项目作者: ne0guille

项目描述 :
split panel custom attribute for aurelia framework
高级语言: JavaScript
项目地址: git://github.com/ne0guille/aurelia-split-panel.git
创建时间: 2017-08-21T15:34:31Z
项目社区:https://github.com/ne0guille/aurelia-split-panel

开源协议:Other

下载


Simply aurelia custom attribute to split screen using https://github.com/nathancahill/Split.js

demo
https://ne0guille-aurelia-split-panel.azurewebsites.net/

Installation

npm install aurelia-split-panel --save

Plugin Setup
aurelia.use.plugin(PLATFORM.moduleName('aurelia-split-panel'));

add style in webpack
'aurelia-split-panel/dist/aurelia-split-panel.css'

Usage
split-panel custom attribute needs to be placed on the parent of the panels to be splitted.
Panels must specify an Id.

If the parent doesnt’t have a height and the clientHeight is also 0, it will take the childrens panel height;

  1. <div split-panel style="height: 200px">
  2. <div id="panel1">
  3. <p>test</p>
  4. <a>test</a>
  5. <a>test</a>
  6. </div>
  7. <div id="panel2">
  8. <p>test</p>
  9. <a>test</a>
  10. <a>test</a>
  11. </div>
  12. </div>

Options
https://nathancahill.github.io/Split.js/

  1. sizes: Array<number>; Initial sizes of each element in percents.
  2. minSize: Array<number> | number = 100; Minimum size of each element in pixels.
  3. gutterSize: number = 10; Gutter size in pixels.
  4. vertical: boolean = false; Direction to split: horizontal or vertical.
  5. initialize: boolean = true; The split its initialize by default when the element is attached.
  1. <div split-panel="sizes.bind: sizesArray; min-size.bind: minSizeProp; gutter-size: 5; vertical: true; initialize: false ">
  2. <div id="panel1">
  3. <p>test</p>
  4. <a>test</a>
  5. <a>test</a>
  6. </div>
  7. <div id="panel2">
  8. <p>test</p>
  9. <a>test</a>
  10. <a>test</a>
  11. </div>
  12. </div>

SplitService
You can trigger programatically the following methods using the SplitService class.

  1. create(options: SplitOptions): void;
  2. setSizes(sizes: number[]): void;
  3. destroy(): void;

Dependencies
“split.js”: https://nathancahill.github.io/Split.js/