@revolist/revogrid 4.27.1 → 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/{filter.button-F2Bw3UAd.js → filter.button-C6ixuMmr.js} +3 -2
- package/dist/cjs/index.cjs.js +3 -2
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/revo-grid.cjs.entry.js +3 -3
- package/dist/cjs/revo-grid.cjs.js +1 -1
- package/dist/cjs/revogr-data_4.cjs.entry.js +9 -8
- package/dist/cjs/revogr-filter-panel.cjs.entry.js +139 -33
- package/dist/cjs/{row-resize.plugin-sK9_rcUN.js → row-resize.plugin-C4YOF1lN.js} +54 -5
- 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/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/{revo-grid/filter.button-DMhpuAiw.js → esm/filter.button-CEPUxLUo.js} +3 -2
- package/dist/esm/index.js +3 -3
- package/dist/esm/loader.js +1 -1
- package/dist/esm/revo-grid.entry.js +3 -3
- package/dist/esm/revo-grid.js +1 -1
- package/dist/esm/revogr-data_4.entry.js +9 -8
- package/dist/esm/revogr-filter-panel.entry.js +139 -33
- package/dist/{revo-grid/row-resize.plugin-DBOgjLdE.js → esm/row-resize.plugin-Beu0pMds.js} +54 -6
- package/dist/{esm/filter.button-DMhpuAiw.js → revo-grid/filter.button-CEPUxLUo.js} +3 -2
- package/dist/revo-grid/index.esm.js +3 -3
- package/dist/revo-grid/revo-grid.entry.js +3 -3
- package/dist/revo-grid/revo-grid.esm.js +1 -1
- package/dist/revo-grid/revogr-data_4.entry.js +9 -8
- package/dist/revo-grid/revogr-filter-panel.entry.js +139 -33
- package/dist/{esm/row-resize.plugin-DBOgjLdE.js → revo-grid/row-resize.plugin-Beu0pMds.js} +54 -6
- 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/types/interfaces.d.ts +13 -1
- package/hydrate/index.js +203 -46
- package/hydrate/index.mjs +203 -46
- package/package.json +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-filter-panel.js +1 -1
- package/standalone/revogr-header2.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)) || '',
|
|
@@ -6,7 +6,7 @@ import { L as createStore, m as setStore, j as calculateDimensionData, N as iden
|
|
|
6
6
|
import { j as calculateRowHeaderSize, g as getViewportMaxCoordinate } from './viewport.store-DWMKRDSH.js';
|
|
7
7
|
import { g as getScrollbarSize, t as timeout } from './index-BvMNbQyq.js';
|
|
8
8
|
import { h } from './index-CtimkLsB.js';
|
|
9
|
-
import { b as FILTER_PROP, i as isFilterBtn } from './filter.button-
|
|
9
|
+
import { b as FILTER_PROP, i as isFilterBtn } from './filter.button-CEPUxLUo.js';
|
|
10
10
|
import { d as debounce } from './debounce-PCRWZliA.js';
|
|
11
11
|
import { O as ON_COLUMN_CLICK, d as dispatch } from './header-cell-renderer-YCiVIQ2E.js';
|
|
12
12
|
|
|
@@ -1361,6 +1361,11 @@ const filterTypes = {
|
|
|
1361
1361
|
boolean: ['notEmpty', 'empty'],
|
|
1362
1362
|
array: ['notEmpty', 'empty'],
|
|
1363
1363
|
};
|
|
1364
|
+
/** Preferred initial operator for built-in filter families. */
|
|
1365
|
+
const filterTypeDefaults = {
|
|
1366
|
+
string: 'contains',
|
|
1367
|
+
number: 'eqN',
|
|
1368
|
+
};
|
|
1364
1369
|
const filterNames = {
|
|
1365
1370
|
none: 'None',
|
|
1366
1371
|
empty: 'Is blank',
|
|
@@ -1403,6 +1408,8 @@ const FILTE_PANEL = 'revogr-filter-panel';
|
|
|
1403
1408
|
*
|
|
1404
1409
|
* @property {FilterLocalization|undefined} localization - translation for filter popup captions.
|
|
1405
1410
|
*
|
|
1411
|
+
* @property {boolean|undefined} defaultFilter - creates a draft condition when an empty filter panel opens. Defaults to true.
|
|
1412
|
+
*
|
|
1406
1413
|
* @property {boolean|undefined} disableDynamicFiltering - disables dynamic filtering. A way to apply filters on Save only.
|
|
1407
1414
|
*/
|
|
1408
1415
|
/**
|
|
@@ -1424,7 +1431,7 @@ class FilterPlugin extends BasePlugin {
|
|
|
1424
1431
|
* number: ['eqN', 'neqN', 'gt']
|
|
1425
1432
|
* }
|
|
1426
1433
|
*/
|
|
1427
|
-
this.filterByType = Object.
|
|
1434
|
+
this.filterByType = Object.fromEntries(Object.entries(filterTypes).map(([type, filters]) => [type, [...filters]]));
|
|
1428
1435
|
this.filterNameIndexByType = Object.assign({}, filterNames);
|
|
1429
1436
|
this.filterFunctionsIndexedByType = Object.assign({}, filterCoreFunctionsIndexedByType);
|
|
1430
1437
|
this.filterProp = FILTER_PROP;
|
|
@@ -1508,11 +1515,16 @@ class FilterPlugin extends BasePlugin {
|
|
|
1508
1515
|
return null;
|
|
1509
1516
|
}
|
|
1510
1517
|
initConfig(config) {
|
|
1511
|
-
var _a;
|
|
1518
|
+
var _a, _b, _c, _d;
|
|
1512
1519
|
this.config = config;
|
|
1513
1520
|
this.allowDuplicateOperators = (_a = config.allowDuplicateOperators) !== null && _a !== void 0 ? _a : true;
|
|
1514
1521
|
if (this.pop) {
|
|
1515
1522
|
this.pop.allowDuplicateOperators = this.allowDuplicateOperators;
|
|
1523
|
+
this.pop.disableDynamicFiltering =
|
|
1524
|
+
(_b = config.disableDynamicFiltering) !== null && _b !== void 0 ? _b : false;
|
|
1525
|
+
this.pop.closeOnOutsideClick =
|
|
1526
|
+
(_c = config.closeFilterPanelOnOutsideClick) !== null && _c !== void 0 ? _c : true;
|
|
1527
|
+
this.pop.filterCaptions = (_d = config.localization) === null || _d === void 0 ? void 0 : _d.captions;
|
|
1516
1528
|
}
|
|
1517
1529
|
if (config.multiFilterItems) {
|
|
1518
1530
|
this.multiFilterItems = Object.assign({}, config.multiFilterItems);
|
|
@@ -1601,11 +1613,12 @@ class FilterPlugin extends BasePlugin {
|
|
|
1601
1613
|
}
|
|
1602
1614
|
// filter button clicked, open filter dialog
|
|
1603
1615
|
const buttonPos = (filterButton instanceof HTMLElement ? filterButton : el).getBoundingClientRect();
|
|
1604
|
-
const data = Object.assign(Object.assign(Object.assign({}, e.detail), this.filterCollection[prop]), { x: buttonPos.x, y: buttonPos.y + buttonPos.height, anchorY: buttonPos.y, autoCorrect: true, filterTypes: this.getColumnFilter(e.detail.filter), filterItems: this.multiFilterItems, extraContent: this.extraHyperContent, extraBottomContent: this.extraBottomHyperContent });
|
|
1616
|
+
const data = Object.assign(Object.assign(Object.assign({}, e.detail), this.filterCollection[prop]), { x: buttonPos.x, y: buttonPos.y + buttonPos.height, anchorY: buttonPos.y, autoCorrect: true, filterTypes: this.getColumnFilter(e.detail.filter), defaultFilterType: this.getDefaultFilter(e.detail.filter), showDefaultFilter: this.shouldShowDefaultFilter(e.detail.filter), filterItems: this.multiFilterItems, extraContent: this.extraHyperContent, extraBottomContent: this.extraBottomHyperContent });
|
|
1605
1617
|
(_b = this.beforeshow) === null || _b === void 0 ? void 0 : _b.call(this, data);
|
|
1606
1618
|
this.pop.show(data);
|
|
1607
1619
|
}
|
|
1608
|
-
getColumnFilter(
|
|
1620
|
+
getColumnFilter(config) {
|
|
1621
|
+
const type = this.isColumnFilterOption(config) ? config.type : config;
|
|
1609
1622
|
let filterType = 'string';
|
|
1610
1623
|
if (!type) {
|
|
1611
1624
|
return { [filterType]: this.filterByType[filterType] };
|
|
@@ -1625,6 +1638,41 @@ class FilterPlugin extends BasePlugin {
|
|
|
1625
1638
|
}
|
|
1626
1639
|
return { [filterType]: this.filterByType[filterType] };
|
|
1627
1640
|
}
|
|
1641
|
+
/** Resolve the preferred operator against the column's available filters. */
|
|
1642
|
+
getDefaultFilter(config) {
|
|
1643
|
+
var _a;
|
|
1644
|
+
const filters = this.getColumnFilter(config);
|
|
1645
|
+
const availableFilters = Object.values(filters).flat();
|
|
1646
|
+
const columnDefault = this.isColumnFilterOption(config)
|
|
1647
|
+
? config.default
|
|
1648
|
+
: undefined;
|
|
1649
|
+
if (typeof columnDefault === 'string' &&
|
|
1650
|
+
availableFilters.includes(columnDefault)) {
|
|
1651
|
+
return columnDefault;
|
|
1652
|
+
}
|
|
1653
|
+
const firstFamily = Object.keys(filters)[0];
|
|
1654
|
+
const familyDefault = filterTypeDefaults[firstFamily];
|
|
1655
|
+
if (familyDefault && ((_a = filters[firstFamily]) === null || _a === void 0 ? void 0 : _a.includes(familyDefault))) {
|
|
1656
|
+
return familyDefault;
|
|
1657
|
+
}
|
|
1658
|
+
return availableFilters[0];
|
|
1659
|
+
}
|
|
1660
|
+
/** Resolve grid and column-level draft opt-outs. */
|
|
1661
|
+
shouldShowDefaultFilter(config) {
|
|
1662
|
+
var _a;
|
|
1663
|
+
if (this.isColumnFilterOption(config)) {
|
|
1664
|
+
if (config.default === false) {
|
|
1665
|
+
return false;
|
|
1666
|
+
}
|
|
1667
|
+
if (typeof config.default === 'string') {
|
|
1668
|
+
return true;
|
|
1669
|
+
}
|
|
1670
|
+
}
|
|
1671
|
+
return ((_a = this.config) === null || _a === void 0 ? void 0 : _a.defaultFilter) !== false;
|
|
1672
|
+
}
|
|
1673
|
+
isColumnFilterOption(value) {
|
|
1674
|
+
return !!value && typeof value === 'object' && !Array.isArray(value);
|
|
1675
|
+
}
|
|
1628
1676
|
isValidType(type) {
|
|
1629
1677
|
return !!(typeof type === 'string' && this.filterByType[type]);
|
|
1630
1678
|
}
|
|
@@ -3709,4 +3757,4 @@ class RowResizePlugin extends BasePlugin {
|
|
|
3709
3757
|
}
|
|
3710
3758
|
}
|
|
3711
3759
|
|
|
3712
|
-
export { AutoSizeColumnPlugin as A, BasePlugin as B, ColumnAutoSizeMode as C, DimensionStore as D, ExportFilePlugin as E, FILTER_TRIMMED_TYPE as F, GroupingRowPlugin as G,
|
|
3760
|
+
export { AutoSizeColumnPlugin as A, BasePlugin as B, ColumnAutoSizeMode as C, DimensionStore as D, ExportFilePlugin as E, FILTER_TRIMMED_TYPE as F, GroupingRowPlugin as G, AFTER_ROW_RESIZE_EVENT as H, ROW_RESIZE_CANCEL_EVENT as I, RowResizePlugin as J, DEFAULT_MIN_ROW_HEIGHT as K, resolveRowResizeConfig as L, clampRowResizeHeight as M, getRowResizeIndexes as N, createRowResizePatch as O, mergeRowResizeDefinitions as P, SortingPlugin as Q, ROW_RESIZE_HANDLE_CLASS as R, SelectionStore as S, hasActiveSorting as T, getSortingIndex as U, sortIndexByItems as V, defaultCellCompare as W, descCellCompare as X, getNextOrder as Y, getComparer as Z, StretchColumn as a, ExportCsv as b, FILTER_CONFIG_CHANGED_EVENT as c, defineTheme as d, FILTE_PANEL as e, FilterPlugin as f, filterCoreFunctionsIndexedByType as g, filterTypes as h, isStretchPlugin as i, filterTypeDefaults as j, filterNames as k, DEFAULT_BLANK_SEMANTICS as l, isBlankValue as m, doCollapse as n, doExpand as o, COLUMN_DRAG_MOVE_EVENT as p, COLUMN_DRAG_END_EVENT as q, resolveBlankSemantics as r, BEFORE_COLUMN_DRAG_END_EVENT as s, themeTokenCssVariables as t, COLUMN_DRAG_START_EVENT as u, ColumnMovePlugin as v, getLeftRelative as w, getColumnDragPosition as x, BEFORE_ROW_RESIZE_EVENT as y, ROW_RESIZE_EVENT as z };
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { LogicFunction } from './filter.types';
|
|
2
2
|
export declare const filterCoreFunctionsIndexedByType: Record<FilterType, LogicFunction>;
|
|
3
3
|
export declare const filterTypes: Record<string, FilterType[]>;
|
|
4
|
+
/** Preferred initial operator for built-in filter families. */
|
|
5
|
+
export declare const filterTypeDefaults: Partial<Record<string, FilterType>>;
|
|
4
6
|
export declare const filterNames: {
|
|
5
7
|
none: string;
|
|
6
8
|
empty: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { EventEmitter, type VNode } from '../../stencil-public-runtime';
|
|
2
2
|
import '../../utils/closest.polifill';
|
|
3
|
-
import { FilterCaptions, LogicFunction, MultiFilterItem, ShowData } from './filter.types';
|
|
3
|
+
import { FilterCaptions, FilterData, LogicFunction, MultiFilterItem, ShowData } from './filter.types';
|
|
4
4
|
import type { ColumnProp } from "../../types/index";
|
|
5
5
|
import { FilterType } from './filter.indexed';
|
|
6
6
|
/**
|
|
@@ -11,6 +11,7 @@ import { FilterType } from './filter.indexed';
|
|
|
11
11
|
*/
|
|
12
12
|
export declare class FilterPanel {
|
|
13
13
|
private dialog?;
|
|
14
|
+
private hasChanges;
|
|
14
15
|
private filterCaptionsInternal;
|
|
15
16
|
element: HTMLElement;
|
|
16
17
|
isFilterIdSet: boolean;
|
|
@@ -19,6 +20,7 @@ export declare class FilterPanel {
|
|
|
19
20
|
currentFilterType: FilterType;
|
|
20
21
|
changes: ShowData | undefined;
|
|
21
22
|
filterItems: MultiFilterItem;
|
|
23
|
+
draftFilter: FilterData | undefined;
|
|
22
24
|
draggedFilterId: number | undefined;
|
|
23
25
|
dragOverFilterId: number | undefined;
|
|
24
26
|
filterNames: Record<string, string>;
|
|
@@ -63,7 +65,12 @@ export declare class FilterPanel {
|
|
|
63
65
|
private toggleFilterAndOr;
|
|
64
66
|
private assertChanges;
|
|
65
67
|
renderSelectOptions(type: FilterType, isDefaultTypeRemoved?: boolean): VNode[] | undefined;
|
|
66
|
-
renderExtra(prop: ColumnProp, index: number): any;
|
|
68
|
+
renderExtra(prop: ColumnProp, index: number, isDraft?: boolean): any;
|
|
69
|
+
private resolveDraftFilterType;
|
|
70
|
+
private promoteDraft;
|
|
71
|
+
private isMeaningfulDraftValue;
|
|
72
|
+
private emitFilterChange;
|
|
73
|
+
private cloneFilterItems;
|
|
67
74
|
private getAddFilterSelect;
|
|
68
75
|
private isOwnFilterButton;
|
|
69
76
|
private getOwningGrid;
|
|
@@ -24,6 +24,8 @@ export declare const FILTE_PANEL = "revogr-filter-panel";
|
|
|
24
24
|
*
|
|
25
25
|
* @property {FilterLocalization|undefined} localization - translation for filter popup captions.
|
|
26
26
|
*
|
|
27
|
+
* @property {boolean|undefined} defaultFilter - creates a draft condition when an empty filter panel opens. Defaults to true.
|
|
28
|
+
*
|
|
27
29
|
* @property {boolean|undefined} disableDynamicFiltering - disables dynamic filtering. A way to apply filters on Save only.
|
|
28
30
|
*/
|
|
29
31
|
/**
|
|
@@ -56,7 +58,12 @@ export declare class FilterPlugin extends BasePlugin {
|
|
|
56
58
|
extraContent(): any;
|
|
57
59
|
initConfig(config: ColumnFilterConfig): void;
|
|
58
60
|
headerclick(e: CustomEvent<ColumnRegular>): Promise<void>;
|
|
59
|
-
getColumnFilter(
|
|
61
|
+
getColumnFilter(config?: ColumnRegular['filter']): Record<string, string[]>;
|
|
62
|
+
/** Resolve the preferred operator against the column's available filters. */
|
|
63
|
+
getDefaultFilter(config?: ColumnRegular['filter']): string | undefined;
|
|
64
|
+
/** Resolve grid and column-level draft opt-outs. */
|
|
65
|
+
shouldShowDefaultFilter(config?: ColumnRegular['filter']): boolean;
|
|
66
|
+
private isColumnFilterOption;
|
|
60
67
|
isValidType(type: any): type is string;
|
|
61
68
|
/**
|
|
62
69
|
* Called on internal component change
|
|
@@ -83,6 +83,10 @@ export interface FilterLocalization {
|
|
|
83
83
|
export interface ColumnFilterConfig {
|
|
84
84
|
/** Grid-level blank policy. Individual columns can override fields. */
|
|
85
85
|
blankSemantics?: BlankSemantics;
|
|
86
|
+
/**
|
|
87
|
+
* Whether empty filter panels start with a draft condition. Defaults to true.
|
|
88
|
+
*/
|
|
89
|
+
defaultFilter?: boolean;
|
|
86
90
|
/**
|
|
87
91
|
* The collection of filters to be applied to the column.
|
|
88
92
|
*/
|
|
@@ -165,6 +169,10 @@ export interface ShowData extends FilterItem, Omit<ColumnRegular, 'filter'> {
|
|
|
165
169
|
*/
|
|
166
170
|
autoCorrect?: boolean;
|
|
167
171
|
filterTypes?: Record<string, string[]>;
|
|
172
|
+
/** Preferred operator for an empty panel. */
|
|
173
|
+
defaultFilterType?: string;
|
|
174
|
+
/** Whether an empty panel should create a draft condition. */
|
|
175
|
+
showDefaultFilter?: boolean;
|
|
168
176
|
filterItems?: MultiFilterItem;
|
|
169
177
|
hideDefaultFilters?: boolean;
|
|
170
178
|
extraContent?: (data: ShowData) => any;
|
|
@@ -165,6 +165,18 @@ export interface ColumnType<TModel extends DataType = DataType> extends ColumnPr
|
|
|
165
165
|
cellParser?: (model: TModel, column: ColumnRegular<ColumnProp, TModel>) => any;
|
|
166
166
|
}
|
|
167
167
|
export type Order = 'asc' | 'desc' | undefined;
|
|
168
|
+
/**
|
|
169
|
+
* Structured filter configuration for an individual column.
|
|
170
|
+
*/
|
|
171
|
+
export interface ColumnFilterOption {
|
|
172
|
+
/** Filter family, or ordered filter families, available to the column. */
|
|
173
|
+
type: string | string[];
|
|
174
|
+
/**
|
|
175
|
+
* Preferred operator shown when the column has no filter conditions, or false
|
|
176
|
+
* to disable the draft.
|
|
177
|
+
*/
|
|
178
|
+
default?: string | false;
|
|
179
|
+
}
|
|
168
180
|
/**
|
|
169
181
|
* Interface for regular column definition.
|
|
170
182
|
* Regular column can be any column that is not a grouping column.
|
|
@@ -194,7 +206,7 @@ export interface ColumnRegular<P extends ColumnProp = ColumnProp, TModel extends
|
|
|
194
206
|
/**
|
|
195
207
|
* Filter. Require filter plugin to be installed and activated through grid config filter.
|
|
196
208
|
*/
|
|
197
|
-
filter?: boolean | string | string[];
|
|
209
|
+
filter?: boolean | string | string[] | ColumnFilterOption;
|
|
198
210
|
/** Partial column override for the grid-level blank filtering policy. */
|
|
199
211
|
blankSemantics?: BlankSemantics;
|
|
200
212
|
/**
|