@shwfed/config 3.0.4 → 3.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/module.json +1 -1
- package/dist/runtime/components/actions/buttons/2026-04-21/com.shwfed.actions.button.navigation/runtime.vue +4 -10
- package/dist/runtime/components/actions/buttons/2026-05-21/com.shwfed.actions.button.http.download/schema.d.ts +1 -1
- package/dist/runtime/components/actions/buttons/2026-05-21/com.shwfed.actions.button.http.download/schema.js +2 -2
- package/dist/runtime/components/actions/buttons/2026-07-13/com.shwfed.actions.button.state.write/runtime.vue +1 -1
- package/dist/runtime/components/actions/buttons/2026-07-13/com.shwfed.actions.button.state.write/schema.d.ts +4 -2
- package/dist/runtime/components/actions/buttons/2026-07-13/com.shwfed.actions.button.state.write/schema.js +1 -1
- package/dist/runtime/components/actions/utils/steps.d.ts +1 -1
- package/dist/runtime/components/config/blocks/2026-05-06/com.shwfed.block.table/config.d.vue.ts +6 -6
- package/dist/runtime/components/config/blocks/2026-05-06/com.shwfed.block.table/config.vue.d.ts +6 -6
- package/dist/runtime/components/config/blocks/2026-05-06/com.shwfed.block.table/runtime.d.vue.ts +6 -6
- package/dist/runtime/components/config/blocks/2026-05-06/com.shwfed.block.table/runtime.vue.d.ts +6 -6
- package/dist/runtime/components/config/blocks/2026-05-06/com.shwfed.block.table/schema.d.ts +3 -3
- package/dist/runtime/components/config/index.vue +25 -0
- package/dist/runtime/components/config/prune-dialog.d.vue.ts +14 -0
- package/dist/runtime/components/config/prune-dialog.vue +72 -0
- package/dist/runtime/components/config/prune-dialog.vue.d.ts +14 -0
- package/dist/runtime/components/config/schema.js +2 -2
- package/dist/runtime/components/config/use-editor.d.ts +9 -0
- package/dist/runtime/components/config/use-editor.js +37 -9
- package/dist/runtime/components/config/utils/linkage.d.ts +8 -0
- package/dist/runtime/components/config/utils/linkage.js +7 -2
- package/dist/runtime/components/config/utils/prune.d.ts +68 -0
- package/dist/runtime/components/config/utils/prune.js +92 -0
- package/dist/runtime/components/form/fields/2026-04-22/com.shwfed.form.field.text/config.d.vue.ts +22 -22
- package/dist/runtime/components/form/fields/2026-04-22/com.shwfed.form.field.text/config.vue.d.ts +22 -22
- package/dist/runtime/components/form/fields/2026-04-28/com.shwfed.form.field.number/config.d.vue.ts +22 -22
- package/dist/runtime/components/form/fields/2026-04-28/com.shwfed.form.field.number/config.vue.d.ts +22 -22
- package/dist/runtime/components/form/fields/2026-07-13/com.shwfed.form.field.dynamic/config.d.vue.ts +31 -0
- package/dist/runtime/components/form/fields/2026-07-13/com.shwfed.form.field.dynamic/config.vue +191 -0
- package/dist/runtime/components/form/fields/2026-07-13/com.shwfed.form.field.dynamic/config.vue.d.ts +31 -0
- package/dist/runtime/components/form/fields/2026-07-13/com.shwfed.form.field.dynamic/expand.d.ts +49 -0
- package/dist/runtime/components/form/fields/2026-07-13/com.shwfed.form.field.dynamic/expand.js +87 -0
- package/dist/runtime/components/form/fields/2026-07-13/com.shwfed.form.field.dynamic/runtime.d.vue.ts +8 -0
- package/dist/runtime/components/form/fields/2026-07-13/com.shwfed.form.field.dynamic/runtime.vue +72 -0
- package/dist/runtime/components/form/fields/2026-07-13/com.shwfed.form.field.dynamic/runtime.vue.d.ts +8 -0
- package/dist/runtime/components/form/fields/2026-07-13/com.shwfed.form.field.dynamic/schema.d.ts +59 -0
- package/dist/runtime/components/form/fields/2026-07-13/com.shwfed.form.field.dynamic/schema.js +139 -0
- package/dist/runtime/components/form/utils/form-vars.d.ts +5 -15
- package/dist/runtime/components/form/utils/form-vars.js +12 -6
- package/dist/runtime/components/operations/2026-06-11/com.shwfed.operation.http.request.json/schema.js +2 -2
- package/dist/runtime/components/operations/2026-06-15/com.shwfed.operation.http.download/schema.js +2 -2
- package/dist/runtime/components/operations/2026-06-15/com.shwfed.operation.navigation/runtime.js +5 -11
- package/dist/runtime/components/operations/2026-06-15/com.shwfed.operation.navigation/schema.js +1 -1
- package/dist/runtime/components/operations/utils/resolve.d.ts +1 -1
- package/dist/runtime/components/operations/utils/step-vars.d.ts +4 -2
- package/dist/runtime/components/table/columns/2026-04-14/com.shwfed.table.column.select/runtime.vue +1 -21
- package/dist/runtime/components/table/columns/2026-04-14/com.shwfed.table.column.select/schema.d.ts +2 -0
- package/dist/runtime/components/table/columns/2026-04-14/com.shwfed.table.column.select/schema.js +16 -1
- package/dist/runtime/components/table/index.vue +15 -0
- package/dist/runtime/components/table/schema.d.ts +6 -6
- package/dist/runtime/components/table/utils/resolve.d.ts +26 -0
- package/dist/runtime/components/table/utils/resolve.js +2 -1
- package/dist/runtime/components/ui/expression-editor/picker-entries.js +1 -1
- package/dist/runtime/components/ui/expression-editor/step-chip-extension.js +1 -1
- package/dist/runtime/components/ui/expression-editor/step-refs.js +1 -1
- package/dist/runtime/share/event-bus.js +2 -2
- package/dist/runtime/share/navigation.d.ts +1 -0
- package/dist/runtime/share/navigation.js +4 -0
- package/dist/runtime/utils/cel-context.d.ts +2 -2
- package/package.json +1 -1
package/dist/runtime/components/table/columns/2026-04-14/com.shwfed.table.column.select/runtime.vue
CHANGED
|
@@ -1,33 +1,13 @@
|
|
|
1
1
|
<script setup>
|
|
2
2
|
import { computed } from "vue";
|
|
3
|
-
import { Effect } from "effect";
|
|
4
3
|
import { Icon } from "@iconify/vue";
|
|
5
|
-
import { cel as $cel } from "../../../../../utils/cel";
|
|
6
|
-
import { celScope, injectCELContext } from "../../../../../utils/cel-context";
|
|
7
4
|
import { cn } from "../../../../../utils/cn";
|
|
8
5
|
defineOptions({ name: "ShwfedTableSelectRendererRuntime" });
|
|
9
6
|
const props = defineProps({
|
|
10
7
|
column: { type: null, required: true },
|
|
11
8
|
ctx: { type: Object, required: true }
|
|
12
9
|
});
|
|
13
|
-
const
|
|
14
|
-
function evalPredicate(expression, fallback) {
|
|
15
|
-
try {
|
|
16
|
-
return Boolean(Effect.runSync($cel(expression, celScope(celContext))));
|
|
17
|
-
} catch (e) {
|
|
18
|
-
console.error("[shwfed-table] row-selection predicate failed", e);
|
|
19
|
-
return fallback;
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
const canSelect = computed(() => {
|
|
23
|
-
if (props.column.enableRowSelection && !evalPredicate(props.column.enableRowSelection, true)) {
|
|
24
|
-
return false;
|
|
25
|
-
}
|
|
26
|
-
if (props.column.mode === "checkbox" && props.column.enableMultiRowSelection && !evalPredicate(props.column.enableMultiRowSelection, true)) {
|
|
27
|
-
return false;
|
|
28
|
-
}
|
|
29
|
-
return true;
|
|
30
|
-
});
|
|
10
|
+
const canSelect = computed(() => props.ctx.row.getCanSelect());
|
|
31
11
|
function onCheckboxClick(e) {
|
|
32
12
|
if (!canSelect.value) return;
|
|
33
13
|
const { row, table } = props.ctx;
|
package/dist/runtime/components/table/columns/2026-04-14/com.shwfed.table.column.select/schema.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Schema } from 'effect';
|
|
2
2
|
import type { ColumnDef } from '@tanstack/vue-table';
|
|
3
3
|
import type { Environment } from '../../../../../vendor/cel-js/lib/index.js';
|
|
4
|
+
import type { ColumnRowSelection } from '../../../utils/resolve.js';
|
|
4
5
|
export declare const type: "com.shwfed.table.column.select";
|
|
5
6
|
export declare const compatibilityDate: "2026-04-14";
|
|
6
7
|
export declare const metadata: {
|
|
@@ -20,4 +21,5 @@ export declare function schema(configure: (env: Environment) => void): Schema.St
|
|
|
20
21
|
}>;
|
|
21
22
|
export type Value = Schema.Schema.Type<ReturnType<typeof schema>>;
|
|
22
23
|
export declare function defaults(): Partial<Value>;
|
|
24
|
+
export declare const rowSelection: ColumnRowSelection;
|
|
23
25
|
export declare function toColumnDef(value: Value): Partial<ColumnDef<unknown, unknown>>;
|
package/dist/runtime/components/table/columns/2026-04-14/com.shwfed.table.column.select/schema.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Schema } from "effect";
|
|
1
|
+
import { Effect, Schema } from "effect";
|
|
2
2
|
import { h } from "vue";
|
|
3
3
|
import { Expression } from "../../../../../share/expression.js";
|
|
4
4
|
import { columnIdentityFields, registerRowVariablesIfAbsent } from "../../../utils/shared.js";
|
|
@@ -40,6 +40,21 @@ export function defaults() {
|
|
|
40
40
|
mode: "checkbox"
|
|
41
41
|
};
|
|
42
42
|
}
|
|
43
|
+
export const rowSelection = (value, deps) => {
|
|
44
|
+
const predicates = [
|
|
45
|
+
value.enableRowSelection,
|
|
46
|
+
value.mode === "checkbox" ? value.enableMultiRowSelection : void 0
|
|
47
|
+
].filter((e) => typeof e === "string" && e.trim() !== "");
|
|
48
|
+
if (predicates.length === 0) return () => true;
|
|
49
|
+
return (row, index) => predicates.every((expression) => {
|
|
50
|
+
try {
|
|
51
|
+
return Boolean(Effect.runSync(deps.$cel(expression, deps.rowScope(row, index))));
|
|
52
|
+
} catch (e) {
|
|
53
|
+
console.error("[shwfed-table] row-selection predicate failed", e);
|
|
54
|
+
return true;
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
};
|
|
43
58
|
export function toColumnDef(value) {
|
|
44
59
|
return {
|
|
45
60
|
header: (ctx) => h(Header, { column: value, ctx }),
|
|
@@ -324,6 +324,20 @@ const getRowId = createRowKeyResolver({
|
|
|
324
324
|
}
|
|
325
325
|
}
|
|
326
326
|
});
|
|
327
|
+
const rowSelectionPredicates = computed(() => effectiveColumns.value.flatMap((col) => {
|
|
328
|
+
const contribute = findColumn(col.type, col.compatibilityDate)?.rowSelection;
|
|
329
|
+
if (!contribute) return [];
|
|
330
|
+
return [contribute(col, {
|
|
331
|
+
$cel,
|
|
332
|
+
rowScope: (row, index) => celScope(inheritedContext, { row, index })
|
|
333
|
+
})];
|
|
334
|
+
}));
|
|
335
|
+
function canSelectRow(row) {
|
|
336
|
+
const predicates = rowSelectionPredicates.value;
|
|
337
|
+
if (predicates.length === 0) return true;
|
|
338
|
+
const index = getDisplayIndex(row);
|
|
339
|
+
return predicates.every((p) => p(row.original, index));
|
|
340
|
+
}
|
|
327
341
|
const tableApi = useVueTable({
|
|
328
342
|
get columns() {
|
|
329
343
|
return columns.value;
|
|
@@ -331,6 +345,7 @@ const tableApi = useVueTable({
|
|
|
331
345
|
get data() {
|
|
332
346
|
return rowData.value;
|
|
333
347
|
},
|
|
348
|
+
enableRowSelection: canSelectRow,
|
|
334
349
|
get manualPagination() {
|
|
335
350
|
return isManualPagination.value;
|
|
336
351
|
},
|
|
@@ -352,6 +352,9 @@ export declare function TableConfig(configure: (env: Environment) => void): Sche
|
|
|
352
352
|
readonly expanded?: boolean | {
|
|
353
353
|
readonly [x: string]: boolean;
|
|
354
354
|
} | undefined;
|
|
355
|
+
readonly rowSelection?: {
|
|
356
|
+
readonly [x: string]: boolean;
|
|
357
|
+
} | undefined;
|
|
355
358
|
readonly columnVisibility?: {
|
|
356
359
|
readonly [x: string]: boolean;
|
|
357
360
|
} | undefined;
|
|
@@ -372,9 +375,6 @@ export declare function TableConfig(configure: (env: Environment) => void): Sche
|
|
|
372
375
|
readonly columnSizing?: {
|
|
373
376
|
readonly [x: string]: number;
|
|
374
377
|
} | undefined;
|
|
375
|
-
readonly rowSelection?: {
|
|
376
|
-
readonly [x: string]: boolean;
|
|
377
|
-
} | undefined;
|
|
378
378
|
} | undefined;
|
|
379
379
|
}, Schema.Struct<{
|
|
380
380
|
kind: Schema.tag<"shwfed.component.table">;
|
|
@@ -1021,6 +1021,9 @@ export declare function createTableConfig(body: Omit<Schema.Schema.Type<ReturnTy
|
|
|
1021
1021
|
readonly expanded?: boolean | {
|
|
1022
1022
|
readonly [x: string]: boolean;
|
|
1023
1023
|
} | undefined;
|
|
1024
|
+
readonly rowSelection?: {
|
|
1025
|
+
readonly [x: string]: boolean;
|
|
1026
|
+
} | undefined;
|
|
1024
1027
|
readonly columnVisibility?: {
|
|
1025
1028
|
readonly [x: string]: boolean;
|
|
1026
1029
|
} | undefined;
|
|
@@ -1041,9 +1044,6 @@ export declare function createTableConfig(body: Omit<Schema.Schema.Type<ReturnTy
|
|
|
1041
1044
|
readonly columnSizing?: {
|
|
1042
1045
|
readonly [x: string]: number;
|
|
1043
1046
|
} | undefined;
|
|
1044
|
-
readonly rowSelection?: {
|
|
1045
|
-
readonly [x: string]: boolean;
|
|
1046
|
-
} | undefined;
|
|
1047
1047
|
} | undefined;
|
|
1048
1048
|
kind: typeof KIND;
|
|
1049
1049
|
};
|
|
@@ -64,6 +64,26 @@ export type ColumnExpandDeps = Readonly<{
|
|
|
64
64
|
seen: ReadonlySet<string>;
|
|
65
65
|
}>;
|
|
66
66
|
export type ColumnExpand = (value: any, deps: ColumnExpandDeps) => ColumnValue[];
|
|
67
|
+
/**
|
|
68
|
+
* Capabilities a column's row-selection predicate needs from the host.
|
|
69
|
+
*/
|
|
70
|
+
export type RowSelectionDeps = Readonly<{
|
|
71
|
+
$cel: CelEvaluator;
|
|
72
|
+
/**
|
|
73
|
+
* CEL scope for one row — inherited host vars plus `row` / `index`, matching
|
|
74
|
+
* what a cell sees. Lazy, so a predicate only subscribes to the vars it reads.
|
|
75
|
+
*/
|
|
76
|
+
rowScope: (row: unknown, index: number) => Record<string, unknown>;
|
|
77
|
+
}>;
|
|
78
|
+
/**
|
|
79
|
+
* Whether a row may be selected, per this column's config. A column exporting
|
|
80
|
+
* this contributes to the table-level `enableRowSelection` option, so TanStack
|
|
81
|
+
* itself knows which rows are selectable: select-all, shift-range and
|
|
82
|
+
* `row.getCanSelect()` then all agree with what the cell renders. Without it,
|
|
83
|
+
* a cell that merely *renders* itself disabled still gets checked by select-all
|
|
84
|
+
* — and the user cannot uncheck it. Columns with no selection semantics omit it.
|
|
85
|
+
*/
|
|
86
|
+
export type ColumnRowSelection = (value: any, deps: RowSelectionDeps) => (row: unknown, index: number) => boolean;
|
|
67
87
|
/**
|
|
68
88
|
* Capabilities a column-migration function may need from the host. Mirrors
|
|
69
89
|
* the form host's `MigrationContext` so cross-host helpers can share a
|
|
@@ -133,6 +153,12 @@ export type ColumnEntry = Readonly<{
|
|
|
133
153
|
* `translateColumn` only ever sees the leaf columns it emits.
|
|
134
154
|
*/
|
|
135
155
|
expand?: ColumnExpand;
|
|
156
|
+
/**
|
|
157
|
+
* Present iff this entry has a say in which rows are selectable (today: the
|
|
158
|
+
* select column). The host folds every present one into TanStack's
|
|
159
|
+
* `enableRowSelection`. See `ColumnRowSelection`.
|
|
160
|
+
*/
|
|
161
|
+
rowSelection?: ColumnRowSelection;
|
|
136
162
|
}>;
|
|
137
163
|
export declare const COLUMNS: ReadonlyArray<ColumnEntry>;
|
|
138
164
|
export declare function allColumnSchemas(configure: (env: Environment) => void): ReadonlyArray<AnySchema>;
|
|
@@ -85,7 +85,8 @@ export const COLUMNS = registry.ENTRIES.map((e) => ({
|
|
|
85
85
|
...e.module.migrate !== void 0 ? { migrate: e.module.migrate } : {},
|
|
86
86
|
...e.module.migrateFrom !== void 0 ? { migrateFrom: e.module.migrateFrom } : {},
|
|
87
87
|
...e.module.defaults !== void 0 ? { defaults: e.module.defaults } : {},
|
|
88
|
-
...e.module.expand !== void 0 ? { expand: e.module.expand } : {}
|
|
88
|
+
...e.module.expand !== void 0 ? { expand: e.module.expand } : {},
|
|
89
|
+
...e.module.rowSelection !== void 0 ? { rowSelection: e.module.rowSelection } : {}
|
|
89
90
|
}));
|
|
90
91
|
const migrationTargets = (() => {
|
|
91
92
|
const map = /* @__PURE__ */ new Map();
|
|
@@ -39,7 +39,7 @@ export function buildStepEntries(roster) {
|
|
|
39
39
|
return roster.filter((step) => step.valid).map((step) => ({
|
|
40
40
|
id: `step:${step.id}`,
|
|
41
41
|
group: "step",
|
|
42
|
-
insert: `${STEPS_VAR}[
|
|
42
|
+
insert: `${STEPS_VAR}[?${JSON.stringify(step.id)}]`,
|
|
43
43
|
display: step.label,
|
|
44
44
|
label: "\u524D\u5E8F\u6B65\u9AA4",
|
|
45
45
|
type: "dyn",
|
|
@@ -76,7 +76,7 @@ const chipPlugin = ViewPlugin.fromClass(
|
|
|
76
76
|
{
|
|
77
77
|
decorations: (plugin) => plugin.decorations,
|
|
78
78
|
// Atomic so the caret steps over a chip and Backspace removes the whole
|
|
79
|
-
// `steps["id"]` at once — matching the scope/selection chips' feel.
|
|
79
|
+
// `steps[?"id"]` at once — matching the scope/selection chips' feel.
|
|
80
80
|
provide: (plugin) => EditorView.atomicRanges.of((view) => view.plugin(plugin)?.decorations ?? Decoration.none)
|
|
81
81
|
}
|
|
82
82
|
);
|
|
@@ -4,10 +4,10 @@ export const Trigger = Schema.Struct({
|
|
|
4
4
|
// Additive + optional like `compatibilityDate`/`params` below, so every
|
|
5
5
|
// pre-existing `{ target, operation }` trigger keeps loading. Minted by the
|
|
6
6
|
// trigger editor on add; it is the address under which this step's output is
|
|
7
|
-
// published for later steps (`steps["<id>"]`), so it must survive reorders —
|
|
7
|
+
// published for later steps (`steps[?"<id>"]`), so it must survive reorders —
|
|
8
8
|
// which the list index, the only other row identity, does not.
|
|
9
9
|
id: Schema.optional(Schema.UUID.annotations({
|
|
10
|
-
description: '\u89E6\u53D1\u884C\u7684\u7A33\u5B9A\u6807\u8BC6\uFF0C\u540E\u7EED\u6B65\u9AA4\u7ECF steps["<id>"] \u5F15\u7528\u672C\u6B65\u8F93\u51FA'
|
|
10
|
+
description: '\u89E6\u53D1\u884C\u7684\u7A33\u5B9A\u6807\u8BC6\uFF0C\u540E\u7EED\u6B65\u9AA4\u7ECF steps[?"<id>"] \u5F15\u7528\u672C\u6B65\u8F93\u51FA'
|
|
11
11
|
})),
|
|
12
12
|
target: Schema.UUID.annotations({
|
|
13
13
|
description: "\u76EE\u6807\u7956\u5148\u5B9E\u4F8B\u7684 ID"
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function isAbsoluteUrl(url: string): boolean;
|
|
@@ -108,10 +108,10 @@ export declare function useSelectionRoster(): Ref<ReadonlyArray<SelectionFieldRe
|
|
|
108
108
|
* surfaces it. Unlike a selection field a trigger row has no designer-given
|
|
109
109
|
* name, so `label` is its position —「第 N 步」— computed live from the row's
|
|
110
110
|
* current index and thus following drag-and-drop reorders for free (the
|
|
111
|
-
* persisted reference is `steps["<id>"]`; the label is never stored).
|
|
111
|
+
* persisted reference is `steps[?"<id>"]`; the label is never stored).
|
|
112
112
|
*/
|
|
113
113
|
export type StepRef = Readonly<{
|
|
114
|
-
/** Trigger-row uuid keyed into `steps["<id>"]` — the publish address. */
|
|
114
|
+
/** Trigger-row uuid keyed into `steps[?"<id>"]` — the publish address. */
|
|
115
115
|
id: string;
|
|
116
116
|
/** Position label,「第 N 步」, derived from the row's current index. */
|
|
117
117
|
label: string;
|