@douyinfe/semi-foundation 2.97.0 → 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/codeHighlight/codeHighlight.scss +1 -1
- package/datePicker/foundation.ts +7 -0
- package/datePicker/inputFoundation.ts +5 -0
- package/form/foundation.ts +48 -4
- 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/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 +8 -8
- 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.js +49 -3
- package/lib/cjs/hotKeys/hotKeys.css +2 -2
- package/lib/cjs/image/image.css +2 -2
- package/lib/cjs/input/input.css +8 -8
- package/lib/cjs/input/textarea.css +2 -2
- 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 +2 -2
- package/lib/cjs/notification/notification.css +4 -4
- 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/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/table/foundation.d.ts +36 -0
- package/lib/cjs/table/foundation.js +162 -28
- 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 +2 -2
- package/lib/cjs/tagInput/tagInput.css +2 -2
- 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/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 +8 -8
- 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.js +49 -3
- package/lib/es/hotKeys/hotKeys.css +2 -2
- package/lib/es/image/image.css +2 -2
- package/lib/es/input/input.css +8 -8
- package/lib/es/input/textarea.css +2 -2
- 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 +2 -2
- package/lib/es/notification/notification.css +4 -4
- 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/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/table/foundation.d.ts +36 -0
- package/lib/es/table/foundation.js +162 -28
- 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 +2 -2
- package/lib/es/tagInput/tagInput.css +2 -2
- 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/package.json +19 -4
- package/scrollList/itemFoundation.ts +12 -0
- package/slider/foundation.ts +55 -15
- package/slider/rtl.scss +62 -0
- package/slider/slider.scss +2 -0
- package/table/foundation.ts +197 -29
- package/table/table.scss +17 -0
- 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
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
font-weight: 600;
|
|
18
18
|
font-size: 14px;
|
|
19
19
|
line-height: 20px;
|
|
20
|
-
font-family: "Inter", -apple-system, BlinkMacSystemFont, "
|
|
20
|
+
font-family: "Inter", -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif;
|
|
21
21
|
}
|
|
22
22
|
.semi-collapse-header-right {
|
|
23
23
|
display: flex;
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
color: var(--semi-color-text-1);
|
|
62
62
|
font-size: 14px;
|
|
63
63
|
line-height: 20px;
|
|
64
|
-
font-family: "Inter", -apple-system, BlinkMacSystemFont, "
|
|
64
|
+
font-family: "Inter", -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif;
|
|
65
65
|
}
|
|
66
66
|
.semi-collapse-content p {
|
|
67
67
|
margin: 0;
|
|
@@ -110,7 +110,7 @@
|
|
|
110
110
|
padding: 0;
|
|
111
111
|
font-size: 14px;
|
|
112
112
|
line-height: 20px;
|
|
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
|
min-height: 24px;
|
|
115
115
|
line-height: 24px;
|
|
116
116
|
}
|
|
@@ -199,7 +199,7 @@
|
|
|
199
199
|
.semi-datepicker-navigation-month {
|
|
200
200
|
font-size: 16px;
|
|
201
201
|
line-height: 22px;
|
|
202
|
-
font-family: "Inter", -apple-system, BlinkMacSystemFont, "
|
|
202
|
+
font-family: "Inter", -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif;
|
|
203
203
|
flex-grow: 1;
|
|
204
204
|
text-align: center;
|
|
205
205
|
font-weight: 600;
|
|
@@ -217,7 +217,7 @@
|
|
|
217
217
|
.semi-datepicker-weekday {
|
|
218
218
|
font-size: 12px;
|
|
219
219
|
line-height: 16px;
|
|
220
|
-
font-family: "Inter", -apple-system, BlinkMacSystemFont, "
|
|
220
|
+
font-family: "Inter", -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif;
|
|
221
221
|
font-weight: 600;
|
|
222
222
|
color: var(--semi-color-text-2);
|
|
223
223
|
border-bottom: 1px solid var(--semi-color-border);
|
|
@@ -737,7 +737,7 @@
|
|
|
737
737
|
font-weight: 600;
|
|
738
738
|
font-size: 14px;
|
|
739
739
|
line-height: 20px;
|
|
740
|
-
font-family: "Inter", -apple-system, BlinkMacSystemFont, "
|
|
740
|
+
font-family: "Inter", -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif;
|
|
741
741
|
white-space: nowrap;
|
|
742
742
|
color: var(--semi-color-text-2);
|
|
743
743
|
}
|
|
@@ -763,7 +763,7 @@
|
|
|
763
763
|
.semi-datepicker-compact {
|
|
764
764
|
font-size: 12px;
|
|
765
765
|
line-height: 16px;
|
|
766
|
-
font-family: "Inter", -apple-system, BlinkMacSystemFont, "
|
|
766
|
+
font-family: "Inter", -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif;
|
|
767
767
|
line-height: 20px;
|
|
768
768
|
display: inline-block;
|
|
769
769
|
max-width: calc(100vw - 32px);
|
|
@@ -834,7 +834,7 @@
|
|
|
834
834
|
.semi-datepicker-compact .semi-datepicker-month-grid .semi-scrolllist {
|
|
835
835
|
font-size: 12px;
|
|
836
836
|
line-height: 16px;
|
|
837
|
-
font-family: "Inter", -apple-system, BlinkMacSystemFont, "
|
|
837
|
+
font-family: "Inter", -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif;
|
|
838
838
|
line-height: 20px;
|
|
839
839
|
}
|
|
840
840
|
.semi-datepicker-compact .semi-datepicker-month-grid .semi-scrolllist-header {
|
|
@@ -878,7 +878,7 @@
|
|
|
878
878
|
.semi-datepicker-compact.semi-datepicker-panel-yam .semi-scrolllist {
|
|
879
879
|
font-size: 12px;
|
|
880
880
|
line-height: 16px;
|
|
881
|
-
font-family: "Inter", -apple-system, BlinkMacSystemFont, "
|
|
881
|
+
font-family: "Inter", -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif;
|
|
882
882
|
line-height: 20px;
|
|
883
883
|
}
|
|
884
884
|
.semi-datepicker-compact .semi-datepicker-tpk {
|
|
@@ -907,7 +907,7 @@
|
|
|
907
907
|
.semi-datepicker-compact .semi-datepicker-navigation-month .semi-button {
|
|
908
908
|
font-size: 12px;
|
|
909
909
|
line-height: 16px;
|
|
910
|
-
font-family: "Inter", -apple-system, BlinkMacSystemFont, "
|
|
910
|
+
font-family: "Inter", -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif;
|
|
911
911
|
line-height: 20px;
|
|
912
912
|
max-width: 100%;
|
|
913
913
|
}
|
|
@@ -138,6 +138,11 @@ export interface DatePickerFoundationProps extends ElementProps, RenderProps, Ev
|
|
|
138
138
|
dateFnsLocale?: any;
|
|
139
139
|
localeCode?: string;
|
|
140
140
|
rangeSeparator?: string;
|
|
141
|
+
/**
|
|
142
|
+
* Only for UI render. Keep `semi-foundation` framework-agnostic (no React types).
|
|
143
|
+
* `semi-ui` layer should declare this as `React.ReactNode`.
|
|
144
|
+
*/
|
|
145
|
+
rangeSeparatorNode?: any;
|
|
141
146
|
insetInput?: DateInputFoundationProps['insetInput'];
|
|
142
147
|
preventScroll?: boolean;
|
|
143
148
|
}
|
|
@@ -53,6 +53,8 @@ class DatePickerFoundation extends _foundation.default {
|
|
|
53
53
|
this._isRangeValueComplete = value => {
|
|
54
54
|
let result = false;
|
|
55
55
|
if (Array.isArray(value)) {
|
|
56
|
+
// Note: empty array should be treated as "complete" (not partially selected)
|
|
57
|
+
// to keep behaviors such as clear/confirm/change consistent.
|
|
56
58
|
result = !value.some(date => (0, _isNullOrUndefined.default)(date));
|
|
57
59
|
}
|
|
58
60
|
return result;
|
|
@@ -40,6 +40,11 @@ export interface DateInputFoundationProps extends DateInputElementProps, DateInp
|
|
|
40
40
|
validateStatus?: ValidateStatus;
|
|
41
41
|
prefixCls?: string;
|
|
42
42
|
rangeSeparator?: string;
|
|
43
|
+
/**
|
|
44
|
+
* Only for UI render. Keep `semi-foundation` framework-agnostic (no React types).
|
|
45
|
+
* `semi-ui` layer should declare this as `React.ReactNode`.
|
|
46
|
+
*/
|
|
47
|
+
rangeSeparatorNode?: any;
|
|
43
48
|
panelType?: PanelType;
|
|
44
49
|
insetInput?: boolean | InsetInputProps;
|
|
45
50
|
insetInputValue?: InsetInputValue;
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
font-weight: normal;
|
|
26
26
|
font-size: 14px;
|
|
27
27
|
line-height: 20px;
|
|
28
|
-
font-family: "Inter", -apple-system, BlinkMacSystemFont, "
|
|
28
|
+
font-family: "Inter", -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif;
|
|
29
29
|
min-height: 14px;
|
|
30
30
|
white-space: nowrap;
|
|
31
31
|
color: var(--semi-color-text-2);
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
font-weight: normal;
|
|
35
35
|
font-size: 14px;
|
|
36
36
|
line-height: 20px;
|
|
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
|
color: var(--semi-color-text-0);
|
|
39
39
|
}
|
|
40
40
|
.semi-descriptions-center .semi-descriptions-item-th {
|
|
@@ -84,14 +84,14 @@
|
|
|
84
84
|
.semi-descriptions-double-small .semi-descriptions-key {
|
|
85
85
|
font-size: 12px;
|
|
86
86
|
line-height: 16px;
|
|
87
|
-
font-family: "Inter", -apple-system, BlinkMacSystemFont, "
|
|
87
|
+
font-family: "Inter", -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif;
|
|
88
88
|
padding-bottom: 0;
|
|
89
89
|
font-size: 12px;
|
|
90
90
|
}
|
|
91
91
|
.semi-descriptions-double-small .semi-descriptions-value {
|
|
92
92
|
font-size: 16px;
|
|
93
93
|
line-height: 22px;
|
|
94
|
-
font-family: "Inter", -apple-system, BlinkMacSystemFont, "
|
|
94
|
+
font-family: "Inter", -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif;
|
|
95
95
|
font-size: 16px;
|
|
96
96
|
}
|
|
97
97
|
.semi-descriptions-double-medium .semi-descriptions-item {
|
|
@@ -104,7 +104,7 @@
|
|
|
104
104
|
.semi-descriptions-double-medium .semi-descriptions-value {
|
|
105
105
|
font-size: 20px;
|
|
106
106
|
line-height: 28px;
|
|
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
|
font-size: 20px;
|
|
109
109
|
}
|
|
110
110
|
.semi-descriptions-double-large .semi-descriptions-item {
|
|
@@ -117,7 +117,7 @@
|
|
|
117
117
|
.semi-descriptions-double-large .semi-descriptions-value {
|
|
118
118
|
font-size: 28px;
|
|
119
119
|
line-height: 40px;
|
|
120
|
-
font-family: "Inter", -apple-system, BlinkMacSystemFont, "
|
|
120
|
+
font-family: "Inter", -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif;
|
|
121
121
|
font-size: 28px;
|
|
122
122
|
}
|
|
123
123
|
.semi-descriptions-horizontal table {
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
.semi-dropdown {
|
|
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
|
}
|
|
9
9
|
.semi-dropdown-wrapper {
|
|
10
10
|
overflow-y: auto;
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
padding-right: 16px;
|
|
36
36
|
font-size: 12px;
|
|
37
37
|
line-height: 16px;
|
|
38
|
-
font-family: "Inter", -apple-system, BlinkMacSystemFont, "
|
|
38
|
+
font-family: "Inter", -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif;
|
|
39
39
|
cursor: default;
|
|
40
40
|
}
|
|
41
41
|
.semi-dropdown-title-withTick {
|
package/lib/cjs/form/form.css
CHANGED
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
vertical-align: middle;
|
|
55
55
|
font-size: 14px;
|
|
56
56
|
line-height: 20px;
|
|
57
|
-
font-family: "Inter", -apple-system, BlinkMacSystemFont, "
|
|
57
|
+
font-family: "Inter", -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif;
|
|
58
58
|
flex-shrink: 0;
|
|
59
59
|
}
|
|
60
60
|
.semi-form-field-label-disabled {
|
|
@@ -89,7 +89,7 @@
|
|
|
89
89
|
.semi-form-field-error-message, .semi-form-field-help-text {
|
|
90
90
|
font-size: 14px;
|
|
91
91
|
line-height: 20px;
|
|
92
|
-
font-family: "Inter", -apple-system, BlinkMacSystemFont, "
|
|
92
|
+
font-family: "Inter", -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif;
|
|
93
93
|
display: flex;
|
|
94
94
|
align-items: center;
|
|
95
95
|
margin-top: 4px;
|
|
@@ -176,7 +176,7 @@
|
|
|
176
176
|
color: var(--semi-color-tertiary);
|
|
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
|
}
|
|
181
181
|
|
|
182
182
|
.semi-form-vertical .semi-form-field-group {
|
|
@@ -210,7 +210,7 @@
|
|
|
210
210
|
margin-block-end: 0;
|
|
211
211
|
font-size: 18px;
|
|
212
212
|
line-height: 24px;
|
|
213
|
-
font-family: "Inter", -apple-system, BlinkMacSystemFont, "
|
|
213
|
+
font-family: "Inter", -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif;
|
|
214
214
|
font-weight: 600;
|
|
215
215
|
width: 100%;
|
|
216
216
|
padding-bottom: 8px;
|
|
@@ -79,14 +79,60 @@ class FormFoundation extends _foundation.default {
|
|
|
79
79
|
const registered = this.registered[field];
|
|
80
80
|
this.registered[field] = true;
|
|
81
81
|
this.fields.set(field, fieldStuff);
|
|
82
|
-
if (fieldStuff.keepState) {
|
|
83
|
-
//
|
|
82
|
+
if (fieldStuff.keepState && registered) {
|
|
83
|
+
// When keepState is true and the field was previously registered (remounting),
|
|
84
|
+
// restore the saved state from formState instead of using the initial value
|
|
85
|
+
const hasSavedValue = ObjectUtil.has(this.data.values, field);
|
|
86
|
+
const savedValue = ObjectUtil.get(this.data.values, field);
|
|
87
|
+
const hasSavedError = ObjectUtil.has(this.data.errors, field);
|
|
88
|
+
const savedError = ObjectUtil.get(this.data.errors, field);
|
|
89
|
+
const hasSavedTouched = ObjectUtil.has(this.data.touched, field);
|
|
90
|
+
const savedTouched = ObjectUtil.get(this.data.touched, field);
|
|
91
|
+
const allowEmpty = fieldStuff.allowEmpty || false;
|
|
92
|
+
const opts = {
|
|
93
|
+
notNotify: true,
|
|
94
|
+
notUpdate: false,
|
|
95
|
+
// updateStateValue reads `fieldAllowEmpty` (field-level override)
|
|
96
|
+
fieldAllowEmpty: allowEmpty
|
|
97
|
+
};
|
|
98
|
+
// Restore value from formState if it exists
|
|
99
|
+
if (hasSavedValue) {
|
|
100
|
+
// Keep formState as source of truth; still trigger a forceUpdate so that
|
|
101
|
+
// consumers of formState can get the latest snapshot when field remounts.
|
|
102
|
+
this.updateStateValue(field, savedValue, opts);
|
|
103
|
+
// Sync the restored value back to the field component's local state.
|
|
104
|
+
// Avoid a second forceUpdate/notify from FieldApi.
|
|
105
|
+
fieldStuff.fieldApi.setValue(savedValue, Object.assign(Object.assign({}, opts), {
|
|
106
|
+
notUpdate: true
|
|
107
|
+
}));
|
|
108
|
+
} else {
|
|
109
|
+
// No saved value, use initial value
|
|
110
|
+
let fieldValue = fieldState.value;
|
|
111
|
+
if (!allowEmpty && fieldValue === '') {
|
|
112
|
+
fieldValue = undefined;
|
|
113
|
+
}
|
|
114
|
+
this.updateStateValue(field, fieldValue, opts);
|
|
115
|
+
}
|
|
116
|
+
// Restore error from formState if it exists
|
|
117
|
+
if (hasSavedError) {
|
|
118
|
+
this.updateStateError(field, savedError, opts);
|
|
119
|
+
fieldStuff.fieldApi.setError(savedError, Object.assign(Object.assign({}, opts), {
|
|
120
|
+
notUpdate: true
|
|
121
|
+
}));
|
|
122
|
+
}
|
|
123
|
+
// Restore touched from formState if it exists
|
|
124
|
+
if (hasSavedTouched) {
|
|
125
|
+
this.updateStateTouched(field, savedTouched, opts);
|
|
126
|
+
fieldStuff.fieldApi.setTouched(savedTouched, Object.assign(Object.assign({}, opts), {
|
|
127
|
+
notUpdate: true
|
|
128
|
+
}));
|
|
129
|
+
}
|
|
84
130
|
} else {
|
|
85
131
|
const allowEmpty = fieldStuff.allowEmpty || false;
|
|
86
132
|
const opts = {
|
|
87
133
|
notNotify: true,
|
|
88
134
|
notUpdate: false,
|
|
89
|
-
allowEmpty
|
|
135
|
+
fieldAllowEmpty: allowEmpty
|
|
90
136
|
};
|
|
91
137
|
let fieldValue = fieldState.value;
|
|
92
138
|
// When allowEmpty is false, 'is equivalent to undefined, and the key of the field does not need to be reflected on values
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
.semi-hotKeys-content {
|
|
16
16
|
font-size: 12px;
|
|
17
17
|
line-height: 16px;
|
|
18
|
-
font-family: "Inter", -apple-system, BlinkMacSystemFont, "
|
|
18
|
+
font-family: "Inter", -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif;
|
|
19
19
|
border-radius: 2px;
|
|
20
20
|
height: 20px;
|
|
21
21
|
padding: 2px 8px;
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
.semi-hotKeys-split {
|
|
27
27
|
font-size: 12px;
|
|
28
28
|
line-height: 16px;
|
|
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
|
margin: 0 3px;
|
|
31
31
|
color: var(--semi-color-text-0);
|
|
32
32
|
}
|
package/lib/cjs/image/image.css
CHANGED
|
@@ -96,7 +96,7 @@
|
|
|
96
96
|
font-weight: normal;
|
|
97
97
|
font-size: 14px;
|
|
98
98
|
line-height: 20px;
|
|
99
|
-
font-family: "Inter", -apple-system, BlinkMacSystemFont, "
|
|
99
|
+
font-family: "Inter", -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif;
|
|
100
100
|
color: var(--semi-color-white);
|
|
101
101
|
height: 60px;
|
|
102
102
|
display: flex;
|
|
@@ -143,7 +143,7 @@
|
|
|
143
143
|
color: var(--semi-color-white);
|
|
144
144
|
font-size: 16px;
|
|
145
145
|
line-height: 22px;
|
|
146
|
-
font-family: "Inter", -apple-system, BlinkMacSystemFont, "
|
|
146
|
+
font-family: "Inter", -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif;
|
|
147
147
|
margin: 0 12px;
|
|
148
148
|
}
|
|
149
149
|
.semi-image-preview-footer .semi-icon {
|
package/lib/cjs/input/input.css
CHANGED
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
box-shadow: none;
|
|
30
30
|
font-size: 14px;
|
|
31
31
|
line-height: 20px;
|
|
32
|
-
font-family: "Inter", -apple-system, BlinkMacSystemFont, "
|
|
32
|
+
font-family: "Inter", -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif;
|
|
33
33
|
background-color: var(--semi-color-fill-0);
|
|
34
34
|
border: 1px transparent solid;
|
|
35
35
|
border-radius: var(--semi-border-radius-small);
|
|
@@ -45,21 +45,21 @@
|
|
|
45
45
|
height: 32px;
|
|
46
46
|
font-size: 14px;
|
|
47
47
|
line-height: 20px;
|
|
48
|
-
font-family: "Inter", -apple-system, BlinkMacSystemFont, "
|
|
48
|
+
font-family: "Inter", -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif;
|
|
49
49
|
line-height: 30px;
|
|
50
50
|
}
|
|
51
51
|
.semi-input-wrapper-small {
|
|
52
52
|
height: 24px;
|
|
53
53
|
font-size: 14px;
|
|
54
54
|
line-height: 20px;
|
|
55
|
-
font-family: "Inter", -apple-system, BlinkMacSystemFont, "
|
|
55
|
+
font-family: "Inter", -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif;
|
|
56
56
|
line-height: 22px;
|
|
57
57
|
}
|
|
58
58
|
.semi-input-wrapper-large {
|
|
59
59
|
height: 40px;
|
|
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
|
line-height: 38px;
|
|
64
64
|
}
|
|
65
65
|
.semi-input-wrapper:hover {
|
|
@@ -357,21 +357,21 @@
|
|
|
357
357
|
height: 38px;
|
|
358
358
|
font-size: 16px;
|
|
359
359
|
line-height: 22px;
|
|
360
|
-
font-family: "Inter", -apple-system, BlinkMacSystemFont, "
|
|
360
|
+
font-family: "Inter", -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif;
|
|
361
361
|
line-height: 38px;
|
|
362
362
|
}
|
|
363
363
|
.semi-input-small {
|
|
364
364
|
height: 22px;
|
|
365
365
|
font-size: 14px;
|
|
366
366
|
line-height: 20px;
|
|
367
|
-
font-family: "Inter", -apple-system, BlinkMacSystemFont, "
|
|
367
|
+
font-family: "Inter", -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif;
|
|
368
368
|
line-height: 22px;
|
|
369
369
|
}
|
|
370
370
|
.semi-input-default {
|
|
371
371
|
height: 30px;
|
|
372
372
|
font-size: 14px;
|
|
373
373
|
line-height: 20px;
|
|
374
|
-
font-family: "Inter", -apple-system, BlinkMacSystemFont, "
|
|
374
|
+
font-family: "Inter", -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif;
|
|
375
375
|
line-height: 30px;
|
|
376
376
|
}
|
|
377
377
|
.semi-input-disabled {
|
|
@@ -429,7 +429,7 @@
|
|
|
429
429
|
color: var(--semi-color-text-2);
|
|
430
430
|
font-size: 14px;
|
|
431
431
|
line-height: 20px;
|
|
432
|
-
font-family: "Inter", -apple-system, BlinkMacSystemFont, "
|
|
432
|
+
font-family: "Inter", -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif;
|
|
433
433
|
flex-shrink: 0;
|
|
434
434
|
}
|
|
435
435
|
.semi-input-prepend-icon, .semi-input-prepend-text, .semi-input-append-icon, .semi-input-append-text {
|
|
@@ -107,7 +107,7 @@
|
|
|
107
107
|
box-shadow: none;
|
|
108
108
|
font-size: 14px;
|
|
109
109
|
line-height: 20px;
|
|
110
|
-
font-family: "Inter", -apple-system, BlinkMacSystemFont, "
|
|
110
|
+
font-family: "Inter", -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif;
|
|
111
111
|
background-color: transparent;
|
|
112
112
|
border: 0 solid transparent;
|
|
113
113
|
vertical-align: bottom;
|
|
@@ -147,7 +147,7 @@
|
|
|
147
147
|
.semi-input-textarea-counter {
|
|
148
148
|
font-size: 12px;
|
|
149
149
|
line-height: 16px;
|
|
150
|
-
font-family: "Inter", -apple-system, BlinkMacSystemFont, "
|
|
150
|
+
font-family: "Inter", -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif;
|
|
151
151
|
display: flex;
|
|
152
152
|
flex-direction: column;
|
|
153
153
|
justify-content: center;
|
|
@@ -80,6 +80,21 @@ declare class InputNumberFoundation extends BaseFoundation<InputNumberAdapter> {
|
|
|
80
80
|
_getPrecLen(num: string | number): number;
|
|
81
81
|
_adjustPrec(num: string | number): string;
|
|
82
82
|
formatCurrency(value: number | string): string;
|
|
83
|
+
/**
|
|
84
|
+
* Check if scientific notation is enabled
|
|
85
|
+
*/
|
|
86
|
+
_isScientificNotation(): boolean;
|
|
87
|
+
/**
|
|
88
|
+
* Get scientific notation threshold
|
|
89
|
+
* @returns {number} threshold for digit count
|
|
90
|
+
*/
|
|
91
|
+
_getScientificNotationThreshold(): number;
|
|
92
|
+
/**
|
|
93
|
+
* Convert number to scientific notation if exceeds threshold
|
|
94
|
+
* @param {number} num
|
|
95
|
+
* @returns {string}
|
|
96
|
+
*/
|
|
97
|
+
_toScientificNotation(num: number): string;
|
|
83
98
|
/**
|
|
84
99
|
* format number to string
|
|
85
100
|
* @param {string|number} value
|
|
@@ -132,8 +132,18 @@ class InputNumberFoundation extends _foundation.default {
|
|
|
132
132
|
handleInputFocus(e) {
|
|
133
133
|
const value = this.getState('value');
|
|
134
134
|
if (value !== '') {
|
|
135
|
-
//
|
|
136
|
-
|
|
135
|
+
// When scientific notation is enabled, convert to full number on focus
|
|
136
|
+
if (this._isScientificNotation() && !this._isCurrency()) {
|
|
137
|
+
const strVal = (0, _toString2.default)(value);
|
|
138
|
+
const isScientificStr = /e/i.test(strVal) && /^[+-]?(?:\d+(?:\.\d*)?|\.\d+)[eE][+-]?\d+$/.test(strVal.trim());
|
|
139
|
+
if (isScientificStr) {
|
|
140
|
+
const parsedNum = this.doParse(strVal, false, false, false);
|
|
141
|
+
if (this.isValidNumber(parsedNum)) {
|
|
142
|
+
const fullNumberStr = this.doFormat(parsedNum, true, false);
|
|
143
|
+
this._adapter.setValue(fullNumberStr);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
}
|
|
137
147
|
}
|
|
138
148
|
this._adapter.recordCursorPosition();
|
|
139
149
|
this._adapter.setFocusing(true, null);
|
|
@@ -236,6 +246,35 @@ class InputNumberFoundation extends _foundation.default {
|
|
|
236
246
|
}
|
|
237
247
|
numHasChanged = true;
|
|
238
248
|
}
|
|
249
|
+
// Fix issue #38: When input contains non-numeric characters (e.g., "1000CNY"),
|
|
250
|
+
// doParse returns NaN, but we should still apply max/min limit if a number
|
|
251
|
+
// can be extracted from the input or if currentNumber is out of range.
|
|
252
|
+
if (!this.isValidNumber(parsedNum)) {
|
|
253
|
+
// Try to extract a number from the input using parseFloat
|
|
254
|
+
// (parseFloat can extract numbers from strings like "1000CNY" -> 1000)
|
|
255
|
+
const extractedNum = parseFloat(currentValue);
|
|
256
|
+
if (!isNaN(extractedNum)) {
|
|
257
|
+
const limitedNum = this.fetchMinOrMax(extractedNum);
|
|
258
|
+
if (limitedNum !== currentNumber) {
|
|
259
|
+
willSetNum = limitedNum;
|
|
260
|
+
if (!this.isControlled()) {
|
|
261
|
+
currentNumber = willSetNum;
|
|
262
|
+
}
|
|
263
|
+
numHasChanged = true;
|
|
264
|
+
}
|
|
265
|
+
} else if (typeof currentNumber === 'number' && !isNaN(currentNumber)) {
|
|
266
|
+
// If we can't extract a number but currentNumber exists and is out of range,
|
|
267
|
+
// apply the max/min limit to currentNumber
|
|
268
|
+
const limitedNum = this.fetchMinOrMax(currentNumber);
|
|
269
|
+
if (limitedNum !== currentNumber) {
|
|
270
|
+
willSetNum = limitedNum;
|
|
271
|
+
if (!this.isControlled()) {
|
|
272
|
+
currentNumber = willSetNum;
|
|
273
|
+
}
|
|
274
|
+
numHasChanged = true;
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
}
|
|
239
278
|
const currentFormattedNum = this.doFormat(currentNumber, true, true);
|
|
240
279
|
if (currentFormattedNum !== currentValue) {
|
|
241
280
|
willSetVal = currentFormattedNum;
|
|
@@ -407,7 +446,11 @@ class InputNumberFoundation extends _foundation.default {
|
|
|
407
446
|
curNum = max;
|
|
408
447
|
}
|
|
409
448
|
// console.log('scale: ', scale, 'curNum: ', curNum);
|
|
410
|
-
|
|
449
|
+
// NOTE:
|
|
450
|
+
// In non-currency mode, `needAdjustCurrency=true` is used by blur/init formatting paths.
|
|
451
|
+
// Step operations often happen while focused, and should keep full-number display.
|
|
452
|
+
// Currency mode still needs `needAdjustCurrency=true` to format currency strings.
|
|
453
|
+
return this.doFormat(curNum, true, this._isCurrency());
|
|
411
454
|
}
|
|
412
455
|
minus(step, event) {
|
|
413
456
|
const pressShift = event && event.shiftKey;
|
|
@@ -457,6 +500,52 @@ class InputNumberFoundation extends _foundation.default {
|
|
|
457
500
|
const formatted = formatter.format(Number(formattedValue));
|
|
458
501
|
return showCurrencySymbol ? formatted : formatted.replace(this._currencySymbol, '').trim();
|
|
459
502
|
}
|
|
503
|
+
/**
|
|
504
|
+
* Check if scientific notation is enabled
|
|
505
|
+
*/
|
|
506
|
+
_isScientificNotation() {
|
|
507
|
+
const {
|
|
508
|
+
scientificNotation
|
|
509
|
+
} = this.getProps();
|
|
510
|
+
return scientificNotation === true || typeof scientificNotation === 'object' && scientificNotation !== null;
|
|
511
|
+
}
|
|
512
|
+
/**
|
|
513
|
+
* Get scientific notation threshold
|
|
514
|
+
* @returns {number} threshold for digit count
|
|
515
|
+
*/
|
|
516
|
+
_getScientificNotationThreshold() {
|
|
517
|
+
const {
|
|
518
|
+
scientificNotation
|
|
519
|
+
} = this.getProps();
|
|
520
|
+
if (typeof scientificNotation === 'object' && scientificNotation !== null) {
|
|
521
|
+
const t = scientificNotation.threshold;
|
|
522
|
+
return typeof t === 'number' && Number.isFinite(t) && t >= 1 ? t : 15;
|
|
523
|
+
}
|
|
524
|
+
return 15; // Default threshold: 15 digits
|
|
525
|
+
}
|
|
526
|
+
/**
|
|
527
|
+
* Convert number to scientific notation if exceeds threshold
|
|
528
|
+
* @param {number} num
|
|
529
|
+
* @returns {string}
|
|
530
|
+
*/
|
|
531
|
+
_toScientificNotation(num) {
|
|
532
|
+
const threshold = this._getScientificNotationThreshold();
|
|
533
|
+
const absNum = Math.abs(num);
|
|
534
|
+
const numStr = String(absNum);
|
|
535
|
+
// Count significant digits (excluding decimal point, sign, exponent symbol and leading zeros)
|
|
536
|
+
// If JS already stringifies it with exponent (contains e/E), it is eligible for scientific notation display.
|
|
537
|
+
const hasExp = /e/i.test(numStr);
|
|
538
|
+
const significantDigits = numStr.replace(/[.\-+eE]/g, '').replace(/^0+/, '');
|
|
539
|
+
// Check if number exceeds threshold
|
|
540
|
+
if ((hasExp || significantDigits.length >= threshold) && absNum !== 0) {
|
|
541
|
+
// Prefer preserving coefficient digits up to threshold (total significant digits = fractionDigits + 1)
|
|
542
|
+
const fractionDigits = Math.max(0, Math.min(100, Math.floor(threshold) - 1));
|
|
543
|
+
const exp = num.toExponential(fractionDigits);
|
|
544
|
+
// Remove trailing zeros in the coefficient
|
|
545
|
+
return exp.replace(/(\.\d*?)0+e/, '$1e').replace(/\.e/, 'e');
|
|
546
|
+
}
|
|
547
|
+
return String(num);
|
|
548
|
+
}
|
|
460
549
|
/**
|
|
461
550
|
* format number to string
|
|
462
551
|
* @param {string|number} value
|
|
@@ -482,6 +571,14 @@ class InputNumberFoundation extends _foundation.default {
|
|
|
482
571
|
} else {
|
|
483
572
|
str = (0, _toString2.default)(value);
|
|
484
573
|
}
|
|
574
|
+
// Apply scientific notation for long numbers in blur state
|
|
575
|
+
// needAdjustCurrency indicates blur state (when true, we're formatting for display after blur)
|
|
576
|
+
if (this._isScientificNotation() && needAdjustCurrency && !this._isCurrency()) {
|
|
577
|
+
const numValue = typeof value === 'number' ? value : parseFloat(str);
|
|
578
|
+
if (!isNaN(numValue) && isFinite(numValue)) {
|
|
579
|
+
str = this._toScientificNotation(numValue);
|
|
580
|
+
}
|
|
581
|
+
}
|
|
485
582
|
if (typeof formatter === 'function') {
|
|
486
583
|
str = formatter(str);
|
|
487
584
|
}
|
|
@@ -545,6 +642,19 @@ class InputNumberFoundation extends _foundation.default {
|
|
|
545
642
|
const parsedValue = parser(value);
|
|
546
643
|
value = typeof parsedValue === 'number' ? (0, _toString2.default)(parsedValue) : parsedValue;
|
|
547
644
|
}
|
|
645
|
+
// Support scientific notation parsing (e.g., "1.23e+15", "1.23E-10", ".5e3", "1.e3")
|
|
646
|
+
if (typeof value === 'string' && /^[+-]?(?:\d+(?:\.\d*)?|\.\d+)[eE][+-]?\d+$/.test(value.trim())) {
|
|
647
|
+
const scientificNum = parseFloat(value.trim());
|
|
648
|
+
if (!isNaN(scientificNum)) {
|
|
649
|
+
if (needAdjustMaxMin) {
|
|
650
|
+
return this.fetchMinOrMax(scientificNum);
|
|
651
|
+
}
|
|
652
|
+
if (needAdjustPrec) {
|
|
653
|
+
return (0, _toNumber2.default)(this._adjustPrec(scientificNum));
|
|
654
|
+
}
|
|
655
|
+
return scientificNum;
|
|
656
|
+
}
|
|
657
|
+
}
|
|
548
658
|
if (needCheckPrec && typeof value === 'string') {
|
|
549
659
|
const zeroIsValid = value.indexOf('.') === -1 || value.indexOf('.') > -1 && (value === '0' || value.lastIndexOf('0') < value.length - 1);
|
|
550
660
|
const dotIsValid = value.lastIndexOf('.') < value.length - 1 && value.split('').filter(v => v === '.').length < 2;
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
color: rgba(var(--semi-blue-7), 1);
|
|
54
54
|
}
|
|
55
55
|
.semi-json-viewer-view-line {
|
|
56
|
-
font-family:
|
|
56
|
+
font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Monaco, "Fira Code", Consolas, "Liberation Mono", "DejaVu Sans Mono", "Courier New", monospace;
|
|
57
57
|
font-weight: normal;
|
|
58
58
|
font-size: 12px;
|
|
59
59
|
font-feature-settings: "liga" 0, "calt" 0;
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
white-space: pre-wrap !important;
|
|
65
65
|
}
|
|
66
66
|
.semi-json-viewer-line-number {
|
|
67
|
-
font-family:
|
|
67
|
+
font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Monaco, "Fira Code", Consolas, "Liberation Mono", "DejaVu Sans Mono", "Courier New", monospace;
|
|
68
68
|
font-weight: normal;
|
|
69
69
|
font-size: 12px;
|
|
70
70
|
font-feature-settings: "liga" 0, "calt" 0;
|
|
@@ -64,7 +64,7 @@ $module: #{$prefix}-json-viewer;
|
|
|
64
64
|
}
|
|
65
65
|
|
|
66
66
|
&-view-line {
|
|
67
|
-
font-family:
|
|
67
|
+
font-family: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Monaco, 'Fira Code', Consolas, 'Liberation Mono', 'DejaVu Sans Mono', 'Courier New', monospace;
|
|
68
68
|
font-weight: normal;
|
|
69
69
|
font-size: 12px;
|
|
70
70
|
font-feature-settings: 'liga' 0, 'calt' 0;
|
|
@@ -76,7 +76,7 @@ $module: #{$prefix}-json-viewer;
|
|
|
76
76
|
}
|
|
77
77
|
|
|
78
78
|
&-line-number {
|
|
79
|
-
font-family:
|
|
79
|
+
font-family: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Monaco, 'Fira Code', Consolas, 'Liberation Mono', 'DejaVu Sans Mono', 'Courier New', monospace;
|
|
80
80
|
font-weight: normal;
|
|
81
81
|
font-size: 12px;
|
|
82
82
|
font-feature-settings: 'liga' 0, 'calt' 0;
|