@douyinfe/semi-ui 2.42.3 → 2.43.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/dist/umd/semi-ui.js +109 -13
- 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/dropdown/dropdownItem.js +5 -1
- package/lib/cjs/table/ResizableTable.js +12 -7
- package/lib/cjs/tree/treeNode.js +3 -1
- package/lib/cjs/typography/base.d.ts +25 -4
- package/lib/cjs/typography/base.js +4 -4
- package/lib/cjs/typography/paragraph.d.ts +21 -0
- package/lib/cjs/typography/text.d.ts +21 -0
- package/lib/cjs/typography/title.d.ts +21 -0
- package/lib/cjs/upload/index.d.ts +6 -0
- package/lib/cjs/upload/index.js +19 -0
- package/lib/es/dropdown/dropdownItem.js +5 -1
- package/lib/es/table/ResizableTable.js +12 -7
- package/lib/es/tree/treeNode.js +3 -1
- package/lib/es/typography/base.d.ts +25 -4
- package/lib/es/typography/base.js +4 -4
- package/lib/es/typography/paragraph.d.ts +21 -0
- package/lib/es/typography/text.d.ts +21 -0
- package/lib/es/typography/title.d.ts +21 -0
- package/lib/es/upload/index.d.ts +6 -0
- package/lib/es/upload/index.js +19 -0
- package/package.json +8 -8
package/dist/umd/semi-ui.js
CHANGED
|
@@ -23867,8 +23867,8 @@ class Base extends external_root_React_commonjs2_react_commonjs_react_amd_react_
|
|
|
23867
23867
|
* 获取文本的缩略class和style
|
|
23868
23868
|
*
|
|
23869
23869
|
* 截断类型:
|
|
23870
|
-
* -
|
|
23871
|
-
* -
|
|
23870
|
+
* - 当设置中间截断(pos='middle')、可展开(expandable)、有后缀(suffix 非空)、可复制(copyable),启用 JS 截断策略
|
|
23871
|
+
* - 非以上场景,启用 CSS 截断策略
|
|
23872
23872
|
* 相关变量
|
|
23873
23873
|
* props:
|
|
23874
23874
|
* - ellipsis:
|
|
@@ -23884,8 +23884,8 @@ class Base extends external_root_React_commonjs2_react_commonjs_react_amd_react_
|
|
|
23884
23884
|
* Get the abbreviated class and style of the text
|
|
23885
23885
|
*
|
|
23886
23886
|
* Truncation type:
|
|
23887
|
-
* -
|
|
23888
|
-
* -
|
|
23887
|
+
* -When setting middle ellipsis (pos='middle')、expandable、suffix is not empty、copyable, the JS ellipsis strategy is enabled
|
|
23888
|
+
* -Otherwise, enable the CSS ellipsis strategy
|
|
23889
23889
|
* related variables
|
|
23890
23890
|
* props:
|
|
23891
23891
|
* -ellipsis:
|
|
@@ -60488,7 +60488,11 @@ class DropdownItem extends BaseComponent {
|
|
|
60488
60488
|
const events = {};
|
|
60489
60489
|
if (!disabled) {
|
|
60490
60490
|
['onClick', 'onMouseEnter', 'onMouseLeave', 'onContextMenu'].forEach(eventName => {
|
|
60491
|
-
|
|
60491
|
+
if (eventName === "onClick") {
|
|
60492
|
+
events["onMouseDown"] = this.props[eventName];
|
|
60493
|
+
} else {
|
|
60494
|
+
events[eventName] = this.props[eventName];
|
|
60495
|
+
}
|
|
60492
60496
|
});
|
|
60493
60497
|
}
|
|
60494
60498
|
let tick = null;
|
|
@@ -83983,20 +83987,25 @@ const ResizableTable = function () {
|
|
|
83983
83987
|
};
|
|
83984
83988
|
const resizableRender = function (col, index) {
|
|
83985
83989
|
let level = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
|
|
83990
|
+
let originalHeaderCellProps = arguments.length > 3 ? arguments[3] : undefined;
|
|
83986
83991
|
return Object.assign(Object.assign({}, col), {
|
|
83987
|
-
onHeaderCell: column =>
|
|
83988
|
-
|
|
83989
|
-
|
|
83990
|
-
|
|
83991
|
-
|
|
83992
|
-
|
|
83992
|
+
onHeaderCell: column => {
|
|
83993
|
+
return Object.assign(Object.assign({}, originalHeaderCellProps), {
|
|
83994
|
+
width: column.width,
|
|
83995
|
+
onResize: handleResize(column),
|
|
83996
|
+
onResizeStart: handleResizeStart(column),
|
|
83997
|
+
onResizeStop: handleResizeStop(column)
|
|
83998
|
+
});
|
|
83999
|
+
}
|
|
83993
84000
|
});
|
|
83994
84001
|
};
|
|
83995
84002
|
const assignResizableRender = function () {
|
|
83996
84003
|
let columns = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
83997
84004
|
let level = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
83998
84005
|
return Array.isArray(columns) && columns.length ? columns.map((col, index) => {
|
|
83999
|
-
|
|
84006
|
+
var _a, _b;
|
|
84007
|
+
const originalHeaderCellProps = (_b = (_a = col.onHeaderCell) === null || _a === void 0 ? void 0 : _a.call(col, col, index, level)) !== null && _b !== void 0 ? _b : {};
|
|
84008
|
+
Object.assign(col, resizableRender(col, index, level, originalHeaderCellProps));
|
|
84000
84009
|
const children = col[childrenColumnName];
|
|
84001
84010
|
if (Array.isArray(children) && children.length) {
|
|
84002
84011
|
col[childrenColumnName] = assignResizableRender(children, level + 1);
|
|
@@ -88302,7 +88311,9 @@ class TreeNode extends external_root_React_commonjs2_react_commonjs_react_amd_re
|
|
|
88302
88311
|
expandStatus: {
|
|
88303
88312
|
expanded,
|
|
88304
88313
|
loading
|
|
88305
|
-
}
|
|
88314
|
+
},
|
|
88315
|
+
filtered,
|
|
88316
|
+
searchWord: rest.keyword
|
|
88306
88317
|
};
|
|
88307
88318
|
const dragProps = {
|
|
88308
88319
|
onDoubleClick: this.onDoubleClick,
|
|
@@ -91573,8 +91584,24 @@ class UploadFoundation extends foundation {
|
|
|
91573
91584
|
constructor(adapter) {
|
|
91574
91585
|
super(Object.assign({}, adapter));
|
|
91575
91586
|
}
|
|
91587
|
+
init() {
|
|
91588
|
+
const {
|
|
91589
|
+
disabled,
|
|
91590
|
+
addOnPasting
|
|
91591
|
+
} = this.getProps();
|
|
91592
|
+
if (addOnPasting && !disabled) {
|
|
91593
|
+
this.bindPastingHandler();
|
|
91594
|
+
}
|
|
91595
|
+
}
|
|
91576
91596
|
destroy() {
|
|
91597
|
+
const {
|
|
91598
|
+
disabled,
|
|
91599
|
+
addOnPasting
|
|
91600
|
+
} = this.getProps();
|
|
91577
91601
|
this.releaseMemory();
|
|
91602
|
+
if (addOnPasting && !disabled) {
|
|
91603
|
+
this.unbindPastingHandler();
|
|
91604
|
+
}
|
|
91578
91605
|
}
|
|
91579
91606
|
getError(_ref) {
|
|
91580
91607
|
let {
|
|
@@ -92434,6 +92461,56 @@ class UploadFoundation extends foundation {
|
|
|
92434
92461
|
handlePreviewClick(fileItem) {
|
|
92435
92462
|
this._adapter.notifyPreviewClick(fileItem);
|
|
92436
92463
|
}
|
|
92464
|
+
readFileFromClipboard(clipboardItems) {
|
|
92465
|
+
for (const clipboardItem of clipboardItems) {
|
|
92466
|
+
for (const type of clipboardItem.types) {
|
|
92467
|
+
// types maybe: text/plain, image/png, text/html
|
|
92468
|
+
if (type.startsWith('image')) {
|
|
92469
|
+
clipboardItem.getType(type).then(blob => {
|
|
92470
|
+
return blob.arrayBuffer();
|
|
92471
|
+
}).then(buffer => {
|
|
92472
|
+
const format = type.split('/')[1];
|
|
92473
|
+
const file = new File([buffer], `upload.${format}`, {
|
|
92474
|
+
type
|
|
92475
|
+
});
|
|
92476
|
+
this.handleChange([file]);
|
|
92477
|
+
});
|
|
92478
|
+
}
|
|
92479
|
+
}
|
|
92480
|
+
}
|
|
92481
|
+
}
|
|
92482
|
+
handlePasting(e) {
|
|
92483
|
+
const isMac = this._adapter.isMac();
|
|
92484
|
+
const isCombineKeydown = isMac ? e.metaKey : e.ctrlKey;
|
|
92485
|
+
if (isCombineKeydown && e.code === 'KeyV' && e.target === document.body) {
|
|
92486
|
+
// https://github.com/microsoft/TypeScript/issues/33923
|
|
92487
|
+
const permissionName = "clipboard-read";
|
|
92488
|
+
// The main thread should not be blocked by clipboard, so callback writing is required here. No await here
|
|
92489
|
+
navigator.permissions.query({
|
|
92490
|
+
name: permissionName
|
|
92491
|
+
}).then(result => {
|
|
92492
|
+
console.log(result);
|
|
92493
|
+
if (result.state === 'granted' || result.state === 'prompt') {
|
|
92494
|
+
// user has authorized or will authorize
|
|
92495
|
+
navigator.clipboard.read().then(clipboardItems => {
|
|
92496
|
+
// Process the data read from the pasteboard
|
|
92497
|
+
// Check the returned data type to determine if it is image data, and process accordingly
|
|
92498
|
+
this.readFileFromClipboard(clipboardItems);
|
|
92499
|
+
});
|
|
92500
|
+
} else {
|
|
92501
|
+
this._adapter.notifyPastingError(result);
|
|
92502
|
+
}
|
|
92503
|
+
}).catch(error => {
|
|
92504
|
+
this._adapter.notifyPastingError(error);
|
|
92505
|
+
});
|
|
92506
|
+
}
|
|
92507
|
+
}
|
|
92508
|
+
bindPastingHandler() {
|
|
92509
|
+
this._adapter.registerPastingHandler(event => this.handlePasting(event));
|
|
92510
|
+
}
|
|
92511
|
+
unbindPastingHandler() {
|
|
92512
|
+
this._adapter.unRegisterPastingHandler();
|
|
92513
|
+
}
|
|
92437
92514
|
}
|
|
92438
92515
|
/* harmony default export */ const upload_foundation = (UploadFoundation);
|
|
92439
92516
|
;// CONCATENATED MODULE: ../semi-foundation/upload/fileCardFoundation.ts
|
|
@@ -93376,6 +93453,19 @@ class Upload extends BaseComponent {
|
|
|
93376
93453
|
replaceInputKey: Math.random()
|
|
93377
93454
|
}));
|
|
93378
93455
|
},
|
|
93456
|
+
isMac: () => {
|
|
93457
|
+
return navigator.platform.toUpperCase().indexOf('MAC') >= 0;
|
|
93458
|
+
},
|
|
93459
|
+
registerPastingHandler: cb => {
|
|
93460
|
+
document.body.addEventListener('keydown', cb);
|
|
93461
|
+
this.pastingCb = cb;
|
|
93462
|
+
},
|
|
93463
|
+
unRegisterPastingHandler: () => {
|
|
93464
|
+
if (this.pastingCb) {
|
|
93465
|
+
document.body.removeEventListener('keydown', this.pastingCb);
|
|
93466
|
+
}
|
|
93467
|
+
},
|
|
93468
|
+
notifyPastingError: error => this.props.onPastingError(error),
|
|
93379
93469
|
updateDragAreaStatus: dragAreaStatus => this.setState({
|
|
93380
93470
|
dragAreaStatus
|
|
93381
93471
|
}),
|
|
@@ -93400,6 +93490,9 @@ class Upload extends BaseComponent {
|
|
|
93400
93490
|
notifyBeforeClear: fileList => this.props.beforeClear(fileList)
|
|
93401
93491
|
});
|
|
93402
93492
|
}
|
|
93493
|
+
componentDidMount() {
|
|
93494
|
+
this.foundation.init();
|
|
93495
|
+
}
|
|
93403
93496
|
componentWillUnmount() {
|
|
93404
93497
|
this.foundation.destroy();
|
|
93405
93498
|
}
|
|
@@ -93475,6 +93568,7 @@ class Upload extends BaseComponent {
|
|
|
93475
93568
|
Upload.propTypes = {
|
|
93476
93569
|
accept: (prop_types_default()).string,
|
|
93477
93570
|
action: (prop_types_default()).string.isRequired,
|
|
93571
|
+
addOnPasting: (prop_types_default()).bool,
|
|
93478
93572
|
afterUpload: (prop_types_default()).func,
|
|
93479
93573
|
beforeClear: (prop_types_default()).func,
|
|
93480
93574
|
beforeRemove: (prop_types_default()).func,
|
|
@@ -93515,6 +93609,7 @@ Upload.propTypes = {
|
|
|
93515
93609
|
onRetry: (prop_types_default()).func,
|
|
93516
93610
|
onSizeError: (prop_types_default()).func,
|
|
93517
93611
|
onSuccess: (prop_types_default()).func,
|
|
93612
|
+
onPastingError: (prop_types_default()).func,
|
|
93518
93613
|
previewFile: (prop_types_default()).func,
|
|
93519
93614
|
prompt: (prop_types_default()).node,
|
|
93520
93615
|
promptPosition: prop_types_default().oneOf(upload_constants_strings.PROMPT_POSITION),
|
|
@@ -93559,6 +93654,7 @@ Upload.defaultProps = {
|
|
|
93559
93654
|
onRetry: (noop_default()),
|
|
93560
93655
|
onSizeError: (noop_default()),
|
|
93561
93656
|
onSuccess: (noop_default()),
|
|
93657
|
+
onPastingError: (noop_default()),
|
|
93562
93658
|
promptPosition: 'right',
|
|
93563
93659
|
showClear: true,
|
|
93564
93660
|
showPicInfo: false,
|