@douyinfe/semi-ui 2.3.1 → 2.5.0-beta.0
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/cascader/__test__/cascader.test.js +24 -0
- package/cascader/_story/cascader.stories.js +73 -0
- package/cascader/index.tsx +5 -2
- package/datePicker/_story/RenderDate/index.js +13 -3
- package/datePicker/_story/RenderFullDate/index.js +36 -14
- package/datePicker/_story/RenderFullDate/index.scss +1 -1
- package/datePicker/_story/datePicker.stories.js +19 -11
- package/datePicker/_story/v2/PanelOpen.jsx +39 -0
- package/datePicker/_story/v2/index.js +2 -1
- package/datePicker/datePicker.tsx +1 -0
- package/dist/css/semi.css +84 -36
- package/dist/css/semi.min.css +1 -1
- package/dist/umd/semi-ui.js +487 -170
- package/dist/umd/semi-ui.js.map +1 -1
- package/dist/umd/semi-ui.min.js +1 -1
- package/dist/umd/semi-ui.min.js.map +1 -1
- package/form/_story/demo.jsx +1 -0
- package/input/index.tsx +1 -0
- package/input/textarea.tsx +6 -4
- package/inputNumber/__test__/inputNumber.test.js +36 -8
- package/lib/cjs/autoComplete/index.d.ts +1 -1
- package/lib/cjs/cascader/index.js +6 -0
- package/lib/cjs/datePicker/datePicker.js +12 -8
- package/lib/cjs/dropdown/index.d.ts +1 -1
- package/lib/cjs/form/baseForm.d.ts +1 -1
- package/lib/cjs/form/field.d.ts +1 -1
- package/lib/cjs/input/index.js +2 -1
- package/lib/cjs/input/textarea.js +5 -3
- package/lib/cjs/navigation/Item.js +1 -1
- package/lib/cjs/navigation/SubNav.js +1 -1
- package/lib/cjs/scrollList/scrollItem.d.ts +5 -1
- package/lib/cjs/scrollList/scrollItem.js +7 -0
- package/lib/cjs/select/index.d.ts +1 -1
- package/lib/cjs/select/index.js +1 -1
- package/lib/cjs/select/option.js +2 -2
- package/lib/cjs/table/Table.d.ts +1 -1
- package/lib/cjs/table/Table.js +17 -7
- package/lib/cjs/table/interface.d.ts +1 -0
- package/lib/cjs/tabs/interface.d.ts +1 -1
- package/lib/cjs/timePicker/TimePicker.d.ts +2 -0
- package/lib/cjs/timePicker/TimePicker.js +4 -4
- package/lib/cjs/timePicker/index.d.ts +1 -0
- package/lib/cjs/tooltip/index.d.ts +1 -1
- package/lib/cjs/tree/index.d.ts +2 -0
- package/lib/cjs/tree/index.js +15 -8
- package/lib/cjs/tree/treeNode.js +10 -1
- package/lib/cjs/treeSelect/index.d.ts +2 -0
- package/lib/cjs/treeSelect/index.js +75 -30
- package/lib/cjs/typography/util.js +0 -1
- package/lib/cjs/upload/fileCard.js +31 -22
- package/lib/cjs/upload/index.d.ts +6 -0
- package/lib/cjs/upload/index.js +15 -8
- package/lib/cjs/upload/interface.d.ts +8 -6
- package/lib/es/autoComplete/index.d.ts +1 -1
- package/lib/es/cascader/index.js +5 -0
- package/lib/es/datePicker/datePicker.js +12 -8
- package/lib/es/dropdown/index.d.ts +1 -1
- package/lib/es/form/baseForm.d.ts +1 -1
- package/lib/es/form/field.d.ts +1 -1
- package/lib/es/input/index.js +2 -1
- package/lib/es/input/textarea.js +5 -3
- package/lib/es/navigation/Item.js +1 -1
- package/lib/es/navigation/SubNav.js +1 -1
- package/lib/es/scrollList/scrollItem.d.ts +5 -1
- package/lib/es/scrollList/scrollItem.js +7 -0
- package/lib/es/select/index.d.ts +1 -1
- package/lib/es/select/index.js +1 -1
- package/lib/es/select/option.js +2 -2
- package/lib/es/table/Table.d.ts +1 -1
- package/lib/es/table/Table.js +19 -7
- package/lib/es/table/interface.d.ts +1 -0
- package/lib/es/tabs/interface.d.ts +1 -1
- package/lib/es/timePicker/TimePicker.d.ts +2 -0
- package/lib/es/timePicker/TimePicker.js +4 -4
- package/lib/es/timePicker/index.d.ts +1 -0
- package/lib/es/tooltip/index.d.ts +1 -1
- package/lib/es/tree/index.d.ts +2 -0
- package/lib/es/tree/index.js +15 -8
- package/lib/es/tree/treeNode.js +9 -1
- package/lib/es/treeSelect/index.d.ts +2 -0
- package/lib/es/treeSelect/index.js +76 -31
- package/lib/es/typography/util.js +0 -1
- package/lib/es/upload/fileCard.js +31 -24
- package/lib/es/upload/index.d.ts +6 -0
- package/lib/es/upload/index.js +14 -8
- package/lib/es/upload/interface.d.ts +8 -6
- package/navigation/Item.tsx +1 -1
- package/navigation/SubNav.tsx +1 -1
- package/package.json +9 -8
- package/scrollList/scrollItem.tsx +10 -3
- package/select/index.tsx +6 -1
- package/select/option.tsx +2 -2
- package/table/Table.tsx +16 -8
- package/table/_story/table.stories.js +1 -0
- package/table/_story/v2/FixedColumnsChange/index.jsx +104 -0
- package/table/_story/v2/FixedHeaderMerge/index.jsx +98 -0
- package/table/_story/v2/FixedZIndex/index.jsx +87 -0
- package/table/_story/v2/defaultFilteredValue.tsx +123 -0
- package/table/_story/v2/index.js +4 -0
- package/table/interface.ts +1 -0
- package/tabs/interface.ts +1 -1
- package/timePicker/TimePicker.tsx +4 -1
- package/timePicker/__test__/timePicker.test.js +42 -3
- package/timePicker/_story/timepicker.stories.js +18 -0
- package/tooltip/_story/tooltip.stories.js +83 -1
- package/tree/__test__/treeMultiple.test.js +94 -0
- package/tree/_story/tree.stories.js +169 -0
- package/tree/index.tsx +12 -5
- package/tree/treeNode.tsx +9 -2
- package/treeSelect/__test__/treeMultiple.test.js +94 -0
- package/treeSelect/__test__/treeSelect.test.js +157 -0
- package/treeSelect/_story/treeSelect.stories.js +242 -0
- package/treeSelect/index.tsx +93 -52
- package/typography/_story/typography.stories.js +8 -0
- package/typography/util.tsx +0 -1
- package/upload/_story/upload.stories.js +22 -6
- package/upload/fileCard.tsx +23 -23
- package/upload/index.tsx +15 -6
- package/upload/interface.ts +7 -5
package/form/_story/demo.jsx
CHANGED
|
@@ -179,6 +179,7 @@ class BasicDemoWithInit extends Component {
|
|
|
179
179
|
<BasicSelect onChange={this.changeLabelPos} value={labelPosition}>
|
|
180
180
|
<BasicSelect.Option value='top'>top</BasicSelect.Option>
|
|
181
181
|
<BasicSelect.Option value='left'>left</BasicSelect.Option>
|
|
182
|
+
<BasicSelect.Option value='inset'>inset</BasicSelect.Option>
|
|
182
183
|
</BasicSelect>
|
|
183
184
|
<BasicSelect onChange={this.changeLabelAlign} value={labelAlign}>
|
|
184
185
|
<BasicSelect.Option value='left'>left</BasicSelect.Option>
|
package/input/index.tsx
CHANGED
package/input/textarea.tsx
CHANGED
|
@@ -295,7 +295,8 @@ class TextArea extends BaseComponent<TextAreaProps, TextAreaState> {
|
|
|
295
295
|
className,
|
|
296
296
|
`${prefixCls}-textarea-wrapper`,
|
|
297
297
|
{
|
|
298
|
-
[`${prefixCls}-textarea-wrapper-disabled`]: disabled
|
|
298
|
+
[`${prefixCls}-textarea-wrapper-disabled`]: disabled,
|
|
299
|
+
[`${prefixCls}-textarea-wrapper-readonly`]: readonly,
|
|
299
300
|
[`${prefixCls}-textarea-wrapper-${validateStatus}`]: Boolean(validateStatus),
|
|
300
301
|
[`${prefixCls}-textarea-wrapper-focus`]: isFocus,
|
|
301
302
|
// [`${prefixCls}-textarea-wrapper-resize`]: !autosize && resize,
|
|
@@ -305,13 +306,14 @@ class TextArea extends BaseComponent<TextAreaProps, TextAreaState> {
|
|
|
305
306
|
const itemCls = cls(
|
|
306
307
|
`${prefixCls}-textarea`,
|
|
307
308
|
{
|
|
308
|
-
[`${prefixCls}-textarea-disabled`]: disabled
|
|
309
|
+
[`${prefixCls}-textarea-disabled`]: disabled,
|
|
310
|
+
[`${prefixCls}-textarea-readonly`]: readonly,
|
|
309
311
|
[`${prefixCls}-textarea-autosize`]: autosize,
|
|
310
312
|
[`${prefixCls}-textarea-showClear`]: showClear,
|
|
311
313
|
}
|
|
312
314
|
);
|
|
313
315
|
const itemProps = {
|
|
314
|
-
...omit(rest, 'insetLabel', 'getValueLength', 'onClear', 'showClear'),
|
|
316
|
+
...omit(rest, 'insetLabel', 'insetLabelId', 'getValueLength', 'onClear', 'showClear'),
|
|
315
317
|
className: itemCls,
|
|
316
318
|
disabled,
|
|
317
319
|
readOnly: readonly,
|
|
@@ -346,4 +348,4 @@ class TextArea extends BaseComponent<TextAreaProps, TextAreaState> {
|
|
|
346
348
|
|
|
347
349
|
const ForwardTextarea = React.forwardRef<HTMLTextAreaElement, Omit<TextAreaProps, 'forwardRef'>>((props, ref) => <TextArea {...props} forwardRef={ref} />);
|
|
348
350
|
|
|
349
|
-
export default ForwardTextarea;
|
|
351
|
+
export default ForwardTextarea;
|
|
@@ -5,6 +5,7 @@ import sinon from 'sinon';
|
|
|
5
5
|
import keyCode from '@douyinfe/semi-foundation/utils/keyCode';
|
|
6
6
|
import * as _ from 'lodash';
|
|
7
7
|
import { BASE_CLASS_PREFIX } from '../../../semi-foundation/base/constants';
|
|
8
|
+
import { numbers } from '@douyinfe/semi-foundation/inputNumber/constants';
|
|
8
9
|
import { Form, withField } from '../../index';
|
|
9
10
|
|
|
10
11
|
const log = (...args) => console.log(...args);
|
|
@@ -216,8 +217,8 @@ describe(`InputNumber`, () => {
|
|
|
216
217
|
const addCount = 3;
|
|
217
218
|
const minusCount = 1;
|
|
218
219
|
|
|
219
|
-
_.times(addCount, () => addBtn.simulate('mousedown'));
|
|
220
|
-
_.times(minusCount, () => minusBtn.simulate('mousedown'));
|
|
220
|
+
_.times(addCount, () => addBtn.simulate('mousedown', { button: numbers.MOUSE_BUTTON_LEFT }));
|
|
221
|
+
_.times(minusCount, () => minusBtn.simulate('mousedown', { button: numbers.MOUSE_BUTTON_LEFT }));
|
|
221
222
|
|
|
222
223
|
expect(inputElem.instance().value).toBe(String(defaultValue + addCount - minusCount));
|
|
223
224
|
expect(onUpClick.called).toBe(true);
|
|
@@ -243,8 +244,8 @@ describe(`InputNumber`, () => {
|
|
|
243
244
|
const addCount = 3;
|
|
244
245
|
const minusCount = 1;
|
|
245
246
|
|
|
246
|
-
_.times(addCount, () => addBtn.simulate('mousedown'));
|
|
247
|
-
_.times(minusCount, () => minusBtn.simulate('mousedown'));
|
|
247
|
+
_.times(addCount, () => addBtn.simulate('mousedown', { button: numbers.MOUSE_BUTTON_LEFT }));
|
|
248
|
+
_.times(minusCount, () => minusBtn.simulate('mousedown', { button: numbers.MOUSE_BUTTON_LEFT }));
|
|
248
249
|
|
|
249
250
|
expect(inputElem.instance().value).toBe(String(defaultValue + addCount - minusCount));
|
|
250
251
|
expect(onUpClick.called).toBe(true);
|
|
@@ -283,9 +284,9 @@ describe(`InputNumber`, () => {
|
|
|
283
284
|
// click button focus
|
|
284
285
|
const addCount = 3;
|
|
285
286
|
const minusCount = 1;
|
|
286
|
-
_.times(addCount, () => addBtn.simulate('mousedown'));
|
|
287
|
+
_.times(addCount, () => addBtn.simulate('mousedown', { button: numbers.MOUSE_BUTTON_LEFT }));
|
|
287
288
|
_.times(addCount, () => addBtn.simulate('mouseup'));
|
|
288
|
-
_.times(minusCount, () => minusBtn.simulate('mousedown'));
|
|
289
|
+
_.times(minusCount, () => minusBtn.simulate('mousedown', { button: numbers.MOUSE_BUTTON_LEFT }));
|
|
289
290
|
_.times(minusCount, () => minusBtn.simulate('mouseup'));
|
|
290
291
|
expect(inputElem.instance().value).toBe(String(defaultValue + addCount - minusCount));
|
|
291
292
|
expect(inputNumber.find(BaseInputNumber).state('focusing')).toBeTruthy();
|
|
@@ -338,7 +339,7 @@ describe(`InputNumber`, () => {
|
|
|
338
339
|
const btns = inputNumber.find(`.${BASE_CLASS_PREFIX}-input-number-suffix-btns .${BASE_CLASS_PREFIX}-input-number-button`);
|
|
339
340
|
const inputElem = inputNumber.find('input');
|
|
340
341
|
const addBtn = btns.first();
|
|
341
|
-
addBtn.simulate('mousedown');
|
|
342
|
+
addBtn.simulate('mousedown', { button: numbers.MOUSE_BUTTON_LEFT });
|
|
342
343
|
expect(inputElem.instance().value).toBe("1");
|
|
343
344
|
})
|
|
344
345
|
|
|
@@ -366,5 +367,32 @@ describe(`InputNumber`, () => {
|
|
|
366
367
|
inputElem.simulate('change', newEvent);
|
|
367
368
|
expect(onNumberChange.calledOnce).toBe(true);
|
|
368
369
|
expect(inputElem.instance().value).toBe('123');
|
|
369
|
-
})
|
|
370
|
+
});
|
|
371
|
+
|
|
372
|
+
/**
|
|
373
|
+
* test buttons right click
|
|
374
|
+
*/
|
|
375
|
+
it(`right click add/minus button`, async () => {
|
|
376
|
+
const defaultValue = 1000;
|
|
377
|
+
const onUpClick = sinon.spy();
|
|
378
|
+
const onDownClick = sinon.spy();
|
|
379
|
+
const MOUSE_BUTTON_RIGHT = 2;
|
|
380
|
+
|
|
381
|
+
const inputNumber = mount(
|
|
382
|
+
<InputNumber defaultValue={defaultValue} onUpClick={onUpClick} onDownClick={onDownClick} />
|
|
383
|
+
);
|
|
384
|
+
const inputElem = inputNumber.find('input');
|
|
385
|
+
|
|
386
|
+
const btns = inputNumber.find(`.${BASE_CLASS_PREFIX}-input-number-suffix-btns .${BASE_CLASS_PREFIX}-input-number-button`);
|
|
387
|
+
|
|
388
|
+
const addBtn = btns.first();
|
|
389
|
+
const minusBtn = btns.last();
|
|
390
|
+
|
|
391
|
+
_.times(1, () => addBtn.simulate('mousedown', { button: MOUSE_BUTTON_RIGHT }));
|
|
392
|
+
_.times(3, () => minusBtn.simulate('mousedown', { button: MOUSE_BUTTON_RIGHT }));
|
|
393
|
+
|
|
394
|
+
expect(inputElem.instance().value).toBe(String(defaultValue));
|
|
395
|
+
expect(onUpClick.called).toBe(false);
|
|
396
|
+
expect(onDownClick.called).toBe(false);
|
|
397
|
+
});
|
|
370
398
|
});
|
|
@@ -113,7 +113,7 @@ declare class AutoComplete<T extends AutoCompleteItems> extends BaseComponent<Au
|
|
|
113
113
|
onBlur: PropTypes.Requireable<(...args: any[]) => any>;
|
|
114
114
|
onFocus: PropTypes.Requireable<(...args: any[]) => any>;
|
|
115
115
|
onChange: PropTypes.Requireable<(...args: any[]) => any>;
|
|
116
|
-
position: PropTypes.Requireable<"top" | "topLeft" | "topRight" | "left" | "leftTop" | "leftBottom" | "right" | "rightTop" | "rightBottom" | "bottom" | "bottomLeft" | "bottomRight" | "leftTopOver" | "rightTopOver">;
|
|
116
|
+
position: PropTypes.Requireable<"top" | "topLeft" | "topRight" | "left" | "leftTop" | "leftBottom" | "right" | "rightTop" | "rightBottom" | "bottom" | "bottomLeft" | "bottomRight" | "leftTopOver" | "rightTopOver" | "leftBottomOver" | "rightBottomOver">;
|
|
117
117
|
placeholder: PropTypes.Requireable<string>;
|
|
118
118
|
prefix: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
119
119
|
onChangeWithObject: PropTypes.Requireable<boolean>;
|
|
@@ -42,6 +42,8 @@ var _isString2 = _interopRequireDefault(require("lodash/isString"));
|
|
|
42
42
|
|
|
43
43
|
var _isEqual2 = _interopRequireDefault(require("lodash/isEqual"));
|
|
44
44
|
|
|
45
|
+
var _isSet2 = _interopRequireDefault(require("lodash/isSet"));
|
|
46
|
+
|
|
45
47
|
var _react = _interopRequireWildcard(require("react"));
|
|
46
48
|
|
|
47
49
|
var _reactDom = _interopRequireDefault(require("react-dom"));
|
|
@@ -776,6 +778,10 @@ class Cascader extends _baseComponent.default {
|
|
|
776
778
|
realKeys = formatKeys;
|
|
777
779
|
}
|
|
778
780
|
|
|
781
|
+
if ((0, _isSet2.default)(realKeys)) {
|
|
782
|
+
realKeys = [...realKeys];
|
|
783
|
+
}
|
|
784
|
+
|
|
779
785
|
const calRes = (0, _treeUtil.calcCheckedKeys)((0, _flatten2.default)(realKeys), keyEntities);
|
|
780
786
|
const checkedKeys = new _set.default(calRes.checkedKeys);
|
|
781
787
|
const halfCheckedKeys = new _set.default(calRes.halfCheckedKeys); // disableStrictly
|
|
@@ -604,14 +604,18 @@ class DatePicker extends _baseComponent.default {
|
|
|
604
604
|
onRangeClear: this.handleRangeInputClear,
|
|
605
605
|
onRangeEndTabPress: this.handleRangeEndTabPress
|
|
606
606
|
});
|
|
607
|
-
return
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
607
|
+
return (
|
|
608
|
+
/*#__PURE__*/
|
|
609
|
+
// eslint-disable-next-line jsx-a11y/no-static-element-interactions, jsx-a11y/click-events-have-key-events
|
|
610
|
+
_react.default.createElement("div", {
|
|
611
|
+
onClick: this.handleTriggerWrapperClick,
|
|
612
|
+
className: inputCls
|
|
613
|
+
}, typeof triggerRender === 'function' ? /*#__PURE__*/_react.default.createElement(_trigger.default, (0, _assign.default)({}, props, {
|
|
614
|
+
triggerRender: triggerRender,
|
|
615
|
+
componentName: "DatePicker",
|
|
616
|
+
componentProps: (0, _assign.default)({}, this.props)
|
|
617
|
+
})) : /*#__PURE__*/_react.default.createElement(_dateInput.default, (0, _assign.default)({}, props)))
|
|
618
|
+
);
|
|
615
619
|
}
|
|
616
620
|
|
|
617
621
|
render() {
|
|
@@ -58,7 +58,7 @@ declare class Dropdown extends BaseComponent<DropdownProps, DropdownState> {
|
|
|
58
58
|
render: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
59
59
|
children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
60
60
|
visible: PropTypes.Requireable<boolean>;
|
|
61
|
-
position: PropTypes.Requireable<"top" | "topLeft" | "topRight" | "left" | "leftTop" | "leftBottom" | "right" | "rightTop" | "rightBottom" | "bottom" | "bottomLeft" | "bottomRight" | "leftTopOver" | "rightTopOver">;
|
|
61
|
+
position: PropTypes.Requireable<"top" | "topLeft" | "topRight" | "left" | "leftTop" | "leftBottom" | "right" | "rightTop" | "rightBottom" | "bottom" | "bottomLeft" | "bottomRight" | "leftTopOver" | "rightTopOver" | "leftBottomOver" | "rightBottomOver">;
|
|
62
62
|
getPopupContainer: PropTypes.Requireable<(...args: any[]) => any>;
|
|
63
63
|
mouseEnterDelay: PropTypes.Requireable<number>;
|
|
64
64
|
mouseLeaveDelay: PropTypes.Requireable<number>;
|
|
@@ -80,7 +80,7 @@ declare class Form extends BaseComponent<BaseFormProps, BaseFormState> {
|
|
|
80
80
|
emptyContent?: React.ReactNode;
|
|
81
81
|
onDropdownVisibleChange?: (visible: boolean) => void;
|
|
82
82
|
zIndex?: number;
|
|
83
|
-
position?: "top" | "topLeft" | "topRight" | "left" | "leftTop" | "leftBottom" | "right" | "rightTop" | "rightBottom" | "bottom" | "bottomLeft" | "bottomRight" | "leftTopOver" | "rightTopOver";
|
|
83
|
+
position?: "top" | "topLeft" | "topRight" | "left" | "leftTop" | "leftBottom" | "right" | "rightTop" | "rightBottom" | "bottom" | "bottomLeft" | "bottomRight" | "leftTopOver" | "rightTopOver" | "leftBottomOver" | "rightBottomOver";
|
|
84
84
|
onSearch?: (value: string) => void;
|
|
85
85
|
dropdownClassName?: string;
|
|
86
86
|
dropdownStyle?: React.CSSProperties;
|
package/lib/cjs/form/field.d.ts
CHANGED
|
@@ -28,7 +28,7 @@ declare const FormSelect: import("react").ComponentType<import("utility-types").
|
|
|
28
28
|
emptyContent?: import("react").ReactNode;
|
|
29
29
|
onDropdownVisibleChange?: (visible: boolean) => void;
|
|
30
30
|
zIndex?: number;
|
|
31
|
-
position?: "top" | "topLeft" | "topRight" | "left" | "leftTop" | "leftBottom" | "right" | "rightTop" | "rightBottom" | "bottom" | "bottomLeft" | "bottomRight" | "leftTopOver" | "rightTopOver";
|
|
31
|
+
position?: "top" | "topLeft" | "topRight" | "left" | "leftTop" | "leftBottom" | "right" | "rightTop" | "rightBottom" | "bottom" | "bottomLeft" | "bottomRight" | "leftTopOver" | "rightTopOver" | "leftBottomOver" | "rightBottomOver";
|
|
32
32
|
onSearch?: (value: string) => void;
|
|
33
33
|
dropdownClassName?: string;
|
|
34
34
|
dropdownStyle?: import("react").CSSProperties;
|
package/lib/cjs/input/index.js
CHANGED
|
@@ -364,6 +364,7 @@ class Input extends _baseComponent.default {
|
|
|
364
364
|
prefix,
|
|
365
365
|
mode,
|
|
366
366
|
insetLabel,
|
|
367
|
+
insetLabelId,
|
|
367
368
|
validateStatus,
|
|
368
369
|
type,
|
|
369
370
|
readonly,
|
|
@@ -379,7 +380,7 @@ class Input extends _baseComponent.default {
|
|
|
379
380
|
maxLength,
|
|
380
381
|
getValueLength
|
|
381
382
|
} = _a,
|
|
382
|
-
rest = __rest(_a, ["addonAfter", "addonBefore", "autofocus", "className", "disabled", "placeholder", "prefix", "mode", "insetLabel", "validateStatus", "type", "readonly", "size", "suffix", "style", "showClear", "onEnterPress", "onClear", "hideSuffix", "inputStyle", "forwardRef", "maxLength", "getValueLength"]);
|
|
383
|
+
rest = __rest(_a, ["addonAfter", "addonBefore", "autofocus", "className", "disabled", "placeholder", "prefix", "mode", "insetLabel", "insetLabelId", "validateStatus", "type", "readonly", "size", "suffix", "style", "showClear", "onEnterPress", "onClear", "hideSuffix", "inputStyle", "forwardRef", "maxLength", "getValueLength"]);
|
|
383
384
|
|
|
384
385
|
const {
|
|
385
386
|
value,
|
|
@@ -267,18 +267,20 @@ class TextArea extends _baseComponent.default {
|
|
|
267
267
|
minLength: stateMinLength
|
|
268
268
|
} = this.state;
|
|
269
269
|
const wrapperCls = (0, _classnames.default)(className, "".concat(prefixCls, "-textarea-wrapper"), {
|
|
270
|
-
["".concat(prefixCls, "-textarea-wrapper-disabled")]: disabled
|
|
270
|
+
["".concat(prefixCls, "-textarea-wrapper-disabled")]: disabled,
|
|
271
|
+
["".concat(prefixCls, "-textarea-wrapper-readonly")]: readonly,
|
|
271
272
|
[(0, _concat.default)(_context = "".concat(prefixCls, "-textarea-wrapper-")).call(_context, validateStatus)]: Boolean(validateStatus),
|
|
272
273
|
["".concat(prefixCls, "-textarea-wrapper-focus")]: isFocus // [`${prefixCls}-textarea-wrapper-resize`]: !autosize && resize,
|
|
273
274
|
|
|
274
275
|
}); // const ref = this.props.forwardRef || this.textAreaRef;
|
|
275
276
|
|
|
276
277
|
const itemCls = (0, _classnames.default)("".concat(prefixCls, "-textarea"), {
|
|
277
|
-
["".concat(prefixCls, "-textarea-disabled")]: disabled
|
|
278
|
+
["".concat(prefixCls, "-textarea-disabled")]: disabled,
|
|
279
|
+
["".concat(prefixCls, "-textarea-readonly")]: readonly,
|
|
278
280
|
["".concat(prefixCls, "-textarea-autosize")]: autosize,
|
|
279
281
|
["".concat(prefixCls, "-textarea-showClear")]: showClear
|
|
280
282
|
});
|
|
281
|
-
const itemProps = (0, _assign.default)((0, _assign.default)({}, (0, _omit2.default)(rest, 'insetLabel', 'getValueLength', 'onClear', 'showClear')), {
|
|
283
|
+
const itemProps = (0, _assign.default)((0, _assign.default)({}, (0, _omit2.default)(rest, 'insetLabel', 'insetLabelId', 'getValueLength', 'onClear', 'showClear')), {
|
|
282
284
|
className: itemCls,
|
|
283
285
|
disabled,
|
|
284
286
|
readOnly: readonly,
|
|
@@ -204,7 +204,7 @@ class NavItem extends _baseComponent.default {
|
|
|
204
204
|
} else {
|
|
205
205
|
let placeholderIcons = null;
|
|
206
206
|
|
|
207
|
-
if (mode === _constants.strings.MODE_VERTICAL && !limitIndent) {
|
|
207
|
+
if (mode === _constants.strings.MODE_VERTICAL && !limitIndent && !isCollapsed) {
|
|
208
208
|
const iconAmount = icon && !indent ? level : level - 1;
|
|
209
209
|
placeholderIcons = (0, _times2.default)(iconAmount, () => this.renderIcon(null, _constants.strings.ICON_POS_RIGHT, false));
|
|
210
210
|
}
|
|
@@ -230,7 +230,7 @@ class SubNav extends _baseComponent.default {
|
|
|
230
230
|
|
|
231
231
|
let placeholderIcons = null;
|
|
232
232
|
|
|
233
|
-
if (mode === _constants.strings.MODE_VERTICAL && !limitIndent) {
|
|
233
|
+
if (mode === _constants.strings.MODE_VERTICAL && !limitIndent && !isCollapsed) {
|
|
234
234
|
/* Different icons' amount means different indents.*/
|
|
235
235
|
const iconAmount = icon && !indent ? level : level - 1;
|
|
236
236
|
placeholderIcons = (0, _times2.default)(iconAmount, index => this.renderIcon(null, _constants.strings.ICON_POS_RIGHT, false, undefined, index));
|
|
@@ -3,7 +3,10 @@ import BaseComponent from '../_base/baseComponent';
|
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
4
|
import { Item, ScrollItemAdapter } from '@douyinfe/semi-foundation/lib/cjs/scrollList/itemFoundation';
|
|
5
5
|
import { Motion } from '../_base/base';
|
|
6
|
-
|
|
6
|
+
interface DebounceSelectFn {
|
|
7
|
+
(e: React.UIEvent, newSelectedNode: HTMLElement): void;
|
|
8
|
+
cancel(): void;
|
|
9
|
+
}
|
|
7
10
|
export interface ScrollItemProps<T extends Item> {
|
|
8
11
|
mode?: string;
|
|
9
12
|
cycled?: boolean;
|
|
@@ -52,6 +55,7 @@ export default class ScrollItem<T extends Item> extends BaseComponent<ScrollItem
|
|
|
52
55
|
debouncedSelect: DebounceSelectFn;
|
|
53
56
|
constructor(props?: {});
|
|
54
57
|
get adapter(): ScrollItemAdapter<ScrollItemProps<T>, ScrollItemState, T>;
|
|
58
|
+
componentWillUnmount(): void;
|
|
55
59
|
componentDidMount(): void;
|
|
56
60
|
componentDidUpdate(prevProps: ScrollItemProps<T>): void;
|
|
57
61
|
_cacheNode: (name: string, node: Element) => Element;
|
|
@@ -451,6 +451,13 @@ class ScrollItem extends _baseComponent.default {
|
|
|
451
451
|
});
|
|
452
452
|
}
|
|
453
453
|
|
|
454
|
+
componentWillUnmount() {
|
|
455
|
+
if (this.props.cycled) {
|
|
456
|
+
this.throttledAdjustList.cancel();
|
|
457
|
+
this.debouncedSelect.cancel();
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
|
|
454
461
|
componentDidMount() {
|
|
455
462
|
this.foundation.init();
|
|
456
463
|
const {
|
|
@@ -165,7 +165,7 @@ declare class Select extends BaseComponent<SelectProps, SelectState> {
|
|
|
165
165
|
emptyContent: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
166
166
|
onDropdownVisibleChange: PropTypes.Requireable<(...args: any[]) => any>;
|
|
167
167
|
zIndex: PropTypes.Requireable<number>;
|
|
168
|
-
position: PropTypes.Requireable<"top" | "topLeft" | "topRight" | "left" | "leftTop" | "leftBottom" | "right" | "rightTop" | "rightBottom" | "bottom" | "bottomLeft" | "bottomRight" | "leftTopOver" | "rightTopOver">;
|
|
168
|
+
position: PropTypes.Requireable<"top" | "topLeft" | "topRight" | "left" | "leftTop" | "leftBottom" | "right" | "rightTop" | "rightBottom" | "bottom" | "bottomLeft" | "bottomRight" | "leftTopOver" | "rightTopOver" | "leftBottomOver" | "rightBottomOver">;
|
|
169
169
|
onSearch: PropTypes.Requireable<(...args: any[]) => any>;
|
|
170
170
|
getPopupContainer: PropTypes.Requireable<(...args: any[]) => any>;
|
|
171
171
|
dropdownClassName: PropTypes.Requireable<string>;
|
package/lib/cjs/select/index.js
CHANGED
|
@@ -563,7 +563,7 @@ class Select extends _baseComponent.default {
|
|
|
563
563
|
role: "button",
|
|
564
564
|
"aria-label": "Use the input box to create an optional item",
|
|
565
565
|
onClick: e => this.onSelect(option, optionIndex, e),
|
|
566
|
-
key:
|
|
566
|
+
key: option.key || option.label
|
|
567
567
|
}, customCreateItem)
|
|
568
568
|
);
|
|
569
569
|
}
|
package/lib/cjs/select/option.js
CHANGED
|
@@ -65,9 +65,9 @@ class Option extends _react.PureComponent {
|
|
|
65
65
|
const {
|
|
66
66
|
props
|
|
67
67
|
} = this;
|
|
68
|
-
const
|
|
68
|
+
const isDisabled = props.disabled;
|
|
69
69
|
|
|
70
|
-
if (!
|
|
70
|
+
if (!isDisabled) {
|
|
71
71
|
props.onSelect((0, _assign.default)((0, _assign.default)({}, rest), {
|
|
72
72
|
value,
|
|
73
73
|
label: label || children
|
package/lib/cjs/table/Table.d.ts
CHANGED
|
@@ -298,7 +298,7 @@ declare class Table<RecordType extends Record<string, any>> extends BaseComponen
|
|
|
298
298
|
showSizeChanger?: boolean;
|
|
299
299
|
showQuickJumper?: boolean;
|
|
300
300
|
popoverZIndex?: number;
|
|
301
|
-
popoverPosition?: "top" | "topLeft" | "topRight" | "left" | "leftTop" | "leftBottom" | "right" | "rightTop" | "rightBottom" | "bottom" | "bottomLeft" | "bottomRight" | "leftTopOver" | "rightTopOver";
|
|
301
|
+
popoverPosition?: "top" | "topLeft" | "topRight" | "left" | "leftTop" | "leftBottom" | "right" | "rightTop" | "rightBottom" | "bottom" | "bottomLeft" | "bottomRight" | "leftTopOver" | "rightTopOver" | "leftBottomOver" | "rightBottomOver";
|
|
302
302
|
hideOnSinglePage?: boolean;
|
|
303
303
|
hoverShowPageSelect?: boolean;
|
|
304
304
|
};
|
package/lib/cjs/table/Table.js
CHANGED
|
@@ -566,10 +566,15 @@ class Table extends _baseComponent.default {
|
|
|
566
566
|
titleArr.push(sorter);
|
|
567
567
|
}
|
|
568
568
|
|
|
569
|
+
const stateFilteredValue = (0, _get2.default)(curQuery, 'filteredValue');
|
|
570
|
+
const defaultFilteredValue = (0, _get2.default)(curQuery, 'defaultFilteredValue');
|
|
571
|
+
const filteredValue = stateFilteredValue ? stateFilteredValue : defaultFilteredValue;
|
|
572
|
+
|
|
569
573
|
if ((0, _isArray.default)(column.filters) && column.filters.length || /*#__PURE__*/(0, _react.isValidElement)(column.filterDropdown)) {
|
|
570
574
|
const filter = /*#__PURE__*/_react.default.createElement(_ColumnFilter.default, (0, _assign.default)({
|
|
571
575
|
key: _constants.strings.DEFAULT_KEY_COLUMN_FILTER
|
|
572
576
|
}, curQuery, {
|
|
577
|
+
filteredValue: filteredValue,
|
|
573
578
|
onFilterDropdownVisibleChange: visible => _this.foundation.toggleShowFilter(dataIndex, visible),
|
|
574
579
|
onSelect: data => _this.foundation.handleFilterSelect(dataIndex, data)
|
|
575
580
|
}));
|
|
@@ -1154,11 +1159,12 @@ class Table extends _baseComponent.default {
|
|
|
1154
1159
|
willUpdateStates.cachedColumns = props.columns;
|
|
1155
1160
|
willUpdateStates.cachedChildren = null;
|
|
1156
1161
|
} else if (props.children && props.children !== state.cachedChildren) {
|
|
1157
|
-
const
|
|
1162
|
+
const newNestedColumns = (0, _getColumns.default)(props.children);
|
|
1163
|
+
const newFlattenColumns = (0, _utils.flattenColumns)(newNestedColumns);
|
|
1158
1164
|
const columns = (0, _utils.mergeColumns)(state.queries, newFlattenColumns, null, false);
|
|
1159
1165
|
willUpdateStates.flattenColumns = newFlattenColumns;
|
|
1160
1166
|
willUpdateStates.queries = [...columns];
|
|
1161
|
-
willUpdateStates.cachedColumns = [...
|
|
1167
|
+
willUpdateStates.cachedColumns = [...newNestedColumns];
|
|
1162
1168
|
willUpdateStates.cachedChildren = props.children;
|
|
1163
1169
|
} // Update controlled selection column
|
|
1164
1170
|
|
|
@@ -1294,15 +1300,18 @@ class Table extends _baseComponent.default {
|
|
|
1294
1300
|
const _dataSource = [...dataSource];
|
|
1295
1301
|
const filteredSortedDataSource = this.foundation.getFilteredSortedDataSource(_dataSource, stateQueries);
|
|
1296
1302
|
this.foundation.setCachedFilteredSortedDataSource(filteredSortedDataSource);
|
|
1297
|
-
states.dataSource = filteredSortedDataSource;
|
|
1298
|
-
|
|
1299
|
-
states.pagination = (0, _isObject2.default)(statePagination) ? (0, _assign.default)((0, _assign.default)({}, statePagination), {
|
|
1300
|
-
currentPage: (0, _isObject2.default)(propsPagination) && propsPagination.currentPage ? propsPagination.currentPage : 1
|
|
1301
|
-
}) : statePagination;
|
|
1303
|
+
states.dataSource = filteredSortedDataSource;
|
|
1302
1304
|
|
|
1303
1305
|
if (this.props.groupBy) {
|
|
1304
1306
|
states.groups = null;
|
|
1305
1307
|
}
|
|
1308
|
+
} // when dataSource has change, should reset currentPage
|
|
1309
|
+
|
|
1310
|
+
|
|
1311
|
+
if (dataSource !== prevProps.dataSource) {
|
|
1312
|
+
states.pagination = (0, _isObject2.default)(statePagination) ? (0, _assign.default)((0, _assign.default)({}, statePagination), {
|
|
1313
|
+
currentPage: (0, _isObject2.default)(propsPagination) && propsPagination.currentPage ? propsPagination.currentPage : 1
|
|
1314
|
+
}) : statePagination;
|
|
1306
1315
|
}
|
|
1307
1316
|
|
|
1308
1317
|
if ((0, _keys.default)(states).length) {
|
|
@@ -1484,6 +1493,7 @@ class Table extends _baseComponent.default {
|
|
|
1484
1493
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
1485
1494
|
ref: this.rootWrapRef,
|
|
1486
1495
|
className: (0, _classnames.default)(className, "".concat(prefixCls, "-wrapper")),
|
|
1496
|
+
"data-column-fixed": anyColumnFixed,
|
|
1487
1497
|
style: wrapStyle,
|
|
1488
1498
|
id: id
|
|
1489
1499
|
}, /*#__PURE__*/_react.default.createElement(_TableContextProvider.default, (0, _assign.default)({}, tableContextValue), /*#__PURE__*/_react.default.createElement(_spin.default, {
|
|
@@ -63,6 +63,7 @@ export interface ColumnProps<RecordType extends Record<string, any> = any> {
|
|
|
63
63
|
className?: string;
|
|
64
64
|
colSpan?: number;
|
|
65
65
|
dataIndex?: string;
|
|
66
|
+
defaultFilteredValue?: any[];
|
|
66
67
|
defaultSortOrder?: SortOrder;
|
|
67
68
|
filterChildrenRecord?: boolean;
|
|
68
69
|
filterDropdown?: React.ReactNode;
|
|
@@ -69,6 +69,7 @@ export declare type TimePickerProps = {
|
|
|
69
69
|
zIndex?: number | string;
|
|
70
70
|
onBlur?: React.FocusEventHandler<HTMLInputElement>;
|
|
71
71
|
onChange?: TimePickerAdapter['notifyChange'];
|
|
72
|
+
onChangeWithDateFirst?: boolean;
|
|
72
73
|
onFocus?: React.FocusEventHandler<HTMLInputElement>;
|
|
73
74
|
onOpenChange?: (open: boolean) => void;
|
|
74
75
|
};
|
|
@@ -169,6 +170,7 @@ export default class TimePicker extends BaseComponent<TimePickerProps, TimePicke
|
|
|
169
170
|
onFocus: (...args: any[]) => void;
|
|
170
171
|
onBlur: (...args: any[]) => void;
|
|
171
172
|
onChange: (...args: any[]) => void;
|
|
173
|
+
onChangeWithDateFirst: boolean;
|
|
172
174
|
use12Hours: boolean;
|
|
173
175
|
focusOnOpen: boolean;
|
|
174
176
|
onKeyDown: (...args: any[]) => void;
|
|
@@ -183,9 +183,7 @@ class TimePicker extends _baseComponent.default {
|
|
|
183
183
|
notifyOpenChange: function () {
|
|
184
184
|
return _this2.props.onOpenChange(...arguments);
|
|
185
185
|
},
|
|
186
|
-
notifyChange:
|
|
187
|
-
return _this2.props.onChange && _this2.props.onChange(...arguments);
|
|
188
|
-
},
|
|
186
|
+
notifyChange: (agr1, arg2) => this.props.onChange && this.props.onChange(agr1, arg2),
|
|
189
187
|
notifyFocus: function () {
|
|
190
188
|
return _this2.props.onFocus && _this2.props.onFocus(...arguments);
|
|
191
189
|
},
|
|
@@ -332,6 +330,7 @@ class TimePicker extends _baseComponent.default {
|
|
|
332
330
|
panelFooter,
|
|
333
331
|
rangeSeparator,
|
|
334
332
|
onOpenChange,
|
|
333
|
+
onChangeWithDateFirst,
|
|
335
334
|
popupClassName: propPopupClassName,
|
|
336
335
|
hideDisabledOptions,
|
|
337
336
|
use12Hours,
|
|
@@ -343,7 +342,7 @@ class TimePicker extends _baseComponent.default {
|
|
|
343
342
|
motion,
|
|
344
343
|
autoAdjustOverflow
|
|
345
344
|
} = _a,
|
|
346
|
-
rest = __rest(_a, ["prefixCls", "placeholder", "disabled", "defaultValue", "className", "popupStyle", "size", "style", "locale", "localeCode", "zIndex", "getPopupContainer", "insetLabel", "insetLabelId", "inputStyle", "showClear", "panelHeader", "panelFooter", "rangeSeparator", "onOpenChange", "popupClassName", "hideDisabledOptions", "use12Hours", "minuteStep", "hourStep", "secondStep", "scrollItemProps", "triggerRender", "motion", "autoAdjustOverflow"]);
|
|
345
|
+
rest = __rest(_a, ["prefixCls", "placeholder", "disabled", "defaultValue", "className", "popupStyle", "size", "style", "locale", "localeCode", "zIndex", "getPopupContainer", "insetLabel", "insetLabelId", "inputStyle", "showClear", "panelHeader", "panelFooter", "rangeSeparator", "onOpenChange", "onChangeWithDateFirst", "popupClassName", "hideDisabledOptions", "use12Hours", "minuteStep", "hourStep", "secondStep", "scrollItemProps", "triggerRender", "motion", "autoAdjustOverflow"]);
|
|
347
346
|
|
|
348
347
|
const format = this.foundation.getDefaultFormatIfNeed();
|
|
349
348
|
const position = this.foundation.getPosition();
|
|
@@ -503,6 +502,7 @@ TimePicker.defaultProps = (0, _assign.default)({
|
|
|
503
502
|
onFocus: _noop2.default,
|
|
504
503
|
onBlur: _noop2.default,
|
|
505
504
|
onChange: _noop2.default,
|
|
505
|
+
onChangeWithDateFirst: true,
|
|
506
506
|
use12Hours: false,
|
|
507
507
|
focusOnOpen: false,
|
|
508
508
|
onKeyDown: _noop2.default,
|
|
@@ -91,6 +91,7 @@ export default class LocaleTimePicker extends React.PureComponent<LocalePickerPr
|
|
|
91
91
|
onFocus: (...args: any[]) => void;
|
|
92
92
|
onBlur: (...args: any[]) => void;
|
|
93
93
|
onChange: (...args: any[]) => void;
|
|
94
|
+
onChangeWithDateFirst: boolean;
|
|
94
95
|
use12Hours: boolean;
|
|
95
96
|
focusOnOpen: boolean;
|
|
96
97
|
onKeyDown: (...args: any[]) => void;
|
|
@@ -67,7 +67,7 @@ export default class Tooltip extends BaseComponent<TooltipProps, TooltipState> {
|
|
|
67
67
|
children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
68
68
|
motion: PropTypes.Requireable<boolean | object>;
|
|
69
69
|
autoAdjustOverflow: PropTypes.Requireable<boolean>;
|
|
70
|
-
position: PropTypes.Requireable<"top" | "topLeft" | "topRight" | "left" | "leftTop" | "leftBottom" | "right" | "rightTop" | "rightBottom" | "bottom" | "bottomLeft" | "bottomRight" | "leftTopOver" | "rightTopOver">;
|
|
70
|
+
position: PropTypes.Requireable<"top" | "topLeft" | "topRight" | "left" | "leftTop" | "leftBottom" | "right" | "rightTop" | "rightBottom" | "bottom" | "bottomLeft" | "bottomRight" | "leftTopOver" | "rightTopOver" | "leftBottomOver" | "rightBottomOver">;
|
|
71
71
|
getPopupContainer: PropTypes.Requireable<(...args: any[]) => any>;
|
|
72
72
|
mouseEnterDelay: PropTypes.Requireable<number>;
|
|
73
73
|
mouseLeaveDelay: PropTypes.Requireable<number>;
|
package/lib/cjs/tree/index.d.ts
CHANGED
|
@@ -70,6 +70,7 @@ declare class Tree extends BaseComponent<TreeProps, TreeState> {
|
|
|
70
70
|
onDragStart: PropTypes.Requireable<(...args: any[]) => any>;
|
|
71
71
|
onDrop: PropTypes.Requireable<(...args: any[]) => any>;
|
|
72
72
|
labelEllipsis: PropTypes.Requireable<boolean>;
|
|
73
|
+
checkRelation: PropTypes.Requireable<string>;
|
|
73
74
|
'aria-label': PropTypes.Requireable<string>;
|
|
74
75
|
};
|
|
75
76
|
static defaultProps: {
|
|
@@ -90,6 +91,7 @@ declare class Tree extends BaseComponent<TreeProps, TreeState> {
|
|
|
90
91
|
disableStrictly: boolean;
|
|
91
92
|
draggable: boolean;
|
|
92
93
|
autoExpandWhenDragEnter: boolean;
|
|
94
|
+
checkRelation: string;
|
|
93
95
|
};
|
|
94
96
|
static TreeNode: typeof TreeNode;
|
|
95
97
|
inputRef: React.RefObject<typeof Input>;
|
package/lib/cjs/tree/index.js
CHANGED
|
@@ -236,6 +236,7 @@ class Tree extends _baseComponent.default {
|
|
|
236
236
|
selectedKeys: [],
|
|
237
237
|
checkedKeys: new _set.default(),
|
|
238
238
|
halfCheckedKeys: new _set.default(),
|
|
239
|
+
realCheckedKeys: new _set.default([]),
|
|
239
240
|
motionKeys: new _set.default([]),
|
|
240
241
|
motionType: 'hide',
|
|
241
242
|
expandedKeys: new _set.default(props.expandedKeys),
|
|
@@ -446,12 +447,16 @@ class Tree extends _baseComponent.default {
|
|
|
446
447
|
}
|
|
447
448
|
|
|
448
449
|
if (checkedKeyValues) {
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
450
|
+
if (props.checkRelation === 'unRelated') {
|
|
451
|
+
newState.realCheckedKeys = new _set.default(checkedKeyValues);
|
|
452
|
+
} else if (props.checkRelation === 'related') {
|
|
453
|
+
const {
|
|
454
|
+
checkedKeys,
|
|
455
|
+
halfCheckedKeys
|
|
456
|
+
} = (0, _treeUtil.calcCheckedKeys)(checkedKeyValues, keyEntities);
|
|
457
|
+
newState.checkedKeys = checkedKeys;
|
|
458
|
+
newState.halfCheckedKeys = halfCheckedKeys;
|
|
459
|
+
}
|
|
455
460
|
}
|
|
456
461
|
} // update loadedKeys
|
|
457
462
|
|
|
@@ -461,7 +466,7 @@ class Tree extends _baseComponent.default {
|
|
|
461
466
|
} // update disableStrictly
|
|
462
467
|
|
|
463
468
|
|
|
464
|
-
if (treeData && props.disableStrictly) {
|
|
469
|
+
if (treeData && props.disableStrictly && props.checkRelation === 'related') {
|
|
465
470
|
newState.disabledKeys = (0, _treeUtil.calcDisabledKeys)(keyEntities);
|
|
466
471
|
}
|
|
467
472
|
|
|
@@ -782,6 +787,7 @@ Tree.propTypes = {
|
|
|
782
787
|
onDragStart: _propTypes.default.func,
|
|
783
788
|
onDrop: _propTypes.default.func,
|
|
784
789
|
labelEllipsis: _propTypes.default.bool,
|
|
790
|
+
checkRelation: _propTypes.default.string,
|
|
785
791
|
'aria-label': _propTypes.default.string
|
|
786
792
|
};
|
|
787
793
|
Tree.defaultProps = {
|
|
@@ -801,7 +807,8 @@ Tree.defaultProps = {
|
|
|
801
807
|
expandAction: false,
|
|
802
808
|
disableStrictly: false,
|
|
803
809
|
draggable: false,
|
|
804
|
-
autoExpandWhenDragEnter: true
|
|
810
|
+
autoExpandWhenDragEnter: true,
|
|
811
|
+
checkRelation: 'related'
|
|
805
812
|
};
|
|
806
813
|
Tree.TreeNode = _treeNode.default;
|
|
807
814
|
var _default = Tree;
|
package/lib/cjs/tree/treeNode.js
CHANGED
|
@@ -24,6 +24,8 @@ var _forEach = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-st
|
|
|
24
24
|
|
|
25
25
|
var _concat = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/concat"));
|
|
26
26
|
|
|
27
|
+
var _isEmpty2 = _interopRequireDefault(require("lodash/isEmpty"));
|
|
28
|
+
|
|
27
29
|
var _get2 = _interopRequireDefault(require("lodash/get"));
|
|
28
30
|
|
|
29
31
|
var _isString2 = _interopRequireDefault(require("lodash/isString"));
|
|
@@ -506,7 +508,14 @@ class TreeNode extends _react.PureComponent {
|
|
|
506
508
|
ref: this.setRef
|
|
507
509
|
}, dragProps));
|
|
508
510
|
} else {
|
|
509
|
-
|
|
511
|
+
if ((0, _isEmpty2.default)(style)) {
|
|
512
|
+
return customLabel;
|
|
513
|
+
} else {
|
|
514
|
+
// In virtualization, props.style will contain location information
|
|
515
|
+
return /*#__PURE__*/_react.default.cloneElement(customLabel, {
|
|
516
|
+
style: (0, _assign.default)((0, _assign.default)({}, (0, _get2.default)(customLabel, ['props', 'style'])), style)
|
|
517
|
+
});
|
|
518
|
+
}
|
|
510
519
|
}
|
|
511
520
|
}
|
|
512
521
|
|