@akinon/akifilter 1.2.0-next.3 → 1.2.0-next.4

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,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,CAAC,EAAE,OAAO,CAAC;IAC1B;;OAEG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B,CAAC;AAmsBF,eAAO,MAAM,SAAS;KACpB,YAAY,SAAS,oBAAoB,uBAElC,cAAc,CAAC,YAAY,CAAC;;CAmBpC,CAAC"}
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,CAAC,EAAE,OAAO,CAAC;IAC1B;;OAEG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B,CAAC;AAyuBF,eAAO,MAAM,SAAS;KACpB,YAAY,SAAS,oBAAoB,uBAElC,cAAc,CAAC,YAAY,CAAC;;CAmBpC,CAAC"}
@@ -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 => {
@@ -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,W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F;;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,CAAC,EAAE,OAAO,CAAC;IAC1B;;OAEG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B,CAAC;AAyuBF,eAAO,MAAM,SAAS;KACpB,YAAY,SAAS,oBAAoB,uBAElC,cAAc,CAAC,YAAY,CAAC;;CAmBpC,CAAC"}
@@ -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 => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@akinon/akifilter",
3
- "version": "1.2.0-next.3",
3
+ "version": "1.2.0-next.4",
4
4
  "private": false,
5
5
  "description": "Akifilter is a filtering library for Akinon frontend applications.",
6
6
  "type": "module",
@@ -13,14 +13,14 @@
13
13
  "antd": "^5.27.0",
14
14
  "react-error-boundary": "^6.0.0",
15
15
  "@akinon/akiform": "1.1.2",
16
+ "@akinon/akidate": "1.1.3-next.0",
16
17
  "@akinon/akilocale": "1.2.1",
17
18
  "@akinon/icons": "1.1.2-next.1",
18
19
  "@akinon/ui-button": "1.4.0-next.1",
19
- "@akinon/akidate": "1.1.3-next.0",
20
20
  "@akinon/ui-card": "1.1.3-next.1",
21
21
  "@akinon/ui-checkbox": "1.3.3-next.1",
22
- "@akinon/ui-date-picker": "1.3.3-next.1",
23
22
  "@akinon/ui-collapse": "1.3.2-next.1",
23
+ "@akinon/ui-date-picker": "1.3.3-next.1",
24
24
  "@akinon/ui-input": "1.1.3-next.1",
25
25
  "@akinon/ui-input-number": "1.3.3-next.1",
26
26
  "@akinon/ui-modal": "1.1.3-next.1",
@@ -35,10 +35,10 @@
35
35
  "rimraf": "^5.0.5",
36
36
  "typescript": "*",
37
37
  "@akinon/akiform-builder": "1.3.5-next.1",
38
- "@akinon/typescript-config": "1.1.1",
39
38
  "@akinon/ui-theme": "1.1.3-next.1",
40
- "@akinon/vitest-config": "1.1.1",
41
- "@akinon/utils": "1.1.4-next.1"
39
+ "@akinon/typescript-config": "1.1.1",
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",