@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.
Files changed (235) hide show
  1. package/cascader/foundation.ts +74 -19
  2. package/codeHighlight/codeHighlight.scss +1 -1
  3. package/datePicker/datePicker.scss +100 -5
  4. package/datePicker/foundation.ts +7 -0
  5. package/datePicker/inputFoundation.ts +5 -0
  6. package/form/foundation.ts +55 -7
  7. package/form/utils.ts +7 -2
  8. package/image/previewImageFoundation.ts +34 -3
  9. package/image/previewInnerFoundation.ts +15 -4
  10. package/input/textarea.scss +35 -0
  11. package/inputNumber/foundation.ts +119 -3
  12. package/jsonViewer/jsonViewer.scss +2 -2
  13. package/lib/cjs/aiChatInput/aiChatInput.css +7 -7
  14. package/lib/cjs/anchor/anchor.css +3 -3
  15. package/lib/cjs/autoComplete/autoComplete.css +1 -1
  16. package/lib/cjs/avatar/avatar.css +5 -5
  17. package/lib/cjs/badge/badge.css +1 -1
  18. package/lib/cjs/breadcrumb/breadcrumb.css +2 -2
  19. package/lib/cjs/calendar/calendar.css +9 -9
  20. package/lib/cjs/cascader/cascader.css +6 -6
  21. package/lib/cjs/cascader/foundation.d.ts +12 -0
  22. package/lib/cjs/cascader/foundation.js +68 -23
  23. package/lib/cjs/checkbox/checkbox.css +2 -2
  24. package/lib/cjs/codeHighlight/codeHighlight.css +1 -1
  25. package/lib/cjs/codeHighlight/codeHighlight.scss +1 -1
  26. package/lib/cjs/collapse/collapse.css +2 -2
  27. package/lib/cjs/datePicker/datePicker.css +75 -13
  28. package/lib/cjs/datePicker/datePicker.scss +100 -5
  29. package/lib/cjs/datePicker/foundation.d.ts +5 -0
  30. package/lib/cjs/datePicker/foundation.js +2 -0
  31. package/lib/cjs/datePicker/inputFoundation.d.ts +5 -0
  32. package/lib/cjs/descriptions/descriptions.css +6 -6
  33. package/lib/cjs/dropdown/dropdown.css +2 -2
  34. package/lib/cjs/form/form.css +4 -4
  35. package/lib/cjs/form/foundation.d.ts +1 -1
  36. package/lib/cjs/form/foundation.js +55 -9
  37. package/lib/cjs/form/utils.js +5 -2
  38. package/lib/cjs/hotKeys/hotKeys.css +2 -2
  39. package/lib/cjs/image/image.css +2 -2
  40. package/lib/cjs/image/previewImageFoundation.d.ts +4 -0
  41. package/lib/cjs/image/previewImageFoundation.js +33 -2
  42. package/lib/cjs/image/previewInnerFoundation.d.ts +1 -0
  43. package/lib/cjs/image/previewInnerFoundation.js +17 -4
  44. package/lib/cjs/input/input.css +8 -8
  45. package/lib/cjs/input/textarea.css +19 -2
  46. package/lib/cjs/input/textarea.scss +35 -0
  47. package/lib/cjs/inputNumber/foundation.d.ts +15 -0
  48. package/lib/cjs/inputNumber/foundation.js +113 -3
  49. package/lib/cjs/jsonViewer/jsonViewer.css +2 -2
  50. package/lib/cjs/jsonViewer/jsonViewer.scss +2 -2
  51. package/lib/cjs/list/list.css +1 -1
  52. package/lib/cjs/modal/modal.css +1 -1
  53. package/lib/cjs/navigation/navigation.css +4 -3
  54. package/lib/cjs/navigation/navigation.scss +1 -0
  55. package/lib/cjs/navigation/variables.scss +1 -1
  56. package/lib/cjs/notification/notification.css +4 -4
  57. package/lib/cjs/overflowList/foundation.d.ts +1 -0
  58. package/lib/cjs/overflowList/foundation.js +51 -1
  59. package/lib/cjs/pagination/pagination.css +5 -5
  60. package/lib/cjs/popconfirm/popconfirm.css +1 -1
  61. package/lib/cjs/popover/popover.css +1 -1
  62. package/lib/cjs/radio/radio.css +2 -2
  63. package/lib/cjs/scrollList/itemFoundation.js +12 -0
  64. package/lib/cjs/scrollList/scrollList.css +2 -2
  65. package/lib/cjs/select/foundation.d.ts +1 -1
  66. package/lib/cjs/select/foundation.js +28 -2
  67. package/lib/cjs/select/select.css +6 -6
  68. package/lib/cjs/sideSheet/sideSheet.css +2 -2
  69. package/lib/cjs/sidebar/sidebar.css +11 -11
  70. package/lib/cjs/slider/foundation.js +46 -12
  71. package/lib/cjs/slider/rtl.scss +62 -0
  72. package/lib/cjs/slider/slider.css +45 -0
  73. package/lib/cjs/slider/slider.scss +2 -0
  74. package/lib/cjs/steps/steps.css +11 -11
  75. package/lib/cjs/switch/switch.css +1 -0
  76. package/lib/cjs/switch/switch.scss +1 -0
  77. package/lib/cjs/switch/variables.scss +2 -1
  78. package/lib/cjs/table/foundation.d.ts +36 -0
  79. package/lib/cjs/table/foundation.js +164 -29
  80. package/lib/cjs/table/table.css +10 -2
  81. package/lib/cjs/table/table.scss +17 -0
  82. package/lib/cjs/tabs/tabs.css +2 -2
  83. package/lib/cjs/tag/tag.css +28 -2
  84. package/lib/cjs/tag/tag.scss +33 -0
  85. package/lib/cjs/tagInput/tagInput.css +19 -2
  86. package/lib/cjs/tagInput/tagInput.scss +18 -0
  87. package/lib/cjs/timePicker/constants.d.ts +1 -0
  88. package/lib/cjs/timePicker/foundation.d.ts +7 -1
  89. package/lib/cjs/timePicker/foundation.js +62 -11
  90. package/lib/cjs/timePicker/timePicker.css +1 -1
  91. package/lib/cjs/timeline/timeline.css +2 -2
  92. package/lib/cjs/toast/toast.css +1 -1
  93. package/lib/cjs/tooltip/foundation.js +8 -5
  94. package/lib/cjs/tooltip/tooltip.css +1 -1
  95. package/lib/cjs/transfer/constants.d.ts +3 -1
  96. package/lib/cjs/transfer/constants.js +3 -1
  97. package/lib/cjs/transfer/foundation.d.ts +3 -0
  98. package/lib/cjs/transfer/foundation.js +4 -0
  99. package/lib/cjs/transfer/transfer.css +14 -5
  100. package/lib/cjs/transfer/transfer.scss +10 -0
  101. package/lib/cjs/tree/foundation.d.ts +3 -0
  102. package/lib/cjs/tree/foundation.js +31 -4
  103. package/lib/cjs/tree/tree.css +1 -1
  104. package/lib/cjs/treeSelect/foundation.d.ts +1 -0
  105. package/lib/cjs/treeSelect/foundation.js +8 -1
  106. package/lib/cjs/treeSelect/treeSelect.css +36 -4
  107. package/lib/cjs/treeSelect/treeSelect.scss +49 -1
  108. package/lib/cjs/typography/typography.css +8 -8
  109. package/lib/cjs/upload/upload.css +8 -8
  110. package/lib/cjs/utils/Store.d.ts +1 -1
  111. package/lib/cjs/utils/Store.js +1 -0
  112. package/lib/es/aiChatInput/aiChatInput.css +7 -7
  113. package/lib/es/anchor/anchor.css +3 -3
  114. package/lib/es/autoComplete/autoComplete.css +1 -1
  115. package/lib/es/avatar/avatar.css +5 -5
  116. package/lib/es/badge/badge.css +1 -1
  117. package/lib/es/breadcrumb/breadcrumb.css +2 -2
  118. package/lib/es/calendar/calendar.css +9 -9
  119. package/lib/es/cascader/cascader.css +6 -6
  120. package/lib/es/cascader/foundation.d.ts +12 -0
  121. package/lib/es/cascader/foundation.js +68 -23
  122. package/lib/es/checkbox/checkbox.css +2 -2
  123. package/lib/es/codeHighlight/codeHighlight.css +1 -1
  124. package/lib/es/codeHighlight/codeHighlight.scss +1 -1
  125. package/lib/es/collapse/collapse.css +2 -2
  126. package/lib/es/datePicker/datePicker.css +75 -13
  127. package/lib/es/datePicker/datePicker.scss +100 -5
  128. package/lib/es/datePicker/foundation.d.ts +5 -0
  129. package/lib/es/datePicker/foundation.js +2 -0
  130. package/lib/es/datePicker/inputFoundation.d.ts +5 -0
  131. package/lib/es/descriptions/descriptions.css +6 -6
  132. package/lib/es/dropdown/dropdown.css +2 -2
  133. package/lib/es/form/form.css +4 -4
  134. package/lib/es/form/foundation.d.ts +1 -1
  135. package/lib/es/form/foundation.js +55 -9
  136. package/lib/es/form/utils.js +5 -2
  137. package/lib/es/hotKeys/hotKeys.css +2 -2
  138. package/lib/es/image/image.css +2 -2
  139. package/lib/es/image/previewImageFoundation.d.ts +4 -0
  140. package/lib/es/image/previewImageFoundation.js +33 -2
  141. package/lib/es/image/previewInnerFoundation.d.ts +1 -0
  142. package/lib/es/image/previewInnerFoundation.js +17 -4
  143. package/lib/es/input/input.css +8 -8
  144. package/lib/es/input/textarea.css +19 -2
  145. package/lib/es/input/textarea.scss +35 -0
  146. package/lib/es/inputNumber/foundation.d.ts +15 -0
  147. package/lib/es/inputNumber/foundation.js +113 -3
  148. package/lib/es/jsonViewer/jsonViewer.css +2 -2
  149. package/lib/es/jsonViewer/jsonViewer.scss +2 -2
  150. package/lib/es/list/list.css +1 -1
  151. package/lib/es/modal/modal.css +1 -1
  152. package/lib/es/navigation/navigation.css +4 -3
  153. package/lib/es/navigation/navigation.scss +1 -0
  154. package/lib/es/navigation/variables.scss +1 -1
  155. package/lib/es/notification/notification.css +4 -4
  156. package/lib/es/overflowList/foundation.d.ts +1 -0
  157. package/lib/es/overflowList/foundation.js +51 -1
  158. package/lib/es/pagination/pagination.css +5 -5
  159. package/lib/es/popconfirm/popconfirm.css +1 -1
  160. package/lib/es/popover/popover.css +1 -1
  161. package/lib/es/radio/radio.css +2 -2
  162. package/lib/es/scrollList/itemFoundation.js +12 -0
  163. package/lib/es/scrollList/scrollList.css +2 -2
  164. package/lib/es/select/foundation.d.ts +1 -1
  165. package/lib/es/select/foundation.js +28 -2
  166. package/lib/es/select/select.css +6 -6
  167. package/lib/es/sideSheet/sideSheet.css +2 -2
  168. package/lib/es/sidebar/sidebar.css +11 -11
  169. package/lib/es/slider/foundation.js +46 -12
  170. package/lib/es/slider/rtl.scss +62 -0
  171. package/lib/es/slider/slider.css +45 -0
  172. package/lib/es/slider/slider.scss +2 -0
  173. package/lib/es/steps/steps.css +11 -11
  174. package/lib/es/switch/switch.css +1 -0
  175. package/lib/es/switch/switch.scss +1 -0
  176. package/lib/es/switch/variables.scss +2 -1
  177. package/lib/es/table/foundation.d.ts +36 -0
  178. package/lib/es/table/foundation.js +164 -29
  179. package/lib/es/table/table.css +10 -2
  180. package/lib/es/table/table.scss +17 -0
  181. package/lib/es/tabs/tabs.css +2 -2
  182. package/lib/es/tag/tag.css +28 -2
  183. package/lib/es/tag/tag.scss +33 -0
  184. package/lib/es/tagInput/tagInput.css +19 -2
  185. package/lib/es/tagInput/tagInput.scss +18 -0
  186. package/lib/es/timePicker/constants.d.ts +1 -0
  187. package/lib/es/timePicker/foundation.d.ts +7 -1
  188. package/lib/es/timePicker/foundation.js +62 -11
  189. package/lib/es/timePicker/timePicker.css +1 -1
  190. package/lib/es/timeline/timeline.css +2 -2
  191. package/lib/es/toast/toast.css +1 -1
  192. package/lib/es/tooltip/foundation.js +8 -5
  193. package/lib/es/tooltip/tooltip.css +1 -1
  194. package/lib/es/transfer/constants.d.ts +3 -1
  195. package/lib/es/transfer/constants.js +3 -1
  196. package/lib/es/transfer/foundation.d.ts +3 -0
  197. package/lib/es/transfer/foundation.js +4 -0
  198. package/lib/es/transfer/transfer.css +14 -5
  199. package/lib/es/transfer/transfer.scss +10 -0
  200. package/lib/es/tree/foundation.d.ts +3 -0
  201. package/lib/es/tree/foundation.js +31 -4
  202. package/lib/es/tree/tree.css +1 -1
  203. package/lib/es/treeSelect/foundation.d.ts +1 -0
  204. package/lib/es/treeSelect/foundation.js +8 -1
  205. package/lib/es/treeSelect/treeSelect.css +36 -4
  206. package/lib/es/treeSelect/treeSelect.scss +49 -1
  207. package/lib/es/typography/typography.css +8 -8
  208. package/lib/es/upload/upload.css +8 -8
  209. package/lib/es/utils/Store.d.ts +1 -1
  210. package/lib/es/utils/Store.js +1 -0
  211. package/navigation/navigation.scss +1 -0
  212. package/navigation/variables.scss +1 -1
  213. package/overflowList/foundation.ts +48 -2
  214. package/package.json +19 -4
  215. package/scrollList/itemFoundation.ts +12 -0
  216. package/select/foundation.ts +27 -2
  217. package/slider/foundation.ts +55 -15
  218. package/slider/rtl.scss +62 -0
  219. package/slider/slider.scss +2 -0
  220. package/switch/switch.scss +1 -0
  221. package/switch/variables.scss +2 -1
  222. package/table/foundation.ts +199 -30
  223. package/table/table.scss +17 -0
  224. package/tag/tag.scss +33 -0
  225. package/tagInput/tagInput.scss +18 -0
  226. package/timePicker/constants.ts +2 -0
  227. package/timePicker/foundation.ts +62 -10
  228. package/tooltip/foundation.ts +8 -5
  229. package/transfer/constants.ts +3 -1
  230. package/transfer/foundation.ts +8 -1
  231. package/transfer/transfer.scss +10 -0
  232. package/tree/foundation.ts +34 -5
  233. package/treeSelect/foundation.ts +10 -1
  234. package/treeSelect/treeSelect.scss +49 -1
  235. package/utils/Store.ts +2 -1
@@ -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, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif;
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, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif;
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 {
@@ -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, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif;
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, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif;
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, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif;
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, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif;
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;
@@ -23,7 +23,7 @@ export default class FormFoundation extends BaseFoundation<BaseFormAdapter> {
23
23
  updateArrayField(arrayField: string, updateValue: any): void;
24
24
  validate(fieldPaths?: Array<string> | ValidateOptions): Promise<unknown>;
25
25
  _formValidate(silent?: boolean): Promise<unknown>;
26
- _fieldsValidate(fieldPaths: Array<string>, silent?: boolean): Promise<unknown>;
26
+ _fieldsValidate(fieldPaths?: Array<string>, silent?: boolean): Promise<unknown>;
27
27
  submit(e?: any): void;
28
28
  /**
29
29
  * Case A:
@@ -70,14 +70,60 @@ export default class FormFoundation extends BaseFoundation {
70
70
  const registered = this.registered[field];
71
71
  this.registered[field] = true;
72
72
  this.fields.set(field, fieldStuff);
73
- if (fieldStuff.keepState) {
74
- // TODO support keepState
73
+ if (fieldStuff.keepState && registered) {
74
+ // When keepState is true and the field was previously registered (remounting),
75
+ // restore the saved state from formState instead of using the initial value
76
+ const hasSavedValue = ObjectUtil.has(this.data.values, field);
77
+ const savedValue = ObjectUtil.get(this.data.values, field);
78
+ const hasSavedError = ObjectUtil.has(this.data.errors, field);
79
+ const savedError = ObjectUtil.get(this.data.errors, field);
80
+ const hasSavedTouched = ObjectUtil.has(this.data.touched, field);
81
+ const savedTouched = ObjectUtil.get(this.data.touched, field);
82
+ const allowEmpty = fieldStuff.allowEmpty || false;
83
+ const opts = {
84
+ notNotify: true,
85
+ notUpdate: false,
86
+ // updateStateValue reads `fieldAllowEmpty` (field-level override)
87
+ fieldAllowEmpty: allowEmpty
88
+ };
89
+ // Restore value from formState if it exists
90
+ if (hasSavedValue) {
91
+ // Keep formState as source of truth; still trigger a forceUpdate so that
92
+ // consumers of formState can get the latest snapshot when field remounts.
93
+ this.updateStateValue(field, savedValue, opts);
94
+ // Sync the restored value back to the field component's local state.
95
+ // Avoid a second forceUpdate/notify from FieldApi.
96
+ fieldStuff.fieldApi.setValue(savedValue, Object.assign(Object.assign({}, opts), {
97
+ notUpdate: true
98
+ }));
99
+ } else {
100
+ // No saved value, use initial value
101
+ let fieldValue = fieldState.value;
102
+ if (!allowEmpty && fieldValue === '') {
103
+ fieldValue = undefined;
104
+ }
105
+ this.updateStateValue(field, fieldValue, opts);
106
+ }
107
+ // Restore error from formState if it exists
108
+ if (hasSavedError) {
109
+ this.updateStateError(field, savedError, opts);
110
+ fieldStuff.fieldApi.setError(savedError, Object.assign(Object.assign({}, opts), {
111
+ notUpdate: true
112
+ }));
113
+ }
114
+ // Restore touched from formState if it exists
115
+ if (hasSavedTouched) {
116
+ this.updateStateTouched(field, savedTouched, opts);
117
+ fieldStuff.fieldApi.setTouched(savedTouched, Object.assign(Object.assign({}, opts), {
118
+ notUpdate: true
119
+ }));
120
+ }
75
121
  } else {
76
122
  const allowEmpty = fieldStuff.allowEmpty || false;
77
123
  const opts = {
78
124
  notNotify: true,
79
125
  notUpdate: false,
80
- allowEmpty
126
+ fieldAllowEmpty: allowEmpty
81
127
  };
82
128
  let fieldValue = fieldState.value;
83
129
  // When allowEmpty is false, 'is equivalent to undefined, and the key of the field does not need to be reflected on values
@@ -126,9 +172,9 @@ export default class FormFoundation extends BaseFoundation {
126
172
  this.registeredArrayField.set(arrayField, mergeVal);
127
173
  }
128
174
  validate(fieldPaths) {
129
- const {
130
- validateFields
131
- } = this.getProps();
175
+ const props = this.getProps();
176
+ // `validator` is the recommended name; `validateFields` is kept as a deprecated alias.
177
+ const validateFields = props.validator || props.validateFields;
132
178
  // Parse options
133
179
  let fields;
134
180
  let silent = false;
@@ -153,9 +199,9 @@ export default class FormFoundation extends BaseFoundation {
153
199
  const {
154
200
  values
155
201
  } = this.data;
156
- const {
157
- validateFields
158
- } = this.getProps();
202
+ const props = this.getProps();
203
+ // `validator` is the recommended name; `validateFields` is kept as a deprecated alias.
204
+ const validateFields = props.validator || props.validateFields;
159
205
  return new Promise((resolve, reject) => {
160
206
  let maybePromisedErrors;
161
207
  try {
@@ -128,6 +128,7 @@ export function mergeProps(props) {
128
128
  wrapperCol,
129
129
  initValue,
130
130
  validate,
131
+ validator,
131
132
  /**
132
133
  * error、warning、default、success
133
134
  */
@@ -159,7 +160,7 @@ export function mergeProps(props) {
159
160
  pure,
160
161
  id
161
162
  } = _a,
162
- rest = __rest(_a, ["field", "label", "labelPosition", "labelWidth", "labelAlign", "labelCol", "wrapperCol", "initValue", "validate", "validateStatus", "trigger", "allowEmptyString", "allowEmpty", "emptyValue", "rules", "onChange", "keepState", "transform", "name", "fieldClassName", "fieldStyle", "noLabel", "noErrorMessage", "isInInputGroup", "stopValidateWithError", "convert", "showValidateIcon", "helpText", "extraText", "extraTextPosition", "pure", "id"]);
163
+ rest = __rest(_a, ["field", "label", "labelPosition", "labelWidth", "labelAlign", "labelCol", "wrapperCol", "initValue", "validate", "validator", "validateStatus", "trigger", "allowEmptyString", "allowEmpty", "emptyValue", "rules", "onChange", "keepState", "transform", "name", "fieldClassName", "fieldStyle", "noLabel", "noErrorMessage", "isInInputGroup", "stopValidateWithError", "convert", "showValidateIcon", "helpText", "extraText", "extraTextPosition", "pure", "id"]);
163
164
  // Form中的任何类型组件,初始值都统一通过initValue字段来传入,同时将可能会导致组件行为错误的props抽取出来,防止透传到组件中
164
165
  // For any type of field component in Form, the initial value is uniformly passed in through the initValue field.
165
166
  // At the same time, the props that may cause component behavior errors are extracted to prevent transparent transmission to the component.
@@ -171,6 +172,8 @@ export function mergeProps(props) {
171
172
  }
172
173
  const required = isRequired(rules);
173
174
  emptyValue = typeof emptyValue !== 'undefined' ? emptyValue : '';
175
+ // `validator` is the recommended name; `validate` is kept as a deprecated alias.
176
+ const finalValidate = validator || validate;
174
177
  return {
175
178
  field,
176
179
  label,
@@ -183,7 +186,7 @@ export function mergeProps(props) {
183
186
  noErrorMessage,
184
187
  isInInputGroup,
185
188
  initValue,
186
- validate,
189
+ validate: finalValidate,
187
190
  validateStatus,
188
191
  trigger,
189
192
  allowEmptyString,
@@ -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, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif;
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, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif;
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
  }
@@ -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, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif;
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, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif;
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 {
@@ -41,6 +41,10 @@ export default class PreviewImageFoundation<P = Record<string, any>, S = Record<
41
41
  originImageHeight: any;
42
42
  containerWidth: number;
43
43
  containerHeight: number;
44
+ private _initialZoomApplied;
45
+ private _initialZoomAppliedSrc;
46
+ private _syncInitialZoomFlagWithSrc;
47
+ private _clampZoom;
44
48
  init(): void;
45
49
  _isImageVertical: () => boolean;
46
50
  _getContainerBoundingRectSize: () => void;
@@ -12,6 +12,28 @@ export default class PreviewImageFoundation extends BaseFoundation {
12
12
  this.originImageHeight = null;
13
13
  this.containerWidth = 0;
14
14
  this.containerHeight = 0;
15
+ // initialZoom should only be applied once per image src (first initialization)
16
+ this._initialZoomApplied = false;
17
+ this._initialZoomAppliedSrc = undefined;
18
+ this._syncInitialZoomFlagWithSrc = () => {
19
+ const src = this.getProp("src");
20
+ if (src !== this._initialZoomAppliedSrc) {
21
+ this._initialZoomAppliedSrc = src;
22
+ this._initialZoomApplied = false;
23
+ }
24
+ };
25
+ this._clampZoom = zoom => {
26
+ const {
27
+ maxZoom,
28
+ minZoom
29
+ } = this.getProps();
30
+ const max = typeof maxZoom === 'number' ? maxZoom : 5;
31
+ const min = typeof minZoom === 'number' ? minZoom : 0.1;
32
+ if (typeof zoom !== 'number' || !Number.isFinite(zoom)) {
33
+ return min;
34
+ }
35
+ return Math.min(max, Math.max(min, zoom));
36
+ };
15
37
  this._isImageVertical = () => this.getProp("rotation") % 180 !== 0;
16
38
  this._getContainerBoundingRectSize = () => {
17
39
  const containerDOM = this._adapter.getContainer();
@@ -39,13 +61,20 @@ export default class PreviewImageFoundation extends BaseFoundation {
39
61
  };
40
62
  this._getInitialZoom = () => {
41
63
  const {
42
- ratio
64
+ ratio,
65
+ initialZoom
43
66
  } = this.getProps();
44
67
  let _zoom = 1;
68
+ // initialZoom is only used for the first initialization of each src
69
+ this._syncInitialZoomFlagWithSrc();
70
+ if (!this._initialZoomApplied && typeof initialZoom === 'number' && Number.isFinite(initialZoom) && initialZoom > 0) {
71
+ this._initialZoomApplied = true;
72
+ return this._clampZoom(initialZoom);
73
+ }
45
74
  if (ratio === 'adaptation') {
46
75
  _zoom = this._getAdaptationZoom();
47
76
  }
48
- return _zoom;
77
+ return this._clampZoom(_zoom);
49
78
  };
50
79
  this.setLoading = loading => {
51
80
  this._adapter.setLoading(loading);
@@ -62,6 +91,8 @@ export default class PreviewImageFoundation extends BaseFoundation {
62
91
  } = e.target;
63
92
  this.originImageHeight = h;
64
93
  this.originImageWidth = w;
94
+ // New image is loaded; allow initialZoom to be applied once for this src
95
+ this._syncInitialZoomFlagWithSrc();
65
96
  this.setState({
66
97
  loading: false
67
98
  });
@@ -48,4 +48,5 @@ export default class PreviewInnerFoundation<P = Record<string, any>, S = Record<
48
48
  preloadSingleImage: () => void;
49
49
  setLoadSuccessStatus: (src: string) => void;
50
50
  onImageLoad: (src: string) => void;
51
+ private _clampZoom;
51
52
  }
@@ -197,11 +197,12 @@ export default class PreviewInnerFoundation extends BaseFoundation {
197
197
  const {
198
198
  zoom
199
199
  } = _this.getStates();
200
- if (zoom !== newZoom) {
201
- notify && _this._adapter.notifyZoom(newZoom, newZoom > zoom);
202
- _this._adapter.changeImageZoom(newZoom, e);
200
+ const nextZoom = _this._clampZoom(newZoom);
201
+ if (zoom !== nextZoom) {
202
+ notify && _this._adapter.notifyZoom(nextZoom, nextZoom > zoom);
203
+ _this._adapter.changeImageZoom(nextZoom, e);
203
204
  _this.setState({
204
- zoom: newZoom
205
+ zoom: nextZoom
205
206
  });
206
207
  }
207
208
  };
@@ -320,6 +321,18 @@ export default class PreviewInnerFoundation extends BaseFoundation {
320
321
  this.preloadSingleImage();
321
322
  }
322
323
  };
324
+ this._clampZoom = zoom => {
325
+ const {
326
+ maxZoom,
327
+ minZoom
328
+ } = this.getProps();
329
+ const max = typeof maxZoom === 'number' ? maxZoom : 5;
330
+ const min = typeof minZoom === 'number' ? minZoom : 0.1;
331
+ if (typeof zoom !== 'number' || !Number.isFinite(zoom)) {
332
+ return min;
333
+ }
334
+ return Math.min(max, Math.max(min, zoom));
335
+ };
323
336
  }
324
337
  beforeShow() {
325
338
  this._adapter.registerKeyDownListener();
@@ -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, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif;
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, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif;
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, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif;
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, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif;
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, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif;
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, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif;
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, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif;
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, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif;
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 {
@@ -12,6 +12,11 @@
12
12
  background-color: var(--semi-color-fill-0);
13
13
  transition: background-color var(--semi-transition_duration-none) var(--semi-transition_function-easeIn) var(--semi-transition_delay-none), border var(--semi-transition_duration-none) var(--semi-transition_function-easeIn) var(--semi-transition_delay-none);
14
14
  }
15
+ .semi-input-textarea-wrapper-resizeX {
16
+ display: inline-block;
17
+ width: fit-content;
18
+ max-width: 100%;
19
+ }
15
20
  .semi-input-textarea-wrapper:hover {
16
21
  background-color: var(--semi-color-fill-1);
17
22
  }
@@ -32,6 +37,9 @@
32
37
  color: var(--semi-color-text-2);
33
38
  right: 4px;
34
39
  height: 32px;
40
+ display: flex;
41
+ align-items: center;
42
+ justify-content: center;
35
43
  }
36
44
  .semi-input-textarea-wrapper .semi-input-clearbtn > svg {
37
45
  pointer-events: none;
@@ -99,7 +107,7 @@
99
107
  box-shadow: none;
100
108
  font-size: 14px;
101
109
  line-height: 20px;
102
- font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif;
110
+ font-family: "Inter", -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif;
103
111
  background-color: transparent;
104
112
  border: 0 solid transparent;
105
113
  vertical-align: bottom;
@@ -134,11 +142,12 @@
134
142
  }
135
143
  .semi-input-textarea-autosize {
136
144
  overflow: hidden;
145
+ resize: none;
137
146
  }
138
147
  .semi-input-textarea-counter {
139
148
  font-size: 12px;
140
149
  line-height: 16px;
141
- font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif;
150
+ font-family: "Inter", -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif;
142
151
  display: flex;
143
152
  flex-direction: column;
144
153
  justify-content: center;
@@ -176,6 +185,14 @@
176
185
  padding: 0;
177
186
  align-items: flex-start;
178
187
  }
188
+ .semi-input-textarea-wrapper-withLineNumber.semi-input-textarea-wrapper-resizeX {
189
+ display: inline-flex;
190
+ width: fit-content;
191
+ max-width: 100%;
192
+ }
193
+ .semi-input-textarea-wrapper-withLineNumber.semi-input-textarea-wrapper-resizeX .semi-input-textarea-content {
194
+ flex: 0 0 auto;
195
+ }
179
196
  .semi-input-textarea-wrapper-withLineNumber .semi-input-textarea-lineNumber {
180
197
  flex-shrink: 0;
181
198
  padding: 5px 12px;
@@ -16,6 +16,21 @@ $module: #{$prefix}-input;
16
16
  transition: background-color $transition_duration-input-bg $transition_function-input-bg $transition_delay-input-bg,
17
17
  border $transition_duration-input-border $transition_function-input-border $transition_delay-input-border;
18
18
 
19
+ // When native resize changes textarea width, wrapper (border/clear/counter) should follow.
20
+ // Default wrapper is `width: 100%`, so it won't grow with textarea. Enable shrink-to-fit.
21
+ &-resizeX {
22
+ // Keep original textarea wrapper formatting (stacking counter, etc.),
23
+ // only shrink-to-fit width so border follows horizontal resize.
24
+ // Using inline-flex here may change internal layout and cause clear/counter misalignment.
25
+ display: inline-block;
26
+ width: fit-content;
27
+ max-width: 100%;
28
+ }
29
+
30
+ &-resizeY {
31
+ // Keep default width behavior; vertical resize doesn't require wrapper width change.
32
+ }
33
+
19
34
  &:hover {
20
35
  background-color: $color-input_default-bg-hover;
21
36
  }
@@ -40,6 +55,10 @@ $module: #{$prefix}-input;
40
55
  color: $color-textarea-icon-default;
41
56
  right: $spacing-textarea-icon-right;
42
57
  height: $height-textarea-default;
58
+ // Center the icon within the clearbtn area
59
+ display: flex;
60
+ align-items: center;
61
+ justify-content: center;
43
62
 
44
63
  & > svg {
45
64
  pointer-events: none;
@@ -130,6 +149,7 @@ $module: #{$prefix}-input;
130
149
 
131
150
  .#{$module}-textarea {
132
151
  position: relative;
152
+ // resize is now controlled by resize prop, default to none for backward compatibility
133
153
  resize: none;
134
154
  // min-height: $height-input_default;
135
155
  padding: $spacing-textarea-paddingY $spacing-textarea-paddingX;
@@ -177,6 +197,8 @@ $module: #{$prefix}-input;
177
197
 
178
198
  &-autosize {
179
199
  overflow: hidden;
200
+ // When autosize is enabled, force resize to none to avoid conflicts
201
+ resize: none;
180
202
  }
181
203
 
182
204
  &-counter {
@@ -235,6 +257,19 @@ $module: #{$prefix}-input;
235
257
  padding: 0;
236
258
  align-items: flex-start;
237
259
 
260
+ &.#{$module}-textarea-wrapper-resizeX {
261
+ // Keep line number + textarea layout, but let width shrink-to-fit
262
+ display: inline-flex;
263
+ width: fit-content;
264
+ max-width: 100%;
265
+
266
+ .#{$module}-textarea-content {
267
+ flex: 0 0 auto;
268
+ }
269
+
270
+ // Do not force a minimum width here; allow the control to fit narrow containers.
271
+ }
272
+
238
273
  .#{$module}-textarea-lineNumber {
239
274
  flex-shrink: 0;
240
275
  padding: $spacing-textarea-paddingY $spacing-textarea-paddingX;
@@ -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