@rockshin/tao-ui 0.0.47 → 0.0.49

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 (144) hide show
  1. package/dist/components/affix/affix.js +20 -16
  2. package/dist/components/alert/alert.js +114 -99
  3. package/dist/components/app/app-modals.js +134 -96
  4. package/dist/components/app/app-notices.js +39 -23
  5. package/dist/components/auto-complete/auto-complete.js +21 -7
  6. package/dist/components/avatar/avatar.js +31 -11
  7. package/dist/components/badge/badge.css +1 -1
  8. package/dist/components/badge/badge.js +72 -257
  9. package/dist/components/border-beam/border-beam.js +21 -17
  10. package/dist/components/breadcrumb/breadcrumb.js +178 -159
  11. package/dist/components/button/button.js +61 -53
  12. package/dist/components/calendar/calendar.js +6 -4
  13. package/dist/components/card/card.js +24 -8
  14. package/dist/components/carousel/carousel.d.ts +1 -1
  15. package/dist/components/carousel/carousel.js +105 -68
  16. package/dist/components/cascader/cascader.js +54 -19
  17. package/dist/components/checkbox/checkbox.css +13 -2
  18. package/dist/components/checkbox/checkbox.d.ts +2 -0
  19. package/dist/components/checkbox/checkbox.js +320 -229
  20. package/dist/components/collapse/collapse-panels.d.ts +1 -1
  21. package/dist/components/collapse/collapse-panels.js +122 -113
  22. package/dist/components/collapse/collapse.js +98 -63
  23. package/dist/components/color-picker/color-picker.js +539 -441
  24. package/dist/components/color-picker/color.js +1 -1
  25. package/dist/components/context-menu/context-menu.d.ts +1 -1
  26. package/dist/components/context-menu/context-menu.js +108 -68
  27. package/dist/components/date-picker/calendar/calendar-grid.js +42 -39
  28. package/dist/components/date-picker/calendar/month-grid.d.ts +8 -1
  29. package/dist/components/date-picker/calendar/month-grid.js +79 -37
  30. package/dist/components/date-picker/calendar/time-panel.d.ts +2 -1
  31. package/dist/components/date-picker/calendar/time-panel.js +94 -89
  32. package/dist/components/date-picker/calendar/year-grid.d.ts +8 -1
  33. package/dist/components/date-picker/calendar/year-grid.js +66 -35
  34. package/dist/components/date-picker/date-picker.css +24 -1
  35. package/dist/components/date-picker/date-picker.js +99 -53
  36. package/dist/components/date-picker/presets.d.ts +2 -1
  37. package/dist/components/date-picker/presets.js +27 -24
  38. package/dist/components/date-picker/range-picker.js +308 -153
  39. package/dist/components/descriptions/descriptions.js +7 -3
  40. package/dist/components/divider/divider.css +1 -1
  41. package/dist/components/divider/divider.js +1 -1
  42. package/dist/components/drawer/drawer.js +201 -369
  43. package/dist/components/dropdown/dropdown.d.ts +1 -1
  44. package/dist/components/dropdown/dropdown.js +183 -279
  45. package/dist/components/empty/empty.js +57 -78
  46. package/dist/components/float-button/float-button.d.ts +1 -0
  47. package/dist/components/float-button/float-button.js +47 -30
  48. package/dist/components/form/field-control.d.ts +4 -2
  49. package/dist/components/form/field-control.js +17 -9
  50. package/dist/components/form/form-context.d.ts +8 -2
  51. package/dist/components/form/form-context.js +2 -1
  52. package/dist/components/form/form-item.js +85 -63
  53. package/dist/components/form/form.css +3 -2
  54. package/dist/components/form/use-form.d.ts +2 -1
  55. package/dist/components/form/use-form.js +2 -1
  56. package/dist/components/form-field/form-field-view.d.ts +3 -1
  57. package/dist/components/form-field/form-field-view.js +194 -141
  58. package/dist/components/form-section/form-section.d.ts +1 -1
  59. package/dist/components/form-section/form-section.js +52 -45
  60. package/dist/components/image/image.js +585 -477
  61. package/dist/components/input/base-input.js +8 -9
  62. package/dist/components/input/input-shared.d.ts +5 -2
  63. package/dist/components/input/input-shared.js +42 -18
  64. package/dist/components/input/otp.js +236 -217
  65. package/dist/components/input/password.js +2 -1
  66. package/dist/components/input/search.js +8 -7
  67. package/dist/components/list/list-pagination.js +41 -36
  68. package/dist/components/list/list.js +141 -125
  69. package/dist/components/listy/listy.js +175 -106
  70. package/dist/components/masonry/masonry.js +108 -85
  71. package/dist/components/mentions/mentions.js +12 -3
  72. package/dist/components/menu/menu-render.d.ts +9 -3
  73. package/dist/components/menu/menu-render.js +99 -36
  74. package/dist/components/modal/confirm-dialog.js +10 -4
  75. package/dist/components/modal/confirm.js +3 -7
  76. package/dist/components/modal/index.js +9 -3
  77. package/dist/components/modal/modal.js +390 -365
  78. package/dist/components/pagination/pagination.js +105 -96
  79. package/dist/components/popconfirm/popconfirm.d.ts +1 -1
  80. package/dist/components/popconfirm/popconfirm.js +219 -168
  81. package/dist/components/popover/popover.js +330 -243
  82. package/dist/components/progress/progress.css +2 -2
  83. package/dist/components/progress/progress.js +232 -458
  84. package/dist/components/qr-code/qr-code.js +72 -66
  85. package/dist/components/radio/radio.css +15 -4
  86. package/dist/components/radio/radio.d.ts +2 -1
  87. package/dist/components/radio/radio.js +260 -198
  88. package/dist/components/rate/rate.js +173 -113
  89. package/dist/components/scroll-area/scroll-area.js +241 -211
  90. package/dist/components/segmented/segmented.js +73 -41
  91. package/dist/components/select/mobile-select.d.ts +2 -1
  92. package/dist/components/select/mobile-select.js +24 -13
  93. package/dist/components/select/select-searchable-list.d.ts +2 -1
  94. package/dist/components/select/select-searchable-list.js +2 -3
  95. package/dist/components/select/select.js +49 -25
  96. package/dist/components/select/use-select-selection.d.ts +1 -1
  97. package/dist/components/select/use-select-selection.js +7 -4
  98. package/dist/components/skeleton/skeleton.js +56 -48
  99. package/dist/components/slider/slider.js +87 -212
  100. package/dist/components/sonner/sonner.js +109 -93
  101. package/dist/components/spinner/spinner.js +147 -138
  102. package/dist/components/splitter/splitter.js +222 -159
  103. package/dist/components/statistic/statistic.js +7 -6
  104. package/dist/components/steps/steps.js +88 -81
  105. package/dist/components/steps/use-display-steps.js +1 -1
  106. package/dist/components/switch/switch.js +89 -89
  107. package/dist/components/table/table-filter.js +66 -56
  108. package/dist/components/table/table-icons.d.ts +2 -1
  109. package/dist/components/table/table-icons.js +11 -9
  110. package/dist/components/table/table-model.js +1 -1
  111. package/dist/components/table/table.js +107 -83
  112. package/dist/components/table/use-table-data.d.ts +6 -3
  113. package/dist/components/table/use-table-data.js +166 -130
  114. package/dist/components/tabs/tabs.css +1 -1
  115. package/dist/components/tabs/tabs.js +236 -179
  116. package/dist/components/tag/tag.d.ts +2 -2
  117. package/dist/components/tag/tag.js +111 -108
  118. package/dist/components/textarea/textarea.js +22 -17
  119. package/dist/components/time-picker/time-picker.js +5 -3
  120. package/dist/components/timeline/timeline.css +6 -1
  121. package/dist/components/timeline/timeline.js +21 -11
  122. package/dist/components/tooltip/tooltip.d.ts +2 -2
  123. package/dist/components/tooltip/tooltip.js +123 -233
  124. package/dist/components/tour/tour.css +4 -0
  125. package/dist/components/tour/tour.js +400 -331
  126. package/dist/components/transfer/transfer-list.js +29 -11
  127. package/dist/components/transfer/transfer-parts.js +1 -1
  128. package/dist/components/transfer/transfer-types.d.ts +1 -0
  129. package/dist/components/transfer/transfer.js +29 -14
  130. package/dist/components/tree/tree-keyboard.d.ts +1 -1
  131. package/dist/components/tree/tree-keyboard.js +5 -3
  132. package/dist/components/tree/tree.js +74 -59
  133. package/dist/components/tree-select/select-engine.d.ts +3 -2
  134. package/dist/components/tree-select/select-engine.js +18 -16
  135. package/dist/components/tree-select/tree-select.js +21 -5
  136. package/dist/components/upload/upload.css +8 -0
  137. package/dist/components/upload/upload.js +160 -72
  138. package/dist/components/watermark/watermark.js +36 -29
  139. package/dist/number-input/use-number-input.js +129 -90
  140. package/dist/number-input/validate.js +32 -5
  141. package/dist/provider/merge-locale.js +12 -9
  142. package/dist/provider/tao-provider.d.ts +3 -1
  143. package/dist/provider/tao-provider.js +123 -86
  144. package/package.json +1 -1
@@ -1,158 +1,227 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import { c } from "react-compiler-runtime";
3
3
  import listy from "@rc-component/listy";
4
- import { forwardRef } from "react";
4
+ import { forwardRef, useImperativeHandle, useRef } from "react";
5
+ import { useTaoDirection } from "../../provider/tao-provider.js";
5
6
  import { cx } from "../../utils/semantic.js";
6
7
  import "./listy.css";
7
8
  import { interopDefault } from "../../utils/interop-default.js";
8
9
  const RcListyComponent = /*#__PURE__*/ interopDefault(listy);
9
10
  function ListyRoot(props, ref) {
10
- const $ = c(45);
11
+ const $ = c(63);
11
12
  let className;
12
13
  let classNames;
14
+ let directionProp;
13
15
  let rest;
14
16
  let rootClassName;
17
+ let scrollWidth;
15
18
  let style;
16
19
  let styles;
17
20
  let t0;
18
21
  let t1;
19
22
  let t2;
20
23
  if ($[0] !== props) {
21
- ({ prefixCls: t0, className, rootClassName, style, classNames, styles, rowHoverable: t1, virtual: t2, ...rest } = props);
24
+ ({ prefixCls: t0, className, rootClassName, style, classNames, styles, rowHoverable: t1, virtual: t2, direction: directionProp, scrollWidth, ...rest } = props);
22
25
  $[0] = props;
23
26
  $[1] = className;
24
27
  $[2] = classNames;
25
- $[3] = rest;
26
- $[4] = rootClassName;
27
- $[5] = style;
28
- $[6] = styles;
29
- $[7] = t0;
30
- $[8] = t1;
31
- $[9] = t2;
28
+ $[3] = directionProp;
29
+ $[4] = rest;
30
+ $[5] = rootClassName;
31
+ $[6] = scrollWidth;
32
+ $[7] = style;
33
+ $[8] = styles;
34
+ $[9] = t0;
35
+ $[10] = t1;
36
+ $[11] = t2;
32
37
  } else {
33
38
  className = $[1];
34
39
  classNames = $[2];
35
- rest = $[3];
36
- rootClassName = $[4];
37
- style = $[5];
38
- styles = $[6];
39
- t0 = $[7];
40
- t1 = $[8];
41
- t2 = $[9];
40
+ directionProp = $[3];
41
+ rest = $[4];
42
+ rootClassName = $[5];
43
+ scrollWidth = $[6];
44
+ style = $[7];
45
+ styles = $[8];
46
+ t0 = $[9];
47
+ t1 = $[10];
48
+ t2 = $[11];
42
49
  }
43
50
  const prefixCls = void 0 === t0 ? "tao-listy" : t0;
44
51
  const rowHoverable = void 0 === t1 ? true : t1;
45
52
  const virtual = void 0 === t2 ? false : t2;
53
+ const [direction, directionRef] = useTaoDirection(directionProp);
54
+ const listRef = useRef(null);
46
55
  let t3;
47
- if ($[10] !== classNames || $[11] !== props) {
48
- t3 = "function" == typeof classNames ? classNames({
56
+ let t4;
57
+ if ($[12] !== direction || $[13] !== virtual) {
58
+ t3 = ()=>({
59
+ scrollTo (config) {
60
+ if (!virtual && "rtl" === direction && config && "object" == typeof config && "left" in config && void 0 !== config.left) return void listRef.current?.scrollTo({
61
+ ...config,
62
+ left: -Math.abs(config.left)
63
+ });
64
+ listRef.current?.scrollTo(config);
65
+ }
66
+ });
67
+ t4 = [
68
+ direction,
69
+ virtual
70
+ ];
71
+ $[12] = direction;
72
+ $[13] = virtual;
73
+ $[14] = t3;
74
+ $[15] = t4;
75
+ } else {
76
+ t3 = $[14];
77
+ t4 = $[15];
78
+ }
79
+ useImperativeHandle(ref, t3, t4);
80
+ const rawWidth = virtual ? void 0 : scrollWidth;
81
+ let t5;
82
+ if ($[16] !== classNames || $[17] !== props) {
83
+ t5 = "function" == typeof classNames ? classNames({
49
84
  props
50
85
  }) : classNames;
51
- $[10] = classNames;
52
- $[11] = props;
53
- $[12] = t3;
54
- } else t3 = $[12];
55
- const classes = t3;
56
- let t4;
57
- if ($[13] !== props || $[14] !== styles) {
58
- t4 = "function" == typeof styles ? styles({
86
+ $[16] = classNames;
87
+ $[17] = props;
88
+ $[18] = t5;
89
+ } else t5 = $[18];
90
+ const classes = t5;
91
+ let t6;
92
+ if ($[19] !== props || $[20] !== styles) {
93
+ t6 = "function" == typeof styles ? styles({
59
94
  props
60
95
  }) : styles;
61
- $[13] = props;
62
- $[14] = styles;
63
- $[15] = t4;
64
- } else t4 = $[15];
65
- const semanticStyles = t4;
66
- const t5 = rowHoverable ? "" : void 0;
67
- const t6 = classes?.root;
68
- let t7;
69
- if ($[16] !== className || $[17] !== rootClassName || $[18] !== t6) {
70
- t7 = cx(t6, rootClassName, className);
71
- $[16] = className;
72
- $[17] = rootClassName;
73
- $[18] = t6;
74
- $[19] = t7;
75
- } else t7 = $[19];
76
- const t8 = classes?.item;
96
+ $[19] = props;
97
+ $[20] = styles;
98
+ $[21] = t6;
99
+ } else t6 = $[21];
100
+ const semanticStyles = t6;
101
+ const t7 = rowHoverable ? "" : void 0;
102
+ const t8 = classes?.root;
77
103
  let t9;
78
- if ($[20] !== t8) {
79
- t9 = cx("tao-listy-item-slot", t8);
80
- $[20] = t8;
81
- $[21] = t9;
82
- } else t9 = $[21];
83
- const t10 = classes?.groupHeader;
104
+ if ($[22] !== className || $[23] !== rootClassName || $[24] !== t8) {
105
+ t9 = cx(t8, rootClassName, className);
106
+ $[22] = className;
107
+ $[23] = rootClassName;
108
+ $[24] = t8;
109
+ $[25] = t9;
110
+ } else t9 = $[25];
111
+ const t10 = classes?.item;
84
112
  let t11;
85
- if ($[22] !== t10) {
86
- t11 = cx("tao-listy-group-slot", t10);
87
- $[22] = t10;
88
- $[23] = t11;
89
- } else t11 = $[23];
90
- let t12;
91
- if ($[24] !== classes || $[25] !== t11 || $[26] !== t7 || $[27] !== t9) {
92
- t12 = {
93
- ...classes,
94
- root: t7,
95
- item: t9,
96
- groupHeader: t11
97
- };
98
- $[24] = classes;
99
- $[25] = t11;
100
- $[26] = t7;
101
- $[27] = t9;
113
+ if ($[26] !== t10) {
114
+ t11 = cx("tao-listy-item-slot", t10);
115
+ $[26] = t10;
116
+ $[27] = t11;
117
+ } else t11 = $[27];
118
+ const t12 = classes?.groupHeader;
119
+ let t13;
120
+ if ($[28] !== t12) {
121
+ t13 = cx("tao-listy-group-slot", t12);
102
122
  $[28] = t12;
103
- } else t12 = $[28];
104
- const t13 = semanticStyles?.root;
123
+ $[29] = t13;
124
+ } else t13 = $[29];
105
125
  let t14;
106
- if ($[29] !== style || $[30] !== t13) {
126
+ if ($[30] !== classes || $[31] !== t11 || $[32] !== t13 || $[33] !== t9) {
107
127
  t14 = {
108
- ...t13,
128
+ ...classes,
129
+ root: t9,
130
+ item: t11,
131
+ groupHeader: t13
132
+ };
133
+ $[30] = classes;
134
+ $[31] = t11;
135
+ $[32] = t13;
136
+ $[33] = t9;
137
+ $[34] = t14;
138
+ } else t14 = $[34];
139
+ const t15 = rawWidth ? "auto" : void 0;
140
+ const t16 = semanticStyles?.root;
141
+ let t17;
142
+ if ($[35] !== style || $[36] !== t15 || $[37] !== t16) {
143
+ t17 = {
144
+ overflowX: t15,
145
+ ...t16,
109
146
  ...style
110
147
  };
111
- $[29] = style;
112
- $[30] = t13;
113
- $[31] = t14;
114
- } else t14 = $[31];
115
- let t15;
116
- if ($[32] !== semanticStyles || $[33] !== t14) {
117
- t15 = {
148
+ $[35] = style;
149
+ $[36] = t15;
150
+ $[37] = t16;
151
+ $[38] = t17;
152
+ } else t17 = $[38];
153
+ let t18;
154
+ if ($[39] !== rawWidth || $[40] !== semanticStyles?.item) {
155
+ t18 = rawWidth ? {
156
+ minWidth: rawWidth,
157
+ ...semanticStyles?.item
158
+ } : semanticStyles?.item;
159
+ $[39] = rawWidth;
160
+ $[40] = semanticStyles?.item;
161
+ $[41] = t18;
162
+ } else t18 = $[41];
163
+ let t19;
164
+ if ($[42] !== rawWidth || $[43] !== semanticStyles?.groupHeader) {
165
+ t19 = rawWidth ? {
166
+ minWidth: rawWidth,
167
+ ...semanticStyles?.groupHeader
168
+ } : semanticStyles?.groupHeader;
169
+ $[42] = rawWidth;
170
+ $[43] = semanticStyles?.groupHeader;
171
+ $[44] = t19;
172
+ } else t19 = $[44];
173
+ let t20;
174
+ if ($[45] !== semanticStyles || $[46] !== t17 || $[47] !== t18 || $[48] !== t19) {
175
+ t20 = {
118
176
  ...semanticStyles,
119
- root: t14
177
+ root: t17,
178
+ item: t18,
179
+ groupHeader: t19
120
180
  };
121
- $[32] = semanticStyles;
122
- $[33] = t14;
123
- $[34] = t15;
124
- } else t15 = $[34];
125
- let t16;
126
- if ($[35] !== prefixCls || $[36] !== ref || $[37] !== rest || $[38] !== t12 || $[39] !== t15 || $[40] !== virtual) {
127
- t16 = /*#__PURE__*/ jsx(RcListyComponent, {
181
+ $[45] = semanticStyles;
182
+ $[46] = t17;
183
+ $[47] = t18;
184
+ $[48] = t19;
185
+ $[49] = t20;
186
+ } else t20 = $[49];
187
+ let t21;
188
+ if ($[50] !== direction || $[51] !== prefixCls || $[52] !== rest || $[53] !== scrollWidth || $[54] !== t14 || $[55] !== t20 || $[56] !== virtual) {
189
+ t21 = /*#__PURE__*/ jsx(RcListyComponent, {
128
190
  ...rest,
129
- ref: ref,
191
+ ref: listRef,
130
192
  prefixCls: prefixCls,
193
+ direction: direction,
194
+ scrollWidth: scrollWidth,
131
195
  virtual: virtual,
132
196
  itemHeight: 46,
133
- classNames: t12,
134
- styles: t15
197
+ classNames: t14,
198
+ styles: t20
135
199
  });
136
- $[35] = prefixCls;
137
- $[36] = ref;
138
- $[37] = rest;
139
- $[38] = t12;
140
- $[39] = t15;
141
- $[40] = virtual;
142
- $[41] = t16;
143
- } else t16 = $[41];
144
- let t17;
145
- if ($[42] !== t16 || $[43] !== t5) {
146
- t17 = /*#__PURE__*/ jsx("div", {
200
+ $[50] = direction;
201
+ $[51] = prefixCls;
202
+ $[52] = rest;
203
+ $[53] = scrollWidth;
204
+ $[54] = t14;
205
+ $[55] = t20;
206
+ $[56] = virtual;
207
+ $[57] = t21;
208
+ } else t21 = $[57];
209
+ let t22;
210
+ if ($[58] !== direction || $[59] !== directionRef || $[60] !== t21 || $[61] !== t7) {
211
+ t22 = /*#__PURE__*/ jsx("div", {
212
+ ref: directionRef,
213
+ dir: direction,
147
214
  "data-tao-listy": "",
148
- "data-tao-hoverable": t5,
149
- children: t16
215
+ "data-tao-hoverable": t7,
216
+ children: t21
150
217
  });
151
- $[42] = t16;
152
- $[43] = t5;
153
- $[44] = t17;
154
- } else t17 = $[44];
155
- return t17;
218
+ $[58] = direction;
219
+ $[59] = directionRef;
220
+ $[60] = t21;
221
+ $[61] = t7;
222
+ $[62] = t22;
223
+ } else t22 = $[62];
224
+ return t22;
156
225
  }
157
226
  const Listy = /*#__PURE__*/ forwardRef(ListyRoot);
158
227
  export { Listy };
@@ -5,8 +5,24 @@ import { resolveResponsiveValue, useBreakpoint } from "../../utils/breakpoint.js
5
5
  import { cx } from "../../utils/semantic.js";
6
6
  import "./masonry.css";
7
7
  const EMPTY_ITEMS = [];
8
+ function resolveColumn(column, count) {
9
+ return void 0 !== column && Number.isFinite(column) ? Math.max(0, Math.min(Math.floor(column), count - 1)) : void 0;
10
+ }
11
+ function measureHeight(element) {
12
+ const style = getComputedStyle(element);
13
+ if ('none' === style.display) return 0;
14
+ if (!style.height.endsWith('px')) return element.getBoundingClientRect().height;
15
+ const height = Number.parseFloat(style.height);
16
+ if ('content-box' !== style.boxSizing) return height;
17
+ return [
18
+ style.paddingTop,
19
+ style.paddingBottom,
20
+ style.borderTopWidth,
21
+ style.borderBottomWidth
22
+ ].reduce((total, size)=>total + (Number.parseFloat(size) || 0), height);
23
+ }
8
24
  function MasonryInner(props, ref) {
9
- const $ = c(41);
25
+ const $ = c(43);
10
26
  let className;
11
27
  let classNames;
12
28
  let columns;
@@ -83,7 +99,14 @@ function MasonryInner(props, ref) {
83
99
  $[17] = screens;
84
100
  $[18] = t3;
85
101
  } else t3 = $[18];
86
- const count = t3;
102
+ const requestedCount = t3;
103
+ let t4;
104
+ if ($[19] !== requestedCount) {
105
+ t4 = Number.isFinite(requestedCount) ? Math.max(1, Math.floor(requestedCount)) : 1;
106
+ $[19] = requestedCount;
107
+ $[20] = t4;
108
+ } else t4 = $[20];
109
+ const count = t4;
87
110
  const gaps = Array.isArray(gutter) ? gutter : [
88
111
  gutter,
89
112
  gutter
@@ -91,63 +114,64 @@ function MasonryInner(props, ref) {
91
114
  const horizontal = resolveResponsiveValue(gaps[0] ?? 0, screens) ?? 0;
92
115
  const vertical = resolveResponsiveValue(gaps[1] ?? horizontal, screens) ?? 0;
93
116
  const root = useRef(null);
94
- let t4;
95
- if ($[19] === Symbol.for("react.memo_cache_sentinel")) {
96
- t4 = new Map();
97
- $[19] = t4;
98
- } else t4 = $[19];
99
- const refs = useRef(t4);
100
- const callback = useRef(onLayoutChange);
101
117
  let t5;
102
- if ($[20] === Symbol.for("react.memo_cache_sentinel")) {
103
- t5 = [];
104
- $[20] = t5;
105
- } else t5 = $[20];
106
- const previousColumns = useRef(t5);
107
- let t6;
108
118
  if ($[21] === Symbol.for("react.memo_cache_sentinel")) {
109
- t6 = {
119
+ t5 = new Map();
120
+ $[21] = t5;
121
+ } else t5 = $[21];
122
+ const refs = useRef(t5);
123
+ const callback = useRef(onLayoutChange);
124
+ let t6;
125
+ if ($[22] === Symbol.for("react.memo_cache_sentinel")) {
126
+ t6 = [];
127
+ $[22] = t6;
128
+ } else t6 = $[22];
129
+ const previousColumns = useRef(t6);
130
+ let t7;
131
+ if ($[23] === Symbol.for("react.memo_cache_sentinel")) {
132
+ t7 = {
110
133
  height: 0,
111
134
  positions: []
112
135
  };
113
- $[21] = t6;
114
- } else t6 = $[21];
115
- const [layout, setLayout] = useState(t6);
116
- let t7;
117
- if ($[22] === Symbol.for("react.memo_cache_sentinel")) {
118
- t7 = ()=>({
136
+ $[23] = t7;
137
+ } else t7 = $[23];
138
+ const [layout, setLayout] = useState(t7);
139
+ let t8;
140
+ if ($[24] === Symbol.for("react.memo_cache_sentinel")) {
141
+ t8 = ()=>({
119
142
  nativeElement: root.current
120
143
  });
121
- $[22] = t7;
122
- } else t7 = $[22];
123
- useImperativeHandle(ref, t7);
124
- let t8;
144
+ $[24] = t8;
145
+ } else t8 = $[24];
146
+ useImperativeHandle(ref, t8);
147
+ let t10;
125
148
  let t9;
126
- if ($[23] !== onLayoutChange) {
127
- t8 = ()=>{
149
+ if ($[25] !== onLayoutChange) {
150
+ t9 = ()=>{
128
151
  callback.current = onLayoutChange;
129
152
  };
130
- t9 = [
153
+ t10 = [
131
154
  onLayoutChange
132
155
  ];
133
- $[23] = onLayoutChange;
134
- $[24] = t8;
135
- $[25] = t9;
156
+ $[25] = onLayoutChange;
157
+ $[26] = t10;
158
+ $[27] = t9;
136
159
  } else {
137
- t8 = $[24];
138
- t9 = $[25];
160
+ t10 = $[26];
161
+ t9 = $[27];
139
162
  }
140
- useLayoutEffect(t8, t9);
141
- let t10;
142
- if ($[26] !== count || $[27] !== items) {
143
- t10 = ()=>{
163
+ useLayoutEffect(t9, t10);
164
+ let t11;
165
+ if ($[28] !== count || $[29] !== items) {
166
+ t11 = ()=>{
144
167
  const element = root.current;
145
168
  const gap = Number.parseFloat(getComputedStyle(element).rowGap) || 0;
146
169
  const heights = Array(count).fill(0);
147
170
  const positions = items.map((item)=>{
148
- const column = Math.min(item.column ?? heights.indexOf(Math.min(...heights)), count - 1);
171
+ const column = resolveColumn(item.column, count) ?? heights.indexOf(Math.min(...heights));
149
172
  const top = heights[column];
150
- heights[column] = heights[column] + ((refs.current.get(item.key)?.getBoundingClientRect().height ?? item.height ?? 0) + gap);
173
+ const node = refs.current.get(item.key);
174
+ heights[column] = heights[column] + ((node ? measureHeight(node) : item.height ?? 0) + gap);
151
175
  return {
152
176
  key: item.key,
153
177
  column,
@@ -159,30 +183,29 @@ function MasonryInner(props, ref) {
159
183
  positions
160
184
  };
161
185
  setLayout((previous)=>previous.height === next.height && previous.positions.length === positions.length && previous.positions.every((position, index)=>position.key === positions[index].key && position.column === positions[index].column && position.top === positions[index].top) ? previous : next);
162
- const order = positions.map(_temp);
163
- if (order.length !== previousColumns.current.length || order.some((item_0, i)=>item_0.key !== previousColumns.current[i].key || item_0.column !== previousColumns.current[i].column)) {
164
- previousColumns.current = order;
165
- callback.current?.(order);
186
+ if (positions.length !== previousColumns.current.length || positions.some((item_0, i)=>item_0.key !== previousColumns.current[i].key || item_0.column !== previousColumns.current[i].column)) {
187
+ previousColumns.current = positions;
188
+ callback.current?.(positions.map(_temp));
166
189
  }
167
190
  };
168
- $[26] = count;
169
- $[27] = items;
170
- $[28] = t10;
171
- } else t10 = $[28];
172
- const measure = t10;
173
- let t11;
174
- if ($[29] !== measure) {
175
- t11 = ()=>{
176
- measure();
177
- };
178
- $[29] = measure;
191
+ $[28] = count;
192
+ $[29] = items;
179
193
  $[30] = t11;
180
194
  } else t11 = $[30];
181
- useLayoutEffect(t11);
195
+ const measure = t11;
182
196
  let t12;
183
- let t13;
184
- if ($[31] !== fresh || $[32] !== measure) {
197
+ if ($[31] !== measure) {
185
198
  t12 = ()=>{
199
+ measure();
200
+ };
201
+ $[31] = measure;
202
+ $[32] = t12;
203
+ } else t12 = $[32];
204
+ useLayoutEffect(t12);
205
+ let t13;
206
+ let t14;
207
+ if ($[33] !== fresh || $[34] !== measure) {
208
+ t13 = ()=>{
186
209
  const observer = new ResizeObserver(measure);
187
210
  observer.observe(root.current);
188
211
  if (fresh) refs.current.forEach((element_0)=>{
@@ -190,19 +213,19 @@ function MasonryInner(props, ref) {
190
213
  });
191
214
  return ()=>observer.disconnect();
192
215
  };
193
- t13 = [
216
+ t14 = [
194
217
  measure,
195
218
  fresh
196
219
  ];
197
- $[31] = fresh;
198
- $[32] = measure;
199
- $[33] = t12;
200
- $[34] = t13;
220
+ $[33] = fresh;
221
+ $[34] = measure;
222
+ $[35] = t13;
223
+ $[36] = t14;
201
224
  } else {
202
- t12 = $[33];
203
- t13 = $[34];
225
+ t13 = $[35];
226
+ t14 = $[36];
204
227
  }
205
- useLayoutEffect(t12, t13);
228
+ useLayoutEffect(t13, t14);
206
229
  const merged = {
207
230
  ...props,
208
231
  columns: count
@@ -215,26 +238,26 @@ function MasonryInner(props, ref) {
215
238
  }) : styles;
216
239
  const gap_0 = "number" == typeof horizontal ? `${horizontal}px` : horizontal;
217
240
  const width = `calc((100% - (${count} - 1) * ${gap_0}) / ${count})`;
218
- let t14;
219
- if ($[35] !== measure || $[36] !== onLoad) {
220
- t14 = (event)=>{
241
+ let t15;
242
+ if ($[37] !== measure || $[38] !== onLoad) {
243
+ t15 = (event)=>{
221
244
  measure();
222
245
  onLoad?.(event);
223
246
  };
224
- $[35] = measure;
225
- $[36] = onLoad;
226
- $[37] = t14;
227
- } else t14 = $[37];
228
- let t15;
229
- if ($[38] !== measure || $[39] !== onError) {
230
- t15 = (event_0)=>{
247
+ $[37] = measure;
248
+ $[38] = onLoad;
249
+ $[39] = t15;
250
+ } else t15 = $[39];
251
+ let t16;
252
+ if ($[40] !== measure || $[41] !== onError) {
253
+ t16 = (event_0)=>{
231
254
  measure();
232
255
  onError?.(event_0);
233
256
  };
234
- $[38] = measure;
235
- $[39] = onError;
236
- $[40] = t15;
237
- } else t15 = $[40];
257
+ $[40] = measure;
258
+ $[41] = onError;
259
+ $[42] = t16;
260
+ } else t16 = $[42];
238
261
  return /*#__PURE__*/ jsx("div", {
239
262
  ...rest,
240
263
  ref: root,
@@ -246,14 +269,14 @@ function MasonryInner(props, ref) {
246
269
  ...slots?.root,
247
270
  ...style
248
271
  },
249
- onLoad: t14,
250
- onError: t15,
272
+ onLoad: t15,
273
+ onError: t16,
251
274
  children: items.map((item_1, index_0)=>{
252
275
  const position_0 = layout.positions[index_0]?.key === item_1.key ? layout.positions[index_0] : void 0;
253
- const column_1 = position_0?.column ?? Math.min(item_1.column ?? index_0 % count, count - 1);
276
+ const column_1 = position_0?.column ?? resolveColumn(item_1.column, count) ?? index_0 % count;
254
277
  return /*#__PURE__*/ jsx("div", {
255
- ref: (node)=>{
256
- if (node) refs.current.set(item_1.key, node);
278
+ ref: (node_0)=>{
279
+ if (node_0) refs.current.set(item_1.key, node_0);
257
280
  else refs.current.delete(item_1.key);
258
281
  },
259
282
  "data-tao-masonry-item": "",
@@ -12,7 +12,8 @@ function getMentions(value = '', { prefix = '@', split = ' ' } = {}) {
12
12
  const prefixes = Array.isArray(prefix) ? prefix : [
13
13
  prefix
14
14
  ];
15
- return value.split(split).flatMap((text)=>{
15
+ const tokens = ' ' === split ? value.split(/\s+/u) : value.split(split);
16
+ return tokens.flatMap((text)=>{
16
17
  const match = prefixes.find((candidate)=>text.startsWith(candidate));
17
18
  return void 0 !== match && text.length > match.length ? [
18
19
  {
@@ -24,7 +25,7 @@ function getMentions(value = '', { prefix = '@', split = ' ' } = {}) {
24
25
  }
25
26
  const MentionsComponent = /*#__PURE__*/ forwardRef((props, ref)=>{
26
27
  const config = useTaoInternalConfig();
27
- const { size: sizeProp = config.size, disabled = config.disabled, variant = config.variant, status, loading = false, prefixCls = 'tao-mentions', className, rootClassName, style, classNames, styles, allowClear, options, children, filterOption, notFoundContent = config.locale.noResults, popupClassName, popupRender, ...rest } = props;
28
+ const { size: sizeProp = config.size, disabled = config.disabled, variant = config.variant, status, loading = false, prefixCls = 'tao-mentions', className, rootClassName, style, classNames, styles, allowClear, options, children, filterOption, notFoundContent = config.locale.noResults, popupClassName, popupRender, value, ...rest } = props;
28
29
  const size = 'middle' === sizeProp ? 'medium' : sizeProp;
29
30
  const resolvedProps = {
30
31
  ...props,
@@ -38,7 +39,7 @@ const MentionsComponent = /*#__PURE__*/ forwardRef((props, ref)=>{
38
39
  const semanticStyles = 'function' == typeof styles ? styles({
39
40
  props: resolvedProps
40
41
  }) : styles;
41
- const clearConfig = allowClear ? {
42
+ const clearConfig = allowClear && !props.readOnly ? {
42
43
  clearIcon: /*#__PURE__*/ jsx(CloseIcon, {}),
43
44
  label: config.locale.clear,
44
45
  ...'object' == typeof allowClear ? allowClear : {}
@@ -74,6 +75,14 @@ const MentionsComponent = /*#__PURE__*/ forwardRef((props, ref)=>{
74
75
  ref: ref,
75
76
  prefixCls: prefixCls,
76
77
  disabled: disabled,
78
+ onKeyDownCapture: (event)=>{
79
+ props.onKeyDownCapture?.(event);
80
+ if (!event.isPropagationStopped() && 'Enter' === event.key && (event.nativeEvent.isComposing || 229 === event.keyCode)) {
81
+ props.onKeyDown?.(event);
82
+ event.stopPropagation();
83
+ }
84
+ },
85
+ value: 'value' in props ? value ?? '' : void 0,
77
86
  silent: loading,
78
87
  allowClear: clearConfig,
79
88
  options: loading ? loadingOptions : options,