@revolist/revogrid 4.27.1 → 4.27.3
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 +141 -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 +140 -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 +141 -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 +141 -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 +205 -46
- package/hydrate/index.mjs +205 -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,27 @@ 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) &&
|
|
156
|
+
this.changes.showDefaultFilter !== false &&
|
|
157
|
+
this.changes.hideDefaultFilters !== true) {
|
|
158
|
+
const type = this.resolveDraftFilterType(this.changes.defaultFilterType);
|
|
159
|
+
if (type) {
|
|
160
|
+
this.draftFilter = {
|
|
161
|
+
id: ++this.filterId,
|
|
162
|
+
type,
|
|
163
|
+
value: '',
|
|
164
|
+
relation: 'and',
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
}
|
|
150
168
|
}
|
|
151
169
|
}
|
|
152
170
|
async getChanges() {
|
|
@@ -167,29 +185,42 @@ const FilterPanel = class {
|
|
|
167
185
|
const prop = (_a = this.changes) === null || _a === void 0 ? void 0 : _a.prop;
|
|
168
186
|
if (prop === undefined)
|
|
169
187
|
return '';
|
|
170
|
-
const propFilters = (_b = this.filterItems[prop]) !== null && _b !== void 0 ? _b : []
|
|
171
|
-
|
|
188
|
+
const propFilters = ((_b = this.filterItems[prop]) !== null && _b !== void 0 ? _b : []).map((filter, index) => ({
|
|
189
|
+
filter,
|
|
190
|
+
index,
|
|
191
|
+
isDraft: false,
|
|
192
|
+
}));
|
|
193
|
+
if (this.draftFilter) {
|
|
194
|
+
propFilters.push({
|
|
195
|
+
filter: this.draftFilter,
|
|
196
|
+
index: propFilters.length,
|
|
197
|
+
isDraft: true,
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
const visibleFilters = propFilters.filter(({ filter }) => !filter.hidden);
|
|
201
|
+
const visibleFilterCount = visibleFilters.length;
|
|
172
202
|
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) => {
|
|
203
|
+
return (h("div", { key: this.filterId }, h("ul", { class: "multi-filter-list-container" }, propFilters.map(({ filter, index, isDraft }) => {
|
|
204
|
+
var _a;
|
|
174
205
|
let andOrButton;
|
|
175
206
|
if (filter.hidden) {
|
|
176
207
|
return;
|
|
177
208
|
}
|
|
178
209
|
// hide toggle button if there is only one filter and the last one
|
|
179
|
-
if (
|
|
210
|
+
if (((_a = visibleFilters[visibleFilterCount - 1]) === null || _a === void 0 ? void 0 : _a.filter.id) !== filter.id) {
|
|
180
211
|
andOrButton = (h(AndOrButton, { text: filter.relation === 'and' ? capts.and : capts.or, onClick: () => this.toggleFilterAndOr(filter.id) }));
|
|
181
212
|
}
|
|
182
|
-
const extra = this.renderExtra(prop, index);
|
|
213
|
+
const extra = this.renderExtra(prop, index, isDraft);
|
|
183
214
|
const isDragging = this.draggedFilterId === filter.id;
|
|
184
215
|
const isDragOver = this.dragOverFilterId === filter.id && !isDragging;
|
|
185
|
-
const canReorder = visibleFilterCount > 1;
|
|
216
|
+
const canReorder = visibleFilterCount > 1 && !isDraft;
|
|
186
217
|
return (h("li", { key: filter.id, class: FILTER_LIST_CLASS, "aria-label": `${capts.filterCondition} ${index + 1}` }, h("div", { class: {
|
|
187
218
|
'multi-filter-list-row': true,
|
|
188
219
|
'filter-row-drop-active': this.draggedFilterId !== undefined && !isDragging,
|
|
189
220
|
'filter-row-dragging': isDragging,
|
|
190
221
|
'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
|
-
})),
|
|
222
|
+
} }, 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) })))));
|
|
223
|
+
})), visibleFilterCount ? h("div", { class: "add-filter-divider" }) : ''));
|
|
193
224
|
}
|
|
194
225
|
componentDidRender() {
|
|
195
226
|
this.syncDialog();
|
|
@@ -238,16 +269,24 @@ const FilterPanel = class {
|
|
|
238
269
|
el.style.left = `${left}px`;
|
|
239
270
|
el.style.top = `${top}px`;
|
|
240
271
|
}
|
|
241
|
-
onFilterTypeChange(e, prop, index) {
|
|
272
|
+
onFilterTypeChange(e, prop, index, isDraft = false) {
|
|
242
273
|
if (!(e.target instanceof HTMLSelectElement)) {
|
|
243
274
|
return;
|
|
244
275
|
}
|
|
245
|
-
|
|
276
|
+
const type = e.target.value;
|
|
277
|
+
const filter = isDraft
|
|
278
|
+
? this.promoteDraft(prop, type)
|
|
279
|
+
: this.filterItems[prop][index];
|
|
280
|
+
if (!filter) {
|
|
281
|
+
return;
|
|
282
|
+
}
|
|
283
|
+
filter.type = type;
|
|
284
|
+
this.hasChanges = true;
|
|
246
285
|
// this re-renders the input to know if we need extra input
|
|
247
286
|
this.filterId++;
|
|
248
287
|
// adding setTimeout will wait for the next tick DOM update then focus on input
|
|
249
288
|
setTimeout(() => {
|
|
250
|
-
const input = document.getElementById('filter-input-' +
|
|
289
|
+
const input = document.getElementById('filter-input-' + filter.id);
|
|
251
290
|
if (input instanceof HTMLInputElement) {
|
|
252
291
|
input.focus();
|
|
253
292
|
}
|
|
@@ -282,12 +321,20 @@ const FilterPanel = class {
|
|
|
282
321
|
return;
|
|
283
322
|
this.filterId++;
|
|
284
323
|
this.currentFilterId = this.filterId;
|
|
285
|
-
this.
|
|
286
|
-
id
|
|
287
|
-
type
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
324
|
+
if (this.draftFilter) {
|
|
325
|
+
this.draftFilter.id = this.currentFilterId;
|
|
326
|
+
this.draftFilter.type = this.currentFilterType;
|
|
327
|
+
this.promoteDraft(prop);
|
|
328
|
+
}
|
|
329
|
+
else {
|
|
330
|
+
this.filterItems[prop].push({
|
|
331
|
+
id: this.currentFilterId,
|
|
332
|
+
type: this.currentFilterType,
|
|
333
|
+
value: '',
|
|
334
|
+
relation: 'and',
|
|
335
|
+
});
|
|
336
|
+
this.hasChanges = true;
|
|
337
|
+
}
|
|
291
338
|
// adding setTimeout will wait for the next tick DOM update then focus on input
|
|
292
339
|
setTimeout(() => {
|
|
293
340
|
const input = document.getElementById('filter-input-' + this.currentFilterId);
|
|
@@ -296,7 +343,9 @@ const FilterPanel = class {
|
|
|
296
343
|
}, 0);
|
|
297
344
|
}
|
|
298
345
|
onSave() {
|
|
299
|
-
|
|
346
|
+
if (this.hasChanges) {
|
|
347
|
+
this.emitFilterChange();
|
|
348
|
+
}
|
|
300
349
|
}
|
|
301
350
|
onCancel() {
|
|
302
351
|
this.changes = undefined;
|
|
@@ -304,16 +353,25 @@ const FilterPanel = class {
|
|
|
304
353
|
onReset() {
|
|
305
354
|
var _a;
|
|
306
355
|
this.assertChanges();
|
|
307
|
-
this.
|
|
356
|
+
this.draftFilter = undefined;
|
|
357
|
+
const prop = (_a = this.changes) === null || _a === void 0 ? void 0 : _a.prop;
|
|
358
|
+
if (prop !== undefined) {
|
|
359
|
+
delete this.filterItems[prop];
|
|
360
|
+
}
|
|
361
|
+
this.resetChange.emit(prop);
|
|
308
362
|
// this updates the DOM which is used by getFilterItemsList() key
|
|
309
363
|
this.filterId++;
|
|
310
364
|
}
|
|
311
365
|
onRemoveFilter(id) {
|
|
312
|
-
var _a;
|
|
366
|
+
var _a, _b;
|
|
313
367
|
this.assertChanges();
|
|
314
368
|
// this is for reactivity issues for getFilterItemsList()
|
|
315
369
|
this.filterId++;
|
|
316
370
|
const prop = (_a = this.changes) === null || _a === void 0 ? void 0 : _a.prop;
|
|
371
|
+
if (((_b = this.draftFilter) === null || _b === void 0 ? void 0 : _b.id) === id) {
|
|
372
|
+
this.draftFilter = undefined;
|
|
373
|
+
return;
|
|
374
|
+
}
|
|
317
375
|
const items = this.filterItems[prop !== null && prop !== void 0 ? prop : ''];
|
|
318
376
|
if (!items)
|
|
319
377
|
return;
|
|
@@ -321,6 +379,7 @@ const FilterPanel = class {
|
|
|
321
379
|
if (index === -1)
|
|
322
380
|
return;
|
|
323
381
|
items.splice(index, 1);
|
|
382
|
+
this.hasChanges = true;
|
|
324
383
|
// let's remove the prop if no more filters so the filter icon will be removed
|
|
325
384
|
if (items.length === 0)
|
|
326
385
|
delete this.filterItems[prop !== null && prop !== void 0 ? prop : ''];
|
|
@@ -362,6 +421,7 @@ const FilterPanel = class {
|
|
|
362
421
|
if (!moveFilterItem(items, sourceId, targetId)) {
|
|
363
422
|
return;
|
|
364
423
|
}
|
|
424
|
+
this.hasChanges = true;
|
|
365
425
|
this.filterId++;
|
|
366
426
|
if (!this.disableDynamicFiltering) {
|
|
367
427
|
this.debouncedApplyFilter();
|
|
@@ -397,6 +457,7 @@ const FilterPanel = class {
|
|
|
397
457
|
if (!target || !moveFilterItem(items, sourceId, target.id)) {
|
|
398
458
|
return;
|
|
399
459
|
}
|
|
460
|
+
this.hasChanges = true;
|
|
400
461
|
this.filterId++;
|
|
401
462
|
if (!this.disableDynamicFiltering) {
|
|
402
463
|
this.debouncedApplyFilter();
|
|
@@ -415,6 +476,7 @@ const FilterPanel = class {
|
|
|
415
476
|
if (index === -1)
|
|
416
477
|
return;
|
|
417
478
|
items[index].relation = items[index].relation === 'and' ? 'or' : 'and';
|
|
479
|
+
this.hasChanges = true;
|
|
418
480
|
if (!this.disableDynamicFiltering) {
|
|
419
481
|
this.debouncedApplyFilter();
|
|
420
482
|
}
|
|
@@ -463,12 +525,22 @@ const FilterPanel = class {
|
|
|
463
525
|
}
|
|
464
526
|
return options;
|
|
465
527
|
}
|
|
466
|
-
renderExtra(prop, index) {
|
|
467
|
-
|
|
528
|
+
renderExtra(prop, index, isDraft = false) {
|
|
529
|
+
var _a, _b;
|
|
530
|
+
const currentFilter = isDraft
|
|
531
|
+
? this.draftFilter
|
|
532
|
+
: (_a = this.filterItems[prop]) === null || _a === void 0 ? void 0 : _a[index];
|
|
468
533
|
if (!currentFilter)
|
|
469
534
|
return '';
|
|
470
535
|
const applyFilter = (value) => {
|
|
471
|
-
|
|
536
|
+
currentFilter.value = value;
|
|
537
|
+
if (isDraft && !this.isMeaningfulDraftValue(value)) {
|
|
538
|
+
return;
|
|
539
|
+
}
|
|
540
|
+
if (isDraft && !this.promoteDraft(prop)) {
|
|
541
|
+
return;
|
|
542
|
+
}
|
|
543
|
+
this.hasChanges = true;
|
|
472
544
|
if (!this.disableDynamicFiltering) {
|
|
473
545
|
this.debouncedApplyFilter();
|
|
474
546
|
}
|
|
@@ -483,11 +555,11 @@ const FilterPanel = class {
|
|
|
483
555
|
}
|
|
484
556
|
};
|
|
485
557
|
const capts = Object.assign(Object.assign({}, this.filterCaptionsInternal), this.filterCaptions);
|
|
486
|
-
const extra = this.filterEntities[currentFilter
|
|
558
|
+
const extra = (_b = this.filterEntities[currentFilter.type]) === null || _b === void 0 ? void 0 : _b.extra;
|
|
487
559
|
if (typeof extra === 'function') {
|
|
488
560
|
return extra(h, {
|
|
489
|
-
value: currentFilter
|
|
490
|
-
filter: currentFilter
|
|
561
|
+
value: currentFilter.value,
|
|
562
|
+
filter: currentFilter,
|
|
491
563
|
prop,
|
|
492
564
|
index,
|
|
493
565
|
placeholder: capts.placeholder,
|
|
@@ -502,7 +574,7 @@ const FilterPanel = class {
|
|
|
502
574
|
if (extra !== 'input' && extra !== 'datepicker') {
|
|
503
575
|
return '';
|
|
504
576
|
}
|
|
505
|
-
return (h("input", { id: `filter-input-${currentFilter
|
|
577
|
+
return (h("input", { id: `filter-input-${currentFilter.id}`, placeholder: capts.placeholder, type: extra === 'datepicker' ? 'date' : 'text', value: currentFilter.value, onInput: (e) => {
|
|
506
578
|
if (e.target instanceof HTMLInputElement) {
|
|
507
579
|
applyFilter(e.target.value);
|
|
508
580
|
}
|
|
@@ -518,6 +590,42 @@ const FilterPanel = class {
|
|
|
518
590
|
e.stopPropagation();
|
|
519
591
|
} }));
|
|
520
592
|
}
|
|
593
|
+
resolveDraftFilterType(preferred) {
|
|
594
|
+
var _a, _b;
|
|
595
|
+
const available = Object.values((_b = (_a = this.changes) === null || _a === void 0 ? void 0 : _a.filterTypes) !== null && _b !== void 0 ? _b : {}).flat();
|
|
596
|
+
const type = preferred && available.includes(preferred)
|
|
597
|
+
? preferred
|
|
598
|
+
: available[0];
|
|
599
|
+
return type;
|
|
600
|
+
}
|
|
601
|
+
promoteDraft(prop, type) {
|
|
602
|
+
if (!this.draftFilter) {
|
|
603
|
+
return;
|
|
604
|
+
}
|
|
605
|
+
if (!this.filterItems[prop]) {
|
|
606
|
+
this.filterItems[prop] = [];
|
|
607
|
+
}
|
|
608
|
+
if (type) {
|
|
609
|
+
this.draftFilter.type = type;
|
|
610
|
+
}
|
|
611
|
+
const filter = this.draftFilter;
|
|
612
|
+
this.filterItems[prop].push(filter);
|
|
613
|
+
this.draftFilter = undefined;
|
|
614
|
+
this.hasChanges = true;
|
|
615
|
+
return filter;
|
|
616
|
+
}
|
|
617
|
+
isMeaningfulDraftValue(value) {
|
|
618
|
+
return value !== '' && value !== undefined && value !== null;
|
|
619
|
+
}
|
|
620
|
+
emitFilterChange() {
|
|
621
|
+
this.filterChange.emit(this.cloneFilterItems(this.filterItems));
|
|
622
|
+
}
|
|
623
|
+
cloneFilterItems(filterItems) {
|
|
624
|
+
return Object.fromEntries(Object.entries(filterItems).map(([prop, filters]) => [
|
|
625
|
+
prop,
|
|
626
|
+
filters.map(filter => (Object.assign({}, filter))),
|
|
627
|
+
]));
|
|
628
|
+
}
|
|
521
629
|
getAddFilterSelect() {
|
|
522
630
|
return this.element.querySelector(`#${FILTER_ID}`);
|
|
523
631
|
}
|
|
@@ -550,7 +658,7 @@ const FilterPanel = class {
|
|
|
550
658
|
top: `${(_d = (_c = this.changes) === null || _c === void 0 ? void 0 : _c.y) !== null && _d !== void 0 ? _d : 0}px`,
|
|
551
659
|
};
|
|
552
660
|
const capts = Object.assign(Object.assign({}, this.filterCaptionsInternal), this.filterCaptions);
|
|
553
|
-
return (h(Host, { key: '
|
|
661
|
+
return (h(Host, { key: 'f7ec3ca1855a9391b4f270ad7056f9c7a4a0204e' }, h("dialog", { key: 'a5c46aa4822934e7a6eb455fd686513b9101afb4', class: "filter-panel-dialog", style: style, ref: el => (this.dialog = el), onCancel: e => {
|
|
554
662
|
e.preventDefault();
|
|
555
663
|
this.onCancel();
|
|
556
664
|
} }, this.changes && [
|
|
@@ -559,7 +667,7 @@ const FilterPanel = class {
|
|
|
559
667
|
((_g = this.changes) === null || _g === void 0 ? void 0 : _g.hideDefaultFilters) !== true && [
|
|
560
668
|
h("label", { key: "filter-title" }, capts.title),
|
|
561
669
|
h("div", { key: "filter-holder", class: "filter-holder" }, this.getFilterItemsList()),
|
|
562
|
-
h("div", { key: "add-filter", class: "add-filter" }, h("select", { key: '
|
|
670
|
+
h("div", { key: "add-filter", class: "add-filter" }, h("select", { key: '3912f4bd9b1e66fda46e9b6d7c002d29da726345', id: FILTER_ID, class: "select-css", onChange: e => this.onAddNewFilter(e) }, this.renderSelectOptions(this.currentFilterType))),
|
|
563
671
|
],
|
|
564
672
|
h("slot", { key: "default-slot" }),
|
|
565
673
|
((_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
|
/**
|