@akinon/akifilter 1.2.0-next.8 → 1.2.0-next.9
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,
|
|
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;AAWzB,OAAO,KAAK,MAAM,OAAO,CAAC;AA0B1B,OAAO,KAAK,EAAkB,eAAe,EAAE,MAAM,SAAS,CAAC;AAY/D,KAAK,oBAAoB,GAAG,WAAW,CAAC;AA0HxC,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;AA2vBF,eAAO,MAAM,SAAS;KACpB,YAAY,SAAS,oBAAoB,uBAElC,cAAc,CAAC,YAAY,CAAC;;CAmBpC,CAAC"}
|
package/dist/cjs/akifilter.js
CHANGED
|
@@ -37,6 +37,32 @@ const use_debounced_value_1 = require("./hooks/use-debounced-value");
|
|
|
37
37
|
const i18n_1 = require("./i18n");
|
|
38
38
|
const schema_1 = require("./utils/schema");
|
|
39
39
|
const values_1 = require("./utils/values");
|
|
40
|
+
const FilterFormItem = (_a) => {
|
|
41
|
+
var _b, _c;
|
|
42
|
+
var { children, control, name, valuePropName } = _a, props = __rest(_a, ["children", "control", "name", "valuePropName"]);
|
|
43
|
+
const { field, fieldState } = (0, akiform_1.useController)({ name, control });
|
|
44
|
+
const childrenWithProps = react_1.default.Children.map(children, child => {
|
|
45
|
+
if (react_1.default.isValidElement(child)) {
|
|
46
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
47
|
+
const typedChild = child;
|
|
48
|
+
return react_1.default.cloneElement(typedChild, Object.assign(Object.assign(Object.assign({}, field), {
|
|
49
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
50
|
+
onChange: (...params) => {
|
|
51
|
+
var _a, _b;
|
|
52
|
+
(_b = (_a = typedChild.props).onChange) === null || _b === void 0 ? void 0 : _b.call(_a, params);
|
|
53
|
+
field.onChange(...params);
|
|
54
|
+
}, onBlur: () => {
|
|
55
|
+
var _a, _b;
|
|
56
|
+
(_b = (_a = typedChild.props).onBlur) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
57
|
+
field.onBlur();
|
|
58
|
+
}, ref: undefined }), (valuePropName && {
|
|
59
|
+
[valuePropName]: field.value
|
|
60
|
+
})));
|
|
61
|
+
}
|
|
62
|
+
return child;
|
|
63
|
+
});
|
|
64
|
+
return (react_1.default.createElement(akiform_1.Akiform.Item, Object.assign({}, props, { validateStatus: fieldState.invalid ? 'error' : undefined, help: (_c = (_b = fieldState.error) === null || _b === void 0 ? void 0 : _b.message) !== null && _c !== void 0 ? _c : props.help, className: props.className }), childrenWithProps));
|
|
65
|
+
};
|
|
40
66
|
/**
|
|
41
67
|
* Checks if a field should be disabled based on config.disabled property.
|
|
42
68
|
*/
|
|
@@ -432,7 +458,7 @@ const AkifilterContent = ({ filterSchema, storageNamespace, defaultValues, onVal
|
|
|
432
458
|
}
|
|
433
459
|
};
|
|
434
460
|
const renderFormField = (field) => {
|
|
435
|
-
return (react_1.default.createElement(
|
|
461
|
+
return (react_1.default.createElement(FilterFormItem, { key: String(field.key), control: formMethods.control, name: field.key, tooltip: field.tooltip, help: field.help, labelDescription: field.labelDescription, required: Boolean(field.validation), className: "mb-0", valuePropName: field.type === 'checkbox' ? 'checked' : undefined }, renderFieldComponent(field)));
|
|
436
462
|
};
|
|
437
463
|
return (react_1.default.createElement(ui_card_1.Card, { size: "small", className: "akinon-filter shadow", "data-testid": "akifilter-root" },
|
|
438
464
|
react_1.default.createElement(antd_1.ConfigProvider, { theme: theme_overrides_1.themeOverrides },
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"akifilter.d.ts","sourceRoot":"","sources":["../../src/akifilter.tsx"],"names":[],"mappings":"AAAA,OAAO,cAAc,CAAC;AAGtB,OAAO,EAIL,WAAW,
|
|
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;AAWzB,OAAO,KAAK,MAAM,OAAO,CAAC;AA0B1B,OAAO,KAAK,EAAkB,eAAe,EAAE,MAAM,SAAS,CAAC;AAY/D,KAAK,oBAAoB,GAAG,WAAW,CAAC;AA0HxC,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;AA2vBF,eAAO,MAAM,SAAS;KACpB,YAAY,SAAS,oBAAoB,uBAElC,cAAc,CAAC,YAAY,CAAC;;CAmBpC,CAAC"}
|
package/dist/esm/akifilter.js
CHANGED
|
@@ -11,7 +11,7 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
11
11
|
};
|
|
12
12
|
import './styles.css';
|
|
13
13
|
import { akidate } from '@akinon/akidate';
|
|
14
|
-
import { Akiform,
|
|
14
|
+
import { Akiform, useController, useForm, useWatch } from '@akinon/akiform';
|
|
15
15
|
import { Button } from '@akinon/ui-button';
|
|
16
16
|
import { Card } from '@akinon/ui-card';
|
|
17
17
|
import { Checkbox } from '@akinon/ui-checkbox';
|
|
@@ -34,6 +34,32 @@ import { useDebouncedValue } from './hooks/use-debounced-value';
|
|
|
34
34
|
import { i18n } from './i18n';
|
|
35
35
|
import { deriveDefaultVisibleKeys, ensureSchemaOrder, extractDefaultValues, flattenSchema, getFieldAriaLabel, normaliseValuesBySchema, partitionSchema } from './utils/schema';
|
|
36
36
|
import { normaliseOutputValues } from './utils/values';
|
|
37
|
+
const FilterFormItem = (_a) => {
|
|
38
|
+
var _b, _c;
|
|
39
|
+
var { children, control, name, valuePropName } = _a, props = __rest(_a, ["children", "control", "name", "valuePropName"]);
|
|
40
|
+
const { field, fieldState } = useController({ name, control });
|
|
41
|
+
const childrenWithProps = React.Children.map(children, child => {
|
|
42
|
+
if (React.isValidElement(child)) {
|
|
43
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
44
|
+
const typedChild = child;
|
|
45
|
+
return React.cloneElement(typedChild, Object.assign(Object.assign(Object.assign({}, field), {
|
|
46
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
47
|
+
onChange: (...params) => {
|
|
48
|
+
var _a, _b;
|
|
49
|
+
(_b = (_a = typedChild.props).onChange) === null || _b === void 0 ? void 0 : _b.call(_a, params);
|
|
50
|
+
field.onChange(...params);
|
|
51
|
+
}, onBlur: () => {
|
|
52
|
+
var _a, _b;
|
|
53
|
+
(_b = (_a = typedChild.props).onBlur) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
54
|
+
field.onBlur();
|
|
55
|
+
}, ref: undefined }), (valuePropName && {
|
|
56
|
+
[valuePropName]: field.value
|
|
57
|
+
})));
|
|
58
|
+
}
|
|
59
|
+
return child;
|
|
60
|
+
});
|
|
61
|
+
return (React.createElement(Akiform.Item, Object.assign({}, props, { validateStatus: fieldState.invalid ? 'error' : undefined, help: (_c = (_b = fieldState.error) === null || _b === void 0 ? void 0 : _b.message) !== null && _c !== void 0 ? _c : props.help, className: props.className }), childrenWithProps));
|
|
62
|
+
};
|
|
37
63
|
/**
|
|
38
64
|
* Checks if a field should be disabled based on config.disabled property.
|
|
39
65
|
*/
|
|
@@ -429,7 +455,7 @@ const AkifilterContent = ({ filterSchema, storageNamespace, defaultValues, onVal
|
|
|
429
455
|
}
|
|
430
456
|
};
|
|
431
457
|
const renderFormField = (field) => {
|
|
432
|
-
return (React.createElement(
|
|
458
|
+
return (React.createElement(FilterFormItem, { key: String(field.key), control: formMethods.control, name: field.key, tooltip: field.tooltip, help: field.help, labelDescription: field.labelDescription, required: Boolean(field.validation), className: "mb-0", valuePropName: field.type === 'checkbox' ? 'checked' : undefined }, renderFieldComponent(field)));
|
|
433
459
|
};
|
|
434
460
|
return (React.createElement(Card, { size: "small", className: "akinon-filter shadow", "data-testid": "akifilter-root" },
|
|
435
461
|
React.createElement(ConfigProvider, { theme: themeOverrides },
|
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.9",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Akifilter is a filtering library for Akinon frontend applications.",
|
|
6
6
|
"type": "module",
|
|
@@ -12,22 +12,22 @@
|
|
|
12
12
|
"dependencies": {
|
|
13
13
|
"antd": "^5.27.0",
|
|
14
14
|
"react-error-boundary": "^6.0.0",
|
|
15
|
+
"@akinon/ui-card": "1.1.3-next.1",
|
|
15
16
|
"@akinon/akiform": "1.1.2",
|
|
16
|
-
"@akinon/icons": "1.1.2-next.1",
|
|
17
17
|
"@akinon/akilocale": "1.2.1",
|
|
18
18
|
"@akinon/ui-button": "1.4.0-next.1",
|
|
19
|
-
"@akinon/ui-card": "1.1.3-next.1",
|
|
20
|
-
"@akinon/ui-collapse": "1.3.2-next.1",
|
|
21
19
|
"@akinon/ui-checkbox": "1.3.3-next.1",
|
|
22
|
-
"@akinon/
|
|
20
|
+
"@akinon/akidate": "1.1.3-next.0",
|
|
23
21
|
"@akinon/ui-input": "1.1.3-next.1",
|
|
22
|
+
"@akinon/ui-collapse": "1.3.2-next.1",
|
|
24
23
|
"@akinon/ui-input-number": "1.3.3-next.1",
|
|
25
|
-
"@akinon/ui-pagination": "1.3.4-next.1",
|
|
26
24
|
"@akinon/ui-modal": "1.1.3-next.1",
|
|
27
|
-
"@akinon/ui-select": "1.3.4-next.1",
|
|
28
|
-
"@akinon/ui-space": "1.3.3-next.1",
|
|
29
25
|
"@akinon/ui-typography": "1.1.2-next.0",
|
|
30
|
-
"@akinon/
|
|
26
|
+
"@akinon/ui-date-picker": "1.3.3-next.1",
|
|
27
|
+
"@akinon/ui-select": "1.3.4-next.1",
|
|
28
|
+
"@akinon/ui-pagination": "1.3.4-next.1",
|
|
29
|
+
"@akinon/icons": "1.1.2-next.1",
|
|
30
|
+
"@akinon/ui-space": "1.3.3-next.1"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"clean-package": "2.2.0",
|