jsl-ui 9.18.3 → 9.18.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (213) hide show
  1. package/lib/components/IntervalComponent.d.ts +17 -0
  2. package/lib/components/IntervalComponent.js +68 -0
  3. package/lib/components/auto-suggest/AutoSuggestComponent.d.ts +22 -0
  4. package/lib/components/auto-suggest/AutoSuggestComponent.js +49 -0
  5. package/lib/components/button/ButtonComponent.d.ts +18 -0
  6. package/lib/components/button/ButtonComponent.js +46 -0
  7. package/lib/components/checkbox/CheckBoxComponent.d.ts +28 -0
  8. package/lib/components/checkbox/CheckBoxComponent.js +94 -0
  9. package/lib/components/checkbox/CheckBoxStyle.scss +86 -0
  10. package/lib/components/date/DateComponent.d.ts +32 -0
  11. package/lib/components/date/DateComponent.js +106 -0
  12. package/lib/components/date-range/DateRangeComponent.d.ts +35 -0
  13. package/lib/components/date-range/DateRangeComponent.js +136 -0
  14. package/lib/components/date-range/DateRangeStyle.scss +12 -0
  15. package/lib/components/date-time/DateTimeComponent.d.ts +15 -0
  16. package/lib/components/date-time/DateTimeComponent.js +53 -0
  17. package/lib/components/date-time/DateTimeStyle.scss +7 -0
  18. package/lib/components/dialog/DialogComponent.d.ts +67 -0
  19. package/lib/components/dialog/DialogComponent.js +242 -0
  20. package/lib/components/drop-down/DropDownComponent.d.ts +27 -0
  21. package/lib/components/drop-down/DropDownComponent.js +74 -0
  22. package/lib/components/expander/ExpanderComponent.d.ts +27 -0
  23. package/lib/components/expander/ExpanderComponent.js +90 -0
  24. package/lib/components/expander/ExpanderStyle.scss +47 -0
  25. package/lib/components/expander/OldExpanderStyle.scss +37 -0
  26. package/lib/components/form-field/FormComponent.d.ts +12 -0
  27. package/lib/components/form-field/FormComponent.js +26 -0
  28. package/lib/components/form-field/FormFieldComponent.d.ts +38 -0
  29. package/lib/components/form-field/FormFieldComponent.js +139 -0
  30. package/lib/components/form-field/FormFieldStyle.scss +87 -0
  31. package/lib/components/grid/GridComponent.d.ts +26 -0
  32. package/lib/components/grid/GridComponent.js +116 -0
  33. package/lib/components/input/InputComponent.d.ts +33 -0
  34. package/lib/components/input/InputComponent.js +144 -0
  35. package/lib/components/loading/LoadingComponent.d.ts +8 -0
  36. package/lib/components/loading/LoadingComponent.js +22 -0
  37. package/lib/components/loading/LoadingStyle.css +29 -0
  38. package/lib/components/navigation/NavigationComponent.d.ts +34 -0
  39. package/lib/components/navigation/NavigationComponent.js +70 -0
  40. package/lib/components/navigation/NavigationStyle.scss +226 -0
  41. package/lib/components/notification/Notification.d.ts +17 -0
  42. package/lib/components/notification/Notification.js +56 -0
  43. package/lib/components/notification/Notification.scss +19 -0
  44. package/lib/components/number/NumberComponent.d.ts +25 -0
  45. package/lib/components/number/NumberComponent.js +87 -0
  46. package/lib/components/overlay/OverlayComponent.d.ts +27 -0
  47. package/lib/components/overlay/OverlayComponent.js +149 -0
  48. package/lib/components/overlay/overlay.css +57 -0
  49. package/lib/components/progress/ProgressComponent.d.ts +18 -0
  50. package/lib/components/progress/ProgressComponent.js +42 -0
  51. package/lib/components/progress/ProgressStyle.scss +15 -0
  52. package/lib/components/ribbon-menu/RibbonMenuComponent.d.ts +12 -0
  53. package/lib/components/ribbon-menu/RibbonMenuComponent.js +34 -0
  54. package/lib/components/ribbon-menu/RibbonMenuStyle.scss +76 -0
  55. package/lib/components/select/SelectComponent.d.ts +79 -0
  56. package/lib/components/select/SelectComponent.js +362 -0
  57. package/lib/components/select/SelectDDAreaComponent.d.ts +32 -0
  58. package/lib/components/select/SelectDDAreaComponent.js +317 -0
  59. package/lib/components/select/SelectStyle.scss +187 -0
  60. package/lib/components/slider/nouislider.css +310 -0
  61. package/lib/components/slider/nouislider.d.ts +44 -0
  62. package/lib/components/slider/nouislider.js +2158 -0
  63. package/lib/components/stack-panel/SplitterComponent.d.ts +21 -0
  64. package/lib/components/stack-panel/SplitterComponent.js +126 -0
  65. package/lib/components/stack-panel/SplitterStyle.scss +45 -0
  66. package/lib/components/stack-panel/StackPanelComponent.d.ts +20 -0
  67. package/lib/components/stack-panel/StackPanelComponent.js +64 -0
  68. package/lib/components/stack-panel/StackPanelStyle.scss +53 -0
  69. package/lib/components/tabs/TabsComponent.d.ts +39 -0
  70. package/lib/components/tabs/TabsComponent.js +177 -0
  71. package/lib/components/tabs/TabsStyle.scss +76 -0
  72. package/lib/components/time/TimeComponent.d.ts +29 -0
  73. package/lib/components/time/TimeComponent.js +113 -0
  74. package/lib/components/time/TimeComponent.scss +4 -0
  75. package/lib/components/tree-view/TreeViewComponent.d.ts +23 -0
  76. package/lib/components/tree-view/TreeViewComponent.js +45 -0
  77. package/lib/components/tree-view/TreeViewStyle.scss +96 -0
  78. package/lib/components/virtual-render/VirtualRenderComponent.d.ts +30 -0
  79. package/lib/components/virtual-render/VirtualRenderComponent.js +104 -0
  80. package/lib/components/virtual-render/VirtualRenderStyle.scss +9 -0
  81. package/lib/core/culture.d.ts +5 -0
  82. package/lib/core/culture.js +385 -0
  83. package/lib/core/date.d.ts +14 -0
  84. package/lib/core/date.js +350 -0
  85. package/lib/core/helper.d.ts +12 -0
  86. package/lib/core/helper.js +101 -0
  87. package/lib/core/jq.d.ts +37 -0
  88. package/lib/core/jq.js +371 -0
  89. package/lib/core/lang.d.ts +24 -0
  90. package/lib/core/lang.js +28 -0
  91. package/lib/core/numeric.d.ts +7 -0
  92. package/lib/core/numeric.js +143 -0
  93. package/lib/core/polyfills.d.ts +0 -0
  94. package/lib/core/polyfills.js +22 -0
  95. package/lib/core.d.ts +6 -0
  96. package/lib/core.js +6 -0
  97. package/lib/grid/controls/slick.columnpicker.css +46 -0
  98. package/lib/grid/controls/slick.draggablegrouping.css +52 -0
  99. package/lib/grid/controls/slick.gridmenu.css +127 -0
  100. package/lib/grid/controls/slick.pager.css +41 -0
  101. package/lib/grid/examples/examples.css +203 -0
  102. package/lib/grid/filterDialogs/dateRangeFilter.d.ts +7 -0
  103. package/lib/grid/filterDialogs/dateRangeFilter.js +156 -0
  104. package/lib/grid/filterDialogs/excelFilter.d.ts +9 -0
  105. package/lib/grid/filterDialogs/excelFilter.js +313 -0
  106. package/lib/grid/plugins/ext.overlay.css +28 -0
  107. package/lib/grid/plugins/ext.overlay.d.ts +2 -0
  108. package/lib/grid/plugins/ext.overlay.js +291 -0
  109. package/lib/grid/plugins/slick.cellrangedecorator.d.ts +12 -0
  110. package/lib/grid/plugins/slick.cellrangedecorator.js +68 -0
  111. package/lib/grid/plugins/slick.cellrangeselector.d.ts +1 -0
  112. package/lib/grid/plugins/slick.cellrangeselector.js +144 -0
  113. package/lib/grid/plugins/slick.cellselectionmodel.d.ts +1 -0
  114. package/lib/grid/plugins/slick.cellselectionmodel.js +194 -0
  115. package/lib/grid/plugins/slick.headerbuttons.css +40 -0
  116. package/lib/grid/plugins/slick.headerbuttons.d.ts +55 -0
  117. package/lib/grid/plugins/slick.headerbuttons.js +156 -0
  118. package/lib/grid/plugins/slick.headermenu.css +101 -0
  119. package/lib/grid/plugins/slick.headermenu.d.ts +74 -0
  120. package/lib/grid/plugins/slick.headermenu.js +260 -0
  121. package/lib/grid/plugins/slick.rowdetailview.css +37 -0
  122. package/lib/grid/plugins/slick.rowmovemanager.css +8 -0
  123. package/lib/grid/plugins/slick.rowmovemanager.d.ts +18 -0
  124. package/lib/grid/plugins/slick.rowmovemanager.js +249 -0
  125. package/lib/grid/plugins/slick.rowselectionmodel.d.ts +1 -0
  126. package/lib/grid/plugins/slick.rowselectionmodel.js +167 -0
  127. package/lib/grid/slick-default-theme.css +154 -0
  128. package/lib/grid/slick.core.d.ts +90 -0
  129. package/lib/grid/slick.core.js +574 -0
  130. package/lib/grid/slick.creator.d.ts +80 -0
  131. package/lib/grid/slick.creator.js +723 -0
  132. package/lib/grid/slick.dataview.d.ts +71 -0
  133. package/lib/grid/slick.dataview.js +1080 -0
  134. package/lib/grid/slick.editors.core.d.ts +4 -0
  135. package/lib/grid/slick.editors.core.js +232 -0
  136. package/lib/grid/slick.editors.date.d.ts +2 -0
  137. package/lib/grid/slick.editors.date.js +125 -0
  138. package/lib/grid/slick.editors.lookup.d.ts +14 -0
  139. package/lib/grid/slick.editors.lookup.js +353 -0
  140. package/lib/grid/slick.editors.nav.d.ts +6 -0
  141. package/lib/grid/slick.editors.nav.js +22 -0
  142. package/lib/grid/slick.formatters.d.ts +17 -0
  143. package/lib/grid/slick.formatters.js +137 -0
  144. package/lib/grid/slick.grid.css +325 -0
  145. package/lib/grid/slick.grid.d.ts +284 -0
  146. package/lib/grid/slick.grid.js +5395 -0
  147. package/lib/grid/slick.groupitemmetadataprovider.d.ts +39 -0
  148. package/lib/grid/slick.groupitemmetadataprovider.js +165 -0
  149. package/lib/grid/slick.tree.css +20 -0
  150. package/lib/grid/slick.tree.d.ts +33 -0
  151. package/lib/grid/slick.tree.js +220 -0
  152. package/lib/grid.d.ts +13 -0
  153. package/lib/grid.js +13 -0
  154. package/lib/index.css +2576 -0
  155. package/lib/index.css.map +1 -1
  156. package/lib/index.d.ts +56 -0
  157. package/lib/index.js +61 -10198
  158. package/lib/index.js.map +1 -1
  159. package/lib/interaction/dataconverter.d.ts +4 -0
  160. package/lib/interaction/dataconverter.js +1 -0
  161. package/lib/interaction/eventhandler.d.ts +13 -0
  162. package/lib/interaction/eventhandler.js +42 -0
  163. package/lib/interaction/moveable.css +0 -0
  164. package/lib/interaction/moveable.d.ts +39 -0
  165. package/lib/interaction/moveable.js +172 -0
  166. package/lib/interaction/resizable.css +33 -0
  167. package/lib/interaction/resizable.d.ts +37 -0
  168. package/lib/interaction/resizable.js +123 -0
  169. package/lib/ui/auto.suggest.css +14 -0
  170. package/lib/ui/auto.suggest.d.ts +17 -0
  171. package/lib/ui/auto.suggest.js +255 -0
  172. package/lib/ui/base.css +150 -0
  173. package/lib/ui/date.picker/css/date-range-picker.css +87 -0
  174. package/lib/ui/date.picker/css/tiny-date-picker.css +326 -0
  175. package/lib/ui/date.picker/date-picker-options.d.ts +11 -0
  176. package/lib/ui/date.picker/date-picker-options.js +76 -0
  177. package/lib/ui/date.picker/lib/date-manip.d.ts +74 -0
  178. package/lib/ui/date.picker/lib/date-manip.js +120 -0
  179. package/lib/ui/date.picker/lib/dom.d.ts +23 -0
  180. package/lib/ui/date.picker/lib/dom.js +28 -0
  181. package/lib/ui/date.picker/lib/emitter.d.ts +13 -0
  182. package/lib/ui/date.picker/lib/emitter.js +49 -0
  183. package/lib/ui/date.picker/lib/fns.d.ts +23 -0
  184. package/lib/ui/date.picker/lib/fns.js +43 -0
  185. package/lib/ui/date.picker/mode/base-mode.d.ts +26 -0
  186. package/lib/ui/date.picker/mode/base-mode.js +248 -0
  187. package/lib/ui/date.picker/mode/dropdown-mode.d.ts +28 -0
  188. package/lib/ui/date.picker/mode/dropdown-mode.js +50 -0
  189. package/lib/ui/date.picker/mode/index.d.ts +28 -0
  190. package/lib/ui/date.picker/mode/index.js +18 -0
  191. package/lib/ui/date.picker/mode/modal-mode.d.ts +25 -0
  192. package/lib/ui/date.picker/mode/modal-mode.js +17 -0
  193. package/lib/ui/date.picker/mode/permanent-mode.d.ts +29 -0
  194. package/lib/ui/date.picker/mode/permanent-mode.js +19 -0
  195. package/lib/ui/date.picker/views/day-picker.d.ts +40 -0
  196. package/lib/ui/date.picker/views/day-picker.js +155 -0
  197. package/lib/ui/date.picker/views/month-picker.d.ts +26 -0
  198. package/lib/ui/date.picker/views/month-picker.js +65 -0
  199. package/lib/ui/date.picker/views/year-picker.d.ts +20 -0
  200. package/lib/ui/date.picker/views/year-picker.js +66 -0
  201. package/lib/ui/date.picker.d.ts +66 -0
  202. package/lib/ui/date.picker.js +32 -0
  203. package/lib/ui/dialog.css +109 -0
  204. package/lib/ui/dialog.d.ts +22 -0
  205. package/lib/ui/dialog.js +113 -0
  206. package/lib/ui/drop.down.css +472 -0
  207. package/lib/ui/drop.down.d.ts +52 -0
  208. package/lib/ui/drop.down.js +2112 -0
  209. package/lib/ui/number.input.css +3 -0
  210. package/lib/ui/number.input.d.ts +12 -0
  211. package/lib/ui/number.input.js +64 -0
  212. package/lib/ui/tabs.css +53 -0
  213. package/package.json +1 -1
@@ -0,0 +1,68 @@
1
+ import { jQueryReplacement } from '../../core/jq';
2
+ import { Slick } from '../slick.core';
3
+ var $ = jQueryReplacement;
4
+ // register namespace
5
+ $.deepExtend(Slick, {
6
+ "CellRangeDecorator": CellRangeDecorator
7
+ });
8
+ /***
9
+ * Displays an overlay on top of a given cell range.
10
+ *
11
+ * TODO:
12
+ * Currently, it blocks mouse events to DOM nodes behind it.
13
+ * Use FF and WebKit-specific "pointer-events" CSS style, or some kind of event forwarding.
14
+ * Could also construct the borders separately using 4 individual DIVs.
15
+ *
16
+ * @param {Grid} grid
17
+ * @param {Object} options
18
+ */
19
+ export function CellRangeDecorator(grid, options) {
20
+ var _elem;
21
+ var _defaults = {
22
+ selectionCssClass: 'slick-range-decorator',
23
+ selectionCss: {
24
+ "zIndex": "9999",
25
+ "border": "2px dashed red"
26
+ },
27
+ offset: {
28
+ top: -1,
29
+ left: -1,
30
+ height: -2,
31
+ width: -2
32
+ }
33
+ };
34
+ options = $.deepExtend({}, _defaults, options);
35
+ function show(range) {
36
+ if (!_elem) {
37
+ _elem = $("<div></div>" /*, {css: options.selectionCss}*/)
38
+ .addClass(options.selectionCssClass)
39
+ .css("position", "absolute")
40
+ .appendTo(grid.getActiveCanvasNode());
41
+ if (options.selectionCss) {
42
+ for (var key in options.selectionCss) {
43
+ _elem.css(key, options.selectionCss[key]);
44
+ }
45
+ }
46
+ }
47
+ var from = grid.getCellNodeBox(range.fromRow, range.fromCell);
48
+ var to = grid.getCellNodeBox(range.toRow, range.toCell);
49
+ _elem.css({
50
+ top: from.top + options.offset.top,
51
+ left: from.left + options.offset.left,
52
+ height: to.bottom - from.top + options.offset.height,
53
+ width: to.right - from.left + options.offset.width
54
+ });
55
+ return _elem;
56
+ }
57
+ function hide() {
58
+ if (_elem) {
59
+ _elem.remove();
60
+ _elem = null;
61
+ }
62
+ }
63
+ $.shallowExtend(this, {
64
+ "pluginName": "CellRangeDecorator",
65
+ "show": show,
66
+ "hide": hide
67
+ });
68
+ }
@@ -0,0 +1 @@
1
+ export declare function CellRangeSelector(options: any): void;
@@ -0,0 +1,144 @@
1
+ import { jQueryReplacement } from '../../core/jq';
2
+ import { Slick, Range } from '../slick.core';
3
+ import { CellRangeDecorator } from './slick.cellrangedecorator';
4
+ var $ = jQueryReplacement;
5
+ // register namespace
6
+ $.deepExtend(window, {
7
+ "Slick": {
8
+ "CellRangeSelector": CellRangeSelector
9
+ }
10
+ });
11
+ export function CellRangeSelector(options) {
12
+ var _grid;
13
+ var _currentlySelectedRange;
14
+ var _canvas;
15
+ var _gridOptions;
16
+ var _$activeCanvas;
17
+ var _dragging;
18
+ var _decorator;
19
+ var _self = this;
20
+ var _handler = new Slick.EventHandler();
21
+ var _defaults = {
22
+ selectionCss: {
23
+ "border": "2px dashed blue"
24
+ }
25
+ };
26
+ // Frozen row & column variables
27
+ var _rowOffset;
28
+ var _columnOffset;
29
+ var _isRightCanvas;
30
+ var _isBottomCanvas;
31
+ // Scrollings
32
+ var _scrollTop = 0;
33
+ var _scrollLeft = 0;
34
+ function init(grid) {
35
+ options = $.deepExtend({}, _defaults, options);
36
+ _decorator = options.cellDecorator || new CellRangeDecorator(grid, options);
37
+ _grid = grid;
38
+ _canvas = _grid.getCanvasNode();
39
+ _gridOptions = _grid.getOptions();
40
+ _handler
41
+ .subscribe(_grid.onScroll, handleScroll)
42
+ .subscribe(_grid.onDragInit, handleDragInit)
43
+ .subscribe(_grid.onDragStart, handleDragStart)
44
+ .subscribe(_grid.onDrag, handleDrag)
45
+ .subscribe(_grid.onDragEnd, handleDragEnd);
46
+ }
47
+ function destroy() {
48
+ _handler.unsubscribeAll();
49
+ }
50
+ function getCellDecorator() {
51
+ return _decorator;
52
+ }
53
+ function handleScroll(e, args) {
54
+ _scrollTop = args.scrollTop;
55
+ _scrollLeft = args.scrollLeft;
56
+ }
57
+ function handleDragInit(e, dd) {
58
+ // Set the active canvas node because the decorator needs to append its
59
+ // box to the correct canvas
60
+ _$activeCanvas = $(_grid.getActiveCanvasNode(e));
61
+ var c = _$activeCanvas.offset();
62
+ _rowOffset = 0;
63
+ _columnOffset = 0;
64
+ _isBottomCanvas = _$activeCanvas.hasClass('grid-canvas-bottom');
65
+ if (_gridOptions.frozenRow > -1 && _isBottomCanvas) {
66
+ _rowOffset = (_gridOptions.frozenBottom) ? $('.grid-canvas-bottom').height() : $('.grid-canvas-top').height();
67
+ }
68
+ _isRightCanvas = _$activeCanvas.hasClass('grid-canvas-right');
69
+ if (_gridOptions.frozenColumn > -1 && _isRightCanvas) {
70
+ _columnOffset = $('.grid-canvas-left').width();
71
+ }
72
+ // // prevent the grid from cancelling drag'n'drop by default
73
+ // e.stopImmediatePropagation();
74
+ }
75
+ function handleDragStart(e, dd) {
76
+ var cell = _grid.getCellFromEvent(e);
77
+ if (_self.onBeforeCellRangeSelected.notify(cell) !== false) {
78
+ if (_grid.canCellBeSelected(cell.row, cell.cell)) {
79
+ _dragging = true;
80
+ e.stopImmediatePropagation();
81
+ }
82
+ }
83
+ if (!_dragging) {
84
+ return;
85
+ }
86
+ _grid.focus();
87
+ var startX = dd.startX - $(_canvas).offset().left;
88
+ if (_gridOptions.frozenColumn >= 0 && _isRightCanvas) {
89
+ startX += _scrollLeft;
90
+ }
91
+ var startY = dd.startY - $(_canvas).offset().top;
92
+ if (_gridOptions.frozenRow >= 0 && _isBottomCanvas) {
93
+ startY += _scrollTop;
94
+ }
95
+ var start = _grid.getCellFromPoint(startX, startY);
96
+ dd.range = { start: start, end: {} };
97
+ _currentlySelectedRange = dd.range;
98
+ return _decorator.show(new Range(start.row, start.cell));
99
+ }
100
+ function handleDrag(e, dd) {
101
+ if (!_dragging) {
102
+ return;
103
+ }
104
+ e.stopImmediatePropagation();
105
+ var end = _grid.getCellFromPoint(e.pageX - _$activeCanvas.offset().left + _columnOffset, e.pageY - _$activeCanvas.offset().top + _rowOffset);
106
+ // ... frozen column(s),
107
+ if (_gridOptions.frozenColumn >= 0 && (!_isRightCanvas && (end.cell > _gridOptions.frozenColumn)) || (_isRightCanvas && (end.cell <= _gridOptions.frozenColumn))) {
108
+ return;
109
+ }
110
+ // ... or frozen row(s)
111
+ if (_gridOptions.frozenRow >= 0 && (!_isBottomCanvas && (end.row >= _gridOptions.frozenRow)) || (_isBottomCanvas && (end.row < _gridOptions.frozenRow))) {
112
+ return;
113
+ }
114
+ // ... or regular grid (without any frozen options)
115
+ if (!_grid.canCellBeSelected(end.row, end.cell)) {
116
+ return;
117
+ }
118
+ dd.range.end = end;
119
+ _decorator.show(new Slick.Range(dd.range.start.row, dd.range.start.cell, end.row, end.cell));
120
+ }
121
+ function handleDragEnd(e, dd) {
122
+ if (!_dragging) {
123
+ return;
124
+ }
125
+ _dragging = false;
126
+ e.stopImmediatePropagation();
127
+ _decorator.hide();
128
+ _self.onCellRangeSelected.notify({
129
+ range: new Slick.Range(dd.range.start.row, dd.range.start.cell, dd.range.end.row, dd.range.end.cell)
130
+ });
131
+ }
132
+ function getCurrentRange() {
133
+ return _currentlySelectedRange;
134
+ }
135
+ $.shallowExtend(this, {
136
+ "init": init,
137
+ "destroy": destroy,
138
+ "pluginName": "CellRangeSelector",
139
+ "getCellDecorator": getCellDecorator,
140
+ "getCurrentRange": getCurrentRange,
141
+ "onBeforeCellRangeSelected": new Slick.Event(),
142
+ "onCellRangeSelected": new Slick.Event()
143
+ });
144
+ }
@@ -0,0 +1 @@
1
+ export declare function CellSelectionModel(options?: any): void;
@@ -0,0 +1,194 @@
1
+ import { jQueryReplacement } from '../../core/jq';
2
+ import { Slick, Range } from '../slick.core';
3
+ import { CellRangeSelector } from './slick.cellrangeselector';
4
+ var $ = jQueryReplacement;
5
+ // register namespace
6
+ $.deepExtend(window, {
7
+ "Slick": {
8
+ "CellSelectionModel": CellSelectionModel
9
+ }
10
+ });
11
+ export function CellSelectionModel(options) {
12
+ var _grid;
13
+ var _canvas;
14
+ var _ranges = [];
15
+ var _self = this;
16
+ var _selector;
17
+ if (typeof options === "undefined" || typeof options.cellRangeSelector === "undefined") {
18
+ _selector = new CellRangeSelector({
19
+ "selectionCss": {
20
+ "border": "2px solid black"
21
+ }
22
+ });
23
+ }
24
+ else {
25
+ _selector = options.cellRangeSelector;
26
+ }
27
+ var _options;
28
+ var _defaults = {
29
+ selectActiveCell: true
30
+ };
31
+ function init(grid) {
32
+ _options = $.deepExtend({}, _defaults, options);
33
+ _grid = grid;
34
+ _canvas = _grid.getCanvasNode();
35
+ _grid.onActiveCellChanged.subscribe(handleActiveCellChange);
36
+ _grid.onKeyDown.subscribe(handleKeyDown);
37
+ grid.registerPlugin(_selector);
38
+ _selector.onCellRangeSelected.subscribe(handleCellRangeSelected);
39
+ _selector.onBeforeCellRangeSelected.subscribe(handleBeforeCellRangeSelected);
40
+ }
41
+ function destroy() {
42
+ _grid.onActiveCellChanged.unsubscribe(handleActiveCellChange);
43
+ _grid.onKeyDown.unsubscribe(handleKeyDown);
44
+ _selector.onCellRangeSelected.unsubscribe(handleCellRangeSelected);
45
+ _selector.onBeforeCellRangeSelected.unsubscribe(handleBeforeCellRangeSelected);
46
+ _grid.unregisterPlugin(_selector);
47
+ }
48
+ function removeInvalidRanges(ranges) {
49
+ var result = [];
50
+ for (var i = 0; i < ranges.length; i++) {
51
+ var r = ranges[i];
52
+ if (_grid.canCellBeSelected(r.fromRow, r.fromCell) && _grid.canCellBeSelected(r.toRow, r.toCell)) {
53
+ result.push(r);
54
+ }
55
+ }
56
+ return result;
57
+ }
58
+ function rangesAreEqual(range1, range2) {
59
+ var areDifferent = (range1.length !== range2.length);
60
+ if (!areDifferent) {
61
+ for (var i = 0; i < range1.length; i++) {
62
+ if (range1[i].fromCell !== range2[i].fromCell
63
+ || range1[i].fromRow !== range2[i].fromRow
64
+ || range1[i].toCell !== range2[i].toCell
65
+ || range1[i].toRow !== range2[i].toRow) {
66
+ areDifferent = true;
67
+ break;
68
+ }
69
+ }
70
+ }
71
+ return !areDifferent;
72
+ }
73
+ function setSelectedRanges(ranges) {
74
+ // simple check for: empty selection didn't change, prevent firing onSelectedRangesChanged
75
+ if ((!_ranges || _ranges.length === 0) && (!ranges || ranges.length === 0)) {
76
+ return;
77
+ }
78
+ // if range has not changed, don't fire onSelectedRangesChanged
79
+ var rangeHasChanged = !rangesAreEqual(_ranges, ranges);
80
+ _ranges = removeInvalidRanges(ranges);
81
+ if (rangeHasChanged) {
82
+ _self.onSelectedRangesChanged.notify(_ranges);
83
+ }
84
+ }
85
+ function getSelectedRanges() {
86
+ return _ranges;
87
+ }
88
+ function handleBeforeCellRangeSelected(e, args) {
89
+ if (_grid.getEditorLock().isActive()) {
90
+ e.stopPropagation();
91
+ return false;
92
+ }
93
+ }
94
+ function handleCellRangeSelected(e, args) {
95
+ _grid.setActiveCell(args.range.fromRow, args.range.fromCell, false, false, true);
96
+ setSelectedRanges([args.range]);
97
+ }
98
+ var lastActiveCell;
99
+ function handleActiveCellChange(e, args) {
100
+ if (_options.selectActiveCell && args.row != null && args.cell != null) {
101
+ var metaKey = e.ctrlKey || e.metaKey;
102
+ if (metaKey) {
103
+ var ranges = getSelectedRanges().slice();
104
+ ranges.push(new Range(args.row, args.cell));
105
+ setSelectedRanges(ranges);
106
+ lastActiveCell = { row: args.row, cell: args.cell };
107
+ }
108
+ else if (e.shiftKey) {
109
+ var ranges = getSelectedRanges().slice();
110
+ if (ranges.length > 0) {
111
+ var currentRange = ranges.pop();
112
+ if (lastActiveCell == null) {
113
+ lastActiveCell = { row: currentRange.fromRow, cell: currentRange.fromCell };
114
+ }
115
+ var newRange = new Range(Math.min(lastActiveCell.row, args.row), Math.min(lastActiveCell.cell, args.cell), Math.max(lastActiveCell.row, args.row), Math.max(lastActiveCell.cell, args.cell));
116
+ ranges.push(newRange);
117
+ }
118
+ else {
119
+ ranges.push(new Range(args.row, args.cell));
120
+ lastActiveCell = { row: args.row, cell: args.cell };
121
+ }
122
+ setSelectedRanges(ranges);
123
+ }
124
+ else {
125
+ setSelectedRanges([new Range(args.row, args.cell)]);
126
+ lastActiveCell = { row: args.row, cell: args.cell };
127
+ }
128
+ }
129
+ else if (!_options.selectActiveCell) {
130
+ // clear the previous selection once the cell changes
131
+ setSelectedRanges([]);
132
+ }
133
+ }
134
+ function handleKeyDown(e) {
135
+ /***
136
+ * Кey codes
137
+ * 37 left
138
+ * 38 up
139
+ * 39 right
140
+ * 40 down
141
+ */
142
+ var ranges, last;
143
+ var active = _grid.getActiveCell();
144
+ var metaKey = e.ctrlKey || e.metaKey;
145
+ if (active && e.shiftKey && !metaKey && !e.altKey &&
146
+ (e.which == 37 || e.which == 39 || e.which == 38 || e.which == 40)) {
147
+ ranges = getSelectedRanges().slice();
148
+ if (!ranges.length)
149
+ ranges.push(new Range(active.row, active.cell));
150
+ // keyboard can work with last range only
151
+ last = ranges.pop();
152
+ // can't handle selection out of active cell
153
+ if (!last.contains(active.row, active.cell))
154
+ last = new Range(active.row, active.cell);
155
+ var dRow = last.toRow - last.fromRow, dCell = last.toCell - last.fromCell,
156
+ // walking direction
157
+ dirRow = active.row == last.fromRow ? 1 : -1, dirCell = active.cell == last.fromCell ? 1 : -1;
158
+ if (e.which == 37) {
159
+ dCell -= dirCell;
160
+ }
161
+ else if (e.which == 39) {
162
+ dCell += dirCell;
163
+ }
164
+ else if (e.which == 38) {
165
+ dRow -= dirRow;
166
+ }
167
+ else if (e.which == 40) {
168
+ dRow += dirRow;
169
+ }
170
+ // define new selection range
171
+ var new_last = new Slick.Range(active.row, active.cell, active.row + dirRow * dRow, active.cell + dirCell * dCell);
172
+ if (removeInvalidRanges([new_last]).length) {
173
+ ranges.push(new_last);
174
+ var viewRow = dirRow > 0 ? new_last.toRow : new_last.fromRow;
175
+ var viewCell = dirCell > 0 ? new_last.toCell : new_last.fromCell;
176
+ _grid.scrollRowIntoView(viewRow);
177
+ _grid.scrollCellIntoView(viewRow, viewCell);
178
+ }
179
+ else
180
+ ranges.push(last);
181
+ setSelectedRanges(ranges);
182
+ e.preventDefault();
183
+ e.stopPropagation();
184
+ }
185
+ }
186
+ $.shallowExtend(this, {
187
+ "getSelectedRanges": getSelectedRanges,
188
+ "setSelectedRanges": setSelectedRanges,
189
+ "init": init,
190
+ "destroy": destroy,
191
+ "pluginName": "CellSelectionModel",
192
+ "onSelectedRangesChanged": new Slick.Event()
193
+ });
194
+ }
@@ -0,0 +1,40 @@
1
+ .slick-column-name,
2
+ .slick-sort-indicator {
3
+ /**
4
+ * This makes all "float:right" elements after it that spill over to the next line
5
+ * display way below the lower boundary of the column thus hiding them.
6
+ */
7
+ display: inline-block;
8
+ float: left;
9
+ margin-bottom: 100px;
10
+ }
11
+
12
+ .slick-header-button {
13
+ display: inline-block;
14
+ float: right;
15
+ vertical-align: top;
16
+ margin: 1px;
17
+ margin-right: 2rem;
18
+ /**
19
+ * This makes all "float:right" elements after it that spill over to the next line
20
+ * display way below the lower boundary of the column thus hiding them.
21
+ */
22
+ margin-bottom: 100px;
23
+ height: 15px;
24
+ width: 15px;
25
+ background-repeat: no-repeat;
26
+ background-position: center center;
27
+ cursor: pointer;
28
+ }
29
+
30
+ .slick-header-button-hidden {
31
+ width: 0;
32
+
33
+ -webkit-transition: 0.2s width;
34
+ -ms-transition: 0.2s width;
35
+ transition: 0.2s width;
36
+ }
37
+
38
+ .slick-header-column:hover > .slick-header-button {
39
+ width: 15px;
40
+ }
@@ -0,0 +1,55 @@
1
+ import "./slick.headerbuttons.css";
2
+ /***
3
+ * A plugin to add custom buttons to column headers.
4
+ *
5
+ * USAGE:
6
+ *
7
+ * Add the plugin .js & .css files and register it with the grid.
8
+ *
9
+ * To specify a custom button in a column header, extend the column definition like so:
10
+ *
11
+ * var columns = [
12
+ * {
13
+ * id: 'myColumn',
14
+ * name: 'My column',
15
+ *
16
+ * // This is the relevant part
17
+ * header: {
18
+ * buttons: [
19
+ * {
20
+ * // button options
21
+ * },
22
+ * {
23
+ * // button options
24
+ * }
25
+ * ]
26
+ * }
27
+ * }
28
+ * ];
29
+ *
30
+ * Available button options:
31
+ * cssClass: CSS class to add to the button.
32
+ * image: Relative button image path.
33
+ * tooltip: Button tooltip.
34
+ * showOnHover: Only show the button on hover.
35
+ * handler: Button click handler.
36
+ * command: A command identifier to be passed to the onCommand event handlers.
37
+ *
38
+ * The plugin exposes the following events:
39
+ * onCommand: Fired on button click for buttons with 'command' specified.
40
+ * Event args:
41
+ * grid: Reference to the grid.
42
+ * column: Column definition.
43
+ * command: Button command identified.
44
+ * button: Button options. Note that you can change the button options in your
45
+ * event handler, and the column header will be automatically updated to
46
+ * reflect them. This is useful if you want to implement something like a
47
+ * toggle button.
48
+ *
49
+ *
50
+ * @param options {Object} Options:
51
+ * buttonCssClass: a CSS class to use for buttons (default 'slick-header-button')
52
+ * @class Slick.Plugins.HeaderButtons
53
+ * @constructor
54
+ */
55
+ export declare function HeaderButtons(options: any): void;
@@ -0,0 +1,156 @@
1
+ import "./slick.headerbuttons.css";
2
+ import { Slick } from "../slick.core";
3
+ import { jQueryReplacement } from "../../core/jq";
4
+ var $ = jQueryReplacement;
5
+ // register namespace
6
+ $.deepExtend(window, {
7
+ "Slick": {
8
+ "Plugins": {
9
+ "HeaderButtons": HeaderButtons
10
+ }
11
+ }
12
+ });
13
+ /***
14
+ * A plugin to add custom buttons to column headers.
15
+ *
16
+ * USAGE:
17
+ *
18
+ * Add the plugin .js & .css files and register it with the grid.
19
+ *
20
+ * To specify a custom button in a column header, extend the column definition like so:
21
+ *
22
+ * var columns = [
23
+ * {
24
+ * id: 'myColumn',
25
+ * name: 'My column',
26
+ *
27
+ * // This is the relevant part
28
+ * header: {
29
+ * buttons: [
30
+ * {
31
+ * // button options
32
+ * },
33
+ * {
34
+ * // button options
35
+ * }
36
+ * ]
37
+ * }
38
+ * }
39
+ * ];
40
+ *
41
+ * Available button options:
42
+ * cssClass: CSS class to add to the button.
43
+ * image: Relative button image path.
44
+ * tooltip: Button tooltip.
45
+ * showOnHover: Only show the button on hover.
46
+ * handler: Button click handler.
47
+ * command: A command identifier to be passed to the onCommand event handlers.
48
+ *
49
+ * The plugin exposes the following events:
50
+ * onCommand: Fired on button click for buttons with 'command' specified.
51
+ * Event args:
52
+ * grid: Reference to the grid.
53
+ * column: Column definition.
54
+ * command: Button command identified.
55
+ * button: Button options. Note that you can change the button options in your
56
+ * event handler, and the column header will be automatically updated to
57
+ * reflect them. This is useful if you want to implement something like a
58
+ * toggle button.
59
+ *
60
+ *
61
+ * @param options {Object} Options:
62
+ * buttonCssClass: a CSS class to use for buttons (default 'slick-header-button')
63
+ * @class Slick.Plugins.HeaderButtons
64
+ * @constructor
65
+ */
66
+ export function HeaderButtons(options) {
67
+ var _grid;
68
+ var _self = this;
69
+ var _handler = new Slick.EventHandler();
70
+ var _defaults = {
71
+ buttonCssClass: "slick-header-button"
72
+ };
73
+ function init(grid) {
74
+ options = $.deepExtend({}, _defaults, options);
75
+ _grid = grid;
76
+ _handler
77
+ .subscribe(_grid.onHeaderCellRendered, handleHeaderCellRendered)
78
+ .subscribe(_grid.onBeforeHeaderCellDestroy, handleBeforeHeaderCellDestroy);
79
+ // Force the grid to re-render the header now that the events are hooked up.
80
+ _grid.setColumns(_grid.getColumns());
81
+ }
82
+ function destroy() {
83
+ _handler.unsubscribeAll();
84
+ }
85
+ function handleHeaderCellRendered(e, args) {
86
+ var column = args.column;
87
+ if (column.header && column.header.buttons) {
88
+ // Append buttons in reverse order since they are floated to the right.
89
+ var i = column.header.buttons.length;
90
+ while (i--) {
91
+ var button = column.header.buttons[i];
92
+ var btn = $("<div></div>")
93
+ .addClass(options.buttonCssClass)
94
+ .data("column", column)
95
+ .data("button", button);
96
+ if (button.showOnHover) {
97
+ btn.addClass("slick-header-button-hidden");
98
+ }
99
+ if (button.image) {
100
+ btn.css("backgroundImage", "url(" + button.image + ")");
101
+ }
102
+ if (button.html) {
103
+ btn.html(button.html);
104
+ }
105
+ if (button.cssClass) {
106
+ btn.addClass(button.cssClass);
107
+ }
108
+ if (button.tooltip) {
109
+ btn.attr("title", button.tooltip);
110
+ }
111
+ if (button.command) {
112
+ btn.data("command", button.command);
113
+ }
114
+ if (button.handler) {
115
+ btn.on("click", button.handler);
116
+ }
117
+ btn
118
+ .on("click", handleButtonClick)
119
+ .appendTo(args.node);
120
+ }
121
+ }
122
+ }
123
+ function handleBeforeHeaderCellDestroy(e, args) {
124
+ var column = args.column;
125
+ if (column.header && column.header.buttons) {
126
+ // Removing buttons via jQuery will also clean up any event handlers and data.
127
+ // NOTE: If you attach event handlers directly or using a different framework,
128
+ // you must also clean them up here to avoid memory leaks.
129
+ $(args.node).find("." + options.buttonCssClass).remove();
130
+ }
131
+ }
132
+ function handleButtonClick(e) {
133
+ var command = $(this).data("command");
134
+ var columnDef = $(this).data("column");
135
+ var button = $(this).data("button");
136
+ if (command != null) {
137
+ _self.onCommand.notify({
138
+ "grid": _grid,
139
+ "column": columnDef,
140
+ "command": command,
141
+ "button": button
142
+ }, e, _self);
143
+ // Update the header in case the user updated the button definition in the handler.
144
+ _grid.updateColumnHeader(columnDef.id);
145
+ }
146
+ // Stop propagation so that it doesn't register as a header click event.
147
+ e.preventDefault();
148
+ e.stopPropagation();
149
+ }
150
+ $.shallowExtend(this, {
151
+ "init": init,
152
+ "destroy": destroy,
153
+ "pluginName": "HeaderButtons",
154
+ "onCommand": new Slick.Event()
155
+ });
156
+ }