@visactor/vtable-plugins 1.22.7-alpha.2 → 1.22.7-alpha.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/cjs/filter/filter-toolbar.js +2 -0
- package/cjs/filter/filter-toolbar.js.map +1 -1
- package/cjs/filter/filter.js +3 -3
- package/cjs/filter/filter.js.map +1 -1
- package/cjs/filter/value-filter.d.ts +2 -1
- package/cjs/filter/value-filter.js +28 -10
- package/cjs/filter/value-filter.js.map +1 -1
- package/cjs/master-detail-plugin/checkbox.js +0 -1
- package/cjs/master-detail-plugin/types.js +1 -1
- package/cjs/table-export/index.js +2 -1
- package/dist/vtable-plugins.js +54 -21
- package/dist/vtable-plugins.min.js +1 -1
- package/es/filter/filter-toolbar.js +2 -0
- package/es/filter/filter-toolbar.js.map +1 -1
- package/es/filter/filter.js +3 -3
- package/es/filter/filter.js.map +1 -1
- package/es/filter/value-filter.d.ts +2 -1
- package/es/filter/value-filter.js +28 -10
- package/es/filter/value-filter.js.map +1 -1
- package/es/master-detail-plugin/checkbox.js +1 -2
- package/es/master-detail-plugin/types.js +1 -1
- package/es/table-export/index.js +2 -1
- package/package.json +6 -6
package/dist/vtable-plugins.js
CHANGED
|
@@ -10376,19 +10376,38 @@ ${recordsStr}
|
|
|
10376
10376
|
this.candidateKeys.set(fieldId, countMap);
|
|
10377
10377
|
this.toUnformattedCache.set(fieldId, toUnformatted);
|
|
10378
10378
|
}
|
|
10379
|
-
|
|
10379
|
+
updateBeforeFilter() {
|
|
10380
10380
|
const currentRecords = this.table.internalProps.dataSource.records;
|
|
10381
10381
|
const filteredFields = this.filterStateManager.getActiveFilterFields();
|
|
10382
10382
|
currentRecords.forEach(record => {
|
|
10383
10383
|
filteredFields.forEach(candidateField => {
|
|
10384
10384
|
const formatFn = this.getFormatFnCache(candidateField);
|
|
10385
|
-
|
|
10386
|
-
|
|
10387
|
-
|
|
10388
|
-
|
|
10389
|
-
|
|
10390
|
-
|
|
10391
|
-
|
|
10385
|
+
if (isValid$2(record)) {
|
|
10386
|
+
const originalValue = record[candidateField];
|
|
10387
|
+
const formattedValue = formatFn(record);
|
|
10388
|
+
const lastToUnformatted = this.toUnformattedCache.get(candidateField) || new Map();
|
|
10389
|
+
if (!lastToUnformatted.has(formattedValue) &&
|
|
10390
|
+
this.filterStateManager.getFilterState(candidateField)?.values?.length > 0) {
|
|
10391
|
+
this.filterStateManager.getFilterState(candidateField).values.push(originalValue);
|
|
10392
|
+
this.selectedKeys.get(candidateField).add(originalValue);
|
|
10393
|
+
}
|
|
10394
|
+
}
|
|
10395
|
+
});
|
|
10396
|
+
});
|
|
10397
|
+
}
|
|
10398
|
+
updateAfterFilter() {
|
|
10399
|
+
const currentRecords = this.table.internalProps.dataSource.records;
|
|
10400
|
+
const filteredFields = this.filterStateManager.getActiveFilterFields();
|
|
10401
|
+
currentRecords.forEach(record => {
|
|
10402
|
+
filteredFields.forEach(candidateField => {
|
|
10403
|
+
if (isValid$2(record)) {
|
|
10404
|
+
const originalValue = record[candidateField];
|
|
10405
|
+
if (this.filterStateManager.getFilterState(candidateField)?.type === 'byCondition') {
|
|
10406
|
+
if (!this.selectedKeys.get(candidateField)) {
|
|
10407
|
+
this.selectedKeys.set(candidateField, new Set());
|
|
10408
|
+
}
|
|
10409
|
+
this.selectedKeys.get(candidateField).add(originalValue);
|
|
10410
|
+
}
|
|
10392
10411
|
}
|
|
10393
10412
|
});
|
|
10394
10413
|
});
|
|
@@ -10411,16 +10430,18 @@ ${recordsStr}
|
|
|
10411
10430
|
}));
|
|
10412
10431
|
}
|
|
10413
10432
|
records.forEach(record => {
|
|
10414
|
-
|
|
10415
|
-
|
|
10416
|
-
|
|
10417
|
-
|
|
10418
|
-
|
|
10419
|
-
|
|
10420
|
-
unformattedSet
|
|
10421
|
-
|
|
10422
|
-
|
|
10423
|
-
|
|
10433
|
+
if (isValid$2(record)) {
|
|
10434
|
+
const originalValue = record[candidateField];
|
|
10435
|
+
const formattedValue = formatFn(record);
|
|
10436
|
+
countMap.set(formattedValue, (countMap.get(formattedValue) || 0) + 1);
|
|
10437
|
+
if (formattedValue !== undefined && formattedValue !== null) {
|
|
10438
|
+
const unformattedSet = toUnformatted.get(formattedValue);
|
|
10439
|
+
if (unformattedSet !== undefined && unformattedSet !== null) {
|
|
10440
|
+
unformattedSet.add(originalValue);
|
|
10441
|
+
}
|
|
10442
|
+
else {
|
|
10443
|
+
toUnformatted.set(formattedValue, new Set([originalValue]));
|
|
10444
|
+
}
|
|
10424
10445
|
}
|
|
10425
10446
|
}
|
|
10426
10447
|
});
|
|
@@ -10462,11 +10483,15 @@ ${recordsStr}
|
|
|
10462
10483
|
const originalValues = new Set();
|
|
10463
10484
|
const currentRecords = this.table.internalProps.dataSource.records;
|
|
10464
10485
|
currentRecords.forEach(record => {
|
|
10465
|
-
|
|
10486
|
+
if (isValid$2(record)) {
|
|
10487
|
+
selectedValues.add(record[fieldId]);
|
|
10488
|
+
}
|
|
10466
10489
|
});
|
|
10467
10490
|
const originalRecords = this.table.internalProps.records;
|
|
10468
10491
|
originalRecords.forEach(record => {
|
|
10469
|
-
|
|
10492
|
+
if (isValid$2(record)) {
|
|
10493
|
+
originalValues.add(record[fieldId]);
|
|
10494
|
+
}
|
|
10470
10495
|
});
|
|
10471
10496
|
const hasFiltered = !arrayEqual(Array.from(originalValues), Array.from(selectedValues));
|
|
10472
10497
|
if (hasFiltered) {
|
|
@@ -11177,6 +11202,13 @@ ${recordsStr}
|
|
|
11177
11202
|
applyStyles(this.applyFilterButton, styles.footerButton(true));
|
|
11178
11203
|
this.valueFilter.updateStyles(styles);
|
|
11179
11204
|
this.conditionFilter.updateStyles(styles);
|
|
11205
|
+
const currentFilter = this.filterStateManager.getFilterState(this.selectedField);
|
|
11206
|
+
if (currentFilter && currentFilter.type === 'byCondition') {
|
|
11207
|
+
this.onTabSwitch('byCondition');
|
|
11208
|
+
}
|
|
11209
|
+
else {
|
|
11210
|
+
this.onTabSwitch('byValue');
|
|
11211
|
+
}
|
|
11180
11212
|
}
|
|
11181
11213
|
attachEventListeners() {
|
|
11182
11214
|
this.filterTabByValue.addEventListener('click', () => {
|
|
@@ -20851,10 +20883,11 @@ ${recordsStr}
|
|
|
20851
20883
|
this.filterToolbar.updateStyles(this.pluginOptions.styles);
|
|
20852
20884
|
}
|
|
20853
20885
|
update() {
|
|
20854
|
-
this.filterToolbar.valueFilter?.
|
|
20886
|
+
this.filterToolbar.valueFilter?.updateBeforeFilter();
|
|
20855
20887
|
if (this.filterStateManager) {
|
|
20856
20888
|
this.reapplyActiveFilters();
|
|
20857
20889
|
}
|
|
20890
|
+
this.filterToolbar.valueFilter?.updateAfterFilter();
|
|
20858
20891
|
}
|
|
20859
20892
|
handleOptionUpdate(options) {
|
|
20860
20893
|
const currentActiveFields = this.filterStateManager ? this.filterStateManager.getActiveFilterFields() : [];
|