@visactor/vtable-plugins 1.22.4-alpha.6 → 1.22.4-alpha.8
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/cjs/contextmenu/menu-manager.js +1 -2
- package/cjs/filter/condition-filter.js +2 -1
- package/cjs/filter/filter-toolbar.d.ts +2 -2
- package/cjs/filter/filter-toolbar.js +16 -9
- package/cjs/filter/filter-toolbar.js.map +1 -1
- package/cjs/filter/filter.js +1 -7
- package/cjs/filter/filter.js.map +1 -1
- package/cjs/filter/value-filter.d.ts +2 -0
- package/cjs/filter/value-filter.js +22 -11
- package/cjs/filter/value-filter.js.map +1 -1
- package/dist/vtable-plugins.js +51 -25
- package/dist/vtable-plugins.min.js +1 -1
- package/es/contextmenu/menu-manager.js +1 -2
- package/es/filter/condition-filter.js +2 -1
- package/es/filter/filter-toolbar.d.ts +2 -2
- package/es/filter/filter-toolbar.js +17 -8
- package/es/filter/filter-toolbar.js.map +1 -1
- package/es/filter/filter.js +1 -7
- package/es/filter/filter.js.map +1 -1
- package/es/filter/value-filter.d.ts +2 -0
- package/es/filter/value-filter.js +23 -12
- package/es/filter/value-filter.js.map +1 -1
- package/package.json +8 -8
package/dist/vtable-plugins.js
CHANGED
|
@@ -10665,8 +10665,6 @@ ${recordsStr}
|
|
|
10665
10665
|
const displayValue = optionDom.originalValue;
|
|
10666
10666
|
const rawValue = displayToRawMap ? displayToRawMap.get(displayValue) : displayValue;
|
|
10667
10667
|
optionDom.checkbox.checked = selectedRawValues.some(v => v === rawValue);
|
|
10668
|
-
const count = this.uniqueKeys.get(filter.field)?.find(key => String(key.value) === optionDom.id)?.count || 0;
|
|
10669
|
-
optionDom.checkbox.disabled = count === 0;
|
|
10670
10668
|
});
|
|
10671
10669
|
}
|
|
10672
10670
|
syncSelectAllWithFilterState(filter) {
|
|
@@ -10769,12 +10767,11 @@ ${recordsStr}
|
|
|
10769
10767
|
checkbox.type = 'checkbox';
|
|
10770
10768
|
checkbox.value = String(value);
|
|
10771
10769
|
checkbox.checked = selectedRawValueSet.has(rawValue);
|
|
10772
|
-
checkbox.disabled = count === 0;
|
|
10773
10770
|
applyStyles(checkbox, this.styles.checkbox);
|
|
10774
10771
|
const countSpan = document.createElement('span');
|
|
10775
10772
|
countSpan.textContent = String(count);
|
|
10776
10773
|
applyStyles(countSpan, this.styles.countSpan);
|
|
10777
|
-
label.append(checkbox, ` ${
|
|
10774
|
+
label.append(checkbox, ` ${rawValue}`);
|
|
10778
10775
|
itemDiv.append(label, countSpan);
|
|
10779
10776
|
this.filterItemsContainer.appendChild(itemDiv);
|
|
10780
10777
|
const itemDom = {
|
|
@@ -10800,19 +10797,46 @@ ${recordsStr}
|
|
|
10800
10797
|
const target = event.target;
|
|
10801
10798
|
if (target instanceof HTMLInputElement && target.type === 'checkbox') {
|
|
10802
10799
|
if (target === this.selectAllCheckbox) {
|
|
10803
|
-
this.
|
|
10800
|
+
this.valueFilterOptionList.get(this.selectedField).forEach(item => (item.checkbox.checked = target.checked));
|
|
10804
10801
|
}
|
|
10805
10802
|
else {
|
|
10806
|
-
|
|
10807
|
-
const checked = checkbox.checked;
|
|
10808
|
-
const value = this.valueFilterOptionList
|
|
10809
|
-
.get(this.selectedField)
|
|
10810
|
-
?.find(item => item.id === checkbox.value)?.originalValue;
|
|
10811
|
-
this.onValueSelect(this.selectedField, value, checked);
|
|
10803
|
+
this.updateCheckboxUI(this.selectedField);
|
|
10812
10804
|
}
|
|
10813
10805
|
}
|
|
10814
10806
|
});
|
|
10815
10807
|
}
|
|
10808
|
+
updateCheckboxUI(field) {
|
|
10809
|
+
const checkedItem = this.valueFilterOptionList.get(field)?.filter(item => item.checkbox.checked);
|
|
10810
|
+
const uncheckedItem = this.valueFilterOptionList.get(field)?.filter(item => !item.checkbox.checked);
|
|
10811
|
+
if (!isValid$2(checkedItem) || !isValid$2(uncheckedItem)) {
|
|
10812
|
+
return;
|
|
10813
|
+
}
|
|
10814
|
+
if (checkedItem.length !== 0 && uncheckedItem.length !== 0) {
|
|
10815
|
+
this.selectAllCheckbox.indeterminate = true;
|
|
10816
|
+
}
|
|
10817
|
+
else {
|
|
10818
|
+
this.selectAllCheckbox.indeterminate = false;
|
|
10819
|
+
this.selectAllCheckbox.checked = uncheckedItem.length === 0;
|
|
10820
|
+
}
|
|
10821
|
+
}
|
|
10822
|
+
updateCheckboxState(field) {
|
|
10823
|
+
const originalValues = this.valueFilterOptionList
|
|
10824
|
+
.get(field)
|
|
10825
|
+
?.filter(item => item.checkbox.checked)
|
|
10826
|
+
.map(item => item.originalValue);
|
|
10827
|
+
const displayToRawMap = this.displayToRawValueMap.get(field);
|
|
10828
|
+
const rawValues = originalValues.map((displayValue) => {
|
|
10829
|
+
return displayToRawMap ? displayToRawMap.get(displayValue) : displayValue;
|
|
10830
|
+
});
|
|
10831
|
+
this.filterStateManager.dispatch({
|
|
10832
|
+
type: exports.FilterActionType.ADD_FILTER,
|
|
10833
|
+
payload: {
|
|
10834
|
+
field: field,
|
|
10835
|
+
type: 'byValue',
|
|
10836
|
+
values: rawValues
|
|
10837
|
+
}
|
|
10838
|
+
});
|
|
10839
|
+
}
|
|
10816
10840
|
show() {
|
|
10817
10841
|
this.collectUniqueColumnValues(this.selectedField);
|
|
10818
10842
|
this.updateCandidateCounts(this.selectedField);
|
|
@@ -10826,6 +10850,7 @@ ${recordsStr}
|
|
|
10826
10850
|
this.filterByValueSearchInput.value = '';
|
|
10827
10851
|
}
|
|
10828
10852
|
this.renderFilterOptions(this.selectedField);
|
|
10853
|
+
this.updateCheckboxUI(this.selectedField);
|
|
10829
10854
|
this.filterByValuePanel.style.display = 'block';
|
|
10830
10855
|
}
|
|
10831
10856
|
hide() {
|
|
@@ -11209,12 +11234,13 @@ ${recordsStr}
|
|
|
11209
11234
|
}
|
|
11210
11235
|
applyFilter(field) {
|
|
11211
11236
|
if (this.activeTab === 'byValue') {
|
|
11237
|
+
this.valueFilter.updateCheckboxState(field);
|
|
11212
11238
|
this.valueFilter.applyFilter(field);
|
|
11213
11239
|
}
|
|
11214
11240
|
else if (this.activeTab === 'byCondition') {
|
|
11215
11241
|
this.conditionFilter.applyFilter(field);
|
|
11216
11242
|
}
|
|
11217
|
-
this.hide();
|
|
11243
|
+
this.hide(this.currentCol, this.currentRow);
|
|
11218
11244
|
}
|
|
11219
11245
|
clearFilter(field) {
|
|
11220
11246
|
if (this.valueFilter) {
|
|
@@ -11223,7 +11249,7 @@ ${recordsStr}
|
|
|
11223
11249
|
if (this.conditionFilter) {
|
|
11224
11250
|
this.conditionFilter.clearFilter(field);
|
|
11225
11251
|
}
|
|
11226
|
-
this.hide();
|
|
11252
|
+
this.hide(this.currentCol, this.currentRow);
|
|
11227
11253
|
}
|
|
11228
11254
|
updateClearFilterButtonState(field) {
|
|
11229
11255
|
const currentFilter = this.filterStateManager.getFilterState(field);
|
|
@@ -11276,7 +11302,7 @@ ${recordsStr}
|
|
|
11276
11302
|
this.filterTabByCondition.addEventListener('click', () => {
|
|
11277
11303
|
this.onTabSwitch('byCondition');
|
|
11278
11304
|
});
|
|
11279
|
-
this.cancelFilterButton.addEventListener('click', () => this.hide());
|
|
11305
|
+
this.cancelFilterButton.addEventListener('click', () => this.hide(this.currentCol, this.currentRow));
|
|
11280
11306
|
this.clearFilterOptionLink.addEventListener('click', e => {
|
|
11281
11307
|
e.preventDefault();
|
|
11282
11308
|
this.clearFilter(this.selectedField);
|
|
@@ -11286,7 +11312,7 @@ ${recordsStr}
|
|
|
11286
11312
|
});
|
|
11287
11313
|
document.addEventListener('click', () => {
|
|
11288
11314
|
if (this.isVisible) {
|
|
11289
|
-
this.hide();
|
|
11315
|
+
this.hide(this.currentCol, this.currentRow);
|
|
11290
11316
|
}
|
|
11291
11317
|
});
|
|
11292
11318
|
this.filterMenu.addEventListener('click', e => {
|
|
@@ -11348,11 +11374,19 @@ ${recordsStr}
|
|
|
11348
11374
|
this.updateClearFilterButtonState(field);
|
|
11349
11375
|
setTimeout(() => {
|
|
11350
11376
|
this.isVisible = true;
|
|
11377
|
+
this.table.fireListeners(VTable.TABLE_EVENT_TYPE.FILTER_MENU_SHOW, {
|
|
11378
|
+
col: col,
|
|
11379
|
+
row: row
|
|
11380
|
+
});
|
|
11351
11381
|
}, 0);
|
|
11352
11382
|
}
|
|
11353
|
-
hide() {
|
|
11383
|
+
hide(currentCol, currentRow) {
|
|
11354
11384
|
this.filterMenu.style.display = 'none';
|
|
11355
11385
|
this.isVisible = false;
|
|
11386
|
+
this.table.fireListeners(VTable.TABLE_EVENT_TYPE.FILTER_MENU_HIDE, {
|
|
11387
|
+
col: currentCol,
|
|
11388
|
+
row: currentRow
|
|
11389
|
+
});
|
|
11356
11390
|
}
|
|
11357
11391
|
}
|
|
11358
11392
|
|
|
@@ -20909,18 +20943,10 @@ ${recordsStr}
|
|
|
20909
20943
|
const col = eventArgs.col;
|
|
20910
20944
|
const row = eventArgs.row;
|
|
20911
20945
|
if (this.filterToolbar.isVisible) {
|
|
20912
|
-
this.filterToolbar.hide();
|
|
20913
|
-
this.table.fireListeners(VTable.TABLE_EVENT_TYPE.FILTER_MENU_HIDE, {
|
|
20914
|
-
col: eventArgs.col,
|
|
20915
|
-
row: eventArgs.row
|
|
20916
|
-
});
|
|
20946
|
+
this.filterToolbar.hide(eventArgs.col, eventArgs.row);
|
|
20917
20947
|
}
|
|
20918
20948
|
else {
|
|
20919
20949
|
this.filterToolbar.show(col, row, this.pluginOptions.filterModes);
|
|
20920
|
-
this.table.fireListeners(VTable.TABLE_EVENT_TYPE.FILTER_MENU_SHOW, {
|
|
20921
|
-
col: eventArgs.col,
|
|
20922
|
-
row: eventArgs.row
|
|
20923
|
-
});
|
|
20924
20950
|
}
|
|
20925
20951
|
}
|
|
20926
20952
|
else if (runtime === VTable.TABLE_EVENT_TYPE.SCROLL) {
|