@rockshin/tao-ui 0.0.48 → 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.
- package/dist/components/affix/affix.js +20 -16
- package/dist/components/alert/alert.js +114 -99
- package/dist/components/app/app-modals.js +134 -96
- package/dist/components/app/app-notices.js +39 -23
- package/dist/components/auto-complete/auto-complete.js +21 -7
- package/dist/components/avatar/avatar.js +31 -11
- package/dist/components/badge/badge.css +1 -1
- package/dist/components/badge/badge.js +72 -257
- package/dist/components/border-beam/border-beam.js +21 -17
- package/dist/components/breadcrumb/breadcrumb.js +178 -159
- package/dist/components/button/button.js +61 -53
- package/dist/components/calendar/calendar.js +6 -4
- package/dist/components/card/card.js +24 -8
- package/dist/components/carousel/carousel.d.ts +1 -1
- package/dist/components/carousel/carousel.js +105 -68
- package/dist/components/cascader/cascader.js +54 -19
- package/dist/components/checkbox/checkbox.css +13 -2
- package/dist/components/checkbox/checkbox.d.ts +2 -0
- package/dist/components/checkbox/checkbox.js +320 -229
- package/dist/components/collapse/collapse-panels.d.ts +1 -1
- package/dist/components/collapse/collapse-panels.js +122 -113
- package/dist/components/collapse/collapse.js +98 -63
- package/dist/components/color-picker/color-picker.js +539 -441
- package/dist/components/color-picker/color.js +1 -1
- package/dist/components/context-menu/context-menu.d.ts +1 -1
- package/dist/components/context-menu/context-menu.js +108 -68
- package/dist/components/date-picker/calendar/calendar-grid.js +42 -39
- package/dist/components/date-picker/calendar/month-grid.d.ts +8 -1
- package/dist/components/date-picker/calendar/month-grid.js +79 -37
- package/dist/components/date-picker/calendar/time-panel.d.ts +2 -1
- package/dist/components/date-picker/calendar/time-panel.js +94 -89
- package/dist/components/date-picker/calendar/year-grid.d.ts +8 -1
- package/dist/components/date-picker/calendar/year-grid.js +66 -35
- package/dist/components/date-picker/date-picker.css +24 -1
- package/dist/components/date-picker/date-picker.js +99 -53
- package/dist/components/date-picker/presets.d.ts +2 -1
- package/dist/components/date-picker/presets.js +27 -24
- package/dist/components/date-picker/range-picker.js +308 -153
- package/dist/components/descriptions/descriptions.js +7 -3
- package/dist/components/divider/divider.css +1 -1
- package/dist/components/divider/divider.js +1 -1
- package/dist/components/drawer/drawer.js +201 -369
- package/dist/components/dropdown/dropdown.d.ts +1 -1
- package/dist/components/dropdown/dropdown.js +183 -279
- package/dist/components/empty/empty.js +57 -78
- package/dist/components/float-button/float-button.d.ts +1 -0
- package/dist/components/float-button/float-button.js +47 -30
- package/dist/components/form/field-control.d.ts +4 -2
- package/dist/components/form/field-control.js +17 -9
- package/dist/components/form/form-context.d.ts +8 -2
- package/dist/components/form/form-context.js +2 -1
- package/dist/components/form/form-item.js +85 -63
- package/dist/components/form/use-form.d.ts +2 -1
- package/dist/components/form/use-form.js +2 -1
- package/dist/components/form-field/form-field-view.d.ts +3 -1
- package/dist/components/form-field/form-field-view.js +194 -141
- package/dist/components/form-section/form-section.d.ts +1 -1
- package/dist/components/form-section/form-section.js +52 -45
- package/dist/components/image/image.js +585 -477
- package/dist/components/input/base-input.js +8 -9
- package/dist/components/input/input-shared.d.ts +5 -2
- package/dist/components/input/input-shared.js +42 -18
- package/dist/components/input/otp.js +236 -217
- package/dist/components/input/password.js +2 -1
- package/dist/components/input/search.js +8 -7
- package/dist/components/list/list-pagination.js +41 -36
- package/dist/components/list/list.js +141 -125
- package/dist/components/listy/listy.js +175 -106
- package/dist/components/masonry/masonry.js +108 -85
- package/dist/components/mentions/mentions.js +12 -3
- package/dist/components/menu/menu-render.d.ts +9 -3
- package/dist/components/menu/menu-render.js +99 -36
- package/dist/components/modal/confirm-dialog.js +10 -4
- package/dist/components/modal/confirm.js +3 -7
- package/dist/components/modal/index.js +9 -3
- package/dist/components/modal/modal.js +390 -365
- package/dist/components/pagination/pagination.js +105 -96
- package/dist/components/popconfirm/popconfirm.d.ts +1 -1
- package/dist/components/popconfirm/popconfirm.js +219 -168
- package/dist/components/popover/popover.js +330 -243
- package/dist/components/progress/progress.css +2 -2
- package/dist/components/progress/progress.js +232 -458
- package/dist/components/qr-code/qr-code.js +72 -66
- package/dist/components/radio/radio.css +15 -4
- package/dist/components/radio/radio.d.ts +2 -1
- package/dist/components/radio/radio.js +260 -198
- package/dist/components/rate/rate.js +173 -113
- package/dist/components/scroll-area/scroll-area.js +241 -211
- package/dist/components/segmented/segmented.js +73 -41
- package/dist/components/select/mobile-select.d.ts +2 -1
- package/dist/components/select/mobile-select.js +24 -13
- package/dist/components/select/select-searchable-list.d.ts +2 -1
- package/dist/components/select/select-searchable-list.js +2 -3
- package/dist/components/select/select.js +49 -25
- package/dist/components/select/use-select-selection.d.ts +1 -1
- package/dist/components/select/use-select-selection.js +7 -4
- package/dist/components/skeleton/skeleton.js +56 -48
- package/dist/components/slider/slider.js +87 -212
- package/dist/components/sonner/sonner.js +109 -93
- package/dist/components/spinner/spinner.js +147 -138
- package/dist/components/splitter/splitter.js +222 -159
- package/dist/components/statistic/statistic.js +7 -6
- package/dist/components/steps/steps.js +88 -81
- package/dist/components/steps/use-display-steps.js +1 -1
- package/dist/components/switch/switch.js +89 -89
- package/dist/components/table/table-filter.js +66 -56
- package/dist/components/table/table-icons.d.ts +2 -1
- package/dist/components/table/table-icons.js +11 -9
- package/dist/components/table/table-model.js +1 -1
- package/dist/components/table/table.js +107 -83
- package/dist/components/table/use-table-data.d.ts +6 -3
- package/dist/components/table/use-table-data.js +166 -130
- package/dist/components/tabs/tabs.css +1 -1
- package/dist/components/tabs/tabs.js +236 -179
- package/dist/components/tag/tag.d.ts +2 -2
- package/dist/components/tag/tag.js +111 -108
- package/dist/components/textarea/textarea.js +22 -17
- package/dist/components/time-picker/time-picker.js +5 -3
- package/dist/components/timeline/timeline.css +6 -1
- package/dist/components/timeline/timeline.js +21 -11
- package/dist/components/tooltip/tooltip.d.ts +2 -2
- package/dist/components/tooltip/tooltip.js +123 -233
- package/dist/components/tour/tour.css +4 -0
- package/dist/components/tour/tour.js +400 -331
- package/dist/components/transfer/transfer-list.js +29 -11
- package/dist/components/transfer/transfer-parts.js +1 -1
- package/dist/components/transfer/transfer-types.d.ts +1 -0
- package/dist/components/transfer/transfer.js +29 -14
- package/dist/components/tree/tree-keyboard.d.ts +1 -1
- package/dist/components/tree/tree-keyboard.js +5 -3
- package/dist/components/tree/tree.js +74 -59
- package/dist/components/tree-select/select-engine.d.ts +3 -2
- package/dist/components/tree-select/select-engine.js +18 -16
- package/dist/components/tree-select/tree-select.js +21 -5
- package/dist/components/upload/upload.css +8 -0
- package/dist/components/upload/upload.js +160 -72
- package/dist/components/watermark/watermark.js +36 -29
- package/dist/number-input/use-number-input.js +129 -90
- package/dist/number-input/validate.js +32 -5
- package/dist/provider/merge-locale.js +12 -9
- package/dist/provider/tao-provider.d.ts +3 -1
- package/dist/provider/tao-provider.js +123 -86
- 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(
|
|
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] =
|
|
26
|
-
$[4] =
|
|
27
|
-
$[5] =
|
|
28
|
-
$[6] =
|
|
29
|
-
$[7] =
|
|
30
|
-
$[8] =
|
|
31
|
-
$[9] =
|
|
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
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
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
|
-
|
|
48
|
-
|
|
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
|
-
$[
|
|
52
|
-
$[
|
|
53
|
-
$[
|
|
54
|
-
} else
|
|
55
|
-
const classes =
|
|
56
|
-
let
|
|
57
|
-
if ($[
|
|
58
|
-
|
|
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
|
-
$[
|
|
62
|
-
$[
|
|
63
|
-
$[
|
|
64
|
-
} else
|
|
65
|
-
const semanticStyles =
|
|
66
|
-
const
|
|
67
|
-
const
|
|
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 ($[
|
|
79
|
-
t9 = cx(
|
|
80
|
-
$[
|
|
81
|
-
$[
|
|
82
|
-
|
|
83
|
-
|
|
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 ($[
|
|
86
|
-
t11 = cx("tao-listy-
|
|
87
|
-
$[
|
|
88
|
-
$[
|
|
89
|
-
} else t11 = $[
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
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
|
-
|
|
104
|
-
|
|
123
|
+
$[29] = t13;
|
|
124
|
+
} else t13 = $[29];
|
|
105
125
|
let t14;
|
|
106
|
-
if ($[
|
|
126
|
+
if ($[30] !== classes || $[31] !== t11 || $[32] !== t13 || $[33] !== t9) {
|
|
107
127
|
t14 = {
|
|
108
|
-
...
|
|
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
|
-
$[
|
|
112
|
-
$[
|
|
113
|
-
$[
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
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:
|
|
177
|
+
root: t17,
|
|
178
|
+
item: t18,
|
|
179
|
+
groupHeader: t19
|
|
120
180
|
};
|
|
121
|
-
$[
|
|
122
|
-
$[
|
|
123
|
-
$[
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
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:
|
|
191
|
+
ref: listRef,
|
|
130
192
|
prefixCls: prefixCls,
|
|
193
|
+
direction: direction,
|
|
194
|
+
scrollWidth: scrollWidth,
|
|
131
195
|
virtual: virtual,
|
|
132
196
|
itemHeight: 46,
|
|
133
|
-
classNames:
|
|
134
|
-
styles:
|
|
197
|
+
classNames: t14,
|
|
198
|
+
styles: t20
|
|
135
199
|
});
|
|
136
|
-
$[
|
|
137
|
-
$[
|
|
138
|
-
$[
|
|
139
|
-
$[
|
|
140
|
-
$[
|
|
141
|
-
$[
|
|
142
|
-
$[
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
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":
|
|
149
|
-
children:
|
|
215
|
+
"data-tao-hoverable": t7,
|
|
216
|
+
children: t21
|
|
150
217
|
});
|
|
151
|
-
$[
|
|
152
|
-
$[
|
|
153
|
-
$[
|
|
154
|
-
|
|
155
|
-
|
|
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(
|
|
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
|
|
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
|
-
|
|
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
|
-
$[
|
|
114
|
-
} else
|
|
115
|
-
const [layout, setLayout] = useState(
|
|
116
|
-
let
|
|
117
|
-
if ($[
|
|
118
|
-
|
|
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
|
-
$[
|
|
122
|
-
} else
|
|
123
|
-
useImperativeHandle(ref,
|
|
124
|
-
let
|
|
144
|
+
$[24] = t8;
|
|
145
|
+
} else t8 = $[24];
|
|
146
|
+
useImperativeHandle(ref, t8);
|
|
147
|
+
let t10;
|
|
125
148
|
let t9;
|
|
126
|
-
if ($[
|
|
127
|
-
|
|
149
|
+
if ($[25] !== onLayoutChange) {
|
|
150
|
+
t9 = ()=>{
|
|
128
151
|
callback.current = onLayoutChange;
|
|
129
152
|
};
|
|
130
|
-
|
|
153
|
+
t10 = [
|
|
131
154
|
onLayoutChange
|
|
132
155
|
];
|
|
133
|
-
$[
|
|
134
|
-
$[
|
|
135
|
-
$[
|
|
156
|
+
$[25] = onLayoutChange;
|
|
157
|
+
$[26] = t10;
|
|
158
|
+
$[27] = t9;
|
|
136
159
|
} else {
|
|
137
|
-
|
|
138
|
-
t9 = $[
|
|
160
|
+
t10 = $[26];
|
|
161
|
+
t9 = $[27];
|
|
139
162
|
}
|
|
140
|
-
useLayoutEffect(
|
|
141
|
-
let
|
|
142
|
-
if ($[
|
|
143
|
-
|
|
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 =
|
|
171
|
+
const column = resolveColumn(item.column, count) ?? heights.indexOf(Math.min(...heights));
|
|
149
172
|
const top = heights[column];
|
|
150
|
-
|
|
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
|
-
|
|
163
|
-
|
|
164
|
-
|
|
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
|
-
$[
|
|
169
|
-
$[
|
|
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
|
-
|
|
195
|
+
const measure = t11;
|
|
182
196
|
let t12;
|
|
183
|
-
|
|
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
|
-
|
|
216
|
+
t14 = [
|
|
194
217
|
measure,
|
|
195
218
|
fresh
|
|
196
219
|
];
|
|
197
|
-
$[
|
|
198
|
-
$[
|
|
199
|
-
$[
|
|
200
|
-
$[
|
|
220
|
+
$[33] = fresh;
|
|
221
|
+
$[34] = measure;
|
|
222
|
+
$[35] = t13;
|
|
223
|
+
$[36] = t14;
|
|
201
224
|
} else {
|
|
202
|
-
|
|
203
|
-
|
|
225
|
+
t13 = $[35];
|
|
226
|
+
t14 = $[36];
|
|
204
227
|
}
|
|
205
|
-
useLayoutEffect(
|
|
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
|
|
219
|
-
if ($[
|
|
220
|
-
|
|
241
|
+
let t15;
|
|
242
|
+
if ($[37] !== measure || $[38] !== onLoad) {
|
|
243
|
+
t15 = (event)=>{
|
|
221
244
|
measure();
|
|
222
245
|
onLoad?.(event);
|
|
223
246
|
};
|
|
224
|
-
$[
|
|
225
|
-
$[
|
|
226
|
-
$[
|
|
227
|
-
} else
|
|
228
|
-
let
|
|
229
|
-
if ($[
|
|
230
|
-
|
|
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
|
-
$[
|
|
235
|
-
$[
|
|
236
|
-
$[
|
|
237
|
-
} else
|
|
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:
|
|
250
|
-
onError:
|
|
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 ??
|
|
276
|
+
const column_1 = position_0?.column ?? resolveColumn(item_1.column, count) ?? index_0 % count;
|
|
254
277
|
return /*#__PURE__*/ jsx("div", {
|
|
255
|
-
ref: (
|
|
256
|
-
if (
|
|
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
|
-
|
|
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,
|