@tu-design/vue 0.5.13 → 0.5.15
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 +100 -45
- package/dist/index.mjs +151 -41
- 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 +1 -1
- package/dist/registry/vue/checkbox.json +1 -1
- 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 +1 -1
- package/dist/registry/vue/date-shared.json +1 -1
- package/dist/registry/vue/dialog.json +2 -2
- package/dist/registry/vue/drawer.json +1 -1
- package/dist/registry/vue/dropdown-menu.json +1 -1
- package/dist/registry/vue/empty.json +1 -1
- package/dist/registry/vue/form-render.json +1 -1
- package/dist/registry/vue/form.json +1 -1
- package/dist/registry/vue/icon-shared.json +1 -1
- package/dist/registry/vue/input.json +1 -1
- 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 +1 -1
- package/dist/registry/vue/progress.json +1 -1
- package/dist/registry/vue/provider.json +1 -1
- package/dist/registry/vue/radio-group.json +1 -1
- package/dist/registry/vue/registry.json +53 -53
- 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 +5 -5
- package/dist/registry/vue/tabs.json +1 -1
- package/dist/registry/vue/textarea.json +1 -1
- package/dist/registry/vue/timeline.json +1 -1
- package/dist/registry/vue/toast.json +2 -2
- package/dist/registry/vue/tokens.json +1 -1
- package/dist/registry/vue/tooltip.json +1 -1
- package/dist/registry/vue/tree-select.json +1 -1
- 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/dist/style.css +21 -0
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -6353,7 +6353,7 @@ const _sfc_main$14 = /*@__PURE__*/ defineComponent({
|
|
|
6353
6353
|
}
|
|
6354
6354
|
const hasHeader = computed(() => Boolean(props.title || props.description));
|
|
6355
6355
|
const preventScroll = overlayPreventScroll();
|
|
6356
|
-
const contentClass = computed(() => cn("bg-dialog text-dialog-foreground 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));
|
|
6356
|
+
const contentClass = computed(() => cn("bg-dialog text-dialog-foreground 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]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-top-2 data-[state=open]:slide-in-from-top-2 data-[state=closed]:ease-in data-[state=open]:ease-out sm:max-w-lg", props.contentClass));
|
|
6357
6357
|
return (_ctx, _cache) => {
|
|
6358
6358
|
return openBlock(), createBlock(unref(Dialog).Root, {
|
|
6359
6359
|
ids: unref(rootIds),
|
|
@@ -6372,7 +6372,7 @@ const _sfc_main$14 = /*@__PURE__*/ defineComponent({
|
|
|
6372
6372
|
default: withCtx(() => [renderSlot(_ctx.$slots, "trigger")]),
|
|
6373
6373
|
_: 3
|
|
6374
6374
|
})) : createCommentVNode("v-if", true),
|
|
6375
|
-
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" }),
|
|
6375
|
+
createVNode(unref(Dialog).Backdrop, { class: "fixed inset-0 z-[var(--z-modal,60)] bg-black/50 duration-200 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]:ease-in data-[state=open]:ease-out" }),
|
|
6376
6376
|
createVNode(unref(Dialog).Positioner, { class: "fixed inset-0 z-[var(--z-modal,60)] flex items-center justify-center p-4" }, {
|
|
6377
6377
|
default: withCtx(() => [createVNode(unref(Dialog).Content, { class: normalizeClass(contentClass.value) }, {
|
|
6378
6378
|
default: withCtx(() => [
|
|
@@ -7092,7 +7092,7 @@ const _sfc_main$43 = /*@__PURE__*/ defineComponent({
|
|
|
7092
7092
|
return items;
|
|
7093
7093
|
});
|
|
7094
7094
|
return (_ctx, _cache) => {
|
|
7095
|
-
return openBlock(), createElementBlock(Fragment, null, [createCommentVNode(" 不带 border-t
|
|
7095
|
+
return openBlock(), createElementBlock(Fragment, null, [createCommentVNode(" 不带 border-t(布局归使用方;表格与分页条之间的分隔线由表格底线承担:bordered 外框 / bottom-bordered);左区缺省时页码靠右 "), visible.value ? (openBlock(), createElementBlock("div", {
|
|
7096
7096
|
key: 0,
|
|
7097
7097
|
class: normalizeClass(unref(cn)("flex w-full items-center gap-4 p-2 text-sm", hasLeft.value ? "justify-between" : "justify-end", _ctx.$attrs.class))
|
|
7098
7098
|
}, [
|
|
@@ -7728,15 +7728,16 @@ function stickyStyle(sticky, key, head = false) {
|
|
|
7728
7728
|
* sticky 底色(防滚动透出)与交界分隔边框
|
|
7729
7729
|
* @param sticky - 列 key → sticky 信息的映射
|
|
7730
7730
|
* @param key - 列 key
|
|
7731
|
+
* @param opts - 行为开关:columnLines 抑制交界边框(统一列线接管);striped 输出不透明条纹固色
|
|
7731
7732
|
* @returns class 列表(未命中项为空串);列非 sticky 时返回 undefined
|
|
7732
7733
|
*/
|
|
7733
|
-
function stickyClass(sticky, key) {
|
|
7734
|
+
function stickyClass(sticky, key, opts = {}) {
|
|
7734
7735
|
const info = sticky.get(key);
|
|
7735
7736
|
if (!info) return void 0;
|
|
7736
7737
|
return [
|
|
7737
|
-
"bg-background",
|
|
7738
|
-
info.side === "left" && info.edge ? "border-r border-border" : "",
|
|
7739
|
-
info.side === "right" && info.edge ? "border-l border-border" : ""
|
|
7738
|
+
opts.striped ? "bg-[color-mix(in_oklab,var(--color-muted)_30%,var(--color-background))]" : "bg-background",
|
|
7739
|
+
!opts.columnLines && info.side === "left" && info.edge ? "border-r border-border" : "",
|
|
7740
|
+
!opts.columnLines && info.side === "right" && info.edge ? "border-l border-border" : ""
|
|
7740
7741
|
];
|
|
7741
7742
|
}
|
|
7742
7743
|
// src/components/icon-shared/GripIcon.vue
|
|
@@ -7816,6 +7817,21 @@ const _sfc_main$54 = /*@__PURE__*/ defineComponent({
|
|
|
7816
7817
|
dragging: {
|
|
7817
7818
|
type: Boolean,
|
|
7818
7819
|
default: false
|
|
7820
|
+
},
|
|
7821
|
+
/** 行分割线开关(single-column 关闭):td 的 border-b(末行由 tbody 选择器置 0) */
|
|
7822
|
+
rowLines: {
|
|
7823
|
+
type: Boolean,
|
|
7824
|
+
default: true
|
|
7825
|
+
},
|
|
7826
|
+
/** 列分割线开关(single-line: false 开启):非行末 td 的 border-r(选择/把手列恒非行末) */
|
|
7827
|
+
columnLines: {
|
|
7828
|
+
type: Boolean,
|
|
7829
|
+
default: false
|
|
7830
|
+
},
|
|
7831
|
+
/** 斑马纹开关(父层传入;奇偶按行模型索引在内部收敛,供 sticky 单元格换不透明固色) */
|
|
7832
|
+
striped: {
|
|
7833
|
+
type: Boolean,
|
|
7834
|
+
default: false
|
|
7819
7835
|
}
|
|
7820
7836
|
},
|
|
7821
7837
|
emits: [
|
|
@@ -7836,6 +7852,11 @@ const _sfc_main$54 = /*@__PURE__*/ defineComponent({
|
|
|
7836
7852
|
const value = line.cells[index];
|
|
7837
7853
|
return isVNode(value) ? "" : String(value ?? "");
|
|
7838
7854
|
}
|
|
7855
|
+
/** stickyClass 行为开关:列线抑制 + 奇数条纹固色(与父层 tr 条纹同一奇偶口径,行模型索引) */
|
|
7856
|
+
const stickyOpts = computed(() => ({
|
|
7857
|
+
columnLines: props.columnLines,
|
|
7858
|
+
striped: props.striped && props.line.index % 2 === 1
|
|
7859
|
+
}));
|
|
7839
7860
|
/**
|
|
7840
7861
|
* ellipsis: "tooltip" 的单元格内容:默认插槽承载截断内容(触发元素本体,不额外包裹),content 显示完整文本。
|
|
7841
7862
|
* VNode(render 工厂)单元格经 cloneVNode 复制进触发位(VNode 不可二次挂载)。
|
|
@@ -7852,7 +7873,7 @@ const _sfc_main$54 = /*@__PURE__*/ defineComponent({
|
|
|
7852
7873
|
}
|
|
7853
7874
|
return (_ctx, _cache) => {
|
|
7854
7875
|
return openBlock(), createElementBlock("tr", {
|
|
7855
|
-
class: normalizeClass(["
|
|
7876
|
+
class: normalizeClass(["transition-colors hover:bg-muted/50", { "opacity-50 [&>td]:outline-2 [&>td]:outline-dashed [&>td]:-outline-offset-2 [&>td]:outline-primary/40": props.dragging }]),
|
|
7856
7877
|
onClick: _cache[7] || (_cache[7] = ($event) => emit("row-click", $event)),
|
|
7857
7878
|
onDblclick: _cache[8] || (_cache[8] = ($event) => emit("row-dblclick", $event)),
|
|
7858
7879
|
onContextmenu: _cache[9] || (_cache[9] = ($event) => emit("row-contextmenu", $event)),
|
|
@@ -7862,7 +7883,11 @@ const _sfc_main$54 = /*@__PURE__*/ defineComponent({
|
|
|
7862
7883
|
createCommentVNode(" 选择单元格:阻断冒泡避免触发行 row-click;radio 为原生控件 "),
|
|
7863
7884
|
props.selection ? (openBlock(), createElementBlock("td", {
|
|
7864
7885
|
key: 0,
|
|
7865
|
-
class: normalizeClass(["w-12 p-2 text-center align-middle",
|
|
7886
|
+
class: normalizeClass(["w-12 p-2 text-center align-middle", [
|
|
7887
|
+
props.rowLines ? "border-b border-border" : "",
|
|
7888
|
+
props.columnLines ? "border-r border-border" : "",
|
|
7889
|
+
unref(stickyClass)(props.sticky, unref(SELECTION_CELL), stickyOpts.value)
|
|
7890
|
+
]]),
|
|
7866
7891
|
style: normalizeStyle(unref(stickyStyle)(props.sticky, unref(SELECTION_CELL), false)),
|
|
7867
7892
|
onClick: _cache[2] || (_cache[2] = withModifiers(() => {}, ["stop"]))
|
|
7868
7893
|
}, [props.selection === "radio" ? (openBlock(), createElementBlock("input", {
|
|
@@ -7887,7 +7912,11 @@ const _sfc_main$54 = /*@__PURE__*/ defineComponent({
|
|
|
7887
7912
|
createCommentVNode(" 拖拽把手单元格:仅把手可起拖(draggable 在按钮上,整行不可拖);阻断冒泡避免触发行 row-click "),
|
|
7888
7913
|
props.dragColumn ? (openBlock(), createElementBlock("td", {
|
|
7889
7914
|
key: 1,
|
|
7890
|
-
class: normalizeClass(["p-1 text-center align-middle",
|
|
7915
|
+
class: normalizeClass(["p-1 text-center align-middle", [
|
|
7916
|
+
props.rowLines ? "border-b border-border" : "",
|
|
7917
|
+
props.columnLines ? "border-r border-border" : "",
|
|
7918
|
+
unref(stickyClass)(props.sticky, unref(DRAG_CELL), stickyOpts.value)
|
|
7919
|
+
]]),
|
|
7891
7920
|
style: normalizeStyle(unref(stickyStyle)(props.sticky, unref(DRAG_CELL), false)),
|
|
7892
7921
|
onClick: _cache[5] || (_cache[5] = withModifiers(() => {}, ["stop"]))
|
|
7893
7922
|
}, [createElementVNode("button", {
|
|
@@ -7903,7 +7932,12 @@ const _sfc_main$54 = /*@__PURE__*/ defineComponent({
|
|
|
7903
7932
|
(openBlock(true), createElementBlock(Fragment, null, renderList(props.line.cells, (value, index) => {
|
|
7904
7933
|
return openBlock(), createElementBlock("td", {
|
|
7905
7934
|
key: props.columns[index].key,
|
|
7906
|
-
class: normalizeClass(["p-2 align-middle", [
|
|
7935
|
+
class: normalizeClass(["p-2 align-middle", [
|
|
7936
|
+
props.rowLines ? "border-b border-border" : "",
|
|
7937
|
+
props.columnLines && index < props.line.cells.length - 1 ? "border-r border-border" : "",
|
|
7938
|
+
unref(stickyClass)(props.sticky, props.columns[index].key, stickyOpts.value),
|
|
7939
|
+
{ truncate: props.columns[index].ellipsis === true }
|
|
7940
|
+
]]),
|
|
7907
7941
|
title: props.columns[index].ellipsis === true ? cellText(props.line, index) : void 0,
|
|
7908
7942
|
style: normalizeStyle([{ textAlign: props.columns[index].align ?? "center" }, unref(stickyStyle)(props.sticky, props.columns[index].key, false)]),
|
|
7909
7943
|
onClick: ($event) => emit("cell-click", props.columns[index].key, $event)
|
|
@@ -8552,7 +8586,7 @@ const _hoisted_11 = {
|
|
|
8552
8586
|
"aria-hidden": "true",
|
|
8553
8587
|
class: "text-xs"
|
|
8554
8588
|
};
|
|
8555
|
-
const _hoisted_12 = { class: "[
|
|
8589
|
+
const _hoisted_12 = { class: "[&>tr:last-child>td]:border-b-0" };
|
|
8556
8590
|
const _hoisted_13 = { "data-error": "" };
|
|
8557
8591
|
const _hoisted_14 = ["colspan"];
|
|
8558
8592
|
const _hoisted_15 = { class: "flex flex-col items-center gap-3" };
|
|
@@ -8564,6 +8598,11 @@ const _hoisted_18 = {
|
|
|
8564
8598
|
};
|
|
8565
8599
|
const _hoisted_19 = ["colspan"];
|
|
8566
8600
|
/** 面板行派生:以原始列节点树(非可见剪枝)为准,保证隐藏后仍可恢复 */
|
|
8601
|
+
const theadLineClass = "border-b border-border";
|
|
8602
|
+
/** sticky 态 table 改分离边框:preflight 为 border-collapse: collapse,
|
|
8603
|
+
* 折叠边框几何归属 table,Chrome 下 sticky th 粘住后自身 border-b 渲染丢失;
|
|
8604
|
+
* separate + spacing-0 恢复单元格边框。普通模式保持 collapse,零回归。
|
|
8605
|
+
* 外框(bordered)与底线(非 bordered 且 bottom-bordered)画在 table 元素,两种边框模型均渲染。 */
|
|
8567
8606
|
const HEADER_ROW_FALLBACK = 40;
|
|
8568
8607
|
/**
|
|
8569
8608
|
* 测量所有表头行高度并派生行顶偏移与 thead 总高(唯一测量源)。
|
|
@@ -8652,6 +8691,31 @@ const _sfc_main$44 = /*@__PURE__*/ defineComponent({
|
|
|
8652
8691
|
fillHeight: {
|
|
8653
8692
|
type: Boolean,
|
|
8654
8693
|
default: void 0
|
|
8694
|
+
},
|
|
8695
|
+
/** 是否显示表格边框(仅外框);网格线由 single-column / single-line 独立控制(正交模型,词汇对齐 naive-ui) */
|
|
8696
|
+
bordered: {
|
|
8697
|
+
type: Boolean,
|
|
8698
|
+
default: void 0
|
|
8699
|
+
},
|
|
8700
|
+
/** 表格底部是否有边框;bordered: true 时外框已含底边,此参数冗余无害 */
|
|
8701
|
+
bottomBordered: {
|
|
8702
|
+
type: Boolean,
|
|
8703
|
+
default: void 0
|
|
8704
|
+
},
|
|
8705
|
+
/** 是否不设定行的分割线;true 时单元格没有下边线 */
|
|
8706
|
+
singleColumn: {
|
|
8707
|
+
type: Boolean,
|
|
8708
|
+
default: void 0
|
|
8709
|
+
},
|
|
8710
|
+
/** 是否不设定列的分割线;true 时单元格没有右边线 */
|
|
8711
|
+
singleLine: {
|
|
8712
|
+
type: Boolean,
|
|
8713
|
+
default: void 0
|
|
8714
|
+
},
|
|
8715
|
+
/** 斑马线条纹(按行模型索引奇偶,虚拟滚动窗口安全);纯样式属性,setup 期定版不支持运行时切换 */
|
|
8716
|
+
striped: {
|
|
8717
|
+
type: Boolean,
|
|
8718
|
+
default: void 0
|
|
8655
8719
|
}
|
|
8656
8720
|
},
|
|
8657
8721
|
emits: [
|
|
@@ -9035,18 +9099,16 @@ const _sfc_main$44 = /*@__PURE__*/ defineComponent({
|
|
|
9035
9099
|
return { top: `${rowTop.value[rowIndex] ?? rowIndex * HEADER_ROW_FALLBACK}px` };
|
|
9036
9100
|
}
|
|
9037
9101
|
/**
|
|
9038
|
-
*
|
|
9039
|
-
*
|
|
9040
|
-
*
|
|
9041
|
-
* sticky 走 `theadThClass` 的 `border-b`),此处**不重复绘制**;
|
|
9042
|
-
* 单级表头(无分组)直接返回空,保证扁平列 DOM 零变化。
|
|
9102
|
+
* 表头列线:分组格分隔线是结构性硬边界(多行表头分组界恒画,不受列线开关影响);
|
|
9103
|
+
* 叶子格受列线开关控制(single-line: false 时开启)。行末排除,右缘归外框。
|
|
9104
|
+
* 横向底线不在此绘制(恒挂 theadLineClass 承担,thead 行级 border 已退役)。
|
|
9043
9105
|
* @param cell - 表头单元格
|
|
9044
9106
|
* @param isLastInRow - 是否为本行最后一个单元格
|
|
9045
9107
|
* @returns class 列表
|
|
9046
9108
|
*/
|
|
9047
9109
|
function headerCellClass(cell, isLastInRow) {
|
|
9048
|
-
if (
|
|
9049
|
-
return
|
|
9110
|
+
if (cell.isGroup) return isLastInRow ? [] : ["border-r border-border"];
|
|
9111
|
+
return columnLinesOn && !isLastInRow ? ["border-r border-border"] : [];
|
|
9050
9112
|
}
|
|
9051
9113
|
/**
|
|
9052
9114
|
* 分组单元格水平对齐(分组无 align 以外的能力)
|
|
@@ -9233,14 +9295,28 @@ const _sfc_main$44 = /*@__PURE__*/ defineComponent({
|
|
|
9233
9295
|
overflowY: "auto"
|
|
9234
9296
|
};
|
|
9235
9297
|
});
|
|
9298
|
+
const bordered = props.bordered ?? true;
|
|
9299
|
+
const bottomBordered = props.bottomBordered ?? true;
|
|
9300
|
+
const singleColumn = props.singleColumn ?? false;
|
|
9301
|
+
const singleLine = props.singleLine ?? true;
|
|
9302
|
+
const striped = props.striped ?? false;
|
|
9303
|
+
/** 行分割线开关(single-column 关闭) */
|
|
9304
|
+
const rowLinesOn = !singleColumn;
|
|
9305
|
+
/** 列分割线开关(single-line 关闭;bordered 不隐含列线,全网格 = :single-line="false") */
|
|
9306
|
+
const columnLinesOn = !singleLine;
|
|
9307
|
+
/** 表头/骨架 stickyClass 开关:仅列线抑制(条纹语义仅在表体行,按行奇偶在 TableBodyRow 收敛) */
|
|
9308
|
+
const stickyOpts = { columnLines: columnLinesOn };
|
|
9236
9309
|
/** sticky 表头普通列类:不透明底防行内容透出;分隔线归 th(thead 行级 border 会随行滚走);
|
|
9237
9310
|
* z-20 高于表体 fixed 列(--z-sticky: 10),纵向滚动行滑过表头时不穿透;
|
|
9238
9311
|
* 表头 fixed 列的 z 由 stickyStyle inline style(var(--z-sticky-head))提供,inline 优先级天然覆盖此处 class */
|
|
9239
|
-
const theadThClass = theadSticky ? "sticky top-0 z-20
|
|
9240
|
-
/**
|
|
9241
|
-
*
|
|
9242
|
-
|
|
9243
|
-
|
|
9312
|
+
const theadThClass = theadSticky ? "sticky top-0 z-20 bg-background" : "";
|
|
9313
|
+
/** 表头底线恒挂 th:两种边框模型均渲染(thead 行级 border 已退役);不受任何开关作用——
|
|
9314
|
+
* 表头/表体分隔线是可读性硬底线,与行分割线(single-column)语义无关 */
|
|
9315
|
+
const tableClass = [
|
|
9316
|
+
theadSticky ? "border-separate border-spacing-0" : "",
|
|
9317
|
+
bordered ? "border border-border" : "",
|
|
9318
|
+
!bordered && bottomBordered ? "border-b border-border" : ""
|
|
9319
|
+
];
|
|
9244
9320
|
const scrollEl = ref(null);
|
|
9245
9321
|
const theadEl = ref(null);
|
|
9246
9322
|
/** 滚动容器内 thead 占据的前缀高度(scrollMargin);表头内容静态,挂载后测量一次 */
|
|
@@ -9465,12 +9541,11 @@ const _sfc_main$44 = /*@__PURE__*/ defineComponent({
|
|
|
9465
9541
|
class: normalizeClass(unref(cn)("overflow-x-auto", unref(fill) && "min-h-0 flex-1 overflow-y-auto")),
|
|
9466
9542
|
style: normalizeStyle(scrollStyle.value)
|
|
9467
9543
|
}, [createElementVNode("table", {
|
|
9468
|
-
class: normalizeClass(["w-full caption-bottom text-sm",
|
|
9544
|
+
class: normalizeClass(["w-full caption-bottom text-sm", tableClass]),
|
|
9469
9545
|
style: normalizeStyle(tableMinWidth.value > 0 ? { minWidth: `${tableMinWidth.value}px` } : void 0)
|
|
9470
9546
|
}, [createElementVNode("thead", {
|
|
9471
9547
|
ref_key: "theadEl",
|
|
9472
|
-
ref: theadEl
|
|
9473
|
-
class: normalizeClass(unref(theadSticky) ? void 0 : "[&_tr]:border-b")
|
|
9548
|
+
ref: theadEl
|
|
9474
9549
|
}, [(openBlock(true), createElementBlock(Fragment, null, renderList(headerRows.value, (cells, rowIndex) => {
|
|
9475
9550
|
return openBlock(), createElementBlock("tr", {
|
|
9476
9551
|
key: rowIndex,
|
|
@@ -9483,7 +9558,12 @@ const _sfc_main$44 = /*@__PURE__*/ defineComponent({
|
|
|
9483
9558
|
key: 0,
|
|
9484
9559
|
scope: "col",
|
|
9485
9560
|
rowspan: headerRows.value.length,
|
|
9486
|
-
class: normalizeClass(["h-10 w-12 px-2 text-center align-middle font-medium text-muted-foreground", [
|
|
9561
|
+
class: normalizeClass(["h-10 w-12 px-2 text-center align-middle font-medium text-muted-foreground", [
|
|
9562
|
+
unref(stickyClass)(stickyOf.value, unref(SELECTION_CELL), stickyOpts),
|
|
9563
|
+
unref(theadThClass),
|
|
9564
|
+
theadLineClass,
|
|
9565
|
+
columnLinesOn ? "border-r border-border" : ""
|
|
9566
|
+
]]),
|
|
9487
9567
|
style: normalizeStyle([{ width: `${selection.value.width}px` }, unref(stickyStyle)(stickyOf.value, unref(SELECTION_CELL), true)])
|
|
9488
9568
|
}, [selection.value.type === "checkbox" ? (openBlock(), createBlock(unref(_sfc_main$9), {
|
|
9489
9569
|
key: 0,
|
|
@@ -9496,7 +9576,12 @@ const _sfc_main$44 = /*@__PURE__*/ defineComponent({
|
|
|
9496
9576
|
key: 1,
|
|
9497
9577
|
scope: "col",
|
|
9498
9578
|
rowspan: headerRows.value.length,
|
|
9499
|
-
class: normalizeClass(["h-10 px-1 text-center align-middle font-medium text-muted-foreground", [
|
|
9579
|
+
class: normalizeClass(["h-10 px-1 text-center align-middle font-medium text-muted-foreground", [
|
|
9580
|
+
unref(stickyClass)(stickyOf.value, unref(DRAG_CELL), stickyOpts),
|
|
9581
|
+
unref(theadThClass),
|
|
9582
|
+
theadLineClass,
|
|
9583
|
+
columnLinesOn ? "border-r border-border" : ""
|
|
9584
|
+
]]),
|
|
9500
9585
|
style: normalizeStyle([{ width: `${unref(dragWidth)}px` }, unref(stickyStyle)(stickyOf.value, unref(DRAG_CELL), true)])
|
|
9501
9586
|
}, [..._cache[7] || (_cache[7] = [createElementVNode("span", { class: "sr-only" }, "拖拽排序", -1)])], 14, _hoisted_8)) : createCommentVNode("v-if", true),
|
|
9502
9587
|
(openBlock(true), createElementBlock(Fragment, null, renderList(cells, (cell, cellIndex) => {
|
|
@@ -9506,8 +9591,9 @@ const _sfc_main$44 = /*@__PURE__*/ defineComponent({
|
|
|
9506
9591
|
colspan: cell.colSpan > 1 ? cell.colSpan : void 0,
|
|
9507
9592
|
rowspan: cell.rowSpan > 1 ? cell.rowSpan : void 0,
|
|
9508
9593
|
class: normalizeClass(["h-10 px-2 align-middle font-medium text-muted-foreground", [
|
|
9509
|
-
cell.isGroup ? void 0 : unref(stickyClass)(stickyOf.value, cell.key),
|
|
9594
|
+
cell.isGroup ? void 0 : unref(stickyClass)(stickyOf.value, cell.key, stickyOpts),
|
|
9510
9595
|
unref(theadThClass),
|
|
9596
|
+
theadLineClass,
|
|
9511
9597
|
headerCellClass(cell, cellIndex === cells.length - 1)
|
|
9512
9598
|
]]),
|
|
9513
9599
|
style: normalizeStyle([cell.isGroup ? { textAlign: headerCellAlign(cell) } : {
|
|
@@ -9523,7 +9609,7 @@ const _sfc_main$44 = /*@__PURE__*/ defineComponent({
|
|
|
9523
9609
|
}, [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);
|
|
9524
9610
|
}), 128))
|
|
9525
9611
|
], 4);
|
|
9526
|
-
}), 128))],
|
|
9612
|
+
}), 128))], 512), createElementVNode("tbody", _hoisted_12, [
|
|
9527
9613
|
createCommentVNode(" 加载态:固定 5 行骨架;选择列一并占位;骨架不虚拟化;loading 判定优先 "),
|
|
9528
9614
|
loading.value ? (openBlock(), createElementBlock(Fragment, { key: 0 }, renderList(SKELETON_ROWS, (row) => {
|
|
9529
9615
|
return createElementVNode("tr", {
|
|
@@ -9532,18 +9618,30 @@ const _sfc_main$44 = /*@__PURE__*/ defineComponent({
|
|
|
9532
9618
|
}, [
|
|
9533
9619
|
hasSelection.value ? (openBlock(), createElementBlock("td", {
|
|
9534
9620
|
key: 0,
|
|
9535
|
-
class: normalizeClass(["p-2 text-center align-middle",
|
|
9621
|
+
class: normalizeClass(["p-2 text-center align-middle", [
|
|
9622
|
+
rowLinesOn ? "border-b border-border" : "",
|
|
9623
|
+
columnLinesOn ? "border-r border-border" : "",
|
|
9624
|
+
unref(stickyClass)(stickyOf.value, unref(SELECTION_CELL), stickyOpts)
|
|
9625
|
+
]]),
|
|
9536
9626
|
style: normalizeStyle(unref(stickyStyle)(stickyOf.value, unref(SELECTION_CELL), false))
|
|
9537
9627
|
}, [createVNode(unref(_sfc_main$39), { class: "size-4" })], 6)) : createCommentVNode("v-if", true),
|
|
9538
9628
|
dragEnabled.value ? (openBlock(), createElementBlock("td", {
|
|
9539
9629
|
key: 1,
|
|
9540
|
-
class: normalizeClass(["p-1 text-center align-middle",
|
|
9630
|
+
class: normalizeClass(["p-1 text-center align-middle", [
|
|
9631
|
+
rowLinesOn ? "border-b border-border" : "",
|
|
9632
|
+
columnLinesOn ? "border-r border-border" : "",
|
|
9633
|
+
unref(stickyClass)(stickyOf.value, unref(DRAG_CELL), stickyOpts)
|
|
9634
|
+
]]),
|
|
9541
9635
|
style: normalizeStyle(unref(stickyStyle)(stickyOf.value, unref(DRAG_CELL), false))
|
|
9542
9636
|
}, [createVNode(unref(_sfc_main$39), { class: "size-4" })], 6)) : createCommentVNode("v-if", true),
|
|
9543
|
-
(openBlock(true), createElementBlock(Fragment, null, renderList(visibleColumns.value, (column) => {
|
|
9637
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(visibleColumns.value, (column, colIndex) => {
|
|
9544
9638
|
return openBlock(), createElementBlock("td", {
|
|
9545
9639
|
key: column.key,
|
|
9546
|
-
class: normalizeClass(["p-2 align-middle",
|
|
9640
|
+
class: normalizeClass(["p-2 align-middle", [
|
|
9641
|
+
rowLinesOn ? "border-b border-border" : "",
|
|
9642
|
+
columnLinesOn && colIndex < visibleColumns.value.length - 1 ? "border-r border-border" : "",
|
|
9643
|
+
unref(stickyClass)(stickyOf.value, column.key, stickyOpts)
|
|
9644
|
+
]]),
|
|
9547
9645
|
style: normalizeStyle([{ textAlign: column.align ?? "center" }, unref(stickyStyle)(stickyOf.value, column.key, false)])
|
|
9548
9646
|
}, [createVNode(unref(_sfc_main$39), { class: "h-4 w-full" })], 6);
|
|
9549
9647
|
}), 128))
|
|
@@ -9578,6 +9676,10 @@ const _sfc_main$44 = /*@__PURE__*/ defineComponent({
|
|
|
9578
9676
|
ref: measureRow,
|
|
9579
9677
|
"data-index": item.row.index,
|
|
9580
9678
|
line: item.line,
|
|
9679
|
+
class: normalizeClass(unref(striped) && item.line.index % 2 === 1 ? "bg-muted/30" : void 0),
|
|
9680
|
+
"row-lines": rowLinesOn,
|
|
9681
|
+
"column-lines": columnLinesOn,
|
|
9682
|
+
striped: unref(striped),
|
|
9581
9683
|
columns: visibleColumns.value,
|
|
9582
9684
|
selection: hasSelection.value ? selection.value.type : void 0,
|
|
9583
9685
|
selected: unref(selectedKeys).has(item.line.key),
|
|
@@ -9598,6 +9700,8 @@ const _sfc_main$44 = /*@__PURE__*/ defineComponent({
|
|
|
9598
9700
|
}, null, 8, [
|
|
9599
9701
|
"data-index",
|
|
9600
9702
|
"line",
|
|
9703
|
+
"class",
|
|
9704
|
+
"striped",
|
|
9601
9705
|
"columns",
|
|
9602
9706
|
"selection",
|
|
9603
9707
|
"selected",
|
|
@@ -9628,6 +9732,10 @@ const _sfc_main$44 = /*@__PURE__*/ defineComponent({
|
|
|
9628
9732
|
return openBlock(), createBlock(_sfc_main$54, {
|
|
9629
9733
|
key: line.key,
|
|
9630
9734
|
line,
|
|
9735
|
+
class: normalizeClass(unref(striped) && line.index % 2 === 1 ? "bg-muted/30" : void 0),
|
|
9736
|
+
"row-lines": rowLinesOn,
|
|
9737
|
+
"column-lines": columnLinesOn,
|
|
9738
|
+
striped: unref(striped),
|
|
9631
9739
|
columns: visibleColumns.value,
|
|
9632
9740
|
selection: hasSelection.value ? selection.value.type : void 0,
|
|
9633
9741
|
selected: unref(selectedKeys).has(line.key),
|
|
@@ -9647,6 +9755,8 @@ const _sfc_main$44 = /*@__PURE__*/ defineComponent({
|
|
|
9647
9755
|
onDragEnd: _cache[4] || (_cache[4] = ($event) => onRowDragEnd())
|
|
9648
9756
|
}, null, 8, [
|
|
9649
9757
|
"line",
|
|
9758
|
+
"class",
|
|
9759
|
+
"striped",
|
|
9650
9760
|
"columns",
|
|
9651
9761
|
"selection",
|
|
9652
9762
|
"selected",
|
|
@@ -9670,11 +9780,11 @@ const _sfc_main$44 = /*@__PURE__*/ defineComponent({
|
|
|
9670
9780
|
colspan: columnCount.value,
|
|
9671
9781
|
class: "p-8 text-center text-muted-foreground"
|
|
9672
9782
|
}, [renderSlot(_ctx.$slots, "empty", {}, () => [createTextVNode(toDisplayString(__props.emptyText ?? "暂无数据"), 1)])], 8, _hoisted_19)])) : createCommentVNode("v-if", true)
|
|
9673
|
-
])],
|
|
9674
|
-
createCommentVNode(" 手动接线(须经 onPageIndex/onPageSize
|
|
9783
|
+
])], 4)], 6),
|
|
9784
|
+
createCommentVNode(" 手动接线(须经 onPageIndex/onPageSize 包装器保留受控去重);size select 保持现状。\n 分页条不再补 border-t——分隔线由 table 底线承担(bordered 外框 / bottom-bordered) "),
|
|
9675
9785
|
showPaginationBar.value ? (openBlock(), createBlock(_sfc_main$43, {
|
|
9676
9786
|
key: 1,
|
|
9677
|
-
class: normalizeClass(unref(cn)(
|
|
9787
|
+
class: normalizeClass(unref(cn)(unref(fill) && "shrink-0")),
|
|
9678
9788
|
"page-index": unref(instance).page.pageIndex,
|
|
9679
9789
|
"page-size": unref(instance).page.pageSize,
|
|
9680
9790
|
"page-size-opts": unref(instance).page.pageSizeOpts,
|
|
@@ -10420,7 +10530,7 @@ const _hoisted_7 = { class: "flex shrink-0 items-center gap-1" };
|
|
|
10420
10530
|
* rAF 时钟守卫:独立挂载路径兜底(组合挂载时 TuDesignProvider 已装,幂等无害);
|
|
10421
10531
|
* mode="none"(经 inject 继承)显式跳过,其余哨兵门控(详注 overlay-shared/rafClock.ts)。
|
|
10422
10532
|
*/
|
|
10423
|
-
const rootBase = "flex w-[22rem] max-w-[calc(100vw-2rem)] items-start gap-3 rounded-md border p-4 shadow-lg
|
|
10533
|
+
const rootBase = "flex w-[22rem] max-w-[calc(100vw-2rem)] items-start gap-3 rounded-md border p-4 shadow-lg";
|
|
10424
10534
|
const _sfc_main$48 = /*@__PURE__*/ defineComponent({
|
|
10425
10535
|
__name: "ToastProvider",
|
|
10426
10536
|
props: {
|
|
@@ -10605,7 +10715,7 @@ const _sfc_main$1 = /*@__PURE__*/ defineComponent({
|
|
|
10605
10715
|
emitCancel: () => emit("cancel"),
|
|
10606
10716
|
close
|
|
10607
10717
|
});
|
|
10608
|
-
const contentClass = computed(() => cn("bg-dialog text-dialog-foreground 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"));
|
|
10718
|
+
const contentClass = computed(() => cn("bg-dialog text-dialog-foreground 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]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-top-2 data-[state=open]:slide-in-from-top-2 data-[state=closed]:ease-in data-[state=open]:ease-out sm:max-w-md"));
|
|
10609
10719
|
const preventScroll = overlayPreventScroll();
|
|
10610
10720
|
return (_ctx, _cache) => {
|
|
10611
10721
|
return openBlock(), createBlock(unref(Dialog).Root, {
|
|
@@ -10616,7 +10726,7 @@ const _sfc_main$1 = /*@__PURE__*/ defineComponent({
|
|
|
10616
10726
|
"close-on-interact-outside": !unref(loading),
|
|
10617
10727
|
"onUpdate:open": handleUpdate
|
|
10618
10728
|
}, {
|
|
10619
|
-
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" }, {
|
|
10729
|
+
default: withCtx(() => [createVNode(unref(Dialog).Backdrop, { class: "fixed inset-0 z-[var(--z-modal,60)] bg-black/50 duration-200 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]:ease-in data-[state=open]:ease-out" }), createVNode(unref(Dialog).Positioner, { class: "fixed inset-0 z-[var(--z-modal,60)] flex items-center justify-center p-4" }, {
|
|
10620
10730
|
default: withCtx(() => [createCommentVNode(" role=\"alertdialog\":覆盖 Ark Content 默认 role=\"dialog\",补偿无上游 AlertDialog 原语的角色语义 "), createVNode(unref(Dialog).Content, {
|
|
10621
10731
|
class: normalizeClass(contentClass.value),
|
|
10622
10732
|
role: "alertdialog",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://ui.shadcn.com/schema/registry-item.json",
|
|
3
3
|
"name": "alert-dialog",
|
|
4
|
-
"version": "0.5.
|
|
4
|
+
"version": "0.5.15",
|
|
5
5
|
"type": "registry:ui",
|
|
6
6
|
"description": "确认弹窗单组件:v-model:open 控制显隐,title/description 传文案,@confirm/@cancel 处理确认与取消;确认处理器返回 Promise 时按钮进入 loading 并锁定 ESC/遮罩关闭,resolve 自动关闭、reject 保持打开;内容节点为 role=alertdialog。",
|
|
7
7
|
"registryDependencies": ["button", "utils", "overlay-shared"],
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"path": "alert-dialog/AlertDialog.vue",
|
|
12
12
|
"type": "registry:component",
|
|
13
13
|
"target": "components/ui/alert-dialog/AlertDialog.vue",
|
|
14
|
-
"content": "<script setup lang=\"ts\">\nimport type { PropType } from \"vue\";\nimport { computed, getCurrentInstance, useAttrs } from \"vue\";\nimport { Dialog as ArkDialog } from \"@ark-ui/vue/dialog\";\nimport { cn } from \"@/lib/utils\";\nimport { Button } from \"@/components/ui/button\";\nimport { useConfirmPending } from \"../overlay-shared/useConfirmPending\";\nimport { useControlledBoolean } from \"../overlay-shared/useControlledBoolean\";\nimport { useOverlayIds } from \"../overlay-shared/useOverlayIds\";\nimport { useOverlayScrollLock } from \"../overlay-shared/useOverlayScrollLock\";\nimport { overlayPreventScroll } from \"../overlay-shared/useSandboxOverlay\";\n\nconst attrs = useAttrs();\n\n// ids 全量覆盖(无冒号):规避 wujie patch getElementById 对 zag 缺省冒号 id 的\n// SyntaxError 刷屏(详注见 useOverlayIds);复用 dialog machine,parts 同 Dialog\nconst { ids: rootIds } = useOverlayIds(attrs, {\n primary: \"content\",\n parts: [\"content\", \"title\", \"description\", \"trigger\", \"closeTrigger\", \"positioner\", \"backdrop\"],\n});\n\n// 用运行时 props 显式 default: undefined:Boolean prop 缺省时 Vue 会 cast 成 false,\n// 导致无法区分「未传(非受控)」与「传了 false(受控关闭)」。与 Dialog.vue 同款约定。\nconst props = defineProps({\n /** 受控开关(配合 v-model:open);不传时为非受控,由内部状态管理 */\n open: { type: Boolean as PropType<boolean | undefined>, default: undefined },\n /** 标题文案(#title 插槽优先) */\n title: { type: String, required: true },\n /** 描述文案(#description 插槽优先,可不传) */\n description: { type: String, default: undefined },\n /** 确认按钮文案 */\n confirmText: { type: String, default: \"确定\" },\n /** 取消按钮文案 */\n cancelText: { type: String, default: \"取消\" },\n /** 确认按钮使用 destructive 语义色(危险操作场景) */\n destructive: { type: Boolean, default: false },\n});\n\nconst emit = defineEmits<{\n \"update:open\": [open: boolean];\n confirm: [];\n cancel: [];\n}>();\n\n// 对 Root 恒走受控模式(open 恒为布尔):非受控语义由内部 ref 实现,与 Dialog.vue 一致。\n// setup 期间捕获实例:getCurrentInstance 仅在 setup/生命周期内有效,事件回调里返回 null。\nconst instance = getCurrentInstance();\nconst { isOpen, setOpen } = useControlledBoolean({\n controlled: () => props.open,\n onChange: (open) => emit(\"update:open\", open),\n});\n\n// overlay 滚动锁契约(issue #5,语义 B 拓扑闸在 overlayContract 内);\n// isModal 仅在 isOpen 转换回调内求值(冻结语义,不 watch attrs)\nuseOverlayScrollLock(isOpen, () => attrs.modal !== false && attrs.modal !== \"false\");\n\nfunction handleUpdate(open: boolean) {\n // pending 期间忽略一切关闭请求(走受控桥拒绝同步,弹窗保持打开)——\n // 与 Popconfirm 同款锁定方案;Root 仍保留 :close-on-escape/:close-on-interact-outside 双保险\n if (!open && loading.value) return;\n setOpen(open);\n}\n\n/** 关闭弹窗:走受控桥把 open 置 false,退出动画/焦点还原由 zag 处理 */\nfunction close() {\n handleUpdate(false);\n}\n\n// 确认 Promise pending 时锁定关闭通道(ESC/遮罩/取消按钮全部锁死),只能等 Promise 落定\nconst { loading, handleConfirm, handleCancel } = useConfirmPending({\n instance,\n emitConfirm: () => emit(\"confirm\"),\n emitCancel: () => emit(\"cancel\"),\n close,\n});\n\n// 面板样式:复用 Dialog 的内容面板类(含 --dialog 模态表面位,issue #2),宽度收窄为 sm:max-w-md 的确认弹窗尺度\nconst contentClass = computed(() =>\n cn(\n \"bg-dialog text-dialog-foreground 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\",\n ),\n);\n\n// 滚动锁沙箱降级(wujie graft 下禁用,机制与论证见 overlayPreventScroll / issue #4)\nconst preventScroll = overlayPreventScroll();\n</script>\n\n<template>\n <ArkDialog.Root\n :ids=\"rootIds\"\n :open=\"isOpen\"\n :prevent-scroll=\"preventScroll\"\n :close-on-escape=\"!loading\"\n :close-on-interact-outside=\"!loading\"\n @update:open=\"handleUpdate\"\n >\n <ArkDialog.Backdrop\n 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\"\n />\n <ArkDialog.Positioner\n class=\"fixed inset-0 z-[var(--z-modal,60)] flex items-center justify-center p-4\"\n >\n <!-- role=\"alertdialog\":覆盖 Ark Content 默认 role=\"dialog\",补偿无上游 AlertDialog 原语的角色语义 -->\n <ArkDialog.Content :class=\"contentClass\" role=\"alertdialog\" aria-modal=\"true\">\n <div class=\"flex flex-col gap-2 text-center sm:text-left\">\n <ArkDialog.Title class=\"text-lg font-semibold leading-none tracking-tight\">\n <slot name=\"title\">{{ props.title }}</slot>\n </ArkDialog.Title>\n <ArkDialog.Description\n v-if=\"$slots.description || props.description\"\n class=\"text-sm text-muted-foreground\"\n >\n <slot name=\"description\">{{ props.description }}</slot>\n </ArkDialog.Description>\n </div>\n\n <!-- 默认插槽:补充正文(可选) -->\n <slot />\n\n <!-- 底部操作区:取消 outline,确认按 destructive 切换语义色;pending 时确认钮转 loading -->\n <div class=\"flex flex-col-reverse gap-2 sm:flex-row sm:justify-end\">\n <Button variant=\"outline\" :disabled=\"loading\" @click=\"handleCancel\">\n {{ props.cancelText }}\n </Button>\n <Button\n :variant=\"props.destructive ? 'destructive' : 'default'\"\n :disabled=\"loading\"\n @click=\"handleConfirm\"\n >\n <svg\n v-if=\"loading\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n class=\"size-4 animate-spin\"\n aria-hidden=\"true\"\n >\n <path d=\"M21 12a9 9 0 1 1-6.219-8.56\" />\n </svg>\n {{ props.confirmText }}\n </Button>\n </div>\n </ArkDialog.Content>\n </ArkDialog.Positioner>\n </ArkDialog.Root>\n</template>\n"
|
|
14
|
+
"content": "<script setup lang=\"ts\">\nimport type { PropType } from \"vue\";\nimport { computed, getCurrentInstance, useAttrs } from \"vue\";\nimport { Dialog as ArkDialog } from \"@ark-ui/vue/dialog\";\nimport { cn } from \"@/lib/utils\";\nimport { Button } from \"@/components/ui/button\";\nimport { useConfirmPending } from \"../overlay-shared/useConfirmPending\";\nimport { useControlledBoolean } from \"../overlay-shared/useControlledBoolean\";\nimport { useOverlayIds } from \"../overlay-shared/useOverlayIds\";\nimport { useOverlayScrollLock } from \"../overlay-shared/useOverlayScrollLock\";\nimport { overlayPreventScroll } from \"../overlay-shared/useSandboxOverlay\";\n\nconst attrs = useAttrs();\n\n// ids 全量覆盖(无冒号):规避 wujie patch getElementById 对 zag 缺省冒号 id 的\n// SyntaxError 刷屏(详注见 useOverlayIds);复用 dialog machine,parts 同 Dialog\nconst { ids: rootIds } = useOverlayIds(attrs, {\n primary: \"content\",\n parts: [\"content\", \"title\", \"description\", \"trigger\", \"closeTrigger\", \"positioner\", \"backdrop\"],\n});\n\n// 用运行时 props 显式 default: undefined:Boolean prop 缺省时 Vue 会 cast 成 false,\n// 导致无法区分「未传(非受控)」与「传了 false(受控关闭)」。与 Dialog.vue 同款约定。\nconst props = defineProps({\n /** 受控开关(配合 v-model:open);不传时为非受控,由内部状态管理 */\n open: { type: Boolean as PropType<boolean | undefined>, default: undefined },\n /** 标题文案(#title 插槽优先) */\n title: { type: String, required: true },\n /** 描述文案(#description 插槽优先,可不传) */\n description: { type: String, default: undefined },\n /** 确认按钮文案 */\n confirmText: { type: String, default: \"确定\" },\n /** 取消按钮文案 */\n cancelText: { type: String, default: \"取消\" },\n /** 确认按钮使用 destructive 语义色(危险操作场景) */\n destructive: { type: Boolean, default: false },\n});\n\nconst emit = defineEmits<{\n \"update:open\": [open: boolean];\n confirm: [];\n cancel: [];\n}>();\n\n// 对 Root 恒走受控模式(open 恒为布尔):非受控语义由内部 ref 实现,与 Dialog.vue 一致。\n// setup 期间捕获实例:getCurrentInstance 仅在 setup/生命周期内有效,事件回调里返回 null。\nconst instance = getCurrentInstance();\nconst { isOpen, setOpen } = useControlledBoolean({\n controlled: () => props.open,\n onChange: (open) => emit(\"update:open\", open),\n});\n\n// overlay 滚动锁契约(issue #5,语义 B 拓扑闸在 overlayContract 内);\n// isModal 仅在 isOpen 转换回调内求值(冻结语义,不 watch attrs)\nuseOverlayScrollLock(isOpen, () => attrs.modal !== false && attrs.modal !== \"false\");\n\nfunction handleUpdate(open: boolean) {\n // pending 期间忽略一切关闭请求(走受控桥拒绝同步,弹窗保持打开)——\n // 与 Popconfirm 同款锁定方案;Root 仍保留 :close-on-escape/:close-on-interact-outside 双保险\n if (!open && loading.value) return;\n setOpen(open);\n}\n\n/** 关闭弹窗:走受控桥把 open 置 false,退出动画/焦点还原由 zag 处理 */\nfunction close() {\n handleUpdate(false);\n}\n\n// 确认 Promise pending 时锁定关闭通道(ESC/遮罩/取消按钮全部锁死),只能等 Promise 落定\nconst { loading, handleConfirm, handleCancel } = useConfirmPending({\n instance,\n emitConfirm: () => emit(\"confirm\"),\n emitCancel: () => emit(\"cancel\"),\n close,\n});\n\n// 面板样式:复用 Dialog 的内容面板类(含 --dialog 模态表面位,issue #2),宽度收窄为 sm:max-w-md 的确认弹窗尺度\n// 进出场动画与 Dialog.vue 保持同款(fade + zoom-95 + 上方 8px 落位,200ms,进 ease-out 出 ease-in)\nconst contentClass = computed(() =>\n cn(\n \"bg-dialog text-dialog-foreground 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]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-top-2 data-[state=open]:slide-in-from-top-2 data-[state=closed]:ease-in data-[state=open]:ease-out sm:max-w-md\",\n ),\n);\n\n// 滚动锁沙箱降级(wujie graft 下禁用,机制与论证见 overlayPreventScroll / issue #4)\nconst preventScroll = overlayPreventScroll();\n</script>\n\n<template>\n <ArkDialog.Root\n :ids=\"rootIds\"\n :open=\"isOpen\"\n :prevent-scroll=\"preventScroll\"\n :close-on-escape=\"!loading\"\n :close-on-interact-outside=\"!loading\"\n @update:open=\"handleUpdate\"\n >\n <ArkDialog.Backdrop\n class=\"fixed inset-0 z-[var(--z-modal,60)] bg-black/50 duration-200 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]:ease-in data-[state=open]:ease-out\"\n />\n <ArkDialog.Positioner\n class=\"fixed inset-0 z-[var(--z-modal,60)] flex items-center justify-center p-4\"\n >\n <!-- role=\"alertdialog\":覆盖 Ark Content 默认 role=\"dialog\",补偿无上游 AlertDialog 原语的角色语义 -->\n <ArkDialog.Content :class=\"contentClass\" role=\"alertdialog\" aria-modal=\"true\">\n <div class=\"flex flex-col gap-2 text-center sm:text-left\">\n <ArkDialog.Title class=\"text-lg font-semibold leading-none tracking-tight\">\n <slot name=\"title\">{{ props.title }}</slot>\n </ArkDialog.Title>\n <ArkDialog.Description\n v-if=\"$slots.description || props.description\"\n class=\"text-sm text-muted-foreground\"\n >\n <slot name=\"description\">{{ props.description }}</slot>\n </ArkDialog.Description>\n </div>\n\n <!-- 默认插槽:补充正文(可选) -->\n <slot />\n\n <!-- 底部操作区:取消 outline,确认按 destructive 切换语义色;pending 时确认钮转 loading -->\n <div class=\"flex flex-col-reverse gap-2 sm:flex-row sm:justify-end\">\n <Button variant=\"outline\" :disabled=\"loading\" @click=\"handleCancel\">\n {{ props.cancelText }}\n </Button>\n <Button\n :variant=\"props.destructive ? 'destructive' : 'default'\"\n :disabled=\"loading\"\n @click=\"handleConfirm\"\n >\n <svg\n v-if=\"loading\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n class=\"size-4 animate-spin\"\n aria-hidden=\"true\"\n >\n <path d=\"M21 12a9 9 0 1 1-6.219-8.56\" />\n </svg>\n {{ props.confirmText }}\n </Button>\n </div>\n </ArkDialog.Content>\n </ArkDialog.Positioner>\n </ArkDialog.Root>\n</template>\n"
|
|
15
15
|
},
|
|
16
16
|
{
|
|
17
17
|
"path": "alert-dialog/index.ts",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://ui.shadcn.com/schema/registry-item.json",
|
|
3
3
|
"name": "calendar",
|
|
4
|
-
"version": "0.5.
|
|
4
|
+
"version": "0.5.15",
|
|
5
5
|
"type": "registry:ui",
|
|
6
6
|
"description": "日历(TCalendar):紧凑日历卡。Picker 弹层内为 embedded 内嵌形态(TDatePicker/TDateRangePicker 自动挂靠,纯卡片内核);独立使用即 standalone 独立形态(自带日历状态与 v-model,恒开展示)。",
|
|
7
7
|
"registryDependencies": ["icon-shared", "utils", "date-shared"],
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://ui.shadcn.com/schema/registry-item.json",
|
|
3
3
|
"name": "card",
|
|
4
|
-
"version": "0.5.
|
|
4
|
+
"version": "0.5.15",
|
|
5
5
|
"type": "registry:ui",
|
|
6
6
|
"description": "卡片容器:单组件 API,title/description 头部 + 命名插槽(cover/action/footer/header),支持尺寸、视觉变体、分段分隔与可关闭。",
|
|
7
7
|
"registryDependencies": ["utils"],
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://ui.shadcn.com/schema/registry-item.json",
|
|
3
3
|
"name": "cascader",
|
|
4
|
-
"version": "0.5.
|
|
4
|
+
"version": "0.5.15",
|
|
5
5
|
"type": "registry:ui",
|
|
6
6
|
"description": "级联选择:一站式 props 驱动,多列联动、勾选级联、路径回显与多标签。",
|
|
7
7
|
"registryDependencies": ["icon-shared", "tree-shared", "utils", "date-shared", "overlay-shared"],
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://ui.shadcn.com/schema/registry-item.json",
|
|
3
3
|
"name": "context-menu",
|
|
4
|
-
"version": "0.5.
|
|
4
|
+
"version": "0.5.15",
|
|
5
5
|
"type": "registry:ui",
|
|
6
6
|
"description": "右键菜单:单组件模式,items 描述菜单项(与 dropdown-menu 同构,含分组/标题/分隔线,支持嵌套),默认插槽为触发元素(ContextTrigger as-child,右键唤出并定位到指针处),内置键盘导航与选中回调。",
|
|
7
7
|
"registryDependencies": ["overlay-shared", "utils", "dropdown-menu"],
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://ui.shadcn.com/schema/registry-item.json",
|
|
3
3
|
"name": "currency-input",
|
|
4
|
-
"version": "0.5.
|
|
4
|
+
"version": "0.5.15",
|
|
5
5
|
"type": "registry:ui",
|
|
6
6
|
"description": "金额输入框:内置万/元/角/分单位后缀,labelUnit 输入单位与 valueUnit 存储单位自动换算(整数分最小精度),值以 number|null 受控。",
|
|
7
7
|
"registryDependencies": ["utils"],
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://ui.shadcn.com/schema/registry-item.json",
|
|
3
3
|
"name": "date-picker",
|
|
4
|
-
"version": "0.5.
|
|
4
|
+
"version": "0.5.15",
|
|
5
5
|
"type": "registry:ui",
|
|
6
6
|
"description": "日期选择器:输入框 + 日历弹层(月/年视图切换),支持手动键入/清空/min-max 边界/不可选谓词,值以 \"yyyy-MM-dd\" 字符串受控。",
|
|
7
7
|
"registryDependencies": ["utils", "date-shared", "calendar"],
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://ui.shadcn.com/schema/registry-item.json",
|
|
3
3
|
"name": "date-range-picker",
|
|
4
|
-
"version": "0.5.
|
|
4
|
+
"version": "0.5.15",
|
|
5
5
|
"type": "registry:ui",
|
|
6
6
|
"description": "日期范围选择器:双月日历弹层(月/年视图切换),点选起点与终点,值以 [\"yyyy-MM-dd\", \"yyyy-MM-dd\"] 有序元组受控,空值归一 null。",
|
|
7
7
|
"registryDependencies": ["icon-shared", "utils", "date-shared", "calendar", "overlay-shared"],
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://ui.shadcn.com/schema/registry-item.json",
|
|
3
3
|
"name": "date-shared",
|
|
4
|
-
"version": "0.5.
|
|
4
|
+
"version": "0.5.15",
|
|
5
5
|
"type": "registry:ui",
|
|
6
6
|
"description": "日期家族共享模块:ISO 值域解析(日期/月/年/区间)、日历样式常量与单值选择器外壳(PickerShell/usePickerBridge)。",
|
|
7
7
|
"registryDependencies": ["icon-shared", "utils", "overlay-shared"],
|