@rockshin/tao-ui 0.0.48 → 0.0.51
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.css +9 -1
- 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/input.css +1 -0
- 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.css +3 -2
- 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 +31 -12
- package/dist/components/transfer/transfer-parts.js +1 -1
- package/dist/components/transfer/transfer-types.d.ts +1 -0
- package/dist/components/transfer/transfer.css +5 -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 +4 -3
|
@@ -26,6 +26,8 @@ export interface MenuGroupType {
|
|
|
26
26
|
children: MenuItemType[];
|
|
27
27
|
}
|
|
28
28
|
export type MenuItem = MenuItemType | MenuDividerType | MenuGroupType;
|
|
29
|
+
/** Internal marker for composed menu items whose label is the action element. */
|
|
30
|
+
export declare const menuItemAsChild: unique symbol;
|
|
29
31
|
export interface MenuProps {
|
|
30
32
|
items: MenuItem[];
|
|
31
33
|
onClick?: (info: {
|
|
@@ -79,11 +81,15 @@ export declare function renderMenuItems(items: MenuItem[], ctx: RenderCtx): Reac
|
|
|
79
81
|
/**
|
|
80
82
|
* Encapsulates a menu's selection state (controlled / uncontrolled), the
|
|
81
83
|
* item-click dispatch (`item.onClick` → `menu.onClick`), and rendering of the
|
|
82
|
-
* item tree (wrapping in a RadioGroup for single-select).
|
|
83
|
-
*
|
|
84
|
+
* item tree (wrapping in a RadioGroup for single-select). Shared by Dropdown
|
|
85
|
+
* and ContextMenu.
|
|
84
86
|
*/
|
|
85
87
|
export declare function useMenuController(menu: MenuProps, P: MenuPrimitives, semantic: {
|
|
86
88
|
classNames?: SemanticClassNames<MenuSemanticPart>;
|
|
87
89
|
styles?: SemanticStyles<MenuSemanticPart>;
|
|
88
|
-
}):
|
|
90
|
+
}): {
|
|
91
|
+
content: string | number | bigint | boolean | import("react").JSX.Element | Iterable<ReactNode> | Promise<string | number | bigint | boolean | Iterable<ReactNode> | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | import("react").ReactPortal | null | undefined> | null | undefined;
|
|
92
|
+
selectedKeys: string[];
|
|
93
|
+
commitSelection: (next: string[], changedKey: string) => void;
|
|
94
|
+
};
|
|
89
95
|
export {};
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { c } from "react-compiler-runtime";
|
|
3
|
-
import {
|
|
3
|
+
import { isReactRenderable } from "@rc-component/util";
|
|
4
|
+
import { useId, useState } from "react";
|
|
4
5
|
import { TaoPortalScope } from "../../provider/tao-provider.js";
|
|
5
6
|
import { cx } from "../../utils/semantic.js";
|
|
6
7
|
import "./menu.css";
|
|
8
|
+
const menuItemAsChild = Symbol('menuItemAsChild');
|
|
7
9
|
function ChevronRightIcon() {
|
|
8
10
|
const $ = c(1);
|
|
9
11
|
let t0;
|
|
@@ -77,7 +79,7 @@ function ItemBody(t0) {
|
|
|
77
79
|
const { icon, label, extra, ctx } = t0;
|
|
78
80
|
let t1;
|
|
79
81
|
if ($[0] !== ctx.classNames?.itemIcon || $[1] !== ctx.styles?.itemIcon || $[2] !== icon) {
|
|
80
|
-
t1 =
|
|
82
|
+
t1 = isReactRenderable(icon) && true !== icon && /*#__PURE__*/ jsx("span", {
|
|
81
83
|
"data-tao-menu-item-icon": "",
|
|
82
84
|
className: cx(ctx.classNames?.itemIcon),
|
|
83
85
|
style: ctx.styles?.itemIcon,
|
|
@@ -111,7 +113,7 @@ function ItemBody(t0) {
|
|
|
111
113
|
} else t5 = $[9];
|
|
112
114
|
let t6;
|
|
113
115
|
if ($[10] !== ctx.classNames?.itemExtra || $[11] !== ctx.styles?.itemExtra || $[12] !== extra) {
|
|
114
|
-
t6 =
|
|
116
|
+
t6 = isReactRenderable(extra) && true !== extra && /*#__PURE__*/ jsx("span", {
|
|
115
117
|
"data-tao-menu-item-extra": "",
|
|
116
118
|
className: cx(ctx.classNames?.itemExtra),
|
|
117
119
|
style: ctx.styles?.itemExtra,
|
|
@@ -138,6 +140,54 @@ function ItemBody(t0) {
|
|
|
138
140
|
} else t7 = $[17];
|
|
139
141
|
return t7;
|
|
140
142
|
}
|
|
143
|
+
function MenuGroup(t0) {
|
|
144
|
+
const $ = c(14);
|
|
145
|
+
const { item, ctx } = t0;
|
|
146
|
+
const { P } = ctx;
|
|
147
|
+
const labelId = useId();
|
|
148
|
+
const T0 = P.Group;
|
|
149
|
+
const t1 = null != item.label ? labelId : void 0;
|
|
150
|
+
let t2;
|
|
151
|
+
if ($[0] !== P.Label || $[1] !== ctx.classNames?.groupLabel || $[2] !== ctx.styles?.groupLabel || $[3] !== item.label || $[4] !== labelId) {
|
|
152
|
+
t2 = null != item.label && /*#__PURE__*/ jsx(P.Label, {
|
|
153
|
+
id: labelId,
|
|
154
|
+
"data-tao-menu-group-label": "",
|
|
155
|
+
className: cx(ctx.classNames?.groupLabel),
|
|
156
|
+
style: ctx.styles?.groupLabel,
|
|
157
|
+
children: item.label
|
|
158
|
+
});
|
|
159
|
+
$[0] = P.Label;
|
|
160
|
+
$[1] = ctx.classNames?.groupLabel;
|
|
161
|
+
$[2] = ctx.styles?.groupLabel;
|
|
162
|
+
$[3] = item.label;
|
|
163
|
+
$[4] = labelId;
|
|
164
|
+
$[5] = t2;
|
|
165
|
+
} else t2 = $[5];
|
|
166
|
+
let t3;
|
|
167
|
+
if ($[6] !== ctx || $[7] !== item.children) {
|
|
168
|
+
t3 = renderMenuItems(item.children, ctx);
|
|
169
|
+
$[6] = ctx;
|
|
170
|
+
$[7] = item.children;
|
|
171
|
+
$[8] = t3;
|
|
172
|
+
} else t3 = $[8];
|
|
173
|
+
let t4;
|
|
174
|
+
if ($[9] !== P.Group || $[10] !== t1 || $[11] !== t2 || $[12] !== t3) {
|
|
175
|
+
t4 = /*#__PURE__*/ jsxs(T0, {
|
|
176
|
+
"data-tao-menu-group": "",
|
|
177
|
+
"aria-labelledby": t1,
|
|
178
|
+
children: [
|
|
179
|
+
t2,
|
|
180
|
+
t3
|
|
181
|
+
]
|
|
182
|
+
});
|
|
183
|
+
$[9] = P.Group;
|
|
184
|
+
$[10] = t1;
|
|
185
|
+
$[11] = t2;
|
|
186
|
+
$[12] = t3;
|
|
187
|
+
$[13] = t4;
|
|
188
|
+
} else t4 = $[13];
|
|
189
|
+
return t4;
|
|
190
|
+
}
|
|
141
191
|
function renderMenuItems(items, ctx) {
|
|
142
192
|
const { P } = ctx;
|
|
143
193
|
return items.map((item, index)=>{
|
|
@@ -146,22 +196,16 @@ function renderMenuItems(items, ctx) {
|
|
|
146
196
|
className: cx(ctx.classNames?.divider),
|
|
147
197
|
style: ctx.styles?.divider
|
|
148
198
|
}, `divider-${index}`);
|
|
149
|
-
if ('type' in item && 'group' === item.type) return /*#__PURE__*/
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
null != item.label && /*#__PURE__*/ jsx(P.Label, {
|
|
153
|
-
"data-tao-menu-group-label": "",
|
|
154
|
-
className: cx(ctx.classNames?.groupLabel),
|
|
155
|
-
style: ctx.styles?.groupLabel,
|
|
156
|
-
children: item.label
|
|
157
|
-
}),
|
|
158
|
-
renderMenuItems(item.children, ctx)
|
|
159
|
-
]
|
|
199
|
+
if ('type' in item && 'group' === item.type) return /*#__PURE__*/ jsx(MenuGroup, {
|
|
200
|
+
item: item,
|
|
201
|
+
ctx: ctx
|
|
160
202
|
}, item.key ?? `group-${index}`);
|
|
203
|
+
const textValue = 'string' == typeof item.label || 'number' == typeof item.label ? String(item.label).trim() : void 0;
|
|
161
204
|
if (item.children && item.children.length > 0) return /*#__PURE__*/ jsxs(P.Sub, {
|
|
162
205
|
children: [
|
|
163
206
|
/*#__PURE__*/ jsxs(P.SubTrigger, {
|
|
164
207
|
disabled: item.disabled,
|
|
208
|
+
textValue: textValue,
|
|
165
209
|
"data-tao-menu-item": "",
|
|
166
210
|
"data-tao-menu-sub-trigger": "",
|
|
167
211
|
"data-tao-danger": item.danger || void 0,
|
|
@@ -199,6 +243,7 @@ function renderMenuItems(items, ctx) {
|
|
|
199
243
|
if (ctx.selectable) {
|
|
200
244
|
if (ctx.multiple) return /*#__PURE__*/ jsxs(P.CheckboxItem, {
|
|
201
245
|
disabled: item.disabled,
|
|
246
|
+
textValue: textValue,
|
|
202
247
|
checked: ctx.selectedKeys.includes(item.key),
|
|
203
248
|
onCheckedChange: ()=>{
|
|
204
249
|
ctx.onToggle(item.key);
|
|
@@ -227,6 +272,7 @@ function renderMenuItems(items, ctx) {
|
|
|
227
272
|
return /*#__PURE__*/ jsxs(P.RadioItem, {
|
|
228
273
|
value: item.key,
|
|
229
274
|
disabled: item.disabled,
|
|
275
|
+
textValue: textValue,
|
|
230
276
|
onSelect: ()=>ctx.onAction(item),
|
|
231
277
|
"data-tao-menu-item": "",
|
|
232
278
|
"data-tao-menu-selectable": "",
|
|
@@ -249,14 +295,17 @@ function renderMenuItems(items, ctx) {
|
|
|
249
295
|
]
|
|
250
296
|
}, item.key);
|
|
251
297
|
}
|
|
298
|
+
const asChild = menuItemAsChild in item;
|
|
252
299
|
return /*#__PURE__*/ jsx(P.Item, {
|
|
300
|
+
asChild: asChild,
|
|
253
301
|
disabled: item.disabled,
|
|
302
|
+
textValue: textValue,
|
|
254
303
|
onSelect: ()=>ctx.onAction(item),
|
|
255
304
|
"data-tao-menu-item": "",
|
|
256
305
|
"data-tao-danger": item.danger || void 0,
|
|
257
306
|
className: cx(ctx.classNames?.item),
|
|
258
307
|
style: ctx.styles?.item,
|
|
259
|
-
children: /*#__PURE__*/ jsx(ItemBody, {
|
|
308
|
+
children: asChild ? item.label : /*#__PURE__*/ jsx(ItemBody, {
|
|
260
309
|
icon: item.icon,
|
|
261
310
|
label: item.label,
|
|
262
311
|
extra: item.extra,
|
|
@@ -266,10 +315,10 @@ function renderMenuItems(items, ctx) {
|
|
|
266
315
|
});
|
|
267
316
|
}
|
|
268
317
|
function useMenuController(menu, P, semantic) {
|
|
269
|
-
const $ = c(
|
|
318
|
+
const $ = c(37);
|
|
270
319
|
const selectable = !!menu.selectable;
|
|
271
320
|
const multiple = !!menu.multiple;
|
|
272
|
-
const isSelControlled =
|
|
321
|
+
const isSelControlled = "selectedKeys" in menu;
|
|
273
322
|
let t0;
|
|
274
323
|
if ($[0] !== menu.defaultSelectedKeys) {
|
|
275
324
|
t0 = menu.defaultSelectedKeys ?? [];
|
|
@@ -292,7 +341,9 @@ function useMenuController(menu, P, semantic) {
|
|
|
292
341
|
if (!isSelControlled) setSelInternal(next);
|
|
293
342
|
menu.onSelect?.({
|
|
294
343
|
key: changedKey,
|
|
295
|
-
selectedKeys:
|
|
344
|
+
selectedKeys: [
|
|
345
|
+
...next
|
|
346
|
+
]
|
|
296
347
|
});
|
|
297
348
|
};
|
|
298
349
|
$[6] = isSelControlled;
|
|
@@ -362,22 +413,34 @@ function useMenuController(menu, P, semantic) {
|
|
|
362
413
|
$[25] = t6;
|
|
363
414
|
} else t6 = $[25];
|
|
364
415
|
const body = t6;
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
416
|
+
let t7;
|
|
417
|
+
if ($[26] !== P || $[27] !== body || $[28] !== multiple || $[29] !== radioChange || $[30] !== selectable || $[31] !== selectedKeys) {
|
|
418
|
+
t7 = selectable && !multiple ? /*#__PURE__*/ jsx(P.RadioGroup, {
|
|
419
|
+
value: selectedKeys[0],
|
|
420
|
+
onValueChange: radioChange,
|
|
421
|
+
children: body
|
|
422
|
+
}) : body;
|
|
423
|
+
$[26] = P;
|
|
424
|
+
$[27] = body;
|
|
425
|
+
$[28] = multiple;
|
|
426
|
+
$[29] = radioChange;
|
|
427
|
+
$[30] = selectable;
|
|
428
|
+
$[31] = selectedKeys;
|
|
429
|
+
$[32] = t7;
|
|
430
|
+
} else t7 = $[32];
|
|
431
|
+
const content = t7;
|
|
432
|
+
let t8;
|
|
433
|
+
if ($[33] !== commitSel || $[34] !== content || $[35] !== selectedKeys) {
|
|
434
|
+
t8 = {
|
|
435
|
+
content,
|
|
436
|
+
selectedKeys,
|
|
437
|
+
commitSelection: commitSel
|
|
438
|
+
};
|
|
439
|
+
$[33] = commitSel;
|
|
440
|
+
$[34] = content;
|
|
441
|
+
$[35] = selectedKeys;
|
|
442
|
+
$[36] = t8;
|
|
443
|
+
} else t8 = $[36];
|
|
444
|
+
return t8;
|
|
382
445
|
}
|
|
383
|
-
export { renderMenuItems, useMenuController };
|
|
446
|
+
export { menuItemAsChild, renderMenuItems, useMenuController };
|
|
@@ -68,16 +68,22 @@ function ConfirmDialog({ onMount, open, close, type = 'confirm', icon, title, co
|
|
|
68
68
|
children: [
|
|
69
69
|
showCancel && /*#__PURE__*/ jsx(Button, {
|
|
70
70
|
variant: "secondary",
|
|
71
|
-
loading: cancelLoading,
|
|
72
|
-
onClick: handleCancel,
|
|
73
71
|
...cancelButtonProps,
|
|
72
|
+
loading: cancelLoading || cancelButtonProps?.loading,
|
|
73
|
+
onClick: (event)=>{
|
|
74
|
+
cancelButtonProps?.onClick?.(event);
|
|
75
|
+
if (!event.defaultPrevented) handleCancel();
|
|
76
|
+
},
|
|
74
77
|
children: cancelText ?? locale.cancel
|
|
75
78
|
}),
|
|
76
79
|
/*#__PURE__*/ jsx(Button, {
|
|
77
80
|
variant: "primary",
|
|
78
|
-
loading: loading,
|
|
79
|
-
onClick: handleOk,
|
|
80
81
|
...okButtonProps,
|
|
82
|
+
loading: loading || okButtonProps?.loading,
|
|
83
|
+
onClick: (event_0)=>{
|
|
84
|
+
okButtonProps?.onClick?.(event_0);
|
|
85
|
+
if (!event_0.defaultPrevented) handleOk();
|
|
86
|
+
},
|
|
81
87
|
disabled: cancelLoading || okButtonProps?.disabled,
|
|
82
88
|
children: okText ?? locale.ok
|
|
83
89
|
})
|
|
@@ -12,16 +12,12 @@ function confirm_confirm(config) {
|
|
|
12
12
|
function onMount() {
|
|
13
13
|
mounted = true;
|
|
14
14
|
}
|
|
15
|
-
function
|
|
15
|
+
function afterClose() {
|
|
16
16
|
if (destroyed) return;
|
|
17
17
|
destroyed = true;
|
|
18
18
|
root.unmount();
|
|
19
|
-
const idx = destroyFns.indexOf(
|
|
19
|
+
const idx = destroyFns.indexOf(afterClose);
|
|
20
20
|
if (-1 !== idx) destroyFns.splice(idx, 1);
|
|
21
|
-
}
|
|
22
|
-
function afterClose() {
|
|
23
|
-
if (destroyed) return;
|
|
24
|
-
destroy();
|
|
25
21
|
currentConfig.afterClose?.();
|
|
26
22
|
}
|
|
27
23
|
function close() {
|
|
@@ -48,7 +44,7 @@ function confirm_confirm(config) {
|
|
|
48
44
|
render();
|
|
49
45
|
}
|
|
50
46
|
render();
|
|
51
|
-
destroyFns.push(
|
|
47
|
+
destroyFns.push(afterClose);
|
|
52
48
|
return {
|
|
53
49
|
destroy: close,
|
|
54
50
|
update
|
|
@@ -10,9 +10,15 @@ modal_Modal.warning = (config)=>confirm_0(withWarn(config));
|
|
|
10
10
|
modal_Modal.warn = modal_Modal.warning;
|
|
11
11
|
modal_Modal.useModal = useModal;
|
|
12
12
|
modal_Modal.destroyAll = ()=>{
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
const errors = [];
|
|
14
|
+
for (const close of [
|
|
15
|
+
...destroyFns
|
|
16
|
+
].reverse())try {
|
|
17
|
+
close();
|
|
18
|
+
} catch (error) {
|
|
19
|
+
errors.push(error);
|
|
16
20
|
}
|
|
21
|
+
if (1 === errors.length) throw errors[0];
|
|
22
|
+
if (errors.length > 1) throw new AggregateError(errors, 'Modal cleanup failed');
|
|
17
23
|
};
|
|
18
24
|
export { modal_Modal as Modal };
|