jsl-ui 9.18.3 → 9.19.0

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 +18 -0
  171. package/lib/ui/auto.suggest.js +258 -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,313 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
13
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
14
+ return new (P || (P = Promise))(function (resolve, reject) {
15
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
16
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
17
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
18
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
19
+ });
20
+ };
21
+ var __generator = (this && this.__generator) || function (thisArg, body) {
22
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
23
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
24
+ function verb(n) { return function (v) { return step([n, v]); }; }
25
+ function step(op) {
26
+ if (f) throw new TypeError("Generator is already executing.");
27
+ while (_) try {
28
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
29
+ if (y = 0, t) op = [op[0] & 2, t.value];
30
+ switch (op[0]) {
31
+ case 0: case 1: t = op; break;
32
+ case 4: _.label++; return { value: op[1], done: false };
33
+ case 5: _.label++; y = op[1]; op = [0]; continue;
34
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
35
+ default:
36
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
37
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
38
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
39
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
40
+ if (t[2]) _.ops.pop();
41
+ _.trys.pop(); continue;
42
+ }
43
+ op = body.call(thisArg, _);
44
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
45
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
46
+ }
47
+ };
48
+ import { UILang } from "../../core/lang";
49
+ import { helper } from "../../core/helper";
50
+ import { Dialog } from "../../ui/dialog";
51
+ import { VirtualRenderComponent } from "../../components/virtual-render/VirtualRenderComponent";
52
+ import { JSLRender } from "jsl-render";
53
+ var ExcelFilter = /** @class */ (function () {
54
+ function ExcelFilter(grid) {
55
+ this.grid = grid;
56
+ }
57
+ ExcelFilter.convertRemToPixels = function (rem) {
58
+ return rem * parseFloat(getComputedStyle(document.documentElement).fontSize);
59
+ };
60
+ ExcelFilter.prototype.show = function (col) {
61
+ return __awaiter(this, void 0, void 0, function () {
62
+ var values, filters, currentFilters, mode, filterOptions, oldCheckedValues, _i, currentFilters_1, f, dlg, dlgBody, id, search, cbAllContainer, cbAll, cbAllLabel, sortedValues, _a, values_1, x, o, visibleValues, checkedValues, cbContainer, rowHeight, height, vr, renderer, dlgObj, dlgOkButton, dlgCancelButton, dlgClearButton;
63
+ var _this = this;
64
+ return __generator(this, function (_b) {
65
+ switch (_b.label) {
66
+ case 0:
67
+ filters = this.grid.getFilters();
68
+ currentFilters = filters.filter(function (f) { return f.columnId === col.id; });
69
+ mode = this.grid.getOptions().mode;
70
+ filterOptions = this.grid.getOptions().getFilterValues;
71
+ if (!(filterOptions == null)) return [3 /*break*/, 1];
72
+ if (mode === "client") {
73
+ // remove any filters for this column
74
+ if (currentFilters.length > 0) {
75
+ this.grid.clearFilter(col.id);
76
+ }
77
+ values = this.getDistinctValues(col);
78
+ }
79
+ else {
80
+ throw new Error("getFilterValues option has to be set when filter mode = server");
81
+ }
82
+ return [3 /*break*/, 3];
83
+ case 1: return [4 /*yield*/, filterOptions(col)];
84
+ case 2:
85
+ values = _b.sent();
86
+ _b.label = 3;
87
+ case 3:
88
+ oldCheckedValues = {};
89
+ if (currentFilters.length > 0) {
90
+ for (_i = 0, currentFilters_1 = currentFilters; _i < currentFilters_1.length; _i++) {
91
+ f = currentFilters_1[_i];
92
+ if (f._checkedValues) {
93
+ oldCheckedValues = f._checkedValues;
94
+ }
95
+ if (mode === "client") {
96
+ filters.push(f);
97
+ }
98
+ }
99
+ if (mode === "client") {
100
+ this.grid.refreshFilters();
101
+ }
102
+ }
103
+ dlg = document.createElement("div");
104
+ dlg.classList.add("jsl-dialog-overlay");
105
+ dlg.innerHTML = '<div class="jsl-dialog" style="width:50vw;min-height:50vh;"><div class="dlg-header">' + UILang.grid.Filter + '</div><div class="dlg-body" style="max-height:calc(100vh - 7.5rem)"></div>' +
106
+ '<div class="dlg-footer">' +
107
+ '<button class="jsl-button ok-button">' + UILang.core.Ok + "</button>" +
108
+ (currentFilters.length > 0 ? ('<button class="jsl-button clear-button">' + UILang.grid.ClearFilter + '</button>') : "") +
109
+ '<button class="jsl-button close-button">' + UILang.core.Cancel + "</button>" +
110
+ "</div></div>";
111
+ dlgBody = dlg.querySelector(".dlg-body");
112
+ id = helper.newDomGuid();
113
+ search = document.createElement("div");
114
+ search.innerHTML = "<input type='text' placeholder='" + UILang.grid.Search + "' />";
115
+ dlgBody.appendChild(search);
116
+ cbAllContainer = document.createElement("div");
117
+ cbAll = document.createElement("input");
118
+ cbAll.type = "checkbox";
119
+ cbAll.id = id;
120
+ cbAllContainer.appendChild(cbAll);
121
+ cbAllLabel = document.createElement("label");
122
+ cbAllLabel.setAttribute("for", id);
123
+ cbAllLabel.textContent = UILang.core.All;
124
+ cbAllLabel.style.cursor = "pointer";
125
+ cbAllLabel.style.marginLeft = "0.2rem";
126
+ cbAllContainer.appendChild(cbAllLabel);
127
+ dlgBody.appendChild(cbAllContainer);
128
+ sortedValues = [];
129
+ if (Array.isArray(values)) {
130
+ for (_a = 0, values_1 = values; _a < values_1.length; _a++) {
131
+ x = values_1[_a];
132
+ sortedValues.push({ id: [x], txt: x !== null && x !== void 0 ? x : "" });
133
+ }
134
+ }
135
+ else {
136
+ for (o in values) {
137
+ if (values.hasOwnProperty(o)) {
138
+ sortedValues.push({ id: values[o], txt: o !== null && o !== void 0 ? o : "" });
139
+ }
140
+ }
141
+ }
142
+ // TODO: use custom comparer when available
143
+ sortedValues.sort(function (a, b) { return a.txt.toLocaleLowerCase() < b.txt.toLocaleLowerCase() ? -1 : (a.txt.toLocaleLowerCase() > b.txt.toLocaleLowerCase() ? 1 : 0); });
144
+ visibleValues = sortedValues;
145
+ checkedValues = __assign({}, oldCheckedValues);
146
+ cbContainer = document.createElement("div");
147
+ dlgBody.appendChild(cbContainer);
148
+ rowHeight = Math.round(ExcelFilter.convertRemToPixels(1.4));
149
+ height = sortedValues.length * rowHeight;
150
+ height = Math.min(height, Math.round(window.innerHeight - ExcelFilter.convertRemToPixels(13)));
151
+ vr = new VirtualRenderComponent({
152
+ data: visibleValues,
153
+ renderRow: function (args) {
154
+ args.container.attr.style["padding-left"] = "1rem";
155
+ args.container.children.push({
156
+ tag: "input",
157
+ attr: {
158
+ id: id + "_" + args.index,
159
+ checked: checkedValues[args.rowData.id[0]] ? "checked" : undefined,
160
+ change: function (_, node) {
161
+ if (node.dom.checked) {
162
+ for (var _i = 0, _a = args.rowData.id; _i < _a.length; _i++) {
163
+ var selId = _a[_i];
164
+ checkedValues[selId] = true;
165
+ }
166
+ }
167
+ else {
168
+ for (var _b = 0, _c = args.rowData.id; _b < _c.length; _b++) {
169
+ var selId = _c[_b];
170
+ delete checkedValues[selId];
171
+ }
172
+ }
173
+ // check if all values or none are checked
174
+ var allChecked = Object.getOwnPropertyNames(checkedValues).length === sortedValues.length;
175
+ var allCb = dlgBody.querySelector("#" + id);
176
+ allCb.checked = allChecked;
177
+ },
178
+ type: "checkbox"
179
+ }
180
+ });
181
+ args.container.children.push({
182
+ tag: "label",
183
+ attr: {
184
+ for: id + "_" + args.index,
185
+ style: "margin-left:0.2rem;cursor:pointer"
186
+ },
187
+ raw: true,
188
+ content: args.rowData.txt
189
+ });
190
+ },
191
+ rowHeight: rowHeight,
192
+ style: "height:" + height + "px"
193
+ });
194
+ renderer = new JSLRender(cbContainer, false);
195
+ renderer.render(vr);
196
+ search.addEventListener("input", function (evt) {
197
+ var _a;
198
+ var term = ((_a = evt.target.value) !== null && _a !== void 0 ? _a : "").toLowerCase();
199
+ if (term) {
200
+ visibleValues = sortedValues.filter(function (x) { var _a; return ((_a = x.txt) !== null && _a !== void 0 ? _a : "").toLowerCase().indexOf(term) >= 0; });
201
+ }
202
+ else {
203
+ visibleValues = sortedValues;
204
+ }
205
+ vr.setData(visibleValues);
206
+ renderer.refresh();
207
+ });
208
+ cbAll.addEventListener("change", function () {
209
+ for (var i = 0; i < visibleValues.length; i++) {
210
+ // if (cbAll.checked) {
211
+ // checkedValues[visibleValues[i].id] = true;
212
+ // } else {
213
+ // delete checkedValues[visibleValues[i].id];
214
+ // }
215
+ if (cbAll.checked) {
216
+ for (var _i = 0, _a = visibleValues[i].id; _i < _a.length; _i++) {
217
+ var selId = _a[_i];
218
+ checkedValues[selId] = true;
219
+ }
220
+ }
221
+ else {
222
+ for (var _b = 0, _c = visibleValues[i].id; _b < _c.length; _b++) {
223
+ var selId = _c[_b];
224
+ delete checkedValues[selId];
225
+ }
226
+ }
227
+ }
228
+ renderer.refresh();
229
+ });
230
+ document.body.appendChild(dlg);
231
+ dlgObj = Dialog(dlg, {
232
+ autoOpen: true, onClose: function () {
233
+ dlg.innerHTML = "";
234
+ dlg.parentElement.removeChild(dlg);
235
+ }
236
+ });
237
+ dlgOkButton = dlg.querySelector(".dlg-footer .ok-button");
238
+ dlgOkButton.addEventListener("click", function (evt) {
239
+ var selLength = Object.getOwnPropertyNames(checkedValues).length;
240
+ var allChecked = selLength === sortedValues.length;
241
+ var anyChecked = selLength > 0;
242
+ _this.grid.clearFilter(col.id, true);
243
+ if (!allChecked && anyChecked) {
244
+ // something (but not everything) was selected -> filter
245
+ var filterObject = {
246
+ field: col.field, columnId: col.id, match: mode === "server" ? function () { return true; } : function (item, field) {
247
+ return !!checkedValues[_this.grid.getDataItemValueForColumn(item, col)];
248
+ }
249
+ };
250
+ filterObject._checkedValues = checkedValues;
251
+ _this.grid.addFilter(filterObject, true);
252
+ }
253
+ _this.grid.refreshFilters();
254
+ dlgObj.close();
255
+ });
256
+ dlgCancelButton = dlg.querySelector(".dlg-footer .close-button");
257
+ dlgCancelButton.addEventListener("click", function (evt) {
258
+ dlgObj.close();
259
+ });
260
+ dlgClearButton = dlg.querySelector(".dlg-footer .clear-button");
261
+ if (dlgClearButton != null) {
262
+ dlgClearButton.addEventListener("click", function (evt) {
263
+ _this.grid.clearFilter(col.id);
264
+ dlgObj.close();
265
+ });
266
+ }
267
+ return [2 /*return*/];
268
+ }
269
+ });
270
+ });
271
+ };
272
+ // private updateStateOfAllCheckebox(dlgBody: HTMLElement, id: string) {
273
+ // let counter = 0;
274
+ // let el: HTMLInputElement;
275
+ // const allCb: HTMLInputElement = dlgBody.querySelector("#" + id) as HTMLInputElement;
276
+ // // tslint:disable-next-line: no-conditional-assignment
277
+ // while (null != (el = dlgBody.querySelector("#" + id + "_" + counter) as HTMLInputElement)) {
278
+ // if (el.parentElement.style.display !== "none" && !el.checked) {
279
+ // allCb.checked = false;
280
+ // return;
281
+ // }
282
+ // counter++;
283
+ // }
284
+ // allCb.checked = true;
285
+ // }
286
+ // private checkAllVisibleBoxes(el: HTMLElement, state: boolean) {
287
+ // const checkboxes = el.querySelectorAll("input");
288
+ // for (let i = 0; i < checkboxes.length; i++) {
289
+ // if (checkboxes[i].type === "checkbox" &&
290
+ // checkboxes[i].parentElement.style.display !== "none") {
291
+ // checkboxes[i].checked = state;
292
+ // }
293
+ // }
294
+ // }
295
+ ExcelFilter.prototype.getDistinctValues = function (col) {
296
+ var textToValues = {};
297
+ for (var idx = 0, len = this.grid.getDataLength(); idx < len; idx++) {
298
+ var item = this.grid.getDataItem(idx);
299
+ var value = this.grid.getDataItemValueForColumn(item, col);
300
+ var text = this.grid.getFormattedValue(col, value, item);
301
+ var valueList = textToValues[text];
302
+ if (valueList == null) {
303
+ valueList = textToValues[text] = [];
304
+ }
305
+ if (valueList.indexOf(value) < 0) {
306
+ valueList.push(value);
307
+ }
308
+ }
309
+ return textToValues;
310
+ };
311
+ return ExcelFilter;
312
+ }());
313
+ export { ExcelFilter };
@@ -0,0 +1,28 @@
1
+
2
+ .header-overlay {
3
+ background-color: #217346;
4
+ }
5
+
6
+ .cell-overlay,
7
+ .selection-cell-overlay {
8
+ display: block;
9
+ position: absolute;
10
+ z-index: 20;
11
+ background-color: #217346;
12
+ }
13
+
14
+ .handle-overlay {
15
+ border: 1px solid white;
16
+ padding: 3px;
17
+ background-color: #217346;
18
+ position: absolute;
19
+ width: 2px;
20
+ height: 2px;
21
+ z-index: 20;
22
+ cursor: crosshair;
23
+ }
24
+
25
+ .overlay-handle-decorator {
26
+ border: 2px solid #217346;
27
+ z-index: 20;
28
+ }
@@ -0,0 +1,2 @@
1
+ import "./ext.overlay.css";
2
+ export declare function Overlays(options: any): void;
@@ -0,0 +1,291 @@
1
+ import "./ext.overlay.css";
2
+ import { jQueryReplacement } from "../../core/jq";
3
+ import { Slick } from "../slick.core";
4
+ import { Moveable } from "../../interaction/moveable";
5
+ import { EventHandler } from "../../interaction/eventhandler";
6
+ var selectinOverlayWidth = 1;
7
+ var $ = jQueryReplacement;
8
+ // register namespace
9
+ $.deepExtend(window, {
10
+ "Ext": {
11
+ "Plugins": {
12
+ "Overlays": Overlays
13
+ }
14
+ }
15
+ });
16
+ export function Overlays(options) {
17
+ var $headerOverlay;
18
+ var $rowOverlay;
19
+ var selectionOverlay;
20
+ var currentColumn;
21
+ var handleDragging;
22
+ var grid;
23
+ var self = this;
24
+ var handler = new Slick.EventHandler();
25
+ var dragDecorator;
26
+ var defaults = {
27
+ buttonCssClass: null,
28
+ buttonImage: "../images/down.gif",
29
+ decoratorWidth: 2
30
+ };
31
+ function init(g) {
32
+ options = $.deepExtend({}, defaults, options);
33
+ grid = g;
34
+ dragDecorator = overlayRangeDecorator(grid);
35
+ $headerOverlay = createRowHeaderOverlay(100);
36
+ $rowOverlay = createRowHeaderOverlay(100);
37
+ selectionOverlay = createSelectionOverlay();
38
+ handler.subscribe(grid.onActiveCellChanged, activeCellChanged)
39
+ .subscribe(grid.onColumnsResized, columnResized)
40
+ .subscribe(grid.onScroll, gridScrolled);
41
+ }
42
+ function destroy() {
43
+ handler.unsubscribeAll();
44
+ }
45
+ function createRowHeaderOverlay(zIndex) {
46
+ return $(document.createElement("div"))
47
+ .addClass("header-overlay")
48
+ .css("position", "absolute")
49
+ .css("z-index", zIndex)
50
+ .appendTo(grid.getContainerNode());
51
+ }
52
+ function createSelectionOverlay() {
53
+ var canvas = grid.getCanvasNode();
54
+ var overlay = new Overlay(canvas, true);
55
+ return overlay;
56
+ }
57
+ function activeCellChanged(e, args) {
58
+ dragDecorator.hide();
59
+ moveSelectionOverlay(e, args);
60
+ moveHeaderRowOverlays(e, args);
61
+ }
62
+ function columnResized(e, args) {
63
+ moveHeaderRowOverlays(e, args);
64
+ moveSelectionOverlay(e, args);
65
+ }
66
+ function gridScrolled(e, args) {
67
+ moveHeaderRowOverlays(e, args);
68
+ moveSelectionOverlay(e, args);
69
+ }
70
+ function moveHeaderRowOverlays(e, args) {
71
+ if (typeof args.cell != 'undefined') {
72
+ currentColumn = args.cell;
73
+ }
74
+ else {
75
+ if (!currentColumn) {
76
+ return;
77
+ }
78
+ }
79
+ if (!grid.getActiveCell()) {
80
+ $rowOverlay.css("display", "none");
81
+ return;
82
+ }
83
+ $rowOverlay.css("display", "");
84
+ var headerHeight = grid.getContainerNode().querySelector('.slick-header').getBoundingClientRect().height;
85
+ var cellPosition = grid.getActiveCellPosition();
86
+ var gridPosition = grid.getGridPosition();
87
+ $rowOverlay.css("display", cellPosition.visible ? "" : "none");
88
+ $headerOverlay.css("display", cellPosition.visible ? "" : "none");
89
+ var headerWidth = cellPosition.width;
90
+ $headerOverlay.css("left", (cellPosition.left - gridPosition.left) + "px").css("top", (headerHeight - 2) + "px").css("width", headerWidth + "px").css("height", "2px");
91
+ $rowOverlay.css("left", "0px").css("top", (cellPosition.top - gridPosition.top) + "px").css("width", "2px").css("height", cellPosition.height + "px");
92
+ }
93
+ function moveSelectionOverlay(e, args) {
94
+ var activeCell = grid.getActiveCell();
95
+ if (!activeCell) {
96
+ selectionOverlay.toggle(false);
97
+ return;
98
+ }
99
+ var column = grid.getColumns()[activeCell.cell];
100
+ selectionOverlay.toggle(true);
101
+ // Only show the handle if the cell is editable
102
+ selectionOverlay.handle.style.display = (column.editor != null && !column.readonly && grid.getOptions().editable) ? "" : "none";
103
+ var position = grid.getCellNodeBox(activeCell.row, activeCell.cell);
104
+ // Not coming through on the property so re-calculated
105
+ position.height = position.bottom - position.top;
106
+ position.width = position.right - position.left;
107
+ selectionOverlay.$left.css({
108
+ left: (position.left - selectinOverlayWidth) + "px",
109
+ top: position.top + "px",
110
+ width: selectinOverlayWidth + "px",
111
+ height: position.height + "px"
112
+ });
113
+ selectionOverlay.$right.css({
114
+ left: (position.left + position.width) + "px",
115
+ top: position.top + "px",
116
+ width: selectinOverlayWidth + "px",
117
+ height: position.height + "px"
118
+ });
119
+ selectionOverlay.$top.css({
120
+ left: (position.left - selectinOverlayWidth) + "px",
121
+ top: (position.top - selectinOverlayWidth) + "px",
122
+ width: (position.width + selectinOverlayWidth + 1) + "px",
123
+ height: selectinOverlayWidth + "px"
124
+ });
125
+ selectionOverlay.$bottom.css({
126
+ left: (position.left - selectinOverlayWidth) + "px",
127
+ top: (position.top + position.height) + "px",
128
+ width: (position.width + selectinOverlayWidth + 1) + "px",
129
+ height: selectinOverlayWidth + "px"
130
+ });
131
+ selectionOverlay.handle.style.left = (position.left + position.width - 4) + "px";
132
+ selectionOverlay.handle.style.top = (position.top + position.height - 4) + "px";
133
+ // console.log("row: " + activeCell.row + " - cell: "+ activeCell.cell);
134
+ // console.log("container: " + grid.getCanvasNode(activeCell.row, activeCell.cell).className);
135
+ selectionOverlay.moveToContainer(grid.getCanvasNode(activeCell.cell, activeCell.row));
136
+ }
137
+ var dd_range;
138
+ function handleOverlayDragStart(e) {
139
+ var cell = grid.getActiveCell();
140
+ if (grid.canCellBeSelected(cell.row, cell.cell)) {
141
+ handleDragging = true;
142
+ }
143
+ if (!handleDragging) {
144
+ e.cancelEvent();
145
+ return null;
146
+ }
147
+ grid.focus();
148
+ dd_range = { start: cell, end: {} };
149
+ return dragDecorator.show(new Slick.Range(cell.row, cell.cell));
150
+ }
151
+ function handleOverlayDrag(e) {
152
+ if (!handleDragging) {
153
+ return;
154
+ }
155
+ var end = {
156
+ cell: dd_range.start.cell, row: grid.getCellFromPoint(0, e.y /* + grid.getCanvasNode().scrollTop*/).row - 1
157
+ };
158
+ if (!grid.canCellBeSelected(end.row, end.cell)) {
159
+ e.cancelEvent(); // ?
160
+ return;
161
+ }
162
+ dd_range.end = end;
163
+ dragDecorator.show(new Slick.Range(dd_range.start.row, dd_range.start.cell, end.row, dd_range.start.cell));
164
+ }
165
+ function handleOverlayDragEnd(e) {
166
+ if (!handleDragging) {
167
+ return;
168
+ }
169
+ handleDragging = false;
170
+ selectionOverlay.handle.style.display = "none";
171
+ self.onFillUpDown.notify({ "grid": grid, "range": dragDecorator.getSelectedRange(), direction: dd_range.end.row >= dd_range.start.row ? "down" : "up" }, e, self);
172
+ }
173
+ function Overlay(target, withHandel, prefix) {
174
+ var className = (prefix || '') + 'cell-overlay';
175
+ this.$left = $(document.createElement("div"))
176
+ .addClass(className)
177
+ .addClass('left')
178
+ .appendTo(target);
179
+ this.$right = $(document.createElement("div"))
180
+ .addClass(className)
181
+ .addClass('right')
182
+ .appendTo(target);
183
+ this.$top = $(document.createElement("div"))
184
+ .addClass(className)
185
+ .addClass('top')
186
+ .appendTo(target);
187
+ this.$bottom = $(document.createElement("div"))
188
+ .addClass(className)
189
+ .addClass('bottom')
190
+ .appendTo(target);
191
+ if (withHandel) {
192
+ this.handle = document.createElement("div");
193
+ this.handle.classList.add("handle-overlay");
194
+ target.appendChild(this.handle);
195
+ var gridContainer = target.closest(".slickgrid");
196
+ var viewports = gridContainer.querySelectorAll(".grid-canvas");
197
+ for (var idx = 0; idx < viewports.length; idx++) {
198
+ console.log(idx);
199
+ Moveable(viewports[idx], {
200
+ selector: ".handle-overlay",
201
+ direction: "y",
202
+ gridY: grid.getOptions().rowHeight,
203
+ containInParent: false,
204
+ onStart: EventHandler.Create(function (e) {
205
+ handleOverlayDragStart(e);
206
+ }),
207
+ onMove: EventHandler.Create(function (e) {
208
+ handleOverlayDrag(e);
209
+ }),
210
+ onStop: EventHandler.Create(function (e) {
211
+ handleOverlayDragEnd(e);
212
+ })
213
+ });
214
+ }
215
+ }
216
+ this.moveToContainer = function (container) {
217
+ this.$left.appendTo(container);
218
+ this.$right.appendTo(container);
219
+ this.$top.appendTo(container);
220
+ this.$bottom.appendTo(container);
221
+ if (this.handle) {
222
+ $(this.handle).appendTo(container);
223
+ }
224
+ };
225
+ this.toggle = function (showOrHide) {
226
+ this.$left.css("display", showOrHide ? "" : "none");
227
+ this.$right.css("display", showOrHide ? "" : "none");
228
+ this.$top.css("display", showOrHide ? "" : "none");
229
+ this.$bottom.css("display", showOrHide ? "" : "none");
230
+ if (this.handle) {
231
+ this.handle.style.display = showOrHide ? "" : "none";
232
+ }
233
+ };
234
+ }
235
+ function overlayRangeDecorator(targetGrid) {
236
+ var decorator;
237
+ var r;
238
+ function show(range) {
239
+ r = range;
240
+ if (!decorator) {
241
+ decorator = new Overlay(grid.getCanvasNode(range.fromCell, range.fromRow), false, 'selection-');
242
+ }
243
+ var from = targetGrid.getCellNodeBox(range.fromRow, range.fromCell);
244
+ var to = targetGrid.getCellNodeBox(range.toRow, range.toCell);
245
+ decorator.$left.css({
246
+ top: from.top - 2,
247
+ left: from.left - 2,
248
+ height: to.bottom - from.top + 2,
249
+ width: options.decoratorWidth
250
+ });
251
+ decorator.$right.css({
252
+ top: from.top - 2,
253
+ left: to.right - 1,
254
+ height: to.bottom - from.top + 2,
255
+ width: options.decoratorWidth
256
+ });
257
+ decorator.$top.css({
258
+ top: from.top - 2,
259
+ left: to.left - 1,
260
+ height: options.decoratorWidth,
261
+ width: to.right - from.left + 2
262
+ });
263
+ decorator.$bottom.css({
264
+ top: to.bottom - 1,
265
+ left: from.left - 2,
266
+ height: options.decoratorWidth,
267
+ width: to.right - from.left + 3
268
+ });
269
+ return decorator;
270
+ }
271
+ function getSelectedRange() {
272
+ return r;
273
+ }
274
+ function hide() {
275
+ if (decorator) {
276
+ decorator.toggle(false);
277
+ decorator = null;
278
+ }
279
+ }
280
+ return {
281
+ hide: hide,
282
+ show: show,
283
+ getSelectedRange: getSelectedRange
284
+ };
285
+ }
286
+ $.shallowExtend(this, {
287
+ "init": init,
288
+ "destroy": destroy,
289
+ "onFillUpDown": new Slick.Event()
290
+ });
291
+ }
@@ -0,0 +1,12 @@
1
+ /***
2
+ * Displays an overlay on top of a given cell range.
3
+ *
4
+ * TODO:
5
+ * Currently, it blocks mouse events to DOM nodes behind it.
6
+ * Use FF and WebKit-specific "pointer-events" CSS style, or some kind of event forwarding.
7
+ * Could also construct the borders separately using 4 individual DIVs.
8
+ *
9
+ * @param {Grid} grid
10
+ * @param {Object} options
11
+ */
12
+ export declare function CellRangeDecorator(grid: any, options: any): void;