@shwfed/config 2.12.0 → 2.12.2
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/module.mjs +10 -0
- package/dist/runtime/components/form/config.vue +17 -6
- package/dist/runtime/components/form/fields/2026-04-24/com.shwfed.form.field.combobox.single/config.d.vue.ts +2 -2
- package/dist/runtime/components/form/fields/2026-04-24/com.shwfed.form.field.combobox.single/config.vue.d.ts +2 -2
- package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.date/config.d.vue.ts +2 -0
- package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.date/config.vue +22 -0
- package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.date/config.vue.d.ts +2 -0
- package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.date/runtime.vue +5 -0
- package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.date/schema.d.ts +1 -0
- package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.date/schema.js +12 -0
- package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.daterange/config.d.vue.ts +2 -0
- package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.daterange/config.vue +22 -0
- package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.daterange/config.vue.d.ts +2 -0
- package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.daterange/runtime.vue +5 -0
- package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.daterange/schema.d.ts +1 -0
- package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.daterange/schema.js +12 -0
- package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.datetime/config.d.vue.ts +2 -0
- package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.datetime/config.vue +22 -0
- package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.datetime/config.vue.d.ts +2 -0
- package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.datetime/runtime.vue +5 -0
- package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.datetime/schema.d.ts +1 -0
- package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.datetime/schema.js +12 -0
- package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.datetimerange/config.d.vue.ts +2 -0
- package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.datetimerange/config.vue +22 -0
- package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.datetimerange/config.vue.d.ts +2 -0
- package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.datetimerange/runtime.vue +5 -0
- package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.datetimerange/schema.d.ts +1 -0
- package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.datetimerange/schema.js +12 -0
- package/dist/runtime/components/form/fields/2026-05-13/com.shwfed.form.field.combobox.single.remote/config.d.vue.ts +2 -2
- package/dist/runtime/components/form/fields/2026-05-13/com.shwfed.form.field.combobox.single.remote/config.vue.d.ts +2 -2
- package/dist/runtime/components/form/fields/2026-05-13/com.shwfed.form.field.list/row.vue +8 -1
- package/dist/runtime/components/form/fields/2026-05-23/com.shwfed.form.field.tree.multi/config.d.vue.ts +24 -24
- package/dist/runtime/components/form/fields/2026-05-23/com.shwfed.form.field.tree.multi/config.vue.d.ts +24 -24
- package/dist/runtime/components/form/fields/2026-05-24/com.shwfed.form.field.month/config.d.vue.ts +2 -0
- package/dist/runtime/components/form/fields/2026-05-24/com.shwfed.form.field.month/config.vue +22 -0
- package/dist/runtime/components/form/fields/2026-05-24/com.shwfed.form.field.month/config.vue.d.ts +2 -0
- package/dist/runtime/components/form/fields/2026-05-24/com.shwfed.form.field.month/runtime.vue +5 -0
- package/dist/runtime/components/form/fields/2026-05-24/com.shwfed.form.field.month/schema.d.ts +1 -0
- package/dist/runtime/components/form/fields/2026-05-24/com.shwfed.form.field.month/schema.js +12 -0
- package/dist/runtime/components/form/fields/2026-05-24/com.shwfed.form.field.monthrange/config.d.vue.ts +2 -0
- package/dist/runtime/components/form/fields/2026-05-24/com.shwfed.form.field.monthrange/config.vue +22 -0
- package/dist/runtime/components/form/fields/2026-05-24/com.shwfed.form.field.monthrange/config.vue.d.ts +2 -0
- package/dist/runtime/components/form/fields/2026-05-24/com.shwfed.form.field.monthrange/runtime.vue +5 -0
- package/dist/runtime/components/form/fields/2026-05-24/com.shwfed.form.field.monthrange/schema.d.ts +1 -0
- package/dist/runtime/components/form/fields/2026-05-24/com.shwfed.form.field.monthrange/schema.js +12 -0
- package/dist/runtime/components/form/fields/2026-05-25/com.shwfed.form.field.combobox.multi/config.d.vue.ts +2 -2
- package/dist/runtime/components/form/fields/2026-05-25/com.shwfed.form.field.combobox.multi/config.vue.d.ts +2 -2
- package/dist/runtime/components/form/fields/2026-05-26/com.shwfed.form.field.tree.combobox.multi/config.d.vue.ts +24 -24
- package/dist/runtime/components/form/fields/2026-05-26/com.shwfed.form.field.tree.combobox.multi/config.vue.d.ts +24 -24
- package/dist/runtime/components/form/fields/2026-05-26/com.shwfed.form.field.tree.combobox.single/config.d.vue.ts +22 -22
- package/dist/runtime/components/form/fields/2026-05-26/com.shwfed.form.field.tree.combobox.single/config.vue.d.ts +22 -22
- package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.combobox.multi/config.d.vue.ts +32 -32
- package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.combobox.multi/config.vue.d.ts +32 -32
- package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.combobox.multi/runtime.vue +9 -1
- package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.combobox.single/config.d.vue.ts +32 -32
- package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.combobox.single/config.vue.d.ts +32 -32
- package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.combobox.single/runtime.vue +9 -1
- package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.combobox.multi/config.d.vue.ts +24 -24
- package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.combobox.multi/config.vue.d.ts +24 -24
- package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.combobox.multi/runtime.vue +19 -1
- package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.combobox.single/config.d.vue.ts +22 -22
- package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.combobox.single/config.vue.d.ts +22 -22
- package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.combobox.single/runtime.vue +19 -1
- package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.multi/config.d.vue.ts +24 -24
- package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.multi/config.vue.d.ts +24 -24
- package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.multi/runtime.vue +20 -1
- package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.single/config.d.vue.ts +22 -22
- package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.single/config.vue.d.ts +22 -22
- package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.single/runtime.vue +20 -1
- package/dist/runtime/components/form/fields/2026-06-14/com.shwfed.form.field.combobox.multi/config.d.vue.ts +32 -32
- package/dist/runtime/components/form/fields/2026-06-14/com.shwfed.form.field.combobox.multi/config.vue.d.ts +32 -32
- package/dist/runtime/components/form/fields/2026-06-14/com.shwfed.form.field.combobox.multi/runtime.vue +9 -1
- package/dist/runtime/components/form/fields/2026-06-14/com.shwfed.form.field.combobox.single/config.d.vue.ts +32 -32
- package/dist/runtime/components/form/fields/2026-06-14/com.shwfed.form.field.combobox.single/config.vue.d.ts +32 -32
- package/dist/runtime/components/form/fields/2026-06-14/com.shwfed.form.field.combobox.single/runtime.vue +9 -1
- package/dist/runtime/components/form/index.vue +6 -3
- package/dist/runtime/components/form/utils/ai-field-tools.d.ts +11 -0
- package/dist/runtime/components/form/utils/ai-field-tools.js +282 -0
- package/dist/runtime/components/form/utils/form-vars.js +2 -1
- package/dist/runtime/components/form/utils/resolve.d.ts +15 -0
- package/dist/runtime/components/form/utils/resolve.js +13 -0
- package/dist/runtime/components/head.d.vue.ts +13 -0
- package/dist/runtime/components/head.vue +69 -0
- package/dist/runtime/components/head.vue.d.ts +13 -0
- package/dist/runtime/components/sidebar/config.d.vue.ts +7 -0
- package/dist/runtime/components/sidebar/config.vue +302 -0
- package/dist/runtime/components/sidebar/config.vue.d.ts +7 -0
- package/dist/runtime/components/sidebar/favorites.d.ts +18 -0
- package/dist/runtime/components/sidebar/favorites.js +20 -0
- package/dist/runtime/components/sidebar/footer.d.vue.ts +11 -0
- package/dist/runtime/components/sidebar/footer.vue +49 -0
- package/dist/runtime/components/sidebar/footer.vue.d.ts +11 -0
- package/dist/runtime/components/sidebar/index.d.vue.ts +50 -0
- package/dist/runtime/components/sidebar/index.vue +100 -0
- package/dist/runtime/components/sidebar/index.vue.d.ts +50 -0
- package/dist/runtime/components/sidebar/node.d.vue.ts +9 -0
- package/dist/runtime/components/sidebar/node.vue +102 -0
- package/dist/runtime/components/sidebar/node.vue.d.ts +9 -0
- package/dist/runtime/components/sidebar/schema.d.ts +72 -0
- package/dist/runtime/components/sidebar/schema.js +84 -0
- package/dist/runtime/components/sidebar/tree.d.vue.ts +10 -0
- package/dist/runtime/components/sidebar/tree.vue +260 -0
- package/dist/runtime/components/sidebar/tree.vue.d.ts +10 -0
- package/dist/runtime/components/sidebar/types.d.ts +19 -0
- package/dist/runtime/components/sidebar/types.js +0 -0
- package/dist/runtime/components/sidebar/use-editor.d.ts +18 -0
- package/dist/runtime/components/sidebar/use-editor.js +43 -0
- package/dist/runtime/components/table/ai-generate.system.md +6 -0
- package/dist/runtime/components/table/ai-generate.vue +18 -17
- package/dist/runtime/components/table/columns/2026-05-24/com.shwfed.table.column.combobox-single.remote.options-remote/config.d.vue.ts +4 -4
- package/dist/runtime/components/table/columns/2026-05-24/com.shwfed.table.column.combobox-single.remote.options-remote/config.vue.d.ts +4 -4
- package/dist/runtime/components/table/columns/2026-05-24/com.shwfed.table.column.combobox-single.remote.options-static/config.d.vue.ts +2 -2
- package/dist/runtime/components/table/columns/2026-05-24/com.shwfed.table.column.combobox-single.remote.options-static/config.vue.d.ts +2 -2
- package/dist/runtime/components/table/columns/2026-05-25/com.shwfed.table.column.combobox-multi.remote.options-remote/config.d.vue.ts +4 -4
- package/dist/runtime/components/table/columns/2026-05-25/com.shwfed.table.column.combobox-multi.remote.options-remote/config.vue.d.ts +4 -4
- package/dist/runtime/components/table/columns/2026-05-25/com.shwfed.table.column.combobox-multi.remote.options-static/config.d.vue.ts +2 -2
- package/dist/runtime/components/table/columns/2026-05-25/com.shwfed.table.column.combobox-multi.remote.options-static/config.vue.d.ts +2 -2
- package/dist/runtime/components/table/columns/2026-05-26/com.shwfed.table.column.combobox-multi/config.d.vue.ts +36 -36
- package/dist/runtime/components/table/columns/2026-05-26/com.shwfed.table.column.combobox-multi/config.vue.d.ts +36 -36
- package/dist/runtime/components/table/columns/2026-05-26/com.shwfed.table.column.combobox-multi.remote/config.d.vue.ts +42 -42
- package/dist/runtime/components/table/columns/2026-05-26/com.shwfed.table.column.combobox-multi.remote/config.vue.d.ts +42 -42
- package/dist/runtime/components/table/columns/2026-05-26/com.shwfed.table.column.combobox-single/config.d.vue.ts +36 -36
- package/dist/runtime/components/table/columns/2026-05-26/com.shwfed.table.column.combobox-single/config.vue.d.ts +36 -36
- package/dist/runtime/components/table/columns/2026-05-26/com.shwfed.table.column.combobox-single.remote/config.d.vue.ts +42 -42
- package/dist/runtime/components/table/columns/2026-05-26/com.shwfed.table.column.combobox-single.remote/config.vue.d.ts +42 -42
- package/dist/runtime/components/table/columns/2026-05-27/com.shwfed.table.column.tree-combobox-multi/config.d.vue.ts +4 -4
- package/dist/runtime/components/table/columns/2026-05-27/com.shwfed.table.column.tree-combobox-multi/config.vue.d.ts +4 -4
- package/dist/runtime/components/table/columns/2026-05-27/com.shwfed.table.column.tree-combobox-single/config.d.vue.ts +2 -2
- package/dist/runtime/components/table/columns/2026-05-27/com.shwfed.table.column.tree-combobox-single/config.vue.d.ts +2 -2
- package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.combobox-multi/config.d.vue.ts +28 -28
- package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.combobox-multi/config.vue.d.ts +28 -28
- package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.combobox-single/config.d.vue.ts +28 -28
- package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.combobox-single/config.vue.d.ts +28 -28
- package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.tree-combobox-multi/config.d.vue.ts +4 -4
- package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.tree-combobox-multi/config.vue.d.ts +4 -4
- package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.tree-combobox-single/config.d.vue.ts +2 -2
- package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.tree-combobox-single/config.vue.d.ts +2 -2
- package/dist/runtime/components/table/columns/2026-06-14/com.shwfed.table.column.combobox-multi/config.d.vue.ts +28 -28
- package/dist/runtime/components/table/columns/2026-06-14/com.shwfed.table.column.combobox-multi/config.vue.d.ts +28 -28
- package/dist/runtime/components/table/columns/2026-06-14/com.shwfed.table.column.combobox-single/config.d.vue.ts +28 -28
- package/dist/runtime/components/table/columns/2026-06-14/com.shwfed.table.column.combobox-single/config.vue.d.ts +28 -28
- package/dist/runtime/components/table/columns/2026-06-14/com.shwfed.table.column.tree-combobox-multi/config.d.vue.ts +4 -4
- package/dist/runtime/components/table/columns/2026-06-14/com.shwfed.table.column.tree-combobox-multi/config.vue.d.ts +4 -4
- package/dist/runtime/components/table/columns/2026-06-14/com.shwfed.table.column.tree-combobox-single/config.d.vue.ts +2 -2
- package/dist/runtime/components/table/columns/2026-06-14/com.shwfed.table.column.tree-combobox-single/config.vue.d.ts +2 -2
- package/dist/runtime/components/table/columns/2026-06-17/com.shwfed.table.column.date-input/config.vue +33 -0
- package/dist/runtime/components/table/columns/2026-06-17/com.shwfed.table.column.date-input/runtime.vue +5 -0
- package/dist/runtime/components/table/columns/2026-06-17/com.shwfed.table.column.date-input/schema.d.ts +1 -0
- package/dist/runtime/components/table/columns/2026-06-17/com.shwfed.table.column.date-input/schema.js +6 -1
- package/dist/runtime/components/table/columns/2026-06-22/com.shwfed.table.column.date-range-input/config.vue +33 -0
- package/dist/runtime/components/table/columns/2026-06-22/com.shwfed.table.column.date-range-input/runtime.vue +5 -0
- package/dist/runtime/components/table/columns/2026-06-22/com.shwfed.table.column.date-range-input/schema.d.ts +1 -0
- package/dist/runtime/components/table/columns/2026-06-22/com.shwfed.table.column.date-range-input/schema.js +6 -1
- package/dist/runtime/components/table/utils/ai-tools.js +50 -1
- package/dist/runtime/components/table/utils/shared.d.ts +1 -0
- package/dist/runtime/components/table/utils/shared.js +10 -0
- package/dist/runtime/components/ui/alert-dialog/AlertDialogCancel.vue +1 -1
- package/dist/runtime/components/ui/chat/ChatPrompt.d.vue.ts +11 -1
- package/dist/runtime/components/ui/chat/ChatPrompt.vue +10 -0
- package/dist/runtime/components/ui/chat/ChatPrompt.vue.d.ts +11 -1
- package/dist/runtime/components/ui/expression-editor/CodeMirrorInput.d.vue.ts +1 -0
- package/dist/runtime/components/ui/expression-editor/CodeMirrorInput.vue +8 -0
- package/dist/runtime/components/ui/expression-editor/CodeMirrorInput.vue.d.ts +1 -0
- package/dist/runtime/components/ui/expression-editor/ExpressionEditor.d.vue.ts +3 -2
- package/dist/runtime/components/ui/expression-editor/ExpressionEditor.vue +51 -9
- package/dist/runtime/components/ui/expression-editor/ExpressionEditor.vue.d.ts +3 -2
- package/dist/runtime/components/ui/expression-editor/option-chip-extension.d.ts +4 -0
- package/dist/runtime/components/ui/expression-editor/option-chip-extension.js +119 -0
- package/dist/runtime/components/ui/expression-editor/option-refs.d.ts +6 -0
- package/dist/runtime/components/ui/expression-editor/option-refs.js +24 -0
- package/dist/runtime/components/ui/expression-editor/picker-entries.d.ts +2 -1
- package/dist/runtime/components/ui/expression-editor/picker-entries.js +12 -2
- package/dist/runtime/share/disabled-date.d.ts +34 -0
- package/dist/runtime/share/disabled-date.js +13 -0
- package/dist/runtime/utils/ai/index.js +24 -1
- package/dist/runtime/utils/cel-context.d.ts +1 -0
- package/dist/runtime/utils/cel-context.js +1 -0
- package/dist/runtime/utils/disabled-date.d.ts +26 -0
- package/dist/runtime/utils/disabled-date.js +21 -0
- package/dist/runtime/utils/selections-registry.d.ts +40 -6
- package/dist/runtime/utils/selections-registry.js +19 -4
- package/dist/runtime/vendor/cel-js/CLAUDE.md +2 -0
- package/dist/runtime/vendor/cel-js/PROMPT.md +2 -0
- package/dist/runtime/vendor/cel-js/lib/functions.js +33 -0
- package/package.json +1 -1
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { computed, inject, onBeforeUnmount, ref, watch } from "vue";
|
|
3
3
|
import { Icon } from "@iconify/vue";
|
|
4
4
|
import { format as formatDate } from "date-fns";
|
|
5
|
+
import { DISABLE_DATE_EDITOR_RESULT, INPUT_DATE_VARS } from "../../../../../share/disabled-date";
|
|
5
6
|
import { ExpressionEditor } from "../../../../ui/expression-editor";
|
|
6
7
|
import { Separator } from "../../../../ui/separator";
|
|
7
8
|
import { Switch } from "../../../../ui/switch";
|
|
@@ -201,6 +202,17 @@ const readonlyModel = computed({
|
|
|
201
202
|
}
|
|
202
203
|
}
|
|
203
204
|
});
|
|
205
|
+
const disabledDateModel = computed({
|
|
206
|
+
get: () => value.value.disabledDate ?? "",
|
|
207
|
+
set: (v) => {
|
|
208
|
+
if (v === "") {
|
|
209
|
+
const { disabledDate: _drop, ...rest } = value.value;
|
|
210
|
+
value.value = rest;
|
|
211
|
+
} else {
|
|
212
|
+
value.value = { ...value.value, disabledDate: v };
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
});
|
|
204
216
|
const derivedModel = computed({
|
|
205
217
|
get: () => value.value.derived,
|
|
206
218
|
set: (v) => {
|
|
@@ -461,6 +473,27 @@ const derivedModel = computed({
|
|
|
461
473
|
:extra-vars="ROW_VARS"
|
|
462
474
|
/>
|
|
463
475
|
</Field>
|
|
476
|
+
<Field orientation="vertical">
|
|
477
|
+
<FieldLabel class="text-xs text-zinc-500">
|
|
478
|
+
<template
|
|
479
|
+
v-if="fieldDescription('disabledDate')"
|
|
480
|
+
#tooltip
|
|
481
|
+
>
|
|
482
|
+
<Markdown
|
|
483
|
+
:source="fieldDescription('disabledDate')"
|
|
484
|
+
block
|
|
485
|
+
class="prose prose-sm prose-zinc"
|
|
486
|
+
/>
|
|
487
|
+
</template>
|
|
488
|
+
{{ fieldTitle("disabledDate") }}
|
|
489
|
+
</FieldLabel>
|
|
490
|
+
<ExpressionEditor
|
|
491
|
+
v-model="disabledDateModel"
|
|
492
|
+
placeholder="例:input.format('i') == '6' || input.format('i') == '7'"
|
|
493
|
+
:result-type="[...DISABLE_DATE_EDITOR_RESULT]"
|
|
494
|
+
:extra-vars="{ ...ROW_VARS, ...INPUT_DATE_VARS }"
|
|
495
|
+
/>
|
|
496
|
+
</Field>
|
|
464
497
|
<Field
|
|
465
498
|
orientation="vertical"
|
|
466
499
|
class="col-span-2"
|
|
@@ -5,6 +5,7 @@ import { useI18n } from "vue-i18n";
|
|
|
5
5
|
import { format as formatDate } from "date-fns";
|
|
6
6
|
import { cel as $cel } from "../../../../../utils/cel";
|
|
7
7
|
import { celScope, injectCELContext } from "../../../../../utils/cel-context";
|
|
8
|
+
import { makeDisabledDatePredicate } from "../../../../../utils/disabled-date";
|
|
8
9
|
import { useFormReadonly } from "../../../../form/utils/readonly";
|
|
9
10
|
import { getLocalizedText } from "../../../../../share/locale";
|
|
10
11
|
import { DATE_PICKER_DEFAULT_FORMATS, DatePicker } from "../../../../ui/date-picker";
|
|
@@ -33,6 +34,9 @@ function evalBool(expression, label) {
|
|
|
33
34
|
}
|
|
34
35
|
}
|
|
35
36
|
const isDisabled = computed(() => evalBool(props.column.disabled, "disabled"));
|
|
37
|
+
const disabledDate = computed(
|
|
38
|
+
() => makeDisabledDatePredicate(props.column.disabledDate, (input) => Effect.runSync($cel(props.column.disabledDate, celScope(celContext, { input }))))
|
|
39
|
+
);
|
|
36
40
|
const formReadonly = useFormReadonly();
|
|
37
41
|
const isReadonly = computed(
|
|
38
42
|
() => props.column.readonly != null ? evalBool(props.column.readonly, "readonly") : formReadonly.value
|
|
@@ -124,6 +128,7 @@ const model = computed({
|
|
|
124
128
|
:value-format="column.valueFormat"
|
|
125
129
|
:placeholder="placeholderText"
|
|
126
130
|
:disabled="isDisabled"
|
|
131
|
+
:disabled-date="disabledDate"
|
|
127
132
|
:shortcuts="shortcuts"
|
|
128
133
|
>
|
|
129
134
|
<!-- `mr-[-0.45rem]` mirrors the clear addon's `has-[>button]:mr-[-0.45rem]`
|
|
@@ -44,6 +44,7 @@ export declare function schema(configure: (env: Environment) => void): Schema.St
|
|
|
44
44
|
}[]], never>>;
|
|
45
45
|
disabled: Schema.optional<Schema.Schema<string, string, never>>;
|
|
46
46
|
readonly: Schema.optional<Schema.Schema<string, string, never>>;
|
|
47
|
+
disabledDate: Schema.optional<Schema.Schema<string, string, never>>;
|
|
47
48
|
derived: Schema.optional<Schema.Struct<{
|
|
48
49
|
mode: Schema.Literal<["formula", "prefill"]>;
|
|
49
50
|
expression: Schema.Schema<string, string, never>;
|
|
@@ -2,7 +2,7 @@ import { Schema } from "effect";
|
|
|
2
2
|
import { getProperty } from "dot-prop";
|
|
3
3
|
import { Locale } from "../../../../../share/locale.js";
|
|
4
4
|
import { ActionSchemaFields } from "../../../../actions/schema.js";
|
|
5
|
-
import { Align, CelRowAccess, derivedRowField, editableColumnFields, editableHeader, registerRowVariablesIfAbsent } from "../../../utils/shared.js";
|
|
5
|
+
import { Align, CelDateDisable, CelRowAccess, derivedRowField, editableColumnFields, editableHeader, registerRowVariablesIfAbsent } from "../../../utils/shared.js";
|
|
6
6
|
export const type = "com.shwfed.table.column.date-input";
|
|
7
7
|
export const compatibilityDate = "2026-06-17";
|
|
8
8
|
export const metadata = {
|
|
@@ -42,6 +42,7 @@ export function presetSchema(configure) {
|
|
|
42
42
|
}
|
|
43
43
|
export function schema(configure) {
|
|
44
44
|
const CelBool = CelRowAccess(configure, { resultType: "bool" });
|
|
45
|
+
const DisabledDate = CelDateDisable(configure);
|
|
45
46
|
const Preset = presetSchema(configure);
|
|
46
47
|
return Schema.Struct({
|
|
47
48
|
type: Schema.Literal(type),
|
|
@@ -60,6 +61,10 @@ export function schema(configure) {
|
|
|
60
61
|
title: "\u53EA\u8BFB\u6761\u4EF6",
|
|
61
62
|
description: "\u8FD4\u56DE `true` \u65F6\u4EC5\u4EE5\u7EAF\u6587\u672C\u5C55\u793A\u5F53\u524D\u503C"
|
|
62
63
|
})),
|
|
64
|
+
disabledDate: Schema.optional(DisabledDate.annotations({
|
|
65
|
+
title: "\u7981\u7528\u65E5\u671F",
|
|
66
|
+
description: "\u9010\u4E2A\u65E5\u671F\u5224\u5B9A\u662F\u5426\u53EF\u9009\uFF1B\u53D8\u91CF `input` \u4E3A\u5019\u9009\u65E5\u671F\uFF0C\u540C\u65F6\u53EF\u8BFB\u53D6 `row`/`index`\u3002\u8FD4\u56DE `true` \u65F6\u7981\u7528\u8BE5\u65E5\u671F\uFF0C\u8FD4\u56DE `false`\u3001\u7A7A\u503C\u6216\u4E0D\u586B\u65F6\u53EF\u9009"
|
|
67
|
+
})),
|
|
63
68
|
derived: derivedRowField(configure, "string"),
|
|
64
69
|
format: Schema.optional(Schema.String.pipe(Schema.minLength(1)).annotations({
|
|
65
70
|
title: "\u5C55\u793A\u683C\u5F0F",
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { computed } from "vue";
|
|
3
3
|
import { Icon } from "@iconify/vue";
|
|
4
4
|
import { format as formatDate } from "date-fns";
|
|
5
|
+
import { DISABLE_DATE_EDITOR_RESULT, INPUT_DATE_VARS } from "../../../../../share/disabled-date";
|
|
5
6
|
import { ExpressionEditor } from "../../../../ui/expression-editor";
|
|
6
7
|
import { Separator } from "../../../../ui/separator";
|
|
7
8
|
import { Switch } from "../../../../ui/switch";
|
|
@@ -201,6 +202,17 @@ const readonlyModel = computed({
|
|
|
201
202
|
}
|
|
202
203
|
}
|
|
203
204
|
});
|
|
205
|
+
const disabledDateModel = computed({
|
|
206
|
+
get: () => value.value.disabledDate ?? "",
|
|
207
|
+
set: (v) => {
|
|
208
|
+
if (v === "") {
|
|
209
|
+
const { disabledDate: _drop, ...rest } = value.value;
|
|
210
|
+
value.value = rest;
|
|
211
|
+
} else {
|
|
212
|
+
value.value = { ...value.value, disabledDate: v };
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
});
|
|
204
216
|
const derivedModel = computed({
|
|
205
217
|
get: () => value.value.derived,
|
|
206
218
|
set: (v) => {
|
|
@@ -557,6 +569,27 @@ const derivedModel = computed({
|
|
|
557
569
|
:extra-vars="ROW_VARS"
|
|
558
570
|
/>
|
|
559
571
|
</Field>
|
|
572
|
+
<Field orientation="vertical">
|
|
573
|
+
<FieldLabel class="text-xs text-zinc-500">
|
|
574
|
+
<template
|
|
575
|
+
v-if="fieldDescription('disabledDate')"
|
|
576
|
+
#tooltip
|
|
577
|
+
>
|
|
578
|
+
<Markdown
|
|
579
|
+
:source="fieldDescription('disabledDate')"
|
|
580
|
+
block
|
|
581
|
+
class="prose prose-sm prose-zinc"
|
|
582
|
+
/>
|
|
583
|
+
</template>
|
|
584
|
+
{{ fieldTitle("disabledDate") }}
|
|
585
|
+
</FieldLabel>
|
|
586
|
+
<ExpressionEditor
|
|
587
|
+
v-model="disabledDateModel"
|
|
588
|
+
placeholder="例:input.format('i') == '6' || input.format('i') == '7'"
|
|
589
|
+
:result-type="[...DISABLE_DATE_EDITOR_RESULT]"
|
|
590
|
+
:extra-vars="{ ...ROW_VARS, ...INPUT_DATE_VARS }"
|
|
591
|
+
/>
|
|
592
|
+
</Field>
|
|
560
593
|
<Field
|
|
561
594
|
orientation="vertical"
|
|
562
595
|
class="col-span-2"
|
|
@@ -5,6 +5,7 @@ import { useI18n } from "vue-i18n";
|
|
|
5
5
|
import { format as formatDate } from "date-fns";
|
|
6
6
|
import { cel as $cel } from "../../../../../utils/cel";
|
|
7
7
|
import { celScope, injectCELContext } from "../../../../../utils/cel-context";
|
|
8
|
+
import { makeDisabledDatePredicate } from "../../../../../utils/disabled-date";
|
|
8
9
|
import { useFormReadonly } from "../../../../form/utils/readonly";
|
|
9
10
|
import { getLocalizedText } from "../../../../../share/locale";
|
|
10
11
|
import { DATE_RANGE_PICKER_DEFAULT_FORMATS, DateRangePicker } from "../../../../ui/date-range-picker";
|
|
@@ -34,6 +35,9 @@ function evalBool(expression, label) {
|
|
|
34
35
|
}
|
|
35
36
|
}
|
|
36
37
|
const isDisabled = computed(() => evalBool(props.column.disabled, "disabled"));
|
|
38
|
+
const disabledDate = computed(
|
|
39
|
+
() => makeDisabledDatePredicate(props.column.disabledDate, (input) => Effect.runSync($cel(props.column.disabledDate, celScope(celContext, { input }))))
|
|
40
|
+
);
|
|
37
41
|
const formReadonly = useFormReadonly();
|
|
38
42
|
const isReadonly = computed(
|
|
39
43
|
() => props.column.readonly != null ? evalBool(props.column.readonly, "readonly") : formReadonly.value
|
|
@@ -143,6 +147,7 @@ const readonlyText = computed(() => {
|
|
|
143
147
|
:range-separator-icon="column.rangeSeparatorIcon"
|
|
144
148
|
:number-of-months="column.numberOfMonths"
|
|
145
149
|
:disabled="isDisabled"
|
|
150
|
+
:disabled-date="disabledDate"
|
|
146
151
|
:shortcuts="shortcuts"
|
|
147
152
|
/>
|
|
148
153
|
</div>
|
|
@@ -59,6 +59,7 @@ export declare function schema(configure: (env: Environment) => void): Schema.St
|
|
|
59
59
|
}[]], never>>;
|
|
60
60
|
disabled: Schema.optional<Schema.Schema<string, string, never>>;
|
|
61
61
|
readonly: Schema.optional<Schema.Schema<string, string, never>>;
|
|
62
|
+
disabledDate: Schema.optional<Schema.Schema<string, string, never>>;
|
|
62
63
|
derived: Schema.optional<Schema.Struct<{
|
|
63
64
|
mode: Schema.Literal<["formula", "prefill"]>;
|
|
64
65
|
expression: Schema.Schema<string, string, never>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Schema } from "effect";
|
|
2
2
|
import { getProperty } from "dot-prop";
|
|
3
3
|
import { Locale } from "../../../../../share/locale.js";
|
|
4
|
-
import { Align, CelRowAccess, derivedRowField, editableColumnFields, editableHeader } from "../../../utils/shared.js";
|
|
4
|
+
import { Align, CelDateDisable, CelRowAccess, derivedRowField, editableColumnFields, editableHeader } from "../../../utils/shared.js";
|
|
5
5
|
export const type = "com.shwfed.table.column.date-range-input";
|
|
6
6
|
export const compatibilityDate = "2026-06-22";
|
|
7
7
|
export const metadata = {
|
|
@@ -40,6 +40,7 @@ export function presetSchema(configure) {
|
|
|
40
40
|
}
|
|
41
41
|
export function schema(configure) {
|
|
42
42
|
const CelBool = CelRowAccess(configure, { resultType: "bool" });
|
|
43
|
+
const DisabledDate = CelDateDisable(configure);
|
|
43
44
|
const Preset = presetSchema(configure);
|
|
44
45
|
return Schema.Struct({
|
|
45
46
|
type: Schema.Literal(type),
|
|
@@ -64,6 +65,10 @@ export function schema(configure) {
|
|
|
64
65
|
title: "\u53EA\u8BFB\u6761\u4EF6",
|
|
65
66
|
description: "\u8FD4\u56DE `true` \u65F6\u4EC5\u4EE5\u7EAF\u6587\u672C\u5C55\u793A\u5F53\u524D\u503C"
|
|
66
67
|
})),
|
|
68
|
+
disabledDate: Schema.optional(DisabledDate.annotations({
|
|
69
|
+
title: "\u7981\u7528\u65E5\u671F",
|
|
70
|
+
description: "\u9010\u4E2A\u65E5\u671F\u5224\u5B9A\u662F\u5426\u53EF\u9009\uFF1B\u53D8\u91CF `input` \u4E3A\u5019\u9009\u65E5\u671F\uFF0C\u540C\u65F6\u53EF\u8BFB\u53D6 `row`/`index`\u3002\u8FD4\u56DE `true` \u65F6\u7981\u7528\u8BE5\u65E5\u671F\uFF0C\u8FD4\u56DE `false`\u3001\u7A7A\u503C\u6216\u4E0D\u586B\u65F6\u53EF\u9009"
|
|
71
|
+
})),
|
|
67
72
|
derived: derivedRowField(configure, "dyn"),
|
|
68
73
|
format: Schema.optional(Schema.String.pipe(Schema.minLength(1)).annotations({
|
|
69
74
|
title: "\u5C55\u793A\u683C\u5F0F",
|
|
@@ -3,11 +3,14 @@ import { coerceFromString } from "../../../share/coerce-from-string.js";
|
|
|
3
3
|
import { Expression, HttpRequestResult } from "../../../share/expression.js";
|
|
4
4
|
import {
|
|
5
5
|
defaultTableConfig,
|
|
6
|
+
metadata as tableMetadata,
|
|
6
7
|
registerDataSourceRequestVars,
|
|
7
8
|
registerDataSourceResponseVars
|
|
8
9
|
} from "../schema.js";
|
|
10
|
+
import { metadata as formMetadata } from "../../form/schema.js";
|
|
9
11
|
import { registerRowVariablesIfAbsent } from "./shared.js";
|
|
10
12
|
import { activeColumns } from "./resolve.js";
|
|
13
|
+
import { createQueryFieldTools } from "../../form/utils/ai-field-tools.js";
|
|
11
14
|
const HARNESS_KEYS = ["id", "groupId", "compatibilityDate"];
|
|
12
15
|
function publicColumnSchema(entry, configure) {
|
|
13
16
|
return entry.schema(configure).pipe(Schema.omit(...HARNESS_KEYS));
|
|
@@ -78,6 +81,16 @@ function safeJsonSchema(schema) {
|
|
|
78
81
|
export function createTableAiTools(deps) {
|
|
79
82
|
const dataSourceSchemas = buildDataSourceExpressionSchemas(deps.configure);
|
|
80
83
|
const rowKeySchema = buildRowKeyExpressionSchema(deps.configure);
|
|
84
|
+
const queryFieldTools = createQueryFieldTools({
|
|
85
|
+
read: () => deps.read().query,
|
|
86
|
+
write: (next) => {
|
|
87
|
+
const working = deps.read();
|
|
88
|
+
working.query = next;
|
|
89
|
+
deps.write(working);
|
|
90
|
+
},
|
|
91
|
+
configure: deps.configure,
|
|
92
|
+
genUuid: deps.genUuid
|
|
93
|
+
});
|
|
81
94
|
return [
|
|
82
95
|
// ---- 信息获取 ----
|
|
83
96
|
{
|
|
@@ -453,6 +466,42 @@ ${fieldErrors.map((e) => `- ${e}`).join("\n")}`;
|
|
|
453
466
|
deps.write(working);
|
|
454
467
|
return { enabled: working.pagination !== void 0, pagination: working.pagination ?? null };
|
|
455
468
|
}
|
|
456
|
-
}
|
|
469
|
+
},
|
|
470
|
+
{
|
|
471
|
+
name: "describe_event_targets",
|
|
472
|
+
description: "List the instances a button can dispatch operations to, and the operations each exposes \u2014 i.e. the valid `target` (an instance id) and `operation` for a button trigger (`{ target, operation }`). Use this to wire search-condition buttons: e.g. a \u641C\u7D22 button whose `event.dispatch` action dispatches `search` to the table, or a \u91CD\u7F6E button dispatching `reset-query`. A trigger's `target` MUST be one of the ids returned here. The table is always listed; the search-condition form is listed once it exists. Operation semantics (e.g. only `search` actually fetches; `reset-query` just prepares state) are explained in the guidance you were given.",
|
|
473
|
+
inputJsonSchema: {
|
|
474
|
+
type: "object",
|
|
475
|
+
properties: {},
|
|
476
|
+
additionalProperties: false
|
|
477
|
+
},
|
|
478
|
+
execute: () => {
|
|
479
|
+
const working = deps.read();
|
|
480
|
+
const targets = [];
|
|
481
|
+
const tableId = typeof working.id === "string" ? working.id : null;
|
|
482
|
+
const tableName = typeof working.displayName === "string" && working.displayName.length > 0 ? working.displayName : tableMetadata.name;
|
|
483
|
+
targets.push({
|
|
484
|
+
id: tableId,
|
|
485
|
+
kind: "table",
|
|
486
|
+
name: tableName,
|
|
487
|
+
operations: tableMetadata.operations.map((o) => ({ id: o.id, name: o.name })),
|
|
488
|
+
...tableId === null ? { note: "This table has no id yet, so a button cannot target it reliably." } : {}
|
|
489
|
+
});
|
|
490
|
+
const query = working.query;
|
|
491
|
+
if (query) {
|
|
492
|
+
const queryId = typeof query.id === "string" ? query.id : null;
|
|
493
|
+
targets.push({
|
|
494
|
+
id: queryId,
|
|
495
|
+
kind: "queryForm",
|
|
496
|
+
name: "\u641C\u7D22\u6761\u4EF6\u8868\u5355",
|
|
497
|
+
operations: formMetadata.operations.map((o) => ({ id: o.id, name: o.name })),
|
|
498
|
+
...queryId === null ? { note: "The query form has no id yet." } : {}
|
|
499
|
+
});
|
|
500
|
+
}
|
|
501
|
+
return targets;
|
|
502
|
+
}
|
|
503
|
+
},
|
|
504
|
+
// ---- 搜索条件(query = 一个 FormConfig;字段工具镜像列工具,放置为新增)----
|
|
505
|
+
...queryFieldTools
|
|
457
506
|
];
|
|
458
507
|
}
|
|
@@ -98,6 +98,7 @@ export declare function LocaleMarkdownWithRow(configure: (env: Environment) => v
|
|
|
98
98
|
readonly locale: "en" | "ja" | "ko";
|
|
99
99
|
readonly message: string;
|
|
100
100
|
}[]], never>>;
|
|
101
|
+
export declare function CelDateDisable(configure: (env: Environment) => void): Schema.Schema<string, string, never>;
|
|
101
102
|
export declare function derivedRowField(configure: (env: Environment) => void, resultType: ResultType): Schema.optional<Schema.Struct<{
|
|
102
103
|
mode: Schema.Literal<["formula", "prefill"]>;
|
|
103
104
|
expression: Schema.Schema<string, string, never>;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Schema } from "effect";
|
|
2
2
|
import { h } from "vue";
|
|
3
3
|
import { SELECTIONS_VAR } from "../../../utils/cel-context.js";
|
|
4
|
+
import { DISABLE_DATE_RESULT, registerInputDateIfAbsent } from "../../../share/disabled-date.js";
|
|
4
5
|
import { Expression, LocaleMarkdown } from "../../../share/expression.js";
|
|
5
6
|
import { Locale } from "../../../share/locale.js";
|
|
6
7
|
import { md } from "../../../share/markdown.js";
|
|
@@ -119,6 +120,15 @@ export function CelRowAccess(configure, options) {
|
|
|
119
120
|
export function LocaleMarkdownWithRow(configure) {
|
|
120
121
|
return LocaleMarkdown({ configure: configureWithRow(configure) });
|
|
121
122
|
}
|
|
123
|
+
export function CelDateDisable(configure) {
|
|
124
|
+
return Expression({
|
|
125
|
+
configure: (env) => {
|
|
126
|
+
configureWithRow(configure)(env);
|
|
127
|
+
registerInputDateIfAbsent(env);
|
|
128
|
+
},
|
|
129
|
+
resultType: DISABLE_DATE_RESULT
|
|
130
|
+
});
|
|
131
|
+
}
|
|
122
132
|
export function derivedRowField(configure, resultType) {
|
|
123
133
|
return derivedField(configureWithRow(configure), resultType);
|
|
124
134
|
}
|
|
@@ -14,7 +14,7 @@ const delegatedProps = reactiveOmit(props, "class");
|
|
|
14
14
|
<template>
|
|
15
15
|
<AlertDialogCancel
|
|
16
16
|
v-bind="delegatedProps"
|
|
17
|
-
:class="cn(buttonVariants(),
|
|
17
|
+
:class="cn(buttonVariants(), props.class)"
|
|
18
18
|
>
|
|
19
19
|
<slot />
|
|
20
20
|
</AlertDialogCancel>
|
|
@@ -7,7 +7,11 @@ type __VLS_ModelProps = {
|
|
|
7
7
|
modelValue?: string;
|
|
8
8
|
};
|
|
9
9
|
type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
|
|
10
|
-
declare
|
|
10
|
+
declare var __VLS_21: {};
|
|
11
|
+
type __VLS_Slots = {} & {
|
|
12
|
+
actions?: (props: typeof __VLS_21) => any;
|
|
13
|
+
};
|
|
14
|
+
declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
11
15
|
stop: () => any;
|
|
12
16
|
submit: () => any;
|
|
13
17
|
"update:modelValue": (value: string) => any;
|
|
@@ -20,5 +24,11 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {},
|
|
|
20
24
|
}>, {
|
|
21
25
|
status: ChatStatus;
|
|
22
26
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
27
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
23
28
|
declare const _default: typeof __VLS_export;
|
|
24
29
|
export default _default;
|
|
30
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
31
|
+
new (): {
|
|
32
|
+
$slots: S;
|
|
33
|
+
};
|
|
34
|
+
};
|
|
@@ -31,6 +31,16 @@ function onKeydown(e) {
|
|
|
31
31
|
@keydown="onKeydown"
|
|
32
32
|
/>
|
|
33
33
|
<InputGroupAddon align="block-end">
|
|
34
|
+
<!-- Host-supplied controls sit at the block-end's leading edge: `mr-auto`
|
|
35
|
+
pushes them hard left while the submit button keeps the trailing
|
|
36
|
+
(right) slot. Only rendered when the host fills the slot, so a bare
|
|
37
|
+
composer stays a lone right-aligned send button. -->
|
|
38
|
+
<div
|
|
39
|
+
v-if="$slots.actions"
|
|
40
|
+
class="mr-auto flex items-center gap-2"
|
|
41
|
+
>
|
|
42
|
+
<slot name="actions" />
|
|
43
|
+
</div>
|
|
34
44
|
<ChatPromptSubmit
|
|
35
45
|
:status="status"
|
|
36
46
|
:disabled="!text.trim()"
|
|
@@ -7,7 +7,11 @@ type __VLS_ModelProps = {
|
|
|
7
7
|
modelValue?: string;
|
|
8
8
|
};
|
|
9
9
|
type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
|
|
10
|
-
declare
|
|
10
|
+
declare var __VLS_21: {};
|
|
11
|
+
type __VLS_Slots = {} & {
|
|
12
|
+
actions?: (props: typeof __VLS_21) => any;
|
|
13
|
+
};
|
|
14
|
+
declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
11
15
|
stop: () => any;
|
|
12
16
|
submit: () => any;
|
|
13
17
|
"update:modelValue": (value: string) => any;
|
|
@@ -20,5 +24,11 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {},
|
|
|
20
24
|
}>, {
|
|
21
25
|
status: ChatStatus;
|
|
22
26
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
27
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
23
28
|
declare const _default: typeof __VLS_export;
|
|
24
29
|
export default _default;
|
|
30
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
31
|
+
new (): {
|
|
32
|
+
$slots: S;
|
|
33
|
+
};
|
|
34
|
+
};
|
|
@@ -9,6 +9,7 @@ type __VLS_Props = {
|
|
|
9
9
|
placeholder?: string;
|
|
10
10
|
scopeLookup: Map<string, ScopeInfo>;
|
|
11
11
|
selectionLookup: Map<string, string>;
|
|
12
|
+
optionLookup: Map<string, string>;
|
|
12
13
|
stepLookup: Map<string, StepChipInfo>;
|
|
13
14
|
};
|
|
14
15
|
declare function insertAtSelection(text: string): void;
|
|
@@ -6,6 +6,7 @@ import { onBeforeUnmount, onMounted, useTemplateRef, watch } from "vue";
|
|
|
6
6
|
import { cn } from "../../../utils/cn";
|
|
7
7
|
import { celHighlighting } from "./cel-language";
|
|
8
8
|
import { scopeChips, scopeLookupFacet } from "./chip-extension";
|
|
9
|
+
import { optionChips, optionLookupFacet } from "./option-chip-extension";
|
|
9
10
|
import { selectionChips, selectionLookupFacet } from "./selection-chip-extension";
|
|
10
11
|
import { stepChips, stepLookupFacet } from "./step-chip-extension";
|
|
11
12
|
defineOptions({ name: "UiCodeMirrorInput" });
|
|
@@ -17,6 +18,7 @@ const props = defineProps({
|
|
|
17
18
|
placeholder: { type: String, required: false },
|
|
18
19
|
scopeLookup: { type: Map, required: true },
|
|
19
20
|
selectionLookup: { type: Map, required: true },
|
|
21
|
+
optionLookup: { type: Map, required: true },
|
|
20
22
|
stepLookup: { type: Map, required: true }
|
|
21
23
|
});
|
|
22
24
|
const emits = defineEmits(["update:modelValue"]);
|
|
@@ -24,6 +26,7 @@ const host = useTemplateRef("host");
|
|
|
24
26
|
let view = null;
|
|
25
27
|
const lookupCompartment = new Compartment();
|
|
26
28
|
const selectionLookupCompartment = new Compartment();
|
|
29
|
+
const optionLookupCompartment = new Compartment();
|
|
27
30
|
const stepLookupCompartment = new Compartment();
|
|
28
31
|
const modeCompartment = new Compartment();
|
|
29
32
|
let applyingExternal = false;
|
|
@@ -80,6 +83,7 @@ function makeState(doc) {
|
|
|
80
83
|
cmPlaceholder(props.placeholder ?? ""),
|
|
81
84
|
lookupCompartment.of(scopeLookupFacet.of(props.scopeLookup)),
|
|
82
85
|
selectionLookupCompartment.of(selectionLookupFacet.of(props.selectionLookup)),
|
|
86
|
+
optionLookupCompartment.of(optionLookupFacet.of(props.optionLookup)),
|
|
83
87
|
stepLookupCompartment.of(stepLookupFacet.of(props.stepLookup)),
|
|
84
88
|
modeCompartment.of(modeExtension(!!props.multiline)),
|
|
85
89
|
editorTheme,
|
|
@@ -89,6 +93,7 @@ function makeState(doc) {
|
|
|
89
93
|
celHighlighting(),
|
|
90
94
|
scopeChips(),
|
|
91
95
|
selectionChips(),
|
|
96
|
+
optionChips(),
|
|
92
97
|
stepChips(),
|
|
93
98
|
EditorView.contentAttributes.of({ "aria-label": props.placeholder ?? "Expression" }),
|
|
94
99
|
EditorView.updateListener.of((update) => {
|
|
@@ -123,6 +128,9 @@ watch(() => props.scopeLookup, (lookup) => {
|
|
|
123
128
|
watch(() => props.selectionLookup, (lookup) => {
|
|
124
129
|
view?.dispatch({ effects: selectionLookupCompartment.reconfigure(selectionLookupFacet.of(lookup)) });
|
|
125
130
|
});
|
|
131
|
+
watch(() => props.optionLookup, (lookup) => {
|
|
132
|
+
view?.dispatch({ effects: optionLookupCompartment.reconfigure(optionLookupFacet.of(lookup)) });
|
|
133
|
+
});
|
|
126
134
|
watch(() => props.stepLookup, (lookup) => {
|
|
127
135
|
view?.dispatch({ effects: stepLookupCompartment.reconfigure(stepLookupFacet.of(lookup)) });
|
|
128
136
|
});
|
|
@@ -9,6 +9,7 @@ type __VLS_Props = {
|
|
|
9
9
|
placeholder?: string;
|
|
10
10
|
scopeLookup: Map<string, ScopeInfo>;
|
|
11
11
|
selectionLookup: Map<string, string>;
|
|
12
|
+
optionLookup: Map<string, string>;
|
|
12
13
|
stepLookup: Map<string, StepChipInfo>;
|
|
13
14
|
};
|
|
14
15
|
declare function insertAtSelection(text: string): void;
|
|
@@ -13,12 +13,13 @@ type __VLS_Props = {
|
|
|
13
13
|
resultType?: string | string[];
|
|
14
14
|
extraVars?: Record<string, VarSpec>;
|
|
15
15
|
unlistedVarsAreDyn?: boolean;
|
|
16
|
+
excludeVars?: string[];
|
|
16
17
|
};
|
|
17
|
-
declare var __VLS_13: {},
|
|
18
|
+
declare var __VLS_13: {}, __VLS_192: {};
|
|
18
19
|
type __VLS_Slots = {} & {
|
|
19
20
|
leading?: (props: typeof __VLS_13) => any;
|
|
20
21
|
} & {
|
|
21
|
-
trailing?: (props: typeof
|
|
22
|
+
trailing?: (props: typeof __VLS_192) => any;
|
|
22
23
|
};
|
|
23
24
|
declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
24
25
|
"update:modelValue": (payload: string) => any;
|
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
import { Icon } from "@iconify/vue";
|
|
3
3
|
import { computed, ref, useSlots, useTemplateRef, watch } from "vue";
|
|
4
4
|
import { buildCheckEnvironment, evaluateExpression } from "../../../share/expression";
|
|
5
|
-
import { injectCELContext, useScopeAncestry, useSelectionRoster, useStepRoster } from "../../../utils/cel-context";
|
|
5
|
+
import { OPTIONS_VAR, SELECTIONS_VAR, injectCELContext, useScopeAncestry, useSelectionRoster, useStepRoster } from "../../../utils/cel-context";
|
|
6
6
|
import { Markdown } from "../markdown";
|
|
7
7
|
import CodeMirrorInput from "./CodeMirrorInput.vue";
|
|
8
8
|
import { buildScopeLookup } from "./scope-refs";
|
|
9
9
|
import { buildSelectionLookup } from "./selection-refs";
|
|
10
10
|
import { buildStepLookup } from "./step-refs";
|
|
11
|
-
import { buildScopeEntries, buildSelectionEntries, buildStepEntries, buildVarEntries, selectShadowedScopes } from "./picker-entries";
|
|
11
|
+
import { buildOptionEntries, buildScopeEntries, buildSelectionEntries, buildStepEntries, buildVarEntries, selectShadowedScopes } from "./picker-entries";
|
|
12
12
|
import { Command, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList } from "../command";
|
|
13
13
|
import { InputGroup, InputGroupAddon, InputGroupButton } from "../input-group";
|
|
14
14
|
import { Popover, PopoverContent, PopoverTrigger } from "../popover";
|
|
@@ -21,24 +21,41 @@ const props = defineProps({
|
|
|
21
21
|
placeholder: { type: String, required: false },
|
|
22
22
|
resultType: { type: [String, Array], required: false },
|
|
23
23
|
extraVars: { type: Object, required: false },
|
|
24
|
-
unlistedVarsAreDyn: { type: Boolean, required: false }
|
|
24
|
+
unlistedVarsAreDyn: { type: Boolean, required: false },
|
|
25
|
+
excludeVars: { type: Array, required: false }
|
|
25
26
|
});
|
|
26
27
|
const emits = defineEmits(["update:modelValue"]);
|
|
27
28
|
const celContext = injectCELContext();
|
|
28
29
|
const scopeAncestry = useScopeAncestry();
|
|
29
30
|
const selectionRoster = useSelectionRoster();
|
|
30
31
|
const stepRoster = useStepRoster();
|
|
31
|
-
const
|
|
32
|
+
const excludedVars = computed(() => new Set(props.excludeVars ?? []));
|
|
33
|
+
const varEntries = computed(
|
|
34
|
+
() => buildVarEntries(celContext, props.extraVars).filter((e) => !excludedVars.value.has(e.id))
|
|
35
|
+
);
|
|
32
36
|
const scopeEntries = computed(() => buildScopeEntries(selectShadowedScopes(scopeAncestry.value)));
|
|
33
|
-
const selectionEntries = computed(
|
|
37
|
+
const selectionEntries = computed(
|
|
38
|
+
() => excludedVars.value.has(SELECTIONS_VAR) ? [] : buildSelectionEntries(selectionRoster.value)
|
|
39
|
+
);
|
|
40
|
+
const optionEntries = computed(
|
|
41
|
+
() => excludedVars.value.has(OPTIONS_VAR) ? [] : buildOptionEntries(selectionRoster.value)
|
|
42
|
+
);
|
|
34
43
|
const stepEntries = computed(() => buildStepEntries(stepRoster.value));
|
|
35
44
|
const scopeLookup = computed(() => buildScopeLookup(scopeAncestry.value));
|
|
36
|
-
const selectionLookup = computed(
|
|
45
|
+
const selectionLookup = computed(
|
|
46
|
+
() => excludedVars.value.has(SELECTIONS_VAR) ? /* @__PURE__ */ new Map() : buildSelectionLookup(selectionRoster.value)
|
|
47
|
+
);
|
|
48
|
+
const optionLookup = computed(
|
|
49
|
+
() => excludedVars.value.has(OPTIONS_VAR) ? /* @__PURE__ */ new Map() : buildSelectionLookup(selectionRoster.value)
|
|
50
|
+
);
|
|
37
51
|
const stepLookup = computed(() => buildStepLookup(stepRoster.value));
|
|
38
|
-
const hasVars = computed(() => varEntries.value.length > 0 || scopeEntries.value.length > 0 || selectionEntries.value.length > 0 || stepEntries.value.length > 0);
|
|
52
|
+
const hasVars = computed(() => varEntries.value.length > 0 || scopeEntries.value.length > 0 || selectionEntries.value.length > 0 || optionEntries.value.length > 0 || stepEntries.value.length > 0);
|
|
39
53
|
const checkEnvironment = computed(() => {
|
|
40
54
|
const vars = /* @__PURE__ */ new Map();
|
|
41
|
-
for (const [name, entry] of Object.entries(celContext))
|
|
55
|
+
for (const [name, entry] of Object.entries(celContext)) {
|
|
56
|
+
if (excludedVars.value.has(name)) continue;
|
|
57
|
+
vars.set(name, entry.type);
|
|
58
|
+
}
|
|
42
59
|
for (const [name, spec] of Object.entries(props.extraVars ?? {})) vars.set(name, spec.type);
|
|
43
60
|
return buildCheckEnvironment(
|
|
44
61
|
[...vars].map(([name, type]) => ({ name, type })),
|
|
@@ -55,6 +72,7 @@ const entries = ref([]);
|
|
|
55
72
|
const shownVars = computed(() => entries.value.filter((e) => e.group === "var"));
|
|
56
73
|
const shownScopes = computed(() => entries.value.filter((e) => e.group === "scope"));
|
|
57
74
|
const shownSelections = computed(() => entries.value.filter((e) => e.group === "selection"));
|
|
75
|
+
const shownOptions = computed(() => entries.value.filter((e) => e.group === "option"));
|
|
58
76
|
const shownSteps = computed(() => entries.value.filter((e) => e.group === "step"));
|
|
59
77
|
const hoveredName = ref(null);
|
|
60
78
|
const editorRef = useTemplateRef("editor");
|
|
@@ -64,7 +82,7 @@ function insertVariable(text) {
|
|
|
64
82
|
}
|
|
65
83
|
watch(open, (v) => {
|
|
66
84
|
if (v) {
|
|
67
|
-
entries.value = [...varEntries.value, ...selectionEntries.value, ...stepEntries.value, ...scopeEntries.value];
|
|
85
|
+
entries.value = [...varEntries.value, ...selectionEntries.value, ...optionEntries.value, ...stepEntries.value, ...scopeEntries.value];
|
|
68
86
|
hoveredName.value = entries.value[0]?.id ?? null;
|
|
69
87
|
}
|
|
70
88
|
});
|
|
@@ -102,6 +120,7 @@ const addonAlign = computed(
|
|
|
102
120
|
:multiline="props.multiline"
|
|
103
121
|
:scope-lookup="scopeLookup"
|
|
104
122
|
:selection-lookup="selectionLookup"
|
|
123
|
+
:option-lookup="optionLookup"
|
|
105
124
|
:step-lookup="stepLookup"
|
|
106
125
|
:class="props.class"
|
|
107
126
|
@update:model-value="(v) => emits('update:modelValue', v)"
|
|
@@ -176,6 +195,29 @@ const addonAlign = computed(
|
|
|
176
195
|
</span>
|
|
177
196
|
</CommandItem>
|
|
178
197
|
</CommandGroup>
|
|
198
|
+
<CommandGroup
|
|
199
|
+
v-if="shownOptions.length > 0"
|
|
200
|
+
heading="全部选项"
|
|
201
|
+
>
|
|
202
|
+
<CommandItem
|
|
203
|
+
v-for="entry in shownOptions"
|
|
204
|
+
:key="entry.id"
|
|
205
|
+
:value="`${entry.display} ${entry.id}`"
|
|
206
|
+
class="cursor-pointer gap-2"
|
|
207
|
+
@select="insertVariable(entry.insert)"
|
|
208
|
+
@mouseenter="hoveredName = entry.id"
|
|
209
|
+
@focus="hoveredName = entry.id"
|
|
210
|
+
>
|
|
211
|
+
<Icon
|
|
212
|
+
icon="fluent:list-20-regular"
|
|
213
|
+
class="size-3.5 shrink-0 text-amber-500"
|
|
214
|
+
/>
|
|
215
|
+
<span class="flex-1 truncate text-xs text-zinc-700">{{ entry.display }}</span>
|
|
216
|
+
<span class="rounded bg-amber-100 px-1.5 py-0.5 font-mono text-[10px] leading-none text-amber-700 select-none">
|
|
217
|
+
{{ entry.type }}
|
|
218
|
+
</span>
|
|
219
|
+
</CommandItem>
|
|
220
|
+
</CommandGroup>
|
|
179
221
|
<CommandGroup
|
|
180
222
|
v-if="shownSteps.length > 0"
|
|
181
223
|
heading="前序步骤"
|
|
@@ -13,12 +13,13 @@ type __VLS_Props = {
|
|
|
13
13
|
resultType?: string | string[];
|
|
14
14
|
extraVars?: Record<string, VarSpec>;
|
|
15
15
|
unlistedVarsAreDyn?: boolean;
|
|
16
|
+
excludeVars?: string[];
|
|
16
17
|
};
|
|
17
|
-
declare var __VLS_13: {},
|
|
18
|
+
declare var __VLS_13: {}, __VLS_192: {};
|
|
18
19
|
type __VLS_Slots = {} & {
|
|
19
20
|
leading?: (props: typeof __VLS_13) => any;
|
|
20
21
|
} & {
|
|
21
|
-
trailing?: (props: typeof
|
|
22
|
+
trailing?: (props: typeof __VLS_192) => any;
|
|
22
23
|
};
|
|
23
24
|
declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
24
25
|
"update:modelValue": (payload: string) => any;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { type Extension, Facet } from '@codemirror/state';
|
|
2
|
+
export declare const optionLookupFacet: Facet<Map<string, string>, Map<string, string>>;
|
|
3
|
+
/** The full option inline-chip extension: decoration plugin + theme. */
|
|
4
|
+
export declare function optionChips(): Extension;
|