@shwfed/nuxt 0.7.10 → 0.7.11
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/module.json +1 -1
- package/dist/runtime/components/table.d.vue.ts +68 -2
- package/dist/runtime/components/table.vue +0 -1
- package/dist/runtime/components/table.vue.d.ts +68 -2
- package/dist/runtime/components/ui/dropdown-menu/DropdownMenuItem.vue +1 -1
- package/dist/runtime/components/ui/field/FieldLabel.vue +1 -1
- package/dist/runtime/components/ui/icon-picker/IconPicker.d.vue.ts +15 -0
- package/dist/runtime/components/ui/icon-picker/IconPicker.vue +178 -0
- package/dist/runtime/components/ui/icon-picker/IconPicker.vue.d.ts +15 -0
- package/dist/runtime/components/ui/icon-picker/index.d.ts +1 -0
- package/dist/runtime/components/ui/icon-picker/index.js +1 -0
- package/dist/runtime/components/ui/input-group/InputGroupComboboxInput.vue +1 -1
- package/dist/runtime/components/ui/input-group/InputGroupInput.vue +1 -1
- package/dist/runtime/components/ui/input-group/InputGroupNumberField.vue +1 -1
- package/dist/runtime/components/ui/input-group/InputGroupTextarea.vue +1 -1
- package/dist/runtime/components/ui/native-select/NativeSelect.d.vue.ts +2 -2
- package/dist/runtime/components/ui/native-select/NativeSelect.vue +1 -1
- package/dist/runtime/components/ui/native-select/NativeSelect.vue.d.ts +2 -2
- package/dist/runtime/components/ui/switch/Switch.vue +2 -2
- package/dist/runtime/components/ui/table/Table.d.vue.ts +69 -3
- package/dist/runtime/components/ui/table/Table.vue +201 -41
- package/dist/runtime/components/ui/table/Table.vue.d.ts +69 -3
- package/dist/runtime/components/ui/table/schema.d.ts +107 -4
- package/dist/runtime/components/ui/table/schema.js +106 -90
- package/dist/runtime/components/ui/table-configurator/TableConfiguratorDialog.d.vue.ts +68 -2
- package/dist/runtime/components/ui/table-configurator/TableConfiguratorDialog.vue +590 -104
- package/dist/runtime/components/ui/table-configurator/TableConfiguratorDialog.vue.d.ts +68 -2
- package/dist/runtime/components/ui/textarea/Textarea.vue +1 -1
- package/dist/runtime/plugins/toast/index.d.ts +2 -2
- package/dist/runtime/table-renderers/builtins.js +151 -75
- package/dist/runtime/table-renderers/registry.d.ts +1 -1
- package/dist/runtime/utils/coders.d.ts +2 -0
- package/dist/runtime/utils/coders.js +13 -0
- package/package.json +6 -6
|
@@ -28,9 +28,42 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {},
|
|
|
28
28
|
grow?: boolean;
|
|
29
29
|
}>[];
|
|
30
30
|
cellStyles?: import("../table/schema.js").Expression;
|
|
31
|
-
props?:
|
|
31
|
+
props?: Readonly<{
|
|
32
|
+
[key: string]: unknown;
|
|
33
|
+
initialState?: Readonly<{
|
|
34
|
+
columnVisibility?: Record<string, boolean>;
|
|
35
|
+
columnOrder?: ReadonlyArray<string>;
|
|
36
|
+
columnPinning?: Readonly<{
|
|
37
|
+
left?: ReadonlyArray<string>;
|
|
38
|
+
right?: ReadonlyArray<string>;
|
|
39
|
+
}>;
|
|
40
|
+
rowPinning?: Readonly<{
|
|
41
|
+
top?: ReadonlyArray<string>;
|
|
42
|
+
bottom?: ReadonlyArray<string>;
|
|
43
|
+
}>;
|
|
44
|
+
columnFilters?: ReadonlyArray<Readonly<{
|
|
45
|
+
id: string;
|
|
46
|
+
value: unknown;
|
|
47
|
+
}>>;
|
|
48
|
+
globalFilter?: unknown;
|
|
49
|
+
sorting?: ReadonlyArray<Readonly<{
|
|
50
|
+
id: string;
|
|
51
|
+
desc: boolean;
|
|
52
|
+
}>>;
|
|
53
|
+
expanded?: boolean | Record<string, boolean>;
|
|
54
|
+
grouping?: ReadonlyArray<string>;
|
|
55
|
+
columnSizing?: Record<string, number>;
|
|
56
|
+
columnSizingInfo?: Record<string, unknown>;
|
|
57
|
+
pagination?: Readonly<{
|
|
58
|
+
pageIndex?: number;
|
|
59
|
+
pageSize?: number;
|
|
60
|
+
}>;
|
|
61
|
+
rowSelection?: Record<string, boolean>;
|
|
62
|
+
}>;
|
|
63
|
+
}>;
|
|
32
64
|
paginationLeft?: import("../table/schema.js").Markdown;
|
|
33
65
|
paginationRight?: import("../table/schema.js").Markdown;
|
|
66
|
+
paginationPageSizes?: ReadonlyArray<number>;
|
|
34
67
|
}>) => any;
|
|
35
68
|
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
36
69
|
"onUpdate:open"?: ((value: boolean) => any) | undefined;
|
|
@@ -53,9 +86,42 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {},
|
|
|
53
86
|
grow?: boolean;
|
|
54
87
|
}>[];
|
|
55
88
|
cellStyles?: import("../table/schema.js").Expression;
|
|
56
|
-
props?:
|
|
89
|
+
props?: Readonly<{
|
|
90
|
+
[key: string]: unknown;
|
|
91
|
+
initialState?: Readonly<{
|
|
92
|
+
columnVisibility?: Record<string, boolean>;
|
|
93
|
+
columnOrder?: ReadonlyArray<string>;
|
|
94
|
+
columnPinning?: Readonly<{
|
|
95
|
+
left?: ReadonlyArray<string>;
|
|
96
|
+
right?: ReadonlyArray<string>;
|
|
97
|
+
}>;
|
|
98
|
+
rowPinning?: Readonly<{
|
|
99
|
+
top?: ReadonlyArray<string>;
|
|
100
|
+
bottom?: ReadonlyArray<string>;
|
|
101
|
+
}>;
|
|
102
|
+
columnFilters?: ReadonlyArray<Readonly<{
|
|
103
|
+
id: string;
|
|
104
|
+
value: unknown;
|
|
105
|
+
}>>;
|
|
106
|
+
globalFilter?: unknown;
|
|
107
|
+
sorting?: ReadonlyArray<Readonly<{
|
|
108
|
+
id: string;
|
|
109
|
+
desc: boolean;
|
|
110
|
+
}>>;
|
|
111
|
+
expanded?: boolean | Record<string, boolean>;
|
|
112
|
+
grouping?: ReadonlyArray<string>;
|
|
113
|
+
columnSizing?: Record<string, number>;
|
|
114
|
+
columnSizingInfo?: Record<string, unknown>;
|
|
115
|
+
pagination?: Readonly<{
|
|
116
|
+
pageIndex?: number;
|
|
117
|
+
pageSize?: number;
|
|
118
|
+
}>;
|
|
119
|
+
rowSelection?: Record<string, boolean>;
|
|
120
|
+
}>;
|
|
121
|
+
}>;
|
|
57
122
|
paginationLeft?: import("../table/schema.js").Markdown;
|
|
58
123
|
paginationRight?: import("../table/schema.js").Markdown;
|
|
124
|
+
paginationPageSizes?: ReadonlyArray<number>;
|
|
59
125
|
}>) => any) | undefined;
|
|
60
126
|
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
61
127
|
declare const _default: typeof __VLS_export;
|
|
@@ -19,6 +19,6 @@ const modelValue = useVModel(props, "modelValue", emits, {
|
|
|
19
19
|
v-model="modelValue"
|
|
20
20
|
data-slot="textarea"
|
|
21
21
|
:placeholder="props.placeholder"
|
|
22
|
-
:class="cn('border-zinc-200 placeholder:text-zinc-400 focus-visible:border-(--primary) aria-invalid:border-red-400
|
|
22
|
+
:class="cn('border-zinc-200 placeholder:text-zinc-400 focus-visible:border-(--primary) aria-invalid:border-red-400 flex field-sizing-content min-h-16 w-full rounded-md border bg-transparent px-3 py-2 text-base shadow-xs transition-[color,box-shadow] outline-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm', props.class)"
|
|
23
23
|
/>
|
|
24
24
|
</template>
|
|
@@ -11,6 +11,7 @@ declare const _default: import("#app").Plugin<{
|
|
|
11
11
|
icon?: import("vue").Component | undefined;
|
|
12
12
|
class?: string | undefined;
|
|
13
13
|
style?: import("vue").CSSProperties | undefined;
|
|
14
|
+
cancel?: (import("vue-sonner").Action | import("vue").Component) | undefined;
|
|
14
15
|
toasterId?: string | undefined;
|
|
15
16
|
component?: import("vue").Component | undefined;
|
|
16
17
|
componentProps?: any;
|
|
@@ -21,7 +22,6 @@ declare const _default: import("#app").Plugin<{
|
|
|
21
22
|
duration?: number | undefined;
|
|
22
23
|
important?: boolean | undefined;
|
|
23
24
|
action?: (import("vue-sonner").Action | import("vue").Component) | undefined;
|
|
24
|
-
cancel?: (import("vue-sonner").Action | import("vue").Component) | undefined;
|
|
25
25
|
onDismiss?: ((toast: import("vue-sonner").ToastT) => void) | undefined;
|
|
26
26
|
onAutoClose?: ((toast: import("vue-sonner").ToastT) => void) | undefined;
|
|
27
27
|
cancelButtonStyle?: import("vue").CSSProperties | undefined;
|
|
@@ -64,6 +64,7 @@ declare const _default: import("#app").Plugin<{
|
|
|
64
64
|
icon?: import("vue").Component | undefined;
|
|
65
65
|
class?: string | undefined;
|
|
66
66
|
style?: import("vue").CSSProperties | undefined;
|
|
67
|
+
cancel?: (import("vue-sonner").Action | import("vue").Component) | undefined;
|
|
67
68
|
toasterId?: string | undefined;
|
|
68
69
|
component?: import("vue").Component | undefined;
|
|
69
70
|
componentProps?: any;
|
|
@@ -74,7 +75,6 @@ declare const _default: import("#app").Plugin<{
|
|
|
74
75
|
duration?: number | undefined;
|
|
75
76
|
important?: boolean | undefined;
|
|
76
77
|
action?: (import("vue-sonner").Action | import("vue").Component) | undefined;
|
|
77
|
-
cancel?: (import("vue-sonner").Action | import("vue").Component) | undefined;
|
|
78
78
|
onDismiss?: ((toast: import("vue-sonner").ToastT) => void) | undefined;
|
|
79
79
|
onAutoClose?: ((toast: import("vue-sonner").ToastT) => void) | undefined;
|
|
80
80
|
cancelButtonStyle?: import("vue").CSSProperties | undefined;
|
|
@@ -1,28 +1,30 @@
|
|
|
1
1
|
import { jsx, jsxs } from "vue/jsx-runtime";
|
|
2
2
|
import { Icon } from "@iconify/vue";
|
|
3
3
|
import { format as formatDate, isValid, toDate } from "date-fns";
|
|
4
|
-
import { defineComponent, ref } from "vue";
|
|
4
|
+
import { defineComponent, h, ref } from "vue";
|
|
5
5
|
import { useI18n } from "vue-i18n";
|
|
6
6
|
import { z } from "zod";
|
|
7
7
|
import { defineTableRenderer } from "./registry.js";
|
|
8
8
|
import { useNuxtApp } from "#app";
|
|
9
|
-
import { expressionC } from "../utils/coders.js";
|
|
9
|
+
import { expressionC, getLocalizedText, hasVisibleLocaleValue, localeC } from "../utils/coders.js";
|
|
10
10
|
import { Button } from "../components/ui/button/index.js";
|
|
11
11
|
import { Checkbox } from "../components/ui/checkbox/index.js";
|
|
12
12
|
import ExpressionEditor from "../components/ui/expression-editor/ExpressionEditor.vue";
|
|
13
13
|
import { Input } from "../components/ui/input/index.js";
|
|
14
|
+
import Locale from "../components/ui/locale/Locale.vue";
|
|
14
15
|
import { NativeSelect, NativeSelectOption } from "../components/ui/native-select/index.js";
|
|
15
16
|
import { Switch } from "../components/ui/switch/index.js";
|
|
16
|
-
import { Textarea } from "../components/ui/textarea/index.js";
|
|
17
17
|
const JUSTIFY_CLASS = {
|
|
18
18
|
left: "justify-start",
|
|
19
19
|
center: "justify-center",
|
|
20
20
|
right: "justify-end"
|
|
21
21
|
};
|
|
22
|
+
const MARKDOWN_EXPRESSION_EXAMPLE = "{{ expression }}";
|
|
22
23
|
const TABLE_RENDERER_CONFIG_MESSAGES = {
|
|
23
24
|
zh: {
|
|
24
25
|
"copyable": "\u53EF\u590D\u5236",
|
|
25
26
|
"copyable-description": "\u4E3A\u975E\u7A7A\u5355\u5143\u683C\u663E\u793A\u590D\u5236\u64CD\u4F5C\u3002",
|
|
27
|
+
"copy-cell-value": "\u590D\u5236\u5355\u5143\u683C\u5185\u5BB9",
|
|
26
28
|
"copy-expression": "\u590D\u5236\u8868\u8FBE\u5F0F",
|
|
27
29
|
"copy-expression-description": "\u590D\u5236\u65F6\u4F7F\u7528\u7684 CEL \u8868\u8FBE\u5F0F\u3002\u53D8\u91CF\uFF1Arow\u3001index\u3002",
|
|
28
30
|
"copy-expression-placeholder": "\u8F93\u5165\u590D\u5236 CEL \u8868\u8FBE\u5F0F",
|
|
@@ -34,14 +36,19 @@ const TABLE_RENDERER_CONFIG_MESSAGES = {
|
|
|
34
36
|
"format": "\u683C\u5F0F",
|
|
35
37
|
"preview": "\u9884\u89C8",
|
|
36
38
|
"markdown": "Markdown",
|
|
37
|
-
"markdown-
|
|
39
|
+
"markdown-description": "\u652F\u6301 Markdown \u7F16\u8F91\uFF0C\u652F\u6301\u5728 {expression} \u4E2D\u6C42\u503C\uFF1B\u5168\u90E8\u8BED\u8A00\u7559\u7A7A\u65F6\u56DE\u9000\u5230\u5355\u5143\u683C\u503C\u3002",
|
|
38
40
|
"no-options": "\u65E0\u53EF\u914D\u7F6E\u9879\u3002",
|
|
39
41
|
"select-all-rows-on-page": "\u9009\u62E9\u5F53\u524D\u9875\u5168\u90E8\u884C",
|
|
40
|
-
"select-all-rows": "\u9009\u62E9\u5168\u90E8\u884C"
|
|
42
|
+
"select-all-rows": "\u9009\u62E9\u5168\u90E8\u884C",
|
|
43
|
+
"expand-row": "\u5C55\u5F00\u884C",
|
|
44
|
+
"collapse-row": "\u6536\u8D77\u884C",
|
|
45
|
+
"expand-all-rows": "\u5C55\u5F00\u5168\u90E8\u884C",
|
|
46
|
+
"collapse-all-rows": "\u6536\u8D77\u5168\u90E8\u884C"
|
|
41
47
|
},
|
|
42
48
|
ja: {
|
|
43
49
|
"copyable": "\u30B3\u30D4\u30FC\u53EF\u80FD",
|
|
44
50
|
"copyable-description": "\u7A7A\u3067\u306A\u3044\u30BB\u30EB\u306B\u30B3\u30D4\u30FC\u64CD\u4F5C\u3092\u8868\u793A\u3057\u307E\u3059\u3002",
|
|
51
|
+
"copy-cell-value": "\u30BB\u30EB\u306E\u5185\u5BB9\u3092\u30B3\u30D4\u30FC",
|
|
45
52
|
"copy-expression": "\u30B3\u30D4\u30FC\u5F0F",
|
|
46
53
|
"copy-expression-description": "\u30B3\u30D4\u30FC\u6642\u306B\u4F7F\u3046 CEL \u5F0F\u3067\u3059\u3002\u5909\u6570: row\u3001index\u3002",
|
|
47
54
|
"copy-expression-placeholder": "\u30B3\u30D4\u30FC\u7528 CEL \u5F0F\u3092\u5165\u529B",
|
|
@@ -53,14 +60,19 @@ const TABLE_RENDERER_CONFIG_MESSAGES = {
|
|
|
53
60
|
"format": "\u30D5\u30A9\u30FC\u30DE\u30C3\u30C8",
|
|
54
61
|
"preview": "\u30D7\u30EC\u30D3\u30E5\u30FC",
|
|
55
62
|
"markdown": "Markdown",
|
|
56
|
-
"markdown-
|
|
63
|
+
"markdown-description": "Markdown \u3067\u7DE8\u96C6\u3067\u304D\u3001{expression} \u3082\u5229\u7528\u3067\u304D\u307E\u3059\u3002\u3059\u3079\u3066\u7A7A\u6B04\u306A\u3089\u30BB\u30EB\u5024\u306B\u623B\u308A\u307E\u3059\u3002",
|
|
57
64
|
"no-options": "\u8A2D\u5B9A\u53EF\u80FD\u306A\u9805\u76EE\u306F\u3042\u308A\u307E\u305B\u3093\u3002",
|
|
58
65
|
"select-all-rows-on-page": "\u73FE\u5728\u306E\u30DA\u30FC\u30B8\u306E\u3059\u3079\u3066\u306E\u884C\u3092\u9078\u629E",
|
|
59
|
-
"select-all-rows": "\u3059\u3079\u3066\u306E\u884C\u3092\u9078\u629E"
|
|
66
|
+
"select-all-rows": "\u3059\u3079\u3066\u306E\u884C\u3092\u9078\u629E",
|
|
67
|
+
"expand-row": "\u884C\u3092\u5C55\u958B",
|
|
68
|
+
"collapse-row": "\u884C\u3092\u6298\u308A\u305F\u305F\u3080",
|
|
69
|
+
"expand-all-rows": "\u3059\u3079\u3066\u306E\u884C\u3092\u5C55\u958B",
|
|
70
|
+
"collapse-all-rows": "\u3059\u3079\u3066\u306E\u884C\u3092\u6298\u308A\u305F\u305F\u3080"
|
|
60
71
|
},
|
|
61
72
|
en: {
|
|
62
73
|
"copyable": "Copyable",
|
|
63
74
|
"copyable-description": "Show a copy action for non-empty cells.",
|
|
75
|
+
"copy-cell-value": "Copy cell value",
|
|
64
76
|
"copy-expression": "Copy expression",
|
|
65
77
|
"copy-expression-description": "CEL expression used when copying. Variables: row, index.",
|
|
66
78
|
"copy-expression-placeholder": "Enter a copy CEL expression",
|
|
@@ -72,10 +84,14 @@ const TABLE_RENDERER_CONFIG_MESSAGES = {
|
|
|
72
84
|
"format": "Format",
|
|
73
85
|
"preview": "Preview",
|
|
74
86
|
"markdown": "Markdown",
|
|
75
|
-
"markdown-
|
|
87
|
+
"markdown-description": "Supports Markdown and {expression}; if every locale is blank, use the cell value.",
|
|
76
88
|
"no-options": "No options.",
|
|
77
89
|
"select-all-rows-on-page": "Select all rows on page",
|
|
78
|
-
"select-all-rows": "Select all rows"
|
|
90
|
+
"select-all-rows": "Select all rows",
|
|
91
|
+
"expand-row": "Expand row",
|
|
92
|
+
"collapse-row": "Collapse row",
|
|
93
|
+
"expand-all-rows": "Expand all rows",
|
|
94
|
+
"collapse-all-rows": "Collapse all rows"
|
|
79
95
|
}
|
|
80
96
|
};
|
|
81
97
|
function useTableRendererConfigI18n() {
|
|
@@ -123,19 +139,26 @@ const TableRendererTextConfig = defineComponent({
|
|
|
123
139
|
validate
|
|
124
140
|
});
|
|
125
141
|
return () => /* @__PURE__ */ jsxs("div", { class: "flex flex-col gap-3 text-sm text-zinc-700", children: [
|
|
126
|
-
/* @__PURE__ */ jsxs(
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
142
|
+
/* @__PURE__ */ jsxs(
|
|
143
|
+
"label",
|
|
144
|
+
{
|
|
145
|
+
"data-field-key": "rendererCopyable",
|
|
146
|
+
class: "flex items-center justify-between gap-3 py-1",
|
|
147
|
+
children: [
|
|
148
|
+
/* @__PURE__ */ jsxs("div", { class: "flex flex-col gap-1", children: [
|
|
149
|
+
/* @__PURE__ */ jsx("span", { class: "text-sm font-medium text-zinc-800", children: t("copyable") }),
|
|
150
|
+
/* @__PURE__ */ jsx("span", { class: "text-xs text-zinc-500", children: t("copyable-description") })
|
|
151
|
+
] }),
|
|
152
|
+
/* @__PURE__ */ jsx(
|
|
153
|
+
Switch,
|
|
154
|
+
{
|
|
155
|
+
modelValue: Boolean(value().copyable),
|
|
156
|
+
"onUpdate:modelValue": (...args) => update({ copyable: args[0] === true })
|
|
157
|
+
}
|
|
158
|
+
)
|
|
159
|
+
]
|
|
160
|
+
}
|
|
161
|
+
),
|
|
139
162
|
/* @__PURE__ */ jsx(
|
|
140
163
|
ExpressionEditor,
|
|
141
164
|
{
|
|
@@ -151,25 +174,23 @@ const TableRendererTextConfig = defineComponent({
|
|
|
151
174
|
),
|
|
152
175
|
/* @__PURE__ */ jsxs("label", { class: "flex flex-col gap-1", children: [
|
|
153
176
|
/* @__PURE__ */ jsx("span", { class: "text-xs font-medium text-zinc-500", children: t("align") }),
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
"
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
update({ align: nextValue });
|
|
164
|
-
}
|
|
165
|
-
},
|
|
166
|
-
children: [
|
|
167
|
-
/* @__PURE__ */ jsx(NativeSelectOption, { value: "left", children: t("align-left") }),
|
|
168
|
-
/* @__PURE__ */ jsx(NativeSelectOption, { value: "center", children: t("align-center") }),
|
|
169
|
-
/* @__PURE__ */ jsx(NativeSelectOption, { value: "right", children: t("align-right") })
|
|
170
|
-
]
|
|
177
|
+
h(NativeSelect, {
|
|
178
|
+
"data-field-key": "rendererAlign",
|
|
179
|
+
"modelValue": value().align ?? "left",
|
|
180
|
+
"class": "w-full",
|
|
181
|
+
"onUpdate:modelValue": (...args) => {
|
|
182
|
+
const nextValue = args[0];
|
|
183
|
+
if (nextValue === "left" || nextValue === "center" || nextValue === "right") {
|
|
184
|
+
update({ align: nextValue });
|
|
185
|
+
}
|
|
171
186
|
}
|
|
172
|
-
|
|
187
|
+
}, {
|
|
188
|
+
default: () => [
|
|
189
|
+
h(NativeSelectOption, { value: "left" }, { default: () => t("align-left") }),
|
|
190
|
+
h(NativeSelectOption, { value: "center" }, { default: () => t("align-center") }),
|
|
191
|
+
h(NativeSelectOption, { value: "right" }, { default: () => t("align-right") })
|
|
192
|
+
]
|
|
193
|
+
})
|
|
173
194
|
] })
|
|
174
195
|
] });
|
|
175
196
|
}
|
|
@@ -189,20 +210,27 @@ const TableRendererSelectionConfig = defineComponent({
|
|
|
189
210
|
const update = (patch) => {
|
|
190
211
|
emit("update:modelValue", { ...value(), ...patch });
|
|
191
212
|
};
|
|
192
|
-
return () => /* @__PURE__ */ jsx("div", { class: "flex flex-col gap-3 text-sm text-zinc-700", children: /* @__PURE__ */ jsxs(
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
213
|
+
return () => /* @__PURE__ */ jsx("div", { class: "flex flex-col gap-3 text-sm text-zinc-700", children: /* @__PURE__ */ jsxs(
|
|
214
|
+
"label",
|
|
215
|
+
{
|
|
216
|
+
"data-field-key": "rendererSelectionCrossPage",
|
|
217
|
+
class: "flex items-center gap-2 select-none",
|
|
218
|
+
children: [
|
|
219
|
+
/* @__PURE__ */ jsx(
|
|
220
|
+
"input",
|
|
221
|
+
{
|
|
222
|
+
type: "checkbox",
|
|
223
|
+
checked: Boolean(value().crossPage),
|
|
224
|
+
onInput: (e) => {
|
|
225
|
+
if (e.target instanceof HTMLInputElement)
|
|
226
|
+
update({ crossPage: e.target.checked });
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
),
|
|
230
|
+
/* @__PURE__ */ jsx("span", { children: t("selection-cross-page") })
|
|
231
|
+
]
|
|
232
|
+
}
|
|
233
|
+
) });
|
|
206
234
|
}
|
|
207
235
|
});
|
|
208
236
|
const TableRendererDateConfig = defineComponent({
|
|
@@ -264,19 +292,64 @@ const TableRendererMarkdownConfig = defineComponent({
|
|
|
264
292
|
clearValidation: () => void 0,
|
|
265
293
|
validate: () => true
|
|
266
294
|
});
|
|
267
|
-
return () => /* @__PURE__ */
|
|
268
|
-
/* @__PURE__ */
|
|
295
|
+
return () => /* @__PURE__ */ jsxs("div", { class: "flex flex-col gap-3 text-sm text-zinc-700", children: [
|
|
296
|
+
/* @__PURE__ */ jsxs("div", { class: "flex flex-col gap-1", children: [
|
|
297
|
+
/* @__PURE__ */ jsx("span", { class: "text-xs font-medium text-zinc-500", children: t("markdown") }),
|
|
298
|
+
/* @__PURE__ */ jsx("span", { class: "text-sm text-zinc-500", children: t("markdown-description", { expression: MARKDOWN_EXPRESSION_EXAMPLE }) })
|
|
299
|
+
] }),
|
|
269
300
|
/* @__PURE__ */ jsx(
|
|
270
|
-
|
|
301
|
+
Locale,
|
|
271
302
|
{
|
|
272
303
|
"data-field-key": "rendererMarkdownSource",
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
modelValue: value().source
|
|
276
|
-
"onUpdate:modelValue": (nextValue) => update({ source:
|
|
304
|
+
"data-slot": "table-renderer-markdown-source-locale",
|
|
305
|
+
multiline: true,
|
|
306
|
+
modelValue: value().source,
|
|
307
|
+
"onUpdate:modelValue": (nextValue) => update({ source: hasVisibleLocaleValue(nextValue) ? nextValue : void 0 })
|
|
277
308
|
}
|
|
278
309
|
)
|
|
279
|
-
] })
|
|
310
|
+
] });
|
|
311
|
+
}
|
|
312
|
+
});
|
|
313
|
+
const TableRendererMarkdownCell = defineComponent({
|
|
314
|
+
name: "TableRendererMarkdownCell",
|
|
315
|
+
props: {
|
|
316
|
+
source: {
|
|
317
|
+
type: Array,
|
|
318
|
+
default: void 0
|
|
319
|
+
},
|
|
320
|
+
fallbackSource: {
|
|
321
|
+
type: String,
|
|
322
|
+
required: true
|
|
323
|
+
},
|
|
324
|
+
row: {
|
|
325
|
+
default: void 0
|
|
326
|
+
},
|
|
327
|
+
index: {
|
|
328
|
+
type: Number,
|
|
329
|
+
required: true
|
|
330
|
+
},
|
|
331
|
+
id: {
|
|
332
|
+
type: String,
|
|
333
|
+
required: true
|
|
334
|
+
}
|
|
335
|
+
},
|
|
336
|
+
setup(props) {
|
|
337
|
+
const { locale } = useI18n();
|
|
338
|
+
const { $md } = useNuxtApp();
|
|
339
|
+
return () => {
|
|
340
|
+
const source = getLocalizedText(props.source, locale.value) ?? props.fallbackSource;
|
|
341
|
+
return /* @__PURE__ */ jsx("div", { class: "relative w-full py-2 px-1 flex items-center justify-center text-xs", children: /* @__PURE__ */ jsx(
|
|
342
|
+
"span",
|
|
343
|
+
{
|
|
344
|
+
class: "prose prose-zinc text-xs",
|
|
345
|
+
innerHTML: $md.inline`${source}`({
|
|
346
|
+
row: props.row,
|
|
347
|
+
index: BigInt(props.index),
|
|
348
|
+
id: props.id
|
|
349
|
+
})
|
|
350
|
+
}
|
|
351
|
+
) });
|
|
352
|
+
};
|
|
280
353
|
}
|
|
281
354
|
});
|
|
282
355
|
const NoOptionsConfig = defineComponent({
|
|
@@ -348,6 +421,7 @@ defineTableRenderer(
|
|
|
348
421
|
options.copyable && !isEmpty ? /* @__PURE__ */ jsx(
|
|
349
422
|
Button,
|
|
350
423
|
{
|
|
424
|
+
"aria-label": getTableRendererConfigText("copy-cell-value"),
|
|
351
425
|
class: "p-1 w-6 h-6 flex items-center justify-center right-1 top-1/2 -translate-y-1/2 transform-3d group-hover:opacity-100 opacity-0 absolute transition-opacity duration-180",
|
|
352
426
|
size: "xs",
|
|
353
427
|
onClick: onCopy,
|
|
@@ -358,7 +432,10 @@ defineTableRenderer(
|
|
|
358
432
|
}
|
|
359
433
|
);
|
|
360
434
|
},
|
|
361
|
-
config: TableRendererTextConfig
|
|
435
|
+
config: TableRendererTextConfig,
|
|
436
|
+
columnDefOverrides: {
|
|
437
|
+
sortingFn: "alphanumeric"
|
|
438
|
+
}
|
|
362
439
|
}
|
|
363
440
|
);
|
|
364
441
|
defineTableRenderer(
|
|
@@ -421,6 +498,7 @@ defineTableRenderer(
|
|
|
421
498
|
{
|
|
422
499
|
variant: "ghost",
|
|
423
500
|
class: "cursor-pointer hover:bg-transparent text-lg",
|
|
501
|
+
"aria-label": ctx.row.getIsExpanded() ? getTableRendererConfigText("collapse-row") : getTableRendererConfigText("expand-row"),
|
|
424
502
|
onClick: ctx.row.getToggleExpandedHandler(),
|
|
425
503
|
children: /* @__PURE__ */ jsx(Icon, { icon: ctx.row.getIsExpanded() ? "fluent:subtract-square-20-regular" : "fluent:add-square-20-regular" })
|
|
426
504
|
}
|
|
@@ -432,6 +510,7 @@ defineTableRenderer(
|
|
|
432
510
|
variant: "ghost",
|
|
433
511
|
size: "xs",
|
|
434
512
|
class: "cursor-pointer hover:bg-transparent text-lg",
|
|
513
|
+
"aria-label": ctx.table.getIsAllRowsExpanded() ? getTableRendererConfigText("collapse-all-rows") : getTableRendererConfigText("expand-all-rows"),
|
|
435
514
|
onClick: ctx.table.getToggleAllRowsExpandedHandler(),
|
|
436
515
|
children: /* @__PURE__ */ jsx(Icon, { icon: ctx.table.getIsAllRowsExpanded() ? "fluent:subtract-square-20-regular" : "fluent:add-square-20-regular" })
|
|
437
516
|
}
|
|
@@ -491,23 +570,20 @@ defineTableRenderer(
|
|
|
491
570
|
defineTableRenderer(
|
|
492
571
|
"table.renderer.markdown",
|
|
493
572
|
{
|
|
494
|
-
source:
|
|
573
|
+
source: localeC.optional()
|
|
495
574
|
},
|
|
496
575
|
{
|
|
497
576
|
cell: ({ ctx, options }) => {
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
return /* @__PURE__ */ jsx("div", { class: "relative w-full py-2 px-1 flex items-center justify-center text-xs", children: /* @__PURE__ */ jsx(
|
|
501
|
-
"span",
|
|
577
|
+
return /* @__PURE__ */ jsx(
|
|
578
|
+
TableRendererMarkdownCell,
|
|
502
579
|
{
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
})
|
|
580
|
+
source: options.source,
|
|
581
|
+
fallbackSource: String(ctx.cell.getValue()),
|
|
582
|
+
row: ctx.row.original,
|
|
583
|
+
index: ctx.row.index,
|
|
584
|
+
id: ctx.column.id
|
|
509
585
|
}
|
|
510
|
-
)
|
|
586
|
+
);
|
|
511
587
|
},
|
|
512
588
|
config: TableRendererMarkdownConfig
|
|
513
589
|
}
|
|
@@ -2,7 +2,7 @@ import type { CellContext, ColumnDef, HeaderContext, RowData } from '@tanstack/v
|
|
|
2
2
|
import type { VNodeChild } from 'vue';
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
export type TableRendererId = string;
|
|
5
|
-
export type TableRendererColumnDefOverrides<TData extends RowData = unknown> = Partial<Pick<ColumnDef<TData, unknown>, 'enableResizing' | 'enableSorting' | 'enableMultiSort' | 'enablePinning' | 'size' | 'meta'>>;
|
|
5
|
+
export type TableRendererColumnDefOverrides<TData extends RowData = unknown> = Partial<Pick<ColumnDef<TData, unknown>, 'enableResizing' | 'enableSorting' | 'enableMultiSort' | 'enablePinning' | 'sortingFn' | 'size' | 'meta'>>;
|
|
6
6
|
export type TableRendererCellArgs<TData extends RowData, TValue, TOptions> = Readonly<{
|
|
7
7
|
ctx: CellContext<TData, TValue>;
|
|
8
8
|
options: TOptions;
|
|
@@ -27,6 +27,8 @@ export declare const localeC: z.ZodReadonly<z.ZodArray<z.ZodObject<{
|
|
|
27
27
|
export type LocaleItem = z.infer<typeof localeItemC>;
|
|
28
28
|
export type LocaleCode = z.infer<typeof localeCodeC>;
|
|
29
29
|
export type LocaleValue = z.infer<typeof localeC>;
|
|
30
|
+
export declare function hasVisibleLocaleValue(value: LocaleValue | undefined): boolean;
|
|
31
|
+
export declare function getLocalizedText(messages: LocaleValue | undefined, locale: string): string | undefined;
|
|
30
32
|
export declare const dotPropC: z.ZodString;
|
|
31
33
|
export declare const expressionC: (tt: ReadonlyArray<RegExp | string> | string | RegExp, vars?: Record<string, string>) => z.ZodString;
|
|
32
34
|
export {};
|
|
@@ -31,6 +31,19 @@ export const localeC = z.array(localeItemC).readonly().superRefine((value, ctx)
|
|
|
31
31
|
});
|
|
32
32
|
}
|
|
33
33
|
}).describe("\u672C\u5730\u5316\u5185\u5BB9\u5217\u8868\uFF0C\u5FC5\u987B\u5305\u542B\u4E14\u53EA\u80FD\u5305\u542B\u4E00\u4E2A zh \u8BED\u8A00");
|
|
34
|
+
export function hasVisibleLocaleValue(value) {
|
|
35
|
+
return value?.some((item) => item.message.trim().length > 0) ?? false;
|
|
36
|
+
}
|
|
37
|
+
export function getLocalizedText(messages, locale) {
|
|
38
|
+
if (!messages) {
|
|
39
|
+
return void 0;
|
|
40
|
+
}
|
|
41
|
+
const localizedMessage = messages.find((message) => message.locale === locale && message.message.trim().length > 0);
|
|
42
|
+
if (localizedMessage) {
|
|
43
|
+
return localizedMessage.message;
|
|
44
|
+
}
|
|
45
|
+
return messages.find((message) => message.message.trim().length > 0)?.message;
|
|
46
|
+
}
|
|
34
47
|
export const dotPropC = z.string().refine(
|
|
35
48
|
(val) => {
|
|
36
49
|
if (val.length === 0) return false;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shwfed/nuxt",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.11",
|
|
4
4
|
"description": "",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -33,6 +33,8 @@
|
|
|
33
33
|
"release:major": "npm run lint && npm run test && npm run prepack && changelogen --major --release --push && npm publish",
|
|
34
34
|
"lint": "eslint .",
|
|
35
35
|
"test": "vitest run",
|
|
36
|
+
"test:e2e": "playwright test",
|
|
37
|
+
"test:e2e:ui": "playwright test --ui",
|
|
36
38
|
"test:watch": "vitest watch",
|
|
37
39
|
"test:types": "vue-tsc --noEmit && cd playground && vue-tsc --noEmit"
|
|
38
40
|
},
|
|
@@ -41,6 +43,7 @@
|
|
|
41
43
|
"@fontsource-variable/noto-sans": "^5.2.10",
|
|
42
44
|
"@fontsource-variable/noto-sans-jp": "^5.2.10",
|
|
43
45
|
"@fontsource-variable/noto-sans-sc": "^5.2.10",
|
|
46
|
+
"@iconify-json/fluent": "^1.2.40",
|
|
44
47
|
"@iconify/vue": "^5.0.0",
|
|
45
48
|
"@intlify/unplugin-vue-i18n": "^11.0.3",
|
|
46
49
|
"@nuxt/fonts": "^0.14.0",
|
|
@@ -77,6 +80,7 @@
|
|
|
77
80
|
"@nuxt/module-builder": "^1.0.2",
|
|
78
81
|
"@nuxt/schema": "^4.3.0",
|
|
79
82
|
"@nuxt/test-utils": "^3.23.0",
|
|
83
|
+
"@playwright/test": "^1.58.2",
|
|
80
84
|
"@types/markdown-it": "^14.1.2",
|
|
81
85
|
"@types/node": "latest",
|
|
82
86
|
"@vue/test-utils": "^2.4.6",
|
|
@@ -86,6 +90,7 @@
|
|
|
86
90
|
"jsdom": "^28.1.0",
|
|
87
91
|
"lint-staged": "^16.2.7",
|
|
88
92
|
"nuxt": "^4.3.0",
|
|
93
|
+
"playwright-core": "^1.58.2",
|
|
89
94
|
"simple-git-hooks": "^2.13.1",
|
|
90
95
|
"typescript": "~5.9.3",
|
|
91
96
|
"vitest": "^4.0.18",
|
|
@@ -99,10 +104,5 @@
|
|
|
99
104
|
"simple-git-hooks": {
|
|
100
105
|
"pre-commit": "bunx lint-staged",
|
|
101
106
|
"commit-msg": "bunx commitlint --edit \"$1\""
|
|
102
|
-
},
|
|
103
|
-
"lint-staged": {
|
|
104
|
-
"*.{js,jsx,ts,tsx,vue}": [
|
|
105
|
-
"eslint --fix"
|
|
106
|
-
]
|
|
107
107
|
}
|
|
108
108
|
}
|