@dragonmastery/zinia-forms-core 0.5.0 → 0.5.2
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/index.js +18 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -8573,6 +8573,14 @@ var EnumMultiSelectFilter = (props) => {
|
|
|
8573
8573
|
};
|
|
8574
8574
|
const applyPendingFilter = () => {
|
|
8575
8575
|
if (state.pendingValues === void 0) return;
|
|
8576
|
+
const currentValues = Array.isArray(props.value) ? props.value : props.value ? [props.value] : [];
|
|
8577
|
+
const pendingSet = new Set(state.pendingValues.map((v) => String(v)));
|
|
8578
|
+
const currentSet = new Set(currentValues.map((v) => String(v)));
|
|
8579
|
+
const valuesChanged = pendingSet.size !== currentSet.size || !Array.from(pendingSet).every((v) => currentSet.has(v));
|
|
8580
|
+
if (!valuesChanged) {
|
|
8581
|
+
state.pendingValues = void 0;
|
|
8582
|
+
return;
|
|
8583
|
+
}
|
|
8576
8584
|
if (state.pendingValues.length === 0) {
|
|
8577
8585
|
if (props.onClearFilter) {
|
|
8578
8586
|
props.onClearFilter(props.field);
|
|
@@ -10267,6 +10275,16 @@ function formatFilterValue(field, filter, column, fieldsMetadata, filterOptionsS
|
|
|
10267
10275
|
if (filter.operator === "between" && filter.values.length === 2) {
|
|
10268
10276
|
return `${filter.values[0]} - ${filter.values[1]}`;
|
|
10269
10277
|
}
|
|
10278
|
+
if (filter.operator === "in" || filter.operator === "notIn") {
|
|
10279
|
+
const options2 = getFilterOptions(field, column, fieldsMetadata, filterOptionsState);
|
|
10280
|
+
if (options2.length > 0) {
|
|
10281
|
+
const labels = filter.values.map((val) => {
|
|
10282
|
+
const option = options2.find((opt) => opt.value === val);
|
|
10283
|
+
return option ? option.label : String(val);
|
|
10284
|
+
});
|
|
10285
|
+
return labels.join(", ");
|
|
10286
|
+
}
|
|
10287
|
+
}
|
|
10270
10288
|
return filter.values.join(", ");
|
|
10271
10289
|
}
|
|
10272
10290
|
const value = filter.value;
|