@akinon/akifilter 1.2.0-next.3 → 1.2.0-next.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/akifilter.d.ts.map +1 -1
- package/dist/cjs/akifilter.js +31 -0
- package/dist/esm/akifilter.d.ts.map +1 -1
- package/dist/esm/akifilter.js +31 -0
- package/package.json +10 -10
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"akifilter.d.ts","sourceRoot":"","sources":["../../src/akifilter.tsx"],"names":[],"mappings":"AAAA,OAAO,cAAc,CAAC;AAGtB,OAAO,EAIL,WAAW,EAEX,IAAI,EAGL,MAAM,iBAAiB,CAAC;AAWzB,OAAO,KAAK,MAAM,OAAO,CAAC;AA0B1B,OAAO,KAAK,EAAkB,eAAe,EAAE,MAAM,SAAS,CAAC;AAY/D,KAAK,oBAAoB,GAAG,WAAW,CAAC;AA2DxC,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;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,IAAI,CAAC;IACzB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,IAAI,CAAC;IACzB;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,IAAI,CAAC;IACxB;;OAEG;IACH,eAAe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CAAC"}
|
package/dist/cjs/akifilter.js
CHANGED
|
@@ -245,6 +245,36 @@ const AkifilterContent = ({ filterSchema, storageNamespace, defaultValues, onVal
|
|
|
245
245
|
react_1.default.useEffect(() => {
|
|
246
246
|
lastPersistedValuesRef.current = null;
|
|
247
247
|
}, [storageKey]);
|
|
248
|
+
// Track previous serialised values to detect field removals
|
|
249
|
+
const previousSerialisedValuesRef = react_1.default.useRef(serialisedValues);
|
|
250
|
+
// Immediate effect for field removals (bypasses debounce)
|
|
251
|
+
react_1.default.useEffect(() => {
|
|
252
|
+
const previous = previousSerialisedValuesRef.current;
|
|
253
|
+
const current = serialisedValues;
|
|
254
|
+
previousSerialisedValuesRef.current = current;
|
|
255
|
+
// Skip if this is the initial render
|
|
256
|
+
if (!hasEmittedValuesRef.current) {
|
|
257
|
+
return;
|
|
258
|
+
}
|
|
259
|
+
// Skip if values haven't actually changed
|
|
260
|
+
if (previous === current) {
|
|
261
|
+
return;
|
|
262
|
+
}
|
|
263
|
+
const prevParsed = JSON.parse(previous);
|
|
264
|
+
const currParsed = JSON.parse(current);
|
|
265
|
+
// Detect if a field was removed (existed in prev but not in current)
|
|
266
|
+
const prevKeys = Object.keys(prevParsed);
|
|
267
|
+
const currKeys = Object.keys(currParsed);
|
|
268
|
+
const removedKeys = prevKeys.filter(key => !currKeys.includes(key));
|
|
269
|
+
// If a field was removed, immediately persist and emit (bypass debounce)
|
|
270
|
+
if (removedKeys.length > 0) {
|
|
271
|
+
const nextSerialised = current;
|
|
272
|
+
persistValues(currParsed, nextSerialised);
|
|
273
|
+
lastPersistedValuesRef.current = nextSerialised;
|
|
274
|
+
currentSerialisedValuesRef.current = nextSerialised;
|
|
275
|
+
onValuesChange === null || onValuesChange === void 0 ? void 0 : onValuesChange(currParsed);
|
|
276
|
+
}
|
|
277
|
+
}, [serialisedValues, onValuesChange, persistValues]);
|
|
248
278
|
const handleClearAll = react_1.default.useCallback(() => {
|
|
249
279
|
const clearedDefaults = Object.assign({}, schemaDefaults);
|
|
250
280
|
flattenedSchema.forEach(field => {
|
|
@@ -322,6 +352,7 @@ const AkifilterContent = ({ filterSchema, storageNamespace, defaultValues, onVal
|
|
|
322
352
|
// Update refs to mark this as the latest persisted state
|
|
323
353
|
lastPersistedValuesRef.current = nextSerialised;
|
|
324
354
|
currentSerialisedValuesRef.current = nextSerialised;
|
|
355
|
+
previousSerialisedValuesRef.current = nextSerialised; // Prevent immediate effect from re-emitting
|
|
325
356
|
hasEmittedValuesRef.current = true;
|
|
326
357
|
hasInitialValuesRef.current = Object.keys(nextValues).length > 0;
|
|
327
358
|
// Emit the change to parent
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"akifilter.d.ts","sourceRoot":"","sources":["../../src/akifilter.tsx"],"names":[],"mappings":"AAAA,OAAO,cAAc,CAAC;AAGtB,OAAO,EAIL,WAAW,EAEX,IAAI,EAGL,MAAM,iBAAiB,CAAC;AAWzB,OAAO,KAAK,MAAM,OAAO,CAAC;AA0B1B,OAAO,KAAK,EAAkB,eAAe,EAAE,MAAM,SAAS,CAAC;AAY/D,KAAK,oBAAoB,GAAG,WAAW,CAAC;AA2DxC,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;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,IAAI,CAAC;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CAAC,EAAE,OAAO,CAAC;CAC3B,CAAC;AA0uBF,eAAO,MAAM,SAAS;KACpB,YAAY,SAAS,oBAAoB,uBAElC,cAAc,CAAC,YAAY,CAAC;;CAmBpC,CAAC"}
|
package/dist/esm/akifilter.js
CHANGED
|
@@ -242,6 +242,36 @@ const AkifilterContent = ({ filterSchema, storageNamespace, defaultValues, onVal
|
|
|
242
242
|
React.useEffect(() => {
|
|
243
243
|
lastPersistedValuesRef.current = null;
|
|
244
244
|
}, [storageKey]);
|
|
245
|
+
// Track previous serialised values to detect field removals
|
|
246
|
+
const previousSerialisedValuesRef = React.useRef(serialisedValues);
|
|
247
|
+
// Immediate effect for field removals (bypasses debounce)
|
|
248
|
+
React.useEffect(() => {
|
|
249
|
+
const previous = previousSerialisedValuesRef.current;
|
|
250
|
+
const current = serialisedValues;
|
|
251
|
+
previousSerialisedValuesRef.current = current;
|
|
252
|
+
// Skip if this is the initial render
|
|
253
|
+
if (!hasEmittedValuesRef.current) {
|
|
254
|
+
return;
|
|
255
|
+
}
|
|
256
|
+
// Skip if values haven't actually changed
|
|
257
|
+
if (previous === current) {
|
|
258
|
+
return;
|
|
259
|
+
}
|
|
260
|
+
const prevParsed = JSON.parse(previous);
|
|
261
|
+
const currParsed = JSON.parse(current);
|
|
262
|
+
// Detect if a field was removed (existed in prev but not in current)
|
|
263
|
+
const prevKeys = Object.keys(prevParsed);
|
|
264
|
+
const currKeys = Object.keys(currParsed);
|
|
265
|
+
const removedKeys = prevKeys.filter(key => !currKeys.includes(key));
|
|
266
|
+
// If a field was removed, immediately persist and emit (bypass debounce)
|
|
267
|
+
if (removedKeys.length > 0) {
|
|
268
|
+
const nextSerialised = current;
|
|
269
|
+
persistValues(currParsed, nextSerialised);
|
|
270
|
+
lastPersistedValuesRef.current = nextSerialised;
|
|
271
|
+
currentSerialisedValuesRef.current = nextSerialised;
|
|
272
|
+
onValuesChange === null || onValuesChange === void 0 ? void 0 : onValuesChange(currParsed);
|
|
273
|
+
}
|
|
274
|
+
}, [serialisedValues, onValuesChange, persistValues]);
|
|
245
275
|
const handleClearAll = React.useCallback(() => {
|
|
246
276
|
const clearedDefaults = Object.assign({}, schemaDefaults);
|
|
247
277
|
flattenedSchema.forEach(field => {
|
|
@@ -319,6 +349,7 @@ const AkifilterContent = ({ filterSchema, storageNamespace, defaultValues, onVal
|
|
|
319
349
|
// Update refs to mark this as the latest persisted state
|
|
320
350
|
lastPersistedValuesRef.current = nextSerialised;
|
|
321
351
|
currentSerialisedValuesRef.current = nextSerialised;
|
|
352
|
+
previousSerialisedValuesRef.current = nextSerialised; // Prevent immediate effect from re-emitting
|
|
322
353
|
hasEmittedValuesRef.current = true;
|
|
323
354
|
hasInitialValuesRef.current = Object.keys(nextValues).length > 0;
|
|
324
355
|
// Emit the change to parent
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@akinon/akifilter",
|
|
3
|
-
"version": "1.2.0-next.
|
|
3
|
+
"version": "1.2.0-next.5",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Akifilter is a filtering library for Akinon frontend applications.",
|
|
6
6
|
"type": "module",
|
|
@@ -16,29 +16,29 @@
|
|
|
16
16
|
"@akinon/akilocale": "1.2.1",
|
|
17
17
|
"@akinon/icons": "1.1.2-next.1",
|
|
18
18
|
"@akinon/ui-button": "1.4.0-next.1",
|
|
19
|
-
"@akinon/akidate": "1.1.3-next.0",
|
|
20
19
|
"@akinon/ui-card": "1.1.3-next.1",
|
|
21
20
|
"@akinon/ui-checkbox": "1.3.3-next.1",
|
|
22
|
-
"@akinon/
|
|
21
|
+
"@akinon/akidate": "1.1.3-next.0",
|
|
23
22
|
"@akinon/ui-collapse": "1.3.2-next.1",
|
|
24
|
-
"@akinon/ui-
|
|
23
|
+
"@akinon/ui-date-picker": "1.3.3-next.1",
|
|
25
24
|
"@akinon/ui-input-number": "1.3.3-next.1",
|
|
26
|
-
"@akinon/ui-modal": "1.1.3-next.1",
|
|
27
25
|
"@akinon/ui-pagination": "1.3.4-next.1",
|
|
28
|
-
"@akinon/ui-select": "1.3.4-next.1",
|
|
29
26
|
"@akinon/ui-space": "1.3.3-next.1",
|
|
30
|
-
"@akinon/ui-
|
|
27
|
+
"@akinon/ui-select": "1.3.4-next.1",
|
|
28
|
+
"@akinon/ui-input": "1.1.3-next.1",
|
|
29
|
+
"@akinon/ui-typography": "1.1.2-next.0",
|
|
30
|
+
"@akinon/ui-modal": "1.1.3-next.1"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"clean-package": "2.2.0",
|
|
34
34
|
"copyfiles": "^2.4.1",
|
|
35
35
|
"rimraf": "^5.0.5",
|
|
36
36
|
"typescript": "*",
|
|
37
|
-
"@akinon/akiform-builder": "1.3.5-next.1",
|
|
38
37
|
"@akinon/typescript-config": "1.1.1",
|
|
38
|
+
"@akinon/akiform-builder": "1.3.5-next.1",
|
|
39
39
|
"@akinon/ui-theme": "1.1.3-next.1",
|
|
40
|
-
"@akinon/
|
|
41
|
-
"@akinon/
|
|
40
|
+
"@akinon/utils": "1.1.4-next.1",
|
|
41
|
+
"@akinon/vitest-config": "1.1.1"
|
|
42
42
|
},
|
|
43
43
|
"peerDependencies": {
|
|
44
44
|
"react": "^18 || ^19",
|