@revolist/revogrid 4.27.3 → 4.27.5
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/index.cjs.js +1 -2
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/revo-grid.cjs.entry.js +1 -1
- package/dist/cjs/revo-grid.cjs.js +1 -1
- package/dist/cjs/revogr-filter-panel.cjs.entry.js +31 -139
- package/dist/cjs/{row-resize.plugin-C4YOF1lN.js → row-resize.plugin-jaZje3kL.js} +4 -53
- package/dist/collection/plugins/filter/filter.indexed.js +0 -5
- package/dist/collection/plugins/filter/filter.panel.js +31 -140
- package/dist/collection/plugins/filter/filter.plugin.js +5 -48
- package/dist/esm/index.js +2 -2
- package/dist/esm/loader.js +1 -1
- package/dist/esm/revo-grid.entry.js +1 -1
- package/dist/esm/revo-grid.js +1 -1
- package/dist/esm/revogr-filter-panel.entry.js +31 -139
- package/dist/esm/{row-resize.plugin-Beu0pMds.js → row-resize.plugin-Dzn9bTOr.js} +5 -53
- package/dist/revo-grid/index.esm.js +2 -2
- package/dist/revo-grid/revo-grid.entry.js +1 -1
- package/dist/revo-grid/revo-grid.esm.js +1 -1
- package/dist/revo-grid/revogr-filter-panel.entry.js +31 -139
- package/dist/revo-grid/{row-resize.plugin-Beu0pMds.js → row-resize.plugin-Dzn9bTOr.js} +5 -53
- package/dist/types/plugins/filter/filter.indexed.d.ts +0 -2
- package/dist/types/plugins/filter/filter.panel.d.ts +2 -9
- package/dist/types/plugins/filter/filter.plugin.d.ts +1 -8
- package/dist/types/plugins/filter/filter.types.d.ts +0 -8
- package/dist/types/types/interfaces.d.ts +1 -13
- package/hydrate/index.js +35 -192
- package/hydrate/index.mjs +35 -192
- package/package.json +1 -1
- package/standalone/index.js +1 -1
- package/standalone/revo-grid.js +1 -1
- package/standalone/revogr-filter-panel.js +1 -1
package/hydrate/index.js
CHANGED
|
@@ -7627,7 +7627,6 @@ class FilterPanel {
|
|
|
7627
7627
|
registerInstance(this, hostRef);
|
|
7628
7628
|
this.filterChange = createEvent(this, "filterChange", 7);
|
|
7629
7629
|
this.resetChange = createEvent(this, "resetChange", 7);
|
|
7630
|
-
this.hasChanges = false;
|
|
7631
7630
|
this.filterCaptionsInternal = {
|
|
7632
7631
|
title: 'Filter by',
|
|
7633
7632
|
ok: 'Close',
|
|
@@ -7663,7 +7662,7 @@ class FilterPanel {
|
|
|
7663
7662
|
*/
|
|
7664
7663
|
this.allowDuplicateOperators = true;
|
|
7665
7664
|
this.debouncedApplyFilter = debounce$1(() => {
|
|
7666
|
-
this.
|
|
7665
|
+
this.filterChange.emit(this.filterItems);
|
|
7667
7666
|
}, 400);
|
|
7668
7667
|
}
|
|
7669
7668
|
onMouseDown(e) {
|
|
@@ -7693,27 +7692,10 @@ class FilterPanel {
|
|
|
7693
7692
|
}
|
|
7694
7693
|
}
|
|
7695
7694
|
async show(newEntity) {
|
|
7696
|
-
this.hasChanges = false;
|
|
7697
7695
|
this.changes = newEntity;
|
|
7698
|
-
this.filterItems =
|
|
7699
|
-
this.draftFilter = undefined;
|
|
7696
|
+
this.filterItems = (newEntity === null || newEntity === void 0 ? void 0 : newEntity.filterItems) || {};
|
|
7700
7697
|
if (this.changes) {
|
|
7701
7698
|
this.changes.type = this.changes.type || defaultType;
|
|
7702
|
-
const prop = this.changes.prop;
|
|
7703
|
-
const propFilters = prop === undefined ? undefined : this.filterItems[prop];
|
|
7704
|
-
if (!(propFilters === null || propFilters === void 0 ? void 0 : propFilters.length) &&
|
|
7705
|
-
this.changes.showDefaultFilter !== false &&
|
|
7706
|
-
this.changes.hideDefaultFilters !== true) {
|
|
7707
|
-
const type = this.resolveDraftFilterType(this.changes.defaultFilterType);
|
|
7708
|
-
if (type) {
|
|
7709
|
-
this.draftFilter = {
|
|
7710
|
-
id: ++this.filterId,
|
|
7711
|
-
type,
|
|
7712
|
-
value: '',
|
|
7713
|
-
relation: 'and',
|
|
7714
|
-
};
|
|
7715
|
-
}
|
|
7716
|
-
}
|
|
7717
7699
|
}
|
|
7718
7700
|
}
|
|
7719
7701
|
async getChanges() {
|
|
@@ -7734,42 +7716,29 @@ class FilterPanel {
|
|
|
7734
7716
|
const prop = (_a = this.changes) === null || _a === void 0 ? void 0 : _a.prop;
|
|
7735
7717
|
if (prop === undefined)
|
|
7736
7718
|
return '';
|
|
7737
|
-
const propFilters = (
|
|
7738
|
-
|
|
7739
|
-
index,
|
|
7740
|
-
isDraft: false,
|
|
7741
|
-
}));
|
|
7742
|
-
if (this.draftFilter) {
|
|
7743
|
-
propFilters.push({
|
|
7744
|
-
filter: this.draftFilter,
|
|
7745
|
-
index: propFilters.length,
|
|
7746
|
-
isDraft: true,
|
|
7747
|
-
});
|
|
7748
|
-
}
|
|
7749
|
-
const visibleFilters = propFilters.filter(({ filter }) => !filter.hidden);
|
|
7750
|
-
const visibleFilterCount = visibleFilters.length;
|
|
7719
|
+
const propFilters = (_b = this.filterItems[prop]) !== null && _b !== void 0 ? _b : [];
|
|
7720
|
+
const visibleFilterCount = propFilters.filter(filter => !filter.hidden).length;
|
|
7751
7721
|
const capts = Object.assign(Object.assign({}, this.filterCaptionsInternal), this.filterCaptions);
|
|
7752
|
-
return (hAsync("div", { key: this.filterId }, hAsync("ul", { class: "multi-filter-list-container" }, propFilters.map((
|
|
7753
|
-
var _a;
|
|
7722
|
+
return (hAsync("div", { key: this.filterId }, hAsync("ul", { class: "multi-filter-list-container" }, propFilters.map((filter, index) => {
|
|
7754
7723
|
let andOrButton;
|
|
7755
7724
|
if (filter.hidden) {
|
|
7756
7725
|
return;
|
|
7757
7726
|
}
|
|
7758
7727
|
// hide toggle button if there is only one filter and the last one
|
|
7759
|
-
if (
|
|
7728
|
+
if (index !== this.filterItems[prop].length - 1) {
|
|
7760
7729
|
andOrButton = (hAsync(AndOrButton, { text: filter.relation === 'and' ? capts.and : capts.or, onClick: () => this.toggleFilterAndOr(filter.id) }));
|
|
7761
7730
|
}
|
|
7762
|
-
const extra = this.renderExtra(prop, index
|
|
7731
|
+
const extra = this.renderExtra(prop, index);
|
|
7763
7732
|
const isDragging = this.draggedFilterId === filter.id;
|
|
7764
7733
|
const isDragOver = this.dragOverFilterId === filter.id && !isDragging;
|
|
7765
|
-
const canReorder = visibleFilterCount > 1
|
|
7734
|
+
const canReorder = visibleFilterCount > 1;
|
|
7766
7735
|
return (hAsync("li", { key: filter.id, class: FILTER_LIST_CLASS, "aria-label": `${capts.filterCondition} ${index + 1}` }, hAsync("div", { class: {
|
|
7767
7736
|
'multi-filter-list-row': true,
|
|
7768
7737
|
'filter-row-drop-active': this.draggedFilterId !== undefined && !isDragging,
|
|
7769
7738
|
'filter-row-dragging': isDragging,
|
|
7770
7739
|
'filter-row-drag-over': isDragOver,
|
|
7771
|
-
} }, canReorder ? (hAsync("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 ? (hAsync(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) })) : '', hAsync("div", { class: { 'select-input': true } }, hAsync("select", { class: "select-css select-filter", onChange: e => this.onFilterTypeChange(e, prop, index
|
|
7772
|
-
})),
|
|
7740
|
+
} }, canReorder ? (hAsync("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 ? (hAsync(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) })) : '', hAsync("div", { class: { 'select-input': true } }, hAsync("select", { class: "select-css select-filter", onChange: e => this.onFilterTypeChange(e, prop, index) }, this.renderSelectOptions(this.filterItems[prop][index].type, true)), extra ? hAsync("div", { class: "filter-extra" }, extra) : ''), hAsync("div", { class: FILTER_LIST_CLASS_ACTION }, andOrButton, hAsync(TrashButton, { ariaLabel: capts.removeFilter, onClick: () => this.onRemoveFilter(filter.id) })))));
|
|
7741
|
+
})), propFilters.some(f => !f.hidden) ? hAsync("div", { class: "add-filter-divider" }) : ''));
|
|
7773
7742
|
}
|
|
7774
7743
|
componentDidRender() {
|
|
7775
7744
|
this.syncDialog();
|
|
@@ -7818,24 +7787,16 @@ class FilterPanel {
|
|
|
7818
7787
|
el.style.left = `${left}px`;
|
|
7819
7788
|
el.style.top = `${top}px`;
|
|
7820
7789
|
}
|
|
7821
|
-
onFilterTypeChange(e, prop, index
|
|
7790
|
+
onFilterTypeChange(e, prop, index) {
|
|
7822
7791
|
if (!(e.target instanceof HTMLSelectElement)) {
|
|
7823
7792
|
return;
|
|
7824
7793
|
}
|
|
7825
|
-
|
|
7826
|
-
const filter = isDraft
|
|
7827
|
-
? this.promoteDraft(prop, type)
|
|
7828
|
-
: this.filterItems[prop][index];
|
|
7829
|
-
if (!filter) {
|
|
7830
|
-
return;
|
|
7831
|
-
}
|
|
7832
|
-
filter.type = type;
|
|
7833
|
-
this.hasChanges = true;
|
|
7794
|
+
this.filterItems[prop][index].type = e.target.value;
|
|
7834
7795
|
// this re-renders the input to know if we need extra input
|
|
7835
7796
|
this.filterId++;
|
|
7836
7797
|
// adding setTimeout will wait for the next tick DOM update then focus on input
|
|
7837
7798
|
setTimeout(() => {
|
|
7838
|
-
const input = document.getElementById('filter-input-' +
|
|
7799
|
+
const input = document.getElementById('filter-input-' + this.filterItems[prop][index].id);
|
|
7839
7800
|
if (input instanceof HTMLInputElement) {
|
|
7840
7801
|
input.focus();
|
|
7841
7802
|
}
|
|
@@ -7870,20 +7831,12 @@ class FilterPanel {
|
|
|
7870
7831
|
return;
|
|
7871
7832
|
this.filterId++;
|
|
7872
7833
|
this.currentFilterId = this.filterId;
|
|
7873
|
-
|
|
7874
|
-
|
|
7875
|
-
|
|
7876
|
-
|
|
7877
|
-
|
|
7878
|
-
|
|
7879
|
-
this.filterItems[prop].push({
|
|
7880
|
-
id: this.currentFilterId,
|
|
7881
|
-
type: this.currentFilterType,
|
|
7882
|
-
value: '',
|
|
7883
|
-
relation: 'and',
|
|
7884
|
-
});
|
|
7885
|
-
this.hasChanges = true;
|
|
7886
|
-
}
|
|
7834
|
+
this.filterItems[prop].push({
|
|
7835
|
+
id: this.currentFilterId,
|
|
7836
|
+
type: this.currentFilterType,
|
|
7837
|
+
value: '',
|
|
7838
|
+
relation: 'and',
|
|
7839
|
+
});
|
|
7887
7840
|
// adding setTimeout will wait for the next tick DOM update then focus on input
|
|
7888
7841
|
setTimeout(() => {
|
|
7889
7842
|
const input = document.getElementById('filter-input-' + this.currentFilterId);
|
|
@@ -7892,9 +7845,7 @@ class FilterPanel {
|
|
|
7892
7845
|
}, 0);
|
|
7893
7846
|
}
|
|
7894
7847
|
onSave() {
|
|
7895
|
-
|
|
7896
|
-
this.emitFilterChange();
|
|
7897
|
-
}
|
|
7848
|
+
this.filterChange.emit(this.filterItems);
|
|
7898
7849
|
}
|
|
7899
7850
|
onCancel() {
|
|
7900
7851
|
this.changes = undefined;
|
|
@@ -7902,25 +7853,16 @@ class FilterPanel {
|
|
|
7902
7853
|
onReset() {
|
|
7903
7854
|
var _a;
|
|
7904
7855
|
this.assertChanges();
|
|
7905
|
-
this.
|
|
7906
|
-
const prop = (_a = this.changes) === null || _a === void 0 ? void 0 : _a.prop;
|
|
7907
|
-
if (prop !== undefined) {
|
|
7908
|
-
delete this.filterItems[prop];
|
|
7909
|
-
}
|
|
7910
|
-
this.resetChange.emit(prop);
|
|
7856
|
+
this.resetChange.emit((_a = this.changes) === null || _a === void 0 ? void 0 : _a.prop);
|
|
7911
7857
|
// this updates the DOM which is used by getFilterItemsList() key
|
|
7912
7858
|
this.filterId++;
|
|
7913
7859
|
}
|
|
7914
7860
|
onRemoveFilter(id) {
|
|
7915
|
-
var _a
|
|
7861
|
+
var _a;
|
|
7916
7862
|
this.assertChanges();
|
|
7917
7863
|
// this is for reactivity issues for getFilterItemsList()
|
|
7918
7864
|
this.filterId++;
|
|
7919
7865
|
const prop = (_a = this.changes) === null || _a === void 0 ? void 0 : _a.prop;
|
|
7920
|
-
if (((_b = this.draftFilter) === null || _b === void 0 ? void 0 : _b.id) === id) {
|
|
7921
|
-
this.draftFilter = undefined;
|
|
7922
|
-
return;
|
|
7923
|
-
}
|
|
7924
7866
|
const items = this.filterItems[prop !== null && prop !== void 0 ? prop : ''];
|
|
7925
7867
|
if (!items)
|
|
7926
7868
|
return;
|
|
@@ -7928,7 +7870,6 @@ class FilterPanel {
|
|
|
7928
7870
|
if (index === -1)
|
|
7929
7871
|
return;
|
|
7930
7872
|
items.splice(index, 1);
|
|
7931
|
-
this.hasChanges = true;
|
|
7932
7873
|
// let's remove the prop if no more filters so the filter icon will be removed
|
|
7933
7874
|
if (items.length === 0)
|
|
7934
7875
|
delete this.filterItems[prop !== null && prop !== void 0 ? prop : ''];
|
|
@@ -7970,7 +7911,6 @@ class FilterPanel {
|
|
|
7970
7911
|
if (!moveFilterItem(items, sourceId, targetId)) {
|
|
7971
7912
|
return;
|
|
7972
7913
|
}
|
|
7973
|
-
this.hasChanges = true;
|
|
7974
7914
|
this.filterId++;
|
|
7975
7915
|
if (!this.disableDynamicFiltering) {
|
|
7976
7916
|
this.debouncedApplyFilter();
|
|
@@ -8006,7 +7946,6 @@ class FilterPanel {
|
|
|
8006
7946
|
if (!target || !moveFilterItem(items, sourceId, target.id)) {
|
|
8007
7947
|
return;
|
|
8008
7948
|
}
|
|
8009
|
-
this.hasChanges = true;
|
|
8010
7949
|
this.filterId++;
|
|
8011
7950
|
if (!this.disableDynamicFiltering) {
|
|
8012
7951
|
this.debouncedApplyFilter();
|
|
@@ -8025,7 +7964,6 @@ class FilterPanel {
|
|
|
8025
7964
|
if (index === -1)
|
|
8026
7965
|
return;
|
|
8027
7966
|
items[index].relation = items[index].relation === 'and' ? 'or' : 'and';
|
|
8028
|
-
this.hasChanges = true;
|
|
8029
7967
|
if (!this.disableDynamicFiltering) {
|
|
8030
7968
|
this.debouncedApplyFilter();
|
|
8031
7969
|
}
|
|
@@ -8074,22 +8012,12 @@ class FilterPanel {
|
|
|
8074
8012
|
}
|
|
8075
8013
|
return options;
|
|
8076
8014
|
}
|
|
8077
|
-
renderExtra(prop, index
|
|
8078
|
-
|
|
8079
|
-
const currentFilter = isDraft
|
|
8080
|
-
? this.draftFilter
|
|
8081
|
-
: (_a = this.filterItems[prop]) === null || _a === void 0 ? void 0 : _a[index];
|
|
8015
|
+
renderExtra(prop, index) {
|
|
8016
|
+
const currentFilter = this.filterItems[prop];
|
|
8082
8017
|
if (!currentFilter)
|
|
8083
8018
|
return '';
|
|
8084
8019
|
const applyFilter = (value) => {
|
|
8085
|
-
|
|
8086
|
-
if (isDraft && !this.isMeaningfulDraftValue(value)) {
|
|
8087
|
-
return;
|
|
8088
|
-
}
|
|
8089
|
-
if (isDraft && !this.promoteDraft(prop)) {
|
|
8090
|
-
return;
|
|
8091
|
-
}
|
|
8092
|
-
this.hasChanges = true;
|
|
8020
|
+
this.filterItems[prop][index].value = value;
|
|
8093
8021
|
if (!this.disableDynamicFiltering) {
|
|
8094
8022
|
this.debouncedApplyFilter();
|
|
8095
8023
|
}
|
|
@@ -8104,11 +8032,11 @@ class FilterPanel {
|
|
|
8104
8032
|
}
|
|
8105
8033
|
};
|
|
8106
8034
|
const capts = Object.assign(Object.assign({}, this.filterCaptionsInternal), this.filterCaptions);
|
|
8107
|
-
const extra =
|
|
8035
|
+
const extra = this.filterEntities[currentFilter[index].type].extra;
|
|
8108
8036
|
if (typeof extra === 'function') {
|
|
8109
8037
|
return extra(hAsync, {
|
|
8110
|
-
value: currentFilter.value,
|
|
8111
|
-
filter: currentFilter,
|
|
8038
|
+
value: currentFilter[index].value,
|
|
8039
|
+
filter: currentFilter[index],
|
|
8112
8040
|
prop,
|
|
8113
8041
|
index,
|
|
8114
8042
|
placeholder: capts.placeholder,
|
|
@@ -8123,7 +8051,7 @@ class FilterPanel {
|
|
|
8123
8051
|
if (extra !== 'input' && extra !== 'datepicker') {
|
|
8124
8052
|
return '';
|
|
8125
8053
|
}
|
|
8126
|
-
return (hAsync("input", { id: `filter-input-${currentFilter.id}`, placeholder: capts.placeholder, type: extra === 'datepicker' ? 'date' : 'text', value: currentFilter.value, onInput: (e) => {
|
|
8054
|
+
return (hAsync("input", { id: `filter-input-${currentFilter[index].id}`, placeholder: capts.placeholder, type: extra === 'datepicker' ? 'date' : 'text', value: currentFilter[index].value, onInput: (e) => {
|
|
8127
8055
|
if (e.target instanceof HTMLInputElement) {
|
|
8128
8056
|
applyFilter(e.target.value);
|
|
8129
8057
|
}
|
|
@@ -8139,42 +8067,6 @@ class FilterPanel {
|
|
|
8139
8067
|
e.stopPropagation();
|
|
8140
8068
|
} }));
|
|
8141
8069
|
}
|
|
8142
|
-
resolveDraftFilterType(preferred) {
|
|
8143
|
-
var _a, _b;
|
|
8144
|
-
const available = Object.values((_b = (_a = this.changes) === null || _a === void 0 ? void 0 : _a.filterTypes) !== null && _b !== void 0 ? _b : {}).flat();
|
|
8145
|
-
const type = preferred && available.includes(preferred)
|
|
8146
|
-
? preferred
|
|
8147
|
-
: available[0];
|
|
8148
|
-
return type;
|
|
8149
|
-
}
|
|
8150
|
-
promoteDraft(prop, type) {
|
|
8151
|
-
if (!this.draftFilter) {
|
|
8152
|
-
return;
|
|
8153
|
-
}
|
|
8154
|
-
if (!this.filterItems[prop]) {
|
|
8155
|
-
this.filterItems[prop] = [];
|
|
8156
|
-
}
|
|
8157
|
-
if (type) {
|
|
8158
|
-
this.draftFilter.type = type;
|
|
8159
|
-
}
|
|
8160
|
-
const filter = this.draftFilter;
|
|
8161
|
-
this.filterItems[prop].push(filter);
|
|
8162
|
-
this.draftFilter = undefined;
|
|
8163
|
-
this.hasChanges = true;
|
|
8164
|
-
return filter;
|
|
8165
|
-
}
|
|
8166
|
-
isMeaningfulDraftValue(value) {
|
|
8167
|
-
return value !== '' && value !== undefined && value !== null;
|
|
8168
|
-
}
|
|
8169
|
-
emitFilterChange() {
|
|
8170
|
-
this.filterChange.emit(this.cloneFilterItems(this.filterItems));
|
|
8171
|
-
}
|
|
8172
|
-
cloneFilterItems(filterItems) {
|
|
8173
|
-
return Object.fromEntries(Object.entries(filterItems).map(([prop, filters]) => [
|
|
8174
|
-
prop,
|
|
8175
|
-
filters.map(filter => (Object.assign({}, filter))),
|
|
8176
|
-
]));
|
|
8177
|
-
}
|
|
8178
8070
|
getAddFilterSelect() {
|
|
8179
8071
|
return this.element.querySelector(`#${FILTER_ID}`);
|
|
8180
8072
|
}
|
|
@@ -8207,7 +8099,7 @@ class FilterPanel {
|
|
|
8207
8099
|
top: `${(_d = (_c = this.changes) === null || _c === void 0 ? void 0 : _c.y) !== null && _d !== void 0 ? _d : 0}px`,
|
|
8208
8100
|
};
|
|
8209
8101
|
const capts = Object.assign(Object.assign({}, this.filterCaptionsInternal), this.filterCaptions);
|
|
8210
|
-
return (hAsync(Host, { key: '
|
|
8102
|
+
return (hAsync(Host, { key: 'd0e4ebb408750b11b3965da6a25e581733c968e3' }, hAsync("dialog", { key: '3df36777c931ec1063e8574169ca880a99dbfe41', class: "filter-panel-dialog", style: style, ref: el => (this.dialog = el), onCancel: e => {
|
|
8211
8103
|
e.preventDefault();
|
|
8212
8104
|
this.onCancel();
|
|
8213
8105
|
} }, this.changes && [
|
|
@@ -8216,7 +8108,7 @@ class FilterPanel {
|
|
|
8216
8108
|
((_g = this.changes) === null || _g === void 0 ? void 0 : _g.hideDefaultFilters) !== true && [
|
|
8217
8109
|
hAsync("label", { key: "filter-title" }, capts.title),
|
|
8218
8110
|
hAsync("div", { key: "filter-holder", class: "filter-holder" }, this.getFilterItemsList()),
|
|
8219
|
-
hAsync("div", { key: "add-filter", class: "add-filter" }, hAsync("select", { key: '
|
|
8111
|
+
hAsync("div", { key: "add-filter", class: "add-filter" }, hAsync("select", { key: 'e2a8bd29f2090d3e6c933795427b71ca190b82aa', id: FILTER_ID, class: "select-css", onChange: e => this.onAddNewFilter(e) }, this.renderSelectOptions(this.currentFilterType))),
|
|
8220
8112
|
],
|
|
8221
8113
|
hAsync("slot", { key: "default-slot" }),
|
|
8222
8114
|
((_j = (_h = this.changes).extraBottomContent) === null || _j === void 0 ? void 0 : _j.call(_h, this.changes)) || '',
|
|
@@ -8248,7 +8140,6 @@ class FilterPanel {
|
|
|
8248
8140
|
"currentFilterType": [32],
|
|
8249
8141
|
"changes": [32],
|
|
8250
8142
|
"filterItems": [32],
|
|
8251
|
-
"draftFilter": [32],
|
|
8252
8143
|
"draggedFilterId": [32],
|
|
8253
8144
|
"dragOverFilterId": [32],
|
|
8254
8145
|
"show": [64],
|
|
@@ -16504,11 +16395,6 @@ const filterTypes = {
|
|
|
16504
16395
|
boolean: ['notEmpty', 'empty'],
|
|
16505
16396
|
array: ['notEmpty', 'empty'],
|
|
16506
16397
|
};
|
|
16507
|
-
/** Preferred initial operator for built-in filter families. */
|
|
16508
|
-
const filterTypeDefaults = {
|
|
16509
|
-
string: 'contains',
|
|
16510
|
-
number: 'eqN',
|
|
16511
|
-
};
|
|
16512
16398
|
const filterNames = {
|
|
16513
16399
|
none: 'None',
|
|
16514
16400
|
empty: 'Is blank',
|
|
@@ -16551,8 +16437,6 @@ const FILTE_PANEL = 'revogr-filter-panel';
|
|
|
16551
16437
|
*
|
|
16552
16438
|
* @property {FilterLocalization|undefined} localization - translation for filter popup captions.
|
|
16553
16439
|
*
|
|
16554
|
-
* @property {boolean|undefined} defaultFilter - creates a draft condition when an empty filter panel opens. Defaults to true.
|
|
16555
|
-
*
|
|
16556
16440
|
* @property {boolean|undefined} disableDynamicFiltering - disables dynamic filtering. A way to apply filters on Save only.
|
|
16557
16441
|
*/
|
|
16558
16442
|
/**
|
|
@@ -16574,7 +16458,7 @@ class FilterPlugin extends BasePlugin {
|
|
|
16574
16458
|
* number: ['eqN', 'neqN', 'gt']
|
|
16575
16459
|
* }
|
|
16576
16460
|
*/
|
|
16577
|
-
this.filterByType = Object.
|
|
16461
|
+
this.filterByType = Object.assign({}, filterTypes);
|
|
16578
16462
|
this.filterNameIndexByType = Object.assign({}, filterNames);
|
|
16579
16463
|
this.filterFunctionsIndexedByType = Object.assign({}, filterCoreFunctionsIndexedByType);
|
|
16580
16464
|
this.filterProp = FILTER_PROP;
|
|
@@ -16658,16 +16542,11 @@ class FilterPlugin extends BasePlugin {
|
|
|
16658
16542
|
return null;
|
|
16659
16543
|
}
|
|
16660
16544
|
initConfig(config) {
|
|
16661
|
-
var _a
|
|
16545
|
+
var _a;
|
|
16662
16546
|
this.config = config;
|
|
16663
16547
|
this.allowDuplicateOperators = (_a = config.allowDuplicateOperators) !== null && _a !== void 0 ? _a : true;
|
|
16664
16548
|
if (this.pop) {
|
|
16665
16549
|
this.pop.allowDuplicateOperators = this.allowDuplicateOperators;
|
|
16666
|
-
this.pop.disableDynamicFiltering =
|
|
16667
|
-
(_b = config.disableDynamicFiltering) !== null && _b !== void 0 ? _b : false;
|
|
16668
|
-
this.pop.closeOnOutsideClick =
|
|
16669
|
-
(_c = config.closeFilterPanelOnOutsideClick) !== null && _c !== void 0 ? _c : true;
|
|
16670
|
-
this.pop.filterCaptions = (_d = config.localization) === null || _d === void 0 ? void 0 : _d.captions;
|
|
16671
16550
|
}
|
|
16672
16551
|
if (config.multiFilterItems) {
|
|
16673
16552
|
this.multiFilterItems = Object.assign({}, config.multiFilterItems);
|
|
@@ -16756,12 +16635,11 @@ class FilterPlugin extends BasePlugin {
|
|
|
16756
16635
|
}
|
|
16757
16636
|
// filter button clicked, open filter dialog
|
|
16758
16637
|
const buttonPos = (filterButton instanceof HTMLElement ? filterButton : el).getBoundingClientRect();
|
|
16759
|
-
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),
|
|
16638
|
+
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 });
|
|
16760
16639
|
(_b = this.beforeshow) === null || _b === void 0 ? void 0 : _b.call(this, data);
|
|
16761
16640
|
this.pop.show(data);
|
|
16762
16641
|
}
|
|
16763
|
-
getColumnFilter(
|
|
16764
|
-
const type = this.isColumnFilterOption(config) ? config.type : config;
|
|
16642
|
+
getColumnFilter(type) {
|
|
16765
16643
|
let filterType = 'string';
|
|
16766
16644
|
if (!type) {
|
|
16767
16645
|
return { [filterType]: this.filterByType[filterType] };
|
|
@@ -16781,41 +16659,6 @@ class FilterPlugin extends BasePlugin {
|
|
|
16781
16659
|
}
|
|
16782
16660
|
return { [filterType]: this.filterByType[filterType] };
|
|
16783
16661
|
}
|
|
16784
|
-
/** Resolve the preferred operator against the column's available filters. */
|
|
16785
|
-
getDefaultFilter(config) {
|
|
16786
|
-
var _a;
|
|
16787
|
-
const filters = this.getColumnFilter(config);
|
|
16788
|
-
const availableFilters = Object.values(filters).flat();
|
|
16789
|
-
const columnDefault = this.isColumnFilterOption(config)
|
|
16790
|
-
? config.default
|
|
16791
|
-
: undefined;
|
|
16792
|
-
if (typeof columnDefault === 'string' &&
|
|
16793
|
-
availableFilters.includes(columnDefault)) {
|
|
16794
|
-
return columnDefault;
|
|
16795
|
-
}
|
|
16796
|
-
const firstFamily = Object.keys(filters)[0];
|
|
16797
|
-
const familyDefault = filterTypeDefaults[firstFamily];
|
|
16798
|
-
if (familyDefault && ((_a = filters[firstFamily]) === null || _a === void 0 ? void 0 : _a.includes(familyDefault))) {
|
|
16799
|
-
return familyDefault;
|
|
16800
|
-
}
|
|
16801
|
-
return availableFilters[0];
|
|
16802
|
-
}
|
|
16803
|
-
/** Resolve grid and column-level draft opt-outs. */
|
|
16804
|
-
shouldShowDefaultFilter(config) {
|
|
16805
|
-
var _a;
|
|
16806
|
-
if (this.isColumnFilterOption(config)) {
|
|
16807
|
-
if (config.default === false) {
|
|
16808
|
-
return false;
|
|
16809
|
-
}
|
|
16810
|
-
if (typeof config.default === 'string') {
|
|
16811
|
-
return true;
|
|
16812
|
-
}
|
|
16813
|
-
}
|
|
16814
|
-
return ((_a = this.config) === null || _a === void 0 ? void 0 : _a.defaultFilter) !== false;
|
|
16815
|
-
}
|
|
16816
|
-
isColumnFilterOption(value) {
|
|
16817
|
-
return !!value && typeof value === 'object' && !Array.isArray(value);
|
|
16818
|
-
}
|
|
16819
16662
|
isValidType(type) {
|
|
16820
16663
|
return !!(typeof type === 'string' && this.filterByType[type]);
|
|
16821
16664
|
}
|