@douyinfe/semi-foundation 2.96.0 → 2.97.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 (81) hide show
  1. package/cascader/foundation.ts +74 -19
  2. package/datePicker/datePicker.scss +100 -5
  3. package/form/foundation.ts +7 -3
  4. package/form/utils.ts +7 -2
  5. package/image/previewImageFoundation.ts +34 -3
  6. package/image/previewInnerFoundation.ts +15 -4
  7. package/input/textarea.scss +35 -0
  8. package/lib/cjs/cascader/foundation.d.ts +12 -0
  9. package/lib/cjs/cascader/foundation.js +68 -23
  10. package/lib/cjs/datePicker/datePicker.css +67 -5
  11. package/lib/cjs/datePicker/datePicker.scss +100 -5
  12. package/lib/cjs/form/foundation.d.ts +1 -1
  13. package/lib/cjs/form/foundation.js +6 -6
  14. package/lib/cjs/form/utils.js +5 -2
  15. package/lib/cjs/image/previewImageFoundation.d.ts +4 -0
  16. package/lib/cjs/image/previewImageFoundation.js +33 -2
  17. package/lib/cjs/image/previewInnerFoundation.d.ts +1 -0
  18. package/lib/cjs/image/previewInnerFoundation.js +17 -4
  19. package/lib/cjs/input/textarea.css +17 -0
  20. package/lib/cjs/input/textarea.scss +35 -0
  21. package/lib/cjs/navigation/navigation.css +2 -1
  22. package/lib/cjs/navigation/navigation.scss +1 -0
  23. package/lib/cjs/navigation/variables.scss +1 -1
  24. package/lib/cjs/overflowList/foundation.d.ts +1 -0
  25. package/lib/cjs/overflowList/foundation.js +51 -1
  26. package/lib/cjs/select/foundation.d.ts +1 -1
  27. package/lib/cjs/select/foundation.js +28 -2
  28. package/lib/cjs/switch/switch.css +1 -0
  29. package/lib/cjs/switch/switch.scss +1 -0
  30. package/lib/cjs/switch/variables.scss +2 -1
  31. package/lib/cjs/table/foundation.js +2 -1
  32. package/lib/cjs/tag/tag.css +26 -0
  33. package/lib/cjs/tag/tag.scss +33 -0
  34. package/lib/cjs/tagInput/tagInput.css +17 -0
  35. package/lib/cjs/tagInput/tagInput.scss +18 -0
  36. package/lib/cjs/timePicker/constants.d.ts +1 -0
  37. package/lib/cjs/timePicker/foundation.d.ts +7 -1
  38. package/lib/cjs/timePicker/foundation.js +62 -11
  39. package/lib/es/cascader/foundation.d.ts +12 -0
  40. package/lib/es/cascader/foundation.js +68 -23
  41. package/lib/es/datePicker/datePicker.css +67 -5
  42. package/lib/es/datePicker/datePicker.scss +100 -5
  43. package/lib/es/form/foundation.d.ts +1 -1
  44. package/lib/es/form/foundation.js +6 -6
  45. package/lib/es/form/utils.js +5 -2
  46. package/lib/es/image/previewImageFoundation.d.ts +4 -0
  47. package/lib/es/image/previewImageFoundation.js +33 -2
  48. package/lib/es/image/previewInnerFoundation.d.ts +1 -0
  49. package/lib/es/image/previewInnerFoundation.js +17 -4
  50. package/lib/es/input/textarea.css +17 -0
  51. package/lib/es/input/textarea.scss +35 -0
  52. package/lib/es/navigation/navigation.css +2 -1
  53. package/lib/es/navigation/navigation.scss +1 -0
  54. package/lib/es/navigation/variables.scss +1 -1
  55. package/lib/es/overflowList/foundation.d.ts +1 -0
  56. package/lib/es/overflowList/foundation.js +51 -1
  57. package/lib/es/select/foundation.d.ts +1 -1
  58. package/lib/es/select/foundation.js +28 -2
  59. package/lib/es/switch/switch.css +1 -0
  60. package/lib/es/switch/switch.scss +1 -0
  61. package/lib/es/switch/variables.scss +2 -1
  62. package/lib/es/table/foundation.js +2 -1
  63. package/lib/es/tag/tag.css +26 -0
  64. package/lib/es/tag/tag.scss +33 -0
  65. package/lib/es/tagInput/tagInput.css +17 -0
  66. package/lib/es/tagInput/tagInput.scss +18 -0
  67. package/lib/es/timePicker/constants.d.ts +1 -0
  68. package/lib/es/timePicker/foundation.d.ts +7 -1
  69. package/lib/es/timePicker/foundation.js +62 -11
  70. package/navigation/navigation.scss +1 -0
  71. package/navigation/variables.scss +1 -1
  72. package/overflowList/foundation.ts +48 -2
  73. package/package.json +4 -4
  74. package/select/foundation.ts +27 -2
  75. package/switch/switch.scss +1 -0
  76. package/switch/variables.scss +2 -1
  77. package/table/foundation.ts +2 -1
  78. package/tag/tag.scss +33 -0
  79. package/tagInput/tagInput.scss +18 -0
  80. package/timePicker/constants.ts +2 -0
  81. package/timePicker/foundation.ts +62 -10
@@ -765,10 +765,38 @@
765
765
  line-height: 16px;
766
766
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif;
767
767
  line-height: 20px;
768
+ display: inline-block;
769
+ max-width: calc(100vw - 32px);
770
+ }
771
+ .semi-datepicker-compact:not(.semi-datepicker-compact-insetInput) {
772
+ width: max-content;
773
+ }
774
+ .semi-datepicker-compact .semi-datepicker-container {
775
+ width: max-content;
776
+ }
777
+ .semi-datepicker-compact .semi-datepicker-month-grid {
778
+ width: max-content;
779
+ }
780
+ .semi-datepicker-compact .semi-datepicker-month-grid .semi-datepicker-month-grid-left,
781
+ .semi-datepicker-compact .semi-datepicker-month-grid .semi-datepicker-month-grid-right {
782
+ min-width: 216px;
783
+ max-width: calc(100vw - 32px);
784
+ }
785
+ .semi-datepicker-compact .semi-datepicker-month-grid .semi-datepicker-month {
786
+ margin-left: auto;
787
+ margin-right: auto;
768
788
  }
769
789
  .semi-datepicker-compact .semi-datepicker-month-grid[x-type=dateTime] .semi-datepicker-yam, .semi-datepicker-compact .semi-datepicker-month-grid[x-type=dateTimeRange] .semi-datepicker-yam {
770
790
  height: calc(100% - 32px);
771
791
  }
792
+ .semi-datepicker-compact .semi-datepicker-month-grid .semi-datepicker-yam {
793
+ position: relative;
794
+ width: 100%;
795
+ max-width: 100%;
796
+ max-height: 256px;
797
+ overflow-x: auto;
798
+ overflow-y: hidden;
799
+ }
772
800
  .semi-datepicker-compact .semi-datepicker-month-grid[x-type=dateRange] .semi-datepicker-month-grid-left, .semi-datepicker-compact .semi-datepicker-month-grid[x-type=dateTimeRange] .semi-datepicker-month-grid-left {
773
801
  border-right: 1px solid var(--semi-color-border);
774
802
  }
@@ -786,6 +814,16 @@
786
814
  box-sizing: border-box;
787
815
  height: 48px;
788
816
  padding: 12px;
817
+ width: 100%;
818
+ max-width: 100%;
819
+ }
820
+ .semi-datepicker-compact .semi-datepicker-month-grid .semi-datepicker-yearmonth-header button,
821
+ .semi-datepicker-compact .semi-datepicker-month-grid .semi-datepicker-yearmonth-header .semi-button {
822
+ width: 100%;
823
+ max-width: 100%;
824
+ overflow: hidden;
825
+ text-overflow: ellipsis;
826
+ white-space: nowrap;
789
827
  }
790
828
  .semi-datepicker-compact .semi-datepicker-month-grid .semi-datepicker-yearmonth-body {
791
829
  display: flex;
@@ -847,9 +885,12 @@
847
885
  height: calc(100% - 32px);
848
886
  }
849
887
  .semi-datepicker-compact .semi-datepicker-navigation {
888
+ box-sizing: border-box;
850
889
  height: 24px;
851
890
  padding: 12px;
852
891
  padding-bottom: 0;
892
+ width: 100%;
893
+ max-width: 100%;
853
894
  }
854
895
  .semi-datepicker-compact .semi-datepicker-navigation-left, .semi-datepicker-compact .semi-datepicker-navigation-right {
855
896
  width: 24px;
@@ -859,11 +900,22 @@
859
900
  min-width: 24px;
860
901
  min-height: 24px;
861
902
  }
903
+ .semi-datepicker-compact .semi-datepicker-navigation-month {
904
+ min-width: 0;
905
+ overflow: hidden;
906
+ }
862
907
  .semi-datepicker-compact .semi-datepicker-navigation-month .semi-button {
863
908
  font-size: 12px;
864
909
  line-height: 16px;
865
910
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif;
866
911
  line-height: 20px;
912
+ max-width: 100%;
913
+ }
914
+ .semi-datepicker-compact .semi-datepicker-navigation-month .semi-button > span {
915
+ display: block;
916
+ overflow: hidden;
917
+ text-overflow: ellipsis;
918
+ white-space: nowrap;
867
919
  }
868
920
  .semi-datepicker-compact .semi-datepicker-month {
869
921
  width: 216px;
@@ -1008,7 +1060,9 @@
1008
1060
  color: var(--semi-color-primary);
1009
1061
  }
1010
1062
  .semi-datepicker-compact .semi-datepicker-quick-control-month {
1011
- max-width: 216px;
1063
+ min-width: 216px;
1064
+ width: max-content;
1065
+ max-width: calc(100vw - 32px);
1012
1066
  }
1013
1067
  .semi-datepicker-compact .semi-datepicker-quick-control-month[x-insetinput=true] .semi-datepicker-quick-control-right-content-wrapper,
1014
1068
  .semi-datepicker-compact .semi-datepicker-quick-control-month[x-insetinput=true] .semi-datepicker-quick-control-left-content-wrapper {
@@ -1019,7 +1073,9 @@
1019
1073
  max-height: 218px;
1020
1074
  }
1021
1075
  .semi-datepicker-compact .semi-datepicker-quick-control-date {
1022
- max-width: 216px;
1076
+ min-width: 216px;
1077
+ width: max-content;
1078
+ max-width: calc(100vw - 32px);
1023
1079
  }
1024
1080
  .semi-datepicker-compact .semi-datepicker-quick-control-date[x-insetinput=true] .semi-datepicker-quick-control-right-content-wrapper,
1025
1081
  .semi-datepicker-compact .semi-datepicker-quick-control-date[x-insetinput=true] .semi-datepicker-quick-control-left-content-wrapper {
@@ -1030,7 +1086,9 @@
1030
1086
  max-height: 208px;
1031
1087
  }
1032
1088
  .semi-datepicker-compact .semi-datepicker-quick-control-dateTime {
1033
- max-width: 216px;
1089
+ min-width: 216px;
1090
+ width: max-content;
1091
+ max-width: calc(100vw - 32px);
1034
1092
  }
1035
1093
  .semi-datepicker-compact .semi-datepicker-quick-control-dateTime[x-insetinput=true] .semi-datepicker-quick-control-right-content-wrapper,
1036
1094
  .semi-datepicker-compact .semi-datepicker-quick-control-dateTime[x-insetinput=true] .semi-datepicker-quick-control-left-content-wrapper {
@@ -1041,7 +1099,9 @@
1041
1099
  max-height: 240px;
1042
1100
  }
1043
1101
  .semi-datepicker-compact .semi-datepicker-quick-control-dateRange {
1044
- max-width: 432px;
1102
+ min-width: min(432px, calc(100vw - 32px));
1103
+ width: max-content;
1104
+ max-width: calc(100vw - 32px);
1045
1105
  }
1046
1106
  .semi-datepicker-compact .semi-datepicker-quick-control-dateRange[x-insetinput=true] .semi-datepicker-quick-control-right-content-wrapper,
1047
1107
  .semi-datepicker-compact .semi-datepicker-quick-control-dateRange[x-insetinput=true] .semi-datepicker-quick-control-left-content-wrapper {
@@ -1052,7 +1112,9 @@
1052
1112
  max-height: 208px;
1053
1113
  }
1054
1114
  .semi-datepicker-compact .semi-datepicker-quick-control-dateTimeRange {
1055
- max-width: 432px;
1115
+ min-width: min(432px, calc(100vw - 32px));
1116
+ width: max-content;
1117
+ max-width: calc(100vw - 32px);
1056
1118
  }
1057
1119
  .semi-datepicker-compact .semi-datepicker-quick-control-dateTimeRange[x-insetinput=true] .semi-datepicker-quick-control-right-content-wrapper,
1058
1120
  .semi-datepicker-compact .semi-datepicker-quick-control-dateTimeRange[x-insetinput=true] .semi-datepicker-quick-control-left-content-wrapper {
@@ -1129,7 +1129,44 @@ $module-list: #{$prefix}-scrolllist;
1129
1129
  @include font-size-small;
1130
1130
  line-height: $lineHeight-datepicker_compact;
1131
1131
 
1132
+ // Max width constraint for compact panels
1133
+ $compact-max-width: calc(100vw - 32px);
1134
+
1135
+ // Make the compact panel shrink-to-fit its contents.
1136
+ // This ensures the popover background/container expands together with
1137
+ // long locale texts instead of letting inner buttons visually overflow.
1138
+ display: inline-block;
1139
+ max-width: $compact-max-width;
1140
+
1141
+ // Ensure the popover expands to fit this compact datepicker
1142
+ &:not(&-insetInput) {
1143
+ width: max-content;
1144
+ }
1145
+
1146
+ .#{$module}-container {
1147
+ // Keep flex layout but allow the container to size by content.
1148
+ width: max-content;
1149
+ }
1150
+
1132
1151
  .#{$module}-month-grid {
1152
+ // Let the month grid contribute its intrinsic width to the popover.
1153
+ width: max-content;
1154
+
1155
+ .#{$module}-month-grid-left,
1156
+ .#{$module}-month-grid-right {
1157
+ min-width: $width-datepicker_month_compact;
1158
+ // Keep the current compact width as the baseline,
1159
+ // but allow the panel to grow to fit long locale texts.
1160
+ // When reaching viewport limit, month title will ellipsis.
1161
+ max-width: $compact-max-width;
1162
+ }
1163
+
1164
+ // Keep calendar body centered when panel grows
1165
+ // without breaking navigation layout in range mode.
1166
+ .#{$module}-month {
1167
+ margin-left: auto;
1168
+ margin-right: auto;
1169
+ }
1133
1170
 
1134
1171
  &[x-type="dateTime"],
1135
1172
  &[x-type="dateTimeRange"] {
@@ -1139,6 +1176,18 @@ $module-list: #{$prefix}-scrolllist;
1139
1176
  }
1140
1177
  }
1141
1178
 
1179
+ // Allow yam (year-month scrolllist) panel to expand with content in compact mode
1180
+ .#{$module}-yam {
1181
+ // Use relative positioning so parent can expand to fit content width
1182
+ // Height is constrained to prevent scrolllist from expanding too much
1183
+ position: relative;
1184
+ width: 100%;
1185
+ max-width: 100%;
1186
+ max-height: $height-datepicker_yam_panel_compact;
1187
+ overflow-x: auto;
1188
+ overflow-y: hidden;
1189
+ }
1190
+
1142
1191
  &[x-type="dateRange"],
1143
1192
  &[x-type="dateTimeRange"] {
1144
1193
  .#{$module}-month-grid-left {
@@ -1169,6 +1218,18 @@ $module-list: #{$prefix}-scrolllist;
1169
1218
  box-sizing: border-box;
1170
1219
  height: $height-datepicker_yam_panel_header_compact;
1171
1220
  padding: $spacing-datepicker_yam_panel_header_compact-padding;
1221
+ width: 100%;
1222
+ max-width: 100%;
1223
+
1224
+ // Constrain the back button to prevent overflow
1225
+ button,
1226
+ .#{$prefix}-button {
1227
+ width: 100%;
1228
+ max-width: 100%;
1229
+ overflow: hidden;
1230
+ text-overflow: ellipsis;
1231
+ white-space: nowrap;
1232
+ }
1172
1233
  }
1173
1234
 
1174
1235
  .#{$module}-yearmonth-body {
@@ -1265,9 +1326,14 @@ $module-list: #{$prefix}-scrolllist;
1265
1326
  }
1266
1327
 
1267
1328
  .#{$module}-navigation {
1329
+ box-sizing: border-box;
1268
1330
  height: $width-datepicker_nav_compact;
1269
1331
  padding: $spacing-datepicker_nav_compact-padding;
1270
1332
  padding-bottom: 0;
1333
+ // In compact mode, keep navigation constrained within each panel
1334
+ // (especially important for dateRange two-column layout).
1335
+ width: 100%;
1336
+ max-width: 100%;
1271
1337
 
1272
1338
  &-left,
1273
1339
  &-right {
@@ -1281,10 +1347,21 @@ $module-list: #{$prefix}-scrolllist;
1281
1347
  }
1282
1348
 
1283
1349
  &-month {
1350
+ min-width: 0;
1351
+ overflow: hidden;
1352
+
1284
1353
  .#{$prefix}-button {
1285
1354
  // 覆盖样式,否则会从button继承
1286
1355
  @include font-size-small;
1287
1356
  line-height: $lineHeight-datepicker_compact;
1357
+ max-width: 100%;
1358
+
1359
+ > span {
1360
+ display: block;
1361
+ overflow: hidden;
1362
+ text-overflow: ellipsis;
1363
+ white-space: nowrap;
1364
+ }
1288
1365
  }
1289
1366
  }
1290
1367
  }
@@ -1498,7 +1575,10 @@ $module-list: #{$prefix}-scrolllist;
1498
1575
  }
1499
1576
 
1500
1577
  &-month {
1501
- max-width: $width-datepicker_panel_compact;
1578
+ // Keep compact baseline width, but allow growing to fit long locale texts.
1579
+ min-width: $width-datepicker_panel_compact;
1580
+ width: max-content;
1581
+ max-width: $compact-max-width;
1502
1582
 
1503
1583
  &[x-insetinput=true] {
1504
1584
  .#{$module}-quick-control-right-content-wrapper,
@@ -1514,7 +1594,10 @@ $module-list: #{$prefix}-scrolllist;
1514
1594
  }
1515
1595
 
1516
1596
  &-date {
1517
- max-width: $width-datepicker_panel_compact;
1597
+ // Keep compact baseline width, but allow growing to fit long locale texts.
1598
+ min-width: $width-datepicker_panel_compact;
1599
+ width: max-content;
1600
+ max-width: $compact-max-width;
1518
1601
 
1519
1602
  &[x-insetinput=true] {
1520
1603
  .#{$module}-quick-control-right-content-wrapper,
@@ -1530,7 +1613,10 @@ $module-list: #{$prefix}-scrolllist;
1530
1613
  }
1531
1614
 
1532
1615
  &-dateTime {
1533
- max-width: $width-datepicker_panel_compact;
1616
+ // Keep compact baseline width, but allow growing to fit long locale texts.
1617
+ min-width: $width-datepicker_panel_compact;
1618
+ width: max-content;
1619
+ max-width: $compact-max-width;
1534
1620
 
1535
1621
  &[x-insetinput=true] {
1536
1622
  .#{$module}-quick-control-right-content-wrapper,
@@ -1546,7 +1632,12 @@ $module-list: #{$prefix}-scrolllist;
1546
1632
  }
1547
1633
 
1548
1634
  &-dateRange {
1549
- max-width: $width-datepicker_panel_compact * 2;
1635
+ // Keep compact baseline width, but allow growing to fit long locale texts.
1636
+ // Avoid min-width > max-width on small viewports (which would force overflow).
1637
+ // Keep the 2-panel baseline when possible, but cap it to the compact viewport limit.
1638
+ min-width: min(#{$width-datepicker_panel_compact * 2}, #{$compact-max-width});
1639
+ width: max-content;
1640
+ max-width: $compact-max-width;
1550
1641
 
1551
1642
  &[x-insetinput=true] {
1552
1643
  .#{$module}-quick-control-right-content-wrapper,
@@ -1562,7 +1653,11 @@ $module-list: #{$prefix}-scrolllist;
1562
1653
  }
1563
1654
 
1564
1655
  &-dateTimeRange {
1565
- max-width: $width-datepicker_panel_compact * 2;
1656
+ // Keep compact baseline width, but allow growing to fit long locale texts.
1657
+ // Avoid min-width > max-width on small viewports (which would force overflow).
1658
+ min-width: min(#{$width-datepicker_panel_compact * 2}, #{$compact-max-width});
1659
+ width: max-content;
1660
+ max-width: $compact-max-width;
1566
1661
 
1567
1662
  &[x-insetinput=true] {
1568
1663
  .#{$module}-quick-control-right-content-wrapper,
@@ -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:
@@ -135,9 +135,9 @@ class FormFoundation extends _foundation.default {
135
135
  this.registeredArrayField.set(arrayField, mergeVal);
136
136
  }
137
137
  validate(fieldPaths) {
138
- const {
139
- validateFields
140
- } = this.getProps();
138
+ const props = this.getProps();
139
+ // `validator` is the recommended name; `validateFields` is kept as a deprecated alias.
140
+ const validateFields = props.validator || props.validateFields;
141
141
  // Parse options
142
142
  let fields;
143
143
  let silent = false;
@@ -162,9 +162,9 @@ class FormFoundation extends _foundation.default {
162
162
  const {
163
163
  values
164
164
  } = this.data;
165
- const {
166
- validateFields
167
- } = this.getProps();
165
+ const props = this.getProps();
166
+ // `validator` is the recommended name; `validateFields` is kept as a deprecated alias.
167
+ const validateFields = props.validator || props.validateFields;
168
168
  return new Promise((resolve, reject) => {
169
169
  let maybePromisedErrors;
170
170
  try {
@@ -142,6 +142,7 @@ function mergeProps(props) {
142
142
  wrapperCol,
143
143
  initValue,
144
144
  validate,
145
+ validator,
145
146
  /**
146
147
  * error、warning、default、success
147
148
  */
@@ -173,7 +174,7 @@ function mergeProps(props) {
173
174
  pure,
174
175
  id
175
176
  } = _a,
176
- 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"]);
177
+ 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"]);
177
178
  // Form中的任何类型组件,初始值都统一通过initValue字段来传入,同时将可能会导致组件行为错误的props抽取出来,防止透传到组件中
178
179
  // For any type of field component in Form, the initial value is uniformly passed in through the initValue field.
179
180
  // At the same time, the props that may cause component behavior errors are extracted to prevent transparent transmission to the component.
@@ -185,6 +186,8 @@ function mergeProps(props) {
185
186
  }
186
187
  const required = isRequired(rules);
187
188
  emptyValue = typeof emptyValue !== 'undefined' ? emptyValue : '';
189
+ // `validator` is the recommended name; `validate` is kept as a deprecated alias.
190
+ const finalValidate = validator || validate;
188
191
  return {
189
192
  field,
190
193
  label,
@@ -197,7 +200,7 @@ function mergeProps(props) {
197
200
  noErrorMessage,
198
201
  isInInputGroup,
199
202
  initValue,
200
- validate,
203
+ validate: finalValidate,
201
204
  validateStatus,
202
205
  trigger,
203
206
  allowEmptyString,
@@ -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;
@@ -19,6 +19,28 @@ class PreviewImageFoundation extends _foundation.default {
19
19
  this.originImageHeight = null;
20
20
  this.containerWidth = 0;
21
21
  this.containerHeight = 0;
22
+ // initialZoom should only be applied once per image src (first initialization)
23
+ this._initialZoomApplied = false;
24
+ this._initialZoomAppliedSrc = undefined;
25
+ this._syncInitialZoomFlagWithSrc = () => {
26
+ const src = this.getProp("src");
27
+ if (src !== this._initialZoomAppliedSrc) {
28
+ this._initialZoomAppliedSrc = src;
29
+ this._initialZoomApplied = false;
30
+ }
31
+ };
32
+ this._clampZoom = zoom => {
33
+ const {
34
+ maxZoom,
35
+ minZoom
36
+ } = this.getProps();
37
+ const max = typeof maxZoom === 'number' ? maxZoom : 5;
38
+ const min = typeof minZoom === 'number' ? minZoom : 0.1;
39
+ if (typeof zoom !== 'number' || !Number.isFinite(zoom)) {
40
+ return min;
41
+ }
42
+ return Math.min(max, Math.max(min, zoom));
43
+ };
22
44
  this._isImageVertical = () => this.getProp("rotation") % 180 !== 0;
23
45
  this._getContainerBoundingRectSize = () => {
24
46
  const containerDOM = this._adapter.getContainer();
@@ -46,13 +68,20 @@ class PreviewImageFoundation extends _foundation.default {
46
68
  };
47
69
  this._getInitialZoom = () => {
48
70
  const {
49
- ratio
71
+ ratio,
72
+ initialZoom
50
73
  } = this.getProps();
51
74
  let _zoom = 1;
75
+ // initialZoom is only used for the first initialization of each src
76
+ this._syncInitialZoomFlagWithSrc();
77
+ if (!this._initialZoomApplied && typeof initialZoom === 'number' && Number.isFinite(initialZoom) && initialZoom > 0) {
78
+ this._initialZoomApplied = true;
79
+ return this._clampZoom(initialZoom);
80
+ }
52
81
  if (ratio === 'adaptation') {
53
82
  _zoom = this._getAdaptationZoom();
54
83
  }
55
- return _zoom;
84
+ return this._clampZoom(_zoom);
56
85
  };
57
86
  this.setLoading = loading => {
58
87
  this._adapter.setLoading(loading);
@@ -69,6 +98,8 @@ class PreviewImageFoundation extends _foundation.default {
69
98
  } = e.target;
70
99
  this.originImageHeight = h;
71
100
  this.originImageWidth = w;
101
+ // New image is loaded; allow initialZoom to be applied once for this src
102
+ this._syncInitialZoomFlagWithSrc();
72
103
  this.setState({
73
104
  loading: false
74
105
  });
@@ -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
  }
@@ -204,11 +204,12 @@ class PreviewInnerFoundation extends _foundation.default {
204
204
  const {
205
205
  zoom
206
206
  } = _this.getStates();
207
- if (zoom !== newZoom) {
208
- notify && _this._adapter.notifyZoom(newZoom, newZoom > zoom);
209
- _this._adapter.changeImageZoom(newZoom, e);
207
+ const nextZoom = _this._clampZoom(newZoom);
208
+ if (zoom !== nextZoom) {
209
+ notify && _this._adapter.notifyZoom(nextZoom, nextZoom > zoom);
210
+ _this._adapter.changeImageZoom(nextZoom, e);
210
211
  _this.setState({
211
- zoom: newZoom
212
+ zoom: nextZoom
212
213
  });
213
214
  }
214
215
  };
@@ -327,6 +328,18 @@ class PreviewInnerFoundation extends _foundation.default {
327
328
  this.preloadSingleImage();
328
329
  }
329
330
  };
331
+ this._clampZoom = zoom => {
332
+ const {
333
+ maxZoom,
334
+ minZoom
335
+ } = this.getProps();
336
+ const max = typeof maxZoom === 'number' ? maxZoom : 5;
337
+ const min = typeof minZoom === 'number' ? minZoom : 0.1;
338
+ if (typeof zoom !== 'number' || !Number.isFinite(zoom)) {
339
+ return min;
340
+ }
341
+ return Math.min(max, Math.max(min, zoom));
342
+ };
330
343
  }
331
344
  beforeShow() {
332
345
  this._adapter.registerKeyDownListener();
@@ -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;
@@ -134,6 +142,7 @@
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;
@@ -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;
@@ -544,7 +544,7 @@
544
544
  transition: padding-left 100ms ease-out, width 200ms cubic-bezier(0.62, 0.05, 0.36, 0.95);
545
545
  }
546
546
  .semi-navigation-vertical .semi-navigation-footer {
547
- color: var(--semi-color-text-2);
547
+ color: var(--semi-color-text-1);
548
548
  padding-left: 8px;
549
549
  padding-right: 8px;
550
550
  }
@@ -556,6 +556,7 @@
556
556
  .semi-navigation-vertical .semi-navigation-footer .semi-navigation-collapse-btn > .semi-button {
557
557
  padding-left: 8px;
558
558
  padding-right: 8px;
559
+ color: var(--semi-color-text-1);
559
560
  }
560
561
  .semi-navigation-vertical .semi-navigation-footer-collapsed {
561
562
  justify-content: center;
@@ -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-2); // 导航栏 footer 图标颜色
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); // 导航栏一级菜单项图标颜色
@@ -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;