@douyinfe/semi-ui 2.56.3-alpha.0 → 2.56.4-alpha.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/dist/umd/semi-ui.js +118 -78
- 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/lib/cjs/anchor/index.d.ts +1 -1
- package/lib/cjs/autoComplete/index.d.ts +1 -1
- package/lib/cjs/button/Button.d.ts +1 -1
- package/lib/cjs/button/buttonGroup.d.ts +1 -1
- package/lib/cjs/button/index.d.ts +1 -1
- package/lib/cjs/datePicker/datePicker.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.d.ts +1 -1
- package/lib/cjs/input/inputGroup.d.ts +1 -1
- package/lib/cjs/locale/source/vi_VN.js +41 -41
- package/lib/cjs/modal/Modal.js +4 -0
- package/lib/cjs/modal/confirm.d.ts +6 -6
- package/lib/cjs/rating/index.d.ts +1 -1
- package/lib/cjs/rating/item.d.ts +1 -1
- package/lib/cjs/switch/index.d.ts +1 -1
- package/lib/cjs/table/Table.d.ts +2 -2
- package/lib/cjs/table/index.d.ts +1 -1
- package/lib/cjs/tagInput/index.d.ts +1 -1
- package/lib/cjs/timePicker/TimePicker.d.ts +1 -1
- package/lib/cjs/timePicker/index.d.ts +1 -1
- package/lib/cjs/treeSelect/index.d.ts +2 -1
- package/lib/cjs/treeSelect/index.js +56 -54
- package/lib/cjs/typography/title.d.ts +1 -1
- package/lib/es/anchor/index.d.ts +1 -1
- package/lib/es/autoComplete/index.d.ts +1 -1
- package/lib/es/button/Button.d.ts +1 -1
- package/lib/es/button/buttonGroup.d.ts +1 -1
- package/lib/es/button/index.d.ts +1 -1
- package/lib/es/datePicker/datePicker.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.d.ts +1 -1
- package/lib/es/input/inputGroup.d.ts +1 -1
- package/lib/es/locale/source/vi_VN.js +41 -41
- package/lib/es/modal/Modal.js +4 -0
- package/lib/es/modal/confirm.d.ts +6 -6
- package/lib/es/rating/index.d.ts +1 -1
- package/lib/es/rating/item.d.ts +1 -1
- package/lib/es/switch/index.d.ts +1 -1
- package/lib/es/table/Table.d.ts +2 -2
- package/lib/es/table/index.d.ts +1 -1
- package/lib/es/tagInput/index.d.ts +1 -1
- package/lib/es/timePicker/TimePicker.d.ts +1 -1
- package/lib/es/timePicker/index.d.ts +1 -1
- package/lib/es/treeSelect/index.d.ts +2 -1
- package/lib/es/treeSelect/index.js +56 -54
- package/lib/es/typography/title.d.ts +1 -1
- package/package.json +8 -8
package/dist/umd/semi-ui.js
CHANGED
|
@@ -62215,6 +62215,7 @@ class Modal extends BaseComponent {
|
|
|
62215
62215
|
footerFill
|
|
62216
62216
|
} = this.props;
|
|
62217
62217
|
const getCancelButton = locale => {
|
|
62218
|
+
var _a;
|
|
62218
62219
|
if (!hasCancel) {
|
|
62219
62220
|
return null;
|
|
62220
62221
|
} else {
|
|
@@ -62226,6 +62227,9 @@ class Modal extends BaseComponent {
|
|
|
62226
62227
|
block: footerFill,
|
|
62227
62228
|
autoFocus: true
|
|
62228
62229
|
}, this.props.cancelButtonProps, {
|
|
62230
|
+
style: Object.assign(Object.assign({}, footerFill ? {
|
|
62231
|
+
marginLeft: "unset"
|
|
62232
|
+
} : {}), (_a = this.props.cancelButtonProps) === null || _a === void 0 ? void 0 : _a.style),
|
|
62229
62233
|
"x-semi-children-alias": "cancelText"
|
|
62230
62234
|
}), cancelText || locale.cancel);
|
|
62231
62235
|
}
|
|
@@ -90389,7 +90393,7 @@ class TreeSelectFoundation extends foundation {
|
|
|
90389
90393
|
} = this.getProps();
|
|
90390
90394
|
const newExpandedKeys = new Set(expandedKeys);
|
|
90391
90395
|
const isExpandControlled = this._isExpandControlled();
|
|
90392
|
-
const expandedOptsKeys = findAncestorKeys(selectedKeys, keyEntities);
|
|
90396
|
+
const expandedOptsKeys = findAncestorKeys(selectedKeys, keyEntities, false);
|
|
90393
90397
|
expandedOptsKeys.forEach(item => newExpandedKeys.add(item));
|
|
90394
90398
|
const newFlattenNodes = flattenTreeData(treeData, newExpandedKeys, keyMaps);
|
|
90395
90399
|
this._adapter.updateState({
|
|
@@ -90426,7 +90430,7 @@ class TreeSelectFoundation extends foundation {
|
|
|
90426
90430
|
let newFlattenNodes = [];
|
|
90427
90431
|
let filteredShownKeys = new Set([]);
|
|
90428
90432
|
if (!sugInput) {
|
|
90429
|
-
expandedOptsKeys = findAncestorKeys(selectedKeys, keyEntities);
|
|
90433
|
+
expandedOptsKeys = findAncestorKeys(selectedKeys, keyEntities, false);
|
|
90430
90434
|
expandedOptsKeys.forEach(item => newExpandedKeys.add(item));
|
|
90431
90435
|
newFlattenNodes = flattenTreeData(treeData, newExpandedKeys, keyMaps);
|
|
90432
90436
|
} else {
|
|
@@ -90729,6 +90733,36 @@ class TreeSelectFoundation extends foundation {
|
|
|
90729
90733
|
setLoadKeys(data, resolve) {
|
|
90730
90734
|
this._adapter.updateLoadKeys(data, resolve);
|
|
90731
90735
|
}
|
|
90736
|
+
handlePopoverVisibleChange(isVisible) {
|
|
90737
|
+
const {
|
|
90738
|
+
filterTreeNode,
|
|
90739
|
+
searchAutoFocus,
|
|
90740
|
+
searchPosition
|
|
90741
|
+
} = this.getProps();
|
|
90742
|
+
const inputValue = this.getState('inputValue');
|
|
90743
|
+
// 将 inputValue 清空,如果有选中值的话,选中项能够快速回显
|
|
90744
|
+
// Clear the inputValue. If there is a selected value, the selected item can be quickly echoed.
|
|
90745
|
+
if (isVisible === false && filterTreeNode) {
|
|
90746
|
+
inputValue && this._adapter.setClearInputFlag(true);
|
|
90747
|
+
this.clearInputValue();
|
|
90748
|
+
}
|
|
90749
|
+
if (filterTreeNode && searchPosition === treeSelect_constants_strings.SEARCH_POSITION_DROPDOWN && isVisible && searchAutoFocus) {
|
|
90750
|
+
this.focusInput(true);
|
|
90751
|
+
}
|
|
90752
|
+
}
|
|
90753
|
+
handleAfterClose() {
|
|
90754
|
+
// flattenNode 的变化将导致弹出层面板中的选项数目变化
|
|
90755
|
+
// 在弹层完全收起之后,再通过 clearInput 重新计算 state 中的 expandedKey, flattenNode
|
|
90756
|
+
// 防止在弹出层未收起时弹层面板中选项数目变化导致视觉上出现弹层闪动问题
|
|
90757
|
+
// Changes to flattenNode will cause the number of options in the popup panel to change
|
|
90758
|
+
// After the pop-up layer is completely closed, recalculate the expandedKey and flattenNode in the state through clearInput.
|
|
90759
|
+
// Prevent the pop-up layer from flickering visually due to changes in the number of options in the pop-up panel when the pop-up layer is not collapsed.
|
|
90760
|
+
const {
|
|
90761
|
+
filterTreeNode
|
|
90762
|
+
} = this.getProps();
|
|
90763
|
+
const shouldClear = this._adapter.getClearInputFlag();
|
|
90764
|
+
filterTreeNode && shouldClear && this.clearInput();
|
|
90765
|
+
}
|
|
90732
90766
|
}
|
|
90733
90767
|
// EXTERNAL MODULE: ../semi-foundation/treeSelect/treeSelect.scss
|
|
90734
90768
|
var treeSelect = __webpack_require__("ZrYm");
|
|
@@ -91093,15 +91127,17 @@ class TreeSelect extends BaseComponent {
|
|
|
91093
91127
|
leafOnly,
|
|
91094
91128
|
searchPosition,
|
|
91095
91129
|
triggerRender,
|
|
91096
|
-
borderless
|
|
91130
|
+
borderless,
|
|
91131
|
+
checkRelation
|
|
91097
91132
|
} = _a,
|
|
91098
|
-
rest = treeSelect_rest(_a, ["disabled", "multiple", "filterTreeNode", "validateStatus", "prefix", "suffix", "style", "size", "insetLabel", "className", "placeholder", "showClear", "leafOnly", "searchPosition", "triggerRender", "borderless"]);
|
|
91133
|
+
rest = treeSelect_rest(_a, ["disabled", "multiple", "filterTreeNode", "validateStatus", "prefix", "suffix", "style", "size", "insetLabel", "className", "placeholder", "showClear", "leafOnly", "searchPosition", "triggerRender", "borderless", "checkRelation"]);
|
|
91099
91134
|
const {
|
|
91100
91135
|
inputValue,
|
|
91101
91136
|
selectedKeys,
|
|
91102
91137
|
checkedKeys,
|
|
91103
91138
|
keyEntities,
|
|
91104
|
-
isFocus
|
|
91139
|
+
isFocus,
|
|
91140
|
+
realCheckedKeys
|
|
91105
91141
|
} = this.state;
|
|
91106
91142
|
const filterable = Boolean(filterTreeNode);
|
|
91107
91143
|
const useCustomTrigger = typeof triggerRender === 'function';
|
|
@@ -91129,31 +91165,45 @@ class TreeSelect extends BaseComponent {
|
|
|
91129
91165
|
[`${treeSelect_prefixcls}-with-suffix`]: suffix,
|
|
91130
91166
|
[`${treeSelect_prefixcls}-with-suffix`]: suffix
|
|
91131
91167
|
}, className);
|
|
91132
|
-
|
|
91133
|
-
|
|
91134
|
-
|
|
91135
|
-
|
|
91136
|
-
|
|
91137
|
-
|
|
91138
|
-
|
|
91139
|
-
|
|
91140
|
-
|
|
91141
|
-
|
|
91142
|
-
|
|
91143
|
-
|
|
91144
|
-
|
|
91145
|
-
|
|
91146
|
-
|
|
91147
|
-
|
|
91148
|
-
|
|
91149
|
-
|
|
91150
|
-
|
|
91151
|
-
|
|
91152
|
-
|
|
91153
|
-
|
|
91154
|
-
|
|
91155
|
-
|
|
91156
|
-
}
|
|
91168
|
+
let inner;
|
|
91169
|
+
if (useCustomTrigger) {
|
|
91170
|
+
let triggerRenderKeys = [];
|
|
91171
|
+
if (multiple) {
|
|
91172
|
+
if (checkRelation === 'related') {
|
|
91173
|
+
triggerRenderKeys = normalizeKeyList(checkedKeys, keyEntities, leafOnly, true);
|
|
91174
|
+
} else if (checkRelation === 'unRelated') {
|
|
91175
|
+
triggerRenderKeys = [...realCheckedKeys];
|
|
91176
|
+
}
|
|
91177
|
+
} else {
|
|
91178
|
+
triggerRenderKeys = selectedKeys;
|
|
91179
|
+
}
|
|
91180
|
+
inner = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(trigger, {
|
|
91181
|
+
inputValue: inputValue,
|
|
91182
|
+
value: triggerRenderKeys.map(key => get_default()(keyEntities, [key, 'data'])),
|
|
91183
|
+
disabled: disabled,
|
|
91184
|
+
placeholder: placeholder,
|
|
91185
|
+
onClear: this.handleClear,
|
|
91186
|
+
componentName: 'TreeSelect',
|
|
91187
|
+
triggerRender: triggerRender,
|
|
91188
|
+
componentProps: Object.assign({}, this.props),
|
|
91189
|
+
onSearch: this.search,
|
|
91190
|
+
onRemove: this.removeTag
|
|
91191
|
+
});
|
|
91192
|
+
} else {
|
|
91193
|
+
inner = [/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(external_root_React_commonjs2_react_commonjs_react_amd_react_.Fragment, {
|
|
91194
|
+
key: 'prefix'
|
|
91195
|
+
}, prefix || insetLabel ? this.renderPrefix() : null), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(external_root_React_commonjs2_react_commonjs_react_amd_react_.Fragment, {
|
|
91196
|
+
key: 'selection'
|
|
91197
|
+
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
|
|
91198
|
+
className: `${treeSelect_prefixcls}-selection`
|
|
91199
|
+
}, this.renderSelectContent())), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(external_root_React_commonjs2_react_commonjs_react_amd_react_.Fragment, {
|
|
91200
|
+
key: 'suffix'
|
|
91201
|
+
}, suffix ? this.renderSuffix() : null), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(external_root_React_commonjs2_react_commonjs_react_amd_react_.Fragment, {
|
|
91202
|
+
key: 'clearBtn'
|
|
91203
|
+
}, showClear || isTriggerPositionSearch && inputValue ? this.renderClearBtn() : null), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(external_root_React_commonjs2_react_commonjs_react_amd_react_.Fragment, {
|
|
91204
|
+
key: 'arrow'
|
|
91205
|
+
}, this.renderArrow())];
|
|
91206
|
+
}
|
|
91157
91207
|
const tabIndex = disabled ? null : 0;
|
|
91158
91208
|
/**
|
|
91159
91209
|
* Reasons for disabling the a11y eslint rule:
|
|
@@ -91408,33 +91458,12 @@ class TreeSelect extends BaseComponent {
|
|
|
91408
91458
|
} = data;
|
|
91409
91459
|
return key;
|
|
91410
91460
|
};
|
|
91411
|
-
/* Event handler function after popover
|
|
91412
|
-
this.
|
|
91413
|
-
|
|
91414
|
-
filterTreeNode,
|
|
91415
|
-
searchAutoFocus,
|
|
91416
|
-
searchPosition
|
|
91417
|
-
} = this.props;
|
|
91418
|
-
// 将 inputValue 清空,如果有选中值的话,选中项能够快速回显
|
|
91419
|
-
// Clear the inputValue. If there is a selected value, the selected item can be quickly echoed.
|
|
91420
|
-
if (isVisible === false && filterTreeNode) {
|
|
91421
|
-
this.foundation.clearInputValue();
|
|
91422
|
-
}
|
|
91423
|
-
if (filterTreeNode && searchPosition === treeSelect_constants_strings.SEARCH_POSITION_DROPDOWN && isVisible && searchAutoFocus) {
|
|
91424
|
-
this.foundation.focusInput(true);
|
|
91425
|
-
}
|
|
91461
|
+
/* Event handler function after popover visible change */
|
|
91462
|
+
this.handlePopoverVisibleChange = isVisible => {
|
|
91463
|
+
this.foundation.handlePopoverVisibleChange(isVisible);
|
|
91426
91464
|
};
|
|
91427
91465
|
this.afterClose = () => {
|
|
91428
|
-
|
|
91429
|
-
// 在弹层完全收起之后,再通过 clearInput 重新计算 state 中的 expandedKey, flattenNode
|
|
91430
|
-
// 防止在弹出层未收起时弹层面板中选项数目变化导致视觉上出现弹层闪动问题
|
|
91431
|
-
// Changes to flattenNode will cause the number of options in the popup panel to change
|
|
91432
|
-
// After the pop-up layer is completely closed, recalculate the expandedKey and flattenNode in the state through clearInput.
|
|
91433
|
-
// Prevent the pop-up layer from flickering visually due to changes in the number of options in the pop-up panel when the pop-up layer is not collapsed.
|
|
91434
|
-
const {
|
|
91435
|
-
filterTreeNode
|
|
91436
|
-
} = this.props;
|
|
91437
|
-
filterTreeNode && this.foundation.clearInput();
|
|
91466
|
+
this.foundation.handleAfterClose();
|
|
91438
91467
|
};
|
|
91439
91468
|
this.renderTreeNode = (treeNode, ind, style) => {
|
|
91440
91469
|
const {
|
|
@@ -91630,6 +91659,7 @@ class TreeSelect extends BaseComponent {
|
|
|
91630
91659
|
this.triggerRef = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createRef();
|
|
91631
91660
|
this.optionsRef = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createRef();
|
|
91632
91661
|
this.clickOutsideHandler = null;
|
|
91662
|
+
this.clearInputFlag = false;
|
|
91633
91663
|
this.foundation = new TreeSelectFoundation(this.adapter);
|
|
91634
91664
|
this.treeSelectID = Math.random().toString(36).slice(2);
|
|
91635
91665
|
this.onMotionEnd = () => {
|
|
@@ -91980,6 +92010,12 @@ class TreeSelect extends BaseComponent {
|
|
|
91980
92010
|
this.setState({
|
|
91981
92011
|
isFocus: bool
|
|
91982
92012
|
});
|
|
92013
|
+
},
|
|
92014
|
+
setClearInputFlag: flag => {
|
|
92015
|
+
this.clearInputFlag = flag;
|
|
92016
|
+
},
|
|
92017
|
+
getClearInputFlag: () => {
|
|
92018
|
+
return this.clearInputFlag;
|
|
91983
92019
|
}
|
|
91984
92020
|
});
|
|
91985
92021
|
}
|
|
@@ -92023,7 +92059,7 @@ class TreeSelect extends BaseComponent {
|
|
|
92023
92059
|
autoAdjustOverflow: autoAdjustOverflow,
|
|
92024
92060
|
mouseLeaveDelay: mouseLeaveDelay,
|
|
92025
92061
|
mouseEnterDelay: mouseEnterDelay,
|
|
92026
|
-
onVisibleChange: this.
|
|
92062
|
+
onVisibleChange: this.handlePopoverVisibleChange,
|
|
92027
92063
|
afterClose: this.afterClose
|
|
92028
92064
|
}, selection);
|
|
92029
92065
|
}
|
|
@@ -92369,7 +92405,7 @@ class UploadFoundation extends foundation {
|
|
|
92369
92405
|
addOnPasting
|
|
92370
92406
|
} = this.getProps();
|
|
92371
92407
|
this.releaseMemory();
|
|
92372
|
-
if (
|
|
92408
|
+
if (!disabled) {
|
|
92373
92409
|
this.unbindPastingHandler();
|
|
92374
92410
|
}
|
|
92375
92411
|
}
|
|
@@ -93252,27 +93288,31 @@ class UploadFoundation extends foundation {
|
|
|
93252
93288
|
handlePasting(e) {
|
|
93253
93289
|
const isMac = this._adapter.isMac();
|
|
93254
93290
|
const isCombineKeydown = isMac ? e.metaKey : e.ctrlKey;
|
|
93255
|
-
|
|
93256
|
-
|
|
93257
|
-
|
|
93258
|
-
|
|
93259
|
-
|
|
93260
|
-
|
|
93261
|
-
|
|
93262
|
-
|
|
93263
|
-
|
|
93264
|
-
|
|
93265
|
-
|
|
93266
|
-
|
|
93267
|
-
//
|
|
93268
|
-
|
|
93269
|
-
|
|
93270
|
-
|
|
93271
|
-
|
|
93272
|
-
|
|
93273
|
-
|
|
93274
|
-
|
|
93275
|
-
|
|
93291
|
+
const {
|
|
93292
|
+
addOnPasting
|
|
93293
|
+
} = this.getProps();
|
|
93294
|
+
if (addOnPasting) {
|
|
93295
|
+
if (isCombineKeydown && e.code === 'KeyV' && e.target === document.body) {
|
|
93296
|
+
// https://github.com/microsoft/TypeScript/issues/33923
|
|
93297
|
+
const permissionName = 'clipboard-read';
|
|
93298
|
+
// The main thread should not be blocked by clipboard, so callback writing is required here. No await here
|
|
93299
|
+
navigator.permissions.query({
|
|
93300
|
+
name: permissionName
|
|
93301
|
+
}).then(result => {
|
|
93302
|
+
if (result.state === 'granted' || result.state === 'prompt') {
|
|
93303
|
+
// user has authorized or will authorize
|
|
93304
|
+
navigator.clipboard.read().then(clipboardItems => {
|
|
93305
|
+
// Process the data read from the pasteboard
|
|
93306
|
+
// Check the returned data type to determine if it is image data, and process accordingly
|
|
93307
|
+
this.readFileFromClipboard(clipboardItems);
|
|
93308
|
+
});
|
|
93309
|
+
} else {
|
|
93310
|
+
this._adapter.notifyPastingError(result);
|
|
93311
|
+
}
|
|
93312
|
+
}).catch(error => {
|
|
93313
|
+
this._adapter.notifyPastingError(error);
|
|
93314
|
+
});
|
|
93315
|
+
}
|
|
93276
93316
|
}
|
|
93277
93317
|
}
|
|
93278
93318
|
bindPastingHandler() {
|