@tu-design/vue 0.3.0 → 0.4.1

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 (54) hide show
  1. package/README.md +74 -0
  2. package/dist/index.d.mts +641 -285
  3. package/dist/index.mjs +1544 -902
  4. package/dist/registry/vue/alert-dialog.json +22 -0
  5. package/dist/registry/vue/alert.json +1 -1
  6. package/dist/registry/vue/avatar-group.json +1 -1
  7. package/dist/registry/vue/avatar.json +1 -1
  8. package/dist/registry/vue/badge.json +1 -1
  9. package/dist/registry/vue/button.json +2 -2
  10. package/dist/registry/vue/calendar.json +3 -3
  11. package/dist/registry/vue/card.json +1 -1
  12. package/dist/registry/vue/cascader.json +5 -5
  13. package/dist/registry/vue/checkbox.json +1 -1
  14. package/dist/registry/vue/context-menu.json +22 -0
  15. package/dist/registry/vue/currency-input.json +2 -2
  16. package/dist/registry/vue/date-picker.json +2 -2
  17. package/dist/registry/vue/date-range-picker.json +3 -3
  18. package/dist/registry/vue/date-shared.json +16 -2
  19. package/dist/registry/vue/dialog.json +3 -3
  20. package/dist/registry/vue/drawer.json +22 -0
  21. package/dist/registry/vue/dropdown-menu.json +4 -4
  22. package/dist/registry/vue/empty.json +1 -1
  23. package/dist/registry/vue/form-render.json +35 -34
  24. package/dist/registry/vue/form.json +2 -2
  25. package/dist/registry/vue/input.json +1 -1
  26. package/dist/registry/vue/label.json +1 -1
  27. package/dist/registry/vue/month-picker.json +2 -2
  28. package/dist/registry/vue/number-input.json +2 -2
  29. package/dist/registry/vue/overlay-shared.json +20 -0
  30. package/dist/registry/vue/password-input.json +1 -1
  31. package/dist/registry/vue/pin-input.json +1 -1
  32. package/dist/registry/vue/popconfirm.json +22 -0
  33. package/dist/registry/vue/popover.json +3 -3
  34. package/dist/registry/vue/progress.json +1 -1
  35. package/dist/registry/vue/radio-group.json +1 -1
  36. package/dist/registry/vue/registry.json +31 -1
  37. package/dist/registry/vue/select.json +4 -4
  38. package/dist/registry/vue/separator.json +1 -1
  39. package/dist/registry/vue/skeleton.json +1 -1
  40. package/dist/registry/vue/slider.json +1 -1
  41. package/dist/registry/vue/slot.json +3 -3
  42. package/dist/registry/vue/spin.json +1 -1
  43. package/dist/registry/vue/switch.json +1 -1
  44. package/dist/registry/vue/table-render.json +39 -11
  45. package/dist/registry/vue/tabs.json +1 -1
  46. package/dist/registry/vue/textarea.json +1 -1
  47. package/dist/registry/vue/toast.json +3 -3
  48. package/dist/registry/vue/tokens.json +2 -1
  49. package/dist/registry/vue/tooltip.json +3 -3
  50. package/dist/registry/vue/tree-select.json +5 -5
  51. package/dist/registry/vue/tree-shared.json +13 -12
  52. package/dist/registry/vue/week-picker.json +2 -2
  53. package/dist/registry/vue/year-picker.json +2 -2
  54. package/package.json +3 -2
package/dist/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import { clsx } from "clsx";
2
2
  import { twMerge } from "tailwind-merge";
3
- import { Comment, Fragment, Teleport, Text, cloneVNode, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createSlots, createStaticVNode, createTextVNode, createVNode, defineComponent, guardReactiveProps, h, inject, isVNode, mergeModels, mergeProps, nextTick, normalizeClass, normalizeProps, normalizeStyle, onBeforeUnmount, onMounted, onUnmounted, openBlock, provide, reactive, readonly, ref, renderList, renderSlot, resolveComponent, resolveDynamicComponent, shallowRef, toDisplayString, toRef, toValue, unref, useAttrs, useId, useModel, useSlots, vModelText, watch, withCtx, withDirectives, withKeys, withModifiers } from "vue";
3
+ import { Comment, Fragment, Teleport, Text, cloneVNode, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createSlots, createStaticVNode, createTextVNode, createVNode, defineComponent, getCurrentInstance, guardReactiveProps, h, inject, isVNode, mergeModels, mergeProps, nextTick, normalizeClass, normalizeProps, normalizeStyle, onBeforeUnmount, onMounted, onUnmounted, openBlock, provide, reactive, readonly, ref, renderList, renderSlot, resolveComponent, resolveDynamicComponent, shallowRef, toDisplayString, toRef, toValue, unref, useAttrs, useId, useModel, useSlots, vModelText, watch, withCtx, withDirectives, withKeys, withModifiers } from "vue";
4
4
  import { cva } from "class-variance-authority";
5
5
  import { Checkbox } from "@ark-ui/vue/checkbox";
6
6
  import { Switch } from "@ark-ui/vue/switch";
@@ -23,6 +23,7 @@ import { getCoreRowModel, getExpandedRowModel, getPaginationRowModel, getSortedR
23
23
  import { Tabs } from "@ark-ui/vue/tabs";
24
24
  import { Progress } from "@ark-ui/vue/progress";
25
25
  import { Toast, Toaster, createToaster } from "@ark-ui/vue/toast";
26
+ import { Drawer } from "@ark-ui/vue/drawer";
26
27
  //#region src/lib/utils.ts
27
28
  function cn(...inputs) {
28
29
  return twMerge(clsx(inputs));
@@ -39,6 +40,7 @@ function cn(...inputs) {
39
40
  */
40
41
  const COMPONENT_NAMES = [
41
42
  "Alert",
43
+ "AlertDialog",
42
44
  "Avatar",
43
45
  "AvatarGroup",
44
46
  "Badge",
@@ -47,10 +49,12 @@ const COMPONENT_NAMES = [
47
49
  "Card",
48
50
  "Cascader",
49
51
  "Checkbox",
52
+ "ContextMenu",
50
53
  "CurrencyInput",
51
54
  "DatePicker",
52
55
  "DateRangePicker",
53
56
  "Dialog",
57
+ "Drawer",
54
58
  "DropdownMenu",
55
59
  "Empty",
56
60
  "Form",
@@ -68,6 +72,7 @@ const COMPONENT_NAMES = [
68
72
  "NumberInput",
69
73
  "PasswordInput",
70
74
  "PinInput",
75
+ "Popconfirm",
71
76
  "Popover",
72
77
  "Progress",
73
78
  "RadioGroup",
@@ -151,7 +156,7 @@ const Slot = defineComponent({
151
156
  });
152
157
  //#endregion
153
158
  //#region src/components/button/Button.vue
154
- const _sfc_main$4 = /*@__PURE__*/ defineComponent({
159
+ const _sfc_main$5 = /*@__PURE__*/ defineComponent({
155
160
  __name: "Button",
156
161
  props: {
157
162
  variant: {},
@@ -216,7 +221,7 @@ const FIELD_KEY = Symbol("tu-form-field");
216
221
  const FORM_ITEM_KEY = Symbol("tu-form-item");
217
222
  //#endregion
218
223
  //#region src/components/form/Form.vue
219
- const _sfc_main$15 = /*@__PURE__*/ defineComponent({
224
+ const _sfc_main$18 = /*@__PURE__*/ defineComponent({
220
225
  __name: "Form",
221
226
  props: {
222
227
  form: {},
@@ -240,7 +245,7 @@ const _sfc_main$15 = /*@__PURE__*/ defineComponent({
240
245
  * 把 id / aria-invalid / aria-describedby 合并到唯一子元素(cloneVNode)。
241
246
  * aria 全同步计算:description/message 的 presence 由 FormItem 的 refs 提供。
242
247
  */
243
- const _sfc_main$16 = defineComponent({
248
+ const _sfc_main$19 = defineComponent({
244
249
  name: "TuFormControl",
245
250
  props: { class: {
246
251
  type: String,
@@ -272,8 +277,8 @@ const _sfc_main$16 = defineComponent({
272
277
  });
273
278
  //#endregion
274
279
  //#region src/components/form/FormDescription.vue
275
- const _hoisted_1$29 = ["id"];
276
- const _sfc_main$17 = /*@__PURE__*/ defineComponent({
280
+ const _hoisted_1$32 = ["id"];
281
+ const _sfc_main$20 = /*@__PURE__*/ defineComponent({
277
282
  __name: "FormDescription",
278
283
  props: { class: {} },
279
284
  setup(__props) {
@@ -286,7 +291,7 @@ const _sfc_main$17 = /*@__PURE__*/ defineComponent({
286
291
  return openBlock(), createElementBlock("p", {
287
292
  id: unref(itemCtx)?.descriptionId,
288
293
  class: normalizeClass(unref(cn)("text-muted-foreground text-sm", props.class))
289
- }, [renderSlot(_ctx.$slots, "default")], 10, _hoisted_1$29);
294
+ }, [renderSlot(_ctx.$slots, "default")], 10, _hoisted_1$32);
290
295
  };
291
296
  }
292
297
  });
@@ -297,7 +302,7 @@ const _sfc_main$17 = /*@__PURE__*/ defineComponent({
297
302
  * field 实例只能在 form.Field 的插槽执行期取得(时序早于子组件 setup),
298
303
  * 故用 defineComponent + render function 在插槽回调中写入 ShallowRef。
299
304
  */
300
- const _sfc_main$18 = defineComponent({
305
+ const _sfc_main$21 = defineComponent({
301
306
  name: "TuFormField",
302
307
  props: {
303
308
  /** 字段名(TanStack 深层 key 的运行时形态) */
@@ -337,8 +342,8 @@ const _sfc_main$18 = defineComponent({
337
342
  });
338
343
  //#endregion
339
344
  //#region src/components/form/FormItem.vue
340
- const _hoisted_1$28 = ["data-invalid"];
341
- const _sfc_main$19 = /*@__PURE__*/ defineComponent({
345
+ const _hoisted_1$31 = ["data-invalid"];
346
+ const _sfc_main$22 = /*@__PURE__*/ defineComponent({
342
347
  __name: "FormItem",
343
348
  setup(__props) {
344
349
  const fieldCtx = inject(FIELD_KEY);
@@ -362,14 +367,14 @@ const _sfc_main$19 = /*@__PURE__*/ defineComponent({
362
367
  return openBlock(), createElementBlock("div", {
363
368
  class: normalizeClass(unref(cn)("group flex flex-col gap-1.5")),
364
369
  "data-invalid": isInvalid.value ? "" : void 0
365
- }, [renderSlot(_ctx.$slots, "default")], 10, _hoisted_1$28);
370
+ }, [renderSlot(_ctx.$slots, "default")], 10, _hoisted_1$31);
366
371
  };
367
372
  }
368
373
  });
369
374
  //#endregion
370
375
  //#region src/components/form/FormLabel.vue
371
- const _hoisted_1$27 = ["for", "data-invalid"];
372
- const _sfc_main$20 = /*@__PURE__*/ defineComponent({
376
+ const _hoisted_1$30 = ["for", "data-invalid"];
377
+ const _sfc_main$23 = /*@__PURE__*/ defineComponent({
373
378
  __name: "FormLabel",
374
379
  props: { class: {} },
375
380
  setup(__props) {
@@ -382,14 +387,14 @@ const _sfc_main$20 = /*@__PURE__*/ defineComponent({
382
387
  for: unref(itemCtx)?.controlId,
383
388
  "data-invalid": isInvalid.value ? "" : void 0,
384
389
  class: normalizeClass(unref(cn)("text-sm font-medium leading-none data-invalid:text-destructive", props.class))
385
- }, [renderSlot(_ctx.$slots, "default")], 10, _hoisted_1$27);
390
+ }, [renderSlot(_ctx.$slots, "default")], 10, _hoisted_1$30);
386
391
  };
387
392
  }
388
393
  });
389
394
  //#endregion
390
395
  //#region src/components/form/FormMessage.vue
391
- const _hoisted_1$26 = ["id"];
392
- const _sfc_main$21 = /*@__PURE__*/ defineComponent({
396
+ const _hoisted_1$29 = ["id"];
397
+ const _sfc_main$24 = /*@__PURE__*/ defineComponent({
393
398
  __name: "FormMessage",
394
399
  props: {
395
400
  message: {},
@@ -413,13 +418,13 @@ const _sfc_main$21 = /*@__PURE__*/ defineComponent({
413
418
  key: 0,
414
419
  id: unref(itemCtx)?.messageId,
415
420
  class: normalizeClass(unref(cn)("text-destructive text-sm", props.class))
416
- }, toDisplayString(errorText.value), 11, _hoisted_1$26)) : createCommentVNode("v-if", true);
421
+ }, toDisplayString(errorText.value), 11, _hoisted_1$29)) : createCommentVNode("v-if", true);
417
422
  };
418
423
  }
419
424
  });
420
425
  //#endregion
421
426
  //#region src/components/form/FormSubscribe.vue
422
- const _sfc_main$23 = /*@__PURE__*/ defineComponent({
427
+ const _sfc_main$26 = /*@__PURE__*/ defineComponent({
423
428
  __name: "FormSubscribe",
424
429
  setup(__props) {
425
430
  const form = inject(FORM_KEY, void 0);
@@ -443,7 +448,7 @@ const _sfc_main$23 = /*@__PURE__*/ defineComponent({
443
448
  * aria 接线(id/aria-invalid/aria-describedby)由 FormControl 的 cloneVNode 机制继承。
444
449
  * widget 调用发生在 FormField 插槽期,拿到 field 实例后组装 WidgetContext。
445
450
  */
446
- const _sfc_main$58 = defineComponent({
451
+ const _sfc_main$64 = defineComponent({
447
452
  name: "TuFormRenderField",
448
453
  props: {
449
454
  item: {
@@ -462,7 +467,7 @@ const _sfc_main$58 = defineComponent({
462
467
  }
463
468
  },
464
469
  setup(props) {
465
- return () => h(_sfc_main$18, {
470
+ return () => h(_sfc_main$21, {
466
471
  name: String(props.item.key),
467
472
  validators: props.item.validators
468
473
  }, { default: ({ field }) => {
@@ -470,22 +475,22 @@ const _sfc_main$58 = defineComponent({
470
475
  if (import.meta.env.DEV) console.warn("[tu-design] <FormRenderField> 未取得 field 上下文(FormRender 缺 definition/form?)");
471
476
  return null;
472
477
  }
473
- return h(_sfc_main$19, { class: props.item.class }, { default: () => [
474
- props.item.hideLabel ? null : h(_sfc_main$20, () => props.item.title),
475
- h(_sfc_main$16, () => props.widget({
478
+ return h(_sfc_main$22, { class: props.item.class }, { default: () => [
479
+ props.item.hideLabel ? null : h(_sfc_main$23, () => props.item.title),
480
+ h(_sfc_main$19, () => props.widget({
476
481
  field,
477
482
  item: props.item,
478
483
  values: props.values
479
484
  })),
480
- props.item.description ? h(_sfc_main$17, () => props.item.description) : null,
481
- h(_sfc_main$21)
485
+ props.item.description ? h(_sfc_main$20, () => props.item.description) : null,
486
+ h(_sfc_main$24)
482
487
  ] });
483
488
  } });
484
489
  }
485
490
  });
486
491
  //#endregion
487
492
  //#region src/components/checkbox/Checkbox.vue
488
- const _hoisted_1$25 = {
493
+ const _hoisted_1$28 = {
489
494
  key: 0,
490
495
  viewBox: "0 0 24 24",
491
496
  fill: "none",
@@ -494,7 +499,7 @@ const _hoisted_1$25 = {
494
499
  "stroke-linecap": "round",
495
500
  class: "size-3.5"
496
501
  };
497
- const _hoisted_2$14 = {
502
+ const _hoisted_2$18 = {
498
503
  key: 1,
499
504
  viewBox: "0 0 24 24",
500
505
  fill: "none",
@@ -504,7 +509,7 @@ const _hoisted_2$14 = {
504
509
  "stroke-linejoin": "round",
505
510
  class: "size-3.5"
506
511
  };
507
- const _sfc_main$8 = /*@__PURE__*/ defineComponent({
512
+ const _sfc_main$9 = /*@__PURE__*/ defineComponent({
508
513
  __name: "Checkbox",
509
514
  props: {
510
515
  checked: {
@@ -558,7 +563,7 @@ const _sfc_main$8 = /*@__PURE__*/ defineComponent({
558
563
  createVNode(unref(Checkbox).HiddenInput),
559
564
  createVNode(unref(Checkbox).Control, { class: "border-input data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground data-[state=checked]:border-primary focus-visible:border-ring focus-visible:ring-ring/50 peer size-4 shrink-0 rounded-[4px] border bg-transparent shadow-xs transition-shadow outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50" }, {
560
565
  default: withCtx(() => [createVNode(unref(Checkbox).Indicator, { class: "flex items-center justify-center text-current" }, {
561
- default: withCtx(() => [createCommentVNode(" 半选态(data-state=indeterminate)显示短横线,选中态显示对勾 "), isChecked.value === "indeterminate" ? (openBlock(), createElementBlock("svg", _hoisted_1$25, [..._cache[0] || (_cache[0] = [createElementVNode("path", { d: "M5 12h14" }, null, -1)])])) : (openBlock(), createElementBlock("svg", _hoisted_2$14, [..._cache[1] || (_cache[1] = [createElementVNode("path", { d: "M20 6 9 17l-5-5" }, null, -1)])]))]),
566
+ default: withCtx(() => [createCommentVNode(" 半选态(data-state=indeterminate)显示短横线,选中态显示对勾 "), isChecked.value === "indeterminate" ? (openBlock(), createElementBlock("svg", _hoisted_1$28, [..._cache[0] || (_cache[0] = [createElementVNode("path", { d: "M5 12h14" }, null, -1)])])) : (openBlock(), createElementBlock("svg", _hoisted_2$18, [..._cache[1] || (_cache[1] = [createElementVNode("path", { d: "M20 6 9 17l-5-5" }, null, -1)])]))]),
562
567
  _: 1
563
568
  })]),
564
569
  _: 1
@@ -584,7 +589,7 @@ const _sfc_main$8 = /*@__PURE__*/ defineComponent({
584
589
  });
585
590
  //#endregion
586
591
  //#region src/components/switch/Switch.vue
587
- const _sfc_main$38 = /*@__PURE__*/ defineComponent({
592
+ const _sfc_main$42 = /*@__PURE__*/ defineComponent({
588
593
  __name: "Switch",
589
594
  props: {
590
595
  checked: {
@@ -682,14 +687,14 @@ function bindField(field, spec) {
682
687
  * 单行布局倾向 hideLabel + label 经 item.title 展示由使用者决定。
683
688
  */
684
689
  function renderCheckboxItem(options = {}) {
685
- return (ctx) => h(_sfc_main$8, {
690
+ return (ctx) => h(_sfc_main$9, {
686
691
  ...options,
687
692
  ...bindField(ctx.field, CHECKED),
688
693
  ...ctx.item.componentProps
689
694
  });
690
695
  }
691
696
  function renderSwitchItem(options = {}) {
692
- return (ctx) => h(_sfc_main$38, {
697
+ return (ctx) => h(_sfc_main$42, {
693
698
  ...options,
694
699
  ...bindField(ctx.field, CHECKED),
695
700
  ...ctx.item.componentProps
@@ -743,14 +748,14 @@ function formatCurrency(value, valueUnit, labelUnit) {
743
748
  }
744
749
  //#endregion
745
750
  //#region src/components/currency-input/CurrencyInput.vue
746
- const _hoisted_1$24 = ["data-invalid"];
747
- const _hoisted_2$13 = [
751
+ const _hoisted_1$27 = ["data-invalid"];
752
+ const _hoisted_2$17 = [
748
753
  "value",
749
754
  "placeholder",
750
755
  "disabled",
751
756
  "aria-invalid"
752
757
  ];
753
- const _sfc_main$9 = /*@__PURE__*/ defineComponent({
758
+ const _sfc_main$11 = /*@__PURE__*/ defineComponent({
754
759
  inheritAttrs: false,
755
760
  __name: "CurrencyInput",
756
761
  props: {
@@ -819,10 +824,10 @@ const _sfc_main$9 = /*@__PURE__*/ defineComponent({
819
824
  "aria-invalid": props.invalid || void 0,
820
825
  class: "bg-transparent h-full w-full min-w-0 flex-1 px-3 text-sm tabular-nums outline-none disabled:cursor-not-allowed disabled:opacity-50",
821
826
  onInput
822
- }), null, 16, _hoisted_2$13), createElementVNode("div", {
827
+ }), null, 16, _hoisted_2$17), createElementVNode("div", {
823
828
  "aria-hidden": "true",
824
829
  class: normalizeClass(unref(cn)("border-input text-muted-foreground flex h-full shrink-0 items-center border-l bg-muted/40 px-3 text-sm", props.disabled && "opacity-50"))
825
- }, toDisplayString(props.labelUnit), 3)], 10, _hoisted_1$24);
830
+ }, toDisplayString(props.labelUnit), 3)], 10, _hoisted_1$27);
826
831
  };
827
832
  }
828
833
  });
@@ -939,7 +944,7 @@ const navBtnCls = "text-muted-foreground inline-flex size-8 items-center justify
939
944
  const viewTriggerCls = "hover:bg-accent inline-flex items-center gap-1 rounded-[3px] px-3 py-1.5 text-sm font-semibold text-foreground outline-none transition-colors disabled:pointer-events-none";
940
945
  const viewTitleCls = "text-sm font-semibold text-foreground";
941
946
  /** 年代范围文本(zag 无现成 part,由 focusedValue.year 推算):2026 → "2020 - 2029" */
942
- const _sfc_main$57 = /*@__PURE__*/ defineComponent({
947
+ const _sfc_main$63 = /*@__PURE__*/ defineComponent({
943
948
  __name: "CalendarNav",
944
949
  props: {
945
950
  /** 导航条服务的视图,决定中间内容形态:day=ViewTrigger(上钻)/ month=年份 / year=年代 */
@@ -954,7 +959,7 @@ view: {
954
959
  return `${start} - ${start + 9}`;
955
960
  }
956
961
  return (_ctx, _cache) => {
957
- return openBlock(), createBlock(unref(DatePicker).ViewControl, { class: normalizeClass(viewControlCls) }, {
962
+ return openBlock(), createBlock(unref(DatePicker).ViewControl, { class: normalizeClass(unref(cn)(viewControlCls, _ctx.$attrs.class)) }, {
958
963
  default: withCtx(() => [
959
964
  createVNode(unref(DatePicker).PrevTrigger, { class: normalizeClass(navBtnCls) }, {
960
965
  default: withCtx(() => [..._cache[0] || (_cache[0] = [createElementVNode("svg", {
@@ -1003,13 +1008,13 @@ view: {
1003
1008
  })
1004
1009
  ]),
1005
1010
  _: 1
1006
- });
1011
+ }, 8, ["class"]);
1007
1012
  };
1008
1013
  }
1009
1014
  });
1010
1015
  //#endregion
1011
1016
  //#region src/components/calendar/CalendarBody.vue
1012
- const _hoisted_1$23 = { class: "flex gap-6" };
1017
+ const _hoisted_1$26 = { class: "flex gap-6" };
1013
1018
  const dayTriggerCls = "group relative flex h-8 w-full cursor-pointer items-center justify-center outline-none data-[outside-view]:pointer-events-none data-[disabled]:pointer-events-none data-[in-range]:not-data-[outside-view]:not-data-[range-start]:not-data-[range-end]:bg-primary/10 data-[range-start]:rounded-l-[3px] data-[range-end]:rounded-r-[3px] data-[week-selected]:bg-primary data-[week-selected]:data-[outside-view]:bg-primary/40 data-[week-selected]:hover:data-[outside-view]:bg-primary/40 group-hover/week-row:not-data-[week-selected]:not-data-[outside-view]:bg-primary/10 group-hover/week-row:data-[outside-view]:not-data-[week-selected]:bg-primary/5";
1014
1019
  const dayDotCls = "flex size-6 items-center justify-center rounded-[3px] text-sm transition-colors group-hover:not-group-data-[week-selected]:bg-accent group-data-[focus]:not-group-data-[outside-view]:not-group-data-[week-selected]:bg-accent group-data-[selected]:not-group-data-[week-selected]:not-group-data-[outside-view]:bg-primary group-data-[selected]:not-group-data-[week-selected]:not-group-data-[outside-view]:font-medium group-data-[selected]:not-group-data-[week-selected]:not-group-data-[outside-view]:text-primary-foreground group-data-[week-selected]:bg-transparent group-data-[week-selected]:font-medium group-data-[week-selected]:text-primary-foreground group-data-[week-selected]:hover:bg-white/20 group-data-[today]:not-group-data-[selected]:text-primary group-data-[today]:not-group-data-[selected]:font-semibold group-data-[unavailable]:line-through group-data-[unavailable]:opacity-30 group-data-[disabled]:opacity-40 group-data-[outside-view]:opacity-30";
1015
1020
  const cellCls = "flex h-9 w-full items-center justify-center rounded-[3px] text-sm outline-none hover:bg-accent data-[selected]:bg-primary data-[selected]:font-medium data-[selected]:text-primary-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-40";
@@ -1018,7 +1023,7 @@ const headCellCls = "text-muted-foreground h-8 border-x-0! border-t-0! border-b
1018
1023
  const bodyCellCls = "border-0! p-0! text-center";
1019
1024
  const rowCls = "bg-transparent!";
1020
1025
  /** 表 i 的锚点月起点(zag getOffset({months: i-1}).visibleRange.start) */
1021
- const _sfc_main$56 = /*@__PURE__*/ defineComponent({
1026
+ const _sfc_main$62 = /*@__PURE__*/ defineComponent({
1022
1027
  __name: "CalendarBody",
1023
1028
  props: {
1024
1029
  mode: { default: "day" },
@@ -1059,9 +1064,9 @@ const _sfc_main$56 = /*@__PURE__*/ defineComponent({
1059
1064
  createVNode(unref(DatePicker).View, { view: "day" }, {
1060
1065
  default: withCtx(() => [
1061
1066
  createCommentVNode(" day 视图导航条在 View 内:viewProps=day → GOTO.NEXT=focusNextPage(翻月) "),
1062
- createVNode(_sfc_main$57, { view: "day" }),
1067
+ createVNode(_sfc_main$63, { view: "day" }),
1063
1068
  createVNode(unref(DatePicker).Context, null, {
1064
- default: withCtx((context) => [createElementVNode("div", _hoisted_1$23, [(openBlock(true), createElementBlock(Fragment, null, renderList(__props.numOfMonths, (i) => {
1069
+ default: withCtx((context) => [createElementVNode("div", _hoisted_1$26, [(openBlock(true), createElementBlock(Fragment, null, renderList(__props.numOfMonths, (i) => {
1065
1070
  return openBlock(), createBlock(unref(DatePicker).Table, {
1066
1071
  key: i,
1067
1072
  class: normalizeClass(tableCls)
@@ -1118,7 +1123,7 @@ const _sfc_main$56 = /*@__PURE__*/ defineComponent({
1118
1123
  createVNode(unref(DatePicker).View, { view: "month" }, {
1119
1124
  default: withCtx(() => [
1120
1125
  createCommentVNode(" 切换视图导航条也在 View 内:DatePicker 切月视图后 GOTO.NEXT=focusNextYear(修复 backlog) "),
1121
- createVNode(_sfc_main$57, { view: "month" }),
1126
+ createVNode(_sfc_main$63, { view: "month" }),
1122
1127
  createVNode(unref(DatePicker).Context, null, {
1123
1128
  default: withCtx((context) => [createVNode(unref(DatePicker).Table, { class: normalizeClass(tableCls) }, {
1124
1129
  default: withCtx(() => [createVNode(unref(DatePicker).TableBody, null, {
@@ -1156,7 +1161,7 @@ const _sfc_main$56 = /*@__PURE__*/ defineComponent({
1156
1161
  _: 1
1157
1162
  }),
1158
1163
  createVNode(unref(DatePicker).View, { view: "year" }, {
1159
- default: withCtx(() => [createVNode(_sfc_main$57, { view: "year" }), createVNode(unref(DatePicker).Context, null, {
1164
+ default: withCtx(() => [createVNode(_sfc_main$63, { view: "year" }), createVNode(unref(DatePicker).Context, null, {
1160
1165
  default: withCtx((context) => [createVNode(unref(DatePicker).Table, { class: normalizeClass(tableCls) }, {
1161
1166
  default: withCtx(() => [createVNode(unref(DatePicker).TableBody, null, {
1162
1167
  default: withCtx(() => [(openBlock(true), createElementBlock(Fragment, null, renderList(context.getYearsGrid({ columns: 4 }), (yearsRow, id) => {
@@ -1194,7 +1199,7 @@ const _sfc_main$56 = /*@__PURE__*/ defineComponent({
1194
1199
  }, {
1195
1200
  default: withCtx(() => [
1196
1201
  createCommentVNode(" 导航条必须在 View 子树内:Prev/NextTrigger 才能拿到 view=\"month\"(GOTO.NEXT=focusNextYear) "),
1197
- createVNode(_sfc_main$57, { view: "month" }),
1202
+ createVNode(_sfc_main$63, { view: "month" }),
1198
1203
  createVNode(unref(DatePicker).Context, null, {
1199
1204
  default: withCtx((context) => [createVNode(unref(DatePicker).Table, { class: normalizeClass(tableCls) }, {
1200
1205
  default: withCtx(() => [createVNode(unref(DatePicker).TableBody, null, {
@@ -1236,7 +1241,7 @@ const _sfc_main$56 = /*@__PURE__*/ defineComponent({
1236
1241
  }, {
1237
1242
  default: withCtx(() => [
1238
1243
  createCommentVNode(" 导航条必须在 View 子树内:Prev/NextTrigger 才能拿到 view=\"year\"(GOTO.NEXT=focusNextDecade) "),
1239
- createVNode(_sfc_main$57, { view: "year" }),
1244
+ createVNode(_sfc_main$63, { view: "year" }),
1240
1245
  createVNode(unref(DatePicker).Context, null, {
1241
1246
  default: withCtx((context) => [createVNode(unref(DatePicker).Table, { class: normalizeClass(tableCls) }, {
1242
1247
  default: withCtx(() => [createVNode(unref(DatePicker).TableBody, null, {
@@ -1275,11 +1280,7 @@ const _sfc_main$56 = /*@__PURE__*/ defineComponent({
1275
1280
  });
1276
1281
  //#endregion
1277
1282
  //#region src/components/calendar/Calendar.vue
1278
- const _hoisted_1$22 = {
1279
- key: 0,
1280
- class: "w-fit"
1281
- };
1282
- const _sfc_main$5 = /*@__PURE__*/ defineComponent({
1283
+ const _sfc_main$6 = /*@__PURE__*/ defineComponent({
1283
1284
  __name: "Calendar",
1284
1285
  props: {
1285
1286
  /** 视图形态:day=日网格(可切月/年);standalone 时 month/year 同时派生视图锁定 */
@@ -1347,7 +1348,10 @@ const _sfc_main$5 = /*@__PURE__*/ defineComponent({
1347
1348
  emit("update:modelValue", value);
1348
1349
  }
1349
1350
  return (_ctx, _cache) => {
1350
- return openBlock(), createElementBlock(Fragment, null, [createCommentVNode("\n standalone 独立形态:自建 Root。:open=\"true\" 恒开——独立卡片没有输入框/触发钮\n 去打开弹层,不恒开则 Content hidden 整卡不可见。沿用已验证的 Root > Content 直渲形态\n (无 Positioner:卡片非浮层,就地渲染)。\n 外层 div 承接 attrs(Ark Root 不透传 attrs,实测 class/id 会丢);w-fit 收缩包裹卡片宽度。\n "), standalone ? (openBlock(), createElementBlock("div", _hoisted_1$22, [createVNode(unref(DatePicker).Root, {
1351
+ return openBlock(), createElementBlock(Fragment, null, [createCommentVNode("\n standalone 独立形态:自建 Root。:open=\"true\" 恒开——独立卡片没有输入框/触发钮\n 去打开弹层,不恒开则 Content hidden 整卡不可见。沿用已验证的 Root > Content 直渲形态\n (无 Positioner:卡片非浮层,就地渲染)。\n 外层 div 承接 attrs(Ark Root 不透传 attrs,实测 class/id 会丢);w-fit 收缩包裹卡片宽度。\n "), standalone ? (openBlock(), createElementBlock("div", {
1352
+ key: 0,
1353
+ class: normalizeClass(unref(cn)("w-fit", _ctx.$attrs.class))
1354
+ }, [createVNode(unref(DatePicker).Root, {
1351
1355
  "model-value": rootValue.value,
1352
1356
  open: true,
1353
1357
  "num-of-months": props.numOfMonths,
@@ -1360,7 +1364,7 @@ const _sfc_main$5 = /*@__PURE__*/ defineComponent({
1360
1364
  "onUpdate:modelValue": handleValueUpdate
1361
1365
  }, {
1362
1366
  default: withCtx(() => [createVNode(unref(DatePicker).Content, null, {
1363
- default: withCtx(() => [createVNode(_sfc_main$56, {
1367
+ default: withCtx(() => [createVNode(_sfc_main$62, {
1364
1368
  mode: props.mode,
1365
1369
  "num-of-months": props.numOfMonths,
1366
1370
  week: props.week,
@@ -1383,7 +1387,7 @@ const _sfc_main$5 = /*@__PURE__*/ defineComponent({
1383
1387
  "max",
1384
1388
  "is-date-unavailable",
1385
1389
  "locale"
1386
- ])])) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [createCommentVNode(" embedded 内嵌形态:宿主 Picker 的 Root 供能,纯卡片内核 "), createVNode(_sfc_main$56, {
1390
+ ])], 2)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [createCommentVNode(" embedded 内嵌形态:宿主 Picker 的 Root 供能,纯卡片内核 "), createVNode(_sfc_main$62, {
1387
1391
  mode: props.mode,
1388
1392
  "num-of-months": props.numOfMonths,
1389
1393
  week: props.week,
@@ -1406,8 +1410,8 @@ var export_helper_default = (sfc, props) => {
1406
1410
  };
1407
1411
  //#endregion
1408
1412
  //#region src/components/date-shared/CalendarIcon.vue
1409
- const _sfc_main$55 = {};
1410
- const _hoisted_1$21 = {
1413
+ const _sfc_main$61 = {};
1414
+ const _hoisted_1$25 = {
1411
1415
  viewBox: "0 0 24 24",
1412
1416
  fill: "none",
1413
1417
  stroke: "currentColor",
@@ -1417,7 +1421,7 @@ const _hoisted_1$21 = {
1417
1421
  class: "size-4"
1418
1422
  };
1419
1423
  function _sfc_render$3(_ctx, _cache) {
1420
- return openBlock(), createElementBlock("svg", _hoisted_1$21, [..._cache[0] || (_cache[0] = [
1424
+ return openBlock(), createElementBlock("svg", _hoisted_1$25, [..._cache[0] || (_cache[0] = [
1421
1425
  createElementVNode("rect", {
1422
1426
  width: "18",
1423
1427
  height: "18",
@@ -1430,11 +1434,11 @@ function _sfc_render$3(_ctx, _cache) {
1430
1434
  createElementVNode("path", { d: "M3 10h18" }, null, -1)
1431
1435
  ])]);
1432
1436
  }
1433
- var CalendarIcon_default = /*#__PURE__*/ export_helper_default(_sfc_main$55, [["render", _sfc_render$3]]);
1437
+ var CalendarIcon_default = /*#__PURE__*/ export_helper_default(_sfc_main$61, [["render", _sfc_render$3]]);
1434
1438
  //#endregion
1435
1439
  //#region src/components/date-shared/ClearIcon.vue
1436
- const _sfc_main$54 = {};
1437
- const _hoisted_1$20 = {
1440
+ const _sfc_main$60 = {};
1441
+ const _hoisted_1$24 = {
1438
1442
  viewBox: "0 0 24 24",
1439
1443
  fill: "none",
1440
1444
  stroke: "currentColor",
@@ -1444,12 +1448,223 @@ const _hoisted_1$20 = {
1444
1448
  class: "size-4"
1445
1449
  };
1446
1450
  function _sfc_render$2(_ctx, _cache) {
1447
- return openBlock(), createElementBlock("svg", _hoisted_1$20, [..._cache[0] || (_cache[0] = [createElementVNode("path", { d: "M18 6 6 18" }, null, -1), createElementVNode("path", { d: "m6 6 12 12" }, null, -1)])]);
1451
+ return openBlock(), createElementBlock("svg", _hoisted_1$24, [..._cache[0] || (_cache[0] = [createElementVNode("path", { d: "M18 6 6 18" }, null, -1), createElementVNode("path", { d: "m6 6 12 12" }, null, -1)])]);
1452
+ }
1453
+ var ClearIcon_default$1 = /*#__PURE__*/ export_helper_default(_sfc_main$60, [["render", _sfc_render$2]]);
1454
+ //#endregion
1455
+ //#region src/components/date-shared/PickerShell.vue
1456
+ /** 单值日期族(Date/Month/Year/Week)共用外壳:触发器 + 清空/日历按钮 + 弹层容器。 */
1457
+ const _sfc_main$59 = /*@__PURE__*/ defineComponent({
1458
+ inheritAttrs: false,
1459
+ __name: "PickerShell",
1460
+ props: {
1461
+ modelValue: {
1462
+ type: Array,
1463
+ required: true
1464
+ },
1465
+ open: {
1466
+ type: Boolean,
1467
+ required: true
1468
+ },
1469
+ locale: {
1470
+ type: String,
1471
+ default: "zh-CN"
1472
+ },
1473
+ min: {
1474
+ type: Object,
1475
+ default: void 0
1476
+ },
1477
+ max: {
1478
+ type: Object,
1479
+ default: void 0
1480
+ },
1481
+ /** 不可选日期谓词(参数为 ark 的 DateValue) */
1482
+ isDateUnavailable: {
1483
+ type: Function,
1484
+ default: void 0
1485
+ },
1486
+ closeOnSelect: {
1487
+ type: Boolean,
1488
+ default: true
1489
+ },
1490
+ readOnly: {
1491
+ type: Boolean,
1492
+ default: void 0
1493
+ },
1494
+ disabled: {
1495
+ type: Boolean,
1496
+ default: void 0
1497
+ },
1498
+ invalid: {
1499
+ type: Boolean,
1500
+ default: void 0
1501
+ },
1502
+ placeholder: {
1503
+ type: String,
1504
+ default: "请选择"
1505
+ },
1506
+ /** 锁定视图粒度(Month/Year 选择器);undefined 走 Ark 默认 day 视图 */
1507
+ minView: {
1508
+ type: String,
1509
+ default: void 0
1510
+ },
1511
+ maxView: {
1512
+ type: String,
1513
+ default: void 0
1514
+ },
1515
+ format: {
1516
+ type: Function,
1517
+ required: true
1518
+ },
1519
+ parse: {
1520
+ type: Function,
1521
+ required: true
1522
+ },
1523
+ class: {
1524
+ type: String,
1525
+ default: void 0
1526
+ }
1527
+ },
1528
+ emits: ["update:modelValue", "update:open"],
1529
+ setup(__props, { emit: __emit }) {
1530
+ const props = __props;
1531
+ const emit = __emit;
1532
+ provide(CALENDAR_IN_PICKER, true);
1533
+ function openFromInput() {
1534
+ if (props.disabled || props.readOnly || props.open) return;
1535
+ emit("update:open", true);
1536
+ }
1537
+ return (_ctx, _cache) => {
1538
+ return openBlock(), createBlock(unref(DatePicker).Root, {
1539
+ "model-value": __props.modelValue,
1540
+ open: __props.open,
1541
+ locale: __props.locale,
1542
+ "min-view": __props.minView,
1543
+ "max-view": __props.maxView,
1544
+ min: __props.min,
1545
+ max: __props.max,
1546
+ "is-date-unavailable": __props.isDateUnavailable,
1547
+ "close-on-select": __props.closeOnSelect,
1548
+ "read-only": __props.readOnly,
1549
+ disabled: __props.disabled,
1550
+ format: __props.format,
1551
+ parse: __props.parse,
1552
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => emit("update:modelValue", $event)),
1553
+ "onUpdate:open": _cache[1] || (_cache[1] = ($event) => emit("update:open", $event))
1554
+ }, {
1555
+ default: withCtx(() => [
1556
+ createVNode(unref(DatePicker).Control, {
1557
+ class: normalizeClass(unref(cn)(unref(controlCls), props.class)),
1558
+ "data-invalid": __props.invalid ? "" : void 0
1559
+ }, {
1560
+ default: withCtx(() => [
1561
+ createVNode(unref(DatePicker).Input, mergeProps(_ctx.$attrs, {
1562
+ placeholder: __props.placeholder,
1563
+ "aria-invalid": __props.invalid || void 0,
1564
+ class: "bg-transparent h-full w-full min-w-0 flex-1 px-3 text-sm tabular-nums outline-none",
1565
+ onClick: openFromInput,
1566
+ onKeydown: withKeys(withModifiers(openFromInput, ["prevent"]), ["down"])
1567
+ }), null, 16, [
1568
+ "placeholder",
1569
+ "aria-invalid",
1570
+ "onKeydown"
1571
+ ]),
1572
+ createVNode(unref(DatePicker).ClearTrigger, { class: normalizeClass(unref(iconBtnCls)) }, {
1573
+ default: withCtx(() => [createVNode(ClearIcon_default$1)]),
1574
+ _: 1
1575
+ }, 8, ["class"]),
1576
+ createVNode(unref(DatePicker).Trigger, { class: normalizeClass(unref(iconBtnCls)) }, {
1577
+ default: withCtx(() => [createVNode(CalendarIcon_default)]),
1578
+ _: 1
1579
+ }, 8, ["class"])
1580
+ ]),
1581
+ _: 1
1582
+ }, 8, ["class", "data-invalid"]),
1583
+ createCommentVNode(" 弹层 Teleport 到 body:脱离表单 DOM——隔离外层 FormControl 的 group class\n (group-hover 会污染面板内全部格子),并消除 overflow 容器裁剪弹层的隐患。 "),
1584
+ (openBlock(), createBlock(Teleport, { to: "body" }, [createVNode(unref(DatePicker).Positioner, { class: "z-[var(--z-overlay)]" }, {
1585
+ default: withCtx(() => [createVNode(unref(DatePicker).Content, { class: normalizeClass(unref(cn)("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 relative z-[var(--z-overlay)] rounded-md border shadow-md")) }, {
1586
+ default: withCtx(() => [renderSlot(_ctx.$slots, "default")]),
1587
+ _: 3
1588
+ }, 8, ["class"])]),
1589
+ _: 3
1590
+ })]))
1591
+ ]),
1592
+ _: 3
1593
+ }, 8, [
1594
+ "model-value",
1595
+ "open",
1596
+ "locale",
1597
+ "min-view",
1598
+ "max-view",
1599
+ "min",
1600
+ "max",
1601
+ "is-date-unavailable",
1602
+ "close-on-select",
1603
+ "read-only",
1604
+ "disabled",
1605
+ "format",
1606
+ "parse"
1607
+ ]);
1608
+ };
1609
+ }
1610
+ });
1611
+ //#endregion
1612
+ //#region src/components/overlay-shared/useControlledBoolean.ts
1613
+ /**
1614
+ * 业务组件惯例:Ark Root 恒走受控,非受控语义由内部 ref 实现。
1615
+ * `controlled()` 返回 undefined 时用内部值,否则永远跟随外部 prop。
1616
+ */
1617
+ function useControlledBoolean(options) {
1618
+ const internal = ref(options.defaultValue?.() ?? false);
1619
+ const isOpen = computed(() => options.controlled() ?? internal.value);
1620
+ function setOpen(next) {
1621
+ internal.value = next;
1622
+ options.onChange?.(next);
1623
+ }
1624
+ return {
1625
+ isOpen,
1626
+ setOpen
1627
+ };
1628
+ }
1629
+ //#endregion
1630
+ //#region src/components/date-shared/usePickerBridge.ts
1631
+ /**
1632
+ * 单值日期选择器的受控桥接:值以内部 ref 为镜像、Root 恒走受控,
1633
+ * 开合复用 useControlledBoolean,openFromInput 统一「点击/↓ 输入框即开」。
1634
+ */
1635
+ function usePickerBridge(options) {
1636
+ const initial = options.defaultValue();
1637
+ const internalValue = ref(initial ? options.normalizeDefault?.(initial) ?? initial : null);
1638
+ const selected = computed(() => {
1639
+ const raw = options.modelValue() !== void 0 ? options.modelValue() : internalValue.value;
1640
+ return options.parse(raw ?? "");
1641
+ });
1642
+ const rootValue = computed(() => selected.value ? [selected.value] : []);
1643
+ const { isOpen, setOpen } = useControlledBoolean({
1644
+ controlled: options.open,
1645
+ defaultValue: options.defaultOpen,
1646
+ onChange: options.onUpdateOpen
1647
+ });
1648
+ function handleValueUpdate(next) {
1649
+ const value = next[0] ? options.toPublicValue(next[0]) : null;
1650
+ internalValue.value = value;
1651
+ options.onUpdateModelValue(value);
1652
+ }
1653
+ function openFromInput() {
1654
+ if (options.disabled() || options.readOnly() || isOpen.value) return;
1655
+ setOpen(true);
1656
+ }
1657
+ return {
1658
+ rootValue,
1659
+ isOpen,
1660
+ setOpen,
1661
+ openFromInput,
1662
+ handleValueUpdate
1663
+ };
1448
1664
  }
1449
- var ClearIcon_default$1 = /*#__PURE__*/ export_helper_default(_sfc_main$54, [["render", _sfc_render$2]]);
1450
1665
  //#endregion
1451
1666
  //#region src/components/date-picker/DatePicker.vue
1452
- const _sfc_main$10 = /*@__PURE__*/ defineComponent({
1667
+ const _sfc_main$12 = /*@__PURE__*/ defineComponent({
1453
1668
  inheritAttrs: false,
1454
1669
  __name: "DatePicker",
1455
1670
  props: {
@@ -1522,32 +1737,24 @@ const _sfc_main$10 = /*@__PURE__*/ defineComponent({
1522
1737
  const props = __props;
1523
1738
  const emit = __emit;
1524
1739
  provide(CALENDAR_IN_PICKER, true);
1525
- const internalValue = ref(props.defaultValue ?? null);
1526
- const selected = computed(() => {
1527
- return parseIsoDate((props.modelValue !== void 0 ? props.modelValue : internalValue.value) ?? "");
1740
+ const { rootValue, isOpen, setOpen, handleValueUpdate } = usePickerBridge({
1741
+ modelValue: () => props.modelValue,
1742
+ defaultValue: () => props.defaultValue,
1743
+ open: () => props.open,
1744
+ defaultOpen: () => props.defaultOpen,
1745
+ disabled: () => props.disabled,
1746
+ readOnly: () => props.readOnly,
1747
+ parse: parseIsoDate,
1748
+ toPublicValue: formatIsoDate,
1749
+ onUpdateModelValue: (value) => emit("update:modelValue", value),
1750
+ onUpdateOpen: (open) => emit("update:open", open)
1528
1751
  });
1529
- const rootValue = computed(() => selected.value ? [selected.value] : []);
1530
- const internalOpen = ref(props.defaultOpen);
1531
- const isOpen = computed(() => props.open ?? internalOpen.value);
1532
1752
  const minDate = computed(() => parseIsoDate(props.min ?? ""));
1533
1753
  const maxDate = computed(() => parseIsoDate(props.max ?? ""));
1534
- function handleValueUpdate(next) {
1535
- const value = next[0] ? formatIsoDate(next[0]) : null;
1536
- internalValue.value = value;
1537
- emit("update:modelValue", value);
1538
- }
1539
- function handleOpenUpdate(next) {
1540
- internalOpen.value = next;
1541
- emit("update:open", next);
1542
- }
1543
- function openFromInput() {
1544
- if (props.disabled || props.readOnly || isOpen.value) return;
1545
- handleOpenUpdate(true);
1546
- }
1547
1754
  return (_ctx, _cache) => {
1548
- return openBlock(), createBlock(unref(DatePicker).Root, {
1549
- "model-value": rootValue.value,
1550
- open: isOpen.value,
1755
+ return openBlock(), createBlock(_sfc_main$59, mergeProps(_ctx.$attrs, {
1756
+ "model-value": unref(rootValue),
1757
+ open: unref(isOpen),
1551
1758
  locale: props.locale,
1552
1759
  min: minDate.value,
1553
1760
  max: maxDate.value,
@@ -1555,50 +1762,17 @@ const _sfc_main$10 = /*@__PURE__*/ defineComponent({
1555
1762
  "close-on-select": props.closeOnSelect,
1556
1763
  "read-only": props.readOnly,
1557
1764
  disabled: props.disabled,
1765
+ invalid: props.invalid,
1766
+ placeholder: props.placeholder,
1767
+ class: props.class,
1558
1768
  format: unref(formatIsoDate),
1559
1769
  parse: unref(parseIsoDate),
1560
- "onUpdate:modelValue": handleValueUpdate,
1561
- "onUpdate:open": handleOpenUpdate
1562
- }, {
1563
- default: withCtx(() => [
1564
- createVNode(unref(DatePicker).Control, {
1565
- class: normalizeClass(unref(cn)(unref(controlCls), props.class)),
1566
- "data-invalid": props.invalid ? "" : void 0
1567
- }, {
1568
- default: withCtx(() => [
1569
- createVNode(unref(DatePicker).Input, mergeProps(_ctx.$attrs, {
1570
- placeholder: props.placeholder,
1571
- "aria-invalid": props.invalid || void 0,
1572
- class: "bg-transparent h-full w-full min-w-0 flex-1 px-3 text-sm tabular-nums outline-none",
1573
- onClick: openFromInput,
1574
- onKeydown: withKeys(withModifiers(openFromInput, ["prevent"]), ["down"])
1575
- }), null, 16, [
1576
- "placeholder",
1577
- "aria-invalid",
1578
- "onKeydown"
1579
- ]),
1580
- createVNode(unref(DatePicker).ClearTrigger, { class: normalizeClass(unref(iconBtnCls)) }, {
1581
- default: withCtx(() => [createVNode(ClearIcon_default$1)]),
1582
- _: 1
1583
- }, 8, ["class"]),
1584
- createVNode(unref(DatePicker).Trigger, { class: normalizeClass(unref(iconBtnCls)) }, {
1585
- default: withCtx(() => [createVNode(CalendarIcon_default)]),
1586
- _: 1
1587
- }, 8, ["class"])
1588
- ]),
1589
- _: 1
1590
- }, 8, ["class", "data-invalid"]),
1591
- createCommentVNode(" 弹层 Teleport 到 body:脱离表单 DOM——隔离外层 FormControl 的 group class\n (group-hover 会污染面板内全部格子),并消除 overflow 容器裁剪弹层的隐患。 "),
1592
- (openBlock(), createBlock(Teleport, { to: "body" }, [createVNode(unref(DatePicker).Positioner, { class: "z-50" }, {
1593
- default: withCtx(() => [createVNode(unref(DatePicker).Content, { class: normalizeClass(unref(cn)("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 relative z-50 rounded-md border shadow-md")) }, {
1594
- default: withCtx(() => [createVNode(unref(_sfc_main$5))]),
1595
- _: 1
1596
- }, 8, ["class"])]),
1597
- _: 1
1598
- })]))
1599
- ]),
1770
+ "onUpdate:modelValue": unref(handleValueUpdate),
1771
+ "onUpdate:open": unref(setOpen)
1772
+ }), {
1773
+ default: withCtx(() => [createVNode(unref(_sfc_main$6))]),
1600
1774
  _: 1
1601
- }, 8, [
1775
+ }, 16, [
1602
1776
  "model-value",
1603
1777
  "open",
1604
1778
  "locale",
@@ -1608,15 +1782,20 @@ const _sfc_main$10 = /*@__PURE__*/ defineComponent({
1608
1782
  "close-on-select",
1609
1783
  "read-only",
1610
1784
  "disabled",
1785
+ "invalid",
1786
+ "placeholder",
1787
+ "class",
1611
1788
  "format",
1612
- "parse"
1789
+ "parse",
1790
+ "onUpdate:modelValue",
1791
+ "onUpdate:open"
1613
1792
  ]);
1614
1793
  };
1615
1794
  }
1616
1795
  });
1617
1796
  //#endregion
1618
1797
  //#region src/components/date-range-picker/DateRangePicker.vue
1619
- const _sfc_main$11 = /*@__PURE__*/ defineComponent({
1798
+ const _sfc_main$13 = /*@__PURE__*/ defineComponent({
1620
1799
  inheritAttrs: false,
1621
1800
  __name: "DateRangePicker",
1622
1801
  props: {
@@ -1714,15 +1893,14 @@ const _sfc_main$11 = /*@__PURE__*/ defineComponent({
1714
1893
  if (props.modelValue === void 0 && props.defaultValue) internalValue.value = parseIsoRange(props.defaultValue) ?? [];
1715
1894
  const minDate = computed(() => parseIsoDate(props.min ?? ""));
1716
1895
  const maxDate = computed(() => parseIsoDate(props.max ?? ""));
1717
- const internalOpen = ref(props.defaultOpen);
1718
- const isOpen = computed(() => props.open ?? internalOpen.value);
1719
- function handleOpenUpdate(next) {
1720
- internalOpen.value = next;
1721
- emit("update:open", next);
1722
- }
1896
+ const { isOpen, setOpen } = useControlledBoolean({
1897
+ controlled: () => props.open,
1898
+ defaultValue: () => props.defaultOpen,
1899
+ onChange: (open) => emit("update:open", open)
1900
+ });
1723
1901
  function openFromInput() {
1724
1902
  if (props.disabled || props.readOnly || isOpen.value) return;
1725
- handleOpenUpdate(true);
1903
+ setOpen(true);
1726
1904
  }
1727
1905
  return (_ctx, _cache) => {
1728
1906
  return openBlock(), createElementBlock(Fragment, null, [createCommentVNode(" outside-day-selectable:zag getDayTableCellState 的 getUnitDuration 把 months 强制置 1,\n 多月视图下第二月起所有当月格被误判 outside-range 而禁用;此开关对冲(见 calendar/CalendarBody 注释) "), createVNode(unref(DatePicker).Root, {
@@ -1730,7 +1908,7 @@ const _sfc_main$11 = /*@__PURE__*/ defineComponent({
1730
1908
  "selection-mode": "range",
1731
1909
  "num-of-months": props.numOfMonths,
1732
1910
  "outside-day-selectable": "",
1733
- open: isOpen.value,
1911
+ open: unref(isOpen),
1734
1912
  locale: props.locale,
1735
1913
  min: minDate.value,
1736
1914
  max: maxDate.value,
@@ -1741,7 +1919,7 @@ const _sfc_main$11 = /*@__PURE__*/ defineComponent({
1741
1919
  format: unref(formatIsoDate),
1742
1920
  parse: unref(parseIsoDate),
1743
1921
  "onUpdate:modelValue": handleValueUpdate,
1744
- "onUpdate:open": handleOpenUpdate
1922
+ "onUpdate:open": unref(setOpen)
1745
1923
  }, {
1746
1924
  default: withCtx(() => [
1747
1925
  createVNode(unref(DatePicker).Control, {
@@ -1795,9 +1973,9 @@ const _sfc_main$11 = /*@__PURE__*/ defineComponent({
1795
1973
  _: 1
1796
1974
  }, 8, ["class", "data-invalid"]),
1797
1975
  createCommentVNode(" 弹层 Teleport 到 body:脱离表单 DOM——隔离外层 FormControl 的 group class\n (group-hover 会污染面板内全部格子),并消除 overflow 容器裁剪弹层的隐患。 "),
1798
- (openBlock(), createBlock(Teleport, { to: "body" }, [createVNode(unref(DatePicker).Positioner, { class: "z-50" }, {
1799
- default: withCtx(() => [createVNode(unref(DatePicker).Content, { class: normalizeClass(unref(cn)("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 relative z-50 rounded-md border shadow-md")) }, {
1800
- default: withCtx(() => [createVNode(unref(_sfc_main$5), { "num-of-months": props.numOfMonths }, null, 8, ["num-of-months"])]),
1976
+ (openBlock(), createBlock(Teleport, { to: "body" }, [createVNode(unref(DatePicker).Positioner, { class: "z-[var(--z-overlay)]" }, {
1977
+ default: withCtx(() => [createVNode(unref(DatePicker).Content, { class: normalizeClass(unref(cn)("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 relative z-[var(--z-overlay)] rounded-md border shadow-md")) }, {
1978
+ default: withCtx(() => [createVNode(unref(_sfc_main$6), { "num-of-months": props.numOfMonths }, null, 8, ["num-of-months"])]),
1801
1979
  _: 1
1802
1980
  }, 8, ["class"])]),
1803
1981
  _: 1
@@ -1816,14 +1994,15 @@ const _sfc_main$11 = /*@__PURE__*/ defineComponent({
1816
1994
  "read-only",
1817
1995
  "disabled",
1818
1996
  "format",
1819
- "parse"
1997
+ "parse",
1998
+ "onUpdate:open"
1820
1999
  ])], 2112);
1821
2000
  };
1822
2001
  }
1823
2002
  });
1824
2003
  //#endregion
1825
2004
  //#region src/components/month-picker/MonthPicker.vue
1826
- const _sfc_main$26 = /*@__PURE__*/ defineComponent({
2005
+ const _sfc_main$29 = /*@__PURE__*/ defineComponent({
1827
2006
  inheritAttrs: false,
1828
2007
  __name: "MonthPicker",
1829
2008
  props: {
@@ -1892,35 +2071,27 @@ const _sfc_main$26 = /*@__PURE__*/ defineComponent({
1892
2071
  const props = __props;
1893
2072
  const emit = __emit;
1894
2073
  provide(CALENDAR_IN_PICKER, true);
1895
- const internalValue = ref(props.defaultValue ?? null);
1896
- const selected = computed(() => {
1897
- return parseIsoMonth((props.modelValue !== void 0 ? props.modelValue : internalValue.value) ?? "");
2074
+ const { rootValue, isOpen, setOpen, handleValueUpdate } = usePickerBridge({
2075
+ modelValue: () => props.modelValue,
2076
+ defaultValue: () => props.defaultValue,
2077
+ open: () => props.open,
2078
+ defaultOpen: () => props.defaultOpen,
2079
+ disabled: () => props.disabled,
2080
+ readOnly: () => props.readOnly,
2081
+ parse: parseIsoMonth,
2082
+ toPublicValue: formatIsoMonth,
2083
+ onUpdateModelValue: (value) => emit("update:modelValue", value),
2084
+ onUpdateOpen: (open) => emit("update:open", open)
1898
2085
  });
1899
- const rootValue = computed(() => selected.value ? [selected.value] : []);
1900
- const internalOpen = ref(props.defaultOpen);
1901
- const isOpen = computed(() => props.open ?? internalOpen.value);
1902
2086
  const minDate = computed(() => parseIsoMonth(props.min ?? ""));
1903
2087
  const maxDate = computed(() => {
1904
2088
  const anchor = parseIsoMonth(props.max ?? "");
1905
2089
  return anchor ? anchor.set({ day: 31 }) : void 0;
1906
2090
  });
1907
- function handleValueUpdate(next) {
1908
- const value = next[0] ? formatIsoMonth(next[0]) : null;
1909
- internalValue.value = value;
1910
- emit("update:modelValue", value);
1911
- }
1912
- function handleOpenUpdate(next) {
1913
- internalOpen.value = next;
1914
- emit("update:open", next);
1915
- }
1916
- function openFromInput() {
1917
- if (props.disabled || props.readOnly || isOpen.value) return;
1918
- handleOpenUpdate(true);
1919
- }
1920
2091
  return (_ctx, _cache) => {
1921
- return openBlock(), createBlock(unref(DatePicker).Root, {
1922
- "model-value": rootValue.value,
1923
- open: isOpen.value,
2092
+ return openBlock(), createBlock(_sfc_main$59, mergeProps(_ctx.$attrs, {
2093
+ "model-value": unref(rootValue),
2094
+ open: unref(isOpen),
1924
2095
  locale: props.locale,
1925
2096
  "min-view": "month",
1926
2097
  "max-view": "month",
@@ -1929,50 +2100,17 @@ const _sfc_main$26 = /*@__PURE__*/ defineComponent({
1929
2100
  "close-on-select": props.closeOnSelect,
1930
2101
  "read-only": props.readOnly,
1931
2102
  disabled: props.disabled,
2103
+ invalid: props.invalid,
2104
+ placeholder: props.placeholder,
2105
+ class: props.class,
1932
2106
  format: unref(formatIsoMonth),
1933
2107
  parse: unref(parseIsoMonth),
1934
- "onUpdate:modelValue": handleValueUpdate,
1935
- "onUpdate:open": handleOpenUpdate
1936
- }, {
1937
- default: withCtx(() => [
1938
- createVNode(unref(DatePicker).Control, {
1939
- class: normalizeClass(unref(cn)(unref(controlCls), props.class)),
1940
- "data-invalid": props.invalid ? "" : void 0
1941
- }, {
1942
- default: withCtx(() => [
1943
- createVNode(unref(DatePicker).Input, mergeProps(_ctx.$attrs, {
1944
- placeholder: props.placeholder,
1945
- "aria-invalid": props.invalid || void 0,
1946
- class: "bg-transparent h-full w-full min-w-0 flex-1 px-3 text-sm tabular-nums outline-none",
1947
- onClick: openFromInput,
1948
- onKeydown: withKeys(withModifiers(openFromInput, ["prevent"]), ["down"])
1949
- }), null, 16, [
1950
- "placeholder",
1951
- "aria-invalid",
1952
- "onKeydown"
1953
- ]),
1954
- createVNode(unref(DatePicker).ClearTrigger, { class: normalizeClass(unref(iconBtnCls)) }, {
1955
- default: withCtx(() => [createVNode(ClearIcon_default$1)]),
1956
- _: 1
1957
- }, 8, ["class"]),
1958
- createVNode(unref(DatePicker).Trigger, { class: normalizeClass(unref(iconBtnCls)) }, {
1959
- default: withCtx(() => [createVNode(CalendarIcon_default)]),
1960
- _: 1
1961
- }, 8, ["class"])
1962
- ]),
1963
- _: 1
1964
- }, 8, ["class", "data-invalid"]),
1965
- createCommentVNode(" 弹层 Teleport 到 body:脱离表单 DOM——隔离外层 FormControl 的 group class\n (group-hover 会污染面板内全部格子),并消除 overflow 容器裁剪弹层的隐患。 "),
1966
- (openBlock(), createBlock(Teleport, { to: "body" }, [createVNode(unref(DatePicker).Positioner, { class: "z-50" }, {
1967
- default: withCtx(() => [createVNode(unref(DatePicker).Content, { class: normalizeClass(unref(cn)("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 relative z-50 rounded-md border shadow-md")) }, {
1968
- default: withCtx(() => [createVNode(unref(_sfc_main$5), { mode: "month" })]),
1969
- _: 1
1970
- }, 8, ["class"])]),
1971
- _: 1
1972
- })]))
1973
- ]),
2108
+ "onUpdate:modelValue": unref(handleValueUpdate),
2109
+ "onUpdate:open": unref(setOpen)
2110
+ }), {
2111
+ default: withCtx(() => [createVNode(unref(_sfc_main$6), { mode: "month" })]),
1974
2112
  _: 1
1975
- }, 8, [
2113
+ }, 16, [
1976
2114
  "model-value",
1977
2115
  "open",
1978
2116
  "locale",
@@ -1981,8 +2119,13 @@ const _sfc_main$26 = /*@__PURE__*/ defineComponent({
1981
2119
  "close-on-select",
1982
2120
  "read-only",
1983
2121
  "disabled",
2122
+ "invalid",
2123
+ "placeholder",
2124
+ "class",
1984
2125
  "format",
1985
- "parse"
2126
+ "parse",
2127
+ "onUpdate:modelValue",
2128
+ "onUpdate:open"
1986
2129
  ]);
1987
2130
  };
1988
2131
  }
@@ -1995,7 +2138,7 @@ function numberOrNull(details) {
1995
2138
  }
1996
2139
  //#endregion
1997
2140
  //#region src/components/number-input/NumberInput.vue
1998
- const _sfc_main$27 = /*@__PURE__*/ defineComponent({
2141
+ const _sfc_main$30 = /*@__PURE__*/ defineComponent({
1999
2142
  inheritAttrs: false,
2000
2143
  __name: "NumberInput",
2001
2144
  props: {
@@ -2104,8 +2247,8 @@ const _sfc_main$27 = /*@__PURE__*/ defineComponent({
2104
2247
  });
2105
2248
  //#endregion
2106
2249
  //#region src/components/password-input/PasswordInput.vue
2107
- const _hoisted_1$19 = ["data-invalid"];
2108
- const _hoisted_2$12 = [
2250
+ const _hoisted_1$23 = ["data-invalid"];
2251
+ const _hoisted_2$16 = [
2109
2252
  "type",
2110
2253
  "value",
2111
2254
  "autocomplete",
@@ -2113,7 +2256,7 @@ const _hoisted_2$12 = [
2113
2256
  "disabled",
2114
2257
  "aria-invalid"
2115
2258
  ];
2116
- const _hoisted_3$10 = [
2259
+ const _hoisted_3$12 = [
2117
2260
  "aria-label",
2118
2261
  "aria-pressed",
2119
2262
  "disabled"
@@ -2129,7 +2272,7 @@ const _hoisted_4$9 = {
2129
2272
  class: "size-4",
2130
2273
  "aria-hidden": "true"
2131
2274
  };
2132
- const _hoisted_5$7 = {
2275
+ const _hoisted_5$6 = {
2133
2276
  key: 1,
2134
2277
  viewBox: "0 0 24 24",
2135
2278
  fill: "none",
@@ -2140,7 +2283,7 @@ const _hoisted_5$7 = {
2140
2283
  class: "size-4",
2141
2284
  "aria-hidden": "true"
2142
2285
  };
2143
- const _sfc_main$28 = /*@__PURE__*/ defineComponent({
2286
+ const _sfc_main$31 = /*@__PURE__*/ defineComponent({
2144
2287
  inheritAttrs: false,
2145
2288
  __name: "PasswordInput",
2146
2289
  props: {
@@ -2206,7 +2349,7 @@ const _sfc_main$28 = /*@__PURE__*/ defineComponent({
2206
2349
  "aria-invalid": props.invalid || void 0,
2207
2350
  class: "bg-transparent h-full w-full min-w-0 flex-1 rounded-md px-3 text-sm outline-none disabled:cursor-not-allowed disabled:opacity-50",
2208
2351
  onInput
2209
- }), null, 16, _hoisted_2$12), createElementVNode("button", {
2352
+ }), null, 16, _hoisted_2$16), createElementVNode("button", {
2210
2353
  type: "button",
2211
2354
  "aria-label": isVisible.value ? "隐藏密码" : "显示密码",
2212
2355
  "aria-pressed": isVisible.value ? "true" : "false",
@@ -2223,18 +2366,18 @@ const _sfc_main$28 = /*@__PURE__*/ defineComponent({
2223
2366
  y1: "2",
2224
2367
  y2: "22"
2225
2368
  }, null, -1)
2226
- ])])) : (openBlock(), createElementBlock("svg", _hoisted_5$7, [..._cache[1] || (_cache[1] = [createElementVNode("path", { d: "M2 12s3-7 10-7 10 7 10 7-3 7-10 7-10-7-10-7Z" }, null, -1), createElementVNode("circle", {
2369
+ ])])) : (openBlock(), createElementBlock("svg", _hoisted_5$6, [..._cache[1] || (_cache[1] = [createElementVNode("path", { d: "M2 12s3-7 10-7 10 7 10 7-3 7-10 7-10-7-10-7Z" }, null, -1), createElementVNode("circle", {
2227
2370
  cx: "12",
2228
2371
  cy: "12",
2229
2372
  r: "3"
2230
- }, null, -1)])]))])], 8, _hoisted_3$10)], 10, _hoisted_1$19);
2373
+ }, null, -1)])]))])], 8, _hoisted_3$12)], 10, _hoisted_1$23);
2231
2374
  };
2232
2375
  }
2233
2376
  });
2234
2377
  //#endregion
2235
2378
  //#region src/components/textarea/Textarea.vue
2236
- const _hoisted_1$18 = ["aria-invalid"];
2237
- const _sfc_main$41 = /*@__PURE__*/ defineComponent({
2379
+ const _hoisted_1$22 = ["aria-invalid"];
2380
+ const _sfc_main$45 = /*@__PURE__*/ defineComponent({
2238
2381
  __name: "Textarea",
2239
2382
  props: /*@__PURE__*/ mergeModels({
2240
2383
  class: {},
@@ -2252,13 +2395,13 @@ const _sfc_main$41 = /*@__PURE__*/ defineComponent({
2252
2395
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => modelValue.value = $event),
2253
2396
  "aria-invalid": props.invalid ? "true" : void 0,
2254
2397
  class: normalizeClass(unref(cn)("flex field-sizing-content min-h-16 w-full rounded-md border border-input bg-transparent px-3 py-2 text-base shadow-sm transition-[color,box-shadow] outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:ring-destructive/20 aria-invalid:border-destructive md:text-sm", props.class))
2255
- }, null, 10, _hoisted_1$18)), [[vModelText, modelValue.value]]);
2398
+ }, null, 10, _hoisted_1$22)), [[vModelText, modelValue.value]]);
2256
2399
  };
2257
2400
  }
2258
2401
  });
2259
2402
  //#endregion
2260
2403
  //#region src/components/week-picker/WeekPicker.vue
2261
- const _sfc_main$45 = /*@__PURE__*/ defineComponent({
2404
+ const _sfc_main$49 = /*@__PURE__*/ defineComponent({
2262
2405
  inheritAttrs: false,
2263
2406
  __name: "WeekPicker",
2264
2407
  props: {
@@ -2332,30 +2475,26 @@ const _sfc_main$45 = /*@__PURE__*/ defineComponent({
2332
2475
  const props = __props;
2333
2476
  const emit = __emit;
2334
2477
  provide(CALENDAR_IN_PICKER, true);
2335
- const internalValue = ref(props.defaultValue ? formatIsoWeekStart(props.defaultValue) : null);
2336
- const selected = computed(() => {
2337
- return parseIsoDate((props.modelValue !== void 0 ? props.modelValue : internalValue.value) ?? "");
2338
- });
2339
- const rootValue = computed(() => selected.value ? [selected.value] : []);
2340
- const internalOpen = ref(props.defaultOpen);
2341
- const isOpen = computed(() => props.open ?? internalOpen.value);
2342
- const minDate = computed(() => parseIsoDate(props.min ?? ""));
2343
- const maxDate = computed(() => parseIsoDate(props.max ?? ""));
2344
- /** "yyyy-MM-dd" → 归一到所在周起始日的 ISO 串(非法输入原样返回 undefined) */
2478
+ /** "yyyy-MM-dd" → 归一到所在周起始日的 ISO 串(非法输入返回 undefined) */
2345
2479
  function formatIsoWeekStart(raw) {
2346
2480
  const date = parseIsoDate(raw);
2347
2481
  return date ? weekStartOf(date, props.locale).toString() : void 0;
2348
2482
  }
2349
- /** zag value → 公开值域:点任意日归一到该周起始日;清空 → null */
2350
- function handleValueUpdate(next) {
2351
- const value = next[0] ? formatIsoWeekStart(next[0].toString()) ?? null : null;
2352
- internalValue.value = value;
2353
- emit("update:modelValue", value);
2354
- }
2355
- function handleOpenUpdate(next) {
2356
- internalOpen.value = next;
2357
- emit("update:open", next);
2358
- }
2483
+ const { rootValue, isOpen, setOpen, handleValueUpdate } = usePickerBridge({
2484
+ modelValue: () => props.modelValue,
2485
+ defaultValue: () => props.defaultValue,
2486
+ open: () => props.open,
2487
+ defaultOpen: () => props.defaultOpen,
2488
+ disabled: () => props.disabled,
2489
+ readOnly: () => props.readOnly,
2490
+ parse: parseIsoDate,
2491
+ normalizeDefault: (raw) => formatIsoWeekStart(raw) ?? null,
2492
+ toPublicValue: (date) => formatIsoWeekStart(date.toString()) ?? null,
2493
+ onUpdateModelValue: (value) => emit("update:modelValue", value),
2494
+ onUpdateOpen: (open) => emit("update:open", open)
2495
+ });
2496
+ const minDate = computed(() => parseIsoDate(props.min ?? ""));
2497
+ const maxDate = computed(() => parseIsoDate(props.max ?? ""));
2359
2498
  function formatDate(date) {
2360
2499
  return formatIsoWeek(date, props.locale);
2361
2500
  }
@@ -2363,14 +2502,10 @@ const _sfc_main$45 = /*@__PURE__*/ defineComponent({
2363
2502
  const date = parseIsoDate(raw);
2364
2503
  return date ? weekStartOf(date, props.locale) : void 0;
2365
2504
  }
2366
- function openFromInput() {
2367
- if (props.disabled || props.readOnly || isOpen.value) return;
2368
- handleOpenUpdate(true);
2369
- }
2370
2505
  return (_ctx, _cache) => {
2371
- return openBlock(), createBlock(unref(DatePicker).Root, {
2372
- "model-value": rootValue.value,
2373
- open: isOpen.value,
2506
+ return openBlock(), createBlock(_sfc_main$59, mergeProps(_ctx.$attrs, {
2507
+ "model-value": unref(rootValue),
2508
+ open: unref(isOpen),
2374
2509
  locale: props.locale,
2375
2510
  min: minDate.value,
2376
2511
  max: maxDate.value,
@@ -2378,53 +2513,20 @@ const _sfc_main$45 = /*@__PURE__*/ defineComponent({
2378
2513
  "close-on-select": props.closeOnSelect,
2379
2514
  "read-only": props.readOnly,
2380
2515
  disabled: props.disabled,
2516
+ invalid: props.invalid,
2517
+ placeholder: props.placeholder,
2518
+ class: props.class,
2381
2519
  format: formatDate,
2382
2520
  parse: parseDate,
2383
- "onUpdate:modelValue": handleValueUpdate,
2384
- "onUpdate:open": handleOpenUpdate
2385
- }, {
2386
- default: withCtx(() => [
2387
- createVNode(unref(DatePicker).Control, {
2388
- class: normalizeClass(unref(cn)(unref(controlCls), props.class)),
2389
- "data-invalid": props.invalid ? "" : void 0
2390
- }, {
2391
- default: withCtx(() => [
2392
- createVNode(unref(DatePicker).Input, mergeProps(_ctx.$attrs, {
2393
- placeholder: props.placeholder,
2394
- "aria-invalid": props.invalid || void 0,
2395
- class: "bg-transparent h-full w-full min-w-0 flex-1 px-3 text-sm tabular-nums outline-none",
2396
- onClick: openFromInput,
2397
- onKeydown: withKeys(withModifiers(openFromInput, ["prevent"]), ["down"])
2398
- }), null, 16, [
2399
- "placeholder",
2400
- "aria-invalid",
2401
- "onKeydown"
2402
- ]),
2403
- createVNode(unref(DatePicker).ClearTrigger, { class: normalizeClass(unref(iconBtnCls)) }, {
2404
- default: withCtx(() => [createVNode(ClearIcon_default$1)]),
2405
- _: 1
2406
- }, 8, ["class"]),
2407
- createVNode(unref(DatePicker).Trigger, { class: normalizeClass(unref(iconBtnCls)) }, {
2408
- default: withCtx(() => [createVNode(CalendarIcon_default)]),
2409
- _: 1
2410
- }, 8, ["class"])
2411
- ]),
2412
- _: 1
2413
- }, 8, ["class", "data-invalid"]),
2414
- createCommentVNode(" 弹层 Teleport 到 body:脱离表单 DOM——隔离外层 FormControl 的 group class\n (group-hover 会污染面板内全部格子),并消除 overflow 容器裁剪弹层的隐患。 "),
2415
- (openBlock(), createBlock(Teleport, { to: "body" }, [createVNode(unref(DatePicker).Positioner, { class: "z-50" }, {
2416
- default: withCtx(() => [createVNode(unref(DatePicker).Content, { class: normalizeClass(unref(cn)("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 relative z-50 rounded-md border shadow-md")) }, {
2417
- default: withCtx(() => [createVNode(unref(_sfc_main$5), {
2418
- week: "",
2419
- locale: props.locale
2420
- }, null, 8, ["locale"])]),
2421
- _: 1
2422
- }, 8, ["class"])]),
2423
- _: 1
2424
- })]))
2425
- ]),
2521
+ "onUpdate:modelValue": unref(handleValueUpdate),
2522
+ "onUpdate:open": unref(setOpen)
2523
+ }), {
2524
+ default: withCtx(() => [createVNode(unref(_sfc_main$6), {
2525
+ week: "",
2526
+ locale: props.locale
2527
+ }, null, 8, ["locale"])]),
2426
2528
  _: 1
2427
- }, 8, [
2529
+ }, 16, [
2428
2530
  "model-value",
2429
2531
  "open",
2430
2532
  "locale",
@@ -2433,14 +2535,19 @@ const _sfc_main$45 = /*@__PURE__*/ defineComponent({
2433
2535
  "is-date-unavailable",
2434
2536
  "close-on-select",
2435
2537
  "read-only",
2436
- "disabled"
2538
+ "disabled",
2539
+ "invalid",
2540
+ "placeholder",
2541
+ "class",
2542
+ "onUpdate:modelValue",
2543
+ "onUpdate:open"
2437
2544
  ]);
2438
2545
  };
2439
2546
  }
2440
2547
  });
2441
2548
  //#endregion
2442
2549
  //#region src/components/year-picker/YearPicker.vue
2443
- const _sfc_main$46 = /*@__PURE__*/ defineComponent({
2550
+ const _sfc_main$50 = /*@__PURE__*/ defineComponent({
2444
2551
  inheritAttrs: false,
2445
2552
  __name: "YearPicker",
2446
2553
  props: {
@@ -2509,32 +2616,24 @@ const _sfc_main$46 = /*@__PURE__*/ defineComponent({
2509
2616
  const props = __props;
2510
2617
  const emit = __emit;
2511
2618
  provide(CALENDAR_IN_PICKER, true);
2512
- const internalValue = ref(props.defaultValue ?? null);
2513
- const selected = computed(() => {
2514
- return parseIsoYear((props.modelValue !== void 0 ? props.modelValue : internalValue.value) ?? "");
2619
+ const { rootValue, isOpen, setOpen, handleValueUpdate } = usePickerBridge({
2620
+ modelValue: () => props.modelValue,
2621
+ defaultValue: () => props.defaultValue,
2622
+ open: () => props.open,
2623
+ defaultOpen: () => props.defaultOpen,
2624
+ disabled: () => props.disabled,
2625
+ readOnly: () => props.readOnly,
2626
+ parse: parseIsoYear,
2627
+ toPublicValue: formatIsoYear,
2628
+ onUpdateModelValue: (value) => emit("update:modelValue", value),
2629
+ onUpdateOpen: (open) => emit("update:open", open)
2515
2630
  });
2516
- const rootValue = computed(() => selected.value ? [selected.value] : []);
2517
- const internalOpen = ref(props.defaultOpen);
2518
- const isOpen = computed(() => props.open ?? internalOpen.value);
2519
2631
  const minDate = computed(() => parseIsoYear(props.min ?? ""));
2520
2632
  const maxDate = computed(() => parseIsoYear(props.max ?? ""));
2521
- function handleValueUpdate(next) {
2522
- const value = next[0] ? formatIsoYear(next[0]) : null;
2523
- internalValue.value = value;
2524
- emit("update:modelValue", value);
2525
- }
2526
- function handleOpenUpdate(next) {
2527
- internalOpen.value = next;
2528
- emit("update:open", next);
2529
- }
2530
- function openFromInput() {
2531
- if (props.disabled || props.readOnly || isOpen.value) return;
2532
- handleOpenUpdate(true);
2533
- }
2534
2633
  return (_ctx, _cache) => {
2535
- return openBlock(), createBlock(unref(DatePicker).Root, {
2536
- "model-value": rootValue.value,
2537
- open: isOpen.value,
2634
+ return openBlock(), createBlock(_sfc_main$59, mergeProps(_ctx.$attrs, {
2635
+ "model-value": unref(rootValue),
2636
+ open: unref(isOpen),
2538
2637
  locale: props.locale,
2539
2638
  "min-view": "year",
2540
2639
  "max-view": "year",
@@ -2543,50 +2642,17 @@ const _sfc_main$46 = /*@__PURE__*/ defineComponent({
2543
2642
  "close-on-select": props.closeOnSelect,
2544
2643
  "read-only": props.readOnly,
2545
2644
  disabled: props.disabled,
2645
+ invalid: props.invalid,
2646
+ placeholder: props.placeholder,
2647
+ class: props.class,
2546
2648
  format: unref(formatIsoYear),
2547
2649
  parse: unref(parseIsoYear),
2548
- "onUpdate:modelValue": handleValueUpdate,
2549
- "onUpdate:open": handleOpenUpdate
2550
- }, {
2551
- default: withCtx(() => [
2552
- createVNode(unref(DatePicker).Control, {
2553
- class: normalizeClass(unref(cn)(unref(controlCls), props.class)),
2554
- "data-invalid": props.invalid ? "" : void 0
2555
- }, {
2556
- default: withCtx(() => [
2557
- createVNode(unref(DatePicker).Input, mergeProps(_ctx.$attrs, {
2558
- placeholder: props.placeholder,
2559
- "aria-invalid": props.invalid || void 0,
2560
- class: "bg-transparent h-full w-full min-w-0 flex-1 px-3 text-sm tabular-nums outline-none",
2561
- onClick: openFromInput,
2562
- onKeydown: withKeys(withModifiers(openFromInput, ["prevent"]), ["down"])
2563
- }), null, 16, [
2564
- "placeholder",
2565
- "aria-invalid",
2566
- "onKeydown"
2567
- ]),
2568
- createVNode(unref(DatePicker).ClearTrigger, { class: normalizeClass(unref(iconBtnCls)) }, {
2569
- default: withCtx(() => [createVNode(ClearIcon_default$1)]),
2570
- _: 1
2571
- }, 8, ["class"]),
2572
- createVNode(unref(DatePicker).Trigger, { class: normalizeClass(unref(iconBtnCls)) }, {
2573
- default: withCtx(() => [createVNode(CalendarIcon_default)]),
2574
- _: 1
2575
- }, 8, ["class"])
2576
- ]),
2577
- _: 1
2578
- }, 8, ["class", "data-invalid"]),
2579
- createCommentVNode(" 弹层 Teleport 到 body:脱离表单 DOM——隔离外层 FormControl 的 group class\n (group-hover 会污染面板内全部格子),并消除 overflow 容器裁剪弹层的隐患。 "),
2580
- (openBlock(), createBlock(Teleport, { to: "body" }, [createVNode(unref(DatePicker).Positioner, { class: "z-50" }, {
2581
- default: withCtx(() => [createVNode(unref(DatePicker).Content, { class: normalizeClass(unref(cn)("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 relative z-50 rounded-md border shadow-md")) }, {
2582
- default: withCtx(() => [createVNode(unref(_sfc_main$5), { mode: "year" })]),
2583
- _: 1
2584
- }, 8, ["class"])]),
2585
- _: 1
2586
- })]))
2587
- ]),
2650
+ "onUpdate:modelValue": unref(handleValueUpdate),
2651
+ "onUpdate:open": unref(setOpen)
2652
+ }), {
2653
+ default: withCtx(() => [createVNode(unref(_sfc_main$6), { mode: "year" })]),
2588
2654
  _: 1
2589
- }, 8, [
2655
+ }, 16, [
2590
2656
  "model-value",
2591
2657
  "open",
2592
2658
  "locale",
@@ -2595,8 +2661,13 @@ const _sfc_main$46 = /*@__PURE__*/ defineComponent({
2595
2661
  "close-on-select",
2596
2662
  "read-only",
2597
2663
  "disabled",
2664
+ "invalid",
2665
+ "placeholder",
2666
+ "class",
2598
2667
  "format",
2599
- "parse"
2668
+ "parse",
2669
+ "onUpdate:modelValue",
2670
+ "onUpdate:open"
2600
2671
  ]);
2601
2672
  };
2602
2673
  }
@@ -2610,7 +2681,7 @@ const _sfc_main$46 = /*@__PURE__*/ defineComponent({
2610
2681
  */
2611
2682
  /** password widget:密码输入(autoComplete 为组件真实 prop,直接派生透传) */
2612
2683
  function renderPasswordItem(options = {}) {
2613
- return (ctx) => h(_sfc_main$28, {
2684
+ return (ctx) => h(_sfc_main$31, {
2614
2685
  placeholder: ctx.item.placeholder,
2615
2686
  ...options,
2616
2687
  ...bindField(ctx.field, MODEL_VALUE),
@@ -2619,7 +2690,7 @@ function renderPasswordItem(options = {}) {
2619
2690
  }
2620
2691
  /** number widget:数值输入(modelValue: number|null) */
2621
2692
  function renderNumberItem(options = {}) {
2622
- return (ctx) => h(_sfc_main$27, {
2693
+ return (ctx) => h(_sfc_main$30, {
2623
2694
  ...options,
2624
2695
  ...bindField(ctx.field, MODEL_VALUE),
2625
2696
  ...ctx.item.componentProps
@@ -2627,7 +2698,7 @@ function renderNumberItem(options = {}) {
2627
2698
  }
2628
2699
  /** currency widget:金额输入(labelUnit/valueUnit 单位展示) */
2629
2700
  function renderCurrencyItem(options = {}) {
2630
- return (ctx) => h(_sfc_main$9, {
2701
+ return (ctx) => h(_sfc_main$11, {
2631
2702
  placeholder: ctx.item.placeholder,
2632
2703
  ...options,
2633
2704
  ...bindField(ctx.field, MODEL_VALUE),
@@ -2636,7 +2707,7 @@ function renderCurrencyItem(options = {}) {
2636
2707
  }
2637
2708
  /** textarea widget:多行文本(placeholder/rows 为原生 attr 透传) */
2638
2709
  function renderTextareaItem(options = {}) {
2639
- return (ctx) => h(_sfc_main$41, {
2710
+ return (ctx) => h(_sfc_main$45, {
2640
2711
  placeholder: ctx.item.placeholder,
2641
2712
  ...options,
2642
2713
  ...bindField(ctx.field, MODEL_VALUE),
@@ -2656,25 +2727,25 @@ function pickerRenderer(component, options) {
2656
2727
  });
2657
2728
  }
2658
2729
  function renderDatePickerItem(options = {}) {
2659
- return pickerRenderer(_sfc_main$10, options);
2730
+ return pickerRenderer(_sfc_main$12, options);
2660
2731
  }
2661
2732
  function renderMonthPickerItem(options = {}) {
2662
- return pickerRenderer(_sfc_main$26, options);
2733
+ return pickerRenderer(_sfc_main$29, options);
2663
2734
  }
2664
2735
  function renderYearPickerItem(options = {}) {
2665
- return pickerRenderer(_sfc_main$46, options);
2736
+ return pickerRenderer(_sfc_main$50, options);
2666
2737
  }
2667
2738
  /** dateRangePicker widget:[start, end] | null 形态 */
2668
2739
  function renderDateRangePickerItem(options = {}) {
2669
- return pickerRenderer(_sfc_main$11, options);
2740
+ return pickerRenderer(_sfc_main$13, options);
2670
2741
  }
2671
2742
  function renderWeekPickerItem(options = {}) {
2672
- return pickerRenderer(_sfc_main$45, options);
2743
+ return pickerRenderer(_sfc_main$49, options);
2673
2744
  }
2674
2745
  //#endregion
2675
2746
  //#region src/components/input/Input.vue
2676
- const _hoisted_1$17 = ["aria-invalid"];
2677
- const _sfc_main$24 = /*@__PURE__*/ defineComponent({
2747
+ const _hoisted_1$21 = ["aria-invalid"];
2748
+ const _sfc_main$27 = /*@__PURE__*/ defineComponent({
2678
2749
  __name: "Input",
2679
2750
  props: /*@__PURE__*/ mergeModels({
2680
2751
  class: {},
@@ -2692,7 +2763,7 @@ const _sfc_main$24 = /*@__PURE__*/ defineComponent({
2692
2763
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => modelValue.value = $event),
2693
2764
  "aria-invalid": props.invalid ? "true" : void 0,
2694
2765
  class: normalizeClass(unref(cn)("flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-sm transition-[color,box-shadow] outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:ring-destructive/20 aria-invalid:border-destructive", props.class))
2695
- }, null, 10, _hoisted_1$17)), [[vModelText, modelValue.value]]);
2766
+ }, null, 10, _hoisted_1$21)), [[vModelText, modelValue.value]]);
2696
2767
  };
2697
2768
  }
2698
2769
  });
@@ -2700,7 +2771,7 @@ const _sfc_main$24 = /*@__PURE__*/ defineComponent({
2700
2771
  //#region src/components/form-render/widgets/input.ts
2701
2772
  /** input widget:单行文本输入(placeholder 为原生 attr 透传,aria-invalid 由 FormControl 接线) */
2702
2773
  function renderInputItem(options = {}) {
2703
- return (ctx) => h(_sfc_main$24, {
2774
+ return (ctx) => h(_sfc_main$27, {
2704
2775
  placeholder: ctx.item.placeholder,
2705
2776
  ...options,
2706
2777
  ...bindField(ctx.field, MODEL_VALUE),
@@ -2717,7 +2788,7 @@ function normalizeSelectItem(item) {
2717
2788
  }
2718
2789
  //#endregion
2719
2790
  //#region src/components/select/Select.vue
2720
- const _sfc_main$33 = /*@__PURE__*/ defineComponent({
2791
+ const _sfc_main$37 = /*@__PURE__*/ defineComponent({
2721
2792
  __name: "Select",
2722
2793
  props: {
2723
2794
  /** 选项列表:字符串(label = value)或 { label, value, disabled? } */
@@ -2779,19 +2850,18 @@ const _sfc_main$33 = /*@__PURE__*/ defineComponent({
2779
2850
  internalValue.value = value;
2780
2851
  emit("update:modelValue", value);
2781
2852
  }
2782
- const internalOpen = ref(props.defaultOpen);
2783
- const isOpen = computed(() => props.open ?? internalOpen.value);
2784
- function handleOpenUpdate(open) {
2785
- internalOpen.value = open;
2786
- emit("update:open", open);
2787
- }
2853
+ const { isOpen, setOpen } = useControlledBoolean({
2854
+ controlled: () => props.open,
2855
+ defaultValue: () => props.defaultOpen,
2856
+ onChange: (open) => emit("update:open", open)
2857
+ });
2788
2858
  return (_ctx, _cache) => {
2789
2859
  return openBlock(), createBlock(unref(Select).Root, {
2790
2860
  collection: collection.value,
2791
2861
  "model-value": toArray(modelValue.value),
2792
- open: isOpen.value,
2862
+ open: unref(isOpen),
2793
2863
  "onUpdate:modelValue": handleModelUpdate,
2794
- "onUpdate:open": handleOpenUpdate
2864
+ "onUpdate:open": unref(setOpen)
2795
2865
  }, {
2796
2866
  default: withCtx(() => [
2797
2867
  createCommentVNode(" 触发器(收编自 SelectTrigger:内置选中回显与 chevron) "),
@@ -2814,8 +2884,8 @@ const _sfc_main$33 = /*@__PURE__*/ defineComponent({
2814
2884
  }, 8, ["class"])]),
2815
2885
  _: 1
2816
2886
  }),
2817
- createVNode(unref(Select).Positioner, { class: "z-50" }, {
2818
- default: withCtx(() => [createVNode(unref(Select).Content, { class: normalizeClass(unref(cn)("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border shadow-md", props.contentClass)) }, {
2887
+ createVNode(unref(Select).Positioner, { class: "z-[var(--z-overlay)]" }, {
2888
+ default: withCtx(() => [createVNode(unref(Select).Content, { class: normalizeClass(unref(cn)("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 relative z-[var(--z-overlay)] max-h-96 min-w-[8rem] overflow-hidden rounded-md border shadow-md", props.contentClass)) }, {
2819
2889
  default: withCtx(() => [(openBlock(true), createElementBlock(Fragment, null, renderList(normalizedItems.value, (entry) => {
2820
2890
  return openBlock(), createBlock(unref(Select).Item, {
2821
2891
  key: entry.item.value,
@@ -2853,7 +2923,8 @@ const _sfc_main$33 = /*@__PURE__*/ defineComponent({
2853
2923
  }, 8, [
2854
2924
  "collection",
2855
2925
  "model-value",
2856
- "open"
2926
+ "open",
2927
+ "onUpdate:open"
2857
2928
  ]);
2858
2929
  };
2859
2930
  }
@@ -2867,7 +2938,7 @@ const _sfc_main$33 = /*@__PURE__*/ defineComponent({
2867
2938
  */
2868
2939
  function renderSelectItem(options) {
2869
2940
  const { placeholder, items, ...rootProps } = options;
2870
- return (ctx) => h(_sfc_main$33, {
2941
+ return (ctx) => h(_sfc_main$37, {
2871
2942
  ...rootProps,
2872
2943
  items,
2873
2944
  placeholder: placeholder ?? ctx.item.placeholder,
@@ -2877,7 +2948,7 @@ function renderSelectItem(options) {
2877
2948
  }
2878
2949
  //#endregion
2879
2950
  //#region src/components/radio-group/RadioGroup.vue
2880
- const _sfc_main$32 = /*@__PURE__*/ defineComponent({
2951
+ const _sfc_main$36 = /*@__PURE__*/ defineComponent({
2881
2952
  __name: "RadioGroup",
2882
2953
  props: {
2883
2954
  items: {},
@@ -2962,7 +3033,7 @@ const _sfc_main$32 = /*@__PURE__*/ defineComponent({
2962
3033
  });
2963
3034
  //#endregion
2964
3035
  //#region src/components/slider/Slider.vue
2965
- const _sfc_main$36 = /*@__PURE__*/ defineComponent({
3036
+ const _sfc_main$40 = /*@__PURE__*/ defineComponent({
2966
3037
  __name: "Slider",
2967
3038
  props: {
2968
3039
  modelValue: {},
@@ -3027,7 +3098,7 @@ const _sfc_main$36 = /*@__PURE__*/ defineComponent({
3027
3098
  * 命名穿透:选项字段为组件 required prop `items`,整体直传,widget 不做组装。
3028
3099
  */
3029
3100
  function renderRadioGroupItem(options) {
3030
- return (ctx) => h(_sfc_main$32, {
3101
+ return (ctx) => h(_sfc_main$36, {
3031
3102
  ...options,
3032
3103
  ...bindField(ctx.field, VALUE),
3033
3104
  ...ctx.item.componentProps
@@ -3038,7 +3109,7 @@ function renderRadioGroupItem(options) {
3038
3109
  * (值 prop 为 `value`,事件却是 `update:modelValue` 且数组语义,由 SLIDER spec 转换)。
3039
3110
  */
3040
3111
  function renderSliderItem(options = {}) {
3041
- return (ctx) => h(_sfc_main$36, {
3112
+ return (ctx) => h(_sfc_main$40, {
3042
3113
  ...options,
3043
3114
  ...bindField(ctx.field, SLIDER),
3044
3115
  ...ctx.item.componentProps
@@ -3046,8 +3117,8 @@ function renderSliderItem(options = {}) {
3046
3117
  }
3047
3118
  //#endregion
3048
3119
  //#region src/components/tree-shared/ChevronIcon.vue
3049
- const _sfc_main$53 = {};
3050
- const _hoisted_1$16 = {
3120
+ const _sfc_main$58 = {};
3121
+ const _hoisted_1$20 = {
3051
3122
  viewBox: "0 0 24 24",
3052
3123
  fill: "none",
3053
3124
  stroke: "currentColor",
@@ -3058,13 +3129,13 @@ const _hoisted_1$16 = {
3058
3129
  class: "size-4 shrink-0 transition-transform"
3059
3130
  };
3060
3131
  function _sfc_render$1(_ctx, _cache) {
3061
- return openBlock(), createElementBlock("svg", _hoisted_1$16, [..._cache[0] || (_cache[0] = [createElementVNode("path", { d: "m9 18 6-6-6-6" }, null, -1)])]);
3132
+ return openBlock(), createElementBlock("svg", _hoisted_1$20, [..._cache[0] || (_cache[0] = [createElementVNode("path", { d: "m9 18 6-6-6-6" }, null, -1)])]);
3062
3133
  }
3063
- var ChevronIcon_default = /*#__PURE__*/ export_helper_default(_sfc_main$53, [["render", _sfc_render$1]]);
3134
+ var ChevronIcon_default = /*#__PURE__*/ export_helper_default(_sfc_main$58, [["render", _sfc_render$1]]);
3064
3135
  //#endregion
3065
3136
  //#region src/components/tree-shared/ClearIcon.vue
3066
- const _sfc_main$52 = {};
3067
- const _hoisted_1$15 = {
3137
+ const _sfc_main$57 = {};
3138
+ const _hoisted_1$19 = {
3068
3139
  viewBox: "0 0 24 24",
3069
3140
  fill: "none",
3070
3141
  stroke: "currentColor",
@@ -3074,21 +3145,20 @@ const _hoisted_1$15 = {
3074
3145
  class: "size-4 shrink-0"
3075
3146
  };
3076
3147
  function _sfc_render(_ctx, _cache) {
3077
- return openBlock(), createElementBlock("svg", _hoisted_1$15, [..._cache[0] || (_cache[0] = [createElementVNode("path", { d: "M18 6 6 18" }, null, -1), createElementVNode("path", { d: "m6 6 12 12" }, null, -1)])]);
3148
+ return openBlock(), createElementBlock("svg", _hoisted_1$19, [..._cache[0] || (_cache[0] = [createElementVNode("path", { d: "M18 6 6 18" }, null, -1), createElementVNode("path", { d: "m6 6 12 12" }, null, -1)])]);
3078
3149
  }
3079
- var ClearIcon_default = /*#__PURE__*/ export_helper_default(_sfc_main$52, [["render", _sfc_render]]);
3150
+ var ClearIcon_default = /*#__PURE__*/ export_helper_default(_sfc_main$57, [["render", _sfc_render]]);
3080
3151
  //#endregion
3081
3152
  //#region src/components/tree-shared/ValueTags.vue
3082
- const _hoisted_1$14 = { class: "flex min-w-0 flex-1 flex-wrap items-center gap-1" };
3083
- const _hoisted_2$11 = ["data-key"];
3084
- const _hoisted_3$9 = { class: "truncate" };
3085
- const _hoisted_4$8 = ["aria-label", "onClick"];
3086
- const _hoisted_5$6 = {
3153
+ const _hoisted_1$18 = ["data-key"];
3154
+ const _hoisted_2$15 = { class: "truncate" };
3155
+ const _hoisted_3$11 = ["aria-label", "onClick"];
3156
+ const _hoisted_4$8 = {
3087
3157
  key: 0,
3088
3158
  "data-part": "tag-overflow",
3089
3159
  class: "text-xs text-muted-foreground"
3090
3160
  };
3091
- const _sfc_main$51 = /*@__PURE__*/ defineComponent({
3161
+ const _sfc_main$56 = /*@__PURE__*/ defineComponent({
3092
3162
  __name: "ValueTags",
3093
3163
  props: {
3094
3164
  /** 展示的选中值(key + label) */
@@ -3118,14 +3188,14 @@ const _sfc_main$51 = /*@__PURE__*/ defineComponent({
3118
3188
  const shown = computed(() => props.maxTagCount === void 0 ? props.values : props.values.slice(0, props.maxTagCount));
3119
3189
  const overflow = computed(() => props.maxTagCount === void 0 ? 0 : Math.max(0, props.values.length - props.maxTagCount));
3120
3190
  return (_ctx, _cache) => {
3121
- return openBlock(), createElementBlock("span", _hoisted_1$14, [
3191
+ return openBlock(), createElementBlock("span", { class: normalizeClass(unref(cn)("flex min-w-0 flex-1 flex-wrap items-center gap-1", _ctx.$attrs.class)) }, [
3122
3192
  (openBlock(true), createElementBlock(Fragment, null, renderList(shown.value, (v) => {
3123
3193
  return openBlock(), createElementBlock("span", {
3124
3194
  key: v.key,
3125
3195
  "data-part": "tag",
3126
3196
  "data-key": v.key,
3127
3197
  class: "inline-flex max-w-full items-center gap-0.5 rounded-sm bg-accent px-1.5 py-0.5 text-xs font-normal text-accent-foreground"
3128
- }, [createElementVNode("span", _hoisted_3$9, toDisplayString(v.label), 1), !__props.disabled ? (openBlock(), createElementBlock("button", {
3198
+ }, [createElementVNode("span", _hoisted_2$15, toDisplayString(v.label), 1), !__props.disabled ? (openBlock(), createElementBlock("button", {
3129
3199
  key: 0,
3130
3200
  type: "button",
3131
3201
  "data-part": "tag-remove",
@@ -3140,9 +3210,9 @@ const _sfc_main$51 = /*@__PURE__*/ defineComponent({
3140
3210
  "stroke-linecap": "round",
3141
3211
  class: "size-3",
3142
3212
  "aria-hidden": "true"
3143
- }, [createElementVNode("path", { d: "M18 6 6 18" }), createElementVNode("path", { d: "m6 6 12 12" })], -1)])], 8, _hoisted_4$8)) : createCommentVNode("v-if", true)], 8, _hoisted_2$11);
3213
+ }, [createElementVNode("path", { d: "M18 6 6 18" }), createElementVNode("path", { d: "m6 6 12 12" })], -1)])], 8, _hoisted_3$11)) : createCommentVNode("v-if", true)], 8, _hoisted_1$18);
3144
3214
  }), 128)),
3145
- overflow.value > 0 ? (openBlock(), createElementBlock("span", _hoisted_5$6, "+" + toDisplayString(overflow.value), 1)) : createCommentVNode("v-if", true),
3215
+ overflow.value > 0 ? (openBlock(), createElementBlock("span", _hoisted_4$8, "+" + toDisplayString(overflow.value), 1)) : createCommentVNode("v-if", true),
3146
3216
  __props.clearable && !__props.disabled ? (openBlock(), createElementBlock("button", {
3147
3217
  key: 1,
3148
3218
  type: "button",
@@ -3159,7 +3229,7 @@ const _sfc_main$51 = /*@__PURE__*/ defineComponent({
3159
3229
  class: "size-4",
3160
3230
  "aria-hidden": "true"
3161
3231
  }, [createElementVNode("path", { d: "M18 6 6 18" }), createElementVNode("path", { d: "m6 6 12 12" })], -1)])])) : createCommentVNode("v-if", true)
3162
- ]);
3232
+ ], 2);
3163
3233
  };
3164
3234
  }
3165
3235
  });
@@ -3749,12 +3819,8 @@ function nextActiveKey(flattened, activeKey, key, options) {
3749
3819
  }
3750
3820
  //#endregion
3751
3821
  //#region src/components/cascader/CascaderPanel.vue
3752
- const _hoisted_1$13 = {
3753
- "data-part": "cascader-panel",
3754
- class: "flex overflow-x-auto"
3755
- };
3756
- const _hoisted_2$10 = ["aria-label"];
3757
- const _hoisted_3$8 = [
3822
+ const _hoisted_1$17 = ["aria-label"];
3823
+ const _hoisted_2$14 = [
3758
3824
  "data-key",
3759
3825
  "aria-selected",
3760
3826
  "aria-checked",
@@ -3767,8 +3833,8 @@ const _hoisted_3$8 = [
3767
3833
  "onClick",
3768
3834
  "onPointerenter"
3769
3835
  ];
3770
- const _hoisted_4$7 = ["onClick"];
3771
- const _hoisted_5$5 = {
3836
+ const _hoisted_3$10 = ["onClick"];
3837
+ const _hoisted_4$7 = {
3772
3838
  key: 0,
3773
3839
  viewBox: "0 0 24 24",
3774
3840
  fill: "none",
@@ -3776,7 +3842,7 @@ const _hoisted_5$5 = {
3776
3842
  "stroke-width": "3",
3777
3843
  class: "size-3"
3778
3844
  };
3779
- const _hoisted_6$4 = {
3845
+ const _hoisted_5$5 = {
3780
3846
  key: 1,
3781
3847
  viewBox: "0 0 24 24",
3782
3848
  fill: "none",
@@ -3784,12 +3850,12 @@ const _hoisted_6$4 = {
3784
3850
  "stroke-width": "3",
3785
3851
  class: "size-3"
3786
3852
  };
3787
- const _hoisted_7$4 = { class: "flex-1 truncate" };
3788
- const _hoisted_8$2 = {
3853
+ const _hoisted_6$4 = { class: "flex-1 truncate" };
3854
+ const _hoisted_7$4 = {
3789
3855
  key: 0,
3790
3856
  class: "px-3 py-1.5 text-sm text-muted-foreground"
3791
3857
  };
3792
- const _sfc_main$50 = /*@__PURE__*/ defineComponent({
3858
+ const _sfc_main$55 = /*@__PURE__*/ defineComponent({
3793
3859
  __name: "CascaderPanel",
3794
3860
  props: {
3795
3861
  /** 列数据:columns[0] 为根层,后续每列为展开路径的子层 */
@@ -3842,6 +3908,9 @@ const _sfc_main$50 = /*@__PURE__*/ defineComponent({
3842
3908
  function labelOf(node) {
3843
3909
  return node.rawNode.label ?? String(node.key);
3844
3910
  }
3911
+ const selectedSet = computed(() => new Set(props.selectedKeys));
3912
+ const checkedSet = computed(() => new Set(props.checkedKeys));
3913
+ const indeterminateSet = computed(() => new Set(props.indeterminateKeys));
3845
3914
  function rowClick(node) {
3846
3915
  if (node.disabled) return;
3847
3916
  emit("select", node);
@@ -3853,7 +3922,10 @@ const _sfc_main$50 = /*@__PURE__*/ defineComponent({
3853
3922
  if (!node.disabled) emit("check", node);
3854
3923
  }
3855
3924
  return (_ctx, _cache) => {
3856
- return openBlock(), createElementBlock("div", _hoisted_1$13, [(openBlock(true), createElementBlock(Fragment, null, renderList(props.columns, (column, ci) => {
3925
+ return openBlock(), createElementBlock("div", {
3926
+ "data-part": "cascader-panel",
3927
+ class: normalizeClass(unref(cn)("flex overflow-x-auto", _ctx.$attrs.class))
3928
+ }, [(openBlock(true), createElementBlock(Fragment, null, renderList(props.columns, (column, ci) => {
3857
3929
  return openBlock(), createElementBlock("div", {
3858
3930
  key: ci,
3859
3931
  role: "listbox",
@@ -3866,13 +3938,13 @@ const _sfc_main$50 = /*@__PURE__*/ defineComponent({
3866
3938
  "data-part": "tree-node",
3867
3939
  "data-key": node.key,
3868
3940
  role: "option",
3869
- "aria-selected": props.selectedKeys.includes(node.key),
3870
- "aria-checked": props.checkable ? props.checkedKeys.includes(node.key) : void 0,
3941
+ "aria-selected": selectedSet.value.has(node.key),
3942
+ "aria-checked": props.checkable ? checkedSet.value.has(node.key) : void 0,
3871
3943
  "aria-expanded": node.children?.length ? props.isExpanded(node) : void 0,
3872
3944
  "aria-disabled": node.disabled || void 0,
3873
- "data-selected": props.selectedKeys.includes(node.key) || void 0,
3874
- "data-checked": props.checkedKeys.includes(node.key) || void 0,
3875
- "data-indeterminate": props.indeterminateKeys.includes(node.key) || void 0,
3945
+ "data-selected": selectedSet.value.has(node.key) || void 0,
3946
+ "data-checked": checkedSet.value.has(node.key) || void 0,
3947
+ "data-indeterminate": indeterminateSet.value.has(node.key) || void 0,
3876
3948
  "data-active": props.activeKey === node.key || void 0,
3877
3949
  class: "flex cursor-pointer items-center gap-1 px-3 py-1.5 text-sm outline-none hover:bg-accent data-[active]:bg-accent data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50",
3878
3950
  onClick: ($event) => rowClick(node),
@@ -3881,28 +3953,28 @@ const _sfc_main$50 = /*@__PURE__*/ defineComponent({
3881
3953
  props.checkable ? (openBlock(), createElementBlock("span", {
3882
3954
  key: 0,
3883
3955
  "data-part": "checkbox",
3884
- class: normalizeClass(["flex size-4 shrink-0 items-center justify-center rounded-sm border", props.checkedKeys.includes(node.key) ? "border-primary bg-primary text-primary-foreground" : "border-input"]),
3956
+ class: normalizeClass(["flex size-4 shrink-0 items-center justify-center rounded-sm border", checkedSet.value.has(node.key) ? "border-primary bg-primary text-primary-foreground" : "border-input"]),
3885
3957
  onClick: withModifiers(($event) => toggleCheck(node), ["stop"])
3886
- }, [props.checkedKeys.includes(node.key) ? (openBlock(), createElementBlock("svg", _hoisted_5$5, [..._cache[0] || (_cache[0] = [createElementVNode("path", { d: "M20 6 9 17l-5-5" }, null, -1)])])) : props.indeterminateKeys.includes(node.key) ? (openBlock(), createElementBlock("svg", _hoisted_6$4, [..._cache[1] || (_cache[1] = [createElementVNode("path", { d: "M5 12h14" }, null, -1)])])) : createCommentVNode("v-if", true)], 10, _hoisted_4$7)) : createCommentVNode("v-if", true),
3887
- createElementVNode("span", _hoisted_7$4, toDisplayString(labelOf(node)), 1),
3958
+ }, [checkedSet.value.has(node.key) ? (openBlock(), createElementBlock("svg", _hoisted_4$7, [..._cache[0] || (_cache[0] = [createElementVNode("path", { d: "M20 6 9 17l-5-5" }, null, -1)])])) : indeterminateSet.value.has(node.key) ? (openBlock(), createElementBlock("svg", _hoisted_5$5, [..._cache[1] || (_cache[1] = [createElementVNode("path", { d: "M5 12h14" }, null, -1)])])) : createCommentVNode("v-if", true)], 10, _hoisted_3$10)) : createCommentVNode("v-if", true),
3959
+ createElementVNode("span", _hoisted_6$4, toDisplayString(labelOf(node)), 1),
3888
3960
  node.children?.length ? (openBlock(), createBlock(ChevronIcon_default, {
3889
3961
  key: 1,
3890
3962
  class: normalizeClass(unref(cn)("size-3.5 shrink-0 text-muted-foreground", props.isExpanded(node) && "rotate-90"))
3891
3963
  }, null, 8, ["class"])) : createCommentVNode("v-if", true)
3892
- ], 40, _hoisted_3$8);
3893
- }), 128)), !column.length ? (openBlock(), createElementBlock("div", _hoisted_8$2, "无数据")) : createCommentVNode("v-if", true)], 8, _hoisted_2$10);
3894
- }), 128))]);
3964
+ ], 40, _hoisted_2$14);
3965
+ }), 128)), !column.length ? (openBlock(), createElementBlock("div", _hoisted_7$4, "无数据")) : createCommentVNode("v-if", true)], 8, _hoisted_1$17);
3966
+ }), 128))], 2);
3895
3967
  };
3896
3968
  }
3897
3969
  });
3898
3970
  //#endregion
3899
3971
  //#region src/components/cascader/Cascader.vue
3900
- const _hoisted_1$12 = ["aria-expanded", "aria-disabled"];
3901
- const _hoisted_2$9 = {
3972
+ const _hoisted_1$16 = ["aria-expanded", "aria-disabled"];
3973
+ const _hoisted_2$13 = {
3902
3974
  key: 1,
3903
3975
  class: "truncate text-muted-foreground"
3904
3976
  };
3905
- const _hoisted_3$7 = {
3977
+ const _hoisted_3$9 = {
3906
3978
  key: 0,
3907
3979
  class: "truncate"
3908
3980
  };
@@ -3911,7 +3983,7 @@ const _hoisted_4$6 = {
3911
3983
  class: "truncate text-muted-foreground"
3912
3984
  };
3913
3985
  const _hoisted_5$4 = { class: "ml-auto flex shrink-0 items-center gap-1" };
3914
- const _sfc_main$7 = /*@__PURE__*/ defineComponent({
3986
+ const _sfc_main$8 = /*@__PURE__*/ defineComponent({
3915
3987
  inheritAttrs: false,
3916
3988
  __name: "Cascader",
3917
3989
  props: {
@@ -4004,10 +4076,15 @@ const _sfc_main$7 = /*@__PURE__*/ defineComponent({
4004
4076
  default: void 0
4005
4077
  }
4006
4078
  },
4007
- emits: ["update:modelValue", "update:show"],
4079
+ emits: [
4080
+ "update:modelValue",
4081
+ "update:show",
4082
+ "update:open"
4083
+ ],
4008
4084
  setup(__props, { emit: __emit }) {
4009
4085
  const props = __props;
4010
4086
  const emit = __emit;
4087
+ if (import.meta.env.DEV && getCurrentInstance()?.vnode.props?.["onUpdate:show"]) console.warn("[tu-design] <Cascader> update:show 已弃用,请改用 update:open(v-model:open)。");
4011
4088
  const toArrayValue = (v) => Array.isArray(v) ? v : v === void 0 || v === null ? [] : [v];
4012
4089
  const treeMate = computed(() => createTreeMate(props.options, { ignoreEmptyChildren: true }));
4013
4090
  const isMulti = computed(() => props.multiple || props.checkable);
@@ -4037,16 +4114,18 @@ const _sfc_main$7 = /*@__PURE__*/ defineComponent({
4037
4114
  internalValue.value = merged.checkedKeys;
4038
4115
  emit("update:modelValue", merged.checkedKeys);
4039
4116
  });
4040
- const internalOpen = ref(props.defaultOpen);
4041
- const isOpen = computed(() => props.open ?? internalOpen.value);
4042
- function handleOpenUpdate(open) {
4043
- internalOpen.value = open;
4044
- emit("update:show", open);
4045
- }
4117
+ const { isOpen, setOpen } = useControlledBoolean({
4118
+ controlled: () => props.open,
4119
+ defaultValue: () => props.defaultOpen,
4120
+ onChange: (open) => {
4121
+ emit("update:open", open);
4122
+ emit("update:show", open);
4123
+ }
4124
+ });
4046
4125
  function openFromInput() {
4047
4126
  if (props.disabled || isOpen.value) return;
4048
4127
  syncPanelWidth();
4049
- handleOpenUpdate(true);
4128
+ setOpen(true);
4050
4129
  }
4051
4130
  const triggerEl = ref(null);
4052
4131
  const panelMinWidth = ref("0px");
@@ -4061,6 +4140,13 @@ const _sfc_main$7 = /*@__PURE__*/ defineComponent({
4061
4140
  commitValue(isMulti.value ? [] : void 0);
4062
4141
  }
4063
4142
  function removeTag(key) {
4143
+ if (props.checkable) {
4144
+ commitValue(treeMate.value.uncheck(key, toArrayValue(value.value), {
4145
+ cascade: props.cascade,
4146
+ checkStrategy: props.checkStrategy
4147
+ }).checkedKeys);
4148
+ return;
4149
+ }
4064
4150
  commitValue(selectedKeys.value.filter((k) => k !== key));
4065
4151
  }
4066
4152
  const expandedPath = ref([]);
@@ -4075,8 +4161,9 @@ const _sfc_main$7 = /*@__PURE__*/ defineComponent({
4075
4161
  }
4076
4162
  return result;
4077
4163
  });
4164
+ const expandedPathSet = computed(() => new Set(expandedPath.value));
4078
4165
  function isExpanded(node) {
4079
- return expandedPath.value.includes(node.key);
4166
+ return expandedPathSet.value.has(node.key);
4080
4167
  }
4081
4168
  function handleExpand(node) {
4082
4169
  expandedPath.value = treeMate.value.getPath(node.key).keyPath;
@@ -4104,7 +4191,7 @@ const _sfc_main$7 = /*@__PURE__*/ defineComponent({
4104
4191
  return;
4105
4192
  }
4106
4193
  commitValue(node.key);
4107
- handleOpenUpdate(false);
4194
+ setOpen(false);
4108
4195
  }
4109
4196
  function labelOf(node) {
4110
4197
  return node.rawNode.label ?? String(node.key);
@@ -4189,8 +4276,8 @@ const _sfc_main$7 = /*@__PURE__*/ defineComponent({
4189
4276
  });
4190
4277
  return (_ctx, _cache) => {
4191
4278
  return openBlock(), createBlock(unref(Popover).Root, {
4192
- open: isOpen.value,
4193
- "onUpdate:open": handleOpenUpdate
4279
+ open: unref(isOpen),
4280
+ "onUpdate:open": unref(setOpen)
4194
4281
  }, {
4195
4282
  default: withCtx(() => [createVNode(unref(Popover).Anchor, { "as-child": "" }, {
4196
4283
  default: withCtx(() => [createElementVNode("div", mergeProps({
@@ -4200,13 +4287,13 @@ const _sfc_main$7 = /*@__PURE__*/ defineComponent({
4200
4287
  "data-part": "trigger",
4201
4288
  role: "button",
4202
4289
  tabindex: "0",
4203
- "aria-expanded": isOpen.value,
4290
+ "aria-expanded": unref(isOpen),
4204
4291
  "aria-haspopup": "true",
4205
4292
  "aria-disabled": props.disabled || void 0,
4206
4293
  class: unref(cn)(unref(controlCls), "min-h-9 cursor-pointer gap-2 px-3 py-1.5 text-sm", props.disabled && "cursor-not-allowed opacity-50", props.class),
4207
4294
  onClick: openFromInput,
4208
4295
  onKeydown: handleKeydown
4209
- }), [isMulti.value ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [tags.value.length ? (openBlock(), createBlock(_sfc_main$51, {
4296
+ }), [isMulti.value ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [tags.value.length ? (openBlock(), createBlock(_sfc_main$56, {
4210
4297
  key: 0,
4211
4298
  values: tags.value,
4212
4299
  "max-tag-count": props.maxTagCount,
@@ -4216,22 +4303,22 @@ const _sfc_main$7 = /*@__PURE__*/ defineComponent({
4216
4303
  "values",
4217
4304
  "max-tag-count",
4218
4305
  "disabled"
4219
- ])) : createCommentVNode("v-if", true), !tags.value.length ? (openBlock(), createElementBlock("span", _hoisted_2$9, toDisplayString(props.placeholder), 1)) : createCommentVNode("v-if", true)], 64)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [singleLabel.value ? (openBlock(), createElementBlock("span", _hoisted_3$7, toDisplayString(singleLabel.value), 1)) : (openBlock(), createElementBlock("span", _hoisted_4$6, toDisplayString(props.placeholder), 1))], 64)), createElementVNode("span", _hoisted_5$4, [props.clearable && hasValue.value && !props.disabled ? (openBlock(), createElementBlock("span", {
4306
+ ])) : createCommentVNode("v-if", true), !tags.value.length ? (openBlock(), createElementBlock("span", _hoisted_2$13, toDisplayString(props.placeholder), 1)) : createCommentVNode("v-if", true)], 64)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [singleLabel.value ? (openBlock(), createElementBlock("span", _hoisted_3$9, toDisplayString(singleLabel.value), 1)) : (openBlock(), createElementBlock("span", _hoisted_4$6, toDisplayString(props.placeholder), 1))], 64)), createElementVNode("span", _hoisted_5$4, [props.clearable && hasValue.value && !props.disabled ? (openBlock(), createElementBlock("span", {
4220
4307
  key: 0,
4221
4308
  role: "button",
4222
4309
  "data-part": "clear",
4223
4310
  class: "text-muted-foreground hover:text-foreground",
4224
4311
  "aria-label": "清空",
4225
4312
  onClick: withModifiers(handleClear, ["stop"])
4226
- }, [createVNode(ClearIcon_default)])) : createCommentVNode("v-if", true), createVNode(ChevronIcon_default, { class: normalizeClass(unref(cn)("text-muted-foreground transition-transform", isOpen.value ? "-rotate-90" : "rotate-90")) }, null, 8, ["class"])])], 16, _hoisted_1$12)]),
4313
+ }, [createVNode(ClearIcon_default)])) : createCommentVNode("v-if", true), createVNode(ChevronIcon_default, { class: normalizeClass(unref(cn)("text-muted-foreground transition-transform", unref(isOpen) ? "-rotate-90" : "rotate-90")) }, null, 8, ["class"])])], 16, _hoisted_1$16)]),
4227
4314
  _: 1
4228
4315
  }), (openBlock(), createBlock(Teleport, { to: "body" }, [createVNode(unref(Popover).Positioner, null, {
4229
4316
  default: withCtx(() => [createVNode(unref(Popover).Content, {
4230
- class: normalizeClass(unref(cn)("bg-popover text-popover-foreground z-50 rounded-md border p-0 shadow-md outline-none data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95")),
4317
+ class: normalizeClass(unref(cn)("bg-popover text-popover-foreground z-[var(--z-overlay)] rounded-md border p-0 shadow-md outline-none data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95")),
4231
4318
  style: normalizeStyle({ minWidth: panelMinWidth.value }),
4232
4319
  onKeydown: handleKeydown
4233
4320
  }, {
4234
- default: withCtx(() => [createVNode(_sfc_main$50, {
4321
+ default: withCtx(() => [createVNode(_sfc_main$55, {
4235
4322
  columns: columns.value,
4236
4323
  "expand-trigger": props.expandTrigger,
4237
4324
  "selected-keys": isMulti.value ? selectedKeys.value : [],
@@ -4257,17 +4344,13 @@ const _sfc_main$7 = /*@__PURE__*/ defineComponent({
4257
4344
  _: 1
4258
4345
  })]))]),
4259
4346
  _: 1
4260
- }, 8, ["open"]);
4347
+ }, 8, ["open", "onUpdate:open"]);
4261
4348
  };
4262
4349
  }
4263
4350
  });
4264
4351
  //#endregion
4265
4352
  //#region src/components/tree-select/TreePanel.vue
4266
- const _hoisted_1$11 = {
4267
- class: "max-h-[280px] overflow-auto p-1",
4268
- role: "tree"
4269
- };
4270
- const _hoisted_2$8 = [
4353
+ const _hoisted_1$15 = [
4271
4354
  "aria-level",
4272
4355
  "aria-selected",
4273
4356
  "aria-checked",
@@ -4279,14 +4362,14 @@ const _hoisted_2$8 = [
4279
4362
  "data-active",
4280
4363
  "onClick"
4281
4364
  ];
4282
- const _hoisted_3$6 = ["aria-label", "onClick"];
4283
- const _hoisted_4$5 = {
4365
+ const _hoisted_2$12 = ["aria-label", "onClick"];
4366
+ const _hoisted_3$8 = {
4284
4367
  key: 1,
4285
4368
  class: "size-4 shrink-0",
4286
4369
  "aria-hidden": "true"
4287
4370
  };
4288
- const _hoisted_5$3 = ["data-checked", "data-indeterminate"];
4289
- const _hoisted_6$3 = {
4371
+ const _hoisted_4$5 = ["data-checked", "data-indeterminate"];
4372
+ const _hoisted_5$3 = {
4290
4373
  key: 0,
4291
4374
  viewBox: "0 0 24 24",
4292
4375
  fill: "none",
@@ -4296,7 +4379,7 @@ const _hoisted_6$3 = {
4296
4379
  "stroke-linejoin": "round",
4297
4380
  class: "size-3"
4298
4381
  };
4299
- const _hoisted_7$3 = {
4382
+ const _hoisted_6$3 = {
4300
4383
  key: 1,
4301
4384
  viewBox: "0 0 24 24",
4302
4385
  fill: "none",
@@ -4305,12 +4388,12 @@ const _hoisted_7$3 = {
4305
4388
  "stroke-linecap": "round",
4306
4389
  class: "size-3"
4307
4390
  };
4308
- const _hoisted_8$1 = { class: "truncate" };
4309
- const _hoisted_9$1 = {
4391
+ const _hoisted_7$3 = { class: "truncate" };
4392
+ const _hoisted_8$1 = {
4310
4393
  key: 0,
4311
4394
  class: "px-2 py-6 text-center text-sm text-muted-foreground"
4312
4395
  };
4313
- const _sfc_main$49 = /*@__PURE__*/ defineComponent({
4396
+ const _sfc_main$54 = /*@__PURE__*/ defineComponent({
4314
4397
  __name: "TreePanel",
4315
4398
  props: {
4316
4399
  /** 展开态扁平化的可见节点序列(来自 treeMate.getFlattenedNodes(expandedKeys)) */
@@ -4356,23 +4439,30 @@ const _sfc_main$49 = /*@__PURE__*/ defineComponent({
4356
4439
  function label(node) {
4357
4440
  return node.rawNode.label ?? String(node.key);
4358
4441
  }
4442
+ const selectedSet = computed(() => new Set(props.selectedKeys));
4443
+ const expandedSet = computed(() => new Set(props.expandedKeys));
4444
+ const checkedSet = computed(() => new Set(props.checkedKeys));
4445
+ const indeterminateSet = computed(() => new Set(props.indeterminateKeys));
4359
4446
  function hasChildren(node) {
4360
4447
  return !node.isLeaf && !!node.children?.length;
4361
4448
  }
4362
4449
  function isExpanded(node) {
4363
- return hasChildren(node) && props.expandedKeys.includes(node.key);
4450
+ return hasChildren(node) && expandedSet.value.has(node.key);
4364
4451
  }
4365
4452
  function isSelected(node) {
4366
- return props.checkable ? props.checkedKeys.includes(node.key) : props.selectedKeys.includes(node.key);
4453
+ return props.checkable ? checkedSet.value.has(node.key) : selectedSet.value.has(node.key);
4367
4454
  }
4368
4455
  function isChecked(node) {
4369
- return props.checkedKeys.includes(node.key);
4456
+ return checkedSet.value.has(node.key);
4370
4457
  }
4371
4458
  function isIndeterminate(node) {
4372
- return props.indeterminateKeys.includes(node.key);
4459
+ return indeterminateSet.value.has(node.key);
4373
4460
  }
4374
4461
  return (_ctx, _cache) => {
4375
- return openBlock(), createElementBlock("div", _hoisted_1$11, [(openBlock(true), createElementBlock(Fragment, null, renderList(__props.nodes, (node) => {
4462
+ return openBlock(), createElementBlock("div", {
4463
+ class: normalizeClass(unref(cn)("max-h-[280px] overflow-auto p-1", _ctx.$attrs.class)),
4464
+ role: "tree"
4465
+ }, [(openBlock(true), createElementBlock(Fragment, null, renderList(__props.nodes, (node) => {
4376
4466
  return openBlock(), createElementBlock("div", {
4377
4467
  key: node.key,
4378
4468
  role: "treeitem",
@@ -4396,7 +4486,7 @@ const _sfc_main$49 = /*@__PURE__*/ defineComponent({
4396
4486
  class: "flex size-4 shrink-0 items-center justify-center text-muted-foreground",
4397
4487
  "aria-label": isExpanded(node) ? "折叠" : "展开",
4398
4488
  onClick: withModifiers(($event) => emit("toggle", node), ["stop"])
4399
- }, [createVNode(ChevronIcon_default, { class: normalizeClass(isExpanded(node) ? "rotate-90" : "") }, null, 8, ["class"])], 8, _hoisted_3$6)) : (openBlock(), createElementBlock("span", _hoisted_4$5)),
4489
+ }, [createVNode(ChevronIcon_default, { class: normalizeClass(isExpanded(node) ? "rotate-90" : "") }, null, 8, ["class"])], 8, _hoisted_2$12)) : (openBlock(), createElementBlock("span", _hoisted_3$8)),
4400
4490
  props.checkable ? (openBlock(), createElementBlock("span", {
4401
4491
  key: 2,
4402
4492
  "data-part": "checkbox",
@@ -4404,18 +4494,18 @@ const _sfc_main$49 = /*@__PURE__*/ defineComponent({
4404
4494
  "data-indeterminate": isIndeterminate(node) ? "" : void 0,
4405
4495
  class: "flex size-4 shrink-0 items-center justify-center rounded-[3px] border border-input bg-background text-background data-[checked]:border-primary data-[checked]:bg-primary data-[indeterminate]:border-primary data-[indeterminate]:bg-primary",
4406
4496
  "aria-hidden": "true"
4407
- }, [isChecked(node) ? (openBlock(), createElementBlock("svg", _hoisted_6$3, [..._cache[0] || (_cache[0] = [createElementVNode("path", { d: "M20 6 9 17l-5-5" }, null, -1)])])) : isIndeterminate(node) ? (openBlock(), createElementBlock("svg", _hoisted_7$3, [..._cache[1] || (_cache[1] = [createElementVNode("path", { d: "M5 12h14" }, null, -1)])])) : createCommentVNode("v-if", true)], 8, _hoisted_5$3)) : createCommentVNode("v-if", true),
4408
- createElementVNode("span", _hoisted_8$1, toDisplayString(label(node)), 1)
4409
- ], 12, _hoisted_2$8);
4410
- }), 128)), __props.nodes.length === 0 ? (openBlock(), createElementBlock("div", _hoisted_9$1, " 无数据 ")) : createCommentVNode("v-if", true)]);
4497
+ }, [isChecked(node) ? (openBlock(), createElementBlock("svg", _hoisted_5$3, [..._cache[0] || (_cache[0] = [createElementVNode("path", { d: "M20 6 9 17l-5-5" }, null, -1)])])) : isIndeterminate(node) ? (openBlock(), createElementBlock("svg", _hoisted_6$3, [..._cache[1] || (_cache[1] = [createElementVNode("path", { d: "M5 12h14" }, null, -1)])])) : createCommentVNode("v-if", true)], 8, _hoisted_4$5)) : createCommentVNode("v-if", true),
4498
+ createElementVNode("span", _hoisted_7$3, toDisplayString(label(node)), 1)
4499
+ ], 12, _hoisted_1$15);
4500
+ }), 128)), __props.nodes.length === 0 ? (openBlock(), createElementBlock("div", _hoisted_8$1, " 无数据 ")) : createCommentVNode("v-if", true)], 2);
4411
4501
  };
4412
4502
  }
4413
4503
  });
4414
4504
  //#endregion
4415
4505
  //#region src/components/tree-select/TreeSelect.vue
4416
- const _hoisted_1$10 = ["aria-expanded", "aria-disabled"];
4417
- const _hoisted_2$7 = ["placeholder", "aria-label"];
4418
- const _hoisted_3$5 = {
4506
+ const _hoisted_1$14 = ["aria-expanded", "aria-disabled"];
4507
+ const _hoisted_2$11 = ["placeholder", "aria-label"];
4508
+ const _hoisted_3$7 = {
4419
4509
  key: 2,
4420
4510
  class: "truncate text-muted-foreground"
4421
4511
  };
@@ -4429,7 +4519,7 @@ const _hoisted_6$2 = {
4429
4519
  class: "truncate text-muted-foreground"
4430
4520
  };
4431
4521
  const _hoisted_7$2 = { class: "ml-auto flex shrink-0 items-center gap-1" };
4432
- const _sfc_main$44 = /*@__PURE__*/ defineComponent({
4522
+ const _sfc_main$48 = /*@__PURE__*/ defineComponent({
4433
4523
  inheritAttrs: false,
4434
4524
  __name: "TreeSelect",
4435
4525
  props: {
@@ -4529,16 +4619,25 @@ const _sfc_main$44 = /*@__PURE__*/ defineComponent({
4529
4619
  emits: [
4530
4620
  "update:modelValue",
4531
4621
  "update:show",
4622
+ "update:open",
4532
4623
  "update:expandedKeys"
4533
4624
  ],
4534
4625
  setup(__props, { emit: __emit }) {
4535
4626
  const props = __props;
4536
4627
  const emit = __emit;
4628
+ if (import.meta.env.DEV && getCurrentInstance()?.vnode.props?.["onUpdate:show"]) console.warn("[tu-design] <TreeSelect> update:show 已弃用,请改用 update:open(v-model:open)。");
4537
4629
  const internalValue = ref(props.defaultValue);
4538
4630
  const value = computed(() => props.modelValue !== void 0 ? props.modelValue : internalValue.value);
4539
4631
  const treeMate = computed(() => createTreeMate(props.options, { ignoreEmptyChildren: true }));
4540
4632
  const internalExpanded = ref(props.defaultExpandAll ? treeMate.value.getNonLeafKeys({ preserveGroup: true }) : [...props.defaultExpandedKeys]);
4541
4633
  const expandedKeys = computed(() => props.expandedKeys ?? internalExpanded.value);
4634
+ let expandAllSeeded = !props.defaultExpandAll || treeMate.value.treeNodes.length > 0;
4635
+ watch(() => props.options, () => {
4636
+ if (expandAllSeeded || !props.defaultExpandAll || props.expandedKeys !== void 0) return;
4637
+ if (treeMate.value.treeNodes.length === 0) return;
4638
+ expandAllSeeded = true;
4639
+ internalExpanded.value = treeMate.value.getNonLeafKeys({ preserveGroup: true });
4640
+ });
4542
4641
  function handleExpandedUpdate(keys) {
4543
4642
  internalExpanded.value = keys;
4544
4643
  emit("update:expandedKeys", keys);
@@ -4604,7 +4703,7 @@ const _sfc_main$44 = /*@__PURE__*/ defineComponent({
4604
4703
  updateValue(current.includes(node.key) ? current.filter((k) => k !== node.key) : [...current, node.key]);
4605
4704
  } else {
4606
4705
  updateValue(node.key);
4607
- handleOpenUpdate(false);
4706
+ setOpen(false);
4608
4707
  }
4609
4708
  }
4610
4709
  watch(checkOptions, () => {
@@ -4614,9 +4713,11 @@ const _sfc_main$44 = /*@__PURE__*/ defineComponent({
4614
4713
  if (normalized.checkedKeys.length !== current.length || normalized.checkedKeys.some((k) => !current.includes(k))) updateValue(normalized.checkedKeys);
4615
4714
  });
4616
4715
  function removeTag(key) {
4617
- const next = toArrayValue(value.value).filter((k) => k !== key);
4618
- internalValue.value = next;
4619
- emit("update:modelValue", next);
4716
+ if (props.checkable) {
4717
+ updateValue(treeMate.value.uncheck(key, normalizeValue(value.value), checkOptions.value).checkedKeys);
4718
+ return;
4719
+ }
4720
+ updateValue(toArrayValue(value.value).filter((k) => k !== key));
4620
4721
  }
4621
4722
  const hasValue = computed(() => tags.value.length > 0);
4622
4723
  function handleClear() {
@@ -4624,16 +4725,18 @@ const _sfc_main$44 = /*@__PURE__*/ defineComponent({
4624
4725
  internalValue.value = next;
4625
4726
  emit("update:modelValue", next);
4626
4727
  }
4627
- const internalOpen = ref(props.defaultOpen);
4628
- const isOpen = computed(() => props.open ?? internalOpen.value);
4629
- function handleOpenUpdate(open) {
4630
- internalOpen.value = open;
4631
- emit("update:show", open);
4632
- }
4728
+ const { isOpen, setOpen } = useControlledBoolean({
4729
+ controlled: () => props.open,
4730
+ defaultValue: () => props.defaultOpen,
4731
+ onChange: (open) => {
4732
+ emit("update:open", open);
4733
+ emit("update:show", open);
4734
+ }
4735
+ });
4633
4736
  function openFromInput() {
4634
4737
  if (props.disabled || isOpen.value) return;
4635
4738
  syncPanelWidth();
4636
- handleOpenUpdate(true);
4739
+ setOpen(true);
4637
4740
  }
4638
4741
  const triggerEl = ref(null);
4639
4742
  const panelMinWidth = ref("0px");
@@ -4722,8 +4825,8 @@ const _sfc_main$44 = /*@__PURE__*/ defineComponent({
4722
4825
  });
4723
4826
  return (_ctx, _cache) => {
4724
4827
  return openBlock(), createBlock(unref(Popover).Root, {
4725
- open: isOpen.value,
4726
- "onUpdate:open": handleOpenUpdate
4828
+ open: unref(isOpen),
4829
+ "onUpdate:open": unref(setOpen)
4727
4830
  }, {
4728
4831
  default: withCtx(() => [
4729
4832
  createVNode(unref(Popover).Anchor, { "as-child": "" }, {
@@ -4734,14 +4837,14 @@ const _sfc_main$44 = /*@__PURE__*/ defineComponent({
4734
4837
  "data-part": "trigger",
4735
4838
  role: "button",
4736
4839
  tabindex: "0",
4737
- "aria-expanded": isOpen.value,
4840
+ "aria-expanded": unref(isOpen),
4738
4841
  "aria-haspopup": "true",
4739
4842
  "aria-disabled": props.disabled || void 0,
4740
4843
  class: unref(cn)(unref(controlCls), "min-h-9 cursor-pointer gap-2 px-3 py-1.5 text-sm", props.disabled && "cursor-not-allowed opacity-50", props.class),
4741
4844
  onClick: openFromInput,
4742
4845
  onKeydown: handleKeydown
4743
4846
  }), [isMulti.value ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
4744
- tags.value.length ? (openBlock(), createBlock(_sfc_main$51, {
4847
+ tags.value.length ? (openBlock(), createBlock(_sfc_main$56, {
4745
4848
  key: 0,
4746
4849
  values: tags.value,
4747
4850
  "max-tag-count": props.maxTagCount,
@@ -4760,8 +4863,8 @@ const _sfc_main$44 = /*@__PURE__*/ defineComponent({
4760
4863
  class: "h-5 w-12 min-w-0 flex-1 bg-transparent outline-none placeholder:text-muted-foreground",
4761
4864
  placeholder: tags.value.length ? "" : props.placeholder,
4762
4865
  "aria-label": props.placeholder
4763
- }, null, 8, _hoisted_2$7)), [[vModelText, pattern.value]]) : createCommentVNode("v-if", true),
4764
- !tags.value.length && !props.filterable ? (openBlock(), createElementBlock("span", _hoisted_3$5, toDisplayString(props.placeholder), 1)) : createCommentVNode("v-if", true)
4866
+ }, null, 8, _hoisted_2$11)), [[vModelText, pattern.value]]) : createCommentVNode("v-if", true),
4867
+ !tags.value.length && !props.filterable ? (openBlock(), createElementBlock("span", _hoisted_3$7, toDisplayString(props.placeholder), 1)) : createCommentVNode("v-if", true)
4765
4868
  ], 64)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [props.filterable ? withDirectives((openBlock(), createElementBlock("input", {
4766
4869
  key: 0,
4767
4870
  "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => pattern.value = $event),
@@ -4777,17 +4880,17 @@ const _sfc_main$44 = /*@__PURE__*/ defineComponent({
4777
4880
  class: "text-muted-foreground hover:text-foreground",
4778
4881
  "aria-label": "清空",
4779
4882
  onClick: withModifiers(handleClear, ["stop"])
4780
- }, [createVNode(ClearIcon_default)])) : createCommentVNode("v-if", true), createVNode(ChevronIcon_default, { class: normalizeClass(unref(cn)("text-muted-foreground transition-transform", isOpen.value ? "-rotate-90" : "rotate-90")) }, null, 8, ["class"])])], 16, _hoisted_1$10)]),
4883
+ }, [createVNode(ClearIcon_default)])) : createCommentVNode("v-if", true), createVNode(ChevronIcon_default, { class: normalizeClass(unref(cn)("text-muted-foreground transition-transform", unref(isOpen) ? "-rotate-90" : "rotate-90")) }, null, 8, ["class"])])], 16, _hoisted_1$14)]),
4781
4884
  _: 1
4782
4885
  }),
4783
4886
  createCommentVNode(" 弹层 Teleport 到 body:脱离表单 DOM,消除 overflow 容器裁剪隐患(DatePicker 同款) "),
4784
- (openBlock(), createBlock(Teleport, { to: "body" }, [createVNode(unref(Popover).Positioner, { class: "z-50" }, {
4887
+ (openBlock(), createBlock(Teleport, { to: "body" }, [createVNode(unref(Popover).Positioner, { class: "z-[var(--z-overlay)]" }, {
4785
4888
  default: withCtx(() => [createVNode(unref(Popover).Content, {
4786
- class: normalizeClass(unref(cn)("bg-popover text-popover-foreground z-50 rounded-md border p-0 shadow-md outline-none data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95")),
4889
+ class: normalizeClass(unref(cn)("bg-popover text-popover-foreground z-[var(--z-overlay)] rounded-md border p-0 shadow-md outline-none data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95")),
4787
4890
  style: normalizeStyle({ minWidth: panelMinWidth.value }),
4788
4891
  onKeydown: handleKeydown
4789
4892
  }, {
4790
- default: withCtx(() => [createVNode(_sfc_main$49, {
4893
+ default: withCtx(() => [createVNode(_sfc_main$54, {
4791
4894
  nodes: filteredNodes.value,
4792
4895
  "selected-keys": selectedKeys.value,
4793
4896
  "expanded-keys": expandedKeys.value,
@@ -4812,7 +4915,7 @@ const _sfc_main$44 = /*@__PURE__*/ defineComponent({
4812
4915
  })]))
4813
4916
  ]),
4814
4917
  _: 1
4815
- }, 8, ["open"]);
4918
+ }, 8, ["open", "onUpdate:open"]);
4816
4919
  };
4817
4920
  }
4818
4921
  });
@@ -4820,7 +4923,7 @@ const _sfc_main$44 = /*@__PURE__*/ defineComponent({
4820
4923
  //#region src/components/form-render/widgets/tree.ts
4821
4924
  function renderTreeSelectItem(options) {
4822
4925
  const { placeholder, ...rest } = options;
4823
- return (ctx) => h(_sfc_main$44, {
4926
+ return (ctx) => h(_sfc_main$48, {
4824
4927
  placeholder: placeholder ?? ctx.item.placeholder,
4825
4928
  ...rest,
4826
4929
  ...bindField(ctx.field, MODEL_VALUE),
@@ -4829,7 +4932,7 @@ function renderTreeSelectItem(options) {
4829
4932
  }
4830
4933
  function renderCascaderItem(options) {
4831
4934
  const { placeholder, ...rest } = options;
4832
- return (ctx) => h(_sfc_main$7, {
4935
+ return (ctx) => h(_sfc_main$8, {
4833
4936
  placeholder: placeholder ?? ctx.item.placeholder,
4834
4937
  ...rest,
4835
4938
  ...bindField(ctx.field, MODEL_VALUE),
@@ -4867,11 +4970,11 @@ function widgetRenders() {
4867
4970
  }
4868
4971
  //#endregion
4869
4972
  //#region src/components/form-render/FormRender.vue
4870
- const _hoisted_1$9 = {
4973
+ const _hoisted_1$13 = {
4871
4974
  key: 0,
4872
4975
  class: "col-span-full flex justify-end gap-2"
4873
4976
  };
4874
- const _sfc_main$22 = /*@__PURE__*/ defineComponent({
4977
+ const _sfc_main$25 = /*@__PURE__*/ defineComponent({
4875
4978
  __name: "FormRender",
4876
4979
  props: {
4877
4980
  /** 聚合式(推荐):defineForm 返回的定义对象 */
@@ -4951,13 +5054,13 @@ const _sfc_main$22 = /*@__PURE__*/ defineComponent({
4951
5054
  });
4952
5055
  return (_ctx, _cache) => {
4953
5056
  return openBlock(), createElementBlock("div", {
4954
- class: "grid gap-4",
5057
+ class: normalizeClass(unref(cn)("grid gap-4", _ctx.$attrs.class)),
4955
5058
  style: normalizeStyle(gridStyle.value)
4956
5059
  }, [(openBlock(true), createElementBlock(Fragment, null, renderList(visibleItems.value, (item) => {
4957
5060
  return openBlock(), createElementBlock("div", {
4958
5061
  key: String(item.key),
4959
5062
  style: normalizeStyle(spanStyle(item.span))
4960
- }, [createVNode(_sfc_main$58, {
5063
+ }, [createVNode(_sfc_main$64, {
4961
5064
  item,
4962
5065
  widget: widgetOf(item),
4963
5066
  values: unref(valuesRef)
@@ -4966,15 +5069,15 @@ const _sfc_main$22 = /*@__PURE__*/ defineComponent({
4966
5069
  "widget",
4967
5070
  "values"
4968
5071
  ])], 4);
4969
- }), 128)), showActions.value ? (openBlock(), createElementBlock("div", _hoisted_1$9, [renderSlot(_ctx.$slots, "actions", {}, () => [
4970
- __props.searchable ? (openBlock(), createBlock(unref(_sfc_main$4), {
5072
+ }), 128)), showActions.value ? (openBlock(), createElementBlock("div", _hoisted_1$13, [renderSlot(_ctx.$slots, "actions", {}, () => [
5073
+ __props.searchable ? (openBlock(), createBlock(unref(_sfc_main$5), {
4971
5074
  key: 0,
4972
5075
  onClick: _cache[0] || (_cache[0] = ($event) => submit("search"))
4973
5076
  }, {
4974
5077
  default: withCtx(() => [createTextVNode(toDisplayString(__props.searchText ?? "搜索"), 1)]),
4975
5078
  _: 1
4976
5079
  })) : createCommentVNode("v-if", true),
4977
- showReset.value ? (openBlock(), createBlock(unref(_sfc_main$4), {
5080
+ showReset.value ? (openBlock(), createBlock(unref(_sfc_main$5), {
4978
5081
  key: 1,
4979
5082
  variant: "outline",
4980
5083
  onClick: onReset
@@ -4982,14 +5085,14 @@ const _sfc_main$22 = /*@__PURE__*/ defineComponent({
4982
5085
  default: withCtx(() => [createTextVNode(toDisplayString(__props.resetText ?? "重置"), 1)]),
4983
5086
  _: 1
4984
5087
  })) : createCommentVNode("v-if", true),
4985
- __props.submitable ? (openBlock(), createBlock(unref(_sfc_main$4), {
5088
+ __props.submitable ? (openBlock(), createBlock(unref(_sfc_main$5), {
4986
5089
  key: 2,
4987
5090
  onClick: _cache[1] || (_cache[1] = ($event) => submit("submit"))
4988
5091
  }, {
4989
5092
  default: withCtx(() => [createTextVNode(toDisplayString(__props.submitText ?? "提交"), 1)]),
4990
5093
  _: 1
4991
5094
  })) : createCommentVNode("v-if", true),
4992
- showCancel.value ? (openBlock(), createBlock(unref(_sfc_main$4), {
5095
+ showCancel.value ? (openBlock(), createBlock(unref(_sfc_main$5), {
4993
5096
  key: 3,
4994
5097
  variant: "outline",
4995
5098
  onClick: _cache[2] || (_cache[2] = ($event) => emit("cancel"))
@@ -4997,7 +5100,7 @@ const _sfc_main$22 = /*@__PURE__*/ defineComponent({
4997
5100
  default: withCtx(() => [..._cache[3] || (_cache[3] = [createTextVNode(" 取消 ", -1)])]),
4998
5101
  _: 1
4999
5102
  })) : createCommentVNode("v-if", true)
5000
- ])])) : createCommentVNode("v-if", true)], 4);
5103
+ ])])) : createCommentVNode("v-if", true)], 6);
5001
5104
  };
5002
5105
  }
5003
5106
  });
@@ -5043,7 +5146,7 @@ function defineForm(config) {
5043
5146
  }
5044
5147
  //#endregion
5045
5148
  //#region src/components/avatar/Avatar.vue
5046
- const _sfc_main$1 = /*@__PURE__*/ defineComponent({
5149
+ const _sfc_main$2 = /*@__PURE__*/ defineComponent({
5047
5150
  __name: "Avatar",
5048
5151
  props: {
5049
5152
  src: {},
@@ -5134,7 +5237,7 @@ const avatarVariants = cva("inline-flex shrink-0 overflow-hidden bg-muted", { va
5134
5237
  const avatarGroupKey = Symbol("tu-avatar-group");
5135
5238
  //#endregion
5136
5239
  //#region src/components/avatar-group/AvatarGroup.vue
5137
- const _sfc_main$2 = /*@__PURE__*/ defineComponent({
5240
+ const _sfc_main$3 = /*@__PURE__*/ defineComponent({
5138
5241
  __name: "AvatarGroup",
5139
5242
  props: {
5140
5243
  max: {},
@@ -5173,7 +5276,7 @@ const _sfc_main$2 = /*@__PURE__*/ defineComponent({
5173
5276
  onMouseleave: onLeave
5174
5277
  }, [(openBlock(true), createElementBlock(Fragment, null, renderList(visibleVnodes.value, (vnode, i) => {
5175
5278
  return openBlock(), createBlock(resolveDynamicComponent(vnode), { key: vnode.key ?? i });
5176
- }), 128)), showRest.value ? (openBlock(), createBlock(unref(_sfc_main$1), {
5279
+ }), 128)), showRest.value ? (openBlock(), createBlock(unref(_sfc_main$2), {
5177
5280
  key: 0,
5178
5281
  class: "!inline-flex font-medium"
5179
5282
  }, {
@@ -5185,7 +5288,7 @@ const _sfc_main$2 = /*@__PURE__*/ defineComponent({
5185
5288
  });
5186
5289
  //#endregion
5187
5290
  //#region src/components/badge/Badge.vue
5188
- const _sfc_main$3 = /*@__PURE__*/ defineComponent({
5291
+ const _sfc_main$4 = /*@__PURE__*/ defineComponent({
5189
5292
  __name: "Badge",
5190
5293
  props: {
5191
5294
  variant: {},
@@ -5218,7 +5321,7 @@ const actionClass = "col-start-2 row-span-2 row-start-1 flex items-center gap-2
5218
5321
  const coverClass = "-mx-px -mt-px overflow-hidden rounded-t-[inherit]";
5219
5322
  const contentClass = "p-6 pt-0";
5220
5323
  const footerClass = "flex items-center p-6 pt-0";
5221
- const _sfc_main$6 = /*@__PURE__*/ defineComponent({
5324
+ const _sfc_main$7 = /*@__PURE__*/ defineComponent({
5222
5325
  __name: "Card",
5223
5326
  props: {
5224
5327
  title: { default: void 0 },
@@ -5342,15 +5445,15 @@ const cardVariants = cva("relative rounded-xl border border-border bg-card text-
5342
5445
  });
5343
5446
  //#endregion
5344
5447
  //#region src/components/dialog/Dialog.vue
5345
- const _hoisted_1$8 = {
5448
+ const _hoisted_1$12 = {
5346
5449
  key: 0,
5347
5450
  class: "flex flex-col gap-2 text-center sm:text-left"
5348
5451
  };
5349
- const _hoisted_2$6 = {
5452
+ const _hoisted_2$10 = {
5350
5453
  key: 1,
5351
5454
  class: "flex flex-col-reverse gap-2 sm:flex-row sm:justify-end"
5352
5455
  };
5353
- const _sfc_main$12 = /*@__PURE__*/ defineComponent({
5456
+ const _sfc_main$14 = /*@__PURE__*/ defineComponent({
5354
5457
  __name: "Dialog",
5355
5458
  props: {
5356
5459
  /** 受控开关(配合 v-model:open);不传时为非受控,由内部状态管理 */
@@ -5398,25 +5501,24 @@ const _sfc_main$12 = /*@__PURE__*/ defineComponent({
5398
5501
  setup(__props, { emit: __emit }) {
5399
5502
  const props = __props;
5400
5503
  const emit = __emit;
5401
- const internalOpen = ref(props.defaultOpen);
5402
- const isOpen = computed(() => props.open ?? internalOpen.value);
5403
- function handleUpdate(open) {
5404
- internalOpen.value = open;
5405
- emit("update:open", open);
5406
- }
5504
+ const { isOpen, setOpen } = useControlledBoolean({
5505
+ controlled: () => props.open,
5506
+ defaultValue: () => props.defaultOpen,
5507
+ onChange: (open) => emit("update:open", open)
5508
+ });
5407
5509
  /** 关闭对话框(#footer 作用域插槽注入):走受控桥把 open 置 false,
5408
5510
  * 与原 TDialogClose(Ark CloseTrigger)的关闭语义等价,退出动画/焦点还原由 zag 处理 */
5409
5511
  function close() {
5410
- handleUpdate(false);
5512
+ setOpen(false);
5411
5513
  }
5412
5514
  const hasHeader = computed(() => Boolean(props.title || props.description));
5413
- const contentClass = computed(() => cn("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out fixed left-1/2 top-1/2 z-50 grid w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-4 rounded-lg border p-6 shadow-lg duration-200 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 sm:max-w-lg", props.contentClass));
5515
+ const contentClass = computed(() => cn("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out fixed left-1/2 top-1/2 z-[var(--z-overlay)] grid w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-4 rounded-lg border p-6 shadow-lg duration-200 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 sm:max-w-lg", props.contentClass));
5414
5516
  return (_ctx, _cache) => {
5415
5517
  return openBlock(), createBlock(unref(Dialog).Root, {
5416
- open: isOpen.value,
5518
+ open: unref(isOpen),
5417
5519
  "lazy-mount": props.lazyMount,
5418
5520
  "unmount-on-exit": props.unmountOnExit,
5419
- "onUpdate:open": handleUpdate
5521
+ "onUpdate:open": unref(setOpen)
5420
5522
  }, {
5421
5523
  default: withCtx(() => [
5422
5524
  createCommentVNode(" #trigger:触发元素本体(asChild 语义合并到子元素,原 TDialogTrigger 同款实现);未提供则不渲染触发器 "),
@@ -5427,12 +5529,12 @@ const _sfc_main$12 = /*@__PURE__*/ defineComponent({
5427
5529
  default: withCtx(() => [renderSlot(_ctx.$slots, "trigger")]),
5428
5530
  _: 3
5429
5531
  })) : createCommentVNode("v-if", true),
5430
- createVNode(unref(Dialog).Backdrop, { class: "fixed inset-0 z-50 bg-black/50 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0" }),
5431
- createVNode(unref(Dialog).Positioner, { class: "fixed inset-0 z-50 flex items-center justify-center p-4" }, {
5532
+ createVNode(unref(Dialog).Backdrop, { class: "fixed inset-0 z-[var(--z-overlay)] bg-black/50 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0" }),
5533
+ createVNode(unref(Dialog).Positioner, { class: "fixed inset-0 z-[var(--z-overlay)] flex items-center justify-center p-4" }, {
5432
5534
  default: withCtx(() => [createVNode(unref(Dialog).Content, { class: normalizeClass(contentClass.value) }, {
5433
5535
  default: withCtx(() => [
5434
5536
  createCommentVNode(" 标题/描述:#title / #description 插槽优先,回退 title/description props;皆无则不渲染对应 DOM "),
5435
- hasHeader.value || _ctx.$slots.title || _ctx.$slots.description ? (openBlock(), createElementBlock("div", _hoisted_1$8, [_ctx.$slots.title || props.title ? (openBlock(), createBlock(unref(Dialog).Title, {
5537
+ hasHeader.value || _ctx.$slots.title || _ctx.$slots.description ? (openBlock(), createElementBlock("div", _hoisted_1$12, [_ctx.$slots.title || props.title ? (openBlock(), createBlock(unref(Dialog).Title, {
5436
5538
  key: 0,
5437
5539
  class: "text-lg font-semibold leading-none tracking-tight"
5438
5540
  }, {
@@ -5448,7 +5550,7 @@ const _sfc_main$12 = /*@__PURE__*/ defineComponent({
5448
5550
  createCommentVNode(" 默认插槽:弹层内容区(原 TDialogContent 的 body 部分) "),
5449
5551
  renderSlot(_ctx.$slots, "default"),
5450
5552
  createCommentVNode(" 底部操作区:#footer=\"{ close }\" 注入关闭函数,替代原 TDialogClose "),
5451
- _ctx.$slots.footer ? (openBlock(), createElementBlock("div", _hoisted_2$6, [renderSlot(_ctx.$slots, "footer", { close })])) : createCommentVNode("v-if", true),
5553
+ _ctx.$slots.footer ? (openBlock(), createElementBlock("div", _hoisted_2$10, [renderSlot(_ctx.$slots, "footer", { close })])) : createCommentVNode("v-if", true),
5452
5554
  props.showCloseButton ? (openBlock(), createBlock(unref(Dialog).CloseTrigger, {
5453
5555
  key: 2,
5454
5556
  class: "absolute right-4 top-4 cursor-pointer rounded-sm opacity-70 transition-opacity hover:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:pointer-events-none"
@@ -5474,7 +5576,8 @@ const _sfc_main$12 = /*@__PURE__*/ defineComponent({
5474
5576
  }, 8, [
5475
5577
  "open",
5476
5578
  "lazy-mount",
5477
- "unmount-on-exit"
5579
+ "unmount-on-exit",
5580
+ "onUpdate:open"
5478
5581
  ]);
5479
5582
  };
5480
5583
  }
@@ -5485,7 +5588,7 @@ const _sfc_main$12 = /*@__PURE__*/ defineComponent({
5485
5588
  const itemCls = "relative flex cursor-pointer select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none data-[highlighted]:bg-accent data-[highlighted]:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:size-4 [&_svg]:shrink-0";
5486
5589
  const labelCls = "px-2 py-1.5 text-sm font-medium";
5487
5590
  const separatorCls = "-mx-1 my-1 h-px bg-muted";
5488
- const _sfc_main$48 = /*@__PURE__*/ defineComponent({
5591
+ const _sfc_main$53 = /*@__PURE__*/ defineComponent({
5489
5592
  __name: "MenuItems",
5490
5593
  props: { items: {} },
5491
5594
  setup(__props) {
@@ -5529,8 +5632,8 @@ const _sfc_main$48 = /*@__PURE__*/ defineComponent({
5529
5632
  });
5530
5633
  //#endregion
5531
5634
  //#region src/components/dropdown-menu/DropdownMenu.vue
5532
- const contentCls = "bg-popover text-popover-foreground z-50 min-w-[8rem] overflow-hidden rounded-md border p-1 shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95";
5533
- const _sfc_main$13 = /*@__PURE__*/ defineComponent({
5635
+ const contentCls$1 = "bg-popover text-popover-foreground z-[var(--z-overlay)] min-w-[8rem] overflow-hidden rounded-md border p-1 shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95";
5636
+ const _sfc_main$16 = /*@__PURE__*/ defineComponent({
5534
5637
  name: "DropdownMenu",
5535
5638
  inheritAttrs: false,
5536
5639
  __name: "DropdownMenu",
@@ -5573,21 +5676,20 @@ const _sfc_main$13 = /*@__PURE__*/ defineComponent({
5573
5676
  const props = __props;
5574
5677
  const emit = __emit;
5575
5678
  const attrs = useAttrs();
5576
- const internalOpen = ref(props.defaultOpen);
5577
- const isOpen = computed(() => props.open ?? internalOpen.value);
5578
- function handleUpdate(open) {
5579
- internalOpen.value = open;
5580
- emit("update:open", open);
5581
- }
5679
+ const { isOpen, setOpen } = useControlledBoolean({
5680
+ controlled: () => props.open,
5681
+ defaultValue: () => props.defaultOpen,
5682
+ onChange: (open) => emit("update:open", open)
5683
+ });
5582
5684
  function handleSelect(details) {
5583
5685
  emit("select", details);
5584
5686
  }
5585
5687
  return (_ctx, _cache) => {
5586
5688
  return openBlock(), createBlock(unref(Menu).Root, {
5587
- open: isOpen.value,
5689
+ open: unref(isOpen),
5588
5690
  "lazy-mount": props.lazyMount,
5589
5691
  "unmount-on-exit": props.unmountOnExit,
5590
- "onUpdate:open": handleUpdate,
5692
+ "onUpdate:open": unref(setOpen),
5591
5693
  onSelect: handleSelect
5592
5694
  }, {
5593
5695
  default: withCtx(() => [
@@ -5599,9 +5701,9 @@ const _sfc_main$13 = /*@__PURE__*/ defineComponent({
5599
5701
  default: withCtx(() => [renderSlot(_ctx.$slots, "default")]),
5600
5702
  _: 3
5601
5703
  }, 8, ["class"]),
5602
- createVNode(unref(Menu).Positioner, { class: "z-50" }, {
5603
- default: withCtx(() => [createVNode(unref(Menu).Content, mergeProps(unref(attrs), { class: unref(cn)(contentCls, props.contentClass) }), {
5604
- default: withCtx(() => [createVNode(_sfc_main$48, { items: props.items }, createSlots({ _: 2 }, [_ctx.$slots.item ? {
5704
+ createVNode(unref(Menu).Positioner, { class: "z-[var(--z-overlay)]" }, {
5705
+ default: withCtx(() => [createVNode(unref(Menu).Content, mergeProps(unref(attrs), { class: unref(cn)(contentCls$1, props.contentClass) }), {
5706
+ default: withCtx(() => [createVNode(_sfc_main$53, { items: props.items }, createSlots({ _: 2 }, [_ctx.$slots.item ? {
5605
5707
  name: "item",
5606
5708
  fn: withCtx((slotProps) => [renderSlot(_ctx.$slots, "item", normalizeProps(guardReactiveProps(slotProps)))]),
5607
5709
  key: "0"
@@ -5615,14 +5717,15 @@ const _sfc_main$13 = /*@__PURE__*/ defineComponent({
5615
5717
  }, 8, [
5616
5718
  "open",
5617
5719
  "lazy-mount",
5618
- "unmount-on-exit"
5720
+ "unmount-on-exit",
5721
+ "onUpdate:open"
5619
5722
  ]);
5620
5723
  };
5621
5724
  }
5622
5725
  });
5623
5726
  //#endregion
5624
5727
  //#region src/components/label/Label.vue
5625
- const _sfc_main$25 = /*@__PURE__*/ defineComponent({
5728
+ const _sfc_main$28 = /*@__PURE__*/ defineComponent({
5626
5729
  __name: "Label",
5627
5730
  props: { class: {} },
5628
5731
  setup(__props) {
@@ -5634,7 +5737,7 @@ const _sfc_main$25 = /*@__PURE__*/ defineComponent({
5634
5737
  });
5635
5738
  //#endregion
5636
5739
  //#region src/components/pin-input/PinInput.vue
5637
- const _sfc_main$29 = /*@__PURE__*/ defineComponent({
5740
+ const _sfc_main$32 = /*@__PURE__*/ defineComponent({
5638
5741
  inheritAttrs: false,
5639
5742
  __name: "PinInput",
5640
5743
  props: {
@@ -5738,7 +5841,7 @@ const _sfc_main$29 = /*@__PURE__*/ defineComponent({
5738
5841
  });
5739
5842
  //#endregion
5740
5843
  //#region src/components/popover/Popover.vue
5741
- const _sfc_main$30 = /*@__PURE__*/ defineComponent({
5844
+ const _sfc_main$34 = /*@__PURE__*/ defineComponent({
5742
5845
  inheritAttrs: false,
5743
5846
  __name: "Popover",
5744
5847
  props: {
@@ -5783,12 +5886,11 @@ const _sfc_main$30 = /*@__PURE__*/ defineComponent({
5783
5886
  const props = __props;
5784
5887
  const emit = __emit;
5785
5888
  const attrs = useAttrs();
5786
- const internalOpen = ref(props.defaultOpen);
5787
- const isOpen = computed(() => props.open ?? internalOpen.value);
5788
- function handleUpdate(open) {
5789
- internalOpen.value = open;
5790
- emit("update:open", open);
5791
- }
5889
+ const { isOpen, setOpen } = useControlledBoolean({
5890
+ controlled: () => props.open,
5891
+ defaultValue: () => props.defaultOpen,
5892
+ onChange: (open) => emit("update:open", open)
5893
+ });
5792
5894
  const rootPositioning = computed(() => {
5793
5895
  const user = attrs.positioning ?? {};
5794
5896
  if (user.placement) return user;
@@ -5798,14 +5900,14 @@ const _sfc_main$30 = /*@__PURE__*/ defineComponent({
5798
5900
  placement
5799
5901
  };
5800
5902
  });
5801
- const contentClass = computed(() => cn("bg-popover text-popover-foreground z-50 w-72 rounded-md border p-4 shadow-md outline-none data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95", props.contentClass, props.contentProps?.["class"]));
5903
+ const contentClass = computed(() => cn("bg-popover text-popover-foreground z-[var(--z-overlay)] w-72 rounded-md border p-4 shadow-md outline-none data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95", props.contentClass, props.contentProps?.["class"]));
5802
5904
  return (_ctx, _cache) => {
5803
5905
  return openBlock(), createBlock(unref(Popover).Root, mergeProps(unref(attrs), {
5804
- open: isOpen.value,
5906
+ open: unref(isOpen),
5805
5907
  positioning: rootPositioning.value,
5806
5908
  "lazy-mount": props.lazyMount,
5807
5909
  "unmount-on-exit": props.unmountOnExit,
5808
- "onUpdate:open": handleUpdate
5910
+ "onUpdate:open": unref(setOpen)
5809
5911
  }), {
5810
5912
  default: withCtx(() => [
5811
5913
  createCommentVNode(" 默认插槽即触发元素本体(asChild 语义合并到子元素,不额外包裹,原 PopoverTrigger 同款实现) "),
@@ -5813,7 +5915,7 @@ const _sfc_main$30 = /*@__PURE__*/ defineComponent({
5813
5915
  default: withCtx(() => [renderSlot(_ctx.$slots, "default")]),
5814
5916
  _: 3
5815
5917
  }),
5816
- createVNode(unref(Popover).Positioner, { class: "z-50" }, {
5918
+ createVNode(unref(Popover).Positioner, { class: "z-[var(--z-overlay)]" }, {
5817
5919
  default: withCtx(() => [createVNode(unref(Popover).Content, mergeProps(props.contentProps, { class: contentClass.value }), {
5818
5920
  default: withCtx(() => [renderSlot(_ctx.$slots, "content")]),
5819
5921
  _: 3
@@ -5826,15 +5928,16 @@ const _sfc_main$30 = /*@__PURE__*/ defineComponent({
5826
5928
  "open",
5827
5929
  "positioning",
5828
5930
  "lazy-mount",
5829
- "unmount-on-exit"
5931
+ "unmount-on-exit",
5932
+ "onUpdate:open"
5830
5933
  ]);
5831
5934
  };
5832
5935
  }
5833
5936
  });
5834
5937
  //#endregion
5835
5938
  //#region src/components/separator/Separator.vue
5836
- const _hoisted_1$7 = ["data-orientation"];
5837
- const _sfc_main$34 = /*@__PURE__*/ defineComponent({
5939
+ const _hoisted_1$11 = ["data-orientation"];
5940
+ const _sfc_main$38 = /*@__PURE__*/ defineComponent({
5838
5941
  __name: "Separator",
5839
5942
  props: {
5840
5943
  orientation: { default: "horizontal" },
@@ -5847,13 +5950,13 @@ const _sfc_main$34 = /*@__PURE__*/ defineComponent({
5847
5950
  return openBlock(), createElementBlock("div", {
5848
5951
  "data-orientation": props.orientation,
5849
5952
  class: normalizeClass(unref(cn)("bg-border shrink-0", orientationClass.value, props.class))
5850
- }, null, 10, _hoisted_1$7);
5953
+ }, null, 10, _hoisted_1$11);
5851
5954
  };
5852
5955
  }
5853
5956
  });
5854
5957
  //#endregion
5855
5958
  //#region src/components/skeleton/Skeleton.vue
5856
- const _sfc_main$35 = /*@__PURE__*/ defineComponent({
5959
+ const _sfc_main$39 = /*@__PURE__*/ defineComponent({
5857
5960
  __name: "Skeleton",
5858
5961
  props: { class: {} },
5859
5962
  setup(__props) {
@@ -5900,7 +6003,7 @@ function columnRenders() {
5900
6003
  const entryVariant = typeof entry === "object" ? entry.variant : void 0;
5901
6004
  if (entryVariant !== void 0 || options?.badge !== void 0) {
5902
6005
  const variant = entryVariant ?? (options?.badge === true ? void 0 : options?.badge);
5903
- return h(_sfc_main$3, { variant }, () => label);
6006
+ return h(_sfc_main$4, { variant }, () => label);
5904
6007
  }
5905
6008
  return label;
5906
6009
  };
@@ -5928,7 +6031,7 @@ function columnRenders() {
5928
6031
  if (items.length === 0) return "";
5929
6032
  return h("div", { class: "flex items-center gap-1" }, items.map((item) => {
5930
6033
  const action = typeof item === "string" ? { text: item } : item;
5931
- return h(_sfc_main$4, {
6034
+ return h(_sfc_main$5, {
5932
6035
  size: "sm",
5933
6036
  variant: action.variant ?? "link",
5934
6037
  disabled: action.disabled?.(record, index),
@@ -5941,7 +6044,7 @@ function columnRenders() {
5941
6044
  }
5942
6045
  //#endregion
5943
6046
  //#region src/components/tooltip/Tooltip.vue
5944
- const _sfc_main$43 = /*@__PURE__*/ defineComponent({
6047
+ const _sfc_main$47 = /*@__PURE__*/ defineComponent({
5945
6048
  __name: "Tooltip",
5946
6049
  props: {
5947
6050
  /** 提示文字;#content 插槽可覆盖以渲染富内容 */
@@ -5992,20 +6095,19 @@ const _sfc_main$43 = /*@__PURE__*/ defineComponent({
5992
6095
  const props = __props;
5993
6096
  const emit = __emit;
5994
6097
  const slots = useSlots();
5995
- const internalOpen = ref(props.defaultOpen);
5996
- const isOpen = computed(() => props.open ?? internalOpen.value);
5997
- function handleUpdate(open) {
5998
- internalOpen.value = open;
5999
- emit("update:open", open);
6000
- }
6098
+ const { isOpen, setOpen } = useControlledBoolean({
6099
+ controlled: () => props.open,
6100
+ defaultValue: () => props.defaultOpen,
6101
+ onChange: (open) => emit("update:open", open)
6102
+ });
6001
6103
  return (_ctx, _cache) => {
6002
6104
  return openBlock(), createBlock(unref(Tooltip).Root, {
6003
- open: isOpen.value,
6105
+ open: unref(isOpen),
6004
6106
  "open-delay": props.delayDuration,
6005
6107
  "close-delay": props.closeDuration,
6006
6108
  "lazy-mount": props.lazyMount,
6007
6109
  "unmount-on-exit": props.unmountOnExit,
6008
- "onUpdate:open": handleUpdate
6110
+ "onUpdate:open": unref(setOpen)
6009
6111
  }, {
6010
6112
  default: withCtx(() => [
6011
6113
  createCommentVNode(" 默认插槽即触发元素本身:Ark Trigger asChild 把行为(hover/focus、aria)合并其上,\n 不额外包裹元素。省略默认插槽即为纯受控气泡(open 驱动,配合 #content) "),
@@ -6016,8 +6118,8 @@ const _sfc_main$43 = /*@__PURE__*/ defineComponent({
6016
6118
  default: withCtx(() => [renderSlot(_ctx.$slots, "default")]),
6017
6119
  _: 3
6018
6120
  })) : createCommentVNode("v-if", true),
6019
- createVNode(unref(Tooltip).Positioner, { class: "z-50" }, {
6020
- default: withCtx(() => [createVNode(unref(Tooltip).Content, mergeProps(props.contentProps, { class: unref(cn)("bg-primary text-primary-foreground z-50 w-fit rounded-md px-3 py-1.5 text-sm data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95", props.contentClass) }), {
6121
+ createVNode(unref(Tooltip).Positioner, { class: "z-[var(--z-overlay)]" }, {
6122
+ default: withCtx(() => [createVNode(unref(Tooltip).Content, mergeProps(props.contentProps, { class: unref(cn)("bg-primary text-primary-foreground z-[var(--z-overlay)] w-fit rounded-md px-3 py-1.5 text-sm data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95", props.contentClass) }), {
6021
6123
  default: withCtx(() => [renderSlot(_ctx.$slots, "content", {}, () => [createTextVNode(toDisplayString(props.content), 1)])]),
6022
6124
  _: 3
6023
6125
  }, 16, ["class"])]),
@@ -6030,18 +6132,182 @@ const _sfc_main$43 = /*@__PURE__*/ defineComponent({
6030
6132
  "open-delay",
6031
6133
  "close-delay",
6032
6134
  "lazy-mount",
6033
- "unmount-on-exit"
6135
+ "unmount-on-exit",
6136
+ "onUpdate:open"
6034
6137
  ]);
6035
6138
  };
6036
6139
  }
6037
6140
  });
6038
6141
  //#endregion
6142
+ //#region src/components/table-render/constants.ts
6143
+ /** 选择列在 sticky 映射中的哨兵键(选择列不在 columns 内,表头/表体单独渲染) */
6144
+ const SELECTION_CELL = "__selection__";
6145
+ //#endregion
6146
+ //#region src/components/table-render/sticky.ts
6147
+ /** sticky 定位样式;head 为 true 时 z-index 高于表体(表头压住表体 sticky) */
6148
+ function stickyStyle(sticky, key, head = false) {
6149
+ const info = sticky.get(key);
6150
+ if (!info) return void 0;
6151
+ return {
6152
+ position: "sticky",
6153
+ [info.side]: `${info.offset}px`,
6154
+ zIndex: head ? "var(--z-sticky-head)" : "var(--z-sticky)"
6155
+ };
6156
+ }
6157
+ /** sticky 底色(防滚动透出)与交界分隔边框 */
6158
+ function stickyClass(sticky, key) {
6159
+ const info = sticky.get(key);
6160
+ if (!info) return void 0;
6161
+ return [
6162
+ "bg-background",
6163
+ info.side === "left" && info.edge ? "border-r border-border" : "",
6164
+ info.side === "right" && info.edge ? "border-l border-border" : ""
6165
+ ];
6166
+ }
6167
+ //#endregion
6168
+ //#region src/components/table-render/TableBodyRow.vue
6169
+ const _hoisted_1$10 = [
6170
+ "checked",
6171
+ "disabled",
6172
+ "aria-label"
6173
+ ];
6174
+ const _hoisted_2$9 = ["title", "onClick"];
6175
+ const _hoisted_3$6 = ["aria-expanded", "aria-label"];
6176
+ const _hoisted_4$3 = {
6177
+ key: 2,
6178
+ class: "min-w-0 truncate"
6179
+ };
6180
+ const _sfc_main$52 = /*@__PURE__*/ defineComponent({
6181
+ __name: "TableBodyRow",
6182
+ props: {
6183
+ /** 表体行数据(cells 值矩阵已由父层按可见列计算) */
6184
+ line: {
6185
+ type: Object,
6186
+ required: true
6187
+ },
6188
+ /** 可见业务列(与 line.cells 同序) */
6189
+ columns: {
6190
+ type: Array,
6191
+ required: true
6192
+ },
6193
+ /** 选择列形态;undefined 不渲染选择单元格 */
6194
+ selection: {
6195
+ type: String,
6196
+ default: void 0
6197
+ },
6198
+ selected: {
6199
+ type: Boolean,
6200
+ default: false
6201
+ },
6202
+ sticky: {
6203
+ type: Object,
6204
+ required: true
6205
+ },
6206
+ /** 树形缩进基准 px;undefined 表示未启用树形(不渲染 depth 缩进与 caret) */
6207
+ treeIndent: {
6208
+ type: Number,
6209
+ default: void 0
6210
+ }
6211
+ },
6212
+ emits: [
6213
+ "select",
6214
+ "row-click",
6215
+ "row-dblclick",
6216
+ "row-contextmenu",
6217
+ "cell-click"
6218
+ ],
6219
+ setup(__props, { emit: __emit }) {
6220
+ const props = __props;
6221
+ const emit = __emit;
6222
+ function cellText(line, index) {
6223
+ const value = line.cells[index];
6224
+ return isVNode(value) ? "" : String(value ?? "");
6225
+ }
6226
+ /** ellipsis: "tooltip" 的单元格内容:默认插槽承载截断内容(触发元素本体,不额外包裹),content 显示完整文本。
6227
+ * VNode(render 工厂)单元格经 cloneVNode 复制进触发位(VNode 不可二次挂载)。 */
6228
+ function tooltipCell(value, text) {
6229
+ const trigger = isVNode(value) ? cloneVNode(value) : h("span", { class: "block truncate" }, text);
6230
+ return h(_sfc_main$47, {
6231
+ delayDuration: 0,
6232
+ content: text
6233
+ }, { default: () => [trigger] });
6234
+ }
6235
+ return (_ctx, _cache) => {
6236
+ return openBlock(), createElementBlock("tr", {
6237
+ class: "border-b transition-colors hover:bg-muted/50",
6238
+ onClick: _cache[4] || (_cache[4] = ($event) => emit("row-click", $event)),
6239
+ onDblclick: _cache[5] || (_cache[5] = ($event) => emit("row-dblclick", $event)),
6240
+ onContextmenu: _cache[6] || (_cache[6] = ($event) => emit("row-contextmenu", $event))
6241
+ }, [
6242
+ createCommentVNode(" 选择单元格:阻断冒泡避免触发行 row-click(S5);radio 为原生控件 "),
6243
+ props.selection ? (openBlock(), createElementBlock("td", {
6244
+ key: 0,
6245
+ class: normalizeClass(["w-12 p-2 align-middle", unref(stickyClass)(props.sticky, unref(SELECTION_CELL))]),
6246
+ style: normalizeStyle(unref(stickyStyle)(props.sticky, unref(SELECTION_CELL), false)),
6247
+ onClick: _cache[2] || (_cache[2] = withModifiers(() => {}, ["stop"]))
6248
+ }, [props.selection === "radio" ? (openBlock(), createElementBlock("input", {
6249
+ key: 0,
6250
+ type: "radio",
6251
+ class: "accent-primary size-4 cursor-pointer disabled:cursor-not-allowed disabled:opacity-50",
6252
+ checked: props.selected,
6253
+ disabled: !props.line.canSelect,
6254
+ "aria-label": `选择第 ${props.line.index + 1} 行`,
6255
+ onClick: _cache[0] || (_cache[0] = ($event) => emit("select", !props.selected))
6256
+ }, null, 8, _hoisted_1$10)) : (openBlock(), createBlock(unref(_sfc_main$9), {
6257
+ key: 1,
6258
+ checked: props.selected,
6259
+ disabled: !props.line.canSelect,
6260
+ "aria-label": `选择第 ${props.line.index + 1} 行`,
6261
+ "onUpdate:checked": _cache[1] || (_cache[1] = (checked) => emit("select", checked))
6262
+ }, null, 8, [
6263
+ "checked",
6264
+ "disabled",
6265
+ "aria-label"
6266
+ ]))], 6)) : createCommentVNode("v-if", true),
6267
+ (openBlock(true), createElementBlock(Fragment, null, renderList(props.line.cells, (value, index) => {
6268
+ return openBlock(), createElementBlock("td", {
6269
+ key: props.columns[index].key,
6270
+ class: normalizeClass(["p-2 align-middle", [unref(stickyClass)(props.sticky, props.columns[index].key), { truncate: props.columns[index].ellipsis === true }]]),
6271
+ title: props.columns[index].ellipsis === true ? cellText(props.line, index) : void 0,
6272
+ style: normalizeStyle([{ textAlign: props.columns[index].align }, unref(stickyStyle)(props.sticky, props.columns[index].key, false)]),
6273
+ onClick: ($event) => emit("cell-click", props.columns[index].key, $event)
6274
+ }, [createCommentVNode(" 首列(tree 启用时):depth 缩进 + 展开 caret(点击 stop 避免误触发行点击) "), props.treeIndent !== void 0 && index === 0 ? (openBlock(), createElementBlock("span", {
6275
+ key: 0,
6276
+ class: "inline-flex max-w-full items-center gap-1",
6277
+ style: normalizeStyle({ marginLeft: `${props.line.row.depth * props.treeIndent}px` })
6278
+ }, [
6279
+ props.line.row.getCanExpand() ? (openBlock(), createElementBlock("button", {
6280
+ key: 0,
6281
+ type: "button",
6282
+ class: "hover:bg-muted text-muted-foreground inline-flex size-4 shrink-0 cursor-pointer items-center justify-center rounded-sm",
6283
+ "aria-expanded": props.line.row.getIsExpanded(),
6284
+ "aria-label": props.line.row.getIsExpanded() ? "收起" : "展开",
6285
+ onClick: _cache[3] || (_cache[3] = withModifiers(($event) => props.line.row.toggleExpanded(), ["stop"]))
6286
+ }, [(openBlock(), createElementBlock("svg", {
6287
+ xmlns: "http://www.w3.org/2000/svg",
6288
+ viewBox: "0 0 24 24",
6289
+ fill: "none",
6290
+ stroke: "currentColor",
6291
+ "stroke-width": "2",
6292
+ "stroke-linecap": "round",
6293
+ "stroke-linejoin": "round",
6294
+ class: normalizeClass(["size-3.5 transition-transform", { "rotate-90": props.line.row.getIsExpanded() }]),
6295
+ "aria-hidden": "true"
6296
+ }, [..._cache[7] || (_cache[7] = [createElementVNode("path", { d: "m9 18 6-6-6-6" }, null, -1)])], 2))], 8, _hoisted_3$6)) : createCommentVNode("v-if", true),
6297
+ createCommentVNode(" VNode 必须走子节点渲染;文本插值会序列化 vnode 导致循环引用 "),
6298
+ isVNode(value) ? (openBlock(), createBlock(resolveDynamicComponent(value), { key: 1 })) : (openBlock(), createElementBlock("span", _hoisted_4$3, toDisplayString(value), 1))
6299
+ ], 4)) : props.columns[index].ellipsis === "tooltip" ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [createCommentVNode(" ellipsis: \"tooltip\":Tooltip 包装(VNode 经 cloneVNode 复制,避免二次挂载) "), (openBlock(), createBlock(resolveDynamicComponent(tooltipCell(value, cellText(props.line, index)))))], 2112)) : (openBlock(), createElementBlock(Fragment, { key: 2 }, [createCommentVNode(" VNode 必须走子节点渲染;文本插值会序列化 vnode 导致循环引用 "), isVNode(value) ? (openBlock(), createBlock(resolveDynamicComponent(value), { key: 0 })) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [createTextVNode(toDisplayString(value), 1)], 64))], 64))], 14, _hoisted_2$9);
6300
+ }), 128))
6301
+ ], 32);
6302
+ };
6303
+ }
6304
+ });
6305
+ //#endregion
6039
6306
  //#region src/components/table-render/TablePagination.vue
6040
- const _hoisted_1$6 = { class: "flex w-full items-center justify-between gap-4 border-t p-2 text-sm" };
6041
- const _hoisted_2$5 = { class: "flex items-center gap-2 text-muted-foreground" };
6042
- const _hoisted_3$4 = ["value"];
6043
- const _hoisted_4$3 = ["value"];
6044
- const _sfc_main$47 = /*@__PURE__*/ defineComponent({
6307
+ const _hoisted_1$9 = { class: "flex items-center gap-2 text-muted-foreground" };
6308
+ const _hoisted_2$8 = ["value"];
6309
+ const _hoisted_3$5 = ["value"];
6310
+ const _sfc_main$51 = /*@__PURE__*/ defineComponent({
6045
6311
  __name: "TablePagination",
6046
6312
  props: {
6047
6313
  pageIndex: {},
@@ -6074,8 +6340,8 @@ const _sfc_main$47 = /*@__PURE__*/ defineComponent({
6074
6340
  return items;
6075
6341
  });
6076
6342
  return (_ctx, _cache) => {
6077
- return openBlock(), createElementBlock("div", _hoisted_1$6, [
6078
- createElementVNode("div", _hoisted_2$5, [createElementVNode("span", null, "共 " + toDisplayString(__props.total) + " 条", 1), createElementVNode("select", {
6343
+ return openBlock(), createElementBlock("div", { class: normalizeClass(unref(cn)("flex w-full items-center justify-between gap-4 border-t p-2 text-sm", _ctx.$attrs.class)) }, [
6344
+ createElementVNode("div", _hoisted_1$9, [createElementVNode("span", null, "共 " + toDisplayString(__props.total) + " 条", 1), createElementVNode("select", {
6079
6345
  class: "h-8 rounded-md border bg-transparent px-2 text-sm",
6080
6346
  value: __props.pageSize,
6081
6347
  onChange: _cache[0] || (_cache[0] = ($event) => emit("update:pageSize", Number($event.target.value)))
@@ -6083,8 +6349,8 @@ const _sfc_main$47 = /*@__PURE__*/ defineComponent({
6083
6349
  return openBlock(), createElementBlock("option", {
6084
6350
  key: size,
6085
6351
  value: size
6086
- }, toDisplayString(size) + " 条/页", 9, _hoisted_4$3);
6087
- }), 128))], 40, _hoisted_3$4)]),
6352
+ }, toDisplayString(size) + " 条/页", 9, _hoisted_3$5);
6353
+ }), 128))], 40, _hoisted_2$8)]),
6088
6354
  createCommentVNode(" Root 渲染为裸 nav 且 Ellipsis 是块级 div,必须显式 flex 才不会断行 "),
6089
6355
  createVNode(unref(PaginationRoot), {
6090
6356
  class: "flex items-center gap-1",
@@ -6103,7 +6369,7 @@ const _sfc_main$47 = /*@__PURE__*/ defineComponent({
6103
6369
  _: 1
6104
6370
  }, 8, ["disabled"]),
6105
6371
  (openBlock(true), createElementBlock(Fragment, null, renderList(pages.value, (item, index) => {
6106
- return openBlock(), createElementBlock(Fragment, { key: item }, [typeof item === "string" ? (openBlock(), createBlock(unref(PaginationEllipsis), {
6372
+ return openBlock(), createElementBlock(Fragment, { key: typeof item === "number" ? item : `gap-${index}` }, [typeof item === "string" ? (openBlock(), createBlock(unref(PaginationEllipsis), {
6107
6373
  key: 0,
6108
6374
  index
6109
6375
  }, null, 8, ["index"])) : (openBlock(), createBlock(unref(PaginationItem), {
@@ -6130,7 +6396,7 @@ const _sfc_main$47 = /*@__PURE__*/ defineComponent({
6130
6396
  "page",
6131
6397
  "page-size"
6132
6398
  ])
6133
- ]);
6399
+ ], 2);
6134
6400
  };
6135
6401
  }
6136
6402
  });
@@ -6444,7 +6710,6 @@ function useTableRender(options) {
6444
6710
  visibleKeysInternal.value = normalizeVisibleKeys(keys);
6445
6711
  }
6446
6712
  watch(controlledVisibleKeys, (next) => {
6447
- console.log("DBG vk watch fired:", JSON.stringify(next));
6448
6713
  if (next === void 0) return;
6449
6714
  const normalized = normalizeVisibleKeys(next);
6450
6715
  if (sameVisibleKeys(normalized, visibleKeysInternal.value)) return;
@@ -6544,17 +6809,16 @@ function useTableRender(options) {
6544
6809
  }
6545
6810
  //#endregion
6546
6811
  //#region src/components/table-render/TableRender.vue
6547
- const _hoisted_1$5 = { class: "w-full" };
6548
- const _hoisted_2$4 = {
6812
+ const _hoisted_1$8 = {
6549
6813
  key: 0,
6550
6814
  class: "mb-2 flex items-end justify-between gap-2"
6551
6815
  };
6552
- const _hoisted_3$3 = { class: "flex items-center justify-end gap-3 px-3 py-2" };
6553
- const _hoisted_4$2 = ["disabled"];
6554
- const _hoisted_5$1 = { class: "max-h-64 overflow-y-auto py-1" };
6555
- const _hoisted_6$1 = ["data-column-key", "onClick"];
6556
- const _hoisted_7$1 = { class: "min-w-0 flex-1 truncate" };
6557
- const _hoisted_8 = {
6816
+ const _hoisted_2$7 = { class: "flex items-center justify-end gap-3 px-3 py-2" };
6817
+ const _hoisted_3$4 = ["disabled"];
6818
+ const _hoisted_4$2 = { class: "max-h-64 overflow-y-auto py-1" };
6819
+ const _hoisted_5$1 = ["data-column-key", "onClick"];
6820
+ const _hoisted_6$1 = { class: "min-w-0 flex-1 truncate" };
6821
+ const _hoisted_7$1 = {
6558
6822
  key: 0,
6559
6823
  xmlns: "http://www.w3.org/2000/svg",
6560
6824
  viewBox: "0 0 24 24",
@@ -6566,69 +6830,25 @@ const _hoisted_8 = {
6566
6830
  class: "text-muted-foreground size-3 shrink-0",
6567
6831
  "aria-hidden": "true"
6568
6832
  };
6569
- const _hoisted_9 = { class: "w-full caption-bottom text-sm" };
6570
- const _hoisted_10 = ["aria-sort"];
6571
- const _hoisted_11 = ["onClick"];
6572
- const _hoisted_12 = {
6833
+ const _hoisted_8 = { class: "w-full caption-bottom text-sm" };
6834
+ const _hoisted_9 = ["aria-sort"];
6835
+ const _hoisted_10 = ["onClick"];
6836
+ const _hoisted_11 = {
6573
6837
  "aria-hidden": "true",
6574
6838
  class: "text-xs"
6575
6839
  };
6576
- const _hoisted_13 = { class: "[&_tr:last-child]:border-0" };
6577
- const _hoisted_14 = { "data-error": "" };
6578
- const _hoisted_15 = ["colspan"];
6579
- const _hoisted_16 = { class: "flex flex-col items-center gap-3" };
6840
+ const _hoisted_12 = { class: "[&_tr:last-child]:border-0" };
6841
+ const _hoisted_13 = { "data-error": "" };
6842
+ const _hoisted_14 = ["colspan"];
6843
+ const _hoisted_15 = { class: "flex flex-col items-center gap-3" };
6844
+ const _hoisted_16 = ["colspan"];
6580
6845
  const _hoisted_17 = ["colspan"];
6581
- const _hoisted_18 = [
6582
- "data-index",
6583
- "onClick",
6584
- "onDblclick",
6585
- "onContextmenu"
6586
- ];
6587
- const _hoisted_19 = [
6588
- "checked",
6589
- "disabled",
6590
- "aria-label",
6591
- "onClick"
6592
- ];
6593
- const _hoisted_20 = ["title", "onClick"];
6594
- const _hoisted_21 = [
6595
- "aria-expanded",
6596
- "aria-label",
6597
- "onClick"
6598
- ];
6599
- const _hoisted_22 = {
6600
- key: 2,
6601
- class: "min-w-0 truncate"
6602
- };
6603
- const _hoisted_23 = ["colspan"];
6604
- const _hoisted_24 = [
6605
- "onClick",
6606
- "onDblclick",
6607
- "onContextmenu"
6608
- ];
6609
- const _hoisted_25 = [
6610
- "checked",
6611
- "disabled",
6612
- "aria-label",
6613
- "onClick"
6614
- ];
6615
- const _hoisted_26 = ["title", "onClick"];
6616
- const _hoisted_27 = [
6617
- "aria-expanded",
6618
- "aria-label",
6619
- "onClick"
6620
- ];
6621
- const _hoisted_28 = {
6622
- key: 2,
6623
- class: "min-w-0 truncate"
6624
- };
6625
- const _hoisted_29 = {
6846
+ const _hoisted_18 = {
6626
6847
  key: 4,
6627
6848
  "data-empty": ""
6628
6849
  };
6629
- const _hoisted_30 = ["colspan"];
6630
- const SELECTION_CELL = "__selection__";
6631
- const _sfc_main$39 = /*@__PURE__*/ defineComponent({
6850
+ const _hoisted_19 = ["colspan"];
6851
+ const _sfc_main$43 = /*@__PURE__*/ defineComponent({
6632
6852
  __name: "TableRender",
6633
6853
  props: {
6634
6854
  /** 聚合式(推荐):defineTable 返回的定义对象 */
@@ -6808,7 +7028,6 @@ const _sfc_main$39 = /*@__PURE__*/ defineComponent({
6808
7028
  });
6809
7029
  /** 总列数 = 可见业务列 + 选择列(空态 colspan 与骨架行,S8/R23) */
6810
7030
  const columnCount = computed(() => visibleColumns.value.length + (hasSelection.value ? 1 : 0));
6811
- /** 选择列在 sticky 映射中的哨兵键(选择列不在 columns 内,模板单独渲染) */
6812
7031
  for (const column of columns.value) if (column.fixed !== void 0 && typeof column.width !== "number") console.warn(`[tu-design] <TableRender> fixed 列 "${column.key}" 需要数字 width,已忽略 fixed。`);
6813
7032
  /** sticky 单元格映射(纯渲染层 computed,不进 TanStack pinning state):
6814
7033
  * 选择列视作最左 fixed 列参与累计(offset 0);fixed-left 按列序累加,
@@ -6854,26 +7073,6 @@ const _sfc_main$39 = /*@__PURE__*/ defineComponent({
6854
7073
  }
6855
7074
  return map;
6856
7075
  });
6857
- /** sticky 定位样式;head 为 true 时 z-index 高于表体(表头 sticky 压住表体 sticky) */
6858
- function stickyStyle(key, head) {
6859
- const sticky = stickyOf.value.get(key);
6860
- if (!sticky) return void 0;
6861
- return {
6862
- position: "sticky",
6863
- [sticky.side]: `${sticky.offset}px`,
6864
- zIndex: head ? 20 : 10
6865
- };
6866
- }
6867
- /** sticky 底色(防滚动透出)与交界分隔边框 */
6868
- function stickyClass(key) {
6869
- const sticky = stickyOf.value.get(key);
6870
- if (!sticky) return void 0;
6871
- return [
6872
- "bg-background",
6873
- sticky.side === "left" && sticky.edge ? "border-r border-border" : "",
6874
- sticky.side === "right" && sticky.edge ? "border-l border-border" : ""
6875
- ];
6876
- }
6877
7076
  /** 表头全选三态(S10):本页可选行与选中集求交派生(TanStack getter 追踪不稳,自算) */
6878
7077
  const selectableKeys = computed(() => rows.value.filter((row) => row.getCanSelect()).map((row) => rowKeyOf(row.original, row.index)));
6879
7078
  const headerChecked = computed(() => hasSelection.value && selection.value.type === "checkbox" && selectableKeys.value.length > 0 && selectableKeys.value.every((key) => selectedKeys.value.has(key)));
@@ -6955,9 +7154,11 @@ const _sfc_main$39 = /*@__PURE__*/ defineComponent({
6955
7154
  const items = virtualRows.value;
6956
7155
  return items.length === 0 ? 0 : Math.max(0, virtualTotal.value - items[items.length - 1].end);
6957
7156
  });
6958
- /** 行高动态测量:measureElement 读 data-index 把实测高度写回(行内容高度可变,不假设固定行高) */
7157
+ /** 行高动态测量:measureElement 读 data-index 把实测高度写回(行内容高度可变,不假设固定行高)。
7158
+ * 行组件为函数 ref,拿到的是组件实例,需经 $el 取真实 tr。 */
6959
7159
  function measureRow(node) {
6960
- if (node instanceof Element) virtualizerRef?.value.measureElement(node);
7160
+ const el = node instanceof Element ? node : node?.$el;
7161
+ if (el instanceof Element) virtualizerRef?.value.measureElement(el);
6961
7162
  }
6962
7163
  /** aria-sort 仅在该列当前被排序时标注(R16) */
6963
7164
  function ariaSort(column) {
@@ -6968,10 +7169,6 @@ const _sfc_main$39 = /*@__PURE__*/ defineComponent({
6968
7169
  const direction = instance.sort.value?.key === column.key ? instance.sort.value.direction : "";
6969
7170
  return direction === "asc" ? "↑" : direction === "desc" ? "↓" : "";
6970
7171
  }
6971
- function cellText(line, index) {
6972
- const value = line.cells[index];
6973
- return isVNode(value) ? "" : String(value ?? "");
6974
- }
6975
7172
  function onSort(key) {
6976
7173
  instance.toggleSort(key);
6977
7174
  emit("sort-change", instance.sort.value);
@@ -7013,15 +7210,6 @@ const _sfc_main$39 = /*@__PURE__*/ defineComponent({
7013
7210
  function onCellClick(record, columnKey, index, event) {
7014
7211
  emit("cell-click", record, columnKey, index, event);
7015
7212
  }
7016
- /** ellipsis: "tooltip" 的单元格内容:默认插槽承载截断内容(触发元素本体,不额外包裹),content 显示完整文本。
7017
- * VNode(render 工厂)单元格经 cloneVNode 复制进触发位(VNode 不可二次挂载)。 */
7018
- function tooltipCell(value, text) {
7019
- const trigger = isVNode(value) ? cloneVNode(value) : h("span", { class: "block truncate" }, text);
7020
- return h(_sfc_main$43, {
7021
- delayDuration: 0,
7022
- content: text
7023
- }, { default: () => [trigger] });
7024
- }
7025
7213
  __expose({
7026
7214
  table: instance.table,
7027
7215
  page: instance.page,
@@ -7040,10 +7228,10 @@ const _sfc_main$39 = /*@__PURE__*/ defineComponent({
7040
7228
  clearSelection: instance.clearSelection
7041
7229
  });
7042
7230
  return (_ctx, _cache) => {
7043
- return openBlock(), createElementBlock("div", _hoisted_1$5, [
7231
+ return openBlock(), createElementBlock("div", { class: normalizeClass(unref(cn)("w-full", _ctx.$attrs.class)) }, [
7044
7232
  createCommentVNode(" 搜索区 + 列设置触发器:同行右对齐(items-end);无搜索时触发器位于表格上方 "),
7045
- unref(search) || showColumnSettings.value ? (openBlock(), createElementBlock("div", _hoisted_2$4, [
7046
- unref(search) ? (openBlock(), createBlock(unref(_sfc_main$22), {
7233
+ unref(search) || showColumnSettings.value ? (openBlock(), createElementBlock("div", _hoisted_1$8, [
7234
+ unref(search) ? (openBlock(), createBlock(unref(_sfc_main$25), {
7047
7235
  key: 0,
7048
7236
  class: "min-w-0 flex-1",
7049
7237
  definition: unref(search),
@@ -7053,23 +7241,23 @@ const _sfc_main$39 = /*@__PURE__*/ defineComponent({
7053
7241
  }, null, 8, ["definition"])) : createCommentVNode("v-if", true),
7054
7242
  createCommentVNode(" 列设置:Popover 面板(R20 最少一列 / R21 重置 / R22 不含选择列);\n 触发钮 Tooltip 手动受控开合(Tooltip 与 Popover 触发器嵌套会吞点击,故并列渲染、不走 hover 自动触发) "),
7055
7243
  showColumnSettings.value ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
7056
- createVNode(unref(_sfc_main$30), {
7244
+ createVNode(unref(_sfc_main$34), {
7057
7245
  align: "end",
7058
7246
  "content-class": "w-56 p-0"
7059
7247
  }, {
7060
7248
  content: withCtx(() => [
7061
- createElementVNode("div", _hoisted_3$3, [createElementVNode("button", {
7249
+ createElementVNode("div", _hoisted_2$7, [createElementVNode("button", {
7062
7250
  type: "button",
7063
7251
  class: "text-muted-foreground hover:text-foreground cursor-pointer text-xs disabled:cursor-not-allowed disabled:opacity-50",
7064
7252
  disabled: allColumnsVisible.value,
7065
7253
  onClick: selectAllColumns
7066
- }, " 全选 ", 8, _hoisted_4$2), createElementVNode("button", {
7254
+ }, " 全选 ", 8, _hoisted_3$4), createElementVNode("button", {
7067
7255
  type: "button",
7068
7256
  class: "text-muted-foreground hover:text-foreground cursor-pointer text-xs",
7069
7257
  onClick: resetColumns
7070
7258
  }, " 重置 ")]),
7071
- createVNode(unref(_sfc_main$34)),
7072
- createElementVNode("div", _hoisted_5$1, [(openBlock(true), createElementBlock(Fragment, null, renderList(columns.value, (column) => {
7259
+ createVNode(unref(_sfc_main$38)),
7260
+ createElementVNode("div", _hoisted_4$2, [(openBlock(true), createElementBlock(Fragment, null, renderList(columns.value, (column) => {
7073
7261
  return openBlock(), createElementBlock("div", {
7074
7262
  key: column.key,
7075
7263
  "data-column-item": "",
@@ -7077,18 +7265,23 @@ const _sfc_main$39 = /*@__PURE__*/ defineComponent({
7077
7265
  class: "hover:bg-accent/50 flex h-8 cursor-pointer items-center gap-2 px-3",
7078
7266
  onClick: ($event) => toggleColumnVisible(column.key)
7079
7267
  }, [
7080
- createVNode(unref(_sfc_main$8), {
7268
+ createVNode(unref(_sfc_main$9), {
7081
7269
  checked: isColumnVisible(column.key),
7082
7270
  disabled: !canHideColumn(column.key),
7271
+ "onUpdate:checked": ($event) => toggleColumnVisible(column.key),
7083
7272
  onClick: _cache[2] || (_cache[2] = withModifiers(() => {}, ["stop"]))
7084
- }, null, 8, ["checked", "disabled"]),
7085
- createElementVNode("span", _hoisted_7$1, toDisplayString(column.title), 1),
7273
+ }, null, 8, [
7274
+ "checked",
7275
+ "disabled",
7276
+ "onUpdate:checked"
7277
+ ]),
7278
+ createElementVNode("span", _hoisted_6$1, toDisplayString(column.title), 1),
7086
7279
  createCommentVNode(" 有效 fixed 列(数字 width)标识 "),
7087
- column.fixed !== void 0 && typeof column.width === "number" ? (openBlock(), createElementBlock("svg", _hoisted_8, [..._cache[6] || (_cache[6] = [createElementVNode("path", { d: "M12 17v5" }, null, -1), createElementVNode("path", { d: "M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7h1a2 2 0 0 0 0-4H8a2 2 0 0 0 0 4h1z" }, null, -1)])])) : createCommentVNode("v-if", true)
7088
- ], 8, _hoisted_6$1);
7280
+ column.fixed !== void 0 && typeof column.width === "number" ? (openBlock(), createElementBlock("svg", _hoisted_7$1, [..._cache[4] || (_cache[4] = [createElementVNode("path", { d: "M12 17v5" }, null, -1), createElementVNode("path", { d: "M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7h1a2 2 0 0 0 0-4H8a2 2 0 0 0 0 4h1z" }, null, -1)])])) : createCommentVNode("v-if", true)
7281
+ ], 8, _hoisted_5$1);
7089
7282
  }), 128))])
7090
7283
  ]),
7091
- default: withCtx(() => [createVNode(unref(_sfc_main$4), {
7284
+ default: withCtx(() => [createVNode(unref(_sfc_main$5), {
7092
7285
  variant: "ghost",
7093
7286
  size: "icon",
7094
7287
  "aria-label": "列设置",
@@ -7096,7 +7289,7 @@ const _sfc_main$39 = /*@__PURE__*/ defineComponent({
7096
7289
  onPointerenter: _cache[0] || (_cache[0] = ($event) => settingsTipOpen.value = true),
7097
7290
  onPointerleave: _cache[1] || (_cache[1] = ($event) => settingsTipOpen.value = false)
7098
7291
  }, {
7099
- default: withCtx(() => [createCommentVNode(" lucide Settings2(内联 SVG,跟随项目图标现状) "), _cache[5] || (_cache[5] = createElementVNode("svg", {
7292
+ default: withCtx(() => [createCommentVNode(" lucide Settings2(内联 SVG,跟随项目图标现状) "), _cache[3] || (_cache[3] = createElementVNode("svg", {
7100
7293
  xmlns: "http://www.w3.org/2000/svg",
7101
7294
  viewBox: "0 0 24 24",
7102
7295
  fill: "none",
@@ -7125,7 +7318,7 @@ const _sfc_main$39 = /*@__PURE__*/ defineComponent({
7125
7318
  _: 1
7126
7319
  }),
7127
7320
  createCommentVNode(" 纯受控气泡(无默认插槽,不渲染触发器):开合由触发钮 pointerenter/leave 驱动 "),
7128
- createVNode(unref(_sfc_main$43), {
7321
+ createVNode(unref(_sfc_main$47), {
7129
7322
  open: settingsTipOpen.value,
7130
7323
  content: "列设置"
7131
7324
  }, null, 8, ["open"])
@@ -7140,7 +7333,7 @@ const _sfc_main$39 = /*@__PURE__*/ defineComponent({
7140
7333
  height: scrollHeight.value,
7141
7334
  overflowY: "auto"
7142
7335
  } : void 0)
7143
- }, [createElementVNode("table", _hoisted_9, [createElementVNode("thead", {
7336
+ }, [createElementVNode("table", _hoisted_8, [createElementVNode("thead", {
7144
7337
  ref_key: "theadEl",
7145
7338
  ref: theadEl,
7146
7339
  class: "[&_tr]:border-b"
@@ -7149,9 +7342,9 @@ const _sfc_main$39 = /*@__PURE__*/ defineComponent({
7149
7342
  hasSelection.value ? (openBlock(), createElementBlock("th", {
7150
7343
  key: 0,
7151
7344
  scope: "col",
7152
- class: normalizeClass(["h-10 w-12 px-2 align-middle font-medium text-muted-foreground", stickyClass(SELECTION_CELL)]),
7153
- style: normalizeStyle([{ width: `${selection.value.width}px` }, stickyStyle(SELECTION_CELL, true)])
7154
- }, [selection.value.type === "checkbox" ? (openBlock(), createBlock(unref(_sfc_main$8), {
7345
+ class: normalizeClass(["h-10 w-12 px-2 align-middle font-medium text-muted-foreground", unref(stickyClass)(stickyOf.value, unref(SELECTION_CELL))]),
7346
+ style: normalizeStyle([{ width: `${selection.value.width}px` }, unref(stickyStyle)(stickyOf.value, unref(SELECTION_CELL), true)])
7347
+ }, [selection.value.type === "checkbox" ? (openBlock(), createBlock(unref(_sfc_main$9), {
7155
7348
  key: 0,
7156
7349
  checked: headerIndeterminate.value ? "indeterminate" : headerChecked.value,
7157
7350
  "aria-label": "全选本页",
@@ -7161,20 +7354,20 @@ const _sfc_main$39 = /*@__PURE__*/ defineComponent({
7161
7354
  return openBlock(), createElementBlock("th", {
7162
7355
  key: column.key,
7163
7356
  scope: "col",
7164
- class: normalizeClass(["h-10 px-2 align-middle font-medium text-muted-foreground", stickyClass(column.key)]),
7357
+ class: normalizeClass(["h-10 px-2 align-middle font-medium text-muted-foreground", unref(stickyClass)(stickyOf.value, column.key)]),
7165
7358
  style: normalizeStyle([{
7166
7359
  width: column.width,
7167
7360
  textAlign: column.align
7168
- }, stickyStyle(column.key, true)]),
7361
+ }, unref(stickyStyle)(stickyOf.value, column.key, true)]),
7169
7362
  "aria-sort": ariaSort(column)
7170
7363
  }, [column.sortable ? (openBlock(), createElementBlock("button", {
7171
7364
  key: 0,
7172
7365
  type: "button",
7173
7366
  class: "inline-flex items-center gap-1 hover:text-foreground",
7174
7367
  onClick: ($event) => onSort(column.key)
7175
- }, [createTextVNode(toDisplayString(column.title) + " ", 1), createElementVNode("span", _hoisted_12, toDisplayString(sortMark(column)), 1)], 8, _hoisted_11)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [createTextVNode(toDisplayString(column.title), 1)], 64))], 14, _hoisted_10);
7368
+ }, [createTextVNode(toDisplayString(column.title) + " ", 1), createElementVNode("span", _hoisted_11, toDisplayString(sortMark(column)), 1)], 8, _hoisted_10)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [createTextVNode(toDisplayString(column.title), 1)], 64))], 14, _hoisted_9);
7176
7369
  }), 128))
7177
- ])], 512), createElementVNode("tbody", _hoisted_13, [
7370
+ ])], 512), createElementVNode("tbody", _hoisted_12, [
7178
7371
  createCommentVNode(" 加载态:固定 5 行骨架(R14);选择列一并占位(S8);骨架不虚拟化;loading 判定优先 "),
7179
7372
  loading.value ? (openBlock(), createElementBlock(Fragment, { key: 0 }, renderList(SKELETON_ROWS, (row) => {
7180
7373
  return createElementVNode("tr", {
@@ -7182,29 +7375,29 @@ const _sfc_main$39 = /*@__PURE__*/ defineComponent({
7182
7375
  "data-skeleton": ""
7183
7376
  }, [hasSelection.value ? (openBlock(), createElementBlock("td", {
7184
7377
  key: 0,
7185
- class: normalizeClass(["p-2 align-middle", stickyClass(SELECTION_CELL)]),
7186
- style: normalizeStyle(stickyStyle(SELECTION_CELL, false))
7187
- }, [createVNode(unref(_sfc_main$35), { class: "size-4" })], 6)) : createCommentVNode("v-if", true), (openBlock(true), createElementBlock(Fragment, null, renderList(visibleColumns.value, (column) => {
7378
+ class: normalizeClass(["p-2 align-middle", unref(stickyClass)(stickyOf.value, unref(SELECTION_CELL))]),
7379
+ style: normalizeStyle(unref(stickyStyle)(stickyOf.value, unref(SELECTION_CELL), false))
7380
+ }, [createVNode(unref(_sfc_main$39), { class: "size-4" })], 6)) : createCommentVNode("v-if", true), (openBlock(true), createElementBlock(Fragment, null, renderList(visibleColumns.value, (column) => {
7188
7381
  return openBlock(), createElementBlock("td", {
7189
7382
  key: column.key,
7190
- class: normalizeClass(["p-2 align-middle", stickyClass(column.key)]),
7191
- style: normalizeStyle([{ textAlign: column.align }, stickyStyle(column.key, false)])
7192
- }, [createVNode(unref(_sfc_main$35), { class: "h-4 w-full" })], 6);
7383
+ class: normalizeClass(["p-2 align-middle", unref(stickyClass)(stickyOf.value, column.key)]),
7384
+ style: normalizeStyle([{ textAlign: column.align }, unref(stickyStyle)(stickyOf.value, column.key, false)])
7385
+ }, [createVNode(unref(_sfc_main$39), { class: "h-4 w-full" })], 6);
7193
7386
  }), 128))]);
7194
- }), 64)) : showError.value ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [createCommentVNode(" 错误态:error 优先于正常数据;插槽可自定义(slot props { error, retry }) "), createElementVNode("tr", _hoisted_14, [createElementVNode("td", {
7387
+ }), 64)) : showError.value ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [createCommentVNode(" 错误态:error 优先于正常数据;插槽可自定义(slot props { error, retry }) "), createElementVNode("tr", _hoisted_13, [createElementVNode("td", {
7195
7388
  colspan: columnCount.value,
7196
7389
  class: "p-8 text-center text-muted-foreground"
7197
7390
  }, [renderSlot(_ctx.$slots, "error", {
7198
7391
  error: loadError.value,
7199
7392
  retry
7200
- }, () => [createElementVNode("div", _hoisted_16, [createElementVNode("p", null, toDisplayString(loadError.value?.message ?? "加载失败"), 1), createVNode(unref(_sfc_main$4), {
7393
+ }, () => [createElementVNode("div", _hoisted_15, [createElementVNode("p", null, toDisplayString(loadError.value?.message ?? "加载失败"), 1), createVNode(unref(_sfc_main$5), {
7201
7394
  variant: "outline",
7202
7395
  size: "sm",
7203
7396
  onClick: retry
7204
7397
  }, {
7205
- default: withCtx(() => [..._cache[7] || (_cache[7] = [createTextVNode("重试", -1)])]),
7398
+ default: withCtx(() => [..._cache[5] || (_cache[5] = [createTextVNode("重试", -1)])]),
7206
7399
  _: 1
7207
- })])])], 8, _hoisted_15)])], 64)) : unref(virtualEnabled) ? (openBlock(), createElementBlock(Fragment, { key: 2 }, [
7400
+ })])])], 8, _hoisted_14)])], 64)) : unref(virtualEnabled) ? (openBlock(), createElementBlock(Fragment, { key: 2 }, [
7208
7401
  createCommentVNode(" 虚拟滚动:窗口行 + 前后占位行(总高撑开滚动区间;行高经 measureElement 动态测量) "),
7209
7402
  createElementVNode("tr", {
7210
7403
  "aria-hidden": "true",
@@ -7213,79 +7406,38 @@ const _sfc_main$39 = /*@__PURE__*/ defineComponent({
7213
7406
  }, [createElementVNode("td", {
7214
7407
  colspan: columnCount.value,
7215
7408
  class: "border-0 p-0"
7216
- }, null, 8, _hoisted_17)], 4),
7409
+ }, null, 8, _hoisted_16)], 4),
7217
7410
  (openBlock(true), createElementBlock(Fragment, null, renderList(virtualLines.value, (item) => {
7218
- return openBlock(), createElementBlock("tr", {
7411
+ return openBlock(), createBlock(_sfc_main$52, {
7219
7412
  key: item.line.key,
7220
7413
  ref_for: true,
7221
7414
  ref: measureRow,
7222
7415
  "data-index": item.row.index,
7223
- class: "border-b transition-colors hover:bg-muted/50",
7224
- onClick: ($event) => onRowClick(item.line.record, item.line.index, $event),
7225
- onDblclick: ($event) => onRowDblclick(item.line.record, item.line.index, $event),
7226
- onContextmenu: ($event) => onRowContextmenu(item.line.record, item.line.index, $event)
7227
- }, [
7228
- createCommentVNode(" 选择单元格:阻断冒泡避免触发行 row-click(S5);radio 为原生控件 "),
7229
- hasSelection.value ? (openBlock(), createElementBlock("td", {
7230
- key: 0,
7231
- class: normalizeClass(["w-12 p-2 align-middle", stickyClass(SELECTION_CELL)]),
7232
- style: normalizeStyle(stickyStyle(SELECTION_CELL, false)),
7233
- onClick: _cache[3] || (_cache[3] = withModifiers(() => {}, ["stop"]))
7234
- }, [selection.value.type === "radio" ? (openBlock(), createElementBlock("input", {
7235
- key: 0,
7236
- type: "radio",
7237
- class: "accent-primary size-4 cursor-pointer disabled:cursor-not-allowed disabled:opacity-50",
7238
- checked: unref(selectedKeys).has(item.line.key),
7239
- disabled: !item.line.canSelect,
7240
- "aria-label": `选择第 ${item.line.index + 1} 行`,
7241
- onClick: ($event) => onRowSelect(item.line, !unref(selectedKeys).has(item.line.key))
7242
- }, null, 8, _hoisted_19)) : (openBlock(), createBlock(unref(_sfc_main$8), {
7243
- key: 1,
7244
- checked: unref(selectedKeys).has(item.line.key),
7245
- disabled: !item.line.canSelect,
7246
- "aria-label": `选择第 ${item.line.index + 1} 行`,
7247
- "onUpdate:checked": (checked) => onRowSelect(item.line, checked)
7248
- }, null, 8, [
7249
- "checked",
7250
- "disabled",
7251
- "aria-label",
7252
- "onUpdate:checked"
7253
- ]))], 6)) : createCommentVNode("v-if", true),
7254
- (openBlock(true), createElementBlock(Fragment, null, renderList(item.line.cells, (value, index) => {
7255
- return openBlock(), createElementBlock("td", {
7256
- key: visibleColumns.value[index].key,
7257
- class: normalizeClass(["p-2 align-middle", [stickyClass(visibleColumns.value[index].key), { truncate: visibleColumns.value[index].ellipsis === true }]]),
7258
- title: visibleColumns.value[index].ellipsis === true ? cellText(item.line, index) : void 0,
7259
- style: normalizeStyle([{ textAlign: visibleColumns.value[index].align }, stickyStyle(visibleColumns.value[index].key, false)]),
7260
- onClick: ($event) => onCellClick(item.line.record, visibleColumns.value[index].key, item.line.index, $event)
7261
- }, [createCommentVNode(" 首列(tree 启用时):depth 缩进 + 展开 caret(点击 stop 避免误触发行点击) "), unref(tree) && index === 0 ? (openBlock(), createElementBlock("span", {
7262
- key: 0,
7263
- class: "inline-flex max-w-full items-center gap-1",
7264
- style: normalizeStyle({ marginLeft: `${item.line.row.depth * unref(treeIndent)}px` })
7265
- }, [
7266
- item.line.row.getCanExpand() ? (openBlock(), createElementBlock("button", {
7267
- key: 0,
7268
- type: "button",
7269
- class: "hover:bg-muted text-muted-foreground inline-flex size-4 shrink-0 cursor-pointer items-center justify-center rounded-sm",
7270
- "aria-expanded": item.line.row.getIsExpanded(),
7271
- "aria-label": item.line.row.getIsExpanded() ? "收起" : "展开",
7272
- onClick: withModifiers(($event) => item.line.row.toggleExpanded(), ["stop"])
7273
- }, [(openBlock(), createElementBlock("svg", {
7274
- xmlns: "http://www.w3.org/2000/svg",
7275
- viewBox: "0 0 24 24",
7276
- fill: "none",
7277
- stroke: "currentColor",
7278
- "stroke-width": "2",
7279
- "stroke-linecap": "round",
7280
- "stroke-linejoin": "round",
7281
- class: normalizeClass(["size-3.5 transition-transform", { "rotate-90": item.line.row.getIsExpanded() }]),
7282
- "aria-hidden": "true"
7283
- }, [..._cache[8] || (_cache[8] = [createElementVNode("path", { d: "m9 18 6-6-6-6" }, null, -1)])], 2))], 8, _hoisted_21)) : createCommentVNode("v-if", true),
7284
- createCommentVNode(" VNode 必须走子节点渲染;文本插值会序列化 vnode 导致循环引用 "),
7285
- isVNode(value) ? (openBlock(), createBlock(resolveDynamicComponent(value), { key: 1 })) : (openBlock(), createElementBlock("span", _hoisted_22, toDisplayString(value), 1))
7286
- ], 4)) : visibleColumns.value[index].ellipsis === "tooltip" ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [createCommentVNode(" ellipsis: \"tooltip\":Tooltip 包装(VNode 经 cloneVNode 复制,避免二次挂载) "), (openBlock(), createBlock(resolveDynamicComponent(tooltipCell(value, cellText(item.line, index)))))], 2112)) : (openBlock(), createElementBlock(Fragment, { key: 2 }, [createCommentVNode(" VNode 必须走子节点渲染;文本插值会序列化 vnode 导致循环引用 "), isVNode(value) ? (openBlock(), createBlock(resolveDynamicComponent(value), { key: 0 })) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [createTextVNode(toDisplayString(value), 1)], 64))], 64))], 14, _hoisted_20);
7287
- }), 128))
7288
- ], 40, _hoisted_18);
7416
+ line: item.line,
7417
+ columns: visibleColumns.value,
7418
+ selection: hasSelection.value ? selection.value.type : void 0,
7419
+ selected: unref(selectedKeys).has(item.line.key),
7420
+ sticky: stickyOf.value,
7421
+ "tree-indent": unref(tree) ? unref(treeIndent) : void 0,
7422
+ onSelect: (checked) => onRowSelect(item.line, checked),
7423
+ onRowClick: ($event) => onRowClick(item.line.record, item.line.index, $event),
7424
+ onRowDblclick: ($event) => onRowDblclick(item.line.record, item.line.index, $event),
7425
+ onRowContextmenu: ($event) => onRowContextmenu(item.line.record, item.line.index, $event),
7426
+ onCellClick: (columnKey, event) => onCellClick(item.line.record, columnKey, item.line.index, event)
7427
+ }, null, 8, [
7428
+ "data-index",
7429
+ "line",
7430
+ "columns",
7431
+ "selection",
7432
+ "selected",
7433
+ "sticky",
7434
+ "tree-indent",
7435
+ "onSelect",
7436
+ "onRowClick",
7437
+ "onRowDblclick",
7438
+ "onRowContextmenu",
7439
+ "onCellClick"
7440
+ ]);
7289
7441
  }), 128)),
7290
7442
  createElementVNode("tr", {
7291
7443
  "aria-hidden": "true",
@@ -7294,84 +7446,42 @@ const _sfc_main$39 = /*@__PURE__*/ defineComponent({
7294
7446
  }, [createElementVNode("td", {
7295
7447
  colspan: columnCount.value,
7296
7448
  class: "border-0 p-0"
7297
- }, null, 8, _hoisted_23)], 4)
7449
+ }, null, 8, _hoisted_17)], 4)
7298
7450
  ], 64)) : (openBlock(true), createElementBlock(Fragment, { key: 3 }, renderList(body.value, (line) => {
7299
- return openBlock(), createElementBlock("tr", {
7451
+ return openBlock(), createBlock(_sfc_main$52, {
7300
7452
  key: line.key,
7301
- class: "border-b transition-colors hover:bg-muted/50",
7302
- onClick: ($event) => onRowClick(line.record, line.index, $event),
7303
- onDblclick: ($event) => onRowDblclick(line.record, line.index, $event),
7304
- onContextmenu: ($event) => onRowContextmenu(line.record, line.index, $event)
7305
- }, [
7306
- createCommentVNode(" 选择单元格:阻断冒泡避免触发行 row-click(S5);radio 为原生控件 "),
7307
- hasSelection.value ? (openBlock(), createElementBlock("td", {
7308
- key: 0,
7309
- class: normalizeClass(["w-12 p-2 align-middle", stickyClass(SELECTION_CELL)]),
7310
- style: normalizeStyle(stickyStyle(SELECTION_CELL, false)),
7311
- onClick: _cache[4] || (_cache[4] = withModifiers(() => {}, ["stop"]))
7312
- }, [selection.value.type === "radio" ? (openBlock(), createElementBlock("input", {
7313
- key: 0,
7314
- type: "radio",
7315
- class: "accent-primary size-4 cursor-pointer disabled:cursor-not-allowed disabled:opacity-50",
7316
- checked: unref(selectedKeys).has(line.key),
7317
- disabled: !line.canSelect,
7318
- "aria-label": `选择第 ${line.index + 1} 行`,
7319
- onClick: ($event) => onRowSelect(line, !unref(selectedKeys).has(line.key))
7320
- }, null, 8, _hoisted_25)) : (openBlock(), createBlock(unref(_sfc_main$8), {
7321
- key: 1,
7322
- checked: unref(selectedKeys).has(line.key),
7323
- disabled: !line.canSelect,
7324
- "aria-label": `选择第 ${line.index + 1} 行`,
7325
- "onUpdate:checked": (checked) => onRowSelect(line, checked)
7326
- }, null, 8, [
7327
- "checked",
7328
- "disabled",
7329
- "aria-label",
7330
- "onUpdate:checked"
7331
- ]))], 6)) : createCommentVNode("v-if", true),
7332
- (openBlock(true), createElementBlock(Fragment, null, renderList(line.cells, (value, index) => {
7333
- return openBlock(), createElementBlock("td", {
7334
- key: visibleColumns.value[index].key,
7335
- class: normalizeClass(["p-2 align-middle", [stickyClass(visibleColumns.value[index].key), { truncate: visibleColumns.value[index].ellipsis === true }]]),
7336
- title: visibleColumns.value[index].ellipsis === true ? cellText(line, index) : void 0,
7337
- style: normalizeStyle([{ textAlign: visibleColumns.value[index].align }, stickyStyle(visibleColumns.value[index].key, false)]),
7338
- onClick: ($event) => onCellClick(line.record, visibleColumns.value[index].key, line.index, $event)
7339
- }, [createCommentVNode(" 首列(tree 启用时):depth 缩进 + 展开 caret(点击 stop 避免误触发行点击) "), unref(tree) && index === 0 ? (openBlock(), createElementBlock("span", {
7340
- key: 0,
7341
- class: "inline-flex max-w-full items-center gap-1",
7342
- style: normalizeStyle({ marginLeft: `${line.row.depth * unref(treeIndent)}px` })
7343
- }, [
7344
- line.row.getCanExpand() ? (openBlock(), createElementBlock("button", {
7345
- key: 0,
7346
- type: "button",
7347
- class: "hover:bg-muted text-muted-foreground inline-flex size-4 shrink-0 cursor-pointer items-center justify-center rounded-sm",
7348
- "aria-expanded": line.row.getIsExpanded(),
7349
- "aria-label": line.row.getIsExpanded() ? "收起" : "展开",
7350
- onClick: withModifiers(($event) => line.row.toggleExpanded(), ["stop"])
7351
- }, [(openBlock(), createElementBlock("svg", {
7352
- xmlns: "http://www.w3.org/2000/svg",
7353
- viewBox: "0 0 24 24",
7354
- fill: "none",
7355
- stroke: "currentColor",
7356
- "stroke-width": "2",
7357
- "stroke-linecap": "round",
7358
- "stroke-linejoin": "round",
7359
- class: normalizeClass(["size-3.5 transition-transform", { "rotate-90": line.row.getIsExpanded() }]),
7360
- "aria-hidden": "true"
7361
- }, [..._cache[9] || (_cache[9] = [createElementVNode("path", { d: "m9 18 6-6-6-6" }, null, -1)])], 2))], 8, _hoisted_27)) : createCommentVNode("v-if", true),
7362
- createCommentVNode(" VNode 必须走子节点渲染;文本插值会序列化 vnode 导致循环引用 "),
7363
- isVNode(value) ? (openBlock(), createBlock(resolveDynamicComponent(value), { key: 1 })) : (openBlock(), createElementBlock("span", _hoisted_28, toDisplayString(value), 1))
7364
- ], 4)) : visibleColumns.value[index].ellipsis === "tooltip" ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [createCommentVNode(" ellipsis: \"tooltip\":Tooltip 包装(VNode 经 cloneVNode 复制,避免二次挂载) "), (openBlock(), createBlock(resolveDynamicComponent(tooltipCell(value, cellText(line, index)))))], 2112)) : (openBlock(), createElementBlock(Fragment, { key: 2 }, [createCommentVNode(" VNode 必须走子节点渲染;文本插值会序列化 vnode 导致循环引用 "), isVNode(value) ? (openBlock(), createBlock(resolveDynamicComponent(value), { key: 0 })) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [createTextVNode(toDisplayString(value), 1)], 64))], 64))], 14, _hoisted_26);
7365
- }), 128))
7366
- ], 40, _hoisted_24);
7453
+ line,
7454
+ columns: visibleColumns.value,
7455
+ selection: hasSelection.value ? selection.value.type : void 0,
7456
+ selected: unref(selectedKeys).has(line.key),
7457
+ sticky: stickyOf.value,
7458
+ "tree-indent": unref(tree) ? unref(treeIndent) : void 0,
7459
+ onSelect: (checked) => onRowSelect(line, checked),
7460
+ onRowClick: ($event) => onRowClick(line.record, line.index, $event),
7461
+ onRowDblclick: ($event) => onRowDblclick(line.record, line.index, $event),
7462
+ onRowContextmenu: ($event) => onRowContextmenu(line.record, line.index, $event),
7463
+ onCellClick: (columnKey, event) => onCellClick(line.record, columnKey, line.index, event)
7464
+ }, null, 8, [
7465
+ "line",
7466
+ "columns",
7467
+ "selection",
7468
+ "selected",
7469
+ "sticky",
7470
+ "tree-indent",
7471
+ "onSelect",
7472
+ "onRowClick",
7473
+ "onRowDblclick",
7474
+ "onRowContextmenu",
7475
+ "onCellClick"
7476
+ ]);
7367
7477
  }), 128)),
7368
7478
  createCommentVNode(" 空态:横跨全列的单单元格,不虚拟化;错误态优先 "),
7369
- !loading.value && !showError.value && body.value.length === 0 ? (openBlock(), createElementBlock("tr", _hoisted_29, [createElementVNode("td", {
7479
+ !loading.value && !showError.value && body.value.length === 0 ? (openBlock(), createElementBlock("tr", _hoisted_18, [createElementVNode("td", {
7370
7480
  colspan: columnCount.value,
7371
7481
  class: "p-8 text-center text-muted-foreground"
7372
- }, [renderSlot(_ctx.$slots, "empty", {}, () => [createTextVNode(toDisplayString(__props.emptyText ?? "暂无数据"), 1)])], 8, _hoisted_30)])) : createCommentVNode("v-if", true)
7482
+ }, [renderSlot(_ctx.$slots, "empty", {}, () => [createTextVNode(toDisplayString(__props.emptyText ?? "暂无数据"), 1)])], 8, _hoisted_19)])) : createCommentVNode("v-if", true)
7373
7483
  ])])], 4),
7374
- showPagination.value ? (openBlock(), createBlock(_sfc_main$47, {
7484
+ showPagination.value ? (openBlock(), createBlock(_sfc_main$51, {
7375
7485
  key: 1,
7376
7486
  "page-index": unref(instance).page.pageIndex,
7377
7487
  "page-size": unref(instance).page.pageSize,
@@ -7385,7 +7495,7 @@ const _sfc_main$39 = /*@__PURE__*/ defineComponent({
7385
7495
  "page-size-opts",
7386
7496
  "total"
7387
7497
  ])) : createCommentVNode("v-if", true)
7388
- ]);
7498
+ ], 2);
7389
7499
  };
7390
7500
  }
7391
7501
  });
@@ -7412,8 +7522,8 @@ function defineTable(config) {
7412
7522
  }
7413
7523
  //#endregion
7414
7524
  //#region src/components/tabs/Tabs.vue
7415
- const _hoisted_1$4 = ["data-state"];
7416
- const _sfc_main$40 = /*@__PURE__*/ defineComponent({
7525
+ const _hoisted_1$7 = ["data-state"];
7526
+ const _sfc_main$44 = /*@__PURE__*/ defineComponent({
7417
7527
  __name: "Tabs",
7418
7528
  props: {
7419
7529
  items: {},
@@ -7479,7 +7589,7 @@ const _sfc_main$40 = /*@__PURE__*/ defineComponent({
7479
7589
  }, api.getContentProps({ value: item.value }), {
7480
7590
  "data-state": currentValue.value === item.value ? "open" : "closed",
7481
7591
  class: "flex-1 outline-none"
7482
- }), [renderSlot(_ctx.$slots, "panel", { item })], 16, _hoisted_1$4)) : createCommentVNode("v-if", true)], 64);
7592
+ }), [renderSlot(_ctx.$slots, "panel", { item })], 16, _hoisted_1$7)) : createCommentVNode("v-if", true)], 64);
7483
7593
  }), 128))]),
7484
7594
  _: 3
7485
7595
  })
@@ -7491,9 +7601,9 @@ const _sfc_main$40 = /*@__PURE__*/ defineComponent({
7491
7601
  });
7492
7602
  //#endregion
7493
7603
  //#region src/components/alert/Alert.vue
7494
- const _hoisted_1$3 = ["role"];
7495
- const _hoisted_2$3 = ["d"];
7496
- const _hoisted_3$2 = { class: "min-w-0 flex-1" };
7604
+ const _hoisted_1$6 = ["role"];
7605
+ const _hoisted_2$6 = ["d"];
7606
+ const _hoisted_3$3 = { class: "min-w-0 flex-1" };
7497
7607
  const _hoisted_4$1 = {
7498
7608
  key: 0,
7499
7609
  class: "font-medium leading-snug"
@@ -7549,8 +7659,8 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
7549
7659
  "stroke-linejoin": "round",
7550
7660
  "aria-hidden": "true",
7551
7661
  class: normalizeClass(unref(cn)(unref(alertIconVariants)({ variant: props.variant })))
7552
- }, [createElementVNode("path", { d: iconPath.value }, null, 8, _hoisted_2$3)], 2)) : createCommentVNode("v-if", true)]),
7553
- createElementVNode("div", _hoisted_3$2, [props.title || unref(slots).title ? (openBlock(), createElementBlock("div", _hoisted_4$1, [renderSlot(_ctx.$slots, "title", {}, () => [createTextVNode(toDisplayString(props.title), 1)])])) : createCommentVNode("v-if", true), props.description || unref(slots).default ? (openBlock(), createElementBlock("div", {
7662
+ }, [createElementVNode("path", { d: iconPath.value }, null, 8, _hoisted_2$6)], 2)) : createCommentVNode("v-if", true)]),
7663
+ createElementVNode("div", _hoisted_3$3, [props.title || unref(slots).title ? (openBlock(), createElementBlock("div", _hoisted_4$1, [renderSlot(_ctx.$slots, "title", {}, () => [createTextVNode(toDisplayString(props.title), 1)])])) : createCommentVNode("v-if", true), props.description || unref(slots).default ? (openBlock(), createElementBlock("div", {
7554
7664
  key: 1,
7555
7665
  class: normalizeClass(unref(cn)("text-sm leading-relaxed", (props.title || unref(slots).title) && "text-muted-foreground mt-1"))
7556
7666
  }, [renderSlot(_ctx.$slots, "default", {}, () => [createTextVNode(toDisplayString(props.description), 1)])], 2)) : createCommentVNode("v-if", true)]),
@@ -7571,7 +7681,7 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
7571
7681
  "aria-hidden": "true",
7572
7682
  class: "size-4"
7573
7683
  }, [createElementVNode("path", { d: "M18 6 6 18M6 6l12 12" })], -1)])])) : createCommentVNode("v-if", true)])
7574
- ], 10, _hoisted_1$3)) : createCommentVNode("v-if", true);
7684
+ ], 10, _hoisted_1$6)) : createCommentVNode("v-if", true);
7575
7685
  };
7576
7686
  }
7577
7687
  });
@@ -7614,13 +7724,13 @@ const alertIconPaths = {
7614
7724
  };
7615
7725
  //#endregion
7616
7726
  //#region src/components/empty/Empty.vue
7617
- const _hoisted_1$2 = { class: "text-muted-foreground/60 [&_svg]:size-24" };
7618
- const _hoisted_2$2 = { class: "text-sm text-muted-foreground" };
7619
- const _hoisted_3$1 = {
7727
+ const _hoisted_1$5 = { class: "text-muted-foreground/60 [&_svg]:size-24" };
7728
+ const _hoisted_2$5 = { class: "text-sm text-muted-foreground" };
7729
+ const _hoisted_3$2 = {
7620
7730
  key: 0,
7621
7731
  class: "mt-2 flex items-center gap-3"
7622
7732
  };
7623
- const _sfc_main$14 = /*@__PURE__*/ defineComponent({
7733
+ const _sfc_main$17 = /*@__PURE__*/ defineComponent({
7624
7734
  __name: "Empty",
7625
7735
  props: {
7626
7736
  class: {},
@@ -7633,16 +7743,16 @@ const _sfc_main$14 = /*@__PURE__*/ defineComponent({
7633
7743
  role: "status",
7634
7744
  class: normalizeClass(unref(cn)("flex flex-col items-center justify-center gap-3 px-6 py-16 text-center", props.class))
7635
7745
  }, [
7636
- createElementVNode("div", _hoisted_1$2, [renderSlot(_ctx.$slots, "icon", {}, () => [createCommentVNode(" 内置插画:简洁空盒 "), _cache[0] || (_cache[0] = createStaticVNode("<svg viewBox=\"0 0 96 96\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"><path d=\"M48 18 78 34v28L48 78 18 62V34L48 18Z\" opacity=\"0.55\"></path><path d=\"M18 34l30 16 30-16\" opacity=\"0.55\"></path><path d=\"M48 50v28\" opacity=\"0.55\"></path><path d=\"M48 18l-8 26 8 6 8-6-8-26Z\" fill=\"currentColor\" fill-opacity=\"0.12\" stroke=\"none\"></path><path d=\"M40 44l8 6 8-6\" opacity=\"0.75\"></path></svg>", 1))])]),
7637
- createElementVNode("p", _hoisted_2$2, toDisplayString(props.description), 1),
7638
- _ctx.$slots.default ? (openBlock(), createElementBlock("div", _hoisted_3$1, [renderSlot(_ctx.$slots, "default")])) : createCommentVNode("v-if", true)
7746
+ createElementVNode("div", _hoisted_1$5, [renderSlot(_ctx.$slots, "icon", {}, () => [createCommentVNode(" 内置插画:简洁空盒 "), _cache[0] || (_cache[0] = createStaticVNode("<svg viewBox=\"0 0 96 96\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"><path d=\"M48 18 78 34v28L48 78 18 62V34L48 18Z\" opacity=\"0.55\"></path><path d=\"M18 34l30 16 30-16\" opacity=\"0.55\"></path><path d=\"M48 50v28\" opacity=\"0.55\"></path><path d=\"M48 18l-8 26 8 6 8-6-8-26Z\" fill=\"currentColor\" fill-opacity=\"0.12\" stroke=\"none\"></path><path d=\"M40 44l8 6 8-6\" opacity=\"0.75\"></path></svg>", 1))])]),
7747
+ createElementVNode("p", _hoisted_2$5, toDisplayString(props.description), 1),
7748
+ _ctx.$slots.default ? (openBlock(), createElementBlock("div", _hoisted_3$2, [renderSlot(_ctx.$slots, "default")])) : createCommentVNode("v-if", true)
7639
7749
  ], 2);
7640
7750
  };
7641
7751
  }
7642
7752
  });
7643
7753
  //#endregion
7644
7754
  //#region src/components/progress/Progress.vue
7645
- const _sfc_main$31 = /*@__PURE__*/ defineComponent({
7755
+ const _sfc_main$35 = /*@__PURE__*/ defineComponent({
7646
7756
  __name: "Progress",
7647
7757
  props: {
7648
7758
  value: {},
@@ -7714,9 +7824,9 @@ const _sfc_main$31 = /*@__PURE__*/ defineComponent({
7714
7824
  });
7715
7825
  //#endregion
7716
7826
  //#region src/components/spin/Spin.vue
7717
- const _hoisted_1$1 = ["inert"];
7718
- const _hoisted_2$1 = ["aria-busy", "aria-label"];
7719
- const _sfc_main$37 = /*@__PURE__*/ defineComponent({
7827
+ const _hoisted_1$4 = ["inert"];
7828
+ const _hoisted_2$4 = ["aria-busy", "aria-label"];
7829
+ const _sfc_main$41 = /*@__PURE__*/ defineComponent({
7720
7830
  __name: "Spin",
7721
7831
  props: {
7722
7832
  size: { default: "default" },
@@ -7767,7 +7877,7 @@ const _sfc_main$37 = /*@__PURE__*/ defineComponent({
7767
7877
  stroke: "currentColor",
7768
7878
  "stroke-width": "3",
7769
7879
  "stroke-linecap": "round"
7770
- }, null, -1)])], 2))], 10, _hoisted_2$1)) : createCommentVNode("v-if", true)], 10, _hoisted_1$1)) : createCommentVNode("v-if", true);
7880
+ }, null, -1)])], 2))], 10, _hoisted_2$4)) : createCommentVNode("v-if", true)], 10, _hoisted_1$4)) : createCommentVNode("v-if", true);
7771
7881
  };
7772
7882
  }
7773
7883
  });
@@ -7780,16 +7890,21 @@ const DEFAULTS = {
7780
7890
  max: 3
7781
7891
  };
7782
7892
  let current = createToaster(DEFAULTS);
7893
+ let currentConfig = { ...DEFAULTS };
7783
7894
  let providerMounted = false;
7784
7895
  /**
7785
7896
  * 按 props 重建单例内部 store(ToastProvider 挂载时调用)。
7786
- * 返回新 store 供 Provider 的 <Toaster> 渲染使用。
7897
+ * 配置未变化时复用现有 store,避免 Provider 重挂载丢弃排队中的 toast。
7898
+ * 返回 store 供 Provider 的 <Toaster> 渲染使用。
7787
7899
  */
7788
7900
  function __configureToaster(props = {}) {
7789
- current = createToaster({
7901
+ const next = {
7790
7902
  ...DEFAULTS,
7791
7903
  ...props
7792
- });
7904
+ };
7905
+ if (next.placement === currentConfig.placement && next.duration === currentConfig.duration && next.max === currentConfig.max) return current;
7906
+ currentConfig = next;
7907
+ current = createToaster(next);
7793
7908
  return current;
7794
7909
  }
7795
7910
  /** 标记 Provider 已挂载/已卸载(Provider 生命周期与测试用) */
@@ -7856,7 +7971,7 @@ function useToast() {
7856
7971
  }
7857
7972
  //#endregion
7858
7973
  //#region src/components/toast/ToastProvider.vue
7859
- const _hoisted_1 = {
7974
+ const _hoisted_1$3 = {
7860
7975
  key: 0,
7861
7976
  viewBox: "0 0 24 24",
7862
7977
  fill: "none",
@@ -7866,7 +7981,7 @@ const _hoisted_1 = {
7866
7981
  "stroke-linejoin": "round",
7867
7982
  class: "size-4"
7868
7983
  };
7869
- const _hoisted_2 = {
7984
+ const _hoisted_2$3 = {
7870
7985
  key: 1,
7871
7986
  viewBox: "0 0 24 24",
7872
7987
  fill: "none",
@@ -7876,7 +7991,7 @@ const _hoisted_2 = {
7876
7991
  "stroke-linejoin": "round",
7877
7992
  class: "size-4"
7878
7993
  };
7879
- const _hoisted_3 = {
7994
+ const _hoisted_3$1 = {
7880
7995
  key: 2,
7881
7996
  viewBox: "0 0 24 24",
7882
7997
  fill: "none",
@@ -7913,7 +8028,7 @@ const _hoisted_7 = { class: "flex shrink-0 items-center gap-1" };
7913
8028
  * 内部按 props 重建 useToast 单例 store,随后所有 toast 方法经单例转发到这里渲染。
7914
8029
  */
7915
8030
  const rootBase = "flex w-[22rem] max-w-[calc(100vw-2rem)] items-start gap-3 rounded-md border p-4 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=open]:fade-in-0 data-[state=closed]:fade-out-0 data-[placement*=top]:data-[state=open]:slide-in-from-top-2 data-[placement*=top]:data-[state=closed]:slide-out-to-top-2 data-[placement*=bottom]:data-[state=open]:slide-in-from-bottom-2 data-[placement*=bottom]:data-[state=closed]:slide-out-to-bottom-2";
7916
- const _sfc_main$42 = /*@__PURE__*/ defineComponent({
8031
+ const _sfc_main$46 = /*@__PURE__*/ defineComponent({
7917
8032
  __name: "ToastProvider",
7918
8033
  props: {
7919
8034
  /** 弹出位置 */
@@ -7959,7 +8074,7 @@ const _sfc_main$42 = /*@__PURE__*/ defineComponent({
7959
8074
  t.type ? (openBlock(), createElementBlock("span", {
7960
8075
  key: 0,
7961
8076
  class: normalizeClass(["mt-0.5 shrink-0", { "animate-spin": t.type === "loading" }])
7962
- }, [t.type === "success" ? (openBlock(), createElementBlock("svg", _hoisted_1, [..._cache[0] || (_cache[0] = [createElementVNode("path", { d: "M21.801 10A10 10 0 1 1 17 3.335" }, null, -1), createElementVNode("path", { d: "m9 11 3 3L22 4" }, null, -1)])])) : t.type === "error" ? (openBlock(), createElementBlock("svg", _hoisted_2, [..._cache[1] || (_cache[1] = [
8077
+ }, [t.type === "success" ? (openBlock(), createElementBlock("svg", _hoisted_1$3, [..._cache[0] || (_cache[0] = [createElementVNode("path", { d: "M21.801 10A10 10 0 1 1 17 3.335" }, null, -1), createElementVNode("path", { d: "m9 11 3 3L22 4" }, null, -1)])])) : t.type === "error" ? (openBlock(), createElementBlock("svg", _hoisted_2$3, [..._cache[1] || (_cache[1] = [
7963
8078
  createElementVNode("circle", {
7964
8079
  cx: "12",
7965
8080
  cy: "12",
@@ -7967,7 +8082,7 @@ const _sfc_main$42 = /*@__PURE__*/ defineComponent({
7967
8082
  }, null, -1),
7968
8083
  createElementVNode("path", { d: "m15 9-6 6" }, null, -1),
7969
8084
  createElementVNode("path", { d: "m9 9 6 6" }, null, -1)
7970
- ])])) : t.type === "warning" ? (openBlock(), createElementBlock("svg", _hoisted_3, [..._cache[2] || (_cache[2] = [
8085
+ ])])) : t.type === "warning" ? (openBlock(), createElementBlock("svg", _hoisted_3$1, [..._cache[2] || (_cache[2] = [
7971
8086
  createElementVNode("path", { d: "m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3" }, null, -1),
7972
8087
  createElementVNode("path", { d: "M12 9v4" }, null, -1),
7973
8088
  createElementVNode("path", { d: "M12 17h.01" }, null, -1)
@@ -8017,4 +8132,531 @@ const _sfc_main$42 = /*@__PURE__*/ defineComponent({
8017
8132
  }
8018
8133
  });
8019
8134
  //#endregion
8020
- export { _sfc_main as Alert, _sfc_main$1 as Avatar, _sfc_main$2 as AvatarGroup, _sfc_main$3 as Badge, _sfc_main$4 as Button, CHECKED, COMPONENT_NAMES, _sfc_main$5 as Calendar, _sfc_main$6 as Card, _sfc_main$7 as Cascader, _sfc_main$8 as Checkbox, _sfc_main$9 as CurrencyInput, _sfc_main$10 as DatePicker, _sfc_main$11 as DateRangePicker, _sfc_main$12 as Dialog, _sfc_main$13 as DropdownMenu, _sfc_main$14 as Empty, _sfc_main$15 as Form, _sfc_main$16 as FormControl, _sfc_main$17 as FormDescription, _sfc_main$18 as FormField, _sfc_main$19 as FormItem, _sfc_main$20 as FormLabel, _sfc_main$21 as FormMessage, _sfc_main$22 as FormRender, _sfc_main$23 as FormSubscribe, _sfc_main$24 as Input, _sfc_main$25 as Label, MODEL_VALUE, _sfc_main$26 as MonthPicker, _sfc_main$27 as NumberInput, _sfc_main$28 as PasswordInput, _sfc_main$29 as PinInput, _sfc_main$30 as Popover, _sfc_main$31 as Progress, _sfc_main$32 as RadioGroup, SLIDER, _sfc_main$33 as Select, _sfc_main$34 as Separator, _sfc_main$35 as Skeleton, _sfc_main$36 as Slider, Slot, _sfc_main$37 as Spin, _sfc_main$38 as Switch, _sfc_main$39 as TableRender, _sfc_main$40 as Tabs, _sfc_main$41 as Textarea, _sfc_main$42 as ToastProvider, _sfc_main$43 as Tooltip, _sfc_main$44 as TreeSelect, TuDesignResolver, VALUE, _sfc_main$45 as WeekPicker, _sfc_main$46 as YearPicker, alertIconPaths, alertIconVariants, alertVariants, avatarGroupKey, avatarVariants, badgeVariants, bindField, buttonVariants, cardVariants, cn, columnRenders, defineColumns, defineForm, defineTable, formatCurrency, numberOrNull, parseCurrency, useFormRender, useTableRender, useToast, widgetRenders };
8135
+ //#region src/components/overlay-shared/useConfirmPending.ts
8136
+ /**
8137
+ * 确认弹层公共 pending 语义:@confirm 处理器返回 Promise 时锁定关闭通道,
8138
+ * resolve 后自动关闭,reject 保持打开并退出 loading;同步处理器直接关闭。
8139
+ */
8140
+ function useConfirmPending(options) {
8141
+ const loading = ref(false);
8142
+ function handleConfirm() {
8143
+ if (loading.value) return;
8144
+ const handler = options.instance?.vnode.props?.onConfirm;
8145
+ const result = handler?.();
8146
+ if (!handler) options.emitConfirm();
8147
+ if (result instanceof Promise) {
8148
+ loading.value = true;
8149
+ result.then(() => {
8150
+ loading.value = false;
8151
+ options.close();
8152
+ }).catch(() => {
8153
+ loading.value = false;
8154
+ });
8155
+ } else options.close();
8156
+ }
8157
+ function handleCancel() {
8158
+ if (loading.value) return;
8159
+ options.emitCancel();
8160
+ options.close();
8161
+ }
8162
+ return {
8163
+ loading,
8164
+ handleConfirm,
8165
+ handleCancel
8166
+ };
8167
+ }
8168
+ //#endregion
8169
+ //#region src/components/alert-dialog/AlertDialog.vue
8170
+ const _hoisted_1$2 = { class: "flex flex-col gap-2 text-center sm:text-left" };
8171
+ const _hoisted_2$2 = { class: "flex flex-col-reverse gap-2 sm:flex-row sm:justify-end" };
8172
+ const _hoisted_3 = {
8173
+ key: 0,
8174
+ viewBox: "0 0 24 24",
8175
+ fill: "none",
8176
+ stroke: "currentColor",
8177
+ "stroke-width": "2",
8178
+ "stroke-linecap": "round",
8179
+ class: "size-4 animate-spin",
8180
+ "aria-hidden": "true"
8181
+ };
8182
+ const _sfc_main$1 = /*@__PURE__*/ defineComponent({
8183
+ __name: "AlertDialog",
8184
+ props: {
8185
+ /** 受控开关(配合 v-model:open);不传时为非受控,由内部状态管理 */
8186
+ open: {
8187
+ type: Boolean,
8188
+ default: void 0
8189
+ },
8190
+ /** 标题文案(#title 插槽优先) */
8191
+ title: {
8192
+ type: String,
8193
+ required: true
8194
+ },
8195
+ /** 描述文案(#description 插槽优先,可不传) */
8196
+ description: {
8197
+ type: String,
8198
+ default: void 0
8199
+ },
8200
+ /** 确认按钮文案 */
8201
+ confirmText: {
8202
+ type: String,
8203
+ default: "确定"
8204
+ },
8205
+ /** 取消按钮文案 */
8206
+ cancelText: {
8207
+ type: String,
8208
+ default: "取消"
8209
+ },
8210
+ /** 确认按钮使用 destructive 语义色(危险操作场景) */
8211
+ destructive: {
8212
+ type: Boolean,
8213
+ default: false
8214
+ }
8215
+ },
8216
+ emits: [
8217
+ "update:open",
8218
+ "confirm",
8219
+ "cancel"
8220
+ ],
8221
+ setup(__props, { emit: __emit }) {
8222
+ const props = __props;
8223
+ const emit = __emit;
8224
+ const instance = getCurrentInstance();
8225
+ const { isOpen, setOpen } = useControlledBoolean({
8226
+ controlled: () => props.open,
8227
+ onChange: (open) => emit("update:open", open)
8228
+ });
8229
+ function handleUpdate(open) {
8230
+ if (!open && loading.value) return;
8231
+ setOpen(open);
8232
+ }
8233
+ /** 关闭弹窗:走受控桥把 open 置 false,退出动画/焦点还原由 zag 处理 */
8234
+ function close() {
8235
+ handleUpdate(false);
8236
+ }
8237
+ const { loading, handleConfirm, handleCancel } = useConfirmPending({
8238
+ instance,
8239
+ emitConfirm: () => emit("confirm"),
8240
+ emitCancel: () => emit("cancel"),
8241
+ close
8242
+ });
8243
+ const contentClass = computed(() => cn("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out fixed left-1/2 top-1/2 z-[var(--z-overlay)] grid w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-4 rounded-lg border p-6 shadow-lg duration-200 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 sm:max-w-md"));
8244
+ return (_ctx, _cache) => {
8245
+ return openBlock(), createBlock(unref(Dialog).Root, {
8246
+ open: unref(isOpen),
8247
+ "close-on-escape": !unref(loading),
8248
+ "close-on-interact-outside": !unref(loading),
8249
+ "onUpdate:open": handleUpdate
8250
+ }, {
8251
+ default: withCtx(() => [createVNode(unref(Dialog).Backdrop, { class: "fixed inset-0 z-[var(--z-overlay)] bg-black/50 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0" }), createVNode(unref(Dialog).Positioner, { class: "fixed inset-0 z-[var(--z-overlay)] flex items-center justify-center p-4" }, {
8252
+ default: withCtx(() => [createCommentVNode(" role=\"alertdialog\":覆盖 Ark Content 默认 role=\"dialog\",补偿无上游 AlertDialog 原语的角色语义 "), createVNode(unref(Dialog).Content, {
8253
+ class: normalizeClass(contentClass.value),
8254
+ role: "alertdialog",
8255
+ "aria-modal": "true"
8256
+ }, {
8257
+ default: withCtx(() => [
8258
+ createElementVNode("div", _hoisted_1$2, [createVNode(unref(Dialog).Title, { class: "text-lg font-semibold leading-none tracking-tight" }, {
8259
+ default: withCtx(() => [renderSlot(_ctx.$slots, "title", {}, () => [createTextVNode(toDisplayString(props.title), 1)])]),
8260
+ _: 3
8261
+ }), _ctx.$slots.description || props.description ? (openBlock(), createBlock(unref(Dialog).Description, {
8262
+ key: 0,
8263
+ class: "text-sm text-muted-foreground"
8264
+ }, {
8265
+ default: withCtx(() => [renderSlot(_ctx.$slots, "description", {}, () => [createTextVNode(toDisplayString(props.description), 1)])]),
8266
+ _: 3
8267
+ })) : createCommentVNode("v-if", true)]),
8268
+ createCommentVNode(" 默认插槽:补充正文(可选) "),
8269
+ renderSlot(_ctx.$slots, "default"),
8270
+ createCommentVNode(" 底部操作区:取消 outline,确认按 destructive 切换语义色;pending 时确认钮转 loading "),
8271
+ createElementVNode("div", _hoisted_2$2, [createVNode(unref(_sfc_main$5), {
8272
+ variant: "outline",
8273
+ disabled: unref(loading),
8274
+ onClick: unref(handleCancel)
8275
+ }, {
8276
+ default: withCtx(() => [createTextVNode(toDisplayString(props.cancelText), 1)]),
8277
+ _: 1
8278
+ }, 8, ["disabled", "onClick"]), createVNode(unref(_sfc_main$5), {
8279
+ variant: props.destructive ? "destructive" : "default",
8280
+ disabled: unref(loading),
8281
+ onClick: unref(handleConfirm)
8282
+ }, {
8283
+ default: withCtx(() => [unref(loading) ? (openBlock(), createElementBlock("svg", _hoisted_3, [..._cache[0] || (_cache[0] = [createElementVNode("path", { d: "M21 12a9 9 0 1 1-6.219-8.56" }, null, -1)])])) : createCommentVNode("v-if", true), createTextVNode(" " + toDisplayString(props.confirmText), 1)]),
8284
+ _: 1
8285
+ }, 8, [
8286
+ "variant",
8287
+ "disabled",
8288
+ "onClick"
8289
+ ])])
8290
+ ]),
8291
+ _: 3
8292
+ }, 8, ["class"])]),
8293
+ _: 3
8294
+ })]),
8295
+ _: 3
8296
+ }, 8, [
8297
+ "open",
8298
+ "close-on-escape",
8299
+ "close-on-interact-outside"
8300
+ ]);
8301
+ };
8302
+ }
8303
+ });
8304
+ //#endregion
8305
+ //#region src/components/context-menu/ContextMenu.vue
8306
+ const contentCls = "bg-popover text-popover-foreground z-[var(--z-overlay)] min-w-[8rem] overflow-hidden rounded-md border p-1 shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95";
8307
+ const _sfc_main$10 = /*@__PURE__*/ defineComponent({
8308
+ name: "ContextMenu",
8309
+ inheritAttrs: false,
8310
+ __name: "ContextMenu",
8311
+ props: {
8312
+ /** 菜单项描述列表,与 DropdownMenu 的 items 完全同构(item/label/separator/group 四种形态,group 可嵌套) */
8313
+ items: {
8314
+ type: Array,
8315
+ required: true
8316
+ } },
8317
+ emits: ["select"],
8318
+ setup(__props, { emit: __emit }) {
8319
+ const props = __props;
8320
+ const emit = __emit;
8321
+ const attrs = useAttrs();
8322
+ function handleSelect(details) {
8323
+ emit("select", details);
8324
+ }
8325
+ return (_ctx, _cache) => {
8326
+ return openBlock(), createBlock(unref(Menu).Root, { onSelect: handleSelect }, {
8327
+ default: withCtx(() => [
8328
+ createCommentVNode(" 默认插槽 = 触发元素本身(ContextTrigger as-child 透传,右键唤出并定位到指针处) "),
8329
+ createVNode(unref(Menu).ContextTrigger, { "as-child": "" }, {
8330
+ default: withCtx(() => [renderSlot(_ctx.$slots, "default")]),
8331
+ _: 3
8332
+ }),
8333
+ createVNode(unref(Menu).Positioner, { class: "z-[var(--z-overlay)]" }, {
8334
+ default: withCtx(() => [createVNode(unref(Menu).Content, mergeProps(unref(attrs), { class: unref(cn)(contentCls) }), {
8335
+ default: withCtx(() => [createVNode(_sfc_main$53, { items: props.items }, null, 8, ["items"])]),
8336
+ _: 1
8337
+ }, 16, ["class"])]),
8338
+ _: 1
8339
+ })
8340
+ ]),
8341
+ _: 3
8342
+ });
8343
+ };
8344
+ }
8345
+ });
8346
+ //#endregion
8347
+ //#region src/components/drawer/Drawer.vue
8348
+ const _hoisted_1$1 = {
8349
+ key: 0,
8350
+ class: "flex flex-col gap-1.5"
8351
+ };
8352
+ const _hoisted_2$1 = {
8353
+ key: 1,
8354
+ class: "mt-auto flex flex-col-reverse gap-2 pt-2 sm:flex-row sm:justify-end"
8355
+ };
8356
+ const _sfc_main$15 = /*@__PURE__*/ defineComponent({
8357
+ __name: "Drawer",
8358
+ props: {
8359
+ /** 受控开关(配合 v-model:open);不传时为非受控,由内部状态管理 */
8360
+ open: {
8361
+ type: Boolean,
8362
+ default: void 0
8363
+ },
8364
+ /** 非受控时的初始开关 */
8365
+ defaultOpen: {
8366
+ type: Boolean,
8367
+ default: false
8368
+ },
8369
+ /** 首次打开前不挂载内容 */
8370
+ lazyMount: {
8371
+ type: Boolean,
8372
+ default: false
8373
+ },
8374
+ /** 关闭后卸载内容(关闭动画结束后) */
8375
+ unmountOnExit: {
8376
+ type: Boolean,
8377
+ default: false
8378
+ },
8379
+ /** 抽屉弹出方向 */
8380
+ placement: {
8381
+ type: String,
8382
+ default: "right"
8383
+ },
8384
+ /** 尺寸档位:侧向(left/right)为宽度,顶/底向(top/bottom)为高度 */
8385
+ size: {
8386
+ type: String,
8387
+ default: "default"
8388
+ },
8389
+ /** 标题文案(#title 插槽优先,两者皆无则不渲染标题) */
8390
+ title: {
8391
+ type: String,
8392
+ default: void 0
8393
+ },
8394
+ /** 描述文案(#description 插槽优先,两者皆无则不渲染描述) */
8395
+ description: {
8396
+ type: String,
8397
+ default: void 0
8398
+ },
8399
+ /** 是否渲染右上角内置关闭按钮(aria-label="关闭") */
8400
+ showCloseButton: {
8401
+ type: Boolean,
8402
+ default: true
8403
+ }
8404
+ },
8405
+ emits: ["update:open"],
8406
+ setup(__props, { emit: __emit }) {
8407
+ const props = __props;
8408
+ const emit = __emit;
8409
+ const { isOpen, setOpen } = useControlledBoolean({
8410
+ controlled: () => props.open,
8411
+ defaultValue: () => props.defaultOpen,
8412
+ onChange: (open) => emit("update:open", open)
8413
+ });
8414
+ /** 关闭抽屉(#footer 作用域插槽注入) */
8415
+ function close() {
8416
+ setOpen(false);
8417
+ }
8418
+ const hasHeader = computed(() => Boolean(props.title || props.description));
8419
+ const placementConfig = {
8420
+ right: {
8421
+ positioner: "justify-end",
8422
+ content: "inset-y-0 right-0 h-full border-l",
8423
+ sizes: {
8424
+ sm: "sm:w-80",
8425
+ default: "sm:w-96",
8426
+ lg: "sm:w-[40rem]"
8427
+ }
8428
+ },
8429
+ left: {
8430
+ positioner: "justify-start",
8431
+ content: "inset-y-0 left-0 h-full border-r",
8432
+ sizes: {
8433
+ sm: "sm:w-80",
8434
+ default: "sm:w-96",
8435
+ lg: "sm:w-[40rem]"
8436
+ }
8437
+ },
8438
+ top: {
8439
+ positioner: "items-start",
8440
+ content: "inset-x-0 top-0 w-full border-b",
8441
+ sizes: {
8442
+ sm: "sm:h-64",
8443
+ default: "sm:h-80",
8444
+ lg: "sm:h-[28rem]"
8445
+ }
8446
+ },
8447
+ bottom: {
8448
+ positioner: "items-end",
8449
+ content: "inset-x-0 bottom-0 w-full border-t",
8450
+ sizes: {
8451
+ sm: "sm:h-64",
8452
+ default: "sm:h-80",
8453
+ lg: "sm:h-[28rem]"
8454
+ }
8455
+ }
8456
+ };
8457
+ const placementAnimations = {
8458
+ right: "data-[state=open]:slide-in-from-right data-[state=closed]:slide-out-to-right",
8459
+ left: "data-[state=open]:slide-in-from-left data-[state=closed]:slide-out-to-left",
8460
+ top: "data-[state=open]:slide-in-from-top data-[state=closed]:slide-out-to-top",
8461
+ bottom: "data-[state=open]:slide-in-from-bottom data-[state=closed]:slide-out-to-bottom"
8462
+ };
8463
+ const config = computed(() => placementConfig[props.placement]);
8464
+ const isLateral = computed(() => props.placement === "left" || props.placement === "right");
8465
+ const contentClass = computed(() => cn("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out fixed z-[var(--z-overlay)] flex flex-col gap-4 overflow-y-auto p-6 shadow-lg duration-200", config.value.content, isLateral.value ? cn("w-full", config.value.sizes[props.size]) : cn("h-full", config.value.sizes[props.size]), placementAnimations[props.placement]));
8466
+ return (_ctx, _cache) => {
8467
+ return openBlock(), createBlock(unref(Drawer).Root, {
8468
+ open: unref(isOpen),
8469
+ "lazy-mount": props.lazyMount,
8470
+ "unmount-on-exit": props.unmountOnExit,
8471
+ "onUpdate:open": unref(setOpen)
8472
+ }, {
8473
+ default: withCtx(() => [
8474
+ _ctx.$slots.trigger ? (openBlock(), createBlock(unref(Drawer).Trigger, {
8475
+ key: 0,
8476
+ "as-child": ""
8477
+ }, {
8478
+ default: withCtx(() => [renderSlot(_ctx.$slots, "trigger")]),
8479
+ _: 3
8480
+ })) : createCommentVNode("v-if", true),
8481
+ createVNode(unref(Drawer).Backdrop, { class: "fixed inset-0 z-[var(--z-overlay)] bg-black/50 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0" }),
8482
+ createVNode(unref(Drawer).Positioner, { class: normalizeClass(unref(cn)("fixed inset-0 z-[var(--z-overlay)] flex", config.value.positioner)) }, {
8483
+ default: withCtx(() => [createVNode(unref(Drawer).Content, { class: normalizeClass(contentClass.value) }, {
8484
+ default: withCtx(() => [
8485
+ hasHeader.value || _ctx.$slots.title || _ctx.$slots.description ? (openBlock(), createElementBlock("div", _hoisted_1$1, [_ctx.$slots.title || props.title ? (openBlock(), createBlock(unref(Drawer).Title, {
8486
+ key: 0,
8487
+ class: "text-lg font-semibold leading-none tracking-tight"
8488
+ }, {
8489
+ default: withCtx(() => [renderSlot(_ctx.$slots, "title", {}, () => [createTextVNode(toDisplayString(props.title), 1)])]),
8490
+ _: 3
8491
+ })) : createCommentVNode("v-if", true), _ctx.$slots.description || props.description ? (openBlock(), createBlock(unref(Drawer).Description, {
8492
+ key: 1,
8493
+ class: "text-sm text-muted-foreground"
8494
+ }, {
8495
+ default: withCtx(() => [renderSlot(_ctx.$slots, "description", {}, () => [createTextVNode(toDisplayString(props.description), 1)])]),
8496
+ _: 3
8497
+ })) : createCommentVNode("v-if", true)])) : createCommentVNode("v-if", true),
8498
+ renderSlot(_ctx.$slots, "default"),
8499
+ _ctx.$slots.footer ? (openBlock(), createElementBlock("div", _hoisted_2$1, [renderSlot(_ctx.$slots, "footer", { close })])) : createCommentVNode("v-if", true),
8500
+ props.showCloseButton ? (openBlock(), createBlock(unref(Drawer).CloseTrigger, {
8501
+ key: 2,
8502
+ "aria-label": "关闭",
8503
+ class: "absolute right-4 top-4 cursor-pointer rounded-sm opacity-70 transition-opacity hover:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:pointer-events-none"
8504
+ }, {
8505
+ default: withCtx(() => [..._cache[0] || (_cache[0] = [createElementVNode("svg", {
8506
+ viewBox: "0 0 24 24",
8507
+ fill: "none",
8508
+ stroke: "currentColor",
8509
+ "stroke-width": "2",
8510
+ "stroke-linecap": "round",
8511
+ "stroke-linejoin": "round",
8512
+ class: "size-4"
8513
+ }, [createElementVNode("path", { d: "M18 6 6 18" }), createElementVNode("path", { d: "m6 6 12 12" })], -1), createElementVNode("span", { class: "sr-only" }, "关闭", -1)])]),
8514
+ _: 1
8515
+ })) : createCommentVNode("v-if", true)
8516
+ ]),
8517
+ _: 3
8518
+ }, 8, ["class"])]),
8519
+ _: 3
8520
+ }, 8, ["class"])
8521
+ ]),
8522
+ _: 3
8523
+ }, 8, [
8524
+ "open",
8525
+ "lazy-mount",
8526
+ "unmount-on-exit",
8527
+ "onUpdate:open"
8528
+ ]);
8529
+ };
8530
+ }
8531
+ });
8532
+ //#endregion
8533
+ //#region src/components/popconfirm/Popconfirm.vue
8534
+ const _hoisted_1 = { class: "mt-3 flex items-center justify-end gap-2" };
8535
+ const _hoisted_2 = {
8536
+ key: 0,
8537
+ viewBox: "0 0 24 24",
8538
+ fill: "none",
8539
+ stroke: "currentColor",
8540
+ "stroke-width": "2",
8541
+ "stroke-linecap": "round",
8542
+ class: "size-4 animate-spin",
8543
+ "aria-hidden": "true"
8544
+ };
8545
+ /**
8546
+ * 气泡确认:Popover 的一体式薄壳变体,面板内容内置 title/description + 确认/取消按钮。
8547
+ * 行为与 M2 AlertDialog 对齐:@confirm 处理器返回 Promise 时确认钮进入 loading 并锁定全部
8548
+ * 关闭通道(ESC/点外部/触发器/取消钮),resolve 后自动关闭、reject 保持打开;
8549
+ * 同步处理器点击确认/取消后自动关闭并派发对应事件。
8550
+ */
8551
+ const _sfc_main$33 = /*@__PURE__*/ defineComponent({
8552
+ inheritAttrs: false,
8553
+ __name: "Popconfirm",
8554
+ props: {
8555
+ /** 气泡标题(渲染为 Ark Popover.Title,content 自动接线 aria-labelledby) */
8556
+ title: {
8557
+ type: String,
8558
+ required: true
8559
+ },
8560
+ /** 气泡描述(可选,渲染为 Ark Popover.Description,content 自动接线 aria-describedby) */
8561
+ description: {
8562
+ type: String,
8563
+ default: void 0
8564
+ },
8565
+ /** 确认按钮文案 */
8566
+ confirmText: {
8567
+ type: String,
8568
+ default: "确定"
8569
+ },
8570
+ /** 取消按钮文案 */
8571
+ cancelText: {
8572
+ type: String,
8573
+ default: "取消"
8574
+ },
8575
+ /** 确认按钮风格:default 主色 / destructive 危险色 */
8576
+ variant: {
8577
+ type: String,
8578
+ default: "default"
8579
+ },
8580
+ /** 受控开关(配合 v-model:open);不传时为非受控,由内部状态管理 */
8581
+ open: {
8582
+ type: Boolean,
8583
+ default: void 0
8584
+ }
8585
+ },
8586
+ emits: [
8587
+ "update:open",
8588
+ "confirm",
8589
+ "cancel"
8590
+ ],
8591
+ setup(__props, { emit: __emit }) {
8592
+ const props = __props;
8593
+ const emit = __emit;
8594
+ const attrs = useAttrs();
8595
+ const instance = getCurrentInstance();
8596
+ const { isOpen, setOpen } = useControlledBoolean({
8597
+ controlled: () => props.open,
8598
+ onChange: (open) => emit("update:open", open)
8599
+ });
8600
+ function handleUpdate(open) {
8601
+ if (!open && loading.value) return;
8602
+ setOpen(open);
8603
+ }
8604
+ /** 关闭气泡:走受控桥把 open 置 false,定位回退/动画由 zag 处理 */
8605
+ function close() {
8606
+ handleUpdate(false);
8607
+ }
8608
+ const { loading, handleConfirm, handleCancel } = useConfirmPending({
8609
+ instance,
8610
+ emitConfirm: () => emit("confirm"),
8611
+ emitCancel: () => emit("cancel"),
8612
+ close
8613
+ });
8614
+ return (_ctx, _cache) => {
8615
+ return openBlock(), createElementBlock(Fragment, null, [createCommentVNode(" 薄壳复用 Popover:触发器 asChild、受控桥、定位与进出场动画均由 Popover 提供 "), createVNode(unref(_sfc_main$34), mergeProps(unref(attrs), {
8616
+ open: unref(isOpen),
8617
+ "content-class": "w-64 p-3",
8618
+ "onUpdate:open": handleUpdate
8619
+ }), {
8620
+ content: withCtx(() => [
8621
+ createVNode(unref(Popover).Title, { class: "text-sm font-medium" }, {
8622
+ default: withCtx(() => [createTextVNode(toDisplayString(props.title), 1)]),
8623
+ _: 1
8624
+ }),
8625
+ props.description ? (openBlock(), createBlock(unref(Popover).Description, {
8626
+ key: 0,
8627
+ class: "mt-1 text-xs text-muted-foreground"
8628
+ }, {
8629
+ default: withCtx(() => [createTextVNode(toDisplayString(props.description), 1)]),
8630
+ _: 1
8631
+ })) : createCommentVNode("v-if", true),
8632
+ createCommentVNode(" 操作区:取消 outline,确认按 variant 切换语义色;pending 时双钮禁用 + 确认钮转 loading "),
8633
+ createElementVNode("div", _hoisted_1, [createVNode(unref(_sfc_main$5), {
8634
+ variant: "outline",
8635
+ size: "sm",
8636
+ disabled: unref(loading),
8637
+ onClick: unref(handleCancel)
8638
+ }, {
8639
+ default: withCtx(() => [createTextVNode(toDisplayString(props.cancelText), 1)]),
8640
+ _: 1
8641
+ }, 8, ["disabled", "onClick"]), createVNode(unref(_sfc_main$5), {
8642
+ variant: props.variant === "destructive" ? "destructive" : "default",
8643
+ size: "sm",
8644
+ disabled: unref(loading),
8645
+ onClick: unref(handleConfirm)
8646
+ }, {
8647
+ default: withCtx(() => [unref(loading) ? (openBlock(), createElementBlock("svg", _hoisted_2, [..._cache[0] || (_cache[0] = [createElementVNode("path", { d: "M21 12a9 9 0 1 1-6.219-8.56" }, null, -1)])])) : createCommentVNode("v-if", true), createTextVNode(" " + toDisplayString(props.confirmText), 1)]),
8648
+ _: 1
8649
+ }, 8, [
8650
+ "variant",
8651
+ "disabled",
8652
+ "onClick"
8653
+ ])])
8654
+ ]),
8655
+ default: withCtx(() => [renderSlot(_ctx.$slots, "default")]),
8656
+ _: 3
8657
+ }, 16, ["open"])], 2112);
8658
+ };
8659
+ }
8660
+ });
8661
+ //#endregion
8662
+ export { _sfc_main as Alert, _sfc_main$1 as AlertDialog, _sfc_main$2 as Avatar, _sfc_main$3 as AvatarGroup, _sfc_main$4 as Badge, _sfc_main$5 as Button, CHECKED, COMPONENT_NAMES, _sfc_main$6 as Calendar, _sfc_main$7 as Card, _sfc_main$8 as Cascader, _sfc_main$9 as Checkbox, _sfc_main$10 as ContextMenu, _sfc_main$11 as CurrencyInput, _sfc_main$12 as DatePicker, _sfc_main$13 as DateRangePicker, _sfc_main$14 as Dialog, _sfc_main$15 as Drawer, _sfc_main$16 as DropdownMenu, _sfc_main$17 as Empty, _sfc_main$18 as Form, _sfc_main$19 as FormControl, _sfc_main$20 as FormDescription, _sfc_main$21 as FormField, _sfc_main$22 as FormItem, _sfc_main$23 as FormLabel, _sfc_main$24 as FormMessage, _sfc_main$25 as FormRender, _sfc_main$26 as FormSubscribe, _sfc_main$27 as Input, _sfc_main$28 as Label, MODEL_VALUE, _sfc_main$29 as MonthPicker, _sfc_main$30 as NumberInput, _sfc_main$31 as PasswordInput, _sfc_main$32 as PinInput, _sfc_main$33 as Popconfirm, _sfc_main$34 as Popover, _sfc_main$35 as Progress, _sfc_main$36 as RadioGroup, SLIDER, _sfc_main$37 as Select, _sfc_main$38 as Separator, _sfc_main$39 as Skeleton, _sfc_main$40 as Slider, Slot, _sfc_main$41 as Spin, _sfc_main$42 as Switch, _sfc_main$43 as TableRender, _sfc_main$44 as Tabs, _sfc_main$45 as Textarea, _sfc_main$46 as ToastProvider, _sfc_main$47 as Tooltip, _sfc_main$48 as TreeSelect, TuDesignResolver, VALUE, _sfc_main$49 as WeekPicker, _sfc_main$50 as YearPicker, alertIconPaths, alertIconVariants, alertVariants, avatarGroupKey, avatarVariants, badgeVariants, bindField, buttonVariants, cardVariants, cn, columnRenders, defineColumns, defineForm, defineTable, formatCurrency, numberOrNull, parseCurrency, useFormRender, useTableRender, useToast, widgetRenders };