@steroidsjs/core 3.0.79 → 3.0.80
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/docs-autogen-result.json
CHANGED
|
@@ -13961,6 +13961,15 @@
|
|
|
13961
13961
|
"example": "true",
|
|
13962
13962
|
"defaultValue": null
|
|
13963
13963
|
},
|
|
13964
|
+
{
|
|
13965
|
+
"name": "multipleSeparator",
|
|
13966
|
+
"decorators": [],
|
|
13967
|
+
"description": "Разделитель между элементами, в случае, если выбрано несколько значений",
|
|
13968
|
+
"required": false,
|
|
13969
|
+
"type": "string",
|
|
13970
|
+
"example": "'; '",
|
|
13971
|
+
"defaultValue": null
|
|
13972
|
+
},
|
|
13964
13973
|
{
|
|
13965
13974
|
"name": "placeholder",
|
|
13966
13975
|
"decorators": [],
|
|
@@ -14177,7 +14186,7 @@
|
|
|
14177
14186
|
"decorators": [],
|
|
14178
14187
|
"description": "",
|
|
14179
14188
|
"required": true,
|
|
14180
|
-
"type": "{className: string, disabled: boolean, name: string, placeholder: string, type: string, value: string | number, onBlur: null, onChange: null}",
|
|
14189
|
+
"type": "{className: string, disabled: boolean, name: string, placeholder: string, type: string, value: string | number | string | number[], onBlur: null, onChange: null}",
|
|
14181
14190
|
"example": null
|
|
14182
14191
|
},
|
|
14183
14192
|
{
|
package/en.json
CHANGED
|
@@ -1016,6 +1016,7 @@
|
|
|
1016
1016
|
"Дополнительные данные которые попадут в дата аттрибут data-icon": "",
|
|
1017
1017
|
"Компоненты для подключения wysiwyg редактора": "",
|
|
1018
1018
|
"Текст при отсутствии элементов": "",
|
|
1019
|
+
"Разделитель между элементами, в случае, если выбрано несколько значений": "",
|
|
1019
1020
|
"Пропсы для отображения элемента": "",
|
|
1020
1021
|
"Отображать чекбоксы только на узлах, не имеющих вложенных элементов": "",
|
|
1021
1022
|
"View компонент для элемента дерева": "",
|
package/package.json
CHANGED
|
@@ -37,6 +37,12 @@ export interface IAutoCompleteFieldProps extends IBaseFieldProps, IDataProviderC
|
|
|
37
37
|
* @example 'Ничего не найдено'
|
|
38
38
|
*/
|
|
39
39
|
empty?: string;
|
|
40
|
+
/**
|
|
41
|
+
* Разделитель между элементами, в случае, если выбрано несколько значений
|
|
42
|
+
* @default ','
|
|
43
|
+
* @example '; '
|
|
44
|
+
*/
|
|
45
|
+
multipleSeparator?: string;
|
|
40
46
|
}
|
|
41
47
|
export interface IAutoCompleteFieldViewProps extends Omit<IAutoCompleteFieldProps, 'items'> {
|
|
42
48
|
items: IAutoCompleteItem[];
|
|
@@ -48,7 +54,7 @@ export interface IAutoCompleteFieldViewProps extends Omit<IAutoCompleteFieldProp
|
|
|
48
54
|
type: string;
|
|
49
55
|
name: string;
|
|
50
56
|
placeholder?: string;
|
|
51
|
-
value: string | number;
|
|
57
|
+
value: (string | number) | (string | number)[];
|
|
52
58
|
disabled: boolean;
|
|
53
59
|
onChange: (value: string) => void;
|
|
54
60
|
onBlur: (e: Event | React.FocusEvent) => void;
|
|
@@ -46,6 +46,7 @@ function AutoCompleteField(props) {
|
|
|
46
46
|
}), items = _b.items, isLoading = _b.isLoading, sourceItems = _b.sourceItems;
|
|
47
47
|
// Data select
|
|
48
48
|
var _c = (0, hooks_1.useDataSelect)({
|
|
49
|
+
multiple: props.multiple,
|
|
49
50
|
selectedIds: props.selectedIds,
|
|
50
51
|
primaryKey: props.primaryKey,
|
|
51
52
|
items: items,
|
|
@@ -95,8 +96,9 @@ function AutoCompleteField(props) {
|
|
|
95
96
|
}, [onBlur, onChange, props.disabled, props.input.name, props.input.value, props.inputProps, props.placeholder]);
|
|
96
97
|
//Sync with form
|
|
97
98
|
(0, react_1.useEffect)(function () {
|
|
98
|
-
props.
|
|
99
|
-
|
|
99
|
+
var newValues = props.multiple ? selectedIds : (selectedIds[0] || null);
|
|
100
|
+
props.input.onChange.call(null, newValues);
|
|
101
|
+
}, [props.input.onChange, props.multiple, selectedIds]);
|
|
100
102
|
var viewProps = (0, react_1.useMemo)(function () { return ({
|
|
101
103
|
inputProps: inputProps,
|
|
102
104
|
items: items,
|
|
@@ -119,10 +121,13 @@ function AutoCompleteField(props) {
|
|
|
119
121
|
className: props.className,
|
|
120
122
|
style: props.style,
|
|
121
123
|
showClear: props.showClear,
|
|
122
|
-
empty: props.empty
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
124
|
+
empty: props.empty,
|
|
125
|
+
multipleSeparator: props.multipleSeparator
|
|
126
|
+
}); }, [
|
|
127
|
+
inputProps, items, isLoading, hoveredId, selectedIds, onOpen, isOpened, onClose,
|
|
128
|
+
onClear, onItemHover, onItemSelect, props.primaryKey, props.size, props.placeholder,
|
|
129
|
+
props.disabled, props.required, props.items, props.className, props.style, props.showClear, props.empty, props.multipleSeparator
|
|
130
|
+
]);
|
|
126
131
|
return components.ui.renderView(props.view || 'form.AutoCompleteFieldView', viewProps);
|
|
127
132
|
}
|
|
128
133
|
AutoCompleteField.defaultProps = {
|
|
@@ -132,6 +137,7 @@ AutoCompleteField.defaultProps = {
|
|
|
132
137
|
disabled: false,
|
|
133
138
|
required: false,
|
|
134
139
|
showClear: false,
|
|
135
|
-
hasCloseOnSelect: true
|
|
140
|
+
hasCloseOnSelect: true,
|
|
141
|
+
multipleSeparator: ','
|
|
136
142
|
};
|
|
137
143
|
exports["default"] = (0, fieldWrapper_1["default"])(enums_1.FieldEnum.AUTO_COMPLETE_FIELD, AutoCompleteField);
|