@sankhyalabs/ezui 0.0.0-bugfix-dev-KB-6165.0 → 0.0.0-bugfix-dev-KB-17130.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.
- package/README.md +8 -10
- package/dist/cjs/{ApplicationUtils-2e444734.js → ApplicationUtils-c9d1205c.js} +56 -6
- package/dist/cjs/{RecordValidationProcessor-edd23705.js → RecordValidationProcessor-4c893e04.js} +1 -1
- package/dist/cjs/{constants-3a1d64fb.js → constants-2714478b.js} +2 -0
- package/dist/cjs/ez-actions-button.cjs.entry.js +56 -28
- package/dist/cjs/ez-alert-list.cjs.entry.js +148 -0
- package/dist/cjs/ez-alert.cjs.entry.js +1 -1
- package/dist/cjs/ez-application.cjs.entry.js +1 -1
- package/dist/cjs/ez-badge.cjs.entry.js +1 -1
- package/dist/cjs/ez-breadcrumb.cjs.entry.js +1 -1
- package/dist/cjs/ez-button.cjs.entry.js +1 -1
- package/dist/cjs/ez-calendar.cjs.entry.js +1 -1
- package/dist/cjs/ez-card-item_3.cjs.entry.js +182 -0
- package/dist/cjs/ez-check.cjs.entry.js +1 -1
- package/dist/cjs/ez-chip.cjs.entry.js +1 -1
- package/dist/cjs/ez-collapsible-box.cjs.entry.js +3 -4
- package/dist/cjs/ez-combo-box.cjs.entry.js +17 -152
- package/dist/cjs/ez-date-input.cjs.entry.js +1 -1
- package/dist/cjs/ez-date-time-input.cjs.entry.js +1 -1
- package/dist/cjs/ez-dialog.cjs.entry.js +31 -5
- package/dist/cjs/ez-dropdown.cjs.entry.js +12 -6
- package/dist/cjs/ez-file-item.cjs.entry.js +1 -1
- package/dist/cjs/ez-form-view.cjs.entry.js +44 -3
- package/dist/cjs/ez-form.cjs.entry.js +36 -4
- package/dist/cjs/ez-grid.cjs.entry.js +246 -64
- package/dist/cjs/ez-guide-navigator.cjs.entry.js +7 -1
- package/dist/cjs/ez-icon.cjs.entry.js +2 -2
- package/dist/cjs/ez-list.cjs.entry.js +5 -3
- package/dist/cjs/ez-loading-bar.cjs.entry.js +1 -1
- package/dist/cjs/ez-modal-container.cjs.entry.js +1 -1
- package/dist/cjs/ez-modal.cjs.entry.js +2 -2
- package/dist/cjs/ez-multi-selection-list.cjs.entry.js +23 -10
- package/dist/cjs/ez-number-input.cjs.entry.js +1 -1
- package/dist/cjs/ez-popover.cjs.entry.js +1 -1
- package/dist/cjs/ez-popup.cjs.entry.js +2 -2
- package/dist/cjs/ez-radio-button.cjs.entry.js +1 -1
- package/dist/cjs/ez-scroller_3.cjs.entry.js +8 -6
- package/dist/cjs/ez-search.cjs.entry.js +615 -32
- package/dist/cjs/ez-skeleton.cjs.entry.js +1 -1
- package/dist/cjs/ez-split-item.cjs.entry.js +19 -0
- package/dist/cjs/ez-split-panel.cjs.entry.js +776 -0
- package/dist/cjs/ez-tabselector.cjs.entry.js +1 -1
- package/dist/cjs/ez-text-area.cjs.entry.js +1 -1
- package/dist/cjs/ez-text-edit.cjs.entry.js +2 -2
- package/dist/cjs/ez-text-input.cjs.entry.js +3 -2
- package/dist/cjs/ez-time-input.cjs.entry.js +1 -1
- package/dist/cjs/ez-toast.cjs.entry.js +1 -1
- package/dist/cjs/ez-upload.cjs.entry.js +2 -2
- package/dist/cjs/ez-view-stack.cjs.entry.js +1 -1
- package/dist/cjs/ezui.cjs.js +2 -2
- package/dist/cjs/filter-column.cjs.entry.js +47 -12
- package/dist/cjs/{index-1064511f.js → index-a7b0c73d.js} +16 -6
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/collection/collection-manifest.json +6 -3
- package/dist/collection/components/ez-actions-button/ez-actions-button.css +17 -3
- package/dist/collection/components/ez-actions-button/ez-actions-button.js +105 -27
- package/dist/collection/components/ez-alert-list/ez-alert-list.css +87 -0
- package/dist/collection/components/ez-alert-list/ez-alert-list.js +268 -0
- package/dist/collection/components/ez-card-item/ez-card-item.css +17 -0
- package/dist/collection/components/ez-collapsible-box/ez-collapsible-box.css +1 -1
- package/dist/collection/components/ez-collapsible-box/ez-collapsible-box.js +0 -1
- package/dist/collection/components/ez-combo-box/ez-combo-box.js +71 -169
- package/dist/collection/components/ez-dialog/ez-dialog.css +1 -1
- package/dist/collection/components/ez-dialog/ez-dialog.js +39 -4
- package/dist/collection/components/ez-dropdown/ez-dropdown.css +4 -3
- package/dist/collection/components/ez-dropdown/ez-dropdown.js +33 -4
- package/dist/collection/components/ez-form/ez-form.js +93 -0
- package/dist/collection/components/ez-form-view/ez-form-view.js +23 -0
- package/dist/collection/components/ez-form-view/fieldbuilder/FieldBuilder.js +4 -1
- package/dist/collection/components/ez-form-view/structure/index.js +34 -0
- package/dist/collection/components/ez-grid/controller/ag-grid/AgGridController.js +21 -9
- package/dist/collection/components/ez-grid/controller/ag-grid/DataSource.js +23 -1
- package/dist/collection/components/ez-grid/controller/ag-grid/components/EzGridCustomHeader.js +1 -1
- package/dist/collection/components/ez-grid/controller/ag-grid/components/cellRendererStatus.js +1 -1
- package/dist/collection/components/ez-grid/ez-grid.css +1 -4
- package/dist/collection/components/ez-grid/ez-grid.js +91 -51
- package/dist/collection/components/ez-grid/interfaces/IColumnFilter.js +1 -0
- package/dist/collection/components/ez-grid/interfaces/index.js +1 -0
- package/dist/collection/components/ez-grid/subcomponents/filter-column.js +66 -12
- package/dist/collection/components/ez-grid/utils/ColumnFilterManager.js +62 -0
- package/dist/collection/components/ez-grid/utils/InMemoryFilterColumnDataSource.js +94 -0
- package/dist/collection/components/ez-grid/utils/index.js +1 -0
- package/dist/collection/components/ez-guide-navigator/ez-guide-navigator.js +22 -0
- package/dist/collection/components/ez-icon/ez-icon.css +148 -139
- package/dist/collection/components/ez-list/ez-list.css +12 -7
- package/dist/collection/components/ez-list/ez-list.js +3 -1
- package/dist/collection/components/ez-modal/ez-modal.css +1 -1
- package/dist/collection/components/ez-multi-selection-list/ez-multi-selection-list.js +41 -10
- package/dist/collection/components/ez-popup/ez-popup.css +2 -2
- package/dist/collection/components/ez-search/ez-search.css +330 -0
- package/dist/collection/components/ez-search/ez-search.js +746 -55
- package/dist/collection/components/ez-split-panel/ez-split-panel.css +8 -0
- package/dist/collection/components/ez-split-panel/ez-split-panel.js +122 -0
- package/dist/collection/components/ez-split-panel/structure/item/ez-split-item.css +12 -0
- package/dist/collection/components/ez-split-panel/structure/item/ez-split-item.js +17 -0
- package/dist/collection/components/ez-text-input/ez-text-input.js +20 -1
- package/dist/collection/components/ez-tree/ez-tree.css +33 -0
- package/dist/collection/components/ez-tree/subcomponents/TreeItem.js +3 -3
- package/dist/collection/utils/ApplicationUtils.js +56 -6
- package/dist/collection/utils/constants.js +1 -0
- package/dist/collection/utils/form/DataBinder.js +12 -1
- package/dist/collection/utils/interfaces/IAction.js +1 -0
- package/dist/custom-elements/index.d.ts +18 -0
- package/dist/custom-elements/index.js +2138 -339
- package/dist/esm/{ApplicationUtils-d9a34a16.js → ApplicationUtils-eaf91331.js} +56 -6
- package/dist/esm/{RecordValidationProcessor-abc814af.js → RecordValidationProcessor-b00b8b77.js} +1 -1
- package/dist/esm/constants-4e0d35b7.js +5 -0
- package/dist/esm/ez-actions-button.entry.js +56 -28
- package/dist/esm/ez-alert-list.entry.js +144 -0
- package/dist/esm/ez-alert.entry.js +1 -1
- package/dist/esm/ez-application.entry.js +1 -1
- package/dist/esm/ez-badge.entry.js +1 -1
- package/dist/esm/ez-breadcrumb.entry.js +1 -1
- package/dist/esm/ez-button.entry.js +1 -1
- package/dist/esm/ez-calendar.entry.js +1 -1
- package/dist/esm/ez-card-item_3.entry.js +176 -0
- package/dist/esm/ez-check.entry.js +1 -1
- package/dist/esm/ez-chip.entry.js +1 -1
- package/dist/esm/ez-collapsible-box.entry.js +3 -4
- package/dist/esm/ez-combo-box.entry.js +18 -153
- package/dist/esm/ez-date-input.entry.js +1 -1
- package/dist/esm/ez-date-time-input.entry.js +1 -1
- package/dist/esm/ez-dialog.entry.js +31 -5
- package/dist/esm/ez-dropdown.entry.js +12 -6
- package/dist/esm/ez-file-item.entry.js +1 -1
- package/dist/esm/ez-form-view.entry.js +44 -3
- package/dist/esm/ez-form.entry.js +36 -4
- package/dist/esm/ez-grid.entry.js +247 -65
- package/dist/esm/ez-guide-navigator.entry.js +7 -1
- package/dist/esm/ez-icon.entry.js +2 -2
- package/dist/esm/ez-list.entry.js +5 -3
- package/dist/esm/ez-loading-bar.entry.js +1 -1
- package/dist/esm/ez-modal-container.entry.js +1 -1
- package/dist/esm/ez-modal.entry.js +2 -2
- package/dist/esm/ez-multi-selection-list.entry.js +23 -10
- package/dist/esm/ez-number-input.entry.js +1 -1
- package/dist/esm/ez-popover.entry.js +1 -1
- package/dist/esm/ez-popup.entry.js +2 -2
- package/dist/esm/ez-radio-button.entry.js +1 -1
- package/dist/esm/ez-scroller_3.entry.js +8 -6
- package/dist/esm/ez-search.entry.js +616 -33
- package/dist/esm/ez-skeleton.entry.js +1 -1
- package/dist/esm/ez-split-item.entry.js +15 -0
- package/dist/esm/ez-split-panel.entry.js +772 -0
- package/dist/esm/ez-tabselector.entry.js +1 -1
- package/dist/esm/ez-text-area.entry.js +1 -1
- package/dist/esm/ez-text-edit.entry.js +2 -2
- package/dist/esm/ez-text-input.entry.js +3 -2
- package/dist/esm/ez-time-input.entry.js +1 -1
- package/dist/esm/ez-toast.entry.js +1 -1
- package/dist/esm/ez-upload.entry.js +2 -2
- package/dist/esm/ez-view-stack.entry.js +1 -1
- package/dist/esm/ezui.js +3 -3
- package/dist/esm/filter-column.entry.js +47 -12
- package/dist/esm/{index-296b8458.js → index-baa5e267.js} +16 -6
- package/dist/esm/loader.js +3 -3
- package/dist/ezui/ezui.esm.js +1 -1
- package/dist/ezui/{p-5cef0264.entry.js → p-0306dff7.entry.js} +1 -1
- package/dist/ezui/p-0447d17c.entry.js +1 -0
- package/dist/ezui/{p-86a2036d.js → p-04f24913.js} +1 -1
- package/dist/ezui/p-05e1f4e7.js +1 -0
- package/dist/ezui/p-072e6347.entry.js +1 -0
- package/dist/ezui/p-133fae4a.entry.js +1 -0
- package/dist/ezui/{p-f4208819.entry.js → p-17be134a.entry.js} +1 -1
- package/dist/ezui/{p-cd19a6f8.entry.js → p-1e7a8633.entry.js} +1 -1
- package/dist/ezui/{p-60ba28ea.entry.js → p-1f50fa05.entry.js} +1 -1
- package/dist/ezui/{p-a5e09759.entry.js → p-20ec22c0.entry.js} +1 -1
- package/dist/ezui/p-2187f86c.js +1 -0
- package/dist/ezui/{p-e318d280.js → p-23a36bb6.js} +1 -1
- package/dist/ezui/{p-ce035beb.entry.js → p-24d3fede.entry.js} +1 -1
- package/dist/ezui/p-2a1a0e04.entry.js +1 -0
- package/dist/ezui/p-40f72de4.entry.js +1 -0
- package/dist/ezui/p-43b03119.entry.js +1 -0
- package/dist/ezui/{p-9b347f04.entry.js → p-44caad9a.entry.js} +1 -1
- package/dist/ezui/p-49456b34.entry.js +1 -0
- package/dist/ezui/p-4a7f113d.entry.js +1 -0
- package/dist/ezui/p-51c5e071.entry.js +1 -0
- package/dist/ezui/{p-ccb4ccd9.entry.js → p-555c9018.entry.js} +1 -1
- package/dist/ezui/{p-d43b22f3.entry.js → p-596634e9.entry.js} +1 -1
- package/dist/ezui/p-5bd5e68f.entry.js +1 -0
- package/dist/ezui/{p-a01068e1.entry.js → p-5d692ed1.entry.js} +1 -1
- package/dist/ezui/{p-95426f93.entry.js → p-5d86cca9.entry.js} +1 -1
- package/dist/ezui/p-5e1d036e.entry.js +1 -0
- package/dist/ezui/{p-7525e604.entry.js → p-5ed81457.entry.js} +1 -1
- package/dist/ezui/{p-c49dbf23.entry.js → p-650e4b6d.entry.js} +1 -1
- package/dist/ezui/{p-fd54b5b4.entry.js → p-6e2f8e6b.entry.js} +2 -2
- package/dist/ezui/p-6e429cff.entry.js +1 -0
- package/dist/ezui/p-76ba9d67.entry.js +1 -0
- package/dist/ezui/{p-37673563.entry.js → p-77a4bd35.entry.js} +1 -1
- package/dist/ezui/p-796c1a88.entry.js +1 -0
- package/dist/ezui/{p-5d6f2550.entry.js → p-85c8baae.entry.js} +1 -1
- package/dist/ezui/{p-fa571a4e.entry.js → p-8becebf8.entry.js} +1 -1
- package/dist/ezui/p-8defa6d3.entry.js +1 -0
- package/dist/ezui/{p-391de0e4.entry.js → p-9050d2cd.entry.js} +1 -1
- package/dist/ezui/{p-028f264f.entry.js → p-9cad9b6e.entry.js} +1 -1
- package/dist/ezui/{p-b11f035c.entry.js → p-9f5fa3f9.entry.js} +1 -1
- package/dist/ezui/p-a08b309b.entry.js +1 -0
- package/dist/ezui/{p-2da09f70.entry.js → p-a80b1287.entry.js} +1 -1
- package/dist/ezui/p-af15c277.entry.js +1 -0
- package/dist/ezui/{p-32b4163f.entry.js → p-b041333c.entry.js} +1 -1
- package/dist/ezui/p-ba875f37.entry.js +1 -0
- package/dist/ezui/p-bc2f844e.entry.js +1 -0
- package/dist/ezui/{p-e2dfd935.entry.js → p-c0f1715f.entry.js} +1 -1
- package/dist/ezui/{p-83885b21.entry.js → p-cc2dc4f4.entry.js} +1 -1
- package/dist/ezui/p-d6ffe679.entry.js +1 -0
- package/dist/ezui/p-eb36f072.entry.js +1 -0
- package/dist/ezui/p-f56dd1da.entry.js +1 -0
- package/dist/types/components/ez-actions-button/ez-actions-button.d.ts +15 -7
- package/dist/types/components/ez-alert-list/ez-alert-list.d.ts +76 -0
- package/dist/types/components/ez-combo-box/ez-combo-box.d.ts +12 -15
- package/dist/types/components/ez-dialog/ez-dialog.d.ts +8 -2
- package/dist/types/components/ez-dropdown/ez-dropdown.d.ts +5 -0
- package/dist/types/components/ez-form/ez-form.d.ts +19 -1
- package/dist/types/components/ez-form-view/ez-form-view.d.ts +5 -0
- package/dist/types/components/ez-form-view/structure/index.d.ts +15 -0
- package/dist/types/components/ez-grid/controller/EzGridController.d.ts +9 -6
- package/dist/types/components/ez-grid/controller/ag-grid/AgGridController.d.ts +2 -3
- package/dist/types/components/ez-grid/controller/ag-grid/DataSource.d.ts +1 -0
- package/dist/types/components/ez-grid/controller/ag-grid/components/EzGridCustomHeader.d.ts +1 -1
- package/dist/types/components/ez-grid/ez-grid.d.ts +13 -5
- package/dist/types/components/ez-grid/interfaces/IColumnFilter.d.ts +4 -0
- package/dist/types/components/ez-grid/interfaces/index.d.ts +1 -0
- package/dist/types/components/ez-grid/subcomponents/filter-column.d.ts +8 -0
- package/dist/types/components/ez-grid/utils/ColumnFilterManager.d.ts +9 -0
- package/dist/types/components/ez-grid/utils/InMemoryFilterColumnDataSource.d.ts +19 -0
- package/dist/types/components/ez-grid/utils/index.d.ts +1 -0
- package/dist/types/components/ez-guide-navigator/ez-guide-navigator.d.ts +4 -0
- package/dist/types/components/ez-guide-navigator/interfaces/IGuideItem.d.ts +1 -0
- package/dist/types/components/ez-multi-selection-list/ez-multi-selection-list.d.ts +4 -0
- package/dist/types/components/ez-multi-selection-list/interfaces/IMultiSelectionListDataSource.d.ts +2 -0
- package/dist/types/components/ez-search/ez-search.d.ts +112 -10
- package/dist/types/components/ez-split-panel/structure/item/ez-split-item.d.ts +3 -0
- package/dist/types/components/ez-text-input/ez-text-input.d.ts +4 -0
- package/dist/types/components/ez-tree/interfaces/ITreeItem.d.ts +1 -0
- package/dist/types/components/ez-tree/subcomponents/TreeItem.d.ts +1 -0
- package/dist/types/components.d.ts +236 -17
- package/dist/types/utils/ApplicationUtils.d.ts +24 -0
- package/dist/types/utils/constants.d.ts +1 -0
- package/dist/types/utils/form/DataBinder.d.ts +1 -0
- package/dist/types/utils/index.d.ts +1 -0
- package/dist/types/utils/interfaces/AbstractFieldMetadata.d.ts +2 -1
- package/dist/types/utils/interfaces/IAction.d.ts +7 -0
- package/package.json +4 -3
- package/react/components.d.ts +3 -0
- package/react/components.js +3 -0
- package/react/components.js.map +1 -1
- package/dist/cjs/ez-card-item.cjs.entry.js +0 -52
- package/dist/cjs/ez-filter-input_2.cjs.entry.js +0 -137
- package/dist/esm/constants-6dab64f7.js +0 -4
- package/dist/esm/ez-card-item.entry.js +0 -48
- package/dist/esm/ez-filter-input_2.entry.js +0 -132
- package/dist/ezui/p-050247dc.entry.js +0 -1
- package/dist/ezui/p-1e7c4986.entry.js +0 -1
- package/dist/ezui/p-244dfe8a.entry.js +0 -1
- package/dist/ezui/p-27a01a26.js +0 -1
- package/dist/ezui/p-2a0e1679.entry.js +0 -1
- package/dist/ezui/p-4535da17.entry.js +0 -1
- package/dist/ezui/p-4c8b029b.entry.js +0 -1
- package/dist/ezui/p-4e31b69b.entry.js +0 -1
- package/dist/ezui/p-5495fa45.entry.js +0 -1
- package/dist/ezui/p-5ce6548c.entry.js +0 -1
- package/dist/ezui/p-68352e41.entry.js +0 -1
- package/dist/ezui/p-87e85160.entry.js +0 -1
- package/dist/ezui/p-8bd3903b.entry.js +0 -1
- package/dist/ezui/p-90fa4cb3.entry.js +0 -1
- package/dist/ezui/p-9285b53e.entry.js +0 -1
- package/dist/ezui/p-a510a4c5.entry.js +0 -1
- package/dist/ezui/p-d51aa09b.entry.js +0 -1
- package/dist/ezui/p-db528b31.entry.js +0 -1
- package/dist/ezui/p-e67d0bd5.entry.js +0 -1
- package/dist/ezui/p-e7fa0ad6.entry.js +0 -1
- package/dist/ezui/p-f15ec3bb.js +0 -1
- package/dist/ezui/p-ff82b176.entry.js +0 -1
|
@@ -0,0 +1,776 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
const index$1 = require('./index-a7b0c73d.js');
|
|
6
|
+
const core = require('@sankhyalabs/core');
|
|
7
|
+
|
|
8
|
+
var numeric = function (value, unit) { return Number(value.slice(0, -1 * unit.length)); };
|
|
9
|
+
|
|
10
|
+
var parseValue = function (value) {
|
|
11
|
+
if (value.endsWith('px'))
|
|
12
|
+
{ return { value: value, type: 'px', numeric: numeric(value, 'px') } }
|
|
13
|
+
if (value.endsWith('fr'))
|
|
14
|
+
{ return { value: value, type: 'fr', numeric: numeric(value, 'fr') } }
|
|
15
|
+
if (value.endsWith('%'))
|
|
16
|
+
{ return { value: value, type: '%', numeric: numeric(value, '%') } }
|
|
17
|
+
if (value === 'auto') { return { value: value, type: 'auto' } }
|
|
18
|
+
return null
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
var parse = function (rule) { return rule.split(' ').map(parseValue); };
|
|
22
|
+
|
|
23
|
+
var getSizeAtTrack = function (index, tracks, gap, end) {
|
|
24
|
+
if ( gap === void 0 ) { gap = 0; }
|
|
25
|
+
if ( end === void 0 ) { end = false; }
|
|
26
|
+
|
|
27
|
+
var newIndex = end ? index + 1 : index;
|
|
28
|
+
var trackSum = tracks
|
|
29
|
+
.slice(0, newIndex)
|
|
30
|
+
.reduce(function (accum, value) { return accum + value.numeric; }, 0);
|
|
31
|
+
var gapSum = gap ? index * gap : 0;
|
|
32
|
+
|
|
33
|
+
return trackSum + gapSum
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
var getStyles = function (rule, ownRules, matchedRules) { return ownRules.concat( matchedRules)
|
|
37
|
+
.map(function (r) { return r.style[rule]; })
|
|
38
|
+
.filter(function (style) { return style !== undefined && style !== ''; }); };
|
|
39
|
+
|
|
40
|
+
var getGapValue = function (unit, size) {
|
|
41
|
+
if (size.endsWith(unit)) {
|
|
42
|
+
return Number(size.slice(0, -1 * unit.length))
|
|
43
|
+
}
|
|
44
|
+
return null
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
var firstNonZero = function (tracks) {
|
|
48
|
+
// eslint-disable-next-line no-plusplus
|
|
49
|
+
for (var i = 0; i < tracks.length; i++) {
|
|
50
|
+
if (tracks[i].numeric > 0) {
|
|
51
|
+
return i
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
return null
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
var NOOP = function () { return false; };
|
|
58
|
+
|
|
59
|
+
var defaultWriteStyle = function (element, gridTemplateProp, style) {
|
|
60
|
+
// eslint-disable-next-line no-param-reassign
|
|
61
|
+
element.style[gridTemplateProp] = style;
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
var getOption = function (options, propName, def) {
|
|
65
|
+
var value = options[propName];
|
|
66
|
+
if (value !== undefined) {
|
|
67
|
+
return value
|
|
68
|
+
}
|
|
69
|
+
return def
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
function getMatchedCSSRules (el) {
|
|
73
|
+
var ref;
|
|
74
|
+
|
|
75
|
+
return (ref = [])
|
|
76
|
+
.concat.apply(
|
|
77
|
+
ref, Array.from(el.ownerDocument.styleSheets).map(function (s) {
|
|
78
|
+
var rules = [];
|
|
79
|
+
|
|
80
|
+
try {
|
|
81
|
+
rules = Array.from(s.cssRules || []);
|
|
82
|
+
} catch (e) {
|
|
83
|
+
// Ignore results on security error
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
return rules
|
|
87
|
+
})
|
|
88
|
+
)
|
|
89
|
+
.filter(function (r) {
|
|
90
|
+
var matches = false;
|
|
91
|
+
try {
|
|
92
|
+
matches = el.matches(r.selectorText);
|
|
93
|
+
} catch (e) {
|
|
94
|
+
// Ignore matching erros
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
return matches
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
var gridTemplatePropColumns = 'grid-template-columns';
|
|
102
|
+
var gridTemplatePropRows = 'grid-template-rows';
|
|
103
|
+
|
|
104
|
+
var Gutter = function Gutter(direction, options, parentOptions) {
|
|
105
|
+
this.direction = direction;
|
|
106
|
+
this.element = options.element;
|
|
107
|
+
this.track = options.track;
|
|
108
|
+
|
|
109
|
+
if (direction === 'column') {
|
|
110
|
+
this.gridTemplateProp = gridTemplatePropColumns;
|
|
111
|
+
this.gridGapProp = 'grid-column-gap';
|
|
112
|
+
this.cursor = getOption(
|
|
113
|
+
parentOptions,
|
|
114
|
+
'columnCursor',
|
|
115
|
+
getOption(parentOptions, 'cursor', 'col-resize')
|
|
116
|
+
);
|
|
117
|
+
this.snapOffset = getOption(
|
|
118
|
+
parentOptions,
|
|
119
|
+
'columnSnapOffset',
|
|
120
|
+
getOption(parentOptions, 'snapOffset', 30)
|
|
121
|
+
);
|
|
122
|
+
this.dragInterval = getOption(
|
|
123
|
+
parentOptions,
|
|
124
|
+
'columnDragInterval',
|
|
125
|
+
getOption(parentOptions, 'dragInterval', 1)
|
|
126
|
+
);
|
|
127
|
+
this.clientAxis = 'clientX';
|
|
128
|
+
this.optionStyle = getOption(parentOptions, 'gridTemplateColumns');
|
|
129
|
+
} else if (direction === 'row') {
|
|
130
|
+
this.gridTemplateProp = gridTemplatePropRows;
|
|
131
|
+
this.gridGapProp = 'grid-row-gap';
|
|
132
|
+
this.cursor = getOption(
|
|
133
|
+
parentOptions,
|
|
134
|
+
'rowCursor',
|
|
135
|
+
getOption(parentOptions, 'cursor', 'row-resize')
|
|
136
|
+
);
|
|
137
|
+
this.snapOffset = getOption(
|
|
138
|
+
parentOptions,
|
|
139
|
+
'rowSnapOffset',
|
|
140
|
+
getOption(parentOptions, 'snapOffset', 30)
|
|
141
|
+
);
|
|
142
|
+
this.dragInterval = getOption(
|
|
143
|
+
parentOptions,
|
|
144
|
+
'rowDragInterval',
|
|
145
|
+
getOption(parentOptions, 'dragInterval', 1)
|
|
146
|
+
);
|
|
147
|
+
this.clientAxis = 'clientY';
|
|
148
|
+
this.optionStyle = getOption(parentOptions, 'gridTemplateRows');
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
this.onDragStart = getOption(parentOptions, 'onDragStart', NOOP);
|
|
152
|
+
this.onDragEnd = getOption(parentOptions, 'onDragEnd', NOOP);
|
|
153
|
+
this.onDrag = getOption(parentOptions, 'onDrag', NOOP);
|
|
154
|
+
this.writeStyle = getOption(
|
|
155
|
+
parentOptions,
|
|
156
|
+
'writeStyle',
|
|
157
|
+
defaultWriteStyle
|
|
158
|
+
);
|
|
159
|
+
|
|
160
|
+
this.startDragging = this.startDragging.bind(this);
|
|
161
|
+
this.stopDragging = this.stopDragging.bind(this);
|
|
162
|
+
this.drag = this.drag.bind(this);
|
|
163
|
+
|
|
164
|
+
this.minSizeStart = options.minSizeStart;
|
|
165
|
+
this.minSizeEnd = options.minSizeEnd;
|
|
166
|
+
|
|
167
|
+
if (options.element) {
|
|
168
|
+
this.element.addEventListener('mousedown', this.startDragging);
|
|
169
|
+
this.element.addEventListener('touchstart', this.startDragging);
|
|
170
|
+
}
|
|
171
|
+
};
|
|
172
|
+
|
|
173
|
+
Gutter.prototype.getDimensions = function getDimensions () {
|
|
174
|
+
var ref = this.grid.getBoundingClientRect();
|
|
175
|
+
var width = ref.width;
|
|
176
|
+
var height = ref.height;
|
|
177
|
+
var top = ref.top;
|
|
178
|
+
var bottom = ref.bottom;
|
|
179
|
+
var left = ref.left;
|
|
180
|
+
var right = ref.right;
|
|
181
|
+
|
|
182
|
+
if (this.direction === 'column') {
|
|
183
|
+
this.start = top;
|
|
184
|
+
this.end = bottom;
|
|
185
|
+
this.size = height;
|
|
186
|
+
} else if (this.direction === 'row') {
|
|
187
|
+
this.start = left;
|
|
188
|
+
this.end = right;
|
|
189
|
+
this.size = width;
|
|
190
|
+
}
|
|
191
|
+
};
|
|
192
|
+
|
|
193
|
+
Gutter.prototype.getSizeAtTrack = function getSizeAtTrack$1 (track, end) {
|
|
194
|
+
return getSizeAtTrack(
|
|
195
|
+
track,
|
|
196
|
+
this.computedPixels,
|
|
197
|
+
this.computedGapPixels,
|
|
198
|
+
end
|
|
199
|
+
)
|
|
200
|
+
};
|
|
201
|
+
|
|
202
|
+
Gutter.prototype.getSizeOfTrack = function getSizeOfTrack (track) {
|
|
203
|
+
return this.computedPixels[track].numeric
|
|
204
|
+
};
|
|
205
|
+
|
|
206
|
+
Gutter.prototype.getRawTracks = function getRawTracks () {
|
|
207
|
+
var tracks = getStyles(
|
|
208
|
+
this.gridTemplateProp,
|
|
209
|
+
[this.grid],
|
|
210
|
+
getMatchedCSSRules(this.grid)
|
|
211
|
+
);
|
|
212
|
+
if (!tracks.length) {
|
|
213
|
+
if (this.optionStyle) { return this.optionStyle }
|
|
214
|
+
|
|
215
|
+
throw Error('Unable to determine grid template tracks from styles.')
|
|
216
|
+
}
|
|
217
|
+
return tracks[0]
|
|
218
|
+
};
|
|
219
|
+
|
|
220
|
+
Gutter.prototype.getGap = function getGap () {
|
|
221
|
+
var gap = getStyles(
|
|
222
|
+
this.gridGapProp,
|
|
223
|
+
[this.grid],
|
|
224
|
+
getMatchedCSSRules(this.grid)
|
|
225
|
+
);
|
|
226
|
+
if (!gap.length) {
|
|
227
|
+
return null
|
|
228
|
+
}
|
|
229
|
+
return gap[0]
|
|
230
|
+
};
|
|
231
|
+
|
|
232
|
+
Gutter.prototype.getRawComputedTracks = function getRawComputedTracks () {
|
|
233
|
+
return window.getComputedStyle(this.grid)[this.gridTemplateProp]
|
|
234
|
+
};
|
|
235
|
+
|
|
236
|
+
Gutter.prototype.getRawComputedGap = function getRawComputedGap () {
|
|
237
|
+
return window.getComputedStyle(this.grid)[this.gridGapProp]
|
|
238
|
+
};
|
|
239
|
+
|
|
240
|
+
Gutter.prototype.setTracks = function setTracks (raw) {
|
|
241
|
+
this.tracks = raw.split(' ');
|
|
242
|
+
this.trackValues = parse(raw);
|
|
243
|
+
};
|
|
244
|
+
|
|
245
|
+
Gutter.prototype.setComputedTracks = function setComputedTracks (raw) {
|
|
246
|
+
this.computedTracks = raw.split(' ');
|
|
247
|
+
this.computedPixels = parse(raw);
|
|
248
|
+
};
|
|
249
|
+
|
|
250
|
+
Gutter.prototype.setGap = function setGap (raw) {
|
|
251
|
+
this.gap = raw;
|
|
252
|
+
};
|
|
253
|
+
|
|
254
|
+
Gutter.prototype.setComputedGap = function setComputedGap (raw) {
|
|
255
|
+
this.computedGap = raw;
|
|
256
|
+
this.computedGapPixels = getGapValue('px', this.computedGap) || 0;
|
|
257
|
+
};
|
|
258
|
+
|
|
259
|
+
Gutter.prototype.getMousePosition = function getMousePosition (e) {
|
|
260
|
+
if ('touches' in e) { return e.touches[0][this.clientAxis] }
|
|
261
|
+
return e[this.clientAxis]
|
|
262
|
+
};
|
|
263
|
+
|
|
264
|
+
Gutter.prototype.startDragging = function startDragging (e) {
|
|
265
|
+
if ('button' in e && e.button !== 0) {
|
|
266
|
+
return
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
// Don't actually drag the element. We emulate that in the drag function.
|
|
270
|
+
e.preventDefault();
|
|
271
|
+
|
|
272
|
+
if (this.element) {
|
|
273
|
+
this.grid = this.element.parentNode;
|
|
274
|
+
} else {
|
|
275
|
+
this.grid = e.target.parentNode;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
this.getDimensions();
|
|
279
|
+
this.setTracks(this.getRawTracks());
|
|
280
|
+
this.setComputedTracks(this.getRawComputedTracks());
|
|
281
|
+
this.setGap(this.getGap());
|
|
282
|
+
this.setComputedGap(this.getRawComputedGap());
|
|
283
|
+
|
|
284
|
+
var trackPercentage = this.trackValues.filter(
|
|
285
|
+
function (track) { return track.type === '%'; }
|
|
286
|
+
);
|
|
287
|
+
var trackFr = this.trackValues.filter(function (track) { return track.type === 'fr'; });
|
|
288
|
+
|
|
289
|
+
this.totalFrs = trackFr.length;
|
|
290
|
+
|
|
291
|
+
if (this.totalFrs) {
|
|
292
|
+
var track = firstNonZero(trackFr);
|
|
293
|
+
|
|
294
|
+
if (track !== null) {
|
|
295
|
+
this.frToPixels =
|
|
296
|
+
this.computedPixels[track].numeric / trackFr[track].numeric;
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
if (trackPercentage.length) {
|
|
301
|
+
var track$1 = firstNonZero(trackPercentage);
|
|
302
|
+
|
|
303
|
+
if (track$1 !== null) {
|
|
304
|
+
this.percentageToPixels =
|
|
305
|
+
this.computedPixels[track$1].numeric /
|
|
306
|
+
trackPercentage[track$1].numeric;
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
// get start of gutter track
|
|
311
|
+
var gutterStart = this.getSizeAtTrack(this.track, false) + this.start;
|
|
312
|
+
this.dragStartOffset = this.getMousePosition(e) - gutterStart;
|
|
313
|
+
|
|
314
|
+
this.aTrack = this.track - 1;
|
|
315
|
+
|
|
316
|
+
if (this.track < this.tracks.length - 1) {
|
|
317
|
+
this.bTrack = this.track + 1;
|
|
318
|
+
} else {
|
|
319
|
+
throw Error(
|
|
320
|
+
("Invalid track index: " + (this.track) + ". Track must be between two other tracks and only " + (this.tracks.length) + " tracks were found.")
|
|
321
|
+
)
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
this.aTrackStart = this.getSizeAtTrack(this.aTrack, false) + this.start;
|
|
325
|
+
this.bTrackEnd = this.getSizeAtTrack(this.bTrack, true) + this.start;
|
|
326
|
+
|
|
327
|
+
// Set the dragging property of the pair object.
|
|
328
|
+
this.dragging = true;
|
|
329
|
+
|
|
330
|
+
// All the binding. `window` gets the stop events in case we drag out of the elements.
|
|
331
|
+
window.addEventListener('mouseup', this.stopDragging);
|
|
332
|
+
window.addEventListener('touchend', this.stopDragging);
|
|
333
|
+
window.addEventListener('touchcancel', this.stopDragging);
|
|
334
|
+
window.addEventListener('mousemove', this.drag);
|
|
335
|
+
window.addEventListener('touchmove', this.drag);
|
|
336
|
+
|
|
337
|
+
// Disable selection. Disable!
|
|
338
|
+
this.grid.addEventListener('selectstart', NOOP);
|
|
339
|
+
this.grid.addEventListener('dragstart', NOOP);
|
|
340
|
+
|
|
341
|
+
this.grid.style.userSelect = 'none';
|
|
342
|
+
this.grid.style.webkitUserSelect = 'none';
|
|
343
|
+
this.grid.style.MozUserSelect = 'none';
|
|
344
|
+
this.grid.style.pointerEvents = 'none';
|
|
345
|
+
|
|
346
|
+
// Set the cursor at multiple levels
|
|
347
|
+
this.grid.style.cursor = this.cursor;
|
|
348
|
+
window.document.body.style.cursor = this.cursor;
|
|
349
|
+
|
|
350
|
+
this.onDragStart(this.direction, this.track);
|
|
351
|
+
};
|
|
352
|
+
|
|
353
|
+
Gutter.prototype.stopDragging = function stopDragging () {
|
|
354
|
+
this.dragging = false;
|
|
355
|
+
|
|
356
|
+
// Remove the stored event listeners. This is why we store them.
|
|
357
|
+
this.cleanup();
|
|
358
|
+
|
|
359
|
+
this.onDragEnd(this.direction, this.track);
|
|
360
|
+
|
|
361
|
+
if (this.needsDestroy) {
|
|
362
|
+
if (this.element) {
|
|
363
|
+
this.element.removeEventListener(
|
|
364
|
+
'mousedown',
|
|
365
|
+
this.startDragging
|
|
366
|
+
);
|
|
367
|
+
this.element.removeEventListener(
|
|
368
|
+
'touchstart',
|
|
369
|
+
this.startDragging
|
|
370
|
+
);
|
|
371
|
+
}
|
|
372
|
+
this.destroyCb();
|
|
373
|
+
this.needsDestroy = false;
|
|
374
|
+
this.destroyCb = null;
|
|
375
|
+
}
|
|
376
|
+
};
|
|
377
|
+
|
|
378
|
+
Gutter.prototype.drag = function drag (e) {
|
|
379
|
+
var mousePosition = this.getMousePosition(e);
|
|
380
|
+
|
|
381
|
+
var gutterSize = this.getSizeOfTrack(this.track);
|
|
382
|
+
var minMousePosition =
|
|
383
|
+
this.aTrackStart +
|
|
384
|
+
this.minSizeStart +
|
|
385
|
+
this.dragStartOffset +
|
|
386
|
+
this.computedGapPixels;
|
|
387
|
+
var maxMousePosition =
|
|
388
|
+
this.bTrackEnd -
|
|
389
|
+
this.minSizeEnd -
|
|
390
|
+
this.computedGapPixels -
|
|
391
|
+
(gutterSize - this.dragStartOffset);
|
|
392
|
+
var minMousePositionOffset = minMousePosition + this.snapOffset;
|
|
393
|
+
var maxMousePositionOffset = maxMousePosition - this.snapOffset;
|
|
394
|
+
|
|
395
|
+
if (mousePosition < minMousePositionOffset) {
|
|
396
|
+
mousePosition = minMousePosition;
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
if (mousePosition > maxMousePositionOffset) {
|
|
400
|
+
mousePosition = maxMousePosition;
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
if (mousePosition < minMousePosition) {
|
|
404
|
+
mousePosition = minMousePosition;
|
|
405
|
+
} else if (mousePosition > maxMousePosition) {
|
|
406
|
+
mousePosition = maxMousePosition;
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
var aTrackSize =
|
|
410
|
+
mousePosition -
|
|
411
|
+
this.aTrackStart -
|
|
412
|
+
this.dragStartOffset -
|
|
413
|
+
this.computedGapPixels;
|
|
414
|
+
var bTrackSize =
|
|
415
|
+
this.bTrackEnd -
|
|
416
|
+
mousePosition +
|
|
417
|
+
this.dragStartOffset -
|
|
418
|
+
gutterSize -
|
|
419
|
+
this.computedGapPixels;
|
|
420
|
+
|
|
421
|
+
if (this.dragInterval > 1) {
|
|
422
|
+
var aTrackSizeIntervaled =
|
|
423
|
+
Math.round(aTrackSize / this.dragInterval) * this.dragInterval;
|
|
424
|
+
bTrackSize -= aTrackSizeIntervaled - aTrackSize;
|
|
425
|
+
aTrackSize = aTrackSizeIntervaled;
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
if (aTrackSize < this.minSizeStart) {
|
|
429
|
+
aTrackSize = this.minSizeStart;
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
if (bTrackSize < this.minSizeEnd) {
|
|
433
|
+
bTrackSize = this.minSizeEnd;
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
if (this.trackValues[this.aTrack].type === 'px') {
|
|
437
|
+
this.tracks[this.aTrack] = aTrackSize + "px";
|
|
438
|
+
} else if (this.trackValues[this.aTrack].type === 'fr') {
|
|
439
|
+
if (this.totalFrs === 1) {
|
|
440
|
+
this.tracks[this.aTrack] = '1fr';
|
|
441
|
+
} else {
|
|
442
|
+
var targetFr = aTrackSize / this.frToPixels;
|
|
443
|
+
this.tracks[this.aTrack] = targetFr + "fr";
|
|
444
|
+
}
|
|
445
|
+
} else if (this.trackValues[this.aTrack].type === '%') {
|
|
446
|
+
var targetPercentage = aTrackSize / this.percentageToPixels;
|
|
447
|
+
this.tracks[this.aTrack] = targetPercentage + "%";
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
if (this.trackValues[this.bTrack].type === 'px') {
|
|
451
|
+
this.tracks[this.bTrack] = bTrackSize + "px";
|
|
452
|
+
} else if (this.trackValues[this.bTrack].type === 'fr') {
|
|
453
|
+
if (this.totalFrs === 1) {
|
|
454
|
+
this.tracks[this.bTrack] = '1fr';
|
|
455
|
+
} else {
|
|
456
|
+
var targetFr$1 = bTrackSize / this.frToPixels;
|
|
457
|
+
this.tracks[this.bTrack] = targetFr$1 + "fr";
|
|
458
|
+
}
|
|
459
|
+
} else if (this.trackValues[this.bTrack].type === '%') {
|
|
460
|
+
var targetPercentage$1 = bTrackSize / this.percentageToPixels;
|
|
461
|
+
this.tracks[this.bTrack] = targetPercentage$1 + "%";
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
var style = this.tracks.join(' ');
|
|
465
|
+
this.writeStyle(this.grid, this.gridTemplateProp, style);
|
|
466
|
+
this.onDrag(this.direction, this.track, style);
|
|
467
|
+
};
|
|
468
|
+
|
|
469
|
+
Gutter.prototype.cleanup = function cleanup () {
|
|
470
|
+
window.removeEventListener('mouseup', this.stopDragging);
|
|
471
|
+
window.removeEventListener('touchend', this.stopDragging);
|
|
472
|
+
window.removeEventListener('touchcancel', this.stopDragging);
|
|
473
|
+
window.removeEventListener('mousemove', this.drag);
|
|
474
|
+
window.removeEventListener('touchmove', this.drag);
|
|
475
|
+
|
|
476
|
+
if (this.grid) {
|
|
477
|
+
this.grid.removeEventListener('selectstart', NOOP);
|
|
478
|
+
this.grid.removeEventListener('dragstart', NOOP);
|
|
479
|
+
|
|
480
|
+
this.grid.style.userSelect = '';
|
|
481
|
+
this.grid.style.webkitUserSelect = '';
|
|
482
|
+
this.grid.style.MozUserSelect = '';
|
|
483
|
+
this.grid.style.pointerEvents = '';
|
|
484
|
+
|
|
485
|
+
this.grid.style.cursor = '';
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
window.document.body.style.cursor = '';
|
|
489
|
+
};
|
|
490
|
+
|
|
491
|
+
Gutter.prototype.destroy = function destroy (immediate, cb) {
|
|
492
|
+
if ( immediate === void 0 ) immediate = true;
|
|
493
|
+
|
|
494
|
+
if (immediate || this.dragging === false) {
|
|
495
|
+
this.cleanup();
|
|
496
|
+
if (this.element) {
|
|
497
|
+
this.element.removeEventListener(
|
|
498
|
+
'mousedown',
|
|
499
|
+
this.startDragging
|
|
500
|
+
);
|
|
501
|
+
this.element.removeEventListener(
|
|
502
|
+
'touchstart',
|
|
503
|
+
this.startDragging
|
|
504
|
+
);
|
|
505
|
+
}
|
|
506
|
+
|
|
507
|
+
if (cb) {
|
|
508
|
+
cb();
|
|
509
|
+
}
|
|
510
|
+
} else {
|
|
511
|
+
this.needsDestroy = true;
|
|
512
|
+
if (cb) {
|
|
513
|
+
this.destroyCb = cb;
|
|
514
|
+
}
|
|
515
|
+
}
|
|
516
|
+
};
|
|
517
|
+
|
|
518
|
+
var getTrackOption = function (options, track, defaultValue) {
|
|
519
|
+
if (track in options) {
|
|
520
|
+
return options[track]
|
|
521
|
+
}
|
|
522
|
+
|
|
523
|
+
return defaultValue
|
|
524
|
+
};
|
|
525
|
+
|
|
526
|
+
var createGutter = function (direction, options) { return function (gutterOptions) {
|
|
527
|
+
if (gutterOptions.track < 1) {
|
|
528
|
+
throw Error(
|
|
529
|
+
("Invalid track index: " + (gutterOptions.track) + ". Track must be between two other tracks.")
|
|
530
|
+
)
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
var trackMinSizes =
|
|
534
|
+
direction === 'column'
|
|
535
|
+
? options.columnMinSizes || {}
|
|
536
|
+
: options.rowMinSizes || {};
|
|
537
|
+
var trackMinSize = direction === 'column' ? 'columnMinSize' : 'rowMinSize';
|
|
538
|
+
|
|
539
|
+
return new Gutter(
|
|
540
|
+
direction,
|
|
541
|
+
Object.assign({}, {minSizeStart: getTrackOption(
|
|
542
|
+
trackMinSizes,
|
|
543
|
+
gutterOptions.track - 1,
|
|
544
|
+
getOption(
|
|
545
|
+
options,
|
|
546
|
+
trackMinSize,
|
|
547
|
+
getOption(options, 'minSize', 0)
|
|
548
|
+
)
|
|
549
|
+
),
|
|
550
|
+
minSizeEnd: getTrackOption(
|
|
551
|
+
trackMinSizes,
|
|
552
|
+
gutterOptions.track + 1,
|
|
553
|
+
getOption(
|
|
554
|
+
options,
|
|
555
|
+
trackMinSize,
|
|
556
|
+
getOption(options, 'minSize', 0)
|
|
557
|
+
)
|
|
558
|
+
)},
|
|
559
|
+
gutterOptions),
|
|
560
|
+
options
|
|
561
|
+
)
|
|
562
|
+
}; };
|
|
563
|
+
|
|
564
|
+
var Grid = function Grid(options) {
|
|
565
|
+
var this$1 = this;
|
|
566
|
+
|
|
567
|
+
this.columnGutters = {};
|
|
568
|
+
this.rowGutters = {};
|
|
569
|
+
|
|
570
|
+
this.options = Object.assign({}, {columnGutters: options.columnGutters || [],
|
|
571
|
+
rowGutters: options.rowGutters || [],
|
|
572
|
+
columnMinSizes: options.columnMinSizes || {},
|
|
573
|
+
rowMinSizes: options.rowMinSizes || {}},
|
|
574
|
+
options);
|
|
575
|
+
|
|
576
|
+
this.options.columnGutters.forEach(function (gutterOptions) {
|
|
577
|
+
this$1.columnGutters[gutterOptions.track] = createGutter(
|
|
578
|
+
'column',
|
|
579
|
+
this$1.options
|
|
580
|
+
)(gutterOptions);
|
|
581
|
+
});
|
|
582
|
+
|
|
583
|
+
this.options.rowGutters.forEach(function (gutterOptions) {
|
|
584
|
+
this$1.rowGutters[gutterOptions.track] = createGutter(
|
|
585
|
+
'row',
|
|
586
|
+
this$1.options
|
|
587
|
+
)(gutterOptions);
|
|
588
|
+
});
|
|
589
|
+
};
|
|
590
|
+
|
|
591
|
+
Grid.prototype.addColumnGutter = function addColumnGutter (element, track) {
|
|
592
|
+
if (this.columnGutters[track]) {
|
|
593
|
+
this.columnGutters[track].destroy();
|
|
594
|
+
}
|
|
595
|
+
|
|
596
|
+
this.columnGutters[track] = createGutter(
|
|
597
|
+
'column',
|
|
598
|
+
this.options
|
|
599
|
+
)({
|
|
600
|
+
element: element,
|
|
601
|
+
track: track,
|
|
602
|
+
});
|
|
603
|
+
};
|
|
604
|
+
|
|
605
|
+
Grid.prototype.addRowGutter = function addRowGutter (element, track) {
|
|
606
|
+
if (this.rowGutters[track]) {
|
|
607
|
+
this.rowGutters[track].destroy();
|
|
608
|
+
}
|
|
609
|
+
|
|
610
|
+
this.rowGutters[track] = createGutter(
|
|
611
|
+
'row',
|
|
612
|
+
this.options
|
|
613
|
+
)({
|
|
614
|
+
element: element,
|
|
615
|
+
track: track,
|
|
616
|
+
});
|
|
617
|
+
};
|
|
618
|
+
|
|
619
|
+
Grid.prototype.removeColumnGutter = function removeColumnGutter (track, immediate) {
|
|
620
|
+
var this$1 = this;
|
|
621
|
+
if ( immediate === void 0 ) immediate = true;
|
|
622
|
+
|
|
623
|
+
if (this.columnGutters[track]) {
|
|
624
|
+
this.columnGutters[track].destroy(immediate, function () {
|
|
625
|
+
delete this$1.columnGutters[track];
|
|
626
|
+
});
|
|
627
|
+
}
|
|
628
|
+
};
|
|
629
|
+
|
|
630
|
+
Grid.prototype.removeRowGutter = function removeRowGutter (track, immediate) {
|
|
631
|
+
var this$1 = this;
|
|
632
|
+
if ( immediate === void 0 ) immediate = true;
|
|
633
|
+
|
|
634
|
+
if (this.rowGutters[track]) {
|
|
635
|
+
this.rowGutters[track].destroy(immediate, function () {
|
|
636
|
+
delete this$1.rowGutters[track];
|
|
637
|
+
});
|
|
638
|
+
}
|
|
639
|
+
};
|
|
640
|
+
|
|
641
|
+
Grid.prototype.handleDragStart = function handleDragStart (e, direction, track) {
|
|
642
|
+
if (direction === 'column') {
|
|
643
|
+
if (this.columnGutters[track]) {
|
|
644
|
+
this.columnGutters[track].destroy();
|
|
645
|
+
}
|
|
646
|
+
|
|
647
|
+
this.columnGutters[track] = createGutter(
|
|
648
|
+
'column',
|
|
649
|
+
this.options
|
|
650
|
+
)({
|
|
651
|
+
track: track,
|
|
652
|
+
});
|
|
653
|
+
this.columnGutters[track].startDragging(e);
|
|
654
|
+
} else if (direction === 'row') {
|
|
655
|
+
if (this.rowGutters[track]) {
|
|
656
|
+
this.rowGutters[track].destroy();
|
|
657
|
+
}
|
|
658
|
+
|
|
659
|
+
this.rowGutters[track] = createGutter(
|
|
660
|
+
'row',
|
|
661
|
+
this.options
|
|
662
|
+
)({
|
|
663
|
+
track: track,
|
|
664
|
+
});
|
|
665
|
+
this.rowGutters[track].startDragging(e);
|
|
666
|
+
}
|
|
667
|
+
};
|
|
668
|
+
|
|
669
|
+
Grid.prototype.destroy = function destroy (immediate) {
|
|
670
|
+
var this$1 = this;
|
|
671
|
+
if ( immediate === void 0 ) immediate = true;
|
|
672
|
+
|
|
673
|
+
Object.keys(this.columnGutters).forEach(function (track) { return this$1.columnGutters[track].destroy(immediate, function () {
|
|
674
|
+
delete this$1.columnGutters[track];
|
|
675
|
+
}); }
|
|
676
|
+
);
|
|
677
|
+
Object.keys(this.rowGutters).forEach(function (track) { return this$1.rowGutters[track].destroy(immediate, function () {
|
|
678
|
+
delete this$1.rowGutters[track];
|
|
679
|
+
}); }
|
|
680
|
+
);
|
|
681
|
+
};
|
|
682
|
+
|
|
683
|
+
function index (options) { return new Grid(options); }
|
|
684
|
+
|
|
685
|
+
const ezSplitPanelCss = ".ez-split-gutter{cursor:grab;background-color:transparent}";
|
|
686
|
+
|
|
687
|
+
const SplitPanel = class {
|
|
688
|
+
constructor(hostRef) {
|
|
689
|
+
index$1.registerInstance(this, hostRef);
|
|
690
|
+
this._items = [];
|
|
691
|
+
this.direction = 'column';
|
|
692
|
+
}
|
|
693
|
+
componentDidLoad() {
|
|
694
|
+
this._panelID = core.StringUtils.generateUUID();
|
|
695
|
+
this._element.dataset.panelId = this._panelID;
|
|
696
|
+
let itemsElements = Array.from(this._element.children);
|
|
697
|
+
this._items = itemsElements.filter(child => { var _a; return ((_a = child.tagName) === null || _a === void 0 ? void 0 : _a.toUpperCase()) === 'EZ-SPLIT-ITEM'; });
|
|
698
|
+
let trackCount = 1;
|
|
699
|
+
this._items.forEach((item, index) => {
|
|
700
|
+
item.dataset.trackNumber = trackCount.toString();
|
|
701
|
+
if (this._items.length > 1 && index != this._items.length - 1) {
|
|
702
|
+
this.addItemGutter(item);
|
|
703
|
+
}
|
|
704
|
+
trackCount += 2;
|
|
705
|
+
});
|
|
706
|
+
this.initSplit();
|
|
707
|
+
}
|
|
708
|
+
initSplit() {
|
|
709
|
+
if (!this._items.length) {
|
|
710
|
+
return;
|
|
711
|
+
}
|
|
712
|
+
this._element.style[this.direction == 'row' ? 'grid-template-rows' : 'grid-template-columns'] = this.getGridTemplate();
|
|
713
|
+
index(this.getGutters());
|
|
714
|
+
}
|
|
715
|
+
getGutters() {
|
|
716
|
+
const gutters = {
|
|
717
|
+
columnGutters: [],
|
|
718
|
+
rowGutters: []
|
|
719
|
+
};
|
|
720
|
+
if (!this._items.length) {
|
|
721
|
+
return gutters;
|
|
722
|
+
}
|
|
723
|
+
const proToChange = this.direction == 'row' ? 'rowGutters' : 'columnGutters';
|
|
724
|
+
this._items.forEach((item, index) => {
|
|
725
|
+
if (index == this._items.length - 1)
|
|
726
|
+
return;
|
|
727
|
+
let gutterTrack = item.dataset.trackNumber;
|
|
728
|
+
if (index === (this._items.length - 1)) {
|
|
729
|
+
gutterTrack = this._items.length.toString();
|
|
730
|
+
}
|
|
731
|
+
gutters[proToChange].push({
|
|
732
|
+
track: Number(gutterTrack),
|
|
733
|
+
element: this._element.querySelector(`ez-split-panel[data-panel-id="${this._panelID}"] > [data-item-track="${item.dataset.trackNumber}"]`)
|
|
734
|
+
});
|
|
735
|
+
});
|
|
736
|
+
return gutters;
|
|
737
|
+
}
|
|
738
|
+
addItemGutter(item) {
|
|
739
|
+
const gutter = document.createElement('div');
|
|
740
|
+
gutter.classList.add("ez-split-gutter");
|
|
741
|
+
gutter.classList.add(this.direction);
|
|
742
|
+
gutter.dataset.itemTrack = `${item.dataset.trackNumber}`;
|
|
743
|
+
gutter.dataset.trackNumber = (Number(item.dataset.trackNumber) + 1).toString();
|
|
744
|
+
item.parentNode.insertBefore(gutter, item.nextSibling);
|
|
745
|
+
}
|
|
746
|
+
getElementStyle() {
|
|
747
|
+
const style = {
|
|
748
|
+
'display': "grid",
|
|
749
|
+
'height': '100%',
|
|
750
|
+
'width': '100%'
|
|
751
|
+
};
|
|
752
|
+
return style;
|
|
753
|
+
}
|
|
754
|
+
getGridTemplate() {
|
|
755
|
+
let template = '';
|
|
756
|
+
this._items.forEach((_col, index) => {
|
|
757
|
+
if (index === this._items.length - 1) {
|
|
758
|
+
template += ` 1fr`;
|
|
759
|
+
return;
|
|
760
|
+
}
|
|
761
|
+
if (index === 0) {
|
|
762
|
+
template += `1fr 5px`;
|
|
763
|
+
return;
|
|
764
|
+
}
|
|
765
|
+
template += ` 1fr 5px`;
|
|
766
|
+
});
|
|
767
|
+
return template;
|
|
768
|
+
}
|
|
769
|
+
render() {
|
|
770
|
+
return (index$1.h(index$1.Host, { style: this.getElementStyle() }));
|
|
771
|
+
}
|
|
772
|
+
get _element() { return index$1.getElement(this); }
|
|
773
|
+
};
|
|
774
|
+
SplitPanel.style = ezSplitPanelCss;
|
|
775
|
+
|
|
776
|
+
exports.ez_split_panel = SplitPanel;
|