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