@douyinfe/semi-foundation 2.96.1 → 2.98.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cascader/foundation.ts +74 -19
- package/codeHighlight/codeHighlight.scss +1 -1
- package/datePicker/datePicker.scss +100 -5
- package/datePicker/foundation.ts +7 -0
- package/datePicker/inputFoundation.ts +5 -0
- package/form/foundation.ts +55 -7
- package/form/utils.ts +7 -2
- package/image/previewImageFoundation.ts +34 -3
- package/image/previewInnerFoundation.ts +15 -4
- package/input/textarea.scss +35 -0
- package/inputNumber/foundation.ts +119 -3
- package/jsonViewer/jsonViewer.scss +2 -2
- package/lib/cjs/aiChatInput/aiChatInput.css +7 -7
- package/lib/cjs/anchor/anchor.css +3 -3
- package/lib/cjs/autoComplete/autoComplete.css +1 -1
- package/lib/cjs/avatar/avatar.css +5 -5
- package/lib/cjs/badge/badge.css +1 -1
- package/lib/cjs/breadcrumb/breadcrumb.css +2 -2
- package/lib/cjs/calendar/calendar.css +9 -9
- package/lib/cjs/cascader/cascader.css +6 -6
- package/lib/cjs/cascader/foundation.d.ts +12 -0
- package/lib/cjs/cascader/foundation.js +68 -23
- package/lib/cjs/checkbox/checkbox.css +2 -2
- package/lib/cjs/codeHighlight/codeHighlight.css +1 -1
- package/lib/cjs/codeHighlight/codeHighlight.scss +1 -1
- package/lib/cjs/collapse/collapse.css +2 -2
- package/lib/cjs/datePicker/datePicker.css +75 -13
- package/lib/cjs/datePicker/datePicker.scss +100 -5
- package/lib/cjs/datePicker/foundation.d.ts +5 -0
- package/lib/cjs/datePicker/foundation.js +2 -0
- package/lib/cjs/datePicker/inputFoundation.d.ts +5 -0
- package/lib/cjs/descriptions/descriptions.css +6 -6
- package/lib/cjs/dropdown/dropdown.css +2 -2
- package/lib/cjs/form/form.css +4 -4
- package/lib/cjs/form/foundation.d.ts +1 -1
- package/lib/cjs/form/foundation.js +55 -9
- package/lib/cjs/form/utils.js +5 -2
- package/lib/cjs/hotKeys/hotKeys.css +2 -2
- package/lib/cjs/image/image.css +2 -2
- package/lib/cjs/image/previewImageFoundation.d.ts +4 -0
- package/lib/cjs/image/previewImageFoundation.js +33 -2
- package/lib/cjs/image/previewInnerFoundation.d.ts +1 -0
- package/lib/cjs/image/previewInnerFoundation.js +17 -4
- package/lib/cjs/input/input.css +8 -8
- package/lib/cjs/input/textarea.css +19 -2
- package/lib/cjs/input/textarea.scss +35 -0
- package/lib/cjs/inputNumber/foundation.d.ts +15 -0
- package/lib/cjs/inputNumber/foundation.js +113 -3
- package/lib/cjs/jsonViewer/jsonViewer.css +2 -2
- package/lib/cjs/jsonViewer/jsonViewer.scss +2 -2
- package/lib/cjs/list/list.css +1 -1
- package/lib/cjs/modal/modal.css +1 -1
- package/lib/cjs/navigation/navigation.css +4 -3
- package/lib/cjs/navigation/navigation.scss +1 -0
- package/lib/cjs/navigation/variables.scss +1 -1
- package/lib/cjs/notification/notification.css +4 -4
- package/lib/cjs/overflowList/foundation.d.ts +1 -0
- package/lib/cjs/overflowList/foundation.js +51 -1
- package/lib/cjs/pagination/pagination.css +5 -5
- package/lib/cjs/popconfirm/popconfirm.css +1 -1
- package/lib/cjs/popover/popover.css +1 -1
- package/lib/cjs/radio/radio.css +2 -2
- package/lib/cjs/scrollList/itemFoundation.js +12 -0
- package/lib/cjs/scrollList/scrollList.css +2 -2
- package/lib/cjs/select/foundation.d.ts +1 -1
- package/lib/cjs/select/foundation.js +28 -2
- package/lib/cjs/select/select.css +6 -6
- package/lib/cjs/sideSheet/sideSheet.css +2 -2
- package/lib/cjs/sidebar/sidebar.css +11 -11
- package/lib/cjs/slider/foundation.js +46 -12
- package/lib/cjs/slider/rtl.scss +62 -0
- package/lib/cjs/slider/slider.css +45 -0
- package/lib/cjs/slider/slider.scss +2 -0
- package/lib/cjs/steps/steps.css +11 -11
- package/lib/cjs/switch/switch.css +1 -0
- package/lib/cjs/switch/switch.scss +1 -0
- package/lib/cjs/switch/variables.scss +2 -1
- package/lib/cjs/table/foundation.d.ts +36 -0
- package/lib/cjs/table/foundation.js +164 -29
- package/lib/cjs/table/table.css +10 -2
- package/lib/cjs/table/table.scss +17 -0
- package/lib/cjs/tabs/tabs.css +2 -2
- package/lib/cjs/tag/tag.css +28 -2
- package/lib/cjs/tag/tag.scss +33 -0
- package/lib/cjs/tagInput/tagInput.css +19 -2
- package/lib/cjs/tagInput/tagInput.scss +18 -0
- package/lib/cjs/timePicker/constants.d.ts +1 -0
- package/lib/cjs/timePicker/foundation.d.ts +7 -1
- package/lib/cjs/timePicker/foundation.js +62 -11
- package/lib/cjs/timePicker/timePicker.css +1 -1
- package/lib/cjs/timeline/timeline.css +2 -2
- package/lib/cjs/toast/toast.css +1 -1
- package/lib/cjs/tooltip/foundation.js +8 -5
- package/lib/cjs/tooltip/tooltip.css +1 -1
- package/lib/cjs/transfer/constants.d.ts +3 -1
- package/lib/cjs/transfer/constants.js +3 -1
- package/lib/cjs/transfer/foundation.d.ts +3 -0
- package/lib/cjs/transfer/foundation.js +4 -0
- package/lib/cjs/transfer/transfer.css +14 -5
- package/lib/cjs/transfer/transfer.scss +10 -0
- package/lib/cjs/tree/foundation.d.ts +3 -0
- package/lib/cjs/tree/foundation.js +31 -4
- package/lib/cjs/tree/tree.css +1 -1
- package/lib/cjs/treeSelect/foundation.d.ts +1 -0
- package/lib/cjs/treeSelect/foundation.js +8 -1
- package/lib/cjs/treeSelect/treeSelect.css +36 -4
- package/lib/cjs/treeSelect/treeSelect.scss +49 -1
- package/lib/cjs/typography/typography.css +8 -8
- package/lib/cjs/upload/upload.css +8 -8
- package/lib/cjs/utils/Store.d.ts +1 -1
- package/lib/cjs/utils/Store.js +1 -0
- package/lib/es/aiChatInput/aiChatInput.css +7 -7
- package/lib/es/anchor/anchor.css +3 -3
- package/lib/es/autoComplete/autoComplete.css +1 -1
- package/lib/es/avatar/avatar.css +5 -5
- package/lib/es/badge/badge.css +1 -1
- package/lib/es/breadcrumb/breadcrumb.css +2 -2
- package/lib/es/calendar/calendar.css +9 -9
- package/lib/es/cascader/cascader.css +6 -6
- package/lib/es/cascader/foundation.d.ts +12 -0
- package/lib/es/cascader/foundation.js +68 -23
- package/lib/es/checkbox/checkbox.css +2 -2
- package/lib/es/codeHighlight/codeHighlight.css +1 -1
- package/lib/es/codeHighlight/codeHighlight.scss +1 -1
- package/lib/es/collapse/collapse.css +2 -2
- package/lib/es/datePicker/datePicker.css +75 -13
- package/lib/es/datePicker/datePicker.scss +100 -5
- package/lib/es/datePicker/foundation.d.ts +5 -0
- package/lib/es/datePicker/foundation.js +2 -0
- package/lib/es/datePicker/inputFoundation.d.ts +5 -0
- package/lib/es/descriptions/descriptions.css +6 -6
- package/lib/es/dropdown/dropdown.css +2 -2
- package/lib/es/form/form.css +4 -4
- package/lib/es/form/foundation.d.ts +1 -1
- package/lib/es/form/foundation.js +55 -9
- package/lib/es/form/utils.js +5 -2
- package/lib/es/hotKeys/hotKeys.css +2 -2
- package/lib/es/image/image.css +2 -2
- package/lib/es/image/previewImageFoundation.d.ts +4 -0
- package/lib/es/image/previewImageFoundation.js +33 -2
- package/lib/es/image/previewInnerFoundation.d.ts +1 -0
- package/lib/es/image/previewInnerFoundation.js +17 -4
- package/lib/es/input/input.css +8 -8
- package/lib/es/input/textarea.css +19 -2
- package/lib/es/input/textarea.scss +35 -0
- package/lib/es/inputNumber/foundation.d.ts +15 -0
- package/lib/es/inputNumber/foundation.js +113 -3
- package/lib/es/jsonViewer/jsonViewer.css +2 -2
- package/lib/es/jsonViewer/jsonViewer.scss +2 -2
- package/lib/es/list/list.css +1 -1
- package/lib/es/modal/modal.css +1 -1
- package/lib/es/navigation/navigation.css +4 -3
- package/lib/es/navigation/navigation.scss +1 -0
- package/lib/es/navigation/variables.scss +1 -1
- package/lib/es/notification/notification.css +4 -4
- package/lib/es/overflowList/foundation.d.ts +1 -0
- package/lib/es/overflowList/foundation.js +51 -1
- package/lib/es/pagination/pagination.css +5 -5
- package/lib/es/popconfirm/popconfirm.css +1 -1
- package/lib/es/popover/popover.css +1 -1
- package/lib/es/radio/radio.css +2 -2
- package/lib/es/scrollList/itemFoundation.js +12 -0
- package/lib/es/scrollList/scrollList.css +2 -2
- package/lib/es/select/foundation.d.ts +1 -1
- package/lib/es/select/foundation.js +28 -2
- package/lib/es/select/select.css +6 -6
- package/lib/es/sideSheet/sideSheet.css +2 -2
- package/lib/es/sidebar/sidebar.css +11 -11
- package/lib/es/slider/foundation.js +46 -12
- package/lib/es/slider/rtl.scss +62 -0
- package/lib/es/slider/slider.css +45 -0
- package/lib/es/slider/slider.scss +2 -0
- package/lib/es/steps/steps.css +11 -11
- package/lib/es/switch/switch.css +1 -0
- package/lib/es/switch/switch.scss +1 -0
- package/lib/es/switch/variables.scss +2 -1
- package/lib/es/table/foundation.d.ts +36 -0
- package/lib/es/table/foundation.js +164 -29
- package/lib/es/table/table.css +10 -2
- package/lib/es/table/table.scss +17 -0
- package/lib/es/tabs/tabs.css +2 -2
- package/lib/es/tag/tag.css +28 -2
- package/lib/es/tag/tag.scss +33 -0
- package/lib/es/tagInput/tagInput.css +19 -2
- package/lib/es/tagInput/tagInput.scss +18 -0
- package/lib/es/timePicker/constants.d.ts +1 -0
- package/lib/es/timePicker/foundation.d.ts +7 -1
- package/lib/es/timePicker/foundation.js +62 -11
- package/lib/es/timePicker/timePicker.css +1 -1
- package/lib/es/timeline/timeline.css +2 -2
- package/lib/es/toast/toast.css +1 -1
- package/lib/es/tooltip/foundation.js +8 -5
- package/lib/es/tooltip/tooltip.css +1 -1
- package/lib/es/transfer/constants.d.ts +3 -1
- package/lib/es/transfer/constants.js +3 -1
- package/lib/es/transfer/foundation.d.ts +3 -0
- package/lib/es/transfer/foundation.js +4 -0
- package/lib/es/transfer/transfer.css +14 -5
- package/lib/es/transfer/transfer.scss +10 -0
- package/lib/es/tree/foundation.d.ts +3 -0
- package/lib/es/tree/foundation.js +31 -4
- package/lib/es/tree/tree.css +1 -1
- package/lib/es/treeSelect/foundation.d.ts +1 -0
- package/lib/es/treeSelect/foundation.js +8 -1
- package/lib/es/treeSelect/treeSelect.css +36 -4
- package/lib/es/treeSelect/treeSelect.scss +49 -1
- package/lib/es/typography/typography.css +8 -8
- package/lib/es/upload/upload.css +8 -8
- package/lib/es/utils/Store.d.ts +1 -1
- package/lib/es/utils/Store.js +1 -0
- package/navigation/navigation.scss +1 -0
- package/navigation/variables.scss +1 -1
- package/overflowList/foundation.ts +48 -2
- package/package.json +19 -4
- package/scrollList/itemFoundation.ts +12 -0
- package/select/foundation.ts +27 -2
- package/slider/foundation.ts +55 -15
- package/slider/rtl.scss +62 -0
- package/slider/slider.scss +2 -0
- package/switch/switch.scss +1 -0
- package/switch/variables.scss +2 -1
- package/table/foundation.ts +199 -30
- package/table/table.scss +17 -0
- package/tag/tag.scss +33 -0
- package/tagInput/tagInput.scss +18 -0
- package/timePicker/constants.ts +2 -0
- package/timePicker/foundation.ts +62 -10
- package/tooltip/foundation.ts +8 -5
- package/transfer/constants.ts +3 -1
- package/transfer/foundation.ts +8 -1
- package/transfer/transfer.scss +10 -0
- package/tree/foundation.ts +34 -5
- package/treeSelect/foundation.ts +10 -1
- package/treeSelect/treeSelect.scss +49 -1
- package/utils/Store.ts +2 -1
|
@@ -569,6 +569,7 @@ $module: #{$prefix}-navigation;
|
|
|
569
569
|
& > .#{$prefix}-button {
|
|
570
570
|
padding-left: $spacing-navigation_footer_collapse_btn_inner-paddingX;
|
|
571
571
|
padding-right: $spacing-navigation_footer_collapse_btn_inner-paddingX;
|
|
572
|
+
color: $color-navigation_footer_icon-default;
|
|
572
573
|
}
|
|
573
574
|
}
|
|
574
575
|
|
|
@@ -65,7 +65,7 @@ $spacing-navigation_sub_item_left_toggle_marginRight:$spacing-tight; // 顶部
|
|
|
65
65
|
$color-navigation-bg-default: var(--semi-color-nav-bg); // 导航栏背景色
|
|
66
66
|
$color-navigation_border-default: var(--semi-color-border); // 导航栏分割线色
|
|
67
67
|
$color-navigation_header-text-default: var(--semi-color-text-0); // 导航栏 header 文字颜色
|
|
68
|
-
$color-navigation_footer_icon-default: var(--semi-color-text-
|
|
68
|
+
$color-navigation_footer_icon-default: var(--semi-color-text-1); // 导航栏 footer 图标颜色
|
|
69
69
|
$color-navigation_itemL1-bg-default: transparent; // 导航栏一级菜单项背景色
|
|
70
70
|
$color-navigation_itemL1-text-default: var(--semi-color-text-0); // 导航栏一级菜单项文字颜色
|
|
71
71
|
$color-navigation_itemL1_icon-default: var(--semi-color-text-2); // 导航栏一级菜单项图标颜色
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
width: 24px;
|
|
60
60
|
font-size: 16px;
|
|
61
61
|
line-height: 22px;
|
|
62
|
-
font-family: "Inter", -apple-system, BlinkMacSystemFont, "
|
|
62
|
+
font-family: "Inter", -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif;
|
|
63
63
|
display: flex;
|
|
64
64
|
align-items: flex-start;
|
|
65
65
|
justify-content: flex-start;
|
|
@@ -101,7 +101,7 @@
|
|
|
101
101
|
.semi-notification-notice-title {
|
|
102
102
|
font-size: 16px;
|
|
103
103
|
line-height: 22px;
|
|
104
|
-
font-family: "Inter", -apple-system, BlinkMacSystemFont, "
|
|
104
|
+
font-family: "Inter", -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif;
|
|
105
105
|
font-weight: 600;
|
|
106
106
|
color: var(--semi-color-text-0);
|
|
107
107
|
margin-bottom: 4px;
|
|
@@ -121,7 +121,7 @@
|
|
|
121
121
|
.semi-notification-notice-content {
|
|
122
122
|
font-size: 14px;
|
|
123
123
|
line-height: 20px;
|
|
124
|
-
font-family: "Inter", -apple-system, BlinkMacSystemFont, "
|
|
124
|
+
font-family: "Inter", -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif;
|
|
125
125
|
font-weight: 400;
|
|
126
126
|
color: var(--semi-color-text-1);
|
|
127
127
|
word-wrap: break-word;
|
|
@@ -137,7 +137,7 @@
|
|
|
137
137
|
display: flex;
|
|
138
138
|
font-size: 14px;
|
|
139
139
|
line-height: 20px;
|
|
140
|
-
font-family: "Inter", -apple-system, BlinkMacSystemFont, "
|
|
140
|
+
font-family: "Inter", -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif;
|
|
141
141
|
cursor: pointer;
|
|
142
142
|
}
|
|
143
143
|
.semi-notification-notice-detail {
|
|
@@ -10,6 +10,7 @@ declare class OverflowListFoundation extends BaseFoundation<OverflowListAdapter>
|
|
|
10
10
|
previousY: any;
|
|
11
11
|
isScrollMode: () => boolean;
|
|
12
12
|
getOverflowItem(): Array<Array<Record<string, any>>>;
|
|
13
|
+
private _syncScrollOverflowCache;
|
|
13
14
|
handleIntersect(entries: Array<IntersectionObserverEntry>): void;
|
|
14
15
|
getReversedItems: () => any;
|
|
15
16
|
handleCollapseOverflow(): void;
|
|
@@ -34,11 +34,21 @@ class OverflowListFoundation extends _foundation.default {
|
|
|
34
34
|
} = this.getProps();
|
|
35
35
|
const {
|
|
36
36
|
visibleState,
|
|
37
|
-
overflow
|
|
37
|
+
overflow,
|
|
38
|
+
scrollOverflow
|
|
38
39
|
} = this.getStates();
|
|
39
40
|
if (!this.isScrollMode()) {
|
|
40
41
|
return overflow;
|
|
41
42
|
}
|
|
43
|
+
// Scroll mode relies on IntersectionObserver to compute visibility.
|
|
44
|
+
// During recalculation (e.g. items changed, or before observer fires),
|
|
45
|
+
// keep last computed overflow to avoid UI flicker (tabs arrows/menu state).
|
|
46
|
+
if (!visibleState || visibleState.size === 0) {
|
|
47
|
+
if (Array.isArray(scrollOverflow) && scrollOverflow.length === 2) {
|
|
48
|
+
return scrollOverflow;
|
|
49
|
+
}
|
|
50
|
+
return [[], []];
|
|
51
|
+
}
|
|
42
52
|
const visibleStateArr = items.map(_ref => {
|
|
43
53
|
let {
|
|
44
54
|
key
|
|
@@ -47,11 +57,49 @@ class OverflowListFoundation extends _foundation.default {
|
|
|
47
57
|
});
|
|
48
58
|
const visibleStart = visibleStateArr.indexOf(true);
|
|
49
59
|
const visibleEnd = visibleStateArr.lastIndexOf(true);
|
|
60
|
+
// If no item is visible (e.g. initial layout not ready or list out of viewport),
|
|
61
|
+
// treat it as "unknown" and keep last computed overflow to avoid wrong enabling.
|
|
62
|
+
if (visibleStart < 0 || visibleEnd < 0) {
|
|
63
|
+
if (Array.isArray(scrollOverflow) && scrollOverflow.length === 2) {
|
|
64
|
+
return scrollOverflow;
|
|
65
|
+
}
|
|
66
|
+
return [[], []];
|
|
67
|
+
}
|
|
50
68
|
const overflowList = [];
|
|
51
69
|
overflowList[0] = visibleStart >= 0 ? items.slice(0, visibleStart) : [];
|
|
52
70
|
overflowList[1] = visibleEnd >= 0 ? items.slice(visibleEnd + 1, items.length) : items.slice();
|
|
53
71
|
return overflowList;
|
|
54
72
|
}
|
|
73
|
+
_syncScrollOverflowCache(nextVisibleState) {
|
|
74
|
+
if (!this.isScrollMode()) {
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
const {
|
|
78
|
+
items
|
|
79
|
+
} = this.getProps();
|
|
80
|
+
const visibleStateArr = items.map(_ref2 => {
|
|
81
|
+
let {
|
|
82
|
+
key
|
|
83
|
+
} = _ref2;
|
|
84
|
+
return Boolean(nextVisibleState.get(key));
|
|
85
|
+
});
|
|
86
|
+
const visibleStart = visibleStateArr.indexOf(true);
|
|
87
|
+
const visibleEnd = visibleStateArr.lastIndexOf(true);
|
|
88
|
+
// No visible items means the result is not reliable; keep cache and stay "calculating"
|
|
89
|
+
if (visibleStart < 0 || visibleEnd < 0) {
|
|
90
|
+
this._adapter.updateStates({
|
|
91
|
+
isScrollOverflowCalculating: true
|
|
92
|
+
});
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
const overflowList = [];
|
|
96
|
+
overflowList[0] = visibleStart >= 0 ? items.slice(0, visibleStart) : [];
|
|
97
|
+
overflowList[1] = visibleEnd >= 0 ? items.slice(visibleEnd + 1, items.length) : items.slice();
|
|
98
|
+
this._adapter.updateStates({
|
|
99
|
+
scrollOverflow: overflowList,
|
|
100
|
+
isScrollOverflowCalculating: false
|
|
101
|
+
});
|
|
102
|
+
}
|
|
55
103
|
handleIntersect(entries) {
|
|
56
104
|
const visibleState = (0, _fastCopy.default)(this.getState('visibleState'));
|
|
57
105
|
const res = {};
|
|
@@ -80,6 +128,8 @@ class OverflowListFoundation extends _foundation.default {
|
|
|
80
128
|
}
|
|
81
129
|
this.previousY = currentY;
|
|
82
130
|
this._adapter.updateVisibleState(visibleState);
|
|
131
|
+
// Keep scroll overflow cache in sync for stable UI
|
|
132
|
+
this._syncScrollOverflowCache(visibleState);
|
|
83
133
|
this._adapter.notifyIntersect(res);
|
|
84
134
|
}
|
|
85
135
|
handleCollapseOverflow() {
|
|
@@ -6,14 +6,14 @@
|
|
|
6
6
|
list-style: none;
|
|
7
7
|
padding: 0;
|
|
8
8
|
align-items: center;
|
|
9
|
-
font-family: "Inter", -apple-system, BlinkMacSystemFont, "
|
|
9
|
+
font-family: "Inter", -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif;
|
|
10
10
|
margin-block-start: 0;
|
|
11
11
|
margin-block-end: 0;
|
|
12
12
|
}
|
|
13
13
|
.semi-page-small {
|
|
14
14
|
font-size: 14px;
|
|
15
15
|
line-height: 20px;
|
|
16
|
-
font-family: "Inter", -apple-system, BlinkMacSystemFont, "
|
|
16
|
+
font-family: "Inter", -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif;
|
|
17
17
|
font-weight: 400;
|
|
18
18
|
color: var(--semi-color-text-2);
|
|
19
19
|
padding: 0 0;
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
.semi-page-item {
|
|
28
28
|
font-size: 14px;
|
|
29
29
|
line-height: 20px;
|
|
30
|
-
font-family: "Inter", -apple-system, BlinkMacSystemFont, "
|
|
30
|
+
font-family: "Inter", -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif;
|
|
31
31
|
min-width: 32px;
|
|
32
32
|
border: 0px solid transparent;
|
|
33
33
|
cursor: pointer;
|
|
@@ -104,7 +104,7 @@
|
|
|
104
104
|
.semi-page-total {
|
|
105
105
|
font-size: 14px;
|
|
106
106
|
line-height: 20px;
|
|
107
|
-
font-family: "Inter", -apple-system, BlinkMacSystemFont, "
|
|
107
|
+
font-family: "Inter", -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif;
|
|
108
108
|
color: var(--semi-color-text-2);
|
|
109
109
|
}
|
|
110
110
|
.semi-page-prev, .semi-page-next {
|
|
@@ -119,7 +119,7 @@
|
|
|
119
119
|
margin-left: 24px;
|
|
120
120
|
font-size: 14px;
|
|
121
121
|
line-height: 20px;
|
|
122
|
-
font-family: "Inter", -apple-system, BlinkMacSystemFont, "
|
|
122
|
+
font-family: "Inter", -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif;
|
|
123
123
|
display: flex;
|
|
124
124
|
justify-content: center;
|
|
125
125
|
align-items: center;
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
.semi-popconfirm-header-title {
|
|
19
19
|
font-size: 16px;
|
|
20
20
|
line-height: 22px;
|
|
21
|
-
font-family: "Inter", -apple-system, BlinkMacSystemFont, "
|
|
21
|
+
font-family: "Inter", -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif;
|
|
22
22
|
font-weight: 600;
|
|
23
23
|
margin-bottom: 8px;
|
|
24
24
|
color: var(--semi-color-text-0);
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
border-radius: var(--semi-border-radius-medium);
|
|
32
32
|
font-size: 14px;
|
|
33
33
|
line-height: 20px;
|
|
34
|
-
font-family: "Inter", -apple-system, BlinkMacSystemFont, "
|
|
34
|
+
font-family: "Inter", -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif;
|
|
35
35
|
opacity: 0;
|
|
36
36
|
}
|
|
37
37
|
.semi-popover-wrapper-show {
|
package/lib/cjs/radio/radio.css
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
box-sizing: border-box;
|
|
6
6
|
font-size: 14px;
|
|
7
7
|
line-height: 20px;
|
|
8
|
-
font-family: "Inter", -apple-system, BlinkMacSystemFont, "
|
|
8
|
+
font-family: "Inter", -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif;
|
|
9
9
|
position: relative;
|
|
10
10
|
display: inline-flex;
|
|
11
11
|
column-gap: 8px;
|
|
@@ -291,7 +291,7 @@
|
|
|
291
291
|
.semi-radioGroup {
|
|
292
292
|
font-size: 14px;
|
|
293
293
|
line-height: 20px;
|
|
294
|
-
font-family: "Inter", -apple-system, BlinkMacSystemFont, "
|
|
294
|
+
font-family: "Inter", -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif;
|
|
295
295
|
}
|
|
296
296
|
.semi-radioGroup-vertical {
|
|
297
297
|
display: flex;
|
|
@@ -81,6 +81,12 @@ class ItemFoundation extends _foundation.default {
|
|
|
81
81
|
const scrollRect = scrollWrapper.getBoundingClientRect();
|
|
82
82
|
const lastRect = lastNode.getBoundingClientRect();
|
|
83
83
|
const listHeight = lastRect.height * list.length;
|
|
84
|
+
// Guard against environments where layout is not computed
|
|
85
|
+
// (e.g. jsdom returns all-zero rects), which would otherwise
|
|
86
|
+
// make `baseTop += listHeight` a no-op and loop forever.
|
|
87
|
+
if (listHeight <= 0) {
|
|
88
|
+
return 0;
|
|
89
|
+
}
|
|
84
90
|
let baseTop = lastRect.top;
|
|
85
91
|
let count = 0;
|
|
86
92
|
while (baseTop <= scrollRect.top + scrollRect.height * ratio) {
|
|
@@ -113,6 +119,12 @@ class ItemFoundation extends _foundation.default {
|
|
|
113
119
|
const scrollRect = scrollWrapper.getBoundingClientRect();
|
|
114
120
|
const firstRect = firstNode.getBoundingClientRect();
|
|
115
121
|
const listHeight = firstRect.height * list.length;
|
|
122
|
+
// Guard against environments where layout is not computed
|
|
123
|
+
// (e.g. jsdom returns all-zero rects), which would otherwise
|
|
124
|
+
// make `baseTop -= listHeight` a no-op and loop forever.
|
|
125
|
+
if (listHeight <= 0) {
|
|
126
|
+
return 0;
|
|
127
|
+
}
|
|
116
128
|
let baseTop = firstRect.top;
|
|
117
129
|
let count = 0;
|
|
118
130
|
while (baseTop + firstRect.height >= scrollRect.top - scrollRect.height * ratio) {
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
overflow: hidden;
|
|
11
11
|
font-size: 14px;
|
|
12
12
|
line-height: 20px;
|
|
13
|
-
font-family: "Inter", -apple-system, BlinkMacSystemFont, "
|
|
13
|
+
font-family: "Inter", -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif;
|
|
14
14
|
user-select: none;
|
|
15
15
|
display: flex;
|
|
16
16
|
flex-direction: column;
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
color: var(--semi-color-text-0);
|
|
27
27
|
font-size: 14px;
|
|
28
28
|
line-height: 20px;
|
|
29
|
-
font-family: "Inter", -apple-system, BlinkMacSystemFont, "
|
|
29
|
+
font-family: "Inter", -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif;
|
|
30
30
|
}
|
|
31
31
|
.semi-scrolllist-body {
|
|
32
32
|
display: flex;
|
|
@@ -54,7 +54,7 @@ export default class SelectFoundation extends BaseFoundation<SelectAdapter> {
|
|
|
54
54
|
constructor(adapter: SelectAdapter);
|
|
55
55
|
_keydownHandler: (...arg: any[]) => void | null;
|
|
56
56
|
init(): void;
|
|
57
|
-
focus(optionsForOpen?: BasicOptionProps[]): void;
|
|
57
|
+
focus(optionsForOpen?: BasicOptionProps[], openDropdown?: boolean): void;
|
|
58
58
|
_focusTrigger(): void;
|
|
59
59
|
destroy(): void;
|
|
60
60
|
_setDropdownWidth(): void;
|
|
@@ -46,15 +46,40 @@ class SelectFoundation extends _foundation.default {
|
|
|
46
46
|
this.focus(originalOptions);
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
|
-
focus(optionsForOpen) {
|
|
49
|
+
focus(optionsForOpen, openDropdown) {
|
|
50
50
|
const isFilterable = this._isFilterable();
|
|
51
51
|
const isMultiple = this._isMultiple();
|
|
52
52
|
const {
|
|
53
53
|
isOpen
|
|
54
54
|
} = this.getStates();
|
|
55
|
+
const {
|
|
56
|
+
searchPosition
|
|
57
|
+
} = this.getProps();
|
|
58
|
+
// Default to true if not specified (backward compatibility)
|
|
59
|
+
const shouldOpenDropdown = openDropdown !== false;
|
|
55
60
|
this._adapter.updateFocusState(true);
|
|
56
61
|
this._adapter.setIsFocusInContainer(false);
|
|
57
62
|
if (isFilterable) {
|
|
63
|
+
/**
|
|
64
|
+
* When openDropdown is false, we only want to "refocus" the Select
|
|
65
|
+
* without changing dropdown visibility.
|
|
66
|
+
*
|
|
67
|
+
* NOTE: For searchPosition='dropdown', the search input is rendered in dropdown,
|
|
68
|
+
* so we should NOT toggle trigger input(showInput) here, otherwise it may affect
|
|
69
|
+
* tabIndex / focusability unexpectedly.
|
|
70
|
+
*/
|
|
71
|
+
if (!shouldOpenDropdown) {
|
|
72
|
+
if (searchPosition === _constants.strings.SEARCH_POSITION_TRIGGER) {
|
|
73
|
+
if (isMultiple) {
|
|
74
|
+
this.focusInput();
|
|
75
|
+
} else {
|
|
76
|
+
this.toggle2SearchInput(true);
|
|
77
|
+
}
|
|
78
|
+
} else {
|
|
79
|
+
this._focusTrigger();
|
|
80
|
+
}
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
58
83
|
if (isMultiple) {
|
|
59
84
|
// when filter and multiple, focus input and open dropdown
|
|
60
85
|
this.focusInput();
|
|
@@ -1092,7 +1117,8 @@ class SelectFoundation extends _foundation.default {
|
|
|
1092
1117
|
this.clearInput(e);
|
|
1093
1118
|
}
|
|
1094
1119
|
// after click showClear button, the select need to be focused
|
|
1095
|
-
|
|
1120
|
+
// but don't open dropdown to avoid focus state confusion
|
|
1121
|
+
this.focus(undefined, false);
|
|
1096
1122
|
this.clearSelected();
|
|
1097
1123
|
// prevent this click open dropdown
|
|
1098
1124
|
e.stopPropagation();
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
.semi-select-option {
|
|
5
5
|
font-size: 14px;
|
|
6
6
|
line-height: 20px;
|
|
7
|
-
font-family: "Inter", -apple-system, BlinkMacSystemFont, "
|
|
7
|
+
font-family: "Inter", -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif;
|
|
8
8
|
word-break: break-all;
|
|
9
9
|
padding-left: 12px;
|
|
10
10
|
padding-right: 12px;
|
|
@@ -110,7 +110,7 @@
|
|
|
110
110
|
.semi-select-large .semi-select-selection {
|
|
111
111
|
font-size: 16px;
|
|
112
112
|
line-height: 22px;
|
|
113
|
-
font-family: "Inter", -apple-system, BlinkMacSystemFont, "
|
|
113
|
+
font-family: "Inter", -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif;
|
|
114
114
|
}
|
|
115
115
|
.semi-select-open, .semi-select-focus {
|
|
116
116
|
border: 1px solid var(--semi-color-focus-border);
|
|
@@ -184,7 +184,7 @@
|
|
|
184
184
|
.semi-select-selection {
|
|
185
185
|
font-size: 14px;
|
|
186
186
|
line-height: 20px;
|
|
187
|
-
font-family: "Inter", -apple-system, BlinkMacSystemFont, "
|
|
187
|
+
font-family: "Inter", -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif;
|
|
188
188
|
height: 100%;
|
|
189
189
|
display: flex;
|
|
190
190
|
align-items: center;
|
|
@@ -309,7 +309,7 @@
|
|
|
309
309
|
color: var(--semi-color-text-2);
|
|
310
310
|
font-size: 14px;
|
|
311
311
|
line-height: 20px;
|
|
312
|
-
font-family: "Inter", -apple-system, BlinkMacSystemFont, "
|
|
312
|
+
font-family: "Inter", -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif;
|
|
313
313
|
font-weight: 600;
|
|
314
314
|
}
|
|
315
315
|
.semi-select-prefix-icon, .semi-select-suffix-icon {
|
|
@@ -340,7 +340,7 @@
|
|
|
340
340
|
font-weight: 600;
|
|
341
341
|
font-size: 14px;
|
|
342
342
|
line-height: 20px;
|
|
343
|
-
font-family: "Inter", -apple-system, BlinkMacSystemFont, "
|
|
343
|
+
font-family: "Inter", -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif;
|
|
344
344
|
color: var(--semi-color-text-2);
|
|
345
345
|
flex-shrink: 0;
|
|
346
346
|
white-space: nowrap;
|
|
@@ -454,7 +454,7 @@
|
|
|
454
454
|
padding-right: 16px;
|
|
455
455
|
font-size: 12px;
|
|
456
456
|
line-height: 16px;
|
|
457
|
-
font-family: "Inter", -apple-system, BlinkMacSystemFont, "
|
|
457
|
+
font-family: "Inter", -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif;
|
|
458
458
|
cursor: default;
|
|
459
459
|
}
|
|
460
460
|
.semi-select-group:not(:nth-of-type(1)) {
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
.semi-sidesheet {
|
|
5
5
|
font-size: 14px;
|
|
6
6
|
line-height: 20px;
|
|
7
|
-
font-family: "Inter", -apple-system, BlinkMacSystemFont, "
|
|
7
|
+
font-family: "Inter", -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif;
|
|
8
8
|
position: fixed;
|
|
9
9
|
margin: 0;
|
|
10
10
|
top: 0;
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
margin: 0;
|
|
60
60
|
font-size: 18px;
|
|
61
61
|
line-height: 24px;
|
|
62
|
-
font-family: "Inter", -apple-system, BlinkMacSystemFont, "
|
|
62
|
+
font-family: "Inter", -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif;
|
|
63
63
|
font-weight: 600;
|
|
64
64
|
font-size: 18px;
|
|
65
65
|
color: var(--semi-color-text-0);
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
flex: 1;
|
|
35
35
|
font-size: 16px;
|
|
36
36
|
line-height: 22px;
|
|
37
|
-
font-family: "Inter", -apple-system, BlinkMacSystemFont, "
|
|
37
|
+
font-family: "Inter", -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif;
|
|
38
38
|
font-weight: 600;
|
|
39
39
|
}
|
|
40
40
|
.semi-sidebar-container-header-closeBtn {
|
|
@@ -86,7 +86,7 @@
|
|
|
86
86
|
.semi-sidebar-mcp-configure-content-header-count {
|
|
87
87
|
font-size: 12px;
|
|
88
88
|
line-height: 16px;
|
|
89
|
-
font-family: "Inter", -apple-system, BlinkMacSystemFont, "
|
|
89
|
+
font-family: "Inter", -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif;
|
|
90
90
|
vertical-align: middle;
|
|
91
91
|
color: var(--semi-color-text-2);
|
|
92
92
|
}
|
|
@@ -124,14 +124,14 @@
|
|
|
124
124
|
.semi-sidebar-mcp-configure-content-item-content-label {
|
|
125
125
|
font-size: 14px;
|
|
126
126
|
line-height: 20px;
|
|
127
|
-
font-family: "Inter", -apple-system, BlinkMacSystemFont, "
|
|
127
|
+
font-family: "Inter", -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif;
|
|
128
128
|
font-weight: 600;
|
|
129
129
|
color: var(--semi-color-text-0);
|
|
130
130
|
}
|
|
131
131
|
.semi-sidebar-mcp-configure-content-item-content-desc {
|
|
132
132
|
font-size: 12px;
|
|
133
133
|
line-height: 16px;
|
|
134
|
-
font-family: "Inter", -apple-system, BlinkMacSystemFont, "
|
|
134
|
+
font-family: "Inter", -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif;
|
|
135
135
|
color: var(--semi-color-text-0);
|
|
136
136
|
overflow: hidden;
|
|
137
137
|
text-overflow: ellipsis;
|
|
@@ -176,7 +176,7 @@
|
|
|
176
176
|
-webkit-box-orient: vertical;
|
|
177
177
|
font-size: 14px;
|
|
178
178
|
line-height: 20px;
|
|
179
|
-
font-family: "Inter", -apple-system, BlinkMacSystemFont, "
|
|
179
|
+
font-family: "Inter", -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif;
|
|
180
180
|
color: var(--semi-color-text-0);
|
|
181
181
|
font-weight: 600;
|
|
182
182
|
}
|
|
@@ -193,7 +193,7 @@
|
|
|
193
193
|
.semi-sidebar-annotation-item-footer-text {
|
|
194
194
|
font-size: 12px;
|
|
195
195
|
line-height: 16px;
|
|
196
|
-
font-family: "Inter", -apple-system, BlinkMacSystemFont, "
|
|
196
|
+
font-family: "Inter", -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif;
|
|
197
197
|
color: var(--semi-color-text-0);
|
|
198
198
|
overflow: hidden;
|
|
199
199
|
text-overflow: ellipsis;
|
|
@@ -212,7 +212,7 @@
|
|
|
212
212
|
justify-content: center;
|
|
213
213
|
font-size: 12px;
|
|
214
214
|
line-height: 16px;
|
|
215
|
-
font-family: "Inter", -apple-system, BlinkMacSystemFont, "
|
|
215
|
+
font-family: "Inter", -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif;
|
|
216
216
|
color: var(--semi-color-text-2);
|
|
217
217
|
}
|
|
218
218
|
.semi-sidebar-annotation-item-text {
|
|
@@ -233,7 +233,7 @@
|
|
|
233
233
|
-webkit-box-orient: vertical;
|
|
234
234
|
font-size: 12px;
|
|
235
235
|
line-height: 16px;
|
|
236
|
-
font-family: "Inter", -apple-system, BlinkMacSystemFont, "
|
|
236
|
+
font-family: "Inter", -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif;
|
|
237
237
|
color: var(--semi-color-text-2);
|
|
238
238
|
}
|
|
239
239
|
.semi-sidebar-annotation-item-video {
|
|
@@ -288,13 +288,13 @@
|
|
|
288
288
|
border-radius: 4px;
|
|
289
289
|
font-size: 12px;
|
|
290
290
|
line-height: 16px;
|
|
291
|
-
font-family: "Inter", -apple-system, BlinkMacSystemFont, "
|
|
291
|
+
font-family: "Inter", -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif;
|
|
292
292
|
color: var(--semi-color-bg-0);
|
|
293
293
|
}
|
|
294
294
|
.semi-sidebar-annotation-item-video-title {
|
|
295
295
|
font-size: 14px;
|
|
296
296
|
line-height: 20px;
|
|
297
|
-
font-family: "Inter", -apple-system, BlinkMacSystemFont, "
|
|
297
|
+
font-family: "Inter", -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif;
|
|
298
298
|
color: var(--semi-color-text-0);
|
|
299
299
|
}
|
|
300
300
|
.semi-sidebar-code-content {
|
|
@@ -522,7 +522,7 @@
|
|
|
522
522
|
.semi-sidebar-detail-header-title {
|
|
523
523
|
font-size: 16px;
|
|
524
524
|
line-height: 22px;
|
|
525
|
-
font-family: "Inter", -apple-system, BlinkMacSystemFont, "
|
|
525
|
+
font-family: "Inter", -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif;
|
|
526
526
|
font-weight: 600;
|
|
527
527
|
}
|
|
528
528
|
.semi-sidebar-detail-header-right {
|
|
@@ -27,6 +27,8 @@ class SliderFoundation extends _foundation.default {
|
|
|
27
27
|
min,
|
|
28
28
|
max
|
|
29
29
|
} = this._adapter.getProps();
|
|
30
|
+
// Percent always increases with value, independent of visual direction.
|
|
31
|
+
// UI layer decides whether to use `left` or `right` to place elements.
|
|
30
32
|
const minPercent = range ? (value[0] - min) / (max - min) : (value - min) / (max - min);
|
|
31
33
|
const maxPercent = range ? (value[1] - min) / (max - min) : 1;
|
|
32
34
|
return {
|
|
@@ -140,6 +142,8 @@ class SliderFoundation extends _foundation.default {
|
|
|
140
142
|
verticalReverse,
|
|
141
143
|
range
|
|
142
144
|
} = this._adapter.getProps();
|
|
145
|
+
const direction = this._adapter.getContext('direction');
|
|
146
|
+
const isRTL = direction === 'rtl' && !vertical;
|
|
143
147
|
const value = this._adapter.getState('currentValue');
|
|
144
148
|
const currentPos = this.transValueToPos(value);
|
|
145
149
|
const {
|
|
@@ -156,6 +160,9 @@ class SliderFoundation extends _foundation.default {
|
|
|
156
160
|
let startPos;
|
|
157
161
|
if (vertical && verticalReverse) {
|
|
158
162
|
startPos = sliderY + len;
|
|
163
|
+
} else if (isRTL) {
|
|
164
|
+
// In RTL mode, start from right (sliderX + sliderWidth)
|
|
165
|
+
startPos = sliderX + len;
|
|
159
166
|
} else {
|
|
160
167
|
startPos = vertical ? sliderY : sliderX;
|
|
161
168
|
}
|
|
@@ -163,11 +170,14 @@ class SliderFoundation extends _foundation.default {
|
|
|
163
170
|
let endPos;
|
|
164
171
|
if (vertical && verticalReverse) {
|
|
165
172
|
endPos = sliderY;
|
|
173
|
+
} else if (isRTL) {
|
|
174
|
+
// In RTL mode, end at left (sliderX)
|
|
175
|
+
endPos = sliderX;
|
|
166
176
|
} else {
|
|
167
177
|
endPos = vertical ? sliderY + sliderHeight : sliderX + sliderWidth;
|
|
168
178
|
}
|
|
169
179
|
// endPos = chooseMovePos === 'min' && isDrag && range ? currentPos[1] : endPos;
|
|
170
|
-
if (vertical && verticalReverse) {
|
|
180
|
+
if (vertical && verticalReverse || isRTL) {
|
|
171
181
|
if (position >= startPos) {
|
|
172
182
|
position = startPos;
|
|
173
183
|
} else if (position <= endPos) {
|
|
@@ -200,6 +210,8 @@ class SliderFoundation extends _foundation.default {
|
|
|
200
210
|
step,
|
|
201
211
|
verticalReverse
|
|
202
212
|
} = this._adapter.getProps();
|
|
213
|
+
const direction = this._adapter.getContext('direction');
|
|
214
|
+
const isRTL = direction === 'rtl' && !vertical;
|
|
203
215
|
const {
|
|
204
216
|
sliderX,
|
|
205
217
|
sliderY,
|
|
@@ -212,6 +224,9 @@ class SliderFoundation extends _foundation.default {
|
|
|
212
224
|
if (vertical && verticalReverse) {
|
|
213
225
|
//isMin = !isMin;
|
|
214
226
|
stepValue = (startPos + len - pos) / len * (max - min) + min;
|
|
227
|
+
} else if (isRTL) {
|
|
228
|
+
// In RTL mode, position is calculated from right to left
|
|
229
|
+
stepValue = (startPos + len - pos) / len * (max - min) + min;
|
|
215
230
|
} else {
|
|
216
231
|
stepValue = (pos - startPos) / len * (max - min) + min;
|
|
217
232
|
}
|
|
@@ -248,6 +263,8 @@ class SliderFoundation extends _foundation.default {
|
|
|
248
263
|
range,
|
|
249
264
|
verticalReverse
|
|
250
265
|
} = this._adapter.getProps();
|
|
266
|
+
const direction = this._adapter.getContext('direction');
|
|
267
|
+
const isRTL = direction === 'rtl' && !vertical;
|
|
251
268
|
const {
|
|
252
269
|
sliderX,
|
|
253
270
|
sliderY,
|
|
@@ -256,10 +273,22 @@ class SliderFoundation extends _foundation.default {
|
|
|
256
273
|
} = this._adapter.getSliderLengths();
|
|
257
274
|
const startPos = vertical ? sliderY : sliderX;
|
|
258
275
|
const len = vertical ? sliderHeight : sliderWidth;
|
|
276
|
+
const transSingle = val => {
|
|
277
|
+
const percent = (val - min) / (max - min);
|
|
278
|
+
if (vertical && verticalReverse) {
|
|
279
|
+
// Reverse direction in vertical mode
|
|
280
|
+
return startPos + len - percent * len;
|
|
281
|
+
}
|
|
282
|
+
if (isRTL) {
|
|
283
|
+
// Reverse direction in horizontal RTL
|
|
284
|
+
return startPos + len - percent * len;
|
|
285
|
+
}
|
|
286
|
+
return startPos + percent * len;
|
|
287
|
+
};
|
|
259
288
|
if (range) {
|
|
260
|
-
return [(value[0]
|
|
289
|
+
return [transSingle(value[0]), transSingle(value[1])];
|
|
261
290
|
} else {
|
|
262
|
-
return (value
|
|
291
|
+
return transSingle(value);
|
|
263
292
|
}
|
|
264
293
|
};
|
|
265
294
|
/**
|
|
@@ -582,23 +611,28 @@ class SliderFoundation extends _foundation.default {
|
|
|
582
611
|
} = this.getStates();
|
|
583
612
|
const {
|
|
584
613
|
step,
|
|
585
|
-
range
|
|
614
|
+
range,
|
|
615
|
+
vertical
|
|
586
616
|
} = this.getProps();
|
|
617
|
+
const direction = this._adapter.getContext('direction');
|
|
618
|
+
const isRTL = direction === 'rtl' && !vertical;
|
|
587
619
|
let outputValue;
|
|
588
620
|
switch (event.key) {
|
|
589
621
|
case "ArrowLeft":
|
|
590
622
|
case "ArrowDown":
|
|
591
|
-
|
|
623
|
+
// In RTL mode, ArrowLeft and ArrowDown should increase value
|
|
624
|
+
outputValue = isRTL ? this._handleValueIncreaseWithKeyBoard(step, handler) : this._handleValueDecreaseWithKeyBoard(step, handler);
|
|
592
625
|
break;
|
|
593
626
|
case "ArrowRight":
|
|
594
627
|
case "ArrowUp":
|
|
595
|
-
|
|
628
|
+
// In RTL mode, ArrowRight and ArrowUp should decrease value
|
|
629
|
+
outputValue = isRTL ? this._handleValueDecreaseWithKeyBoard(step, handler) : this._handleValueIncreaseWithKeyBoard(step, handler);
|
|
596
630
|
break;
|
|
597
631
|
case "PageUp":
|
|
598
|
-
outputValue = this._handleValueIncreaseWithKeyBoard(10 * step, handler);
|
|
632
|
+
outputValue = isRTL ? this._handleValueDecreaseWithKeyBoard(10 * step, handler) : this._handleValueIncreaseWithKeyBoard(10 * step, handler);
|
|
599
633
|
break;
|
|
600
634
|
case "PageDown":
|
|
601
|
-
outputValue = this._handleValueDecreaseWithKeyBoard(10 * step, handler);
|
|
635
|
+
outputValue = isRTL ? this._handleValueIncreaseWithKeyBoard(10 * step, handler) : this._handleValueDecreaseWithKeyBoard(10 * step, handler);
|
|
602
636
|
break;
|
|
603
637
|
case "Home":
|
|
604
638
|
outputValue = this._handleHomeKey(handler);
|
|
@@ -719,10 +753,10 @@ class SliderFoundation extends _foundation.default {
|
|
|
719
753
|
const currentPos = this.transValueToPos(currentValue);
|
|
720
754
|
let isMin = true;
|
|
721
755
|
if (Array.isArray(currentPos)) {
|
|
722
|
-
//
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
756
|
+
// Choose the nearest handle regardless of ordering (LTR/RTL/verticalReverse)
|
|
757
|
+
const distToFirst = Math.abs(pagePos - currentPos[0]);
|
|
758
|
+
const distToSecond = Math.abs(pagePos - currentPos[1]);
|
|
759
|
+
isMin = distToFirst <= distToSecond;
|
|
726
760
|
}
|
|
727
761
|
if (vertical && verticalReverse) {
|
|
728
762
|
isMin = !isMin;
|