@shwfed/config 2.2.4 → 2.3.0

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 (62) hide show
  1. package/dist/module.json +1 -1
  2. package/dist/runtime/components/config/blocks/2026-05-06/com.shwfed.block.table/config.d.vue.ts +8 -8
  3. package/dist/runtime/components/config/blocks/2026-05-06/com.shwfed.block.table/config.vue.d.ts +8 -8
  4. package/dist/runtime/components/config/blocks/2026-05-06/com.shwfed.block.table/runtime.d.vue.ts +8 -8
  5. package/dist/runtime/components/config/blocks/2026-05-06/com.shwfed.block.table/runtime.vue.d.ts +8 -8
  6. package/dist/runtime/components/config/blocks/2026-05-06/com.shwfed.block.table/schema.d.ts +9 -15
  7. package/dist/runtime/components/form/fields/2026-05-13/com.shwfed.form.field.list/row.d.vue.ts +3 -4
  8. package/dist/runtime/components/form/fields/2026-05-13/com.shwfed.form.field.list/row.vue +1 -1
  9. package/dist/runtime/components/form/fields/2026-05-13/com.shwfed.form.field.list/row.vue.d.ts +3 -4
  10. package/dist/runtime/components/form/fields/2026-05-13/com.shwfed.form.field.list/runtime.vue +9 -2
  11. package/dist/runtime/components/form/fields/2026-05-18/com.shwfed.form.field.table/config.d.vue.ts +2 -2
  12. package/dist/runtime/components/form/fields/2026-05-18/com.shwfed.form.field.table/config.vue +32 -52
  13. package/dist/runtime/components/form/fields/2026-05-18/com.shwfed.form.field.table/config.vue.d.ts +2 -2
  14. package/dist/runtime/components/form/fields/2026-05-18/com.shwfed.form.field.table/runtime.vue +19 -8
  15. package/dist/runtime/components/form/fields/2026-05-18/com.shwfed.form.field.table/schema.d.ts +2 -2
  16. package/dist/runtime/components/form/fields/2026-05-18/com.shwfed.form.field.table/schema.js +4 -3
  17. package/dist/runtime/components/form/utils/state.d.ts +10 -2
  18. package/dist/runtime/components/form/utils/state.js +10 -3
  19. package/dist/runtime/components/table/columns/2026-05-13/com.shwfed.table.column.switch/config.vue +25 -0
  20. package/dist/runtime/components/table/columns/2026-05-13/com.shwfed.table.column.switch/runtime.vue +2 -8
  21. package/dist/runtime/components/table/columns/2026-05-13/com.shwfed.table.column.switch/schema.d.ts +4 -0
  22. package/dist/runtime/components/table/columns/2026-05-13/com.shwfed.table.column.switch/schema.js +5 -0
  23. package/dist/runtime/components/table/columns/2026-05-20/com.shwfed.table.column.combobox-single/config.d.vue.ts +133 -0
  24. package/dist/runtime/components/table/columns/2026-05-20/com.shwfed.table.column.combobox-single/config.vue +533 -0
  25. package/dist/runtime/components/table/columns/2026-05-20/com.shwfed.table.column.combobox-single/config.vue.d.ts +133 -0
  26. package/dist/runtime/components/table/columns/2026-05-20/com.shwfed.table.column.combobox-single/runtime.d.vue.ts +9 -0
  27. package/dist/runtime/components/table/columns/2026-05-20/com.shwfed.table.column.combobox-single/runtime.vue +237 -0
  28. package/dist/runtime/components/table/columns/2026-05-20/com.shwfed.table.column.combobox-single/runtime.vue.d.ts +9 -0
  29. package/dist/runtime/components/table/columns/2026-05-20/com.shwfed.table.column.combobox-single/schema.d.ts +124 -0
  30. package/dist/runtime/components/table/columns/2026-05-20/com.shwfed.table.column.combobox-single/schema.js +96 -0
  31. package/dist/runtime/components/table/columns/2026-05-20/com.shwfed.table.column.number-input/config.d.vue.ts +10 -0
  32. package/dist/runtime/components/table/columns/2026-05-20/com.shwfed.table.column.number-input/config.vue +475 -0
  33. package/dist/runtime/components/table/columns/2026-05-20/com.shwfed.table.column.number-input/config.vue.d.ts +10 -0
  34. package/dist/runtime/components/table/columns/2026-05-20/com.shwfed.table.column.number-input/runtime.d.vue.ts +9 -0
  35. package/dist/runtime/components/table/columns/2026-05-20/com.shwfed.table.column.number-input/runtime.vue +156 -0
  36. package/dist/runtime/components/table/columns/2026-05-20/com.shwfed.table.column.number-input/runtime.vue.d.ts +9 -0
  37. package/dist/runtime/components/table/columns/2026-05-20/com.shwfed.table.column.number-input/schema.d.ts +56 -0
  38. package/dist/runtime/components/table/columns/2026-05-20/com.shwfed.table.column.number-input/schema.js +81 -0
  39. package/dist/runtime/components/table/columns/2026-05-20/com.shwfed.table.column.text-input/config.d.vue.ts +10 -0
  40. package/dist/runtime/components/table/columns/2026-05-20/com.shwfed.table.column.text-input/config.vue +292 -0
  41. package/dist/runtime/components/table/columns/2026-05-20/com.shwfed.table.column.text-input/config.vue.d.ts +10 -0
  42. package/dist/runtime/components/table/columns/2026-05-20/com.shwfed.table.column.text-input/runtime.d.vue.ts +9 -0
  43. package/dist/runtime/components/table/columns/2026-05-20/com.shwfed.table.column.text-input/runtime.vue +140 -0
  44. package/dist/runtime/components/table/columns/2026-05-20/com.shwfed.table.column.text-input/runtime.vue.d.ts +9 -0
  45. package/dist/runtime/components/table/columns/2026-05-20/com.shwfed.table.column.text-input/schema.d.ts +50 -0
  46. package/dist/runtime/components/table/columns/2026-05-20/com.shwfed.table.column.text-input/schema.js +53 -0
  47. package/dist/runtime/components/table/config.d.vue.ts +2 -0
  48. package/dist/runtime/components/table/config.vue +136 -109
  49. package/dist/runtime/components/table/config.vue.d.ts +2 -0
  50. package/dist/runtime/components/table/index.d.vue.ts +2 -2
  51. package/dist/runtime/components/table/index.vue +46 -53
  52. package/dist/runtime/components/table/index.vue.d.ts +2 -2
  53. package/dist/runtime/components/table/row-provider.d.vue.ts +23 -0
  54. package/dist/runtime/components/table/row-provider.vue +55 -0
  55. package/dist/runtime/components/table/row-provider.vue.d.ts +23 -0
  56. package/dist/runtime/components/table/schema.d.ts +17 -29
  57. package/dist/runtime/components/table/schema.js +22 -18
  58. package/dist/runtime/components/table/utils/shared.d.ts +28 -0
  59. package/dist/runtime/components/table/utils/shared.js +40 -0
  60. package/dist/runtime/components/ui/field/index.js +6 -1
  61. package/dist/runtime/components/ui/input/Input.vue +1 -1
  62. package/package.json +1 -1
package/dist/module.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "shwfed",
3
3
  "configKey": "shwfed",
4
- "version": "2.2.4",
4
+ "version": "2.3.0",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.2",
7
7
  "unbuild": "unknown"
@@ -34,11 +34,11 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {},
34
34
  readonly message: string;
35
35
  }[]] | undefined;
36
36
  }[];
37
- readonly dataSource: {
37
+ readonly dataSource?: {
38
38
  readonly data: string;
39
39
  readonly request?: string | undefined;
40
40
  readonly total?: string | undefined;
41
- };
41
+ } | undefined;
42
42
  readonly actions?: {
43
43
  readonly size: "default" | "sm" | "xs";
44
44
  readonly style?: string | undefined;
@@ -147,9 +147,9 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {},
147
147
  readonly locale: "en" | "ja" | "ko";
148
148
  readonly message: string;
149
149
  }[]] | undefined;
150
- readonly pageSizes: readonly number[];
151
- readonly pageIndex: number;
152
150
  readonly pageSize: number;
151
+ readonly pageSizes?: readonly number[] | undefined;
152
+ readonly pageIndex?: number | undefined;
153
153
  } | undefined;
154
154
  readonly initialState?: {
155
155
  readonly expanded?: boolean | {
@@ -209,11 +209,11 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {},
209
209
  readonly message: string;
210
210
  }[]] | undefined;
211
211
  }[];
212
- readonly dataSource: {
212
+ readonly dataSource?: {
213
213
  readonly data: string;
214
214
  readonly request?: string | undefined;
215
215
  readonly total?: string | undefined;
216
- };
216
+ } | undefined;
217
217
  readonly actions?: {
218
218
  readonly size: "default" | "sm" | "xs";
219
219
  readonly style?: string | undefined;
@@ -322,9 +322,9 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {},
322
322
  readonly locale: "en" | "ja" | "ko";
323
323
  readonly message: string;
324
324
  }[]] | undefined;
325
- readonly pageSizes: readonly number[];
326
- readonly pageIndex: number;
327
325
  readonly pageSize: number;
326
+ readonly pageSizes?: readonly number[] | undefined;
327
+ readonly pageIndex?: number | undefined;
328
328
  } | undefined;
329
329
  readonly initialState?: {
330
330
  readonly expanded?: boolean | {
@@ -34,11 +34,11 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {},
34
34
  readonly message: string;
35
35
  }[]] | undefined;
36
36
  }[];
37
- readonly dataSource: {
37
+ readonly dataSource?: {
38
38
  readonly data: string;
39
39
  readonly request?: string | undefined;
40
40
  readonly total?: string | undefined;
41
- };
41
+ } | undefined;
42
42
  readonly actions?: {
43
43
  readonly size: "default" | "sm" | "xs";
44
44
  readonly style?: string | undefined;
@@ -147,9 +147,9 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {},
147
147
  readonly locale: "en" | "ja" | "ko";
148
148
  readonly message: string;
149
149
  }[]] | undefined;
150
- readonly pageSizes: readonly number[];
151
- readonly pageIndex: number;
152
150
  readonly pageSize: number;
151
+ readonly pageSizes?: readonly number[] | undefined;
152
+ readonly pageIndex?: number | undefined;
153
153
  } | undefined;
154
154
  readonly initialState?: {
155
155
  readonly expanded?: boolean | {
@@ -209,11 +209,11 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {},
209
209
  readonly message: string;
210
210
  }[]] | undefined;
211
211
  }[];
212
- readonly dataSource: {
212
+ readonly dataSource?: {
213
213
  readonly data: string;
214
214
  readonly request?: string | undefined;
215
215
  readonly total?: string | undefined;
216
- };
216
+ } | undefined;
217
217
  readonly actions?: {
218
218
  readonly size: "default" | "sm" | "xs";
219
219
  readonly style?: string | undefined;
@@ -322,9 +322,9 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {},
322
322
  readonly locale: "en" | "ja" | "ko";
323
323
  readonly message: string;
324
324
  }[]] | undefined;
325
- readonly pageSizes: readonly number[];
326
- readonly pageIndex: number;
327
325
  readonly pageSize: number;
326
+ readonly pageSizes?: readonly number[] | undefined;
327
+ readonly pageIndex?: number | undefined;
328
328
  } | undefined;
329
329
  readonly initialState?: {
330
330
  readonly expanded?: boolean | {
@@ -29,11 +29,11 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_ModelProps, {},
29
29
  readonly message: string;
30
30
  }[]] | undefined;
31
31
  }[];
32
- readonly dataSource: {
32
+ readonly dataSource?: {
33
33
  readonly data: string;
34
34
  readonly request?: string | undefined;
35
35
  readonly total?: string | undefined;
36
- };
36
+ } | undefined;
37
37
  readonly actions?: {
38
38
  readonly size: "default" | "sm" | "xs";
39
39
  readonly style?: string | undefined;
@@ -142,9 +142,9 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_ModelProps, {},
142
142
  readonly locale: "en" | "ja" | "ko";
143
143
  readonly message: string;
144
144
  }[]] | undefined;
145
- readonly pageSizes: readonly number[];
146
- readonly pageIndex: number;
147
145
  readonly pageSize: number;
146
+ readonly pageSizes?: readonly number[] | undefined;
147
+ readonly pageIndex?: number | undefined;
148
148
  } | undefined;
149
149
  readonly initialState?: {
150
150
  readonly expanded?: boolean | {
@@ -204,11 +204,11 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_ModelProps, {},
204
204
  readonly message: string;
205
205
  }[]] | undefined;
206
206
  }[];
207
- readonly dataSource: {
207
+ readonly dataSource?: {
208
208
  readonly data: string;
209
209
  readonly request?: string | undefined;
210
210
  readonly total?: string | undefined;
211
- };
211
+ } | undefined;
212
212
  readonly actions?: {
213
213
  readonly size: "default" | "sm" | "xs";
214
214
  readonly style?: string | undefined;
@@ -317,9 +317,9 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_ModelProps, {},
317
317
  readonly locale: "en" | "ja" | "ko";
318
318
  readonly message: string;
319
319
  }[]] | undefined;
320
- readonly pageSizes: readonly number[];
321
- readonly pageIndex: number;
322
320
  readonly pageSize: number;
321
+ readonly pageSizes?: readonly number[] | undefined;
322
+ readonly pageIndex?: number | undefined;
323
323
  } | undefined;
324
324
  readonly initialState?: {
325
325
  readonly expanded?: boolean | {
@@ -29,11 +29,11 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_ModelProps, {},
29
29
  readonly message: string;
30
30
  }[]] | undefined;
31
31
  }[];
32
- readonly dataSource: {
32
+ readonly dataSource?: {
33
33
  readonly data: string;
34
34
  readonly request?: string | undefined;
35
35
  readonly total?: string | undefined;
36
- };
36
+ } | undefined;
37
37
  readonly actions?: {
38
38
  readonly size: "default" | "sm" | "xs";
39
39
  readonly style?: string | undefined;
@@ -142,9 +142,9 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_ModelProps, {},
142
142
  readonly locale: "en" | "ja" | "ko";
143
143
  readonly message: string;
144
144
  }[]] | undefined;
145
- readonly pageSizes: readonly number[];
146
- readonly pageIndex: number;
147
145
  readonly pageSize: number;
146
+ readonly pageSizes?: readonly number[] | undefined;
147
+ readonly pageIndex?: number | undefined;
148
148
  } | undefined;
149
149
  readonly initialState?: {
150
150
  readonly expanded?: boolean | {
@@ -204,11 +204,11 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_ModelProps, {},
204
204
  readonly message: string;
205
205
  }[]] | undefined;
206
206
  }[];
207
- readonly dataSource: {
207
+ readonly dataSource?: {
208
208
  readonly data: string;
209
209
  readonly request?: string | undefined;
210
210
  readonly total?: string | undefined;
211
- };
211
+ } | undefined;
212
212
  readonly actions?: {
213
213
  readonly size: "default" | "sm" | "xs";
214
214
  readonly style?: string | undefined;
@@ -317,9 +317,9 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_ModelProps, {},
317
317
  readonly locale: "en" | "ja" | "ko";
318
318
  readonly message: string;
319
319
  }[]] | undefined;
320
- readonly pageSizes: readonly number[];
321
- readonly pageIndex: number;
322
320
  readonly pageSize: number;
321
+ readonly pageSizes?: readonly number[] | undefined;
322
+ readonly pageIndex?: number | undefined;
323
323
  } | undefined;
324
324
  readonly initialState?: {
325
325
  readonly expanded?: boolean | {
@@ -44,11 +44,11 @@ export declare function schema(configure: (env: Environment) => void, _blockRef:
44
44
  readonly message: string;
45
45
  }[]] | undefined;
46
46
  }[];
47
- readonly dataSource: {
47
+ readonly dataSource?: {
48
48
  readonly data: string;
49
49
  readonly request?: string | undefined;
50
50
  readonly total?: string | undefined;
51
- };
51
+ } | undefined;
52
52
  readonly actions?: {
53
53
  readonly size: "default" | "sm" | "xs";
54
54
  readonly style?: string | undefined;
@@ -157,9 +157,9 @@ export declare function schema(configure: (env: Environment) => void, _blockRef:
157
157
  readonly locale: "en" | "ja" | "ko";
158
158
  readonly message: string;
159
159
  }[]] | undefined;
160
- readonly pageSizes: readonly number[];
161
- readonly pageIndex: number;
162
160
  readonly pageSize: number;
161
+ readonly pageSizes?: readonly number[] | undefined;
162
+ readonly pageIndex?: number | undefined;
163
163
  } | undefined;
164
164
  readonly initialState?: {
165
165
  readonly expanded?: boolean | {
@@ -213,11 +213,11 @@ export declare function schema(configure: (env: Environment) => void, _blockRef:
213
213
  }>>, {
214
214
  default: () => never[];
215
215
  }>;
216
- dataSource: Schema.Struct<{
216
+ dataSource: Schema.optional<Schema.Struct<{
217
217
  request: Schema.optional<Schema.Schema<string, string, never>>;
218
218
  data: Schema.Schema<string, string, never>;
219
219
  total: Schema.optional<Schema.Schema<string, string, never>>;
220
- }>;
220
+ }>>;
221
221
  actions: Schema.optional<Schema.Struct<{
222
222
  size: Schema.optionalWith<Schema.Literal<["default", "sm", "xs"]>, {
223
223
  default: () => "default";
@@ -359,15 +359,9 @@ export declare function schema(configure: (env: Environment) => void, _blockRef:
359
359
  cellStyle: Schema.optional<Schema.Schema<string, string, never>>;
360
360
  style: Schema.optional<typeof Schema.String>;
361
361
  pagination: Schema.optional<Schema.Struct<{
362
- pageSizes: Schema.optionalWith<Schema.Array$<Schema.filter<Schema.filter<typeof Schema.Number>>>, {
363
- default: () => number[];
364
- }>;
365
- pageIndex: Schema.optionalWith<Schema.filter<Schema.filter<typeof Schema.Number>>, {
366
- default: () => number;
367
- }>;
368
- pageSize: Schema.optionalWith<Schema.filter<Schema.filter<typeof Schema.Number>>, {
369
- default: () => number;
370
- }>;
362
+ pageSize: Schema.refine<number, Schema.filter<typeof Schema.Number>>;
363
+ pageSizes: Schema.optional<Schema.Array$<Schema.filter<Schema.filter<typeof Schema.Number>>>>;
364
+ pageIndex: Schema.optional<Schema.filter<Schema.filter<typeof Schema.Number>>>;
371
365
  left: Schema.optional<Schema.TupleType<readonly [Schema.Struct<{
372
366
  locale: Schema.Literal<["zh"]>;
373
367
  message: Schema.SchemaClass<string, string, never>;
@@ -1,17 +1,16 @@
1
1
  import type { FormUnitValue } from '../../../schema.js';
2
- import { type FormState } from '../../../utils/state.js';
3
2
  type __VLS_Props = {
4
3
  unit: FormUnitValue;
5
4
  index: number;
6
5
  };
7
6
  type __VLS_ModelProps = {
8
- modelValue: FormState;
7
+ modelValue: unknown;
9
8
  };
10
9
  type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
11
10
  declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
12
- "update:modelValue": (value: FormState) => any;
11
+ "update:modelValue": (value: unknown) => any;
13
12
  }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
14
- "onUpdate:modelValue"?: ((value: FormState) => any) | undefined;
13
+ "onUpdate:modelValue"?: ((value: unknown) => any) | undefined;
15
14
  }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
16
15
  declare const _default: typeof __VLS_export;
17
16
  export default _default;
@@ -6,7 +6,7 @@ import FormUnitRenderer from "../../../FormUnitRenderer.vue";
6
6
  import { useDerived, useDerivedQuiescence } from "../../../utils/derived";
7
7
  import { provideFormState } from "../../../utils/state";
8
8
  defineOptions({ name: "ShwfedListFieldRow" });
9
- const state = defineModel({ type: Object, ...{ required: true } });
9
+ const state = defineModel({ type: null, ...{ required: true } });
10
10
  const props = defineProps({
11
11
  unit: { type: Object, required: true },
12
12
  index: { type: Number, required: true }
@@ -1,17 +1,16 @@
1
1
  import type { FormUnitValue } from '../../../schema.js';
2
- import { type FormState } from '../../../utils/state.js';
3
2
  type __VLS_Props = {
4
3
  unit: FormUnitValue;
5
4
  index: number;
6
5
  };
7
6
  type __VLS_ModelProps = {
8
- modelValue: FormState;
7
+ modelValue: unknown;
9
8
  };
10
9
  type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
11
10
  declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
12
- "update:modelValue": (value: FormState) => any;
11
+ "update:modelValue": (value: unknown) => any;
13
12
  }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
14
- "onUpdate:modelValue"?: ((value: FormState) => any) | undefined;
13
+ "onUpdate:modelValue"?: ((value: unknown) => any) | undefined;
15
14
  }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
16
15
  declare const _default: typeof __VLS_export;
17
16
  export default _default;
@@ -14,7 +14,7 @@ import { Button } from "../../../../ui/button";
14
14
  import { Field, FieldLabel } from "../../../../ui/field";
15
15
  import { InputGroupButton } from "../../../../ui/input-group";
16
16
  import { Markdown } from "../../../../ui/markdown";
17
- import { useFormState } from "../../../utils/state";
17
+ import { SELF_BINDING, useFormState } from "../../../utils/state";
18
18
  import Row from "./row.vue";
19
19
  defineOptions({ name: "ShwfedListFieldRuntime" });
20
20
  const props = defineProps({
@@ -45,6 +45,12 @@ function evalBool(expression, label) {
45
45
  }
46
46
  const isDisabled = computed(() => evalBool(props.config.disabled, "disabled"));
47
47
  const reorderable = computed(() => props.config.reorderable ?? true);
48
+ const isScalarRow = computed(() => {
49
+ const fields = props.config.unit.fields;
50
+ if (fields.length !== 1) return false;
51
+ const only = fields[0];
52
+ return only.binding === SELF_BINDING;
53
+ });
48
54
  const localItems = ref([]);
49
55
  const items = computed(() => {
50
56
  const path = props.config.binding;
@@ -120,7 +126,8 @@ const canRemove = computed(() => !isDisabled.value && !atMin.value);
120
126
  const canReorder = computed(() => !isDisabled.value && reorderable.value);
121
127
  function append() {
122
128
  if (!canAdd.value) return;
123
- writeItems([...items.value, {}]);
129
+ const seed = isScalarRow.value ? null : {};
130
+ writeItems([...items.value, seed]);
124
131
  const id = makeId();
125
132
  rowKeys.value = [...rowKeys.value, id];
126
133
  const next = new Set(expandedKeys.value);
@@ -19,7 +19,7 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_ModelProps, {},
19
19
  displayName?: string;
20
20
  columns: ReadonlyArray<import("../../../../table/schema.js").ColumnValue>;
21
21
  groups: ReadonlyArray<import("../../../../table/schema.js").ColumnGroupValue>;
22
- dataSource: Readonly<{
22
+ dataSource?: Readonly<{
23
23
  request?: string;
24
24
  data: string;
25
25
  total?: string;
@@ -81,7 +81,7 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_ModelProps, {},
81
81
  displayName?: string;
82
82
  columns: ReadonlyArray<import("../../../../table/schema.js").ColumnValue>;
83
83
  groups: ReadonlyArray<import("../../../../table/schema.js").ColumnGroupValue>;
84
- dataSource: Readonly<{
84
+ dataSource?: Readonly<{
85
85
  request?: string;
86
86
  data: string;
87
87
  total?: string;
@@ -26,9 +26,16 @@ function configureEmbeddedTable(env) {
26
26
  registerFormVariablesIfAbsent(env);
27
27
  }
28
28
  const tableModel = computed({
29
- get: () => value.value.table,
29
+ get: () => {
30
+ const { dataSource: _omit, ...rest } = value.value.table;
31
+ return rest;
32
+ },
30
33
  set: (next) => {
31
- value.value = { ...value.value, table: next };
34
+ const { dataSource: _omit, ...rest } = next;
35
+ value.value = {
36
+ ...value.value,
37
+ table: rest
38
+ };
32
39
  }
33
40
  });
34
41
  const bindingText = computed({
@@ -43,65 +50,38 @@ const bindingText = computed({
43
50
  }
44
51
  }
45
52
  });
46
- function setDisplayName(v) {
47
- const s = String(v ?? "");
48
- value.value = { ...value.value, displayName: s.length > 0 ? s : void 0 };
49
- }
50
53
  </script>
51
54
 
52
55
  <template>
53
56
  <TableConfigEditor
54
57
  v-model="tableModel"
55
58
  :configure="configureEmbeddedTable"
59
+ hide-display-name
60
+ hide-data-source
56
61
  >
57
62
  <template #general-extra>
58
- <div class="grid grid-cols-2 gap-3">
59
- <Field orientation="vertical">
60
- <FieldLabel class="text-xs text-zinc-500">
61
- <template
62
- v-if="fieldDescription('displayName')"
63
- #tooltip
64
- >
65
- <Markdown
66
- :source="fieldDescription('displayName')"
67
- block
68
- class="prose prose-sm prose-zinc"
69
- />
70
- </template>
71
- {{ fieldTitle("displayName") }}
72
- </FieldLabel>
73
- <InputGroup>
74
- <InputGroupInput
75
- :model-value="value.displayName ?? ''"
76
- placeholder="例:成员表格"
77
- @update:model-value="setDisplayName"
78
- />
79
- </InputGroup>
80
- </Field>
81
-
82
- <Field orientation="vertical">
83
- <FieldLabel class="text-xs text-zinc-500">
84
- <template
85
- v-if="fieldDescription('binding')"
86
- #tooltip
87
- >
88
- <Markdown
89
- :source="fieldDescription('binding')"
90
- block
91
- class="prose prose-sm prose-zinc"
92
- />
93
- </template>
94
- {{ fieldTitle("binding") }}
95
- </FieldLabel>
96
- <InputGroup>
97
- <InputGroupInput
98
- v-model="bindingText"
99
- placeholder="例:rows"
100
- class="font-mono"
63
+ <Field orientation="vertical">
64
+ <FieldLabel class="text-xs text-zinc-500">
65
+ <template
66
+ v-if="fieldDescription('binding')"
67
+ #tooltip
68
+ >
69
+ <Markdown
70
+ :source="fieldDescription('binding')"
71
+ block
72
+ class="prose prose-sm prose-zinc"
101
73
  />
102
- </InputGroup>
103
- </Field>
104
- </div>
74
+ </template>
75
+ {{ fieldTitle("binding") }}
76
+ </FieldLabel>
77
+ <InputGroup>
78
+ <InputGroupInput
79
+ v-model="bindingText"
80
+ placeholder="例:rows"
81
+ class="font-mono"
82
+ />
83
+ </InputGroup>
84
+ </Field>
105
85
 
106
86
  <div class="grid grid-cols-2 gap-3">
107
87
  <Field orientation="vertical">
@@ -19,7 +19,7 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_ModelProps, {},
19
19
  displayName?: string;
20
20
  columns: ReadonlyArray<import("../../../../table/schema.js").ColumnValue>;
21
21
  groups: ReadonlyArray<import("../../../../table/schema.js").ColumnGroupValue>;
22
- dataSource: Readonly<{
22
+ dataSource?: Readonly<{
23
23
  request?: string;
24
24
  data: string;
25
25
  total?: string;
@@ -81,7 +81,7 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_ModelProps, {},
81
81
  displayName?: string;
82
82
  columns: ReadonlyArray<import("../../../../table/schema.js").ColumnValue>;
83
83
  groups: ReadonlyArray<import("../../../../table/schema.js").ColumnGroupValue>;
84
- dataSource: Readonly<{
84
+ dataSource?: Readonly<{
85
85
  request?: string;
86
86
  data: string;
87
87
  total?: string;
@@ -12,17 +12,28 @@ const props = defineProps({
12
12
  config: { type: null, required: true }
13
13
  });
14
14
  const { locale } = useI18n();
15
- const { setAtSilent } = useFormState();
15
+ const formState = useFormState();
16
16
  const labelText = computed(() => getLocalizedText(props.config.label, locale.value));
17
17
  const tooltipText = computed(
18
18
  () => props.config.tooltip ? getLocalizedText(props.config.tooltip, locale.value) : void 0
19
19
  );
20
- const tableConfig = computed(() => props.config.table);
21
- function onRows(rows) {
22
- const path = props.config.binding;
23
- if (path == null) return;
24
- setAtSilent(path, rows);
25
- }
20
+ const tableConfig = computed(() => {
21
+ const { dataSource: _omit, ...rest } = props.config.table;
22
+ return rest;
23
+ });
24
+ const rowsModel = computed({
25
+ get: () => {
26
+ const binding = props.config.binding?.trim();
27
+ if (!binding) return [];
28
+ const v = formState.getAt(binding);
29
+ return Array.isArray(v) ? v : [];
30
+ },
31
+ set: (next) => {
32
+ const binding = props.config.binding?.trim();
33
+ if (!binding) return;
34
+ formState.setAtSilent(binding, next);
35
+ }
36
+ });
26
37
  </script>
27
38
 
28
39
  <template>
@@ -45,8 +56,8 @@ function onRows(rows) {
45
56
  </FieldLabel>
46
57
 
47
58
  <ShwfedTable
59
+ v-model:rows="rowsModel"
48
60
  :config="tableConfig"
49
- @update:rows="onRows"
50
61
  />
51
62
  </Field>
52
63
  </template>
@@ -39,7 +39,7 @@ export declare function schema(configure: (env: Environment) => void): Schema.St
39
39
  displayName?: string;
40
40
  columns: ReadonlyArray<import("../../../../table/schema.js").ColumnValue>;
41
41
  groups: ReadonlyArray<import("../../../../table/schema.js").ColumnGroupValue>;
42
- dataSource: import("../../../../table/schema.js").DataSourceValue;
42
+ dataSource?: import("../../../../table/schema.js").DataSourceValue;
43
43
  actions?: import("../../../../table/schema.js").TableActionsValue;
44
44
  query?: import("../../../schema.js").FormConfigValue;
45
45
  cellStyle?: string;
@@ -73,7 +73,7 @@ export declare function schema(configure: (env: Environment) => void): Schema.St
73
73
  displayName?: string;
74
74
  columns: ReadonlyArray<import("../../../../table/schema.js").ColumnValue>;
75
75
  groups: ReadonlyArray<import("../../../../table/schema.js").ColumnGroupValue>;
76
- dataSource: import("../../../../table/schema.js").DataSourceValue;
76
+ dataSource?: import("../../../../table/schema.js").DataSourceValue;
77
77
  actions?: import("../../../../table/schema.js").TableActionsValue;
78
78
  query?: import("../../../schema.js").FormConfigValue;
79
79
  cellStyle?: string;
@@ -28,11 +28,11 @@ export function schema(configure) {
28
28
  })),
29
29
  binding: Schema.optional(Schema.String.pipe(Schema.minLength(1)).annotations({
30
30
  title: "\u7ED1\u5B9A\u8DEF\u5F84",
31
- description: "\u8868\u683C\u5F53\u524D\u6570\u636E\u5B9E\u65F6\u5199\u5165\u8868\u5355\u72B6\u6001\u7684 `dot-prop` \u8DEF\u5F84\uFF0C\u4F8B\u5982 `rows`\uFF1B\u7559\u7A7A\u5219\u4E0D\u5199\u5165\u8868\u5355\u72B6\u6001"
31
+ description: "\u8868\u683C\u6570\u636E\u5728\u8868\u5355\u72B6\u6001\u4E2D\u7684 `dot-prop` \u8DEF\u5F84\uFF0C\u4F8B\u5982 `rows`\uFF1B\u8868\u683C\u4ECE `form.<binding>` \u8BFB\u53D6\u884C\u6570\u636E\uFF0C\u672C\u5730\u589E\u5220\u6539\u5B9E\u65F6\u5199\u56DE\u540C\u4E00\u8DEF\u5F84\uFF1B\u7559\u7A7A\u65F6\u8868\u683C\u65E0\u6570\u636E\uFF0C\u884C\u7F16\u8F91\u4E0D\u6301\u4E45\u5316"
32
32
  })),
33
33
  table: Table.annotations({
34
34
  title: "\u8868\u683C\u914D\u7F6E",
35
- description: "\u5185\u5D4C\u8868\u683C\u7684\u5B8C\u6574\u914D\u7F6E\uFF1B\u6570\u636E\u7531\u8868\u683C\u81EA\u5DF1\u7684\u6570\u636E\u6E90\u52A0\u8F7D\uFF0C\u7528\u6237\u7684\u672C\u5730\u589E\u5220\u6539\u5B9E\u65F6\u56DE\u5199\u5230\u300C\u7ED1\u5B9A\u8DEF\u5F84\u300D"
35
+ description: "\u5185\u5D4C\u8868\u683C\u7684\u5B8C\u6574\u914D\u7F6E\uFF1B\u6570\u636E\u6E90\u81EA\u52A8\u7ED1\u5B9A\u5230 `form.<binding>`\uFF0C\u65E0\u9700\u5355\u72EC\u914D\u7F6E"
36
36
  })
37
37
  }).annotations({
38
38
  title: "TableField",
@@ -40,5 +40,6 @@ export function schema(configure) {
40
40
  });
41
41
  }
42
42
  export function defaults() {
43
- return { table: defaultTableConfig() };
43
+ const { dataSource: _omit, ...rest } = defaultTableConfig();
44
+ return { table: rest };
44
45
  }
@@ -1,7 +1,15 @@
1
1
  import type { InjectionKey, Ref } from 'vue';
2
2
  export type FormState = Record<string, unknown>;
3
+ /**
4
+ * Sentinel binding meaning "the bag's state itself", not a key inside it.
5
+ * Used by `list` rows that hold scalar items: the inner field's `binding: '.'`
6
+ * tells the bag to read/replace `state.value` wholesale instead of walking
7
+ * into it as a dot-prop path. dot-prop has no notion of a self-path, so the
8
+ * bag intercepts this before delegating.
9
+ */
10
+ export declare const SELF_BINDING: ".";
3
11
  export type FormStateBag = {
4
- state: Ref<FormState>;
12
+ state: Ref<unknown>;
5
13
  getAt: (path: string) => unknown;
6
14
  /**
7
15
  * Write a value at `path` on behalf of a **user interaction**. Besides
@@ -33,5 +41,5 @@ export type FormStateBag = {
33
41
  markDirty: (path: string) => void;
34
42
  };
35
43
  export declare const FORM_STATE_KEY: InjectionKey<FormStateBag>;
36
- export declare function provideFormState(state: Ref<FormState>): FormStateBag;
44
+ export declare function provideFormState(state: Ref<unknown>): FormStateBag;
37
45
  export declare function useFormState(): FormStateBag;
@@ -1,18 +1,25 @@
1
1
  import { getProperty, setProperty } from "dot-prop";
2
2
  import { inject, provide, ref } from "vue";
3
+ export const SELF_BINDING = ".";
3
4
  export const FORM_STATE_KEY = Symbol("shwfed-form-state");
4
5
  export function provideFormState(state) {
5
6
  const dirty = ref(/* @__PURE__ */ new Set());
6
7
  function write(path, value) {
7
- setProperty(state.value, path, value === void 0 ? null : value);
8
- state.value = { ...state.value };
8
+ const normalized = value === void 0 ? null : value;
9
+ if (path === SELF_BINDING) {
10
+ state.value = normalized;
11
+ return;
12
+ }
13
+ const current = state.value;
14
+ setProperty(current, path, normalized);
15
+ state.value = { ...current };
9
16
  }
10
17
  function markDirty(path) {
11
18
  if (!dirty.value.has(path)) dirty.value = new Set(dirty.value).add(path);
12
19
  }
13
20
  const bag = {
14
21
  state,
15
- getAt: (path) => getProperty(state.value, path),
22
+ getAt: (path) => path === SELF_BINDING ? state.value : getProperty(state.value, path),
16
23
  setAt: (path, value) => {
17
24
  write(path, value);
18
25
  markDirty(path);