@douyinfe/semi-foundation 2.13.0 → 2.14.0-beta.1
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/anchor/foundation.ts +1 -2
- package/autoComplete/foundation.ts +29 -18
- package/avatar/avatar.scss +14 -0
- package/avatar/foundation.ts +17 -0
- package/avatar/variables.scss +3 -0
- package/base/foundation.ts +6 -0
- package/calendar/foundation.ts +2 -1
- package/cascader/cascader.scss +3 -0
- package/cascader/foundation.ts +3 -0
- package/checkbox/checkboxFoundation.ts +2 -1
- package/datePicker/foundation.ts +3 -3
- package/datePicker/inputFoundation.ts +1 -1
- package/datePicker/monthsGridFoundation.ts +8 -4
- package/form/utils.ts +5 -1
- package/input/foundation.ts +3 -11
- package/input/input.scss +6 -0
- package/input/textareaFoundation.ts +0 -9
- package/input/variables.scss +3 -0
- package/lib/cjs/anchor/foundation.d.ts +1 -2
- package/lib/cjs/autoComplete/foundation.d.ts +0 -1
- package/lib/cjs/autoComplete/foundation.js +35 -23
- package/lib/cjs/avatar/avatar.css +9 -0
- package/lib/cjs/avatar/avatar.scss +14 -0
- package/lib/cjs/avatar/foundation.d.ts +3 -0
- package/lib/cjs/avatar/foundation.js +20 -0
- package/lib/cjs/avatar/variables.scss +3 -0
- package/lib/cjs/base/foundation.js +12 -0
- package/lib/cjs/calendar/eventUtil.d.ts +1 -1
- package/lib/cjs/calendar/foundation.d.ts +1 -2
- package/lib/cjs/cascader/cascader.css +5 -0
- package/lib/cjs/cascader/cascader.scss +3 -0
- package/lib/cjs/cascader/foundation.d.ts +0 -11
- package/lib/cjs/cascader/foundation.js +5 -0
- package/lib/cjs/checkbox/checkboxFoundation.js +3 -1
- package/lib/cjs/datePicker/foundation.d.ts +3 -4
- package/lib/cjs/datePicker/inputFoundation.d.ts +1 -2
- package/lib/cjs/datePicker/monthsGridFoundation.d.ts +4 -5
- package/lib/cjs/form/utils.d.ts +5 -2
- package/lib/cjs/form/utils.js +4 -0
- package/lib/cjs/input/foundation.d.ts +0 -4
- package/lib/cjs/input/foundation.js +7 -13
- package/lib/cjs/input/input.css +6 -0
- package/lib/cjs/input/input.scss +6 -0
- package/lib/cjs/input/textareaFoundation.d.ts +0 -4
- package/lib/cjs/input/textareaFoundation.js +0 -12
- package/lib/cjs/input/variables.scss +3 -0
- package/lib/cjs/overflowList/foundation.d.ts +1 -0
- package/lib/cjs/overflowList/foundation.js +25 -0
- package/lib/cjs/radio/radio.css +6 -0
- package/lib/cjs/radio/radio.scss +8 -0
- package/lib/cjs/radio/radioFoundation.d.ts +3 -0
- package/lib/cjs/radio/radioFoundation.js +24 -0
- package/lib/cjs/radio/variables.scss +4 -0
- package/lib/cjs/select/foundation.js +2 -0
- package/lib/cjs/select/select.css +5 -0
- package/lib/cjs/select/select.scss +3 -0
- package/lib/cjs/switch/foundation.js +3 -1
- package/lib/cjs/tagInput/foundation.js +2 -0
- package/lib/cjs/tagInput/tagInput.css +1 -1
- package/lib/cjs/tagInput/variables.scss +1 -1
- package/lib/cjs/timePicker/foundation.js +4 -0
- package/lib/cjs/timePicker/utils/localeDate.js +5 -0
- package/lib/cjs/tree/tree.css +0 -20
- package/lib/cjs/tree/tree.scss +0 -20
- package/lib/cjs/tree/treeUtil.js +2 -0
- package/lib/cjs/tree/variables.scss +0 -18
- package/lib/cjs/treeSelect/foundation.js +10 -1
- package/lib/cjs/treeSelect/treeSelect.css +5 -0
- package/lib/cjs/treeSelect/treeSelect.scss +3 -0
- package/lib/cjs/utils/Logger.js +8 -0
- package/lib/cjs/utils/Store.js +1 -0
- package/lib/cjs/utils/date-fns-extra.js +4 -0
- package/lib/cjs/utils/isElement.js +1 -0
- package/lib/cjs/utils/isEscPress.js +1 -0
- package/lib/cjs/utils/set.js +1 -0
- package/lib/es/anchor/foundation.d.ts +1 -2
- package/lib/es/autoComplete/foundation.d.ts +0 -1
- package/lib/es/autoComplete/foundation.js +35 -23
- package/lib/es/avatar/avatar.css +9 -0
- package/lib/es/avatar/avatar.scss +14 -0
- package/lib/es/avatar/foundation.d.ts +3 -0
- package/lib/es/avatar/foundation.js +19 -0
- package/lib/es/avatar/variables.scss +3 -0
- package/lib/es/base/foundation.js +12 -0
- package/lib/es/calendar/eventUtil.d.ts +1 -1
- package/lib/es/calendar/foundation.d.ts +1 -2
- package/lib/es/cascader/cascader.css +5 -0
- package/lib/es/cascader/cascader.scss +3 -0
- package/lib/es/cascader/foundation.d.ts +0 -11
- package/lib/es/cascader/foundation.js +5 -0
- package/lib/es/checkbox/checkboxFoundation.js +2 -1
- package/lib/es/datePicker/foundation.d.ts +3 -4
- package/lib/es/datePicker/inputFoundation.d.ts +1 -2
- package/lib/es/datePicker/monthsGridFoundation.d.ts +4 -5
- package/lib/es/form/utils.d.ts +5 -2
- package/lib/es/form/utils.js +5 -0
- package/lib/es/input/foundation.d.ts +0 -4
- package/lib/es/input/foundation.js +6 -12
- package/lib/es/input/input.css +6 -0
- package/lib/es/input/input.scss +6 -0
- package/lib/es/input/textareaFoundation.d.ts +0 -4
- package/lib/es/input/textareaFoundation.js +0 -11
- package/lib/es/input/variables.scss +3 -0
- package/lib/es/overflowList/foundation.d.ts +1 -0
- package/lib/es/overflowList/foundation.js +25 -0
- package/lib/es/radio/radio.css +6 -0
- package/lib/es/radio/radio.scss +8 -0
- package/lib/es/radio/radioFoundation.d.ts +3 -0
- package/lib/es/radio/radioFoundation.js +23 -0
- package/lib/es/radio/variables.scss +4 -0
- package/lib/es/select/foundation.js +2 -0
- package/lib/es/select/select.css +5 -0
- package/lib/es/select/select.scss +3 -0
- package/lib/es/switch/foundation.js +2 -1
- package/lib/es/tagInput/foundation.js +2 -0
- package/lib/es/tagInput/tagInput.css +1 -1
- package/lib/es/tagInput/variables.scss +1 -1
- package/lib/es/timePicker/foundation.js +4 -0
- package/lib/es/timePicker/utils/localeDate.js +5 -0
- package/lib/es/tree/tree.css +0 -20
- package/lib/es/tree/tree.scss +0 -20
- package/lib/es/tree/treeUtil.js +2 -0
- package/lib/es/tree/variables.scss +0 -18
- package/lib/es/treeSelect/foundation.js +10 -1
- package/lib/es/treeSelect/treeSelect.css +5 -0
- package/lib/es/treeSelect/treeSelect.scss +3 -0
- package/lib/es/utils/Logger.js +8 -0
- package/lib/es/utils/Store.js +1 -0
- package/lib/es/utils/date-fns-extra.js +4 -0
- package/lib/es/utils/isElement.js +1 -0
- package/lib/es/utils/isEscPress.js +1 -0
- package/lib/es/utils/set.js +2 -0
- package/overflowList/foundation.ts +20 -0
- package/package.json +2 -2
- package/radio/radio.scss +8 -0
- package/radio/radioFoundation.ts +17 -0
- package/radio/variables.scss +4 -0
- package/select/foundation.ts +1 -0
- package/select/select.scss +3 -0
- package/switch/foundation.ts +2 -1
- package/tagInput/foundation.ts +1 -0
- package/tagInput/variables.scss +1 -1
- package/timePicker/foundation.ts +2 -1
- package/timePicker/utils/localeDate.ts +3 -0
- package/tree/tree.scss +0 -20
- package/tree/treeUtil.ts +1 -0
- package/tree/variables.scss +0 -18
- package/treeSelect/foundation.ts +7 -0
- package/treeSelect/treeSelect.scss +3 -0
- package/utils/Logger.ts +4 -0
- package/utils/Store.ts +1 -0
- package/utils/date-fns-extra.ts +2 -0
- package/utils/isElement.ts +1 -0
- package/utils/isEscPress.ts +1 -0
- package/utils/set.ts +1 -0
|
@@ -8,7 +8,7 @@ $color-tagInput-border-default: transparent; // 标签输入框描边颜色 -
|
|
|
8
8
|
$color-tagInput-border-hover: transparent ; // 标签输入框描边颜色 - 悬浮
|
|
9
9
|
$color-tagInput-border-focus: var(--semi-color-focus-border); // 标签输入框描边颜色 - 选中态
|
|
10
10
|
$color-tagInput_prefix-default: var(--semi-color-text-2); // 标签输入框 prefix 颜色
|
|
11
|
-
$color-tagInput_suffix-default: var(--semi-color-text-
|
|
11
|
+
$color-tagInput_suffix-default: var(--semi-color-text-2); // 标签输入框 suffix 颜色
|
|
12
12
|
|
|
13
13
|
$color-tagInput_default-bg-default: var(--semi-color-fill-0); // 标签输入框背景颜色 - 默认
|
|
14
14
|
$color-tagInput_default-bg-hover: var(--semi-color-fill-1); // 标签输入框背景颜色 - 悬浮
|
|
@@ -272,6 +272,8 @@ class TimePickerFoundation extends _foundation.default {
|
|
|
272
272
|
|
|
273
273
|
this._adapter.notifyBlur(e);
|
|
274
274
|
}
|
|
275
|
+
/* istanbul ignore next */
|
|
276
|
+
|
|
275
277
|
|
|
276
278
|
handleVisibleChange(visible) {
|
|
277
279
|
if (!this._isControlledComponent('open')) {
|
|
@@ -322,6 +324,8 @@ class TimePickerFoundation extends _foundation.default {
|
|
|
322
324
|
this._notifyChange(value, input);
|
|
323
325
|
}
|
|
324
326
|
}
|
|
327
|
+
/* istanbul ignore next */
|
|
328
|
+
|
|
325
329
|
|
|
326
330
|
doValidate(args) {
|
|
327
331
|
if (typeof args === 'string') {
|
|
@@ -15,6 +15,7 @@ var _keys = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stabl
|
|
|
15
15
|
|
|
16
16
|
var _dateFns = require("date-fns");
|
|
17
17
|
|
|
18
|
+
/* istanbul ignore next */
|
|
18
19
|
const replace = function replace(str, replacements) {
|
|
19
20
|
let _str = str;
|
|
20
21
|
|
|
@@ -26,6 +27,8 @@ const replace = function replace(str, replacements) {
|
|
|
26
27
|
|
|
27
28
|
return _str;
|
|
28
29
|
};
|
|
30
|
+
/* istanbul ignore next */
|
|
31
|
+
|
|
29
32
|
|
|
30
33
|
function localeFormat(date, format) {
|
|
31
34
|
let locale = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
@@ -34,6 +37,8 @@ function localeFormat(date, format) {
|
|
|
34
37
|
str = replace(str, locale);
|
|
35
38
|
return str;
|
|
36
39
|
}
|
|
40
|
+
/* istanbul ignore next */
|
|
41
|
+
|
|
37
42
|
|
|
38
43
|
function localeParse(dateString, format) {
|
|
39
44
|
let locale = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
package/lib/cjs/tree/tree.css
CHANGED
|
@@ -1,26 +1,6 @@
|
|
|
1
1
|
/* shadow */
|
|
2
2
|
/* sizing */
|
|
3
3
|
/* spacing */
|
|
4
|
-
.semi-tree {
|
|
5
|
-
box-sizing: border-box;
|
|
6
|
-
border-radius: var(--semi-border-radius-small);
|
|
7
|
-
border: 1px solid transparent;
|
|
8
|
-
height: 32px;
|
|
9
|
-
line-height: 32px;
|
|
10
|
-
font-weight: 400;
|
|
11
|
-
background-color: var(--semi-color-fill-0);
|
|
12
|
-
display: inline-block;
|
|
13
|
-
vertical-align: middle;
|
|
14
|
-
position: relative;
|
|
15
|
-
cursor: pointer;
|
|
16
|
-
}
|
|
17
|
-
.semi-tree:hover {
|
|
18
|
-
background-color: var(--semi-color-fill-1);
|
|
19
|
-
}
|
|
20
|
-
.semi-tree-focus {
|
|
21
|
-
border: 1px solid var(--semi-color-focus-border);
|
|
22
|
-
outline: 0;
|
|
23
|
-
}
|
|
24
4
|
.semi-tree-search-wrapper {
|
|
25
5
|
padding: 8px 12px;
|
|
26
6
|
}
|
package/lib/cjs/tree/tree.scss
CHANGED
|
@@ -3,26 +3,6 @@
|
|
|
3
3
|
$module: #{$prefix}-tree;
|
|
4
4
|
|
|
5
5
|
.#{$module} {
|
|
6
|
-
box-sizing: border-box;
|
|
7
|
-
border-radius: $radius-tree;
|
|
8
|
-
border: 1px solid $color-tree_default-border-default;
|
|
9
|
-
height: $height-tree_default;
|
|
10
|
-
line-height: $height-tree_default;
|
|
11
|
-
font-weight: $font-tree_default-fontWeight;
|
|
12
|
-
background-color: $color-tree_default-bg-default;
|
|
13
|
-
display: inline-block;
|
|
14
|
-
vertical-align: middle;
|
|
15
|
-
position: relative;
|
|
16
|
-
cursor: pointer;
|
|
17
|
-
|
|
18
|
-
&:hover {
|
|
19
|
-
background-color: $color-tree_default-bg-hover;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
&-focus {
|
|
23
|
-
border: $width-tree_focus-border solid $color-tree_default-border-focus;
|
|
24
|
-
outline: 0;
|
|
25
|
-
}
|
|
26
6
|
|
|
27
7
|
&-search-wrapper {
|
|
28
8
|
padding: $spacing-tree_search_wrapper-paddingY $spacing-tree_search_wrapper-paddingX;
|
package/lib/cjs/tree/treeUtil.js
CHANGED
|
@@ -1,10 +1,3 @@
|
|
|
1
|
-
$color-tree_default-bg-default: var(--semi-color-fill-0); // 树背景颜色 - 默认
|
|
2
|
-
$color-tree_default-border-default: transparent; // 树描边颜色 - 默认
|
|
3
|
-
$color-tree_default-icon-default: var(--semi-color-text-2); // 树图标颜色 - 默认
|
|
4
|
-
$color-tree_default-bg-hover: var(--semi-color-fill-1); // 树背景颜色 - 悬停
|
|
5
|
-
|
|
6
|
-
$color-tree_default-border-focus: var(--semi-color-focus-border); // 树描边颜色 - 按下
|
|
7
|
-
|
|
8
1
|
$color-tree_option-text-default: var(--semi-color-text-0); // 树选项文字颜色
|
|
9
2
|
$color-tree_option-icon-default: var(--semi-color-text-2); // 树选项图标颜色
|
|
10
3
|
|
|
@@ -19,13 +12,9 @@ $color-tree_option_loading-icon-default: var(--semi-color-primary); // 树选项
|
|
|
19
12
|
|
|
20
13
|
$color-tree_option_draggable_insert-border-default: var(--semi-color-primary); // 树选项加载 spin 颜色
|
|
21
14
|
|
|
22
|
-
$height-tree_default: $height-control-default; // 树选项高度 - 默认
|
|
23
|
-
|
|
24
|
-
$font-tree_default-fontWeight: $font-weight-regular; // 树选项文本字重 - 默认
|
|
25
15
|
$font-tree_option_hightlight-fontWeight: $font-weight-bold; // 树选项高亮文本字重
|
|
26
16
|
$color-tree_option_hightlight-text: var(--semi-color-primary); // 树选项高亮文本颜色
|
|
27
17
|
|
|
28
|
-
$radius-tree: var(--semi-border-radius-small); // 树整体圆角
|
|
29
18
|
$radius-tree_checkbox_addon: var(--semi-border-radius-small); // 多选树 checkbox 圆角
|
|
30
19
|
|
|
31
20
|
$spacing-tree_search_wrapper-paddingX: 12px; // 树搜索框水平内边距
|
|
@@ -41,14 +30,7 @@ $spacing-tree_icon-marginRight: 8px; // 树选项图标右侧外边距
|
|
|
41
30
|
$spacing-tree_label_withIcon-marginRight: 8px; // 树选项图标右侧外边距
|
|
42
31
|
$spacing-tree_option_draggable-paddingY: 3px; // 可拖拽的树选项垂直内边距
|
|
43
32
|
$spacing-tree_option_draggable-paddingX: 0; // 可拖拽的树选项水平内边距
|
|
44
|
-
$spacing-tree_spinIcon-paddingY: 4px; // 树选项加载 spin 垂直内边距 (已废弃)
|
|
45
|
-
$spacing-tree_spinIcon-paddingX: 0; // 树选项加载 spin 水平内边距 (已废弃)
|
|
46
33
|
|
|
47
|
-
$width-tree-border: 1px; // 树选项描边宽度
|
|
48
|
-
$width-tree_arrow: 32px; // 树选项箭头宽度
|
|
49
34
|
$width-tree_emptyIcon: $width-icon-small; // 树选项空图标宽度
|
|
50
35
|
$width-tree_spinIcon: $width-icon-small; // 树选项加载 spin 宽度
|
|
51
|
-
$width-tree_focus-border: $border-thickness-control-focus; // 树选中态描边宽度
|
|
52
|
-
$width-tree_option: 230px; // 树选项宽度
|
|
53
|
-
$width-tree_search_wrapper-border: 1px; // 树搜索框容器描边宽度
|
|
54
36
|
$width-tree_option_draggable-border: 2px; // 可拖拽的树标示线宽度
|
|
@@ -254,6 +254,8 @@ class TreeSelectFoundation extends _foundation.default {
|
|
|
254
254
|
loadingKeys: loadingKeys.add(key)
|
|
255
255
|
};
|
|
256
256
|
}
|
|
257
|
+
/* istanbul ignore next */
|
|
258
|
+
|
|
257
259
|
|
|
258
260
|
focusInput(bool) {
|
|
259
261
|
this._adapter.updateInputFocus(bool);
|
|
@@ -368,6 +370,8 @@ class TreeSelectFoundation extends _foundation.default {
|
|
|
368
370
|
* A11y: simulate selection click
|
|
369
371
|
*/
|
|
370
372
|
|
|
373
|
+
/* istanbul ignore next */
|
|
374
|
+
|
|
371
375
|
|
|
372
376
|
handleSelectionEnterPress(e) {
|
|
373
377
|
if ((0, _isEnterPress.default)(e)) {
|
|
@@ -420,6 +424,8 @@ class TreeSelectFoundation extends _foundation.default {
|
|
|
420
424
|
* A11y: simulate clear button click
|
|
421
425
|
*/
|
|
422
426
|
|
|
427
|
+
/* istanbul ignore next */
|
|
428
|
+
|
|
423
429
|
|
|
424
430
|
handleClearEnterPress(e) {
|
|
425
431
|
if ((0, _isEnterPress.default)(e)) {
|
|
@@ -751,7 +757,7 @@ class TreeSelectFoundation extends _foundation.default {
|
|
|
751
757
|
eventKey,
|
|
752
758
|
expanded,
|
|
753
759
|
data
|
|
754
|
-
} = treeNode;
|
|
760
|
+
} = treeNode; // debugger;
|
|
755
761
|
|
|
756
762
|
if (!expanded) {
|
|
757
763
|
filteredExpandedKeys.add(eventKey);
|
|
@@ -764,6 +770,7 @@ class TreeSelectFoundation extends _foundation.default {
|
|
|
764
770
|
this._adapter.cacheFlattenNodes(motionType === 'hide' && this._isAnimated());
|
|
765
771
|
|
|
766
772
|
if (!this._isExpandControlled()) {
|
|
773
|
+
// debugger;
|
|
767
774
|
const flattenNodes = (0, _treeUtil.flattenTreeData)(treeData, filteredExpandedKeys, showFilteredOnly && filteredShownKeys);
|
|
768
775
|
const motionKeys = this._isAnimated() ? (0, _treeUtil.getMotionKeys)(eventKey, filteredExpandedKeys, keyEntities) : [];
|
|
769
776
|
const newState = {
|
|
@@ -783,6 +790,7 @@ class TreeSelectFoundation extends _foundation.default {
|
|
|
783
790
|
}
|
|
784
791
|
|
|
785
792
|
handleNodeExpand(e, treeNode) {
|
|
793
|
+
// debugger;
|
|
786
794
|
const {
|
|
787
795
|
loadData
|
|
788
796
|
} = this.getProps();
|
|
@@ -827,6 +835,7 @@ class TreeSelectFoundation extends _foundation.default {
|
|
|
827
835
|
this._adapter.cacheFlattenNodes(motionType === 'hide' && this._isAnimated());
|
|
828
836
|
|
|
829
837
|
if (!isExpandControlled) {
|
|
838
|
+
// debugger;
|
|
830
839
|
const flattenNodes = (0, _treeUtil.flattenTreeData)(treeData, expandedKeys);
|
|
831
840
|
const motionKeys = this._isAnimated() ? (0, _treeUtil.getMotionKeys)(eventKey, expandedKeys, keyEntities) : [];
|
|
832
841
|
const newState = {
|
|
@@ -180,6 +180,11 @@
|
|
|
180
180
|
min-height: 40px;
|
|
181
181
|
line-height: 40px;
|
|
182
182
|
}
|
|
183
|
+
.semi-tree-select-large .semi-tree-select-selection {
|
|
184
|
+
font-size: 16px;
|
|
185
|
+
line-height: 22px;
|
|
186
|
+
font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif;
|
|
187
|
+
}
|
|
183
188
|
.semi-tree-select-arrow {
|
|
184
189
|
display: inline-flex;
|
|
185
190
|
align-items: center;
|
package/lib/cjs/utils/Logger.js
CHANGED
|
@@ -38,6 +38,8 @@ class Logger {
|
|
|
38
38
|
console[method](...messages);
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
|
+
/* istanbul ignore next */
|
|
42
|
+
|
|
41
43
|
|
|
42
44
|
log() {
|
|
43
45
|
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
@@ -46,6 +48,8 @@ class Logger {
|
|
|
46
48
|
|
|
47
49
|
this._baseLog('log', ...args);
|
|
48
50
|
}
|
|
51
|
+
/* istanbul ignore next */
|
|
52
|
+
|
|
49
53
|
|
|
50
54
|
warn() {
|
|
51
55
|
for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
|
|
@@ -54,6 +58,8 @@ class Logger {
|
|
|
54
58
|
|
|
55
59
|
this._baseLog('warn', ...args);
|
|
56
60
|
}
|
|
61
|
+
/* istanbul ignore next */
|
|
62
|
+
|
|
57
63
|
|
|
58
64
|
error() {
|
|
59
65
|
for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
|
|
@@ -62,6 +68,8 @@ class Logger {
|
|
|
62
68
|
|
|
63
69
|
this._baseLog('error', ...args);
|
|
64
70
|
}
|
|
71
|
+
/* istanbul ignore next */
|
|
72
|
+
|
|
65
73
|
|
|
66
74
|
info() {
|
|
67
75
|
for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
|
package/lib/cjs/utils/Store.js
CHANGED
|
@@ -16,6 +16,7 @@ var _indexOf = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-st
|
|
|
16
16
|
|
|
17
17
|
var _splice = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/splice"));
|
|
18
18
|
|
|
19
|
+
/* istanbul ignore next */
|
|
19
20
|
class Store {
|
|
20
21
|
constructor(initialState) {
|
|
21
22
|
this._state = (0, _assign.default)({}, initialState);
|
|
@@ -67,6 +67,8 @@ const toIANA = tz => {
|
|
|
67
67
|
* @returns {Date}
|
|
68
68
|
*/
|
|
69
69
|
|
|
70
|
+
/* istanbul ignore next */
|
|
71
|
+
|
|
70
72
|
|
|
71
73
|
exports.toIANA = toIANA;
|
|
72
74
|
|
|
@@ -92,6 +94,8 @@ const parse = (date, formatToken, options) => {
|
|
|
92
94
|
* @param {string} [options.timeZone]
|
|
93
95
|
*/
|
|
94
96
|
|
|
97
|
+
/* istanbul ignore next */
|
|
98
|
+
|
|
95
99
|
|
|
96
100
|
exports.parse = parse;
|
|
97
101
|
|
package/lib/cjs/utils/set.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import BaseFoundation, { DefaultAdapter } from '../base/foundation';
|
|
2
|
-
import React from 'react';
|
|
3
2
|
export interface AnchorAdapter<P = Record<string, any>, S = Record<string, any>> extends DefaultAdapter<P, S> {
|
|
4
3
|
addLink: (link: string) => void;
|
|
5
4
|
removeLink: (link: string) => void;
|
|
@@ -15,7 +14,7 @@ export interface AnchorAdapter<P = Record<string, any>, S = Record<string, any>>
|
|
|
15
14
|
getAnchorNode: (selector: string) => HTMLElement;
|
|
16
15
|
getContentNode: (selector: string) => HTMLElement;
|
|
17
16
|
notifyChange: (currentLink: string, previousLink: string) => void;
|
|
18
|
-
notifyClick: (e:
|
|
17
|
+
notifyClick: (e: any, link: string) => void;
|
|
19
18
|
canSmoothScroll: () => boolean;
|
|
20
19
|
}
|
|
21
20
|
export default class AnchorFoundation<P = Record<string, any>, S = Record<string, any>> extends BaseFoundation<AnchorAdapter<P, S>, P, S> {
|
|
@@ -53,7 +53,6 @@ declare class AutoCompleteFoundation<P = Record<string, any>, S = Record<string,
|
|
|
53
53
|
_getRenderSelectedItem(): any;
|
|
54
54
|
handleClear(): void;
|
|
55
55
|
bindKeyBoardEvent(): void;
|
|
56
|
-
unBindKeyBoardEvent(): void;
|
|
57
56
|
_handleKeyDown(event: KeyboardEvent): void;
|
|
58
57
|
_getEnableFocusIndex(offset: number): void;
|
|
59
58
|
_handleArrowKeyDown(offset: number): void;
|
|
@@ -57,9 +57,8 @@ class AutoCompleteFoundation extends BaseFoundation {
|
|
|
57
57
|
}
|
|
58
58
|
}
|
|
59
59
|
|
|
60
|
-
destroy() {
|
|
61
|
-
// this.
|
|
62
|
-
this.unBindKeyBoardEvent();
|
|
60
|
+
destroy() {// this._adapter.unregisterClickOutsideHandler();
|
|
61
|
+
// this.unBindKeyBoardEvent();
|
|
63
62
|
}
|
|
64
63
|
|
|
65
64
|
_setDropdownWidth() {
|
|
@@ -111,8 +110,6 @@ class AutoCompleteFoundation extends BaseFoundation {
|
|
|
111
110
|
|
|
112
111
|
this._adapter.notifyDropdownVisibleChange(true);
|
|
113
112
|
|
|
114
|
-
this.bindKeyBoardEvent();
|
|
115
|
-
|
|
116
113
|
this._modifyFocusIndexOnPanelOpen();
|
|
117
114
|
}
|
|
118
115
|
|
|
@@ -122,9 +119,9 @@ class AutoCompleteFoundation extends BaseFoundation {
|
|
|
122
119
|
this._adapter.toggleListVisible(false); // this._adapter.unregisterClickOutsideHandler();
|
|
123
120
|
|
|
124
121
|
|
|
125
|
-
this._adapter.notifyDropdownVisibleChange(false);
|
|
122
|
+
this._adapter.notifyDropdownVisibleChange(false); // After closing the panel, you can still open the panel by pressing the enter key
|
|
123
|
+
// this.unBindKeyBoardEvent();
|
|
126
124
|
|
|
127
|
-
this.unBindKeyBoardEvent();
|
|
128
125
|
} // props.data => optionList
|
|
129
126
|
|
|
130
127
|
|
|
@@ -347,13 +344,12 @@ class AutoCompleteFoundation extends BaseFoundation {
|
|
|
347
344
|
};
|
|
348
345
|
|
|
349
346
|
this._adapter.registerKeyDown(this._keydownHandler);
|
|
350
|
-
}
|
|
347
|
+
} // unBindKeyBoardEvent() {
|
|
348
|
+
// if (this._keydownHandler) {
|
|
349
|
+
// this._adapter.unregisterKeyDown(this._keydownHandler);
|
|
350
|
+
// }
|
|
351
|
+
// }
|
|
351
352
|
|
|
352
|
-
unBindKeyBoardEvent() {
|
|
353
|
-
if (this._keydownHandler) {
|
|
354
|
-
this._adapter.unregisterKeyDown(this._keydownHandler);
|
|
355
|
-
}
|
|
356
|
-
}
|
|
357
353
|
|
|
358
354
|
_handleKeyDown(event) {
|
|
359
355
|
const key = event.keyCode;
|
|
@@ -361,10 +357,6 @@ class AutoCompleteFoundation extends BaseFoundation {
|
|
|
361
357
|
visible
|
|
362
358
|
} = this.getStates();
|
|
363
359
|
|
|
364
|
-
if (!visible) {
|
|
365
|
-
return;
|
|
366
|
-
}
|
|
367
|
-
|
|
368
360
|
switch (key) {
|
|
369
361
|
case KeyCode.UP:
|
|
370
362
|
// Prevent Input's cursor from following the movement
|
|
@@ -383,6 +375,9 @@ class AutoCompleteFoundation extends BaseFoundation {
|
|
|
383
375
|
break;
|
|
384
376
|
|
|
385
377
|
case KeyCode.ENTER:
|
|
378
|
+
// when custom trigger, prevent outer open panel again
|
|
379
|
+
event.preventDefault();
|
|
380
|
+
|
|
386
381
|
this._handleEnterKeyDown();
|
|
387
382
|
|
|
388
383
|
break;
|
|
@@ -454,7 +449,15 @@ class AutoCompleteFoundation extends BaseFoundation {
|
|
|
454
449
|
}
|
|
455
450
|
|
|
456
451
|
_handleArrowKeyDown(offset) {
|
|
457
|
-
|
|
452
|
+
const {
|
|
453
|
+
visible
|
|
454
|
+
} = this.getStates();
|
|
455
|
+
|
|
456
|
+
if (!visible) {
|
|
457
|
+
this.openDropdown();
|
|
458
|
+
} else {
|
|
459
|
+
this._getEnableFocusIndex(offset);
|
|
460
|
+
}
|
|
458
461
|
}
|
|
459
462
|
|
|
460
463
|
_handleEnterKeyDown() {
|
|
@@ -464,12 +467,17 @@ class AutoCompleteFoundation extends BaseFoundation {
|
|
|
464
467
|
focusIndex
|
|
465
468
|
} = this.getStates();
|
|
466
469
|
|
|
467
|
-
if (
|
|
468
|
-
|
|
470
|
+
if (!visible) {
|
|
471
|
+
this.openDropdown();
|
|
472
|
+
} else {
|
|
473
|
+
if (focusIndex !== undefined && focusIndex !== -1 && options.length !== 0) {
|
|
474
|
+
const visibleOptions = _filterInstanceProperty(options).call(options, item => item.show);
|
|
469
475
|
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
476
|
+
const selectedOption = visibleOptions[focusIndex];
|
|
477
|
+
this.handleSelect(selectedOption, focusIndex);
|
|
478
|
+
} else {
|
|
479
|
+
this.closeDropdown();
|
|
480
|
+
}
|
|
473
481
|
}
|
|
474
482
|
}
|
|
475
483
|
|
|
@@ -478,6 +486,10 @@ class AutoCompleteFoundation extends BaseFoundation {
|
|
|
478
486
|
}
|
|
479
487
|
|
|
480
488
|
handleFocus(e) {
|
|
489
|
+
// If you get the focus through the tab key, you need to manually bind keyboard events
|
|
490
|
+
// Then you can open the panel by pressing the enter key
|
|
491
|
+
this.bindKeyBoardEvent();
|
|
492
|
+
|
|
481
493
|
this._adapter.notifyFocus(e);
|
|
482
494
|
}
|
|
483
495
|
|
package/lib/es/avatar/avatar.css
CHANGED
|
@@ -11,6 +11,15 @@
|
|
|
11
11
|
text-align: center;
|
|
12
12
|
vertical-align: middle;
|
|
13
13
|
}
|
|
14
|
+
.semi-avatar:focus-visible {
|
|
15
|
+
outline: 2px solid var(--semi-color-primary-light-active);
|
|
16
|
+
}
|
|
17
|
+
.semi-avatar-focus {
|
|
18
|
+
outline: 2px solid var(--semi-color-primary-light-active);
|
|
19
|
+
}
|
|
20
|
+
.semi-avatar-no-focus-visible:focus-visible {
|
|
21
|
+
outline: none;
|
|
22
|
+
}
|
|
14
23
|
.semi-avatar .semi-avatar-label {
|
|
15
24
|
display: flex;
|
|
16
25
|
align-items: center;
|
|
@@ -16,6 +16,20 @@ $colors: "amber", "blue", "cyan", "green", "grey", "indigo", "light-blue", "ligh
|
|
|
16
16
|
text-align: center;
|
|
17
17
|
vertical-align: middle;
|
|
18
18
|
|
|
19
|
+
&:focus-visible {
|
|
20
|
+
outline: $width-avatar-outline solid $color-avatar-outline-focus;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
&-focus {
|
|
24
|
+
outline: $width-avatar-outline solid $color-avatar-outline-focus;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
&-no-focus-visible {
|
|
28
|
+
&:focus-visible {
|
|
29
|
+
outline: none;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
19
33
|
.#{$module}-label {
|
|
20
34
|
display: flex;
|
|
21
35
|
align-items: center;
|
|
@@ -3,6 +3,7 @@ export interface AvatarAdapter<P = Record<string, any>, S = Record<string, any>>
|
|
|
3
3
|
notifyImgState(isImgExist: boolean): void;
|
|
4
4
|
notifyLeave(event: any): void;
|
|
5
5
|
notifyEnter(event: any): void;
|
|
6
|
+
setFocusVisible: (focusVisible: boolean) => void;
|
|
6
7
|
}
|
|
7
8
|
export default class AvatarFoundation<P = Record<string, any>, S = Record<string, any>> extends BaseFoundation<AvatarAdapter<P, S>, P, S> {
|
|
8
9
|
constructor(adapter: AvatarAdapter<P, S>);
|
|
@@ -11,4 +12,6 @@ export default class AvatarFoundation<P = Record<string, any>, S = Record<string
|
|
|
11
12
|
handleImgLoadError(): void;
|
|
12
13
|
handleEnter(e: any): void;
|
|
13
14
|
handleLeave(e: any): void;
|
|
15
|
+
handleFocusVisible: (event: any) => void;
|
|
16
|
+
handleBlur: () => void;
|
|
14
17
|
}
|
|
@@ -1,8 +1,27 @@
|
|
|
1
1
|
import _Object$assign from "@babel/runtime-corejs3/core-js-stable/object/assign";
|
|
2
2
|
import BaseFoundation from '../base/foundation';
|
|
3
|
+
import warning from '../utils/warning';
|
|
3
4
|
export default class AvatarFoundation extends BaseFoundation {
|
|
4
5
|
constructor(adapter) {
|
|
5
6
|
super(_Object$assign({}, adapter));
|
|
7
|
+
|
|
8
|
+
this.handleFocusVisible = event => {
|
|
9
|
+
const {
|
|
10
|
+
target
|
|
11
|
+
} = event;
|
|
12
|
+
|
|
13
|
+
try {
|
|
14
|
+
if (target.matches(':focus-visible')) {
|
|
15
|
+
this._adapter.setFocusVisible(true);
|
|
16
|
+
}
|
|
17
|
+
} catch (error) {
|
|
18
|
+
warning(true, 'Warning: [Semi Avatar] The current browser does not support the focus-visible');
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
this.handleBlur = () => {
|
|
23
|
+
this._adapter.setFocusVisible(false);
|
|
24
|
+
};
|
|
6
25
|
}
|
|
7
26
|
|
|
8
27
|
init() {} // eslint-disable-line
|
|
@@ -2,6 +2,7 @@ $z-avatar-default: 100; // 头像 z-index
|
|
|
2
2
|
// color
|
|
3
3
|
$color-avatar_default-border-default: var(--semi-color-bg-1); // 头像描边颜色
|
|
4
4
|
$color-avatar_more_default-bg-default: rgba(var(--semi-grey-5), 1); // 「更多」描边颜色
|
|
5
|
+
$color-avatar-outline-focus: var(--semi-color-primary-light-active); // 头像聚焦轮廓颜色
|
|
5
6
|
|
|
6
7
|
|
|
7
8
|
$width-avatar_extra_extra_small: 20px; // 头像尺寸 - 极小
|
|
@@ -43,3 +44,5 @@ $spacing-avatar_extra_small-marginLeft: -10px; // 头像左侧外边距 - 超小
|
|
|
43
44
|
|
|
44
45
|
$width-avatar_extra_extra_small-border: 1px; // 头像描边尺寸 - 极小
|
|
45
46
|
$spacing-avatar_extra_extra_small-marginLeft: -4px; // 头像左侧外边距 - 极小
|
|
47
|
+
|
|
48
|
+
$width-avatar-outline: 2px; //头像聚焦轮廓宽度
|
|
@@ -14,6 +14,8 @@ class BaseFoundation {
|
|
|
14
14
|
}
|
|
15
15
|
/** @return enum{css className} */
|
|
16
16
|
|
|
17
|
+
/* istanbul ignore next */
|
|
18
|
+
|
|
17
19
|
|
|
18
20
|
static get cssClasses() {
|
|
19
21
|
// Classes extending Foundation should implement this method to return an object which exports every
|
|
@@ -22,6 +24,8 @@ class BaseFoundation {
|
|
|
22
24
|
}
|
|
23
25
|
/** @return enum{strings} */
|
|
24
26
|
|
|
27
|
+
/* istanbul ignore next */
|
|
28
|
+
|
|
25
29
|
|
|
26
30
|
static get strings() {
|
|
27
31
|
// Classes extending Foundation should implement this method to return an object which exports all
|
|
@@ -30,6 +34,8 @@ class BaseFoundation {
|
|
|
30
34
|
}
|
|
31
35
|
/** @return enum{numbers} */
|
|
32
36
|
|
|
37
|
+
/* istanbul ignore next */
|
|
38
|
+
|
|
33
39
|
|
|
34
40
|
static get numbers() {
|
|
35
41
|
// Classes extending Foundation should implement this method to return an object which exports all
|
|
@@ -76,10 +82,14 @@ class BaseFoundation {
|
|
|
76
82
|
getContext(key) {
|
|
77
83
|
return this._adapter.getContext(key);
|
|
78
84
|
}
|
|
85
|
+
/* istanbul ignore next */
|
|
86
|
+
|
|
79
87
|
|
|
80
88
|
getContexts() {
|
|
81
89
|
return this._adapter.getContexts();
|
|
82
90
|
}
|
|
91
|
+
/* istanbul ignore next */
|
|
92
|
+
|
|
83
93
|
|
|
84
94
|
getCaches() {
|
|
85
95
|
return this._adapter.getCaches();
|
|
@@ -116,6 +126,8 @@ class BaseFoundation {
|
|
|
116
126
|
|
|
117
127
|
destroy() {// Subclasses should override this method to perform de-initialization routines (de-registering events, etc.)
|
|
118
128
|
}
|
|
129
|
+
/* istanbul ignore next */
|
|
130
|
+
|
|
119
131
|
|
|
120
132
|
log(text) {
|
|
121
133
|
for (var _len = arguments.length, rest = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
@@ -88,6 +88,6 @@ export declare const collectDailyEvents: (events: ParsedRangeEvent[][]) => Parse
|
|
|
88
88
|
export declare const renderDailyEvent: (event: EventObject) => {
|
|
89
89
|
startPos: number;
|
|
90
90
|
endPos: number;
|
|
91
|
-
children:
|
|
91
|
+
children: any;
|
|
92
92
|
allDay: boolean;
|
|
93
93
|
};
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import BaseFoundation, { DefaultAdapter } from '../base/foundation';
|
|
3
2
|
import { Locale } from 'date-fns';
|
|
4
3
|
import { DateObj } from './eventUtil';
|
|
@@ -8,7 +7,7 @@ export interface EventObject {
|
|
|
8
7
|
allDay?: boolean;
|
|
9
8
|
start?: Date;
|
|
10
9
|
end?: Date;
|
|
11
|
-
children?:
|
|
10
|
+
children?: any;
|
|
12
11
|
}
|
|
13
12
|
export interface ParsedEventsWithArray {
|
|
14
13
|
day: Array<any>;
|
|
@@ -29,6 +29,11 @@
|
|
|
29
29
|
min-height: 40px;
|
|
30
30
|
line-height: 40px;
|
|
31
31
|
}
|
|
32
|
+
.semi-cascader-large .semi-cascader-selection {
|
|
33
|
+
font-size: 16px;
|
|
34
|
+
line-height: 22px;
|
|
35
|
+
font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif;
|
|
36
|
+
}
|
|
32
37
|
.semi-cascader-focus {
|
|
33
38
|
border: 1px solid var(--semi-color-focus-border);
|
|
34
39
|
outline: 0;
|