@shwfed/config 2.12.18 → 3.0.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.
- package/dist/module.json +1 -1
- package/dist/runtime/components/actions/buttons/2026-06-25/com.shwfed.actions.button.state.write/config.vue +17 -11
- package/dist/runtime/components/config/blocks/2026-05-06/com.shwfed.block.table/config.d.vue.ts +68 -68
- package/dist/runtime/components/config/blocks/2026-05-06/com.shwfed.block.table/config.vue.d.ts +68 -68
- package/dist/runtime/components/config/blocks/2026-05-06/com.shwfed.block.table/runtime.d.vue.ts +68 -68
- package/dist/runtime/components/config/blocks/2026-05-06/com.shwfed.block.table/runtime.vue.d.ts +68 -68
- package/dist/runtime/components/config/blocks/2026-05-06/com.shwfed.block.table/schema.d.ts +34 -34
- package/dist/runtime/components/config/footer.vue +14 -8
- package/dist/runtime/components/config/index.d.vue.ts +1 -0
- package/dist/runtime/components/config/index.vue +30 -2
- package/dist/runtime/components/config/index.vue.d.ts +1 -0
- package/dist/runtime/components/config/use-editor.d.ts +12 -1
- package/dist/runtime/components/config/use-editor.js +47 -24
- package/dist/runtime/components/config/use-unsaved-guard.d.ts +1 -0
- package/dist/runtime/components/config/use-unsaved-guard.js +8 -0
- package/dist/runtime/components/modal.d.vue.ts +8 -8
- package/dist/runtime/components/modal.vue +9 -1
- package/dist/runtime/components/modal.vue.d.ts +8 -8
- package/dist/runtime/components/sidebar/footer.vue +13 -7
- package/dist/runtime/components/sidebar/index.d.vue.ts +1 -0
- package/dist/runtime/components/sidebar/index.vue +30 -2
- package/dist/runtime/components/sidebar/index.vue.d.ts +1 -0
- package/dist/runtime/components/sidebar/use-editor.d.ts +11 -1
- package/dist/runtime/components/sidebar/use-editor.js +38 -17
- package/dist/runtime/components/table/columns/2026-05-24/com.shwfed.table.column.combobox-single.remote.options-remote/config.d.vue.ts +2 -2
- package/dist/runtime/components/table/columns/2026-05-24/com.shwfed.table.column.combobox-single.remote.options-remote/config.vue.d.ts +2 -2
- 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 +2 -2
- package/dist/runtime/components/table/columns/2026-05-25/com.shwfed.table.column.combobox-multi.remote.options-remote/config.vue.d.ts +2 -2
- 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.remote/config.d.vue.ts +2 -2
- package/dist/runtime/components/table/columns/2026-05-26/com.shwfed.table.column.combobox-multi.remote/config.vue.d.ts +2 -2
- package/dist/runtime/components/table/columns/2026-05-26/com.shwfed.table.column.combobox-single.remote/config.d.vue.ts +2 -2
- package/dist/runtime/components/table/columns/2026-05-26/com.shwfed.table.column.combobox-single.remote/config.vue.d.ts +2 -2
- package/dist/runtime/components/table/columns/2026-05-27/com.shwfed.table.column.tree-combobox-multi/config.d.vue.ts +2 -2
- package/dist/runtime/components/table/columns/2026-05-27/com.shwfed.table.column.tree-combobox-multi/config.vue.d.ts +2 -2
- 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 +2 -2
- package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.combobox-multi/config.vue.d.ts +2 -2
- package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.combobox-single/config.d.vue.ts +2 -2
- package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.combobox-single/config.vue.d.ts +2 -2
- package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.tree-combobox-multi/config.d.vue.ts +2 -2
- package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.tree-combobox-multi/config.vue.d.ts +2 -2
- 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 +2 -2
- package/dist/runtime/components/table/columns/2026-06-14/com.shwfed.table.column.combobox-multi/config.vue.d.ts +2 -2
- package/dist/runtime/components/table/columns/2026-06-14/com.shwfed.table.column.combobox-single/config.d.vue.ts +2 -2
- package/dist/runtime/components/table/columns/2026-06-14/com.shwfed.table.column.combobox-single/config.vue.d.ts +2 -2
- package/dist/runtime/components/table/columns/2026-06-14/com.shwfed.table.column.tree-combobox-multi/config.d.vue.ts +2 -2
- package/dist/runtime/components/table/columns/2026-06-14/com.shwfed.table.column.tree-combobox-multi/config.vue.d.ts +2 -2
- 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/schema.d.ts +68 -68
- package/dist/runtime/components/ui/expression-editor/ExpressionEditor.vue +4 -1
- package/package.json +1 -1
package/dist/runtime/components/config/blocks/2026-05-06/com.shwfed.block.table/runtime.vue.d.ts
CHANGED
|
@@ -29,6 +29,40 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_ModelProps, {},
|
|
|
29
29
|
readonly message: string;
|
|
30
30
|
}[]] | undefined;
|
|
31
31
|
}[];
|
|
32
|
+
readonly query?: {
|
|
33
|
+
readonly style?: string | undefined;
|
|
34
|
+
readonly id?: string | undefined;
|
|
35
|
+
readonly initial?: {
|
|
36
|
+
readonly data: string;
|
|
37
|
+
readonly request?: string | undefined;
|
|
38
|
+
} | undefined;
|
|
39
|
+
readonly displayName?: string | undefined;
|
|
40
|
+
readonly kind: "shwfed.component.form";
|
|
41
|
+
readonly fields: readonly any[];
|
|
42
|
+
readonly layouts: readonly {
|
|
43
|
+
readonly name: string;
|
|
44
|
+
readonly layout: {
|
|
45
|
+
readonly style?: string | undefined;
|
|
46
|
+
readonly columns: number;
|
|
47
|
+
readonly gap?: number | undefined;
|
|
48
|
+
readonly rows?: number | undefined;
|
|
49
|
+
readonly placements: {
|
|
50
|
+
readonly [x: string]: {
|
|
51
|
+
readonly area: readonly [readonly [number, number], readonly [number, number]];
|
|
52
|
+
readonly v?: "stretch" | "center" | "end" | "start" | undefined;
|
|
53
|
+
readonly h?: "stretch" | "center" | "end" | "start" | undefined;
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
readonly media?: string | undefined;
|
|
58
|
+
}[];
|
|
59
|
+
readonly readonly?: string | undefined;
|
|
60
|
+
} | undefined;
|
|
61
|
+
readonly dataSource?: {
|
|
62
|
+
readonly data: string;
|
|
63
|
+
readonly total?: string | undefined;
|
|
64
|
+
readonly request?: string | undefined;
|
|
65
|
+
} | undefined;
|
|
32
66
|
readonly actions?: {
|
|
33
67
|
readonly size: "default" | "sm" | "xs";
|
|
34
68
|
readonly style?: string | undefined;
|
|
@@ -96,40 +130,6 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_ModelProps, {},
|
|
|
96
130
|
readonly variant?: "default" | "link" | "destructive" | "primary" | "ghost" | undefined;
|
|
97
131
|
}[];
|
|
98
132
|
} | undefined;
|
|
99
|
-
readonly query?: {
|
|
100
|
-
readonly style?: string | undefined;
|
|
101
|
-
readonly id?: string | undefined;
|
|
102
|
-
readonly initial?: {
|
|
103
|
-
readonly data: string;
|
|
104
|
-
readonly request?: string | undefined;
|
|
105
|
-
} | undefined;
|
|
106
|
-
readonly displayName?: string | undefined;
|
|
107
|
-
readonly kind: "shwfed.component.form";
|
|
108
|
-
readonly fields: readonly any[];
|
|
109
|
-
readonly layouts: readonly {
|
|
110
|
-
readonly name: string;
|
|
111
|
-
readonly layout: {
|
|
112
|
-
readonly style?: string | undefined;
|
|
113
|
-
readonly columns: number;
|
|
114
|
-
readonly gap?: number | undefined;
|
|
115
|
-
readonly rows?: number | undefined;
|
|
116
|
-
readonly placements: {
|
|
117
|
-
readonly [x: string]: {
|
|
118
|
-
readonly area: readonly [readonly [number, number], readonly [number, number]];
|
|
119
|
-
readonly v?: "stretch" | "center" | "end" | "start" | undefined;
|
|
120
|
-
readonly h?: "stretch" | "center" | "end" | "start" | undefined;
|
|
121
|
-
};
|
|
122
|
-
};
|
|
123
|
-
};
|
|
124
|
-
readonly media?: string | undefined;
|
|
125
|
-
}[];
|
|
126
|
-
readonly readonly?: string | undefined;
|
|
127
|
-
} | undefined;
|
|
128
|
-
readonly dataSource?: {
|
|
129
|
-
readonly data: string;
|
|
130
|
-
readonly total?: string | undefined;
|
|
131
|
-
readonly request?: string | undefined;
|
|
132
|
-
} | undefined;
|
|
133
133
|
readonly bottomActions?: {
|
|
134
134
|
readonly size: "default" | "sm" | "xs";
|
|
135
135
|
readonly style?: string | undefined;
|
|
@@ -277,6 +277,40 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_ModelProps, {},
|
|
|
277
277
|
readonly message: string;
|
|
278
278
|
}[]] | undefined;
|
|
279
279
|
}[];
|
|
280
|
+
readonly query?: {
|
|
281
|
+
readonly style?: string | undefined;
|
|
282
|
+
readonly id?: string | undefined;
|
|
283
|
+
readonly initial?: {
|
|
284
|
+
readonly data: string;
|
|
285
|
+
readonly request?: string | undefined;
|
|
286
|
+
} | undefined;
|
|
287
|
+
readonly displayName?: string | undefined;
|
|
288
|
+
readonly kind: "shwfed.component.form";
|
|
289
|
+
readonly fields: readonly any[];
|
|
290
|
+
readonly layouts: readonly {
|
|
291
|
+
readonly name: string;
|
|
292
|
+
readonly layout: {
|
|
293
|
+
readonly style?: string | undefined;
|
|
294
|
+
readonly columns: number;
|
|
295
|
+
readonly gap?: number | undefined;
|
|
296
|
+
readonly rows?: number | undefined;
|
|
297
|
+
readonly placements: {
|
|
298
|
+
readonly [x: string]: {
|
|
299
|
+
readonly area: readonly [readonly [number, number], readonly [number, number]];
|
|
300
|
+
readonly v?: "stretch" | "center" | "end" | "start" | undefined;
|
|
301
|
+
readonly h?: "stretch" | "center" | "end" | "start" | undefined;
|
|
302
|
+
};
|
|
303
|
+
};
|
|
304
|
+
};
|
|
305
|
+
readonly media?: string | undefined;
|
|
306
|
+
}[];
|
|
307
|
+
readonly readonly?: string | undefined;
|
|
308
|
+
} | undefined;
|
|
309
|
+
readonly dataSource?: {
|
|
310
|
+
readonly data: string;
|
|
311
|
+
readonly total?: string | undefined;
|
|
312
|
+
readonly request?: string | undefined;
|
|
313
|
+
} | undefined;
|
|
280
314
|
readonly actions?: {
|
|
281
315
|
readonly size: "default" | "sm" | "xs";
|
|
282
316
|
readonly style?: string | undefined;
|
|
@@ -344,40 +378,6 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_ModelProps, {},
|
|
|
344
378
|
readonly variant?: "default" | "link" | "destructive" | "primary" | "ghost" | undefined;
|
|
345
379
|
}[];
|
|
346
380
|
} | undefined;
|
|
347
|
-
readonly query?: {
|
|
348
|
-
readonly style?: string | undefined;
|
|
349
|
-
readonly id?: string | undefined;
|
|
350
|
-
readonly initial?: {
|
|
351
|
-
readonly data: string;
|
|
352
|
-
readonly request?: string | undefined;
|
|
353
|
-
} | undefined;
|
|
354
|
-
readonly displayName?: string | undefined;
|
|
355
|
-
readonly kind: "shwfed.component.form";
|
|
356
|
-
readonly fields: readonly any[];
|
|
357
|
-
readonly layouts: readonly {
|
|
358
|
-
readonly name: string;
|
|
359
|
-
readonly layout: {
|
|
360
|
-
readonly style?: string | undefined;
|
|
361
|
-
readonly columns: number;
|
|
362
|
-
readonly gap?: number | undefined;
|
|
363
|
-
readonly rows?: number | undefined;
|
|
364
|
-
readonly placements: {
|
|
365
|
-
readonly [x: string]: {
|
|
366
|
-
readonly area: readonly [readonly [number, number], readonly [number, number]];
|
|
367
|
-
readonly v?: "stretch" | "center" | "end" | "start" | undefined;
|
|
368
|
-
readonly h?: "stretch" | "center" | "end" | "start" | undefined;
|
|
369
|
-
};
|
|
370
|
-
};
|
|
371
|
-
};
|
|
372
|
-
readonly media?: string | undefined;
|
|
373
|
-
}[];
|
|
374
|
-
readonly readonly?: string | undefined;
|
|
375
|
-
} | undefined;
|
|
376
|
-
readonly dataSource?: {
|
|
377
|
-
readonly data: string;
|
|
378
|
-
readonly total?: string | undefined;
|
|
379
|
-
readonly request?: string | undefined;
|
|
380
|
-
} | undefined;
|
|
381
381
|
readonly bottomActions?: {
|
|
382
382
|
readonly size: "default" | "sm" | "xs";
|
|
383
383
|
readonly style?: string | undefined;
|
|
@@ -47,6 +47,40 @@ export declare function schema(configure: (env: Environment) => void, _blockRef:
|
|
|
47
47
|
readonly message: string;
|
|
48
48
|
}[]] | undefined;
|
|
49
49
|
}[];
|
|
50
|
+
readonly query?: {
|
|
51
|
+
readonly style?: string | undefined;
|
|
52
|
+
readonly id?: string | undefined;
|
|
53
|
+
readonly initial?: {
|
|
54
|
+
readonly data: string;
|
|
55
|
+
readonly request?: string | undefined;
|
|
56
|
+
} | undefined;
|
|
57
|
+
readonly displayName?: string | undefined;
|
|
58
|
+
readonly kind: "shwfed.component.form";
|
|
59
|
+
readonly fields: readonly any[];
|
|
60
|
+
readonly layouts: readonly {
|
|
61
|
+
readonly name: string;
|
|
62
|
+
readonly layout: {
|
|
63
|
+
readonly style?: string | undefined;
|
|
64
|
+
readonly columns: number;
|
|
65
|
+
readonly gap?: number | undefined;
|
|
66
|
+
readonly rows?: number | undefined;
|
|
67
|
+
readonly placements: {
|
|
68
|
+
readonly [x: string]: {
|
|
69
|
+
readonly area: readonly [readonly [number, number], readonly [number, number]];
|
|
70
|
+
readonly v?: "stretch" | "center" | "end" | "start" | undefined;
|
|
71
|
+
readonly h?: "stretch" | "center" | "end" | "start" | undefined;
|
|
72
|
+
};
|
|
73
|
+
};
|
|
74
|
+
};
|
|
75
|
+
readonly media?: string | undefined;
|
|
76
|
+
}[];
|
|
77
|
+
readonly readonly?: string | undefined;
|
|
78
|
+
} | undefined;
|
|
79
|
+
readonly dataSource?: {
|
|
80
|
+
readonly data: string;
|
|
81
|
+
readonly total?: string | undefined;
|
|
82
|
+
readonly request?: string | undefined;
|
|
83
|
+
} | undefined;
|
|
50
84
|
readonly actions?: {
|
|
51
85
|
readonly size: "default" | "sm" | "xs";
|
|
52
86
|
readonly style?: string | undefined;
|
|
@@ -114,40 +148,6 @@ export declare function schema(configure: (env: Environment) => void, _blockRef:
|
|
|
114
148
|
readonly variant?: "default" | "link" | "destructive" | "primary" | "ghost" | undefined;
|
|
115
149
|
}[];
|
|
116
150
|
} | undefined;
|
|
117
|
-
readonly query?: {
|
|
118
|
-
readonly style?: string | undefined;
|
|
119
|
-
readonly id?: string | undefined;
|
|
120
|
-
readonly initial?: {
|
|
121
|
-
readonly data: string;
|
|
122
|
-
readonly request?: string | undefined;
|
|
123
|
-
} | undefined;
|
|
124
|
-
readonly displayName?: string | undefined;
|
|
125
|
-
readonly kind: "shwfed.component.form";
|
|
126
|
-
readonly fields: readonly any[];
|
|
127
|
-
readonly layouts: readonly {
|
|
128
|
-
readonly name: string;
|
|
129
|
-
readonly layout: {
|
|
130
|
-
readonly style?: string | undefined;
|
|
131
|
-
readonly columns: number;
|
|
132
|
-
readonly gap?: number | undefined;
|
|
133
|
-
readonly rows?: number | undefined;
|
|
134
|
-
readonly placements: {
|
|
135
|
-
readonly [x: string]: {
|
|
136
|
-
readonly area: readonly [readonly [number, number], readonly [number, number]];
|
|
137
|
-
readonly v?: "stretch" | "center" | "end" | "start" | undefined;
|
|
138
|
-
readonly h?: "stretch" | "center" | "end" | "start" | undefined;
|
|
139
|
-
};
|
|
140
|
-
};
|
|
141
|
-
};
|
|
142
|
-
readonly media?: string | undefined;
|
|
143
|
-
}[];
|
|
144
|
-
readonly readonly?: string | undefined;
|
|
145
|
-
} | undefined;
|
|
146
|
-
readonly dataSource?: {
|
|
147
|
-
readonly data: string;
|
|
148
|
-
readonly total?: string | undefined;
|
|
149
|
-
readonly request?: string | undefined;
|
|
150
|
-
} | undefined;
|
|
151
151
|
readonly bottomActions?: {
|
|
152
152
|
readonly size: "default" | "sm" | "xs";
|
|
153
153
|
readonly style?: string | undefined;
|
|
@@ -10,16 +10,12 @@ const props = defineProps({
|
|
|
10
10
|
});
|
|
11
11
|
const emit = defineEmits(["close", "select-version"]);
|
|
12
12
|
function onDismiss() {
|
|
13
|
+
if (props.state.saving.value) return;
|
|
13
14
|
props.state.dismiss();
|
|
14
15
|
emit("close");
|
|
15
16
|
}
|
|
16
|
-
function onConfirm() {
|
|
17
|
-
|
|
18
|
-
const errorBefore = props.state.validationError.value;
|
|
19
|
-
props.state.confirm();
|
|
20
|
-
const errorAfter = props.state.validationError.value;
|
|
21
|
-
if (errorAfter && errorAfter !== errorBefore) return;
|
|
22
|
-
if (!dirtyBefore || !errorAfter) emit("close");
|
|
17
|
+
async function onConfirm() {
|
|
18
|
+
if (await props.state.confirm()) emit("close");
|
|
23
19
|
}
|
|
24
20
|
</script>
|
|
25
21
|
|
|
@@ -30,12 +26,17 @@ function onConfirm() {
|
|
|
30
26
|
v-if="props.state.validationError.value"
|
|
31
27
|
class="text-red-500 break-all"
|
|
32
28
|
>{{ props.state.validationError.value }}</span>
|
|
29
|
+
<span
|
|
30
|
+
v-if="props.state.saveError.value"
|
|
31
|
+
class="text-red-500 break-all"
|
|
32
|
+
>{{ props.state.saveError.value }}</span>
|
|
33
33
|
</div>
|
|
34
34
|
<Button
|
|
35
35
|
v-if="props.state.stack.value.length > 1"
|
|
36
36
|
type="button"
|
|
37
37
|
variant="default"
|
|
38
38
|
size="sm"
|
|
39
|
+
:disabled="props.state.saving.value"
|
|
39
40
|
@click="props.state.popOne()"
|
|
40
41
|
>
|
|
41
42
|
<Icon icon="fluent:arrow-left-20-regular" />
|
|
@@ -46,6 +47,7 @@ function onConfirm() {
|
|
|
46
47
|
type="button"
|
|
47
48
|
variant="default"
|
|
48
49
|
size="sm"
|
|
50
|
+
:disabled="props.state.saving.value"
|
|
49
51
|
@click="onDismiss"
|
|
50
52
|
>
|
|
51
53
|
<Icon icon="fluent:dismiss-20-regular" />
|
|
@@ -61,9 +63,13 @@ function onConfirm() {
|
|
|
61
63
|
type="button"
|
|
62
64
|
variant="primary"
|
|
63
65
|
size="sm"
|
|
66
|
+
:disabled="props.state.saving.value"
|
|
64
67
|
@click="onConfirm"
|
|
65
68
|
>
|
|
66
|
-
<Icon
|
|
69
|
+
<Icon
|
|
70
|
+
:icon="props.state.saving.value ? 'fluent:arrow-sync-20-regular' : 'fluent:checkmark-20-regular'"
|
|
71
|
+
:class="props.state.saving.value ? 'animate-spin' : ''"
|
|
72
|
+
/>
|
|
67
73
|
确认
|
|
68
74
|
</Button>
|
|
69
75
|
<HistoryPicker
|
|
@@ -21,6 +21,7 @@ import * as httpRequestOperation from "../operations/2026-06-11/com.shwfed.opera
|
|
|
21
21
|
import * as navigationOperation from "../operations/2026-06-15/com.shwfed.operation.navigation/schema";
|
|
22
22
|
import { PAGE_TARGET_ID, createPageConfig } from "./schema";
|
|
23
23
|
import { useConfigEditor } from "./use-editor";
|
|
24
|
+
import { useUnsavedChangesGuard } from "./use-unsaved-guard";
|
|
24
25
|
import { findBlock } from "./utils/resolve";
|
|
25
26
|
import { useTabStore } from "../tabs/use-tabs";
|
|
26
27
|
import { publishPageTitle } from "../../utils/page-title-registry";
|
|
@@ -35,6 +36,7 @@ const config = computed({
|
|
|
35
36
|
const props = defineProps({
|
|
36
37
|
configure: { type: Function, required: false },
|
|
37
38
|
editable: { type: Boolean, required: false },
|
|
39
|
+
save: { type: Function, required: false },
|
|
38
40
|
versions: { type: Array, required: false }
|
|
39
41
|
});
|
|
40
42
|
const emit = defineEmits(["select-version"]);
|
|
@@ -95,10 +97,17 @@ provideEventTarget(PAGE_TARGET_ID, {
|
|
|
95
97
|
const editorOpen = ref(false);
|
|
96
98
|
const editorState = useConfigEditor(config, {
|
|
97
99
|
configure: mergedConfigure,
|
|
100
|
+
// Presence is decided once at setup (a host toggling the prop's existence
|
|
101
|
+
// at runtime is not supported); the wrapper reads the current prop per
|
|
102
|
+
// call so a rebound handler identity stays honored.
|
|
103
|
+
save: props.save ? (cfg) => props.save(cfg) : void 0,
|
|
98
104
|
onClose: () => {
|
|
99
105
|
editorOpen.value = false;
|
|
100
106
|
}
|
|
101
107
|
});
|
|
108
|
+
useUnsavedChangesGuard(
|
|
109
|
+
() => props.editable === true && (editorState.isDirty.value || editorState.saving.value)
|
|
110
|
+
);
|
|
102
111
|
watch(editorOpen, (open, prev) => {
|
|
103
112
|
if (open && !prev) editorState.reset();
|
|
104
113
|
});
|
|
@@ -202,11 +211,16 @@ const isMac = computed(
|
|
|
202
211
|
</template>
|
|
203
212
|
</SlotRenderer>
|
|
204
213
|
</div>
|
|
214
|
+
<!-- While the draft is dirty (or a save is in flight) the modal refuses
|
|
215
|
+
casual dismissal — Esc, outside-click, and the × button all drop the
|
|
216
|
+
session on the reopen re-anchor above, which was a top edit-loss
|
|
217
|
+
complaint. The explicit footer exits (取消 discards, 确认 saves)
|
|
218
|
+
remain the only ways out of a dirty session. -->
|
|
205
219
|
<ShwfedModal
|
|
206
220
|
v-if="editable"
|
|
207
221
|
v-model:open="editorOpen"
|
|
208
222
|
content-width="90vw"
|
|
209
|
-
:dismissible="
|
|
223
|
+
:dismissible="!editorState.isDirty.value && !editorState.saving.value"
|
|
210
224
|
>
|
|
211
225
|
<template #title>
|
|
212
226
|
<EditorBreadcrumb :state="editorState" />
|
|
@@ -214,7 +228,21 @@ const isMac = computed(
|
|
|
214
228
|
<template #description>
|
|
215
229
|
<span class="sr-only">编辑页面布局与块配置</span>
|
|
216
230
|
</template>
|
|
217
|
-
|
|
231
|
+
<!-- The overlay freezes the canvas while the host save runs: an edit
|
|
232
|
+
landing mid-save would be silently clobbered by the post-commit
|
|
233
|
+
draft re-anchor. -->
|
|
234
|
+
<div class="relative">
|
|
235
|
+
<EditorBody :state="editorState" />
|
|
236
|
+
<div
|
|
237
|
+
v-if="editorState.saving.value"
|
|
238
|
+
class="absolute inset-0 z-20 flex items-center justify-center bg-white/60"
|
|
239
|
+
>
|
|
240
|
+
<Icon
|
|
241
|
+
icon="fluent:arrow-sync-20-regular"
|
|
242
|
+
class="animate-spin text-2xl text-zinc-500"
|
|
243
|
+
/>
|
|
244
|
+
</div>
|
|
245
|
+
</div>
|
|
218
246
|
<template #footer>
|
|
219
247
|
<EditorFooter
|
|
220
248
|
:state="editorState"
|
|
@@ -84,6 +84,8 @@ export interface ConfigEditorState {
|
|
|
84
84
|
selectedBlockIds: Ref<string[]>;
|
|
85
85
|
activeLayoutIndex: Ref<number>;
|
|
86
86
|
validationError: Ref<string | null>;
|
|
87
|
+
saveError: Ref<string | null>;
|
|
88
|
+
saving: Ref<boolean>;
|
|
87
89
|
addCrumb: () => BreadcrumbCrumb;
|
|
88
90
|
addParentSuffix: () => BreadcrumbParentSuffix;
|
|
89
91
|
isDirty: ComputedRef<boolean>;
|
|
@@ -116,12 +118,21 @@ export interface ConfigEditorState {
|
|
|
116
118
|
getBlockLabel: (b: BlockValue) => string;
|
|
117
119
|
findBlockMeta: (type: string, compatibilityDate: string) => BlockEntry | undefined;
|
|
118
120
|
onDrillDown: (blockId: string) => void;
|
|
119
|
-
confirm: () =>
|
|
121
|
+
confirm: () => Promise<boolean>;
|
|
120
122
|
dismiss: () => void;
|
|
121
123
|
reset: () => void;
|
|
122
124
|
}
|
|
123
125
|
export interface UseConfigEditorOptions {
|
|
124
126
|
configure?: (env: Environment) => void;
|
|
127
|
+
/**
|
|
128
|
+
* Delegated persistence. When provided, a successful 确认 first awaits this
|
|
129
|
+
* with the validated config; only after it resolves does the draft commit
|
|
130
|
+
* to the outer model and the editor close. A rejection keeps the editor
|
|
131
|
+
* open with the draft intact and surfaces the failure via `saveError` — the
|
|
132
|
+
* host owns transport and recovery (retry, re-auth, offline fallback, …),
|
|
133
|
+
* the editor guarantees the session is never lost to a failed save.
|
|
134
|
+
*/
|
|
135
|
+
save?: (config: PageConfigValue) => void | Promise<void>;
|
|
125
136
|
/**
|
|
126
137
|
* Called after a successful 确认 commits the draft to the outer model.
|
|
127
138
|
* Hosts wire this to close the modal; legacy mode emits `close`.
|
|
@@ -375,40 +375,58 @@ export function useConfigEditor(model, options = {}) {
|
|
|
375
375
|
pushBlock(blockId);
|
|
376
376
|
}
|
|
377
377
|
const validationError = ref(null);
|
|
378
|
+
const saveError = ref(null);
|
|
379
|
+
const saving = ref(false);
|
|
378
380
|
const validityRegistry = createExpressionValidityRegistry();
|
|
379
381
|
provideExpressionValidity(validityRegistry);
|
|
380
|
-
function confirm() {
|
|
382
|
+
async function confirm() {
|
|
383
|
+
if (saving.value) return false;
|
|
381
384
|
const schema = PageConfig(configure);
|
|
385
|
+
let decoded;
|
|
382
386
|
try {
|
|
383
|
-
|
|
384
|
-
if (!validityRegistry.allValid()) {
|
|
385
|
-
validationError.value = "\u5B58\u5728\u65E0\u6548\u7684\u8DE8\u5C42\u4F5C\u7528\u57DF\u5F15\u7528\uFF0C\u8BF7\u4FEE\u6B63\u6807\u7EA2\u7684\u8868\u8FBE\u5F0F\u540E\u518D\u4FDD\u5B58";
|
|
386
|
-
return;
|
|
387
|
-
}
|
|
388
|
-
const dangling = findDanglingLinkages(decoded);
|
|
389
|
-
if (dangling.length > 0) {
|
|
390
|
-
validationError.value = formatDanglingLinkages(dangling, decoded, (i) => {
|
|
391
|
-
const b = topSlotEditor.blocks.value[i];
|
|
392
|
-
return b ? topSlotEditor.getBlockLabel(b) : void 0;
|
|
393
|
-
});
|
|
394
|
-
return;
|
|
395
|
-
}
|
|
396
|
-
validationError.value = null;
|
|
397
|
-
model.value = decoded;
|
|
398
|
-
baseline.value = deepClone(decoded);
|
|
399
|
-
draft.value = deepClone(decoded);
|
|
400
|
-
stack.value = [{ kind: "layout" }];
|
|
401
|
-
topSlotEditor.selectedBlockIds.value = [];
|
|
402
|
-
topSlotEditor.activeLayoutIndex.value = 0;
|
|
403
|
-
subCrumbs.value = [];
|
|
404
|
-
parentSuffixes.value = [];
|
|
405
|
-
options.onClose?.();
|
|
387
|
+
decoded = Schema.decodeUnknownSync(schema)(draft.value);
|
|
406
388
|
} catch (err) {
|
|
407
389
|
validationError.value = formatValidationError(err, (i) => {
|
|
408
390
|
const b = topSlotEditor.blocks.value[i];
|
|
409
391
|
return b ? topSlotEditor.getBlockLabel(b) : void 0;
|
|
410
392
|
}, draft.value);
|
|
393
|
+
return false;
|
|
411
394
|
}
|
|
395
|
+
if (!validityRegistry.allValid()) {
|
|
396
|
+
validationError.value = "\u5B58\u5728\u65E0\u6548\u7684\u8DE8\u5C42\u4F5C\u7528\u57DF\u5F15\u7528\uFF0C\u8BF7\u4FEE\u6B63\u6807\u7EA2\u7684\u8868\u8FBE\u5F0F\u540E\u518D\u4FDD\u5B58";
|
|
397
|
+
return false;
|
|
398
|
+
}
|
|
399
|
+
const dangling = findDanglingLinkages(decoded);
|
|
400
|
+
if (dangling.length > 0) {
|
|
401
|
+
validationError.value = formatDanglingLinkages(dangling, decoded, (i) => {
|
|
402
|
+
const b = topSlotEditor.blocks.value[i];
|
|
403
|
+
return b ? topSlotEditor.getBlockLabel(b) : void 0;
|
|
404
|
+
});
|
|
405
|
+
return false;
|
|
406
|
+
}
|
|
407
|
+
validationError.value = null;
|
|
408
|
+
if (options.save) {
|
|
409
|
+
saving.value = true;
|
|
410
|
+
saveError.value = null;
|
|
411
|
+
try {
|
|
412
|
+
await options.save(deepClone(decoded));
|
|
413
|
+
} catch (err) {
|
|
414
|
+
saveError.value = `\u4FDD\u5B58\u5931\u8D25\uFF1A${err instanceof Error ? err.message : String(err)}`;
|
|
415
|
+
return false;
|
|
416
|
+
} finally {
|
|
417
|
+
saving.value = false;
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
model.value = decoded;
|
|
421
|
+
baseline.value = deepClone(decoded);
|
|
422
|
+
draft.value = deepClone(decoded);
|
|
423
|
+
stack.value = [{ kind: "layout" }];
|
|
424
|
+
topSlotEditor.selectedBlockIds.value = [];
|
|
425
|
+
topSlotEditor.activeLayoutIndex.value = 0;
|
|
426
|
+
subCrumbs.value = [];
|
|
427
|
+
parentSuffixes.value = [];
|
|
428
|
+
options.onClose?.();
|
|
429
|
+
return true;
|
|
412
430
|
}
|
|
413
431
|
function reset() {
|
|
414
432
|
baseline.value = deepClone(model.value);
|
|
@@ -417,15 +435,18 @@ export function useConfigEditor(model, options = {}) {
|
|
|
417
435
|
topSlotEditor.selectedBlockIds.value = [];
|
|
418
436
|
topSlotEditor.activeLayoutIndex.value = 0;
|
|
419
437
|
validationError.value = null;
|
|
438
|
+
saveError.value = null;
|
|
420
439
|
subCrumbs.value = [];
|
|
421
440
|
parentSuffixes.value = [];
|
|
422
441
|
}
|
|
423
442
|
function dismiss() {
|
|
443
|
+
if (saving.value) return;
|
|
424
444
|
reset();
|
|
425
445
|
options.onClose?.();
|
|
426
446
|
}
|
|
427
447
|
watch(draft, () => {
|
|
428
448
|
if (validationError.value) validationError.value = null;
|
|
449
|
+
if (saveError.value) saveError.value = null;
|
|
429
450
|
}, { deep: true });
|
|
430
451
|
return {
|
|
431
452
|
draft,
|
|
@@ -433,6 +454,8 @@ export function useConfigEditor(model, options = {}) {
|
|
|
433
454
|
selectedBlockIds: topSlotEditor.selectedBlockIds,
|
|
434
455
|
activeLayoutIndex: topSlotEditor.activeLayoutIndex,
|
|
435
456
|
validationError,
|
|
457
|
+
saveError,
|
|
458
|
+
saving,
|
|
436
459
|
addCrumb,
|
|
437
460
|
addParentSuffix,
|
|
438
461
|
isDirty,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function useUnsavedChangesGuard(hasUnsaved: () => boolean): void;
|
|
@@ -10,29 +10,29 @@ declare function close(): void;
|
|
|
10
10
|
declare var __VLS_20: {
|
|
11
11
|
close: typeof close;
|
|
12
12
|
isDesktop: boolean;
|
|
13
|
-
},
|
|
13
|
+
}, __VLS_45: {
|
|
14
14
|
close: typeof close;
|
|
15
15
|
isDesktop: boolean;
|
|
16
|
-
},
|
|
16
|
+
}, __VLS_53: {
|
|
17
17
|
close: typeof close;
|
|
18
18
|
isDesktop: boolean;
|
|
19
|
-
},
|
|
19
|
+
}, __VLS_60: {
|
|
20
20
|
close: typeof close;
|
|
21
21
|
isDesktop: boolean;
|
|
22
|
-
},
|
|
22
|
+
}, __VLS_68: {
|
|
23
23
|
close: typeof close;
|
|
24
24
|
isDesktop: boolean;
|
|
25
25
|
};
|
|
26
26
|
type __VLS_Slots = {} & {
|
|
27
27
|
trigger?: (props: typeof __VLS_20) => any;
|
|
28
28
|
} & {
|
|
29
|
-
title?: (props: typeof
|
|
29
|
+
title?: (props: typeof __VLS_45) => any;
|
|
30
30
|
} & {
|
|
31
|
-
description?: (props: typeof
|
|
31
|
+
description?: (props: typeof __VLS_53) => any;
|
|
32
32
|
} & {
|
|
33
|
-
default?: (props: typeof
|
|
33
|
+
default?: (props: typeof __VLS_60) => any;
|
|
34
34
|
} & {
|
|
35
|
-
footer?: (props: typeof
|
|
35
|
+
footer?: (props: typeof __VLS_68) => any;
|
|
36
36
|
};
|
|
37
37
|
declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
38
38
|
"update:open": (open: boolean) => any;
|
|
@@ -78,6 +78,9 @@ const open = computed({
|
|
|
78
78
|
function close() {
|
|
79
79
|
open.value = false;
|
|
80
80
|
}
|
|
81
|
+
function onDismissAttempt(event) {
|
|
82
|
+
if (!props.dismissible) event.preventDefault();
|
|
83
|
+
}
|
|
81
84
|
</script>
|
|
82
85
|
|
|
83
86
|
<template>
|
|
@@ -98,12 +101,17 @@ function close() {
|
|
|
98
101
|
/>
|
|
99
102
|
</component>
|
|
100
103
|
|
|
104
|
+
<!-- The × button is a dismiss affordance too — it hides alongside the
|
|
105
|
+
other dismissal paths while the modal is non-dismissible. -->
|
|
101
106
|
<component
|
|
102
107
|
:is="modalComponents.Content"
|
|
103
108
|
v-bind="attrs"
|
|
104
|
-
:show-close-button="props.showCloseButton"
|
|
109
|
+
:show-close-button="props.showCloseButton && props.dismissible"
|
|
105
110
|
:content-width="props.contentWidth"
|
|
106
111
|
@after-close="emit('after-close')"
|
|
112
|
+
@escape-key-down="onDismissAttempt"
|
|
113
|
+
@pointer-down-outside="onDismissAttempt"
|
|
114
|
+
@interact-outside="onDismissAttempt"
|
|
107
115
|
>
|
|
108
116
|
<component
|
|
109
117
|
:is="modalComponents.Header"
|
|
@@ -10,29 +10,29 @@ declare function close(): void;
|
|
|
10
10
|
declare var __VLS_20: {
|
|
11
11
|
close: typeof close;
|
|
12
12
|
isDesktop: boolean;
|
|
13
|
-
},
|
|
13
|
+
}, __VLS_45: {
|
|
14
14
|
close: typeof close;
|
|
15
15
|
isDesktop: boolean;
|
|
16
|
-
},
|
|
16
|
+
}, __VLS_53: {
|
|
17
17
|
close: typeof close;
|
|
18
18
|
isDesktop: boolean;
|
|
19
|
-
},
|
|
19
|
+
}, __VLS_60: {
|
|
20
20
|
close: typeof close;
|
|
21
21
|
isDesktop: boolean;
|
|
22
|
-
},
|
|
22
|
+
}, __VLS_68: {
|
|
23
23
|
close: typeof close;
|
|
24
24
|
isDesktop: boolean;
|
|
25
25
|
};
|
|
26
26
|
type __VLS_Slots = {} & {
|
|
27
27
|
trigger?: (props: typeof __VLS_20) => any;
|
|
28
28
|
} & {
|
|
29
|
-
title?: (props: typeof
|
|
29
|
+
title?: (props: typeof __VLS_45) => any;
|
|
30
30
|
} & {
|
|
31
|
-
description?: (props: typeof
|
|
31
|
+
description?: (props: typeof __VLS_53) => any;
|
|
32
32
|
} & {
|
|
33
|
-
default?: (props: typeof
|
|
33
|
+
default?: (props: typeof __VLS_60) => any;
|
|
34
34
|
} & {
|
|
35
|
-
footer?: (props: typeof
|
|
35
|
+
footer?: (props: typeof __VLS_68) => any;
|
|
36
36
|
};
|
|
37
37
|
declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
38
38
|
"update:open": (open: boolean) => any;
|