@laser-ui/components 2.3.3 → 2.3.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/CHANGELOG.md +12 -0
- package/cascader/Cascader.js +9 -5
- package/checkbox/Checkbox.js +4 -1
- package/checkbox/CheckboxGroup.js +2 -1
- package/date-picker/DatePicker.js +5 -1
- package/input/Input.js +4 -1
- package/input/InputNumber.js +4 -1
- package/package.json +2 -2
- package/radio/Radio.js +4 -1
- package/select/Select.js +3 -5
- package/slider/Slider.js +45 -39
- package/switch/Switch.js +4 -1
- package/time-picker/TimePicker.js +5 -1
- package/transfer/Transfer.js +1 -1
- package/tree/Tree.js +7 -1
- package/tree-select/TreeSelect.js +9 -5
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,18 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
## [2.3.5](https://github.com/laser-ui/laser-ui/compare/v2.3.4...v2.3.5) (2026-03-16)
|
|
6
|
+
|
|
7
|
+
### Bug Fixes
|
|
8
|
+
|
|
9
|
+
- **components:** fix pass class or style to `inputProps` ([1f7a6ba](https://github.com/laser-ui/laser-ui/commit/1f7a6ba7524742cb7095b2f335a87f91434203a0))
|
|
10
|
+
|
|
11
|
+
## [2.3.4](https://github.com/laser-ui/laser-ui/compare/v2.3.3...v2.3.4) (2026-03-06)
|
|
12
|
+
|
|
13
|
+
### Bug Fixes
|
|
14
|
+
|
|
15
|
+
- **components:** fix previously selected not included in the list when multiple selections ([d048837](https://github.com/laser-ui/laser-ui/commit/d048837295dd5fb2121625f7046d157d89f8559b))
|
|
16
|
+
|
|
5
17
|
## [2.3.3](https://github.com/laser-ui/laser-ui/compare/v2.3.2...v2.3.3) (2026-03-05)
|
|
6
18
|
|
|
7
19
|
### Bug Fixes
|
package/cascader/Cascader.js
CHANGED
|
@@ -65,7 +65,13 @@ export function Cascader(props) {
|
|
|
65
65
|
const [_selected, changeSelected] = useControlled(defaultModel !== null && defaultModel !== void 0 ? defaultModel : (multiple ? [] : null), model, (value) => {
|
|
66
66
|
if (onModelChange) {
|
|
67
67
|
if (multiple) {
|
|
68
|
-
onModelChange(value, value.map((v) =>
|
|
68
|
+
onModelChange(value, value.map((v) => {
|
|
69
|
+
const node = nodesMap.get(v);
|
|
70
|
+
if (node) {
|
|
71
|
+
return node.origin;
|
|
72
|
+
}
|
|
73
|
+
return null;
|
|
74
|
+
}));
|
|
69
75
|
}
|
|
70
76
|
else {
|
|
71
77
|
onModelChange(value, isNull(value) ? null : nodesMap.get(value).origin);
|
|
@@ -275,10 +281,8 @@ export function Cascader(props) {
|
|
|
275
281
|
changeVisible((draft) => (searchable ? true : !draft));
|
|
276
282
|
}, children: [_jsxs("div", Object.assign({}, styled('cascader__container'), { title: selectedLabel, children: [(() => {
|
|
277
283
|
const nodeProps = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, inputProps), mergeCS(styled('cascader__search'), {
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
zIndex: inputable ? undefined : -1,
|
|
281
|
-
},
|
|
284
|
+
className: inputProps === null || inputProps === void 0 ? void 0 : inputProps.className,
|
|
285
|
+
style: Object.assign(Object.assign({}, inputProps === null || inputProps === void 0 ? void 0 : inputProps.style), { opacity: inputable ? undefined : 0, zIndex: inputable ? undefined : -1 }),
|
|
282
286
|
})), formControl === null || formControl === void 0 ? void 0 : formControl.inputAria), { ref: (instance) => {
|
|
283
287
|
inputRef.current = instance;
|
|
284
288
|
const ret = setRef(inputProps === null || inputProps === void 0 ? void 0 : inputProps.ref, instance);
|
package/checkbox/Checkbox.js
CHANGED
|
@@ -17,7 +17,10 @@ export const Checkbox = (props) => {
|
|
|
17
17
|
}), {
|
|
18
18
|
className: restProps.className,
|
|
19
19
|
style: restProps.style,
|
|
20
|
-
}), { children: [_jsxs("div", Object.assign({}, styled('checkbox__state-container'), { children: [_jsx("input", Object.assign({}, inputProps, styled('checkbox__input'),
|
|
20
|
+
}), { children: [_jsxs("div", Object.assign({}, styled('checkbox__state-container'), { children: [_jsx("input", Object.assign({}, inputProps, mergeCS(styled('checkbox__input'), {
|
|
21
|
+
className: inputProps === null || inputProps === void 0 ? void 0 : inputProps.className,
|
|
22
|
+
style: inputProps === null || inputProps === void 0 ? void 0 : inputProps.style,
|
|
23
|
+
}), formControl === null || formControl === void 0 ? void 0 : formControl.inputAria, { type: "checkbox", disabled: disabled, "aria-checked": indeterminate ? 'mixed' : checked, onChange: () => {
|
|
21
24
|
changeChecked((draft) => !draft);
|
|
22
25
|
} })), indeterminate ? _jsx("div", Object.assign({}, styled('checkbox__indeterminate'))) : checked && _jsx("div", Object.assign({}, styled('checkbox__tick')))] })), checkNodeExist(children) && _jsx("div", Object.assign({}, styled('checkbox__label'), { children: children }))] })));
|
|
23
26
|
};
|
|
@@ -3,7 +3,8 @@ export function CheckboxGroup(props) {
|
|
|
3
3
|
const { children, formControl, list, model, defaultModel, disabled: disabledProp = false, onModelChange, } = useComponentProps('CheckboxGroup', props);
|
|
4
4
|
const [values, changeValues] = useControlled(defaultModel !== null && defaultModel !== void 0 ? defaultModel : [], model, (vals) => {
|
|
5
5
|
if (onModelChange) {
|
|
6
|
-
|
|
6
|
+
const listMap = new Map(list.map((o) => [o.value, o]));
|
|
7
|
+
onModelChange(vals, vals.map((val) => { var _a; return ((_a = listMap.get(val)) !== null && _a !== void 0 ? _a : null); }));
|
|
7
8
|
}
|
|
8
9
|
}, undefined, formControl === null || formControl === void 0 ? void 0 : formControl.control);
|
|
9
10
|
const { disabled } = useScopedProps({ disabled: disabledProp || (formControl === null || formControl === void 0 ? void 0 : formControl.control.disabled) });
|
|
@@ -191,10 +191,14 @@ export function DatePicker(props) {
|
|
|
191
191
|
};
|
|
192
192
|
const clearable = clearableProp && !isNull(_value) && !visible && !disabled;
|
|
193
193
|
const inputNode = (isLeft) => {
|
|
194
|
+
var _a, _b;
|
|
194
195
|
const index = isLeft ? 0 : 1;
|
|
195
196
|
const value = isLeft ? valueLeft : valueRight;
|
|
196
197
|
const inputRef = isLeft ? inputLeftRef : inputRightRef;
|
|
197
|
-
return (_jsx(BaseInput, Object.assign({}, inputProps === null || inputProps === void 0 ? void 0 : inputProps[index], styled('date-picker__input'),
|
|
198
|
+
return (_jsx(BaseInput, Object.assign({}, inputProps === null || inputProps === void 0 ? void 0 : inputProps[index], mergeCS(styled('date-picker__input'), {
|
|
199
|
+
className: (_a = inputProps === null || inputProps === void 0 ? void 0 : inputProps[index]) === null || _a === void 0 ? void 0 : _a.className,
|
|
200
|
+
style: (_b = inputProps === null || inputProps === void 0 ? void 0 : inputProps[index]) === null || _b === void 0 ? void 0 : _b.style,
|
|
201
|
+
}), formControl === null || formControl === void 0 ? void 0 : formControl.inputAria, { ref: (instance) => {
|
|
198
202
|
var _a;
|
|
199
203
|
inputRef.current = instance;
|
|
200
204
|
const ret = setRef((_a = inputProps === null || inputProps === void 0 ? void 0 : inputProps[index]) === null || _a === void 0 ? void 0 : _a.ref, instance);
|
package/input/Input.js
CHANGED
|
@@ -42,7 +42,10 @@ export const Input = (props) => {
|
|
|
42
42
|
var _a, _b;
|
|
43
43
|
(_a = restProps.onClick) === null || _a === void 0 ? void 0 : _a.call(restProps, e);
|
|
44
44
|
(_b = inputRef.current) === null || _b === void 0 ? void 0 : _b.focus({ preventScroll: true });
|
|
45
|
-
}, children: [checkNodeExist(prefix) && _jsx("div", Object.assign({}, styled('input__prefix'), { children: prefix })), _jsx(BaseInput, Object.assign({}, inputProps, styled('input__input'),
|
|
45
|
+
}, children: [checkNodeExist(prefix) && _jsx("div", Object.assign({}, styled('input__prefix'), { children: prefix })), _jsx(BaseInput, Object.assign({}, inputProps, mergeCS(styled('input__input'), {
|
|
46
|
+
className: inputProps === null || inputProps === void 0 ? void 0 : inputProps.className,
|
|
47
|
+
style: inputProps === null || inputProps === void 0 ? void 0 : inputProps.style,
|
|
48
|
+
}), formControl === null || formControl === void 0 ? void 0 : formControl.inputAria, { ref: (instance) => {
|
|
46
49
|
inputRef.current = instance;
|
|
47
50
|
const ret = setRef(inputProps === null || inputProps === void 0 ? void 0 : inputProps.ref, instance);
|
|
48
51
|
return () => {
|
package/input/InputNumber.js
CHANGED
|
@@ -85,7 +85,10 @@ export function InputNumber(props) {
|
|
|
85
85
|
var _a, _b;
|
|
86
86
|
(_a = restProps.onClick) === null || _a === void 0 ? void 0 : _a.call(restProps, e);
|
|
87
87
|
(_b = inputRef.current) === null || _b === void 0 ? void 0 : _b.focus({ preventScroll: true });
|
|
88
|
-
}, children: [checkNodeExist(prefix) && _jsx("div", Object.assign({}, styled('input__prefix'), { children: prefix })), _jsx(BaseInput, Object.assign({}, inputProps, styled('input__input'),
|
|
88
|
+
}, children: [checkNodeExist(prefix) && _jsx("div", Object.assign({}, styled('input__prefix'), { children: prefix })), _jsx(BaseInput, Object.assign({}, inputProps, mergeCS(styled('input__input'), {
|
|
89
|
+
className: inputProps === null || inputProps === void 0 ? void 0 : inputProps.className,
|
|
90
|
+
style: inputProps === null || inputProps === void 0 ? void 0 : inputProps.style,
|
|
91
|
+
}), formControl === null || formControl === void 0 ? void 0 : formControl.inputAria, { ref: (instance) => {
|
|
89
92
|
inputRef.current = instance;
|
|
90
93
|
const ret = setRef(inputProps === null || inputProps === void 0 ? void 0 : inputProps.ref, instance);
|
|
91
94
|
return () => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@laser-ui/components",
|
|
3
|
-
"version": "2.3.
|
|
3
|
+
"version": "2.3.5",
|
|
4
4
|
"description": "React components.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ui",
|
|
@@ -37,5 +37,5 @@
|
|
|
37
37
|
"access": "public",
|
|
38
38
|
"directory": "../../dist/libs/components"
|
|
39
39
|
},
|
|
40
|
-
"gitHead": "
|
|
40
|
+
"gitHead": "e51fff3eacbe15668fbce67291124b3bb36d19c3"
|
|
41
41
|
}
|
package/radio/Radio.js
CHANGED
|
@@ -36,7 +36,10 @@ export const Radio = (props) => {
|
|
|
36
36
|
return () => {
|
|
37
37
|
waveRef.current = null;
|
|
38
38
|
};
|
|
39
|
-
}, color: `var(--${namespace}-color-primary)` }), _jsx("div", Object.assign({}, styled('radio__input-wrapper'), { children: _jsx("input", Object.assign({}, inputProps, styled('radio__input'),
|
|
39
|
+
}, color: `var(--${namespace}-color-primary)` }), _jsx("div", Object.assign({}, styled('radio__input-wrapper'), { children: _jsx("input", Object.assign({}, inputProps, mergeCS(styled('radio__input'), {
|
|
40
|
+
className: inputProps === null || inputProps === void 0 ? void 0 : inputProps.className,
|
|
41
|
+
style: inputProps === null || inputProps === void 0 ? void 0 : inputProps.style,
|
|
42
|
+
}), formControl === null || formControl === void 0 ? void 0 : formControl.inputAria, { type: "radio", checked: checked, disabled: disabled, "aria-checked": checked, onChange: () => {
|
|
40
43
|
changeChecked(true);
|
|
41
44
|
} })) })), checkNodeExist(children) && _jsx("div", Object.assign({}, styled('radio__label'), { children: children }))] })));
|
|
42
45
|
};
|
package/select/Select.js
CHANGED
|
@@ -58,7 +58,7 @@ export function Select(props) {
|
|
|
58
58
|
const [_selected, changeSelected] = useControlled(defaultModel !== null && defaultModel !== void 0 ? defaultModel : (multiple ? [] : null), model, (value) => {
|
|
59
59
|
if (onModelChange) {
|
|
60
60
|
if (multiple) {
|
|
61
|
-
onModelChange(value, value.map((v) => itemsMap.get(v)));
|
|
61
|
+
onModelChange(value, value.map((v) => { var _a; return (_a = itemsMap.get(v)) !== null && _a !== void 0 ? _a : null; }));
|
|
62
62
|
}
|
|
63
63
|
else {
|
|
64
64
|
onModelChange(value, isNull(value) ? null : itemsMap.get(value));
|
|
@@ -290,10 +290,8 @@ export function Select(props) {
|
|
|
290
290
|
changeVisible((draft) => (searchable ? true : !draft));
|
|
291
291
|
}, children: [_jsxs("div", Object.assign({}, styled('select__container'), { title: selectedLabel, children: [(() => {
|
|
292
292
|
const nodeProps = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, inputProps), mergeCS(styled('select__search'), {
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
zIndex: inputable ? undefined : -1,
|
|
296
|
-
},
|
|
293
|
+
className: inputProps === null || inputProps === void 0 ? void 0 : inputProps.className,
|
|
294
|
+
style: Object.assign(Object.assign({}, inputProps === null || inputProps === void 0 ? void 0 : inputProps.style), { opacity: inputable ? undefined : 0, zIndex: inputable ? undefined : -1 }),
|
|
297
295
|
})), formControl === null || formControl === void 0 ? void 0 : formControl.inputAria), { ref: (instance) => {
|
|
298
296
|
inputRef.current = instance;
|
|
299
297
|
const ret = setRef(inputProps === null || inputProps === void 0 ? void 0 : inputProps.ref, instance);
|
package/slider/Slider.js
CHANGED
|
@@ -248,46 +248,52 @@ export function Slider(props) {
|
|
|
248
248
|
};
|
|
249
249
|
}, visible: isLeft ? visibleLeft : visibleRight, title: customTooltip ? customTooltip(value) : value, placement: vertical ? 'right' : 'top', onVisibleChange: (visible) => {
|
|
250
250
|
setDotVisible(visible ? (isLeft ? 'left' : 'right') : null);
|
|
251
|
-
}, children: (tooltipProps) =>
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
dotRef.current =
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
251
|
+
}, children: (tooltipProps) => {
|
|
252
|
+
var _a, _b;
|
|
253
|
+
return (_jsx("div", Object.assign({}, mergeCS(styled('slider__input-wrapper'), {
|
|
254
|
+
style: {
|
|
255
|
+
left: vertical ? undefined : `calc(${value} / ${max - min} * 100% - 7px)`,
|
|
256
|
+
bottom: vertical ? `calc(${value} / ${max - min} * 100% - 7px)` : undefined,
|
|
257
|
+
},
|
|
258
|
+
}), { ref: (instance) => {
|
|
259
|
+
const dotRef = isLeft ? dotLeftRef : dotRightRef;
|
|
260
|
+
dotRef.current = instance;
|
|
261
|
+
return () => {
|
|
262
|
+
dotRef.current = null;
|
|
263
|
+
};
|
|
264
|
+
} }, tooltipProps, { children: _jsx("input", Object.assign({}, inputProps === null || inputProps === void 0 ? void 0 : inputProps[index], mergeCS(styled('slider__input'), {
|
|
265
|
+
className: (_a = inputProps === null || inputProps === void 0 ? void 0 : inputProps[index]) === null || _a === void 0 ? void 0 : _a.className,
|
|
266
|
+
style: (_b = inputProps === null || inputProps === void 0 ? void 0 : inputProps[index]) === null || _b === void 0 ? void 0 : _b.style,
|
|
267
|
+
}), formControl === null || formControl === void 0 ? void 0 : formControl.inputAria, { type: "range", value: value, max: max, min: min, step: step !== null && step !== void 0 ? step : undefined, disabled: disabled, "aria-orientation": vertical ? 'vertical' : 'horizontal', onChange: (e) => {
|
|
268
|
+
const val = toNumber(e.currentTarget.value);
|
|
269
|
+
if (range) {
|
|
270
|
+
const index = isLeft ? 0 : 1;
|
|
271
|
+
changeValue((draft) => {
|
|
272
|
+
const offset = val - draft[index];
|
|
273
|
+
const isAdd = offset > 0;
|
|
274
|
+
draft[index] = val;
|
|
275
|
+
if (isNumber(rangeMinDistance) && draft[1] - draft[0] < rangeMinDistance) {
|
|
276
|
+
const _index = isLeft ? 1 : 0;
|
|
277
|
+
draft[_index] = getValue(draft[_index] + offset, isAdd ? 'ceil' : 'floor');
|
|
278
|
+
if (draft[1] - draft[0] < rangeMinDistance) {
|
|
279
|
+
draft[index] = getValue(draft[_index] + (isAdd ? -rangeMinDistance : rangeMinDistance), isAdd ? 'floor' : 'ceil');
|
|
280
|
+
}
|
|
275
281
|
}
|
|
276
|
-
}
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
282
|
+
});
|
|
283
|
+
}
|
|
284
|
+
else {
|
|
285
|
+
changeValue(val);
|
|
286
|
+
}
|
|
287
|
+
}, onFocus: (e) => {
|
|
288
|
+
var _a, _b;
|
|
289
|
+
(_b = (_a = inputProps === null || inputProps === void 0 ? void 0 : inputProps[index]) === null || _a === void 0 ? void 0 : _a.onFocus) === null || _b === void 0 ? void 0 : _b.call(_a, e);
|
|
290
|
+
setDotFocused(isLeft ? 'left' : 'right');
|
|
291
|
+
}, onBlur: (e) => {
|
|
292
|
+
var _a, _b;
|
|
293
|
+
(_b = (_a = inputProps === null || inputProps === void 0 ? void 0 : inputProps[index]) === null || _a === void 0 ? void 0 : _a.onBlur) === null || _b === void 0 ? void 0 : _b.call(_a, e);
|
|
294
|
+
setDotFocused(null);
|
|
295
|
+
} })) })));
|
|
296
|
+
} }));
|
|
291
297
|
};
|
|
292
298
|
const preventBlur = (e) => {
|
|
293
299
|
if (e.button === 0) {
|
package/switch/Switch.js
CHANGED
|
@@ -26,7 +26,10 @@ export function Switch(props) {
|
|
|
26
26
|
style: { opacity: checked ? 1 : 0 },
|
|
27
27
|
}), { children: stateContent[0] }))), checkNodeExist(stateContent[1]) && (_jsx("div", Object.assign({}, mergeCS(styled('switch__state-content'), {
|
|
28
28
|
style: { opacity: checked ? 0 : 1 },
|
|
29
|
-
}), { children: stateContent[1] })))] })), _jsx("input", Object.assign({}, inputProps, styled('switch__input'),
|
|
29
|
+
}), { children: stateContent[1] })))] })), _jsx("input", Object.assign({}, inputProps, mergeCS(styled('switch__input'), {
|
|
30
|
+
className: inputProps === null || inputProps === void 0 ? void 0 : inputProps.className,
|
|
31
|
+
style: inputProps === null || inputProps === void 0 ? void 0 : inputProps.style,
|
|
32
|
+
}), formControl === null || formControl === void 0 ? void 0 : formControl.inputAria, { type: "checkbox", disabled: disabled, role: "switch", "aria-checked": checked, onChange: () => {
|
|
30
33
|
changeChecked((draft) => !draft);
|
|
31
34
|
} })), _jsx(Transition, { enter: checked, name: `${namespace}-switch`, duration: TTANSITION_DURING, onSkipEnter: (el) => {
|
|
32
35
|
if (el) {
|
|
@@ -179,10 +179,14 @@ export function TimePicker(props) {
|
|
|
179
179
|
};
|
|
180
180
|
const clearable = clearableProp && !isNull(_value) && !visible && !disabled;
|
|
181
181
|
const inputNode = (isLeft) => {
|
|
182
|
+
var _a, _b;
|
|
182
183
|
const index = isLeft ? 0 : 1;
|
|
183
184
|
const value = isLeft ? valueLeft : valueRight;
|
|
184
185
|
const inputRef = isLeft ? inputLeftRef : inputRightRef;
|
|
185
|
-
return (_jsx(BaseInput, Object.assign({}, inputProps === null || inputProps === void 0 ? void 0 : inputProps[index], styled('time-picker__input'),
|
|
186
|
+
return (_jsx(BaseInput, Object.assign({}, inputProps === null || inputProps === void 0 ? void 0 : inputProps[index], mergeCS(styled('time-picker__input'), {
|
|
187
|
+
className: (_a = inputProps === null || inputProps === void 0 ? void 0 : inputProps[index]) === null || _a === void 0 ? void 0 : _a.className,
|
|
188
|
+
style: (_b = inputProps === null || inputProps === void 0 ? void 0 : inputProps[index]) === null || _b === void 0 ? void 0 : _b.style,
|
|
189
|
+
}), formControl === null || formControl === void 0 ? void 0 : formControl.inputAria, { ref: (instance) => {
|
|
186
190
|
var _a;
|
|
187
191
|
inputRef.current = instance;
|
|
188
192
|
const ret = setRef((_a = inputProps === null || inputProps === void 0 ? void 0 : inputProps[index]) === null || _a === void 0 ? void 0 : _a.ref, instance);
|
package/transfer/Transfer.js
CHANGED
|
@@ -18,7 +18,7 @@ export function Transfer(props) {
|
|
|
18
18
|
const itemsMap = useMemo(() => new Map(listProp.map((item) => [item.value, item])), [listProp]);
|
|
19
19
|
const [_valueRight, changeValueRight] = useControlled(defaultModel !== null && defaultModel !== void 0 ? defaultModel : [], model, (value) => {
|
|
20
20
|
if (onModelChange) {
|
|
21
|
-
onModelChange(value, value.map((v) => itemsMap.get(v)));
|
|
21
|
+
onModelChange(value, value.map((v) => { var _a; return ((_a = itemsMap.get(v)) !== null && _a !== void 0 ? _a : null); }));
|
|
22
22
|
}
|
|
23
23
|
}, undefined, formControl === null || formControl === void 0 ? void 0 : formControl.control);
|
|
24
24
|
const valueRight = useMemo(() => new Set(_valueRight), [_valueRight]);
|
package/tree/Tree.js
CHANGED
|
@@ -40,7 +40,13 @@ export function Tree(props) {
|
|
|
40
40
|
const [_selected, changeSelected] = useControlled(defaultModel !== null && defaultModel !== void 0 ? defaultModel : (multiple ? [] : null), model, (value) => {
|
|
41
41
|
if (onModelChange) {
|
|
42
42
|
if (multiple) {
|
|
43
|
-
onModelChange(value, value.map((v) =>
|
|
43
|
+
onModelChange(value, value.map((v) => {
|
|
44
|
+
const node = nodesMap.get(v);
|
|
45
|
+
if (node) {
|
|
46
|
+
return node.origin;
|
|
47
|
+
}
|
|
48
|
+
return null;
|
|
49
|
+
}));
|
|
44
50
|
}
|
|
45
51
|
else {
|
|
46
52
|
onModelChange(value, isNull(value) ? null : nodesMap.get(value).origin);
|
|
@@ -69,7 +69,13 @@ export function TreeSelect(props) {
|
|
|
69
69
|
const [_selected, changeSelected] = useControlled(defaultModel !== null && defaultModel !== void 0 ? defaultModel : (multiple ? [] : null), model, (value) => {
|
|
70
70
|
if (onModelChange) {
|
|
71
71
|
if (multiple) {
|
|
72
|
-
onModelChange(value, value.map((v) =>
|
|
72
|
+
onModelChange(value, value.map((v) => {
|
|
73
|
+
const node = nodesMap.get(v);
|
|
74
|
+
if (node) {
|
|
75
|
+
return node.origin;
|
|
76
|
+
}
|
|
77
|
+
return null;
|
|
78
|
+
}));
|
|
73
79
|
}
|
|
74
80
|
else {
|
|
75
81
|
onModelChange(value, isNull(value) ? null : nodesMap.get(value).origin);
|
|
@@ -295,10 +301,8 @@ export function TreeSelect(props) {
|
|
|
295
301
|
changeVisible((draft) => (searchable ? true : !draft));
|
|
296
302
|
}, children: [_jsxs("div", Object.assign({}, styled('tree-select__container'), { title: selectedLabel, children: [(() => {
|
|
297
303
|
const nodeProps = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, inputProps), mergeCS(styled('tree-select__search'), {
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
zIndex: inputable ? undefined : -1,
|
|
301
|
-
},
|
|
304
|
+
className: inputProps === null || inputProps === void 0 ? void 0 : inputProps.className,
|
|
305
|
+
style: Object.assign(Object.assign({}, inputProps === null || inputProps === void 0 ? void 0 : inputProps.style), { opacity: inputable ? undefined : 0, zIndex: inputable ? undefined : -1 }),
|
|
302
306
|
})), formControl === null || formControl === void 0 ? void 0 : formControl.inputAria), { ref: (instance) => {
|
|
303
307
|
inputRef.current = instance;
|
|
304
308
|
const ret = setRef(inputProps === null || inputProps === void 0 ? void 0 : inputProps.ref, instance);
|