@revolist/revogrid 4.27.0 → 4.27.2
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/{cell-renderer-C7rdgaov.js → cell-renderer-BDIx0xys.js} +1 -1
- package/dist/cjs/{column.service-Bbml5C2j.js → column.service-D-ENzqyb.js} +2 -0
- package/dist/cjs/{filter.button-F2Bw3UAd.js → filter.button-C6ixuMmr.js} +3 -2
- package/dist/cjs/{header-cell-renderer-BljFI6wj.js → header-cell-renderer-B5Y4fdZC.js} +1 -1
- package/dist/cjs/index.cjs.js +7 -5
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/revo-grid.cjs.entry.js +63 -43
- package/dist/cjs/revo-grid.cjs.js +1 -1
- package/dist/cjs/revogr-attribution_7.cjs.entry.js +1 -1
- package/dist/cjs/revogr-data_4.cjs.entry.js +12 -11
- package/dist/cjs/revogr-filter-panel.cjs.entry.js +139 -33
- package/dist/cjs/{row-resize.plugin-BRQy_qNn.js → row-resize.plugin-C4YOF1lN.js} +353 -185
- package/dist/collection/components/header/header-renderer.js +7 -6
- package/dist/collection/components/header/revogr-header-style.css +8 -3
- package/dist/collection/components/revoGrid/revo-grid-style.css +12 -2
- package/dist/collection/components/revoGrid/revo-grid.js +37 -21
- package/dist/collection/plugins/filter/filter.button.js +3 -2
- package/dist/collection/plugins/filter/filter.indexed.js +5 -0
- package/dist/collection/plugins/filter/filter.panel.js +138 -31
- package/dist/collection/plugins/filter/filter.plugin.js +48 -5
- package/dist/collection/plugins/filter/filter.style.css +25 -3
- package/dist/collection/plugins/groupingRow/grouping.const.js +1 -0
- package/dist/collection/plugins/groupingRow/grouping.row.plugin.js +84 -54
- package/dist/collection/plugins/groupingRow/grouping.sorting.service.js +58 -0
- package/dist/collection/plugins/groupingRow/grouping.trimmed.service.js +5 -3
- package/dist/collection/plugins/row-resize/row-resize.plugin.js +144 -113
- package/dist/collection/plugins/sorting/sorting.plugin.js +16 -13
- package/dist/collection/plugins/wcag/index.js +5 -4
- package/dist/collection/services/dimension.provider.js +17 -1
- package/dist/esm/{cell-renderer-BFpmdV8H.js → cell-renderer-D9ze8OJw.js} +1 -1
- package/dist/esm/{column.service-CM-wgGs8.js → column.service-pu_fdQ0S.js} +2 -1
- package/dist/esm/{filter.button-DMhpuAiw.js → filter.button-CEPUxLUo.js} +3 -2
- package/dist/{revo-grid/header-cell-renderer-Bqh1PrgH.js → esm/header-cell-renderer-YCiVIQ2E.js} +1 -1
- package/dist/esm/index.js +6 -6
- package/dist/esm/loader.js +1 -1
- package/dist/esm/revo-grid.entry.js +63 -43
- package/dist/esm/revo-grid.js +1 -1
- package/dist/esm/revogr-attribution_7.entry.js +1 -1
- package/dist/esm/revogr-data_4.entry.js +12 -11
- package/dist/esm/revogr-filter-panel.entry.js +139 -33
- package/dist/esm/{row-resize.plugin-BRiaHlHA.js → row-resize.plugin-Beu0pMds.js} +354 -187
- package/dist/revo-grid/{cell-renderer-BFpmdV8H.js → cell-renderer-D9ze8OJw.js} +1 -1
- package/dist/revo-grid/{column.service-CM-wgGs8.js → column.service-pu_fdQ0S.js} +2 -1
- package/dist/revo-grid/{filter.button-DMhpuAiw.js → filter.button-CEPUxLUo.js} +3 -2
- package/dist/{esm/header-cell-renderer-Bqh1PrgH.js → revo-grid/header-cell-renderer-YCiVIQ2E.js} +1 -1
- package/dist/revo-grid/index.esm.js +6 -6
- package/dist/revo-grid/revo-grid.entry.js +63 -43
- package/dist/revo-grid/revo-grid.esm.js +1 -1
- package/dist/revo-grid/revogr-attribution_7.entry.js +1 -1
- package/dist/revo-grid/revogr-data_4.entry.js +12 -11
- package/dist/revo-grid/revogr-filter-panel.entry.js +139 -33
- package/dist/revo-grid/{row-resize.plugin-BRiaHlHA.js → row-resize.plugin-Beu0pMds.js} +354 -187
- package/dist/types/components/revoGrid/revo-grid.d.ts +2 -0
- package/dist/types/plugins/filter/filter.indexed.d.ts +2 -0
- package/dist/types/plugins/filter/filter.panel.d.ts +9 -2
- package/dist/types/plugins/filter/filter.plugin.d.ts +8 -1
- package/dist/types/plugins/filter/filter.types.d.ts +8 -0
- package/dist/types/plugins/groupingRow/grouping.const.d.ts +1 -0
- package/dist/types/plugins/groupingRow/grouping.row.plugin.d.ts +5 -7
- package/dist/types/plugins/groupingRow/grouping.sorting.service.d.ts +7 -0
- package/dist/types/plugins/groupingRow/grouping.trimmed.service.d.ts +9 -0
- package/dist/types/plugins/row-resize/row-resize.plugin.d.ts +14 -12
- package/dist/types/plugins/sorting/sorting.plugin.d.ts +5 -0
- package/dist/types/services/dimension.provider.d.ts +7 -1
- package/dist/types/types/interfaces.d.ts +13 -1
- package/hydrate/index.js +561 -264
- package/hydrate/index.mjs +561 -264
- package/package.json +1 -1
- package/standalone/column.service.js +1 -1
- package/standalone/filter.button.js +1 -1
- package/standalone/index.js +1 -1
- package/standalone/revo-grid.js +1 -1
- package/standalone/revogr-data2.js +1 -1
- package/standalone/revogr-filter-panel.js +1 -1
- package/standalone/revogr-header2.js +1 -1
- package/standalone/revogr-overlay-selection2.js +1 -1
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { r as registerInstance, a as createEvent, h, d as Host, g as getElement } from './index-CtimkLsB.js';
|
|
5
5
|
import { d as debounce } from './debounce-PCRWZliA.js';
|
|
6
|
-
import { e as AndOrButton, f as ReorderButton, d as TrashButton, i as isFilterBtn } from './filter.button-
|
|
6
|
+
import { e as AndOrButton, f as ReorderButton, d as TrashButton, i as isFilterBtn } from './filter.button-CEPUxLUo.js';
|
|
7
7
|
|
|
8
8
|
(function closest() {
|
|
9
9
|
if (!Element.prototype.matches) {
|
|
@@ -66,7 +66,7 @@ function moveFilterItem(items, sourceId, targetId) {
|
|
|
66
66
|
return true;
|
|
67
67
|
}
|
|
68
68
|
|
|
69
|
-
const filterStyleCss = () => `.revo-button{position:relative;overflow:hidden;color:var(--rg-theme-button-text);background-color:var(--rg-theme-button-bg);height:32px;line-height:32px;padding:0 15px;outline:0;border:0;border-radius:7px;box-sizing:border-box;cursor:pointer}.revo-button.green{background-color:var(--rg-theme-button-success-bg)}.revo-button.red{background-color:var(--rg-theme-button-danger-bg)}.revo-button:disabled,.revo-button[disabled]{cursor:not-allowed !important;filter:opacity(0.35) !important}.revo-button.outline{border:1px solid var(--rg-theme-button-outline-border);line-height:30px;background:none;color:var(--rg-theme-button-outline-text);box-shadow:none}revogr-filter-panel{display:block}revogr-filter-panel .filter-panel-dialog{position:fixed;top:0;left:0;z-index:100;max-height:calc(100vh - 16px);overflow:auto;opacity:1;transform:none;color:var(--rg-theme-filter-panel-text);background-color:var(--rg-theme-filter-panel-bg);border:1px solid var(--rg-theme-filter-panel-border);transform-origin:62px 0px;box-shadow:0 5px 18px -2px var(--rg-theme-filter-panel-shadow);box-sizing:border-box;padding:10px;border-radius:8px;margin:0;min-width:220px;text-align:left;animation:revogr-filter-panel-open 140ms cubic-bezier(0.2, 0, 0, 1)}revogr-filter-panel .filter-panel-dialog .filter-holder>div{display:flex;flex-direction:column}revogr-filter-panel .filter-panel-dialog label{font-size:13px;display:block;padding:8px 0}revogr-filter-panel .filter-panel-dialog select{width:100%}revogr-filter-panel .filter-panel-dialog input[type=text]{border:0;min-height:34px;margin:5px 0;color:var(--rg-theme-filter-panel-text);background:var(--rg-theme-filter-panel-input-bg);border-radius:5px;padding:0 10px;box-sizing:border-box;width:100%}revogr-filter-panel .filter-panel-dialog .filter-actions{position:sticky;right:0;bottom:-10px;left:0;z-index:1;text-align:right;margin:10px -10px -10px;padding:0 5px 10px 10px;background:var(--rg-theme-filter-panel-bg);border-top:1px solid var(--rg-theme-filter-panel-divider)}revogr-filter-panel .filter-panel-dialog .filter-actions button{margin-top:10px;margin-right:5px}@keyframes revogr-filter-panel-open{from{opacity:0;transform:translateY(-4px) scale(0.98)}to{opacity:1;transform:none}}@media (prefers-reduced-motion: reduce){revogr-filter-panel .filter-panel-dialog{animation:none}}.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{
|
|
69
|
+
const filterStyleCss = () => `.revo-button{position:relative;overflow:hidden;color:var(--rg-theme-button-text);background-color:var(--rg-theme-button-bg);height:32px;line-height:32px;padding:0 15px;outline:0;border:0;border-radius:7px;box-sizing:border-box;cursor:pointer}.revo-button.green{background-color:var(--rg-theme-button-success-bg)}.revo-button.red{background-color:var(--rg-theme-button-danger-bg)}.revo-button:disabled,.revo-button[disabled]{cursor:not-allowed !important;filter:opacity(0.35) !important}.revo-button.outline{border:1px solid var(--rg-theme-button-outline-border);line-height:30px;background:none;color:var(--rg-theme-button-outline-text);box-shadow:none}revogr-filter-panel{display:block}revogr-filter-panel .filter-panel-dialog{position:fixed;top:0;left:0;z-index:100;max-height:calc(100vh - 16px);overflow:auto;opacity:1;transform:none;color:var(--rg-theme-filter-panel-text);background-color:var(--rg-theme-filter-panel-bg);border:1px solid var(--rg-theme-filter-panel-border);transform-origin:62px 0px;box-shadow:0 5px 18px -2px var(--rg-theme-filter-panel-shadow);box-sizing:border-box;padding:10px;border-radius:8px;margin:0;min-width:220px;text-align:left;animation:revogr-filter-panel-open 140ms cubic-bezier(0.2, 0, 0, 1)}revogr-filter-panel .filter-panel-dialog .filter-holder>div{display:flex;flex-direction:column}revogr-filter-panel .filter-panel-dialog label{font-size:13px;display:block;padding:8px 0}revogr-filter-panel .filter-panel-dialog select{width:100%}revogr-filter-panel .filter-panel-dialog input[type=text]{border:0;min-height:34px;margin:5px 0;color:var(--rg-theme-filter-panel-text);background:var(--rg-theme-filter-panel-input-bg);border-radius:5px;padding:0 10px;box-sizing:border-box;width:100%}revogr-filter-panel .filter-panel-dialog .filter-actions{position:sticky;right:0;bottom:-10px;left:0;z-index:1;text-align:right;margin:10px -10px -10px;padding:0 5px 10px 10px;background:var(--rg-theme-filter-panel-bg);border-top:1px solid var(--rg-theme-filter-panel-divider)}revogr-filter-panel .filter-panel-dialog .filter-actions button{margin-top:10px;margin-right:5px}@keyframes revogr-filter-panel-open{from{opacity:0;transform:translateY(-4px) scale(0.98)}to{opacity:1;transform:none}}@media (prefers-reduced-motion: reduce){revogr-filter-panel .filter-panel-dialog{animation:none}}.rgHeaderCell:hover .rv-filter{transition:opacity 267ms cubic-bezier(0.4, 0, 0.2, 1) 0ms, width 267ms cubic-bezier(0.4, 0, 0.2, 1) 0ms, transform 178ms cubic-bezier(0.4, 0, 0.2, 1) 0ms}.rgHeaderCell:hover:has(.rv-filter) .header-content,.rgHeaderCell:focus-within:has(.rv-filter) .header-content,.rgHeaderCell:has(.rv-filter.active) .header-content{margin-right:24px}.rgHeaderCell:hover:has(.rv-filter):has(.desc) .header-content,.rgHeaderCell:hover:has(.rv-filter):has(.asc) .header-content,.rgHeaderCell:focus-within:has(.rv-filter):has(.desc) .header-content,.rgHeaderCell:focus-within:has(.rv-filter):has(.asc) .header-content,.rgHeaderCell:has(.rv-filter.active):has(.desc) .header-content,.rgHeaderCell:has(.rv-filter.active):has(.asc) .header-content{margin-right:8px;padding-right:24px}.rgHeaderCell:hover .rv-filter,.rgHeaderCell:focus-within .rv-filter,.rgHeaderCell .rv-filter.active{opacity:1;width:24px}@media (hover: none), (pointer: coarse){.rgHeaderCell:has(.rv-filter) .header-content{margin-right:24px}.rgHeaderCell:has(.rv-filter):has(.desc) .header-content,.rgHeaderCell:has(.rv-filter):has(.asc) .header-content{margin-right:8px;padding-right:24px}.rgHeaderCell .rv-filter{opacity:1;width:24px}}.rgHeaderCell .rv-filter{height:24px;width:0;background:none;border:0;opacity:0;visibility:visible;cursor:pointer;border-radius:4px;position:relative;z-index:1;padding:0}.rgHeaderCell .rv-filter.active{color:var(--rg-theme-filter-panel-icon-active)}.rgHeaderCell .rv-filter .filter-img{color:var(--rg-theme-filter-panel-icon);width:11px}.select-css{display:block;font-family:sans-serif;line-height:1.3;padding:0.6em 1.4em 0.5em 0.8em;width:100%;max-width:100%;box-sizing:border-box;margin:0;color:var(--rg-theme-filter-panel-text);border:1px solid var(--rg-theme-filter-panel-select-border);box-shadow:transparent;border-radius:0.5em;appearance:none;background-color:var(--rg-theme-filter-panel-input-bg);background-image:var(--revo-grid-filter-panel-select-arrow, 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"));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{}.select-css:hover{border-color:var(--rg-theme-filter-panel-select-border)}.select-css{}.select-css:focus{border-color:var(--rg-theme-filter-panel-select-border-hover);box-shadow:var(--rg-theme-filter-panel-focus-ring);outline:none}.select-css{}.select-css option{font-weight:normal}.select-css{}.select-css:disabled,.select-css[aria-disabled=true]{color:var(--rg-theme-filter-panel-muted-text);background-image:var(--revo-grid-filter-panel-select-arrow-disabled, 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"))}.select-css:disabled:hover,.select-css[aria-disabled=true]{border-color:var(--rg-theme-filter-panel-select-border)}.multi-filter-list{margin-top:5px;margin-bottom:5px}.multi-filter-list div{white-space:nowrap}.multi-filter-list .multi-filter-list-row{display:flex;align-items:center;gap:6px;position:relative}.multi-filter-list .multi-filter-list-row.filter-row-dragging{opacity:0.65}.multi-filter-list .multi-filter-list-row.filter-row-drag-over::before{content:"";position:absolute;top:-4px;right:0;left:0;z-index:2;height:2px;background:var(--rg-theme-filter-panel-reorder-accent);border-radius:999px;box-shadow:0 0 0 2px var(--rg-theme-filter-panel-bg)}.multi-filter-list .multi-filter-list-row.filter-row-drop-active .filter-row-drop-target{pointer-events:auto}.multi-filter-list .filter-row-drop-target{position:absolute;inset:0;z-index:1;padding:0;pointer-events:none;background:transparent;border:0}.multi-filter-list .multi-filter-list-action{display:flex;align-self:stretch;flex:0 0 auto;justify-content:flex-end;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;padding:0;border:0;background:transparent;color:inherit;cursor:pointer;width:22px;height:100%;font-size:16px}.multi-filter-list .trash-button .trash-img{width:1em}.multi-filter-list .reorder-button{border:0;background:transparent;color:var(--rg-theme-filter-panel-reorder-color);cursor:grab;font-family:monospace;font-size:12px;letter-spacing:0;line-height:1;padding:6px 2px;transform:scaleX(0.8);width:16px}.multi-filter-list .reorder-button.filter-row-drag-over{color:var(--rg-theme-filter-panel-reorder-accent)}.multi-filter-list .reorder-button:active{cursor:grabbing}.multi-filter-list-container{padding:0;margin:0;list-style:none}.add-filter-divider{display:block;margin:0 -10px 10px -10px;border-bottom:1px solid var(--rg-theme-filter-panel-divider);height:10px}.select-input{display:flex;align-items:center;flex:1 1 auto;gap:6px;min-width:0}.select-input .select-filter,.select-input .filter-extra{flex:1 1 0;min-width:0}.select-input .select-filter{width:auto}.select-input .filter-extra{display:flex}.select-input .filter-extra>*{width:100%}.select-input input[type=text],.select-input input[type=date]{margin:0}`;
|
|
70
70
|
|
|
71
71
|
const defaultType = 'none';
|
|
72
72
|
const FILTER_LIST_CLASS = 'multi-filter-list';
|
|
@@ -78,6 +78,7 @@ const FilterPanel = class {
|
|
|
78
78
|
registerInstance(this, hostRef);
|
|
79
79
|
this.filterChange = createEvent(this, "filterChange", 7);
|
|
80
80
|
this.resetChange = createEvent(this, "resetChange", 7);
|
|
81
|
+
this.hasChanges = false;
|
|
81
82
|
this.filterCaptionsInternal = {
|
|
82
83
|
title: 'Filter by',
|
|
83
84
|
ok: 'Close',
|
|
@@ -113,7 +114,7 @@ const FilterPanel = class {
|
|
|
113
114
|
*/
|
|
114
115
|
this.allowDuplicateOperators = true;
|
|
115
116
|
this.debouncedApplyFilter = debounce(() => {
|
|
116
|
-
this.
|
|
117
|
+
this.emitFilterChange();
|
|
117
118
|
}, 400);
|
|
118
119
|
}
|
|
119
120
|
onMouseDown(e) {
|
|
@@ -143,10 +144,25 @@ const FilterPanel = class {
|
|
|
143
144
|
}
|
|
144
145
|
}
|
|
145
146
|
async show(newEntity) {
|
|
147
|
+
this.hasChanges = false;
|
|
146
148
|
this.changes = newEntity;
|
|
147
|
-
this.filterItems = (newEntity === null || newEntity === void 0 ? void 0 : newEntity.filterItems) || {};
|
|
149
|
+
this.filterItems = this.cloneFilterItems((newEntity === null || newEntity === void 0 ? void 0 : newEntity.filterItems) || {});
|
|
150
|
+
this.draftFilter = undefined;
|
|
148
151
|
if (this.changes) {
|
|
149
152
|
this.changes.type = this.changes.type || defaultType;
|
|
153
|
+
const prop = this.changes.prop;
|
|
154
|
+
const propFilters = prop === undefined ? undefined : this.filterItems[prop];
|
|
155
|
+
if (!(propFilters === null || propFilters === void 0 ? void 0 : propFilters.length) && this.changes.showDefaultFilter !== false) {
|
|
156
|
+
const type = this.resolveDraftFilterType(this.changes.defaultFilterType);
|
|
157
|
+
if (type) {
|
|
158
|
+
this.draftFilter = {
|
|
159
|
+
id: ++this.filterId,
|
|
160
|
+
type,
|
|
161
|
+
value: '',
|
|
162
|
+
relation: 'and',
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
}
|
|
150
166
|
}
|
|
151
167
|
}
|
|
152
168
|
async getChanges() {
|
|
@@ -167,29 +183,42 @@ const FilterPanel = class {
|
|
|
167
183
|
const prop = (_a = this.changes) === null || _a === void 0 ? void 0 : _a.prop;
|
|
168
184
|
if (prop === undefined)
|
|
169
185
|
return '';
|
|
170
|
-
const propFilters = (_b = this.filterItems[prop]) !== null && _b !== void 0 ? _b : []
|
|
171
|
-
|
|
186
|
+
const propFilters = ((_b = this.filterItems[prop]) !== null && _b !== void 0 ? _b : []).map((filter, index) => ({
|
|
187
|
+
filter,
|
|
188
|
+
index,
|
|
189
|
+
isDraft: false,
|
|
190
|
+
}));
|
|
191
|
+
if (this.draftFilter) {
|
|
192
|
+
propFilters.push({
|
|
193
|
+
filter: this.draftFilter,
|
|
194
|
+
index: propFilters.length,
|
|
195
|
+
isDraft: true,
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
const visibleFilters = propFilters.filter(({ filter }) => !filter.hidden);
|
|
199
|
+
const visibleFilterCount = visibleFilters.length;
|
|
172
200
|
const capts = Object.assign(Object.assign({}, this.filterCaptionsInternal), this.filterCaptions);
|
|
173
|
-
return (h("div", { key: this.filterId }, h("ul", { class: "multi-filter-list-container" }, propFilters.map((filter, index) => {
|
|
201
|
+
return (h("div", { key: this.filterId }, h("ul", { class: "multi-filter-list-container" }, propFilters.map(({ filter, index, isDraft }) => {
|
|
202
|
+
var _a;
|
|
174
203
|
let andOrButton;
|
|
175
204
|
if (filter.hidden) {
|
|
176
205
|
return;
|
|
177
206
|
}
|
|
178
207
|
// hide toggle button if there is only one filter and the last one
|
|
179
|
-
if (
|
|
208
|
+
if (((_a = visibleFilters[visibleFilterCount - 1]) === null || _a === void 0 ? void 0 : _a.filter.id) !== filter.id) {
|
|
180
209
|
andOrButton = (h(AndOrButton, { text: filter.relation === 'and' ? capts.and : capts.or, onClick: () => this.toggleFilterAndOr(filter.id) }));
|
|
181
210
|
}
|
|
182
|
-
const extra = this.renderExtra(prop, index);
|
|
211
|
+
const extra = this.renderExtra(prop, index, isDraft);
|
|
183
212
|
const isDragging = this.draggedFilterId === filter.id;
|
|
184
213
|
const isDragOver = this.dragOverFilterId === filter.id && !isDragging;
|
|
185
|
-
const canReorder = visibleFilterCount > 1;
|
|
214
|
+
const canReorder = visibleFilterCount > 1 && !isDraft;
|
|
186
215
|
return (h("li", { key: filter.id, class: FILTER_LIST_CLASS, "aria-label": `${capts.filterCondition} ${index + 1}` }, h("div", { class: {
|
|
187
216
|
'multi-filter-list-row': true,
|
|
188
217
|
'filter-row-drop-active': this.draggedFilterId !== undefined && !isDragging,
|
|
189
218
|
'filter-row-dragging': isDragging,
|
|
190
219
|
'filter-row-drag-over': isDragOver,
|
|
191
|
-
} }, canReorder ? (h("button", { type: "button", class: "filter-row-drop-target", tabIndex: -1, "aria-label": `${capts.filterCondition} ${index + 1}`, onDragOver: e => this.onFilterDragOver(e, filter.id), onDragLeave: () => this.onFilterDragLeave(filter.id), onDrop: e => this.onFilterDrop(e, prop, filter.id) })) : '', canReorder ? (h(ReorderButton, { ariaLabel: capts.reorderFilter, dragging: isDragging, dragOver: isDragOver, onDragStart: e => this.onFilterDragStart(e, filter.id), onDragEnd: () => this.onFilterDragEnd(), onKeyDown: e => this.onFilterReorderKeyDown(e, prop, filter.id) })) : '', h("div", { class: { 'select-input': true } }, h("select", { class: "select-css select-filter", onChange: e => this.onFilterTypeChange(e, prop, index) }, this.renderSelectOptions(
|
|
192
|
-
})),
|
|
220
|
+
} }, canReorder ? (h("button", { type: "button", class: "filter-row-drop-target", tabIndex: -1, "aria-label": `${capts.filterCondition} ${index + 1}`, onDragOver: e => this.onFilterDragOver(e, filter.id), onDragLeave: () => this.onFilterDragLeave(filter.id), onDrop: e => this.onFilterDrop(e, prop, filter.id) })) : '', canReorder ? (h(ReorderButton, { ariaLabel: capts.reorderFilter, dragging: isDragging, dragOver: isDragOver, onDragStart: e => this.onFilterDragStart(e, filter.id), onDragEnd: () => this.onFilterDragEnd(), onKeyDown: e => this.onFilterReorderKeyDown(e, prop, filter.id) })) : '', h("div", { class: { 'select-input': true } }, h("select", { class: "select-css select-filter", onChange: e => this.onFilterTypeChange(e, prop, index, isDraft) }, this.renderSelectOptions(filter.type, true)), extra ? h("div", { class: "filter-extra" }, extra) : ''), h("div", { class: FILTER_LIST_CLASS_ACTION }, andOrButton, h(TrashButton, { ariaLabel: capts.removeFilter, onClick: () => this.onRemoveFilter(filter.id) })))));
|
|
221
|
+
})), visibleFilterCount ? h("div", { class: "add-filter-divider" }) : ''));
|
|
193
222
|
}
|
|
194
223
|
componentDidRender() {
|
|
195
224
|
this.syncDialog();
|
|
@@ -238,16 +267,24 @@ const FilterPanel = class {
|
|
|
238
267
|
el.style.left = `${left}px`;
|
|
239
268
|
el.style.top = `${top}px`;
|
|
240
269
|
}
|
|
241
|
-
onFilterTypeChange(e, prop, index) {
|
|
270
|
+
onFilterTypeChange(e, prop, index, isDraft = false) {
|
|
242
271
|
if (!(e.target instanceof HTMLSelectElement)) {
|
|
243
272
|
return;
|
|
244
273
|
}
|
|
245
|
-
|
|
274
|
+
const type = e.target.value;
|
|
275
|
+
const filter = isDraft
|
|
276
|
+
? this.promoteDraft(prop, type)
|
|
277
|
+
: this.filterItems[prop][index];
|
|
278
|
+
if (!filter) {
|
|
279
|
+
return;
|
|
280
|
+
}
|
|
281
|
+
filter.type = type;
|
|
282
|
+
this.hasChanges = true;
|
|
246
283
|
// this re-renders the input to know if we need extra input
|
|
247
284
|
this.filterId++;
|
|
248
285
|
// adding setTimeout will wait for the next tick DOM update then focus on input
|
|
249
286
|
setTimeout(() => {
|
|
250
|
-
const input = document.getElementById('filter-input-' +
|
|
287
|
+
const input = document.getElementById('filter-input-' + filter.id);
|
|
251
288
|
if (input instanceof HTMLInputElement) {
|
|
252
289
|
input.focus();
|
|
253
290
|
}
|
|
@@ -282,12 +319,20 @@ const FilterPanel = class {
|
|
|
282
319
|
return;
|
|
283
320
|
this.filterId++;
|
|
284
321
|
this.currentFilterId = this.filterId;
|
|
285
|
-
this.
|
|
286
|
-
id
|
|
287
|
-
type
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
322
|
+
if (this.draftFilter) {
|
|
323
|
+
this.draftFilter.id = this.currentFilterId;
|
|
324
|
+
this.draftFilter.type = this.currentFilterType;
|
|
325
|
+
this.promoteDraft(prop);
|
|
326
|
+
}
|
|
327
|
+
else {
|
|
328
|
+
this.filterItems[prop].push({
|
|
329
|
+
id: this.currentFilterId,
|
|
330
|
+
type: this.currentFilterType,
|
|
331
|
+
value: '',
|
|
332
|
+
relation: 'and',
|
|
333
|
+
});
|
|
334
|
+
this.hasChanges = true;
|
|
335
|
+
}
|
|
291
336
|
// adding setTimeout will wait for the next tick DOM update then focus on input
|
|
292
337
|
setTimeout(() => {
|
|
293
338
|
const input = document.getElementById('filter-input-' + this.currentFilterId);
|
|
@@ -296,7 +341,9 @@ const FilterPanel = class {
|
|
|
296
341
|
}, 0);
|
|
297
342
|
}
|
|
298
343
|
onSave() {
|
|
299
|
-
|
|
344
|
+
if (this.hasChanges) {
|
|
345
|
+
this.emitFilterChange();
|
|
346
|
+
}
|
|
300
347
|
}
|
|
301
348
|
onCancel() {
|
|
302
349
|
this.changes = undefined;
|
|
@@ -304,16 +351,25 @@ const FilterPanel = class {
|
|
|
304
351
|
onReset() {
|
|
305
352
|
var _a;
|
|
306
353
|
this.assertChanges();
|
|
307
|
-
this.
|
|
354
|
+
this.draftFilter = undefined;
|
|
355
|
+
const prop = (_a = this.changes) === null || _a === void 0 ? void 0 : _a.prop;
|
|
356
|
+
if (prop !== undefined) {
|
|
357
|
+
delete this.filterItems[prop];
|
|
358
|
+
}
|
|
359
|
+
this.resetChange.emit(prop);
|
|
308
360
|
// this updates the DOM which is used by getFilterItemsList() key
|
|
309
361
|
this.filterId++;
|
|
310
362
|
}
|
|
311
363
|
onRemoveFilter(id) {
|
|
312
|
-
var _a;
|
|
364
|
+
var _a, _b;
|
|
313
365
|
this.assertChanges();
|
|
314
366
|
// this is for reactivity issues for getFilterItemsList()
|
|
315
367
|
this.filterId++;
|
|
316
368
|
const prop = (_a = this.changes) === null || _a === void 0 ? void 0 : _a.prop;
|
|
369
|
+
if (((_b = this.draftFilter) === null || _b === void 0 ? void 0 : _b.id) === id) {
|
|
370
|
+
this.draftFilter = undefined;
|
|
371
|
+
return;
|
|
372
|
+
}
|
|
317
373
|
const items = this.filterItems[prop !== null && prop !== void 0 ? prop : ''];
|
|
318
374
|
if (!items)
|
|
319
375
|
return;
|
|
@@ -321,6 +377,7 @@ const FilterPanel = class {
|
|
|
321
377
|
if (index === -1)
|
|
322
378
|
return;
|
|
323
379
|
items.splice(index, 1);
|
|
380
|
+
this.hasChanges = true;
|
|
324
381
|
// let's remove the prop if no more filters so the filter icon will be removed
|
|
325
382
|
if (items.length === 0)
|
|
326
383
|
delete this.filterItems[prop !== null && prop !== void 0 ? prop : ''];
|
|
@@ -362,6 +419,7 @@ const FilterPanel = class {
|
|
|
362
419
|
if (!moveFilterItem(items, sourceId, targetId)) {
|
|
363
420
|
return;
|
|
364
421
|
}
|
|
422
|
+
this.hasChanges = true;
|
|
365
423
|
this.filterId++;
|
|
366
424
|
if (!this.disableDynamicFiltering) {
|
|
367
425
|
this.debouncedApplyFilter();
|
|
@@ -397,6 +455,7 @@ const FilterPanel = class {
|
|
|
397
455
|
if (!target || !moveFilterItem(items, sourceId, target.id)) {
|
|
398
456
|
return;
|
|
399
457
|
}
|
|
458
|
+
this.hasChanges = true;
|
|
400
459
|
this.filterId++;
|
|
401
460
|
if (!this.disableDynamicFiltering) {
|
|
402
461
|
this.debouncedApplyFilter();
|
|
@@ -415,6 +474,7 @@ const FilterPanel = class {
|
|
|
415
474
|
if (index === -1)
|
|
416
475
|
return;
|
|
417
476
|
items[index].relation = items[index].relation === 'and' ? 'or' : 'and';
|
|
477
|
+
this.hasChanges = true;
|
|
418
478
|
if (!this.disableDynamicFiltering) {
|
|
419
479
|
this.debouncedApplyFilter();
|
|
420
480
|
}
|
|
@@ -463,12 +523,22 @@ const FilterPanel = class {
|
|
|
463
523
|
}
|
|
464
524
|
return options;
|
|
465
525
|
}
|
|
466
|
-
renderExtra(prop, index) {
|
|
467
|
-
|
|
526
|
+
renderExtra(prop, index, isDraft = false) {
|
|
527
|
+
var _a, _b;
|
|
528
|
+
const currentFilter = isDraft
|
|
529
|
+
? this.draftFilter
|
|
530
|
+
: (_a = this.filterItems[prop]) === null || _a === void 0 ? void 0 : _a[index];
|
|
468
531
|
if (!currentFilter)
|
|
469
532
|
return '';
|
|
470
533
|
const applyFilter = (value) => {
|
|
471
|
-
|
|
534
|
+
currentFilter.value = value;
|
|
535
|
+
if (isDraft && !this.isMeaningfulDraftValue(value)) {
|
|
536
|
+
return;
|
|
537
|
+
}
|
|
538
|
+
if (isDraft && !this.promoteDraft(prop)) {
|
|
539
|
+
return;
|
|
540
|
+
}
|
|
541
|
+
this.hasChanges = true;
|
|
472
542
|
if (!this.disableDynamicFiltering) {
|
|
473
543
|
this.debouncedApplyFilter();
|
|
474
544
|
}
|
|
@@ -483,11 +553,11 @@ const FilterPanel = class {
|
|
|
483
553
|
}
|
|
484
554
|
};
|
|
485
555
|
const capts = Object.assign(Object.assign({}, this.filterCaptionsInternal), this.filterCaptions);
|
|
486
|
-
const extra = this.filterEntities[currentFilter
|
|
556
|
+
const extra = (_b = this.filterEntities[currentFilter.type]) === null || _b === void 0 ? void 0 : _b.extra;
|
|
487
557
|
if (typeof extra === 'function') {
|
|
488
558
|
return extra(h, {
|
|
489
|
-
value: currentFilter
|
|
490
|
-
filter: currentFilter
|
|
559
|
+
value: currentFilter.value,
|
|
560
|
+
filter: currentFilter,
|
|
491
561
|
prop,
|
|
492
562
|
index,
|
|
493
563
|
placeholder: capts.placeholder,
|
|
@@ -502,7 +572,7 @@ const FilterPanel = class {
|
|
|
502
572
|
if (extra !== 'input' && extra !== 'datepicker') {
|
|
503
573
|
return '';
|
|
504
574
|
}
|
|
505
|
-
return (h("input", { id: `filter-input-${currentFilter
|
|
575
|
+
return (h("input", { id: `filter-input-${currentFilter.id}`, placeholder: capts.placeholder, type: extra === 'datepicker' ? 'date' : 'text', value: currentFilter.value, onInput: (e) => {
|
|
506
576
|
if (e.target instanceof HTMLInputElement) {
|
|
507
577
|
applyFilter(e.target.value);
|
|
508
578
|
}
|
|
@@ -518,6 +588,42 @@ const FilterPanel = class {
|
|
|
518
588
|
e.stopPropagation();
|
|
519
589
|
} }));
|
|
520
590
|
}
|
|
591
|
+
resolveDraftFilterType(preferred) {
|
|
592
|
+
var _a, _b;
|
|
593
|
+
const available = Object.values((_b = (_a = this.changes) === null || _a === void 0 ? void 0 : _a.filterTypes) !== null && _b !== void 0 ? _b : {}).flat();
|
|
594
|
+
const type = preferred && available.includes(preferred)
|
|
595
|
+
? preferred
|
|
596
|
+
: available[0];
|
|
597
|
+
return type;
|
|
598
|
+
}
|
|
599
|
+
promoteDraft(prop, type) {
|
|
600
|
+
if (!this.draftFilter) {
|
|
601
|
+
return;
|
|
602
|
+
}
|
|
603
|
+
if (!this.filterItems[prop]) {
|
|
604
|
+
this.filterItems[prop] = [];
|
|
605
|
+
}
|
|
606
|
+
if (type) {
|
|
607
|
+
this.draftFilter.type = type;
|
|
608
|
+
}
|
|
609
|
+
const filter = this.draftFilter;
|
|
610
|
+
this.filterItems[prop].push(filter);
|
|
611
|
+
this.draftFilter = undefined;
|
|
612
|
+
this.hasChanges = true;
|
|
613
|
+
return filter;
|
|
614
|
+
}
|
|
615
|
+
isMeaningfulDraftValue(value) {
|
|
616
|
+
return value !== '' && value !== undefined && value !== null;
|
|
617
|
+
}
|
|
618
|
+
emitFilterChange() {
|
|
619
|
+
this.filterChange.emit(this.cloneFilterItems(this.filterItems));
|
|
620
|
+
}
|
|
621
|
+
cloneFilterItems(filterItems) {
|
|
622
|
+
return Object.fromEntries(Object.entries(filterItems).map(([prop, filters]) => [
|
|
623
|
+
prop,
|
|
624
|
+
filters.map(filter => (Object.assign({}, filter))),
|
|
625
|
+
]));
|
|
626
|
+
}
|
|
521
627
|
getAddFilterSelect() {
|
|
522
628
|
return this.element.querySelector(`#${FILTER_ID}`);
|
|
523
629
|
}
|
|
@@ -550,7 +656,7 @@ const FilterPanel = class {
|
|
|
550
656
|
top: `${(_d = (_c = this.changes) === null || _c === void 0 ? void 0 : _c.y) !== null && _d !== void 0 ? _d : 0}px`,
|
|
551
657
|
};
|
|
552
658
|
const capts = Object.assign(Object.assign({}, this.filterCaptionsInternal), this.filterCaptions);
|
|
553
|
-
return (h(Host, { key: '
|
|
659
|
+
return (h(Host, { key: '0bb6ac39407141e989b6a2f54063ee5ed789e40e' }, h("dialog", { key: '28a919ca4184018e8f00bbd31d373e153306d163', class: "filter-panel-dialog", style: style, ref: el => (this.dialog = el), onCancel: e => {
|
|
554
660
|
e.preventDefault();
|
|
555
661
|
this.onCancel();
|
|
556
662
|
} }, this.changes && [
|
|
@@ -559,7 +665,7 @@ const FilterPanel = class {
|
|
|
559
665
|
((_g = this.changes) === null || _g === void 0 ? void 0 : _g.hideDefaultFilters) !== true && [
|
|
560
666
|
h("label", { key: "filter-title" }, capts.title),
|
|
561
667
|
h("div", { key: "filter-holder", class: "filter-holder" }, this.getFilterItemsList()),
|
|
562
|
-
h("div", { key: "add-filter", class: "add-filter" }, h("select", { key: '
|
|
668
|
+
h("div", { key: "add-filter", class: "add-filter" }, h("select", { key: 'c5816b6699d8608bd8ec2621bbbd4c70daf52a1e', id: FILTER_ID, class: "select-css", onChange: e => this.onAddNewFilter(e) }, this.renderSelectOptions(this.currentFilterType))),
|
|
563
669
|
],
|
|
564
670
|
h("slot", { key: "default-slot" }),
|
|
565
671
|
((_j = (_h = this.changes).extraBottomContent) === null || _j === void 0 ? void 0 : _j.call(_h, this.changes)) || '',
|