@dilicorp/ui 0.2.39 → 0.2.40
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/components/page-list/filters/filter-async-select-group/filter-async-select.d.ts +2 -1
- package/dist/components/page-list/filters/filter-async-select-group/filter-async-select.js +6 -1
- package/dist/components/page-list/filters/filter-async-select-group/filter-group.d.ts +1 -0
- package/dist/components/page-list/filters/filter-async-select-group/filter-group.js +8 -2
- package/dist/components/page-list/filters/filter-async-select-group/index.d.ts +5 -5
- package/package.json +1 -1
package/dist/components/page-list/filters/filter-async-select-group/filter-async-select.d.ts
CHANGED
|
@@ -12,7 +12,8 @@ declare type FilterAsyncSelectProps = {
|
|
|
12
12
|
placeholder: string;
|
|
13
13
|
defaultOptions?: Option[];
|
|
14
14
|
id?: string;
|
|
15
|
-
|
|
15
|
+
labelName?: string;
|
|
16
|
+
value?: Option;
|
|
16
17
|
isDisabled?: boolean;
|
|
17
18
|
isLoading?: boolean;
|
|
18
19
|
isClearable?: boolean;
|
|
@@ -16,8 +16,13 @@ export const FilterAsyncSelect = (props) => {
|
|
|
16
16
|
}, action);
|
|
17
17
|
}
|
|
18
18
|
}, []);
|
|
19
|
+
const finalDefaultOptions = value
|
|
20
|
+
? [
|
|
21
|
+
value
|
|
22
|
+
]
|
|
23
|
+
: defaultOptions;
|
|
19
24
|
return (React.createElement("div", { className: "form-group label-margin" },
|
|
20
25
|
Boolean(label) && React.createElement("label", { className: "form-label new-label", htmlFor: name }, label),
|
|
21
|
-
React.createElement(AsyncSelect, { placeholder: placeholder, className: "form-builder-select", classNamePrefix: "form-builder", defaultOptions:
|
|
26
|
+
React.createElement(AsyncSelect, { placeholder: placeholder, className: "form-builder-select", classNamePrefix: "form-builder", defaultOptions: finalDefaultOptions, name: name, id: id, defaultValue: value, value: value, isDisabled: isDisabled, isLoading: isLoading, isClearable: isClearable, isSearchable: isSearchable, isMulti: isMulti, cacheOptions: cacheOptions, loadOptions: loadOptions, onChange: handleChange }),
|
|
22
27
|
Boolean(message) && React.createElement("label", { className: "form-label new-message", htmlFor: name }, message)));
|
|
23
28
|
};
|
|
@@ -7,12 +7,18 @@ export const FilterGroupSelect = (props) => {
|
|
|
7
7
|
const [internalValue, setInternalValue] = React.useState(defaultOptions === null || defaultOptions === void 0 ? void 0 : defaultOptions.find(option => (option === null || option === void 0 ? void 0 : option.value) === value));
|
|
8
8
|
const [internalOptions, setInternalOptions] = React.useState(defaultOptions || []);
|
|
9
9
|
const prepareFields = React.useCallback(({ key, field, value, defaultOptions }) => {
|
|
10
|
-
const { size } = field === null || field === void 0 ? void 0 : field.props;
|
|
10
|
+
const { size, labelName } = field === null || field === void 0 ? void 0 : field.props;
|
|
11
|
+
const labelValue = labelName && value
|
|
12
|
+
? {
|
|
13
|
+
...value,
|
|
14
|
+
label: (value === null || value === void 0 ? void 0 : value[labelName]) || (value === null || value === void 0 ? void 0 : value.label)
|
|
15
|
+
}
|
|
16
|
+
: value;
|
|
11
17
|
const clone = React.cloneElement(field, {
|
|
12
18
|
key,
|
|
13
19
|
size,
|
|
14
|
-
value,
|
|
15
20
|
defaultOptions,
|
|
21
|
+
value: labelValue,
|
|
16
22
|
onChange: (newValue) => {
|
|
17
23
|
var _a, _b;
|
|
18
24
|
const value = (_a = newValue === null || newValue === void 0 ? void 0 : newValue.target) === null || _a === void 0 ? void 0 : _a.value;
|
|
@@ -6,12 +6,14 @@ export declare const Group: {
|
|
|
6
6
|
name: string;
|
|
7
7
|
value?: (string | number) | undefined;
|
|
8
8
|
defaultOptions?: ({
|
|
9
|
+
[name: string]: string | number;
|
|
9
10
|
label: string | number;
|
|
10
11
|
value: string | number;
|
|
11
12
|
} | undefined)[] | undefined;
|
|
12
13
|
children?: import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>[] | undefined;
|
|
13
14
|
size?: import("../../../..").columns | undefined;
|
|
14
15
|
onChange?: ((selected: {
|
|
16
|
+
[name: string]: string | number;
|
|
15
17
|
label: string | number;
|
|
16
18
|
value: string | number;
|
|
17
19
|
} | undefined) => void) | undefined;
|
|
@@ -26,13 +28,11 @@ export declare const Group: {
|
|
|
26
28
|
value: string | number;
|
|
27
29
|
}[] | undefined;
|
|
28
30
|
id?: string | undefined;
|
|
29
|
-
|
|
31
|
+
labelName?: string | undefined;
|
|
32
|
+
value?: {
|
|
30
33
|
label: string | number;
|
|
31
34
|
value: string | number;
|
|
32
|
-
} |
|
|
33
|
-
label: string | number;
|
|
34
|
-
value: string | number;
|
|
35
|
-
}[] | undefined;
|
|
35
|
+
} | undefined;
|
|
36
36
|
isDisabled?: boolean | undefined;
|
|
37
37
|
isLoading?: boolean | undefined;
|
|
38
38
|
isClearable?: boolean | undefined;
|