@shwfed/nuxt 0.7.8 → 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 (174) hide show
  1. package/dist/module.json +1 -1
  2. package/dist/runtime/components/app.d.vue.ts +7 -58
  3. package/dist/runtime/components/app.vue +18 -411
  4. package/dist/runtime/components/app.vue.d.ts +7 -58
  5. package/dist/runtime/components/fields.d.vue.ts +177 -0
  6. package/dist/runtime/components/fields.vue +47 -0
  7. package/dist/runtime/components/fields.vue.d.ts +177 -0
  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/button-group/ButtonGroupSeparator.vue +1 -1
  15. package/dist/runtime/components/ui/button-group/ButtonGroupText.vue +1 -1
  16. package/dist/runtime/components/ui/calendar/Calendar.d.vue.ts +5 -12
  17. package/dist/runtime/components/ui/calendar/Calendar.vue +77 -92
  18. package/dist/runtime/components/ui/calendar/Calendar.vue.d.ts +5 -12
  19. package/dist/runtime/components/ui/calendar/CalendarCellTrigger.vue +1 -1
  20. package/dist/runtime/components/ui/calendar/index.d.ts +1 -1
  21. package/dist/runtime/components/ui/checkbox/Checkbox.vue +6 -2
  22. package/dist/runtime/components/ui/command/CommandGroup.vue +4 -0
  23. package/dist/runtime/components/ui/dialog/DialogOverlay.vue +1 -1
  24. package/dist/runtime/components/ui/dropdown-menu/DropdownMenuCheckboxItem.vue +1 -1
  25. package/dist/runtime/components/ui/dropdown-menu/DropdownMenuSubTrigger.vue +1 -1
  26. package/dist/runtime/components/ui/expression-editor/ExpressionEditor.d.vue.ts +30 -0
  27. package/dist/runtime/components/ui/expression-editor/ExpressionEditor.vue +87 -0
  28. package/dist/runtime/components/ui/expression-editor/ExpressionEditor.vue.d.ts +30 -0
  29. package/dist/runtime/components/ui/expression-editor/index.d.ts +1 -0
  30. package/dist/runtime/components/ui/expression-editor/index.js +1 -0
  31. package/dist/runtime/components/ui/field/FieldContent.vue +1 -1
  32. package/dist/runtime/components/ui/field/FieldDescription.vue +1 -1
  33. package/dist/runtime/components/ui/field/FieldError.vue +2 -2
  34. package/dist/runtime/components/ui/field/FieldLabel.vue +1 -1
  35. package/dist/runtime/components/ui/field/FieldSeparator.vue +1 -1
  36. package/dist/runtime/components/ui/field/index.js +7 -5
  37. package/dist/runtime/components/ui/fields/Fields.d.vue.ts +376 -0
  38. package/dist/runtime/components/ui/fields/Fields.vue +441 -0
  39. package/dist/runtime/components/ui/fields/Fields.vue.d.ts +376 -0
  40. package/dist/runtime/components/ui/fields-configurator/FieldsConfiguratorDialog.d.vue.ts +163 -0
  41. package/dist/runtime/components/ui/fields-configurator/FieldsConfiguratorDialog.vue +363 -0
  42. package/dist/runtime/components/ui/fields-configurator/FieldsConfiguratorDialog.vue.d.ts +163 -0
  43. package/dist/runtime/components/ui/input/Input.d.vue.ts +1 -0
  44. package/dist/runtime/components/ui/input/Input.vue +3 -1
  45. package/dist/runtime/components/ui/input/Input.vue.d.ts +1 -0
  46. package/dist/runtime/components/ui/input-group/InputGroup.vue +3 -0
  47. package/dist/runtime/components/ui/input-group/InputGroupAddon.vue +4 -1
  48. package/dist/runtime/components/ui/input-group/InputGroupCombobox.d.vue.ts +11 -3
  49. package/dist/runtime/components/ui/input-group/InputGroupCombobox.vue +16 -5
  50. package/dist/runtime/components/ui/input-group/InputGroupCombobox.vue.d.ts +11 -3
  51. package/dist/runtime/components/ui/input-group/InputGroupComboboxInput.d.vue.ts +8 -1
  52. package/dist/runtime/components/ui/input-group/InputGroupComboboxInput.vue +12 -1
  53. package/dist/runtime/components/ui/input-group/InputGroupComboboxInput.vue.d.ts +8 -1
  54. package/dist/runtime/components/ui/input-group/InputGroupInput.vue +1 -1
  55. package/dist/runtime/components/ui/input-group/InputGroupNumberField.d.vue.ts +5 -2
  56. package/dist/runtime/components/ui/input-group/InputGroupNumberField.vue +10 -4
  57. package/dist/runtime/components/ui/input-group/InputGroupNumberField.vue.d.ts +5 -2
  58. package/dist/runtime/components/ui/input-group/InputGroupText.vue +1 -1
  59. package/dist/runtime/components/ui/input-group/InputGroupTextarea.vue +1 -1
  60. package/dist/runtime/components/ui/input-group/index.js +2 -2
  61. package/dist/runtime/components/ui/label/Label.vue +1 -1
  62. package/dist/runtime/components/ui/locale/Locale.d.vue.ts +20 -0
  63. package/dist/runtime/components/ui/locale/Locale.vue +291 -0
  64. package/dist/runtime/components/ui/locale/Locale.vue.d.ts +20 -0
  65. package/dist/runtime/components/ui/locale/index.d.ts +1 -0
  66. package/dist/runtime/components/ui/locale/index.js +1 -0
  67. package/dist/runtime/components/ui/native-select/NativeSelect.vue +3 -3
  68. package/dist/runtime/components/ui/native-select/NativeSelectOption.d.vue.ts +1 -0
  69. package/dist/runtime/components/ui/native-select/NativeSelectOption.vue +4 -1
  70. package/dist/runtime/components/ui/native-select/NativeSelectOption.vue.d.ts +1 -0
  71. package/dist/runtime/components/ui/navigation-menu/NavigationMenuLink.vue +1 -1
  72. package/dist/runtime/components/ui/navigation-menu/NavigationMenuViewport.vue +1 -1
  73. package/dist/runtime/components/ui/number-field/NumberFieldInput.vue +1 -1
  74. package/dist/runtime/components/ui/range-calendar/RangeCalendarCell.vue +1 -1
  75. package/dist/runtime/components/ui/range-calendar/RangeCalendarCellTrigger.vue +1 -1
  76. package/dist/runtime/components/ui/sheet/SheetOverlay.vue +1 -1
  77. package/dist/runtime/components/ui/switch/Switch.d.vue.ts +24 -0
  78. package/dist/runtime/components/ui/switch/Switch.vue +46 -0
  79. package/dist/runtime/components/ui/switch/Switch.vue.d.ts +24 -0
  80. package/dist/runtime/components/ui/switch/index.d.ts +1 -0
  81. package/dist/runtime/components/ui/switch/index.js +1 -0
  82. package/dist/runtime/components/ui/table/Table.d.vue.ts +81 -0
  83. package/dist/runtime/components/ui/table/Table.vue +792 -0
  84. package/dist/runtime/components/ui/table/Table.vue.d.ts +81 -0
  85. package/dist/runtime/components/ui/table/schema.d.ts +48 -0
  86. package/dist/runtime/components/ui/table/schema.js +126 -0
  87. package/dist/runtime/components/ui/table-configurator/TableConfiguratorDialog.d.vue.ts +62 -0
  88. package/dist/runtime/components/ui/table-configurator/TableConfiguratorDialog.vue +2233 -0
  89. package/dist/runtime/components/ui/table-configurator/TableConfiguratorDialog.vue.d.ts +62 -0
  90. package/dist/runtime/components/ui/table-configurator/menu.d.ts +37 -0
  91. package/dist/runtime/components/ui/table-configurator/menu.js +227 -0
  92. package/dist/runtime/components/ui/tabs/Tabs.d.vue.ts +24 -0
  93. package/dist/runtime/components/ui/tabs/Tabs.vue +30 -0
  94. package/dist/runtime/components/ui/tabs/Tabs.vue.d.ts +24 -0
  95. package/dist/runtime/components/ui/tabs/TabsContent.d.vue.ts +18 -0
  96. package/dist/runtime/components/ui/tabs/TabsContent.vue +23 -0
  97. package/dist/runtime/components/ui/tabs/TabsContent.vue.d.ts +18 -0
  98. package/dist/runtime/components/ui/tabs/TabsList.d.vue.ts +18 -0
  99. package/dist/runtime/components/ui/tabs/TabsList.vue +25 -0
  100. package/dist/runtime/components/ui/tabs/TabsList.vue.d.ts +18 -0
  101. package/dist/runtime/components/ui/tabs/TabsTrigger.d.vue.ts +18 -0
  102. package/dist/runtime/components/ui/tabs/TabsTrigger.vue +27 -0
  103. package/dist/runtime/components/ui/tabs/TabsTrigger.vue.d.ts +18 -0
  104. package/dist/runtime/components/ui/tabs/index.d.ts +4 -0
  105. package/dist/runtime/components/ui/tabs/index.js +4 -0
  106. package/dist/runtime/components/ui/textarea/Textarea.d.vue.ts +1 -0
  107. package/dist/runtime/components/ui/textarea/Textarea.vue +4 -2
  108. package/dist/runtime/components/ui/textarea/Textarea.vue.d.ts +1 -0
  109. package/dist/runtime/components/ui/toggle/Toggle.d.vue.ts +34 -0
  110. package/dist/runtime/components/ui/toggle/Toggle.vue +32 -0
  111. package/dist/runtime/components/ui/toggle/Toggle.vue.d.ts +34 -0
  112. package/dist/runtime/components/ui/toggle/index.d.ts +7 -0
  113. package/dist/runtime/components/ui/toggle/index.js +22 -0
  114. package/dist/runtime/composables/useTableRenderers.d.ts +2 -1
  115. package/dist/runtime/composables/useTableRenderers.js +2 -1
  116. package/dist/runtime/plugins/cel/env.d.ts +2 -2
  117. package/dist/runtime/plugins/cel/env.js +5 -4
  118. package/dist/runtime/plugins/cel/index.d.ts +3 -3
  119. package/dist/runtime/plugins/cel/index.js +7 -3
  120. package/dist/runtime/plugins/markdown/index.d.ts +1 -1
  121. package/dist/runtime/style.css +1 -1
  122. package/dist/runtime/table-renderers/builtins.js +213 -98
  123. package/dist/runtime/table-renderers/registry.d.ts +1 -0
  124. package/dist/runtime/table-renderers/registry.js +3 -0
  125. package/dist/runtime/utils/coders.d.ts +32 -0
  126. package/dist/runtime/utils/coders.js +64 -0
  127. package/dist/runtime/vendor/cel/index.d.ts +17 -0
  128. package/dist/runtime/vendor/cel/index.js +10 -0
  129. package/dist/runtime/vendor/cel-js/LICENSE +21 -0
  130. package/dist/runtime/vendor/cel-js/UPSTREAM.md +17 -0
  131. package/dist/runtime/vendor/cel-js/lib/errors.d.ts +21 -0
  132. package/dist/runtime/vendor/cel-js/lib/errors.js +97 -0
  133. package/dist/runtime/vendor/cel-js/lib/evaluator.d.ts +4 -0
  134. package/dist/runtime/vendor/cel-js/lib/evaluator.js +192 -0
  135. package/dist/runtime/vendor/cel-js/lib/functions.d.ts +53 -0
  136. package/dist/runtime/vendor/cel-js/lib/functions.js +513 -0
  137. package/dist/runtime/vendor/cel-js/lib/globals.d.ts +27 -0
  138. package/dist/runtime/vendor/cel-js/lib/globals.js +33 -0
  139. package/dist/runtime/vendor/cel-js/lib/index.d.ts +469 -0
  140. package/dist/runtime/vendor/cel-js/lib/index.js +18 -0
  141. package/dist/runtime/vendor/cel-js/lib/macros.d.ts +1 -0
  142. package/dist/runtime/vendor/cel-js/lib/macros.js +230 -0
  143. package/dist/runtime/vendor/cel-js/lib/operators.d.ts +117 -0
  144. package/dist/runtime/vendor/cel-js/lib/operators.js +739 -0
  145. package/dist/runtime/vendor/cel-js/lib/optional.d.ts +14 -0
  146. package/dist/runtime/vendor/cel-js/lib/optional.js +161 -0
  147. package/dist/runtime/vendor/cel-js/lib/options.d.ts +23 -0
  148. package/dist/runtime/vendor/cel-js/lib/options.js +47 -0
  149. package/dist/runtime/vendor/cel-js/lib/overloads.d.ts +1 -0
  150. package/dist/runtime/vendor/cel-js/lib/overloads.js +214 -0
  151. package/dist/runtime/vendor/cel-js/lib/parser.d.ts +56 -0
  152. package/dist/runtime/vendor/cel-js/lib/parser.js +827 -0
  153. package/dist/runtime/vendor/cel-js/lib/registry.d.ts +279 -0
  154. package/dist/runtime/vendor/cel-js/lib/registry.js +1596 -0
  155. package/dist/runtime/vendor/cel-js/lib/serialize.d.ts +1 -0
  156. package/dist/runtime/vendor/cel-js/lib/serialize.js +259 -0
  157. package/dist/runtime/vendor/cel-js/lib/type-checker.d.ts +26 -0
  158. package/dist/runtime/vendor/cel-js/lib/type-checker.js +81 -0
  159. package/package.json +9 -4
  160. package/dist/runtime/components/locale.d.vue.ts +0 -14
  161. package/dist/runtime/components/locale.vue +0 -89
  162. package/dist/runtime/components/locale.vue.d.ts +0 -14
  163. package/dist/runtime/components/query.d.vue.ts +0 -30
  164. package/dist/runtime/components/query.vue +0 -266
  165. package/dist/runtime/components/query.vue.d.ts +0 -30
  166. package/dist/runtime/utilities/query-config/global.d.ts +0 -4
  167. package/dist/runtime/utilities/query-config/global.js +0 -18
  168. package/dist/runtime/utilities/query-config/index.d.ts +0 -3
  169. package/dist/runtime/utilities/query-config/index.js +0 -14
  170. package/dist/runtime/utilities/query-config/schema.d.ts +0 -96
  171. package/dist/runtime/utilities/query-config/schema.js +0 -51
  172. /package/dist/runtime/components/{logo.d.vue.ts → ui/logo/Logo.d.vue.ts} +0 -0
  173. /package/dist/runtime/components/{logo.vue → ui/logo/Logo.vue} +0 -0
  174. /package/dist/runtime/components/{logo.vue.d.ts → ui/logo/Logo.vue.d.ts} +0 -0
@@ -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
  }
@@ -0,0 +1,32 @@
1
+ import z from 'zod';
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
+ }>;
16
+ message: z.ZodString;
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>;
30
+ export declare const dotPropC: z.ZodString;
31
+ export declare const expressionC: (tt: ReadonlyArray<RegExp | string> | string | RegExp, vars?: Record<string, string>) => z.ZodString;
32
+ export {};
@@ -0,0 +1,64 @@
1
+ import z from "zod";
2
+ import { parsePath } from "dot-prop";
3
+ import { md } from "../plugins/markdown/md.js";
4
+ import { createEnvironment } from "../plugins/cel/env.js";
5
+ const localeCodeC = z.enum(["zh", "ja", "en", "ko"]);
6
+ export const supportedLocales = localeCodeC.options;
7
+ export const localeItemC = z.object({
8
+ locale: localeCodeC.describe("\u652F\u6301\u7684\u8BED\u8A00\u7801\uFF0C\u4EC5\u9650 zh\u3001ja\u3001en\u3001ko"),
9
+ message: z.string().describe("\u9488\u5BF9\u8BE5\u8BED\u8A00\u7684 UI \u6587\u672C")
10
+ }).describe("\u9488\u5BF9\u67D0\u4E2A\u8BED\u8A00\u7684\u672C\u5730\u5316\u5185\u5BB9");
11
+ export const localeC = z.array(localeItemC).readonly().superRefine((value, ctx) => {
12
+ const seen = /* @__PURE__ */ new Set();
13
+ let zhCount = 0;
14
+ for (const [index, item] of value.entries()) {
15
+ if (seen.has(item.locale)) {
16
+ ctx.addIssue({
17
+ code: "custom",
18
+ message: "\u8BED\u8A00\u7801\u4E0D\u80FD\u91CD\u590D",
19
+ path: [index, "locale"]
20
+ });
21
+ }
22
+ seen.add(item.locale);
23
+ if (item.locale === "zh") {
24
+ zhCount++;
25
+ }
26
+ }
27
+ if (zhCount !== 1) {
28
+ ctx.addIssue({
29
+ code: "custom",
30
+ message: "\u5FC5\u987B\u4E14\u53EA\u80FD\u5305\u542B\u4E00\u4E2A zh \u8BED\u8A00"
31
+ });
32
+ }
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 const dotPropC = z.string().refine(
35
+ (val) => {
36
+ if (val.length === 0) return false;
37
+ try {
38
+ return parsePath(val).length > 0;
39
+ } catch {
40
+ return false;
41
+ }
42
+ },
43
+ { error: "\u65E0\u6548\u7684 dot-prop \u8DEF\u5F84" }
44
+ ).describe(md`
45
+ NPM \`dot-prop\` 包支持的语法,如
46
+
47
+ - \`foo.bar\`
48
+ - \`foo[0].bar\`
49
+ `);
50
+ export const expressionC = (tt, vars) => {
51
+ return z.string().refine(
52
+ (val) => {
53
+ const env = createEnvironment((env2) => {
54
+ for (const [key, type] of Object.entries(vars ?? {})) {
55
+ env2.registerVariable(key, type);
56
+ }
57
+ return env2;
58
+ });
59
+ const result = env.check(val);
60
+ return result.valid && (Array.isArray(tt) ? tt : [tt]).some((reg) => reg instanceof RegExp ? result.type.match(reg) : result.type === reg);
61
+ },
62
+ { error: "\u65E0\u6548\u7684 CEL \u8868\u8FBE\u5F0F\u6216\u8FD4\u56DE\u7C7B\u578B\u4E0D\u5339\u914D" }
63
+ );
64
+ };
@@ -0,0 +1,17 @@
1
+ export {
2
+ Environment,
3
+ EvaluationError,
4
+ evaluate,
5
+ Optional,
6
+ ParseError,
7
+ parse,
8
+ serialize,
9
+ TypeError,
10
+ } from '../cel-js/lib/index.js'
11
+
12
+ export type {
13
+ ASTNode,
14
+ Context,
15
+ ParseResult,
16
+ TypeCheckResult,
17
+ } from '../cel-js/lib/index.js'
@@ -0,0 +1,10 @@
1
+ export {
2
+ Environment,
3
+ EvaluationError,
4
+ evaluate,
5
+ Optional,
6
+ ParseError,
7
+ parse,
8
+ serialize,
9
+ TypeError,
10
+ } from '../cel-js/lib/index.js'
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Marc Bachmann
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,17 @@
1
+ Vendored from `@marcbachmann/cel-js` `v7.5.2`.
2
+
3
+ - Upstream repository: `https://github.com/marcbachmann/cel-js`
4
+ - Upstream tag: `v7.5.2`
5
+ - Upstream commit: `4dd97919826967c709e9b8522663ab07bc51c960`
6
+ - Vendored scope: `lib/` runtime sources plus upstream `LICENSE`
7
+
8
+ Sync rules:
9
+
10
+ 1. Treat `src/runtime/vendor/cel-js/lib/` as an upstream mirror and keep diffs minimal.
11
+ 2. Put local integration changes in `src/runtime/vendor/cel/` or higher-level runtime code first.
12
+ 3. If upstream files must change, document the delta in this file when it happens.
13
+
14
+ Local deltas:
15
+
16
+ - `lib/registry.js`
17
+ Read `obj[key]` before `hasOwn(obj, key)` in `#getMapField` so Vue reactive proxies track missing-to-present field access. This cannot live in `src/runtime/vendor/cel/` because `#getMapField` is a private method on the upstream class.
@@ -0,0 +1,21 @@
1
+ export class ParseError extends Error {
2
+ constructor(message: any, node: any, cause: any);
3
+ message: any;
4
+ get node(): any;
5
+ withAst(node: any): this;
6
+ #private;
7
+ }
8
+ export class EvaluationError extends Error {
9
+ constructor(message: any, node: any, cause: any);
10
+ message: any;
11
+ get node(): any;
12
+ withAst(node: any): this;
13
+ #private;
14
+ }
15
+ export class TypeError extends Error {
16
+ constructor(message: any, node: any, cause: any);
17
+ message: any;
18
+ get node(): any;
19
+ withAst(node: any): this;
20
+ #private;
21
+ }