@revolist/revogrid 4.9.13 → 4.9.16
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/dist/cjs/{column.drag.plugin-e636b5af.js → column.drag.plugin-a5cc161a.js} +106 -186
- package/dist/cjs/column.drag.plugin-a5cc161a.js.map +1 -0
- package/dist/cjs/{column.service-15c8352d.js → column.service-d45dbb3f.js} +141 -14
- package/dist/cjs/column.service-d45dbb3f.js.map +1 -0
- package/dist/cjs/{header-cell-renderer-375a879f.js → header-cell-renderer-28f7f21d.js} +14 -14
- package/dist/cjs/header-cell-renderer-28f7f21d.js.map +1 -0
- package/dist/cjs/index.cjs.js +15 -13
- package/dist/cjs/index.cjs.js.map +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/revo-grid.cjs.entry.js +23 -17
- package/dist/cjs/revo-grid.cjs.entry.js.map +1 -1
- package/dist/cjs/revo-grid.cjs.js +1 -1
- package/dist/cjs/revogr-attribution_6.cjs.entry.js +1 -1
- package/dist/cjs/revogr-data_4.cjs.entry.js +7 -7
- package/dist/cjs/revogr-data_4.cjs.entry.js.map +1 -1
- package/dist/cjs/revogr-filter-panel.cjs.entry.js +17 -10
- package/dist/cjs/revogr-filter-panel.cjs.entry.js.map +1 -1
- package/dist/collection/collection-manifest.json +2 -2
- package/dist/collection/components/data/cell-renderer.js +2 -2
- package/dist/collection/components/data/cell-renderer.js.map +1 -1
- package/dist/collection/components/data/column.service.js +5 -14
- package/dist/collection/components/data/column.service.js.map +1 -1
- package/dist/collection/components/header/header-cell-renderer.js +5 -4
- package/dist/collection/components/header/header-cell-renderer.js.map +1 -1
- package/dist/collection/components/header/header-renderer.js +2 -2
- package/dist/collection/components/header/header-renderer.js.map +1 -1
- package/dist/collection/components/header/resizable.directive.js.map +1 -1
- package/dist/collection/components/header/resizable.element.js +9 -10
- package/dist/collection/components/header/resizable.element.js.map +1 -1
- package/dist/collection/components/header/revogr-header.js +3 -3
- package/dist/collection/components/header/revogr-header.js.map +1 -1
- package/dist/collection/components/revoGrid/revo-grid.js +6 -6
- package/dist/collection/components/revoGrid/revo-grid.js.map +1 -1
- package/dist/collection/global/global.js +2 -2
- package/dist/collection/global/global.js.map +1 -1
- package/dist/collection/plugins/filter/{filter.service.js → filter.indexed.js} +18 -18
- package/dist/collection/plugins/filter/filter.indexed.js.map +1 -0
- package/dist/collection/plugins/filter/filter.panel.js +32 -46
- package/dist/collection/plugins/filter/filter.panel.js.map +1 -1
- package/dist/collection/plugins/filter/filter.plugin.js +86 -40
- package/dist/collection/plugins/filter/filter.plugin.js.map +1 -1
- package/dist/collection/plugins/filter/filter.types.js.map +1 -1
- package/dist/collection/plugins/wcag/index.js +7 -1
- package/dist/collection/plugins/wcag/index.js.map +1 -1
- package/dist/collection/serve/controller.js +1 -1
- package/dist/collection/themeManager/theme.compact.js +1 -1
- package/dist/collection/themeManager/theme.compact.js.map +1 -1
- package/dist/collection/themeManager/theme.default.js +1 -1
- package/dist/collection/themeManager/theme.default.js.map +1 -1
- package/dist/collection/themeManager/theme.material.js +1 -1
- package/dist/collection/themeManager/theme.material.js.map +1 -1
- package/dist/collection/themeManager/theme.service.js +9 -9
- package/dist/collection/themeManager/theme.service.js.map +1 -1
- package/dist/collection/types/interfaces.js.map +1 -1
- package/dist/collection/utils/column.utils.js +10 -0
- package/dist/collection/utils/column.utils.js.map +1 -1
- package/dist/esm/{column.drag.plugin-30dc4e24.js → column.drag.plugin-18125693.js} +107 -181
- package/dist/esm/column.drag.plugin-18125693.js.map +1 -0
- package/dist/esm/{column.service-414e9cba.js → column.service-00a51837.js} +136 -16
- package/dist/esm/column.service-00a51837.js.map +1 -0
- package/dist/esm/{edit.utils-0666e5bd.js → edit.utils-b50f9378.js} +2 -2
- package/dist/esm/{edit.utils-0666e5bd.js.map → edit.utils-b50f9378.js.map} +1 -1
- package/dist/esm/{header-cell-renderer-ca570fcf.js → header-cell-renderer-6d89f141.js} +14 -14
- package/dist/esm/header-cell-renderer-6d89f141.js.map +1 -0
- package/dist/esm/{index-74b9801b.js → index-00cb6ac1.js} +2 -2
- package/dist/esm/{index-74b9801b.js.map → index-00cb6ac1.js.map} +1 -1
- package/dist/esm/index.js +7 -7
- package/dist/esm/{key.utils-d3df5db8.js → key.utils-b8a11f7d.js} +2 -2
- package/dist/esm/{key.utils-d3df5db8.js.map → key.utils-b8a11f7d.js.map} +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/revo-grid.entry.js +18 -12
- package/dist/esm/revo-grid.entry.js.map +1 -1
- package/dist/esm/revo-grid.js +1 -1
- package/dist/esm/revogr-attribution_6.entry.js +6 -6
- package/dist/esm/revogr-clipboard_3.entry.js +4 -4
- package/dist/esm/revogr-data_4.entry.js +9 -9
- package/dist/esm/revogr-data_4.entry.js.map +1 -1
- package/dist/esm/revogr-filter-panel.entry.js +17 -10
- package/dist/esm/revogr-filter-panel.entry.js.map +1 -1
- package/dist/esm/{row-header-utils-c7e3e2d5.js → row-header-utils-30750b8e.js} +2 -2
- package/dist/esm/{row-header-utils-c7e3e2d5.js.map → row-header-utils-30750b8e.js.map} +1 -1
- package/dist/esm/{text-editor-96d69516.js → text-editor-f8a9ff85.js} +3 -3
- package/dist/esm/{text-editor-96d69516.js.map → text-editor-f8a9ff85.js.map} +1 -1
- package/dist/esm/{throttle-262c3ed2.js → throttle-9b08685d.js} +2 -2
- package/dist/esm/{throttle-262c3ed2.js.map → throttle-9b08685d.js.map} +1 -1
- package/dist/revo-grid/column.drag.plugin-18125693.js +5 -0
- package/dist/revo-grid/column.drag.plugin-18125693.js.map +1 -0
- package/dist/revo-grid/column.service-00a51837.js +5 -0
- package/dist/revo-grid/column.service-00a51837.js.map +1 -0
- package/dist/revo-grid/{edit.utils-0666e5bd.js → edit.utils-b50f9378.js} +2 -2
- package/dist/revo-grid/{header-cell-renderer-ca570fcf.js → header-cell-renderer-6d89f141.js} +2 -2
- package/dist/revo-grid/header-cell-renderer-6d89f141.js.map +1 -0
- package/dist/revo-grid/{index-74b9801b.js → index-00cb6ac1.js} +2 -2
- package/dist/revo-grid/index.esm.js +1 -1
- package/dist/revo-grid/{key.utils-d3df5db8.js → key.utils-b8a11f7d.js} +2 -2
- package/dist/revo-grid/revo-grid.entry.js +1 -1
- package/dist/revo-grid/revo-grid.entry.js.map +1 -1
- package/dist/revo-grid/revo-grid.esm.js +1 -1
- package/dist/revo-grid/revo-grid.esm.js.map +1 -1
- package/dist/revo-grid/revogr-attribution_6.entry.js +1 -1
- package/dist/revo-grid/revogr-clipboard_3.entry.js +1 -1
- package/dist/revo-grid/revogr-data_4.entry.js +1 -1
- package/dist/revo-grid/revogr-data_4.entry.js.map +1 -1
- package/dist/revo-grid/revogr-filter-panel.entry.js +1 -1
- package/dist/revo-grid/revogr-filter-panel.entry.js.map +1 -1
- package/dist/revo-grid/{row-header-utils-c7e3e2d5.js → row-header-utils-30750b8e.js} +2 -2
- package/dist/revo-grid/{text-editor-96d69516.js → text-editor-f8a9ff85.js} +2 -2
- package/dist/revo-grid/{throttle-262c3ed2.js → throttle-9b08685d.js} +2 -2
- package/dist/types/components/data/column.service.d.ts +1 -2
- package/dist/types/components/header/header-cell-renderer.d.ts +7 -9
- package/dist/types/components/header/header-renderer.d.ts +2 -3
- package/dist/types/components/header/resizable.directive.d.ts +0 -1
- package/dist/types/components/header/resizable.element.d.ts +3 -2
- package/dist/types/components/revoGrid/revo-grid.d.ts +1 -1
- package/dist/types/components.d.ts +2 -8
- package/dist/types/plugins/filter/{filter.service.d.ts → filter.indexed.d.ts} +2 -2
- package/dist/types/plugins/filter/filter.panel.d.ts +3 -27
- package/dist/types/plugins/filter/filter.plugin.d.ts +14 -47
- package/dist/types/plugins/filter/filter.types.d.ts +86 -1
- package/dist/types/themeManager/theme.compact.d.ts +1 -1
- package/dist/types/themeManager/theme.default.d.ts +1 -1
- package/dist/types/themeManager/theme.material.d.ts +1 -1
- package/dist/types/themeManager/theme.service.d.ts +2 -2
- package/dist/types/types/interfaces.d.ts +9 -12
- package/dist/types/utils/column.utils.d.ts +3 -1
- package/hydrate/index.js +1007 -949
- package/hydrate/index.mjs +1007 -949
- package/package.json +1 -1
- package/standalone/column.service.js +136 -15
- package/standalone/column.service.js.map +1 -1
- package/standalone/dimension.helpers.js +2 -216
- package/standalone/dimension.helpers.js.map +1 -1
- package/standalone/index.js +7 -6
- package/standalone/index.js.map +1 -1
- package/standalone/index2.js +2 -84
- package/standalone/index2.js.map +1 -1
- package/standalone/platform.js +89 -0
- package/standalone/platform.js.map +1 -0
- package/standalone/{data.store.js → reduce.js} +252 -38
- package/standalone/reduce.js.map +1 -0
- package/standalone/revo-grid.js +119 -186
- package/standalone/revo-grid.js.map +1 -1
- package/standalone/revogr-data2.js +3 -2
- package/standalone/revogr-data2.js.map +1 -1
- package/standalone/revogr-edit2.js +2 -1
- package/standalone/revogr-edit2.js.map +1 -1
- package/standalone/revogr-filter-panel.js +17 -11
- package/standalone/revogr-filter-panel.js.map +1 -1
- package/standalone/revogr-focus2.js +1 -1
- package/standalone/revogr-header2.js +20 -20
- package/standalone/revogr-header2.js.map +1 -1
- package/standalone/revogr-order-editor2.js +1 -1
- package/standalone/revogr-overlay-selection2.js +3 -2
- package/standalone/revogr-overlay-selection2.js.map +1 -1
- package/standalone/revogr-row-headers2.js +1 -1
- package/standalone/selection.utils.js +1 -1
- package/dist/cjs/column.drag.plugin-e636b5af.js.map +0 -1
- package/dist/cjs/column.service-15c8352d.js.map +0 -1
- package/dist/cjs/header-cell-renderer-375a879f.js.map +0 -1
- package/dist/collection/plugins/filter/filter.service.js.map +0 -1
- package/dist/esm/column.drag.plugin-30dc4e24.js.map +0 -1
- package/dist/esm/column.service-414e9cba.js.map +0 -1
- package/dist/esm/header-cell-renderer-ca570fcf.js.map +0 -1
- package/dist/revo-grid/column.drag.plugin-30dc4e24.js +0 -5
- package/dist/revo-grid/column.drag.plugin-30dc4e24.js.map +0 -1
- package/dist/revo-grid/column.service-414e9cba.js +0 -5
- package/dist/revo-grid/column.service-414e9cba.js.map +0 -1
- package/dist/revo-grid/header-cell-renderer-ca570fcf.js.map +0 -1
- package/standalone/data.store.js.map +0 -1
- /package/dist/revo-grid/{edit.utils-0666e5bd.js.map → edit.utils-b50f9378.js.map} +0 -0
- /package/dist/revo-grid/{index-74b9801b.js.map → index-00cb6ac1.js.map} +0 -0
- /package/dist/revo-grid/{key.utils-d3df5db8.js.map → key.utils-b8a11f7d.js.map} +0 -0
- /package/dist/revo-grid/{row-header-utils-c7e3e2d5.js.map → row-header-utils-30750b8e.js.map} +0 -0
- /package/dist/revo-grid/{text-editor-96d69516.js.map → text-editor-f8a9ff85.js.map} +0 -0
- /package/dist/revo-grid/{throttle-262c3ed2.js.map → throttle-9b08685d.js.map} +0 -0
package/hydrate/index.js
CHANGED
|
@@ -2439,55 +2439,6 @@ class Clipboard {
|
|
|
2439
2439
|
}; }
|
|
2440
2440
|
}
|
|
2441
2441
|
|
|
2442
|
-
const FILTER_BUTTON_CLASS = 'rv-filter';
|
|
2443
|
-
const FILTER_BUTTON_ACTIVE = 'active';
|
|
2444
|
-
const FILTER_PROP = 'hasFilter';
|
|
2445
|
-
const AND_OR_BUTTON = 'and-or-button';
|
|
2446
|
-
const TRASH_BUTTON = 'trash-button';
|
|
2447
|
-
const FilterButton = ({ column }) => {
|
|
2448
|
-
return (hAsync("span", null,
|
|
2449
|
-
hAsync("button", { class: {
|
|
2450
|
-
[FILTER_BUTTON_CLASS]: true,
|
|
2451
|
-
[FILTER_BUTTON_ACTIVE]: column && !!column[FILTER_PROP],
|
|
2452
|
-
} },
|
|
2453
|
-
hAsync("svg", { class: "filter-img", viewBox: "0 0 64 64" },
|
|
2454
|
-
hAsync("g", { stroke: "none", "stroke-width": "1", fill: "none", "fill-rule": "evenodd" },
|
|
2455
|
-
hAsync("path", { d: "M43,48 L43,56 L21,56 L21,48 L43,48 Z M53,28 L53,36 L12,36 L12,28 L53,28 Z M64,8 L64,16 L0,16 L0,8 L64,8 Z", fill: "currentColor" }))))));
|
|
2456
|
-
};
|
|
2457
|
-
const TrashButton = () => {
|
|
2458
|
-
return (hAsync("div", { class: { [TRASH_BUTTON]: true } },
|
|
2459
|
-
hAsync("svg", { class: "trash-img", viewBox: "0 0 24 24" },
|
|
2460
|
-
hAsync("path", { fill: "currentColor", d: "M9,3V4H4V6H5V19A2,2 0 0,0 7,21H17A2,2 0 0,0 19,19V6H20V4H15V3H9M7,6H17V19H7V6M9,8V17H11V8H9M13,8V17H15V8H13Z" }))));
|
|
2461
|
-
};
|
|
2462
|
-
const AndOrButton = ({ text }) => {
|
|
2463
|
-
return hAsync("button", { class: { [AND_OR_BUTTON]: true, 'light revo-button': true } }, text);
|
|
2464
|
-
};
|
|
2465
|
-
function isFilterBtn(e) {
|
|
2466
|
-
if (e.classList.contains(FILTER_BUTTON_CLASS)) {
|
|
2467
|
-
return true;
|
|
2468
|
-
}
|
|
2469
|
-
return e === null || e === void 0 ? void 0 : e.closest(`.${FILTER_BUTTON_CLASS}`);
|
|
2470
|
-
}
|
|
2471
|
-
|
|
2472
|
-
(function closest() {
|
|
2473
|
-
if (!Element.prototype.matches) {
|
|
2474
|
-
Element.prototype.matches =
|
|
2475
|
-
Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector;
|
|
2476
|
-
}
|
|
2477
|
-
if (!Element.prototype.closest) {
|
|
2478
|
-
Element.prototype.closest = function (s) {
|
|
2479
|
-
let el = this;
|
|
2480
|
-
do {
|
|
2481
|
-
if (Element.prototype.matches.call(el, s)) {
|
|
2482
|
-
return el;
|
|
2483
|
-
}
|
|
2484
|
-
el = el.parentElement || el.parentNode;
|
|
2485
|
-
} while (el !== null && el.nodeType === 1);
|
|
2486
|
-
return null;
|
|
2487
|
-
};
|
|
2488
|
-
}
|
|
2489
|
-
})();
|
|
2490
|
-
|
|
2491
2442
|
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
2492
2443
|
|
|
2493
2444
|
/**
|
|
@@ -3029,6 +2980,55 @@ function debounce$2(func, wait, options) {
|
|
|
3029
2980
|
|
|
3030
2981
|
var debounce_1 = debounce$2;
|
|
3031
2982
|
|
|
2983
|
+
const FILTER_BUTTON_CLASS = 'rv-filter';
|
|
2984
|
+
const FILTER_BUTTON_ACTIVE = 'active';
|
|
2985
|
+
const FILTER_PROP = 'hasFilter';
|
|
2986
|
+
const AND_OR_BUTTON = 'and-or-button';
|
|
2987
|
+
const TRASH_BUTTON = 'trash-button';
|
|
2988
|
+
const FilterButton = ({ column }) => {
|
|
2989
|
+
return (hAsync("span", null,
|
|
2990
|
+
hAsync("button", { class: {
|
|
2991
|
+
[FILTER_BUTTON_CLASS]: true,
|
|
2992
|
+
[FILTER_BUTTON_ACTIVE]: column && !!column[FILTER_PROP],
|
|
2993
|
+
} },
|
|
2994
|
+
hAsync("svg", { class: "filter-img", viewBox: "0 0 64 64" },
|
|
2995
|
+
hAsync("g", { stroke: "none", "stroke-width": "1", fill: "none", "fill-rule": "evenodd" },
|
|
2996
|
+
hAsync("path", { d: "M43,48 L43,56 L21,56 L21,48 L43,48 Z M53,28 L53,36 L12,36 L12,28 L53,28 Z M64,8 L64,16 L0,16 L0,8 L64,8 Z", fill: "currentColor" }))))));
|
|
2997
|
+
};
|
|
2998
|
+
const TrashButton = () => {
|
|
2999
|
+
return (hAsync("div", { class: { [TRASH_BUTTON]: true } },
|
|
3000
|
+
hAsync("svg", { class: "trash-img", viewBox: "0 0 24 24" },
|
|
3001
|
+
hAsync("path", { fill: "currentColor", d: "M9,3V4H4V6H5V19A2,2 0 0,0 7,21H17A2,2 0 0,0 19,19V6H20V4H15V3H9M7,6H17V19H7V6M9,8V17H11V8H9M13,8V17H15V8H13Z" }))));
|
|
3002
|
+
};
|
|
3003
|
+
const AndOrButton = ({ text }) => {
|
|
3004
|
+
return hAsync("button", { class: { [AND_OR_BUTTON]: true, 'light revo-button': true } }, text);
|
|
3005
|
+
};
|
|
3006
|
+
function isFilterBtn(e) {
|
|
3007
|
+
if (e.classList.contains(FILTER_BUTTON_CLASS)) {
|
|
3008
|
+
return true;
|
|
3009
|
+
}
|
|
3010
|
+
return e === null || e === void 0 ? void 0 : e.closest(`.${FILTER_BUTTON_CLASS}`);
|
|
3011
|
+
}
|
|
3012
|
+
|
|
3013
|
+
(function closest() {
|
|
3014
|
+
if (!Element.prototype.matches) {
|
|
3015
|
+
Element.prototype.matches =
|
|
3016
|
+
Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector;
|
|
3017
|
+
}
|
|
3018
|
+
if (!Element.prototype.closest) {
|
|
3019
|
+
Element.prototype.closest = function (s) {
|
|
3020
|
+
let el = this;
|
|
3021
|
+
do {
|
|
3022
|
+
if (Element.prototype.matches.call(el, s)) {
|
|
3023
|
+
return el;
|
|
3024
|
+
}
|
|
3025
|
+
el = el.parentElement || el.parentNode;
|
|
3026
|
+
} while (el !== null && el.nodeType === 1);
|
|
3027
|
+
return null;
|
|
3028
|
+
};
|
|
3029
|
+
}
|
|
3030
|
+
})();
|
|
3031
|
+
|
|
3032
3032
|
const filterStyleCss = ".revo-drag-icon{width:11px;opacity:0.8}.revo-drag-icon::before{content:\"::\"}.revo-alt-icon{-webkit-mask-image:url(\"data:image/svg+xml,%3C%3Fxml version='1.0' encoding='UTF-8'%3F%3E%3Csvg viewBox='0 0 384 383' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'%3E%3Cg%3E%3Cpath d='M192.4375,383 C197.424479,383 201.663411,381.254557 205.154297,377.763672 L205.154297,377.763672 L264.25,318.667969 C270.234375,312.683594 271.605794,306.075846 268.364258,298.844727 C265.122721,291.613607 259.51237,287.998047 251.533203,287.998047 L251.533203,287.998047 L213.382812,287.998047 L213.382812,212.445312 L288.935547,212.445312 L288.935547,250.595703 C288.935547,258.57487 292.551107,264.185221 299.782227,267.426758 C307.013346,270.668294 313.621094,269.296875 319.605469,263.3125 L319.605469,263.3125 L378.701172,204.216797 C382.192057,200.725911 383.9375,196.486979 383.9375,191.5 C383.9375,186.513021 382.192057,182.274089 378.701172,178.783203 L378.701172,178.783203 L319.605469,119.6875 C313.621094,114.201823 307.013346,112.955078 299.782227,115.947266 C292.551107,118.939453 288.935547,124.42513 288.935547,132.404297 L288.935547,132.404297 L288.935547,170.554688 L213.382812,170.554688 L213.382812,95.0019531 L251.533203,95.0019531 C259.51237,95.0019531 264.998047,91.3863932 267.990234,84.1552734 C270.982422,76.9241536 269.735677,70.3164062 264.25,64.3320312 L264.25,64.3320312 L205.154297,5.23632812 C201.663411,1.74544271 197.424479,0 192.4375,0 C187.450521,0 183.211589,1.74544271 179.720703,5.23632812 L179.720703,5.23632812 L120.625,64.3320312 C114.640625,70.3164062 113.269206,76.9241536 116.510742,84.1552734 C119.752279,91.3863932 125.36263,95.0019531 133.341797,95.0019531 L133.341797,95.0019531 L171.492188,95.0019531 L171.492188,170.554688 L95.9394531,170.554688 L95.9394531,132.404297 C95.9394531,124.42513 92.3238932,118.814779 85.0927734,115.573242 C77.8616536,112.331706 71.2539062,113.703125 65.2695312,119.6875 L65.2695312,119.6875 L6.17382812,178.783203 C2.68294271,182.274089 0.9375,186.513021 0.9375,191.5 C0.9375,196.486979 2.68294271,200.725911 6.17382812,204.216797 L6.17382812,204.216797 L65.2695312,263.3125 C71.2539062,268.798177 77.8616536,270.044922 85.0927734,267.052734 C92.3238932,264.060547 95.9394531,258.57487 95.9394531,250.595703 L95.9394531,250.595703 L95.9394531,212.445312 L171.492188,212.445312 L171.492188,287.998047 L133.341797,287.998047 C125.36263,287.998047 119.876953,291.613607 116.884766,298.844727 C113.892578,306.075846 115.139323,312.683594 120.625,318.667969 L120.625,318.667969 L179.720703,377.763672 C183.211589,381.254557 187.450521,383 192.4375,383 Z'%3E%3C/path%3E%3C/g%3E%3C/svg%3E\");mask-image:url(\"data:image/svg+xml,%3C%3Fxml version='1.0' encoding='UTF-8'%3F%3E%3Csvg viewBox='0 0 384 383' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'%3E%3Cg%3E%3Cpath d='M192.4375,383 C197.424479,383 201.663411,381.254557 205.154297,377.763672 L205.154297,377.763672 L264.25,318.667969 C270.234375,312.683594 271.605794,306.075846 268.364258,298.844727 C265.122721,291.613607 259.51237,287.998047 251.533203,287.998047 L251.533203,287.998047 L213.382812,287.998047 L213.382812,212.445312 L288.935547,212.445312 L288.935547,250.595703 C288.935547,258.57487 292.551107,264.185221 299.782227,267.426758 C307.013346,270.668294 313.621094,269.296875 319.605469,263.3125 L319.605469,263.3125 L378.701172,204.216797 C382.192057,200.725911 383.9375,196.486979 383.9375,191.5 C383.9375,186.513021 382.192057,182.274089 378.701172,178.783203 L378.701172,178.783203 L319.605469,119.6875 C313.621094,114.201823 307.013346,112.955078 299.782227,115.947266 C292.551107,118.939453 288.935547,124.42513 288.935547,132.404297 L288.935547,132.404297 L288.935547,170.554688 L213.382812,170.554688 L213.382812,95.0019531 L251.533203,95.0019531 C259.51237,95.0019531 264.998047,91.3863932 267.990234,84.1552734 C270.982422,76.9241536 269.735677,70.3164062 264.25,64.3320312 L264.25,64.3320312 L205.154297,5.23632812 C201.663411,1.74544271 197.424479,0 192.4375,0 C187.450521,0 183.211589,1.74544271 179.720703,5.23632812 L179.720703,5.23632812 L120.625,64.3320312 C114.640625,70.3164062 113.269206,76.9241536 116.510742,84.1552734 C119.752279,91.3863932 125.36263,95.0019531 133.341797,95.0019531 L133.341797,95.0019531 L171.492188,95.0019531 L171.492188,170.554688 L95.9394531,170.554688 L95.9394531,132.404297 C95.9394531,124.42513 92.3238932,118.814779 85.0927734,115.573242 C77.8616536,112.331706 71.2539062,113.703125 65.2695312,119.6875 L65.2695312,119.6875 L6.17382812,178.783203 C2.68294271,182.274089 0.9375,186.513021 0.9375,191.5 C0.9375,196.486979 2.68294271,200.725911 6.17382812,204.216797 L6.17382812,204.216797 L65.2695312,263.3125 C71.2539062,268.798177 77.8616536,270.044922 85.0927734,267.052734 C92.3238932,264.060547 95.9394531,258.57487 95.9394531,250.595703 L95.9394531,250.595703 L95.9394531,212.445312 L171.492188,212.445312 L171.492188,287.998047 L133.341797,287.998047 C125.36263,287.998047 119.876953,291.613607 116.884766,298.844727 C113.892578,306.075846 115.139323,312.683594 120.625,318.667969 L120.625,318.667969 L179.720703,377.763672 C183.211589,381.254557 187.450521,383 192.4375,383 Z'%3E%3C/path%3E%3C/g%3E%3C/svg%3E\");width:11px;height:11px;background-size:cover;background-repeat:no-repeat}.arrow-down{position:absolute;right:5px;top:0}.arrow-down svg{width:8px;margin-top:5px;margin-left:5px;opacity:0.4}.cell-value-wrapper{margin-right:10px;overflow:hidden;text-overflow:ellipsis}.revo-button{position:relative;overflow:hidden;color:#fff;background-color:#6200ee;height:34px;line-height:34px;padding:0 15px;outline:0;border:0;border-radius:7px;box-sizing:border-box;cursor:pointer}.revo-button.green{background-color:#009037;border:1px solid #00772d}.revo-button.red{background-color:#E0662E;border:1px solid #d55920}.revo-button:disabled,.revo-button[disabled]{cursor:not-allowed !important;filter:opacity(0.35) !important}.revo-button.light{border:1px solid #cedefa;line-height:32px;background:none;color:#000;box-shadow:none}revogr-filter-panel{position:absolute;display:block;top:0;left:0;z-index:100;opacity:1;transform:none;background-color:#fff;transform-origin:62px 0px;box-shadow:0 5px 18px -2px rgba(0, 0, 0, 0.2);padding:10px;border-radius:4px;min-width:220px;text-align:left}revogr-filter-panel .filter-holder>div{display:flex;flex-direction:column}revogr-filter-panel label{font-size:13px;display:block;padding:8px 0}revogr-filter-panel select{width:100%}revogr-filter-panel input[type=text]{border:0;min-height:34px;margin:5px 0;background:#f3f3f3;border-radius:5px;padding:0 10px;box-sizing:border-box;width:100%}revogr-filter-panel button{margin-top:10px;margin-right:5px}revogr-filter-panel .filter-actions{text-align:right;margin-right:-5px}.rgHeaderCell:hover .rv-filter{transition:opacity 267ms cubic-bezier(0.4, 0, 0.2, 1) 0ms, transform 178ms cubic-bezier(0.4, 0, 0.2, 1) 0ms}.rgHeaderCell:hover .rv-filter,.rgHeaderCell .rv-filter.active{opacity:1}.rgHeaderCell .rv-filter{height:24px;width:24px;background:none;border:0;opacity:0;visibility:visible;cursor:pointer;border-radius:4px}.rgHeaderCell .rv-filter.active{color:#10224a}.rgHeaderCell .rv-filter .filter-img{color:gray;width:11px}.select-css{display:block;font-family:sans-serif;font-weight:600;color:#444;line-height:1.3;padding:0.6em 1.4em 0.5em 0.8em;width:100%;max-width:100%;box-sizing:border-box;margin:0;border:1px solid #f1f1f1;box-shadow:transparent;border-radius:0.5em;appearance:none;background-color:#fff;background-image:url(\"data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%23007CB2%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E\"), linear-gradient(to bottom, #ffffff 0%, #ffffff 100%);background-repeat:no-repeat, repeat;background-position:right 0.7em top 50%, 0 0;background-size:0.65em auto, 100%;}.select-css::-ms-expand{display:none}.select-css:hover{border-color:rgb(197, 197, 197)}.select-css:focus{border-color:#f1f1f1;box-shadow:0 0 1px 3px rgba(59, 153, 252, 0.7);box-shadow:0 0 0 3px -moz-mac-focusring;color:#222;outline:none}.select-css option{font-weight:normal}.select-css:disabled,.select-css[aria-disabled=true]{color:gray;background-image:url(\"data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22graytext%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E\"), linear-gradient(to bottom, #ffffff 0%, #ffffff 100%)}.select-css:disabled:hover,.select-css[aria-disabled=true]{border-color:#f1f1f1}.multi-filter-list{margin-top:5px;margin-bottom:5px}.multi-filter-list div{white-space:nowrap}.multi-filter-list .multi-filter-list-action{display:flex;justify-content:space-between;align-items:center}.multi-filter-list .and-or-button{margin:0 0 0 10px;min-width:58px;cursor:pointer}.multi-filter-list .trash-button{margin:0 0 -2px 6px;cursor:pointer;width:22px;height:100%;font-size:16px}.multi-filter-list .trash-button .trash-img{width:1em}.add-filter-divider{display:block;margin:0 -10px 10px -10px;border-bottom:1px solid #d9d9d9;height:10px}.select-input{display:flex;justify-content:space-between;align-items:center}";
|
|
3033
3033
|
var RevogrFilterPanelStyle0 = filterStyleCss;
|
|
3034
3034
|
|
|
@@ -3066,7 +3066,6 @@ class FilterPanel {
|
|
|
3066
3066
|
this.currentFilterType = defaultType;
|
|
3067
3067
|
this.changes = undefined;
|
|
3068
3068
|
this.filterItems = {};
|
|
3069
|
-
this.filterTypes = {};
|
|
3070
3069
|
this.filterNames = {};
|
|
3071
3070
|
this.filterEntities = {};
|
|
3072
3071
|
this.filterCaptions = undefined;
|
|
@@ -3092,7 +3091,9 @@ class FilterPanel {
|
|
|
3092
3091
|
}
|
|
3093
3092
|
this.currentFilterId = -1;
|
|
3094
3093
|
const isOutside = !path.includes(this.element);
|
|
3095
|
-
if (e.target instanceof HTMLElement &&
|
|
3094
|
+
if (e.target instanceof HTMLElement &&
|
|
3095
|
+
isOutside &&
|
|
3096
|
+
!isFilterBtn(e.target)) {
|
|
3096
3097
|
this.changes = undefined;
|
|
3097
3098
|
}
|
|
3098
3099
|
}
|
|
@@ -3116,15 +3117,19 @@ class FilterPanel {
|
|
|
3116
3117
|
}
|
|
3117
3118
|
}
|
|
3118
3119
|
renderSelectOptions(type, isDefaultTypeRemoved = false) {
|
|
3119
|
-
|
|
3120
|
+
if (!this.changes) {
|
|
3121
|
+
return;
|
|
3122
|
+
}
|
|
3120
3123
|
const options = [];
|
|
3121
|
-
const prop =
|
|
3124
|
+
const prop = this.changes.prop;
|
|
3122
3125
|
if (!isDefaultTypeRemoved) {
|
|
3123
3126
|
const capts = Object.assign(this.filterCaptionsInternal, this.filterCaptions);
|
|
3124
|
-
options.push(hAsync("option", { selected: this.currentFilterType === defaultType, value: defaultType }, prop && this.filterItems[prop] && this.filterItems[prop].length > 0
|
|
3127
|
+
options.push(hAsync("option", { selected: this.currentFilterType === defaultType, value: defaultType }, prop && this.filterItems[prop] && this.filterItems[prop].length > 0
|
|
3128
|
+
? capts.add
|
|
3129
|
+
: this.filterNames[defaultType]));
|
|
3125
3130
|
}
|
|
3126
|
-
for (let gIndex in this.filterTypes) {
|
|
3127
|
-
options.push(...this.filterTypes[gIndex].map(k => (hAsync("option", { value: k, selected: type === k }, this.filterNames[k]))));
|
|
3131
|
+
for (let gIndex in this.changes.filterTypes) {
|
|
3132
|
+
options.push(...this.changes.filterTypes[gIndex].map(k => (hAsync("option", { value: k, selected: type === k }, this.filterNames[k]))));
|
|
3128
3133
|
options.push(hAsync("option", { disabled: true }));
|
|
3129
3134
|
}
|
|
3130
3135
|
return options;
|
|
@@ -3175,8 +3180,10 @@ class FilterPanel {
|
|
|
3175
3180
|
top: `${this.changes.y}px`,
|
|
3176
3181
|
};
|
|
3177
3182
|
const capts = Object.assign(this.filterCaptionsInternal, this.filterCaptions);
|
|
3178
|
-
return (hAsync(Host, { style: style, ref:
|
|
3179
|
-
|
|
3183
|
+
return (hAsync(Host, { style: style, ref: el => {
|
|
3184
|
+
var _a;
|
|
3185
|
+
((_a = this.changes) === null || _a === void 0 ? void 0 : _a.autoCorrect) && this.autoCorrect(el);
|
|
3186
|
+
} }, hAsync("label", null, capts.title), hAsync("div", { class: "filter-holder" }, this.getFilterItemsList()), hAsync("div", { class: "add-filter" }, hAsync("select", { id: FILTER_ID, class: "select-css", onChange: e => this.onAddNewFilter(e) }, this.renderSelectOptions(this.currentFilterType))), hAsync("div", { class: "filter-actions" }, this.disableDynamicFiltering && (hAsync("button", { id: "revo-button-save", "aria-label": "save", class: "revo-button green", onClick: () => this.onSave() }, capts.save)), hAsync("button", { id: "revo-button-reset", "aria-label": "reset", class: "revo-button light", onClick: () => this.onReset() }, capts.reset), hAsync("button", { id: "revo-button-cancel", "aria-label": "cancel", class: "revo-button light", onClick: () => this.onCancel() }, capts.cancel))));
|
|
3180
3187
|
}
|
|
3181
3188
|
onFilterTypeChange(e, prop, index) {
|
|
3182
3189
|
if (!(e.target instanceof HTMLSelectElement)) {
|
|
@@ -3314,7 +3321,6 @@ class FilterPanel {
|
|
|
3314
3321
|
"$tagName$": "revogr-filter-panel",
|
|
3315
3322
|
"$members$": {
|
|
3316
3323
|
"filterItems": [16],
|
|
3317
|
-
"filterTypes": [16],
|
|
3318
3324
|
"filterNames": [16],
|
|
3319
3325
|
"filterEntities": [16],
|
|
3320
3326
|
"filterCaptions": [16],
|
|
@@ -8648,507 +8654,133 @@ class OrderEditor {
|
|
|
8648
8654
|
}; }
|
|
8649
8655
|
}
|
|
8650
8656
|
|
|
8651
|
-
|
|
8652
|
-
|
|
8653
|
-
|
|
8654
|
-
const PSEUDO_GROUP_ITEM_VALUE = `${GRID_INTERNALS}-value`;
|
|
8655
|
-
const PSEUDO_GROUP_COLUMN = `${GRID_INTERNALS}-column`;
|
|
8656
|
-
const GROUP_EXPANDED = `${GRID_INTERNALS}-expanded`;
|
|
8657
|
-
const GROUP_ORIGINAL_INDEX = `${GRID_INTERNALS}-original-index`;
|
|
8658
|
-
const GROUP_EXPAND_BTN = `group-expand`;
|
|
8659
|
-
const GROUP_EXPAND_EVENT = `groupexpandclick`;
|
|
8660
|
-
const GROUPING_ROW_TYPE = 'rgRow';
|
|
8661
|
-
|
|
8662
|
-
function getGroupValueDefault(item, prop) {
|
|
8663
|
-
return item[prop] || null;
|
|
8664
|
-
}
|
|
8665
|
-
/**
|
|
8666
|
-
* Gather data for grouping
|
|
8667
|
-
* @param array - flat data array
|
|
8668
|
-
* @param groupIds - ids of groups
|
|
8669
|
-
* @param expanded - potentially expanded items if present
|
|
8670
|
-
*/
|
|
8671
|
-
function gatherGrouping(array, groupIds, { prevExpanded, expandedAll, getGroupValue = getGroupValueDefault, }) {
|
|
8672
|
-
const groupedItems = new Map();
|
|
8673
|
-
array.forEach((item, originalIndex) => {
|
|
8674
|
-
const groupLevelValues = groupIds.map(groupId => getGroupValue(item, groupId));
|
|
8675
|
-
const lastLevelValue = groupLevelValues.pop();
|
|
8676
|
-
let currentGroupLevel = groupedItems;
|
|
8677
|
-
groupLevelValues.forEach(value => {
|
|
8678
|
-
if (!currentGroupLevel.has(value)) {
|
|
8679
|
-
currentGroupLevel.set(value, new Map());
|
|
8680
|
-
}
|
|
8681
|
-
currentGroupLevel = currentGroupLevel.get(value);
|
|
8682
|
-
});
|
|
8683
|
-
if (!currentGroupLevel.has(lastLevelValue)) {
|
|
8684
|
-
currentGroupLevel.set(lastLevelValue, []);
|
|
8685
|
-
}
|
|
8686
|
-
const lastLevelItems = currentGroupLevel.get(lastLevelValue);
|
|
8687
|
-
lastLevelItems.push(Object.assign(Object.assign({}, item), { [GROUP_ORIGINAL_INDEX]: originalIndex }));
|
|
8688
|
-
});
|
|
8689
|
-
let itemIndex = -1;
|
|
8690
|
-
const groupingDepth = groupIds.length;
|
|
8691
|
-
// collapse all groups in the beginning
|
|
8692
|
-
const trimmed = {};
|
|
8693
|
-
// index mapping
|
|
8694
|
-
const oldNewIndexMap = {};
|
|
8695
|
-
// check if group header exists
|
|
8696
|
-
const pseudoGroupTest = {};
|
|
8697
|
-
const sourceWithGroups = [];
|
|
8698
|
-
function flattenGroupMaps(groupedValues, parentIds, isExpanded) {
|
|
8699
|
-
const depth = parentIds.length;
|
|
8700
|
-
groupedValues.forEach((innerGroupedValues, groupId) => {
|
|
8701
|
-
const levelIds = [...parentIds, groupId];
|
|
8702
|
-
const mergedIds = levelIds.join(',');
|
|
8703
|
-
const isGroupExpanded = isExpanded && (!!expandedAll || !!(prevExpanded === null || prevExpanded === void 0 ? void 0 : prevExpanded[mergedIds]));
|
|
8704
|
-
sourceWithGroups.push({
|
|
8705
|
-
[PSEUDO_GROUP_ITEM]: groupId,
|
|
8706
|
-
[GROUP_DEPTH]: depth,
|
|
8707
|
-
[PSEUDO_GROUP_ITEM_ID]: JSON.stringify(levelIds),
|
|
8708
|
-
[PSEUDO_GROUP_ITEM_VALUE]: mergedIds,
|
|
8709
|
-
[GROUP_EXPANDED]: isGroupExpanded,
|
|
8710
|
-
});
|
|
8711
|
-
itemIndex += 1;
|
|
8712
|
-
if (!isGroupExpanded && depth) {
|
|
8713
|
-
trimmed[itemIndex] = true;
|
|
8714
|
-
}
|
|
8715
|
-
if (Array.isArray(innerGroupedValues)) {
|
|
8716
|
-
innerGroupedValues.forEach(value => {
|
|
8717
|
-
itemIndex += 1;
|
|
8718
|
-
if (!isGroupExpanded) {
|
|
8719
|
-
trimmed[itemIndex] = true;
|
|
8720
|
-
}
|
|
8721
|
-
oldNewIndexMap[value[GROUP_ORIGINAL_INDEX]] = itemIndex;
|
|
8722
|
-
const pseudoGroupTestIds = levelIds.map((_value, index) => levelIds.slice(0, index + 1).join(','));
|
|
8723
|
-
pseudoGroupTestIds.forEach(pseudoGroupTestId => {
|
|
8724
|
-
if (!pseudoGroupTest[pseudoGroupTestId]) {
|
|
8725
|
-
pseudoGroupTest[pseudoGroupTestId] = [];
|
|
8726
|
-
}
|
|
8727
|
-
pseudoGroupTest[pseudoGroupTestId].push(itemIndex);
|
|
8728
|
-
});
|
|
8729
|
-
});
|
|
8730
|
-
sourceWithGroups.push(...innerGroupedValues);
|
|
8731
|
-
}
|
|
8732
|
-
else {
|
|
8733
|
-
flattenGroupMaps(innerGroupedValues, levelIds, isGroupExpanded);
|
|
8734
|
-
}
|
|
8735
|
-
});
|
|
8657
|
+
function getCellData(val) {
|
|
8658
|
+
if (typeof val === 'undefined' || val === null) {
|
|
8659
|
+
return '';
|
|
8736
8660
|
}
|
|
8737
|
-
|
|
8738
|
-
return {
|
|
8739
|
-
sourceWithGroups, // updates source mirror
|
|
8740
|
-
depth: groupingDepth, // largest depth for grouping
|
|
8741
|
-
trimmed, // used for expand/collapse grouping values
|
|
8742
|
-
oldNewIndexMap, // used for mapping old values to new
|
|
8743
|
-
childrenByGroup: pseudoGroupTest, // used to get child items in group
|
|
8744
|
-
};
|
|
8745
|
-
}
|
|
8746
|
-
function getGroupingName(rgRow) {
|
|
8747
|
-
return rgRow && rgRow[PSEUDO_GROUP_ITEM];
|
|
8748
|
-
}
|
|
8749
|
-
function isGrouping(rgRow) {
|
|
8750
|
-
return typeof (rgRow === null || rgRow === void 0 ? void 0 : rgRow[PSEUDO_GROUP_ITEM]) !== 'undefined';
|
|
8661
|
+
return val;
|
|
8751
8662
|
}
|
|
8752
|
-
function
|
|
8753
|
-
|
|
8663
|
+
function getCellDataParsed(model, column) {
|
|
8664
|
+
const val = column.cellParser ? column.cellParser(model, column) : model[column.prop];
|
|
8665
|
+
return getCellData(val);
|
|
8754
8666
|
}
|
|
8755
|
-
function
|
|
8756
|
-
|
|
8757
|
-
|
|
8758
|
-
for (; i < ln; i++) {
|
|
8759
|
-
if (groupA[i] !== groupB[i]) {
|
|
8760
|
-
return i;
|
|
8761
|
-
}
|
|
8667
|
+
function getColumnType(rgCol) {
|
|
8668
|
+
if (rgCol.pin) {
|
|
8669
|
+
return rgCol.pin;
|
|
8762
8670
|
}
|
|
8763
|
-
return
|
|
8671
|
+
return 'rgCol';
|
|
8764
8672
|
}
|
|
8765
|
-
function
|
|
8766
|
-
const
|
|
8767
|
-
|
|
8768
|
-
|
|
8769
|
-
|
|
8673
|
+
function getColumnSizes(cols) {
|
|
8674
|
+
const res = {};
|
|
8675
|
+
for (const [i, c] of cols.entries()) {
|
|
8676
|
+
if (c.size) {
|
|
8677
|
+
res[i] = c.size;
|
|
8678
|
+
}
|
|
8770
8679
|
}
|
|
8771
|
-
return
|
|
8680
|
+
return res;
|
|
8772
8681
|
}
|
|
8773
|
-
|
|
8774
|
-
|
|
8775
|
-
|
|
8776
|
-
|
|
8777
|
-
|
|
8778
|
-
}
|
|
8779
|
-
const depth = measureEqualDepth(currentGroup, nextGroup);
|
|
8780
|
-
return currentModel[GROUP_DEPTH] < depth;
|
|
8682
|
+
/**
|
|
8683
|
+
* Check if column is grouping column
|
|
8684
|
+
*/
|
|
8685
|
+
function isColGrouping(colData) {
|
|
8686
|
+
return !!colData.children;
|
|
8781
8687
|
}
|
|
8782
|
-
|
|
8783
8688
|
/**
|
|
8784
|
-
*
|
|
8785
|
-
*
|
|
8786
|
-
* @private
|
|
8787
|
-
* @param {Array} array The array to slice.
|
|
8788
|
-
* @param {number} [start=0] The start position.
|
|
8789
|
-
* @param {number} [end=array.length] The end position.
|
|
8790
|
-
* @returns {Array} Returns the slice of `array`.
|
|
8689
|
+
* This function is used to create a collection of columns.
|
|
8791
8690
|
*/
|
|
8792
|
-
|
|
8793
|
-
|
|
8794
|
-
|
|
8795
|
-
|
|
8796
|
-
|
|
8797
|
-
|
|
8798
|
-
|
|
8799
|
-
|
|
8800
|
-
|
|
8801
|
-
|
|
8802
|
-
|
|
8803
|
-
|
|
8804
|
-
|
|
8805
|
-
|
|
8806
|
-
|
|
8807
|
-
|
|
8808
|
-
|
|
8809
|
-
|
|
8810
|
-
|
|
8811
|
-
|
|
8812
|
-
}
|
|
8813
|
-
|
|
8814
|
-
|
|
8815
|
-
|
|
8816
|
-
|
|
8817
|
-
isIterateeCall$1 = _isIterateeCall,
|
|
8818
|
-
toInteger$2 = toInteger_1;
|
|
8819
|
-
|
|
8820
|
-
/**
|
|
8821
|
-
* Creates a slice of `array` from `start` up to, but not including, `end`.
|
|
8822
|
-
*
|
|
8823
|
-
* **Note:** This method is used instead of
|
|
8824
|
-
* [`Array#slice`](https://mdn.io/Array/slice) to ensure dense arrays are
|
|
8825
|
-
* returned.
|
|
8826
|
-
*
|
|
8827
|
-
* @static
|
|
8828
|
-
* @memberOf _
|
|
8829
|
-
* @since 3.0.0
|
|
8830
|
-
* @category Array
|
|
8831
|
-
* @param {Array} array The array to slice.
|
|
8832
|
-
* @param {number} [start=0] The start position.
|
|
8833
|
-
* @param {number} [end=array.length] The end position.
|
|
8834
|
-
* @returns {Array} Returns the slice of `array`.
|
|
8835
|
-
*/
|
|
8836
|
-
function slice(array, start, end) {
|
|
8837
|
-
var length = array == null ? 0 : array.length;
|
|
8838
|
-
if (!length) {
|
|
8839
|
-
return [];
|
|
8840
|
-
}
|
|
8841
|
-
if (end && typeof end != 'number' && isIterateeCall$1(array, start, end)) {
|
|
8842
|
-
start = 0;
|
|
8843
|
-
end = length;
|
|
8844
|
-
}
|
|
8845
|
-
else {
|
|
8846
|
-
start = start == null ? 0 : toInteger$2(start);
|
|
8847
|
-
end = end === undefined ? length : toInteger$2(end);
|
|
8848
|
-
}
|
|
8849
|
-
return baseSlice(array, start, end);
|
|
8850
|
-
}
|
|
8851
|
-
|
|
8852
|
-
var slice_1 = slice;
|
|
8853
|
-
|
|
8854
|
-
class ColumnService {
|
|
8855
|
-
get columns() {
|
|
8856
|
-
return getVisibleSourceItem(this.source);
|
|
8857
|
-
}
|
|
8858
|
-
constructor(dataStore, source) {
|
|
8859
|
-
this.dataStore = dataStore;
|
|
8860
|
-
this.source = source;
|
|
8861
|
-
this.unsubscribe = [];
|
|
8862
|
-
this.hasGrouping = false;
|
|
8863
|
-
this.unsubscribe.push(source.onChange('source', s => this.checkGrouping(s)));
|
|
8864
|
-
this.checkGrouping(source.get('source'));
|
|
8865
|
-
this.type = source.get('type');
|
|
8866
|
-
}
|
|
8867
|
-
checkGrouping(cols) {
|
|
8868
|
-
for (let rgCol of cols) {
|
|
8869
|
-
if (isGroupingColumn(rgCol)) {
|
|
8870
|
-
this.hasGrouping = true;
|
|
8871
|
-
return;
|
|
8872
|
-
}
|
|
8873
|
-
this.hasGrouping = false;
|
|
8874
|
-
}
|
|
8875
|
-
}
|
|
8876
|
-
isReadOnly(r, c) {
|
|
8877
|
-
var _a;
|
|
8878
|
-
const readOnly = (_a = this.columns[c]) === null || _a === void 0 ? void 0 : _a.readonly;
|
|
8879
|
-
if (typeof readOnly === 'function') {
|
|
8880
|
-
const data = this.rowDataModel(r, c);
|
|
8881
|
-
return readOnly(data);
|
|
8882
|
-
}
|
|
8883
|
-
return !!readOnly;
|
|
8884
|
-
}
|
|
8885
|
-
mergeProperties(r, c, defaultProps, model, extraPropsFunc) {
|
|
8886
|
-
const cellClass = {
|
|
8887
|
-
[CELL_CLASS]: true,
|
|
8888
|
-
[DISABLED_CLASS]: this.isReadOnly(r, c),
|
|
8889
|
-
};
|
|
8890
|
-
let props = Object.assign(Object.assign({}, defaultProps), { class: cellClass });
|
|
8891
|
-
const extra = extraPropsFunc === null || extraPropsFunc === void 0 ? void 0 : extraPropsFunc(model);
|
|
8892
|
-
if (!extra) {
|
|
8893
|
-
return props;
|
|
8691
|
+
function getColumns(columns, level = 0, types) {
|
|
8692
|
+
const collection = {
|
|
8693
|
+
// columns as they are in stores per type
|
|
8694
|
+
columns: {
|
|
8695
|
+
rgCol: [],
|
|
8696
|
+
colPinStart: [],
|
|
8697
|
+
colPinEnd: [],
|
|
8698
|
+
},
|
|
8699
|
+
// columns indexed by prop for quick access
|
|
8700
|
+
columnByProp: {},
|
|
8701
|
+
// column grouping
|
|
8702
|
+
columnGrouping: {
|
|
8703
|
+
rgCol: [],
|
|
8704
|
+
colPinStart: [],
|
|
8705
|
+
colPinEnd: [],
|
|
8706
|
+
},
|
|
8707
|
+
// max depth level for column grouping
|
|
8708
|
+
maxLevel: level,
|
|
8709
|
+
// sorting
|
|
8710
|
+
sort: {},
|
|
8711
|
+
};
|
|
8712
|
+
return reduce_1(columns, (res, colData) => {
|
|
8713
|
+
// Grouped column
|
|
8714
|
+
if (isColGrouping(colData)) {
|
|
8715
|
+
return gatherGroup(res, colData, getColumns(colData.children, level + 1, types), level);
|
|
8894
8716
|
}
|
|
8895
|
-
|
|
8896
|
-
|
|
8897
|
-
|
|
8898
|
-
|
|
8899
|
-
|
|
8900
|
-
|
|
8901
|
-
getCellData(r, c) {
|
|
8902
|
-
const data = this.rowDataModel(r, c);
|
|
8903
|
-
return getCellData(data.model[data.prop]);
|
|
8904
|
-
}
|
|
8905
|
-
getSaveData(rowIndex, colIndex, val) {
|
|
8906
|
-
if (typeof val === 'undefined') {
|
|
8907
|
-
val = this.getCellData(rowIndex, colIndex);
|
|
8717
|
+
// Regular column
|
|
8718
|
+
const regularColumn = Object.assign(Object.assign({}, (colData.columnType && types && types[colData.columnType])), colData);
|
|
8719
|
+
// Regular column, no Pin
|
|
8720
|
+
if (!regularColumn.pin) {
|
|
8721
|
+
res.columns.rgCol.push(regularColumn);
|
|
8722
|
+
// Pin
|
|
8908
8723
|
}
|
|
8909
|
-
|
|
8910
|
-
|
|
8911
|
-
prop: data.prop,
|
|
8912
|
-
rowIndex,
|
|
8913
|
-
colIndex,
|
|
8914
|
-
val,
|
|
8915
|
-
model: data.model,
|
|
8916
|
-
colType: this.type,
|
|
8917
|
-
type: this.dataStore.get('type'),
|
|
8918
|
-
};
|
|
8919
|
-
}
|
|
8920
|
-
getCellEditor(_r, c, editors) {
|
|
8921
|
-
var _a;
|
|
8922
|
-
const editor = (_a = this.columns[c]) === null || _a === void 0 ? void 0 : _a.editor;
|
|
8923
|
-
if (!editor) {
|
|
8924
|
-
return undefined;
|
|
8724
|
+
else {
|
|
8725
|
+
res.columns[regularColumn.pin].push(regularColumn);
|
|
8925
8726
|
}
|
|
8926
|
-
|
|
8927
|
-
|
|
8928
|
-
return editors[editor];
|
|
8727
|
+
if (regularColumn.order) {
|
|
8728
|
+
res.sort[regularColumn.prop] = regularColumn;
|
|
8929
8729
|
}
|
|
8930
|
-
|
|
8931
|
-
|
|
8932
|
-
|
|
8933
|
-
* Get cell data model for given rowIndex and colIndex
|
|
8934
|
-
* Used to pass data to editor/renderer
|
|
8935
|
-
*/
|
|
8936
|
-
rowDataModel(rowIndex, colIndex) {
|
|
8937
|
-
const column = this.columns[colIndex];
|
|
8938
|
-
const prop = column === null || column === void 0 ? void 0 : column.prop;
|
|
8939
|
-
const model = getSourceItem(this.dataStore, rowIndex) || {};
|
|
8940
|
-
const value = model[prop];
|
|
8941
|
-
const type = this.dataStore.get('type');
|
|
8942
|
-
return {
|
|
8943
|
-
prop,
|
|
8944
|
-
model,
|
|
8945
|
-
data: this.dataStore.get('source'),
|
|
8946
|
-
column,
|
|
8947
|
-
rowIndex,
|
|
8948
|
-
colIndex,
|
|
8949
|
-
colType: this.type,
|
|
8950
|
-
type,
|
|
8951
|
-
value,
|
|
8952
|
-
};
|
|
8953
|
-
}
|
|
8954
|
-
getRangeData(d, columns) {
|
|
8955
|
-
var _a;
|
|
8956
|
-
const changed = {};
|
|
8957
|
-
// get original length sizes
|
|
8958
|
-
const copyColLength = d.oldRange.x1 - d.oldRange.x + 1;
|
|
8959
|
-
const copyRowLength = d.oldRange.y1 - d.oldRange.y + 1;
|
|
8960
|
-
const mapping = {};
|
|
8961
|
-
// rows
|
|
8962
|
-
for (let rowIndex = d.newRange.y, i = 0; rowIndex < d.newRange.y1 + 1; rowIndex++, i++) {
|
|
8963
|
-
// copy original data link
|
|
8964
|
-
const oldRowIndex = d.oldRange.y + (i % copyRowLength);
|
|
8965
|
-
const copyRow = getSourceItem(this.dataStore, oldRowIndex) || {};
|
|
8966
|
-
// columns
|
|
8967
|
-
for (let colIndex = d.newRange.x, j = 0; colIndex < d.newRange.x1 + 1; colIndex++, j++) {
|
|
8968
|
-
// check if old range area
|
|
8969
|
-
if (rowIndex >= d.oldRange.y &&
|
|
8970
|
-
rowIndex <= d.oldRange.y1 &&
|
|
8971
|
-
colIndex >= d.oldRange.x &&
|
|
8972
|
-
colIndex <= d.oldRange.x1) {
|
|
8973
|
-
continue;
|
|
8974
|
-
}
|
|
8975
|
-
// requested column beyond range
|
|
8976
|
-
if (!this.columns[colIndex]) {
|
|
8977
|
-
continue;
|
|
8978
|
-
}
|
|
8979
|
-
const prop = (_a = this.columns[colIndex]) === null || _a === void 0 ? void 0 : _a.prop;
|
|
8980
|
-
const copyColIndex = d.oldRange.x + (j % copyColLength);
|
|
8981
|
-
const copyColumnProp = columns[copyColIndex].prop;
|
|
8982
|
-
/** if can write */
|
|
8983
|
-
if (!this.isReadOnly(rowIndex, colIndex)) {
|
|
8984
|
-
/** to show before save */
|
|
8985
|
-
if (!changed[rowIndex]) {
|
|
8986
|
-
changed[rowIndex] = {};
|
|
8987
|
-
}
|
|
8988
|
-
changed[rowIndex][prop] = copyRow[copyColumnProp];
|
|
8989
|
-
/** Generate mapping object */
|
|
8990
|
-
if (!mapping[rowIndex]) {
|
|
8991
|
-
mapping[rowIndex] = {};
|
|
8992
|
-
}
|
|
8993
|
-
mapping[rowIndex][prop] = {
|
|
8994
|
-
colIndex: copyColIndex,
|
|
8995
|
-
colProp: copyColumnProp,
|
|
8996
|
-
rowIndex: oldRowIndex,
|
|
8997
|
-
};
|
|
8998
|
-
}
|
|
8999
|
-
}
|
|
8730
|
+
// it's possible that some columns have same prop, but better to avoid it
|
|
8731
|
+
if (!res.columnByProp[regularColumn.prop]) {
|
|
8732
|
+
res.columnByProp[regularColumn.prop] = [];
|
|
9000
8733
|
}
|
|
9001
|
-
|
|
9002
|
-
|
|
9003
|
-
|
|
9004
|
-
|
|
9005
|
-
}
|
|
9006
|
-
|
|
9007
|
-
|
|
9008
|
-
|
|
9009
|
-
|
|
9010
|
-
|
|
9011
|
-
|
|
9012
|
-
|
|
9013
|
-
|
|
9014
|
-
|
|
9015
|
-
|
|
9016
|
-
|
|
9017
|
-
|
|
9018
|
-
|
|
9019
|
-
|
|
9020
|
-
|
|
9021
|
-
|
|
9022
|
-
const currentCol = j % colLength;
|
|
9023
|
-
/** if can write */
|
|
9024
|
-
if (!this.isReadOnly(rowIndex, colIndex)) {
|
|
9025
|
-
/** to show before save */
|
|
9026
|
-
if (!changed[rowIndex]) {
|
|
9027
|
-
changed[rowIndex] = {};
|
|
9028
|
-
}
|
|
9029
|
-
changed[rowIndex][p] = copyRow[currentCol];
|
|
9030
|
-
}
|
|
8734
|
+
res.columnByProp[regularColumn.prop].push(regularColumn);
|
|
8735
|
+
// trigger setup hook if present
|
|
8736
|
+
regularColumn.beforeSetup && regularColumn.beforeSetup(regularColumn);
|
|
8737
|
+
return res;
|
|
8738
|
+
}, collection);
|
|
8739
|
+
}
|
|
8740
|
+
function gatherGroup(res, colData, collection, level = 0) {
|
|
8741
|
+
// group template
|
|
8742
|
+
const group = Object.assign(Object.assign({}, colData), { level, ids: [] });
|
|
8743
|
+
// check columns for update
|
|
8744
|
+
for (let k in collection.columns) {
|
|
8745
|
+
const key = k;
|
|
8746
|
+
const resultItem = res.columns[key];
|
|
8747
|
+
const collectionItem = collection.columns[key];
|
|
8748
|
+
// if column data
|
|
8749
|
+
if (isArray_1(resultItem) && isArray_1(collectionItem)) {
|
|
8750
|
+
// fill columns
|
|
8751
|
+
resultItem.push(...collectionItem);
|
|
8752
|
+
// fill grouping
|
|
8753
|
+
if (collectionItem.length) {
|
|
8754
|
+
res.columnGrouping[key].push(Object.assign(Object.assign({}, group), { ids: collectionItem.map(item => item.prop) }));
|
|
9031
8755
|
}
|
|
9032
|
-
maxCol = Math.max(maxCol, colIndex - 1);
|
|
9033
8756
|
}
|
|
9034
|
-
const range = getRange(start, {
|
|
9035
|
-
y: rowIndex - 1,
|
|
9036
|
-
x: maxCol,
|
|
9037
|
-
});
|
|
9038
|
-
return {
|
|
9039
|
-
changed,
|
|
9040
|
-
range,
|
|
9041
|
-
};
|
|
9042
8757
|
}
|
|
9043
|
-
|
|
9044
|
-
|
|
9045
|
-
|
|
9046
|
-
|
|
9047
|
-
|
|
9048
|
-
for (let colIndex = d.x, j = 0; colIndex < d.x1 + 1; colIndex++, j++) {
|
|
9049
|
-
// requested column beyond range
|
|
9050
|
-
if (!this.columns[colIndex]) {
|
|
9051
|
-
continue;
|
|
9052
|
-
}
|
|
9053
|
-
const p = this.columns[colIndex].prop;
|
|
9054
|
-
/** if can write */
|
|
9055
|
-
if (!this.isReadOnly(rowIndex, colIndex)) {
|
|
9056
|
-
/** to show before save */
|
|
9057
|
-
if (!changed[rowIndex]) {
|
|
9058
|
-
changed[rowIndex] = {};
|
|
9059
|
-
}
|
|
9060
|
-
changed[rowIndex][p] = value;
|
|
9061
|
-
}
|
|
9062
|
-
}
|
|
9063
|
-
}
|
|
9064
|
-
return changed;
|
|
8758
|
+
// merge column groupings
|
|
8759
|
+
for (let k in collection.columnGrouping) {
|
|
8760
|
+
const key = k;
|
|
8761
|
+
const collectionItem = collection.columnGrouping[key];
|
|
8762
|
+
res.columnGrouping[key].push(...collectionItem);
|
|
9065
8763
|
}
|
|
9066
|
-
|
|
9067
|
-
|
|
9068
|
-
|
|
9069
|
-
|
|
9070
|
-
|
|
9071
|
-
|
|
9072
|
-
|
|
9073
|
-
|
|
9074
|
-
|
|
9075
|
-
|
|
9076
|
-
prop,
|
|
9077
|
-
rowIndex,
|
|
9078
|
-
colIndex,
|
|
9079
|
-
model: getSourceItem(store, rowIndex),
|
|
9080
|
-
type,
|
|
9081
|
-
colType: this.type,
|
|
9082
|
-
});
|
|
8764
|
+
res.maxLevel = Math.max(res.maxLevel, collection.maxLevel);
|
|
8765
|
+
res.sort = Object.assign(Object.assign({}, res.sort), collection.sort);
|
|
8766
|
+
return res;
|
|
8767
|
+
}
|
|
8768
|
+
function findColumn(columns, prop) {
|
|
8769
|
+
for (const c of columns) {
|
|
8770
|
+
if (isColGrouping(c)) {
|
|
8771
|
+
const found = findColumn(c.children, prop);
|
|
8772
|
+
if (found) {
|
|
8773
|
+
return found;
|
|
9083
8774
|
}
|
|
9084
8775
|
}
|
|
9085
|
-
|
|
9086
|
-
|
|
9087
|
-
copyRangeArray(range, store) {
|
|
9088
|
-
const cols = [...this.columns];
|
|
9089
|
-
const props = slice_1(cols, range.x, range.x1 + 1).map(v => v.prop);
|
|
9090
|
-
const toCopy = [];
|
|
9091
|
-
const mapping = {};
|
|
9092
|
-
// rows indexes
|
|
9093
|
-
for (let i = range.y; i <= range.y1; i++) {
|
|
9094
|
-
const rgRow = [];
|
|
9095
|
-
mapping[i] = {};
|
|
9096
|
-
// columns indexes
|
|
9097
|
-
for (let prop of props) {
|
|
9098
|
-
const item = getSourceItem(store, i);
|
|
9099
|
-
// if no item - skip
|
|
9100
|
-
if (!item) {
|
|
9101
|
-
continue;
|
|
9102
|
-
}
|
|
9103
|
-
const val = item[prop];
|
|
9104
|
-
rgRow.push(val);
|
|
9105
|
-
mapping[i][prop] = val;
|
|
9106
|
-
}
|
|
9107
|
-
toCopy.push(rgRow);
|
|
8776
|
+
else if (c.prop === prop) {
|
|
8777
|
+
return c;
|
|
9108
8778
|
}
|
|
9109
|
-
return {
|
|
9110
|
-
data: toCopy,
|
|
9111
|
-
mapping,
|
|
9112
|
-
};
|
|
9113
8779
|
}
|
|
9114
|
-
|
|
9115
|
-
this.unsubscribe.forEach(f => f());
|
|
9116
|
-
}
|
|
9117
|
-
}
|
|
9118
|
-
function getCellData(val) {
|
|
9119
|
-
if (typeof val === 'undefined' || val === null) {
|
|
9120
|
-
return '';
|
|
9121
|
-
}
|
|
9122
|
-
return val;
|
|
9123
|
-
}
|
|
9124
|
-
/**
|
|
9125
|
-
* Checks if the given rowDrag is a service for dragging rows.
|
|
9126
|
-
*/
|
|
9127
|
-
function isRowDragService(rowDrag, model) {
|
|
9128
|
-
if (typeof rowDrag === 'function') {
|
|
9129
|
-
return rowDrag(model);
|
|
9130
|
-
}
|
|
9131
|
-
return !!rowDrag;
|
|
8780
|
+
return undefined;
|
|
9132
8781
|
}
|
|
9133
|
-
function
|
|
9134
|
-
|
|
9135
|
-
// extend existing props
|
|
9136
|
-
if (extra.class) {
|
|
9137
|
-
if (typeof extra.class === 'object' && typeof props.class === 'object') {
|
|
9138
|
-
props.class = Object.assign(Object.assign({}, extra.class), props.class);
|
|
9139
|
-
}
|
|
9140
|
-
else if (typeof extra.class === 'string' &&
|
|
9141
|
-
typeof props.class === 'object') {
|
|
9142
|
-
props.class[extra.class] = true;
|
|
9143
|
-
}
|
|
9144
|
-
else if (typeof props.class === 'string') {
|
|
9145
|
-
props.class += ' ' + extra.class;
|
|
9146
|
-
}
|
|
9147
|
-
}
|
|
9148
|
-
if (extra.style) {
|
|
9149
|
-
props.style = Object.assign(Object.assign({}, extra.style), props.style);
|
|
9150
|
-
}
|
|
9151
|
-
return props;
|
|
8782
|
+
function getColumnByProp(columns, prop) {
|
|
8783
|
+
return findColumn(columns, prop);
|
|
9152
8784
|
}
|
|
9153
8785
|
|
|
9154
8786
|
var codes;
|
|
@@ -9227,386 +8859,761 @@ var keyValues;
|
|
|
9227
8859
|
keyValues["TAB"] = "Tab";
|
|
9228
8860
|
})(keyValues || (keyValues = {}));
|
|
9229
8861
|
|
|
9230
|
-
|
|
9231
|
-
|
|
9232
|
-
|
|
9233
|
-
|
|
9234
|
-
if (focusClass && touchEvent) {
|
|
9235
|
-
if (!(touchEvent.target instanceof Element && touchEvent.target.classList.contains(focusClass))) {
|
|
9236
|
-
return false;
|
|
9237
|
-
}
|
|
9238
|
-
}
|
|
9239
|
-
return true;
|
|
9240
|
-
}
|
|
9241
|
-
/**
|
|
9242
|
-
* Function to get the value of a specific property from a MouseEvent or TouchEvent object.
|
|
9243
|
-
*/
|
|
9244
|
-
function getPropertyFromEvent(e, prop, focusClass // for touch events
|
|
9245
|
-
) {
|
|
9246
|
-
// Check if the event is a touch event
|
|
9247
|
-
if (isTouch(e)) {
|
|
9248
|
-
// If the event has touches, get the first touch
|
|
9249
|
-
if (e.touches.length > 0) {
|
|
9250
|
-
const touchEvent = e.touches[0];
|
|
9251
|
-
// Check if the target of the touch event is the specified element
|
|
9252
|
-
if (!verifyTouchTarget(touchEvent, focusClass)) {
|
|
9253
|
-
// If not, return null
|
|
9254
|
-
return null;
|
|
9255
|
-
}
|
|
9256
|
-
// Get the value of the specified property from the touch event and return it
|
|
9257
|
-
return touchEvent[prop] || 0;
|
|
9258
|
-
}
|
|
9259
|
-
// If there are no touches, return null
|
|
9260
|
-
return null;
|
|
9261
|
-
}
|
|
9262
|
-
// If the event is not a touch event, get the value of the specified property from the event and return it
|
|
9263
|
-
return e[prop] || 0;
|
|
9264
|
-
}
|
|
8862
|
+
var osPlatform;
|
|
8863
|
+
(function (osPlatform) {
|
|
8864
|
+
osPlatform["mac"] = "Mac";
|
|
8865
|
+
})(osPlatform || (osPlatform = {}));
|
|
9265
8866
|
|
|
9266
|
-
function
|
|
9267
|
-
|
|
9268
|
-
for (let i in data) {
|
|
9269
|
-
const rowIndex = parseInt(i, 10);
|
|
9270
|
-
models[rowIndex] = getSourceItem(store, rowIndex);
|
|
9271
|
-
}
|
|
9272
|
-
return models;
|
|
8867
|
+
function isClear(code) {
|
|
8868
|
+
return codesLetter.BACKSPACE === code || codesLetter.DELETE === code;
|
|
9273
8869
|
}
|
|
9274
|
-
function
|
|
9275
|
-
|
|
9276
|
-
|
|
9277
|
-
|
|
9278
|
-
|
|
9279
|
-
|
|
9280
|
-
|
|
9281
|
-
|
|
9282
|
-
|
|
9283
|
-
|
|
9284
|
-
|
|
9285
|
-
|
|
9286
|
-
|
|
9287
|
-
|
|
9288
|
-
|
|
9289
|
-
|
|
9290
|
-
|
|
9291
|
-
|
|
9292
|
-
|
|
8870
|
+
function isTab(code) {
|
|
8871
|
+
return codesLetter.TAB === code;
|
|
8872
|
+
}
|
|
8873
|
+
function isEnterKeyValue(key) {
|
|
8874
|
+
return keyValues.ENTER === key;
|
|
8875
|
+
}
|
|
8876
|
+
function isCut(event) {
|
|
8877
|
+
return ((event.ctrlKey && event.code === 'KeyX') || // Ctrl + X on Windows
|
|
8878
|
+
(event.metaKey && event.code === 'KeyX')); // Cmd + X on Mac
|
|
8879
|
+
}
|
|
8880
|
+
function isCopy(event) {
|
|
8881
|
+
return ((event.ctrlKey && event.code === 'KeyC') || // Ctrl + C on Windows
|
|
8882
|
+
(event.metaKey && event.code === 'KeyC')); // Cmd + C on Mac
|
|
8883
|
+
}
|
|
8884
|
+
function isPaste(event) {
|
|
8885
|
+
return ((event.ctrlKey && event.code === 'KeyV') || // Ctrl + V on Windows
|
|
8886
|
+
(event.metaKey && event.code === 'KeyV')); // Cmd + V on Mac
|
|
8887
|
+
}
|
|
8888
|
+
function isAll(event) {
|
|
8889
|
+
return ((event.ctrlKey && event.code === 'KeyA') || // Ctrl + A on Windows
|
|
8890
|
+
(event.metaKey && event.code === 'KeyA')); // Cmd + A on Mac
|
|
9293
8891
|
}
|
|
8892
|
+
|
|
8893
|
+
const LETTER_BLOCK_SIZE$1 = 10;
|
|
8894
|
+
const calculateRowHeaderSize = (itemsLength, rowHeaderColumn, minWidth = 50) => {
|
|
8895
|
+
return ((rowHeaderColumn === null || rowHeaderColumn === void 0 ? void 0 : rowHeaderColumn.size) ||
|
|
8896
|
+
Math.max((itemsLength.toString().length + 1) * LETTER_BLOCK_SIZE$1, minWidth));
|
|
8897
|
+
};
|
|
8898
|
+
|
|
9294
8899
|
/**
|
|
9295
|
-
* Calculate
|
|
8900
|
+
* Calculate system scrollbar size
|
|
9296
8901
|
*/
|
|
9297
|
-
function
|
|
9298
|
-
//
|
|
9299
|
-
const
|
|
9300
|
-
//
|
|
9301
|
-
|
|
9302
|
-
|
|
9303
|
-
|
|
9304
|
-
|
|
9305
|
-
|
|
9306
|
-
|
|
9307
|
-
//
|
|
9308
|
-
|
|
9309
|
-
|
|
9310
|
-
|
|
9311
|
-
//
|
|
9312
|
-
|
|
9313
|
-
|
|
9314
|
-
|
|
9315
|
-
if (rgCol.itemIndex < 0) {
|
|
9316
|
-
rgCol.itemIndex = 0;
|
|
9317
|
-
}
|
|
9318
|
-
if (rgRow.itemIndex < 0) {
|
|
9319
|
-
rgRow.itemIndex = 0;
|
|
9320
|
-
}
|
|
9321
|
-
return { x: rgCol.itemIndex, y: rgRow.itemIndex };
|
|
8902
|
+
function getScrollbarSize(document) {
|
|
8903
|
+
// Create a temporary div container and append it to the body
|
|
8904
|
+
const container = document.createElement('div');
|
|
8905
|
+
// Apply styling to ensure the div is scrollable
|
|
8906
|
+
container.style.overflow = 'scroll';
|
|
8907
|
+
container.style.visibility = 'hidden'; // make sure the container isn't visible
|
|
8908
|
+
container.style.position = 'absolute';
|
|
8909
|
+
container.style.top = '-9999px'; // move it out of the screen
|
|
8910
|
+
container.style.width = '50px'; // arbitrary width
|
|
8911
|
+
container.style.height = '50px'; // arbitrary height
|
|
8912
|
+
// Append the div to the body
|
|
8913
|
+
document.body.appendChild(container);
|
|
8914
|
+
// Calculate the width of the scrollbar
|
|
8915
|
+
const scrollbarWidth = container.offsetWidth - container.clientWidth;
|
|
8916
|
+
// Remove the div from the body after calculation
|
|
8917
|
+
document.body.removeChild(container);
|
|
8918
|
+
// Return the calculated width of the scrollbar
|
|
8919
|
+
return scrollbarWidth;
|
|
9322
8920
|
}
|
|
9323
|
-
|
|
9324
|
-
|
|
9325
|
-
|
|
9326
|
-
|
|
9327
|
-
|
|
9328
|
-
|
|
9329
|
-
|
|
9330
|
-
|
|
9331
|
-
|
|
9332
|
-
|
|
9333
|
-
|
|
9334
|
-
|
|
9335
|
-
|
|
9336
|
-
|
|
9337
|
-
return null;
|
|
8921
|
+
/* Scale a value between 2 ranges
|
|
8922
|
+
*
|
|
8923
|
+
* Sample:
|
|
8924
|
+
* // 55 from a 0-100 range to a 0-1000 range (Ranges don't have to be positive)
|
|
8925
|
+
* const n = scaleValue(55, [0,100], [0,1000]);
|
|
8926
|
+
*
|
|
8927
|
+
* Ranges of two values
|
|
8928
|
+
* @from
|
|
8929
|
+
* @to
|
|
8930
|
+
*
|
|
8931
|
+
* ~~ return value does the equivalent of Math.floor but faster.
|
|
8932
|
+
*/
|
|
8933
|
+
function scaleValue(value, from, to) {
|
|
8934
|
+
return ((to[1] - to[0]) * (value - from[0])) / (from[1] - from[0]) + to[0];
|
|
9338
8935
|
}
|
|
9339
8936
|
/**
|
|
9340
|
-
*
|
|
9341
|
-
* or if the y coordinate of the cell position is after or equal to the y coordinate of the last cell position
|
|
8937
|
+
* Async timeout
|
|
9342
8938
|
*/
|
|
9343
|
-
function
|
|
9344
|
-
|
|
9345
|
-
|
|
9346
|
-
|
|
9347
|
-
function isBeforeFirst({ x, y }) {
|
|
9348
|
-
return x < 0 || y < 0;
|
|
8939
|
+
async function timeout(delay = 0) {
|
|
8940
|
+
await new Promise((r) => {
|
|
8941
|
+
setTimeout(() => r(), delay);
|
|
8942
|
+
});
|
|
9349
8943
|
}
|
|
9350
|
-
|
|
9351
|
-
|
|
9352
|
-
|
|
9353
|
-
|
|
9354
|
-
|
|
9355
|
-
|
|
9356
|
-
|
|
9357
|
-
|
|
9358
|
-
|
|
9359
|
-
|
|
9360
|
-
|
|
9361
|
-
|
|
9362
|
-
|
|
9363
|
-
|
|
9364
|
-
// cell[k] = Math.abs(initial[k] - last[k]);
|
|
9365
|
-
// }
|
|
9366
|
-
// if (cell.x > cell.y) {
|
|
9367
|
-
// return { x: 1 };
|
|
9368
|
-
// }
|
|
9369
|
-
// if (cell.y > cell.x) {
|
|
9370
|
-
// return { y: 1 };
|
|
9371
|
-
// }
|
|
9372
|
-
// return null;
|
|
9373
|
-
// }
|
|
9374
|
-
function styleByCellProps(styles) {
|
|
9375
|
-
return {
|
|
9376
|
-
left: `${styles.left}px`,
|
|
9377
|
-
top: `${styles.top}px`,
|
|
9378
|
-
width: `${styles.width}px`,
|
|
9379
|
-
height: `${styles.height}px`,
|
|
9380
|
-
};
|
|
8944
|
+
|
|
8945
|
+
const GROUP_DEPTH = `${GRID_INTERNALS}-depth`;
|
|
8946
|
+
const PSEUDO_GROUP_ITEM = `${GRID_INTERNALS}-name`;
|
|
8947
|
+
const PSEUDO_GROUP_ITEM_ID = `${GRID_INTERNALS}-id`;
|
|
8948
|
+
const PSEUDO_GROUP_ITEM_VALUE = `${GRID_INTERNALS}-value`;
|
|
8949
|
+
const PSEUDO_GROUP_COLUMN = `${GRID_INTERNALS}-column`;
|
|
8950
|
+
const GROUP_EXPANDED = `${GRID_INTERNALS}-expanded`;
|
|
8951
|
+
const GROUP_ORIGINAL_INDEX = `${GRID_INTERNALS}-original-index`;
|
|
8952
|
+
const GROUP_EXPAND_BTN = `group-expand`;
|
|
8953
|
+
const GROUP_EXPAND_EVENT = `groupexpandclick`;
|
|
8954
|
+
const GROUPING_ROW_TYPE = 'rgRow';
|
|
8955
|
+
|
|
8956
|
+
function getGroupValueDefault(item, prop) {
|
|
8957
|
+
return item[prop] || null;
|
|
9381
8958
|
}
|
|
9382
|
-
|
|
9383
|
-
|
|
9384
|
-
|
|
9385
|
-
|
|
9386
|
-
|
|
8959
|
+
/**
|
|
8960
|
+
* Gather data for grouping
|
|
8961
|
+
* @param array - flat data array
|
|
8962
|
+
* @param groupIds - ids of groups
|
|
8963
|
+
* @param expanded - potentially expanded items if present
|
|
8964
|
+
*/
|
|
8965
|
+
function gatherGrouping(array, groupIds, { prevExpanded, expandedAll, getGroupValue = getGroupValueDefault, }) {
|
|
8966
|
+
const groupedItems = new Map();
|
|
8967
|
+
array.forEach((item, originalIndex) => {
|
|
8968
|
+
const groupLevelValues = groupIds.map(groupId => getGroupValue(item, groupId));
|
|
8969
|
+
const lastLevelValue = groupLevelValues.pop();
|
|
8970
|
+
let currentGroupLevel = groupedItems;
|
|
8971
|
+
groupLevelValues.forEach(value => {
|
|
8972
|
+
if (!currentGroupLevel.has(value)) {
|
|
8973
|
+
currentGroupLevel.set(value, new Map());
|
|
8974
|
+
}
|
|
8975
|
+
currentGroupLevel = currentGroupLevel.get(value);
|
|
8976
|
+
});
|
|
8977
|
+
if (!currentGroupLevel.has(lastLevelValue)) {
|
|
8978
|
+
currentGroupLevel.set(lastLevelValue, []);
|
|
8979
|
+
}
|
|
8980
|
+
const lastLevelItems = currentGroupLevel.get(lastLevelValue);
|
|
8981
|
+
lastLevelItems.push(Object.assign(Object.assign({}, item), { [GROUP_ORIGINAL_INDEX]: originalIndex }));
|
|
8982
|
+
});
|
|
8983
|
+
let itemIndex = -1;
|
|
8984
|
+
const groupingDepth = groupIds.length;
|
|
8985
|
+
// collapse all groups in the beginning
|
|
8986
|
+
const trimmed = {};
|
|
8987
|
+
// index mapping
|
|
8988
|
+
const oldNewIndexMap = {};
|
|
8989
|
+
// check if group header exists
|
|
8990
|
+
const pseudoGroupTest = {};
|
|
8991
|
+
const sourceWithGroups = [];
|
|
8992
|
+
function flattenGroupMaps(groupedValues, parentIds, isExpanded) {
|
|
8993
|
+
const depth = parentIds.length;
|
|
8994
|
+
groupedValues.forEach((innerGroupedValues, groupId) => {
|
|
8995
|
+
const levelIds = [...parentIds, groupId];
|
|
8996
|
+
const mergedIds = levelIds.join(',');
|
|
8997
|
+
const isGroupExpanded = isExpanded && (!!expandedAll || !!(prevExpanded === null || prevExpanded === void 0 ? void 0 : prevExpanded[mergedIds]));
|
|
8998
|
+
sourceWithGroups.push({
|
|
8999
|
+
[PSEUDO_GROUP_ITEM]: groupId,
|
|
9000
|
+
[GROUP_DEPTH]: depth,
|
|
9001
|
+
[PSEUDO_GROUP_ITEM_ID]: JSON.stringify(levelIds),
|
|
9002
|
+
[PSEUDO_GROUP_ITEM_VALUE]: mergedIds,
|
|
9003
|
+
[GROUP_EXPANDED]: isGroupExpanded,
|
|
9004
|
+
});
|
|
9005
|
+
itemIndex += 1;
|
|
9006
|
+
if (!isGroupExpanded && depth) {
|
|
9007
|
+
trimmed[itemIndex] = true;
|
|
9008
|
+
}
|
|
9009
|
+
if (Array.isArray(innerGroupedValues)) {
|
|
9010
|
+
innerGroupedValues.forEach(value => {
|
|
9011
|
+
itemIndex += 1;
|
|
9012
|
+
if (!isGroupExpanded) {
|
|
9013
|
+
trimmed[itemIndex] = true;
|
|
9014
|
+
}
|
|
9015
|
+
oldNewIndexMap[value[GROUP_ORIGINAL_INDEX]] = itemIndex;
|
|
9016
|
+
const pseudoGroupTestIds = levelIds.map((_value, index) => levelIds.slice(0, index + 1).join(','));
|
|
9017
|
+
pseudoGroupTestIds.forEach(pseudoGroupTestId => {
|
|
9018
|
+
if (!pseudoGroupTest[pseudoGroupTestId]) {
|
|
9019
|
+
pseudoGroupTest[pseudoGroupTestId] = [];
|
|
9020
|
+
}
|
|
9021
|
+
pseudoGroupTest[pseudoGroupTestId].push(itemIndex);
|
|
9022
|
+
});
|
|
9023
|
+
});
|
|
9024
|
+
sourceWithGroups.push(...innerGroupedValues);
|
|
9025
|
+
}
|
|
9026
|
+
else {
|
|
9027
|
+
flattenGroupMaps(innerGroupedValues, levelIds, isGroupExpanded);
|
|
9028
|
+
}
|
|
9029
|
+
});
|
|
9030
|
+
}
|
|
9031
|
+
flattenGroupMaps(groupedItems, [], true);
|
|
9387
9032
|
return {
|
|
9388
|
-
|
|
9389
|
-
|
|
9390
|
-
|
|
9391
|
-
|
|
9392
|
-
|
|
9393
|
-
|
|
9394
|
-
};
|
|
9395
|
-
}
|
|
9396
|
-
function getElStyle(range, dimensionRow, dimensionCol) {
|
|
9397
|
-
const styles = getCell(range, dimensionRow, dimensionCol);
|
|
9398
|
-
return styleByCellProps(styles);
|
|
9399
|
-
}
|
|
9400
|
-
|
|
9401
|
-
// is edit input
|
|
9402
|
-
function isEditInput(el) {
|
|
9403
|
-
return !!(el === null || el === void 0 ? void 0 : el.closest(`.${EDIT_INPUT_WR}`));
|
|
9033
|
+
sourceWithGroups, // updates source mirror
|
|
9034
|
+
depth: groupingDepth, // largest depth for grouping
|
|
9035
|
+
trimmed, // used for expand/collapse grouping values
|
|
9036
|
+
oldNewIndexMap, // used for mapping old values to new
|
|
9037
|
+
childrenByGroup: pseudoGroupTest, // used to get child items in group
|
|
9038
|
+
};
|
|
9404
9039
|
}
|
|
9405
|
-
|
|
9406
|
-
|
|
9407
|
-
return typeof editor === 'function' && typeof editor.prototype === 'object';
|
|
9040
|
+
function getGroupingName(rgRow) {
|
|
9041
|
+
return rgRow && rgRow[PSEUDO_GROUP_ITEM];
|
|
9408
9042
|
}
|
|
9409
|
-
|
|
9410
|
-
|
|
9411
|
-
(function (osPlatform) {
|
|
9412
|
-
osPlatform["mac"] = "Mac";
|
|
9413
|
-
})(osPlatform || (osPlatform = {}));
|
|
9414
|
-
|
|
9415
|
-
function isClear(code) {
|
|
9416
|
-
return codesLetter.BACKSPACE === code || codesLetter.DELETE === code;
|
|
9043
|
+
function isGrouping(rgRow) {
|
|
9044
|
+
return typeof (rgRow === null || rgRow === void 0 ? void 0 : rgRow[PSEUDO_GROUP_ITEM]) !== 'undefined';
|
|
9417
9045
|
}
|
|
9418
|
-
function
|
|
9419
|
-
return
|
|
9046
|
+
function isGroupingColumn(column) {
|
|
9047
|
+
return column && typeof column[PSEUDO_GROUP_COLUMN] !== 'undefined';
|
|
9420
9048
|
}
|
|
9421
|
-
function
|
|
9422
|
-
|
|
9049
|
+
function measureEqualDepth(groupA, groupB) {
|
|
9050
|
+
const ln = groupA.length;
|
|
9051
|
+
let i = 0;
|
|
9052
|
+
for (; i < ln; i++) {
|
|
9053
|
+
if (groupA[i] !== groupB[i]) {
|
|
9054
|
+
return i;
|
|
9055
|
+
}
|
|
9056
|
+
}
|
|
9057
|
+
return i;
|
|
9423
9058
|
}
|
|
9424
|
-
function
|
|
9425
|
-
|
|
9426
|
-
|
|
9059
|
+
function getParsedGroup(id) {
|
|
9060
|
+
const parseGroup = JSON.parse(id);
|
|
9061
|
+
// extra precaution and type safeguard
|
|
9062
|
+
if (!Array.isArray(parseGroup)) {
|
|
9063
|
+
return null;
|
|
9064
|
+
}
|
|
9065
|
+
return parseGroup;
|
|
9427
9066
|
}
|
|
9428
|
-
|
|
9429
|
-
|
|
9430
|
-
|
|
9067
|
+
// check if items is child of current clicked group
|
|
9068
|
+
function isSameGroup(currentGroup, currentModel, nextModel) {
|
|
9069
|
+
const nextGroup = getParsedGroup(nextModel[PSEUDO_GROUP_ITEM_ID]);
|
|
9070
|
+
if (!nextGroup) {
|
|
9071
|
+
return false;
|
|
9072
|
+
}
|
|
9073
|
+
const depth = measureEqualDepth(currentGroup, nextGroup);
|
|
9074
|
+
return currentModel[GROUP_DEPTH] < depth;
|
|
9431
9075
|
}
|
|
9432
|
-
|
|
9433
|
-
|
|
9434
|
-
|
|
9076
|
+
|
|
9077
|
+
/**
|
|
9078
|
+
* The base implementation of `_.slice` without an iteratee call guard.
|
|
9079
|
+
*
|
|
9080
|
+
* @private
|
|
9081
|
+
* @param {Array} array The array to slice.
|
|
9082
|
+
* @param {number} [start=0] The start position.
|
|
9083
|
+
* @param {number} [end=array.length] The end position.
|
|
9084
|
+
* @returns {Array} Returns the slice of `array`.
|
|
9085
|
+
*/
|
|
9086
|
+
|
|
9087
|
+
function baseSlice$1(array, start, end) {
|
|
9088
|
+
var index = -1,
|
|
9089
|
+
length = array.length;
|
|
9090
|
+
|
|
9091
|
+
if (start < 0) {
|
|
9092
|
+
start = -start > length ? 0 : (length + start);
|
|
9093
|
+
}
|
|
9094
|
+
end = end > length ? length : end;
|
|
9095
|
+
if (end < 0) {
|
|
9096
|
+
end += length;
|
|
9097
|
+
}
|
|
9098
|
+
length = start > end ? 0 : ((end - start) >>> 0);
|
|
9099
|
+
start >>>= 0;
|
|
9100
|
+
|
|
9101
|
+
var result = Array(length);
|
|
9102
|
+
while (++index < length) {
|
|
9103
|
+
result[index] = array[index + start];
|
|
9104
|
+
}
|
|
9105
|
+
return result;
|
|
9435
9106
|
}
|
|
9436
|
-
|
|
9437
|
-
|
|
9438
|
-
|
|
9107
|
+
|
|
9108
|
+
var _baseSlice = baseSlice$1;
|
|
9109
|
+
|
|
9110
|
+
var baseSlice = _baseSlice,
|
|
9111
|
+
isIterateeCall$1 = _isIterateeCall,
|
|
9112
|
+
toInteger$2 = toInteger_1;
|
|
9113
|
+
|
|
9114
|
+
/**
|
|
9115
|
+
* Creates a slice of `array` from `start` up to, but not including, `end`.
|
|
9116
|
+
*
|
|
9117
|
+
* **Note:** This method is used instead of
|
|
9118
|
+
* [`Array#slice`](https://mdn.io/Array/slice) to ensure dense arrays are
|
|
9119
|
+
* returned.
|
|
9120
|
+
*
|
|
9121
|
+
* @static
|
|
9122
|
+
* @memberOf _
|
|
9123
|
+
* @since 3.0.0
|
|
9124
|
+
* @category Array
|
|
9125
|
+
* @param {Array} array The array to slice.
|
|
9126
|
+
* @param {number} [start=0] The start position.
|
|
9127
|
+
* @param {number} [end=array.length] The end position.
|
|
9128
|
+
* @returns {Array} Returns the slice of `array`.
|
|
9129
|
+
*/
|
|
9130
|
+
function slice(array, start, end) {
|
|
9131
|
+
var length = array == null ? 0 : array.length;
|
|
9132
|
+
if (!length) {
|
|
9133
|
+
return [];
|
|
9134
|
+
}
|
|
9135
|
+
if (end && typeof end != 'number' && isIterateeCall$1(array, start, end)) {
|
|
9136
|
+
start = 0;
|
|
9137
|
+
end = length;
|
|
9138
|
+
}
|
|
9139
|
+
else {
|
|
9140
|
+
start = start == null ? 0 : toInteger$2(start);
|
|
9141
|
+
end = end === undefined ? length : toInteger$2(end);
|
|
9142
|
+
}
|
|
9143
|
+
return baseSlice(array, start, end);
|
|
9439
9144
|
}
|
|
9440
9145
|
|
|
9441
|
-
|
|
9442
|
-
|
|
9443
|
-
|
|
9146
|
+
var slice_1 = slice;
|
|
9147
|
+
|
|
9148
|
+
class ColumnService {
|
|
9149
|
+
get columns() {
|
|
9150
|
+
return getVisibleSourceItem(this.source);
|
|
9151
|
+
}
|
|
9152
|
+
constructor(dataStore, source) {
|
|
9153
|
+
this.dataStore = dataStore;
|
|
9154
|
+
this.source = source;
|
|
9155
|
+
this.unsubscribe = [];
|
|
9156
|
+
this.hasGrouping = false;
|
|
9157
|
+
this.unsubscribe.push(source.onChange('source', s => this.checkGrouping(s)));
|
|
9158
|
+
this.checkGrouping(source.get('source'));
|
|
9159
|
+
this.type = source.get('type');
|
|
9160
|
+
}
|
|
9161
|
+
checkGrouping(cols) {
|
|
9162
|
+
for (let rgCol of cols) {
|
|
9163
|
+
if (isGroupingColumn(rgCol)) {
|
|
9164
|
+
this.hasGrouping = true;
|
|
9165
|
+
return;
|
|
9166
|
+
}
|
|
9167
|
+
this.hasGrouping = false;
|
|
9168
|
+
}
|
|
9169
|
+
}
|
|
9170
|
+
isReadOnly(r, c) {
|
|
9171
|
+
var _a;
|
|
9172
|
+
const readOnly = (_a = this.columns[c]) === null || _a === void 0 ? void 0 : _a.readonly;
|
|
9173
|
+
if (typeof readOnly === 'function') {
|
|
9174
|
+
const data = this.rowDataModel(r, c);
|
|
9175
|
+
return readOnly(data);
|
|
9176
|
+
}
|
|
9177
|
+
return !!readOnly;
|
|
9178
|
+
}
|
|
9179
|
+
mergeProperties(r, c, defaultProps, model, extraPropsFunc) {
|
|
9180
|
+
const props = Object.assign({}, defaultProps);
|
|
9181
|
+
props.class = Object.assign(Object.assign({}, (typeof props.class === 'string' ? { [props.class]: true } : props.class)), { [CELL_CLASS]: true, [DISABLED_CLASS]: this.isReadOnly(r, c) });
|
|
9182
|
+
const extra = extraPropsFunc === null || extraPropsFunc === void 0 ? void 0 : extraPropsFunc(model);
|
|
9183
|
+
if (!extra) {
|
|
9184
|
+
return props;
|
|
9185
|
+
}
|
|
9186
|
+
return doPropMerge(props, extra);
|
|
9187
|
+
}
|
|
9188
|
+
getRowClass(r, prop) {
|
|
9189
|
+
const model = getSourceItem(this.dataStore, r) || {};
|
|
9190
|
+
return model[prop] || '';
|
|
9191
|
+
}
|
|
9192
|
+
getCellData(r, c) {
|
|
9193
|
+
const data = this.rowDataModel(r, c);
|
|
9194
|
+
return getCellData(data.model[data.prop]);
|
|
9195
|
+
}
|
|
9196
|
+
getSaveData(rowIndex, colIndex, val) {
|
|
9197
|
+
const data = this.rowDataModel(rowIndex, colIndex);
|
|
9198
|
+
if (typeof val === 'undefined') {
|
|
9199
|
+
val = getCellData(data.model[data.prop]);
|
|
9200
|
+
}
|
|
9201
|
+
return {
|
|
9202
|
+
prop: data.prop,
|
|
9203
|
+
rowIndex,
|
|
9204
|
+
colIndex,
|
|
9205
|
+
val,
|
|
9206
|
+
model: data.model,
|
|
9207
|
+
colType: this.type,
|
|
9208
|
+
type: this.dataStore.get('type'),
|
|
9209
|
+
};
|
|
9210
|
+
}
|
|
9211
|
+
getCellEditor(_r, c, editors) {
|
|
9212
|
+
var _a;
|
|
9213
|
+
const editor = (_a = this.columns[c]) === null || _a === void 0 ? void 0 : _a.editor;
|
|
9214
|
+
if (!editor) {
|
|
9215
|
+
return undefined;
|
|
9216
|
+
}
|
|
9217
|
+
// reference
|
|
9218
|
+
if (typeof editor === 'string') {
|
|
9219
|
+
return editors[editor];
|
|
9220
|
+
}
|
|
9221
|
+
return editor;
|
|
9222
|
+
}
|
|
9223
|
+
/**
|
|
9224
|
+
* Get cell data model for given rowIndex and colIndex
|
|
9225
|
+
* Used to pass data to editor/renderer
|
|
9226
|
+
*/
|
|
9227
|
+
rowDataModel(rowIndex, colIndex) {
|
|
9228
|
+
const column = this.columns[colIndex];
|
|
9229
|
+
const prop = column === null || column === void 0 ? void 0 : column.prop;
|
|
9230
|
+
const model = getSourceItem(this.dataStore, rowIndex) || {};
|
|
9231
|
+
const value = model[prop];
|
|
9232
|
+
const type = this.dataStore.get('type');
|
|
9233
|
+
return {
|
|
9234
|
+
prop,
|
|
9235
|
+
model,
|
|
9236
|
+
data: this.dataStore.get('source'),
|
|
9237
|
+
column,
|
|
9238
|
+
rowIndex,
|
|
9239
|
+
colIndex,
|
|
9240
|
+
colType: this.type,
|
|
9241
|
+
type,
|
|
9242
|
+
value,
|
|
9243
|
+
};
|
|
9244
|
+
}
|
|
9245
|
+
getRangeData(d, columns) {
|
|
9246
|
+
var _a;
|
|
9247
|
+
const changed = {};
|
|
9248
|
+
// get original length sizes
|
|
9249
|
+
const copyColLength = d.oldRange.x1 - d.oldRange.x + 1;
|
|
9250
|
+
const copyRowLength = d.oldRange.y1 - d.oldRange.y + 1;
|
|
9251
|
+
const mapping = {};
|
|
9252
|
+
// rows
|
|
9253
|
+
for (let rowIndex = d.newRange.y, i = 0; rowIndex < d.newRange.y1 + 1; rowIndex++, i++) {
|
|
9254
|
+
// copy original data link
|
|
9255
|
+
const oldRowIndex = d.oldRange.y + (i % copyRowLength);
|
|
9256
|
+
const copyRow = getSourceItem(this.dataStore, oldRowIndex) || {};
|
|
9257
|
+
// columns
|
|
9258
|
+
for (let colIndex = d.newRange.x, j = 0; colIndex < d.newRange.x1 + 1; colIndex++, j++) {
|
|
9259
|
+
// check if old range area
|
|
9260
|
+
if (rowIndex >= d.oldRange.y &&
|
|
9261
|
+
rowIndex <= d.oldRange.y1 &&
|
|
9262
|
+
colIndex >= d.oldRange.x &&
|
|
9263
|
+
colIndex <= d.oldRange.x1) {
|
|
9264
|
+
continue;
|
|
9265
|
+
}
|
|
9266
|
+
// requested column beyond range
|
|
9267
|
+
if (!this.columns[colIndex]) {
|
|
9268
|
+
continue;
|
|
9269
|
+
}
|
|
9270
|
+
const prop = (_a = this.columns[colIndex]) === null || _a === void 0 ? void 0 : _a.prop;
|
|
9271
|
+
const copyColIndex = d.oldRange.x + (j % copyColLength);
|
|
9272
|
+
const copyColumnProp = columns[copyColIndex].prop;
|
|
9273
|
+
/** if can write */
|
|
9274
|
+
if (!this.isReadOnly(rowIndex, colIndex)) {
|
|
9275
|
+
/** to show before save */
|
|
9276
|
+
if (!changed[rowIndex]) {
|
|
9277
|
+
changed[rowIndex] = {};
|
|
9278
|
+
}
|
|
9279
|
+
changed[rowIndex][prop] = copyRow[copyColumnProp];
|
|
9280
|
+
/** Generate mapping object */
|
|
9281
|
+
if (!mapping[rowIndex]) {
|
|
9282
|
+
mapping[rowIndex] = {};
|
|
9283
|
+
}
|
|
9284
|
+
mapping[rowIndex][prop] = {
|
|
9285
|
+
colIndex: copyColIndex,
|
|
9286
|
+
colProp: copyColumnProp,
|
|
9287
|
+
rowIndex: oldRowIndex,
|
|
9288
|
+
};
|
|
9289
|
+
}
|
|
9290
|
+
}
|
|
9291
|
+
}
|
|
9292
|
+
return {
|
|
9293
|
+
changed,
|
|
9294
|
+
mapping,
|
|
9295
|
+
};
|
|
9444
9296
|
}
|
|
9445
|
-
|
|
9446
|
-
}
|
|
9447
|
-
|
|
9448
|
-
|
|
9449
|
-
|
|
9450
|
-
|
|
9451
|
-
|
|
9297
|
+
getTransformedDataToApply(start, data) {
|
|
9298
|
+
const changed = {};
|
|
9299
|
+
const copyRowLength = data.length;
|
|
9300
|
+
const colLength = this.columns.length;
|
|
9301
|
+
const rowLength = this.dataStore.get('items').length;
|
|
9302
|
+
// rows
|
|
9303
|
+
let rowIndex = start.y;
|
|
9304
|
+
let maxCol = 0;
|
|
9305
|
+
for (let i = 0; rowIndex < rowLength && i < copyRowLength; rowIndex++, i++) {
|
|
9306
|
+
// copy original data link
|
|
9307
|
+
const copyRow = data[i % copyRowLength];
|
|
9308
|
+
const copyColLength = (copyRow === null || copyRow === void 0 ? void 0 : copyRow.length) || 0;
|
|
9309
|
+
// columns
|
|
9310
|
+
let colIndex = start.x;
|
|
9311
|
+
for (let j = 0; colIndex < colLength && j < copyColLength; colIndex++, j++) {
|
|
9312
|
+
const p = this.columns[colIndex].prop;
|
|
9313
|
+
const currentCol = j % colLength;
|
|
9314
|
+
/** if can write */
|
|
9315
|
+
if (!this.isReadOnly(rowIndex, colIndex)) {
|
|
9316
|
+
/** to show before save */
|
|
9317
|
+
if (!changed[rowIndex]) {
|
|
9318
|
+
changed[rowIndex] = {};
|
|
9319
|
+
}
|
|
9320
|
+
changed[rowIndex][p] = copyRow[currentCol];
|
|
9321
|
+
}
|
|
9322
|
+
}
|
|
9323
|
+
maxCol = Math.max(maxCol, colIndex - 1);
|
|
9452
9324
|
}
|
|
9325
|
+
const range = getRange(start, {
|
|
9326
|
+
y: rowIndex - 1,
|
|
9327
|
+
x: maxCol,
|
|
9328
|
+
});
|
|
9329
|
+
return {
|
|
9330
|
+
changed,
|
|
9331
|
+
range,
|
|
9332
|
+
};
|
|
9333
|
+
}
|
|
9334
|
+
getRangeStaticData(d, value) {
|
|
9335
|
+
const changed = {};
|
|
9336
|
+
// rows
|
|
9337
|
+
for (let rowIndex = d.y, i = 0; rowIndex < d.y1 + 1; rowIndex++, i++) {
|
|
9338
|
+
// columns
|
|
9339
|
+
for (let colIndex = d.x, j = 0; colIndex < d.x1 + 1; colIndex++, j++) {
|
|
9340
|
+
// requested column beyond range
|
|
9341
|
+
if (!this.columns[colIndex]) {
|
|
9342
|
+
continue;
|
|
9343
|
+
}
|
|
9344
|
+
const p = this.columns[colIndex].prop;
|
|
9345
|
+
/** if can write */
|
|
9346
|
+
if (!this.isReadOnly(rowIndex, colIndex)) {
|
|
9347
|
+
/** to show before save */
|
|
9348
|
+
if (!changed[rowIndex]) {
|
|
9349
|
+
changed[rowIndex] = {};
|
|
9350
|
+
}
|
|
9351
|
+
changed[rowIndex][p] = value;
|
|
9352
|
+
}
|
|
9353
|
+
}
|
|
9354
|
+
}
|
|
9355
|
+
return changed;
|
|
9356
|
+
}
|
|
9357
|
+
getRangeTransformedToProps(d, store) {
|
|
9358
|
+
var _a;
|
|
9359
|
+
const area = [];
|
|
9360
|
+
const type = this.dataStore.get('type');
|
|
9361
|
+
// rows
|
|
9362
|
+
for (let rowIndex = d.y, i = 0; rowIndex < d.y1 + 1; rowIndex++, i++) {
|
|
9363
|
+
// columns
|
|
9364
|
+
for (let colIndex = d.x, j = 0; colIndex < d.x1 + 1; colIndex++, j++) {
|
|
9365
|
+
const prop = (_a = this.columns[colIndex]) === null || _a === void 0 ? void 0 : _a.prop;
|
|
9366
|
+
area.push({
|
|
9367
|
+
prop,
|
|
9368
|
+
rowIndex,
|
|
9369
|
+
colIndex,
|
|
9370
|
+
model: getSourceItem(store, rowIndex),
|
|
9371
|
+
type,
|
|
9372
|
+
colType: this.type,
|
|
9373
|
+
});
|
|
9374
|
+
}
|
|
9375
|
+
}
|
|
9376
|
+
return area;
|
|
9377
|
+
}
|
|
9378
|
+
copyRangeArray(range, store) {
|
|
9379
|
+
const cols = [...this.columns];
|
|
9380
|
+
const props = slice_1(cols, range.x, range.x1 + 1).map(v => v.prop);
|
|
9381
|
+
const toCopy = [];
|
|
9382
|
+
const mapping = {};
|
|
9383
|
+
// rows indexes
|
|
9384
|
+
for (let i = range.y; i <= range.y1; i++) {
|
|
9385
|
+
const rgRow = [];
|
|
9386
|
+
mapping[i] = {};
|
|
9387
|
+
// columns indexes
|
|
9388
|
+
for (let prop of props) {
|
|
9389
|
+
const item = getSourceItem(store, i);
|
|
9390
|
+
// if no item - skip
|
|
9391
|
+
if (!item) {
|
|
9392
|
+
continue;
|
|
9393
|
+
}
|
|
9394
|
+
const val = item[prop];
|
|
9395
|
+
rgRow.push(val);
|
|
9396
|
+
mapping[i][prop] = val;
|
|
9397
|
+
}
|
|
9398
|
+
toCopy.push(rgRow);
|
|
9399
|
+
}
|
|
9400
|
+
return {
|
|
9401
|
+
data: toCopy,
|
|
9402
|
+
mapping,
|
|
9403
|
+
};
|
|
9404
|
+
}
|
|
9405
|
+
destroy() {
|
|
9406
|
+
this.unsubscribe.forEach(f => f());
|
|
9453
9407
|
}
|
|
9454
|
-
return res;
|
|
9455
9408
|
}
|
|
9456
9409
|
/**
|
|
9457
|
-
*
|
|
9410
|
+
* Checks if the given rowDrag is a service for dragging rows.
|
|
9458
9411
|
*/
|
|
9459
|
-
function
|
|
9460
|
-
|
|
9412
|
+
function isRowDragService(rowDrag, model) {
|
|
9413
|
+
if (typeof rowDrag === 'function') {
|
|
9414
|
+
return rowDrag(model);
|
|
9415
|
+
}
|
|
9416
|
+
return !!rowDrag;
|
|
9461
9417
|
}
|
|
9462
|
-
|
|
9463
|
-
|
|
9464
|
-
|
|
9465
|
-
|
|
9466
|
-
|
|
9467
|
-
|
|
9468
|
-
columns: {
|
|
9469
|
-
rgCol: [],
|
|
9470
|
-
colPinStart: [],
|
|
9471
|
-
colPinEnd: [],
|
|
9472
|
-
},
|
|
9473
|
-
// columns indexed by prop for quick access
|
|
9474
|
-
columnByProp: {},
|
|
9475
|
-
// column grouping
|
|
9476
|
-
columnGrouping: {
|
|
9477
|
-
rgCol: [],
|
|
9478
|
-
colPinStart: [],
|
|
9479
|
-
colPinEnd: [],
|
|
9480
|
-
},
|
|
9481
|
-
// max depth level for column grouping
|
|
9482
|
-
maxLevel: level,
|
|
9483
|
-
// sorting
|
|
9484
|
-
sort: {},
|
|
9485
|
-
};
|
|
9486
|
-
return reduce_1(columns, (res, colData) => {
|
|
9487
|
-
// Grouped column
|
|
9488
|
-
if (isColGrouping(colData)) {
|
|
9489
|
-
return gatherGroup(res, colData, getColumns(colData.children, level + 1, types), level);
|
|
9490
|
-
}
|
|
9491
|
-
// Regular column
|
|
9492
|
-
const regularColumn = Object.assign(Object.assign({}, (colData.columnType && types && types[colData.columnType])), colData);
|
|
9493
|
-
// Regular column, no Pin
|
|
9494
|
-
if (!regularColumn.pin) {
|
|
9495
|
-
res.columns.rgCol.push(regularColumn);
|
|
9496
|
-
// Pin
|
|
9497
|
-
}
|
|
9498
|
-
else {
|
|
9499
|
-
res.columns[regularColumn.pin].push(regularColumn);
|
|
9418
|
+
function doPropMerge(existing, extra) {
|
|
9419
|
+
let props = Object.assign(Object.assign({}, extra), existing);
|
|
9420
|
+
// extend existing props
|
|
9421
|
+
if (extra.class) {
|
|
9422
|
+
if (typeof extra.class === 'object' && typeof props.class === 'object') {
|
|
9423
|
+
props.class = Object.assign(Object.assign({}, extra.class), props.class);
|
|
9500
9424
|
}
|
|
9501
|
-
if (
|
|
9502
|
-
|
|
9425
|
+
else if (typeof extra.class === 'string' &&
|
|
9426
|
+
typeof props.class === 'object') {
|
|
9427
|
+
props.class[extra.class] = true;
|
|
9503
9428
|
}
|
|
9504
|
-
|
|
9505
|
-
|
|
9506
|
-
res.columnByProp[regularColumn.prop] = [];
|
|
9429
|
+
else if (typeof props.class === 'string') {
|
|
9430
|
+
props.class += ' ' + extra.class;
|
|
9507
9431
|
}
|
|
9508
|
-
|
|
9509
|
-
|
|
9510
|
-
|
|
9511
|
-
|
|
9512
|
-
|
|
9432
|
+
}
|
|
9433
|
+
if (extra.style) {
|
|
9434
|
+
props.style = Object.assign(Object.assign({}, extra.style), props.style);
|
|
9435
|
+
}
|
|
9436
|
+
return props;
|
|
9513
9437
|
}
|
|
9514
|
-
|
|
9515
|
-
|
|
9516
|
-
|
|
9517
|
-
|
|
9518
|
-
|
|
9519
|
-
|
|
9520
|
-
|
|
9521
|
-
|
|
9522
|
-
// if column data
|
|
9523
|
-
if (isArray_1(resultItem) && isArray_1(collectionItem)) {
|
|
9524
|
-
// fill columns
|
|
9525
|
-
resultItem.push(...collectionItem);
|
|
9526
|
-
// fill grouping
|
|
9527
|
-
if (collectionItem.length) {
|
|
9528
|
-
res.columnGrouping[key].push(Object.assign(Object.assign({}, group), { ids: collectionItem.map(item => item.prop) }));
|
|
9529
|
-
}
|
|
9438
|
+
|
|
9439
|
+
function isTouch(e) {
|
|
9440
|
+
return !!e.touches;
|
|
9441
|
+
}
|
|
9442
|
+
function verifyTouchTarget(touchEvent, focusClass) {
|
|
9443
|
+
if (focusClass && touchEvent) {
|
|
9444
|
+
if (!(touchEvent.target instanceof Element && touchEvent.target.classList.contains(focusClass))) {
|
|
9445
|
+
return false;
|
|
9530
9446
|
}
|
|
9531
9447
|
}
|
|
9532
|
-
|
|
9533
|
-
for (let k in collection.columnGrouping) {
|
|
9534
|
-
const key = k;
|
|
9535
|
-
const collectionItem = collection.columnGrouping[key];
|
|
9536
|
-
res.columnGrouping[key].push(...collectionItem);
|
|
9537
|
-
}
|
|
9538
|
-
res.maxLevel = Math.max(res.maxLevel, collection.maxLevel);
|
|
9539
|
-
res.sort = Object.assign(Object.assign({}, res.sort), collection.sort);
|
|
9540
|
-
return res;
|
|
9448
|
+
return true;
|
|
9541
9449
|
}
|
|
9542
|
-
|
|
9543
|
-
|
|
9544
|
-
|
|
9545
|
-
|
|
9546
|
-
|
|
9547
|
-
|
|
9450
|
+
/**
|
|
9451
|
+
* Function to get the value of a specific property from a MouseEvent or TouchEvent object.
|
|
9452
|
+
*/
|
|
9453
|
+
function getPropertyFromEvent(e, prop, focusClass // for touch events
|
|
9454
|
+
) {
|
|
9455
|
+
// Check if the event is a touch event
|
|
9456
|
+
if (isTouch(e)) {
|
|
9457
|
+
// If the event has touches, get the first touch
|
|
9458
|
+
if (e.touches.length > 0) {
|
|
9459
|
+
const touchEvent = e.touches[0];
|
|
9460
|
+
// Check if the target of the touch event is the specified element
|
|
9461
|
+
if (!verifyTouchTarget(touchEvent, focusClass)) {
|
|
9462
|
+
// If not, return null
|
|
9463
|
+
return null;
|
|
9548
9464
|
}
|
|
9465
|
+
// Get the value of the specified property from the touch event and return it
|
|
9466
|
+
return touchEvent[prop] || 0;
|
|
9549
9467
|
}
|
|
9550
|
-
|
|
9551
|
-
|
|
9552
|
-
}
|
|
9468
|
+
// If there are no touches, return null
|
|
9469
|
+
return null;
|
|
9553
9470
|
}
|
|
9554
|
-
return
|
|
9555
|
-
|
|
9556
|
-
function getColumnByProp(columns, prop) {
|
|
9557
|
-
return findColumn(columns, prop);
|
|
9471
|
+
// If the event is not a touch event, get the value of the specified property from the event and return it
|
|
9472
|
+
return e[prop] || 0;
|
|
9558
9473
|
}
|
|
9559
9474
|
|
|
9560
|
-
|
|
9561
|
-
const
|
|
9562
|
-
|
|
9563
|
-
|
|
9564
|
-
|
|
9565
|
-
|
|
9475
|
+
function collectModelsOfRange(data, store) {
|
|
9476
|
+
const models = {};
|
|
9477
|
+
for (let i in data) {
|
|
9478
|
+
const rowIndex = parseInt(i, 10);
|
|
9479
|
+
models[rowIndex] = getSourceItem(store, rowIndex);
|
|
9480
|
+
}
|
|
9481
|
+
return models;
|
|
9482
|
+
}
|
|
9483
|
+
function getFocusCellBasedOnEvent(e, data) {
|
|
9484
|
+
// If event default is prevented, return
|
|
9485
|
+
if (e.defaultPrevented) {
|
|
9486
|
+
return null;
|
|
9487
|
+
}
|
|
9488
|
+
// Get coordinates from event object
|
|
9489
|
+
const x = getPropertyFromEvent(e, 'clientX');
|
|
9490
|
+
const y = getPropertyFromEvent(e, 'clientY');
|
|
9491
|
+
// If coordinates are not available, return
|
|
9492
|
+
if (x === null || y === null) {
|
|
9493
|
+
return null;
|
|
9494
|
+
}
|
|
9495
|
+
// Get current cell based on coordinates and data
|
|
9496
|
+
const focusCell = getCurrentCell({ x, y }, data);
|
|
9497
|
+
// If current cell is not available, return
|
|
9498
|
+
if (isAfterLast(focusCell, data.lastCell)) {
|
|
9499
|
+
return null;
|
|
9500
|
+
}
|
|
9501
|
+
return focusCell;
|
|
9502
|
+
}
|
|
9566
9503
|
/**
|
|
9567
|
-
* Calculate
|
|
9504
|
+
* Calculate cell based on x, y position
|
|
9568
9505
|
*/
|
|
9569
|
-
function
|
|
9570
|
-
//
|
|
9571
|
-
const
|
|
9572
|
-
//
|
|
9573
|
-
|
|
9574
|
-
|
|
9575
|
-
|
|
9576
|
-
|
|
9577
|
-
|
|
9578
|
-
|
|
9579
|
-
//
|
|
9580
|
-
|
|
9581
|
-
|
|
9582
|
-
|
|
9583
|
-
//
|
|
9584
|
-
|
|
9585
|
-
|
|
9586
|
-
|
|
9506
|
+
function getCurrentCell({ x, y }, { el, rows, cols }) {
|
|
9507
|
+
// Get the bounding rectangle of the element
|
|
9508
|
+
const { top, left, height, width } = el.getBoundingClientRect();
|
|
9509
|
+
// Calculate the cell position relative to the element
|
|
9510
|
+
let cellY = y - top;
|
|
9511
|
+
let cellX = x - left;
|
|
9512
|
+
// Limit the cell position to the element height
|
|
9513
|
+
if (cellY >= height) {
|
|
9514
|
+
cellY = height - 1;
|
|
9515
|
+
}
|
|
9516
|
+
// Limit the cell position to the element width
|
|
9517
|
+
if (cellX >= width) {
|
|
9518
|
+
cellX = width - 1;
|
|
9519
|
+
}
|
|
9520
|
+
// Get the row and column items based on the cell position
|
|
9521
|
+
const rgRow = getItemByPosition(rows, cellY);
|
|
9522
|
+
const rgCol = getItemByPosition(cols, cellX);
|
|
9523
|
+
// Set the row and column index to 0 if they are before the first item
|
|
9524
|
+
if (rgCol.itemIndex < 0) {
|
|
9525
|
+
rgCol.itemIndex = 0;
|
|
9526
|
+
}
|
|
9527
|
+
if (rgRow.itemIndex < 0) {
|
|
9528
|
+
rgRow.itemIndex = 0;
|
|
9529
|
+
}
|
|
9530
|
+
return { x: rgCol.itemIndex, y: rgRow.itemIndex };
|
|
9587
9531
|
}
|
|
9588
|
-
|
|
9589
|
-
|
|
9590
|
-
|
|
9591
|
-
|
|
9592
|
-
|
|
9593
|
-
|
|
9594
|
-
|
|
9595
|
-
|
|
9596
|
-
|
|
9597
|
-
|
|
9598
|
-
|
|
9599
|
-
|
|
9600
|
-
|
|
9601
|
-
|
|
9532
|
+
function getCoordinate(range, focus, changes, isMulti = false) {
|
|
9533
|
+
const updateCoordinate = (c, pos = 0) => {
|
|
9534
|
+
const start = { x: range.x, y: range.y };
|
|
9535
|
+
const end = isMulti ? { x: range.x1, y: range.y1 } : start;
|
|
9536
|
+
const point = end[c] > focus[c] ? end : start;
|
|
9537
|
+
point[c] += pos;
|
|
9538
|
+
return { start, end };
|
|
9539
|
+
};
|
|
9540
|
+
if (changes.x) {
|
|
9541
|
+
return updateCoordinate('x', changes['x']);
|
|
9542
|
+
}
|
|
9543
|
+
if (changes.y) {
|
|
9544
|
+
return updateCoordinate('y', changes['y']);
|
|
9545
|
+
}
|
|
9546
|
+
return null;
|
|
9602
9547
|
}
|
|
9603
9548
|
/**
|
|
9604
|
-
*
|
|
9549
|
+
* Check if the x coordinate of the cell position is after or equal to the x coordinate of the last cell position
|
|
9550
|
+
* or if the y coordinate of the cell position is after or equal to the y coordinate of the last cell position
|
|
9605
9551
|
*/
|
|
9606
|
-
|
|
9607
|
-
|
|
9608
|
-
|
|
9609
|
-
|
|
9552
|
+
function isAfterLast({ x, y }, lastCell) {
|
|
9553
|
+
return x >= lastCell.x || y >= lastCell.y;
|
|
9554
|
+
}
|
|
9555
|
+
/** check if out of range */
|
|
9556
|
+
function isBeforeFirst({ x, y }) {
|
|
9557
|
+
return x < 0 || y < 0;
|
|
9558
|
+
}
|
|
9559
|
+
/** Compare cells, only 1 coordinate difference is possible */
|
|
9560
|
+
// export function getDirectionCoordinate(initial: Cell, last: Cell): Partial<Cell> | null {
|
|
9561
|
+
// const c: (keyof Cell)[] = ['x', 'y'];
|
|
9562
|
+
// for (let k of c) {
|
|
9563
|
+
// if (initial[k] !== last[k]) {
|
|
9564
|
+
// return { [k]: 1 };
|
|
9565
|
+
// }
|
|
9566
|
+
// }
|
|
9567
|
+
// return null;
|
|
9568
|
+
// }
|
|
9569
|
+
// export function getLargestAxis(initial: Cell, last: Cell): Partial<Cell> | null {
|
|
9570
|
+
// const cell: Partial<Cell> = {};
|
|
9571
|
+
// const c: (keyof Cell)[] = ['x', 'y'];
|
|
9572
|
+
// for (let k of c) {
|
|
9573
|
+
// cell[k] = Math.abs(initial[k] - last[k]);
|
|
9574
|
+
// }
|
|
9575
|
+
// if (cell.x > cell.y) {
|
|
9576
|
+
// return { x: 1 };
|
|
9577
|
+
// }
|
|
9578
|
+
// if (cell.y > cell.x) {
|
|
9579
|
+
// return { y: 1 };
|
|
9580
|
+
// }
|
|
9581
|
+
// return null;
|
|
9582
|
+
// }
|
|
9583
|
+
function styleByCellProps(styles) {
|
|
9584
|
+
return {
|
|
9585
|
+
left: `${styles.left}px`,
|
|
9586
|
+
top: `${styles.top}px`,
|
|
9587
|
+
width: `${styles.width}px`,
|
|
9588
|
+
height: `${styles.height}px`,
|
|
9589
|
+
};
|
|
9590
|
+
}
|
|
9591
|
+
function getCell({ x, y, x1, y1 }, dimensionRow, dimensionCol) {
|
|
9592
|
+
const top = getItemByIndex(dimensionRow, y).start;
|
|
9593
|
+
const left = getItemByIndex(dimensionCol, x).start;
|
|
9594
|
+
const bottom = getItemByIndex(dimensionRow, y1).end;
|
|
9595
|
+
const right = getItemByIndex(dimensionCol, x1).end;
|
|
9596
|
+
return {
|
|
9597
|
+
left,
|
|
9598
|
+
right,
|
|
9599
|
+
top,
|
|
9600
|
+
bottom,
|
|
9601
|
+
width: right - left,
|
|
9602
|
+
height: bottom - top,
|
|
9603
|
+
};
|
|
9604
|
+
}
|
|
9605
|
+
function getElStyle(range, dimensionRow, dimensionCol) {
|
|
9606
|
+
const styles = getCell(range, dimensionRow, dimensionCol);
|
|
9607
|
+
return styleByCellProps(styles);
|
|
9608
|
+
}
|
|
9609
|
+
|
|
9610
|
+
// is edit input
|
|
9611
|
+
function isEditInput(el) {
|
|
9612
|
+
return !!(el === null || el === void 0 ? void 0 : el.closest(`.${EDIT_INPUT_WR}`));
|
|
9613
|
+
}
|
|
9614
|
+
// Type guard for EditorCtrConstructible
|
|
9615
|
+
function isEditorCtrConstructible(editor) {
|
|
9616
|
+
return typeof editor === 'function' && typeof editor.prototype === 'object';
|
|
9610
9617
|
}
|
|
9611
9618
|
|
|
9612
9619
|
const DIRECTION_CODES = [
|
|
@@ -11191,7 +11198,7 @@ class ThemeService {
|
|
|
11191
11198
|
this.register('default');
|
|
11192
11199
|
}
|
|
11193
11200
|
register(theme) {
|
|
11194
|
-
const parsedTheme =
|
|
11201
|
+
const parsedTheme = getTheme(theme);
|
|
11195
11202
|
switch (parsedTheme) {
|
|
11196
11203
|
case 'material':
|
|
11197
11204
|
case 'darkMaterial':
|
|
@@ -11206,12 +11213,12 @@ class ThemeService {
|
|
|
11206
11213
|
break;
|
|
11207
11214
|
}
|
|
11208
11215
|
}
|
|
11209
|
-
|
|
11210
|
-
|
|
11211
|
-
|
|
11212
|
-
|
|
11213
|
-
return DEFAULT_THEME;
|
|
11216
|
+
}
|
|
11217
|
+
function getTheme(theme) {
|
|
11218
|
+
if (theme && allowedThemes.indexOf(theme) > -1) {
|
|
11219
|
+
return theme;
|
|
11214
11220
|
}
|
|
11221
|
+
return DEFAULT_THEME;
|
|
11215
11222
|
}
|
|
11216
11223
|
|
|
11217
11224
|
/**
|
|
@@ -11618,23 +11625,7 @@ const notContains = (value, extra) => {
|
|
|
11618
11625
|
notContains.extra = 'input';
|
|
11619
11626
|
contains.extra = 'input';
|
|
11620
11627
|
|
|
11621
|
-
const
|
|
11622
|
-
none: 'None',
|
|
11623
|
-
empty: 'Not set',
|
|
11624
|
-
notEmpty: 'Set',
|
|
11625
|
-
eq: 'Equal',
|
|
11626
|
-
notEq: 'Not equal',
|
|
11627
|
-
begins: 'Begins with',
|
|
11628
|
-
contains: 'Contains',
|
|
11629
|
-
notContains: 'Does not contain',
|
|
11630
|
-
eqN: '=',
|
|
11631
|
-
neqN: '!=',
|
|
11632
|
-
gt: '>',
|
|
11633
|
-
gte: '>=',
|
|
11634
|
-
lt: '<',
|
|
11635
|
-
lte: '<=',
|
|
11636
|
-
};
|
|
11637
|
-
const filterEntities = {
|
|
11628
|
+
const filterCoreFunctionsIndexedByType = {
|
|
11638
11629
|
none: () => true,
|
|
11639
11630
|
empty: notSet,
|
|
11640
11631
|
notEmpty: set,
|
|
@@ -11654,7 +11645,37 @@ const filterTypes = {
|
|
|
11654
11645
|
string: ['notEmpty', 'empty', 'eq', 'notEq', 'begins', 'contains', 'notContains'],
|
|
11655
11646
|
number: ['notEmpty', 'empty', 'eqN', 'neqN', 'gt', 'gte', 'lt', 'lte'],
|
|
11656
11647
|
};
|
|
11648
|
+
const filterNames = {
|
|
11649
|
+
none: 'None',
|
|
11650
|
+
empty: 'Not set',
|
|
11651
|
+
notEmpty: 'Set',
|
|
11652
|
+
eq: 'Equal',
|
|
11653
|
+
notEq: 'Not equal',
|
|
11654
|
+
begins: 'Begins with',
|
|
11655
|
+
contains: 'Contains',
|
|
11656
|
+
notContains: 'Does not contain',
|
|
11657
|
+
eqN: '=',
|
|
11658
|
+
neqN: '!=',
|
|
11659
|
+
gt: '>',
|
|
11660
|
+
gte: '>=',
|
|
11661
|
+
lt: '<',
|
|
11662
|
+
lte: '<=',
|
|
11663
|
+
};
|
|
11657
11664
|
|
|
11665
|
+
/**
|
|
11666
|
+
* @typedef ColumnFilterConfig
|
|
11667
|
+
* @type {object}
|
|
11668
|
+
* @property {FilterCollection|undefined} collection - preserved filter data
|
|
11669
|
+
* @property {string[]|undefined} include - filters to be included, if defined everything else out of scope will be ignored
|
|
11670
|
+
* @property {Record<string, CustomFilter>|undefined} customFilters - hash map of {FilterType:CustomFilter}.
|
|
11671
|
+
* @property {FilterLocalization|undefined} localization - translation for filter popup captions.
|
|
11672
|
+
* @property {MultiFilterItem|undefined} multiFilterItems - data for multi filtering.
|
|
11673
|
+
* @property {boolean|undefined} disableDynamicFiltering - disables dynamic filtering.
|
|
11674
|
+
* A way to define your own filter types per column
|
|
11675
|
+
*/
|
|
11676
|
+
/**
|
|
11677
|
+
* @internal
|
|
11678
|
+
*/
|
|
11658
11679
|
const FILTER_TRIMMED_TYPE = 'filter';
|
|
11659
11680
|
const FILTER_CONFIG_CHANGED_EVENT = 'filterconfigchanged';
|
|
11660
11681
|
class FilterPlugin extends BasePlugin {
|
|
@@ -11664,14 +11685,13 @@ class FilterPlugin extends BasePlugin {
|
|
|
11664
11685
|
this.revogrid = revogrid;
|
|
11665
11686
|
this.filterCollection = {};
|
|
11666
11687
|
this.multiFilterItems = {};
|
|
11667
|
-
this.
|
|
11668
|
-
this.
|
|
11669
|
-
this.
|
|
11688
|
+
this.filterByType = Object.assign({}, filterTypes);
|
|
11689
|
+
this.filterNameIndexByType = Object.assign({}, filterNames);
|
|
11690
|
+
this.filterFunctionsIndexedByType = Object.assign({}, filterCoreFunctionsIndexedByType);
|
|
11670
11691
|
this.filterProp = FILTER_PROP;
|
|
11671
11692
|
if (config) {
|
|
11672
11693
|
this.initConfig(config);
|
|
11673
11694
|
}
|
|
11674
|
-
const headerclick = (e) => this.headerclick(e);
|
|
11675
11695
|
const aftersourceset = async () => {
|
|
11676
11696
|
const filterCollectionProps = Object.keys(this.filterCollection);
|
|
11677
11697
|
if (filterCollectionProps.length > 0) {
|
|
@@ -11691,7 +11711,7 @@ class FilterPlugin extends BasePlugin {
|
|
|
11691
11711
|
}
|
|
11692
11712
|
await this.runFiltering();
|
|
11693
11713
|
};
|
|
11694
|
-
this.addEventListener('headerclick', headerclick);
|
|
11714
|
+
this.addEventListener('headerclick', (e) => this.headerclick(e));
|
|
11695
11715
|
this.addEventListener(FILTER_CONFIG_CHANGED_EVENT, ({ detail }) => {
|
|
11696
11716
|
if (!detail) {
|
|
11697
11717
|
this.clearFiltering();
|
|
@@ -11704,27 +11724,29 @@ class FilterPlugin extends BasePlugin {
|
|
|
11704
11724
|
});
|
|
11705
11725
|
this.addEventListener('aftersourceset', aftersourceset);
|
|
11706
11726
|
this.addEventListener('filter', ({ detail }) => this.onFilterChange(detail));
|
|
11707
|
-
const existingNodes = this.revogrid.registerVNode.filter(
|
|
11727
|
+
const existingNodes = this.revogrid.registerVNode.filter(n => n.$tag$ !== 'revogr-filter-panel');
|
|
11708
11728
|
this.revogrid.registerVNode = [
|
|
11709
11729
|
...existingNodes,
|
|
11710
|
-
hAsync("revogr-filter-panel", { filterItems: this.multiFilterItems, filterNames: this.
|
|
11730
|
+
hAsync("revogr-filter-panel", { filterItems: this.multiFilterItems, filterNames: this.filterNameIndexByType, filterEntities: this.filterFunctionsIndexedByType, filterCaptions: (_a = config === null || config === void 0 ? void 0 : config.localization) === null || _a === void 0 ? void 0 : _a.captions, onFilterChange: e => this.onFilterChange(e.detail), disableDynamicFiltering: config === null || config === void 0 ? void 0 : config.disableDynamicFiltering, ref: e => (this.pop = e) }),
|
|
11711
11731
|
];
|
|
11712
11732
|
}
|
|
11713
11733
|
initConfig(config) {
|
|
11714
11734
|
if (config.multiFilterItems) {
|
|
11715
11735
|
this.multiFilterItems = Object.assign({}, config.multiFilterItems);
|
|
11716
11736
|
}
|
|
11737
|
+
// Add custom filters
|
|
11717
11738
|
if (config.customFilters) {
|
|
11718
|
-
for (let
|
|
11719
|
-
const cFilter = config.customFilters[
|
|
11720
|
-
if (!this.
|
|
11721
|
-
this.
|
|
11739
|
+
for (let customFilterType in config.customFilters) {
|
|
11740
|
+
const cFilter = config.customFilters[customFilterType];
|
|
11741
|
+
if (!this.filterByType[cFilter.columnFilterType]) {
|
|
11742
|
+
this.filterByType[cFilter.columnFilterType] = [];
|
|
11722
11743
|
}
|
|
11723
|
-
this.
|
|
11724
|
-
this.
|
|
11725
|
-
this.
|
|
11744
|
+
this.filterByType[cFilter.columnFilterType].push(customFilterType);
|
|
11745
|
+
this.filterFunctionsIndexedByType[customFilterType] = cFilter.func;
|
|
11746
|
+
this.filterNameIndexByType[customFilterType] = cFilter.name;
|
|
11726
11747
|
}
|
|
11727
11748
|
}
|
|
11749
|
+
// Add filterProp if provided in config
|
|
11728
11750
|
if (config.filterProp) {
|
|
11729
11751
|
this.filterProp = config.filterProp;
|
|
11730
11752
|
}
|
|
@@ -11735,21 +11757,21 @@ class FilterPlugin extends BasePlugin {
|
|
|
11735
11757
|
const cfgInlcude = config.include;
|
|
11736
11758
|
if (cfgInlcude) {
|
|
11737
11759
|
const filters = {};
|
|
11738
|
-
for (let t in this.
|
|
11760
|
+
for (let t in this.filterByType) {
|
|
11739
11761
|
// validate filters, if appropriate function present
|
|
11740
|
-
const newTypes = this.
|
|
11762
|
+
const newTypes = this.filterByType[t].filter(f => cfgInlcude.indexOf(f) > -1);
|
|
11741
11763
|
if (newTypes.length) {
|
|
11742
11764
|
filters[t] = newTypes;
|
|
11743
11765
|
}
|
|
11744
11766
|
}
|
|
11745
11767
|
// if any valid filters provided show them
|
|
11746
11768
|
if (Object.keys(filters).length > 0) {
|
|
11747
|
-
this.
|
|
11769
|
+
this.filterByType = filters;
|
|
11748
11770
|
}
|
|
11749
11771
|
}
|
|
11750
11772
|
if (config.collection) {
|
|
11751
11773
|
this.filterCollection = reduce_1(config.collection, (result, item, prop) => {
|
|
11752
|
-
if (this.
|
|
11774
|
+
if (this.filterFunctionsIndexedByType[item.type]) {
|
|
11753
11775
|
result[prop] = item;
|
|
11754
11776
|
}
|
|
11755
11777
|
else {
|
|
@@ -11761,8 +11783,8 @@ class FilterPlugin extends BasePlugin {
|
|
|
11761
11783
|
if (config.localization) {
|
|
11762
11784
|
if (config.localization.filterNames) {
|
|
11763
11785
|
Object.entries(config.localization.filterNames).forEach(([k, v]) => {
|
|
11764
|
-
if (this.
|
|
11765
|
-
this.
|
|
11786
|
+
if (this.filterNameIndexByType[k] != void 0) {
|
|
11787
|
+
this.filterNameIndexByType[k] = v;
|
|
11766
11788
|
}
|
|
11767
11789
|
});
|
|
11768
11790
|
}
|
|
@@ -11788,13 +11810,12 @@ class FilterPlugin extends BasePlugin {
|
|
|
11788
11810
|
const gridPos = this.revogrid.getBoundingClientRect();
|
|
11789
11811
|
const buttonPos = el.getBoundingClientRect();
|
|
11790
11812
|
const prop = e.detail.prop;
|
|
11791
|
-
this.pop.filterTypes
|
|
11792
|
-
this.pop.show(Object.assign(Object.assign({}, this.filterCollection[prop]), { x: buttonPos.x - gridPos.x, y: buttonPos.y - gridPos.y + buttonPos.height, autoCorrect: true, prop }));
|
|
11813
|
+
this.pop.show(Object.assign(Object.assign({}, this.filterCollection[prop]), { x: buttonPos.x - gridPos.x, y: buttonPos.y - gridPos.y + buttonPos.height, autoCorrect: true, prop, filterTypes: this.getColumnFilter(e.detail.filter) }));
|
|
11793
11814
|
}
|
|
11794
11815
|
getColumnFilter(type) {
|
|
11795
11816
|
let filterType = 'string';
|
|
11796
11817
|
if (!type) {
|
|
11797
|
-
return { [filterType]: this.
|
|
11818
|
+
return { [filterType]: this.filterByType[filterType] };
|
|
11798
11819
|
}
|
|
11799
11820
|
// if custom column filter
|
|
11800
11821
|
if (this.isValidType(type)) {
|
|
@@ -11804,44 +11825,59 @@ class FilterPlugin extends BasePlugin {
|
|
|
11804
11825
|
else if (typeof type === 'object' && type.length) {
|
|
11805
11826
|
return type.reduce((r, multiType) => {
|
|
11806
11827
|
if (this.isValidType(multiType)) {
|
|
11807
|
-
r[multiType] = this.
|
|
11828
|
+
r[multiType] = this.filterByType[multiType];
|
|
11808
11829
|
}
|
|
11809
11830
|
return r;
|
|
11810
11831
|
}, {});
|
|
11811
11832
|
}
|
|
11812
|
-
return { [filterType]: this.
|
|
11833
|
+
return { [filterType]: this.filterByType[filterType] };
|
|
11813
11834
|
}
|
|
11814
11835
|
isValidType(type) {
|
|
11815
|
-
return !!(typeof type === 'string' && this.
|
|
11836
|
+
return !!(typeof type === 'string' && this.filterByType[type]);
|
|
11816
11837
|
}
|
|
11817
|
-
|
|
11838
|
+
/**
|
|
11839
|
+
* Called on internal component change
|
|
11840
|
+
*/
|
|
11818
11841
|
async onFilterChange(filterItems) {
|
|
11842
|
+
// store the filter items
|
|
11819
11843
|
this.multiFilterItems = filterItems;
|
|
11844
|
+
// run the filtering when the items change
|
|
11820
11845
|
this.runFiltering();
|
|
11821
11846
|
}
|
|
11822
11847
|
/**
|
|
11823
11848
|
* Triggers grid filtering
|
|
11824
11849
|
*/
|
|
11825
|
-
async doFiltering(collection,
|
|
11850
|
+
async doFiltering(collection, source, columns, filterItems) {
|
|
11826
11851
|
const columnsToUpdate = [];
|
|
11852
|
+
/**
|
|
11853
|
+
* Loop through the columns and update the columns that need to be updated with the `hasFilter` property.
|
|
11854
|
+
*/
|
|
11855
|
+
const columnByProp = {};
|
|
11827
11856
|
columns.forEach(rgCol => {
|
|
11828
11857
|
const column = Object.assign({}, rgCol);
|
|
11829
11858
|
const hasFilter = filterItems[column.prop];
|
|
11859
|
+
columnByProp[column.prop] = column;
|
|
11860
|
+
/**
|
|
11861
|
+
* If the column has a filter and it's not already marked as filtered, update the column.
|
|
11862
|
+
*/
|
|
11830
11863
|
if (column[this.filterProp] && !hasFilter) {
|
|
11831
11864
|
delete column[this.filterProp];
|
|
11832
11865
|
columnsToUpdate.push(column);
|
|
11833
11866
|
}
|
|
11867
|
+
/**
|
|
11868
|
+
* If the column does not have a filter and it's marked as filtered, update the column.
|
|
11869
|
+
*/
|
|
11834
11870
|
if (!column[this.filterProp] && hasFilter) {
|
|
11835
11871
|
columnsToUpdate.push(column);
|
|
11836
11872
|
column[this.filterProp] = true;
|
|
11837
11873
|
}
|
|
11838
11874
|
});
|
|
11839
|
-
const
|
|
11875
|
+
const itemsToTrim = this.getRowFilter(source, filterItems, columnByProp);
|
|
11840
11876
|
// check is filter event prevented
|
|
11841
11877
|
const { defaultPrevented, detail } = this.emit('beforefiltertrimmed', {
|
|
11842
11878
|
collection,
|
|
11843
|
-
itemsToFilter,
|
|
11844
|
-
source
|
|
11879
|
+
itemsToFilter: itemsToTrim,
|
|
11880
|
+
source,
|
|
11845
11881
|
filterItems,
|
|
11846
11882
|
});
|
|
11847
11883
|
if (defaultPrevented) {
|
|
@@ -11853,7 +11889,7 @@ class FilterPlugin extends BasePlugin {
|
|
|
11853
11889
|
return;
|
|
11854
11890
|
}
|
|
11855
11891
|
// applies the hasFilter to the columns to show filter icon
|
|
11856
|
-
|
|
11892
|
+
this.providers.column.updateColumns(columnsToUpdate);
|
|
11857
11893
|
this.emit('afterfilterapply');
|
|
11858
11894
|
}
|
|
11859
11895
|
async clearFiltering() {
|
|
@@ -11869,7 +11905,7 @@ class FilterPlugin extends BasePlugin {
|
|
|
11869
11905
|
if (this.multiFilterItems[prop].length > 0) {
|
|
11870
11906
|
const firstFilterItem = this.multiFilterItems[prop][0];
|
|
11871
11907
|
collection[prop] = {
|
|
11872
|
-
filter:
|
|
11908
|
+
filter: this.filterFunctionsIndexedByType[firstFilterItem.type],
|
|
11873
11909
|
type: firstFilterItem.type,
|
|
11874
11910
|
value: firstFilterItem.value,
|
|
11875
11911
|
};
|
|
@@ -11894,52 +11930,68 @@ class FilterPlugin extends BasePlugin {
|
|
|
11894
11930
|
columns: await this.revogrid.getColumns(),
|
|
11895
11931
|
};
|
|
11896
11932
|
}
|
|
11897
|
-
|
|
11933
|
+
/**
|
|
11934
|
+
* Get trimmed rows based on filter
|
|
11935
|
+
*/
|
|
11936
|
+
getRowFilter(rows, filterItems, columnByProp) {
|
|
11898
11937
|
const propKeys = Object.keys(filterItems);
|
|
11899
11938
|
const trimmed = {};
|
|
11900
11939
|
let propFilterSatisfiedCount = 0;
|
|
11901
11940
|
let lastFilterResults = [];
|
|
11902
11941
|
// each rows
|
|
11903
11942
|
rows.forEach((model, rowIndex) => {
|
|
11904
|
-
//
|
|
11943
|
+
// check filter by column properties
|
|
11905
11944
|
for (const prop of propKeys) {
|
|
11906
11945
|
const propFilters = filterItems[prop];
|
|
11946
|
+
// reset the count of satisfied filters
|
|
11907
11947
|
propFilterSatisfiedCount = 0;
|
|
11948
|
+
// reset the array of last filter results
|
|
11908
11949
|
lastFilterResults = [];
|
|
11909
11950
|
// testing each filter for a prop
|
|
11910
11951
|
for (const [filterIndex, filterData] of propFilters.entries()) {
|
|
11911
11952
|
// the filter LogicFunction based on the type
|
|
11912
|
-
const
|
|
11953
|
+
const filterFunc = this.filterFunctionsIndexedByType[filterData.type];
|
|
11913
11954
|
// THE MAGIC OF FILTERING IS HERE
|
|
11955
|
+
const column = columnByProp[prop];
|
|
11956
|
+
// If there is no column but user wants to filter by a property
|
|
11957
|
+
const value = column ? getCellDataParsed(model, columnByProp[prop]) : model[prop];
|
|
11958
|
+
// OR relation
|
|
11914
11959
|
if (filterData.relation === 'or') {
|
|
11960
|
+
// reset the array of last filter results
|
|
11915
11961
|
lastFilterResults = [];
|
|
11916
|
-
if
|
|
11962
|
+
// if the filter is satisfied, continue to the next filter
|
|
11963
|
+
if (filterFunc(value, filterData.value)) {
|
|
11917
11964
|
continue;
|
|
11918
11965
|
}
|
|
11966
|
+
// if the filter is not satisfied, count it
|
|
11919
11967
|
propFilterSatisfiedCount++;
|
|
11968
|
+
// AND relation
|
|
11920
11969
|
}
|
|
11921
11970
|
else {
|
|
11922
11971
|
// 'and' relation will need to know the next filter
|
|
11923
11972
|
// so we save this current filter to include it in the next filter
|
|
11924
|
-
lastFilterResults.push(!
|
|
11973
|
+
lastFilterResults.push(!filterFunc(value, filterData.value));
|
|
11925
11974
|
// check first if we have a filter on the next index to pair it with this current filter
|
|
11926
11975
|
const nextFilterData = propFilters[filterIndex + 1];
|
|
11927
11976
|
// stop the sequence if there is no next filter or if the next filter is not an 'and' relation
|
|
11928
11977
|
if (!nextFilterData || nextFilterData.relation !== 'and') {
|
|
11929
11978
|
// let's just continue since for sure propFilterSatisfiedCount cannot be satisfied
|
|
11930
11979
|
if (lastFilterResults.indexOf(true) === -1) {
|
|
11980
|
+
// reset the array of last filter results
|
|
11931
11981
|
lastFilterResults = [];
|
|
11932
11982
|
continue;
|
|
11933
11983
|
}
|
|
11934
11984
|
// we need to add all of the lastFilterResults since we need to satisfy all
|
|
11935
11985
|
propFilterSatisfiedCount += lastFilterResults.length;
|
|
11986
|
+
// reset the array of last filter results
|
|
11936
11987
|
lastFilterResults = [];
|
|
11937
11988
|
}
|
|
11938
11989
|
}
|
|
11939
11990
|
} // end of propFilters forEach
|
|
11940
11991
|
// add to the list of removed/trimmed rows of filter condition is satisfied
|
|
11941
|
-
if (propFilterSatisfiedCount === propFilters.length)
|
|
11992
|
+
if (propFilterSatisfiedCount === propFilters.length) {
|
|
11942
11993
|
trimmed[rowIndex] = true;
|
|
11994
|
+
}
|
|
11943
11995
|
} // end of for-of propKeys
|
|
11944
11996
|
});
|
|
11945
11997
|
return trimmed;
|
|
@@ -13931,34 +13983,33 @@ const ResizableElement = (props, children) => {
|
|
|
13931
13983
|
const resizeEls = [];
|
|
13932
13984
|
const directive = (props.canResize &&
|
|
13933
13985
|
new ResizeDirective(props, e => {
|
|
13986
|
+
var _a;
|
|
13934
13987
|
if (e.eventName === ResizeEvents.end) {
|
|
13935
|
-
props.onResize
|
|
13988
|
+
(_a = props.onResize) === null || _a === void 0 ? void 0 : _a.call(props, e);
|
|
13936
13989
|
}
|
|
13937
13990
|
})) ||
|
|
13938
13991
|
null;
|
|
13939
|
-
if (props.
|
|
13940
|
-
if (props.
|
|
13992
|
+
if (props.active) {
|
|
13993
|
+
if (props.canResize) {
|
|
13941
13994
|
for (let p in props.active) {
|
|
13942
13995
|
resizeEls.push(hAsync("div", { onClick: e => e.preventDefault(), onDblClick: e => {
|
|
13943
13996
|
var _a;
|
|
13944
13997
|
e.preventDefault();
|
|
13945
|
-
(_a = props.
|
|
13998
|
+
(_a = props.onDblClick) === null || _a === void 0 ? void 0 : _a.call(props, e);
|
|
13946
13999
|
}, onMouseDown: (e) => directive === null || directive === void 0 ? void 0 : directive.handleDown(e), onTouchStart: (e) => directive === null || directive === void 0 ? void 0 : directive.handleDown(e), class: `resizable resizable-${props.active[p]}` }));
|
|
13947
14000
|
}
|
|
13948
14001
|
}
|
|
13949
|
-
|
|
13950
|
-
else {
|
|
13951
|
-
if (props.active) {
|
|
14002
|
+
else {
|
|
13952
14003
|
for (let p in props.active) {
|
|
13953
14004
|
resizeEls.push(hAsync("div", { onClick: e => e.preventDefault(), onTouchStart: (e) => e.preventDefault(), onDblClick: e => {
|
|
13954
14005
|
var _a;
|
|
13955
14006
|
e.preventDefault();
|
|
13956
|
-
(_a = props.
|
|
14007
|
+
(_a = props.onDblClick) === null || _a === void 0 ? void 0 : _a.call(props, e);
|
|
13957
14008
|
}, class: `no-resize resizable resizable-${props.active[p]}` }));
|
|
13958
14009
|
}
|
|
13959
14010
|
}
|
|
13960
14011
|
}
|
|
13961
|
-
return (hAsync("div", Object.assign({}, props, { ref:
|
|
14012
|
+
return (hAsync("div", Object.assign({}, props, { ref: e => e && (directive === null || directive === void 0 ? void 0 : directive.set(e)) }),
|
|
13962
14013
|
children,
|
|
13963
14014
|
resizeEls));
|
|
13964
14015
|
};
|
|
@@ -13972,16 +14023,17 @@ const HeaderCellRenderer = ({ data, props, additionalData }, children) => {
|
|
|
13972
14023
|
}
|
|
13973
14024
|
if (data === null || data === void 0 ? void 0 : data.columnProperties) {
|
|
13974
14025
|
const extra = data.columnProperties(data);
|
|
13975
|
-
if (extra
|
|
14026
|
+
if (extra) {
|
|
13976
14027
|
cellProps = doPropMerge(props, extra);
|
|
13977
14028
|
}
|
|
13978
14029
|
}
|
|
13979
|
-
|
|
14030
|
+
const resizeProps = Object.assign(Object.assign({}, cellProps), { onMouseDown(e) {
|
|
13980
14031
|
dispatch(e.currentTarget, ON_COLUMN_CLICK, {
|
|
13981
14032
|
data,
|
|
13982
14033
|
event: e,
|
|
13983
14034
|
});
|
|
13984
|
-
} })
|
|
14035
|
+
} });
|
|
14036
|
+
return (hAsync(ResizableElement, Object.assign({}, resizeProps),
|
|
13985
14037
|
hAsync("div", { class: "header-content" }, colTemplate),
|
|
13986
14038
|
children));
|
|
13987
14039
|
};
|
|
@@ -14194,8 +14246,14 @@ class WCAGPlugin extends BasePlugin {
|
|
|
14194
14246
|
return result;
|
|
14195
14247
|
};
|
|
14196
14248
|
column.cellProperties = (...args) => {
|
|
14249
|
+
const wcagProps = {
|
|
14250
|
+
['role']: 'gridcell',
|
|
14251
|
+
['aria-colindex']: index,
|
|
14252
|
+
['aria-rowindex']: args[0].rowIndex,
|
|
14253
|
+
['tabindex']: -1,
|
|
14254
|
+
};
|
|
14197
14255
|
const columnProps = (cellProperties === null || cellProperties === void 0 ? void 0 : cellProperties(...args)) || {};
|
|
14198
|
-
return Object.assign({
|
|
14256
|
+
return Object.assign(Object.assign({}, wcagProps), columnProps);
|
|
14199
14257
|
};
|
|
14200
14258
|
});
|
|
14201
14259
|
});
|
|
@@ -15881,9 +15939,9 @@ const HeaderRenderer = (p) => {
|
|
|
15881
15939
|
transform: `translateX(${p.column.start}px)`,
|
|
15882
15940
|
},
|
|
15883
15941
|
onResize: p.onResize,
|
|
15884
|
-
|
|
15942
|
+
onDblClick(originalEvent) {
|
|
15885
15943
|
var _a;
|
|
15886
|
-
(_a = p.
|
|
15944
|
+
(_a = p.onDblClick) === null || _a === void 0 ? void 0 : _a.call(p, {
|
|
15887
15945
|
column: p.data,
|
|
15888
15946
|
index: p.column.itemIndex,
|
|
15889
15947
|
originalEvent,
|
|
@@ -16011,12 +16069,12 @@ class RevogrHeaderComponent {
|
|
|
16011
16069
|
// render header columns
|
|
16012
16070
|
for (let rgCol of cols) {
|
|
16013
16071
|
const colData = this.colData[rgCol.itemIndex];
|
|
16014
|
-
cells.push(hAsync(HeaderRenderer, { range: range, column: rgCol, data: Object.assign(Object.assign({}, colData), { index: rgCol.itemIndex, providers: this.providers }), canFilter: !!this.columnFilter, canResize: this.canResize, active: this.resizeHandler, onResize: e => this.onResize(e, rgCol.itemIndex),
|
|
16072
|
+
cells.push(hAsync(HeaderRenderer, { range: range, column: rgCol, data: Object.assign(Object.assign({}, colData), { index: rgCol.itemIndex, providers: this.providers }), canFilter: !!this.columnFilter, canResize: this.canResize, active: this.resizeHandler, onResize: e => this.onResize(e, rgCol.itemIndex), onDblClick: e => this.headerdblClick.emit(e), onClick: e => this.initialHeaderClick.emit(e), additionalData: this.additionalData }));
|
|
16015
16073
|
visibleProps[colData === null || colData === void 0 ? void 0 : colData.prop] = rgCol.itemIndex;
|
|
16016
16074
|
}
|
|
16017
16075
|
return [
|
|
16018
|
-
hAsync("div", { key: '
|
|
16019
|
-
hAsync("div", { key: '
|
|
16076
|
+
hAsync("div", { key: 'fcfd687bcae987699e2c0c6dd2b403dc3bb36c3d', class: "group-rgRow" }, hAsync(ColumnGroupsRenderer, { key: 'e3dfe9c5cbdd3c3dbbcbd7301a1a8a97353abf4b', canResize: this.canResize, active: this.resizeHandler, visibleProps: visibleProps, providers: this.providers, groups: this.groups, dimensionCol: this.dimensionCol.state, depth: this.groupingDepth, onResize: (changedX, startIndex, endIndex) => this.onResizeGroup(changedX, startIndex, endIndex), additionalData: this.additionalData })),
|
|
16077
|
+
hAsync("div", { key: '6b373546cc50bd85c7458da556c987e1a556d81b', class: `${HEADER_ROW_CLASS} ${HEADER_ACTUAL_ROW_CLASS}` }, cells),
|
|
16020
16078
|
];
|
|
16021
16079
|
}
|
|
16022
16080
|
get providers() {
|