@tu-design/vue 0.4.0 → 0.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +74 -0
- package/dist/index.d.mts +99 -94
- package/dist/index.mjs +986 -875
- package/dist/registry/vue/alert-dialog.json +4 -3
- package/dist/registry/vue/alert.json +2 -1
- package/dist/registry/vue/avatar-group.json +2 -1
- package/dist/registry/vue/avatar.json +2 -1
- package/dist/registry/vue/badge.json +2 -1
- package/dist/registry/vue/button.json +3 -2
- package/dist/registry/vue/calendar.json +4 -3
- package/dist/registry/vue/card.json +2 -1
- package/dist/registry/vue/cascader.json +6 -5
- package/dist/registry/vue/checkbox.json +2 -1
- package/dist/registry/vue/context-menu.json +3 -2
- package/dist/registry/vue/currency-input.json +3 -2
- package/dist/registry/vue/date-picker.json +3 -2
- package/dist/registry/vue/date-range-picker.json +4 -3
- package/dist/registry/vue/date-shared.json +17 -2
- package/dist/registry/vue/dialog.json +4 -3
- package/dist/registry/vue/drawer.json +4 -3
- package/dist/registry/vue/dropdown-menu.json +5 -4
- package/dist/registry/vue/empty.json +2 -1
- package/dist/registry/vue/form-render.json +36 -34
- package/dist/registry/vue/form.json +3 -2
- package/dist/registry/vue/input.json +2 -1
- package/dist/registry/vue/label.json +2 -1
- package/dist/registry/vue/month-picker.json +3 -2
- package/dist/registry/vue/number-input.json +3 -2
- package/dist/registry/vue/overlay-shared.json +21 -0
- package/dist/registry/vue/password-input.json +2 -1
- package/dist/registry/vue/pin-input.json +2 -1
- package/dist/registry/vue/popconfirm.json +4 -3
- package/dist/registry/vue/popover.json +4 -3
- package/dist/registry/vue/progress.json +2 -1
- package/dist/registry/vue/radio-group.json +2 -1
- package/dist/registry/vue/registry.json +57 -1
- package/dist/registry/vue/select.json +5 -4
- package/dist/registry/vue/separator.json +2 -1
- package/dist/registry/vue/skeleton.json +2 -1
- package/dist/registry/vue/slider.json +2 -1
- package/dist/registry/vue/slot.json +4 -3
- package/dist/registry/vue/spin.json +2 -1
- package/dist/registry/vue/switch.json +2 -1
- package/dist/registry/vue/table-render.json +40 -11
- package/dist/registry/vue/tabs.json +2 -1
- package/dist/registry/vue/textarea.json +2 -1
- package/dist/registry/vue/toast.json +4 -3
- package/dist/registry/vue/tokens.json +3 -1
- package/dist/registry/vue/tooltip.json +4 -3
- package/dist/registry/vue/tree-select.json +6 -5
- package/dist/registry/vue/tree-shared.json +16 -14
- package/dist/registry/vue/utils.json +1 -0
- package/dist/registry/vue/week-picker.json +3 -2
- package/dist/registry/vue/year-picker.json +3 -2
- package/package.json +3 -2
package/dist/index.mjs
CHANGED
|
@@ -448,7 +448,7 @@ const _sfc_main$26 = /*@__PURE__*/ defineComponent({
|
|
|
448
448
|
* aria 接线(id/aria-invalid/aria-describedby)由 FormControl 的 cloneVNode 机制继承。
|
|
449
449
|
* widget 调用发生在 FormField 插槽期,拿到 field 实例后组装 WidgetContext。
|
|
450
450
|
*/
|
|
451
|
-
const _sfc_main$
|
|
451
|
+
const _sfc_main$64 = defineComponent({
|
|
452
452
|
name: "TuFormRenderField",
|
|
453
453
|
props: {
|
|
454
454
|
item: {
|
|
@@ -499,7 +499,7 @@ const _hoisted_1$28 = {
|
|
|
499
499
|
"stroke-linecap": "round",
|
|
500
500
|
class: "size-3.5"
|
|
501
501
|
};
|
|
502
|
-
const _hoisted_2$
|
|
502
|
+
const _hoisted_2$18 = {
|
|
503
503
|
key: 1,
|
|
504
504
|
viewBox: "0 0 24 24",
|
|
505
505
|
fill: "none",
|
|
@@ -563,7 +563,7 @@ const _sfc_main$9 = /*@__PURE__*/ defineComponent({
|
|
|
563
563
|
createVNode(unref(Checkbox).HiddenInput),
|
|
564
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" }, {
|
|
565
565
|
default: withCtx(() => [createVNode(unref(Checkbox).Indicator, { class: "flex items-center justify-center text-current" }, {
|
|
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$
|
|
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)])]))]),
|
|
567
567
|
_: 1
|
|
568
568
|
})]),
|
|
569
569
|
_: 1
|
|
@@ -749,7 +749,7 @@ function formatCurrency(value, valueUnit, labelUnit) {
|
|
|
749
749
|
//#endregion
|
|
750
750
|
//#region src/components/currency-input/CurrencyInput.vue
|
|
751
751
|
const _hoisted_1$27 = ["data-invalid"];
|
|
752
|
-
const _hoisted_2$
|
|
752
|
+
const _hoisted_2$17 = [
|
|
753
753
|
"value",
|
|
754
754
|
"placeholder",
|
|
755
755
|
"disabled",
|
|
@@ -824,7 +824,7 @@ const _sfc_main$11 = /*@__PURE__*/ defineComponent({
|
|
|
824
824
|
"aria-invalid": props.invalid || void 0,
|
|
825
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",
|
|
826
826
|
onInput
|
|
827
|
-
}), null, 16, _hoisted_2$
|
|
827
|
+
}), null, 16, _hoisted_2$17), createElementVNode("div", {
|
|
828
828
|
"aria-hidden": "true",
|
|
829
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"))
|
|
830
830
|
}, toDisplayString(props.labelUnit), 3)], 10, _hoisted_1$27);
|
|
@@ -944,7 +944,7 @@ const navBtnCls = "text-muted-foreground inline-flex size-8 items-center justify
|
|
|
944
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";
|
|
945
945
|
const viewTitleCls = "text-sm font-semibold text-foreground";
|
|
946
946
|
/** 年代范围文本(zag 无现成 part,由 focusedValue.year 推算):2026 → "2020 - 2029" */
|
|
947
|
-
const _sfc_main$
|
|
947
|
+
const _sfc_main$63 = /*@__PURE__*/ defineComponent({
|
|
948
948
|
__name: "CalendarNav",
|
|
949
949
|
props: {
|
|
950
950
|
/** 导航条服务的视图,决定中间内容形态:day=ViewTrigger(上钻)/ month=年份 / year=年代 */
|
|
@@ -959,7 +959,7 @@ view: {
|
|
|
959
959
|
return `${start} - ${start + 9}`;
|
|
960
960
|
}
|
|
961
961
|
return (_ctx, _cache) => {
|
|
962
|
-
return openBlock(), createBlock(unref(DatePicker).ViewControl, { class: normalizeClass(viewControlCls) }, {
|
|
962
|
+
return openBlock(), createBlock(unref(DatePicker).ViewControl, { class: normalizeClass(unref(cn)(viewControlCls, _ctx.$attrs.class)) }, {
|
|
963
963
|
default: withCtx(() => [
|
|
964
964
|
createVNode(unref(DatePicker).PrevTrigger, { class: normalizeClass(navBtnCls) }, {
|
|
965
965
|
default: withCtx(() => [..._cache[0] || (_cache[0] = [createElementVNode("svg", {
|
|
@@ -1008,7 +1008,7 @@ view: {
|
|
|
1008
1008
|
})
|
|
1009
1009
|
]),
|
|
1010
1010
|
_: 1
|
|
1011
|
-
});
|
|
1011
|
+
}, 8, ["class"]);
|
|
1012
1012
|
};
|
|
1013
1013
|
}
|
|
1014
1014
|
});
|
|
@@ -1023,7 +1023,7 @@ const headCellCls = "text-muted-foreground h-8 border-x-0! border-t-0! border-b
|
|
|
1023
1023
|
const bodyCellCls = "border-0! p-0! text-center";
|
|
1024
1024
|
const rowCls = "bg-transparent!";
|
|
1025
1025
|
/** 表 i 的锚点月起点(zag getOffset({months: i-1}).visibleRange.start) */
|
|
1026
|
-
const _sfc_main$
|
|
1026
|
+
const _sfc_main$62 = /*@__PURE__*/ defineComponent({
|
|
1027
1027
|
__name: "CalendarBody",
|
|
1028
1028
|
props: {
|
|
1029
1029
|
mode: { default: "day" },
|
|
@@ -1064,7 +1064,7 @@ const _sfc_main$60 = /*@__PURE__*/ defineComponent({
|
|
|
1064
1064
|
createVNode(unref(DatePicker).View, { view: "day" }, {
|
|
1065
1065
|
default: withCtx(() => [
|
|
1066
1066
|
createCommentVNode(" day 视图导航条在 View 内:viewProps=day → GOTO.NEXT=focusNextPage(翻月) "),
|
|
1067
|
-
createVNode(_sfc_main$
|
|
1067
|
+
createVNode(_sfc_main$63, { view: "day" }),
|
|
1068
1068
|
createVNode(unref(DatePicker).Context, null, {
|
|
1069
1069
|
default: withCtx((context) => [createElementVNode("div", _hoisted_1$26, [(openBlock(true), createElementBlock(Fragment, null, renderList(__props.numOfMonths, (i) => {
|
|
1070
1070
|
return openBlock(), createBlock(unref(DatePicker).Table, {
|
|
@@ -1123,7 +1123,7 @@ const _sfc_main$60 = /*@__PURE__*/ defineComponent({
|
|
|
1123
1123
|
createVNode(unref(DatePicker).View, { view: "month" }, {
|
|
1124
1124
|
default: withCtx(() => [
|
|
1125
1125
|
createCommentVNode(" 切换视图导航条也在 View 内:DatePicker 切月视图后 GOTO.NEXT=focusNextYear(修复 backlog) "),
|
|
1126
|
-
createVNode(_sfc_main$
|
|
1126
|
+
createVNode(_sfc_main$63, { view: "month" }),
|
|
1127
1127
|
createVNode(unref(DatePicker).Context, null, {
|
|
1128
1128
|
default: withCtx((context) => [createVNode(unref(DatePicker).Table, { class: normalizeClass(tableCls) }, {
|
|
1129
1129
|
default: withCtx(() => [createVNode(unref(DatePicker).TableBody, null, {
|
|
@@ -1161,7 +1161,7 @@ const _sfc_main$60 = /*@__PURE__*/ defineComponent({
|
|
|
1161
1161
|
_: 1
|
|
1162
1162
|
}),
|
|
1163
1163
|
createVNode(unref(DatePicker).View, { view: "year" }, {
|
|
1164
|
-
default: withCtx(() => [createVNode(_sfc_main$
|
|
1164
|
+
default: withCtx(() => [createVNode(_sfc_main$63, { view: "year" }), createVNode(unref(DatePicker).Context, null, {
|
|
1165
1165
|
default: withCtx((context) => [createVNode(unref(DatePicker).Table, { class: normalizeClass(tableCls) }, {
|
|
1166
1166
|
default: withCtx(() => [createVNode(unref(DatePicker).TableBody, null, {
|
|
1167
1167
|
default: withCtx(() => [(openBlock(true), createElementBlock(Fragment, null, renderList(context.getYearsGrid({ columns: 4 }), (yearsRow, id) => {
|
|
@@ -1199,7 +1199,7 @@ const _sfc_main$60 = /*@__PURE__*/ defineComponent({
|
|
|
1199
1199
|
}, {
|
|
1200
1200
|
default: withCtx(() => [
|
|
1201
1201
|
createCommentVNode(" 导航条必须在 View 子树内:Prev/NextTrigger 才能拿到 view=\"month\"(GOTO.NEXT=focusNextYear) "),
|
|
1202
|
-
createVNode(_sfc_main$
|
|
1202
|
+
createVNode(_sfc_main$63, { view: "month" }),
|
|
1203
1203
|
createVNode(unref(DatePicker).Context, null, {
|
|
1204
1204
|
default: withCtx((context) => [createVNode(unref(DatePicker).Table, { class: normalizeClass(tableCls) }, {
|
|
1205
1205
|
default: withCtx(() => [createVNode(unref(DatePicker).TableBody, null, {
|
|
@@ -1241,7 +1241,7 @@ const _sfc_main$60 = /*@__PURE__*/ defineComponent({
|
|
|
1241
1241
|
}, {
|
|
1242
1242
|
default: withCtx(() => [
|
|
1243
1243
|
createCommentVNode(" 导航条必须在 View 子树内:Prev/NextTrigger 才能拿到 view=\"year\"(GOTO.NEXT=focusNextDecade) "),
|
|
1244
|
-
createVNode(_sfc_main$
|
|
1244
|
+
createVNode(_sfc_main$63, { view: "year" }),
|
|
1245
1245
|
createVNode(unref(DatePicker).Context, null, {
|
|
1246
1246
|
default: withCtx((context) => [createVNode(unref(DatePicker).Table, { class: normalizeClass(tableCls) }, {
|
|
1247
1247
|
default: withCtx(() => [createVNode(unref(DatePicker).TableBody, null, {
|
|
@@ -1280,10 +1280,6 @@ const _sfc_main$60 = /*@__PURE__*/ defineComponent({
|
|
|
1280
1280
|
});
|
|
1281
1281
|
//#endregion
|
|
1282
1282
|
//#region src/components/calendar/Calendar.vue
|
|
1283
|
-
const _hoisted_1$25 = {
|
|
1284
|
-
key: 0,
|
|
1285
|
-
class: "w-fit"
|
|
1286
|
-
};
|
|
1287
1283
|
const _sfc_main$6 = /*@__PURE__*/ defineComponent({
|
|
1288
1284
|
__name: "Calendar",
|
|
1289
1285
|
props: {
|
|
@@ -1352,7 +1348,10 @@ const _sfc_main$6 = /*@__PURE__*/ defineComponent({
|
|
|
1352
1348
|
emit("update:modelValue", value);
|
|
1353
1349
|
}
|
|
1354
1350
|
return (_ctx, _cache) => {
|
|
1355
|
-
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",
|
|
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, {
|
|
1356
1355
|
"model-value": rootValue.value,
|
|
1357
1356
|
open: true,
|
|
1358
1357
|
"num-of-months": props.numOfMonths,
|
|
@@ -1365,7 +1364,7 @@ const _sfc_main$6 = /*@__PURE__*/ defineComponent({
|
|
|
1365
1364
|
"onUpdate:modelValue": handleValueUpdate
|
|
1366
1365
|
}, {
|
|
1367
1366
|
default: withCtx(() => [createVNode(unref(DatePicker).Content, null, {
|
|
1368
|
-
default: withCtx(() => [createVNode(_sfc_main$
|
|
1367
|
+
default: withCtx(() => [createVNode(_sfc_main$62, {
|
|
1369
1368
|
mode: props.mode,
|
|
1370
1369
|
"num-of-months": props.numOfMonths,
|
|
1371
1370
|
week: props.week,
|
|
@@ -1388,7 +1387,7 @@ const _sfc_main$6 = /*@__PURE__*/ defineComponent({
|
|
|
1388
1387
|
"max",
|
|
1389
1388
|
"is-date-unavailable",
|
|
1390
1389
|
"locale"
|
|
1391
|
-
])])) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [createCommentVNode(" embedded 内嵌形态:宿主 Picker 的 Root 供能,纯卡片内核 "), createVNode(_sfc_main$
|
|
1390
|
+
])], 2)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [createCommentVNode(" embedded 内嵌形态:宿主 Picker 的 Root 供能,纯卡片内核 "), createVNode(_sfc_main$62, {
|
|
1392
1391
|
mode: props.mode,
|
|
1393
1392
|
"num-of-months": props.numOfMonths,
|
|
1394
1393
|
week: props.week,
|
|
@@ -1411,8 +1410,8 @@ var export_helper_default = (sfc, props) => {
|
|
|
1411
1410
|
};
|
|
1412
1411
|
//#endregion
|
|
1413
1412
|
//#region src/components/date-shared/CalendarIcon.vue
|
|
1414
|
-
const _sfc_main$
|
|
1415
|
-
const _hoisted_1$
|
|
1413
|
+
const _sfc_main$61 = {};
|
|
1414
|
+
const _hoisted_1$25 = {
|
|
1416
1415
|
viewBox: "0 0 24 24",
|
|
1417
1416
|
fill: "none",
|
|
1418
1417
|
stroke: "currentColor",
|
|
@@ -1422,7 +1421,7 @@ const _hoisted_1$24 = {
|
|
|
1422
1421
|
class: "size-4"
|
|
1423
1422
|
};
|
|
1424
1423
|
function _sfc_render$3(_ctx, _cache) {
|
|
1425
|
-
return openBlock(), createElementBlock("svg", _hoisted_1$
|
|
1424
|
+
return openBlock(), createElementBlock("svg", _hoisted_1$25, [..._cache[0] || (_cache[0] = [
|
|
1426
1425
|
createElementVNode("rect", {
|
|
1427
1426
|
width: "18",
|
|
1428
1427
|
height: "18",
|
|
@@ -1435,11 +1434,11 @@ function _sfc_render$3(_ctx, _cache) {
|
|
|
1435
1434
|
createElementVNode("path", { d: "M3 10h18" }, null, -1)
|
|
1436
1435
|
])]);
|
|
1437
1436
|
}
|
|
1438
|
-
var CalendarIcon_default = /*#__PURE__*/ export_helper_default(_sfc_main$
|
|
1437
|
+
var CalendarIcon_default = /*#__PURE__*/ export_helper_default(_sfc_main$61, [["render", _sfc_render$3]]);
|
|
1439
1438
|
//#endregion
|
|
1440
1439
|
//#region src/components/date-shared/ClearIcon.vue
|
|
1441
|
-
const _sfc_main$
|
|
1442
|
-
const _hoisted_1$
|
|
1440
|
+
const _sfc_main$60 = {};
|
|
1441
|
+
const _hoisted_1$24 = {
|
|
1443
1442
|
viewBox: "0 0 24 24",
|
|
1444
1443
|
fill: "none",
|
|
1445
1444
|
stroke: "currentColor",
|
|
@@ -1449,9 +1448,220 @@ const _hoisted_1$23 = {
|
|
|
1449
1448
|
class: "size-4"
|
|
1450
1449
|
};
|
|
1451
1450
|
function _sfc_render$2(_ctx, _cache) {
|
|
1452
|
-
return openBlock(), createElementBlock("svg", _hoisted_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
|
+
};
|
|
1453
1664
|
}
|
|
1454
|
-
var ClearIcon_default$1 = /*#__PURE__*/ export_helper_default(_sfc_main$58, [["render", _sfc_render$2]]);
|
|
1455
1665
|
//#endregion
|
|
1456
1666
|
//#region src/components/date-picker/DatePicker.vue
|
|
1457
1667
|
const _sfc_main$12 = /*@__PURE__*/ defineComponent({
|
|
@@ -1527,32 +1737,24 @@ const _sfc_main$12 = /*@__PURE__*/ defineComponent({
|
|
|
1527
1737
|
const props = __props;
|
|
1528
1738
|
const emit = __emit;
|
|
1529
1739
|
provide(CALENDAR_IN_PICKER, true);
|
|
1530
|
-
const
|
|
1531
|
-
|
|
1532
|
-
|
|
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)
|
|
1533
1751
|
});
|
|
1534
|
-
const rootValue = computed(() => selected.value ? [selected.value] : []);
|
|
1535
|
-
const internalOpen = ref(props.defaultOpen);
|
|
1536
|
-
const isOpen = computed(() => props.open ?? internalOpen.value);
|
|
1537
1752
|
const minDate = computed(() => parseIsoDate(props.min ?? ""));
|
|
1538
1753
|
const maxDate = computed(() => parseIsoDate(props.max ?? ""));
|
|
1539
|
-
function handleValueUpdate(next) {
|
|
1540
|
-
const value = next[0] ? formatIsoDate(next[0]) : null;
|
|
1541
|
-
internalValue.value = value;
|
|
1542
|
-
emit("update:modelValue", value);
|
|
1543
|
-
}
|
|
1544
|
-
function handleOpenUpdate(next) {
|
|
1545
|
-
internalOpen.value = next;
|
|
1546
|
-
emit("update:open", next);
|
|
1547
|
-
}
|
|
1548
|
-
function openFromInput() {
|
|
1549
|
-
if (props.disabled || props.readOnly || isOpen.value) return;
|
|
1550
|
-
handleOpenUpdate(true);
|
|
1551
|
-
}
|
|
1552
1754
|
return (_ctx, _cache) => {
|
|
1553
|
-
return openBlock(), createBlock(
|
|
1554
|
-
"model-value": rootValue
|
|
1555
|
-
open: isOpen
|
|
1755
|
+
return openBlock(), createBlock(_sfc_main$59, mergeProps(_ctx.$attrs, {
|
|
1756
|
+
"model-value": unref(rootValue),
|
|
1757
|
+
open: unref(isOpen),
|
|
1556
1758
|
locale: props.locale,
|
|
1557
1759
|
min: minDate.value,
|
|
1558
1760
|
max: maxDate.value,
|
|
@@ -1560,50 +1762,17 @@ const _sfc_main$12 = /*@__PURE__*/ defineComponent({
|
|
|
1560
1762
|
"close-on-select": props.closeOnSelect,
|
|
1561
1763
|
"read-only": props.readOnly,
|
|
1562
1764
|
disabled: props.disabled,
|
|
1765
|
+
invalid: props.invalid,
|
|
1766
|
+
placeholder: props.placeholder,
|
|
1767
|
+
class: props.class,
|
|
1563
1768
|
format: unref(formatIsoDate),
|
|
1564
1769
|
parse: unref(parseIsoDate),
|
|
1565
|
-
"onUpdate:modelValue": handleValueUpdate,
|
|
1566
|
-
"onUpdate:open":
|
|
1567
|
-
}, {
|
|
1568
|
-
default: withCtx(() => [
|
|
1569
|
-
createVNode(unref(DatePicker).Control, {
|
|
1570
|
-
class: normalizeClass(unref(cn)(unref(controlCls), props.class)),
|
|
1571
|
-
"data-invalid": props.invalid ? "" : void 0
|
|
1572
|
-
}, {
|
|
1573
|
-
default: withCtx(() => [
|
|
1574
|
-
createVNode(unref(DatePicker).Input, mergeProps(_ctx.$attrs, {
|
|
1575
|
-
placeholder: props.placeholder,
|
|
1576
|
-
"aria-invalid": props.invalid || void 0,
|
|
1577
|
-
class: "bg-transparent h-full w-full min-w-0 flex-1 px-3 text-sm tabular-nums outline-none",
|
|
1578
|
-
onClick: openFromInput,
|
|
1579
|
-
onKeydown: withKeys(withModifiers(openFromInput, ["prevent"]), ["down"])
|
|
1580
|
-
}), null, 16, [
|
|
1581
|
-
"placeholder",
|
|
1582
|
-
"aria-invalid",
|
|
1583
|
-
"onKeydown"
|
|
1584
|
-
]),
|
|
1585
|
-
createVNode(unref(DatePicker).ClearTrigger, { class: normalizeClass(unref(iconBtnCls)) }, {
|
|
1586
|
-
default: withCtx(() => [createVNode(ClearIcon_default$1)]),
|
|
1587
|
-
_: 1
|
|
1588
|
-
}, 8, ["class"]),
|
|
1589
|
-
createVNode(unref(DatePicker).Trigger, { class: normalizeClass(unref(iconBtnCls)) }, {
|
|
1590
|
-
default: withCtx(() => [createVNode(CalendarIcon_default)]),
|
|
1591
|
-
_: 1
|
|
1592
|
-
}, 8, ["class"])
|
|
1593
|
-
]),
|
|
1594
|
-
_: 1
|
|
1595
|
-
}, 8, ["class", "data-invalid"]),
|
|
1596
|
-
createCommentVNode(" 弹层 Teleport 到 body:脱离表单 DOM——隔离外层 FormControl 的 group class\n (group-hover 会污染面板内全部格子),并消除 overflow 容器裁剪弹层的隐患。 "),
|
|
1597
|
-
(openBlock(), createBlock(Teleport, { to: "body" }, [createVNode(unref(DatePicker).Positioner, { class: "z-50" }, {
|
|
1598
|
-
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")) }, {
|
|
1599
|
-
default: withCtx(() => [createVNode(unref(_sfc_main$6))]),
|
|
1600
|
-
_: 1
|
|
1601
|
-
}, 8, ["class"])]),
|
|
1602
|
-
_: 1
|
|
1603
|
-
})]))
|
|
1604
|
-
]),
|
|
1770
|
+
"onUpdate:modelValue": unref(handleValueUpdate),
|
|
1771
|
+
"onUpdate:open": unref(setOpen)
|
|
1772
|
+
}), {
|
|
1773
|
+
default: withCtx(() => [createVNode(unref(_sfc_main$6))]),
|
|
1605
1774
|
_: 1
|
|
1606
|
-
},
|
|
1775
|
+
}, 16, [
|
|
1607
1776
|
"model-value",
|
|
1608
1777
|
"open",
|
|
1609
1778
|
"locale",
|
|
@@ -1613,8 +1782,13 @@ const _sfc_main$12 = /*@__PURE__*/ defineComponent({
|
|
|
1613
1782
|
"close-on-select",
|
|
1614
1783
|
"read-only",
|
|
1615
1784
|
"disabled",
|
|
1785
|
+
"invalid",
|
|
1786
|
+
"placeholder",
|
|
1787
|
+
"class",
|
|
1616
1788
|
"format",
|
|
1617
|
-
"parse"
|
|
1789
|
+
"parse",
|
|
1790
|
+
"onUpdate:modelValue",
|
|
1791
|
+
"onUpdate:open"
|
|
1618
1792
|
]);
|
|
1619
1793
|
};
|
|
1620
1794
|
}
|
|
@@ -1719,15 +1893,14 @@ const _sfc_main$13 = /*@__PURE__*/ defineComponent({
|
|
|
1719
1893
|
if (props.modelValue === void 0 && props.defaultValue) internalValue.value = parseIsoRange(props.defaultValue) ?? [];
|
|
1720
1894
|
const minDate = computed(() => parseIsoDate(props.min ?? ""));
|
|
1721
1895
|
const maxDate = computed(() => parseIsoDate(props.max ?? ""));
|
|
1722
|
-
const
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
}
|
|
1896
|
+
const { isOpen, setOpen } = useControlledBoolean({
|
|
1897
|
+
controlled: () => props.open,
|
|
1898
|
+
defaultValue: () => props.defaultOpen,
|
|
1899
|
+
onChange: (open) => emit("update:open", open)
|
|
1900
|
+
});
|
|
1728
1901
|
function openFromInput() {
|
|
1729
1902
|
if (props.disabled || props.readOnly || isOpen.value) return;
|
|
1730
|
-
|
|
1903
|
+
setOpen(true);
|
|
1731
1904
|
}
|
|
1732
1905
|
return (_ctx, _cache) => {
|
|
1733
1906
|
return openBlock(), createElementBlock(Fragment, null, [createCommentVNode(" outside-day-selectable:zag getDayTableCellState 的 getUnitDuration 把 months 强制置 1,\n 多月视图下第二月起所有当月格被误判 outside-range 而禁用;此开关对冲(见 calendar/CalendarBody 注释) "), createVNode(unref(DatePicker).Root, {
|
|
@@ -1735,7 +1908,7 @@ const _sfc_main$13 = /*@__PURE__*/ defineComponent({
|
|
|
1735
1908
|
"selection-mode": "range",
|
|
1736
1909
|
"num-of-months": props.numOfMonths,
|
|
1737
1910
|
"outside-day-selectable": "",
|
|
1738
|
-
open: isOpen
|
|
1911
|
+
open: unref(isOpen),
|
|
1739
1912
|
locale: props.locale,
|
|
1740
1913
|
min: minDate.value,
|
|
1741
1914
|
max: maxDate.value,
|
|
@@ -1746,7 +1919,7 @@ const _sfc_main$13 = /*@__PURE__*/ defineComponent({
|
|
|
1746
1919
|
format: unref(formatIsoDate),
|
|
1747
1920
|
parse: unref(parseIsoDate),
|
|
1748
1921
|
"onUpdate:modelValue": handleValueUpdate,
|
|
1749
|
-
"onUpdate:open":
|
|
1922
|
+
"onUpdate:open": unref(setOpen)
|
|
1750
1923
|
}, {
|
|
1751
1924
|
default: withCtx(() => [
|
|
1752
1925
|
createVNode(unref(DatePicker).Control, {
|
|
@@ -1800,8 +1973,8 @@ const _sfc_main$13 = /*@__PURE__*/ defineComponent({
|
|
|
1800
1973
|
_: 1
|
|
1801
1974
|
}, 8, ["class", "data-invalid"]),
|
|
1802
1975
|
createCommentVNode(" 弹层 Teleport 到 body:脱离表单 DOM——隔离外层 FormControl 的 group class\n (group-hover 会污染面板内全部格子),并消除 overflow 容器裁剪弹层的隐患。 "),
|
|
1803
|
-
(openBlock(), createBlock(Teleport, { to: "body" }, [createVNode(unref(DatePicker).Positioner, { class: "z-
|
|
1804
|
-
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-
|
|
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")) }, {
|
|
1805
1978
|
default: withCtx(() => [createVNode(unref(_sfc_main$6), { "num-of-months": props.numOfMonths }, null, 8, ["num-of-months"])]),
|
|
1806
1979
|
_: 1
|
|
1807
1980
|
}, 8, ["class"])]),
|
|
@@ -1821,7 +1994,8 @@ const _sfc_main$13 = /*@__PURE__*/ defineComponent({
|
|
|
1821
1994
|
"read-only",
|
|
1822
1995
|
"disabled",
|
|
1823
1996
|
"format",
|
|
1824
|
-
"parse"
|
|
1997
|
+
"parse",
|
|
1998
|
+
"onUpdate:open"
|
|
1825
1999
|
])], 2112);
|
|
1826
2000
|
};
|
|
1827
2001
|
}
|
|
@@ -1897,35 +2071,27 @@ const _sfc_main$29 = /*@__PURE__*/ defineComponent({
|
|
|
1897
2071
|
const props = __props;
|
|
1898
2072
|
const emit = __emit;
|
|
1899
2073
|
provide(CALENDAR_IN_PICKER, true);
|
|
1900
|
-
const
|
|
1901
|
-
|
|
1902
|
-
|
|
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)
|
|
1903
2085
|
});
|
|
1904
|
-
const rootValue = computed(() => selected.value ? [selected.value] : []);
|
|
1905
|
-
const internalOpen = ref(props.defaultOpen);
|
|
1906
|
-
const isOpen = computed(() => props.open ?? internalOpen.value);
|
|
1907
2086
|
const minDate = computed(() => parseIsoMonth(props.min ?? ""));
|
|
1908
2087
|
const maxDate = computed(() => {
|
|
1909
2088
|
const anchor = parseIsoMonth(props.max ?? "");
|
|
1910
2089
|
return anchor ? anchor.set({ day: 31 }) : void 0;
|
|
1911
2090
|
});
|
|
1912
|
-
function handleValueUpdate(next) {
|
|
1913
|
-
const value = next[0] ? formatIsoMonth(next[0]) : null;
|
|
1914
|
-
internalValue.value = value;
|
|
1915
|
-
emit("update:modelValue", value);
|
|
1916
|
-
}
|
|
1917
|
-
function handleOpenUpdate(next) {
|
|
1918
|
-
internalOpen.value = next;
|
|
1919
|
-
emit("update:open", next);
|
|
1920
|
-
}
|
|
1921
|
-
function openFromInput() {
|
|
1922
|
-
if (props.disabled || props.readOnly || isOpen.value) return;
|
|
1923
|
-
handleOpenUpdate(true);
|
|
1924
|
-
}
|
|
1925
2091
|
return (_ctx, _cache) => {
|
|
1926
|
-
return openBlock(), createBlock(
|
|
1927
|
-
"model-value": rootValue
|
|
1928
|
-
open: isOpen
|
|
2092
|
+
return openBlock(), createBlock(_sfc_main$59, mergeProps(_ctx.$attrs, {
|
|
2093
|
+
"model-value": unref(rootValue),
|
|
2094
|
+
open: unref(isOpen),
|
|
1929
2095
|
locale: props.locale,
|
|
1930
2096
|
"min-view": "month",
|
|
1931
2097
|
"max-view": "month",
|
|
@@ -1934,50 +2100,17 @@ const _sfc_main$29 = /*@__PURE__*/ defineComponent({
|
|
|
1934
2100
|
"close-on-select": props.closeOnSelect,
|
|
1935
2101
|
"read-only": props.readOnly,
|
|
1936
2102
|
disabled: props.disabled,
|
|
2103
|
+
invalid: props.invalid,
|
|
2104
|
+
placeholder: props.placeholder,
|
|
2105
|
+
class: props.class,
|
|
1937
2106
|
format: unref(formatIsoMonth),
|
|
1938
2107
|
parse: unref(parseIsoMonth),
|
|
1939
|
-
"onUpdate:modelValue": handleValueUpdate,
|
|
1940
|
-
"onUpdate:open":
|
|
1941
|
-
}, {
|
|
1942
|
-
default: withCtx(() => [
|
|
1943
|
-
createVNode(unref(DatePicker).Control, {
|
|
1944
|
-
class: normalizeClass(unref(cn)(unref(controlCls), props.class)),
|
|
1945
|
-
"data-invalid": props.invalid ? "" : void 0
|
|
1946
|
-
}, {
|
|
1947
|
-
default: withCtx(() => [
|
|
1948
|
-
createVNode(unref(DatePicker).Input, mergeProps(_ctx.$attrs, {
|
|
1949
|
-
placeholder: props.placeholder,
|
|
1950
|
-
"aria-invalid": props.invalid || void 0,
|
|
1951
|
-
class: "bg-transparent h-full w-full min-w-0 flex-1 px-3 text-sm tabular-nums outline-none",
|
|
1952
|
-
onClick: openFromInput,
|
|
1953
|
-
onKeydown: withKeys(withModifiers(openFromInput, ["prevent"]), ["down"])
|
|
1954
|
-
}), null, 16, [
|
|
1955
|
-
"placeholder",
|
|
1956
|
-
"aria-invalid",
|
|
1957
|
-
"onKeydown"
|
|
1958
|
-
]),
|
|
1959
|
-
createVNode(unref(DatePicker).ClearTrigger, { class: normalizeClass(unref(iconBtnCls)) }, {
|
|
1960
|
-
default: withCtx(() => [createVNode(ClearIcon_default$1)]),
|
|
1961
|
-
_: 1
|
|
1962
|
-
}, 8, ["class"]),
|
|
1963
|
-
createVNode(unref(DatePicker).Trigger, { class: normalizeClass(unref(iconBtnCls)) }, {
|
|
1964
|
-
default: withCtx(() => [createVNode(CalendarIcon_default)]),
|
|
1965
|
-
_: 1
|
|
1966
|
-
}, 8, ["class"])
|
|
1967
|
-
]),
|
|
1968
|
-
_: 1
|
|
1969
|
-
}, 8, ["class", "data-invalid"]),
|
|
1970
|
-
createCommentVNode(" 弹层 Teleport 到 body:脱离表单 DOM——隔离外层 FormControl 的 group class\n (group-hover 会污染面板内全部格子),并消除 overflow 容器裁剪弹层的隐患。 "),
|
|
1971
|
-
(openBlock(), createBlock(Teleport, { to: "body" }, [createVNode(unref(DatePicker).Positioner, { class: "z-50" }, {
|
|
1972
|
-
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")) }, {
|
|
1973
|
-
default: withCtx(() => [createVNode(unref(_sfc_main$6), { mode: "month" })]),
|
|
1974
|
-
_: 1
|
|
1975
|
-
}, 8, ["class"])]),
|
|
1976
|
-
_: 1
|
|
1977
|
-
})]))
|
|
1978
|
-
]),
|
|
2108
|
+
"onUpdate:modelValue": unref(handleValueUpdate),
|
|
2109
|
+
"onUpdate:open": unref(setOpen)
|
|
2110
|
+
}), {
|
|
2111
|
+
default: withCtx(() => [createVNode(unref(_sfc_main$6), { mode: "month" })]),
|
|
1979
2112
|
_: 1
|
|
1980
|
-
},
|
|
2113
|
+
}, 16, [
|
|
1981
2114
|
"model-value",
|
|
1982
2115
|
"open",
|
|
1983
2116
|
"locale",
|
|
@@ -1986,8 +2119,13 @@ const _sfc_main$29 = /*@__PURE__*/ defineComponent({
|
|
|
1986
2119
|
"close-on-select",
|
|
1987
2120
|
"read-only",
|
|
1988
2121
|
"disabled",
|
|
2122
|
+
"invalid",
|
|
2123
|
+
"placeholder",
|
|
2124
|
+
"class",
|
|
1989
2125
|
"format",
|
|
1990
|
-
"parse"
|
|
2126
|
+
"parse",
|
|
2127
|
+
"onUpdate:modelValue",
|
|
2128
|
+
"onUpdate:open"
|
|
1991
2129
|
]);
|
|
1992
2130
|
};
|
|
1993
2131
|
}
|
|
@@ -2109,8 +2247,8 @@ const _sfc_main$30 = /*@__PURE__*/ defineComponent({
|
|
|
2109
2247
|
});
|
|
2110
2248
|
//#endregion
|
|
2111
2249
|
//#region src/components/password-input/PasswordInput.vue
|
|
2112
|
-
const _hoisted_1$
|
|
2113
|
-
const _hoisted_2$
|
|
2250
|
+
const _hoisted_1$23 = ["data-invalid"];
|
|
2251
|
+
const _hoisted_2$16 = [
|
|
2114
2252
|
"type",
|
|
2115
2253
|
"value",
|
|
2116
2254
|
"autocomplete",
|
|
@@ -2118,7 +2256,7 @@ const _hoisted_2$15 = [
|
|
|
2118
2256
|
"disabled",
|
|
2119
2257
|
"aria-invalid"
|
|
2120
2258
|
];
|
|
2121
|
-
const _hoisted_3$
|
|
2259
|
+
const _hoisted_3$12 = [
|
|
2122
2260
|
"aria-label",
|
|
2123
2261
|
"aria-pressed",
|
|
2124
2262
|
"disabled"
|
|
@@ -2134,7 +2272,7 @@ const _hoisted_4$9 = {
|
|
|
2134
2272
|
class: "size-4",
|
|
2135
2273
|
"aria-hidden": "true"
|
|
2136
2274
|
};
|
|
2137
|
-
const _hoisted_5$
|
|
2275
|
+
const _hoisted_5$6 = {
|
|
2138
2276
|
key: 1,
|
|
2139
2277
|
viewBox: "0 0 24 24",
|
|
2140
2278
|
fill: "none",
|
|
@@ -2211,7 +2349,7 @@ const _sfc_main$31 = /*@__PURE__*/ defineComponent({
|
|
|
2211
2349
|
"aria-invalid": props.invalid || void 0,
|
|
2212
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",
|
|
2213
2351
|
onInput
|
|
2214
|
-
}), null, 16, _hoisted_2$
|
|
2352
|
+
}), null, 16, _hoisted_2$16), createElementVNode("button", {
|
|
2215
2353
|
type: "button",
|
|
2216
2354
|
"aria-label": isVisible.value ? "隐藏密码" : "显示密码",
|
|
2217
2355
|
"aria-pressed": isVisible.value ? "true" : "false",
|
|
@@ -2228,17 +2366,17 @@ const _sfc_main$31 = /*@__PURE__*/ defineComponent({
|
|
|
2228
2366
|
y1: "2",
|
|
2229
2367
|
y2: "22"
|
|
2230
2368
|
}, null, -1)
|
|
2231
|
-
])])) : (openBlock(), createElementBlock("svg", _hoisted_5$
|
|
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", {
|
|
2232
2370
|
cx: "12",
|
|
2233
2371
|
cy: "12",
|
|
2234
2372
|
r: "3"
|
|
2235
|
-
}, null, -1)])]))])], 8, _hoisted_3$
|
|
2373
|
+
}, null, -1)])]))])], 8, _hoisted_3$12)], 10, _hoisted_1$23);
|
|
2236
2374
|
};
|
|
2237
2375
|
}
|
|
2238
2376
|
});
|
|
2239
2377
|
//#endregion
|
|
2240
2378
|
//#region src/components/textarea/Textarea.vue
|
|
2241
|
-
const _hoisted_1$
|
|
2379
|
+
const _hoisted_1$22 = ["aria-invalid"];
|
|
2242
2380
|
const _sfc_main$45 = /*@__PURE__*/ defineComponent({
|
|
2243
2381
|
__name: "Textarea",
|
|
2244
2382
|
props: /*@__PURE__*/ mergeModels({
|
|
@@ -2257,7 +2395,7 @@ const _sfc_main$45 = /*@__PURE__*/ defineComponent({
|
|
|
2257
2395
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => modelValue.value = $event),
|
|
2258
2396
|
"aria-invalid": props.invalid ? "true" : void 0,
|
|
2259
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))
|
|
2260
|
-
}, null, 10, _hoisted_1$
|
|
2398
|
+
}, null, 10, _hoisted_1$22)), [[vModelText, modelValue.value]]);
|
|
2261
2399
|
};
|
|
2262
2400
|
}
|
|
2263
2401
|
});
|
|
@@ -2337,30 +2475,26 @@ const _sfc_main$49 = /*@__PURE__*/ defineComponent({
|
|
|
2337
2475
|
const props = __props;
|
|
2338
2476
|
const emit = __emit;
|
|
2339
2477
|
provide(CALENDAR_IN_PICKER, true);
|
|
2340
|
-
|
|
2341
|
-
const selected = computed(() => {
|
|
2342
|
-
return parseIsoDate((props.modelValue !== void 0 ? props.modelValue : internalValue.value) ?? "");
|
|
2343
|
-
});
|
|
2344
|
-
const rootValue = computed(() => selected.value ? [selected.value] : []);
|
|
2345
|
-
const internalOpen = ref(props.defaultOpen);
|
|
2346
|
-
const isOpen = computed(() => props.open ?? internalOpen.value);
|
|
2347
|
-
const minDate = computed(() => parseIsoDate(props.min ?? ""));
|
|
2348
|
-
const maxDate = computed(() => parseIsoDate(props.max ?? ""));
|
|
2349
|
-
/** "yyyy-MM-dd" → 归一到所在周起始日的 ISO 串(非法输入原样返回 undefined) */
|
|
2478
|
+
/** "yyyy-MM-dd" → 归一到所在周起始日的 ISO 串(非法输入返回 undefined) */
|
|
2350
2479
|
function formatIsoWeekStart(raw) {
|
|
2351
2480
|
const date = parseIsoDate(raw);
|
|
2352
2481
|
return date ? weekStartOf(date, props.locale).toString() : void 0;
|
|
2353
2482
|
}
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
|
|
2360
|
-
|
|
2361
|
-
|
|
2362
|
-
|
|
2363
|
-
|
|
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 ?? ""));
|
|
2364
2498
|
function formatDate(date) {
|
|
2365
2499
|
return formatIsoWeek(date, props.locale);
|
|
2366
2500
|
}
|
|
@@ -2368,14 +2502,10 @@ const _sfc_main$49 = /*@__PURE__*/ defineComponent({
|
|
|
2368
2502
|
const date = parseIsoDate(raw);
|
|
2369
2503
|
return date ? weekStartOf(date, props.locale) : void 0;
|
|
2370
2504
|
}
|
|
2371
|
-
function openFromInput() {
|
|
2372
|
-
if (props.disabled || props.readOnly || isOpen.value) return;
|
|
2373
|
-
handleOpenUpdate(true);
|
|
2374
|
-
}
|
|
2375
2505
|
return (_ctx, _cache) => {
|
|
2376
|
-
return openBlock(), createBlock(
|
|
2377
|
-
"model-value": rootValue
|
|
2378
|
-
open: isOpen
|
|
2506
|
+
return openBlock(), createBlock(_sfc_main$59, mergeProps(_ctx.$attrs, {
|
|
2507
|
+
"model-value": unref(rootValue),
|
|
2508
|
+
open: unref(isOpen),
|
|
2379
2509
|
locale: props.locale,
|
|
2380
2510
|
min: minDate.value,
|
|
2381
2511
|
max: maxDate.value,
|
|
@@ -2383,53 +2513,20 @@ const _sfc_main$49 = /*@__PURE__*/ defineComponent({
|
|
|
2383
2513
|
"close-on-select": props.closeOnSelect,
|
|
2384
2514
|
"read-only": props.readOnly,
|
|
2385
2515
|
disabled: props.disabled,
|
|
2516
|
+
invalid: props.invalid,
|
|
2517
|
+
placeholder: props.placeholder,
|
|
2518
|
+
class: props.class,
|
|
2386
2519
|
format: formatDate,
|
|
2387
2520
|
parse: parseDate,
|
|
2388
|
-
"onUpdate:modelValue": handleValueUpdate,
|
|
2389
|
-
"onUpdate:open":
|
|
2390
|
-
}, {
|
|
2391
|
-
default: withCtx(() => [
|
|
2392
|
-
|
|
2393
|
-
|
|
2394
|
-
|
|
2395
|
-
}, {
|
|
2396
|
-
default: withCtx(() => [
|
|
2397
|
-
createVNode(unref(DatePicker).Input, mergeProps(_ctx.$attrs, {
|
|
2398
|
-
placeholder: props.placeholder,
|
|
2399
|
-
"aria-invalid": props.invalid || void 0,
|
|
2400
|
-
class: "bg-transparent h-full w-full min-w-0 flex-1 px-3 text-sm tabular-nums outline-none",
|
|
2401
|
-
onClick: openFromInput,
|
|
2402
|
-
onKeydown: withKeys(withModifiers(openFromInput, ["prevent"]), ["down"])
|
|
2403
|
-
}), null, 16, [
|
|
2404
|
-
"placeholder",
|
|
2405
|
-
"aria-invalid",
|
|
2406
|
-
"onKeydown"
|
|
2407
|
-
]),
|
|
2408
|
-
createVNode(unref(DatePicker).ClearTrigger, { class: normalizeClass(unref(iconBtnCls)) }, {
|
|
2409
|
-
default: withCtx(() => [createVNode(ClearIcon_default$1)]),
|
|
2410
|
-
_: 1
|
|
2411
|
-
}, 8, ["class"]),
|
|
2412
|
-
createVNode(unref(DatePicker).Trigger, { class: normalizeClass(unref(iconBtnCls)) }, {
|
|
2413
|
-
default: withCtx(() => [createVNode(CalendarIcon_default)]),
|
|
2414
|
-
_: 1
|
|
2415
|
-
}, 8, ["class"])
|
|
2416
|
-
]),
|
|
2417
|
-
_: 1
|
|
2418
|
-
}, 8, ["class", "data-invalid"]),
|
|
2419
|
-
createCommentVNode(" 弹层 Teleport 到 body:脱离表单 DOM——隔离外层 FormControl 的 group class\n (group-hover 会污染面板内全部格子),并消除 overflow 容器裁剪弹层的隐患。 "),
|
|
2420
|
-
(openBlock(), createBlock(Teleport, { to: "body" }, [createVNode(unref(DatePicker).Positioner, { class: "z-50" }, {
|
|
2421
|
-
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")) }, {
|
|
2422
|
-
default: withCtx(() => [createVNode(unref(_sfc_main$6), {
|
|
2423
|
-
week: "",
|
|
2424
|
-
locale: props.locale
|
|
2425
|
-
}, null, 8, ["locale"])]),
|
|
2426
|
-
_: 1
|
|
2427
|
-
}, 8, ["class"])]),
|
|
2428
|
-
_: 1
|
|
2429
|
-
})]))
|
|
2430
|
-
]),
|
|
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"])]),
|
|
2431
2528
|
_: 1
|
|
2432
|
-
},
|
|
2529
|
+
}, 16, [
|
|
2433
2530
|
"model-value",
|
|
2434
2531
|
"open",
|
|
2435
2532
|
"locale",
|
|
@@ -2438,7 +2535,12 @@ const _sfc_main$49 = /*@__PURE__*/ defineComponent({
|
|
|
2438
2535
|
"is-date-unavailable",
|
|
2439
2536
|
"close-on-select",
|
|
2440
2537
|
"read-only",
|
|
2441
|
-
"disabled"
|
|
2538
|
+
"disabled",
|
|
2539
|
+
"invalid",
|
|
2540
|
+
"placeholder",
|
|
2541
|
+
"class",
|
|
2542
|
+
"onUpdate:modelValue",
|
|
2543
|
+
"onUpdate:open"
|
|
2442
2544
|
]);
|
|
2443
2545
|
};
|
|
2444
2546
|
}
|
|
@@ -2514,32 +2616,24 @@ const _sfc_main$50 = /*@__PURE__*/ defineComponent({
|
|
|
2514
2616
|
const props = __props;
|
|
2515
2617
|
const emit = __emit;
|
|
2516
2618
|
provide(CALENDAR_IN_PICKER, true);
|
|
2517
|
-
const
|
|
2518
|
-
|
|
2519
|
-
|
|
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)
|
|
2520
2630
|
});
|
|
2521
|
-
const rootValue = computed(() => selected.value ? [selected.value] : []);
|
|
2522
|
-
const internalOpen = ref(props.defaultOpen);
|
|
2523
|
-
const isOpen = computed(() => props.open ?? internalOpen.value);
|
|
2524
2631
|
const minDate = computed(() => parseIsoYear(props.min ?? ""));
|
|
2525
2632
|
const maxDate = computed(() => parseIsoYear(props.max ?? ""));
|
|
2526
|
-
function handleValueUpdate(next) {
|
|
2527
|
-
const value = next[0] ? formatIsoYear(next[0]) : null;
|
|
2528
|
-
internalValue.value = value;
|
|
2529
|
-
emit("update:modelValue", value);
|
|
2530
|
-
}
|
|
2531
|
-
function handleOpenUpdate(next) {
|
|
2532
|
-
internalOpen.value = next;
|
|
2533
|
-
emit("update:open", next);
|
|
2534
|
-
}
|
|
2535
|
-
function openFromInput() {
|
|
2536
|
-
if (props.disabled || props.readOnly || isOpen.value) return;
|
|
2537
|
-
handleOpenUpdate(true);
|
|
2538
|
-
}
|
|
2539
2633
|
return (_ctx, _cache) => {
|
|
2540
|
-
return openBlock(), createBlock(
|
|
2541
|
-
"model-value": rootValue
|
|
2542
|
-
open: isOpen
|
|
2634
|
+
return openBlock(), createBlock(_sfc_main$59, mergeProps(_ctx.$attrs, {
|
|
2635
|
+
"model-value": unref(rootValue),
|
|
2636
|
+
open: unref(isOpen),
|
|
2543
2637
|
locale: props.locale,
|
|
2544
2638
|
"min-view": "year",
|
|
2545
2639
|
"max-view": "year",
|
|
@@ -2548,50 +2642,17 @@ const _sfc_main$50 = /*@__PURE__*/ defineComponent({
|
|
|
2548
2642
|
"close-on-select": props.closeOnSelect,
|
|
2549
2643
|
"read-only": props.readOnly,
|
|
2550
2644
|
disabled: props.disabled,
|
|
2645
|
+
invalid: props.invalid,
|
|
2646
|
+
placeholder: props.placeholder,
|
|
2647
|
+
class: props.class,
|
|
2551
2648
|
format: unref(formatIsoYear),
|
|
2552
2649
|
parse: unref(parseIsoYear),
|
|
2553
|
-
"onUpdate:modelValue": handleValueUpdate,
|
|
2554
|
-
"onUpdate:open":
|
|
2555
|
-
}, {
|
|
2556
|
-
default: withCtx(() => [
|
|
2557
|
-
createVNode(unref(DatePicker).Control, {
|
|
2558
|
-
class: normalizeClass(unref(cn)(unref(controlCls), props.class)),
|
|
2559
|
-
"data-invalid": props.invalid ? "" : void 0
|
|
2560
|
-
}, {
|
|
2561
|
-
default: withCtx(() => [
|
|
2562
|
-
createVNode(unref(DatePicker).Input, mergeProps(_ctx.$attrs, {
|
|
2563
|
-
placeholder: props.placeholder,
|
|
2564
|
-
"aria-invalid": props.invalid || void 0,
|
|
2565
|
-
class: "bg-transparent h-full w-full min-w-0 flex-1 px-3 text-sm tabular-nums outline-none",
|
|
2566
|
-
onClick: openFromInput,
|
|
2567
|
-
onKeydown: withKeys(withModifiers(openFromInput, ["prevent"]), ["down"])
|
|
2568
|
-
}), null, 16, [
|
|
2569
|
-
"placeholder",
|
|
2570
|
-
"aria-invalid",
|
|
2571
|
-
"onKeydown"
|
|
2572
|
-
]),
|
|
2573
|
-
createVNode(unref(DatePicker).ClearTrigger, { class: normalizeClass(unref(iconBtnCls)) }, {
|
|
2574
|
-
default: withCtx(() => [createVNode(ClearIcon_default$1)]),
|
|
2575
|
-
_: 1
|
|
2576
|
-
}, 8, ["class"]),
|
|
2577
|
-
createVNode(unref(DatePicker).Trigger, { class: normalizeClass(unref(iconBtnCls)) }, {
|
|
2578
|
-
default: withCtx(() => [createVNode(CalendarIcon_default)]),
|
|
2579
|
-
_: 1
|
|
2580
|
-
}, 8, ["class"])
|
|
2581
|
-
]),
|
|
2582
|
-
_: 1
|
|
2583
|
-
}, 8, ["class", "data-invalid"]),
|
|
2584
|
-
createCommentVNode(" 弹层 Teleport 到 body:脱离表单 DOM——隔离外层 FormControl 的 group class\n (group-hover 会污染面板内全部格子),并消除 overflow 容器裁剪弹层的隐患。 "),
|
|
2585
|
-
(openBlock(), createBlock(Teleport, { to: "body" }, [createVNode(unref(DatePicker).Positioner, { class: "z-50" }, {
|
|
2586
|
-
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")) }, {
|
|
2587
|
-
default: withCtx(() => [createVNode(unref(_sfc_main$6), { mode: "year" })]),
|
|
2588
|
-
_: 1
|
|
2589
|
-
}, 8, ["class"])]),
|
|
2590
|
-
_: 1
|
|
2591
|
-
})]))
|
|
2592
|
-
]),
|
|
2650
|
+
"onUpdate:modelValue": unref(handleValueUpdate),
|
|
2651
|
+
"onUpdate:open": unref(setOpen)
|
|
2652
|
+
}), {
|
|
2653
|
+
default: withCtx(() => [createVNode(unref(_sfc_main$6), { mode: "year" })]),
|
|
2593
2654
|
_: 1
|
|
2594
|
-
},
|
|
2655
|
+
}, 16, [
|
|
2595
2656
|
"model-value",
|
|
2596
2657
|
"open",
|
|
2597
2658
|
"locale",
|
|
@@ -2600,8 +2661,13 @@ const _sfc_main$50 = /*@__PURE__*/ defineComponent({
|
|
|
2600
2661
|
"close-on-select",
|
|
2601
2662
|
"read-only",
|
|
2602
2663
|
"disabled",
|
|
2664
|
+
"invalid",
|
|
2665
|
+
"placeholder",
|
|
2666
|
+
"class",
|
|
2603
2667
|
"format",
|
|
2604
|
-
"parse"
|
|
2668
|
+
"parse",
|
|
2669
|
+
"onUpdate:modelValue",
|
|
2670
|
+
"onUpdate:open"
|
|
2605
2671
|
]);
|
|
2606
2672
|
};
|
|
2607
2673
|
}
|
|
@@ -2678,7 +2744,7 @@ function renderWeekPickerItem(options = {}) {
|
|
|
2678
2744
|
}
|
|
2679
2745
|
//#endregion
|
|
2680
2746
|
//#region src/components/input/Input.vue
|
|
2681
|
-
const _hoisted_1$
|
|
2747
|
+
const _hoisted_1$21 = ["aria-invalid"];
|
|
2682
2748
|
const _sfc_main$27 = /*@__PURE__*/ defineComponent({
|
|
2683
2749
|
__name: "Input",
|
|
2684
2750
|
props: /*@__PURE__*/ mergeModels({
|
|
@@ -2697,7 +2763,7 @@ const _sfc_main$27 = /*@__PURE__*/ defineComponent({
|
|
|
2697
2763
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => modelValue.value = $event),
|
|
2698
2764
|
"aria-invalid": props.invalid ? "true" : void 0,
|
|
2699
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))
|
|
2700
|
-
}, null, 10, _hoisted_1$
|
|
2766
|
+
}, null, 10, _hoisted_1$21)), [[vModelText, modelValue.value]]);
|
|
2701
2767
|
};
|
|
2702
2768
|
}
|
|
2703
2769
|
});
|
|
@@ -2784,19 +2850,18 @@ const _sfc_main$37 = /*@__PURE__*/ defineComponent({
|
|
|
2784
2850
|
internalValue.value = value;
|
|
2785
2851
|
emit("update:modelValue", value);
|
|
2786
2852
|
}
|
|
2787
|
-
const
|
|
2788
|
-
|
|
2789
|
-
|
|
2790
|
-
|
|
2791
|
-
|
|
2792
|
-
}
|
|
2853
|
+
const { isOpen, setOpen } = useControlledBoolean({
|
|
2854
|
+
controlled: () => props.open,
|
|
2855
|
+
defaultValue: () => props.defaultOpen,
|
|
2856
|
+
onChange: (open) => emit("update:open", open)
|
|
2857
|
+
});
|
|
2793
2858
|
return (_ctx, _cache) => {
|
|
2794
2859
|
return openBlock(), createBlock(unref(Select).Root, {
|
|
2795
2860
|
collection: collection.value,
|
|
2796
2861
|
"model-value": toArray(modelValue.value),
|
|
2797
|
-
open: isOpen
|
|
2862
|
+
open: unref(isOpen),
|
|
2798
2863
|
"onUpdate:modelValue": handleModelUpdate,
|
|
2799
|
-
"onUpdate:open":
|
|
2864
|
+
"onUpdate:open": unref(setOpen)
|
|
2800
2865
|
}, {
|
|
2801
2866
|
default: withCtx(() => [
|
|
2802
2867
|
createCommentVNode(" 触发器(收编自 SelectTrigger:内置选中回显与 chevron) "),
|
|
@@ -2819,8 +2884,8 @@ const _sfc_main$37 = /*@__PURE__*/ defineComponent({
|
|
|
2819
2884
|
}, 8, ["class"])]),
|
|
2820
2885
|
_: 1
|
|
2821
2886
|
}),
|
|
2822
|
-
createVNode(unref(Select).Positioner, { class: "z-
|
|
2823
|
-
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-
|
|
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)) }, {
|
|
2824
2889
|
default: withCtx(() => [(openBlock(true), createElementBlock(Fragment, null, renderList(normalizedItems.value, (entry) => {
|
|
2825
2890
|
return openBlock(), createBlock(unref(Select).Item, {
|
|
2826
2891
|
key: entry.item.value,
|
|
@@ -2858,7 +2923,8 @@ const _sfc_main$37 = /*@__PURE__*/ defineComponent({
|
|
|
2858
2923
|
}, 8, [
|
|
2859
2924
|
"collection",
|
|
2860
2925
|
"model-value",
|
|
2861
|
-
"open"
|
|
2926
|
+
"open",
|
|
2927
|
+
"onUpdate:open"
|
|
2862
2928
|
]);
|
|
2863
2929
|
};
|
|
2864
2930
|
}
|
|
@@ -3051,8 +3117,8 @@ function renderSliderItem(options = {}) {
|
|
|
3051
3117
|
}
|
|
3052
3118
|
//#endregion
|
|
3053
3119
|
//#region src/components/tree-shared/ChevronIcon.vue
|
|
3054
|
-
const _sfc_main$
|
|
3055
|
-
const _hoisted_1$
|
|
3120
|
+
const _sfc_main$58 = {};
|
|
3121
|
+
const _hoisted_1$20 = {
|
|
3056
3122
|
viewBox: "0 0 24 24",
|
|
3057
3123
|
fill: "none",
|
|
3058
3124
|
stroke: "currentColor",
|
|
@@ -3063,13 +3129,13 @@ const _hoisted_1$19 = {
|
|
|
3063
3129
|
class: "size-4 shrink-0 transition-transform"
|
|
3064
3130
|
};
|
|
3065
3131
|
function _sfc_render$1(_ctx, _cache) {
|
|
3066
|
-
return openBlock(), createElementBlock("svg", _hoisted_1$
|
|
3132
|
+
return openBlock(), createElementBlock("svg", _hoisted_1$20, [..._cache[0] || (_cache[0] = [createElementVNode("path", { d: "m9 18 6-6-6-6" }, null, -1)])]);
|
|
3067
3133
|
}
|
|
3068
|
-
var ChevronIcon_default = /*#__PURE__*/ export_helper_default(_sfc_main$
|
|
3134
|
+
var ChevronIcon_default = /*#__PURE__*/ export_helper_default(_sfc_main$58, [["render", _sfc_render$1]]);
|
|
3069
3135
|
//#endregion
|
|
3070
3136
|
//#region src/components/tree-shared/ClearIcon.vue
|
|
3071
|
-
const _sfc_main$
|
|
3072
|
-
const _hoisted_1$
|
|
3137
|
+
const _sfc_main$57 = {};
|
|
3138
|
+
const _hoisted_1$19 = {
|
|
3073
3139
|
viewBox: "0 0 24 24",
|
|
3074
3140
|
fill: "none",
|
|
3075
3141
|
stroke: "currentColor",
|
|
@@ -3079,21 +3145,20 @@ const _hoisted_1$18 = {
|
|
|
3079
3145
|
class: "size-4 shrink-0"
|
|
3080
3146
|
};
|
|
3081
3147
|
function _sfc_render(_ctx, _cache) {
|
|
3082
|
-
return openBlock(), createElementBlock("svg", _hoisted_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)])]);
|
|
3083
3149
|
}
|
|
3084
|
-
var ClearIcon_default = /*#__PURE__*/ export_helper_default(_sfc_main$
|
|
3150
|
+
var ClearIcon_default = /*#__PURE__*/ export_helper_default(_sfc_main$57, [["render", _sfc_render]]);
|
|
3085
3151
|
//#endregion
|
|
3086
3152
|
//#region src/components/tree-shared/ValueTags.vue
|
|
3087
|
-
const _hoisted_1$
|
|
3088
|
-
const _hoisted_2$
|
|
3089
|
-
const _hoisted_3$
|
|
3090
|
-
const _hoisted_4$8 =
|
|
3091
|
-
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 = {
|
|
3092
3157
|
key: 0,
|
|
3093
3158
|
"data-part": "tag-overflow",
|
|
3094
3159
|
class: "text-xs text-muted-foreground"
|
|
3095
3160
|
};
|
|
3096
|
-
const _sfc_main$
|
|
3161
|
+
const _sfc_main$56 = /*@__PURE__*/ defineComponent({
|
|
3097
3162
|
__name: "ValueTags",
|
|
3098
3163
|
props: {
|
|
3099
3164
|
/** 展示的选中值(key + label) */
|
|
@@ -3123,14 +3188,14 @@ const _sfc_main$55 = /*@__PURE__*/ defineComponent({
|
|
|
3123
3188
|
const shown = computed(() => props.maxTagCount === void 0 ? props.values : props.values.slice(0, props.maxTagCount));
|
|
3124
3189
|
const overflow = computed(() => props.maxTagCount === void 0 ? 0 : Math.max(0, props.values.length - props.maxTagCount));
|
|
3125
3190
|
return (_ctx, _cache) => {
|
|
3126
|
-
return openBlock(), createElementBlock("span",
|
|
3191
|
+
return openBlock(), createElementBlock("span", { class: normalizeClass(unref(cn)("flex min-w-0 flex-1 flex-wrap items-center gap-1", _ctx.$attrs.class)) }, [
|
|
3127
3192
|
(openBlock(true), createElementBlock(Fragment, null, renderList(shown.value, (v) => {
|
|
3128
3193
|
return openBlock(), createElementBlock("span", {
|
|
3129
3194
|
key: v.key,
|
|
3130
3195
|
"data-part": "tag",
|
|
3131
3196
|
"data-key": v.key,
|
|
3132
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"
|
|
3133
|
-
}, [createElementVNode("span",
|
|
3198
|
+
}, [createElementVNode("span", _hoisted_2$15, toDisplayString(v.label), 1), !__props.disabled ? (openBlock(), createElementBlock("button", {
|
|
3134
3199
|
key: 0,
|
|
3135
3200
|
type: "button",
|
|
3136
3201
|
"data-part": "tag-remove",
|
|
@@ -3145,9 +3210,9 @@ const _sfc_main$55 = /*@__PURE__*/ defineComponent({
|
|
|
3145
3210
|
"stroke-linecap": "round",
|
|
3146
3211
|
class: "size-3",
|
|
3147
3212
|
"aria-hidden": "true"
|
|
3148
|
-
}, [createElementVNode("path", { d: "M18 6 6 18" }), createElementVNode("path", { d: "m6 6 12 12" })], -1)])], 8,
|
|
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);
|
|
3149
3214
|
}), 128)),
|
|
3150
|
-
overflow.value > 0 ? (openBlock(), createElementBlock("span",
|
|
3215
|
+
overflow.value > 0 ? (openBlock(), createElementBlock("span", _hoisted_4$8, "+" + toDisplayString(overflow.value), 1)) : createCommentVNode("v-if", true),
|
|
3151
3216
|
__props.clearable && !__props.disabled ? (openBlock(), createElementBlock("button", {
|
|
3152
3217
|
key: 1,
|
|
3153
3218
|
type: "button",
|
|
@@ -3164,7 +3229,7 @@ const _sfc_main$55 = /*@__PURE__*/ defineComponent({
|
|
|
3164
3229
|
class: "size-4",
|
|
3165
3230
|
"aria-hidden": "true"
|
|
3166
3231
|
}, [createElementVNode("path", { d: "M18 6 6 18" }), createElementVNode("path", { d: "m6 6 12 12" })], -1)])])) : createCommentVNode("v-if", true)
|
|
3167
|
-
]);
|
|
3232
|
+
], 2);
|
|
3168
3233
|
};
|
|
3169
3234
|
}
|
|
3170
3235
|
});
|
|
@@ -3173,7 +3238,7 @@ const _sfc_main$55 = /*@__PURE__*/ defineComponent({
|
|
|
3173
3238
|
/*!
|
|
3174
3239
|
* 移植自 treemate v0.3.11 —— https://github.com/07akioni/treemate
|
|
3175
3240
|
* MIT License · Copyright (c) 07akioni
|
|
3176
|
-
*
|
|
3241
|
+
* 本地改动:defaultGetChildren 返回类型同步 GetChildren 塌缩为 `unknown`(语义不变)。
|
|
3177
3242
|
*/
|
|
3178
3243
|
function toArray(arg) {
|
|
3179
3244
|
if (Array.isArray(arg)) return arg;
|
|
@@ -3754,12 +3819,8 @@ function nextActiveKey(flattened, activeKey, key, options) {
|
|
|
3754
3819
|
}
|
|
3755
3820
|
//#endregion
|
|
3756
3821
|
//#region src/components/cascader/CascaderPanel.vue
|
|
3757
|
-
const _hoisted_1$
|
|
3758
|
-
|
|
3759
|
-
class: "flex overflow-x-auto"
|
|
3760
|
-
};
|
|
3761
|
-
const _hoisted_2$13 = ["aria-label"];
|
|
3762
|
-
const _hoisted_3$9 = [
|
|
3822
|
+
const _hoisted_1$17 = ["aria-label"];
|
|
3823
|
+
const _hoisted_2$14 = [
|
|
3763
3824
|
"data-key",
|
|
3764
3825
|
"aria-selected",
|
|
3765
3826
|
"aria-checked",
|
|
@@ -3772,8 +3833,8 @@ const _hoisted_3$9 = [
|
|
|
3772
3833
|
"onClick",
|
|
3773
3834
|
"onPointerenter"
|
|
3774
3835
|
];
|
|
3775
|
-
const
|
|
3776
|
-
const
|
|
3836
|
+
const _hoisted_3$10 = ["onClick"];
|
|
3837
|
+
const _hoisted_4$7 = {
|
|
3777
3838
|
key: 0,
|
|
3778
3839
|
viewBox: "0 0 24 24",
|
|
3779
3840
|
fill: "none",
|
|
@@ -3781,7 +3842,7 @@ const _hoisted_5$5 = {
|
|
|
3781
3842
|
"stroke-width": "3",
|
|
3782
3843
|
class: "size-3"
|
|
3783
3844
|
};
|
|
3784
|
-
const
|
|
3845
|
+
const _hoisted_5$5 = {
|
|
3785
3846
|
key: 1,
|
|
3786
3847
|
viewBox: "0 0 24 24",
|
|
3787
3848
|
fill: "none",
|
|
@@ -3789,12 +3850,12 @@ const _hoisted_6$4 = {
|
|
|
3789
3850
|
"stroke-width": "3",
|
|
3790
3851
|
class: "size-3"
|
|
3791
3852
|
};
|
|
3792
|
-
const
|
|
3793
|
-
const
|
|
3853
|
+
const _hoisted_6$4 = { class: "flex-1 truncate" };
|
|
3854
|
+
const _hoisted_7$4 = {
|
|
3794
3855
|
key: 0,
|
|
3795
3856
|
class: "px-3 py-1.5 text-sm text-muted-foreground"
|
|
3796
3857
|
};
|
|
3797
|
-
const _sfc_main$
|
|
3858
|
+
const _sfc_main$55 = /*@__PURE__*/ defineComponent({
|
|
3798
3859
|
__name: "CascaderPanel",
|
|
3799
3860
|
props: {
|
|
3800
3861
|
/** 列数据:columns[0] 为根层,后续每列为展开路径的子层 */
|
|
@@ -3847,6 +3908,9 @@ const _sfc_main$54 = /*@__PURE__*/ defineComponent({
|
|
|
3847
3908
|
function labelOf(node) {
|
|
3848
3909
|
return node.rawNode.label ?? String(node.key);
|
|
3849
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));
|
|
3850
3914
|
function rowClick(node) {
|
|
3851
3915
|
if (node.disabled) return;
|
|
3852
3916
|
emit("select", node);
|
|
@@ -3858,7 +3922,10 @@ const _sfc_main$54 = /*@__PURE__*/ defineComponent({
|
|
|
3858
3922
|
if (!node.disabled) emit("check", node);
|
|
3859
3923
|
}
|
|
3860
3924
|
return (_ctx, _cache) => {
|
|
3861
|
-
return openBlock(), createElementBlock("div",
|
|
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) => {
|
|
3862
3929
|
return openBlock(), createElementBlock("div", {
|
|
3863
3930
|
key: ci,
|
|
3864
3931
|
role: "listbox",
|
|
@@ -3871,13 +3938,13 @@ const _sfc_main$54 = /*@__PURE__*/ defineComponent({
|
|
|
3871
3938
|
"data-part": "tree-node",
|
|
3872
3939
|
"data-key": node.key,
|
|
3873
3940
|
role: "option",
|
|
3874
|
-
"aria-selected":
|
|
3875
|
-
"aria-checked": props.checkable ?
|
|
3941
|
+
"aria-selected": selectedSet.value.has(node.key),
|
|
3942
|
+
"aria-checked": props.checkable ? checkedSet.value.has(node.key) : void 0,
|
|
3876
3943
|
"aria-expanded": node.children?.length ? props.isExpanded(node) : void 0,
|
|
3877
3944
|
"aria-disabled": node.disabled || void 0,
|
|
3878
|
-
"data-selected":
|
|
3879
|
-
"data-checked":
|
|
3880
|
-
"data-indeterminate":
|
|
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,
|
|
3881
3948
|
"data-active": props.activeKey === node.key || void 0,
|
|
3882
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",
|
|
3883
3950
|
onClick: ($event) => rowClick(node),
|
|
@@ -3886,28 +3953,28 @@ const _sfc_main$54 = /*@__PURE__*/ defineComponent({
|
|
|
3886
3953
|
props.checkable ? (openBlock(), createElementBlock("span", {
|
|
3887
3954
|
key: 0,
|
|
3888
3955
|
"data-part": "checkbox",
|
|
3889
|
-
class: normalizeClass(["flex size-4 shrink-0 items-center justify-center rounded-sm border",
|
|
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"]),
|
|
3890
3957
|
onClick: withModifiers(($event) => toggleCheck(node), ["stop"])
|
|
3891
|
-
}, [
|
|
3892
|
-
createElementVNode("span",
|
|
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),
|
|
3893
3960
|
node.children?.length ? (openBlock(), createBlock(ChevronIcon_default, {
|
|
3894
3961
|
key: 1,
|
|
3895
3962
|
class: normalizeClass(unref(cn)("size-3.5 shrink-0 text-muted-foreground", props.isExpanded(node) && "rotate-90"))
|
|
3896
3963
|
}, null, 8, ["class"])) : createCommentVNode("v-if", true)
|
|
3897
|
-
], 40,
|
|
3898
|
-
}), 128)), !column.length ? (openBlock(), createElementBlock("div",
|
|
3899
|
-
}), 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);
|
|
3900
3967
|
};
|
|
3901
3968
|
}
|
|
3902
3969
|
});
|
|
3903
3970
|
//#endregion
|
|
3904
3971
|
//#region src/components/cascader/Cascader.vue
|
|
3905
|
-
const _hoisted_1$
|
|
3906
|
-
const _hoisted_2$
|
|
3972
|
+
const _hoisted_1$16 = ["aria-expanded", "aria-disabled"];
|
|
3973
|
+
const _hoisted_2$13 = {
|
|
3907
3974
|
key: 1,
|
|
3908
3975
|
class: "truncate text-muted-foreground"
|
|
3909
3976
|
};
|
|
3910
|
-
const _hoisted_3$
|
|
3977
|
+
const _hoisted_3$9 = {
|
|
3911
3978
|
key: 0,
|
|
3912
3979
|
class: "truncate"
|
|
3913
3980
|
};
|
|
@@ -4009,10 +4076,15 @@ const _sfc_main$8 = /*@__PURE__*/ defineComponent({
|
|
|
4009
4076
|
default: void 0
|
|
4010
4077
|
}
|
|
4011
4078
|
},
|
|
4012
|
-
emits: [
|
|
4079
|
+
emits: [
|
|
4080
|
+
"update:modelValue",
|
|
4081
|
+
"update:show",
|
|
4082
|
+
"update:open"
|
|
4083
|
+
],
|
|
4013
4084
|
setup(__props, { emit: __emit }) {
|
|
4014
4085
|
const props = __props;
|
|
4015
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)。");
|
|
4016
4088
|
const toArrayValue = (v) => Array.isArray(v) ? v : v === void 0 || v === null ? [] : [v];
|
|
4017
4089
|
const treeMate = computed(() => createTreeMate(props.options, { ignoreEmptyChildren: true }));
|
|
4018
4090
|
const isMulti = computed(() => props.multiple || props.checkable);
|
|
@@ -4042,16 +4114,18 @@ const _sfc_main$8 = /*@__PURE__*/ defineComponent({
|
|
|
4042
4114
|
internalValue.value = merged.checkedKeys;
|
|
4043
4115
|
emit("update:modelValue", merged.checkedKeys);
|
|
4044
4116
|
});
|
|
4045
|
-
const
|
|
4046
|
-
|
|
4047
|
-
|
|
4048
|
-
|
|
4049
|
-
|
|
4050
|
-
|
|
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
|
+
});
|
|
4051
4125
|
function openFromInput() {
|
|
4052
4126
|
if (props.disabled || isOpen.value) return;
|
|
4053
4127
|
syncPanelWidth();
|
|
4054
|
-
|
|
4128
|
+
setOpen(true);
|
|
4055
4129
|
}
|
|
4056
4130
|
const triggerEl = ref(null);
|
|
4057
4131
|
const panelMinWidth = ref("0px");
|
|
@@ -4066,6 +4140,13 @@ const _sfc_main$8 = /*@__PURE__*/ defineComponent({
|
|
|
4066
4140
|
commitValue(isMulti.value ? [] : void 0);
|
|
4067
4141
|
}
|
|
4068
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
|
+
}
|
|
4069
4150
|
commitValue(selectedKeys.value.filter((k) => k !== key));
|
|
4070
4151
|
}
|
|
4071
4152
|
const expandedPath = ref([]);
|
|
@@ -4080,8 +4161,9 @@ const _sfc_main$8 = /*@__PURE__*/ defineComponent({
|
|
|
4080
4161
|
}
|
|
4081
4162
|
return result;
|
|
4082
4163
|
});
|
|
4164
|
+
const expandedPathSet = computed(() => new Set(expandedPath.value));
|
|
4083
4165
|
function isExpanded(node) {
|
|
4084
|
-
return
|
|
4166
|
+
return expandedPathSet.value.has(node.key);
|
|
4085
4167
|
}
|
|
4086
4168
|
function handleExpand(node) {
|
|
4087
4169
|
expandedPath.value = treeMate.value.getPath(node.key).keyPath;
|
|
@@ -4109,7 +4191,7 @@ const _sfc_main$8 = /*@__PURE__*/ defineComponent({
|
|
|
4109
4191
|
return;
|
|
4110
4192
|
}
|
|
4111
4193
|
commitValue(node.key);
|
|
4112
|
-
|
|
4194
|
+
setOpen(false);
|
|
4113
4195
|
}
|
|
4114
4196
|
function labelOf(node) {
|
|
4115
4197
|
return node.rawNode.label ?? String(node.key);
|
|
@@ -4194,8 +4276,8 @@ const _sfc_main$8 = /*@__PURE__*/ defineComponent({
|
|
|
4194
4276
|
});
|
|
4195
4277
|
return (_ctx, _cache) => {
|
|
4196
4278
|
return openBlock(), createBlock(unref(Popover).Root, {
|
|
4197
|
-
open: isOpen
|
|
4198
|
-
"onUpdate:open":
|
|
4279
|
+
open: unref(isOpen),
|
|
4280
|
+
"onUpdate:open": unref(setOpen)
|
|
4199
4281
|
}, {
|
|
4200
4282
|
default: withCtx(() => [createVNode(unref(Popover).Anchor, { "as-child": "" }, {
|
|
4201
4283
|
default: withCtx(() => [createElementVNode("div", mergeProps({
|
|
@@ -4205,13 +4287,13 @@ const _sfc_main$8 = /*@__PURE__*/ defineComponent({
|
|
|
4205
4287
|
"data-part": "trigger",
|
|
4206
4288
|
role: "button",
|
|
4207
4289
|
tabindex: "0",
|
|
4208
|
-
"aria-expanded": isOpen
|
|
4290
|
+
"aria-expanded": unref(isOpen),
|
|
4209
4291
|
"aria-haspopup": "true",
|
|
4210
4292
|
"aria-disabled": props.disabled || void 0,
|
|
4211
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),
|
|
4212
4294
|
onClick: openFromInput,
|
|
4213
4295
|
onKeydown: handleKeydown
|
|
4214
|
-
}), [isMulti.value ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [tags.value.length ? (openBlock(), createBlock(_sfc_main$
|
|
4296
|
+
}), [isMulti.value ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [tags.value.length ? (openBlock(), createBlock(_sfc_main$56, {
|
|
4215
4297
|
key: 0,
|
|
4216
4298
|
values: tags.value,
|
|
4217
4299
|
"max-tag-count": props.maxTagCount,
|
|
@@ -4221,22 +4303,22 @@ const _sfc_main$8 = /*@__PURE__*/ defineComponent({
|
|
|
4221
4303
|
"values",
|
|
4222
4304
|
"max-tag-count",
|
|
4223
4305
|
"disabled"
|
|
4224
|
-
])) : createCommentVNode("v-if", true), !tags.value.length ? (openBlock(), createElementBlock("span", _hoisted_2$
|
|
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", {
|
|
4225
4307
|
key: 0,
|
|
4226
4308
|
role: "button",
|
|
4227
4309
|
"data-part": "clear",
|
|
4228
4310
|
class: "text-muted-foreground hover:text-foreground",
|
|
4229
4311
|
"aria-label": "清空",
|
|
4230
4312
|
onClick: withModifiers(handleClear, ["stop"])
|
|
4231
|
-
}, [createVNode(ClearIcon_default)])) : createCommentVNode("v-if", true), createVNode(ChevronIcon_default, { class: normalizeClass(unref(cn)("text-muted-foreground transition-transform", isOpen
|
|
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)]),
|
|
4232
4314
|
_: 1
|
|
4233
4315
|
}), (openBlock(), createBlock(Teleport, { to: "body" }, [createVNode(unref(Popover).Positioner, null, {
|
|
4234
4316
|
default: withCtx(() => [createVNode(unref(Popover).Content, {
|
|
4235
|
-
class: normalizeClass(unref(cn)("bg-popover text-popover-foreground z-
|
|
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")),
|
|
4236
4318
|
style: normalizeStyle({ minWidth: panelMinWidth.value }),
|
|
4237
4319
|
onKeydown: handleKeydown
|
|
4238
4320
|
}, {
|
|
4239
|
-
default: withCtx(() => [createVNode(_sfc_main$
|
|
4321
|
+
default: withCtx(() => [createVNode(_sfc_main$55, {
|
|
4240
4322
|
columns: columns.value,
|
|
4241
4323
|
"expand-trigger": props.expandTrigger,
|
|
4242
4324
|
"selected-keys": isMulti.value ? selectedKeys.value : [],
|
|
@@ -4262,17 +4344,13 @@ const _sfc_main$8 = /*@__PURE__*/ defineComponent({
|
|
|
4262
4344
|
_: 1
|
|
4263
4345
|
})]))]),
|
|
4264
4346
|
_: 1
|
|
4265
|
-
}, 8, ["open"]);
|
|
4347
|
+
}, 8, ["open", "onUpdate:open"]);
|
|
4266
4348
|
};
|
|
4267
4349
|
}
|
|
4268
4350
|
});
|
|
4269
4351
|
//#endregion
|
|
4270
4352
|
//#region src/components/tree-select/TreePanel.vue
|
|
4271
|
-
const _hoisted_1$
|
|
4272
|
-
class: "max-h-[280px] overflow-auto p-1",
|
|
4273
|
-
role: "tree"
|
|
4274
|
-
};
|
|
4275
|
-
const _hoisted_2$11 = [
|
|
4353
|
+
const _hoisted_1$15 = [
|
|
4276
4354
|
"aria-level",
|
|
4277
4355
|
"aria-selected",
|
|
4278
4356
|
"aria-checked",
|
|
@@ -4284,14 +4362,14 @@ const _hoisted_2$11 = [
|
|
|
4284
4362
|
"data-active",
|
|
4285
4363
|
"onClick"
|
|
4286
4364
|
];
|
|
4287
|
-
const
|
|
4288
|
-
const
|
|
4365
|
+
const _hoisted_2$12 = ["aria-label", "onClick"];
|
|
4366
|
+
const _hoisted_3$8 = {
|
|
4289
4367
|
key: 1,
|
|
4290
4368
|
class: "size-4 shrink-0",
|
|
4291
4369
|
"aria-hidden": "true"
|
|
4292
4370
|
};
|
|
4293
|
-
const
|
|
4294
|
-
const
|
|
4371
|
+
const _hoisted_4$5 = ["data-checked", "data-indeterminate"];
|
|
4372
|
+
const _hoisted_5$3 = {
|
|
4295
4373
|
key: 0,
|
|
4296
4374
|
viewBox: "0 0 24 24",
|
|
4297
4375
|
fill: "none",
|
|
@@ -4301,7 +4379,7 @@ const _hoisted_6$3 = {
|
|
|
4301
4379
|
"stroke-linejoin": "round",
|
|
4302
4380
|
class: "size-3"
|
|
4303
4381
|
};
|
|
4304
|
-
const
|
|
4382
|
+
const _hoisted_6$3 = {
|
|
4305
4383
|
key: 1,
|
|
4306
4384
|
viewBox: "0 0 24 24",
|
|
4307
4385
|
fill: "none",
|
|
@@ -4310,12 +4388,12 @@ const _hoisted_7$3 = {
|
|
|
4310
4388
|
"stroke-linecap": "round",
|
|
4311
4389
|
class: "size-3"
|
|
4312
4390
|
};
|
|
4313
|
-
const
|
|
4314
|
-
const
|
|
4391
|
+
const _hoisted_7$3 = { class: "truncate" };
|
|
4392
|
+
const _hoisted_8$1 = {
|
|
4315
4393
|
key: 0,
|
|
4316
4394
|
class: "px-2 py-6 text-center text-sm text-muted-foreground"
|
|
4317
4395
|
};
|
|
4318
|
-
const _sfc_main$
|
|
4396
|
+
const _sfc_main$54 = /*@__PURE__*/ defineComponent({
|
|
4319
4397
|
__name: "TreePanel",
|
|
4320
4398
|
props: {
|
|
4321
4399
|
/** 展开态扁平化的可见节点序列(来自 treeMate.getFlattenedNodes(expandedKeys)) */
|
|
@@ -4361,23 +4439,30 @@ const _sfc_main$53 = /*@__PURE__*/ defineComponent({
|
|
|
4361
4439
|
function label(node) {
|
|
4362
4440
|
return node.rawNode.label ?? String(node.key);
|
|
4363
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));
|
|
4364
4446
|
function hasChildren(node) {
|
|
4365
4447
|
return !node.isLeaf && !!node.children?.length;
|
|
4366
4448
|
}
|
|
4367
4449
|
function isExpanded(node) {
|
|
4368
|
-
return hasChildren(node) &&
|
|
4450
|
+
return hasChildren(node) && expandedSet.value.has(node.key);
|
|
4369
4451
|
}
|
|
4370
4452
|
function isSelected(node) {
|
|
4371
|
-
return props.checkable ?
|
|
4453
|
+
return props.checkable ? checkedSet.value.has(node.key) : selectedSet.value.has(node.key);
|
|
4372
4454
|
}
|
|
4373
4455
|
function isChecked(node) {
|
|
4374
|
-
return
|
|
4456
|
+
return checkedSet.value.has(node.key);
|
|
4375
4457
|
}
|
|
4376
4458
|
function isIndeterminate(node) {
|
|
4377
|
-
return
|
|
4459
|
+
return indeterminateSet.value.has(node.key);
|
|
4378
4460
|
}
|
|
4379
4461
|
return (_ctx, _cache) => {
|
|
4380
|
-
return openBlock(), createElementBlock("div",
|
|
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) => {
|
|
4381
4466
|
return openBlock(), createElementBlock("div", {
|
|
4382
4467
|
key: node.key,
|
|
4383
4468
|
role: "treeitem",
|
|
@@ -4401,7 +4486,7 @@ const _sfc_main$53 = /*@__PURE__*/ defineComponent({
|
|
|
4401
4486
|
class: "flex size-4 shrink-0 items-center justify-center text-muted-foreground",
|
|
4402
4487
|
"aria-label": isExpanded(node) ? "折叠" : "展开",
|
|
4403
4488
|
onClick: withModifiers(($event) => emit("toggle", node), ["stop"])
|
|
4404
|
-
}, [createVNode(ChevronIcon_default, { class: normalizeClass(isExpanded(node) ? "rotate-90" : "") }, null, 8, ["class"])], 8,
|
|
4489
|
+
}, [createVNode(ChevronIcon_default, { class: normalizeClass(isExpanded(node) ? "rotate-90" : "") }, null, 8, ["class"])], 8, _hoisted_2$12)) : (openBlock(), createElementBlock("span", _hoisted_3$8)),
|
|
4405
4490
|
props.checkable ? (openBlock(), createElementBlock("span", {
|
|
4406
4491
|
key: 2,
|
|
4407
4492
|
"data-part": "checkbox",
|
|
@@ -4409,18 +4494,18 @@ const _sfc_main$53 = /*@__PURE__*/ defineComponent({
|
|
|
4409
4494
|
"data-indeterminate": isIndeterminate(node) ? "" : void 0,
|
|
4410
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",
|
|
4411
4496
|
"aria-hidden": "true"
|
|
4412
|
-
}, [isChecked(node) ? (openBlock(), createElementBlock("svg",
|
|
4413
|
-
createElementVNode("span",
|
|
4414
|
-
], 12,
|
|
4415
|
-
}), 128)), __props.nodes.length === 0 ? (openBlock(), createElementBlock("div",
|
|
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);
|
|
4416
4501
|
};
|
|
4417
4502
|
}
|
|
4418
4503
|
});
|
|
4419
4504
|
//#endregion
|
|
4420
4505
|
//#region src/components/tree-select/TreeSelect.vue
|
|
4421
|
-
const _hoisted_1$
|
|
4422
|
-
const _hoisted_2$
|
|
4423
|
-
const _hoisted_3$
|
|
4506
|
+
const _hoisted_1$14 = ["aria-expanded", "aria-disabled"];
|
|
4507
|
+
const _hoisted_2$11 = ["placeholder", "aria-label"];
|
|
4508
|
+
const _hoisted_3$7 = {
|
|
4424
4509
|
key: 2,
|
|
4425
4510
|
class: "truncate text-muted-foreground"
|
|
4426
4511
|
};
|
|
@@ -4534,16 +4619,25 @@ const _sfc_main$48 = /*@__PURE__*/ defineComponent({
|
|
|
4534
4619
|
emits: [
|
|
4535
4620
|
"update:modelValue",
|
|
4536
4621
|
"update:show",
|
|
4622
|
+
"update:open",
|
|
4537
4623
|
"update:expandedKeys"
|
|
4538
4624
|
],
|
|
4539
4625
|
setup(__props, { emit: __emit }) {
|
|
4540
4626
|
const props = __props;
|
|
4541
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)。");
|
|
4542
4629
|
const internalValue = ref(props.defaultValue);
|
|
4543
4630
|
const value = computed(() => props.modelValue !== void 0 ? props.modelValue : internalValue.value);
|
|
4544
4631
|
const treeMate = computed(() => createTreeMate(props.options, { ignoreEmptyChildren: true }));
|
|
4545
4632
|
const internalExpanded = ref(props.defaultExpandAll ? treeMate.value.getNonLeafKeys({ preserveGroup: true }) : [...props.defaultExpandedKeys]);
|
|
4546
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
|
+
});
|
|
4547
4641
|
function handleExpandedUpdate(keys) {
|
|
4548
4642
|
internalExpanded.value = keys;
|
|
4549
4643
|
emit("update:expandedKeys", keys);
|
|
@@ -4609,7 +4703,7 @@ const _sfc_main$48 = /*@__PURE__*/ defineComponent({
|
|
|
4609
4703
|
updateValue(current.includes(node.key) ? current.filter((k) => k !== node.key) : [...current, node.key]);
|
|
4610
4704
|
} else {
|
|
4611
4705
|
updateValue(node.key);
|
|
4612
|
-
|
|
4706
|
+
setOpen(false);
|
|
4613
4707
|
}
|
|
4614
4708
|
}
|
|
4615
4709
|
watch(checkOptions, () => {
|
|
@@ -4619,9 +4713,11 @@ const _sfc_main$48 = /*@__PURE__*/ defineComponent({
|
|
|
4619
4713
|
if (normalized.checkedKeys.length !== current.length || normalized.checkedKeys.some((k) => !current.includes(k))) updateValue(normalized.checkedKeys);
|
|
4620
4714
|
});
|
|
4621
4715
|
function removeTag(key) {
|
|
4622
|
-
|
|
4623
|
-
|
|
4624
|
-
|
|
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));
|
|
4625
4721
|
}
|
|
4626
4722
|
const hasValue = computed(() => tags.value.length > 0);
|
|
4627
4723
|
function handleClear() {
|
|
@@ -4629,16 +4725,18 @@ const _sfc_main$48 = /*@__PURE__*/ defineComponent({
|
|
|
4629
4725
|
internalValue.value = next;
|
|
4630
4726
|
emit("update:modelValue", next);
|
|
4631
4727
|
}
|
|
4632
|
-
const
|
|
4633
|
-
|
|
4634
|
-
|
|
4635
|
-
|
|
4636
|
-
|
|
4637
|
-
|
|
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
|
+
});
|
|
4638
4736
|
function openFromInput() {
|
|
4639
4737
|
if (props.disabled || isOpen.value) return;
|
|
4640
4738
|
syncPanelWidth();
|
|
4641
|
-
|
|
4739
|
+
setOpen(true);
|
|
4642
4740
|
}
|
|
4643
4741
|
const triggerEl = ref(null);
|
|
4644
4742
|
const panelMinWidth = ref("0px");
|
|
@@ -4727,8 +4825,8 @@ const _sfc_main$48 = /*@__PURE__*/ defineComponent({
|
|
|
4727
4825
|
});
|
|
4728
4826
|
return (_ctx, _cache) => {
|
|
4729
4827
|
return openBlock(), createBlock(unref(Popover).Root, {
|
|
4730
|
-
open: isOpen
|
|
4731
|
-
"onUpdate:open":
|
|
4828
|
+
open: unref(isOpen),
|
|
4829
|
+
"onUpdate:open": unref(setOpen)
|
|
4732
4830
|
}, {
|
|
4733
4831
|
default: withCtx(() => [
|
|
4734
4832
|
createVNode(unref(Popover).Anchor, { "as-child": "" }, {
|
|
@@ -4739,14 +4837,14 @@ const _sfc_main$48 = /*@__PURE__*/ defineComponent({
|
|
|
4739
4837
|
"data-part": "trigger",
|
|
4740
4838
|
role: "button",
|
|
4741
4839
|
tabindex: "0",
|
|
4742
|
-
"aria-expanded": isOpen
|
|
4840
|
+
"aria-expanded": unref(isOpen),
|
|
4743
4841
|
"aria-haspopup": "true",
|
|
4744
4842
|
"aria-disabled": props.disabled || void 0,
|
|
4745
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),
|
|
4746
4844
|
onClick: openFromInput,
|
|
4747
4845
|
onKeydown: handleKeydown
|
|
4748
4846
|
}), [isMulti.value ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
4749
|
-
tags.value.length ? (openBlock(), createBlock(_sfc_main$
|
|
4847
|
+
tags.value.length ? (openBlock(), createBlock(_sfc_main$56, {
|
|
4750
4848
|
key: 0,
|
|
4751
4849
|
values: tags.value,
|
|
4752
4850
|
"max-tag-count": props.maxTagCount,
|
|
@@ -4765,8 +4863,8 @@ const _sfc_main$48 = /*@__PURE__*/ defineComponent({
|
|
|
4765
4863
|
class: "h-5 w-12 min-w-0 flex-1 bg-transparent outline-none placeholder:text-muted-foreground",
|
|
4766
4864
|
placeholder: tags.value.length ? "" : props.placeholder,
|
|
4767
4865
|
"aria-label": props.placeholder
|
|
4768
|
-
}, null, 8, _hoisted_2$
|
|
4769
|
-
!tags.value.length && !props.filterable ? (openBlock(), createElementBlock("span", _hoisted_3$
|
|
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)
|
|
4770
4868
|
], 64)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [props.filterable ? withDirectives((openBlock(), createElementBlock("input", {
|
|
4771
4869
|
key: 0,
|
|
4772
4870
|
"onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => pattern.value = $event),
|
|
@@ -4782,17 +4880,17 @@ const _sfc_main$48 = /*@__PURE__*/ defineComponent({
|
|
|
4782
4880
|
class: "text-muted-foreground hover:text-foreground",
|
|
4783
4881
|
"aria-label": "清空",
|
|
4784
4882
|
onClick: withModifiers(handleClear, ["stop"])
|
|
4785
|
-
}, [createVNode(ClearIcon_default)])) : createCommentVNode("v-if", true), createVNode(ChevronIcon_default, { class: normalizeClass(unref(cn)("text-muted-foreground transition-transform", isOpen
|
|
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)]),
|
|
4786
4884
|
_: 1
|
|
4787
4885
|
}),
|
|
4788
4886
|
createCommentVNode(" 弹层 Teleport 到 body:脱离表单 DOM,消除 overflow 容器裁剪隐患(DatePicker 同款) "),
|
|
4789
|
-
(openBlock(), createBlock(Teleport, { to: "body" }, [createVNode(unref(Popover).Positioner, { class: "z-
|
|
4887
|
+
(openBlock(), createBlock(Teleport, { to: "body" }, [createVNode(unref(Popover).Positioner, { class: "z-[var(--z-overlay)]" }, {
|
|
4790
4888
|
default: withCtx(() => [createVNode(unref(Popover).Content, {
|
|
4791
|
-
class: normalizeClass(unref(cn)("bg-popover text-popover-foreground z-
|
|
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")),
|
|
4792
4890
|
style: normalizeStyle({ minWidth: panelMinWidth.value }),
|
|
4793
4891
|
onKeydown: handleKeydown
|
|
4794
4892
|
}, {
|
|
4795
|
-
default: withCtx(() => [createVNode(_sfc_main$
|
|
4893
|
+
default: withCtx(() => [createVNode(_sfc_main$54, {
|
|
4796
4894
|
nodes: filteredNodes.value,
|
|
4797
4895
|
"selected-keys": selectedKeys.value,
|
|
4798
4896
|
"expanded-keys": expandedKeys.value,
|
|
@@ -4817,7 +4915,7 @@ const _sfc_main$48 = /*@__PURE__*/ defineComponent({
|
|
|
4817
4915
|
})]))
|
|
4818
4916
|
]),
|
|
4819
4917
|
_: 1
|
|
4820
|
-
}, 8, ["open"]);
|
|
4918
|
+
}, 8, ["open", "onUpdate:open"]);
|
|
4821
4919
|
};
|
|
4822
4920
|
}
|
|
4823
4921
|
});
|
|
@@ -4872,7 +4970,7 @@ function widgetRenders() {
|
|
|
4872
4970
|
}
|
|
4873
4971
|
//#endregion
|
|
4874
4972
|
//#region src/components/form-render/FormRender.vue
|
|
4875
|
-
const _hoisted_1$
|
|
4973
|
+
const _hoisted_1$13 = {
|
|
4876
4974
|
key: 0,
|
|
4877
4975
|
class: "col-span-full flex justify-end gap-2"
|
|
4878
4976
|
};
|
|
@@ -4956,13 +5054,13 @@ const _sfc_main$25 = /*@__PURE__*/ defineComponent({
|
|
|
4956
5054
|
});
|
|
4957
5055
|
return (_ctx, _cache) => {
|
|
4958
5056
|
return openBlock(), createElementBlock("div", {
|
|
4959
|
-
class: "grid gap-4",
|
|
5057
|
+
class: normalizeClass(unref(cn)("grid gap-4", _ctx.$attrs.class)),
|
|
4960
5058
|
style: normalizeStyle(gridStyle.value)
|
|
4961
5059
|
}, [(openBlock(true), createElementBlock(Fragment, null, renderList(visibleItems.value, (item) => {
|
|
4962
5060
|
return openBlock(), createElementBlock("div", {
|
|
4963
5061
|
key: String(item.key),
|
|
4964
5062
|
style: normalizeStyle(spanStyle(item.span))
|
|
4965
|
-
}, [createVNode(_sfc_main$
|
|
5063
|
+
}, [createVNode(_sfc_main$64, {
|
|
4966
5064
|
item,
|
|
4967
5065
|
widget: widgetOf(item),
|
|
4968
5066
|
values: unref(valuesRef)
|
|
@@ -4971,7 +5069,7 @@ const _sfc_main$25 = /*@__PURE__*/ defineComponent({
|
|
|
4971
5069
|
"widget",
|
|
4972
5070
|
"values"
|
|
4973
5071
|
])], 4);
|
|
4974
|
-
}), 128)), showActions.value ? (openBlock(), createElementBlock("div", _hoisted_1$
|
|
5072
|
+
}), 128)), showActions.value ? (openBlock(), createElementBlock("div", _hoisted_1$13, [renderSlot(_ctx.$slots, "actions", {}, () => [
|
|
4975
5073
|
__props.searchable ? (openBlock(), createBlock(unref(_sfc_main$5), {
|
|
4976
5074
|
key: 0,
|
|
4977
5075
|
onClick: _cache[0] || (_cache[0] = ($event) => submit("search"))
|
|
@@ -5002,7 +5100,7 @@ const _sfc_main$25 = /*@__PURE__*/ defineComponent({
|
|
|
5002
5100
|
default: withCtx(() => [..._cache[3] || (_cache[3] = [createTextVNode(" 取消 ", -1)])]),
|
|
5003
5101
|
_: 1
|
|
5004
5102
|
})) : createCommentVNode("v-if", true)
|
|
5005
|
-
])])) : createCommentVNode("v-if", true)],
|
|
5103
|
+
])])) : createCommentVNode("v-if", true)], 6);
|
|
5006
5104
|
};
|
|
5007
5105
|
}
|
|
5008
5106
|
});
|
|
@@ -5347,11 +5445,11 @@ const cardVariants = cva("relative rounded-xl border border-border bg-card text-
|
|
|
5347
5445
|
});
|
|
5348
5446
|
//#endregion
|
|
5349
5447
|
//#region src/components/dialog/Dialog.vue
|
|
5350
|
-
const _hoisted_1$
|
|
5448
|
+
const _hoisted_1$12 = {
|
|
5351
5449
|
key: 0,
|
|
5352
5450
|
class: "flex flex-col gap-2 text-center sm:text-left"
|
|
5353
5451
|
};
|
|
5354
|
-
const _hoisted_2$
|
|
5452
|
+
const _hoisted_2$10 = {
|
|
5355
5453
|
key: 1,
|
|
5356
5454
|
class: "flex flex-col-reverse gap-2 sm:flex-row sm:justify-end"
|
|
5357
5455
|
};
|
|
@@ -5403,25 +5501,24 @@ const _sfc_main$14 = /*@__PURE__*/ defineComponent({
|
|
|
5403
5501
|
setup(__props, { emit: __emit }) {
|
|
5404
5502
|
const props = __props;
|
|
5405
5503
|
const emit = __emit;
|
|
5406
|
-
const
|
|
5407
|
-
|
|
5408
|
-
|
|
5409
|
-
|
|
5410
|
-
|
|
5411
|
-
}
|
|
5504
|
+
const { isOpen, setOpen } = useControlledBoolean({
|
|
5505
|
+
controlled: () => props.open,
|
|
5506
|
+
defaultValue: () => props.defaultOpen,
|
|
5507
|
+
onChange: (open) => emit("update:open", open)
|
|
5508
|
+
});
|
|
5412
5509
|
/** 关闭对话框(#footer 作用域插槽注入):走受控桥把 open 置 false,
|
|
5413
5510
|
* 与原 TDialogClose(Ark CloseTrigger)的关闭语义等价,退出动画/焦点还原由 zag 处理 */
|
|
5414
5511
|
function close() {
|
|
5415
|
-
|
|
5512
|
+
setOpen(false);
|
|
5416
5513
|
}
|
|
5417
5514
|
const hasHeader = computed(() => Boolean(props.title || props.description));
|
|
5418
|
-
const contentClass = computed(() => cn("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out fixed left-1/2 top-1/2 z-
|
|
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));
|
|
5419
5516
|
return (_ctx, _cache) => {
|
|
5420
5517
|
return openBlock(), createBlock(unref(Dialog).Root, {
|
|
5421
|
-
open: isOpen
|
|
5518
|
+
open: unref(isOpen),
|
|
5422
5519
|
"lazy-mount": props.lazyMount,
|
|
5423
5520
|
"unmount-on-exit": props.unmountOnExit,
|
|
5424
|
-
"onUpdate:open":
|
|
5521
|
+
"onUpdate:open": unref(setOpen)
|
|
5425
5522
|
}, {
|
|
5426
5523
|
default: withCtx(() => [
|
|
5427
5524
|
createCommentVNode(" #trigger:触发元素本体(asChild 语义合并到子元素,原 TDialogTrigger 同款实现);未提供则不渲染触发器 "),
|
|
@@ -5432,12 +5529,12 @@ const _sfc_main$14 = /*@__PURE__*/ defineComponent({
|
|
|
5432
5529
|
default: withCtx(() => [renderSlot(_ctx.$slots, "trigger")]),
|
|
5433
5530
|
_: 3
|
|
5434
5531
|
})) : createCommentVNode("v-if", true),
|
|
5435
|
-
createVNode(unref(Dialog).Backdrop, { class: "fixed inset-0 z-
|
|
5436
|
-
createVNode(unref(Dialog).Positioner, { class: "fixed inset-0 z-
|
|
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" }, {
|
|
5437
5534
|
default: withCtx(() => [createVNode(unref(Dialog).Content, { class: normalizeClass(contentClass.value) }, {
|
|
5438
5535
|
default: withCtx(() => [
|
|
5439
5536
|
createCommentVNode(" 标题/描述:#title / #description 插槽优先,回退 title/description props;皆无则不渲染对应 DOM "),
|
|
5440
|
-
hasHeader.value || _ctx.$slots.title || _ctx.$slots.description ? (openBlock(), createElementBlock("div", _hoisted_1$
|
|
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, {
|
|
5441
5538
|
key: 0,
|
|
5442
5539
|
class: "text-lg font-semibold leading-none tracking-tight"
|
|
5443
5540
|
}, {
|
|
@@ -5453,7 +5550,7 @@ const _sfc_main$14 = /*@__PURE__*/ defineComponent({
|
|
|
5453
5550
|
createCommentVNode(" 默认插槽:弹层内容区(原 TDialogContent 的 body 部分) "),
|
|
5454
5551
|
renderSlot(_ctx.$slots, "default"),
|
|
5455
5552
|
createCommentVNode(" 底部操作区:#footer=\"{ close }\" 注入关闭函数,替代原 TDialogClose "),
|
|
5456
|
-
_ctx.$slots.footer ? (openBlock(), createElementBlock("div", _hoisted_2$
|
|
5553
|
+
_ctx.$slots.footer ? (openBlock(), createElementBlock("div", _hoisted_2$10, [renderSlot(_ctx.$slots, "footer", { close })])) : createCommentVNode("v-if", true),
|
|
5457
5554
|
props.showCloseButton ? (openBlock(), createBlock(unref(Dialog).CloseTrigger, {
|
|
5458
5555
|
key: 2,
|
|
5459
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"
|
|
@@ -5479,7 +5576,8 @@ const _sfc_main$14 = /*@__PURE__*/ defineComponent({
|
|
|
5479
5576
|
}, 8, [
|
|
5480
5577
|
"open",
|
|
5481
5578
|
"lazy-mount",
|
|
5482
|
-
"unmount-on-exit"
|
|
5579
|
+
"unmount-on-exit",
|
|
5580
|
+
"onUpdate:open"
|
|
5483
5581
|
]);
|
|
5484
5582
|
};
|
|
5485
5583
|
}
|
|
@@ -5490,7 +5588,7 @@ const _sfc_main$14 = /*@__PURE__*/ defineComponent({
|
|
|
5490
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";
|
|
5491
5589
|
const labelCls = "px-2 py-1.5 text-sm font-medium";
|
|
5492
5590
|
const separatorCls = "-mx-1 my-1 h-px bg-muted";
|
|
5493
|
-
const _sfc_main$
|
|
5591
|
+
const _sfc_main$53 = /*@__PURE__*/ defineComponent({
|
|
5494
5592
|
__name: "MenuItems",
|
|
5495
5593
|
props: { items: {} },
|
|
5496
5594
|
setup(__props) {
|
|
@@ -5534,7 +5632,7 @@ const _sfc_main$52 = /*@__PURE__*/ defineComponent({
|
|
|
5534
5632
|
});
|
|
5535
5633
|
//#endregion
|
|
5536
5634
|
//#region src/components/dropdown-menu/DropdownMenu.vue
|
|
5537
|
-
const contentCls$1 = "bg-popover text-popover-foreground z-
|
|
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";
|
|
5538
5636
|
const _sfc_main$16 = /*@__PURE__*/ defineComponent({
|
|
5539
5637
|
name: "DropdownMenu",
|
|
5540
5638
|
inheritAttrs: false,
|
|
@@ -5578,21 +5676,20 @@ const _sfc_main$16 = /*@__PURE__*/ defineComponent({
|
|
|
5578
5676
|
const props = __props;
|
|
5579
5677
|
const emit = __emit;
|
|
5580
5678
|
const attrs = useAttrs();
|
|
5581
|
-
const
|
|
5582
|
-
|
|
5583
|
-
|
|
5584
|
-
|
|
5585
|
-
|
|
5586
|
-
}
|
|
5679
|
+
const { isOpen, setOpen } = useControlledBoolean({
|
|
5680
|
+
controlled: () => props.open,
|
|
5681
|
+
defaultValue: () => props.defaultOpen,
|
|
5682
|
+
onChange: (open) => emit("update:open", open)
|
|
5683
|
+
});
|
|
5587
5684
|
function handleSelect(details) {
|
|
5588
5685
|
emit("select", details);
|
|
5589
5686
|
}
|
|
5590
5687
|
return (_ctx, _cache) => {
|
|
5591
5688
|
return openBlock(), createBlock(unref(Menu).Root, {
|
|
5592
|
-
open: isOpen
|
|
5689
|
+
open: unref(isOpen),
|
|
5593
5690
|
"lazy-mount": props.lazyMount,
|
|
5594
5691
|
"unmount-on-exit": props.unmountOnExit,
|
|
5595
|
-
"onUpdate:open":
|
|
5692
|
+
"onUpdate:open": unref(setOpen),
|
|
5596
5693
|
onSelect: handleSelect
|
|
5597
5694
|
}, {
|
|
5598
5695
|
default: withCtx(() => [
|
|
@@ -5604,9 +5701,9 @@ const _sfc_main$16 = /*@__PURE__*/ defineComponent({
|
|
|
5604
5701
|
default: withCtx(() => [renderSlot(_ctx.$slots, "default")]),
|
|
5605
5702
|
_: 3
|
|
5606
5703
|
}, 8, ["class"]),
|
|
5607
|
-
createVNode(unref(Menu).Positioner, { class: "z-
|
|
5704
|
+
createVNode(unref(Menu).Positioner, { class: "z-[var(--z-overlay)]" }, {
|
|
5608
5705
|
default: withCtx(() => [createVNode(unref(Menu).Content, mergeProps(unref(attrs), { class: unref(cn)(contentCls$1, props.contentClass) }), {
|
|
5609
|
-
default: withCtx(() => [createVNode(_sfc_main$
|
|
5706
|
+
default: withCtx(() => [createVNode(_sfc_main$53, { items: props.items }, createSlots({ _: 2 }, [_ctx.$slots.item ? {
|
|
5610
5707
|
name: "item",
|
|
5611
5708
|
fn: withCtx((slotProps) => [renderSlot(_ctx.$slots, "item", normalizeProps(guardReactiveProps(slotProps)))]),
|
|
5612
5709
|
key: "0"
|
|
@@ -5620,7 +5717,8 @@ const _sfc_main$16 = /*@__PURE__*/ defineComponent({
|
|
|
5620
5717
|
}, 8, [
|
|
5621
5718
|
"open",
|
|
5622
5719
|
"lazy-mount",
|
|
5623
|
-
"unmount-on-exit"
|
|
5720
|
+
"unmount-on-exit",
|
|
5721
|
+
"onUpdate:open"
|
|
5624
5722
|
]);
|
|
5625
5723
|
};
|
|
5626
5724
|
}
|
|
@@ -5788,12 +5886,11 @@ const _sfc_main$34 = /*@__PURE__*/ defineComponent({
|
|
|
5788
5886
|
const props = __props;
|
|
5789
5887
|
const emit = __emit;
|
|
5790
5888
|
const attrs = useAttrs();
|
|
5791
|
-
const
|
|
5792
|
-
|
|
5793
|
-
|
|
5794
|
-
|
|
5795
|
-
|
|
5796
|
-
}
|
|
5889
|
+
const { isOpen, setOpen } = useControlledBoolean({
|
|
5890
|
+
controlled: () => props.open,
|
|
5891
|
+
defaultValue: () => props.defaultOpen,
|
|
5892
|
+
onChange: (open) => emit("update:open", open)
|
|
5893
|
+
});
|
|
5797
5894
|
const rootPositioning = computed(() => {
|
|
5798
5895
|
const user = attrs.positioning ?? {};
|
|
5799
5896
|
if (user.placement) return user;
|
|
@@ -5803,14 +5900,14 @@ const _sfc_main$34 = /*@__PURE__*/ defineComponent({
|
|
|
5803
5900
|
placement
|
|
5804
5901
|
};
|
|
5805
5902
|
});
|
|
5806
|
-
const contentClass = computed(() => cn("bg-popover text-popover-foreground z-
|
|
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"]));
|
|
5807
5904
|
return (_ctx, _cache) => {
|
|
5808
5905
|
return openBlock(), createBlock(unref(Popover).Root, mergeProps(unref(attrs), {
|
|
5809
|
-
open: isOpen
|
|
5906
|
+
open: unref(isOpen),
|
|
5810
5907
|
positioning: rootPositioning.value,
|
|
5811
5908
|
"lazy-mount": props.lazyMount,
|
|
5812
5909
|
"unmount-on-exit": props.unmountOnExit,
|
|
5813
|
-
"onUpdate:open":
|
|
5910
|
+
"onUpdate:open": unref(setOpen)
|
|
5814
5911
|
}), {
|
|
5815
5912
|
default: withCtx(() => [
|
|
5816
5913
|
createCommentVNode(" 默认插槽即触发元素本体(asChild 语义合并到子元素,不额外包裹,原 PopoverTrigger 同款实现) "),
|
|
@@ -5818,7 +5915,7 @@ const _sfc_main$34 = /*@__PURE__*/ defineComponent({
|
|
|
5818
5915
|
default: withCtx(() => [renderSlot(_ctx.$slots, "default")]),
|
|
5819
5916
|
_: 3
|
|
5820
5917
|
}),
|
|
5821
|
-
createVNode(unref(Popover).Positioner, { class: "z-
|
|
5918
|
+
createVNode(unref(Popover).Positioner, { class: "z-[var(--z-overlay)]" }, {
|
|
5822
5919
|
default: withCtx(() => [createVNode(unref(Popover).Content, mergeProps(props.contentProps, { class: contentClass.value }), {
|
|
5823
5920
|
default: withCtx(() => [renderSlot(_ctx.$slots, "content")]),
|
|
5824
5921
|
_: 3
|
|
@@ -5831,14 +5928,15 @@ const _sfc_main$34 = /*@__PURE__*/ defineComponent({
|
|
|
5831
5928
|
"open",
|
|
5832
5929
|
"positioning",
|
|
5833
5930
|
"lazy-mount",
|
|
5834
|
-
"unmount-on-exit"
|
|
5931
|
+
"unmount-on-exit",
|
|
5932
|
+
"onUpdate:open"
|
|
5835
5933
|
]);
|
|
5836
5934
|
};
|
|
5837
5935
|
}
|
|
5838
5936
|
});
|
|
5839
5937
|
//#endregion
|
|
5840
5938
|
//#region src/components/separator/Separator.vue
|
|
5841
|
-
const _hoisted_1$
|
|
5939
|
+
const _hoisted_1$11 = ["data-orientation"];
|
|
5842
5940
|
const _sfc_main$38 = /*@__PURE__*/ defineComponent({
|
|
5843
5941
|
__name: "Separator",
|
|
5844
5942
|
props: {
|
|
@@ -5852,7 +5950,7 @@ const _sfc_main$38 = /*@__PURE__*/ defineComponent({
|
|
|
5852
5950
|
return openBlock(), createElementBlock("div", {
|
|
5853
5951
|
"data-orientation": props.orientation,
|
|
5854
5952
|
class: normalizeClass(unref(cn)("bg-border shrink-0", orientationClass.value, props.class))
|
|
5855
|
-
}, null, 10, _hoisted_1$
|
|
5953
|
+
}, null, 10, _hoisted_1$11);
|
|
5856
5954
|
};
|
|
5857
5955
|
}
|
|
5858
5956
|
});
|
|
@@ -5997,20 +6095,19 @@ const _sfc_main$47 = /*@__PURE__*/ defineComponent({
|
|
|
5997
6095
|
const props = __props;
|
|
5998
6096
|
const emit = __emit;
|
|
5999
6097
|
const slots = useSlots();
|
|
6000
|
-
const
|
|
6001
|
-
|
|
6002
|
-
|
|
6003
|
-
|
|
6004
|
-
|
|
6005
|
-
}
|
|
6098
|
+
const { isOpen, setOpen } = useControlledBoolean({
|
|
6099
|
+
controlled: () => props.open,
|
|
6100
|
+
defaultValue: () => props.defaultOpen,
|
|
6101
|
+
onChange: (open) => emit("update:open", open)
|
|
6102
|
+
});
|
|
6006
6103
|
return (_ctx, _cache) => {
|
|
6007
6104
|
return openBlock(), createBlock(unref(Tooltip).Root, {
|
|
6008
|
-
open: isOpen
|
|
6105
|
+
open: unref(isOpen),
|
|
6009
6106
|
"open-delay": props.delayDuration,
|
|
6010
6107
|
"close-delay": props.closeDuration,
|
|
6011
6108
|
"lazy-mount": props.lazyMount,
|
|
6012
6109
|
"unmount-on-exit": props.unmountOnExit,
|
|
6013
|
-
"onUpdate:open":
|
|
6110
|
+
"onUpdate:open": unref(setOpen)
|
|
6014
6111
|
}, {
|
|
6015
6112
|
default: withCtx(() => [
|
|
6016
6113
|
createCommentVNode(" 默认插槽即触发元素本身:Ark Trigger asChild 把行为(hover/focus、aria)合并其上,\n 不额外包裹元素。省略默认插槽即为纯受控气泡(open 驱动,配合 #content) "),
|
|
@@ -6021,8 +6118,8 @@ const _sfc_main$47 = /*@__PURE__*/ defineComponent({
|
|
|
6021
6118
|
default: withCtx(() => [renderSlot(_ctx.$slots, "default")]),
|
|
6022
6119
|
_: 3
|
|
6023
6120
|
})) : createCommentVNode("v-if", true),
|
|
6024
|
-
createVNode(unref(Tooltip).Positioner, { class: "z-
|
|
6025
|
-
default: withCtx(() => [createVNode(unref(Tooltip).Content, mergeProps(props.contentProps, { class: unref(cn)("bg-primary text-primary-foreground z-
|
|
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) }), {
|
|
6026
6123
|
default: withCtx(() => [renderSlot(_ctx.$slots, "content", {}, () => [createTextVNode(toDisplayString(props.content), 1)])]),
|
|
6027
6124
|
_: 3
|
|
6028
6125
|
}, 16, ["class"])]),
|
|
@@ -6035,17 +6132,181 @@ const _sfc_main$47 = /*@__PURE__*/ defineComponent({
|
|
|
6035
6132
|
"open-delay",
|
|
6036
6133
|
"close-delay",
|
|
6037
6134
|
"lazy-mount",
|
|
6038
|
-
"unmount-on-exit"
|
|
6135
|
+
"unmount-on-exit",
|
|
6136
|
+
"onUpdate:open"
|
|
6039
6137
|
]);
|
|
6040
6138
|
};
|
|
6041
6139
|
}
|
|
6042
6140
|
});
|
|
6043
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
|
|
6044
6306
|
//#region src/components/table-render/TablePagination.vue
|
|
6045
|
-
const _hoisted_1$9 = { class: "flex
|
|
6046
|
-
const _hoisted_2$8 =
|
|
6307
|
+
const _hoisted_1$9 = { class: "flex items-center gap-2 text-muted-foreground" };
|
|
6308
|
+
const _hoisted_2$8 = ["value"];
|
|
6047
6309
|
const _hoisted_3$5 = ["value"];
|
|
6048
|
-
const _hoisted_4$3 = ["value"];
|
|
6049
6310
|
const _sfc_main$51 = /*@__PURE__*/ defineComponent({
|
|
6050
6311
|
__name: "TablePagination",
|
|
6051
6312
|
props: {
|
|
@@ -6079,8 +6340,8 @@ const _sfc_main$51 = /*@__PURE__*/ defineComponent({
|
|
|
6079
6340
|
return items;
|
|
6080
6341
|
});
|
|
6081
6342
|
return (_ctx, _cache) => {
|
|
6082
|
-
return openBlock(), createElementBlock("div",
|
|
6083
|
-
createElementVNode("div",
|
|
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", {
|
|
6084
6345
|
class: "h-8 rounded-md border bg-transparent px-2 text-sm",
|
|
6085
6346
|
value: __props.pageSize,
|
|
6086
6347
|
onChange: _cache[0] || (_cache[0] = ($event) => emit("update:pageSize", Number($event.target.value)))
|
|
@@ -6088,8 +6349,8 @@ const _sfc_main$51 = /*@__PURE__*/ defineComponent({
|
|
|
6088
6349
|
return openBlock(), createElementBlock("option", {
|
|
6089
6350
|
key: size,
|
|
6090
6351
|
value: size
|
|
6091
|
-
}, toDisplayString(size) + " 条/页", 9,
|
|
6092
|
-
}), 128))], 40,
|
|
6352
|
+
}, toDisplayString(size) + " 条/页", 9, _hoisted_3$5);
|
|
6353
|
+
}), 128))], 40, _hoisted_2$8)]),
|
|
6093
6354
|
createCommentVNode(" Root 渲染为裸 nav 且 Ellipsis 是块级 div,必须显式 flex 才不会断行 "),
|
|
6094
6355
|
createVNode(unref(PaginationRoot), {
|
|
6095
6356
|
class: "flex items-center gap-1",
|
|
@@ -6108,7 +6369,7 @@ const _sfc_main$51 = /*@__PURE__*/ defineComponent({
|
|
|
6108
6369
|
_: 1
|
|
6109
6370
|
}, 8, ["disabled"]),
|
|
6110
6371
|
(openBlock(true), createElementBlock(Fragment, null, renderList(pages.value, (item, index) => {
|
|
6111
|
-
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), {
|
|
6112
6373
|
key: 0,
|
|
6113
6374
|
index
|
|
6114
6375
|
}, null, 8, ["index"])) : (openBlock(), createBlock(unref(PaginationItem), {
|
|
@@ -6135,7 +6396,7 @@ const _sfc_main$51 = /*@__PURE__*/ defineComponent({
|
|
|
6135
6396
|
"page",
|
|
6136
6397
|
"page-size"
|
|
6137
6398
|
])
|
|
6138
|
-
]);
|
|
6399
|
+
], 2);
|
|
6139
6400
|
};
|
|
6140
6401
|
}
|
|
6141
6402
|
});
|
|
@@ -6449,7 +6710,6 @@ function useTableRender(options) {
|
|
|
6449
6710
|
visibleKeysInternal.value = normalizeVisibleKeys(keys);
|
|
6450
6711
|
}
|
|
6451
6712
|
watch(controlledVisibleKeys, (next) => {
|
|
6452
|
-
console.log("DBG vk watch fired:", JSON.stringify(next));
|
|
6453
6713
|
if (next === void 0) return;
|
|
6454
6714
|
const normalized = normalizeVisibleKeys(next);
|
|
6455
6715
|
if (sameVisibleKeys(normalized, visibleKeysInternal.value)) return;
|
|
@@ -6549,17 +6809,16 @@ function useTableRender(options) {
|
|
|
6549
6809
|
}
|
|
6550
6810
|
//#endregion
|
|
6551
6811
|
//#region src/components/table-render/TableRender.vue
|
|
6552
|
-
const _hoisted_1$8 = {
|
|
6553
|
-
const _hoisted_2$7 = {
|
|
6812
|
+
const _hoisted_1$8 = {
|
|
6554
6813
|
key: 0,
|
|
6555
6814
|
class: "mb-2 flex items-end justify-between gap-2"
|
|
6556
6815
|
};
|
|
6557
|
-
const
|
|
6558
|
-
const
|
|
6559
|
-
const
|
|
6560
|
-
const
|
|
6561
|
-
const
|
|
6562
|
-
const
|
|
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 = {
|
|
6563
6822
|
key: 0,
|
|
6564
6823
|
xmlns: "http://www.w3.org/2000/svg",
|
|
6565
6824
|
viewBox: "0 0 24 24",
|
|
@@ -6571,68 +6830,24 @@ const _hoisted_8 = {
|
|
|
6571
6830
|
class: "text-muted-foreground size-3 shrink-0",
|
|
6572
6831
|
"aria-hidden": "true"
|
|
6573
6832
|
};
|
|
6574
|
-
const
|
|
6575
|
-
const
|
|
6576
|
-
const
|
|
6577
|
-
const
|
|
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 = {
|
|
6578
6837
|
"aria-hidden": "true",
|
|
6579
6838
|
class: "text-xs"
|
|
6580
6839
|
};
|
|
6581
|
-
const
|
|
6582
|
-
const
|
|
6583
|
-
const
|
|
6584
|
-
const
|
|
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"];
|
|
6585
6845
|
const _hoisted_17 = ["colspan"];
|
|
6586
|
-
const _hoisted_18 =
|
|
6587
|
-
"data-index",
|
|
6588
|
-
"onClick",
|
|
6589
|
-
"onDblclick",
|
|
6590
|
-
"onContextmenu"
|
|
6591
|
-
];
|
|
6592
|
-
const _hoisted_19 = [
|
|
6593
|
-
"checked",
|
|
6594
|
-
"disabled",
|
|
6595
|
-
"aria-label",
|
|
6596
|
-
"onClick"
|
|
6597
|
-
];
|
|
6598
|
-
const _hoisted_20 = ["title", "onClick"];
|
|
6599
|
-
const _hoisted_21 = [
|
|
6600
|
-
"aria-expanded",
|
|
6601
|
-
"aria-label",
|
|
6602
|
-
"onClick"
|
|
6603
|
-
];
|
|
6604
|
-
const _hoisted_22 = {
|
|
6605
|
-
key: 2,
|
|
6606
|
-
class: "min-w-0 truncate"
|
|
6607
|
-
};
|
|
6608
|
-
const _hoisted_23 = ["colspan"];
|
|
6609
|
-
const _hoisted_24 = [
|
|
6610
|
-
"onClick",
|
|
6611
|
-
"onDblclick",
|
|
6612
|
-
"onContextmenu"
|
|
6613
|
-
];
|
|
6614
|
-
const _hoisted_25 = [
|
|
6615
|
-
"checked",
|
|
6616
|
-
"disabled",
|
|
6617
|
-
"aria-label",
|
|
6618
|
-
"onClick"
|
|
6619
|
-
];
|
|
6620
|
-
const _hoisted_26 = ["title", "onClick"];
|
|
6621
|
-
const _hoisted_27 = [
|
|
6622
|
-
"aria-expanded",
|
|
6623
|
-
"aria-label",
|
|
6624
|
-
"onClick"
|
|
6625
|
-
];
|
|
6626
|
-
const _hoisted_28 = {
|
|
6627
|
-
key: 2,
|
|
6628
|
-
class: "min-w-0 truncate"
|
|
6629
|
-
};
|
|
6630
|
-
const _hoisted_29 = {
|
|
6846
|
+
const _hoisted_18 = {
|
|
6631
6847
|
key: 4,
|
|
6632
6848
|
"data-empty": ""
|
|
6633
6849
|
};
|
|
6634
|
-
const
|
|
6635
|
-
const SELECTION_CELL = "__selection__";
|
|
6850
|
+
const _hoisted_19 = ["colspan"];
|
|
6636
6851
|
const _sfc_main$43 = /*@__PURE__*/ defineComponent({
|
|
6637
6852
|
__name: "TableRender",
|
|
6638
6853
|
props: {
|
|
@@ -6813,7 +7028,6 @@ const _sfc_main$43 = /*@__PURE__*/ defineComponent({
|
|
|
6813
7028
|
});
|
|
6814
7029
|
/** 总列数 = 可见业务列 + 选择列(空态 colspan 与骨架行,S8/R23) */
|
|
6815
7030
|
const columnCount = computed(() => visibleColumns.value.length + (hasSelection.value ? 1 : 0));
|
|
6816
|
-
/** 选择列在 sticky 映射中的哨兵键(选择列不在 columns 内,模板单独渲染) */
|
|
6817
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。`);
|
|
6818
7032
|
/** sticky 单元格映射(纯渲染层 computed,不进 TanStack pinning state):
|
|
6819
7033
|
* 选择列视作最左 fixed 列参与累计(offset 0);fixed-left 按列序累加,
|
|
@@ -6859,26 +7073,6 @@ const _sfc_main$43 = /*@__PURE__*/ defineComponent({
|
|
|
6859
7073
|
}
|
|
6860
7074
|
return map;
|
|
6861
7075
|
});
|
|
6862
|
-
/** sticky 定位样式;head 为 true 时 z-index 高于表体(表头 sticky 压住表体 sticky) */
|
|
6863
|
-
function stickyStyle(key, head) {
|
|
6864
|
-
const sticky = stickyOf.value.get(key);
|
|
6865
|
-
if (!sticky) return void 0;
|
|
6866
|
-
return {
|
|
6867
|
-
position: "sticky",
|
|
6868
|
-
[sticky.side]: `${sticky.offset}px`,
|
|
6869
|
-
zIndex: head ? 20 : 10
|
|
6870
|
-
};
|
|
6871
|
-
}
|
|
6872
|
-
/** sticky 底色(防滚动透出)与交界分隔边框 */
|
|
6873
|
-
function stickyClass(key) {
|
|
6874
|
-
const sticky = stickyOf.value.get(key);
|
|
6875
|
-
if (!sticky) return void 0;
|
|
6876
|
-
return [
|
|
6877
|
-
"bg-background",
|
|
6878
|
-
sticky.side === "left" && sticky.edge ? "border-r border-border" : "",
|
|
6879
|
-
sticky.side === "right" && sticky.edge ? "border-l border-border" : ""
|
|
6880
|
-
];
|
|
6881
|
-
}
|
|
6882
7076
|
/** 表头全选三态(S10):本页可选行与选中集求交派生(TanStack getter 追踪不稳,自算) */
|
|
6883
7077
|
const selectableKeys = computed(() => rows.value.filter((row) => row.getCanSelect()).map((row) => rowKeyOf(row.original, row.index)));
|
|
6884
7078
|
const headerChecked = computed(() => hasSelection.value && selection.value.type === "checkbox" && selectableKeys.value.length > 0 && selectableKeys.value.every((key) => selectedKeys.value.has(key)));
|
|
@@ -6960,9 +7154,11 @@ const _sfc_main$43 = /*@__PURE__*/ defineComponent({
|
|
|
6960
7154
|
const items = virtualRows.value;
|
|
6961
7155
|
return items.length === 0 ? 0 : Math.max(0, virtualTotal.value - items[items.length - 1].end);
|
|
6962
7156
|
});
|
|
6963
|
-
/** 行高动态测量:measureElement 读 data-index
|
|
7157
|
+
/** 行高动态测量:measureElement 读 data-index 把实测高度写回(行内容高度可变,不假设固定行高)。
|
|
7158
|
+
* 行组件为函数 ref,拿到的是组件实例,需经 $el 取真实 tr。 */
|
|
6964
7159
|
function measureRow(node) {
|
|
6965
|
-
|
|
7160
|
+
const el = node instanceof Element ? node : node?.$el;
|
|
7161
|
+
if (el instanceof Element) virtualizerRef?.value.measureElement(el);
|
|
6966
7162
|
}
|
|
6967
7163
|
/** aria-sort 仅在该列当前被排序时标注(R16) */
|
|
6968
7164
|
function ariaSort(column) {
|
|
@@ -6973,10 +7169,6 @@ const _sfc_main$43 = /*@__PURE__*/ defineComponent({
|
|
|
6973
7169
|
const direction = instance.sort.value?.key === column.key ? instance.sort.value.direction : "";
|
|
6974
7170
|
return direction === "asc" ? "↑" : direction === "desc" ? "↓" : "";
|
|
6975
7171
|
}
|
|
6976
|
-
function cellText(line, index) {
|
|
6977
|
-
const value = line.cells[index];
|
|
6978
|
-
return isVNode(value) ? "" : String(value ?? "");
|
|
6979
|
-
}
|
|
6980
7172
|
function onSort(key) {
|
|
6981
7173
|
instance.toggleSort(key);
|
|
6982
7174
|
emit("sort-change", instance.sort.value);
|
|
@@ -7018,15 +7210,6 @@ const _sfc_main$43 = /*@__PURE__*/ defineComponent({
|
|
|
7018
7210
|
function onCellClick(record, columnKey, index, event) {
|
|
7019
7211
|
emit("cell-click", record, columnKey, index, event);
|
|
7020
7212
|
}
|
|
7021
|
-
/** ellipsis: "tooltip" 的单元格内容:默认插槽承载截断内容(触发元素本体,不额外包裹),content 显示完整文本。
|
|
7022
|
-
* VNode(render 工厂)单元格经 cloneVNode 复制进触发位(VNode 不可二次挂载)。 */
|
|
7023
|
-
function tooltipCell(value, text) {
|
|
7024
|
-
const trigger = isVNode(value) ? cloneVNode(value) : h("span", { class: "block truncate" }, text);
|
|
7025
|
-
return h(_sfc_main$47, {
|
|
7026
|
-
delayDuration: 0,
|
|
7027
|
-
content: text
|
|
7028
|
-
}, { default: () => [trigger] });
|
|
7029
|
-
}
|
|
7030
7213
|
__expose({
|
|
7031
7214
|
table: instance.table,
|
|
7032
7215
|
page: instance.page,
|
|
@@ -7045,9 +7228,9 @@ const _sfc_main$43 = /*@__PURE__*/ defineComponent({
|
|
|
7045
7228
|
clearSelection: instance.clearSelection
|
|
7046
7229
|
});
|
|
7047
7230
|
return (_ctx, _cache) => {
|
|
7048
|
-
return openBlock(), createElementBlock("div",
|
|
7231
|
+
return openBlock(), createElementBlock("div", { class: normalizeClass(unref(cn)("w-full", _ctx.$attrs.class)) }, [
|
|
7049
7232
|
createCommentVNode(" 搜索区 + 列设置触发器:同行右对齐(items-end);无搜索时触发器位于表格上方 "),
|
|
7050
|
-
unref(search) || showColumnSettings.value ? (openBlock(), createElementBlock("div",
|
|
7233
|
+
unref(search) || showColumnSettings.value ? (openBlock(), createElementBlock("div", _hoisted_1$8, [
|
|
7051
7234
|
unref(search) ? (openBlock(), createBlock(unref(_sfc_main$25), {
|
|
7052
7235
|
key: 0,
|
|
7053
7236
|
class: "min-w-0 flex-1",
|
|
@@ -7063,18 +7246,18 @@ const _sfc_main$43 = /*@__PURE__*/ defineComponent({
|
|
|
7063
7246
|
"content-class": "w-56 p-0"
|
|
7064
7247
|
}, {
|
|
7065
7248
|
content: withCtx(() => [
|
|
7066
|
-
createElementVNode("div",
|
|
7249
|
+
createElementVNode("div", _hoisted_2$7, [createElementVNode("button", {
|
|
7067
7250
|
type: "button",
|
|
7068
7251
|
class: "text-muted-foreground hover:text-foreground cursor-pointer text-xs disabled:cursor-not-allowed disabled:opacity-50",
|
|
7069
7252
|
disabled: allColumnsVisible.value,
|
|
7070
7253
|
onClick: selectAllColumns
|
|
7071
|
-
}, " 全选 ", 8,
|
|
7254
|
+
}, " 全选 ", 8, _hoisted_3$4), createElementVNode("button", {
|
|
7072
7255
|
type: "button",
|
|
7073
7256
|
class: "text-muted-foreground hover:text-foreground cursor-pointer text-xs",
|
|
7074
7257
|
onClick: resetColumns
|
|
7075
7258
|
}, " 重置 ")]),
|
|
7076
7259
|
createVNode(unref(_sfc_main$38)),
|
|
7077
|
-
createElementVNode("div",
|
|
7260
|
+
createElementVNode("div", _hoisted_4$2, [(openBlock(true), createElementBlock(Fragment, null, renderList(columns.value, (column) => {
|
|
7078
7261
|
return openBlock(), createElementBlock("div", {
|
|
7079
7262
|
key: column.key,
|
|
7080
7263
|
"data-column-item": "",
|
|
@@ -7085,12 +7268,17 @@ const _sfc_main$43 = /*@__PURE__*/ defineComponent({
|
|
|
7085
7268
|
createVNode(unref(_sfc_main$9), {
|
|
7086
7269
|
checked: isColumnVisible(column.key),
|
|
7087
7270
|
disabled: !canHideColumn(column.key),
|
|
7271
|
+
"onUpdate:checked": ($event) => toggleColumnVisible(column.key),
|
|
7088
7272
|
onClick: _cache[2] || (_cache[2] = withModifiers(() => {}, ["stop"]))
|
|
7089
|
-
}, null, 8, [
|
|
7090
|
-
|
|
7273
|
+
}, null, 8, [
|
|
7274
|
+
"checked",
|
|
7275
|
+
"disabled",
|
|
7276
|
+
"onUpdate:checked"
|
|
7277
|
+
]),
|
|
7278
|
+
createElementVNode("span", _hoisted_6$1, toDisplayString(column.title), 1),
|
|
7091
7279
|
createCommentVNode(" 有效 fixed 列(数字 width)标识 "),
|
|
7092
|
-
column.fixed !== void 0 && typeof column.width === "number" ? (openBlock(), createElementBlock("svg",
|
|
7093
|
-
], 8,
|
|
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);
|
|
7094
7282
|
}), 128))])
|
|
7095
7283
|
]),
|
|
7096
7284
|
default: withCtx(() => [createVNode(unref(_sfc_main$5), {
|
|
@@ -7101,7 +7289,7 @@ const _sfc_main$43 = /*@__PURE__*/ defineComponent({
|
|
|
7101
7289
|
onPointerenter: _cache[0] || (_cache[0] = ($event) => settingsTipOpen.value = true),
|
|
7102
7290
|
onPointerleave: _cache[1] || (_cache[1] = ($event) => settingsTipOpen.value = false)
|
|
7103
7291
|
}, {
|
|
7104
|
-
default: withCtx(() => [createCommentVNode(" lucide Settings2(内联 SVG,跟随项目图标现状) "), _cache[
|
|
7292
|
+
default: withCtx(() => [createCommentVNode(" lucide Settings2(内联 SVG,跟随项目图标现状) "), _cache[3] || (_cache[3] = createElementVNode("svg", {
|
|
7105
7293
|
xmlns: "http://www.w3.org/2000/svg",
|
|
7106
7294
|
viewBox: "0 0 24 24",
|
|
7107
7295
|
fill: "none",
|
|
@@ -7145,7 +7333,7 @@ const _sfc_main$43 = /*@__PURE__*/ defineComponent({
|
|
|
7145
7333
|
height: scrollHeight.value,
|
|
7146
7334
|
overflowY: "auto"
|
|
7147
7335
|
} : void 0)
|
|
7148
|
-
}, [createElementVNode("table",
|
|
7336
|
+
}, [createElementVNode("table", _hoisted_8, [createElementVNode("thead", {
|
|
7149
7337
|
ref_key: "theadEl",
|
|
7150
7338
|
ref: theadEl,
|
|
7151
7339
|
class: "[&_tr]:border-b"
|
|
@@ -7154,8 +7342,8 @@ const _sfc_main$43 = /*@__PURE__*/ defineComponent({
|
|
|
7154
7342
|
hasSelection.value ? (openBlock(), createElementBlock("th", {
|
|
7155
7343
|
key: 0,
|
|
7156
7344
|
scope: "col",
|
|
7157
|
-
class: normalizeClass(["h-10 w-12 px-2 align-middle font-medium text-muted-foreground", stickyClass(SELECTION_CELL)]),
|
|
7158
|
-
style: normalizeStyle([{ width: `${selection.value.width}px` }, stickyStyle(SELECTION_CELL, true)])
|
|
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)])
|
|
7159
7347
|
}, [selection.value.type === "checkbox" ? (openBlock(), createBlock(unref(_sfc_main$9), {
|
|
7160
7348
|
key: 0,
|
|
7161
7349
|
checked: headerIndeterminate.value ? "indeterminate" : headerChecked.value,
|
|
@@ -7166,20 +7354,20 @@ const _sfc_main$43 = /*@__PURE__*/ defineComponent({
|
|
|
7166
7354
|
return openBlock(), createElementBlock("th", {
|
|
7167
7355
|
key: column.key,
|
|
7168
7356
|
scope: "col",
|
|
7169
|
-
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)]),
|
|
7170
7358
|
style: normalizeStyle([{
|
|
7171
7359
|
width: column.width,
|
|
7172
7360
|
textAlign: column.align
|
|
7173
|
-
}, stickyStyle(column.key, true)]),
|
|
7361
|
+
}, unref(stickyStyle)(stickyOf.value, column.key, true)]),
|
|
7174
7362
|
"aria-sort": ariaSort(column)
|
|
7175
7363
|
}, [column.sortable ? (openBlock(), createElementBlock("button", {
|
|
7176
7364
|
key: 0,
|
|
7177
7365
|
type: "button",
|
|
7178
7366
|
class: "inline-flex items-center gap-1 hover:text-foreground",
|
|
7179
7367
|
onClick: ($event) => onSort(column.key)
|
|
7180
|
-
}, [createTextVNode(toDisplayString(column.title) + " ", 1), createElementVNode("span",
|
|
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);
|
|
7181
7369
|
}), 128))
|
|
7182
|
-
])], 512), createElementVNode("tbody",
|
|
7370
|
+
])], 512), createElementVNode("tbody", _hoisted_12, [
|
|
7183
7371
|
createCommentVNode(" 加载态:固定 5 行骨架(R14);选择列一并占位(S8);骨架不虚拟化;loading 判定优先 "),
|
|
7184
7372
|
loading.value ? (openBlock(), createElementBlock(Fragment, { key: 0 }, renderList(SKELETON_ROWS, (row) => {
|
|
7185
7373
|
return createElementVNode("tr", {
|
|
@@ -7187,29 +7375,29 @@ const _sfc_main$43 = /*@__PURE__*/ defineComponent({
|
|
|
7187
7375
|
"data-skeleton": ""
|
|
7188
7376
|
}, [hasSelection.value ? (openBlock(), createElementBlock("td", {
|
|
7189
7377
|
key: 0,
|
|
7190
|
-
class: normalizeClass(["p-2 align-middle", stickyClass(SELECTION_CELL)]),
|
|
7191
|
-
style: normalizeStyle(stickyStyle(SELECTION_CELL, false))
|
|
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))
|
|
7192
7380
|
}, [createVNode(unref(_sfc_main$39), { class: "size-4" })], 6)) : createCommentVNode("v-if", true), (openBlock(true), createElementBlock(Fragment, null, renderList(visibleColumns.value, (column) => {
|
|
7193
7381
|
return openBlock(), createElementBlock("td", {
|
|
7194
7382
|
key: column.key,
|
|
7195
|
-
class: normalizeClass(["p-2 align-middle", stickyClass(column.key)]),
|
|
7196
|
-
style: normalizeStyle([{ textAlign: column.align }, stickyStyle(column.key, false)])
|
|
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)])
|
|
7197
7385
|
}, [createVNode(unref(_sfc_main$39), { class: "h-4 w-full" })], 6);
|
|
7198
7386
|
}), 128))]);
|
|
7199
|
-
}), 64)) : showError.value ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [createCommentVNode(" 错误态:error 优先于正常数据;插槽可自定义(slot props { error, retry }) "), createElementVNode("tr",
|
|
7387
|
+
}), 64)) : showError.value ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [createCommentVNode(" 错误态:error 优先于正常数据;插槽可自定义(slot props { error, retry }) "), createElementVNode("tr", _hoisted_13, [createElementVNode("td", {
|
|
7200
7388
|
colspan: columnCount.value,
|
|
7201
7389
|
class: "p-8 text-center text-muted-foreground"
|
|
7202
7390
|
}, [renderSlot(_ctx.$slots, "error", {
|
|
7203
7391
|
error: loadError.value,
|
|
7204
7392
|
retry
|
|
7205
|
-
}, () => [createElementVNode("div",
|
|
7393
|
+
}, () => [createElementVNode("div", _hoisted_15, [createElementVNode("p", null, toDisplayString(loadError.value?.message ?? "加载失败"), 1), createVNode(unref(_sfc_main$5), {
|
|
7206
7394
|
variant: "outline",
|
|
7207
7395
|
size: "sm",
|
|
7208
7396
|
onClick: retry
|
|
7209
7397
|
}, {
|
|
7210
|
-
default: withCtx(() => [..._cache[
|
|
7398
|
+
default: withCtx(() => [..._cache[5] || (_cache[5] = [createTextVNode("重试", -1)])]),
|
|
7211
7399
|
_: 1
|
|
7212
|
-
})])])], 8,
|
|
7400
|
+
})])])], 8, _hoisted_14)])], 64)) : unref(virtualEnabled) ? (openBlock(), createElementBlock(Fragment, { key: 2 }, [
|
|
7213
7401
|
createCommentVNode(" 虚拟滚动:窗口行 + 前后占位行(总高撑开滚动区间;行高经 measureElement 动态测量) "),
|
|
7214
7402
|
createElementVNode("tr", {
|
|
7215
7403
|
"aria-hidden": "true",
|
|
@@ -7218,79 +7406,38 @@ const _sfc_main$43 = /*@__PURE__*/ defineComponent({
|
|
|
7218
7406
|
}, [createElementVNode("td", {
|
|
7219
7407
|
colspan: columnCount.value,
|
|
7220
7408
|
class: "border-0 p-0"
|
|
7221
|
-
}, null, 8,
|
|
7409
|
+
}, null, 8, _hoisted_16)], 4),
|
|
7222
7410
|
(openBlock(true), createElementBlock(Fragment, null, renderList(virtualLines.value, (item) => {
|
|
7223
|
-
return openBlock(),
|
|
7411
|
+
return openBlock(), createBlock(_sfc_main$52, {
|
|
7224
7412
|
key: item.line.key,
|
|
7225
7413
|
ref_for: true,
|
|
7226
7414
|
ref: measureRow,
|
|
7227
7415
|
"data-index": item.row.index,
|
|
7228
|
-
|
|
7229
|
-
|
|
7230
|
-
|
|
7231
|
-
|
|
7232
|
-
|
|
7233
|
-
|
|
7234
|
-
|
|
7235
|
-
|
|
7236
|
-
|
|
7237
|
-
|
|
7238
|
-
|
|
7239
|
-
|
|
7240
|
-
|
|
7241
|
-
|
|
7242
|
-
|
|
7243
|
-
|
|
7244
|
-
|
|
7245
|
-
|
|
7246
|
-
|
|
7247
|
-
|
|
7248
|
-
|
|
7249
|
-
|
|
7250
|
-
|
|
7251
|
-
|
|
7252
|
-
|
|
7253
|
-
}, null, 8, [
|
|
7254
|
-
"checked",
|
|
7255
|
-
"disabled",
|
|
7256
|
-
"aria-label",
|
|
7257
|
-
"onUpdate:checked"
|
|
7258
|
-
]))], 6)) : createCommentVNode("v-if", true),
|
|
7259
|
-
(openBlock(true), createElementBlock(Fragment, null, renderList(item.line.cells, (value, index) => {
|
|
7260
|
-
return openBlock(), createElementBlock("td", {
|
|
7261
|
-
key: visibleColumns.value[index].key,
|
|
7262
|
-
class: normalizeClass(["p-2 align-middle", [stickyClass(visibleColumns.value[index].key), { truncate: visibleColumns.value[index].ellipsis === true }]]),
|
|
7263
|
-
title: visibleColumns.value[index].ellipsis === true ? cellText(item.line, index) : void 0,
|
|
7264
|
-
style: normalizeStyle([{ textAlign: visibleColumns.value[index].align }, stickyStyle(visibleColumns.value[index].key, false)]),
|
|
7265
|
-
onClick: ($event) => onCellClick(item.line.record, visibleColumns.value[index].key, item.line.index, $event)
|
|
7266
|
-
}, [createCommentVNode(" 首列(tree 启用时):depth 缩进 + 展开 caret(点击 stop 避免误触发行点击) "), unref(tree) && index === 0 ? (openBlock(), createElementBlock("span", {
|
|
7267
|
-
key: 0,
|
|
7268
|
-
class: "inline-flex max-w-full items-center gap-1",
|
|
7269
|
-
style: normalizeStyle({ marginLeft: `${item.line.row.depth * unref(treeIndent)}px` })
|
|
7270
|
-
}, [
|
|
7271
|
-
item.line.row.getCanExpand() ? (openBlock(), createElementBlock("button", {
|
|
7272
|
-
key: 0,
|
|
7273
|
-
type: "button",
|
|
7274
|
-
class: "hover:bg-muted text-muted-foreground inline-flex size-4 shrink-0 cursor-pointer items-center justify-center rounded-sm",
|
|
7275
|
-
"aria-expanded": item.line.row.getIsExpanded(),
|
|
7276
|
-
"aria-label": item.line.row.getIsExpanded() ? "收起" : "展开",
|
|
7277
|
-
onClick: withModifiers(($event) => item.line.row.toggleExpanded(), ["stop"])
|
|
7278
|
-
}, [(openBlock(), createElementBlock("svg", {
|
|
7279
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
7280
|
-
viewBox: "0 0 24 24",
|
|
7281
|
-
fill: "none",
|
|
7282
|
-
stroke: "currentColor",
|
|
7283
|
-
"stroke-width": "2",
|
|
7284
|
-
"stroke-linecap": "round",
|
|
7285
|
-
"stroke-linejoin": "round",
|
|
7286
|
-
class: normalizeClass(["size-3.5 transition-transform", { "rotate-90": item.line.row.getIsExpanded() }]),
|
|
7287
|
-
"aria-hidden": "true"
|
|
7288
|
-
}, [..._cache[8] || (_cache[8] = [createElementVNode("path", { d: "m9 18 6-6-6-6" }, null, -1)])], 2))], 8, _hoisted_21)) : createCommentVNode("v-if", true),
|
|
7289
|
-
createCommentVNode(" VNode 必须走子节点渲染;文本插值会序列化 vnode 导致循环引用 "),
|
|
7290
|
-
isVNode(value) ? (openBlock(), createBlock(resolveDynamicComponent(value), { key: 1 })) : (openBlock(), createElementBlock("span", _hoisted_22, toDisplayString(value), 1))
|
|
7291
|
-
], 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);
|
|
7292
|
-
}), 128))
|
|
7293
|
-
], 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
|
+
]);
|
|
7294
7441
|
}), 128)),
|
|
7295
7442
|
createElementVNode("tr", {
|
|
7296
7443
|
"aria-hidden": "true",
|
|
@@ -7299,82 +7446,40 @@ const _sfc_main$43 = /*@__PURE__*/ defineComponent({
|
|
|
7299
7446
|
}, [createElementVNode("td", {
|
|
7300
7447
|
colspan: columnCount.value,
|
|
7301
7448
|
class: "border-0 p-0"
|
|
7302
|
-
}, null, 8,
|
|
7449
|
+
}, null, 8, _hoisted_17)], 4)
|
|
7303
7450
|
], 64)) : (openBlock(true), createElementBlock(Fragment, { key: 3 }, renderList(body.value, (line) => {
|
|
7304
|
-
return openBlock(),
|
|
7451
|
+
return openBlock(), createBlock(_sfc_main$52, {
|
|
7305
7452
|
key: line.key,
|
|
7306
|
-
|
|
7307
|
-
|
|
7308
|
-
|
|
7309
|
-
|
|
7310
|
-
|
|
7311
|
-
|
|
7312
|
-
|
|
7313
|
-
|
|
7314
|
-
|
|
7315
|
-
|
|
7316
|
-
|
|
7317
|
-
|
|
7318
|
-
|
|
7319
|
-
|
|
7320
|
-
|
|
7321
|
-
|
|
7322
|
-
|
|
7323
|
-
|
|
7324
|
-
|
|
7325
|
-
|
|
7326
|
-
|
|
7327
|
-
|
|
7328
|
-
|
|
7329
|
-
|
|
7330
|
-
"onUpdate:checked": (checked) => onRowSelect(line, checked)
|
|
7331
|
-
}, null, 8, [
|
|
7332
|
-
"checked",
|
|
7333
|
-
"disabled",
|
|
7334
|
-
"aria-label",
|
|
7335
|
-
"onUpdate:checked"
|
|
7336
|
-
]))], 6)) : createCommentVNode("v-if", true),
|
|
7337
|
-
(openBlock(true), createElementBlock(Fragment, null, renderList(line.cells, (value, index) => {
|
|
7338
|
-
return openBlock(), createElementBlock("td", {
|
|
7339
|
-
key: visibleColumns.value[index].key,
|
|
7340
|
-
class: normalizeClass(["p-2 align-middle", [stickyClass(visibleColumns.value[index].key), { truncate: visibleColumns.value[index].ellipsis === true }]]),
|
|
7341
|
-
title: visibleColumns.value[index].ellipsis === true ? cellText(line, index) : void 0,
|
|
7342
|
-
style: normalizeStyle([{ textAlign: visibleColumns.value[index].align }, stickyStyle(visibleColumns.value[index].key, false)]),
|
|
7343
|
-
onClick: ($event) => onCellClick(line.record, visibleColumns.value[index].key, line.index, $event)
|
|
7344
|
-
}, [createCommentVNode(" 首列(tree 启用时):depth 缩进 + 展开 caret(点击 stop 避免误触发行点击) "), unref(tree) && index === 0 ? (openBlock(), createElementBlock("span", {
|
|
7345
|
-
key: 0,
|
|
7346
|
-
class: "inline-flex max-w-full items-center gap-1",
|
|
7347
|
-
style: normalizeStyle({ marginLeft: `${line.row.depth * unref(treeIndent)}px` })
|
|
7348
|
-
}, [
|
|
7349
|
-
line.row.getCanExpand() ? (openBlock(), createElementBlock("button", {
|
|
7350
|
-
key: 0,
|
|
7351
|
-
type: "button",
|
|
7352
|
-
class: "hover:bg-muted text-muted-foreground inline-flex size-4 shrink-0 cursor-pointer items-center justify-center rounded-sm",
|
|
7353
|
-
"aria-expanded": line.row.getIsExpanded(),
|
|
7354
|
-
"aria-label": line.row.getIsExpanded() ? "收起" : "展开",
|
|
7355
|
-
onClick: withModifiers(($event) => line.row.toggleExpanded(), ["stop"])
|
|
7356
|
-
}, [(openBlock(), createElementBlock("svg", {
|
|
7357
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
7358
|
-
viewBox: "0 0 24 24",
|
|
7359
|
-
fill: "none",
|
|
7360
|
-
stroke: "currentColor",
|
|
7361
|
-
"stroke-width": "2",
|
|
7362
|
-
"stroke-linecap": "round",
|
|
7363
|
-
"stroke-linejoin": "round",
|
|
7364
|
-
class: normalizeClass(["size-3.5 transition-transform", { "rotate-90": line.row.getIsExpanded() }]),
|
|
7365
|
-
"aria-hidden": "true"
|
|
7366
|
-
}, [..._cache[9] || (_cache[9] = [createElementVNode("path", { d: "m9 18 6-6-6-6" }, null, -1)])], 2))], 8, _hoisted_27)) : createCommentVNode("v-if", true),
|
|
7367
|
-
createCommentVNode(" VNode 必须走子节点渲染;文本插值会序列化 vnode 导致循环引用 "),
|
|
7368
|
-
isVNode(value) ? (openBlock(), createBlock(resolveDynamicComponent(value), { key: 1 })) : (openBlock(), createElementBlock("span", _hoisted_28, toDisplayString(value), 1))
|
|
7369
|
-
], 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);
|
|
7370
|
-
}), 128))
|
|
7371
|
-
], 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
|
+
]);
|
|
7372
7477
|
}), 128)),
|
|
7373
7478
|
createCommentVNode(" 空态:横跨全列的单单元格,不虚拟化;错误态优先 "),
|
|
7374
|
-
!loading.value && !showError.value && body.value.length === 0 ? (openBlock(), createElementBlock("tr",
|
|
7479
|
+
!loading.value && !showError.value && body.value.length === 0 ? (openBlock(), createElementBlock("tr", _hoisted_18, [createElementVNode("td", {
|
|
7375
7480
|
colspan: columnCount.value,
|
|
7376
7481
|
class: "p-8 text-center text-muted-foreground"
|
|
7377
|
-
}, [renderSlot(_ctx.$slots, "empty", {}, () => [createTextVNode(toDisplayString(__props.emptyText ?? "暂无数据"), 1)])], 8,
|
|
7482
|
+
}, [renderSlot(_ctx.$slots, "empty", {}, () => [createTextVNode(toDisplayString(__props.emptyText ?? "暂无数据"), 1)])], 8, _hoisted_19)])) : createCommentVNode("v-if", true)
|
|
7378
7483
|
])])], 4),
|
|
7379
7484
|
showPagination.value ? (openBlock(), createBlock(_sfc_main$51, {
|
|
7380
7485
|
key: 1,
|
|
@@ -7390,7 +7495,7 @@ const _sfc_main$43 = /*@__PURE__*/ defineComponent({
|
|
|
7390
7495
|
"page-size-opts",
|
|
7391
7496
|
"total"
|
|
7392
7497
|
])) : createCommentVNode("v-if", true)
|
|
7393
|
-
]);
|
|
7498
|
+
], 2);
|
|
7394
7499
|
};
|
|
7395
7500
|
}
|
|
7396
7501
|
});
|
|
@@ -7785,16 +7890,21 @@ const DEFAULTS = {
|
|
|
7785
7890
|
max: 3
|
|
7786
7891
|
};
|
|
7787
7892
|
let current = createToaster(DEFAULTS);
|
|
7893
|
+
let currentConfig = { ...DEFAULTS };
|
|
7788
7894
|
let providerMounted = false;
|
|
7789
7895
|
/**
|
|
7790
7896
|
* 按 props 重建单例内部 store(ToastProvider 挂载时调用)。
|
|
7791
|
-
*
|
|
7897
|
+
* 配置未变化时复用现有 store,避免 Provider 重挂载丢弃排队中的 toast。
|
|
7898
|
+
* 返回 store 供 Provider 的 <Toaster> 渲染使用。
|
|
7792
7899
|
*/
|
|
7793
7900
|
function __configureToaster(props = {}) {
|
|
7794
|
-
|
|
7901
|
+
const next = {
|
|
7795
7902
|
...DEFAULTS,
|
|
7796
7903
|
...props
|
|
7797
|
-
}
|
|
7904
|
+
};
|
|
7905
|
+
if (next.placement === currentConfig.placement && next.duration === currentConfig.duration && next.max === currentConfig.max) return current;
|
|
7906
|
+
currentConfig = next;
|
|
7907
|
+
current = createToaster(next);
|
|
7798
7908
|
return current;
|
|
7799
7909
|
}
|
|
7800
7910
|
/** 标记 Provider 已挂载/已卸载(Provider 生命周期与测试用) */
|
|
@@ -8022,6 +8132,40 @@ const _sfc_main$46 = /*@__PURE__*/ defineComponent({
|
|
|
8022
8132
|
}
|
|
8023
8133
|
});
|
|
8024
8134
|
//#endregion
|
|
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
|
|
8025
8169
|
//#region src/components/alert-dialog/AlertDialog.vue
|
|
8026
8170
|
const _hoisted_1$2 = { class: "flex flex-col gap-2 text-center sm:text-left" };
|
|
8027
8171
|
const _hoisted_2$2 = { class: "flex flex-col-reverse gap-2 sm:flex-row sm:justify-end" };
|
|
@@ -8078,54 +8222,33 @@ const _sfc_main$1 = /*@__PURE__*/ defineComponent({
|
|
|
8078
8222
|
const props = __props;
|
|
8079
8223
|
const emit = __emit;
|
|
8080
8224
|
const instance = getCurrentInstance();
|
|
8081
|
-
const
|
|
8082
|
-
|
|
8225
|
+
const { isOpen, setOpen } = useControlledBoolean({
|
|
8226
|
+
controlled: () => props.open,
|
|
8227
|
+
onChange: (open) => emit("update:open", open)
|
|
8228
|
+
});
|
|
8083
8229
|
function handleUpdate(open) {
|
|
8084
8230
|
if (!open && loading.value) return;
|
|
8085
|
-
|
|
8086
|
-
emit("update:open", open);
|
|
8231
|
+
setOpen(open);
|
|
8087
8232
|
}
|
|
8088
8233
|
/** 关闭弹窗:走受控桥把 open 置 false,退出动画/焦点还原由 zag 处理 */
|
|
8089
8234
|
function close() {
|
|
8090
8235
|
handleUpdate(false);
|
|
8091
8236
|
}
|
|
8092
|
-
const loading =
|
|
8093
|
-
|
|
8094
|
-
|
|
8095
|
-
|
|
8096
|
-
|
|
8097
|
-
|
|
8098
|
-
|
|
8099
|
-
function handleConfirm() {
|
|
8100
|
-
if (loading.value) return;
|
|
8101
|
-
const handler = instance?.vnode.props?.onConfirm;
|
|
8102
|
-
const result = handler?.();
|
|
8103
|
-
if (!handler) emit("confirm");
|
|
8104
|
-
if (result instanceof Promise) {
|
|
8105
|
-
loading.value = true;
|
|
8106
|
-
result.then(() => {
|
|
8107
|
-
loading.value = false;
|
|
8108
|
-
close();
|
|
8109
|
-
}).catch(() => {
|
|
8110
|
-
loading.value = false;
|
|
8111
|
-
});
|
|
8112
|
-
} else close();
|
|
8113
|
-
}
|
|
8114
|
-
/** 取消:pending 时同样锁定;确认关闭并派发 cancel */
|
|
8115
|
-
function handleCancel() {
|
|
8116
|
-
if (loading.value) return;
|
|
8117
|
-
emit("cancel");
|
|
8118
|
-
close();
|
|
8119
|
-
}
|
|
8120
|
-
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-md"));
|
|
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"));
|
|
8121
8244
|
return (_ctx, _cache) => {
|
|
8122
8245
|
return openBlock(), createBlock(unref(Dialog).Root, {
|
|
8123
|
-
open: isOpen
|
|
8124
|
-
"close-on-escape": !
|
|
8125
|
-
"close-on-interact-outside": !
|
|
8246
|
+
open: unref(isOpen),
|
|
8247
|
+
"close-on-escape": !unref(loading),
|
|
8248
|
+
"close-on-interact-outside": !unref(loading),
|
|
8126
8249
|
"onUpdate:open": handleUpdate
|
|
8127
8250
|
}, {
|
|
8128
|
-
default: withCtx(() => [createVNode(unref(Dialog).Backdrop, { class: "fixed inset-0 z-
|
|
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" }, {
|
|
8129
8252
|
default: withCtx(() => [createCommentVNode(" role=\"alertdialog\":覆盖 Ark Content 默认 role=\"dialog\",补偿无上游 AlertDialog 原语的角色语义 "), createVNode(unref(Dialog).Content, {
|
|
8130
8253
|
class: normalizeClass(contentClass.value),
|
|
8131
8254
|
role: "alertdialog",
|
|
@@ -8147,19 +8270,23 @@ const _sfc_main$1 = /*@__PURE__*/ defineComponent({
|
|
|
8147
8270
|
createCommentVNode(" 底部操作区:取消 outline,确认按 destructive 切换语义色;pending 时确认钮转 loading "),
|
|
8148
8271
|
createElementVNode("div", _hoisted_2$2, [createVNode(unref(_sfc_main$5), {
|
|
8149
8272
|
variant: "outline",
|
|
8150
|
-
disabled: loading
|
|
8151
|
-
onClick: handleCancel
|
|
8273
|
+
disabled: unref(loading),
|
|
8274
|
+
onClick: unref(handleCancel)
|
|
8152
8275
|
}, {
|
|
8153
8276
|
default: withCtx(() => [createTextVNode(toDisplayString(props.cancelText), 1)]),
|
|
8154
8277
|
_: 1
|
|
8155
|
-
}, 8, ["disabled"]), createVNode(unref(_sfc_main$5), {
|
|
8278
|
+
}, 8, ["disabled", "onClick"]), createVNode(unref(_sfc_main$5), {
|
|
8156
8279
|
variant: props.destructive ? "destructive" : "default",
|
|
8157
|
-
disabled: loading
|
|
8158
|
-
onClick: handleConfirm
|
|
8280
|
+
disabled: unref(loading),
|
|
8281
|
+
onClick: unref(handleConfirm)
|
|
8159
8282
|
}, {
|
|
8160
|
-
default: withCtx(() => [loading
|
|
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)]),
|
|
8161
8284
|
_: 1
|
|
8162
|
-
}, 8, [
|
|
8285
|
+
}, 8, [
|
|
8286
|
+
"variant",
|
|
8287
|
+
"disabled",
|
|
8288
|
+
"onClick"
|
|
8289
|
+
])])
|
|
8163
8290
|
]),
|
|
8164
8291
|
_: 3
|
|
8165
8292
|
}, 8, ["class"])]),
|
|
@@ -8176,7 +8303,7 @@ const _sfc_main$1 = /*@__PURE__*/ defineComponent({
|
|
|
8176
8303
|
});
|
|
8177
8304
|
//#endregion
|
|
8178
8305
|
//#region src/components/context-menu/ContextMenu.vue
|
|
8179
|
-
const contentCls = "bg-popover text-popover-foreground z-
|
|
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";
|
|
8180
8307
|
const _sfc_main$10 = /*@__PURE__*/ defineComponent({
|
|
8181
8308
|
name: "ContextMenu",
|
|
8182
8309
|
inheritAttrs: false,
|
|
@@ -8203,9 +8330,9 @@ items: {
|
|
|
8203
8330
|
default: withCtx(() => [renderSlot(_ctx.$slots, "default")]),
|
|
8204
8331
|
_: 3
|
|
8205
8332
|
}),
|
|
8206
|
-
createVNode(unref(Menu).Positioner, { class: "z-
|
|
8333
|
+
createVNode(unref(Menu).Positioner, { class: "z-[var(--z-overlay)]" }, {
|
|
8207
8334
|
default: withCtx(() => [createVNode(unref(Menu).Content, mergeProps(unref(attrs), { class: unref(cn)(contentCls) }), {
|
|
8208
|
-
default: withCtx(() => [createVNode(_sfc_main$
|
|
8335
|
+
default: withCtx(() => [createVNode(_sfc_main$53, { items: props.items }, null, 8, ["items"])]),
|
|
8209
8336
|
_: 1
|
|
8210
8337
|
}, 16, ["class"])]),
|
|
8211
8338
|
_: 1
|
|
@@ -8279,15 +8406,14 @@ const _sfc_main$15 = /*@__PURE__*/ defineComponent({
|
|
|
8279
8406
|
setup(__props, { emit: __emit }) {
|
|
8280
8407
|
const props = __props;
|
|
8281
8408
|
const emit = __emit;
|
|
8282
|
-
const
|
|
8283
|
-
|
|
8284
|
-
|
|
8285
|
-
|
|
8286
|
-
|
|
8287
|
-
}
|
|
8409
|
+
const { isOpen, setOpen } = useControlledBoolean({
|
|
8410
|
+
controlled: () => props.open,
|
|
8411
|
+
defaultValue: () => props.defaultOpen,
|
|
8412
|
+
onChange: (open) => emit("update:open", open)
|
|
8413
|
+
});
|
|
8288
8414
|
/** 关闭抽屉(#footer 作用域插槽注入) */
|
|
8289
8415
|
function close() {
|
|
8290
|
-
|
|
8416
|
+
setOpen(false);
|
|
8291
8417
|
}
|
|
8292
8418
|
const hasHeader = computed(() => Boolean(props.title || props.description));
|
|
8293
8419
|
const placementConfig = {
|
|
@@ -8336,13 +8462,13 @@ const _sfc_main$15 = /*@__PURE__*/ defineComponent({
|
|
|
8336
8462
|
};
|
|
8337
8463
|
const config = computed(() => placementConfig[props.placement]);
|
|
8338
8464
|
const isLateral = computed(() => props.placement === "left" || props.placement === "right");
|
|
8339
|
-
const contentClass = computed(() => cn("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out fixed z-
|
|
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]));
|
|
8340
8466
|
return (_ctx, _cache) => {
|
|
8341
8467
|
return openBlock(), createBlock(unref(Drawer).Root, {
|
|
8342
|
-
open: isOpen
|
|
8468
|
+
open: unref(isOpen),
|
|
8343
8469
|
"lazy-mount": props.lazyMount,
|
|
8344
8470
|
"unmount-on-exit": props.unmountOnExit,
|
|
8345
|
-
"onUpdate:open":
|
|
8471
|
+
"onUpdate:open": unref(setOpen)
|
|
8346
8472
|
}, {
|
|
8347
8473
|
default: withCtx(() => [
|
|
8348
8474
|
_ctx.$slots.trigger ? (openBlock(), createBlock(unref(Drawer).Trigger, {
|
|
@@ -8352,8 +8478,8 @@ const _sfc_main$15 = /*@__PURE__*/ defineComponent({
|
|
|
8352
8478
|
default: withCtx(() => [renderSlot(_ctx.$slots, "trigger")]),
|
|
8353
8479
|
_: 3
|
|
8354
8480
|
})) : createCommentVNode("v-if", true),
|
|
8355
|
-
createVNode(unref(Drawer).Backdrop, { class: "fixed inset-0 z-
|
|
8356
|
-
createVNode(unref(Drawer).Positioner, { class: normalizeClass(unref(cn)("fixed inset-0 z-
|
|
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)) }, {
|
|
8357
8483
|
default: withCtx(() => [createVNode(unref(Drawer).Content, { class: normalizeClass(contentClass.value) }, {
|
|
8358
8484
|
default: withCtx(() => [
|
|
8359
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, {
|
|
@@ -8397,7 +8523,8 @@ const _sfc_main$15 = /*@__PURE__*/ defineComponent({
|
|
|
8397
8523
|
}, 8, [
|
|
8398
8524
|
"open",
|
|
8399
8525
|
"lazy-mount",
|
|
8400
|
-
"unmount-on-exit"
|
|
8526
|
+
"unmount-on-exit",
|
|
8527
|
+
"onUpdate:open"
|
|
8401
8528
|
]);
|
|
8402
8529
|
};
|
|
8403
8530
|
}
|
|
@@ -8466,47 +8593,27 @@ const _sfc_main$33 = /*@__PURE__*/ defineComponent({
|
|
|
8466
8593
|
const emit = __emit;
|
|
8467
8594
|
const attrs = useAttrs();
|
|
8468
8595
|
const instance = getCurrentInstance();
|
|
8469
|
-
const
|
|
8470
|
-
|
|
8471
|
-
|
|
8596
|
+
const { isOpen, setOpen } = useControlledBoolean({
|
|
8597
|
+
controlled: () => props.open,
|
|
8598
|
+
onChange: (open) => emit("update:open", open)
|
|
8599
|
+
});
|
|
8472
8600
|
function handleUpdate(open) {
|
|
8473
8601
|
if (!open && loading.value) return;
|
|
8474
|
-
|
|
8475
|
-
emit("update:open", open);
|
|
8602
|
+
setOpen(open);
|
|
8476
8603
|
}
|
|
8477
8604
|
/** 关闭气泡:走受控桥把 open 置 false,定位回退/动画由 zag 处理 */
|
|
8478
8605
|
function close() {
|
|
8479
8606
|
handleUpdate(false);
|
|
8480
8607
|
}
|
|
8481
|
-
|
|
8482
|
-
|
|
8483
|
-
|
|
8484
|
-
|
|
8485
|
-
|
|
8486
|
-
|
|
8487
|
-
if (loading.value) return;
|
|
8488
|
-
const handler = instance?.vnode.props?.onConfirm;
|
|
8489
|
-
const result = handler?.();
|
|
8490
|
-
if (!handler) emit("confirm");
|
|
8491
|
-
if (result instanceof Promise) {
|
|
8492
|
-
loading.value = true;
|
|
8493
|
-
result.then(() => {
|
|
8494
|
-
loading.value = false;
|
|
8495
|
-
close();
|
|
8496
|
-
}).catch(() => {
|
|
8497
|
-
loading.value = false;
|
|
8498
|
-
});
|
|
8499
|
-
} else close();
|
|
8500
|
-
}
|
|
8501
|
-
/** 取消:pending 期间锁定;派发 cancel 并关闭 */
|
|
8502
|
-
function handleCancel() {
|
|
8503
|
-
if (loading.value) return;
|
|
8504
|
-
emit("cancel");
|
|
8505
|
-
close();
|
|
8506
|
-
}
|
|
8608
|
+
const { loading, handleConfirm, handleCancel } = useConfirmPending({
|
|
8609
|
+
instance,
|
|
8610
|
+
emitConfirm: () => emit("confirm"),
|
|
8611
|
+
emitCancel: () => emit("cancel"),
|
|
8612
|
+
close
|
|
8613
|
+
});
|
|
8507
8614
|
return (_ctx, _cache) => {
|
|
8508
8615
|
return openBlock(), createElementBlock(Fragment, null, [createCommentVNode(" 薄壳复用 Popover:触发器 asChild、受控桥、定位与进出场动画均由 Popover 提供 "), createVNode(unref(_sfc_main$34), mergeProps(unref(attrs), {
|
|
8509
|
-
open: isOpen
|
|
8616
|
+
open: unref(isOpen),
|
|
8510
8617
|
"content-class": "w-64 p-3",
|
|
8511
8618
|
"onUpdate:open": handleUpdate
|
|
8512
8619
|
}), {
|
|
@@ -8526,20 +8633,24 @@ const _sfc_main$33 = /*@__PURE__*/ defineComponent({
|
|
|
8526
8633
|
createElementVNode("div", _hoisted_1, [createVNode(unref(_sfc_main$5), {
|
|
8527
8634
|
variant: "outline",
|
|
8528
8635
|
size: "sm",
|
|
8529
|
-
disabled: loading
|
|
8530
|
-
onClick: handleCancel
|
|
8636
|
+
disabled: unref(loading),
|
|
8637
|
+
onClick: unref(handleCancel)
|
|
8531
8638
|
}, {
|
|
8532
8639
|
default: withCtx(() => [createTextVNode(toDisplayString(props.cancelText), 1)]),
|
|
8533
8640
|
_: 1
|
|
8534
|
-
}, 8, ["disabled"]), createVNode(unref(_sfc_main$5), {
|
|
8641
|
+
}, 8, ["disabled", "onClick"]), createVNode(unref(_sfc_main$5), {
|
|
8535
8642
|
variant: props.variant === "destructive" ? "destructive" : "default",
|
|
8536
8643
|
size: "sm",
|
|
8537
|
-
disabled: loading
|
|
8538
|
-
onClick: handleConfirm
|
|
8644
|
+
disabled: unref(loading),
|
|
8645
|
+
onClick: unref(handleConfirm)
|
|
8539
8646
|
}, {
|
|
8540
|
-
default: withCtx(() => [loading
|
|
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)]),
|
|
8541
8648
|
_: 1
|
|
8542
|
-
}, 8, [
|
|
8649
|
+
}, 8, [
|
|
8650
|
+
"variant",
|
|
8651
|
+
"disabled",
|
|
8652
|
+
"onClick"
|
|
8653
|
+
])])
|
|
8543
8654
|
]),
|
|
8544
8655
|
default: withCtx(() => [renderSlot(_ctx.$slots, "default")]),
|
|
8545
8656
|
_: 3
|