@rockshin/tao-ui 0.0.57 → 0.0.59
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 +38 -4
- package/dist/components/app/app-modals.js +11 -6
- package/dist/components/app/app-notices.js +112 -47
- package/dist/components/auto-complete/auto-complete.js +9 -2
- package/dist/components/avatar/avatar.js +1 -1
- package/dist/components/badge/badge.js +2 -2
- package/dist/components/breadcrumb/breadcrumb.js +5 -1
- package/dist/components/calendar/calendar.js +24 -17
- package/dist/components/carousel/carousel.js +35 -16
- package/dist/components/cascader/cascader.js +17 -12
- package/dist/components/checkbox/checkbox.d.ts +3 -1
- package/dist/components/checkbox/checkbox.js +65 -58
- package/dist/components/collapse/collapse-panels.js +68 -67
- package/dist/components/color-picker/color-picker.js +383 -360
- package/dist/components/date-picker/calendar/calendar-grid.d.ts +5 -3
- package/dist/components/date-picker/calendar/calendar-grid.js +9 -4
- package/dist/components/date-picker/calendar/month-grid.d.ts +2 -1
- package/dist/components/date-picker/calendar/month-grid.js +61 -45
- package/dist/components/date-picker/calendar/time-panel.d.ts +8 -1
- package/dist/components/date-picker/calendar/time-panel.js +89 -88
- package/dist/components/date-picker/calendar/year-grid.d.ts +2 -1
- package/dist/components/date-picker/calendar/year-grid.js +60 -44
- package/dist/components/date-picker/date-localization.js +12 -14
- package/dist/components/date-picker/date-picker.css +9 -0
- package/dist/components/date-picker/date-picker.js +22 -13
- package/dist/components/date-picker/range-picker.d.ts +2 -0
- package/dist/components/date-picker/range-picker.js +127 -70
- package/dist/components/date-picker/types.js +1 -1
- package/dist/components/divider/divider.js +1 -1
- package/dist/components/drawer/drawer.d.ts +1 -1
- package/dist/components/drawer/drawer.js +4 -3
- package/dist/components/dropdown/dropdown.js +11 -9
- package/dist/components/float-button/float-button.js +11 -9
- package/dist/components/form/form-item.d.ts +1 -1
- package/dist/components/form/form-item.js +160 -120
- package/dist/components/form-field/form-field-view.d.ts +2 -1
- package/dist/components/form-field/form-field-view.js +173 -108
- package/dist/components/image/image.js +135 -143
- package/dist/components/input/input-shared.js +3 -2
- package/dist/components/input/otp.js +120 -110
- package/dist/components/input/password.js +55 -61
- package/dist/components/input/search.js +13 -7
- package/dist/components/list/list.js +106 -105
- package/dist/components/masonry/masonry.js +1 -1
- package/dist/components/mentions/mentions.js +1 -0
- package/dist/components/menu/menu-render.js +1 -0
- package/dist/components/modal/confirm-dialog.js +11 -4
- package/dist/components/modal/modal.js +320 -315
- package/dist/components/pagination/pagination.d.ts +3 -0
- package/dist/components/pagination/pagination.js +5 -0
- package/dist/components/popover/popover.js +325 -289
- package/dist/components/qr-code/qr-code.js +157 -150
- package/dist/components/radio/radio.d.ts +3 -1
- package/dist/components/radio/radio.js +73 -64
- package/dist/components/rate/rate.js +83 -72
- package/dist/components/scroll-area/scroll-area.css +1 -1
- package/dist/components/scroll-area/scroll-area.js +294 -222
- package/dist/components/select/mobile-select.js +6 -3
- package/dist/components/select/select-model.js +2 -2
- package/dist/components/select/select.js +78 -39
- package/dist/components/select/use-select-selection.d.ts +1 -1
- package/dist/components/select/use-select-selection.js +91 -84
- package/dist/components/slider/slider.d.ts +2 -2
- package/dist/components/slider/slider.js +13 -2
- package/dist/components/sonner/sonner.js +2 -2
- package/dist/components/splitter/splitter.css +1 -0
- package/dist/components/splitter/splitter.js +152 -126
- package/dist/components/statistic/statistic.js +84 -78
- package/dist/components/steps/steps.js +1 -1
- package/dist/components/switch/switch.js +45 -39
- package/dist/components/table/table.js +5 -1
- package/dist/components/table/use-table-data.js +2 -2
- package/dist/components/time-picker/time-picker.js +31 -1
- package/dist/components/tooltip/tooltip.js +237 -99
- package/dist/components/tree/tree.js +31 -3
- package/dist/components/tree-select/tree-select.js +1 -1
- package/dist/components/upload/upload.js +69 -42
- package/dist/locales/ar-EG.js +2 -0
- package/dist/locales/de-DE.js +2 -0
- package/dist/locales/en-US.js +2 -0
- package/dist/locales/es-ES.js +2 -0
- package/dist/locales/fr-FR.js +2 -0
- package/dist/locales/hi-IN.js +2 -0
- package/dist/locales/id-ID.js +2 -0
- package/dist/locales/it-IT.js +2 -0
- package/dist/locales/ja-JP.js +2 -0
- package/dist/locales/ko-KR.js +2 -0
- package/dist/locales/pt-BR.js +2 -0
- package/dist/locales/ru-RU.js +2 -0
- package/dist/locales/th-TH.js +2 -0
- package/dist/locales/tr-TR.js +2 -0
- package/dist/locales/types.d.ts +2 -0
- package/dist/locales/vi-VN.js +2 -0
- package/dist/locales/zh-CN.js +2 -0
- package/dist/locales/zh-TW.js +2 -0
- package/dist/number-input/cursor.js +20 -8
- package/dist/number-input/format.js +13 -5
- package/dist/number-input/use-number-input.js +166 -318
- package/dist/number-input/validate.d.ts +1 -0
- package/dist/number-input/validate.js +1 -1
- package/dist/provider/tao-provider.d.ts +2 -2
- package/dist/provider/tao-provider.js +49 -49
- package/dist/utils/composed-parent.d.ts +1 -0
- package/dist/utils/composed-parent.js +7 -0
- package/dist/utils/portal.d.ts +5 -0
- package/dist/utils/portal.js +7 -1
- package/dist/utils/refs.d.ts +3 -1
- package/dist/utils/refs.js +25 -1
- package/package.json +1 -1
|
@@ -322,7 +322,7 @@ function gridVariables(grid) {
|
|
|
322
322
|
return result;
|
|
323
323
|
}
|
|
324
324
|
function ListRoot(t0, ref) {
|
|
325
|
-
const $ = c(
|
|
325
|
+
const $ = c(106);
|
|
326
326
|
let children;
|
|
327
327
|
let className;
|
|
328
328
|
let classNames;
|
|
@@ -425,27 +425,28 @@ function ListRoot(t0, ref) {
|
|
|
425
425
|
if (pagination && void 0 === paging.current && page !== current) setPage(current);
|
|
426
426
|
const start = (current - 1) * resolvedPageSize;
|
|
427
427
|
let t9;
|
|
428
|
-
if ($[28] !== dataSource || $[29] !== pagination || $[30] !== resolvedPageSize || $[31] !== start) {
|
|
429
|
-
t9 = pagination && dataSource.length
|
|
428
|
+
if ($[28] !== dataSource || $[29] !== pagination || $[30] !== resolvedPageSize || $[31] !== start || $[32] !== total) {
|
|
429
|
+
t9 = pagination && total <= dataSource.length ? dataSource.slice(start, start + resolvedPageSize) : dataSource;
|
|
430
430
|
$[28] = dataSource;
|
|
431
431
|
$[29] = pagination;
|
|
432
432
|
$[30] = resolvedPageSize;
|
|
433
433
|
$[31] = start;
|
|
434
|
-
$[32] =
|
|
435
|
-
|
|
434
|
+
$[32] = total;
|
|
435
|
+
$[33] = t9;
|
|
436
|
+
} else t9 = $[33];
|
|
436
437
|
const data = t9;
|
|
437
438
|
let t10;
|
|
438
|
-
if ($[
|
|
439
|
+
if ($[34] !== loading) {
|
|
439
440
|
t10 = "boolean" == typeof loading ? {
|
|
440
441
|
spinning: loading
|
|
441
442
|
} : loading;
|
|
442
|
-
$[
|
|
443
|
-
$[
|
|
444
|
-
} else t10 = $[
|
|
443
|
+
$[34] = loading;
|
|
444
|
+
$[35] = t10;
|
|
445
|
+
} else t10 = $[35];
|
|
445
446
|
const spinner = t10;
|
|
446
447
|
const isLoading = spinner.spinning ?? "object" == typeof loading;
|
|
447
448
|
let t11;
|
|
448
|
-
if ($[
|
|
449
|
+
if ($[36] !== classNames?.pagination || $[37] !== current || $[38] !== pagination || $[39] !== paging || $[40] !== resolvedPageSize || $[41] !== styles?.pagination || $[42] !== total) {
|
|
449
450
|
t11 = pagination && !(paging.hideOnSinglePage && total <= resolvedPageSize) ? /*#__PURE__*/ jsx("div", {
|
|
450
451
|
"data-tao-list-pagination": "",
|
|
451
452
|
"data-tao-align": paging.align ?? "end",
|
|
@@ -464,18 +465,18 @@ function ListRoot(t0, ref) {
|
|
|
464
465
|
}
|
|
465
466
|
})
|
|
466
467
|
}) : null;
|
|
467
|
-
$[
|
|
468
|
-
$[
|
|
469
|
-
$[
|
|
470
|
-
$[
|
|
471
|
-
$[
|
|
472
|
-
$[
|
|
473
|
-
$[
|
|
474
|
-
$[
|
|
475
|
-
} else t11 = $[
|
|
468
|
+
$[36] = classNames?.pagination;
|
|
469
|
+
$[37] = current;
|
|
470
|
+
$[38] = pagination;
|
|
471
|
+
$[39] = paging;
|
|
472
|
+
$[40] = resolvedPageSize;
|
|
473
|
+
$[41] = styles?.pagination;
|
|
474
|
+
$[42] = total;
|
|
475
|
+
$[43] = t11;
|
|
476
|
+
} else t11 = $[43];
|
|
476
477
|
const paginationNode = t11;
|
|
477
478
|
let t12;
|
|
478
|
-
if ($[
|
|
479
|
+
if ($[44] !== children || $[45] !== data || $[46] !== renderItem || $[47] !== rowKey) {
|
|
479
480
|
t12 = data.length ? data.map((value, index)=>{
|
|
480
481
|
const rendered = renderItem?.(value, index);
|
|
481
482
|
const configuredKey = "function" == typeof rowKey ? rowKey(value) : null != rowKey ? value[rowKey] : void 0;
|
|
@@ -484,74 +485,74 @@ function ListRoot(t0, ref) {
|
|
|
484
485
|
children: rendered
|
|
485
486
|
}, key);
|
|
486
487
|
}) : children;
|
|
487
|
-
$[
|
|
488
|
-
$[
|
|
489
|
-
$[
|
|
490
|
-
$[
|
|
491
|
-
$[
|
|
492
|
-
} else t12 = $[
|
|
488
|
+
$[44] = children;
|
|
489
|
+
$[45] = data;
|
|
490
|
+
$[46] = renderItem;
|
|
491
|
+
$[47] = rowKey;
|
|
492
|
+
$[48] = t12;
|
|
493
|
+
} else t12 = $[48];
|
|
493
494
|
const content = t12;
|
|
494
495
|
let t13;
|
|
495
|
-
if ($[
|
|
496
|
+
if ($[49] !== grid || $[50] !== itemLayout) {
|
|
496
497
|
t13 = {
|
|
497
498
|
grid,
|
|
498
499
|
itemLayout
|
|
499
500
|
};
|
|
500
|
-
$[
|
|
501
|
-
$[
|
|
502
|
-
$[
|
|
503
|
-
} else t13 = $[
|
|
501
|
+
$[49] = grid;
|
|
502
|
+
$[50] = itemLayout;
|
|
503
|
+
$[51] = t13;
|
|
504
|
+
} else t13 = $[51];
|
|
504
505
|
const t14 = "default" === size ? "medium" : size ?? config.size;
|
|
505
506
|
const t15 = bordered ? "" : void 0;
|
|
506
507
|
const t16 = split ? "" : void 0;
|
|
507
508
|
const t17 = grid ? "" : void 0;
|
|
508
509
|
const t18 = classNames?.root;
|
|
509
510
|
let t19;
|
|
510
|
-
if ($[
|
|
511
|
+
if ($[52] !== className || $[53] !== prefixCls || $[54] !== rootClassName || $[55] !== t18) {
|
|
511
512
|
t19 = cx(prefixCls, t18, rootClassName, className);
|
|
512
|
-
$[
|
|
513
|
-
$[
|
|
514
|
-
$[
|
|
515
|
-
$[
|
|
516
|
-
$[
|
|
517
|
-
} else t19 = $[
|
|
513
|
+
$[52] = className;
|
|
514
|
+
$[53] = prefixCls;
|
|
515
|
+
$[54] = rootClassName;
|
|
516
|
+
$[55] = t18;
|
|
517
|
+
$[56] = t19;
|
|
518
|
+
} else t19 = $[56];
|
|
518
519
|
let t20;
|
|
519
|
-
if ($[
|
|
520
|
+
if ($[57] !== grid) {
|
|
520
521
|
t20 = gridVariables(grid);
|
|
521
|
-
$[
|
|
522
|
-
$[
|
|
523
|
-
} else t20 = $[
|
|
522
|
+
$[57] = grid;
|
|
523
|
+
$[58] = t20;
|
|
524
|
+
} else t20 = $[58];
|
|
524
525
|
const t21 = styles?.root;
|
|
525
526
|
let t22;
|
|
526
|
-
if ($[
|
|
527
|
+
if ($[59] !== style || $[60] !== t20 || $[61] !== t21) {
|
|
527
528
|
t22 = {
|
|
528
529
|
...t20,
|
|
529
530
|
...t21,
|
|
530
531
|
...style
|
|
531
532
|
};
|
|
532
|
-
$[
|
|
533
|
-
$[
|
|
534
|
-
$[
|
|
535
|
-
$[
|
|
536
|
-
} else t22 = $[
|
|
533
|
+
$[59] = style;
|
|
534
|
+
$[60] = t20;
|
|
535
|
+
$[61] = t21;
|
|
536
|
+
$[62] = t22;
|
|
537
|
+
} else t22 = $[62];
|
|
537
538
|
const t23 = ("top" === paging.position || "both" === paging.position) && paginationNode;
|
|
538
539
|
let t24;
|
|
539
|
-
if ($[
|
|
540
|
+
if ($[63] !== classNames?.header || $[64] !== header || $[65] !== styles?.header) {
|
|
540
541
|
t24 = null != header && /*#__PURE__*/ jsx("div", {
|
|
541
542
|
"data-tao-list-header": "",
|
|
542
543
|
className: classNames?.header,
|
|
543
544
|
style: styles?.header,
|
|
544
545
|
children: header
|
|
545
546
|
});
|
|
546
|
-
$[
|
|
547
|
-
$[
|
|
548
|
-
$[
|
|
549
|
-
$[
|
|
550
|
-
} else t24 = $[
|
|
547
|
+
$[63] = classNames?.header;
|
|
548
|
+
$[64] = header;
|
|
549
|
+
$[65] = styles?.header;
|
|
550
|
+
$[66] = t24;
|
|
551
|
+
} else t24 = $[66];
|
|
551
552
|
const t25 = classNames?.items;
|
|
552
553
|
const t26 = styles?.items;
|
|
553
554
|
let t27;
|
|
554
|
-
if ($[
|
|
555
|
+
if ($[67] !== children || $[68] !== classNames?.empty || $[69] !== content || $[70] !== data.length || $[71] !== isLoading || $[72] !== locale?.emptyText || $[73] !== styles?.empty) {
|
|
555
556
|
t27 = data.length || Children.toArray(children).length ? content : isLoading ? /*#__PURE__*/ jsx("li", {
|
|
556
557
|
"data-tao-list-loading": ""
|
|
557
558
|
}) : /*#__PURE__*/ jsx("li", {
|
|
@@ -562,56 +563,56 @@ function ListRoot(t0, ref) {
|
|
|
562
563
|
image: Empty.PRESENTED_IMAGE_SIMPLE
|
|
563
564
|
})
|
|
564
565
|
});
|
|
565
|
-
$[
|
|
566
|
-
$[
|
|
567
|
-
$[
|
|
568
|
-
$[
|
|
569
|
-
$[
|
|
570
|
-
$[
|
|
571
|
-
$[
|
|
572
|
-
$[
|
|
573
|
-
} else t27 = $[
|
|
566
|
+
$[67] = children;
|
|
567
|
+
$[68] = classNames?.empty;
|
|
568
|
+
$[69] = content;
|
|
569
|
+
$[70] = data.length;
|
|
570
|
+
$[71] = isLoading;
|
|
571
|
+
$[72] = locale?.emptyText;
|
|
572
|
+
$[73] = styles?.empty;
|
|
573
|
+
$[74] = t27;
|
|
574
|
+
} else t27 = $[74];
|
|
574
575
|
let t28;
|
|
575
|
-
if ($[
|
|
576
|
+
if ($[75] !== t25 || $[76] !== t26 || $[77] !== t27) {
|
|
576
577
|
t28 = /*#__PURE__*/ jsx("ul", {
|
|
577
578
|
"data-tao-list-items": "",
|
|
578
579
|
className: t25,
|
|
579
580
|
style: t26,
|
|
580
581
|
children: t27
|
|
581
582
|
});
|
|
582
|
-
$[
|
|
583
|
-
$[
|
|
584
|
-
$[
|
|
585
|
-
$[
|
|
586
|
-
} else t28 = $[
|
|
583
|
+
$[75] = t25;
|
|
584
|
+
$[76] = t26;
|
|
585
|
+
$[77] = t27;
|
|
586
|
+
$[78] = t28;
|
|
587
|
+
} else t28 = $[78];
|
|
587
588
|
let t29;
|
|
588
|
-
if ($[
|
|
589
|
+
if ($[79] !== isLoading || $[80] !== spinner || $[81] !== t28) {
|
|
589
590
|
t29 = /*#__PURE__*/ jsx(Spinner, {
|
|
590
591
|
...spinner,
|
|
591
592
|
spinning: isLoading,
|
|
592
593
|
children: t28
|
|
593
594
|
});
|
|
594
|
-
$[
|
|
595
|
-
$[
|
|
596
|
-
$[
|
|
597
|
-
$[
|
|
598
|
-
} else t29 = $[
|
|
595
|
+
$[79] = isLoading;
|
|
596
|
+
$[80] = spinner;
|
|
597
|
+
$[81] = t28;
|
|
598
|
+
$[82] = t29;
|
|
599
|
+
} else t29 = $[82];
|
|
599
600
|
let t30;
|
|
600
|
-
if ($[
|
|
601
|
+
if ($[83] !== classNames?.footer || $[84] !== footer || $[85] !== styles?.footer) {
|
|
601
602
|
t30 = null != footer && /*#__PURE__*/ jsx("div", {
|
|
602
603
|
"data-tao-list-footer": "",
|
|
603
604
|
className: classNames?.footer,
|
|
604
605
|
style: styles?.footer,
|
|
605
606
|
children: footer
|
|
606
607
|
});
|
|
607
|
-
$[
|
|
608
|
-
$[
|
|
609
|
-
$[
|
|
610
|
-
$[
|
|
611
|
-
} else t30 = $[
|
|
608
|
+
$[83] = classNames?.footer;
|
|
609
|
+
$[84] = footer;
|
|
610
|
+
$[85] = styles?.footer;
|
|
611
|
+
$[86] = t30;
|
|
612
|
+
} else t30 = $[86];
|
|
612
613
|
const t31 = "top" !== paging.position && paginationNode;
|
|
613
614
|
let t32;
|
|
614
|
-
if ($[
|
|
615
|
+
if ($[87] !== extra || $[88] !== loadMore || $[89] !== ref || $[90] !== rest || $[91] !== t14 || $[92] !== t15 || $[93] !== t16 || $[94] !== t17 || $[95] !== t19 || $[96] !== t22 || $[97] !== t23 || $[98] !== t24 || $[99] !== t29 || $[100] !== t30 || $[101] !== t31) {
|
|
615
616
|
t32 = /*#__PURE__*/ jsxs("div", {
|
|
616
617
|
...rest,
|
|
617
618
|
ref: ref,
|
|
@@ -632,33 +633,33 @@ function ListRoot(t0, ref) {
|
|
|
632
633
|
t31
|
|
633
634
|
]
|
|
634
635
|
});
|
|
635
|
-
$[
|
|
636
|
-
$[
|
|
637
|
-
$[
|
|
638
|
-
$[
|
|
639
|
-
$[
|
|
640
|
-
$[
|
|
641
|
-
$[
|
|
642
|
-
$[
|
|
643
|
-
$[
|
|
644
|
-
$[
|
|
645
|
-
$[
|
|
646
|
-
$[
|
|
647
|
-
$[
|
|
648
|
-
$[
|
|
649
|
-
$[
|
|
650
|
-
$[
|
|
651
|
-
} else t32 = $[
|
|
636
|
+
$[87] = extra;
|
|
637
|
+
$[88] = loadMore;
|
|
638
|
+
$[89] = ref;
|
|
639
|
+
$[90] = rest;
|
|
640
|
+
$[91] = t14;
|
|
641
|
+
$[92] = t15;
|
|
642
|
+
$[93] = t16;
|
|
643
|
+
$[94] = t17;
|
|
644
|
+
$[95] = t19;
|
|
645
|
+
$[96] = t22;
|
|
646
|
+
$[97] = t23;
|
|
647
|
+
$[98] = t24;
|
|
648
|
+
$[99] = t29;
|
|
649
|
+
$[100] = t30;
|
|
650
|
+
$[101] = t31;
|
|
651
|
+
$[102] = t32;
|
|
652
|
+
} else t32 = $[102];
|
|
652
653
|
let t33;
|
|
653
|
-
if ($[
|
|
654
|
+
if ($[103] !== t13 || $[104] !== t32) {
|
|
654
655
|
t33 = /*#__PURE__*/ jsx(ListContext.Provider, {
|
|
655
656
|
value: t13,
|
|
656
657
|
children: t32
|
|
657
658
|
});
|
|
658
|
-
$[
|
|
659
|
-
$[
|
|
660
|
-
$[
|
|
661
|
-
} else t33 = $[
|
|
659
|
+
$[103] = t13;
|
|
660
|
+
$[104] = t32;
|
|
661
|
+
$[105] = t33;
|
|
662
|
+
} else t33 = $[105];
|
|
662
663
|
return t33;
|
|
663
664
|
}
|
|
664
665
|
const List = Object.assign(/*#__PURE__*/ forwardRef(ListRoot), {
|
|
@@ -286,7 +286,7 @@ function MasonryInner(props, ref) {
|
|
|
286
286
|
...slots?.item,
|
|
287
287
|
position: "absolute",
|
|
288
288
|
width,
|
|
289
|
-
height: item_1.height,
|
|
289
|
+
height: item_1.height ?? slots?.item?.height,
|
|
290
290
|
insetInlineStart: `calc((${width} + ${gap_0}) * ${column_1})`,
|
|
291
291
|
top: position_0?.top ?? 0
|
|
292
292
|
},
|
|
@@ -75,6 +75,7 @@ const MentionsComponent = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
|
75
75
|
ref: ref,
|
|
76
76
|
prefixCls: prefixCls,
|
|
77
77
|
disabled: disabled,
|
|
78
|
+
"aria-invalid": 'error' === status ? true : props['aria-invalid'],
|
|
78
79
|
onKeyDownCapture: (event)=>{
|
|
79
80
|
props.onKeyDownCapture?.(event);
|
|
80
81
|
if (!event.isPropagationStopped() && 'Enter' === event.key && (event.nativeEvent.isComposing || 229 === event.keyCode)) {
|
|
@@ -245,6 +245,7 @@ function renderMenuItems(items, ctx) {
|
|
|
245
245
|
disabled: item.disabled,
|
|
246
246
|
textValue: textValue,
|
|
247
247
|
checked: ctx.selectedKeys.includes(item.key),
|
|
248
|
+
onSelect: (event)=>event.preventDefault(),
|
|
248
249
|
onCheckedChange: ()=>{
|
|
249
250
|
ctx.onToggle(item.key);
|
|
250
251
|
ctx.onAction(item);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { c } from "react-compiler-runtime";
|
|
3
|
-
import { useLayoutEffect, useRef, useState } from "react";
|
|
3
|
+
import { useId, useLayoutEffect, useRef, useState } from "react";
|
|
4
4
|
import { cx } from "../../utils/semantic.js";
|
|
5
5
|
import { Button } from "../button/button.js";
|
|
6
6
|
import { StatusIcon } from "../status-icon/status-icon.js";
|
|
@@ -9,8 +9,10 @@ import { useTaoConfig } from "../../provider/tao-provider.js";
|
|
|
9
9
|
function isPromise(v) {
|
|
10
10
|
return !!v && 'function' == typeof v.then;
|
|
11
11
|
}
|
|
12
|
-
function ConfirmDialog({ onMount, open, close, type = 'confirm', icon, title, content, okText, cancelText, okCancel, okButtonProps, cancelButtonProps, onOk, onCancel, afterClose, centered = true, width = 416, maskClosable = false, closable
|
|
13
|
-
const { locale } = useTaoConfig();
|
|
12
|
+
function ConfirmDialog({ onMount, open, close, type = 'confirm', icon, title, content, okText, cancelText, okCancel, okButtonProps, cancelButtonProps, onOk, onCancel, afterClose, centered = true, width = 416, maskClosable = false, closable, keyboard = true, className, classNames, styles }) {
|
|
13
|
+
const { locale, disabled } = useTaoConfig();
|
|
14
|
+
const titleId = useId();
|
|
15
|
+
const contentId = useId();
|
|
14
16
|
const [loading, setLoading] = useState(false);
|
|
15
17
|
const [cancelLoading, setCancelLoading] = useState(false);
|
|
16
18
|
const cancelPending = useRef(false);
|
|
@@ -55,11 +57,13 @@ function ConfirmDialog({ onMount, open, close, type = 'confirm', icon, title, co
|
|
|
55
57
|
return /*#__PURE__*/ jsx(Modal, {
|
|
56
58
|
open: open,
|
|
57
59
|
title: null,
|
|
60
|
+
"aria-labelledby": null != title ? titleId : void 0,
|
|
61
|
+
"aria-describedby": null != content ? contentId : void 0,
|
|
58
62
|
onClose: handleCancel,
|
|
59
63
|
afterClose: afterClose,
|
|
60
64
|
width: width,
|
|
61
65
|
centered: centered,
|
|
62
|
-
closable: closable,
|
|
66
|
+
closable: closable ?? (!!(okButtonProps?.disabled ?? disabled) && (!showCancel || !!cancelButtonProps?.disabled)),
|
|
63
67
|
maskClosable: maskClosable,
|
|
64
68
|
keyboard: keyboard,
|
|
65
69
|
classNames: mergedClassNames,
|
|
@@ -69,6 +73,7 @@ function ConfirmDialog({ onMount, open, close, type = 'confirm', icon, title, co
|
|
|
69
73
|
showCancel && /*#__PURE__*/ jsx(Button, {
|
|
70
74
|
variant: "secondary",
|
|
71
75
|
...cancelButtonProps,
|
|
76
|
+
disabled: cancelButtonProps?.disabled ?? false,
|
|
72
77
|
loading: cancelLoading || cancelButtonProps?.loading,
|
|
73
78
|
onClick: (event)=>{
|
|
74
79
|
cancelButtonProps?.onClick?.(event);
|
|
@@ -101,10 +106,12 @@ function ConfirmDialog({ onMount, open, close, type = 'confirm', icon, title, co
|
|
|
101
106
|
"data-tao-modal-confirm-main": "",
|
|
102
107
|
children: [
|
|
103
108
|
null != title && /*#__PURE__*/ jsx("div", {
|
|
109
|
+
id: titleId,
|
|
104
110
|
"data-tao-modal-confirm-title": "",
|
|
105
111
|
children: title
|
|
106
112
|
}),
|
|
107
113
|
null != content && /*#__PURE__*/ jsx("div", {
|
|
114
|
+
id: contentId,
|
|
108
115
|
"data-tao-modal-confirm-content": "",
|
|
109
116
|
children: content
|
|
110
117
|
})
|