@shwfed/nuxt 0.7.9 → 0.7.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.
Files changed (95) hide show
  1. package/dist/module.json +1 -1
  2. package/dist/runtime/components/app.d.vue.ts +7 -56
  3. package/dist/runtime/components/app.vue +17 -404
  4. package/dist/runtime/components/app.vue.d.ts +7 -56
  5. package/dist/runtime/components/fields.d.vue.ts +154 -132
  6. package/dist/runtime/components/fields.vue +30 -295
  7. package/dist/runtime/components/fields.vue.d.ts +154 -132
  8. package/dist/runtime/components/table.d.vue.ts +63 -59
  9. package/dist/runtime/components/table.vue +52 -617
  10. package/dist/runtime/components/table.vue.d.ts +63 -59
  11. package/dist/runtime/components/ui/app/App.d.vue.ts +86 -0
  12. package/dist/runtime/components/ui/app/App.vue +414 -0
  13. package/dist/runtime/components/ui/app/App.vue.d.ts +86 -0
  14. package/dist/runtime/components/ui/checkbox/Checkbox.vue +6 -2
  15. package/dist/runtime/components/ui/expression-editor/ExpressionEditor.d.vue.ts +30 -0
  16. package/dist/runtime/components/ui/expression-editor/ExpressionEditor.vue +87 -0
  17. package/dist/runtime/components/ui/expression-editor/ExpressionEditor.vue.d.ts +30 -0
  18. package/dist/runtime/components/ui/expression-editor/index.d.ts +1 -0
  19. package/dist/runtime/components/ui/expression-editor/index.js +1 -0
  20. package/dist/runtime/components/ui/field/FieldContent.vue +1 -1
  21. package/dist/runtime/components/ui/field/FieldError.vue +2 -2
  22. package/dist/runtime/components/ui/fields/Fields.d.vue.ts +376 -0
  23. package/dist/runtime/components/ui/fields/Fields.vue +441 -0
  24. package/dist/runtime/components/ui/fields/Fields.vue.d.ts +376 -0
  25. package/dist/runtime/components/ui/fields-configurator/FieldsConfiguratorDialog.d.vue.ts +163 -0
  26. package/dist/runtime/components/ui/fields-configurator/FieldsConfiguratorDialog.vue +363 -0
  27. package/dist/runtime/components/ui/fields-configurator/FieldsConfiguratorDialog.vue.d.ts +163 -0
  28. package/dist/runtime/components/ui/input/Input.d.vue.ts +1 -0
  29. package/dist/runtime/components/ui/input/Input.vue +2 -0
  30. package/dist/runtime/components/ui/input/Input.vue.d.ts +1 -0
  31. package/dist/runtime/components/ui/input-group/InputGroupAddon.vue +4 -1
  32. package/dist/runtime/components/ui/input-group/InputGroupCombobox.d.vue.ts +8 -3
  33. package/dist/runtime/components/ui/input-group/InputGroupCombobox.vue +8 -3
  34. package/dist/runtime/components/ui/input-group/InputGroupCombobox.vue.d.ts +8 -3
  35. package/dist/runtime/components/ui/input-group/InputGroupComboboxInput.d.vue.ts +8 -1
  36. package/dist/runtime/components/ui/input-group/InputGroupComboboxInput.vue +10 -1
  37. package/dist/runtime/components/ui/input-group/InputGroupComboboxInput.vue.d.ts +8 -1
  38. package/dist/runtime/components/ui/input-group/InputGroupNumberField.d.vue.ts +5 -2
  39. package/dist/runtime/components/ui/input-group/InputGroupNumberField.vue +9 -3
  40. package/dist/runtime/components/ui/input-group/InputGroupNumberField.vue.d.ts +5 -2
  41. package/dist/runtime/components/ui/input-group/index.js +1 -1
  42. package/dist/runtime/components/ui/locale/Locale.d.vue.ts +20 -0
  43. package/dist/runtime/components/ui/locale/Locale.vue +291 -0
  44. package/dist/runtime/components/ui/locale/Locale.vue.d.ts +20 -0
  45. package/dist/runtime/components/ui/locale/index.d.ts +1 -0
  46. package/dist/runtime/components/ui/locale/index.js +1 -0
  47. package/dist/runtime/components/ui/native-select/NativeSelectOption.d.vue.ts +1 -0
  48. package/dist/runtime/components/ui/native-select/NativeSelectOption.vue +4 -1
  49. package/dist/runtime/components/ui/native-select/NativeSelectOption.vue.d.ts +1 -0
  50. package/dist/runtime/components/ui/number-field/NumberFieldInput.vue +1 -1
  51. package/dist/runtime/components/ui/switch/Switch.vue +1 -1
  52. package/dist/runtime/components/ui/table/Table.d.vue.ts +81 -0
  53. package/dist/runtime/components/ui/table/Table.vue +792 -0
  54. package/dist/runtime/components/ui/table/Table.vue.d.ts +81 -0
  55. package/dist/runtime/components/ui/table/schema.d.ts +48 -0
  56. package/dist/runtime/components/ui/table/schema.js +126 -0
  57. package/dist/runtime/components/ui/table-configurator/TableConfiguratorDialog.d.vue.ts +62 -0
  58. package/dist/runtime/components/ui/table-configurator/TableConfiguratorDialog.vue +2233 -0
  59. package/dist/runtime/components/ui/table-configurator/TableConfiguratorDialog.vue.d.ts +62 -0
  60. package/dist/runtime/components/ui/table-configurator/menu.d.ts +37 -0
  61. package/dist/runtime/components/ui/table-configurator/menu.js +227 -0
  62. package/dist/runtime/components/ui/tabs/Tabs.d.vue.ts +24 -0
  63. package/dist/runtime/components/ui/tabs/Tabs.vue +30 -0
  64. package/dist/runtime/components/ui/tabs/Tabs.vue.d.ts +24 -0
  65. package/dist/runtime/components/ui/tabs/TabsContent.d.vue.ts +18 -0
  66. package/dist/runtime/components/ui/tabs/TabsContent.vue +23 -0
  67. package/dist/runtime/components/ui/tabs/TabsContent.vue.d.ts +18 -0
  68. package/dist/runtime/components/ui/tabs/TabsList.d.vue.ts +18 -0
  69. package/dist/runtime/components/ui/tabs/TabsList.vue +25 -0
  70. package/dist/runtime/components/ui/tabs/TabsList.vue.d.ts +18 -0
  71. package/dist/runtime/components/ui/tabs/TabsTrigger.d.vue.ts +18 -0
  72. package/dist/runtime/components/ui/tabs/TabsTrigger.vue +27 -0
  73. package/dist/runtime/components/ui/tabs/TabsTrigger.vue.d.ts +18 -0
  74. package/dist/runtime/components/ui/tabs/index.d.ts +4 -0
  75. package/dist/runtime/components/ui/tabs/index.js +4 -0
  76. package/dist/runtime/components/ui/textarea/Textarea.d.vue.ts +1 -0
  77. package/dist/runtime/components/ui/textarea/Textarea.vue +3 -1
  78. package/dist/runtime/components/ui/textarea/Textarea.vue.d.ts +1 -0
  79. package/dist/runtime/components/ui/toggle/Toggle.d.vue.ts +34 -0
  80. package/dist/runtime/components/ui/toggle/Toggle.vue +32 -0
  81. package/dist/runtime/components/ui/toggle/Toggle.vue.d.ts +34 -0
  82. package/dist/runtime/components/ui/toggle/index.d.ts +7 -0
  83. package/dist/runtime/components/ui/toggle/index.js +22 -0
  84. package/dist/runtime/composables/useTableRenderers.d.ts +2 -1
  85. package/dist/runtime/composables/useTableRenderers.js +2 -1
  86. package/dist/runtime/style.css +1 -1
  87. package/dist/runtime/table-renderers/builtins.js +213 -98
  88. package/dist/runtime/table-renderers/registry.d.ts +1 -0
  89. package/dist/runtime/table-renderers/registry.js +3 -0
  90. package/dist/runtime/utils/coders.d.ts +27 -2
  91. package/dist/runtime/utils/coders.js +27 -2
  92. package/package.json +3 -1
  93. /package/dist/runtime/components/{logo.d.vue.ts → ui/logo/Logo.d.vue.ts} +0 -0
  94. /package/dist/runtime/components/{logo.vue → ui/logo/Logo.vue} +0 -0
  95. /package/dist/runtime/components/{logo.vue.d.ts → ui/logo/Logo.vue.d.ts} +0 -0
@@ -0,0 +1,34 @@
1
+ import type { ToggleProps } from 'reka-ui';
2
+ import type { HTMLAttributes } from 'vue';
3
+ import type { ToggleVariants } from '.';
4
+ type __VLS_Props = ToggleProps & {
5
+ class?: HTMLAttributes['class'];
6
+ variant?: ToggleVariants['variant'];
7
+ size?: ToggleVariants['size'];
8
+ };
9
+ declare var __VLS_8: {
10
+ modelValue: boolean;
11
+ state: "off" | "on";
12
+ pressed: boolean;
13
+ disabled: boolean;
14
+ };
15
+ type __VLS_Slots = {} & {
16
+ default?: (props: typeof __VLS_8) => any;
17
+ };
18
+ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
19
+ "update:modelValue": (value: boolean) => any;
20
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
21
+ "onUpdate:modelValue"?: ((value: boolean) => any) | undefined;
22
+ }>, {
23
+ disabled: boolean;
24
+ size: "default" | "sm" | "lg" | null;
25
+ variant: "default" | "outline" | null;
26
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
27
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
28
+ declare const _default: typeof __VLS_export;
29
+ export default _default;
30
+ type __VLS_WithSlots<T, S> = T & {
31
+ new (): {
32
+ $slots: S;
33
+ };
34
+ };
@@ -0,0 +1,32 @@
1
+ <script setup>
2
+ import { reactiveOmit } from "@vueuse/core";
3
+ import { Toggle, useForwardPropsEmits } from "reka-ui";
4
+ import { cn } from "../../../utils/cn";
5
+ import { toggleVariants } from ".";
6
+ const props = defineProps({
7
+ defaultValue: { type: Boolean, required: false },
8
+ modelValue: { type: [Boolean, null], required: false },
9
+ disabled: { type: Boolean, required: false, default: false },
10
+ asChild: { type: Boolean, required: false },
11
+ as: { type: null, required: false },
12
+ name: { type: String, required: false },
13
+ required: { type: Boolean, required: false },
14
+ class: { type: null, required: false },
15
+ variant: { type: null, required: false, default: "default" },
16
+ size: { type: null, required: false, default: "default" }
17
+ });
18
+ const emits = defineEmits(["update:modelValue"]);
19
+ const delegatedProps = reactiveOmit(props, "class", "size", "variant");
20
+ const forwarded = useForwardPropsEmits(delegatedProps, emits);
21
+ </script>
22
+
23
+ <template>
24
+ <Toggle
25
+ v-slot="slotProps"
26
+ data-slot="toggle"
27
+ v-bind="forwarded"
28
+ :class="cn(toggleVariants({ variant, size }), props.class)"
29
+ >
30
+ <slot v-bind="slotProps" />
31
+ </Toggle>
32
+ </template>
@@ -0,0 +1,34 @@
1
+ import type { ToggleProps } from 'reka-ui';
2
+ import type { HTMLAttributes } from 'vue';
3
+ import type { ToggleVariants } from '.';
4
+ type __VLS_Props = ToggleProps & {
5
+ class?: HTMLAttributes['class'];
6
+ variant?: ToggleVariants['variant'];
7
+ size?: ToggleVariants['size'];
8
+ };
9
+ declare var __VLS_8: {
10
+ modelValue: boolean;
11
+ state: "off" | "on";
12
+ pressed: boolean;
13
+ disabled: boolean;
14
+ };
15
+ type __VLS_Slots = {} & {
16
+ default?: (props: typeof __VLS_8) => any;
17
+ };
18
+ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
19
+ "update:modelValue": (value: boolean) => any;
20
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
21
+ "onUpdate:modelValue"?: ((value: boolean) => any) | undefined;
22
+ }>, {
23
+ disabled: boolean;
24
+ size: "default" | "sm" | "lg" | null;
25
+ variant: "default" | "outline" | null;
26
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
27
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
28
+ declare const _default: typeof __VLS_export;
29
+ export default _default;
30
+ type __VLS_WithSlots<T, S> = T & {
31
+ new (): {
32
+ $slots: S;
33
+ };
34
+ };
@@ -0,0 +1,7 @@
1
+ import type { VariantProps } from 'class-variance-authority';
2
+ export { default as Toggle } from './Toggle.vue.js';
3
+ export declare const toggleVariants: (props?: ({
4
+ variant?: "default" | "outline" | null | undefined;
5
+ size?: "default" | "sm" | "lg" | null | undefined;
6
+ } & import("class-variance-authority/types").ClassProp) | undefined) => string;
7
+ export type ToggleVariants = VariantProps<typeof toggleVariants>;
@@ -0,0 +1,22 @@
1
+ import { cva } from "class-variance-authority";
2
+ export { default as Toggle } from "./Toggle.vue";
3
+ export const toggleVariants = cva(
4
+ "inline-flex cursor-pointer items-center justify-center gap-2 whitespace-nowrap rounded-sm text-sm font-medium transition-all duration-180 outline-none disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 [&_svg]:shrink-0",
5
+ {
6
+ variants: {
7
+ variant: {
8
+ default: "bg-transparent text-zinc-600 hover:bg-zinc-50 hover:text-zinc-900 data-[state=on]:bg-[color-mix(in_srgb,var(--primary)_12%,white)] data-[state=on]:text-(--primary)",
9
+ outline: "border border-zinc-200 bg-white text-zinc-700 shadow-xs hover:bg-zinc-50 hover:text-zinc-900 data-[state=on]:border-[color-mix(in_srgb,var(--primary)_50%,white)] data-[state=on]:bg-[color-mix(in_srgb,var(--primary)_12%,white)] data-[state=on]:text-(--primary)"
10
+ },
11
+ size: {
12
+ default: "h-9 min-w-9 px-3",
13
+ sm: "h-8 min-w-8 px-2.5 text-xs",
14
+ lg: "h-10 min-w-10 px-4"
15
+ }
16
+ },
17
+ defaultVariants: {
18
+ variant: "default",
19
+ size: "default"
20
+ }
21
+ }
22
+ );
@@ -1,8 +1,9 @@
1
1
  import '../table-renderers/builtins.js';
2
- import { getTableRenderer, resolveTableRenderer } from '../table-renderers/registry.js';
2
+ import { getTableRenderer, listTableRenderers, resolveTableRenderer } from '../table-renderers/registry.js';
3
3
  export { defineTableRenderer } from '../table-renderers/registry.js';
4
4
  export type { TableRenderer, TableRendererCellArgs, TableRendererColumnDefOverrides, TableRendererConfigComponent, TableRendererFooterArgs, TableRendererHeaderArgs, TableRendererId, } from '../table-renderers/registry.js';
5
5
  export declare function useTableRenderers(): {
6
6
  getTableRenderer: typeof getTableRenderer;
7
+ listTableRenderers: typeof listTableRenderers;
7
8
  resolveTableRenderer: typeof resolveTableRenderer;
8
9
  };
@@ -1,9 +1,10 @@
1
1
  import "../table-renderers/builtins";
2
- import { getTableRenderer, resolveTableRenderer } from "../table-renderers/registry.js";
2
+ import { getTableRenderer, listTableRenderers, resolveTableRenderer } from "../table-renderers/registry.js";
3
3
  export { defineTableRenderer } from "../table-renderers/registry.js";
4
4
  export function useTableRenderers() {
5
5
  return {
6
6
  getTableRenderer,
7
+ listTableRenderers,
7
8
  resolveTableRenderer
8
9
  };
9
10
  }
@@ -1 +1 @@
1
- @import "tailwindcss";@plugin "@tailwindcss/typography";@source "components";@theme{--font-sans:"Noto Sans","Noto Sans SC","Noto Sans JP","sans-serif";--font-mono:"Berkeley Mono","Fira Mono","monospace"}
1
+ @import "tailwindcss";@plugin "@tailwindcss/typography";@source "components";@source "table-renderers";@theme{--font-sans:"Noto Sans","Noto Sans SC","Noto Sans JP","sans-serif";--font-mono:"Berkeley Mono","Fira Mono","monospace"}
@@ -1,17 +1,101 @@
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 } from "vue";
4
+ import { defineComponent, ref } from "vue";
5
+ import { useI18n } from "vue-i18n";
5
6
  import { z } from "zod";
6
7
  import { defineTableRenderer } from "./registry.js";
7
8
  import { useNuxtApp } from "#app";
9
+ import { expressionC } from "../utils/coders.js";
8
10
  import { Button } from "../components/ui/button/index.js";
9
11
  import { Checkbox } from "../components/ui/checkbox/index.js";
12
+ import ExpressionEditor from "../components/ui/expression-editor/ExpressionEditor.vue";
13
+ import { Input } from "../components/ui/input/index.js";
14
+ import { NativeSelect, NativeSelectOption } from "../components/ui/native-select/index.js";
15
+ import { Switch } from "../components/ui/switch/index.js";
16
+ import { Textarea } from "../components/ui/textarea/index.js";
10
17
  const JUSTIFY_CLASS = {
11
18
  left: "justify-start",
12
19
  center: "justify-center",
13
20
  right: "justify-end"
14
21
  };
22
+ const TABLE_RENDERER_CONFIG_MESSAGES = {
23
+ zh: {
24
+ "copyable": "\u53EF\u590D\u5236",
25
+ "copyable-description": "\u4E3A\u975E\u7A7A\u5355\u5143\u683C\u663E\u793A\u590D\u5236\u64CD\u4F5C\u3002",
26
+ "copy-expression": "\u590D\u5236\u8868\u8FBE\u5F0F",
27
+ "copy-expression-description": "\u590D\u5236\u65F6\u4F7F\u7528\u7684 CEL \u8868\u8FBE\u5F0F\u3002\u53D8\u91CF\uFF1Arow\u3001index\u3002",
28
+ "copy-expression-placeholder": "\u8F93\u5165\u590D\u5236 CEL \u8868\u8FBE\u5F0F",
29
+ "align": "\u5BF9\u9F50",
30
+ "align-left": "\u5DE6\u5BF9\u9F50",
31
+ "align-center": "\u5C45\u4E2D",
32
+ "align-right": "\u53F3\u5BF9\u9F50",
33
+ "selection-cross-page": "\u8DE8\u9875\u5168\u9009",
34
+ "format": "\u683C\u5F0F",
35
+ "preview": "\u9884\u89C8",
36
+ "markdown": "Markdown",
37
+ "markdown-placeholder": "Markdown \u6E90\u7801\uFF08\u7559\u7A7A\u5219\u4F7F\u7528\u5355\u5143\u683C\u503C\uFF09",
38
+ "no-options": "\u65E0\u53EF\u914D\u7F6E\u9879\u3002",
39
+ "select-all-rows-on-page": "\u9009\u62E9\u5F53\u524D\u9875\u5168\u90E8\u884C",
40
+ "select-all-rows": "\u9009\u62E9\u5168\u90E8\u884C"
41
+ },
42
+ ja: {
43
+ "copyable": "\u30B3\u30D4\u30FC\u53EF\u80FD",
44
+ "copyable-description": "\u7A7A\u3067\u306A\u3044\u30BB\u30EB\u306B\u30B3\u30D4\u30FC\u64CD\u4F5C\u3092\u8868\u793A\u3057\u307E\u3059\u3002",
45
+ "copy-expression": "\u30B3\u30D4\u30FC\u5F0F",
46
+ "copy-expression-description": "\u30B3\u30D4\u30FC\u6642\u306B\u4F7F\u3046 CEL \u5F0F\u3067\u3059\u3002\u5909\u6570: row\u3001index\u3002",
47
+ "copy-expression-placeholder": "\u30B3\u30D4\u30FC\u7528 CEL \u5F0F\u3092\u5165\u529B",
48
+ "align": "\u914D\u7F6E",
49
+ "align-left": "\u5DE6\u5BC4\u305B",
50
+ "align-center": "\u4E2D\u592E\u63C3\u3048",
51
+ "align-right": "\u53F3\u5BC4\u305B",
52
+ "selection-cross-page": "\u30DA\u30FC\u30B8\u3092\u307E\u305F\u3044\u3067\u5168\u9078\u629E",
53
+ "format": "\u30D5\u30A9\u30FC\u30DE\u30C3\u30C8",
54
+ "preview": "\u30D7\u30EC\u30D3\u30E5\u30FC",
55
+ "markdown": "Markdown",
56
+ "markdown-placeholder": "Markdown \u30BD\u30FC\u30B9\uFF08\u7A7A\u6B04\u306E\u5834\u5408\u306F\u30BB\u30EB\u5024\u3092\u4F7F\u7528\uFF09",
57
+ "no-options": "\u8A2D\u5B9A\u53EF\u80FD\u306A\u9805\u76EE\u306F\u3042\u308A\u307E\u305B\u3093\u3002",
58
+ "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"
60
+ },
61
+ en: {
62
+ "copyable": "Copyable",
63
+ "copyable-description": "Show a copy action for non-empty cells.",
64
+ "copy-expression": "Copy expression",
65
+ "copy-expression-description": "CEL expression used when copying. Variables: row, index.",
66
+ "copy-expression-placeholder": "Enter a copy CEL expression",
67
+ "align": "Align",
68
+ "align-left": "Left",
69
+ "align-center": "Center",
70
+ "align-right": "Right",
71
+ "selection-cross-page": "Cross page select-all",
72
+ "format": "Format",
73
+ "preview": "Preview",
74
+ "markdown": "Markdown",
75
+ "markdown-placeholder": "Markdown source (leave empty to use cell value)",
76
+ "no-options": "No options.",
77
+ "select-all-rows-on-page": "Select all rows on page",
78
+ "select-all-rows": "Select all rows"
79
+ }
80
+ };
81
+ function useTableRendererConfigI18n() {
82
+ return useI18n({
83
+ inheritLocale: true,
84
+ messages: TABLE_RENDERER_CONFIG_MESSAGES
85
+ });
86
+ }
87
+ function getTableRendererConfigText(key) {
88
+ const language = navigator?.language?.toLocaleLowerCase() ?? "zh";
89
+ if (language.startsWith("ja")) {
90
+ return TABLE_RENDERER_CONFIG_MESSAGES.ja[key];
91
+ }
92
+ if (language.startsWith("en")) {
93
+ return TABLE_RENDERER_CONFIG_MESSAGES.en[key];
94
+ }
95
+ return TABLE_RENDERER_CONFIG_MESSAGES.zh[key];
96
+ }
97
+ const TEXT_RENDERER_COPY_EXPRESSION_C = expressionC(/.+/, { row: "dyn", index: "int" }).optional();
98
+ const DATE_RENDERER_PREVIEW_DATE = new Date(2025, 8, 30, 13, 59, 43);
15
99
  const TableRendererTextConfig = defineComponent({
16
100
  name: "TableRendererTextConfig",
17
101
  props: {
@@ -21,59 +105,68 @@ const TableRendererTextConfig = defineComponent({
21
105
  }
22
106
  },
23
107
  emits: ["update:modelValue"],
24
- setup(props, { emit }) {
108
+ setup(props, { emit, expose }) {
109
+ const { t } = useTableRendererConfigI18n();
110
+ const copyExpressionEditor = ref(null);
25
111
  const value = () => props.modelValue ?? {};
26
112
  const update = (patch) => {
27
113
  emit("update:modelValue", { ...value(), ...patch });
28
114
  };
115
+ function clearValidation() {
116
+ copyExpressionEditor.value?.clearValidation();
117
+ }
118
+ function validate() {
119
+ return copyExpressionEditor.value ? copyExpressionEditor.value.validate() : true;
120
+ }
121
+ expose({
122
+ clearValidation,
123
+ validate
124
+ });
29
125
  return () => /* @__PURE__ */ jsxs("div", { class: "flex flex-col gap-3 text-sm text-zinc-700", children: [
30
- /* @__PURE__ */ jsxs("label", { class: "flex items-center gap-2 select-none", children: [
31
- /* @__PURE__ */ jsx(
32
- "input",
33
- {
34
- type: "checkbox",
35
- checked: Boolean(value().copyable),
36
- onInput: (e) => {
37
- if (e.target instanceof HTMLInputElement)
38
- update({ copyable: e.target.checked });
39
- }
40
- }
41
- ),
42
- /* @__PURE__ */ jsx("span", { children: "Copyable" })
43
- ] }),
44
- /* @__PURE__ */ jsxs("label", { class: "flex flex-col gap-1", children: [
45
- /* @__PURE__ */ jsx("span", { class: "text-xs text-zinc-500", children: "Copy expression" }),
126
+ /* @__PURE__ */ jsxs("label", { class: "flex items-center justify-between gap-3 py-1", children: [
127
+ /* @__PURE__ */ jsxs("div", { class: "flex flex-col gap-1", children: [
128
+ /* @__PURE__ */ jsx("span", { class: "text-sm font-medium text-zinc-800", children: t("copyable") }),
129
+ /* @__PURE__ */ jsx("span", { class: "text-xs text-zinc-500", children: t("copyable-description") })
130
+ ] }),
46
131
  /* @__PURE__ */ jsx(
47
- "input",
132
+ Switch,
48
133
  {
49
- class: "border border-zinc-200 rounded px-2 py-1 text-sm",
50
- placeholder: "CEL expression (row, index)",
51
- value: value().copyExpression ?? "",
52
- onInput: (e) => {
53
- if (e.target instanceof HTMLInputElement)
54
- update({ copyExpression: e.target.value || null });
55
- }
134
+ modelValue: Boolean(value().copyable),
135
+ "onUpdate:modelValue": (...args) => update({ copyable: args[0] === true })
56
136
  }
57
137
  )
58
138
  ] }),
139
+ /* @__PURE__ */ jsx(
140
+ ExpressionEditor,
141
+ {
142
+ ref: copyExpressionEditor,
143
+ "data-field-key": "rendererCopyExpression",
144
+ modelValue: value().copyExpression ?? void 0,
145
+ label: t("copy-expression"),
146
+ description: t("copy-expression-description"),
147
+ placeholder: t("copy-expression-placeholder"),
148
+ schema: TEXT_RENDERER_COPY_EXPRESSION_C,
149
+ "onUpdate:modelValue": (nextValue) => update({ copyExpression: nextValue ?? null })
150
+ }
151
+ ),
59
152
  /* @__PURE__ */ jsxs("label", { class: "flex flex-col gap-1", children: [
60
- /* @__PURE__ */ jsx("span", { class: "text-xs text-zinc-500", children: "Align" }),
153
+ /* @__PURE__ */ jsx("span", { class: "text-xs font-medium text-zinc-500", children: t("align") }),
61
154
  /* @__PURE__ */ jsxs(
62
- "select",
155
+ NativeSelect,
63
156
  {
64
- class: "border border-zinc-200 rounded px-2 py-1 text-sm bg-white",
65
- value: value().align ?? "left",
66
- onChange: (e) => {
67
- if (e.target instanceof HTMLSelectElement) {
68
- const v = e.target.value;
69
- if (v === "left" || v === "center" || v === "right")
70
- update({ align: v });
157
+ "data-field-key": "rendererAlign",
158
+ modelValue: value().align ?? "left",
159
+ class: "w-full",
160
+ "onUpdate:modelValue": (...args) => {
161
+ const nextValue = args[0];
162
+ if (nextValue === "left" || nextValue === "center" || nextValue === "right") {
163
+ update({ align: nextValue });
71
164
  }
72
165
  },
73
166
  children: [
74
- /* @__PURE__ */ jsx("option", { value: "left", children: "left" }),
75
- /* @__PURE__ */ jsx("option", { value: "center", children: "center" }),
76
- /* @__PURE__ */ jsx("option", { value: "right", children: "right" })
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") })
77
170
  ]
78
171
  }
79
172
  )
@@ -91,6 +184,7 @@ const TableRendererSelectionConfig = defineComponent({
91
184
  },
92
185
  emits: ["update:modelValue"],
93
186
  setup(props, { emit }) {
187
+ const { t } = useTableRendererConfigI18n();
94
188
  const value = () => props.modelValue ?? {};
95
189
  const update = (patch) => {
96
190
  emit("update:modelValue", { ...value(), ...patch });
@@ -107,7 +201,7 @@ const TableRendererSelectionConfig = defineComponent({
107
201
  }
108
202
  }
109
203
  ),
110
- /* @__PURE__ */ jsx("span", { children: "Cross page select-all" })
204
+ /* @__PURE__ */ jsx("span", { children: t("selection-cross-page") })
111
205
  ] }) });
112
206
  }
113
207
  });
@@ -120,26 +214,35 @@ const TableRendererDateConfig = defineComponent({
120
214
  }
121
215
  },
122
216
  emits: ["update:modelValue"],
123
- setup(props, { emit }) {
217
+ setup(props, { emit, expose }) {
218
+ const { t } = useTableRendererConfigI18n();
124
219
  const value = () => props.modelValue ?? {};
125
220
  const update = (patch) => {
126
221
  emit("update:modelValue", { ...value(), ...patch });
127
222
  };
128
- return () => /* @__PURE__ */ jsx("div", { class: "flex flex-col gap-3 text-sm text-zinc-700", children: /* @__PURE__ */ jsxs("label", { class: "flex flex-col gap-1", children: [
129
- /* @__PURE__ */ jsx("span", { class: "text-xs text-zinc-500", children: "Format" }),
130
- /* @__PURE__ */ jsx(
131
- "input",
132
- {
133
- class: "border border-zinc-200 rounded px-2 py-1 text-sm",
134
- placeholder: "yyyy-MM-dd",
135
- value: value().format ?? "",
136
- onInput: (e) => {
137
- if (e.target instanceof HTMLInputElement)
138
- update({ format: e.target.value });
223
+ expose({
224
+ clearValidation: () => void 0,
225
+ validate: () => true
226
+ });
227
+ return () => /* @__PURE__ */ jsxs("div", { class: "flex flex-col gap-3 text-sm text-zinc-700", children: [
228
+ /* @__PURE__ */ jsxs("label", { class: "flex flex-col gap-1", children: [
229
+ /* @__PURE__ */ jsx("span", { class: "text-xs font-medium text-zinc-500", children: t("format") }),
230
+ /* @__PURE__ */ jsx(
231
+ Input,
232
+ {
233
+ "data-field-key": "rendererDateFormat",
234
+ placeholder: "yyyy-MM-dd",
235
+ modelValue: value().format ?? "",
236
+ "onUpdate:modelValue": (nextValue) => update({ format: String(nextValue) })
139
237
  }
140
- }
141
- )
142
- ] }) });
238
+ )
239
+ ] }),
240
+ /* @__PURE__ */ jsxs("div", { class: "rounded-md bg-zinc-50/70 px-3 py-2", children: [
241
+ /* @__PURE__ */ jsx("div", { class: "text-xs font-medium text-zinc-500", children: t("preview") }),
242
+ /* @__PURE__ */ jsx("div", { class: "mt-1 font-mono text-sm text-zinc-700", children: formatTableRendererDate(DATE_RENDERER_PREVIEW_DATE, value().format ?? "yyyy-MM-dd") }),
243
+ /* @__PURE__ */ jsx("div", { class: "mt-1 text-xs text-zinc-400", children: "2025-09-30 13:59:43" })
244
+ ] })
245
+ ] });
143
246
  }
144
247
  });
145
248
  const TableRendererMarkdownConfig = defineComponent({
@@ -151,23 +254,26 @@ const TableRendererMarkdownConfig = defineComponent({
151
254
  }
152
255
  },
153
256
  emits: ["update:modelValue"],
154
- setup(props, { emit }) {
257
+ setup(props, { emit, expose }) {
258
+ const { t } = useTableRendererConfigI18n();
155
259
  const value = () => props.modelValue ?? {};
156
260
  const update = (patch) => {
157
261
  emit("update:modelValue", { ...value(), ...patch });
158
262
  };
263
+ expose({
264
+ clearValidation: () => void 0,
265
+ validate: () => true
266
+ });
159
267
  return () => /* @__PURE__ */ jsx("div", { class: "flex flex-col gap-3 text-sm text-zinc-700", children: /* @__PURE__ */ jsxs("label", { class: "flex flex-col gap-1", children: [
160
- /* @__PURE__ */ jsx("span", { class: "text-xs text-zinc-500", children: "Source" }),
268
+ /* @__PURE__ */ jsx("span", { class: "text-xs font-medium text-zinc-500", children: t("markdown") }),
161
269
  /* @__PURE__ */ jsx(
162
- "textarea",
270
+ Textarea,
163
271
  {
164
- class: "border border-zinc-200 rounded px-2 py-1 text-sm min-h-20",
165
- placeholder: "Markdown source (leave empty to use cell value)",
166
- value: value().source ?? "",
167
- onInput: (e) => {
168
- if (e.target instanceof HTMLTextAreaElement)
169
- update({ source: e.target.value || void 0 });
170
- }
272
+ "data-field-key": "rendererMarkdownSource",
273
+ class: "min-h-24",
274
+ placeholder: t("markdown-placeholder"),
275
+ modelValue: value().source ?? "",
276
+ "onUpdate:modelValue": (nextValue) => update({ source: String(nextValue).trim().length > 0 ? String(nextValue) : void 0 })
171
277
  }
172
278
  )
173
279
  ] }) });
@@ -176,10 +282,30 @@ const TableRendererMarkdownConfig = defineComponent({
176
282
  const NoOptionsConfig = defineComponent({
177
283
  name: "TableRendererNoOptionsConfig",
178
284
  emits: ["update:modelValue"],
179
- setup() {
180
- return () => /* @__PURE__ */ jsx("div", { class: "text-xs text-zinc-500", children: "No options." });
285
+ setup(_props, { expose }) {
286
+ const { t } = useTableRendererConfigI18n();
287
+ expose({
288
+ clearValidation: () => void 0,
289
+ validate: () => true
290
+ });
291
+ return () => /* @__PURE__ */ jsx("div", { class: "text-xs text-zinc-500", children: t("no-options") });
181
292
  }
182
293
  });
294
+ function formatTableRendererDate(value, formatPattern) {
295
+ let date = null;
296
+ try {
297
+ date = typeof value === "string" || typeof value === "number" || value instanceof Date ? toDate(value) : null;
298
+ } catch {
299
+ }
300
+ if (!date || !isValid(date)) {
301
+ return "-";
302
+ }
303
+ try {
304
+ return formatDate(date, formatPattern);
305
+ } catch {
306
+ return "-";
307
+ }
308
+ }
183
309
  defineTableRenderer(
184
310
  "table.renderer.text",
185
311
  {
@@ -248,7 +374,7 @@ defineTableRenderer(
248
374
  id: `${ctx.column.id}-${ctx.row.id}`,
249
375
  disabled: !ctx.row.getCanSelect(),
250
376
  modelValue: ctx.row.getIsSelected(),
251
- "onUpdate:modelValue": ctx.row.getToggleSelectedHandler(),
377
+ "onUpdate:modelValue": (value) => ctx.row.toggleSelected(value === true),
252
378
  class: "w-4 h-4"
253
379
  }
254
380
  ) });
@@ -259,28 +385,23 @@ defineTableRenderer(
259
385
  const crossPage = options.crossPage ?? false;
260
386
  const indeterminate = crossPage ? ctx.table.getIsSomePageRowsSelected() : ctx.table.getIsSomeRowsSelected();
261
387
  const checked = crossPage ? ctx.table.getIsAllPageRowsSelected() : ctx.table.getIsAllRowsSelected();
262
- const onInput = crossPage ? ctx.table.getToggleAllPageRowsSelectedHandler() : ctx.table.getToggleAllRowsSelectedHandler();
263
- return /* @__PURE__ */ jsx("div", { class: "inline-flex items-center", children: /* @__PURE__ */ jsxs("label", { class: "flex items-center cursor-pointer relative", children: [
264
- /* @__PURE__ */ jsx(
265
- "input",
266
- {
267
- id: `${ctx.column.id}-header`,
268
- type: "checkbox",
269
- checked,
270
- class: [
271
- "peer h-4 w-4 cursor-pointer transition-colors duration-180 appearance-none rounded bg-white",
272
- "border border-[color-mix(in_srgb,var(--primary)_10%,#00000033)] not-checked-group-hover:border-[color-mix(in_srgb,var(--primary)_20%,#00000033)]",
273
- "not-checked-group-hover:bg-[color-mix(in_srgb,var(--primary)_5%,#00000011)] checked:border-(--primary) checked:bg-(--primary)"
274
- ],
275
- ref: (el) => {
276
- if (el instanceof HTMLInputElement)
277
- el.indeterminate = Boolean(indeterminate);
278
- },
279
- onInput: (e) => onInput(e)
280
- }
281
- ),
282
- /* @__PURE__ */ jsx("span", { class: "absolute text-white opacity-0 peer-checked:opacity-100 top-1/2 left-1/2 transform -translate-x-1/2 -translate-y-1/2 pointer-events-none", children: /* @__PURE__ */ jsx(Icon, { icon: "fluent:checkmark-20-filled", class: "text-white text-xs" }) })
283
- ] }) });
388
+ const modelValue = checked ? true : indeterminate ? "indeterminate" : false;
389
+ return /* @__PURE__ */ jsx("div", { class: "w-full h-full flex items-center justify-center", children: /* @__PURE__ */ jsx(
390
+ Checkbox,
391
+ {
392
+ id: `${ctx.column.id}-header`,
393
+ modelValue,
394
+ "aria-label": crossPage ? getTableRendererConfigText("select-all-rows-on-page") : getTableRendererConfigText("select-all-rows"),
395
+ "onUpdate:modelValue": (value) => {
396
+ if (crossPage) {
397
+ ctx.table.toggleAllPageRowsSelected(value === true);
398
+ return;
399
+ }
400
+ ctx.table.toggleAllRowsSelected(value === true);
401
+ },
402
+ class: "w-4 h-4 bg-white"
403
+ }
404
+ ) });
284
405
  },
285
406
  config: TableRendererSelectionConfig,
286
407
  columnDefOverrides: {
@@ -351,20 +472,14 @@ defineTableRenderer(
351
472
  },
352
473
  {
353
474
  cell: ({ ctx, options }) => {
354
- const value = ctx.cell.getValue();
355
- let d = null;
356
- try {
357
- d = typeof value === "string" || typeof value === "number" || value instanceof Date ? toDate(value) : null;
358
- } catch {
359
- }
360
- const date = isValid(d) ? d : null;
361
- const formatted = date ? formatDate(date, options.format ?? "yyyy-MM-dd") : "-";
475
+ const formatted = formatTableRendererDate(ctx.cell.getValue(), options.format ?? "yyyy-MM-dd");
476
+ const hasDate = formatted !== "-";
362
477
  return /* @__PURE__ */ jsx(
363
478
  "div",
364
479
  {
365
480
  class: [
366
481
  "relative w-full py-2 px-1 flex items-center justify-center text-xs",
367
- date ? "text-zinc-600" : "text-zinc-300 select-none"
482
+ hasDate ? "text-zinc-600" : "text-zinc-300 select-none"
368
483
  ],
369
484
  children: formatted
370
485
  }
@@ -34,4 +34,5 @@ export declare function defineTableRenderer<const TShape extends z.ZodRawShape,
34
34
  columnDefOverrides?: TableRenderer<TOptions>['columnDefOverrides'];
35
35
  }>): TableRenderer<TOptions>;
36
36
  export declare function getTableRenderer(id: TableRendererId): TableRenderer<unknown> | undefined;
37
+ export declare function listTableRenderers(): Array<TableRenderer<unknown>>;
37
38
  export declare function resolveTableRenderer(id: TableRendererId): TableRenderer<unknown>;
@@ -21,6 +21,9 @@ export function defineTableRenderer(id, shape, impl) {
21
21
  export function getTableRenderer(id) {
22
22
  return _renderers.get(id);
23
23
  }
24
+ export function listTableRenderers() {
25
+ return Array.from(_renderers.values());
26
+ }
24
27
  export function resolveTableRenderer(id) {
25
28
  return _renderers.get(id) ?? _renderers.get("table.renderer.text");
26
29
  }
@@ -1,7 +1,32 @@
1
1
  import z from 'zod';
2
- export declare const localeC: z.ZodObject<{
3
- locale: z.ZodString;
2
+ declare const localeCodeC: z.ZodEnum<{
3
+ zh: "zh";
4
+ ja: "ja";
5
+ en: "en";
6
+ ko: "ko";
7
+ }>;
8
+ export declare const supportedLocales: ("zh" | "ja" | "en" | "ko")[];
9
+ export declare const localeItemC: z.ZodObject<{
10
+ locale: z.ZodEnum<{
11
+ zh: "zh";
12
+ ja: "ja";
13
+ en: "en";
14
+ ko: "ko";
15
+ }>;
4
16
  message: z.ZodString;
5
17
  }, z.core.$strip>;
18
+ export declare const localeC: z.ZodReadonly<z.ZodArray<z.ZodObject<{
19
+ locale: z.ZodEnum<{
20
+ zh: "zh";
21
+ ja: "ja";
22
+ en: "en";
23
+ ko: "ko";
24
+ }>;
25
+ message: z.ZodString;
26
+ }, z.core.$strip>>>;
27
+ export type LocaleItem = z.infer<typeof localeItemC>;
28
+ export type LocaleCode = z.infer<typeof localeCodeC>;
29
+ export type LocaleValue = z.infer<typeof localeC>;
6
30
  export declare const dotPropC: z.ZodString;
7
31
  export declare const expressionC: (tt: ReadonlyArray<RegExp | string> | string | RegExp, vars?: Record<string, string>) => z.ZodString;
32
+ export {};