@tu-design/vue 0.5.8 → 0.5.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +242 -158
- package/dist/index.mjs +1296 -516
- package/dist/registry/vue/alert-dialog.json +2 -2
- package/dist/registry/vue/alert.json +1 -1
- package/dist/registry/vue/avatar-group.json +1 -1
- package/dist/registry/vue/avatar.json +1 -1
- package/dist/registry/vue/badge.json +1 -1
- package/dist/registry/vue/button.json +1 -1
- package/dist/registry/vue/calendar.json +1 -1
- package/dist/registry/vue/card.json +1 -1
- package/dist/registry/vue/cascader.json +2 -2
- package/dist/registry/vue/checkbox.json +2 -2
- package/dist/registry/vue/context-menu.json +1 -1
- package/dist/registry/vue/currency-input.json +1 -1
- package/dist/registry/vue/date-picker.json +1 -1
- package/dist/registry/vue/date-range-picker.json +2 -2
- package/dist/registry/vue/date-shared.json +2 -2
- package/dist/registry/vue/dialog.json +2 -2
- package/dist/registry/vue/drawer.json +2 -2
- package/dist/registry/vue/dropdown-menu.json +1 -1
- package/dist/registry/vue/empty.json +1 -1
- package/dist/registry/vue/form-render.json +9 -9
- package/dist/registry/vue/form.json +2 -2
- package/dist/registry/vue/icon-shared.json +8 -2
- package/dist/registry/vue/input.json +2 -2
- package/dist/registry/vue/label.json +1 -1
- package/dist/registry/vue/month-picker.json +1 -1
- package/dist/registry/vue/number-input.json +1 -1
- package/dist/registry/vue/overlay-shared.json +1 -1
- package/dist/registry/vue/password-input.json +1 -1
- package/dist/registry/vue/pin-input.json +1 -1
- package/dist/registry/vue/popconfirm.json +1 -1
- package/dist/registry/vue/popover.json +2 -2
- package/dist/registry/vue/progress.json +1 -1
- package/dist/registry/vue/radio-group.json +1 -1
- package/dist/registry/vue/registry.json +54 -54
- package/dist/registry/vue/select.json +1 -1
- package/dist/registry/vue/separator.json +1 -1
- package/dist/registry/vue/skeleton.json +1 -1
- package/dist/registry/vue/slider.json +1 -1
- package/dist/registry/vue/slot.json +1 -1
- package/dist/registry/vue/spin.json +1 -1
- package/dist/registry/vue/switch.json +1 -1
- package/dist/registry/vue/table-render.json +24 -11
- package/dist/registry/vue/tabs.json +1 -1
- package/dist/registry/vue/textarea.json +2 -2
- package/dist/registry/vue/timeline.json +1 -1
- package/dist/registry/vue/toast.json +1 -1
- package/dist/registry/vue/tokens.json +2 -2
- package/dist/registry/vue/tooltip.json +1 -1
- package/dist/registry/vue/tree-select.json +2 -2
- package/dist/registry/vue/tree-shared.json +1 -1
- package/dist/registry/vue/utils.json +1 -1
- package/dist/registry/vue/week-picker.json +1 -1
- package/dist/registry/vue/year-picker.json +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -294,7 +294,7 @@ const _sfc_main$19 = defineComponent({
|
|
|
294
294
|
});
|
|
295
295
|
//#endregion
|
|
296
296
|
//#region src/components/form/FormDescription.vue
|
|
297
|
-
const _hoisted_1$
|
|
297
|
+
const _hoisted_1$33 = ["id"];
|
|
298
298
|
const _sfc_main$20 = /*@__PURE__*/ defineComponent({
|
|
299
299
|
__name: "FormDescription",
|
|
300
300
|
props: { class: {} },
|
|
@@ -308,37 +308,20 @@ const _sfc_main$20 = /*@__PURE__*/ defineComponent({
|
|
|
308
308
|
return openBlock(), createElementBlock("p", {
|
|
309
309
|
id: unref(itemCtx)?.descriptionId,
|
|
310
310
|
class: normalizeClass(unref(cn)("text-muted-foreground text-sm", props.class))
|
|
311
|
-
}, [renderSlot(_ctx.$slots, "default")], 10, _hoisted_1$
|
|
311
|
+
}, [renderSlot(_ctx.$slots, "default")], 10, _hoisted_1$33);
|
|
312
312
|
};
|
|
313
313
|
}
|
|
314
314
|
});
|
|
315
315
|
//#endregion
|
|
316
316
|
//#region src/components/form/FormField.vue
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
*
|
|
320
|
-
*
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
/** 字段名(TanStack 深层 key 的运行时形态) */
|
|
326
|
-
name: {
|
|
327
|
-
type: String,
|
|
328
|
-
required: true
|
|
329
|
-
},
|
|
330
|
-
/** 校验器配置,原样透传(值可为函数或 Standard Schema,如 valibot) */
|
|
331
|
-
validators: {
|
|
332
|
-
type: Object,
|
|
333
|
-
default: void 0
|
|
334
|
-
},
|
|
335
|
-
/** 字段模式:value 单值(默认);array 数组字段,解锁 pushValue/removeValue 等行操作 */
|
|
336
|
-
mode: {
|
|
337
|
-
type: String,
|
|
338
|
-
default: "value"
|
|
339
|
-
}
|
|
340
|
-
},
|
|
341
|
-
setup(props, { slots }) {
|
|
317
|
+
const _sfc_main$21 = defineComponent(
|
|
318
|
+
/**
|
|
319
|
+
* @param props - 组件 props(name/validators/mode)
|
|
320
|
+
* @param ctx - setup 上下文(slots/attrs/emit)
|
|
321
|
+
* @returns 渲染函数:Form 内渲染 TanStack form.Field 并捕获 field 实例;缺席时降级直渲插槽
|
|
322
|
+
*/
|
|
323
|
+
(props, ctx) => {
|
|
324
|
+
const { slots } = ctx;
|
|
342
325
|
const form = inject(FORM_KEY);
|
|
343
326
|
if (!form && import.meta.env.DEV) console.warn("[tu-design] <FormField> 必须在 <Form> 内使用");
|
|
344
327
|
const fieldRef = shallowRef();
|
|
@@ -355,11 +338,28 @@ const _sfc_main$21 = defineComponent({
|
|
|
355
338
|
fieldRef.value = slotProps.field;
|
|
356
339
|
return slots.default?.(slotProps);
|
|
357
340
|
} });
|
|
341
|
+
},
|
|
342
|
+
{
|
|
343
|
+
name: "TuFormField",
|
|
344
|
+
props: {
|
|
345
|
+
name: {
|
|
346
|
+
type: String,
|
|
347
|
+
required: true
|
|
348
|
+
},
|
|
349
|
+
validators: {
|
|
350
|
+
type: Object,
|
|
351
|
+
default: void 0
|
|
352
|
+
},
|
|
353
|
+
mode: {
|
|
354
|
+
type: String,
|
|
355
|
+
default: "value"
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
358
|
}
|
|
359
|
-
|
|
359
|
+
);
|
|
360
360
|
//#endregion
|
|
361
361
|
//#region src/components/form/FormItem.vue
|
|
362
|
-
const _hoisted_1$
|
|
362
|
+
const _hoisted_1$32 = ["data-invalid"];
|
|
363
363
|
const _sfc_main$22 = /*@__PURE__*/ defineComponent({
|
|
364
364
|
__name: "FormItem",
|
|
365
365
|
setup(__props) {
|
|
@@ -384,13 +384,13 @@ const _sfc_main$22 = /*@__PURE__*/ defineComponent({
|
|
|
384
384
|
return openBlock(), createElementBlock("div", {
|
|
385
385
|
class: normalizeClass(unref(cn)("group flex flex-col gap-1.5")),
|
|
386
386
|
"data-invalid": isInvalid.value ? "" : void 0
|
|
387
|
-
}, [renderSlot(_ctx.$slots, "default")], 10, _hoisted_1$
|
|
387
|
+
}, [renderSlot(_ctx.$slots, "default")], 10, _hoisted_1$32);
|
|
388
388
|
};
|
|
389
389
|
}
|
|
390
390
|
});
|
|
391
391
|
//#endregion
|
|
392
392
|
//#region src/components/form/FormLabel.vue
|
|
393
|
-
const _hoisted_1$
|
|
393
|
+
const _hoisted_1$31 = ["for", "data-invalid"];
|
|
394
394
|
const _sfc_main$23 = /*@__PURE__*/ defineComponent({
|
|
395
395
|
__name: "FormLabel",
|
|
396
396
|
props: { class: {} },
|
|
@@ -404,13 +404,13 @@ const _sfc_main$23 = /*@__PURE__*/ defineComponent({
|
|
|
404
404
|
for: unref(itemCtx)?.controlId,
|
|
405
405
|
"data-invalid": isInvalid.value ? "" : void 0,
|
|
406
406
|
class: normalizeClass(unref(cn)("text-sm font-medium leading-none data-invalid:text-destructive", props.class))
|
|
407
|
-
}, [renderSlot(_ctx.$slots, "default")], 10, _hoisted_1$
|
|
407
|
+
}, [renderSlot(_ctx.$slots, "default")], 10, _hoisted_1$31);
|
|
408
408
|
};
|
|
409
409
|
}
|
|
410
410
|
});
|
|
411
411
|
//#endregion
|
|
412
412
|
//#region src/components/form/FormMessage.vue
|
|
413
|
-
const _hoisted_1$
|
|
413
|
+
const _hoisted_1$30 = ["id"];
|
|
414
414
|
const _sfc_main$24 = /*@__PURE__*/ defineComponent({
|
|
415
415
|
__name: "FormMessage",
|
|
416
416
|
props: {
|
|
@@ -435,7 +435,7 @@ const _sfc_main$24 = /*@__PURE__*/ defineComponent({
|
|
|
435
435
|
key: 0,
|
|
436
436
|
id: unref(itemCtx)?.messageId,
|
|
437
437
|
class: normalizeClass(unref(cn)("text-destructive text-sm", props.class))
|
|
438
|
-
}, toDisplayString(errorText.value), 11, _hoisted_1$
|
|
438
|
+
}, toDisplayString(errorText.value), 11, _hoisted_1$30)) : createCommentVNode("v-if", true);
|
|
439
439
|
};
|
|
440
440
|
}
|
|
441
441
|
});
|
|
@@ -465,7 +465,7 @@ const _sfc_main$26 = /*@__PURE__*/ defineComponent({
|
|
|
465
465
|
* aria 接线(id/aria-invalid/aria-describedby)由 FormControl 的 cloneVNode 机制继承。
|
|
466
466
|
* widget 调用发生在 FormField 插槽期,拿到 field 实例后组装 WidgetContext。
|
|
467
467
|
*/
|
|
468
|
-
const _sfc_main$
|
|
468
|
+
const _sfc_main$65 = defineComponent({
|
|
469
469
|
name: "TuFormRenderField",
|
|
470
470
|
props: {
|
|
471
471
|
item: {
|
|
@@ -477,7 +477,7 @@ const _sfc_main$64 = defineComponent({
|
|
|
477
477
|
type: Function,
|
|
478
478
|
required: true
|
|
479
479
|
},
|
|
480
|
-
/** 响应式全量表单值(FormRender 经 useSelector
|
|
480
|
+
/** 响应式全量表单值(FormRender 经 useSelector 建立) */
|
|
481
481
|
values: {
|
|
482
482
|
type: Object,
|
|
483
483
|
required: true
|
|
@@ -507,7 +507,7 @@ const _sfc_main$64 = defineComponent({
|
|
|
507
507
|
});
|
|
508
508
|
//#endregion
|
|
509
509
|
//#region src/components/checkbox/Checkbox.vue
|
|
510
|
-
const _hoisted_1$
|
|
510
|
+
const _hoisted_1$29 = {
|
|
511
511
|
key: 0,
|
|
512
512
|
viewBox: "0 0 24 24",
|
|
513
513
|
fill: "none",
|
|
@@ -580,7 +580,7 @@ const _sfc_main$9 = /*@__PURE__*/ defineComponent({
|
|
|
580
580
|
createVNode(unref(Checkbox).HiddenInput),
|
|
581
581
|
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" }, {
|
|
582
582
|
default: withCtx(() => [createVNode(unref(Checkbox).Indicator, { class: "flex items-center justify-center text-current" }, {
|
|
583
|
-
default: withCtx(() => [createCommentVNode(" 半选态(data-state=indeterminate)显示短横线,选中态显示对勾 "), isChecked.value === "indeterminate" ? (openBlock(), createElementBlock("svg", _hoisted_1$
|
|
583
|
+
default: withCtx(() => [createCommentVNode(" 半选态(data-state=indeterminate)显示短横线,选中态显示对勾 "), isChecked.value === "indeterminate" ? (openBlock(), createElementBlock("svg", _hoisted_1$29, [..._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)])]))]),
|
|
584
584
|
_: 1
|
|
585
585
|
})]),
|
|
586
586
|
_: 1
|
|
@@ -783,7 +783,7 @@ function formatCurrency(value, valueUnit, labelUnit) {
|
|
|
783
783
|
}
|
|
784
784
|
//#endregion
|
|
785
785
|
//#region src/components/currency-input/CurrencyInput.vue
|
|
786
|
-
const _hoisted_1$
|
|
786
|
+
const _hoisted_1$28 = ["data-invalid"];
|
|
787
787
|
const _hoisted_2$17 = [
|
|
788
788
|
"value",
|
|
789
789
|
"placeholder",
|
|
@@ -862,7 +862,7 @@ const _sfc_main$11 = /*@__PURE__*/ defineComponent({
|
|
|
862
862
|
}), null, 16, _hoisted_2$17), createElementVNode("div", {
|
|
863
863
|
"aria-hidden": "true",
|
|
864
864
|
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"))
|
|
865
|
-
}, toDisplayString(props.labelUnit), 3)], 10, _hoisted_1$
|
|
865
|
+
}, toDisplayString(props.labelUnit), 3)], 10, _hoisted_1$28);
|
|
866
866
|
};
|
|
867
867
|
}
|
|
868
868
|
});
|
|
@@ -1028,8 +1028,8 @@ var export_helper_default = (sfc, props) => {
|
|
|
1028
1028
|
};
|
|
1029
1029
|
//#endregion
|
|
1030
1030
|
//#region src/components/icon-shared/ChevronIcon.vue
|
|
1031
|
-
const _sfc_main$
|
|
1032
|
-
const _hoisted_1$
|
|
1031
|
+
const _sfc_main$64 = {};
|
|
1032
|
+
const _hoisted_1$27 = {
|
|
1033
1033
|
viewBox: "0 0 24 24",
|
|
1034
1034
|
fill: "none",
|
|
1035
1035
|
stroke: "currentColor",
|
|
@@ -1038,10 +1038,10 @@ const _hoisted_1$26 = {
|
|
|
1038
1038
|
"stroke-linejoin": "round",
|
|
1039
1039
|
"aria-hidden": "true"
|
|
1040
1040
|
};
|
|
1041
|
-
function _sfc_render$
|
|
1042
|
-
return openBlock(), createElementBlock("svg", _hoisted_1$
|
|
1041
|
+
function _sfc_render$3(_ctx, _cache) {
|
|
1042
|
+
return openBlock(), createElementBlock("svg", _hoisted_1$27, [..._cache[0] || (_cache[0] = [createElementVNode("path", { d: "m9 18 6-6-6-6" }, null, -1)])]);
|
|
1043
1043
|
}
|
|
1044
|
-
var ChevronIcon_default = /*#__PURE__*/ export_helper_default(_sfc_main$
|
|
1044
|
+
var ChevronIcon_default = /*#__PURE__*/ export_helper_default(_sfc_main$64, [["render", _sfc_render$3]]);
|
|
1045
1045
|
//#endregion
|
|
1046
1046
|
//#region src/components/calendar/CalendarNav.vue
|
|
1047
1047
|
/**
|
|
@@ -1059,7 +1059,7 @@ const viewTitleCls = "text-sm font-semibold text-foreground";
|
|
|
1059
1059
|
* @param year - 聚焦年份
|
|
1060
1060
|
* @returns "起 - 止" 形式的年代范围文本
|
|
1061
1061
|
*/
|
|
1062
|
-
const _sfc_main$
|
|
1062
|
+
const _sfc_main$63 = /*@__PURE__*/ defineComponent({
|
|
1063
1063
|
__name: "CalendarNav",
|
|
1064
1064
|
props: {
|
|
1065
1065
|
/** 导航条服务的视图,决定中间内容形态:day=ViewTrigger(上钻)/ month=年份 / year=年代 */
|
|
@@ -1113,7 +1113,7 @@ view: {
|
|
|
1113
1113
|
});
|
|
1114
1114
|
//#endregion
|
|
1115
1115
|
//#region src/components/calendar/CalendarBody.vue
|
|
1116
|
-
const _hoisted_1$
|
|
1116
|
+
const _hoisted_1$26 = { class: "flex gap-6" };
|
|
1117
1117
|
const dayTriggerCls = "group relative flex h-8 w-full cursor-pointer items-center justify-center outline-none data-[outside-view]:pointer-events-none data-[disabled]:pointer-events-none data-[in-range]:not-data-[outside-view]:not-data-[range-start]:not-data-[range-end]:bg-primary/10 data-[range-start]:rounded-l-[3px] data-[range-end]:rounded-r-[3px] data-[week-selected]:bg-primary data-[week-selected]:data-[outside-view]:bg-primary/40 data-[week-selected]:hover:data-[outside-view]:bg-primary/40 group-hover/week-row:not-data-[week-selected]:not-data-[outside-view]:bg-primary/10 group-hover/week-row:data-[outside-view]:not-data-[week-selected]:bg-primary/5";
|
|
1118
1118
|
const dayDotCls = "flex size-6 items-center justify-center rounded-[3px] text-sm transition-colors group-hover:not-group-data-[week-selected]:bg-accent group-data-[focus]:not-group-data-[outside-view]:not-group-data-[week-selected]:bg-accent group-data-[selected]:not-group-data-[week-selected]:not-group-data-[outside-view]:bg-primary group-data-[selected]:not-group-data-[week-selected]:not-group-data-[outside-view]:font-medium group-data-[selected]:not-group-data-[week-selected]:not-group-data-[outside-view]:text-primary-foreground group-data-[week-selected]:bg-transparent group-data-[week-selected]:font-medium group-data-[week-selected]:text-primary-foreground group-data-[week-selected]:hover:bg-white/20 group-data-[today]:not-group-data-[selected]:text-primary group-data-[today]:not-group-data-[selected]:font-semibold group-data-[unavailable]:line-through group-data-[unavailable]:opacity-30 group-data-[disabled]:opacity-40 group-data-[outside-view]:opacity-30";
|
|
1119
1119
|
const cellCls = "flex h-9 w-full items-center justify-center rounded-[3px] text-sm outline-none hover:bg-accent data-[selected]:bg-primary data-[selected]:font-medium data-[selected]:text-primary-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-40";
|
|
@@ -1127,7 +1127,7 @@ const rowCls = "bg-transparent!";
|
|
|
1127
1127
|
* @param i - 表序号(1-based,相对当前锚点月偏移 i-1 个月)
|
|
1128
1128
|
* @returns 该表锚点月的起始日期
|
|
1129
1129
|
*/
|
|
1130
|
-
const _sfc_main$
|
|
1130
|
+
const _sfc_main$62 = /*@__PURE__*/ defineComponent({
|
|
1131
1131
|
__name: "CalendarBody",
|
|
1132
1132
|
props: {
|
|
1133
1133
|
mode: { default: "day" },
|
|
@@ -1176,7 +1176,7 @@ const _sfc_main$61 = /*@__PURE__*/ defineComponent({
|
|
|
1176
1176
|
createVNode(unref(DatePicker).View, { view: "day" }, {
|
|
1177
1177
|
default: withCtx(() => [
|
|
1178
1178
|
createCommentVNode(" day 视图导航条在 View 内:viewProps=day → GOTO.NEXT=focusNextPage(翻月) "),
|
|
1179
|
-
createVNode(_sfc_main$
|
|
1179
|
+
createVNode(_sfc_main$63, { view: "day" }, createSlots({ _: 2 }, [_ctx.$slots["prev-icon"] ? {
|
|
1180
1180
|
name: "prev-icon",
|
|
1181
1181
|
fn: withCtx(() => [renderSlot(_ctx.$slots, "prev-icon")]),
|
|
1182
1182
|
key: "0"
|
|
@@ -1186,7 +1186,7 @@ const _sfc_main$61 = /*@__PURE__*/ defineComponent({
|
|
|
1186
1186
|
key: "1"
|
|
1187
1187
|
} : void 0]), 1024),
|
|
1188
1188
|
createVNode(unref(DatePicker).Context, null, {
|
|
1189
|
-
default: withCtx((context) => [createElementVNode("div", _hoisted_1$
|
|
1189
|
+
default: withCtx((context) => [createElementVNode("div", _hoisted_1$26, [(openBlock(true), createElementBlock(Fragment, null, renderList(__props.numOfMonths, (i) => {
|
|
1190
1190
|
return openBlock(), createBlock(unref(DatePicker).Table, {
|
|
1191
1191
|
key: i,
|
|
1192
1192
|
class: normalizeClass(tableCls)
|
|
@@ -1243,7 +1243,7 @@ const _sfc_main$61 = /*@__PURE__*/ defineComponent({
|
|
|
1243
1243
|
createVNode(unref(DatePicker).View, { view: "month" }, {
|
|
1244
1244
|
default: withCtx(() => [
|
|
1245
1245
|
createCommentVNode(" 切换视图导航条也在 View 内:DatePicker 切月视图后 GOTO.NEXT=focusNextYear(修复 backlog) "),
|
|
1246
|
-
createVNode(_sfc_main$
|
|
1246
|
+
createVNode(_sfc_main$63, { view: "month" }, createSlots({ _: 2 }, [_ctx.$slots["prev-icon"] ? {
|
|
1247
1247
|
name: "prev-icon",
|
|
1248
1248
|
fn: withCtx(() => [renderSlot(_ctx.$slots, "prev-icon")]),
|
|
1249
1249
|
key: "0"
|
|
@@ -1289,7 +1289,7 @@ const _sfc_main$61 = /*@__PURE__*/ defineComponent({
|
|
|
1289
1289
|
_: 3
|
|
1290
1290
|
}),
|
|
1291
1291
|
createVNode(unref(DatePicker).View, { view: "year" }, {
|
|
1292
|
-
default: withCtx(() => [createVNode(_sfc_main$
|
|
1292
|
+
default: withCtx(() => [createVNode(_sfc_main$63, { view: "year" }, createSlots({ _: 2 }, [_ctx.$slots["prev-icon"] ? {
|
|
1293
1293
|
name: "prev-icon",
|
|
1294
1294
|
fn: withCtx(() => [renderSlot(_ctx.$slots, "prev-icon")]),
|
|
1295
1295
|
key: "0"
|
|
@@ -1335,7 +1335,7 @@ const _sfc_main$61 = /*@__PURE__*/ defineComponent({
|
|
|
1335
1335
|
}, {
|
|
1336
1336
|
default: withCtx(() => [
|
|
1337
1337
|
createCommentVNode(" 导航条必须在 View 子树内:Prev/NextTrigger 才能拿到 view=\"month\"(GOTO.NEXT=focusNextYear) "),
|
|
1338
|
-
createVNode(_sfc_main$
|
|
1338
|
+
createVNode(_sfc_main$63, { view: "month" }, createSlots({ _: 2 }, [_ctx.$slots["prev-icon"] ? {
|
|
1339
1339
|
name: "prev-icon",
|
|
1340
1340
|
fn: withCtx(() => [renderSlot(_ctx.$slots, "prev-icon")]),
|
|
1341
1341
|
key: "0"
|
|
@@ -1385,7 +1385,7 @@ const _sfc_main$61 = /*@__PURE__*/ defineComponent({
|
|
|
1385
1385
|
}, {
|
|
1386
1386
|
default: withCtx(() => [
|
|
1387
1387
|
createCommentVNode(" 导航条必须在 View 子树内:Prev/NextTrigger 才能拿到 view=\"year\"(GOTO.NEXT=focusNextDecade) "),
|
|
1388
|
-
createVNode(_sfc_main$
|
|
1388
|
+
createVNode(_sfc_main$63, { view: "year" }, createSlots({ _: 2 }, [_ctx.$slots["prev-icon"] ? {
|
|
1389
1389
|
name: "prev-icon",
|
|
1390
1390
|
fn: withCtx(() => [renderSlot(_ctx.$slots, "prev-icon")]),
|
|
1391
1391
|
key: "0"
|
|
@@ -1516,7 +1516,7 @@ const _sfc_main$6 = /*@__PURE__*/ defineComponent({
|
|
|
1516
1516
|
"onUpdate:modelValue": handleValueUpdate
|
|
1517
1517
|
}, {
|
|
1518
1518
|
default: withCtx(() => [createVNode(unref(DatePicker).Content, null, {
|
|
1519
|
-
default: withCtx(() => [createVNode(_sfc_main$
|
|
1519
|
+
default: withCtx(() => [createVNode(_sfc_main$62, {
|
|
1520
1520
|
mode: props.mode,
|
|
1521
1521
|
"num-of-months": props.numOfMonths,
|
|
1522
1522
|
week: props.week,
|
|
@@ -1547,7 +1547,7 @@ const _sfc_main$6 = /*@__PURE__*/ defineComponent({
|
|
|
1547
1547
|
"max",
|
|
1548
1548
|
"is-date-unavailable",
|
|
1549
1549
|
"locale"
|
|
1550
|
-
])], 2)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [createCommentVNode(" embedded 内嵌形态:宿主 Picker 的 Root 供能,纯卡片内核 "), createVNode(_sfc_main$
|
|
1550
|
+
])], 2)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [createCommentVNode(" embedded 内嵌形态:宿主 Picker 的 Root 供能,纯卡片内核 "), createVNode(_sfc_main$62, {
|
|
1551
1551
|
mode: props.mode,
|
|
1552
1552
|
"num-of-months": props.numOfMonths,
|
|
1553
1553
|
week: props.week,
|
|
@@ -1571,8 +1571,8 @@ const _sfc_main$6 = /*@__PURE__*/ defineComponent({
|
|
|
1571
1571
|
});
|
|
1572
1572
|
//#endregion
|
|
1573
1573
|
//#region src/components/icon-shared/CalendarIcon.vue
|
|
1574
|
-
const _sfc_main$
|
|
1575
|
-
const _hoisted_1$
|
|
1574
|
+
const _sfc_main$61 = {};
|
|
1575
|
+
const _hoisted_1$25 = {
|
|
1576
1576
|
viewBox: "0 0 24 24",
|
|
1577
1577
|
fill: "none",
|
|
1578
1578
|
stroke: "currentColor",
|
|
@@ -1581,8 +1581,8 @@ const _hoisted_1$24 = {
|
|
|
1581
1581
|
"stroke-linejoin": "round",
|
|
1582
1582
|
"aria-hidden": "true"
|
|
1583
1583
|
};
|
|
1584
|
-
function _sfc_render$
|
|
1585
|
-
return openBlock(), createElementBlock("svg", _hoisted_1$
|
|
1584
|
+
function _sfc_render$2(_ctx, _cache) {
|
|
1585
|
+
return openBlock(), createElementBlock("svg", _hoisted_1$25, [..._cache[0] || (_cache[0] = [
|
|
1586
1586
|
createElementVNode("rect", {
|
|
1587
1587
|
width: "18",
|
|
1588
1588
|
height: "18",
|
|
@@ -1595,11 +1595,11 @@ function _sfc_render$1(_ctx, _cache) {
|
|
|
1595
1595
|
createElementVNode("path", { d: "M3 10h18" }, null, -1)
|
|
1596
1596
|
])]);
|
|
1597
1597
|
}
|
|
1598
|
-
var CalendarIcon_default = /*#__PURE__*/ export_helper_default(_sfc_main$
|
|
1598
|
+
var CalendarIcon_default = /*#__PURE__*/ export_helper_default(_sfc_main$61, [["render", _sfc_render$2]]);
|
|
1599
1599
|
//#endregion
|
|
1600
1600
|
//#region src/components/icon-shared/CloseIcon.vue
|
|
1601
|
-
const _sfc_main$
|
|
1602
|
-
const _hoisted_1$
|
|
1601
|
+
const _sfc_main$60 = {};
|
|
1602
|
+
const _hoisted_1$24 = {
|
|
1603
1603
|
viewBox: "0 0 24 24",
|
|
1604
1604
|
fill: "none",
|
|
1605
1605
|
stroke: "currentColor",
|
|
@@ -1608,10 +1608,10 @@ const _hoisted_1$23 = {
|
|
|
1608
1608
|
"stroke-linejoin": "round",
|
|
1609
1609
|
"aria-hidden": "true"
|
|
1610
1610
|
};
|
|
1611
|
-
function _sfc_render(_ctx, _cache) {
|
|
1612
|
-
return openBlock(), createElementBlock("svg", _hoisted_1$
|
|
1611
|
+
function _sfc_render$1(_ctx, _cache) {
|
|
1612
|
+
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)])]);
|
|
1613
1613
|
}
|
|
1614
|
-
var CloseIcon_default = /*#__PURE__*/ export_helper_default(_sfc_main$
|
|
1614
|
+
var CloseIcon_default = /*#__PURE__*/ export_helper_default(_sfc_main$60, [["render", _sfc_render$1]]);
|
|
1615
1615
|
//#endregion
|
|
1616
1616
|
//#region src/components/overlay-shared/sandbox.ts
|
|
1617
1617
|
/**
|
|
@@ -1703,7 +1703,7 @@ function withSandboxStrategy(user, merged) {
|
|
|
1703
1703
|
//#endregion
|
|
1704
1704
|
//#region src/components/date-shared/PickerShell.vue
|
|
1705
1705
|
/** 单值日期族(Date/Month/Year/Week)共用外壳:触发器 + 清空/日历按钮 + 弹层容器。 */
|
|
1706
|
-
const _sfc_main$
|
|
1706
|
+
const _sfc_main$59 = /*@__PURE__*/ defineComponent({
|
|
1707
1707
|
inheritAttrs: false,
|
|
1708
1708
|
__name: "PickerShell",
|
|
1709
1709
|
props: {
|
|
@@ -1839,8 +1839,8 @@ const _sfc_main$58 = /*@__PURE__*/ defineComponent({
|
|
|
1839
1839
|
_: 1
|
|
1840
1840
|
}, 8, ["class", "data-invalid"]),
|
|
1841
1841
|
createCommentVNode(" 弹层 Teleport:脱离表单 DOM——隔离外层 FormControl 的 group class\n (group-hover 会污染面板内全部格子),并消除 overflow 容器裁剪弹层的隐患;\n 目标经沙箱适配降级(shadow DOM / wujie graft → 应用挂载容器) "),
|
|
1842
|
-
(openBlock(), createBlock(Teleport, { to: unref(teleportTarget) }, [createVNode(unref(DatePicker).Positioner, { class: "z-[var(--z-
|
|
1843
|
-
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-
|
|
1842
|
+
(openBlock(), createBlock(Teleport, { to: unref(teleportTarget) }, [createVNode(unref(DatePicker).Positioner, { class: "z-[var(--z-modal,60)]" }, {
|
|
1843
|
+
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-modal,60)] rounded-md border shadow-md")) }, {
|
|
1844
1844
|
default: withCtx(() => [renderSlot(_ctx.$slots, "default")]),
|
|
1845
1845
|
_: 3
|
|
1846
1846
|
}, 8, ["class"])]),
|
|
@@ -2022,7 +2022,7 @@ const _sfc_main$12 = /*@__PURE__*/ defineComponent({
|
|
|
2022
2022
|
const minDate = computed(() => parseIsoDate(props.min ?? ""));
|
|
2023
2023
|
const maxDate = computed(() => parseIsoDate(props.max ?? ""));
|
|
2024
2024
|
return (_ctx, _cache) => {
|
|
2025
|
-
return openBlock(), createBlock(_sfc_main$
|
|
2025
|
+
return openBlock(), createBlock(_sfc_main$59, mergeProps(_ctx.$attrs, {
|
|
2026
2026
|
"model-value": unref(rootValue),
|
|
2027
2027
|
open: unref(isOpen),
|
|
2028
2028
|
locale: props.locale,
|
|
@@ -2254,8 +2254,8 @@ const _sfc_main$13 = /*@__PURE__*/ defineComponent({
|
|
|
2254
2254
|
_: 1
|
|
2255
2255
|
}, 8, ["class", "data-invalid"]),
|
|
2256
2256
|
createCommentVNode(" 弹层 Teleport:脱离表单 DOM——隔离外层 FormControl 的 group class\n (group-hover 会污染面板内全部格子),并消除 overflow 容器裁剪弹层的隐患;\n 目标经沙箱适配降级(shadow DOM / wujie graft → 应用挂载容器) "),
|
|
2257
|
-
(openBlock(), createBlock(Teleport, { to: unref(teleportTarget) }, [createVNode(unref(DatePicker).Positioner, { class: "z-[var(--z-
|
|
2258
|
-
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-
|
|
2257
|
+
(openBlock(), createBlock(Teleport, { to: unref(teleportTarget) }, [createVNode(unref(DatePicker).Positioner, { class: "z-[var(--z-modal,60)]" }, {
|
|
2258
|
+
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-modal,60)] rounded-md border shadow-md")) }, {
|
|
2259
2259
|
default: withCtx(() => [createVNode(unref(_sfc_main$6), { "num-of-months": props.numOfMonths }, null, 8, ["num-of-months"])]),
|
|
2260
2260
|
_: 1
|
|
2261
2261
|
}, 8, ["class"])]),
|
|
@@ -2378,7 +2378,7 @@ const _sfc_main$29 = /*@__PURE__*/ defineComponent({
|
|
|
2378
2378
|
return anchor ? anchor.set({ day: 31 }) : void 0;
|
|
2379
2379
|
});
|
|
2380
2380
|
return (_ctx, _cache) => {
|
|
2381
|
-
return openBlock(), createBlock(_sfc_main$
|
|
2381
|
+
return openBlock(), createBlock(_sfc_main$59, mergeProps(_ctx.$attrs, {
|
|
2382
2382
|
"model-value": unref(rootValue),
|
|
2383
2383
|
open: unref(isOpen),
|
|
2384
2384
|
locale: props.locale,
|
|
@@ -2545,7 +2545,7 @@ const _sfc_main$30 = /*@__PURE__*/ defineComponent({
|
|
|
2545
2545
|
});
|
|
2546
2546
|
//#endregion
|
|
2547
2547
|
//#region src/components/password-input/PasswordInput.vue
|
|
2548
|
-
const _hoisted_1$
|
|
2548
|
+
const _hoisted_1$23 = ["data-invalid"];
|
|
2549
2549
|
const _hoisted_2$16 = [
|
|
2550
2550
|
"type",
|
|
2551
2551
|
"value",
|
|
@@ -2570,7 +2570,7 @@ const _hoisted_4$10 = {
|
|
|
2570
2570
|
class: "size-4",
|
|
2571
2571
|
"aria-hidden": "true"
|
|
2572
2572
|
};
|
|
2573
|
-
const _hoisted_5$
|
|
2573
|
+
const _hoisted_5$8 = {
|
|
2574
2574
|
key: 1,
|
|
2575
2575
|
viewBox: "0 0 24 24",
|
|
2576
2576
|
fill: "none",
|
|
@@ -2664,17 +2664,17 @@ const _sfc_main$31 = /*@__PURE__*/ defineComponent({
|
|
|
2664
2664
|
y1: "2",
|
|
2665
2665
|
y2: "22"
|
|
2666
2666
|
}, null, -1)
|
|
2667
|
-
])])) : (openBlock(), createElementBlock("svg", _hoisted_5$
|
|
2667
|
+
])])) : (openBlock(), createElementBlock("svg", _hoisted_5$8, [..._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", {
|
|
2668
2668
|
cx: "12",
|
|
2669
2669
|
cy: "12",
|
|
2670
2670
|
r: "3"
|
|
2671
|
-
}, null, -1)])]))])], 8, _hoisted_3$12)], 10, _hoisted_1$
|
|
2671
|
+
}, null, -1)])]))])], 8, _hoisted_3$12)], 10, _hoisted_1$23);
|
|
2672
2672
|
};
|
|
2673
2673
|
}
|
|
2674
2674
|
});
|
|
2675
2675
|
//#endregion
|
|
2676
2676
|
//#region src/components/textarea/Textarea.vue
|
|
2677
|
-
const _hoisted_1$
|
|
2677
|
+
const _hoisted_1$22 = ["aria-invalid"];
|
|
2678
2678
|
const _sfc_main$46 = /*@__PURE__*/ defineComponent({
|
|
2679
2679
|
__name: "Textarea",
|
|
2680
2680
|
props: /*@__PURE__*/ mergeModels({
|
|
@@ -2686,14 +2686,18 @@ const _sfc_main$46 = /*@__PURE__*/ defineComponent({
|
|
|
2686
2686
|
}),
|
|
2687
2687
|
emits: ["update:modelValue"],
|
|
2688
2688
|
setup(__props) {
|
|
2689
|
-
const
|
|
2689
|
+
const looseToNumber = (val) => {
|
|
2690
|
+
const n = Number.parseFloat(String(val));
|
|
2691
|
+
return Number.isNaN(n) ? val : n;
|
|
2692
|
+
};
|
|
2693
|
+
const modelValue = useModel(__props, "modelValue", { set: (v) => typeof modelValue.value === "number" ? looseToNumber(v) : v });
|
|
2690
2694
|
const props = __props;
|
|
2691
2695
|
return (_ctx, _cache) => {
|
|
2692
2696
|
return withDirectives((openBlock(), createElementBlock("textarea", {
|
|
2693
2697
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => modelValue.value = $event),
|
|
2694
2698
|
"aria-invalid": props.invalid ? "true" : void 0,
|
|
2695
2699
|
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))
|
|
2696
|
-
}, null, 10, _hoisted_1$
|
|
2700
|
+
}, null, 10, _hoisted_1$22)), [[vModelText, modelValue.value]]);
|
|
2697
2701
|
};
|
|
2698
2702
|
}
|
|
2699
2703
|
});
|
|
@@ -2812,7 +2816,7 @@ const _sfc_main$51 = /*@__PURE__*/ defineComponent({
|
|
|
2812
2816
|
return date ? weekStartOf(date, props.locale) : void 0;
|
|
2813
2817
|
}
|
|
2814
2818
|
return (_ctx, _cache) => {
|
|
2815
|
-
return openBlock(), createBlock(_sfc_main$
|
|
2819
|
+
return openBlock(), createBlock(_sfc_main$59, mergeProps(_ctx.$attrs, {
|
|
2816
2820
|
"model-value": unref(rootValue),
|
|
2817
2821
|
open: unref(isOpen),
|
|
2818
2822
|
locale: props.locale,
|
|
@@ -2949,7 +2953,7 @@ const _sfc_main$52 = /*@__PURE__*/ defineComponent({
|
|
|
2949
2953
|
const minDate = computed(() => parseIsoYear(props.min ?? ""));
|
|
2950
2954
|
const maxDate = computed(() => parseIsoYear(props.max ?? ""));
|
|
2951
2955
|
return (_ctx, _cache) => {
|
|
2952
|
-
return openBlock(), createBlock(_sfc_main$
|
|
2956
|
+
return openBlock(), createBlock(_sfc_main$59, mergeProps(_ctx.$attrs, {
|
|
2953
2957
|
"model-value": unref(rootValue),
|
|
2954
2958
|
open: unref(isOpen),
|
|
2955
2959
|
locale: props.locale,
|
|
@@ -2997,7 +3001,7 @@ const _sfc_main$52 = /*@__PURE__*/ defineComponent({
|
|
|
2997
3001
|
/**
|
|
2998
3002
|
* modelValue 形态 widgets 统一展开模式(方案 C):
|
|
2999
3003
|
* item 级缺省 → options 整体展开(命名穿透,组件全 props)→ 受控绑定 → 逃逸口。
|
|
3000
|
-
* options.placeholder 为 undefined 时 Vue 视为未传,item
|
|
3004
|
+
* options.placeholder 为 undefined 时 Vue 视为未传,item 级缺省保留。
|
|
3001
3005
|
*/
|
|
3002
3006
|
/**
|
|
3003
3007
|
* password widget:密码输入(autoComplete 为组件真实 prop,直接派生透传)
|
|
@@ -3107,7 +3111,7 @@ function renderWeekPickerItem(options = {}) {
|
|
|
3107
3111
|
}
|
|
3108
3112
|
//#endregion
|
|
3109
3113
|
//#region src/components/input/Input.vue
|
|
3110
|
-
const _hoisted_1$
|
|
3114
|
+
const _hoisted_1$21 = ["aria-invalid"];
|
|
3111
3115
|
const _sfc_main$27 = /*@__PURE__*/ defineComponent({
|
|
3112
3116
|
__name: "Input",
|
|
3113
3117
|
props: /*@__PURE__*/ mergeModels({
|
|
@@ -3119,14 +3123,18 @@ const _sfc_main$27 = /*@__PURE__*/ defineComponent({
|
|
|
3119
3123
|
}),
|
|
3120
3124
|
emits: ["update:modelValue"],
|
|
3121
3125
|
setup(__props) {
|
|
3122
|
-
const
|
|
3126
|
+
const looseToNumber = (val) => {
|
|
3127
|
+
const n = Number.parseFloat(String(val));
|
|
3128
|
+
return Number.isNaN(n) ? val : n;
|
|
3129
|
+
};
|
|
3130
|
+
const modelValue = useModel(__props, "modelValue", { set: (v) => typeof modelValue.value === "number" ? looseToNumber(v) : v });
|
|
3123
3131
|
const props = __props;
|
|
3124
3132
|
return (_ctx, _cache) => {
|
|
3125
3133
|
return withDirectives((openBlock(), createElementBlock("input", {
|
|
3126
3134
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => modelValue.value = $event),
|
|
3127
3135
|
"aria-invalid": props.invalid ? "true" : void 0,
|
|
3128
3136
|
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))
|
|
3129
|
-
}, null, 10, _hoisted_1$
|
|
3137
|
+
}, null, 10, _hoisted_1$21)), [[vModelText, modelValue.value]]);
|
|
3130
3138
|
};
|
|
3131
3139
|
}
|
|
3132
3140
|
});
|
|
@@ -3219,7 +3227,7 @@ function normalizeSelectItem(item) {
|
|
|
3219
3227
|
}
|
|
3220
3228
|
//#endregion
|
|
3221
3229
|
//#region src/components/select/Select.vue
|
|
3222
|
-
const _hoisted_1$
|
|
3230
|
+
const _hoisted_1$20 = { class: "min-w-0 flex-1 truncate" };
|
|
3223
3231
|
const _sfc_main$37 = /*@__PURE__*/ defineComponent({
|
|
3224
3232
|
__name: "Select",
|
|
3225
3233
|
props: {
|
|
@@ -3327,7 +3335,7 @@ const _sfc_main$37 = /*@__PURE__*/ defineComponent({
|
|
|
3327
3335
|
default: withCtx(() => [createVNode(unref(Select).Trigger, { class: normalizeClass(unref(cn)("border-input data-[placeholder]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 flex h-9 w-full items-center justify-between gap-2 rounded-md border bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs focus-visible:outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 [&_svg]:shrink-0 [&_svg:not([class*=size-])]:size-4", props.triggerClass)) }, {
|
|
3328
3336
|
default: withCtx(() => [
|
|
3329
3337
|
createCommentVNode(" 截断层:触发器 w-full 定宽后,超长选中值/placeholder 走 ellipsis(flex 子项 overflow 非 visible 时自动最小尺寸归零,min-w-0 双保险)。\n 注意:不能向 ValueText 传插槽内容,其内部会对默认插槽做字符串化渲染 "),
|
|
3330
|
-
createElementVNode("span", _hoisted_1$
|
|
3338
|
+
createElementVNode("span", _hoisted_1$20, [createVNode(unref(Select).ValueText, { placeholder: props.placeholder }, null, 8, ["placeholder"])]),
|
|
3331
3339
|
renderSlot(_ctx.$slots, "trigger-icon", {}, () => [createVNode(ChevronIcon_default, { class: "size-4 rotate-90 opacity-50" })])
|
|
3332
3340
|
]),
|
|
3333
3341
|
_: 3
|
|
@@ -3386,7 +3394,7 @@ const _sfc_main$37 = /*@__PURE__*/ defineComponent({
|
|
|
3386
3394
|
/**
|
|
3387
3395
|
* select widget:Select 已单组件化,items/placeholder 均为正式 prop 直写。
|
|
3388
3396
|
* v3 命名穿透:options 整体透传给 Select(内部做 string 归一化);
|
|
3389
|
-
* placeholder 解构出来做 item 级缺省回退(options
|
|
3397
|
+
* placeholder 解构出来做 item 级缺省回退(options 优先)。
|
|
3390
3398
|
* @param options - widget 选项,items/placeholder 直写为组件 prop,其余整体透传给 Select
|
|
3391
3399
|
* @returns 渲染函数,接收渲染上下文并产出 Select vnode
|
|
3392
3400
|
*/
|
|
@@ -3575,7 +3583,7 @@ function renderSliderItem(options = {}) {
|
|
|
3575
3583
|
}
|
|
3576
3584
|
//#endregion
|
|
3577
3585
|
//#region src/components/tree-shared/ValueTags.vue
|
|
3578
|
-
const _hoisted_1$
|
|
3586
|
+
const _hoisted_1$19 = ["data-key"];
|
|
3579
3587
|
const _hoisted_2$15 = { class: "truncate" };
|
|
3580
3588
|
const _hoisted_3$11 = ["aria-label", "onClick"];
|
|
3581
3589
|
const _hoisted_4$9 = {
|
|
@@ -3583,7 +3591,7 @@ const _hoisted_4$9 = {
|
|
|
3583
3591
|
"data-part": "tag-overflow",
|
|
3584
3592
|
class: "text-xs text-muted-foreground"
|
|
3585
3593
|
};
|
|
3586
|
-
const _sfc_main$
|
|
3594
|
+
const _sfc_main$58 = /*@__PURE__*/ defineComponent({
|
|
3587
3595
|
__name: "ValueTags",
|
|
3588
3596
|
props: {
|
|
3589
3597
|
/** 展示的选中值(key + label) */
|
|
@@ -3627,7 +3635,7 @@ const _sfc_main$57 = /*@__PURE__*/ defineComponent({
|
|
|
3627
3635
|
class: "text-muted-foreground hover:text-foreground",
|
|
3628
3636
|
"aria-label": `移除 ${v.label}`,
|
|
3629
3637
|
onClick: withModifiers(($event) => emit("remove", v.key), ["stop"])
|
|
3630
|
-
}, [createVNode(CloseIcon_default, { class: "size-3" })], 8, _hoisted_3$11)) : createCommentVNode("v-if", true)], 8, _hoisted_1$
|
|
3638
|
+
}, [createVNode(CloseIcon_default, { class: "size-3" })], 8, _hoisted_3$11)) : createCommentVNode("v-if", true)], 8, _hoisted_1$19);
|
|
3631
3639
|
}), 128)),
|
|
3632
3640
|
overflow.value > 0 ? (openBlock(), createElementBlock("span", _hoisted_4$9, "+" + toDisplayString(overflow.value), 1)) : createCommentVNode("v-if", true),
|
|
3633
3641
|
__props.clearable && !__props.disabled ? (openBlock(), createElementBlock("button", {
|
|
@@ -4462,7 +4470,7 @@ function nextActiveKey(flattened, activeKey, key, options) {
|
|
|
4462
4470
|
}
|
|
4463
4471
|
//#endregion
|
|
4464
4472
|
//#region src/components/cascader/CascaderPanel.vue
|
|
4465
|
-
const _hoisted_1$
|
|
4473
|
+
const _hoisted_1$18 = ["aria-label"];
|
|
4466
4474
|
const _hoisted_2$14 = [
|
|
4467
4475
|
"data-key",
|
|
4468
4476
|
"aria-selected",
|
|
@@ -4485,7 +4493,7 @@ const _hoisted_4$8 = {
|
|
|
4485
4493
|
"stroke-width": "3",
|
|
4486
4494
|
class: "size-3"
|
|
4487
4495
|
};
|
|
4488
|
-
const _hoisted_5$
|
|
4496
|
+
const _hoisted_5$7 = {
|
|
4489
4497
|
key: 1,
|
|
4490
4498
|
viewBox: "0 0 24 24",
|
|
4491
4499
|
fill: "none",
|
|
@@ -4498,7 +4506,7 @@ const _hoisted_7$4 = {
|
|
|
4498
4506
|
key: 0,
|
|
4499
4507
|
class: "px-3 py-1.5 text-sm text-muted-foreground"
|
|
4500
4508
|
};
|
|
4501
|
-
const _sfc_main$
|
|
4509
|
+
const _sfc_main$57 = /*@__PURE__*/ defineComponent({
|
|
4502
4510
|
__name: "CascaderPanel",
|
|
4503
4511
|
props: {
|
|
4504
4512
|
/** 列数据:columns[0] 为根层,后续每列为展开路径的子层 */
|
|
@@ -4598,21 +4606,21 @@ const _sfc_main$56 = /*@__PURE__*/ defineComponent({
|
|
|
4598
4606
|
"data-part": "checkbox",
|
|
4599
4607
|
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"]),
|
|
4600
4608
|
onClick: withModifiers(($event) => toggleCheck(node), ["stop"])
|
|
4601
|
-
}, [checkedSet.value.has(node.key) ? (openBlock(), createElementBlock("svg", _hoisted_4$8, [..._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$
|
|
4609
|
+
}, [checkedSet.value.has(node.key) ? (openBlock(), createElementBlock("svg", _hoisted_4$8, [..._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$7, [..._cache[1] || (_cache[1] = [createElementVNode("path", { d: "M5 12h14" }, null, -1)])])) : createCommentVNode("v-if", true)], 10, _hoisted_3$10)) : createCommentVNode("v-if", true),
|
|
4602
4610
|
createElementVNode("span", _hoisted_6$5, toDisplayString(labelOf(node)), 1),
|
|
4603
4611
|
node.children?.length ? (openBlock(), createBlock(ChevronIcon_default, {
|
|
4604
4612
|
key: 1,
|
|
4605
4613
|
class: normalizeClass(unref(cn)("size-3.5 shrink-0 text-muted-foreground transition-transform", props.isExpanded(node) && "rotate-90"))
|
|
4606
4614
|
}, null, 8, ["class"])) : createCommentVNode("v-if", true)
|
|
4607
4615
|
], 40, _hoisted_2$14);
|
|
4608
|
-
}), 128)), !column.length ? (openBlock(), createElementBlock("div", _hoisted_7$4, "无数据")) : createCommentVNode("v-if", true)], 8, _hoisted_1$
|
|
4616
|
+
}), 128)), !column.length ? (openBlock(), createElementBlock("div", _hoisted_7$4, "无数据")) : createCommentVNode("v-if", true)], 8, _hoisted_1$18);
|
|
4609
4617
|
}), 128))], 2);
|
|
4610
4618
|
};
|
|
4611
4619
|
}
|
|
4612
4620
|
});
|
|
4613
4621
|
//#endregion
|
|
4614
4622
|
//#region src/components/cascader/Cascader.vue
|
|
4615
|
-
const _hoisted_1$
|
|
4623
|
+
const _hoisted_1$17 = ["aria-expanded", "aria-disabled"];
|
|
4616
4624
|
const _hoisted_2$13 = {
|
|
4617
4625
|
key: 1,
|
|
4618
4626
|
class: "truncate text-muted-foreground"
|
|
@@ -4625,7 +4633,7 @@ const _hoisted_4$7 = {
|
|
|
4625
4633
|
key: 1,
|
|
4626
4634
|
class: "truncate text-muted-foreground"
|
|
4627
4635
|
};
|
|
4628
|
-
const _hoisted_5$
|
|
4636
|
+
const _hoisted_5$6 = { class: "ml-auto flex shrink-0 items-center gap-1" };
|
|
4629
4637
|
const _sfc_main$8 = /*@__PURE__*/ defineComponent({
|
|
4630
4638
|
inheritAttrs: false,
|
|
4631
4639
|
__name: "Cascader",
|
|
@@ -4959,7 +4967,7 @@ const _sfc_main$8 = /*@__PURE__*/ defineComponent({
|
|
|
4959
4967
|
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),
|
|
4960
4968
|
onClick: openFromInput,
|
|
4961
4969
|
onKeydown: handleKeydown
|
|
4962
|
-
}), [isMulti.value ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [tags.value.length ? (openBlock(), createBlock(_sfc_main$
|
|
4970
|
+
}), [isMulti.value ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [tags.value.length ? (openBlock(), createBlock(_sfc_main$58, {
|
|
4963
4971
|
key: 0,
|
|
4964
4972
|
values: tags.value,
|
|
4965
4973
|
"max-tag-count": props.maxTagCount,
|
|
@@ -4969,22 +4977,22 @@ const _sfc_main$8 = /*@__PURE__*/ defineComponent({
|
|
|
4969
4977
|
"values",
|
|
4970
4978
|
"max-tag-count",
|
|
4971
4979
|
"disabled"
|
|
4972
|
-
])) : 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$7, toDisplayString(props.placeholder), 1))], 64)), createElementVNode("span", _hoisted_5$
|
|
4980
|
+
])) : 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$7, toDisplayString(props.placeholder), 1))], 64)), createElementVNode("span", _hoisted_5$6, [props.clearable && hasValue.value && !props.disabled ? (openBlock(), createElementBlock("span", {
|
|
4973
4981
|
key: 0,
|
|
4974
4982
|
role: "button",
|
|
4975
4983
|
"data-part": "clear",
|
|
4976
4984
|
class: "text-muted-foreground hover:text-foreground",
|
|
4977
4985
|
"aria-label": "清空",
|
|
4978
4986
|
onClick: withModifiers(handleClear, ["stop"])
|
|
4979
|
-
}, [createVNode(CloseIcon_default, { class: "size-4 shrink-0" })])) : createCommentVNode("v-if", true), createVNode(ChevronIcon_default, { class: normalizeClass(unref(cn)("size-4 shrink-0 text-muted-foreground transition-transform", unref(isOpen) ? "-rotate-90" : "rotate-90")) }, null, 8, ["class"])])], 16, _hoisted_1$
|
|
4987
|
+
}, [createVNode(CloseIcon_default, { class: "size-4 shrink-0" })])) : createCommentVNode("v-if", true), createVNode(ChevronIcon_default, { class: normalizeClass(unref(cn)("size-4 shrink-0 text-muted-foreground transition-transform", unref(isOpen) ? "-rotate-90" : "rotate-90")) }, null, 8, ["class"])])], 16, _hoisted_1$17)]),
|
|
4980
4988
|
_: 1
|
|
4981
|
-
}), (openBlock(), createBlock(Teleport, { to: unref(teleportTarget) }, [createVNode(unref(Popover).Positioner, { class: "z-[var(--z-
|
|
4989
|
+
}), (openBlock(), createBlock(Teleport, { to: unref(teleportTarget) }, [createVNode(unref(Popover).Positioner, { class: "z-[var(--z-modal,60)]" }, {
|
|
4982
4990
|
default: withCtx(() => [createVNode(unref(Popover).Content, {
|
|
4983
|
-
class: normalizeClass(unref(cn)("bg-popover text-popover-foreground z-[var(--z-
|
|
4991
|
+
class: normalizeClass(unref(cn)("bg-popover text-popover-foreground z-[var(--z-modal,60)] 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")),
|
|
4984
4992
|
style: normalizeStyle({ minWidth: panelMinWidth.value }),
|
|
4985
4993
|
onKeydown: handleKeydown
|
|
4986
4994
|
}, {
|
|
4987
|
-
default: withCtx(() => [createVNode(_sfc_main$
|
|
4995
|
+
default: withCtx(() => [createVNode(_sfc_main$57, {
|
|
4988
4996
|
columns: columns.value,
|
|
4989
4997
|
"expand-trigger": props.expandTrigger,
|
|
4990
4998
|
"selected-keys": isMulti.value ? selectedKeys.value : [],
|
|
@@ -5021,7 +5029,7 @@ const _sfc_main$8 = /*@__PURE__*/ defineComponent({
|
|
|
5021
5029
|
});
|
|
5022
5030
|
//#endregion
|
|
5023
5031
|
//#region src/components/tree-select/TreePanel.vue
|
|
5024
|
-
const _hoisted_1$
|
|
5032
|
+
const _hoisted_1$16 = [
|
|
5025
5033
|
"aria-level",
|
|
5026
5034
|
"aria-selected",
|
|
5027
5035
|
"aria-checked",
|
|
@@ -5040,7 +5048,7 @@ const _hoisted_3$8 = {
|
|
|
5040
5048
|
"aria-hidden": "true"
|
|
5041
5049
|
};
|
|
5042
5050
|
const _hoisted_4$6 = ["data-checked", "data-indeterminate"];
|
|
5043
|
-
const _hoisted_5$
|
|
5051
|
+
const _hoisted_5$5 = {
|
|
5044
5052
|
key: 0,
|
|
5045
5053
|
viewBox: "0 0 24 24",
|
|
5046
5054
|
fill: "none",
|
|
@@ -5064,7 +5072,7 @@ const _hoisted_8$1 = {
|
|
|
5064
5072
|
key: 0,
|
|
5065
5073
|
class: "px-2 py-6 text-center text-sm text-muted-foreground"
|
|
5066
5074
|
};
|
|
5067
|
-
const _sfc_main$
|
|
5075
|
+
const _sfc_main$56 = /*@__PURE__*/ defineComponent({
|
|
5068
5076
|
__name: "TreePanel",
|
|
5069
5077
|
props: {
|
|
5070
5078
|
/** 展开态扁平化的可见节点序列(来自 treeMate.getFlattenedNodes(expandedKeys)) */
|
|
@@ -5165,23 +5173,23 @@ const _sfc_main$55 = /*@__PURE__*/ defineComponent({
|
|
|
5165
5173
|
"data-indeterminate": isIndeterminate(node) ? "" : void 0,
|
|
5166
5174
|
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",
|
|
5167
5175
|
"aria-hidden": "true"
|
|
5168
|
-
}, [isChecked(node) ? (openBlock(), createElementBlock("svg", _hoisted_5$
|
|
5176
|
+
}, [isChecked(node) ? (openBlock(), createElementBlock("svg", _hoisted_5$5, [..._cache[0] || (_cache[0] = [createElementVNode("path", { d: "M20 6 9 17l-5-5" }, null, -1)])])) : isIndeterminate(node) ? (openBlock(), createElementBlock("svg", _hoisted_6$4, [..._cache[1] || (_cache[1] = [createElementVNode("path", { d: "M5 12h14" }, null, -1)])])) : createCommentVNode("v-if", true)], 8, _hoisted_4$6)) : createCommentVNode("v-if", true),
|
|
5169
5177
|
createElementVNode("span", _hoisted_7$3, toDisplayString(label(node)), 1)
|
|
5170
|
-
], 12, _hoisted_1$
|
|
5178
|
+
], 12, _hoisted_1$16);
|
|
5171
5179
|
}), 128)), __props.nodes.length === 0 ? (openBlock(), createElementBlock("div", _hoisted_8$1, " 无数据 ")) : createCommentVNode("v-if", true)], 2);
|
|
5172
5180
|
};
|
|
5173
5181
|
}
|
|
5174
5182
|
});
|
|
5175
5183
|
//#endregion
|
|
5176
5184
|
//#region src/components/tree-select/TreeSelect.vue
|
|
5177
|
-
const _hoisted_1$
|
|
5185
|
+
const _hoisted_1$15 = ["aria-expanded", "aria-disabled"];
|
|
5178
5186
|
const _hoisted_2$11 = ["placeholder", "aria-label"];
|
|
5179
5187
|
const _hoisted_3$7 = {
|
|
5180
5188
|
key: 2,
|
|
5181
5189
|
class: "truncate text-muted-foreground"
|
|
5182
5190
|
};
|
|
5183
5191
|
const _hoisted_4$5 = ["placeholder", "aria-label"];
|
|
5184
|
-
const _hoisted_5$
|
|
5192
|
+
const _hoisted_5$4 = {
|
|
5185
5193
|
key: 0,
|
|
5186
5194
|
class: "truncate"
|
|
5187
5195
|
};
|
|
@@ -5538,7 +5546,7 @@ const _sfc_main$50 = /*@__PURE__*/ defineComponent({
|
|
|
5538
5546
|
onClick: openFromInput,
|
|
5539
5547
|
onKeydown: handleKeydown
|
|
5540
5548
|
}), [isMulti.value ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
5541
|
-
tags.value.length ? (openBlock(), createBlock(_sfc_main$
|
|
5549
|
+
tags.value.length ? (openBlock(), createBlock(_sfc_main$58, {
|
|
5542
5550
|
key: 0,
|
|
5543
5551
|
values: tags.value,
|
|
5544
5552
|
"max-tag-count": props.maxTagCount,
|
|
@@ -5567,24 +5575,24 @@ const _sfc_main$50 = /*@__PURE__*/ defineComponent({
|
|
|
5567
5575
|
class: "h-full w-full min-w-0 flex-1 bg-transparent outline-none placeholder:text-muted-foreground",
|
|
5568
5576
|
placeholder: singleLabel.value || props.placeholder,
|
|
5569
5577
|
"aria-label": props.placeholder
|
|
5570
|
-
}, null, 8, _hoisted_4$5)), [[vModelText, pattern.value]]) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [singleLabel.value ? (openBlock(), createElementBlock("span", _hoisted_5$
|
|
5578
|
+
}, null, 8, _hoisted_4$5)), [[vModelText, pattern.value]]) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [singleLabel.value ? (openBlock(), createElementBlock("span", _hoisted_5$4, toDisplayString(singleLabel.value), 1)) : (openBlock(), createElementBlock("span", _hoisted_6$3, toDisplayString(props.placeholder), 1))], 64))], 64)), createElementVNode("span", _hoisted_7$2, [props.clearable && hasValue.value && !props.disabled ? (openBlock(), createElementBlock("span", {
|
|
5571
5579
|
key: 0,
|
|
5572
5580
|
role: "button",
|
|
5573
5581
|
"data-part": "clear",
|
|
5574
5582
|
class: "text-muted-foreground hover:text-foreground",
|
|
5575
5583
|
"aria-label": "清空",
|
|
5576
5584
|
onClick: withModifiers(handleClear, ["stop"])
|
|
5577
|
-
}, [createVNode(CloseIcon_default, { class: "size-4 shrink-0" })])) : createCommentVNode("v-if", true), createVNode(ChevronIcon_default, { class: normalizeClass(unref(cn)("size-4 shrink-0 text-muted-foreground transition-transform", unref(isOpen) ? "-rotate-90" : "rotate-90")) }, null, 8, ["class"])])], 16, _hoisted_1$
|
|
5585
|
+
}, [createVNode(CloseIcon_default, { class: "size-4 shrink-0" })])) : createCommentVNode("v-if", true), createVNode(ChevronIcon_default, { class: normalizeClass(unref(cn)("size-4 shrink-0 text-muted-foreground transition-transform", unref(isOpen) ? "-rotate-90" : "rotate-90")) }, null, 8, ["class"])])], 16, _hoisted_1$15)]),
|
|
5578
5586
|
_: 1
|
|
5579
5587
|
}),
|
|
5580
5588
|
createCommentVNode(" 弹层 Teleport:脱离表单 DOM,消除 overflow 容器裁剪隐患(DatePicker 同款);\n 目标经沙箱适配降级(shadow DOM / wujie graft → 应用挂载容器) "),
|
|
5581
|
-
(openBlock(), createBlock(Teleport, { to: unref(teleportTarget) }, [createVNode(unref(Popover).Positioner, { class: "z-[var(--z-
|
|
5589
|
+
(openBlock(), createBlock(Teleport, { to: unref(teleportTarget) }, [createVNode(unref(Popover).Positioner, { class: "z-[var(--z-modal,60)]" }, {
|
|
5582
5590
|
default: withCtx(() => [createVNode(unref(Popover).Content, {
|
|
5583
|
-
class: normalizeClass(unref(cn)("bg-popover text-popover-foreground z-[var(--z-
|
|
5591
|
+
class: normalizeClass(unref(cn)("bg-popover text-popover-foreground z-[var(--z-modal,60)] 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")),
|
|
5584
5592
|
style: normalizeStyle({ minWidth: panelMinWidth.value }),
|
|
5585
5593
|
onKeydown: handleKeydown
|
|
5586
5594
|
}, {
|
|
5587
|
-
default: withCtx(() => [createVNode(_sfc_main$
|
|
5595
|
+
default: withCtx(() => [createVNode(_sfc_main$56, {
|
|
5588
5596
|
nodes: filteredNodes.value,
|
|
5589
5597
|
"selected-keys": selectedKeys.value,
|
|
5590
5598
|
"expanded-keys": expandedKeys.value,
|
|
@@ -5622,7 +5630,7 @@ const _sfc_main$50 = /*@__PURE__*/ defineComponent({
|
|
|
5622
5630
|
//#region src/components/form-render/widgets/tree.ts
|
|
5623
5631
|
/**
|
|
5624
5632
|
* treeSelect widget:树形下拉选择,options 原名直传(TreeOption 命名穿透),
|
|
5625
|
-
* placeholder 先用 item
|
|
5633
|
+
* placeholder 先用 item 级回退,options.placeholder 展开时覆盖。
|
|
5626
5634
|
* @param options - widget 选项,原名直传给 TreeSelect,placeholder 以 item 级缺省兜底
|
|
5627
5635
|
* @returns 渲染函数,接收渲染上下文并产出 TreeSelect vnode
|
|
5628
5636
|
*/
|
|
@@ -5637,7 +5645,7 @@ function renderTreeSelectItem(options) {
|
|
|
5637
5645
|
}
|
|
5638
5646
|
/**
|
|
5639
5647
|
* cascader widget:级联选择,绑定与 treeSelect 一致(modelValue 受控形态),
|
|
5640
|
-
* placeholder 先用 item
|
|
5648
|
+
* placeholder 先用 item 级回退,options.placeholder 展开时覆盖。
|
|
5641
5649
|
* @param options - widget 选项,原名直传给 Cascader,placeholder 以 item 级缺省兜底
|
|
5642
5650
|
* @returns 渲染函数,接收渲染上下文并产出 Cascader vnode
|
|
5643
5651
|
*/
|
|
@@ -5682,7 +5690,7 @@ function widgetRenders() {
|
|
|
5682
5690
|
}
|
|
5683
5691
|
//#endregion
|
|
5684
5692
|
//#region src/components/form-render/FormRender.vue
|
|
5685
|
-
const _hoisted_1$
|
|
5693
|
+
const _hoisted_1$14 = {
|
|
5686
5694
|
key: 0,
|
|
5687
5695
|
class: "col-span-full flex justify-end gap-2"
|
|
5688
5696
|
};
|
|
@@ -5755,8 +5763,8 @@ const _sfc_main$25 = /*@__PURE__*/ defineComponent({
|
|
|
5755
5763
|
if (props.searchable !== void 0 || props.submitable !== void 0 || props.resetable !== void 0 || props.cancelable !== void 0 || props.searchText !== void 0 || props.submitText !== void 0 || props.resetText !== void 0) console.warn("[tu-design] <FormRender> definition.actions 与按钮 props 同传,已按 actions 渲染。");
|
|
5756
5764
|
}
|
|
5757
5765
|
/**
|
|
5758
|
-
*
|
|
5759
|
-
*
|
|
5766
|
+
* 校验失败时 isFieldsValid=false,不 emit;成功后才 emit(事件回调中一次性读取不受非响应式限制)。
|
|
5767
|
+
* 校验语义单点化:definition 存在时复用 definition.submit();拆分式 :form + :items 走内联逻辑
|
|
5760
5768
|
* @param mode - 提交语义:"search" 触发 search 事件(查询按钮),"submit" 触发 submit 事件
|
|
5761
5769
|
*/
|
|
5762
5770
|
async function submit(mode) {
|
|
@@ -5789,7 +5797,7 @@ const _sfc_main$25 = /*@__PURE__*/ defineComponent({
|
|
|
5789
5797
|
return openBlock(), createElementBlock("div", {
|
|
5790
5798
|
key: String(item.key),
|
|
5791
5799
|
style: normalizeStyle(spanStyle(item.span))
|
|
5792
|
-
}, [createVNode(_sfc_main$
|
|
5800
|
+
}, [createVNode(_sfc_main$65, {
|
|
5793
5801
|
item,
|
|
5794
5802
|
widget: widgetOf(item),
|
|
5795
5803
|
values: unref(valuesRef)
|
|
@@ -5798,7 +5806,7 @@ const _sfc_main$25 = /*@__PURE__*/ defineComponent({
|
|
|
5798
5806
|
"widget",
|
|
5799
5807
|
"values"
|
|
5800
5808
|
])], 4);
|
|
5801
|
-
}), 128)), showActions.value ? (openBlock(), createElementBlock("div", _hoisted_1$
|
|
5809
|
+
}), 128)), showActions.value ? (openBlock(), createElementBlock("div", _hoisted_1$14, [renderSlot(_ctx.$slots, "actions", {}, () => [
|
|
5802
5810
|
searchable.value ? (openBlock(), createBlock(unref(_sfc_main$5), {
|
|
5803
5811
|
key: 0,
|
|
5804
5812
|
onClick: _cache[0] || (_cache[0] = ($event) => submit("search"))
|
|
@@ -5883,8 +5891,8 @@ function useFormRender(options) {
|
|
|
5883
5891
|
* - `items` / `form` 传给 `<FormRender>`(支持 `:definition` 单 prop 或 `:form` + `:items` 拆分);
|
|
5884
5892
|
* - `form` 可直接 `reset()` / `validate()` / `handleSubmit()`;
|
|
5885
5893
|
* - `resetToDefaults()` 重置到 `items.default`(搜索表单"重置"语义);
|
|
5886
|
-
* - `submit()`
|
|
5887
|
-
* - `actions` 按钮预设(searchable 等七项直传):存在时 `<FormRender>` 组件按钮 props
|
|
5894
|
+
* - `submit()` 全量校验并返回是否通过(组合式查询链路);
|
|
5895
|
+
* - `actions` 按钮预设(searchable 等七项直传):存在时 `<FormRender>` 组件按钮 props 全量忽略(块级互斥)。
|
|
5888
5896
|
*
|
|
5889
5897
|
* 须在组件 setup 中调用(TanStack useForm 约束)。
|
|
5890
5898
|
* @param config - 表单配置:字段定义、校验 schema、提交回调、按钮预设七项与 TanStack 透传项
|
|
@@ -6194,7 +6202,7 @@ const cardVariants = cva("relative rounded-xl border border-border bg-card text-
|
|
|
6194
6202
|
});
|
|
6195
6203
|
//#endregion
|
|
6196
6204
|
//#region src/components/dialog/Dialog.vue
|
|
6197
|
-
const _hoisted_1$
|
|
6205
|
+
const _hoisted_1$13 = {
|
|
6198
6206
|
key: 0,
|
|
6199
6207
|
class: "flex flex-col gap-2 text-center sm:text-left"
|
|
6200
6208
|
};
|
|
@@ -6273,7 +6281,7 @@ const _sfc_main$14 = /*@__PURE__*/ defineComponent({
|
|
|
6273
6281
|
setOpen(false);
|
|
6274
6282
|
}
|
|
6275
6283
|
const hasHeader = computed(() => Boolean(props.title || props.description));
|
|
6276
|
-
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-
|
|
6284
|
+
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-modal,60)] 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));
|
|
6277
6285
|
return (_ctx, _cache) => {
|
|
6278
6286
|
return openBlock(), createBlock(unref(Dialog).Root, {
|
|
6279
6287
|
ids: unref(rootIds),
|
|
@@ -6291,12 +6299,12 @@ const _sfc_main$14 = /*@__PURE__*/ defineComponent({
|
|
|
6291
6299
|
default: withCtx(() => [renderSlot(_ctx.$slots, "trigger")]),
|
|
6292
6300
|
_: 3
|
|
6293
6301
|
})) : createCommentVNode("v-if", true),
|
|
6294
|
-
createVNode(unref(Dialog).Backdrop, { class: "fixed inset-0 z-[var(--z-
|
|
6295
|
-
createVNode(unref(Dialog).Positioner, { class: "fixed inset-0 z-[var(--z-
|
|
6302
|
+
createVNode(unref(Dialog).Backdrop, { class: "fixed inset-0 z-[var(--z-modal,60)] 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" }),
|
|
6303
|
+
createVNode(unref(Dialog).Positioner, { class: "fixed inset-0 z-[var(--z-modal,60)] flex items-center justify-center p-4" }, {
|
|
6296
6304
|
default: withCtx(() => [createVNode(unref(Dialog).Content, { class: normalizeClass(contentClass.value) }, {
|
|
6297
6305
|
default: withCtx(() => [
|
|
6298
6306
|
createCommentVNode(" 标题/描述:#title / #description 插槽优先,回退 title/description props;皆无则不渲染对应 DOM "),
|
|
6299
|
-
hasHeader.value || _ctx.$slots.title || _ctx.$slots.description ? (openBlock(), createElementBlock("div", _hoisted_1$
|
|
6307
|
+
hasHeader.value || _ctx.$slots.title || _ctx.$slots.description ? (openBlock(), createElementBlock("div", _hoisted_1$13, [_ctx.$slots.title || props.title ? (openBlock(), createBlock(unref(Dialog).Title, {
|
|
6300
6308
|
key: 0,
|
|
6301
6309
|
class: "text-lg font-semibold leading-none tracking-tight"
|
|
6302
6310
|
}, {
|
|
@@ -6343,7 +6351,7 @@ const _sfc_main$14 = /*@__PURE__*/ defineComponent({
|
|
|
6343
6351
|
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";
|
|
6344
6352
|
const labelCls = "px-2 py-1.5 text-sm font-medium";
|
|
6345
6353
|
const separatorCls = "-mx-1 my-1 h-px bg-muted";
|
|
6346
|
-
const _sfc_main$
|
|
6354
|
+
const _sfc_main$55 = /*@__PURE__*/ defineComponent({
|
|
6347
6355
|
__name: "MenuItems",
|
|
6348
6356
|
props: { items: {} },
|
|
6349
6357
|
setup(__props) {
|
|
@@ -6467,7 +6475,7 @@ const _sfc_main$16 = /*@__PURE__*/ defineComponent({
|
|
|
6467
6475
|
}, 8, ["class"]),
|
|
6468
6476
|
createVNode(unref(Menu).Positioner, { class: "z-[var(--z-overlay)]" }, {
|
|
6469
6477
|
default: withCtx(() => [createVNode(unref(Menu).Content, mergeProps(unref(attrs), { class: unref(cn)(contentCls$1, props.contentClass) }), {
|
|
6470
|
-
default: withCtx(() => [createVNode(_sfc_main$
|
|
6478
|
+
default: withCtx(() => [createVNode(_sfc_main$55, { items: props.items }, createSlots({ _: 2 }, [_ctx.$slots.item ? {
|
|
6471
6479
|
name: "item",
|
|
6472
6480
|
fn: withCtx((slotProps) => [renderSlot(_ctx.$slots, "item", normalizeProps(guardReactiveProps(slotProps)))]),
|
|
6473
6481
|
key: "0"
|
|
@@ -6784,9 +6792,9 @@ const _sfc_main$34 = /*@__PURE__*/ defineComponent({
|
|
|
6784
6792
|
sameWidth: props.matchTriggerWidth || user.sameWidth
|
|
6785
6793
|
});
|
|
6786
6794
|
});
|
|
6787
|
-
const contentClass = computed(() => cn("bg-popover text-popover-foreground z-[var(--z-
|
|
6795
|
+
const contentClass = computed(() => cn("bg-popover text-popover-foreground z-[var(--z-modal,60)] 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"]));
|
|
6788
6796
|
const arrowClass = computed(() => cn("[--arrow-size:10px] [--arrow-background:var(--popover)]", props.arrowClass));
|
|
6789
|
-
const positionerClass = computed(() => props.zIndex != null ? "" : "z-[var(--z-
|
|
6797
|
+
const positionerClass = computed(() => props.zIndex != null ? "" : "z-[var(--z-modal,60)]");
|
|
6790
6798
|
const positionerStyle = computed(() => props.zIndex != null ? { zIndex: props.zIndex } : void 0);
|
|
6791
6799
|
return (_ctx, _cache) => {
|
|
6792
6800
|
return openBlock(), createBlock(unref(Popover).Root, mergeProps(unref(attrs), {
|
|
@@ -6860,7 +6868,7 @@ const _sfc_main$34 = /*@__PURE__*/ defineComponent({
|
|
|
6860
6868
|
});
|
|
6861
6869
|
//#endregion
|
|
6862
6870
|
//#region src/components/separator/Separator.vue
|
|
6863
|
-
const _hoisted_1$
|
|
6871
|
+
const _hoisted_1$12 = ["data-orientation"];
|
|
6864
6872
|
const _sfc_main$38 = /*@__PURE__*/ defineComponent({
|
|
6865
6873
|
__name: "Separator",
|
|
6866
6874
|
props: {
|
|
@@ -6874,7 +6882,7 @@ const _sfc_main$38 = /*@__PURE__*/ defineComponent({
|
|
|
6874
6882
|
return openBlock(), createElementBlock("div", {
|
|
6875
6883
|
"data-orientation": props.orientation,
|
|
6876
6884
|
class: normalizeClass(unref(cn)("bg-border shrink-0", orientationClass.value, props.class))
|
|
6877
|
-
}, null, 10, _hoisted_1$
|
|
6885
|
+
}, null, 10, _hoisted_1$12);
|
|
6878
6886
|
};
|
|
6879
6887
|
}
|
|
6880
6888
|
});
|
|
@@ -6895,14 +6903,14 @@ const _sfc_main$39 = /*@__PURE__*/ defineComponent({
|
|
|
6895
6903
|
});
|
|
6896
6904
|
//#endregion
|
|
6897
6905
|
//#region src/components/table-render/TablePagination.vue
|
|
6898
|
-
const _hoisted_1$
|
|
6906
|
+
const _hoisted_1$11 = {
|
|
6899
6907
|
key: 0,
|
|
6900
6908
|
class: "flex items-center gap-2 text-muted-foreground"
|
|
6901
6909
|
};
|
|
6902
6910
|
const _hoisted_2$9 = { key: 0 };
|
|
6903
6911
|
const _hoisted_3$6 = ["value"];
|
|
6904
6912
|
const _hoisted_4$4 = ["value"];
|
|
6905
|
-
const _hoisted_5$
|
|
6913
|
+
const _hoisted_5$3 = {
|
|
6906
6914
|
key: 0,
|
|
6907
6915
|
xmlns: "http://www.w3.org/2000/svg",
|
|
6908
6916
|
viewBox: "0 0 24 24",
|
|
@@ -6929,8 +6937,8 @@ const _hoisted_6$2 = {
|
|
|
6929
6937
|
const _sfc_main$43 = /*@__PURE__*/ defineComponent({
|
|
6930
6938
|
__name: "TablePagination",
|
|
6931
6939
|
props: {
|
|
6932
|
-
/** 组合式:传 defineTable 返回值,自动接线 page
|
|
6933
|
-
* 与手动分页 props 同传时以 definition 为准(DEV
|
|
6940
|
+
/** 组合式:传 defineTable 返回值,自动接线 page/动作并单页自隐藏;
|
|
6941
|
+
* 与手动分页 props 同传时以 definition 为准(DEV 警告) */
|
|
6934
6942
|
definition: { type: Object },
|
|
6935
6943
|
/** 1-based 当前页码(手动模式) */
|
|
6936
6944
|
pageIndex: {
|
|
@@ -6978,7 +6986,7 @@ const _sfc_main$43 = /*@__PURE__*/ defineComponent({
|
|
|
6978
6986
|
const pageSizeOpts = computed(() => props.definition?.page.pageSizeOpts ?? props.pageSizeOpts);
|
|
6979
6987
|
const total = computed(() => props.definition?.page.total ?? props.total);
|
|
6980
6988
|
const totalPages = computed(() => Math.max(1, Math.ceil((total.value ?? 0) / (pageSize.value ?? 1))));
|
|
6981
|
-
/** 可见性:definition
|
|
6989
|
+
/** 可见性:definition 模式单页自隐藏;手动模式须 pageIndex/pageSize/total 齐备(缺项 DEV 警告 + 不渲染) */
|
|
6982
6990
|
const visible = computed(() => {
|
|
6983
6991
|
if (props.definition !== void 0) return Math.ceil((total.value ?? 0) / (pageSize.value ?? 1)) > 1;
|
|
6984
6992
|
return props.pageIndex !== void 0 && props.pageSize !== void 0 && props.total !== void 0;
|
|
@@ -6995,7 +7003,7 @@ const _sfc_main$43 = /*@__PURE__*/ defineComponent({
|
|
|
6995
7003
|
props.definition?.setPageSize(value);
|
|
6996
7004
|
emit("update:pageSize", value);
|
|
6997
7005
|
}
|
|
6998
|
-
/** 页码窗口:首页/尾页 + 当前页 ±1
|
|
7006
|
+
/** 页码窗口:首页/尾页 + 当前页 ±1,跳过段用省略号 */
|
|
6999
7007
|
const pages = computed(() => {
|
|
7000
7008
|
const count = totalPages.value;
|
|
7001
7009
|
const current = pageIndex.value ?? 1;
|
|
@@ -7016,11 +7024,11 @@ const _sfc_main$43 = /*@__PURE__*/ defineComponent({
|
|
|
7016
7024
|
return items;
|
|
7017
7025
|
});
|
|
7018
7026
|
return (_ctx, _cache) => {
|
|
7019
|
-
return openBlock(), createElementBlock(Fragment, null, [createCommentVNode("
|
|
7027
|
+
return openBlock(), createElementBlock(Fragment, null, [createCommentVNode(" 不带 border-t(布局归使用方,TableRender 内置使用处显式补);左区缺省时页码靠右 "), visible.value ? (openBlock(), createElementBlock("div", {
|
|
7020
7028
|
key: 0,
|
|
7021
7029
|
class: normalizeClass(unref(cn)("flex w-full items-center gap-4 p-2 text-sm", hasLeft.value ? "justify-between" : "justify-end", _ctx.$attrs.class))
|
|
7022
7030
|
}, [
|
|
7023
|
-
hasLeft.value ? (openBlock(), createElementBlock("div", _hoisted_1$
|
|
7031
|
+
hasLeft.value ? (openBlock(), createElementBlock("div", _hoisted_1$11, [showTotalBar.value ? (openBlock(), createElementBlock("span", _hoisted_2$9, "共 " + toDisplayString(total.value) + " 条", 1)) : createCommentVNode("v-if", true), showSelect.value ? (openBlock(), createElementBlock("select", {
|
|
7024
7032
|
key: 1,
|
|
7025
7033
|
class: "h-8 rounded-md border bg-transparent px-2 text-sm",
|
|
7026
7034
|
value: pageSize.value,
|
|
@@ -7046,7 +7054,7 @@ const _sfc_main$43 = /*@__PURE__*/ defineComponent({
|
|
|
7046
7054
|
disabled: (pageIndex.value ?? 1) <= 1,
|
|
7047
7055
|
"aria-label": iconMode.value ? "上一页" : void 0
|
|
7048
7056
|
}, {
|
|
7049
|
-
default: withCtx(() => [iconMode.value ? (openBlock(), createElementBlock("svg", _hoisted_5$
|
|
7057
|
+
default: withCtx(() => [iconMode.value ? (openBlock(), createElementBlock("svg", _hoisted_5$3, [..._cache[2] || (_cache[2] = [createElementVNode("path", { d: "m15 18-6-6 6-6" }, null, -1)])])) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [createTextVNode("上一页")], 64))]),
|
|
7050
7058
|
_: 1
|
|
7051
7059
|
}, 8, [
|
|
7052
7060
|
"class",
|
|
@@ -7091,6 +7099,171 @@ const _sfc_main$43 = /*@__PURE__*/ defineComponent({
|
|
|
7091
7099
|
}
|
|
7092
7100
|
});
|
|
7093
7101
|
//#endregion
|
|
7102
|
+
//#region src/components/overlay-shared/useConfirmPending.ts
|
|
7103
|
+
/**
|
|
7104
|
+
* 确认弹层公共 pending 语义:@confirm 处理器返回 Promise 时锁定关闭通道,
|
|
7105
|
+
* resolve 后自动关闭,reject 保持打开并退出 loading;同步处理器直接关闭。
|
|
7106
|
+
* @param options - pending 配置:组件实例、confirm/cancel 补发与弹层关闭回调
|
|
7107
|
+
* @returns loading(确认进行中标记)、handleConfirm(异步确认处理)与 handleCancel(取消处理)
|
|
7108
|
+
*/
|
|
7109
|
+
function useConfirmPending(options) {
|
|
7110
|
+
const loading = ref(false);
|
|
7111
|
+
function handleConfirm() {
|
|
7112
|
+
if (loading.value) return;
|
|
7113
|
+
const handler = options.instance?.vnode.props?.onConfirm;
|
|
7114
|
+
const result = handler?.();
|
|
7115
|
+
if (!handler) options.emitConfirm();
|
|
7116
|
+
if (result instanceof Promise) {
|
|
7117
|
+
loading.value = true;
|
|
7118
|
+
result.then(() => {
|
|
7119
|
+
loading.value = false;
|
|
7120
|
+
options.close();
|
|
7121
|
+
}).catch(() => {
|
|
7122
|
+
loading.value = false;
|
|
7123
|
+
});
|
|
7124
|
+
} else options.close();
|
|
7125
|
+
}
|
|
7126
|
+
function handleCancel() {
|
|
7127
|
+
if (loading.value) return;
|
|
7128
|
+
options.emitCancel();
|
|
7129
|
+
options.close();
|
|
7130
|
+
}
|
|
7131
|
+
return {
|
|
7132
|
+
loading,
|
|
7133
|
+
handleConfirm,
|
|
7134
|
+
handleCancel
|
|
7135
|
+
};
|
|
7136
|
+
}
|
|
7137
|
+
//#endregion
|
|
7138
|
+
//#region src/components/popconfirm/Popconfirm.vue
|
|
7139
|
+
const _hoisted_1$10 = { class: "mt-3 flex items-center justify-end gap-2" };
|
|
7140
|
+
const _hoisted_2$8 = {
|
|
7141
|
+
key: 0,
|
|
7142
|
+
viewBox: "0 0 24 24",
|
|
7143
|
+
fill: "none",
|
|
7144
|
+
stroke: "currentColor",
|
|
7145
|
+
"stroke-width": "2",
|
|
7146
|
+
"stroke-linecap": "round",
|
|
7147
|
+
class: "size-4 animate-spin",
|
|
7148
|
+
"aria-hidden": "true"
|
|
7149
|
+
};
|
|
7150
|
+
/**
|
|
7151
|
+
* 气泡确认:Popover 的一体式薄壳变体,面板内容内置 title/description + 确认/取消按钮。
|
|
7152
|
+
* 行为与 M2 AlertDialog 对齐:@confirm 处理器返回 Promise 时确认钮进入 loading 并锁定全部
|
|
7153
|
+
* 关闭通道(ESC/点外部/触发器/取消钮),resolve 后自动关闭、reject 保持打开;
|
|
7154
|
+
* 同步处理器点击确认/取消后自动关闭并派发对应事件。
|
|
7155
|
+
*/
|
|
7156
|
+
const _sfc_main$33 = /*@__PURE__*/ defineComponent({
|
|
7157
|
+
inheritAttrs: false,
|
|
7158
|
+
__name: "Popconfirm",
|
|
7159
|
+
props: {
|
|
7160
|
+
/** 气泡标题(渲染为 Ark Popover.Title,content 自动接线 aria-labelledby) */
|
|
7161
|
+
title: {
|
|
7162
|
+
type: String,
|
|
7163
|
+
required: true
|
|
7164
|
+
},
|
|
7165
|
+
/** 气泡描述(可选,渲染为 Ark Popover.Description,content 自动接线 aria-describedby) */
|
|
7166
|
+
description: {
|
|
7167
|
+
type: String,
|
|
7168
|
+
default: void 0
|
|
7169
|
+
},
|
|
7170
|
+
/** 确认按钮文案 */
|
|
7171
|
+
confirmText: {
|
|
7172
|
+
type: String,
|
|
7173
|
+
default: "确定"
|
|
7174
|
+
},
|
|
7175
|
+
/** 取消按钮文案 */
|
|
7176
|
+
cancelText: {
|
|
7177
|
+
type: String,
|
|
7178
|
+
default: "取消"
|
|
7179
|
+
},
|
|
7180
|
+
/** 确认按钮风格:default 主色 / destructive 危险色 */
|
|
7181
|
+
variant: {
|
|
7182
|
+
type: String,
|
|
7183
|
+
default: "default"
|
|
7184
|
+
},
|
|
7185
|
+
/** 受控开关(配合 v-model:open);不传时为非受控,由内部状态管理 */
|
|
7186
|
+
open: {
|
|
7187
|
+
type: Boolean,
|
|
7188
|
+
default: void 0
|
|
7189
|
+
}
|
|
7190
|
+
},
|
|
7191
|
+
emits: [
|
|
7192
|
+
"update:open",
|
|
7193
|
+
"confirm",
|
|
7194
|
+
"cancel"
|
|
7195
|
+
],
|
|
7196
|
+
setup(__props, { emit: __emit }) {
|
|
7197
|
+
const props = __props;
|
|
7198
|
+
const emit = __emit;
|
|
7199
|
+
const attrs = useAttrs();
|
|
7200
|
+
const instance = getCurrentInstance();
|
|
7201
|
+
const { isOpen, setOpen } = useControlledBoolean({
|
|
7202
|
+
controlled: () => props.open,
|
|
7203
|
+
onChange: (open) => emit("update:open", open)
|
|
7204
|
+
});
|
|
7205
|
+
function handleUpdate(open) {
|
|
7206
|
+
if (!open && loading.value) return;
|
|
7207
|
+
setOpen(open);
|
|
7208
|
+
}
|
|
7209
|
+
/** 关闭气泡:走受控桥把 open 置 false,定位回退/动画由 zag 处理 */
|
|
7210
|
+
function close() {
|
|
7211
|
+
handleUpdate(false);
|
|
7212
|
+
}
|
|
7213
|
+
const { loading, handleConfirm, handleCancel } = useConfirmPending({
|
|
7214
|
+
instance,
|
|
7215
|
+
emitConfirm: () => emit("confirm"),
|
|
7216
|
+
emitCancel: () => emit("cancel"),
|
|
7217
|
+
close
|
|
7218
|
+
});
|
|
7219
|
+
return (_ctx, _cache) => {
|
|
7220
|
+
return openBlock(), createElementBlock(Fragment, null, [createCommentVNode(" 薄壳复用 Popover:触发器 asChild、受控桥、定位与进出场动画均由 Popover 提供 "), createVNode(unref(_sfc_main$34), mergeProps(unref(attrs), {
|
|
7221
|
+
open: unref(isOpen),
|
|
7222
|
+
"content-class": "w-64 p-3",
|
|
7223
|
+
"onUpdate:open": handleUpdate
|
|
7224
|
+
}), {
|
|
7225
|
+
content: withCtx(() => [
|
|
7226
|
+
createVNode(unref(Popover).Title, { class: "text-sm font-medium" }, {
|
|
7227
|
+
default: withCtx(() => [createTextVNode(toDisplayString(props.title), 1)]),
|
|
7228
|
+
_: 1
|
|
7229
|
+
}),
|
|
7230
|
+
props.description ? (openBlock(), createBlock(unref(Popover).Description, {
|
|
7231
|
+
key: 0,
|
|
7232
|
+
class: "mt-1 text-xs text-muted-foreground"
|
|
7233
|
+
}, {
|
|
7234
|
+
default: withCtx(() => [createTextVNode(toDisplayString(props.description), 1)]),
|
|
7235
|
+
_: 1
|
|
7236
|
+
})) : createCommentVNode("v-if", true),
|
|
7237
|
+
createCommentVNode(" 操作区:取消 outline,确认按 variant 切换语义色;pending 时双钮禁用 + 确认钮转 loading "),
|
|
7238
|
+
createElementVNode("div", _hoisted_1$10, [createVNode(unref(_sfc_main$5), {
|
|
7239
|
+
variant: "outline",
|
|
7240
|
+
size: "sm",
|
|
7241
|
+
disabled: unref(loading),
|
|
7242
|
+
onClick: unref(handleCancel)
|
|
7243
|
+
}, {
|
|
7244
|
+
default: withCtx(() => [createTextVNode(toDisplayString(props.cancelText), 1)]),
|
|
7245
|
+
_: 1
|
|
7246
|
+
}, 8, ["disabled", "onClick"]), createVNode(unref(_sfc_main$5), {
|
|
7247
|
+
variant: props.variant === "destructive" ? "destructive" : "default",
|
|
7248
|
+
size: "sm",
|
|
7249
|
+
disabled: unref(loading),
|
|
7250
|
+
onClick: unref(handleConfirm)
|
|
7251
|
+
}, {
|
|
7252
|
+
default: withCtx(() => [unref(loading) ? (openBlock(), createElementBlock("svg", _hoisted_2$8, [..._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)]),
|
|
7253
|
+
_: 1
|
|
7254
|
+
}, 8, [
|
|
7255
|
+
"variant",
|
|
7256
|
+
"disabled",
|
|
7257
|
+
"onClick"
|
|
7258
|
+
])])
|
|
7259
|
+
]),
|
|
7260
|
+
default: withCtx(() => [renderSlot(_ctx.$slots, "default")]),
|
|
7261
|
+
_: 3
|
|
7262
|
+
}, 16, ["open"])], 2112);
|
|
7263
|
+
};
|
|
7264
|
+
}
|
|
7265
|
+
});
|
|
7266
|
+
//#endregion
|
|
7094
7267
|
//#region src/components/table-render/column-renders.ts
|
|
7095
7268
|
/**
|
|
7096
7269
|
* 两位补零
|
|
@@ -7117,41 +7290,143 @@ function formatDate(input, pattern) {
|
|
|
7117
7290
|
};
|
|
7118
7291
|
return pattern.replace(/yyyy|MM|dd|HH|mm|ss/g, (token) => tokens[token]);
|
|
7119
7292
|
}
|
|
7293
|
+
const FIT_CLASS = {
|
|
7294
|
+
cover: "object-cover",
|
|
7295
|
+
contain: "object-contain",
|
|
7296
|
+
fill: "object-fill",
|
|
7297
|
+
none: "object-none",
|
|
7298
|
+
"scale-down": "object-scale-down"
|
|
7299
|
+
};
|
|
7300
|
+
const SHAPE_CLASS = {
|
|
7301
|
+
rounded: "rounded-md",
|
|
7302
|
+
square: "rounded-none",
|
|
7303
|
+
circle: "rounded-full"
|
|
7304
|
+
};
|
|
7120
7305
|
/**
|
|
7121
|
-
*
|
|
7122
|
-
*
|
|
7123
|
-
* 与 FormRender widget 的 r.xxx() 范式共词根(D10)。
|
|
7124
|
-
* @returns 各内置渲染器集合(render/dict/date/currency/serial/button)
|
|
7306
|
+
* 单元格图片内部组件(不导出):error 计数状态机驱动 原图 → fallback → 占位盒。
|
|
7307
|
+
* errors 单调递增防循环切换;watch src 复位,防虚拟滚动/分页行复用串图。
|
|
7125
7308
|
*/
|
|
7126
|
-
|
|
7127
|
-
|
|
7128
|
-
|
|
7129
|
-
|
|
7130
|
-
|
|
7131
|
-
|
|
7132
|
-
const entry = mapping[raw];
|
|
7133
|
-
if (entry === void 0) return raw ?? "";
|
|
7134
|
-
const label = typeof entry === "string" ? entry : entry.label;
|
|
7135
|
-
const entryVariant = typeof entry === "object" ? entry.variant : void 0;
|
|
7136
|
-
if (entryVariant !== void 0 || options?.badge !== void 0) {
|
|
7137
|
-
const variant = entryVariant ?? (options?.badge === true ? void 0 : options?.badge);
|
|
7138
|
-
return h(_sfc_main$4, { variant }, () => label);
|
|
7139
|
-
}
|
|
7140
|
-
return label;
|
|
7141
|
-
};
|
|
7309
|
+
const CellImage = defineComponent({
|
|
7310
|
+
name: "TuCellImage",
|
|
7311
|
+
props: {
|
|
7312
|
+
src: {
|
|
7313
|
+
type: String,
|
|
7314
|
+
required: true
|
|
7142
7315
|
},
|
|
7143
|
-
|
|
7144
|
-
|
|
7316
|
+
alt: {
|
|
7317
|
+
type: String,
|
|
7318
|
+
default: ""
|
|
7145
7319
|
},
|
|
7146
|
-
|
|
7147
|
-
|
|
7148
|
-
|
|
7149
|
-
|
|
7150
|
-
|
|
7151
|
-
|
|
7152
|
-
|
|
7153
|
-
|
|
7154
|
-
|
|
7320
|
+
fallback: {
|
|
7321
|
+
type: String,
|
|
7322
|
+
default: void 0
|
|
7323
|
+
},
|
|
7324
|
+
size: {
|
|
7325
|
+
type: Number,
|
|
7326
|
+
default: 40
|
|
7327
|
+
},
|
|
7328
|
+
fit: {
|
|
7329
|
+
type: String,
|
|
7330
|
+
default: "cover"
|
|
7331
|
+
},
|
|
7332
|
+
shape: {
|
|
7333
|
+
type: String,
|
|
7334
|
+
default: "rounded"
|
|
7335
|
+
}
|
|
7336
|
+
},
|
|
7337
|
+
setup(props) {
|
|
7338
|
+
const errors = ref(0);
|
|
7339
|
+
watch(() => props.src, () => {
|
|
7340
|
+
errors.value = 0;
|
|
7341
|
+
});
|
|
7342
|
+
return () => {
|
|
7343
|
+
const sizeStyle = {
|
|
7344
|
+
width: `${props.size}px`,
|
|
7345
|
+
height: `${props.size}px`
|
|
7346
|
+
};
|
|
7347
|
+
const shapeClass = SHAPE_CLASS[props.shape];
|
|
7348
|
+
const currentSrc = errors.value === 0 ? props.src : errors.value === 1 ? props.fallback : void 0;
|
|
7349
|
+
if (!currentSrc) return h("div", {
|
|
7350
|
+
class: ["bg-muted text-muted-foreground flex items-center justify-center", shapeClass],
|
|
7351
|
+
style: sizeStyle,
|
|
7352
|
+
"aria-hidden": "true"
|
|
7353
|
+
}, [h("svg", {
|
|
7354
|
+
viewBox: "0 0 24 24",
|
|
7355
|
+
fill: "none",
|
|
7356
|
+
stroke: "currentColor",
|
|
7357
|
+
"stroke-width": "2",
|
|
7358
|
+
"stroke-linecap": "round",
|
|
7359
|
+
"stroke-linejoin": "round",
|
|
7360
|
+
class: "size-1/2",
|
|
7361
|
+
"aria-hidden": "true"
|
|
7362
|
+
}, [
|
|
7363
|
+
h("rect", {
|
|
7364
|
+
width: "18",
|
|
7365
|
+
height: "18",
|
|
7366
|
+
x: "3",
|
|
7367
|
+
y: "3",
|
|
7368
|
+
rx: "2",
|
|
7369
|
+
ry: "2"
|
|
7370
|
+
}),
|
|
7371
|
+
h("circle", {
|
|
7372
|
+
cx: "9",
|
|
7373
|
+
cy: "9",
|
|
7374
|
+
r: "2"
|
|
7375
|
+
}),
|
|
7376
|
+
h("path", { d: "m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21" })
|
|
7377
|
+
])]);
|
|
7378
|
+
return h("img", {
|
|
7379
|
+
src: currentSrc,
|
|
7380
|
+
alt: props.alt,
|
|
7381
|
+
loading: "lazy",
|
|
7382
|
+
class: [
|
|
7383
|
+
"bg-muted",
|
|
7384
|
+
shapeClass,
|
|
7385
|
+
FIT_CLASS[props.fit]
|
|
7386
|
+
],
|
|
7387
|
+
style: sizeStyle,
|
|
7388
|
+
onError: () => {
|
|
7389
|
+
errors.value++;
|
|
7390
|
+
}
|
|
7391
|
+
});
|
|
7392
|
+
};
|
|
7393
|
+
}
|
|
7394
|
+
});
|
|
7395
|
+
/**
|
|
7396
|
+
* 内置列渲染器工厂:dict/date/currency/serial/button/image。
|
|
7397
|
+
* 返回值直接填入 TableColumnOptions.render;column 参数用于读取字段值。
|
|
7398
|
+
* 与 FormRender widget 的 r.xxx() 范式共词根。
|
|
7399
|
+
* @returns 各内置渲染器集合(render/dict/date/currency/serial/button/image)
|
|
7400
|
+
*/
|
|
7401
|
+
function columnRenders() {
|
|
7402
|
+
return {
|
|
7403
|
+
render: (fn) => fn,
|
|
7404
|
+
dict(mapping, options) {
|
|
7405
|
+
return (record, _index, column) => {
|
|
7406
|
+
const raw = record[column.key];
|
|
7407
|
+
const entry = mapping[raw];
|
|
7408
|
+
if (entry === void 0) return raw ?? "";
|
|
7409
|
+
const label = typeof entry === "string" ? entry : entry.label;
|
|
7410
|
+
const entryVariant = typeof entry === "object" ? entry.variant : void 0;
|
|
7411
|
+
if (entryVariant !== void 0 || options?.badge !== void 0) {
|
|
7412
|
+
const variant = entryVariant ?? (options?.badge === true ? void 0 : options?.badge);
|
|
7413
|
+
return h(_sfc_main$4, { variant }, () => label);
|
|
7414
|
+
}
|
|
7415
|
+
return label;
|
|
7416
|
+
};
|
|
7417
|
+
},
|
|
7418
|
+
date(pattern = "yyyy-MM-dd") {
|
|
7419
|
+
return (record, _index, column) => formatDate(record[column.key], pattern);
|
|
7420
|
+
},
|
|
7421
|
+
currency(currency = "CNY", locale = "zh-CN") {
|
|
7422
|
+
const format = new Intl.NumberFormat(locale, {
|
|
7423
|
+
style: "currency",
|
|
7424
|
+
currency
|
|
7425
|
+
});
|
|
7426
|
+
return (record, _index, column) => {
|
|
7427
|
+
const raw = record[column.key];
|
|
7428
|
+
const value = typeof raw === "string" ? Number(raw) : raw;
|
|
7429
|
+
if (typeof value !== "number" || Number.isNaN(value)) return raw;
|
|
7155
7430
|
return format.format(value);
|
|
7156
7431
|
};
|
|
7157
7432
|
},
|
|
@@ -7163,14 +7438,40 @@ function columnRenders() {
|
|
|
7163
7438
|
if (items.length === 0) return "";
|
|
7164
7439
|
return h("div", { class: "inline-flex items-center gap-1" }, items.map((item) => {
|
|
7165
7440
|
const action = typeof item === "string" ? { text: item } : item;
|
|
7166
|
-
|
|
7441
|
+
const buttonNode = h(_sfc_main$5, {
|
|
7167
7442
|
size: "sm",
|
|
7168
7443
|
variant: action.variant ?? "link",
|
|
7169
7444
|
disabled: action.disabled?.(record, index),
|
|
7170
|
-
onClick: () => action.onClick?.(record, index)
|
|
7445
|
+
onClick: action.confirm ? void 0 : () => action.onClick?.(record, index)
|
|
7171
7446
|
}, () => typeof action.text === "function" ? action.text(record, index) : action.text);
|
|
7447
|
+
if (!action.confirm) return buttonNode;
|
|
7448
|
+
const confirm = typeof action.confirm === "string" ? { title: action.confirm } : action.confirm;
|
|
7449
|
+
const resolveText = (value) => typeof value === "function" ? value(record, index) : value;
|
|
7450
|
+
return h(_sfc_main$33, {
|
|
7451
|
+
title: resolveText(confirm.title),
|
|
7452
|
+
description: resolveText(confirm.description),
|
|
7453
|
+
confirmText: confirm.confirmText,
|
|
7454
|
+
cancelText: confirm.cancelText,
|
|
7455
|
+
variant: confirm.variant ?? (action.variant === "destructive" ? "destructive" : "default"),
|
|
7456
|
+
onConfirm: () => action.onClick?.(record, index)
|
|
7457
|
+
}, () => buttonNode);
|
|
7172
7458
|
}));
|
|
7173
7459
|
};
|
|
7460
|
+
},
|
|
7461
|
+
image(options) {
|
|
7462
|
+
return (record, index, column) => {
|
|
7463
|
+
const raw = record[column.key];
|
|
7464
|
+
if (typeof raw !== "string" || raw === "") return "";
|
|
7465
|
+
const resolveText = (value) => typeof value === "function" ? value(record, index) : value;
|
|
7466
|
+
return h(CellImage, {
|
|
7467
|
+
src: raw,
|
|
7468
|
+
alt: resolveText(options?.alt) ?? "",
|
|
7469
|
+
fallback: resolveText(options?.fallback),
|
|
7470
|
+
size: options?.size,
|
|
7471
|
+
fit: options?.fit,
|
|
7472
|
+
shape: options?.shape
|
|
7473
|
+
});
|
|
7474
|
+
};
|
|
7174
7475
|
}
|
|
7175
7476
|
};
|
|
7176
7477
|
}
|
|
@@ -7292,9 +7593,42 @@ const _sfc_main$49 = /*@__PURE__*/ defineComponent({
|
|
|
7292
7593
|
}
|
|
7293
7594
|
});
|
|
7294
7595
|
//#endregion
|
|
7596
|
+
//#region src/components/table-render/columns.ts
|
|
7597
|
+
/**
|
|
7598
|
+
* 列节点工具:分组判别与叶子扁平化(多级表头支撑)。
|
|
7599
|
+
*
|
|
7600
|
+
* 设计取向:叶子口径全局不变 —— 引擎(TanStack 列定义)、列显隐、sticky 偏移、
|
|
7601
|
+
* min-width 求和、体单元格矩阵全部继续消费「扁平叶子」,分组能力只叠加在
|
|
7602
|
+
* 表头渲染与列设置面板两处。故此处是唯一的结构归一入口。
|
|
7603
|
+
*/
|
|
7604
|
+
/**
|
|
7605
|
+
* 判别节点是否为分组(含 children)。
|
|
7606
|
+
* @param node - 列节点(叶子或分组)
|
|
7607
|
+
* @returns 该节点是否为分组
|
|
7608
|
+
*/
|
|
7609
|
+
function isColumnGroup(node) {
|
|
7610
|
+
return Array.isArray(node.children);
|
|
7611
|
+
}
|
|
7612
|
+
/**
|
|
7613
|
+
* 扁平化列节点树为叶子列数组(深度优先,保持声明顺序)。
|
|
7614
|
+
* @param nodes - 列节点树
|
|
7615
|
+
* @returns 深度优先展开的叶子列数组(下游全部消费此层)
|
|
7616
|
+
*/
|
|
7617
|
+
function flattenColumns(nodes) {
|
|
7618
|
+
const leaves = [];
|
|
7619
|
+
const walk = (list) => {
|
|
7620
|
+
for (const node of list) if (isColumnGroup(node)) walk(node.children);
|
|
7621
|
+
else leaves.push(node);
|
|
7622
|
+
};
|
|
7623
|
+
walk(nodes);
|
|
7624
|
+
return leaves;
|
|
7625
|
+
}
|
|
7626
|
+
//#endregion
|
|
7295
7627
|
//#region src/components/table-render/constants.ts
|
|
7296
7628
|
/** 选择列在 sticky 映射中的哨兵键(选择列不在 columns 内,表头/表体单独渲染) */
|
|
7297
7629
|
const SELECTION_CELL = "__selection__";
|
|
7630
|
+
/** 拖拽把手列在 sticky 映射中的哨兵键(同选择列:不在 columns 内,表头/表体单独渲染) */
|
|
7631
|
+
const DRAG_CELL = "__drag__";
|
|
7298
7632
|
/** 布局容器与 TableRender 的跨包填充协议 key:provide(true) 声明容器内 TableRender 应填满、内部滚动、表头固定 */
|
|
7299
7633
|
const PAGE_TABLE_FILL_KEY = "tu-design:page-table-fill";
|
|
7300
7634
|
//#endregion
|
|
@@ -7331,15 +7665,36 @@ function stickyClass(sticky, key) {
|
|
|
7331
7665
|
];
|
|
7332
7666
|
}
|
|
7333
7667
|
//#endregion
|
|
7668
|
+
//#region src/components/icon-shared/GripIcon.vue
|
|
7669
|
+
const _sfc_main$54 = {};
|
|
7670
|
+
const _hoisted_1$9 = {
|
|
7671
|
+
viewBox: "0 0 24 24",
|
|
7672
|
+
fill: "none",
|
|
7673
|
+
stroke: "currentColor",
|
|
7674
|
+
"stroke-width": "2",
|
|
7675
|
+
"stroke-linecap": "round",
|
|
7676
|
+
"stroke-linejoin": "round",
|
|
7677
|
+
"aria-hidden": "true"
|
|
7678
|
+
};
|
|
7679
|
+
function _sfc_render(_ctx, _cache) {
|
|
7680
|
+
return openBlock(), createElementBlock("svg", _hoisted_1$9, [..._cache[0] || (_cache[0] = [createStaticVNode("<circle cx=\"9\" cy=\"12\" r=\"1\"></circle><circle cx=\"9\" cy=\"5\" r=\"1\"></circle><circle cx=\"9\" cy=\"19\" r=\"1\"></circle><circle cx=\"15\" cy=\"12\" r=\"1\"></circle><circle cx=\"15\" cy=\"5\" r=\"1\"></circle><circle cx=\"15\" cy=\"19\" r=\"1\"></circle>", 6)])]);
|
|
7681
|
+
}
|
|
7682
|
+
var GripIcon_default = /*#__PURE__*/ export_helper_default(_sfc_main$54, [["render", _sfc_render]]);
|
|
7683
|
+
//#endregion
|
|
7334
7684
|
//#region src/components/table-render/TableBodyRow.vue
|
|
7335
|
-
const _hoisted_1$
|
|
7685
|
+
const _hoisted_1$8 = [
|
|
7336
7686
|
"checked",
|
|
7337
7687
|
"disabled",
|
|
7338
7688
|
"aria-label"
|
|
7339
7689
|
];
|
|
7340
|
-
const _hoisted_2$
|
|
7341
|
-
|
|
7342
|
-
|
|
7690
|
+
const _hoisted_2$7 = [
|
|
7691
|
+
"disabled",
|
|
7692
|
+
"draggable",
|
|
7693
|
+
"aria-label"
|
|
7694
|
+
];
|
|
7695
|
+
const _hoisted_3$5 = ["title", "onClick"];
|
|
7696
|
+
const _hoisted_4$3 = ["aria-expanded", "aria-label"];
|
|
7697
|
+
const _hoisted_5$2 = {
|
|
7343
7698
|
key: 2,
|
|
7344
7699
|
class: "min-w-0 truncate"
|
|
7345
7700
|
};
|
|
@@ -7373,6 +7728,21 @@ const _sfc_main$53 = /*@__PURE__*/ defineComponent({
|
|
|
7373
7728
|
treeIndent: {
|
|
7374
7729
|
type: Number,
|
|
7375
7730
|
default: void 0
|
|
7731
|
+
},
|
|
7732
|
+
/** 是否渲染拖拽把手列(draggable 启用且未被守卫降级) */
|
|
7733
|
+
dragColumn: {
|
|
7734
|
+
type: Boolean,
|
|
7735
|
+
default: false
|
|
7736
|
+
},
|
|
7737
|
+
/** 本行把手禁用(排序激活 / rowKey 缺失 / 行级谓词 false) */
|
|
7738
|
+
dragDisabled: {
|
|
7739
|
+
type: Boolean,
|
|
7740
|
+
default: false
|
|
7741
|
+
},
|
|
7742
|
+
/** 本行正在被拖拽(占位态:半透明 + 虚线描边,实时让位预览中即落点提示) */
|
|
7743
|
+
dragging: {
|
|
7744
|
+
type: Boolean,
|
|
7745
|
+
default: false
|
|
7376
7746
|
}
|
|
7377
7747
|
},
|
|
7378
7748
|
emits: [
|
|
@@ -7380,7 +7750,11 @@ const _sfc_main$53 = /*@__PURE__*/ defineComponent({
|
|
|
7380
7750
|
"row-click",
|
|
7381
7751
|
"row-dblclick",
|
|
7382
7752
|
"row-contextmenu",
|
|
7383
|
-
"cell-click"
|
|
7753
|
+
"cell-click",
|
|
7754
|
+
"drag-start",
|
|
7755
|
+
"drag-over",
|
|
7756
|
+
"drop",
|
|
7757
|
+
"drag-end"
|
|
7384
7758
|
],
|
|
7385
7759
|
setup(__props, { emit: __emit }) {
|
|
7386
7760
|
const props = __props;
|
|
@@ -7405,12 +7779,14 @@ const _sfc_main$53 = /*@__PURE__*/ defineComponent({
|
|
|
7405
7779
|
}
|
|
7406
7780
|
return (_ctx, _cache) => {
|
|
7407
7781
|
return openBlock(), createElementBlock("tr", {
|
|
7408
|
-
class: "border-b transition-colors hover:bg-muted/50",
|
|
7409
|
-
onClick: _cache[
|
|
7410
|
-
onDblclick: _cache[
|
|
7411
|
-
onContextmenu: _cache[
|
|
7782
|
+
class: normalizeClass(["border-b transition-colors hover:bg-muted/50", { "opacity-50 [&>td]:outline-2 [&>td]:outline-dashed [&>td]:-outline-offset-2 [&>td]:outline-primary/40": props.dragging }]),
|
|
7783
|
+
onClick: _cache[7] || (_cache[7] = ($event) => emit("row-click", $event)),
|
|
7784
|
+
onDblclick: _cache[8] || (_cache[8] = ($event) => emit("row-dblclick", $event)),
|
|
7785
|
+
onContextmenu: _cache[9] || (_cache[9] = ($event) => emit("row-contextmenu", $event)),
|
|
7786
|
+
onDragover: _cache[10] || (_cache[10] = ($event) => emit("drag-over", $event)),
|
|
7787
|
+
onDrop: _cache[11] || (_cache[11] = ($event) => emit("drop", $event))
|
|
7412
7788
|
}, [
|
|
7413
|
-
createCommentVNode(" 选择单元格:阻断冒泡避免触发行 row-click
|
|
7789
|
+
createCommentVNode(" 选择单元格:阻断冒泡避免触发行 row-click;radio 为原生控件 "),
|
|
7414
7790
|
props.selection ? (openBlock(), createElementBlock("td", {
|
|
7415
7791
|
key: 0,
|
|
7416
7792
|
class: normalizeClass(["w-12 p-2 text-center align-middle", unref(stickyClass)(props.sticky, unref(SELECTION_CELL))]),
|
|
@@ -7424,7 +7800,7 @@ const _sfc_main$53 = /*@__PURE__*/ defineComponent({
|
|
|
7424
7800
|
disabled: !props.line.canSelect,
|
|
7425
7801
|
"aria-label": `选择第 ${props.line.index + 1} 行`,
|
|
7426
7802
|
onClick: _cache[0] || (_cache[0] = ($event) => emit("select", !props.selected))
|
|
7427
|
-
}, null, 8, _hoisted_1$
|
|
7803
|
+
}, null, 8, _hoisted_1$8)) : (openBlock(), createBlock(unref(_sfc_main$9), {
|
|
7428
7804
|
key: 1,
|
|
7429
7805
|
checked: props.selected,
|
|
7430
7806
|
disabled: !props.line.canSelect,
|
|
@@ -7435,6 +7811,22 @@ const _sfc_main$53 = /*@__PURE__*/ defineComponent({
|
|
|
7435
7811
|
"disabled",
|
|
7436
7812
|
"aria-label"
|
|
7437
7813
|
]))], 6)) : createCommentVNode("v-if", true),
|
|
7814
|
+
createCommentVNode(" 拖拽把手单元格:仅把手可起拖(draggable 在按钮上,整行不可拖);阻断冒泡避免触发行 row-click "),
|
|
7815
|
+
props.dragColumn ? (openBlock(), createElementBlock("td", {
|
|
7816
|
+
key: 1,
|
|
7817
|
+
class: normalizeClass(["p-1 text-center align-middle", unref(stickyClass)(props.sticky, unref(DRAG_CELL))]),
|
|
7818
|
+
style: normalizeStyle(unref(stickyStyle)(props.sticky, unref(DRAG_CELL), false)),
|
|
7819
|
+
onClick: _cache[5] || (_cache[5] = withModifiers(() => {}, ["stop"]))
|
|
7820
|
+
}, [createElementVNode("button", {
|
|
7821
|
+
type: "button",
|
|
7822
|
+
"data-drag-handle": "",
|
|
7823
|
+
class: "text-muted-foreground inline-flex size-6 cursor-grab items-center justify-center rounded-sm active:cursor-grabbing disabled:cursor-not-allowed disabled:opacity-50",
|
|
7824
|
+
disabled: props.dragDisabled,
|
|
7825
|
+
draggable: !props.dragDisabled,
|
|
7826
|
+
"aria-label": `拖拽排序第 ${props.line.index + 1} 行`,
|
|
7827
|
+
onDragstart: _cache[3] || (_cache[3] = ($event) => emit("drag-start", $event)),
|
|
7828
|
+
onDragend: _cache[4] || (_cache[4] = ($event) => emit("drag-end", $event))
|
|
7829
|
+
}, [createVNode(GripIcon_default, { class: "size-4" })], 40, _hoisted_2$7)], 6)) : createCommentVNode("v-if", true),
|
|
7438
7830
|
(openBlock(true), createElementBlock(Fragment, null, renderList(props.line.cells, (value, index) => {
|
|
7439
7831
|
return openBlock(), createElementBlock("td", {
|
|
7440
7832
|
key: props.columns[index].key,
|
|
@@ -7453,13 +7845,13 @@ const _sfc_main$53 = /*@__PURE__*/ defineComponent({
|
|
|
7453
7845
|
class: "hover:bg-muted text-muted-foreground inline-flex size-4 shrink-0 cursor-pointer items-center justify-center rounded-sm",
|
|
7454
7846
|
"aria-expanded": props.line.row.getIsExpanded(),
|
|
7455
7847
|
"aria-label": props.line.row.getIsExpanded() ? "收起" : "展开",
|
|
7456
|
-
onClick: _cache[
|
|
7457
|
-
}, [createVNode(ChevronIcon_default, { class: normalizeClass(["size-3.5 transition-transform", { "rotate-90": props.line.row.getIsExpanded() }]) }, null, 8, ["class"])], 8,
|
|
7848
|
+
onClick: _cache[6] || (_cache[6] = withModifiers(($event) => props.line.row.toggleExpanded(), ["stop"]))
|
|
7849
|
+
}, [createVNode(ChevronIcon_default, { class: normalizeClass(["size-3.5 transition-transform", { "rotate-90": props.line.row.getIsExpanded() }]) }, null, 8, ["class"])], 8, _hoisted_4$3)) : createCommentVNode("v-if", true),
|
|
7458
7850
|
createCommentVNode(" VNode 必须走子节点渲染;文本插值会序列化 vnode 导致循环引用 "),
|
|
7459
|
-
isVNode(value) ? (openBlock(), createBlock(resolveDynamicComponent(value), { key: 1 })) : (openBlock(), createElementBlock("span",
|
|
7460
|
-
], 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,
|
|
7851
|
+
isVNode(value) ? (openBlock(), createBlock(resolveDynamicComponent(value), { key: 1 })) : (openBlock(), createElementBlock("span", _hoisted_5$2, toDisplayString(value), 1))
|
|
7852
|
+
], 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_3$5);
|
|
7461
7853
|
}), 128))
|
|
7462
|
-
],
|
|
7854
|
+
], 34);
|
|
7463
7855
|
};
|
|
7464
7856
|
}
|
|
7465
7857
|
});
|
|
@@ -7480,7 +7872,7 @@ function numericOption(value) {
|
|
|
7480
7872
|
return typeof value === "number" ? value : void 0;
|
|
7481
7873
|
}
|
|
7482
7874
|
/**
|
|
7483
|
-
* DEV
|
|
7875
|
+
* DEV 兜底提示:生产构建静默,只留可读的降级行为
|
|
7484
7876
|
* @param message - 提示文本
|
|
7485
7877
|
*/
|
|
7486
7878
|
function warn(message) {
|
|
@@ -7496,7 +7888,8 @@ function warn(message) {
|
|
|
7496
7888
|
* @returns 表格渲染定义(含只读投影与实例动作),供 TableRender 组件消费
|
|
7497
7889
|
*/
|
|
7498
7890
|
function useTableRender(options) {
|
|
7499
|
-
const
|
|
7891
|
+
const columnTree = options.columns;
|
|
7892
|
+
const columns = flattenColumns(options.columns);
|
|
7500
7893
|
const serverMode = typeof options.onLoad === "function";
|
|
7501
7894
|
if (columns.length === 0) warn("columns 为空,表格将没有表头。");
|
|
7502
7895
|
if (serverMode && options.data !== void 0) warn("onLoad 与 data 不能同时传入,已按 onLoad(服务端模式)处理。");
|
|
@@ -7561,15 +7954,29 @@ function useTableRender(options) {
|
|
|
7561
7954
|
const loading = ref(false);
|
|
7562
7955
|
const error = ref(void 0);
|
|
7563
7956
|
const rows = shallowRef([]);
|
|
7957
|
+
let draggableConfig;
|
|
7958
|
+
if (options.draggable !== void 0 && options.draggable !== false) {
|
|
7959
|
+
if (tree) warn("draggable 与 tree 不能同时启用,已忽略 draggable。");
|
|
7960
|
+
else if (options.virtual === true) warn("draggable 与 virtual 不能同时启用,已忽略 draggable。");
|
|
7961
|
+
else {
|
|
7962
|
+
const config = options.draggable === true ? {} : options.draggable;
|
|
7963
|
+
if (config.width !== void 0 && typeof config.width !== "number") {
|
|
7964
|
+
warn("draggable.width 必须是数字,已按默认 32 处理。");
|
|
7965
|
+
delete config.width;
|
|
7966
|
+
}
|
|
7967
|
+
draggableConfig = config;
|
|
7968
|
+
if (sort.value !== void 0) warn("draggable 与初始排序(defaultSort/受控 sort)同时配置,排序激活期间拖拽不可用。");
|
|
7969
|
+
}
|
|
7970
|
+
}
|
|
7564
7971
|
const rawSelection = options.rowSelection;
|
|
7565
7972
|
const selectionConfig = rawSelection === void 0 ? void 0 : typeof rawSelection === "string" ? { type: rawSelection } : rawSelection;
|
|
7566
7973
|
const rowKey = ref(options.rowKey);
|
|
7567
7974
|
const selectionEnabled = computed(() => selectionConfig !== void 0 && !!rowKey.value);
|
|
7568
7975
|
const selectedKeys = ref(/* @__PURE__ */ new Set());
|
|
7569
7976
|
const selectionRows = shallowRef([]);
|
|
7570
|
-
/** key →
|
|
7977
|
+
/** key → 最近一次出现的行对象;跨页选中行由此返回快照 */
|
|
7571
7978
|
const selectionSnapshot = /* @__PURE__ */ new Map();
|
|
7572
|
-
/** 选中但当前数据中不存在的 key(reserveOnPageChange
|
|
7979
|
+
/** 选中但当前数据中不存在的 key(reserveOnPageChange 语义) */
|
|
7573
7980
|
const dirtyKeys = /* @__PURE__ */ new Set();
|
|
7574
7981
|
/** 受控选择状态:单一真相源,onRowSelectionChange 只通知不落盘(避免 setRowSelection 回环) */
|
|
7575
7982
|
const rowSelectionState = ref({});
|
|
@@ -7588,7 +7995,7 @@ function useTableRender(options) {
|
|
|
7588
7995
|
selectionEmitSafe();
|
|
7589
7996
|
}
|
|
7590
7997
|
/**
|
|
7591
|
-
* 行主键 → TanStack row id;rowKey
|
|
7998
|
+
* 行主键 → TanStack row id;rowKey 缺失时退化为索引(仅非选择场景可达)
|
|
7592
7999
|
* @param record - 行记录
|
|
7593
8000
|
* @param index - 行索引(rowKey 缺失时的退化 id 来源)
|
|
7594
8001
|
* @returns 稳定的行标识字符串
|
|
@@ -7598,7 +8005,7 @@ function useTableRender(options) {
|
|
|
7598
8005
|
const value = key ? record[key] : void 0;
|
|
7599
8006
|
return value === void 0 || value === null ? `index-${index}` : String(value);
|
|
7600
8007
|
}
|
|
7601
|
-
/** 数据窗口变化时刷新快照中已存在 key
|
|
8008
|
+
/** 数据窗口变化时刷新快照中已存在 key 的行对象(后写覆盖) */
|
|
7602
8009
|
function refreshSnapshot() {
|
|
7603
8010
|
const key = rowKey.value;
|
|
7604
8011
|
if (!key) return;
|
|
@@ -7688,7 +8095,7 @@ function useTableRender(options) {
|
|
|
7688
8095
|
table.setPageSize(pageSize);
|
|
7689
8096
|
table.setPageIndex(0);
|
|
7690
8097
|
}
|
|
7691
|
-
/** 排序应用的唯一管线:服务端模式归位第 1
|
|
8098
|
+
/** 排序应用的唯一管线:服务端模式归位第 1 页+ 投影落值 + TanStack setSorting。
|
|
7692
8099
|
* 受控 sort 的外部同步与此共用(直接 setSorting 会漏服务端重载)
|
|
7693
8100
|
* @param next - 目标排序(key + direction),undefined 表示取消排序
|
|
7694
8101
|
*/
|
|
@@ -7701,7 +8108,7 @@ function useTableRender(options) {
|
|
|
7701
8108
|
}] : []);
|
|
7702
8109
|
}
|
|
7703
8110
|
/**
|
|
7704
|
-
* 排序三态:无 → asc → desc → 取消;非 sortable
|
|
8111
|
+
* 排序三态:无 → asc → desc → 取消;非 sortable 列为空操作
|
|
7705
8112
|
* @param key - 目标列 key
|
|
7706
8113
|
*/
|
|
7707
8114
|
function toggleSort(key) {
|
|
@@ -7713,6 +8120,37 @@ function useTableRender(options) {
|
|
|
7713
8120
|
direction
|
|
7714
8121
|
} : void 0);
|
|
7715
8122
|
}
|
|
8123
|
+
/**
|
|
8124
|
+
* 页内重排(drag-sort 唯一管线):from/to 为页内 0-based 索引。
|
|
8125
|
+
* 静态模式按对象身份定位全量位置后 splice(页内索引 → 全量映射不依赖裸索引 arithmetic,
|
|
8126
|
+
* 行对象与 rows.value 同引用);服务端模式 rows.value 即当前页数据,只算新序不落盘。
|
|
8127
|
+
* @param from - 源行页内索引
|
|
8128
|
+
* @param to - 目标行页内索引(拖拽落位行;源行移除后插入该原位)
|
|
8129
|
+
* @returns drag-sort 载荷;守卫不通过或索引无效时 undefined
|
|
8130
|
+
*/
|
|
8131
|
+
function reorderRows(from, to) {
|
|
8132
|
+
if (!draggableConfig || sort.value !== void 0) return void 0;
|
|
8133
|
+
const pageRows = table.getRowModel().rows.map((row) => row.original);
|
|
8134
|
+
if (from === to || from < 0 || to < 0 || from >= pageRows.length || to >= pageRows.length) return;
|
|
8135
|
+
const record = pageRows[from];
|
|
8136
|
+
const next = [...pageRows];
|
|
8137
|
+
next.splice(from, 1);
|
|
8138
|
+
next.splice(to, 0, record);
|
|
8139
|
+
if (!serverMode) {
|
|
8140
|
+
const all = [...rows.value];
|
|
8141
|
+
const target = pageRows[to];
|
|
8142
|
+
all.splice(all.indexOf(record), 1);
|
|
8143
|
+
const targetIndex = all.indexOf(target);
|
|
8144
|
+
all.splice(from < to ? targetIndex + 1 : targetIndex, 0, record);
|
|
8145
|
+
rows.value = all;
|
|
8146
|
+
}
|
|
8147
|
+
return {
|
|
8148
|
+
from,
|
|
8149
|
+
to,
|
|
8150
|
+
record,
|
|
8151
|
+
rows: next
|
|
8152
|
+
};
|
|
8153
|
+
}
|
|
7716
8154
|
let requestId = 0;
|
|
7717
8155
|
async function load() {
|
|
7718
8156
|
const id = ++requestId;
|
|
@@ -7777,7 +8215,7 @@ function useTableRender(options) {
|
|
|
7777
8215
|
}, { immediate: true });
|
|
7778
8216
|
let emptyVisibleWarned = false;
|
|
7779
8217
|
/**
|
|
7780
|
-
* 规范化:未知 key 静默忽略、按 columns 原序、空数组钳制为首列(
|
|
8218
|
+
* 规范化:未知 key 静默忽略、按 columns 原序、空数组钳制为首列(warn 一次)
|
|
7781
8219
|
* @param keys - 目标可见列 key 列表(任意顺序,可含未知 key)
|
|
7782
8220
|
* @returns 规范化后的可见列 key 列表(columns 原序)
|
|
7783
8221
|
*/
|
|
@@ -7828,7 +8266,7 @@ function useTableRender(options) {
|
|
|
7828
8266
|
syncData();
|
|
7829
8267
|
}
|
|
7830
8268
|
/**
|
|
7831
|
-
* 程序化设置选中集;不存在的 key 保留进入 dirtyKeys
|
|
8269
|
+
* 程序化设置选中集;不存在的 key 保留进入 dirtyKeys;不可选行被过滤
|
|
7832
8270
|
* @param keys - 目标选中行的 key 列表(整体替换现有选中集)
|
|
7833
8271
|
*/
|
|
7834
8272
|
function setSelection(keys) {
|
|
@@ -7857,7 +8295,7 @@ function useTableRender(options) {
|
|
|
7857
8295
|
});
|
|
7858
8296
|
}
|
|
7859
8297
|
/**
|
|
7860
|
-
* 拆分式装配口:TableRender setup 时回传组件 rowKey
|
|
8298
|
+
* 拆分式装配口:TableRender setup 时回传组件 rowKey
|
|
7861
8299
|
* @param key - 行主键字段名
|
|
7862
8300
|
*/
|
|
7863
8301
|
function setRowKey(key) {
|
|
@@ -7871,6 +8309,7 @@ function useTableRender(options) {
|
|
|
7871
8309
|
});
|
|
7872
8310
|
return {
|
|
7873
8311
|
columns,
|
|
8312
|
+
columnTree,
|
|
7874
8313
|
table,
|
|
7875
8314
|
page: readonly(page),
|
|
7876
8315
|
sort: readonly(sort),
|
|
@@ -7905,6 +8344,8 @@ function useTableRender(options) {
|
|
|
7905
8344
|
virtual: options.virtual,
|
|
7906
8345
|
height: options.height,
|
|
7907
8346
|
tree,
|
|
8347
|
+
draggable: draggableConfig,
|
|
8348
|
+
reorderRows,
|
|
7908
8349
|
visibleKeys: readonly(visibleKeysInternal),
|
|
7909
8350
|
setVisibleKeys,
|
|
7910
8351
|
defaultVisibleKeys: parsedDefaultVisibleKeys,
|
|
@@ -7913,11 +8354,113 @@ function useTableRender(options) {
|
|
|
7913
8354
|
};
|
|
7914
8355
|
}
|
|
7915
8356
|
//#endregion
|
|
8357
|
+
//#region src/components/table-render/useRowDrag.ts
|
|
8358
|
+
/**
|
|
8359
|
+
* 行拖拽状态机(原生 HTML5 DnD):内部状态是唯一事实源,不读 dataTransfer
|
|
8360
|
+
* (happy-dom 的 DragEvent 是 Event 别名、无 dataTransfer,测试直接派发普通 Event)。
|
|
8361
|
+
* dataTransfer 写入仅作真实浏览器兼容(Firefox 需 setData 才起拖、setDragImage 整行快照),
|
|
8362
|
+
* 全部 optional 守卫。
|
|
8363
|
+
*
|
|
8364
|
+
* 落位语义由组件层预览序决定(实时让位):本状态机只负责起拖/接收/落位/清理。
|
|
8365
|
+
* @returns 拖拽状态(draggingKey)与事件动作(start/over/drop/end)
|
|
8366
|
+
*/
|
|
8367
|
+
function useRowDrag() {
|
|
8368
|
+
const draggingKey = ref(void 0);
|
|
8369
|
+
/**
|
|
8370
|
+
* 起拖(把手 dragstart)
|
|
8371
|
+
* @param key - 源行主键
|
|
8372
|
+
* @param event - 原生 dragstart 事件
|
|
8373
|
+
* @param image - 拖拽快照(离屏克隆元素 + 相对原行的抓取偏移);提供时幽灵影为整行截图
|
|
8374
|
+
*/
|
|
8375
|
+
function start(key, event, image) {
|
|
8376
|
+
draggingKey.value = key;
|
|
8377
|
+
if (event.dataTransfer) {
|
|
8378
|
+
event.dataTransfer.effectAllowed = "move";
|
|
8379
|
+
event.dataTransfer.setData("text/plain", key);
|
|
8380
|
+
if (image) event.dataTransfer.setDragImage(image.el, image.offsetX, image.offsetY);
|
|
8381
|
+
}
|
|
8382
|
+
}
|
|
8383
|
+
/**
|
|
8384
|
+
* 悬停(行 dragover):持续 preventDefault 才允许 drop——**含被拖行占位自身**
|
|
8385
|
+
* (实时让位后光标恰停在占位上,不 preventDefault 则真实浏览器拒绝 drop)。
|
|
8386
|
+
* @param key - 悬停行主键
|
|
8387
|
+
* @param event - 原生 dragover 事件
|
|
8388
|
+
* @returns 是否接收让位(同源行返回 false:允许 drop 但不移动预览序)
|
|
8389
|
+
*/
|
|
8390
|
+
function over(key, event) {
|
|
8391
|
+
if (!draggingKey.value) return false;
|
|
8392
|
+
event.preventDefault();
|
|
8393
|
+
if (event.dataTransfer) event.dataTransfer.dropEffect = "move";
|
|
8394
|
+
return key !== draggingKey.value;
|
|
8395
|
+
}
|
|
8396
|
+
/**
|
|
8397
|
+
* 落位(行 drop):仅成功落位返回结果(取消路径走 end,不返回)。
|
|
8398
|
+
* 实时让位后被拖行占位恰在光标下,落在自身占位是有效提交(toKey = fromKey),
|
|
8399
|
+
* 最终序由组件层预览序决定;无预览时同源落位由组件层 from === to 守卫为空操作。
|
|
8400
|
+
* @param key - 落位行主键
|
|
8401
|
+
* @param event - 原生 drop 事件
|
|
8402
|
+
* @returns 源/目标行主键;无起拖状态时 undefined
|
|
8403
|
+
*/
|
|
8404
|
+
function drop(key, event) {
|
|
8405
|
+
const fromKey = draggingKey.value;
|
|
8406
|
+
draggingKey.value = void 0;
|
|
8407
|
+
if (!fromKey) return void 0;
|
|
8408
|
+
event.preventDefault();
|
|
8409
|
+
return {
|
|
8410
|
+
fromKey,
|
|
8411
|
+
toKey: key
|
|
8412
|
+
};
|
|
8413
|
+
}
|
|
8414
|
+
/** 拖拽结束(把手 dragend,含取消路径):仅清理状态,不产生落位结果 */
|
|
8415
|
+
function end() {
|
|
8416
|
+
draggingKey.value = void 0;
|
|
8417
|
+
}
|
|
8418
|
+
return {
|
|
8419
|
+
draggingKey,
|
|
8420
|
+
start,
|
|
8421
|
+
over,
|
|
8422
|
+
drop,
|
|
8423
|
+
end
|
|
8424
|
+
};
|
|
8425
|
+
}
|
|
8426
|
+
/**
|
|
8427
|
+
* 整行拖拽快照:深克隆 tr 包进离屏临时 table(border-separate + 完整边框)。
|
|
8428
|
+
* border-collapse 下边框几何归属 table 而非 tr,直接截 tr 会缺上/左边框;
|
|
8429
|
+
* 克隆逐格复制实测宽度保证列宽一致。调用方负责在 drop/dragend 时 remove()。
|
|
8430
|
+
* @param tr - 源行元素
|
|
8431
|
+
* @returns 离屏快照 table(已挂 body,fixed 定位移出视口)
|
|
8432
|
+
*/
|
|
8433
|
+
function createRowSnapshot(tr) {
|
|
8434
|
+
const clone = tr.cloneNode(true);
|
|
8435
|
+
const srcCells = tr.querySelectorAll("td");
|
|
8436
|
+
const cloneCells = clone.querySelectorAll("td");
|
|
8437
|
+
srcCells.forEach((td, index) => {
|
|
8438
|
+
const cell = cloneCells[index];
|
|
8439
|
+
if (cell) cell.style.width = `${td.offsetWidth}px`;
|
|
8440
|
+
});
|
|
8441
|
+
const tbody = document.createElement("tbody");
|
|
8442
|
+
tbody.appendChild(clone);
|
|
8443
|
+
const table = document.createElement("table");
|
|
8444
|
+
table.className = "border-separate border-spacing-0 border border-border bg-background";
|
|
8445
|
+
table.style.position = "fixed";
|
|
8446
|
+
table.style.left = "-9999px";
|
|
8447
|
+
table.style.top = "0";
|
|
8448
|
+
table.style.tableLayout = "fixed";
|
|
8449
|
+
table.style.width = `${tr.offsetWidth}px`;
|
|
8450
|
+
table.appendChild(tbody);
|
|
8451
|
+
document.body.appendChild(table);
|
|
8452
|
+
return table;
|
|
8453
|
+
}
|
|
8454
|
+
//#endregion
|
|
7916
8455
|
//#region src/components/table-render/TableRender.vue
|
|
7917
|
-
const _hoisted_1$
|
|
7918
|
-
const _hoisted_2$
|
|
8456
|
+
const _hoisted_1$7 = { class: "flex items-center justify-end gap-3 px-3 py-2" };
|
|
8457
|
+
const _hoisted_2$6 = ["disabled"];
|
|
7919
8458
|
const _hoisted_3$4 = { class: "max-h-64 overflow-y-auto py-1" };
|
|
7920
|
-
const _hoisted_4$2 = [
|
|
8459
|
+
const _hoisted_4$2 = [
|
|
8460
|
+
"data-column-key",
|
|
8461
|
+
"data-column-group",
|
|
8462
|
+
"onClick"
|
|
8463
|
+
];
|
|
7921
8464
|
const _hoisted_5$1 = { class: "min-w-0 flex-1 truncate" };
|
|
7922
8465
|
const _hoisted_6$1 = {
|
|
7923
8466
|
key: 0,
|
|
@@ -7931,23 +8474,40 @@ const _hoisted_6$1 = {
|
|
|
7931
8474
|
class: "text-muted-foreground size-3 shrink-0",
|
|
7932
8475
|
"aria-hidden": "true"
|
|
7933
8476
|
};
|
|
7934
|
-
const _hoisted_7$1 = ["
|
|
7935
|
-
const _hoisted_8 = ["
|
|
7936
|
-
const _hoisted_9 =
|
|
8477
|
+
const _hoisted_7$1 = ["rowspan"];
|
|
8478
|
+
const _hoisted_8 = ["rowspan"];
|
|
8479
|
+
const _hoisted_9 = [
|
|
8480
|
+
"scope",
|
|
8481
|
+
"colspan",
|
|
8482
|
+
"rowspan",
|
|
8483
|
+
"aria-sort"
|
|
8484
|
+
];
|
|
8485
|
+
const _hoisted_10 = ["onClick"];
|
|
8486
|
+
const _hoisted_11 = {
|
|
7937
8487
|
"aria-hidden": "true",
|
|
7938
8488
|
class: "text-xs"
|
|
7939
8489
|
};
|
|
7940
|
-
const
|
|
7941
|
-
const
|
|
7942
|
-
const _hoisted_12 = ["colspan"];
|
|
7943
|
-
const _hoisted_13 = { class: "flex flex-col items-center gap-3" };
|
|
8490
|
+
const _hoisted_12 = { class: "[&_tr:last-child]:border-0" };
|
|
8491
|
+
const _hoisted_13 = { "data-error": "" };
|
|
7944
8492
|
const _hoisted_14 = ["colspan"];
|
|
7945
|
-
const _hoisted_15 =
|
|
7946
|
-
const _hoisted_16 =
|
|
8493
|
+
const _hoisted_15 = { class: "flex flex-col items-center gap-3" };
|
|
8494
|
+
const _hoisted_16 = ["colspan"];
|
|
8495
|
+
const _hoisted_17 = ["colspan"];
|
|
8496
|
+
const _hoisted_18 = {
|
|
7947
8497
|
key: 4,
|
|
7948
8498
|
"data-empty": ""
|
|
7949
8499
|
};
|
|
7950
|
-
const
|
|
8500
|
+
const _hoisted_19 = ["colspan"];
|
|
8501
|
+
/** 面板行派生:以原始列节点树(非可见剪枝)为准,保证隐藏后仍可恢复 */
|
|
8502
|
+
const HEADER_ROW_FALLBACK = 40;
|
|
8503
|
+
/**
|
|
8504
|
+
* 测量所有表头行高度并派生行顶偏移与 thead 总高(唯一测量源)。
|
|
8505
|
+
*
|
|
8506
|
+
* 两处口径有意区分:
|
|
8507
|
+
* - `rowTop`(多行 sticky 逐行 top)用兜底 h-10(40px)——测量不可用时避免表头行重叠;
|
|
8508
|
+
* - `theadOffset`(virtual 的 scrollMargin)用**实测原值**,与既有行为一致
|
|
8509
|
+
* (happy-dom 无布局 → 0;真实浏览器 → 真实高度)。
|
|
8510
|
+
*/
|
|
7951
8511
|
const _sfc_main$44 = /*@__PURE__*/ defineComponent({
|
|
7952
8512
|
__name: "TableRender",
|
|
7953
8513
|
props: {
|
|
@@ -7958,7 +8518,7 @@ const _sfc_main$44 = /*@__PURE__*/ defineComponent({
|
|
|
7958
8518
|
type: String,
|
|
7959
8519
|
required: true
|
|
7960
8520
|
},
|
|
7961
|
-
/** 拆分式:与 definition 二选一,definition
|
|
8521
|
+
/** 拆分式:与 definition 二选一,definition 优先(支持分组列节点) */
|
|
7962
8522
|
columns: { type: Array },
|
|
7963
8523
|
onLoad: { type: Function },
|
|
7964
8524
|
data: { type: Array },
|
|
@@ -7966,7 +8526,7 @@ const _sfc_main$44 = /*@__PURE__*/ defineComponent({
|
|
|
7966
8526
|
type: Boolean,
|
|
7967
8527
|
default: void 0
|
|
7968
8528
|
},
|
|
7969
|
-
/** 每页条数 /
|
|
8529
|
+
/** 每页条数 / 受控每页条数:传入即受控(pageIndex 未受控时页码归位内部处理并通知) */
|
|
7970
8530
|
pageSize: { type: Number },
|
|
7971
8531
|
pageSizeOpts: { type: Array },
|
|
7972
8532
|
loading: {
|
|
@@ -7990,6 +8550,11 @@ const _sfc_main$44 = /*@__PURE__*/ defineComponent({
|
|
|
7990
8550
|
height: { type: [Number, String] },
|
|
7991
8551
|
/** 树形数据(子行展开/收起);拆分式直接传,聚合式请在 defineTable 配置 */
|
|
7992
8552
|
tree: { type: Object },
|
|
8553
|
+
/** 行拖拽排序(仅拆分式生效;聚合式请在 defineTable 配置):true 或对象配置;与 tree/virtual 互斥 */
|
|
8554
|
+
draggable: {
|
|
8555
|
+
type: [Boolean, Object],
|
|
8556
|
+
default: void 0
|
|
8557
|
+
},
|
|
7993
8558
|
/** 受控页码(1-based):传入即受控,缺省非受控;内部翻页经 update:page-index 通知 */
|
|
7994
8559
|
pageIndex: { type: Number },
|
|
7995
8560
|
/** 受控排序:传入即受控;内部/外部变化均经 sort-change 通知 */
|
|
@@ -7998,19 +8563,19 @@ const _sfc_main$44 = /*@__PURE__*/ defineComponent({
|
|
|
7998
8563
|
selectedKeys: { type: Array },
|
|
7999
8564
|
/** 受控可见列 key(columns 原序子集):传入即受控;内部显隐经 update:visible-keys 通知 */
|
|
8000
8565
|
visibleKeys: { type: Array },
|
|
8001
|
-
/** 拆分式默认可见列集;与聚合式 columnVisibility.defaultVisibleKeys 同传时 DEV 警告(
|
|
8566
|
+
/** 拆分式默认可见列集;与聚合式 columnVisibility.defaultVisibleKeys 同传时 DEV 警告(definition 优先) */
|
|
8002
8567
|
defaultVisibleKeys: { type: Array },
|
|
8003
8568
|
/** 列设置触发器/面板开关(默认 true);false 时不渲染 UI,受控 API 不受影响 */
|
|
8004
8569
|
columnSettings: {
|
|
8005
8570
|
type: Boolean,
|
|
8006
8571
|
default: void 0
|
|
8007
8572
|
},
|
|
8008
|
-
/**
|
|
8573
|
+
/** 搜索区渲染开关:false 关闭内置搜索区(组合式外置 FormRender);数据链路不变 */
|
|
8009
8574
|
showSearch: {
|
|
8010
8575
|
type: Boolean,
|
|
8011
8576
|
default: void 0
|
|
8012
8577
|
},
|
|
8013
|
-
/**
|
|
8578
|
+
/** 分页条渲染开关:false 关闭内置分页条(组合式外置 TablePagination);缺省模式单页自隐藏不变 */
|
|
8014
8579
|
showPagination: {
|
|
8015
8580
|
type: Boolean,
|
|
8016
8581
|
default: void 0
|
|
@@ -8038,14 +8603,15 @@ const _sfc_main$44 = /*@__PURE__*/ defineComponent({
|
|
|
8038
8603
|
"reset",
|
|
8039
8604
|
"load-error",
|
|
8040
8605
|
"update:visible-keys",
|
|
8041
|
-
"column-visibility-change"
|
|
8606
|
+
"column-visibility-change",
|
|
8607
|
+
"drag-sort"
|
|
8042
8608
|
],
|
|
8043
8609
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
8044
8610
|
const props = __props;
|
|
8045
8611
|
const pageTableFill = inject(PAGE_TABLE_FILL_KEY, false);
|
|
8046
8612
|
const fill = props.fillHeight ?? pageTableFill;
|
|
8047
8613
|
const emit = __emit;
|
|
8048
|
-
/**
|
|
8614
|
+
/** 加载态骨架行数 */
|
|
8049
8615
|
const SKELETON_ROWS = [
|
|
8050
8616
|
1,
|
|
8051
8617
|
2,
|
|
@@ -8057,6 +8623,7 @@ const _sfc_main$44 = /*@__PURE__*/ defineComponent({
|
|
|
8057
8623
|
const RENDERS = columnRenders();
|
|
8058
8624
|
if (props.definition && props.columns && import.meta.env.DEV) console.warn("[tu-design] <TableRender> definition 与 columns 同时传入,已按 definition 渲染。");
|
|
8059
8625
|
if (props.definition && props.rowSelection && import.meta.env.DEV) console.warn("[tu-design] <TableRender> 聚合式下 rowSelection 请在 defineTable 配置,组件 prop 已忽略。");
|
|
8626
|
+
if (props.definition && props.draggable !== void 0 && import.meta.env.DEV) console.warn("[tu-design] <TableRender> 聚合式下 draggable 请在 defineTable 配置,组件 prop 已忽略。");
|
|
8060
8627
|
const instance = props.definition ?? useTableRender({
|
|
8061
8628
|
columns: props.columns ?? [],
|
|
8062
8629
|
onLoad: props.onLoad,
|
|
@@ -8069,6 +8636,7 @@ const _sfc_main$44 = /*@__PURE__*/ defineComponent({
|
|
|
8069
8636
|
virtual: props.virtual,
|
|
8070
8637
|
height: props.height,
|
|
8071
8638
|
tree: props.tree,
|
|
8639
|
+
draggable: props.draggable,
|
|
8072
8640
|
pageIndex: () => props.pageIndex,
|
|
8073
8641
|
pageSize: () => props.pageSize,
|
|
8074
8642
|
sort: () => props.sort,
|
|
@@ -8107,12 +8675,12 @@ const _sfc_main$44 = /*@__PURE__*/ defineComponent({
|
|
|
8107
8675
|
}
|
|
8108
8676
|
const columns = computed(() => instance.columns);
|
|
8109
8677
|
const rows = computed(() => instance.table.getRowModel().rows);
|
|
8110
|
-
/** 内部加载态 ∪
|
|
8678
|
+
/** 内部加载态 ∪ 外部受控加载态 */
|
|
8111
8679
|
const loading = computed(() => props.loading === true || instance.loading.value);
|
|
8112
8680
|
const showPagination = computed(() => Math.ceil(instance.page.total / instance.page.pageSize) > 1);
|
|
8113
|
-
/**
|
|
8681
|
+
/** 内置分页条开关:showPagination=false 关闭;单页自隐藏仅作用于缺省模式 */
|
|
8114
8682
|
const showPaginationBar = computed(() => showPagination.value && props.showPagination !== false);
|
|
8115
|
-
/**
|
|
8683
|
+
/** 内置搜索区开关:配置了 search 且未被 showSearch=false 关闭;列设置触发器不受影响 */
|
|
8116
8684
|
const showSearchArea = computed(() => search !== void 0 && props.showSearch !== false);
|
|
8117
8685
|
const loadError = computed(() => instance.error.value);
|
|
8118
8686
|
const showError = computed(() => !loading.value && loadError.value !== void 0);
|
|
@@ -8126,15 +8694,78 @@ const _sfc_main$44 = /*@__PURE__*/ defineComponent({
|
|
|
8126
8694
|
const selectedKeys = instance.selectedKeys;
|
|
8127
8695
|
const hasSelection = computed(() => selection.value.enabled);
|
|
8128
8696
|
const visibleKeySet = computed(() => new Set(instance.visibleKeys.value));
|
|
8129
|
-
/** 可见业务列(columns 原序子集):header/body/骨架/colspan/sticky
|
|
8697
|
+
/** 可见业务列(columns 原序子集):header/body/骨架/colspan/sticky 全部基于此渲染 */
|
|
8130
8698
|
const visibleColumns = computed(() => columns.value.filter((column) => visibleKeySet.value.has(column.key)));
|
|
8699
|
+
const columnsTree = computed(() => instance.columnTree ?? columns.value);
|
|
8700
|
+
/** 可见表头树节点:按 visibleKeySet 剪枝后的结构(空分组已被剔除) */
|
|
8701
|
+
function buildVisibleHeaderTree(nodes, parentPath) {
|
|
8702
|
+
const views = [];
|
|
8703
|
+
nodes.forEach((node, index) => {
|
|
8704
|
+
const path = parentPath === "" ? `${index}` : `${parentPath}-${index}`;
|
|
8705
|
+
if (isColumnGroup(node)) {
|
|
8706
|
+
const children = buildVisibleHeaderTree(node.children, path);
|
|
8707
|
+
if (children.length > 0) views.push({
|
|
8708
|
+
node,
|
|
8709
|
+
isGroup: true,
|
|
8710
|
+
path,
|
|
8711
|
+
children
|
|
8712
|
+
});
|
|
8713
|
+
} else if (visibleKeySet.value.has(node.key)) views.push({
|
|
8714
|
+
node,
|
|
8715
|
+
isGroup: false,
|
|
8716
|
+
path,
|
|
8717
|
+
children: []
|
|
8718
|
+
});
|
|
8719
|
+
});
|
|
8720
|
+
return views;
|
|
8721
|
+
}
|
|
8722
|
+
/** 唯一派生源:可见表头树(maxDepth 与表头矩阵同源于此,杜绝口径漂移) */
|
|
8723
|
+
const visibleHeaderTree = computed(() => buildVisibleHeaderTree(columnsTree.value, ""));
|
|
8724
|
+
/** 表头深度(可见树):无分组时为 1 */
|
|
8725
|
+
const maxDepth = computed(() => {
|
|
8726
|
+
const depthOf = (view) => view.children.length > 0 ? 1 + Math.max(...view.children.map(depthOf)) : 1;
|
|
8727
|
+
return visibleHeaderTree.value.length > 0 ? Math.max(...visibleHeaderTree.value.map(depthOf)) : 1;
|
|
8728
|
+
});
|
|
8729
|
+
/** 表头单元格:分组跨列、叶子下沉贴底 */
|
|
8730
|
+
const headerRows = computed(() => {
|
|
8731
|
+
const rows = Array.from({ length: maxDepth.value }, () => []);
|
|
8732
|
+
const collectLeaves = (view) => view.isGroup ? view.children.flatMap(collectLeaves) : [view.node.key];
|
|
8733
|
+
const walk = (views, depth) => {
|
|
8734
|
+
for (const view of views) {
|
|
8735
|
+
const leafKeys = collectLeaves(view);
|
|
8736
|
+
if (view.isGroup) rows[depth].push({
|
|
8737
|
+
node: view.node,
|
|
8738
|
+
key: `g:${view.path}`,
|
|
8739
|
+
path: view.path,
|
|
8740
|
+
depth,
|
|
8741
|
+
colSpan: leafKeys.length,
|
|
8742
|
+
rowSpan: 1,
|
|
8743
|
+
isGroup: true,
|
|
8744
|
+
leafKeys
|
|
8745
|
+
});
|
|
8746
|
+
else rows[depth].push({
|
|
8747
|
+
node: view.node,
|
|
8748
|
+
key: view.node.key,
|
|
8749
|
+
path: view.path,
|
|
8750
|
+
depth,
|
|
8751
|
+
colSpan: 1,
|
|
8752
|
+
rowSpan: maxDepth.value - depth,
|
|
8753
|
+
isGroup: false,
|
|
8754
|
+
leafKeys
|
|
8755
|
+
});
|
|
8756
|
+
walk(view.children, depth + 1);
|
|
8757
|
+
}
|
|
8758
|
+
};
|
|
8759
|
+
walk(visibleHeaderTree.value, 0);
|
|
8760
|
+
return rows;
|
|
8761
|
+
});
|
|
8131
8762
|
/** 列设置触发器/面板开关(默认 true);false 时不渲染 UI,受控 API 不受影响 */
|
|
8132
8763
|
const showColumnSettings = computed(() => props.columnSettings ?? true);
|
|
8133
8764
|
function isColumnVisible(key) {
|
|
8134
8765
|
return visibleKeySet.value.has(key);
|
|
8135
8766
|
}
|
|
8136
8767
|
/**
|
|
8137
|
-
*
|
|
8768
|
+
* 最少一列:唯一可见列不可隐藏
|
|
8138
8769
|
* @param key - 列 key
|
|
8139
8770
|
* @returns 是否允许隐藏该列
|
|
8140
8771
|
*/
|
|
@@ -8153,18 +8784,89 @@ const _sfc_main$44 = /*@__PURE__*/ defineComponent({
|
|
|
8153
8784
|
function resetColumns() {
|
|
8154
8785
|
instance.setVisibleKeys(instance.defaultVisibleKeys ?? columns.value.map((column) => column.key));
|
|
8155
8786
|
}
|
|
8787
|
+
/** 面板行(全树扁平化,避免模板递归):分组行为父级三态,叶子行为勾选项 */
|
|
8788
|
+
const panelRows = computed(() => {
|
|
8789
|
+
const rows = [];
|
|
8790
|
+
const collectLeaves = (node) => isColumnGroup(node) ? node.children.flatMap(collectLeaves) : [node.key];
|
|
8791
|
+
const walk = (nodes, depth, parentPath) => {
|
|
8792
|
+
nodes.forEach((node, index) => {
|
|
8793
|
+
const path = parentPath === "" ? `${index}` : `${parentPath}-${index}`;
|
|
8794
|
+
const isGroup = isColumnGroup(node);
|
|
8795
|
+
rows.push({
|
|
8796
|
+
node,
|
|
8797
|
+
depth,
|
|
8798
|
+
isGroup,
|
|
8799
|
+
leafKeys: collectLeaves(node),
|
|
8800
|
+
path,
|
|
8801
|
+
key: isGroup ? `g:${path}` : node.key
|
|
8802
|
+
});
|
|
8803
|
+
if (isGroup) walk(node.children, depth + 1, path);
|
|
8804
|
+
});
|
|
8805
|
+
};
|
|
8806
|
+
walk(columnsTree.value, 0, "");
|
|
8807
|
+
return rows;
|
|
8808
|
+
});
|
|
8809
|
+
/**
|
|
8810
|
+
* 分组勾选三态:全部可见 = true,部分可见 = "indeterminate",全隐 = false
|
|
8811
|
+
* @param row - 面板分组行
|
|
8812
|
+
* @returns 该分组的三态勾选值
|
|
8813
|
+
*/
|
|
8814
|
+
function groupCheckedState(row) {
|
|
8815
|
+
const visibleCount = row.leafKeys.filter((key) => visibleKeySet.value.has(key)).length;
|
|
8816
|
+
if (visibleCount === 0) return false;
|
|
8817
|
+
if (visibleCount === row.leafKeys.length) return true;
|
|
8818
|
+
return "indeterminate";
|
|
8819
|
+
}
|
|
8820
|
+
/**
|
|
8821
|
+
* 分组批量显隐(最少一列恒按叶子口径):
|
|
8822
|
+
* 隐藏整组会导致 0 列可见时,保留该组最后一枚可见叶子(父级呈 indeterminate)。
|
|
8823
|
+
* @param row - 面板分组行
|
|
8824
|
+
*/
|
|
8825
|
+
function toggleGroupVisible(row) {
|
|
8826
|
+
const leafSet = new Set(row.leafKeys);
|
|
8827
|
+
if (!row.leafKeys.every((key) => visibleKeySet.value.has(key))) {
|
|
8828
|
+
instance.setVisibleKeys(columns.value.map((column) => column.key).filter((key) => visibleKeySet.value.has(key) || leafSet.has(key)));
|
|
8829
|
+
return;
|
|
8830
|
+
}
|
|
8831
|
+
const remaining = instance.visibleKeys.value.filter((key) => !leafSet.has(key));
|
|
8832
|
+
if (remaining.length === 0) {
|
|
8833
|
+
instance.setVisibleKeys([row.leafKeys[row.leafKeys.length - 1]]);
|
|
8834
|
+
return;
|
|
8835
|
+
}
|
|
8836
|
+
instance.setVisibleKeys(remaining);
|
|
8837
|
+
}
|
|
8838
|
+
/**
|
|
8839
|
+
* 面板行点击(分组批量显隐 / 叶子单列切换)
|
|
8840
|
+
* @param row - 面板行(分组或叶子)
|
|
8841
|
+
*/
|
|
8842
|
+
function onPanelRowClick(row) {
|
|
8843
|
+
if (row.isGroup) toggleGroupVisible(row);
|
|
8844
|
+
else toggleColumnVisible(row.key);
|
|
8845
|
+
}
|
|
8156
8846
|
watch(instance.visibleKeys, (keys) => {
|
|
8157
8847
|
emit("update:visible-keys", [...keys]);
|
|
8158
8848
|
emit("column-visibility-change", [...keys]);
|
|
8159
8849
|
});
|
|
8160
|
-
/** 总列数 = 可见业务列 + 选择列(空态 colspan
|
|
8161
|
-
const columnCount = computed(() => visibleColumns.value.length + (hasSelection.value ? 1 : 0));
|
|
8850
|
+
/** 总列数 = 可见业务列 + 选择列(空态 colspan 与骨架行) */
|
|
8851
|
+
const columnCount = computed(() => visibleColumns.value.length + (hasSelection.value ? 1 : 0) + (dragEnabled.value ? 1 : 0));
|
|
8162
8852
|
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。`);
|
|
8163
|
-
if (
|
|
8853
|
+
if (import.meta.env.DEV) {
|
|
8854
|
+
const validateNodes = (nodes, depth) => {
|
|
8855
|
+
for (const node of nodes) if (isColumnGroup(node)) {
|
|
8856
|
+
if ("key" in node && node.key !== void 0) console.warn("[tu-design] <TableRender> 分组节点不应配置 key(分组不是数据列),已忽略。");
|
|
8857
|
+
if (node.sortable !== void 0) console.warn(`[tu-design] <TableRender> 分组「${node.title}」不支持 sortable(仅叶子列可排序),已忽略。`);
|
|
8858
|
+
if (node.fixed !== void 0) console.warn(`[tu-design] <TableRender> 分组「${node.title}」不支持 fixed(请配置到叶子列),已忽略。`);
|
|
8859
|
+
if (node.children.length === 0) console.warn(`[tu-design] <TableRender> 分组「${node.title}」children 为空,将被忽略。`);
|
|
8860
|
+
validateNodes(node.children, depth + 1);
|
|
8861
|
+
} else if ("children" in node && node.children !== void 0) console.warn(`[tu-design] <TableRender> 叶子列 "${node.key}" 不应配置 children,已按叶子渲染。`);
|
|
8862
|
+
};
|
|
8863
|
+
validateNodes(columnsTree.value, 0);
|
|
8864
|
+
}
|
|
8865
|
+
if (columns.value.length >= 10 && !columns.value.some((c) => typeof c.width === "number")) console.warn(`[tu-design] <TableRender> ${columns.value.length} 列均无数字 width,窄容器下不会出现横向滚动;宽表请为列声明数字 width(px)。`);
|
|
8164
8866
|
/** sticky 单元格映射(纯渲染层 computed,不进 TanStack pinning state):
|
|
8165
8867
|
* 选择列视作最左 fixed 列参与累计(offset 0);fixed-left 按列序累加,
|
|
8166
8868
|
* fixed-right 从最右列反向累计。edge = 该 sticky 组朝滚动方向的交界列(加分隔边框)。
|
|
8167
|
-
*
|
|
8869
|
+
* 全部基于**可见集**:sticky 组因隐藏变空则无该组输出(不输出边框)。
|
|
8168
8870
|
*/
|
|
8169
8871
|
const stickyOf = computed(() => {
|
|
8170
8872
|
const map = /* @__PURE__ */ new Map();
|
|
@@ -8181,10 +8883,18 @@ const _sfc_main$44 = /*@__PURE__*/ defineComponent({
|
|
|
8181
8883
|
map.set(SELECTION_CELL, {
|
|
8182
8884
|
side: "left",
|
|
8183
8885
|
offset: 0,
|
|
8184
|
-
edge: lefts.length === 0
|
|
8886
|
+
edge: lefts.length === 0 && !dragEnabled.value
|
|
8185
8887
|
});
|
|
8186
8888
|
acc = selection.value.width;
|
|
8187
8889
|
}
|
|
8890
|
+
if (dragEnabled.value) {
|
|
8891
|
+
map.set(DRAG_CELL, {
|
|
8892
|
+
side: "left",
|
|
8893
|
+
offset: acc,
|
|
8894
|
+
edge: lefts.length === 0
|
|
8895
|
+
});
|
|
8896
|
+
acc += dragWidth;
|
|
8897
|
+
}
|
|
8188
8898
|
lefts.forEach((left, index) => {
|
|
8189
8899
|
map.set(left.key, {
|
|
8190
8900
|
side: "left",
|
|
@@ -8209,9 +8919,10 @@ const _sfc_main$44 = /*@__PURE__*/ defineComponent({
|
|
|
8209
8919
|
let sum = 0;
|
|
8210
8920
|
for (const column of visibleColumns.value) if (typeof column.width === "number" && column.width > 0) sum += column.width;
|
|
8211
8921
|
if (hasSelection.value && selection.value.width > 0) sum += selection.value.width;
|
|
8922
|
+
if (dragEnabled.value && dragWidth > 0) sum += dragWidth;
|
|
8212
8923
|
return sum;
|
|
8213
8924
|
});
|
|
8214
|
-
/** 列宽 inline style
|
|
8925
|
+
/** 列宽 inline style 值:数字补 px 单位——Vue :style 不自动加单位,
|
|
8215
8926
|
* 裸数字会被浏览器当非法 CSS 值丢弃,列宽即失效;字符串视为已带单位原样输出。
|
|
8216
8927
|
* @param width - 列宽配置
|
|
8217
8928
|
* @returns 可直接用于 :style 的 CSS 宽度值;未配置返回 undefined
|
|
@@ -8219,7 +8930,70 @@ const _sfc_main$44 = /*@__PURE__*/ defineComponent({
|
|
|
8219
8930
|
function widthOf(width) {
|
|
8220
8931
|
return typeof width === "number" ? `${width}px` : width;
|
|
8221
8932
|
}
|
|
8222
|
-
/**
|
|
8933
|
+
/** 混合固定组警告去重(同名分组仅警告一次) */
|
|
8934
|
+
const warnedMixedFixedGroups = /* @__PURE__ */ new Set();
|
|
8935
|
+
/**
|
|
8936
|
+
* 分组单元格的 sticky 样式:子树可见叶子同侧且连续固定时整格 sticky,
|
|
8937
|
+
* 偏移取首个可见叶子;混合侧 → 返回 undefined(降级普通格)并 DEV 警告一次。
|
|
8938
|
+
* @param cell - 表头单元格(分组)
|
|
8939
|
+
* @returns 分组单元格的 sticky inline style;不适用时返回 undefined
|
|
8940
|
+
*/
|
|
8941
|
+
function groupStickyStyle(cell) {
|
|
8942
|
+
const sides = new Set(cell.leafKeys.map((key) => columns.value.find((column) => column.key === key)?.fixed).filter((side) => side !== void 0));
|
|
8943
|
+
if (sides.size > 1) {
|
|
8944
|
+
if (!warnedMixedFixedGroups.has(cell.key)) {
|
|
8945
|
+
warnedMixedFixedGroups.add(cell.key);
|
|
8946
|
+
if (import.meta.env.DEV) console.warn(`[tu-design] <TableRender> 分组「${cell.node.title}」内固定方向混合,已降级为普通表头格。`);
|
|
8947
|
+
}
|
|
8948
|
+
return;
|
|
8949
|
+
}
|
|
8950
|
+
if (sides.size === 0) return void 0;
|
|
8951
|
+
if (cell.leafKeys.filter((key) => {
|
|
8952
|
+
const column = columns.value.find((c) => c.key === key);
|
|
8953
|
+
return column?.fixed !== void 0 && typeof column.width === "number";
|
|
8954
|
+
}).length !== cell.leafKeys.length) return void 0;
|
|
8955
|
+
const side = [...sides][0];
|
|
8956
|
+
const first = stickyOf.value.get(cell.leafKeys[0]);
|
|
8957
|
+
if (!first) return void 0;
|
|
8958
|
+
return {
|
|
8959
|
+
position: "sticky",
|
|
8960
|
+
[side]: `${first.offset}px`,
|
|
8961
|
+
zIndex: "var(--z-sticky-head)"
|
|
8962
|
+
};
|
|
8963
|
+
}
|
|
8964
|
+
/**
|
|
8965
|
+
* 表头行的行级样式:sticky 模式下逐行累积 top 偏移(多行表头),避免顶边重叠。
|
|
8966
|
+
* @param rowIndex - 表头行下标
|
|
8967
|
+
* @returns 行级 inline style;非 sticky 模式返回 undefined
|
|
8968
|
+
*/
|
|
8969
|
+
function headerRowStyle(rowIndex) {
|
|
8970
|
+
if (!theadSticky) return void 0;
|
|
8971
|
+
return { top: `${rowTop.value[rowIndex] ?? rowIndex * HEADER_ROW_FALLBACK}px` };
|
|
8972
|
+
}
|
|
8973
|
+
/**
|
|
8974
|
+
* 表头单元格的视觉规约:分组格与其后单元格之间加竖向分隔线。
|
|
8975
|
+
*
|
|
8976
|
+
* 横向底边线沿用既有机制(非 sticky 走 thead 行级 `[&_tr]:border-b`;
|
|
8977
|
+
* sticky 走 `theadThClass` 的 `border-b`),此处**不重复绘制**;
|
|
8978
|
+
* 单级表头(无分组)直接返回空,保证扁平列 DOM 零变化。
|
|
8979
|
+
* @param cell - 表头单元格
|
|
8980
|
+
* @param isLastInRow - 是否为本行最后一个单元格
|
|
8981
|
+
* @returns class 列表
|
|
8982
|
+
*/
|
|
8983
|
+
function headerCellClass(cell, isLastInRow) {
|
|
8984
|
+
if (maxDepth.value === 1) return [];
|
|
8985
|
+
return cell.isGroup && !isLastInRow ? ["border-r border-border"] : [];
|
|
8986
|
+
}
|
|
8987
|
+
/**
|
|
8988
|
+
* 分组单元格水平对齐(分组无 align 以外的能力)
|
|
8989
|
+
* @param cell - 表头单元格
|
|
8990
|
+
* @returns 对齐值,默认居中
|
|
8991
|
+
*/
|
|
8992
|
+
function headerCellAlign(cell) {
|
|
8993
|
+
return cell.isGroup ? cell.node.align ?? "center" : cell.node.align ?? "center";
|
|
8994
|
+
}
|
|
8995
|
+
/** 分组无需排序能力标记(sortable 仅叶子生效,对分组 sortable 警告) */
|
|
8996
|
+
/** 表头全选三态:本页可选行与选中集求交派生(TanStack getter 追踪不稳,自算) */
|
|
8223
8997
|
const selectableKeys = computed(() => rows.value.filter((row) => row.getCanSelect()).map((row) => rowKeyOf(row.original, row.index)));
|
|
8224
8998
|
const headerChecked = computed(() => hasSelection.value && selection.value.type === "checkbox" && selectableKeys.value.length > 0 && selectableKeys.value.every((key) => selectedKeys.value.has(key)));
|
|
8225
8999
|
const headerIndeterminate = computed(() => hasSelection.value && !headerChecked.value && selectableKeys.value.some((key) => selectedKeys.value.has(key)));
|
|
@@ -8227,7 +9001,7 @@ const _sfc_main$44 = /*@__PURE__*/ defineComponent({
|
|
|
8227
9001
|
instance.table.toggleAllPageRowsSelected(checked);
|
|
8228
9002
|
}
|
|
8229
9003
|
/**
|
|
8230
|
-
* 行选择控件切换;radio
|
|
9004
|
+
* 行选择控件切换;radio 不可取消由引擎守卫,不选中态点击传 checked=true
|
|
8231
9005
|
* @param line - 行数据(含行 key)
|
|
8232
9006
|
* @param checked - 目标选中态
|
|
8233
9007
|
*/
|
|
@@ -8238,7 +9012,7 @@ const _sfc_main$44 = /*@__PURE__*/ defineComponent({
|
|
|
8238
9012
|
emit("selection-change", [...selection.value.value]);
|
|
8239
9013
|
emit("update:selected-keys", [...keys]);
|
|
8240
9014
|
});
|
|
8241
|
-
/** 行 → 单元格值矩阵:render > formatter > record[key]
|
|
9015
|
+
/** 行 → 单元格值矩阵:render > formatter > record[key] */
|
|
8242
9016
|
const body = computed(() => {
|
|
8243
9017
|
const renderFns = new Map(columns.value.filter((c) => c.render).map((c) => [c, c.render(RENDERS)]));
|
|
8244
9018
|
return rows.value.map((row) => ({
|
|
@@ -8247,7 +9021,7 @@ const _sfc_main$44 = /*@__PURE__*/ defineComponent({
|
|
|
8247
9021
|
key: rowKeyOf(row.original, row.index),
|
|
8248
9022
|
index: row.index,
|
|
8249
9023
|
record: row.original,
|
|
8250
|
-
/**
|
|
9024
|
+
/** 行级可选过滤:selectable 谓词交由引擎 enableRowSelection 判定 */
|
|
8251
9025
|
canSelect: row.getCanSelect(),
|
|
8252
9026
|
cells: visibleColumns.value.map((column) => {
|
|
8253
9027
|
const render = renderFns.get(column);
|
|
@@ -8261,7 +9035,7 @@ const _sfc_main$44 = /*@__PURE__*/ defineComponent({
|
|
|
8261
9035
|
const treeIndent = tree?.indentSize ?? 16;
|
|
8262
9036
|
let missingRowKeyWarned = false;
|
|
8263
9037
|
/**
|
|
8264
|
-
* 行主键:rowKey
|
|
9038
|
+
* 行主键:rowKey 字段缺失时以行索引兜底
|
|
8265
9039
|
* @param record - 行记录
|
|
8266
9040
|
* @param index - 行索引(兜底来源)
|
|
8267
9041
|
* @returns 稳定的行主键字符串
|
|
@@ -8281,6 +9055,109 @@ const _sfc_main$44 = /*@__PURE__*/ defineComponent({
|
|
|
8281
9055
|
const heightRaw = instance.height ?? props.height;
|
|
8282
9056
|
if (virtualRaw === true && heightRaw === void 0 && !fill) console.warn("[tu-design] <TableRender> virtual 需要配置 height,已降级普通渲染。");
|
|
8283
9057
|
const virtualEnabled = virtualRaw === true && (heightRaw !== void 0 || fill);
|
|
9058
|
+
const dragConfig = instance.draggable;
|
|
9059
|
+
const dragEnabled = computed(() => dragConfig !== void 0 && !virtualEnabled);
|
|
9060
|
+
const dragWidth = dragConfig?.width ?? 32;
|
|
9061
|
+
const drag = useRowDrag();
|
|
9062
|
+
const dragKeysValid = computed(() => !dragEnabled.value || body.value.every((line) => line.record[props.rowKey] != null));
|
|
9063
|
+
let dragRowKeyWarned = false;
|
|
9064
|
+
watch(dragKeysValid, (valid) => {
|
|
9065
|
+
if (!valid && !dragRowKeyWarned && import.meta.env.DEV) {
|
|
9066
|
+
dragRowKeyWarned = true;
|
|
9067
|
+
console.warn(`[tu-design] <TableRender> 部分记录缺少 rowKey 字段 "${props.rowKey}",已禁用行拖拽排序。`);
|
|
9068
|
+
}
|
|
9069
|
+
}, { immediate: true });
|
|
9070
|
+
/**
|
|
9071
|
+
* 本行把手禁用判定:排序激活(动态守卫,取消排序恢复)/ rowKey 缺失 / 行级谓词 false
|
|
9072
|
+
* @param line - 行数据
|
|
9073
|
+
* @returns 是否禁用本行把手
|
|
9074
|
+
*/
|
|
9075
|
+
function rowDragDisabled(line) {
|
|
9076
|
+
if (instance.sort.value !== void 0 || !dragKeysValid.value) return true;
|
|
9077
|
+
return dragConfig?.draggable ? !dragConfig.draggable(line.record) : false;
|
|
9078
|
+
}
|
|
9079
|
+
const previewKeys = ref(void 0);
|
|
9080
|
+
/** 显示序:拖拽中按预览序重排(失效 key 过滤、新增行追加,防中途外部 data 变更);平时即引擎序 */
|
|
9081
|
+
const displayBody = computed(() => {
|
|
9082
|
+
const keys = previewKeys.value;
|
|
9083
|
+
if (!keys) return body.value;
|
|
9084
|
+
const byKey = new Map(body.value.map((line) => [line.key, line]));
|
|
9085
|
+
const ordered = [];
|
|
9086
|
+
for (const key of keys) {
|
|
9087
|
+
const line = byKey.get(key);
|
|
9088
|
+
if (line) {
|
|
9089
|
+
ordered.push(line);
|
|
9090
|
+
byKey.delete(key);
|
|
9091
|
+
}
|
|
9092
|
+
}
|
|
9093
|
+
return ordered.concat([...byKey.values()]);
|
|
9094
|
+
});
|
|
9095
|
+
/** 离屏整行快照(仅真实浏览器 dataTransfer 存在时创建);drop/dragend 时移除 */
|
|
9096
|
+
let dragSnapshot;
|
|
9097
|
+
function removeDragSnapshot() {
|
|
9098
|
+
dragSnapshot?.remove();
|
|
9099
|
+
dragSnapshot = void 0;
|
|
9100
|
+
}
|
|
9101
|
+
/**
|
|
9102
|
+
* 起拖(把手 dragstart):禁用行不接收;离屏克隆整行作为拖拽快照(幽灵影 = 带边框整行截图)
|
|
9103
|
+
* @param line - 源行数据
|
|
9104
|
+
* @param event - 原生 dragstart 事件
|
|
9105
|
+
*/
|
|
9106
|
+
function onRowDragStart(line, event) {
|
|
9107
|
+
if (rowDragDisabled(line)) return;
|
|
9108
|
+
const tr = event.target?.closest?.("tr");
|
|
9109
|
+
let image;
|
|
9110
|
+
if (event.dataTransfer && tr) {
|
|
9111
|
+
const rect = tr.getBoundingClientRect();
|
|
9112
|
+
dragSnapshot = createRowSnapshot(tr);
|
|
9113
|
+
image = {
|
|
9114
|
+
el: dragSnapshot,
|
|
9115
|
+
offsetX: event.clientX - rect.left,
|
|
9116
|
+
offsetY: event.clientY - rect.top
|
|
9117
|
+
};
|
|
9118
|
+
}
|
|
9119
|
+
drag.start(line.key, event, image);
|
|
9120
|
+
}
|
|
9121
|
+
/**
|
|
9122
|
+
* 悬停让位:把被拖行移到悬停行在当前预览序中的位置(仅被拖行移动)
|
|
9123
|
+
* @param line - 悬停行数据
|
|
9124
|
+
* @param event - 原生 dragover 事件
|
|
9125
|
+
*/
|
|
9126
|
+
function onRowDragOver(line, event) {
|
|
9127
|
+
if (!drag.over(line.key, event)) return;
|
|
9128
|
+
const dragging = drag.draggingKey.value;
|
|
9129
|
+
const keys = [...previewKeys.value ?? body.value.map((item) => item.key)];
|
|
9130
|
+
const fromIndex = keys.indexOf(dragging);
|
|
9131
|
+
const toIndex = keys.indexOf(line.key);
|
|
9132
|
+
if (fromIndex < 0 || toIndex < 0 || fromIndex === toIndex) return;
|
|
9133
|
+
keys.splice(fromIndex, 1);
|
|
9134
|
+
keys.splice(toIndex, 0, dragging);
|
|
9135
|
+
previewKeys.value = keys;
|
|
9136
|
+
}
|
|
9137
|
+
/**
|
|
9138
|
+
* 成功落位:提交预览序。多跳预览的复合结果 ≡ 单次「源行原位移 → 最终预览位」,
|
|
9139
|
+
* 故 from = 原 body 索引、to = 预览序中被拖行最终索引,直接复用引擎 reorderRows。
|
|
9140
|
+
* @param line - 落位行数据
|
|
9141
|
+
* @param event - 原生 drop 事件
|
|
9142
|
+
*/
|
|
9143
|
+
function onRowDrop(line, event) {
|
|
9144
|
+
const preview = previewKeys.value;
|
|
9145
|
+
const result = drag.drop(line.key, event);
|
|
9146
|
+
previewKeys.value = void 0;
|
|
9147
|
+
removeDragSnapshot();
|
|
9148
|
+
if (!result) return;
|
|
9149
|
+
const from = body.value.findIndex((item) => item.key === result.fromKey);
|
|
9150
|
+
const to = preview ? preview.indexOf(result.fromKey) : body.value.findIndex((item) => item.key === result.toKey);
|
|
9151
|
+
if (from < 0 || to < 0) return;
|
|
9152
|
+
const payload = instance.reorderRows(from, to);
|
|
9153
|
+
if (payload) emit("drag-sort", payload);
|
|
9154
|
+
}
|
|
9155
|
+
/** 拖拽结束(含取消路径):清理状态 + 预览序弹回引擎原序 + 移除离屏快照 */
|
|
9156
|
+
function onRowDragEnd() {
|
|
9157
|
+
drag.end();
|
|
9158
|
+
previewKeys.value = void 0;
|
|
9159
|
+
removeDragSnapshot();
|
|
9160
|
+
}
|
|
8284
9161
|
const scrollHeight = computed(() => typeof heightRaw === "number" ? `${heightRaw}px` : heightRaw);
|
|
8285
9162
|
/** 表头 sticky 仅在组件内存在真实纵向滚动盒时生效(fill / virtual),普通模式不挂载,行为不变 */
|
|
8286
9163
|
const theadSticky = fill || virtualEnabled;
|
|
@@ -8304,6 +9181,17 @@ const _sfc_main$44 = /*@__PURE__*/ defineComponent({
|
|
|
8304
9181
|
const theadEl = ref(null);
|
|
8305
9182
|
/** 滚动容器内 thead 占据的前缀高度(scrollMargin);表头内容静态,挂载后测量一次 */
|
|
8306
9183
|
const theadOffset = ref(0);
|
|
9184
|
+
/** 表头行元素(模板 ref 收集,逐行求高度) */
|
|
9185
|
+
const headerRowEls = ref([]);
|
|
9186
|
+
/** 各行顶部偏移(前缀和):多行 sticky 表头逐行钉住,避免顶边重叠 */
|
|
9187
|
+
const rowTop = ref([]);
|
|
9188
|
+
/** 行高兜底:表头行 class 为 h-10(2.5rem = 40px);happy-dom 下 offsetHeight 恒 0 */
|
|
9189
|
+
function measureHeaderRows() {
|
|
9190
|
+
const raw = headerRowEls.value.map((el) => el?.offsetHeight ?? 0);
|
|
9191
|
+
const heights = raw.map((height) => height || HEADER_ROW_FALLBACK);
|
|
9192
|
+
rowTop.value = heights.map((_, index) => heights.slice(0, index).reduce((a, h) => a + h, 0));
|
|
9193
|
+
if (virtualEnabled) theadOffset.value = raw.reduce((a, h) => a + h, 0);
|
|
9194
|
+
}
|
|
8307
9195
|
const virtualizerRef = virtualEnabled ? useVirtualizer(computed(() => ({
|
|
8308
9196
|
count: rows.value.length,
|
|
8309
9197
|
getScrollElement: () => scrollEl.value,
|
|
@@ -8312,9 +9200,8 @@ const _sfc_main$44 = /*@__PURE__*/ defineComponent({
|
|
|
8312
9200
|
getItemKey: (index) => rowKeyOf(rows.value[index], index),
|
|
8313
9201
|
scrollMargin: theadOffset.value
|
|
8314
9202
|
}))) : null;
|
|
8315
|
-
onMounted(
|
|
8316
|
-
|
|
8317
|
-
});
|
|
9203
|
+
onMounted(measureHeaderRows);
|
|
9204
|
+
watch(headerRows, () => void nextTick(measureHeaderRows), { flush: "post" });
|
|
8318
9205
|
const virtualRows = computed(() => virtualizerRef ? virtualizerRef.value.getVirtualItems() : []);
|
|
8319
9206
|
const virtualTotal = computed(() => virtualizerRef ? virtualizerRef.value.getTotalSize() : 0);
|
|
8320
9207
|
/** 窗口行 + 对应全量行数据(cells 矩阵已由 body computed 缓存,虚拟化只裁剪 DOM 节点) */
|
|
@@ -8336,7 +9223,7 @@ const _sfc_main$44 = /*@__PURE__*/ defineComponent({
|
|
|
8336
9223
|
if (el instanceof Element) virtualizerRef?.value.measureElement(el);
|
|
8337
9224
|
}
|
|
8338
9225
|
/**
|
|
8339
|
-
* aria-sort
|
|
9226
|
+
* aria-sort 仅在该列当前被排序时标注
|
|
8340
9227
|
* @param column - 列配置
|
|
8341
9228
|
* @returns 当前排序方向对应的 aria-sort 值;未排序返回 undefined
|
|
8342
9229
|
*/
|
|
@@ -8408,7 +9295,7 @@ const _sfc_main$44 = /*@__PURE__*/ defineComponent({
|
|
|
8408
9295
|
});
|
|
8409
9296
|
return (_ctx, _cache) => {
|
|
8410
9297
|
return openBlock(), createElementBlock("div", { class: normalizeClass(unref(cn)("w-full", unref(fill) && "flex h-full min-h-0 flex-col", _ctx.$attrs.class)) }, [
|
|
8411
|
-
createCommentVNode(" 搜索区 + 列设置触发器:同行右对齐(items-end);无搜索时触发器位于表格上方(
|
|
9298
|
+
createCommentVNode(" 搜索区 + 列设置触发器:同行右对齐(items-end);无搜索时触发器位于表格上方(showSearch=false 关闭搜索区) "),
|
|
8412
9299
|
showSearchArea.value || showColumnSettings.value ? (openBlock(), createElementBlock("div", {
|
|
8413
9300
|
key: 0,
|
|
8414
9301
|
class: normalizeClass(unref(cn)("mb-2 flex items-end justify-between gap-2", unref(fill) && "shrink-0"))
|
|
@@ -8421,46 +9308,48 @@ const _sfc_main$44 = /*@__PURE__*/ defineComponent({
|
|
|
8421
9308
|
onSearch,
|
|
8422
9309
|
onReset
|
|
8423
9310
|
}, null, 8, ["definition", "searchable"])) : createCommentVNode("v-if", true),
|
|
8424
|
-
createCommentVNode(" 列设置:Popover
|
|
9311
|
+
createCommentVNode(" 列设置:Popover 面板(最少一列 / 重置 / 不含选择列);\n 触发钮 Tooltip 手动受控开合(Tooltip 与 Popover 触发器嵌套会吞点击,故并列渲染、不走 hover 自动触发) "),
|
|
8425
9312
|
showColumnSettings.value ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
|
|
8426
9313
|
createVNode(unref(_sfc_main$34), {
|
|
8427
9314
|
align: "end",
|
|
8428
9315
|
"content-class": "w-56 p-0"
|
|
8429
9316
|
}, {
|
|
8430
9317
|
content: withCtx(() => [
|
|
8431
|
-
createElementVNode("div", _hoisted_1$
|
|
9318
|
+
createElementVNode("div", _hoisted_1$7, [createElementVNode("button", {
|
|
8432
9319
|
type: "button",
|
|
8433
9320
|
class: "text-muted-foreground hover:text-foreground cursor-pointer text-xs disabled:cursor-not-allowed disabled:opacity-50",
|
|
8434
9321
|
disabled: allColumnsVisible.value,
|
|
8435
9322
|
onClick: selectAllColumns
|
|
8436
|
-
}, " 全选 ", 8, _hoisted_2$
|
|
9323
|
+
}, " 全选 ", 8, _hoisted_2$6), createElementVNode("button", {
|
|
8437
9324
|
type: "button",
|
|
8438
9325
|
class: "text-muted-foreground hover:text-foreground cursor-pointer text-xs",
|
|
8439
9326
|
onClick: resetColumns
|
|
8440
9327
|
}, " 重置 ")]),
|
|
8441
9328
|
createVNode(unref(_sfc_main$38)),
|
|
8442
|
-
createElementVNode("div", _hoisted_3$4, [(openBlock(true), createElementBlock(Fragment, null, renderList(
|
|
9329
|
+
createElementVNode("div", _hoisted_3$4, [(openBlock(true), createElementBlock(Fragment, null, renderList(panelRows.value, (row) => {
|
|
8443
9330
|
return openBlock(), createElementBlock("div", {
|
|
8444
|
-
key:
|
|
9331
|
+
key: row.key,
|
|
8445
9332
|
"data-column-item": "",
|
|
8446
|
-
"data-column-key":
|
|
9333
|
+
"data-column-key": row.isGroup ? void 0 : row.key,
|
|
9334
|
+
"data-column-group": row.isGroup ? row.path : void 0,
|
|
8447
9335
|
class: "hover:bg-accent/50 flex h-8 cursor-pointer items-center gap-2 px-3",
|
|
8448
|
-
|
|
9336
|
+
style: normalizeStyle({ paddingLeft: `${12 + row.depth * 12}px` }),
|
|
9337
|
+
onClick: ($event) => onPanelRowClick(row)
|
|
8449
9338
|
}, [
|
|
8450
9339
|
createVNode(unref(_sfc_main$9), {
|
|
8451
|
-
checked: isColumnVisible(
|
|
8452
|
-
disabled: !canHideColumn(
|
|
8453
|
-
"onUpdate:checked": ($event) =>
|
|
9340
|
+
checked: row.isGroup ? groupCheckedState(row) : isColumnVisible(row.key),
|
|
9341
|
+
disabled: row.isGroup ? false : !canHideColumn(row.key),
|
|
9342
|
+
"onUpdate:checked": ($event) => onPanelRowClick(row),
|
|
8454
9343
|
onClick: _cache[2] || (_cache[2] = withModifiers(() => {}, ["stop"]))
|
|
8455
9344
|
}, null, 8, [
|
|
8456
9345
|
"checked",
|
|
8457
9346
|
"disabled",
|
|
8458
9347
|
"onUpdate:checked"
|
|
8459
9348
|
]),
|
|
8460
|
-
createElementVNode("span", _hoisted_5$1, toDisplayString(
|
|
8461
|
-
createCommentVNode(" 有效 fixed 列(数字 width
|
|
8462
|
-
|
|
8463
|
-
],
|
|
9349
|
+
createElementVNode("span", _hoisted_5$1, toDisplayString(row.node.title), 1),
|
|
9350
|
+
createCommentVNode(" 有效 fixed 列(数字 width)标识:仅叶子 "),
|
|
9351
|
+
!row.isGroup && row.node.fixed !== void 0 && typeof row.node.width === "number" ? (openBlock(), createElementBlock("svg", _hoisted_6$1, [..._cache[6] || (_cache[6] = [createElementVNode("path", { d: "M12 17v5" }, null, -1), createElementVNode("path", { d: "M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7h1a2 2 0 0 0 0-4H8a2 2 0 0 0 0 4h1z" }, null, -1)])])) : createCommentVNode("v-if", true)
|
|
9352
|
+
], 12, _hoisted_4$2);
|
|
8464
9353
|
}), 128))])
|
|
8465
9354
|
]),
|
|
8466
9355
|
default: withCtx(() => [createVNode(unref(_sfc_main$5), {
|
|
@@ -8471,7 +9360,7 @@ const _sfc_main$44 = /*@__PURE__*/ defineComponent({
|
|
|
8471
9360
|
onPointerenter: _cache[0] || (_cache[0] = ($event) => settingsTipOpen.value = true),
|
|
8472
9361
|
onPointerleave: _cache[1] || (_cache[1] = ($event) => settingsTipOpen.value = false)
|
|
8473
9362
|
}, {
|
|
8474
|
-
default: withCtx(() => [createCommentVNode(" lucide Settings2(内联 SVG,跟随项目图标现状) "), _cache[
|
|
9363
|
+
default: withCtx(() => [createCommentVNode(" lucide Settings2(内联 SVG,跟随项目图标现状) "), _cache[5] || (_cache[5] = createElementVNode("svg", {
|
|
8475
9364
|
xmlns: "http://www.w3.org/2000/svg",
|
|
8476
9365
|
viewBox: "0 0 24 24",
|
|
8477
9366
|
fill: "none",
|
|
@@ -8519,67 +9408,97 @@ const _sfc_main$44 = /*@__PURE__*/ defineComponent({
|
|
|
8519
9408
|
ref_key: "theadEl",
|
|
8520
9409
|
ref: theadEl,
|
|
8521
9410
|
class: normalizeClass(unref(theadSticky) ? void 0 : "[&_tr]:border-b")
|
|
8522
|
-
}, [
|
|
8523
|
-
|
|
8524
|
-
|
|
8525
|
-
|
|
8526
|
-
|
|
8527
|
-
|
|
8528
|
-
|
|
8529
|
-
|
|
8530
|
-
|
|
8531
|
-
|
|
8532
|
-
"aria-label": "全选本页",
|
|
8533
|
-
"onUpdate:checked": onHeaderSelect
|
|
8534
|
-
}, null, 8, ["checked"])) : createCommentVNode("v-if", true)], 6)) : createCommentVNode("v-if", true),
|
|
8535
|
-
(openBlock(true), createElementBlock(Fragment, null, renderList(visibleColumns.value, (column) => {
|
|
8536
|
-
return openBlock(), createElementBlock("th", {
|
|
8537
|
-
key: column.key,
|
|
9411
|
+
}, [(openBlock(true), createElementBlock(Fragment, null, renderList(headerRows.value, (cells, rowIndex) => {
|
|
9412
|
+
return openBlock(), createElementBlock("tr", {
|
|
9413
|
+
key: rowIndex,
|
|
9414
|
+
ref_for: true,
|
|
9415
|
+
ref: (el) => headerRowEls.value[rowIndex] = el,
|
|
9416
|
+
style: normalizeStyle(headerRowStyle(rowIndex))
|
|
9417
|
+
}, [
|
|
9418
|
+
createCommentVNode(" 选择列:checkbox 型表头为本页全选三态;radio 型占位;视作最左固定列 "),
|
|
9419
|
+
hasSelection.value && rowIndex === 0 ? (openBlock(), createElementBlock("th", {
|
|
9420
|
+
key: 0,
|
|
8538
9421
|
scope: "col",
|
|
8539
|
-
|
|
8540
|
-
|
|
8541
|
-
|
|
8542
|
-
|
|
8543
|
-
}, unref(stickyStyle)(stickyOf.value, column.key, true)]),
|
|
8544
|
-
"aria-sort": ariaSort(column)
|
|
8545
|
-
}, [column.sortable ? (openBlock(), createElementBlock("button", {
|
|
9422
|
+
rowspan: headerRows.value.length,
|
|
9423
|
+
class: normalizeClass(["h-10 w-12 px-2 text-center align-middle font-medium text-muted-foreground", [unref(stickyClass)(stickyOf.value, unref(SELECTION_CELL)), unref(theadThClass)]]),
|
|
9424
|
+
style: normalizeStyle([{ width: `${selection.value.width}px` }, unref(stickyStyle)(stickyOf.value, unref(SELECTION_CELL), true)])
|
|
9425
|
+
}, [selection.value.type === "checkbox" ? (openBlock(), createBlock(unref(_sfc_main$9), {
|
|
8546
9426
|
key: 0,
|
|
8547
|
-
|
|
8548
|
-
|
|
8549
|
-
|
|
8550
|
-
},
|
|
8551
|
-
|
|
8552
|
-
|
|
8553
|
-
|
|
9427
|
+
checked: headerIndeterminate.value ? "indeterminate" : headerChecked.value,
|
|
9428
|
+
"aria-label": "全选本页",
|
|
9429
|
+
"onUpdate:checked": onHeaderSelect
|
|
9430
|
+
}, null, 8, ["checked"])) : createCommentVNode("v-if", true)], 14, _hoisted_7$1)) : createCommentVNode("v-if", true),
|
|
9431
|
+
createCommentVNode(" 拖拽把手列表头:占位(对齐 radio 选择列范式);视作最左固定列(紧随选择列) "),
|
|
9432
|
+
dragEnabled.value && rowIndex === 0 ? (openBlock(), createElementBlock("th", {
|
|
9433
|
+
key: 1,
|
|
9434
|
+
scope: "col",
|
|
9435
|
+
rowspan: headerRows.value.length,
|
|
9436
|
+
class: normalizeClass(["h-10 px-1 text-center align-middle font-medium text-muted-foreground", [unref(stickyClass)(stickyOf.value, unref(DRAG_CELL)), unref(theadThClass)]]),
|
|
9437
|
+
style: normalizeStyle([{ width: `${unref(dragWidth)}px` }, unref(stickyStyle)(stickyOf.value, unref(DRAG_CELL), true)])
|
|
9438
|
+
}, [..._cache[7] || (_cache[7] = [createElementVNode("span", { class: "sr-only" }, "拖拽排序", -1)])], 14, _hoisted_8)) : createCommentVNode("v-if", true),
|
|
9439
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(cells, (cell, cellIndex) => {
|
|
9440
|
+
return openBlock(), createElementBlock("th", {
|
|
9441
|
+
key: cell.key,
|
|
9442
|
+
scope: cell.isGroup ? "colgroup" : "col",
|
|
9443
|
+
colspan: cell.colSpan > 1 ? cell.colSpan : void 0,
|
|
9444
|
+
rowspan: cell.rowSpan > 1 ? cell.rowSpan : void 0,
|
|
9445
|
+
class: normalizeClass(["h-10 px-2 align-middle font-medium text-muted-foreground", [
|
|
9446
|
+
cell.isGroup ? void 0 : unref(stickyClass)(stickyOf.value, cell.key),
|
|
9447
|
+
unref(theadThClass),
|
|
9448
|
+
headerCellClass(cell, cellIndex === cells.length - 1)
|
|
9449
|
+
]]),
|
|
9450
|
+
style: normalizeStyle([cell.isGroup ? { textAlign: headerCellAlign(cell) } : {
|
|
9451
|
+
width: widthOf(cell.node.width),
|
|
9452
|
+
textAlign: headerCellAlign(cell)
|
|
9453
|
+
}, cell.isGroup ? groupStickyStyle(cell) : unref(stickyStyle)(stickyOf.value, cell.key, true)]),
|
|
9454
|
+
"aria-sort": cell.isGroup ? void 0 : ariaSort(cell.node)
|
|
9455
|
+
}, [!cell.isGroup && cell.node.sortable ? (openBlock(), createElementBlock("button", {
|
|
9456
|
+
key: 0,
|
|
9457
|
+
type: "button",
|
|
9458
|
+
class: "inline-flex items-center gap-1 hover:text-foreground",
|
|
9459
|
+
onClick: ($event) => onSort(cell.node.key)
|
|
9460
|
+
}, [createTextVNode(toDisplayString(cell.node.title) + " ", 1), createElementVNode("span", _hoisted_11, toDisplayString(sortMark(cell.node)), 1)], 8, _hoisted_10)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [createTextVNode(toDisplayString(cell.node.title), 1)], 64))], 14, _hoisted_9);
|
|
9461
|
+
}), 128))
|
|
9462
|
+
], 4);
|
|
9463
|
+
}), 128))], 2), createElementVNode("tbody", _hoisted_12, [
|
|
9464
|
+
createCommentVNode(" 加载态:固定 5 行骨架;选择列一并占位;骨架不虚拟化;loading 判定优先 "),
|
|
8554
9465
|
loading.value ? (openBlock(), createElementBlock(Fragment, { key: 0 }, renderList(SKELETON_ROWS, (row) => {
|
|
8555
9466
|
return createElementVNode("tr", {
|
|
8556
9467
|
key: row,
|
|
8557
9468
|
"data-skeleton": ""
|
|
8558
|
-
}, [
|
|
8559
|
-
|
|
8560
|
-
|
|
8561
|
-
|
|
8562
|
-
|
|
8563
|
-
|
|
8564
|
-
|
|
8565
|
-
|
|
8566
|
-
|
|
8567
|
-
|
|
8568
|
-
|
|
8569
|
-
|
|
9469
|
+
}, [
|
|
9470
|
+
hasSelection.value ? (openBlock(), createElementBlock("td", {
|
|
9471
|
+
key: 0,
|
|
9472
|
+
class: normalizeClass(["p-2 text-center align-middle", unref(stickyClass)(stickyOf.value, unref(SELECTION_CELL))]),
|
|
9473
|
+
style: normalizeStyle(unref(stickyStyle)(stickyOf.value, unref(SELECTION_CELL), false))
|
|
9474
|
+
}, [createVNode(unref(_sfc_main$39), { class: "size-4" })], 6)) : createCommentVNode("v-if", true),
|
|
9475
|
+
dragEnabled.value ? (openBlock(), createElementBlock("td", {
|
|
9476
|
+
key: 1,
|
|
9477
|
+
class: normalizeClass(["p-1 text-center align-middle", unref(stickyClass)(stickyOf.value, unref(DRAG_CELL))]),
|
|
9478
|
+
style: normalizeStyle(unref(stickyStyle)(stickyOf.value, unref(DRAG_CELL), false))
|
|
9479
|
+
}, [createVNode(unref(_sfc_main$39), { class: "size-4" })], 6)) : createCommentVNode("v-if", true),
|
|
9480
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(visibleColumns.value, (column) => {
|
|
9481
|
+
return openBlock(), createElementBlock("td", {
|
|
9482
|
+
key: column.key,
|
|
9483
|
+
class: normalizeClass(["p-2 align-middle", unref(stickyClass)(stickyOf.value, column.key)]),
|
|
9484
|
+
style: normalizeStyle([{ textAlign: column.align ?? "center" }, unref(stickyStyle)(stickyOf.value, column.key, false)])
|
|
9485
|
+
}, [createVNode(unref(_sfc_main$39), { class: "h-4 w-full" })], 6);
|
|
9486
|
+
}), 128))
|
|
9487
|
+
]);
|
|
9488
|
+
}), 64)) : showError.value ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [createCommentVNode(" 错误态:error 优先于正常数据;插槽可自定义(slot props { error, retry }) "), createElementVNode("tr", _hoisted_13, [createElementVNode("td", {
|
|
8570
9489
|
colspan: columnCount.value,
|
|
8571
9490
|
class: "p-8 text-center text-muted-foreground"
|
|
8572
9491
|
}, [renderSlot(_ctx.$slots, "error", {
|
|
8573
9492
|
error: loadError.value,
|
|
8574
9493
|
retry
|
|
8575
|
-
}, () => [createElementVNode("div",
|
|
9494
|
+
}, () => [createElementVNode("div", _hoisted_15, [createElementVNode("p", null, toDisplayString(loadError.value?.message ?? "加载失败"), 1), createVNode(unref(_sfc_main$5), {
|
|
8576
9495
|
variant: "outline",
|
|
8577
9496
|
size: "sm",
|
|
8578
9497
|
onClick: retry
|
|
8579
9498
|
}, {
|
|
8580
|
-
default: withCtx(() => [..._cache[
|
|
9499
|
+
default: withCtx(() => [..._cache[8] || (_cache[8] = [createTextVNode("重试", -1)])]),
|
|
8581
9500
|
_: 1
|
|
8582
|
-
})])])], 8,
|
|
9501
|
+
})])])], 8, _hoisted_14)])], 64)) : unref(virtualEnabled) ? (openBlock(), createElementBlock(Fragment, { key: 2 }, [
|
|
8583
9502
|
createCommentVNode(" 虚拟滚动:窗口行 + 前后占位行(总高撑开滚动区间;行高经 measureElement 动态测量) "),
|
|
8584
9503
|
createElementVNode("tr", {
|
|
8585
9504
|
"aria-hidden": "true",
|
|
@@ -8588,7 +9507,7 @@ const _sfc_main$44 = /*@__PURE__*/ defineComponent({
|
|
|
8588
9507
|
}, [createElementVNode("td", {
|
|
8589
9508
|
colspan: columnCount.value,
|
|
8590
9509
|
class: "border-0 p-0"
|
|
8591
|
-
}, null, 8,
|
|
9510
|
+
}, null, 8, _hoisted_16)], 4),
|
|
8592
9511
|
(openBlock(true), createElementBlock(Fragment, null, renderList(virtualLines.value, (item) => {
|
|
8593
9512
|
return openBlock(), createBlock(_sfc_main$53, {
|
|
8594
9513
|
key: item.line.key,
|
|
@@ -8601,11 +9520,18 @@ const _sfc_main$44 = /*@__PURE__*/ defineComponent({
|
|
|
8601
9520
|
selected: unref(selectedKeys).has(item.line.key),
|
|
8602
9521
|
sticky: stickyOf.value,
|
|
8603
9522
|
"tree-indent": unref(tree) ? unref(treeIndent) : void 0,
|
|
9523
|
+
"drag-column": dragEnabled.value,
|
|
9524
|
+
"drag-disabled": rowDragDisabled(item.line),
|
|
9525
|
+
dragging: unref(drag).draggingKey.value === item.line.key,
|
|
8604
9526
|
onSelect: (checked) => onRowSelect(item.line, checked),
|
|
8605
9527
|
onRowClick: ($event) => onRowClick(item.line.record, item.line.index, $event),
|
|
8606
9528
|
onRowDblclick: ($event) => onRowDblclick(item.line.record, item.line.index, $event),
|
|
8607
9529
|
onRowContextmenu: ($event) => onRowContextmenu(item.line.record, item.line.index, $event),
|
|
8608
|
-
onCellClick: (columnKey, event) => onCellClick(item.line.record, columnKey, item.line.index, event)
|
|
9530
|
+
onCellClick: (columnKey, event) => onCellClick(item.line.record, columnKey, item.line.index, event),
|
|
9531
|
+
onDragStart: ($event) => onRowDragStart(item.line, $event),
|
|
9532
|
+
onDragOver: ($event) => onRowDragOver(item.line, $event),
|
|
9533
|
+
onDrop: ($event) => onRowDrop(item.line, $event),
|
|
9534
|
+
onDragEnd: _cache[3] || (_cache[3] = ($event) => onRowDragEnd())
|
|
8609
9535
|
}, null, 8, [
|
|
8610
9536
|
"data-index",
|
|
8611
9537
|
"line",
|
|
@@ -8614,11 +9540,17 @@ const _sfc_main$44 = /*@__PURE__*/ defineComponent({
|
|
|
8614
9540
|
"selected",
|
|
8615
9541
|
"sticky",
|
|
8616
9542
|
"tree-indent",
|
|
9543
|
+
"drag-column",
|
|
9544
|
+
"drag-disabled",
|
|
9545
|
+
"dragging",
|
|
8617
9546
|
"onSelect",
|
|
8618
9547
|
"onRowClick",
|
|
8619
9548
|
"onRowDblclick",
|
|
8620
9549
|
"onRowContextmenu",
|
|
8621
|
-
"onCellClick"
|
|
9550
|
+
"onCellClick",
|
|
9551
|
+
"onDragStart",
|
|
9552
|
+
"onDragOver",
|
|
9553
|
+
"onDrop"
|
|
8622
9554
|
]);
|
|
8623
9555
|
}), 128)),
|
|
8624
9556
|
createElementVNode("tr", {
|
|
@@ -8628,8 +9560,8 @@ const _sfc_main$44 = /*@__PURE__*/ defineComponent({
|
|
|
8628
9560
|
}, [createElementVNode("td", {
|
|
8629
9561
|
colspan: columnCount.value,
|
|
8630
9562
|
class: "border-0 p-0"
|
|
8631
|
-
}, null, 8,
|
|
8632
|
-
], 64)) : (openBlock(true), createElementBlock(Fragment, { key: 3 }, renderList(
|
|
9563
|
+
}, null, 8, _hoisted_17)], 4)
|
|
9564
|
+
], 64)) : (openBlock(true), createElementBlock(Fragment, { key: 3 }, renderList(displayBody.value, (line) => {
|
|
8633
9565
|
return openBlock(), createBlock(_sfc_main$53, {
|
|
8634
9566
|
key: line.key,
|
|
8635
9567
|
line,
|
|
@@ -8638,11 +9570,18 @@ const _sfc_main$44 = /*@__PURE__*/ defineComponent({
|
|
|
8638
9570
|
selected: unref(selectedKeys).has(line.key),
|
|
8639
9571
|
sticky: stickyOf.value,
|
|
8640
9572
|
"tree-indent": unref(tree) ? unref(treeIndent) : void 0,
|
|
9573
|
+
"drag-column": dragEnabled.value,
|
|
9574
|
+
"drag-disabled": rowDragDisabled(line),
|
|
9575
|
+
dragging: unref(drag).draggingKey.value === line.key,
|
|
8641
9576
|
onSelect: (checked) => onRowSelect(line, checked),
|
|
8642
9577
|
onRowClick: ($event) => onRowClick(line.record, line.index, $event),
|
|
8643
9578
|
onRowDblclick: ($event) => onRowDblclick(line.record, line.index, $event),
|
|
8644
9579
|
onRowContextmenu: ($event) => onRowContextmenu(line.record, line.index, $event),
|
|
8645
|
-
onCellClick: (columnKey, event) => onCellClick(line.record, columnKey, line.index, event)
|
|
9580
|
+
onCellClick: (columnKey, event) => onCellClick(line.record, columnKey, line.index, event),
|
|
9581
|
+
onDragStart: ($event) => onRowDragStart(line, $event),
|
|
9582
|
+
onDragOver: ($event) => onRowDragOver(line, $event),
|
|
9583
|
+
onDrop: ($event) => onRowDrop(line, $event),
|
|
9584
|
+
onDragEnd: _cache[4] || (_cache[4] = ($event) => onRowDragEnd())
|
|
8646
9585
|
}, null, 8, [
|
|
8647
9586
|
"line",
|
|
8648
9587
|
"columns",
|
|
@@ -8650,20 +9589,26 @@ const _sfc_main$44 = /*@__PURE__*/ defineComponent({
|
|
|
8650
9589
|
"selected",
|
|
8651
9590
|
"sticky",
|
|
8652
9591
|
"tree-indent",
|
|
9592
|
+
"drag-column",
|
|
9593
|
+
"drag-disabled",
|
|
9594
|
+
"dragging",
|
|
8653
9595
|
"onSelect",
|
|
8654
9596
|
"onRowClick",
|
|
8655
9597
|
"onRowDblclick",
|
|
8656
9598
|
"onRowContextmenu",
|
|
8657
|
-
"onCellClick"
|
|
9599
|
+
"onCellClick",
|
|
9600
|
+
"onDragStart",
|
|
9601
|
+
"onDragOver",
|
|
9602
|
+
"onDrop"
|
|
8658
9603
|
]);
|
|
8659
9604
|
}), 128)),
|
|
8660
9605
|
createCommentVNode(" 空态:横跨全列的单单元格,不虚拟化;错误态优先 "),
|
|
8661
|
-
!loading.value && !showError.value && body.value.length === 0 ? (openBlock(), createElementBlock("tr",
|
|
9606
|
+
!loading.value && !showError.value && body.value.length === 0 ? (openBlock(), createElementBlock("tr", _hoisted_18, [createElementVNode("td", {
|
|
8662
9607
|
colspan: columnCount.value,
|
|
8663
9608
|
class: "p-8 text-center text-muted-foreground"
|
|
8664
|
-
}, [renderSlot(_ctx.$slots, "empty", {}, () => [createTextVNode(toDisplayString(__props.emptyText ?? "暂无数据"), 1)])], 8,
|
|
9609
|
+
}, [renderSlot(_ctx.$slots, "empty", {}, () => [createTextVNode(toDisplayString(__props.emptyText ?? "暂无数据"), 1)])], 8, _hoisted_19)])) : createCommentVNode("v-if", true)
|
|
8665
9610
|
])], 6)], 6),
|
|
8666
|
-
createCommentVNode("
|
|
9611
|
+
createCommentVNode(" 手动接线(须经 onPageIndex/onPageSize 包装器保留受控去重);显式补 border-t 与 size select 保持现状 "),
|
|
8667
9612
|
showPaginationBar.value ? (openBlock(), createBlock(_sfc_main$43, {
|
|
8668
9613
|
key: 1,
|
|
8669
9614
|
class: normalizeClass(unref(cn)("border-t", unref(fill) && "shrink-0")),
|
|
@@ -8691,8 +9636,8 @@ const _sfc_main$44 = /*@__PURE__*/ defineComponent({
|
|
|
8691
9636
|
* 列定义辅助:补全泛型推导,便于把列配置抽到独立文件。
|
|
8692
9637
|
*
|
|
8693
9638
|
* 纯类型辅助,原样返回入参——裸数组同样可直接传给 defineTable(无需此函数)。
|
|
8694
|
-
* @param columns -
|
|
8695
|
-
* @returns
|
|
9639
|
+
* @param columns - 列节点树(叶子列或分组)
|
|
9640
|
+
* @returns 原样返回的列节点树
|
|
8696
9641
|
*/
|
|
8697
9642
|
function defineColumns(columns) {
|
|
8698
9643
|
return columns;
|
|
@@ -8712,7 +9657,7 @@ function defineTable(config) {
|
|
|
8712
9657
|
}
|
|
8713
9658
|
//#endregion
|
|
8714
9659
|
//#region src/components/tabs/Tabs.vue
|
|
8715
|
-
const _hoisted_1$
|
|
9660
|
+
const _hoisted_1$6 = [
|
|
8716
9661
|
"aria-label",
|
|
8717
9662
|
"onClick",
|
|
8718
9663
|
"onKeydown"
|
|
@@ -8847,7 +9792,7 @@ const _sfc_main$45 = /*@__PURE__*/ defineComponent({
|
|
|
8847
9792
|
onMousedown: _cache[0] || (_cache[0] = withModifiers(() => {}, ["prevent"])),
|
|
8848
9793
|
onClick: withModifiers(($event) => emit("close", item.value), ["stop"]),
|
|
8849
9794
|
onKeydown: [withKeys(withModifiers(($event) => emit("close", item.value), ["stop", "prevent"]), ["enter"]), withKeys(withModifiers(($event) => emit("close", item.value), ["stop", "prevent"]), ["space"])]
|
|
8850
|
-
}, "×", 40, _hoisted_1$
|
|
9795
|
+
}, "×", 40, _hoisted_1$6)) : createCommentVNode("v-if", true)
|
|
8851
9796
|
]),
|
|
8852
9797
|
_: 2
|
|
8853
9798
|
}, 1032, [
|
|
@@ -8891,8 +9836,8 @@ const _sfc_main$45 = /*@__PURE__*/ defineComponent({
|
|
|
8891
9836
|
});
|
|
8892
9837
|
//#endregion
|
|
8893
9838
|
//#region src/components/alert/Alert.vue
|
|
8894
|
-
const _hoisted_1$
|
|
8895
|
-
const _hoisted_2$
|
|
9839
|
+
const _hoisted_1$5 = ["role"];
|
|
9840
|
+
const _hoisted_2$5 = ["d"];
|
|
8896
9841
|
const _hoisted_3$3 = { class: "min-w-0 flex-1" };
|
|
8897
9842
|
const _hoisted_4$1 = {
|
|
8898
9843
|
key: 0,
|
|
@@ -8949,7 +9894,7 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
|
8949
9894
|
"stroke-linejoin": "round",
|
|
8950
9895
|
"aria-hidden": "true",
|
|
8951
9896
|
class: normalizeClass(unref(cn)(unref(alertIconVariants)({ variant: props.variant })))
|
|
8952
|
-
}, [createElementVNode("path", { d: iconPath.value }, null, 8, _hoisted_2$
|
|
9897
|
+
}, [createElementVNode("path", { d: iconPath.value }, null, 8, _hoisted_2$5)], 2)) : createCommentVNode("v-if", true)]),
|
|
8953
9898
|
createElementVNode("div", _hoisted_3$3, [props.title || unref(slots).title ? (openBlock(), createElementBlock("div", _hoisted_4$1, [renderSlot(_ctx.$slots, "title", {}, () => [createTextVNode(toDisplayString(props.title), 1)])])) : createCommentVNode("v-if", true), props.description || unref(slots).default ? (openBlock(), createElementBlock("div", {
|
|
8954
9899
|
key: 1,
|
|
8955
9900
|
class: normalizeClass(unref(cn)("text-sm leading-relaxed", (props.title || unref(slots).title) && "text-muted-foreground mt-1"))
|
|
@@ -8961,7 +9906,7 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
|
8961
9906
|
class: "shrink-0 rounded-sm opacity-60 transition-opacity hover:opacity-100 focus-visible:outline-2 focus-visible:outline-ring -m-1 p-1",
|
|
8962
9907
|
onClick: onClose
|
|
8963
9908
|
}, [createVNode(CloseIcon_default, { class: "size-4" })])) : createCommentVNode("v-if", true)])
|
|
8964
|
-
], 10, _hoisted_1$
|
|
9909
|
+
], 10, _hoisted_1$5)) : createCommentVNode("v-if", true);
|
|
8965
9910
|
};
|
|
8966
9911
|
}
|
|
8967
9912
|
});
|
|
@@ -9004,8 +9949,8 @@ const alertIconPaths = {
|
|
|
9004
9949
|
};
|
|
9005
9950
|
//#endregion
|
|
9006
9951
|
//#region src/components/empty/Empty.vue
|
|
9007
|
-
const _hoisted_1$
|
|
9008
|
-
const _hoisted_2$
|
|
9952
|
+
const _hoisted_1$4 = { class: "text-muted-foreground/60 [&_svg]:size-24" };
|
|
9953
|
+
const _hoisted_2$4 = { class: "text-sm text-muted-foreground" };
|
|
9009
9954
|
const _hoisted_3$2 = {
|
|
9010
9955
|
key: 0,
|
|
9011
9956
|
class: "mt-2 flex items-center gap-3"
|
|
@@ -9023,8 +9968,8 @@ const _sfc_main$17 = /*@__PURE__*/ defineComponent({
|
|
|
9023
9968
|
role: "status",
|
|
9024
9969
|
class: normalizeClass(unref(cn)("flex flex-col items-center justify-center gap-3 px-6 py-16 text-center", props.class))
|
|
9025
9970
|
}, [
|
|
9026
|
-
createElementVNode("div", _hoisted_1$
|
|
9027
|
-
createElementVNode("p", _hoisted_2$
|
|
9971
|
+
createElementVNode("div", _hoisted_1$4, [renderSlot(_ctx.$slots, "icon", {}, () => [createCommentVNode(" 内置插画:简洁空盒 "), _cache[0] || (_cache[0] = createStaticVNode("<svg viewBox=\"0 0 96 96\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"><path d=\"M48 18 78 34v28L48 78 18 62V34L48 18Z\" opacity=\"0.55\"></path><path d=\"M18 34l30 16 30-16\" opacity=\"0.55\"></path><path d=\"M48 50v28\" opacity=\"0.55\"></path><path d=\"M48 18l-8 26 8 6 8-6-8-26Z\" fill=\"currentColor\" fill-opacity=\"0.12\" stroke=\"none\"></path><path d=\"M40 44l8 6 8-6\" opacity=\"0.75\"></path></svg>", 1))])]),
|
|
9972
|
+
createElementVNode("p", _hoisted_2$4, toDisplayString(props.description), 1),
|
|
9028
9973
|
_ctx.$slots.default ? (openBlock(), createElementBlock("div", _hoisted_3$2, [renderSlot(_ctx.$slots, "default")])) : createCommentVNode("v-if", true)
|
|
9029
9974
|
], 2);
|
|
9030
9975
|
};
|
|
@@ -9104,8 +10049,8 @@ const _sfc_main$35 = /*@__PURE__*/ defineComponent({
|
|
|
9104
10049
|
});
|
|
9105
10050
|
//#endregion
|
|
9106
10051
|
//#region src/components/spin/Spin.vue
|
|
9107
|
-
const _hoisted_1$
|
|
9108
|
-
const _hoisted_2$
|
|
10052
|
+
const _hoisted_1$3 = ["inert"];
|
|
10053
|
+
const _hoisted_2$3 = ["aria-busy", "aria-label"];
|
|
9109
10054
|
const _sfc_main$41 = /*@__PURE__*/ defineComponent({
|
|
9110
10055
|
__name: "Spin",
|
|
9111
10056
|
props: {
|
|
@@ -9157,7 +10102,7 @@ const _sfc_main$41 = /*@__PURE__*/ defineComponent({
|
|
|
9157
10102
|
stroke: "currentColor",
|
|
9158
10103
|
"stroke-width": "3",
|
|
9159
10104
|
"stroke-linecap": "round"
|
|
9160
|
-
}, null, -1)])], 2))])], 10, _hoisted_2$
|
|
10105
|
+
}, null, -1)])], 2))])], 10, _hoisted_2$3)) : createCommentVNode("v-if", true)], 10, _hoisted_1$3)) : createCommentVNode("v-if", true);
|
|
9161
10106
|
};
|
|
9162
10107
|
}
|
|
9163
10108
|
});
|
|
@@ -9293,7 +10238,7 @@ function useToast() {
|
|
|
9293
10238
|
}
|
|
9294
10239
|
//#endregion
|
|
9295
10240
|
//#region src/components/toast/ToastProvider.vue
|
|
9296
|
-
const _hoisted_1$
|
|
10241
|
+
const _hoisted_1$2 = {
|
|
9297
10242
|
key: 0,
|
|
9298
10243
|
viewBox: "0 0 24 24",
|
|
9299
10244
|
fill: "none",
|
|
@@ -9303,7 +10248,7 @@ const _hoisted_1$3 = {
|
|
|
9303
10248
|
"stroke-linejoin": "round",
|
|
9304
10249
|
class: "size-4"
|
|
9305
10250
|
};
|
|
9306
|
-
const _hoisted_2$
|
|
10251
|
+
const _hoisted_2$2 = {
|
|
9307
10252
|
key: 1,
|
|
9308
10253
|
viewBox: "0 0 24 24",
|
|
9309
10254
|
fill: "none",
|
|
@@ -9396,7 +10341,7 @@ const _sfc_main$48 = /*@__PURE__*/ defineComponent({
|
|
|
9396
10341
|
t.type ? (openBlock(), createElementBlock("span", {
|
|
9397
10342
|
key: 0,
|
|
9398
10343
|
class: normalizeClass(["mt-0.5 shrink-0", { "animate-spin": t.type === "loading" }])
|
|
9399
|
-
}, [renderSlot(_ctx.$slots, "icon", { type: t.type }, () => [t.type === "success" ? (openBlock(), createElementBlock("svg", _hoisted_1$
|
|
10344
|
+
}, [renderSlot(_ctx.$slots, "icon", { type: t.type }, () => [t.type === "success" ? (openBlock(), createElementBlock("svg", _hoisted_1$2, [..._cache[0] || (_cache[0] = [createElementVNode("path", { d: "M21.801 10A10 10 0 1 1 17 3.335" }, null, -1), createElementVNode("path", { d: "m9 11 3 3L22 4" }, null, -1)])])) : t.type === "error" ? (openBlock(), createElementBlock("svg", _hoisted_2$2, [..._cache[1] || (_cache[1] = [
|
|
9400
10345
|
createElementVNode("circle", {
|
|
9401
10346
|
cx: "12",
|
|
9402
10347
|
cy: "12",
|
|
@@ -9446,45 +10391,9 @@ const _sfc_main$48 = /*@__PURE__*/ defineComponent({
|
|
|
9446
10391
|
}
|
|
9447
10392
|
});
|
|
9448
10393
|
//#endregion
|
|
9449
|
-
//#region src/components/overlay-shared/useConfirmPending.ts
|
|
9450
|
-
/**
|
|
9451
|
-
* 确认弹层公共 pending 语义:@confirm 处理器返回 Promise 时锁定关闭通道,
|
|
9452
|
-
* resolve 后自动关闭,reject 保持打开并退出 loading;同步处理器直接关闭。
|
|
9453
|
-
* @param options - pending 配置:组件实例、confirm/cancel 补发与弹层关闭回调
|
|
9454
|
-
* @returns loading(确认进行中标记)、handleConfirm(异步确认处理)与 handleCancel(取消处理)
|
|
9455
|
-
*/
|
|
9456
|
-
function useConfirmPending(options) {
|
|
9457
|
-
const loading = ref(false);
|
|
9458
|
-
function handleConfirm() {
|
|
9459
|
-
if (loading.value) return;
|
|
9460
|
-
const handler = options.instance?.vnode.props?.onConfirm;
|
|
9461
|
-
const result = handler?.();
|
|
9462
|
-
if (!handler) options.emitConfirm();
|
|
9463
|
-
if (result instanceof Promise) {
|
|
9464
|
-
loading.value = true;
|
|
9465
|
-
result.then(() => {
|
|
9466
|
-
loading.value = false;
|
|
9467
|
-
options.close();
|
|
9468
|
-
}).catch(() => {
|
|
9469
|
-
loading.value = false;
|
|
9470
|
-
});
|
|
9471
|
-
} else options.close();
|
|
9472
|
-
}
|
|
9473
|
-
function handleCancel() {
|
|
9474
|
-
if (loading.value) return;
|
|
9475
|
-
options.emitCancel();
|
|
9476
|
-
options.close();
|
|
9477
|
-
}
|
|
9478
|
-
return {
|
|
9479
|
-
loading,
|
|
9480
|
-
handleConfirm,
|
|
9481
|
-
handleCancel
|
|
9482
|
-
};
|
|
9483
|
-
}
|
|
9484
|
-
//#endregion
|
|
9485
10394
|
//#region src/components/alert-dialog/AlertDialog.vue
|
|
9486
|
-
const _hoisted_1$
|
|
9487
|
-
const _hoisted_2$
|
|
10395
|
+
const _hoisted_1$1 = { class: "flex flex-col gap-2 text-center sm:text-left" };
|
|
10396
|
+
const _hoisted_2$1 = { class: "flex flex-col-reverse gap-2 sm:flex-row sm:justify-end" };
|
|
9488
10397
|
const _hoisted_3 = {
|
|
9489
10398
|
key: 0,
|
|
9490
10399
|
viewBox: "0 0 24 24",
|
|
@@ -9568,7 +10477,7 @@ const _sfc_main$1 = /*@__PURE__*/ defineComponent({
|
|
|
9568
10477
|
emitCancel: () => emit("cancel"),
|
|
9569
10478
|
close
|
|
9570
10479
|
});
|
|
9571
|
-
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-
|
|
10480
|
+
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-modal,60)] 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"));
|
|
9572
10481
|
return (_ctx, _cache) => {
|
|
9573
10482
|
return openBlock(), createBlock(unref(Dialog).Root, {
|
|
9574
10483
|
ids: unref(rootIds),
|
|
@@ -9577,14 +10486,14 @@ const _sfc_main$1 = /*@__PURE__*/ defineComponent({
|
|
|
9577
10486
|
"close-on-interact-outside": !unref(loading),
|
|
9578
10487
|
"onUpdate:open": handleUpdate
|
|
9579
10488
|
}, {
|
|
9580
|
-
default: withCtx(() => [createVNode(unref(Dialog).Backdrop, { class: "fixed inset-0 z-[var(--z-
|
|
10489
|
+
default: withCtx(() => [createVNode(unref(Dialog).Backdrop, { class: "fixed inset-0 z-[var(--z-modal,60)] 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-modal,60)] flex items-center justify-center p-4" }, {
|
|
9581
10490
|
default: withCtx(() => [createCommentVNode(" role=\"alertdialog\":覆盖 Ark Content 默认 role=\"dialog\",补偿无上游 AlertDialog 原语的角色语义 "), createVNode(unref(Dialog).Content, {
|
|
9582
10491
|
class: normalizeClass(contentClass.value),
|
|
9583
10492
|
role: "alertdialog",
|
|
9584
10493
|
"aria-modal": "true"
|
|
9585
10494
|
}, {
|
|
9586
10495
|
default: withCtx(() => [
|
|
9587
|
-
createElementVNode("div", _hoisted_1$
|
|
10496
|
+
createElementVNode("div", _hoisted_1$1, [createVNode(unref(Dialog).Title, { class: "text-lg font-semibold leading-none tracking-tight" }, {
|
|
9588
10497
|
default: withCtx(() => [renderSlot(_ctx.$slots, "title", {}, () => [createTextVNode(toDisplayString(props.title), 1)])]),
|
|
9589
10498
|
_: 3
|
|
9590
10499
|
}), _ctx.$slots.description || props.description ? (openBlock(), createBlock(unref(Dialog).Description, {
|
|
@@ -9597,7 +10506,7 @@ const _sfc_main$1 = /*@__PURE__*/ defineComponent({
|
|
|
9597
10506
|
createCommentVNode(" 默认插槽:补充正文(可选) "),
|
|
9598
10507
|
renderSlot(_ctx.$slots, "default"),
|
|
9599
10508
|
createCommentVNode(" 底部操作区:取消 outline,确认按 destructive 切换语义色;pending 时确认钮转 loading "),
|
|
9600
|
-
createElementVNode("div", _hoisted_2$
|
|
10509
|
+
createElementVNode("div", _hoisted_2$1, [createVNode(unref(_sfc_main$5), {
|
|
9601
10510
|
variant: "outline",
|
|
9602
10511
|
disabled: unref(loading),
|
|
9603
10512
|
onClick: unref(handleCancel)
|
|
@@ -9674,7 +10583,7 @@ const _sfc_main$10 = /*@__PURE__*/ defineComponent({
|
|
|
9674
10583
|
}),
|
|
9675
10584
|
createVNode(unref(Menu).Positioner, { class: "z-[var(--z-overlay)]" }, {
|
|
9676
10585
|
default: withCtx(() => [createVNode(unref(Menu).Content, mergeProps(unref(attrs), { class: unref(cn)(contentCls) }), {
|
|
9677
|
-
default: withCtx(() => [createVNode(_sfc_main$
|
|
10586
|
+
default: withCtx(() => [createVNode(_sfc_main$55, { items: props.items }, null, 8, ["items"])]),
|
|
9678
10587
|
_: 1
|
|
9679
10588
|
}, 16, ["class"])]),
|
|
9680
10589
|
_: 1
|
|
@@ -9687,11 +10596,11 @@ const _sfc_main$10 = /*@__PURE__*/ defineComponent({
|
|
|
9687
10596
|
});
|
|
9688
10597
|
//#endregion
|
|
9689
10598
|
//#region src/components/drawer/Drawer.vue
|
|
9690
|
-
const _hoisted_1
|
|
10599
|
+
const _hoisted_1 = {
|
|
9691
10600
|
key: 0,
|
|
9692
10601
|
class: "flex flex-col gap-1.5"
|
|
9693
10602
|
};
|
|
9694
|
-
const _hoisted_2
|
|
10603
|
+
const _hoisted_2 = {
|
|
9695
10604
|
key: 1,
|
|
9696
10605
|
class: "mt-auto flex flex-col-reverse gap-2 pt-2 sm:flex-row sm:justify-end"
|
|
9697
10606
|
};
|
|
@@ -9820,7 +10729,7 @@ const _sfc_main$15 = /*@__PURE__*/ defineComponent({
|
|
|
9820
10729
|
};
|
|
9821
10730
|
const config = computed(() => placementConfig[props.placement]);
|
|
9822
10731
|
const isLateral = computed(() => props.placement === "left" || props.placement === "right");
|
|
9823
|
-
const contentClass = computed(() => cn("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out fixed z-[var(--z-
|
|
10732
|
+
const contentClass = computed(() => cn("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out fixed z-[var(--z-modal,60)] 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]));
|
|
9824
10733
|
return (_ctx, _cache) => {
|
|
9825
10734
|
return openBlock(), createBlock(unref(Drawer).Root, {
|
|
9826
10735
|
ids: unref(rootIds),
|
|
@@ -9837,11 +10746,11 @@ const _sfc_main$15 = /*@__PURE__*/ defineComponent({
|
|
|
9837
10746
|
default: withCtx(() => [renderSlot(_ctx.$slots, "trigger")]),
|
|
9838
10747
|
_: 3
|
|
9839
10748
|
})) : createCommentVNode("v-if", true),
|
|
9840
|
-
createVNode(unref(Drawer).Backdrop, { class: "fixed inset-0 z-[var(--z-
|
|
9841
|
-
createVNode(unref(Drawer).Positioner, { class: normalizeClass(unref(cn)("fixed inset-0 z-[var(--z-
|
|
10749
|
+
createVNode(unref(Drawer).Backdrop, { class: "fixed inset-0 z-[var(--z-modal,60)] 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" }),
|
|
10750
|
+
createVNode(unref(Drawer).Positioner, { class: normalizeClass(unref(cn)("fixed inset-0 z-[var(--z-modal,60)] flex", config.value.positioner)) }, {
|
|
9842
10751
|
default: withCtx(() => [createVNode(unref(Drawer).Content, { class: normalizeClass(contentClass.value) }, {
|
|
9843
10752
|
default: withCtx(() => [
|
|
9844
|
-
hasHeader.value || _ctx.$slots.title || _ctx.$slots.description ? (openBlock(), createElementBlock("div", _hoisted_1
|
|
10753
|
+
hasHeader.value || _ctx.$slots.title || _ctx.$slots.description ? (openBlock(), createElementBlock("div", _hoisted_1, [_ctx.$slots.title || props.title ? (openBlock(), createBlock(unref(Drawer).Title, {
|
|
9845
10754
|
key: 0,
|
|
9846
10755
|
class: "text-lg font-semibold leading-none tracking-tight"
|
|
9847
10756
|
}, {
|
|
@@ -9855,7 +10764,7 @@ const _sfc_main$15 = /*@__PURE__*/ defineComponent({
|
|
|
9855
10764
|
_: 3
|
|
9856
10765
|
})) : createCommentVNode("v-if", true)])) : createCommentVNode("v-if", true),
|
|
9857
10766
|
renderSlot(_ctx.$slots, "default"),
|
|
9858
|
-
_ctx.$slots.footer ? (openBlock(), createElementBlock("div", _hoisted_2
|
|
10767
|
+
_ctx.$slots.footer ? (openBlock(), createElementBlock("div", _hoisted_2, [renderSlot(_ctx.$slots, "footer", { close })])) : createCommentVNode("v-if", true),
|
|
9859
10768
|
props.showCloseButton ? (openBlock(), createBlock(unref(Drawer).CloseTrigger, {
|
|
9860
10769
|
key: 2,
|
|
9861
10770
|
"aria-label": "关闭",
|
|
@@ -9882,135 +10791,6 @@ const _sfc_main$15 = /*@__PURE__*/ defineComponent({
|
|
|
9882
10791
|
}
|
|
9883
10792
|
});
|
|
9884
10793
|
//#endregion
|
|
9885
|
-
//#region src/components/popconfirm/Popconfirm.vue
|
|
9886
|
-
const _hoisted_1 = { class: "mt-3 flex items-center justify-end gap-2" };
|
|
9887
|
-
const _hoisted_2 = {
|
|
9888
|
-
key: 0,
|
|
9889
|
-
viewBox: "0 0 24 24",
|
|
9890
|
-
fill: "none",
|
|
9891
|
-
stroke: "currentColor",
|
|
9892
|
-
"stroke-width": "2",
|
|
9893
|
-
"stroke-linecap": "round",
|
|
9894
|
-
class: "size-4 animate-spin",
|
|
9895
|
-
"aria-hidden": "true"
|
|
9896
|
-
};
|
|
9897
|
-
/**
|
|
9898
|
-
* 气泡确认:Popover 的一体式薄壳变体,面板内容内置 title/description + 确认/取消按钮。
|
|
9899
|
-
* 行为与 M2 AlertDialog 对齐:@confirm 处理器返回 Promise 时确认钮进入 loading 并锁定全部
|
|
9900
|
-
* 关闭通道(ESC/点外部/触发器/取消钮),resolve 后自动关闭、reject 保持打开;
|
|
9901
|
-
* 同步处理器点击确认/取消后自动关闭并派发对应事件。
|
|
9902
|
-
*/
|
|
9903
|
-
const _sfc_main$33 = /*@__PURE__*/ defineComponent({
|
|
9904
|
-
inheritAttrs: false,
|
|
9905
|
-
__name: "Popconfirm",
|
|
9906
|
-
props: {
|
|
9907
|
-
/** 气泡标题(渲染为 Ark Popover.Title,content 自动接线 aria-labelledby) */
|
|
9908
|
-
title: {
|
|
9909
|
-
type: String,
|
|
9910
|
-
required: true
|
|
9911
|
-
},
|
|
9912
|
-
/** 气泡描述(可选,渲染为 Ark Popover.Description,content 自动接线 aria-describedby) */
|
|
9913
|
-
description: {
|
|
9914
|
-
type: String,
|
|
9915
|
-
default: void 0
|
|
9916
|
-
},
|
|
9917
|
-
/** 确认按钮文案 */
|
|
9918
|
-
confirmText: {
|
|
9919
|
-
type: String,
|
|
9920
|
-
default: "确定"
|
|
9921
|
-
},
|
|
9922
|
-
/** 取消按钮文案 */
|
|
9923
|
-
cancelText: {
|
|
9924
|
-
type: String,
|
|
9925
|
-
default: "取消"
|
|
9926
|
-
},
|
|
9927
|
-
/** 确认按钮风格:default 主色 / destructive 危险色 */
|
|
9928
|
-
variant: {
|
|
9929
|
-
type: String,
|
|
9930
|
-
default: "default"
|
|
9931
|
-
},
|
|
9932
|
-
/** 受控开关(配合 v-model:open);不传时为非受控,由内部状态管理 */
|
|
9933
|
-
open: {
|
|
9934
|
-
type: Boolean,
|
|
9935
|
-
default: void 0
|
|
9936
|
-
}
|
|
9937
|
-
},
|
|
9938
|
-
emits: [
|
|
9939
|
-
"update:open",
|
|
9940
|
-
"confirm",
|
|
9941
|
-
"cancel"
|
|
9942
|
-
],
|
|
9943
|
-
setup(__props, { emit: __emit }) {
|
|
9944
|
-
const props = __props;
|
|
9945
|
-
const emit = __emit;
|
|
9946
|
-
const attrs = useAttrs();
|
|
9947
|
-
const instance = getCurrentInstance();
|
|
9948
|
-
const { isOpen, setOpen } = useControlledBoolean({
|
|
9949
|
-
controlled: () => props.open,
|
|
9950
|
-
onChange: (open) => emit("update:open", open)
|
|
9951
|
-
});
|
|
9952
|
-
function handleUpdate(open) {
|
|
9953
|
-
if (!open && loading.value) return;
|
|
9954
|
-
setOpen(open);
|
|
9955
|
-
}
|
|
9956
|
-
/** 关闭气泡:走受控桥把 open 置 false,定位回退/动画由 zag 处理 */
|
|
9957
|
-
function close() {
|
|
9958
|
-
handleUpdate(false);
|
|
9959
|
-
}
|
|
9960
|
-
const { loading, handleConfirm, handleCancel } = useConfirmPending({
|
|
9961
|
-
instance,
|
|
9962
|
-
emitConfirm: () => emit("confirm"),
|
|
9963
|
-
emitCancel: () => emit("cancel"),
|
|
9964
|
-
close
|
|
9965
|
-
});
|
|
9966
|
-
return (_ctx, _cache) => {
|
|
9967
|
-
return openBlock(), createElementBlock(Fragment, null, [createCommentVNode(" 薄壳复用 Popover:触发器 asChild、受控桥、定位与进出场动画均由 Popover 提供 "), createVNode(unref(_sfc_main$34), mergeProps(unref(attrs), {
|
|
9968
|
-
open: unref(isOpen),
|
|
9969
|
-
"content-class": "w-64 p-3",
|
|
9970
|
-
"onUpdate:open": handleUpdate
|
|
9971
|
-
}), {
|
|
9972
|
-
content: withCtx(() => [
|
|
9973
|
-
createVNode(unref(Popover).Title, { class: "text-sm font-medium" }, {
|
|
9974
|
-
default: withCtx(() => [createTextVNode(toDisplayString(props.title), 1)]),
|
|
9975
|
-
_: 1
|
|
9976
|
-
}),
|
|
9977
|
-
props.description ? (openBlock(), createBlock(unref(Popover).Description, {
|
|
9978
|
-
key: 0,
|
|
9979
|
-
class: "mt-1 text-xs text-muted-foreground"
|
|
9980
|
-
}, {
|
|
9981
|
-
default: withCtx(() => [createTextVNode(toDisplayString(props.description), 1)]),
|
|
9982
|
-
_: 1
|
|
9983
|
-
})) : createCommentVNode("v-if", true),
|
|
9984
|
-
createCommentVNode(" 操作区:取消 outline,确认按 variant 切换语义色;pending 时双钮禁用 + 确认钮转 loading "),
|
|
9985
|
-
createElementVNode("div", _hoisted_1, [createVNode(unref(_sfc_main$5), {
|
|
9986
|
-
variant: "outline",
|
|
9987
|
-
size: "sm",
|
|
9988
|
-
disabled: unref(loading),
|
|
9989
|
-
onClick: unref(handleCancel)
|
|
9990
|
-
}, {
|
|
9991
|
-
default: withCtx(() => [createTextVNode(toDisplayString(props.cancelText), 1)]),
|
|
9992
|
-
_: 1
|
|
9993
|
-
}, 8, ["disabled", "onClick"]), createVNode(unref(_sfc_main$5), {
|
|
9994
|
-
variant: props.variant === "destructive" ? "destructive" : "default",
|
|
9995
|
-
size: "sm",
|
|
9996
|
-
disabled: unref(loading),
|
|
9997
|
-
onClick: unref(handleConfirm)
|
|
9998
|
-
}, {
|
|
9999
|
-
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)]),
|
|
10000
|
-
_: 1
|
|
10001
|
-
}, 8, [
|
|
10002
|
-
"variant",
|
|
10003
|
-
"disabled",
|
|
10004
|
-
"onClick"
|
|
10005
|
-
])])
|
|
10006
|
-
]),
|
|
10007
|
-
default: withCtx(() => [renderSlot(_ctx.$slots, "default")]),
|
|
10008
|
-
_: 3
|
|
10009
|
-
}, 16, ["open"])], 2112);
|
|
10010
|
-
};
|
|
10011
|
-
}
|
|
10012
|
-
});
|
|
10013
|
-
//#endregion
|
|
10014
10794
|
//#region src/components/timeline/Timeline.vue
|
|
10015
10795
|
const _sfc_main$47 = /*@__PURE__*/ defineComponent({
|
|
10016
10796
|
__name: "Timeline",
|
|
@@ -10249,4 +11029,4 @@ const timelineDotVariants = cva("relative z-10 mt-1 block shrink-0 rounded-full"
|
|
|
10249
11029
|
}
|
|
10250
11030
|
});
|
|
10251
11031
|
//#endregion
|
|
10252
|
-
export { _sfc_main as Alert, _sfc_main$1 as AlertDialog, _sfc_main$2 as Avatar, _sfc_main$3 as AvatarGroup, _sfc_main$4 as Badge, _sfc_main$5 as Button, CHECKED, COMPONENT_NAMES, _sfc_main$6 as Calendar, _sfc_main$7 as Card, _sfc_main$8 as Cascader, _sfc_main$9 as Checkbox, _sfc_main$10 as ContextMenu, _sfc_main$11 as CurrencyInput, _sfc_main$12 as DatePicker, _sfc_main$13 as DateRangePicker, _sfc_main$14 as Dialog, _sfc_main$15 as Drawer, _sfc_main$16 as DropdownMenu, _sfc_main$17 as Empty, _sfc_main$18 as Form, _sfc_main$19 as FormControl, _sfc_main$20 as FormDescription, _sfc_main$21 as FormField, _sfc_main$22 as FormItem, _sfc_main$23 as FormLabel, _sfc_main$24 as FormMessage, _sfc_main$25 as FormRender, _sfc_main$26 as FormSubscribe, _sfc_main$27 as Input, _sfc_main$28 as Label, MODEL_VALUE, _sfc_main$29 as MonthPicker, _sfc_main$30 as NumberInput, PAGE_TABLE_FILL_KEY, _sfc_main$31 as PasswordInput, _sfc_main$32 as PinInput, _sfc_main$33 as Popconfirm, _sfc_main$34 as Popover, _sfc_main$35 as Progress, _sfc_main$36 as RadioGroup, SLIDER, _sfc_main$37 as Select, _sfc_main$38 as Separator, _sfc_main$39 as Skeleton, _sfc_main$40 as Slider, Slot, _sfc_main$41 as Spin, _sfc_main$42 as Switch, _sfc_main$43 as TablePagination, _sfc_main$44 as TableRender, _sfc_main$45 as Tabs, _sfc_main$46 as Textarea, _sfc_main$47 as Timeline, _sfc_main$48 as ToastProvider, _sfc_main$49 as Tooltip, _sfc_main$50 as TreeSelect, TuDesignResolver, VALUE, _sfc_main$51 as WeekPicker, _sfc_main$52 as YearPicker, alertIconPaths, alertIconVariants, alertVariants, avatarGroupKey, avatarVariants, badgeVariants, bindField, buttonVariants, cardVariants, cn, columnRenders, defineColumns, defineForm, defineTable, formatCurrency, numberOrNull, parseCurrency, timelineDotVariants, timelineItemVariants, timelineVariants, useFormRender, useTableRender, useToast, widgetRenders };
|
|
11032
|
+
export { _sfc_main as Alert, _sfc_main$1 as AlertDialog, _sfc_main$2 as Avatar, _sfc_main$3 as AvatarGroup, _sfc_main$4 as Badge, _sfc_main$5 as Button, CHECKED, COMPONENT_NAMES, _sfc_main$6 as Calendar, _sfc_main$7 as Card, _sfc_main$8 as Cascader, _sfc_main$9 as Checkbox, _sfc_main$10 as ContextMenu, _sfc_main$11 as CurrencyInput, _sfc_main$12 as DatePicker, _sfc_main$13 as DateRangePicker, _sfc_main$14 as Dialog, _sfc_main$15 as Drawer, _sfc_main$16 as DropdownMenu, _sfc_main$17 as Empty, _sfc_main$18 as Form, _sfc_main$19 as FormControl, _sfc_main$20 as FormDescription, _sfc_main$21 as FormField, _sfc_main$22 as FormItem, _sfc_main$23 as FormLabel, _sfc_main$24 as FormMessage, _sfc_main$25 as FormRender, _sfc_main$26 as FormSubscribe, _sfc_main$27 as Input, _sfc_main$28 as Label, MODEL_VALUE, _sfc_main$29 as MonthPicker, _sfc_main$30 as NumberInput, PAGE_TABLE_FILL_KEY, _sfc_main$31 as PasswordInput, _sfc_main$32 as PinInput, _sfc_main$33 as Popconfirm, _sfc_main$34 as Popover, _sfc_main$35 as Progress, _sfc_main$36 as RadioGroup, SLIDER, _sfc_main$37 as Select, _sfc_main$38 as Separator, _sfc_main$39 as Skeleton, _sfc_main$40 as Slider, Slot, _sfc_main$41 as Spin, _sfc_main$42 as Switch, _sfc_main$43 as TablePagination, _sfc_main$44 as TableRender, _sfc_main$45 as Tabs, _sfc_main$46 as Textarea, _sfc_main$47 as Timeline, _sfc_main$48 as ToastProvider, _sfc_main$49 as Tooltip, _sfc_main$50 as TreeSelect, TuDesignResolver, VALUE, _sfc_main$51 as WeekPicker, _sfc_main$52 as YearPicker, alertIconPaths, alertIconVariants, alertVariants, avatarGroupKey, avatarVariants, badgeVariants, bindField, buttonVariants, cardVariants, cn, columnRenders, defineColumns, defineForm, defineTable, flattenColumns, formatCurrency, isColumnGroup, numberOrNull, parseCurrency, timelineDotVariants, timelineItemVariants, timelineVariants, useFormRender, useTableRender, useToast, widgetRenders };
|