@douyinfe/semi-foundation 2.30.0-alpha.0 → 2.30.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/datePicker/monthsGridFoundation.ts +9 -3
- package/lib/cjs/anchor/constants.js +1 -1
- package/lib/cjs/anchor/foundation.js +3 -3
- package/lib/cjs/autoComplete/constants.js +3 -3
- package/lib/cjs/avatar/constants.js +1 -1
- package/lib/cjs/backtop/constants.js +1 -1
- package/lib/cjs/badge/constants.js +1 -1
- package/lib/cjs/banner/constants.js +1 -1
- package/lib/cjs/breadcrumb/constants.js +1 -1
- package/lib/cjs/button/constants.js +1 -1
- package/lib/cjs/calendar/constants.js +1 -1
- package/lib/cjs/card/constants.js +1 -1
- package/lib/cjs/carousel/constants.js +9 -9
- package/lib/cjs/cascader/constants.js +2 -2
- package/lib/cjs/cascader/foundation.js +1 -1
- package/lib/cjs/cascader/util.js +2 -2
- package/lib/cjs/checkbox/constants.js +13 -13
- package/lib/cjs/collapse/constants.js +1 -1
- package/lib/cjs/collapsible/constants.js +1 -1
- package/lib/cjs/datePicker/_utils/getInsetInputFormatToken.js +1 -1
- package/lib/cjs/datePicker/_utils/getMonthTable.js +4 -4
- package/lib/cjs/datePicker/_utils/getMonthsInYear.js +1 -1
- package/lib/cjs/datePicker/constants.js +27 -27
- package/lib/cjs/datePicker/foundation.js +3 -3
- package/lib/cjs/datePicker/inputFoundation.js +2 -2
- package/lib/cjs/datePicker/monthsGridFoundation.js +15 -4
- package/lib/cjs/descriptions/constants.js +1 -1
- package/lib/cjs/divider/constants.js +1 -1
- package/lib/cjs/dropdown/constants.js +3 -3
- package/lib/cjs/dropdown/menuFoundation.js +1 -1
- package/lib/cjs/empty/constants.js +1 -1
- package/lib/cjs/form/constants.js +1 -1
- package/lib/cjs/form/foundation.js +1 -1
- package/lib/cjs/form/utils.js +1 -1
- package/lib/cjs/grid/constants.js +1 -1
- package/lib/cjs/highlight/constants.js +1 -1
- package/lib/cjs/icons/constants.js +1 -1
- package/lib/cjs/image/constants.js +1 -1
- package/lib/cjs/input/constants.js +1 -1
- package/lib/cjs/input/textareaFoundation.js +1 -1
- package/lib/cjs/layout/constants.js +1 -1
- package/lib/cjs/list/constants.js +1 -1
- package/lib/cjs/modal/constants.js +1 -1
- package/lib/cjs/navigation/constants.js +1 -1
- package/lib/cjs/notification/constants.js +3 -3
- package/lib/cjs/pagination/constants.js +1 -1
- package/lib/cjs/popconfirm/constants.js +2 -2
- package/lib/cjs/popconfirm/popconfirmFoundation.d.ts +4 -0
- package/lib/cjs/popconfirm/popconfirmFoundation.js +21 -1
- package/lib/cjs/popover/constants.js +2 -2
- package/lib/cjs/progress/constants.js +1 -1
- package/lib/cjs/progress/generates.js +14 -14
- package/lib/cjs/radio/constants.js +13 -13
- package/lib/cjs/rating/constants.js +1 -1
- package/lib/cjs/scrollList/constants.js +2 -2
- package/lib/cjs/select/constants.js +3 -3
- package/lib/cjs/select/foundation.js +2 -1
- package/lib/cjs/select/select.css +1 -0
- package/lib/cjs/select/select.scss +1 -0
- package/lib/cjs/select/variables.scss +1 -0
- package/lib/cjs/sideSheet/constants.js +2 -2
- package/lib/cjs/skeleton/constants.js +1 -1
- package/lib/cjs/slider/constants.js +7 -7
- package/lib/cjs/space/constants.js +1 -1
- package/lib/cjs/spin/constants.js +1 -1
- package/lib/cjs/steps/bacisSteps.scss +238 -286
- package/lib/cjs/steps/constants.js +2 -2
- package/lib/cjs/steps/fillSteps.scss +142 -148
- package/lib/cjs/steps/navSteps.scss +40 -60
- package/lib/cjs/steps/steps.css +14 -377
- package/lib/cjs/switch/constants.js +13 -13
- package/lib/cjs/table/constants.js +7 -7
- package/lib/cjs/table/utils.js +2 -2
- package/lib/cjs/tabs/constants.js +21 -21
- package/lib/cjs/tag/constants.js +1 -1
- package/lib/cjs/tag/tag.css +9 -2
- package/lib/cjs/tag/tag.scss +13 -4
- package/lib/cjs/tagInput/constants.js +1 -1
- package/lib/cjs/timePicker/ComboxFoundation.js +2 -2
- package/lib/cjs/timePicker/constants.js +3 -3
- package/lib/cjs/timePicker/utils/index.js +3 -3
- package/lib/cjs/timeline/constants.js +2 -2
- package/lib/cjs/toast/constants.js +3 -3
- package/lib/cjs/tooltip/constants.js +1 -1
- package/lib/cjs/tooltip/foundation.d.ts +1 -1
- package/lib/cjs/tooltip/foundation.js +15 -12
- package/lib/cjs/transfer/constants.js +1 -1
- package/lib/cjs/tree/constants.js +2 -2
- package/lib/cjs/tree/treeUtil.d.ts +1 -1
- package/lib/cjs/tree/treeUtil.js +1 -1
- package/lib/cjs/treeSelect/constants.js +3 -3
- package/lib/cjs/treeSelect/foundation.d.ts +5 -2
- package/lib/cjs/treeSelect/foundation.js +42 -17
- package/lib/cjs/treeSelect/treeSelect.css +5 -1
- package/lib/cjs/treeSelect/treeSelect.scss +6 -0
- package/lib/cjs/treeSelect/variables.scss +1 -1
- package/lib/cjs/typography/constants.js +1 -1
- package/lib/cjs/typography/formatNumeral.js +6 -11
- package/lib/cjs/upload/constants.d.ts +1 -1
- package/lib/cjs/upload/constants.js +2 -2
- package/lib/cjs/upload/foundation.js +1 -1
- package/lib/cjs/upload/utils.js +4 -4
- package/lib/cjs/utils/getMotionObjFromProps.js +2 -2
- package/lib/cjs/utils/touchPolyfill.js +1 -1
- package/lib/cjs/utils/uuid.js +2 -2
- package/lib/cjs/utils/warning.js +1 -1
- package/lib/es/anchor/constants.js +1 -1
- package/lib/es/anchor/foundation.js +3 -3
- package/lib/es/autoComplete/constants.js +3 -3
- package/lib/es/avatar/constants.js +1 -1
- package/lib/es/backtop/constants.js +1 -1
- package/lib/es/badge/constants.js +1 -1
- package/lib/es/banner/constants.js +1 -1
- package/lib/es/breadcrumb/constants.js +1 -1
- package/lib/es/button/constants.js +1 -1
- package/lib/es/calendar/constants.js +1 -1
- package/lib/es/card/constants.js +1 -1
- package/lib/es/carousel/constants.js +9 -9
- package/lib/es/cascader/constants.js +2 -2
- package/lib/es/cascader/foundation.js +1 -1
- package/lib/es/cascader/util.js +2 -2
- package/lib/es/checkbox/constants.js +13 -13
- package/lib/es/collapse/constants.js +1 -1
- package/lib/es/collapsible/constants.js +1 -1
- package/lib/es/datePicker/_utils/getInsetInputFormatToken.js +1 -1
- package/lib/es/datePicker/_utils/getMonthTable.js +4 -4
- package/lib/es/datePicker/_utils/getMonthsInYear.js +1 -1
- package/lib/es/datePicker/constants.js +27 -27
- package/lib/es/datePicker/foundation.js +3 -3
- package/lib/es/datePicker/inputFoundation.js +2 -2
- package/lib/es/datePicker/monthsGridFoundation.js +15 -4
- package/lib/es/descriptions/constants.js +1 -1
- package/lib/es/divider/constants.js +1 -1
- package/lib/es/dropdown/constants.js +3 -3
- package/lib/es/dropdown/menuFoundation.js +1 -1
- package/lib/es/empty/constants.js +1 -1
- package/lib/es/form/constants.js +1 -1
- package/lib/es/form/foundation.js +1 -1
- package/lib/es/form/utils.js +1 -1
- package/lib/es/grid/constants.js +1 -1
- package/lib/es/highlight/constants.js +1 -1
- package/lib/es/icons/constants.js +1 -1
- package/lib/es/image/constants.js +1 -1
- package/lib/es/input/constants.js +1 -1
- package/lib/es/input/textareaFoundation.js +1 -1
- package/lib/es/layout/constants.js +1 -1
- package/lib/es/list/constants.js +1 -1
- package/lib/es/modal/constants.js +1 -1
- package/lib/es/navigation/constants.js +1 -1
- package/lib/es/notification/constants.js +3 -3
- package/lib/es/pagination/constants.js +1 -1
- package/lib/es/popconfirm/constants.js +2 -2
- package/lib/es/popconfirm/popconfirmFoundation.d.ts +4 -0
- package/lib/es/popconfirm/popconfirmFoundation.js +20 -1
- package/lib/es/popover/constants.js +2 -2
- package/lib/es/progress/constants.js +1 -1
- package/lib/es/progress/generates.js +14 -14
- package/lib/es/radio/constants.js +13 -13
- package/lib/es/rating/constants.js +1 -1
- package/lib/es/scrollList/constants.js +2 -2
- package/lib/es/select/constants.js +3 -3
- package/lib/es/select/foundation.js +2 -1
- package/lib/es/select/select.css +1 -0
- package/lib/es/select/select.scss +1 -0
- package/lib/es/select/variables.scss +1 -0
- package/lib/es/sideSheet/constants.js +2 -2
- package/lib/es/skeleton/constants.js +1 -1
- package/lib/es/slider/constants.js +7 -7
- package/lib/es/space/constants.js +1 -1
- package/lib/es/spin/constants.js +1 -1
- package/lib/es/steps/bacisSteps.scss +238 -286
- package/lib/es/steps/constants.js +2 -2
- package/lib/es/steps/fillSteps.scss +142 -148
- package/lib/es/steps/navSteps.scss +40 -60
- package/lib/es/steps/steps.css +14 -377
- package/lib/es/switch/constants.js +13 -13
- package/lib/es/table/constants.js +7 -7
- package/lib/es/table/utils.js +2 -2
- package/lib/es/tabs/constants.js +21 -21
- package/lib/es/tag/constants.js +1 -1
- package/lib/es/tag/tag.css +9 -2
- package/lib/es/tag/tag.scss +13 -4
- package/lib/es/tagInput/constants.js +1 -1
- package/lib/es/timePicker/ComboxFoundation.js +2 -2
- package/lib/es/timePicker/constants.js +3 -3
- package/lib/es/timePicker/utils/index.js +3 -3
- package/lib/es/timeline/constants.js +2 -2
- package/lib/es/toast/constants.js +3 -3
- package/lib/es/tooltip/constants.js +1 -1
- package/lib/es/tooltip/foundation.d.ts +1 -1
- package/lib/es/tooltip/foundation.js +15 -12
- package/lib/es/transfer/constants.js +1 -1
- package/lib/es/tree/constants.js +2 -2
- package/lib/es/tree/treeUtil.d.ts +1 -1
- package/lib/es/tree/treeUtil.js +1 -1
- package/lib/es/treeSelect/constants.js +3 -3
- package/lib/es/treeSelect/foundation.d.ts +5 -2
- package/lib/es/treeSelect/foundation.js +42 -17
- package/lib/es/treeSelect/treeSelect.css +5 -1
- package/lib/es/treeSelect/treeSelect.scss +6 -0
- package/lib/es/treeSelect/variables.scss +1 -1
- package/lib/es/typography/constants.js +1 -1
- package/lib/es/typography/formatNumeral.js +6 -11
- package/lib/es/upload/constants.d.ts +1 -1
- package/lib/es/upload/constants.js +2 -2
- package/lib/es/upload/foundation.js +1 -1
- package/lib/es/upload/utils.js +4 -4
- package/lib/es/utils/getMotionObjFromProps.js +2 -2
- package/lib/es/utils/touchPolyfill.js +1 -1
- package/lib/es/utils/uuid.js +2 -2
- package/lib/es/utils/warning.js +1 -1
- package/package.json +3 -3
- package/popconfirm/popconfirmFoundation.ts +20 -1
- package/select/select.scss +1 -0
- package/select/variables.scss +1 -0
- package/steps/bacisSteps.scss +238 -286
- package/steps/fillSteps.scss +142 -148
- package/steps/navSteps.scss +40 -60
- package/tag/tag.scss +13 -4
- package/tooltip/foundation.ts +8 -5
- package/treeSelect/foundation.ts +39 -15
- package/treeSelect/treeSelect.scss +6 -0
- package/treeSelect/variables.scss +1 -1
- package/typography/formatNumeral.ts +2 -5
|
@@ -118,14 +118,14 @@ export const isTimeFormatLike = (time, formatToken) => {
|
|
|
118
118
|
let isLike = true;
|
|
119
119
|
const dateFnsSupportFormatCh = 'BDEGHKLMOPQRSTXYabcehimopqstuwxyz'; // dateFns support format character
|
|
120
120
|
|
|
121
|
-
const formatSupportChReg = new RegExp(
|
|
122
|
-
const formatNotSupportChReg = new RegExp(
|
|
121
|
+
const formatSupportChReg = new RegExp(`[${dateFnsSupportFormatCh}]`, 'g');
|
|
122
|
+
const formatNotSupportChReg = new RegExp(`[^${dateFnsSupportFormatCh}]`, 'g');
|
|
123
123
|
const hmsReg = /[H|m|s]{1,2}/;
|
|
124
124
|
const formatSplitted = formatToken.split(formatNotSupportChReg); // => ['HH', 'mm'];
|
|
125
125
|
|
|
126
126
|
const timeSeparator = formatToken.replace(formatSupportChReg, ''); // => :
|
|
127
127
|
|
|
128
|
-
const timeReg = new RegExp(
|
|
128
|
+
const timeReg = new RegExp(`[${timeSeparator}]`, 'g'); // => /[:]/g
|
|
129
129
|
|
|
130
130
|
const timeSplitted = time.split(timeReg); // => ['12', '0]
|
|
131
131
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { BASE_CLASS_PREFIX } from '../base/constants';
|
|
2
2
|
const cssClasses = {
|
|
3
|
-
PREFIX:
|
|
4
|
-
ITEM:
|
|
3
|
+
PREFIX: `${BASE_CLASS_PREFIX}-timeline`,
|
|
4
|
+
ITEM: `${BASE_CLASS_PREFIX}-timeline-item`
|
|
5
5
|
};
|
|
6
6
|
const strings = {
|
|
7
7
|
MODE: ['left', 'alternate', 'right', 'center'],
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { BASE_CLASS_PREFIX } from '../base/constants';
|
|
2
|
-
const PREFIX =
|
|
2
|
+
const PREFIX = `${BASE_CLASS_PREFIX}-toast`;
|
|
3
3
|
const cssClasses = {
|
|
4
4
|
PREFIX,
|
|
5
|
-
WRAPPER:
|
|
6
|
-
LIST:
|
|
5
|
+
WRAPPER: `${PREFIX}-wrapper`,
|
|
6
|
+
LIST: `${PREFIX}-list`
|
|
7
7
|
};
|
|
8
8
|
const strings = {
|
|
9
9
|
types: ['warning', 'success', 'info', 'error', 'default'],
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BASE_CLASS_PREFIX } from '../base/constants';
|
|
2
2
|
const cssClasses = {
|
|
3
|
-
PREFIX:
|
|
3
|
+
PREFIX: `${BASE_CLASS_PREFIX}-tooltip`
|
|
4
4
|
};
|
|
5
5
|
const strings = {
|
|
6
6
|
POSITION_SET: ['top', 'topLeft', 'topRight', 'left', 'leftTop', 'leftBottom', 'right', 'rightTop', 'rightBottom', 'bottom', 'bottomLeft', 'bottomRight', 'leftTopOver', 'rightTopOver', 'leftBottomOver', 'rightBottomOver'],
|
|
@@ -133,7 +133,7 @@ export default class Tooltip<P = Record<string, any>, S = Record<string, any>> e
|
|
|
133
133
|
* 如果 trigger 是 focus 或者 hover,则它绑定了 onFocus,这里我们如果重新 focus 的话,popup 会再次打开
|
|
134
134
|
* 因此 returnFocusOnClose 只支持 click trigger
|
|
135
135
|
*/
|
|
136
|
-
|
|
136
|
+
focusTrigger(): void;
|
|
137
137
|
_handleEscKeyDown(event: any): void;
|
|
138
138
|
_handleContainerTabKeyDown(focusableElements: any[], event: any): void;
|
|
139
139
|
_handleContainerShiftTabKeyDown(focusableElements: any[], event: any): void;
|
|
@@ -480,23 +480,23 @@ export default class Tooltip extends BaseFoundation {
|
|
|
480
480
|
if (position && triggerRect && translateX != null && translateY != null) {
|
|
481
481
|
if (this.getProp('transformFromCenter')) {
|
|
482
482
|
if (['topLeft', 'bottomLeft'].includes(position)) {
|
|
483
|
-
return
|
|
483
|
+
return `${this._roundPixel(triggerRect.width / 2)}px ${-translateY * 100}%`;
|
|
484
484
|
}
|
|
485
485
|
|
|
486
486
|
if (['topRight', 'bottomRight'].includes(position)) {
|
|
487
|
-
return
|
|
487
|
+
return `calc(100% - ${this._roundPixel(triggerRect.width / 2)}px) ${-translateY * 100}%`;
|
|
488
488
|
}
|
|
489
489
|
|
|
490
490
|
if (['leftTop', 'rightTop'].includes(position)) {
|
|
491
|
-
return
|
|
491
|
+
return `${-translateX * 100}% ${this._roundPixel(triggerRect.height / 2)}px`;
|
|
492
492
|
}
|
|
493
493
|
|
|
494
494
|
if (['leftBottom', 'rightBottom'].includes(position)) {
|
|
495
|
-
return
|
|
495
|
+
return `${-translateX * 100}% calc(100% - ${this._roundPixel(triggerRect.height / 2)}px)`;
|
|
496
496
|
}
|
|
497
497
|
}
|
|
498
498
|
|
|
499
|
-
return
|
|
499
|
+
return `${-translateX * 100}% ${-translateY * 100}%`;
|
|
500
500
|
}
|
|
501
501
|
|
|
502
502
|
return null;
|
|
@@ -507,6 +507,9 @@ export default class Tooltip extends BaseFoundation {
|
|
|
507
507
|
spacing,
|
|
508
508
|
isOverFlow
|
|
509
509
|
} = props;
|
|
510
|
+
const {
|
|
511
|
+
innerWidth
|
|
512
|
+
} = window;
|
|
510
513
|
const triggerRect = (_isEmpty(props.triggerRect) ? props.triggerRect : this._adapter.getTriggerBounding()) || Object.assign({}, defaultRect);
|
|
511
514
|
const containerRect = (_isEmpty(props.containerRect) ? props.containerRect : this._adapter.getPopupContainerRect()) || Object.assign({}, defaultRect);
|
|
512
515
|
const wrapperRect = (_isEmpty(props.wrapperRect) ? props.wrapperRect : this._adapter.getWrapperBounding()) || Object.assign({}, defaultRect); // eslint-disable-next-line
|
|
@@ -549,6 +552,7 @@ export default class Tooltip extends BaseFoundation {
|
|
|
549
552
|
const isWidthOverFlow = isOverFlow && isOverFlow[1];
|
|
550
553
|
const isTriggerNearLeft = middleX - containerRect.left < containerRect.right - middleX;
|
|
551
554
|
const isTriggerNearTop = middleY - containerRect.top < containerRect.bottom - middleY;
|
|
555
|
+
const isWrapperWidthOverflow = wrapperRect.width > innerWidth;
|
|
552
556
|
|
|
553
557
|
switch (position) {
|
|
554
558
|
case 'top':
|
|
@@ -563,7 +567,7 @@ export default class Tooltip extends BaseFoundation {
|
|
|
563
567
|
case 'topLeft':
|
|
564
568
|
// left = pointAtCenter ? middleX - offsetXWithArrow : triggerRect.left;
|
|
565
569
|
// top = triggerRect.top - SPACING;
|
|
566
|
-
left = isWidthOverFlow ? containerRect.left : pointAtCenter ? middleX - offsetXWithArrow : triggerRect.left;
|
|
570
|
+
left = isWidthOverFlow ? isWrapperWidthOverflow ? containerRect.left : containerRect.right - wrapperRect.width : pointAtCenter ? middleX - offsetXWithArrow : triggerRect.left;
|
|
567
571
|
top = isHeightOverFlow ? containerRect.bottom + offsetHeight : triggerRect.top - SPACING;
|
|
568
572
|
translateY = -1;
|
|
569
573
|
break;
|
|
@@ -615,7 +619,7 @@ export default class Tooltip extends BaseFoundation {
|
|
|
615
619
|
case 'bottomLeft':
|
|
616
620
|
// left = pointAtCenter ? middleX - offsetXWithArrow : triggerRect.left;
|
|
617
621
|
// top = triggerRect.bottom + SPACING;
|
|
618
|
-
left = isWidthOverFlow ? containerRect.left : pointAtCenter ? middleX - offsetXWithArrow : triggerRect.left;
|
|
622
|
+
left = isWidthOverFlow ? isWrapperWidthOverflow ? containerRect.left : containerRect.right - wrapperRect.width : pointAtCenter ? middleX - offsetXWithArrow : triggerRect.left;
|
|
619
623
|
top = isHeightOverFlow ? containerRect.top + offsetYWithArrow - SPACING : triggerRect.top + triggerRect.height + SPACING;
|
|
620
624
|
break;
|
|
621
625
|
|
|
@@ -723,7 +727,7 @@ export default class Tooltip extends BaseFoundation {
|
|
|
723
727
|
let transform = ''; // eslint-disable-next-line
|
|
724
728
|
|
|
725
729
|
if (translateX != null) {
|
|
726
|
-
transform +=
|
|
730
|
+
transform += `translateX(${translateX * 100}%) `;
|
|
727
731
|
Object.defineProperty(style, 'translateX', {
|
|
728
732
|
enumerable: false,
|
|
729
733
|
value: translateX
|
|
@@ -732,7 +736,7 @@ export default class Tooltip extends BaseFoundation {
|
|
|
732
736
|
|
|
733
737
|
|
|
734
738
|
if (translateY != null) {
|
|
735
|
-
transform +=
|
|
739
|
+
transform += `translateY(${translateY * 100}%) `;
|
|
736
740
|
Object.defineProperty(style, 'translateY', {
|
|
737
741
|
enumerable: false,
|
|
738
742
|
value: translateY
|
|
@@ -1219,7 +1223,7 @@ export default class Tooltip extends BaseFoundation {
|
|
|
1219
1223
|
*/
|
|
1220
1224
|
|
|
1221
1225
|
|
|
1222
|
-
|
|
1226
|
+
focusTrigger() {
|
|
1223
1227
|
const {
|
|
1224
1228
|
trigger,
|
|
1225
1229
|
returnFocusOnClose,
|
|
@@ -1245,8 +1249,7 @@ export default class Tooltip extends BaseFoundation {
|
|
|
1245
1249
|
if (trigger !== 'custom') {
|
|
1246
1250
|
// Move the focus into the trigger first and then close the pop-up layer
|
|
1247
1251
|
// to avoid the problem of opening the pop-up layer again when the focus returns to the trigger in the case of hover and focus
|
|
1248
|
-
this.
|
|
1249
|
-
|
|
1252
|
+
this.focusTrigger();
|
|
1250
1253
|
this.hide();
|
|
1251
1254
|
}
|
|
1252
1255
|
|
package/lib/es/tree/constants.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { BASE_CLASS_PREFIX } from '../base/constants';
|
|
2
2
|
const cssClasses = {
|
|
3
|
-
PREFIX:
|
|
4
|
-
PREFIX_OPTION:
|
|
3
|
+
PREFIX: `${BASE_CLASS_PREFIX}-tree`,
|
|
4
|
+
PREFIX_OPTION: `${BASE_CLASS_PREFIX}-tree-option`
|
|
5
5
|
};
|
|
6
6
|
const strings = {
|
|
7
7
|
EXPAND_ACTION: [false, 'click', 'doubleClick']
|
|
@@ -75,6 +75,6 @@ export declare function getValueOrKey(data: any): any;
|
|
|
75
75
|
export declare function normalizeValue(value: any, withObject: boolean): any;
|
|
76
76
|
export declare function updateKeys(keySet: Set<string> | string[], keyEntities: KeyEntities): string[];
|
|
77
77
|
export declare function calcDisabledKeys(keyEntities: KeyEntities): Set<string>;
|
|
78
|
-
export declare function calcDropRelativePosition(event: any, treeNode: any):
|
|
78
|
+
export declare function calcDropRelativePosition(event: any, treeNode: any): 1 | -1 | 0;
|
|
79
79
|
export declare function getDragNodesKeys(key: string, keyEntities: KeyEntities): string[];
|
|
80
80
|
export declare function calcDropActualPosition(pos: string, relativeDropPos: any): any;
|
package/lib/es/tree/treeUtil.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { VALIDATE_STATUS, BASE_CLASS_PREFIX } from '../base/constants';
|
|
2
2
|
const cssClasses = {
|
|
3
|
-
PREFIX:
|
|
4
|
-
PREFIX_TREE:
|
|
5
|
-
PREFIX_OPTION:
|
|
3
|
+
PREFIX: `${BASE_CLASS_PREFIX}-tree-select`,
|
|
4
|
+
PREFIX_TREE: `${BASE_CLASS_PREFIX}-tree`,
|
|
5
|
+
PREFIX_OPTION: `${BASE_CLASS_PREFIX}-tree-select-option`
|
|
6
6
|
};
|
|
7
7
|
const strings = {
|
|
8
8
|
SIZE_SET: ['small', 'large', 'default'],
|
|
@@ -27,7 +27,7 @@ export interface BasicOnChange {
|
|
|
27
27
|
(node: BasicTreeNodeData[] | BasicTreeNodeData, e: any): void;
|
|
28
28
|
(value: BasicTreeNodeData['value'] | Array<BasicTreeNodeData['value']>, node: BasicTreeNodeData[] | BasicTreeNodeData, e: any): void;
|
|
29
29
|
}
|
|
30
|
-
export interface BasicTreeSelectProps extends Pick<BasicTreeProps, 'virtualize' | 'renderFullLabel' | 'renderLabel' | 'autoExpandParent' | 'className' | 'defaultExpandAll' | 'defaultExpandedKeys' | 'defaultValue' | 'disabled' | 'emptyContent' | 'expandAction' | 'expandedKeys' | 'filterTreeNode' | 'labelEllipsis' | 'leafOnly' | 'multiple' | 'onChangeWithObject' | 'showClear' | 'showFilteredOnly' | 'style' | 'treeData' | 'treeNodeFilterProp' | 'value' | 'onExpand' | 'expandAll' | 'disableStrictly' | 'aria-label' | 'checkRelation'> {
|
|
30
|
+
export interface BasicTreeSelectProps extends Pick<BasicTreeProps, 'virtualize' | 'renderFullLabel' | 'renderLabel' | 'autoExpandParent' | 'className' | 'defaultExpandAll' | 'defaultExpandedKeys' | 'defaultValue' | 'disabled' | 'emptyContent' | 'expandAction' | 'expandedKeys' | 'filterTreeNode' | 'labelEllipsis' | 'leafOnly' | 'multiple' | 'onChangeWithObject' | 'showClear' | 'showFilteredOnly' | 'style' | 'treeData' | 'treeNodeFilterProp' | 'value' | 'onExpand' | 'expandAll' | 'disableStrictly' | 'aria-label' | 'checkRelation' | 'preventScroll'> {
|
|
31
31
|
motion?: Motion;
|
|
32
32
|
mouseEnterDelay?: number;
|
|
33
33
|
mouseLeaveDelay?: number;
|
|
@@ -74,7 +74,6 @@ export interface BasicTreeSelectProps extends Pick<BasicTreeProps, 'virtualize'
|
|
|
74
74
|
export interface BasicTreeSelectInnerData extends Pick<BasicTreeInnerData, 'keyEntities' | 'treeData' | 'flattenNodes' | 'selectedKeys' | 'checkedKeys' | 'halfCheckedKeys' | 'motionKeys' | 'motionType' | 'expandedKeys' | 'filteredKeys' | 'filteredExpandedKeys' | 'filteredShownKeys' | 'cachedKeyValuePairs' | 'inputValue' | 'disabledKeys' | 'loadedKeys' | 'loadingKeys' | 'realCheckedKeys'> {
|
|
75
75
|
inputTriggerFocus: boolean;
|
|
76
76
|
isOpen: boolean;
|
|
77
|
-
isInput: boolean;
|
|
78
77
|
rePosKey: number;
|
|
79
78
|
dropdownMinWidth: null | number;
|
|
80
79
|
isHovering: boolean;
|
|
@@ -102,6 +101,7 @@ export interface TreeSelectAdapter<P = Record<string, any>, S = Record<string, a
|
|
|
102
101
|
notifyLoad: (newLoadedKeys: Set<string>, data: BasicTreeNodeData) => void;
|
|
103
102
|
updateInputFocus: (bool: boolean) => void;
|
|
104
103
|
updateLoadKeys: (data: BasicTreeNodeData, resolve: (value?: any) => void) => void;
|
|
104
|
+
updateIsFocus: (bool: boolean) => void;
|
|
105
105
|
}
|
|
106
106
|
export default class TreeSelectFoundation<P = Record<string, any>, S = Record<string, any>> extends BaseFoundation<TreeSelectAdapter<P, S>, P, S> {
|
|
107
107
|
constructor(adapter: TreeSelectAdapter<P, S>);
|
|
@@ -131,8 +131,11 @@ export default class TreeSelectFoundation<P = Record<string, any>, S = Record<st
|
|
|
131
131
|
focusInput(bool: boolean): void;
|
|
132
132
|
_notifyMultipleChange(key: string[], e: any): void;
|
|
133
133
|
_notifyChange(key: any, e: any): void;
|
|
134
|
+
_registerClickOutsideHandler: (e: any) => void;
|
|
134
135
|
_notifyFocus(e: any): void;
|
|
136
|
+
handleTriggerFocus(e: any): void;
|
|
135
137
|
_notifyBlur(e: any): void;
|
|
138
|
+
handlerTriggerBlur(e: any): void;
|
|
136
139
|
toggleHoverState(bool: boolean): void;
|
|
137
140
|
open(): void;
|
|
138
141
|
close(e: any): void;
|
|
@@ -14,6 +14,13 @@ import isEnterPress from '../utils/isEnterPress'; // eslint-disable-next-line ma
|
|
|
14
14
|
export default class TreeSelectFoundation extends BaseFoundation {
|
|
15
15
|
constructor(adapter) {
|
|
16
16
|
super(Object.assign({}, adapter));
|
|
17
|
+
|
|
18
|
+
this._registerClickOutsideHandler = e => {
|
|
19
|
+
this._adapter.registerClickOutsideHandler(e => {
|
|
20
|
+
this.handlerTriggerBlur(e);
|
|
21
|
+
this.close(e);
|
|
22
|
+
});
|
|
23
|
+
};
|
|
17
24
|
}
|
|
18
25
|
|
|
19
26
|
init() {
|
|
@@ -32,6 +39,10 @@ export default class TreeSelectFoundation extends BaseFoundation {
|
|
|
32
39
|
if (isOpen) {
|
|
33
40
|
this.open();
|
|
34
41
|
}
|
|
42
|
+
|
|
43
|
+
if (triggerSearchAutoFocus) {
|
|
44
|
+
this.handleTriggerFocus(null);
|
|
45
|
+
}
|
|
35
46
|
}
|
|
36
47
|
|
|
37
48
|
destroy() {
|
|
@@ -299,6 +310,14 @@ export default class TreeSelectFoundation extends BaseFoundation {
|
|
|
299
310
|
|
|
300
311
|
_notifyFocus(e) {
|
|
301
312
|
this._adapter.notifyFocus(e);
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
handleTriggerFocus(e) {
|
|
316
|
+
this._adapter.updateIsFocus(true);
|
|
317
|
+
|
|
318
|
+
this._notifyFocus(e);
|
|
319
|
+
|
|
320
|
+
this._registerClickOutsideHandler(e);
|
|
302
321
|
} // Scenes that may trigger blur
|
|
303
322
|
// 1、clickOutSide
|
|
304
323
|
// 2、click option / press enter, and then select complete(when multiple is false
|
|
@@ -309,6 +328,14 @@ export default class TreeSelectFoundation extends BaseFoundation {
|
|
|
309
328
|
this._adapter.notifyBlur(e);
|
|
310
329
|
}
|
|
311
330
|
|
|
331
|
+
handlerTriggerBlur(e) {
|
|
332
|
+
this._adapter.updateIsFocus(false);
|
|
333
|
+
|
|
334
|
+
this._notifyBlur(e);
|
|
335
|
+
|
|
336
|
+
this._adapter.unregisterClickOutsideHandler();
|
|
337
|
+
}
|
|
338
|
+
|
|
312
339
|
toggleHoverState(bool) {
|
|
313
340
|
this._adapter.toggleHovering(bool);
|
|
314
341
|
}
|
|
@@ -317,19 +344,11 @@ export default class TreeSelectFoundation extends BaseFoundation {
|
|
|
317
344
|
this._adapter.openMenu();
|
|
318
345
|
|
|
319
346
|
this._setDropdownWidth();
|
|
320
|
-
|
|
321
|
-
this._adapter.registerClickOutsideHandler(e => {
|
|
322
|
-
this.close(e);
|
|
323
|
-
});
|
|
324
347
|
}
|
|
325
348
|
|
|
326
349
|
close(e) {
|
|
327
350
|
this._adapter.closeMenu();
|
|
328
351
|
|
|
329
|
-
this._adapter.unregisterClickOutsideHandler();
|
|
330
|
-
|
|
331
|
-
this._notifyBlur(e);
|
|
332
|
-
|
|
333
352
|
if (this.getProp('motionExpand')) {
|
|
334
353
|
this._adapter.updateState({
|
|
335
354
|
motionKeys: new Set([])
|
|
@@ -342,7 +361,8 @@ export default class TreeSelectFoundation extends BaseFoundation {
|
|
|
342
361
|
|
|
343
362
|
const {
|
|
344
363
|
isOpen,
|
|
345
|
-
inputValue
|
|
364
|
+
inputValue,
|
|
365
|
+
isFocus
|
|
346
366
|
} = this.getStates();
|
|
347
367
|
const {
|
|
348
368
|
searchPosition
|
|
@@ -350,16 +370,20 @@ export default class TreeSelectFoundation extends BaseFoundation {
|
|
|
350
370
|
|
|
351
371
|
if (isDisabled) {
|
|
352
372
|
return;
|
|
353
|
-
} else
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
this._notifyFocus(e);
|
|
357
|
-
} else if (isOpen) {
|
|
358
|
-
if (searchPosition === 'trigger' && inputValue) {
|
|
359
|
-
return;
|
|
373
|
+
} else {
|
|
374
|
+
if (!isFocus) {
|
|
375
|
+
this.handleTriggerFocus(e);
|
|
360
376
|
}
|
|
361
377
|
|
|
362
|
-
|
|
378
|
+
if (isOpen) {
|
|
379
|
+
if (searchPosition === 'trigger' && inputValue) {
|
|
380
|
+
return;
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
this.close(e);
|
|
384
|
+
} else {
|
|
385
|
+
this.open();
|
|
386
|
+
}
|
|
363
387
|
}
|
|
364
388
|
}
|
|
365
389
|
/**
|
|
@@ -605,6 +629,7 @@ export default class TreeSelectFoundation extends BaseFoundation {
|
|
|
605
629
|
|
|
606
630
|
if (clickToHide && (this._isSelectToClose() || !data.children)) {
|
|
607
631
|
this.close(e);
|
|
632
|
+
this.handlerTriggerBlur(e);
|
|
608
633
|
}
|
|
609
634
|
}
|
|
610
635
|
|
|
@@ -17,12 +17,16 @@
|
|
|
17
17
|
}
|
|
18
18
|
.semi-tree-select:hover {
|
|
19
19
|
background-color: var(--semi-color-fill-1);
|
|
20
|
-
border: 1px solid
|
|
20
|
+
border: 1px solid transparent;
|
|
21
21
|
}
|
|
22
22
|
.semi-tree-select-focus {
|
|
23
23
|
border: 1px solid var(--semi-color-focus-border);
|
|
24
24
|
outline: 0;
|
|
25
25
|
}
|
|
26
|
+
.semi-tree-select-focus:hover {
|
|
27
|
+
border: 1px solid var(--semi-color-focus-border);
|
|
28
|
+
outline: 0;
|
|
29
|
+
}
|
|
26
30
|
.semi-tree-select-warning {
|
|
27
31
|
background-color: var(--semi-color-warning-light-default);
|
|
28
32
|
border-color: var(--semi-color-warning-light-default);
|
|
@@ -26,6 +26,12 @@ $module: #{$prefix}-tree-select;
|
|
|
26
26
|
outline: 0;
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
+
&-focus:hover {
|
|
30
|
+
border: $width-treeSelect_focus-border solid $color-treeSelect_default-border-focus;
|
|
31
|
+
outline: 0;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
|
|
29
35
|
&-warning {
|
|
30
36
|
background-color: $color-treeSelect_warning-bg-default;
|
|
31
37
|
border-color: $color-treeSelect_warning-border-default;
|
|
@@ -6,7 +6,7 @@ $color-treeSelect_default-icon-hover: var(--semi-color-primary-hover); // 树选
|
|
|
6
6
|
$color-treeSelect_default-icon-active: var(--semi-color-primary-active); // 树选择器选择框清空按钮颜色 - 按下
|
|
7
7
|
$color-treeSelect_default-bg-hover: var(--semi-color-fill-1); // 树选择器选择框背景颜色 - 悬停
|
|
8
8
|
|
|
9
|
-
$color-treeSelect_default-border-hover:
|
|
9
|
+
$color-treeSelect_default-border-hover: transparent; // 树选择器选择框描边颜色 - 悬浮
|
|
10
10
|
$color-treeSelect_default-border-focus: var(--semi-color-focus-border);// 树选择器选择框描边颜色 - 选中
|
|
11
11
|
|
|
12
12
|
$color-treeSelect_search-border-default: var(--semi-color-fill-0); // 树选择器菜单搜索框描边颜色 - 默认
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BASE_CLASS_PREFIX } from '../base/constants';
|
|
2
2
|
const cssClasses = {
|
|
3
|
-
PREFIX:
|
|
3
|
+
PREFIX: `${BASE_CLASS_PREFIX}-typography`
|
|
4
4
|
};
|
|
5
5
|
const strings = {
|
|
6
6
|
TYPE: ['primary', 'secondary', 'danger', 'warning', 'success', 'tertiary', 'quaternary'],
|
|
@@ -11,7 +11,7 @@ export default class FormatNumeral {
|
|
|
11
11
|
i++;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
return
|
|
14
|
+
return `${this.truncatePrecision(value)} ${units[i]}`;
|
|
15
15
|
},
|
|
16
16
|
'bytes-binary': value => {
|
|
17
17
|
const units = ['B', 'KiB', 'MiB', 'GiB', 'TiB', 'PiB', 'EiB', 'ZiB', 'YiB'];
|
|
@@ -22,21 +22,16 @@ export default class FormatNumeral {
|
|
|
22
22
|
i++;
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
return
|
|
25
|
+
return `${this.truncatePrecision(value)} ${units[i]}`;
|
|
26
26
|
},
|
|
27
27
|
percentages: value => {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
if (Number(cArr[0]) === 0) {
|
|
31
|
-
return "".concat(this.truncatePrecision(value * 100), "%");
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
return "".concat(this.truncatePrecision(value), "%");
|
|
28
|
+
// The rules here have been modified in version v2.30.0
|
|
29
|
+
return `${this.truncatePrecision(value * 100)}%`;
|
|
35
30
|
},
|
|
36
31
|
exponential: value => {
|
|
37
32
|
const vExponential = value.toExponential(this.precision + 2);
|
|
38
33
|
const vArr = vExponential.split('e');
|
|
39
|
-
return
|
|
34
|
+
return `${this.truncatePrecision(Number(vArr[0]))}e${vArr[1]}`;
|
|
40
35
|
}
|
|
41
36
|
}; // A collection of methods for truncating numbers; Methods key: Truncate (strings.Truncate);
|
|
42
37
|
|
|
@@ -86,7 +81,7 @@ export default class FormatNumeral {
|
|
|
86
81
|
const cTLength = cArr[1].length; // Fill in any missing `0` at the end.
|
|
87
82
|
|
|
88
83
|
if (cTLength < this.precision) {
|
|
89
|
-
return
|
|
84
|
+
return `${cArr[0]}.${cArr[1]}${'0'.repeat(this.precision - cTLength)}`;
|
|
90
85
|
}
|
|
91
86
|
|
|
92
87
|
return cTruncated.toString();
|
|
@@ -18,7 +18,7 @@ declare const strings: {
|
|
|
18
18
|
DRAG_AREA_ILLEGAL: string;
|
|
19
19
|
TRIGGER_AUTO: "auto";
|
|
20
20
|
TRIGGER_CUSTOM: "custom";
|
|
21
|
-
UPLOAD_TRIGGER: ("
|
|
21
|
+
UPLOAD_TRIGGER: ("auto" | "custom")[];
|
|
22
22
|
VALIDATE_STATUS: readonly ["default", "error", "warning", "success"];
|
|
23
23
|
PROMPT_POSITION: readonly ["left", "right", "bottom"];
|
|
24
24
|
};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { VALIDATE_STATUS, BASE_CLASS_PREFIX } from '../base/constants';
|
|
2
|
-
const PREFIX =
|
|
2
|
+
const PREFIX = `${BASE_CLASS_PREFIX}-upload`;
|
|
3
3
|
const FILE_LIST_PIC = 'picture';
|
|
4
4
|
const FILE_LIST_DEFAULT = 'list';
|
|
5
5
|
const PROGRESS_COEFFICIENT = 0.95;
|
|
6
6
|
const cssClasses = {
|
|
7
7
|
PREFIX,
|
|
8
8
|
// WRAPPER: `${PREFIX}-wrapper`,
|
|
9
|
-
LIST:
|
|
9
|
+
LIST: `${PREFIX}-list`
|
|
10
10
|
};
|
|
11
11
|
const TRIGGER_AUTO = 'auto';
|
|
12
12
|
const TRIGGER_CUSTOM = 'custom';
|
|
@@ -63,7 +63,7 @@ class UploadFoundation extends BaseFoundation {
|
|
|
63
63
|
fileName
|
|
64
64
|
} = _ref;
|
|
65
65
|
const status = xhr ? xhr.status : 0;
|
|
66
|
-
const msg = message ||
|
|
66
|
+
const msg = message || `cannot post ${fileName} to ${action}, xhr status: ${status}'`;
|
|
67
67
|
const err = new Error(msg);
|
|
68
68
|
err.status = status;
|
|
69
69
|
err.method = 'post';
|
package/lib/es/upload/utils.js
CHANGED
|
@@ -34,11 +34,11 @@ export const byteKB = 1024;
|
|
|
34
34
|
export const byteMB = 1048576;
|
|
35
35
|
export function getFileSize(number) {
|
|
36
36
|
if (number < byteKB) {
|
|
37
|
-
return
|
|
37
|
+
return `${(number / byteKB).toFixed(2)}KB`;
|
|
38
38
|
} else if (number >= byteKB && number < byteMB) {
|
|
39
|
-
return
|
|
39
|
+
return `${(number / byteKB).toFixed(1)}KB`;
|
|
40
40
|
} else if (number >= byteMB) {
|
|
41
|
-
return
|
|
41
|
+
return `${(number / byteMB).toFixed(1)}MB`;
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
return undefined;
|
|
@@ -108,7 +108,7 @@ export function mapFileTree(items) {
|
|
|
108
108
|
|
|
109
109
|
for (let index = 0; index < entries.length; index++) {
|
|
110
110
|
const entry = entries[index];
|
|
111
|
-
yield _traverseFileTree(entry,
|
|
111
|
+
yield _traverseFileTree(entry, `${path}${item.name}/`);
|
|
112
112
|
}
|
|
113
113
|
}
|
|
114
114
|
});
|
|
@@ -17,7 +17,7 @@ import warning from './warning';
|
|
|
17
17
|
|
|
18
18
|
export default function getMotionObjFromProps(props) {
|
|
19
19
|
if (typeof props !== 'object' || props === null) {
|
|
20
|
-
throw new TypeError(
|
|
20
|
+
throw new TypeError(`props should be object type, got ${typeof props}`);
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
const MOTION_PROPS = ['willEnter', 'didEnter', 'willLeave', 'didLeave', 'onStart', 'onRest', 'state'];
|
|
@@ -41,7 +41,7 @@ export default function getMotionObjFromProps(props) {
|
|
|
41
41
|
};
|
|
42
42
|
}
|
|
43
43
|
} else {
|
|
44
|
-
warning(true,
|
|
44
|
+
warning(true, `[Semi] duplicate motion key '${key}' from motion prop and props`);
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
47
|
} else if (typeof motionProp === 'function') {
|
package/lib/es/utils/uuid.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export default function getUuid(prefix) {
|
|
2
|
-
return
|
|
2
|
+
return `${prefix}-${new Date().getTime()}-${Math.random()}`;
|
|
3
3
|
} // https://stackoverflow.com/questions/105034/create-guid-uuid-in-javascript
|
|
4
4
|
|
|
5
5
|
function getUuidv4() {
|
|
@@ -39,7 +39,7 @@ function getUuidShort() {
|
|
|
39
39
|
randomId += characters.charAt(random);
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
return prefix ?
|
|
42
|
+
return prefix ? `${prefix}-${randomId}` : randomId;
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
export { getUuid, getUuidv4, getUuidShort };
|
package/lib/es/utils/warning.js
CHANGED
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@douyinfe/semi-foundation",
|
|
3
|
-
"version": "2.30.0
|
|
3
|
+
"version": "2.30.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"scripts": {
|
|
6
|
-
"build:lib": "node ./scripts/compileLib.js",
|
|
6
|
+
"build:lib": "export NODE_OPTIONS=--no-experimental-fetch && node ./scripts/compileLib.js",
|
|
7
7
|
"prepublishOnly": "npm run build:lib"
|
|
8
8
|
},
|
|
9
9
|
"dependencies": {
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"*.scss",
|
|
24
24
|
"*.css"
|
|
25
25
|
],
|
|
26
|
-
"gitHead": "
|
|
26
|
+
"gitHead": "c433ecebd974f8bb013a030b22d9a22cb8e70e9e",
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"@babel/plugin-transform-runtime": "^7.15.8",
|
|
29
29
|
"@babel/preset-env": "^7.15.8",
|