@ramathibodi/nuxt-commons 4.0.20 → 4.0.21
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/document/TemplateBuilder.d.vue.ts +7 -1
- package/dist/runtime/components/document/TemplateBuilder.vue +7 -461
- package/dist/runtime/components/document/TemplateBuilder.vue.d.ts +7 -1
- package/dist/runtime/components/document/TemplateBuilderLiveView.d.vue.ts +185 -0
- package/dist/runtime/components/document/TemplateBuilderLiveView.vue +579 -0
- package/dist/runtime/components/document/TemplateBuilderLiveView.vue.d.ts +185 -0
- package/dist/runtime/components/document/TemplateItemForm.d.vue.ts +11 -0
- package/dist/runtime/components/document/TemplateItemForm.vue +437 -0
- package/dist/runtime/components/document/TemplateItemForm.vue.d.ts +11 -0
- package/dist/runtime/components/document/TemplatePalette.d.vue.ts +54 -0
- package/dist/runtime/components/document/TemplatePalette.vue +362 -0
- package/dist/runtime/components/document/TemplatePalette.vue.d.ts +54 -0
- package/dist/runtime/components/form/Pad.vue +1 -1
- package/dist/runtime/composables/document/template.d.ts +72 -1
- package/dist/runtime/composables/document/template.js +47 -8
- package/dist/runtime/composables/document/templateBuilderModel.d.ts +51 -0
- package/dist/runtime/composables/document/templateBuilderModel.js +62 -0
- package/dist/runtime/composables/document/templateFormHidden.js +3 -1
- package/dist/runtime/composables/document/templatePalette.d.ts +21 -0
- package/dist/runtime/composables/document/templatePalette.js +10 -0
- package/dist/runtime/composables/document/validateTemplate.js +61 -2
- package/package.json +1 -1
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
export type DocumentTemplateImportMode = 'ask' | 'append' | 'replace';
|
|
2
|
+
interface Props {
|
|
3
|
+
title?: string;
|
|
4
|
+
customCode?: boolean;
|
|
5
|
+
disableAdvanceMode?: boolean;
|
|
6
|
+
templateScript?: string;
|
|
7
|
+
toolbarColor?: string;
|
|
8
|
+
editorWidth?: number | string;
|
|
9
|
+
outline?: boolean;
|
|
10
|
+
initialData?: Record<string, any>;
|
|
11
|
+
importable?: boolean;
|
|
12
|
+
exportable?: boolean;
|
|
13
|
+
importMode?: DocumentTemplateImportMode;
|
|
14
|
+
stringFields?: string[];
|
|
15
|
+
sortable?: boolean;
|
|
16
|
+
palette?: boolean;
|
|
17
|
+
paletteTypes?: string[];
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Public props accepted by DocumentTemplateBuilderLiveView.
|
|
21
|
+
*
|
|
22
|
+
* Two surface modes are available from the live view's own bar (above the preview):
|
|
23
|
+
* - **Design** (default) — the preview is a click target: clicking any rendered
|
|
24
|
+
* field opens that item in the side panel. Inputs are not interactive.
|
|
25
|
+
* - **Preview** — the preview is a live, fillable form so you can try the
|
|
26
|
+
* validations; the data typed is shown in the "Preview data" panel.
|
|
27
|
+
*
|
|
28
|
+
* Items with no visual (`FormHidden`, `Separator`) are reachable from the
|
|
29
|
+
* **Outline** list, which also offers reordering for every item.
|
|
30
|
+
*
|
|
31
|
+
* In Design mode every rendered field is also a drag handle: drop it on the
|
|
32
|
+
* left / top half of another field to insert before it, on the right / bottom
|
|
33
|
+
* half to insert after (`sortable`, on by default).
|
|
34
|
+
*
|
|
35
|
+
* The **Palette** column (`palette`, on by default) shows one thumbnail card
|
|
36
|
+
* per input type. Drag a card into the live view to insert a new item of that
|
|
37
|
+
* type where it lands (the same before / after halves apply; anywhere else in
|
|
38
|
+
* the preview appends), or click a card to add one after the selected item.
|
|
39
|
+
* The new item opens in the editor so its label / variable can be filled in.
|
|
40
|
+
*/
|
|
41
|
+
type __VLS_Props = Props;
|
|
42
|
+
declare function openCreate(): void;
|
|
43
|
+
declare function openEdit(index: number): void;
|
|
44
|
+
declare function closeEditor(): void;
|
|
45
|
+
declare function deleteSelected(): void;
|
|
46
|
+
/**
|
|
47
|
+
* Move the item at `from` so it lands at index `to` (its index *after* the
|
|
48
|
+
* move). The editor selection follows the moved item; a selected neighbour
|
|
49
|
+
* that got shifted by the move keeps pointing at the same item.
|
|
50
|
+
*/
|
|
51
|
+
declare function moveItemTo(from: number, to: number): boolean;
|
|
52
|
+
declare function moveSelected(delta: number): void;
|
|
53
|
+
declare function duplicateSelected(): void;
|
|
54
|
+
/**
|
|
55
|
+
* Insert a fresh item of `inputType` at `index` (clamped; defaults to the
|
|
56
|
+
* end) and open it in the editor. The item is seeded from `initialData` plus
|
|
57
|
+
* a unique `variableName` and a default `inputLabel` (when the type needs
|
|
58
|
+
* them) so it renders in the preview right away — an item with no variable
|
|
59
|
+
* name would compile to `v-model="data."` and blank the whole preview.
|
|
60
|
+
* Returns the index it landed at.
|
|
61
|
+
*/
|
|
62
|
+
declare function insertInputType(inputType: string, index?: number): number;
|
|
63
|
+
/**
|
|
64
|
+
* Rows parsed by `<ImportCSV>` (one template item per row). `id` columns left
|
|
65
|
+
* behind by a FormTable export are dropped so appended items never collide;
|
|
66
|
+
* `printConfig` object maps are exploded into editor rows like a v-model load.
|
|
67
|
+
*/
|
|
68
|
+
declare function importItems(rows: Record<string, any>[]): Promise<void>;
|
|
69
|
+
type __VLS_ModelProps = {
|
|
70
|
+
modelValue?: string | Record<string, any>[];
|
|
71
|
+
};
|
|
72
|
+
type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
|
|
73
|
+
declare var __VLS_20: {}, __VLS_28: {
|
|
74
|
+
items: Record<string, any>[];
|
|
75
|
+
operation: {
|
|
76
|
+
openCreate: typeof openCreate;
|
|
77
|
+
openEdit: typeof openEdit;
|
|
78
|
+
closeEditor: typeof closeEditor;
|
|
79
|
+
deleteSelected: typeof deleteSelected;
|
|
80
|
+
moveSelected: typeof moveSelected;
|
|
81
|
+
moveItemTo: typeof moveItemTo;
|
|
82
|
+
duplicateSelected: typeof duplicateSelected;
|
|
83
|
+
insertInputType: typeof insertInputType;
|
|
84
|
+
importItems: typeof importItems;
|
|
85
|
+
convertToAdvanceMode: () => Promise<void>;
|
|
86
|
+
};
|
|
87
|
+
}, __VLS_197: {
|
|
88
|
+
operation: {
|
|
89
|
+
openCreate: typeof openCreate;
|
|
90
|
+
openEdit: typeof openEdit;
|
|
91
|
+
closeEditor: typeof closeEditor;
|
|
92
|
+
deleteSelected: typeof deleteSelected;
|
|
93
|
+
moveSelected: typeof moveSelected;
|
|
94
|
+
moveItemTo: typeof moveItemTo;
|
|
95
|
+
duplicateSelected: typeof duplicateSelected;
|
|
96
|
+
insertInputType: typeof insertInputType;
|
|
97
|
+
importItems: typeof importItems;
|
|
98
|
+
convertToAdvanceMode: () => Promise<void>;
|
|
99
|
+
};
|
|
100
|
+
}, __VLS_248: {
|
|
101
|
+
insert: typeof insertInputType;
|
|
102
|
+
disabled: boolean;
|
|
103
|
+
};
|
|
104
|
+
type __VLS_Slots = {} & {
|
|
105
|
+
title?: (props: typeof __VLS_20) => any;
|
|
106
|
+
} & {
|
|
107
|
+
toolbarItems?: (props: typeof __VLS_28) => any;
|
|
108
|
+
} & {
|
|
109
|
+
empty?: (props: typeof __VLS_197) => any;
|
|
110
|
+
} & {
|
|
111
|
+
palette?: (props: typeof __VLS_248) => any;
|
|
112
|
+
};
|
|
113
|
+
declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {
|
|
114
|
+
templateItems: import("vue").Ref<Record<string, any>[], Record<string, any>[]>;
|
|
115
|
+
previewData: import("vue").Ref<Record<string, any>, Record<string, any>>;
|
|
116
|
+
selectedIndex: import("vue").Ref<number | null, number | null>;
|
|
117
|
+
dragIndex: import("vue").Ref<number | null, number | null>;
|
|
118
|
+
mode: import("vue").Ref<"design" | "preview", "design" | "preview">;
|
|
119
|
+
operation: import("vue").Ref<{
|
|
120
|
+
openCreate: typeof openCreate;
|
|
121
|
+
openEdit: typeof openEdit;
|
|
122
|
+
closeEditor: typeof closeEditor;
|
|
123
|
+
deleteSelected: typeof deleteSelected;
|
|
124
|
+
moveSelected: typeof moveSelected;
|
|
125
|
+
moveItemTo: typeof moveItemTo;
|
|
126
|
+
duplicateSelected: typeof duplicateSelected;
|
|
127
|
+
insertInputType: typeof insertInputType;
|
|
128
|
+
importItems: typeof importItems;
|
|
129
|
+
convertToAdvanceMode: () => Promise<void>;
|
|
130
|
+
}, {
|
|
131
|
+
openCreate: typeof openCreate;
|
|
132
|
+
openEdit: typeof openEdit;
|
|
133
|
+
closeEditor: typeof closeEditor;
|
|
134
|
+
deleteSelected: typeof deleteSelected;
|
|
135
|
+
moveSelected: typeof moveSelected;
|
|
136
|
+
moveItemTo: typeof moveItemTo;
|
|
137
|
+
duplicateSelected: typeof duplicateSelected;
|
|
138
|
+
insertInputType: typeof insertInputType;
|
|
139
|
+
importItems: typeof importItems;
|
|
140
|
+
convertToAdvanceMode: () => Promise<void>;
|
|
141
|
+
} | {
|
|
142
|
+
openCreate: typeof openCreate;
|
|
143
|
+
openEdit: typeof openEdit;
|
|
144
|
+
closeEditor: typeof closeEditor;
|
|
145
|
+
deleteSelected: typeof deleteSelected;
|
|
146
|
+
moveSelected: typeof moveSelected;
|
|
147
|
+
moveItemTo: typeof moveItemTo;
|
|
148
|
+
duplicateSelected: typeof duplicateSelected;
|
|
149
|
+
insertInputType: typeof insertInputType;
|
|
150
|
+
importItems: typeof importItems;
|
|
151
|
+
convertToAdvanceMode: () => Promise<void>;
|
|
152
|
+
}>;
|
|
153
|
+
openCreate: typeof openCreate;
|
|
154
|
+
openEdit: typeof openEdit;
|
|
155
|
+
closeEditor: typeof closeEditor;
|
|
156
|
+
moveItemTo: typeof moveItemTo;
|
|
157
|
+
insertInputType: typeof insertInputType;
|
|
158
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
159
|
+
"update:modelValue": (value: string | Record<string, any>[] | undefined) => any;
|
|
160
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
161
|
+
"onUpdate:modelValue"?: ((value: string | Record<string, any>[] | undefined) => any) | undefined;
|
|
162
|
+
}>, {
|
|
163
|
+
title: string;
|
|
164
|
+
stringFields: string[];
|
|
165
|
+
initialData: Record<string, any>;
|
|
166
|
+
customCode: boolean;
|
|
167
|
+
disableAdvanceMode: boolean;
|
|
168
|
+
toolbarColor: string;
|
|
169
|
+
editorWidth: number | string;
|
|
170
|
+
outline: boolean;
|
|
171
|
+
importable: boolean;
|
|
172
|
+
exportable: boolean;
|
|
173
|
+
importMode: DocumentTemplateImportMode;
|
|
174
|
+
sortable: boolean;
|
|
175
|
+
palette: boolean;
|
|
176
|
+
paletteTypes: string[];
|
|
177
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
178
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
179
|
+
declare const _default: typeof __VLS_export;
|
|
180
|
+
export default _default;
|
|
181
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
182
|
+
new (): {
|
|
183
|
+
$slots: S;
|
|
184
|
+
};
|
|
185
|
+
};
|