@akinon/akifilter 1.5.0 → 1.6.0
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"akifilter.d.ts","sourceRoot":"","sources":["../../src/akifilter.tsx"],"names":[],"mappings":"AAAA,OAAO,cAAc,CAAC;AAGtB,OAAO,EAIL,WAAW,EACX,IAAI,EAIL,MAAM,iBAAiB,CAAC;AAIzB,OAAO,EAAY,KAAK,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAShE,OAAO,KAAK,MAAM,OAAO,CAAC;AAa1B,OAAO,EACL,KAAK,aAAa,EAEnB,MAAM,8BAA8B,CAAC;AActC,OAAO,KAAK,EACV,mBAAmB,EAEnB,eAAe,EAChB,MAAM,SAAS,CAAC;AAcjB,KAAK,oBAAoB,GAAG,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"akifilter.d.ts","sourceRoot":"","sources":["../../src/akifilter.tsx"],"names":[],"mappings":"AAAA,OAAO,cAAc,CAAC;AAGtB,OAAO,EAIL,WAAW,EACX,IAAI,EAIL,MAAM,iBAAiB,CAAC;AAIzB,OAAO,EAAY,KAAK,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAShE,OAAO,KAAK,MAAM,OAAO,CAAC;AAa1B,OAAO,EACL,KAAK,aAAa,EAEnB,MAAM,8BAA8B,CAAC;AActC,OAAO,KAAK,EACV,mBAAmB,EAEnB,eAAe,EAChB,MAAM,SAAS,CAAC;AAcjB,KAAK,oBAAoB,GAAG,WAAW,CAAC;AAoKxC,MAAM,MAAM,cAAc,CACxB,YAAY,SAAS,oBAAoB,GAAG,oBAAoB,IAC9D;IACF;;OAEG;IACH,YAAY,CAAC,EAAE,eAAe,CAAC,YAAY,CAAC,CAAC;IAC7C;;OAEG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B;;OAEG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC,YAAY,CAAC,CAAC;IACtC;;OAEG;IACH,cAAc,CAAC,EAAE,CAAC,MAAM,EAAE,OAAO,CAAC,YAAY,CAAC,KAAK,IAAI,CAAC;IACzD;;OAEG;IACH,qBAAqB,CAAC,EAAE,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,KAAK,IAAI,CAAC;IAClE;;;OAGG;IACH,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI,CAAC;IACnC;;;OAGG;IACH,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI,CAAC;IACnC;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,IAAI,CAAC;IACxB;;OAEG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B;;OAEG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B;;OAEG;IACH,gBAAgB,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAC;IAClD;;;OAGG;IACH,sBAAsB,CAAC,EAAE,aAAa,EAAE,CAAC;IACzC;;OAEG;IACH,sBAAsB,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;CAChD,CAAC;AA4zBF,eAAO,MAAM,UAAU,GAAI,cAAc,UAAU;;;;;;;;CAQjD,CAAC;AA8CH,eAAO,MAAM,SAAS;KACpB,YAAY,SAAS,oBAAoB,uBAElC,cAAc,CAAC,YAAY,CAAC;;CAmBpC,CAAC"}
|
package/dist/cjs/akifilter.js
CHANGED
|
@@ -111,7 +111,10 @@ const resolveClearedFieldValue = (field, defaultValue) => {
|
|
|
111
111
|
return [];
|
|
112
112
|
}
|
|
113
113
|
return null;
|
|
114
|
+
// Custom fields must clear to `null`, not `undefined` (PUF-5666): otherwise
|
|
115
|
+
// react-hook-form rewrites the cleared value as a "zombie" and resurrects the filter.
|
|
114
116
|
case constants_1.FIELD_TYPES.FILE:
|
|
117
|
+
case constants_1.FIELD_TYPES.CUSTOM:
|
|
115
118
|
return null;
|
|
116
119
|
default:
|
|
117
120
|
return undefined;
|
|
@@ -269,16 +272,6 @@ const AkifilterContent = ({ filterSchema, storageNamespace, defaultValues, onVal
|
|
|
269
272
|
(0, storage_1.writeVisibleKeys)(storageKey, visibleKeys);
|
|
270
273
|
onVisibleFieldsChange === null || onVisibleFieldsChange === void 0 ? void 0 : onVisibleFieldsChange(visibleKeys);
|
|
271
274
|
}, [visibleKeys, onVisibleFieldsChange, storageKey]);
|
|
272
|
-
// Track previous mergedDefaultValues to avoid unnecessary resets
|
|
273
|
-
const previousMergedDefaultValuesRef = react_1.default.useRef(null);
|
|
274
|
-
react_1.default.useEffect(() => {
|
|
275
|
-
const serialised = JSON.stringify(mergedDefaultValues);
|
|
276
|
-
// Skip if the values haven't actually changed (deep comparison)
|
|
277
|
-
if (previousMergedDefaultValuesRef.current === serialised) {
|
|
278
|
-
return;
|
|
279
|
-
}
|
|
280
|
-
previousMergedDefaultValuesRef.current = serialised;
|
|
281
|
-
}, [mergedDefaultValues]);
|
|
282
275
|
const normalisedValues = react_1.default.useMemo(() => (0, values_1.normaliseOutputValues)(flattenedSchema, formValues), [flattenedSchema, formValues]);
|
|
283
276
|
const hasInitialValuesRef = react_1.default.useRef(false);
|
|
284
277
|
react_1.default.useEffect(() => {
|
|
@@ -379,6 +372,9 @@ const AkifilterContent = ({ filterSchema, storageNamespace, defaultValues, onVal
|
|
|
379
372
|
clearedDefaults[key] = resolved;
|
|
380
373
|
}
|
|
381
374
|
});
|
|
375
|
+
// clearedDefaults carries an explicit cleared value (e.g. `null` for custom/file
|
|
376
|
+
// fields) for every key, so reset overwrites stale values instead of leaving the
|
|
377
|
+
// field untouched and resurrecting the filter (PUF-5666).
|
|
382
378
|
formMethods.reset(clearedDefaults, {
|
|
383
379
|
keepDirty: false,
|
|
384
380
|
keepTouched: false
|
|
@@ -431,7 +427,9 @@ const AkifilterContent = ({ filterSchema, storageNamespace, defaultValues, onVal
|
|
|
431
427
|
const updatedFormValues = Object.assign(Object.assign({}, currentFormValues), { [String(schemaField.key)]: nextValue });
|
|
432
428
|
// Normalize the values (removes empty/undefined entries)
|
|
433
429
|
const nextValues = (0, values_1.normaliseOutputValues)(flattenedSchema, updatedFormValues);
|
|
434
|
-
//
|
|
430
|
+
// updatedFormValues holds an explicit cleared value (e.g. `null` for custom/file
|
|
431
|
+
// fields) for the removed key, so reset overwrites the stale value rather than
|
|
432
|
+
// leaving it in place and resurrecting the filter (PUF-5666).
|
|
435
433
|
formMethods.reset(updatedFormValues, {
|
|
436
434
|
keepDirty: false,
|
|
437
435
|
keepTouched: false,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"akifilter.d.ts","sourceRoot":"","sources":["../../src/akifilter.tsx"],"names":[],"mappings":"AAAA,OAAO,cAAc,CAAC;AAGtB,OAAO,EAIL,WAAW,EACX,IAAI,EAIL,MAAM,iBAAiB,CAAC;AAIzB,OAAO,EAAY,KAAK,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAShE,OAAO,KAAK,MAAM,OAAO,CAAC;AAa1B,OAAO,EACL,KAAK,aAAa,EAEnB,MAAM,8BAA8B,CAAC;AActC,OAAO,KAAK,EACV,mBAAmB,EAEnB,eAAe,EAChB,MAAM,SAAS,CAAC;AAcjB,KAAK,oBAAoB,GAAG,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"akifilter.d.ts","sourceRoot":"","sources":["../../src/akifilter.tsx"],"names":[],"mappings":"AAAA,OAAO,cAAc,CAAC;AAGtB,OAAO,EAIL,WAAW,EACX,IAAI,EAIL,MAAM,iBAAiB,CAAC;AAIzB,OAAO,EAAY,KAAK,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAShE,OAAO,KAAK,MAAM,OAAO,CAAC;AAa1B,OAAO,EACL,KAAK,aAAa,EAEnB,MAAM,8BAA8B,CAAC;AActC,OAAO,KAAK,EACV,mBAAmB,EAEnB,eAAe,EAChB,MAAM,SAAS,CAAC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/esm/akifilter.js
CHANGED
|
@@ -108,7 +108,10 @@ const resolveClearedFieldValue = (field, defaultValue) => {
|
|
|
108
108
|
return [];
|
|
109
109
|
}
|
|
110
110
|
return null;
|
|
111
|
+
// Custom fields must clear to `null`, not `undefined` (PUF-5666): otherwise
|
|
112
|
+
// react-hook-form rewrites the cleared value as a "zombie" and resurrects the filter.
|
|
111
113
|
case FIELD_TYPES.FILE:
|
|
114
|
+
case FIELD_TYPES.CUSTOM:
|
|
112
115
|
return null;
|
|
113
116
|
default:
|
|
114
117
|
return undefined;
|
|
@@ -266,16 +269,6 @@ const AkifilterContent = ({ filterSchema, storageNamespace, defaultValues, onVal
|
|
|
266
269
|
writeVisibleKeys(storageKey, visibleKeys);
|
|
267
270
|
onVisibleFieldsChange === null || onVisibleFieldsChange === void 0 ? void 0 : onVisibleFieldsChange(visibleKeys);
|
|
268
271
|
}, [visibleKeys, onVisibleFieldsChange, storageKey]);
|
|
269
|
-
// Track previous mergedDefaultValues to avoid unnecessary resets
|
|
270
|
-
const previousMergedDefaultValuesRef = React.useRef(null);
|
|
271
|
-
React.useEffect(() => {
|
|
272
|
-
const serialised = JSON.stringify(mergedDefaultValues);
|
|
273
|
-
// Skip if the values haven't actually changed (deep comparison)
|
|
274
|
-
if (previousMergedDefaultValuesRef.current === serialised) {
|
|
275
|
-
return;
|
|
276
|
-
}
|
|
277
|
-
previousMergedDefaultValuesRef.current = serialised;
|
|
278
|
-
}, [mergedDefaultValues]);
|
|
279
272
|
const normalisedValues = React.useMemo(() => normaliseOutputValues(flattenedSchema, formValues), [flattenedSchema, formValues]);
|
|
280
273
|
const hasInitialValuesRef = React.useRef(false);
|
|
281
274
|
React.useEffect(() => {
|
|
@@ -376,6 +369,9 @@ const AkifilterContent = ({ filterSchema, storageNamespace, defaultValues, onVal
|
|
|
376
369
|
clearedDefaults[key] = resolved;
|
|
377
370
|
}
|
|
378
371
|
});
|
|
372
|
+
// clearedDefaults carries an explicit cleared value (e.g. `null` for custom/file
|
|
373
|
+
// fields) for every key, so reset overwrites stale values instead of leaving the
|
|
374
|
+
// field untouched and resurrecting the filter (PUF-5666).
|
|
379
375
|
formMethods.reset(clearedDefaults, {
|
|
380
376
|
keepDirty: false,
|
|
381
377
|
keepTouched: false
|
|
@@ -428,7 +424,9 @@ const AkifilterContent = ({ filterSchema, storageNamespace, defaultValues, onVal
|
|
|
428
424
|
const updatedFormValues = Object.assign(Object.assign({}, currentFormValues), { [String(schemaField.key)]: nextValue });
|
|
429
425
|
// Normalize the values (removes empty/undefined entries)
|
|
430
426
|
const nextValues = normaliseOutputValues(flattenedSchema, updatedFormValues);
|
|
431
|
-
//
|
|
427
|
+
// updatedFormValues holds an explicit cleared value (e.g. `null` for custom/file
|
|
428
|
+
// fields) for the removed key, so reset overwrites the stale value rather than
|
|
429
|
+
// leaving it in place and resurrecting the filter (PUF-5666).
|
|
432
430
|
formMethods.reset(updatedFormValues, {
|
|
433
431
|
keepDirty: false,
|
|
434
432
|
keepTouched: false,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@akinon/akifilter",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Akifilter is a filtering library for Akinon frontend applications.",
|
|
6
6
|
"type": "module",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"@akinon/ui-select": "1.4.13",
|
|
30
30
|
"@akinon/ui-space": "1.4.10",
|
|
31
31
|
"@akinon/ui-typography": "1.2.7",
|
|
32
|
-
"@akinon/ui-upload": "1.
|
|
32
|
+
"@akinon/ui-upload": "1.6.0"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"@types/lodash-es": "^4.17.12",
|