@ramathibodi/nuxt-commons 4.0.26 → 4.0.28
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 +2 -2
- package/dist/runtime/components/Calendar.d.vue.ts +12 -10
- package/dist/runtime/components/Calendar.vue.d.ts +12 -10
- package/dist/runtime/components/ExportCSV.d.vue.ts +3 -3
- package/dist/runtime/components/ExportCSV.vue.d.ts +3 -3
- package/dist/runtime/components/FileBtn.d.vue.ts +3 -3
- package/dist/runtime/components/FileBtn.vue.d.ts +3 -3
- package/dist/runtime/components/ImportCSV.d.vue.ts +3 -3
- package/dist/runtime/components/ImportCSV.vue.d.ts +3 -3
- package/dist/runtime/components/SplitterPanel.d.vue.ts +7 -5
- package/dist/runtime/components/SplitterPanel.vue.d.ts +7 -5
- package/dist/runtime/components/TabsGroup.d.vue.ts +7 -5
- package/dist/runtime/components/TabsGroup.vue.d.ts +7 -5
- package/dist/runtime/components/device/IdCardButton.d.vue.ts +3 -3
- package/dist/runtime/components/device/IdCardButton.vue.d.ts +3 -3
- package/dist/runtime/components/device/Scanner.d.vue.ts +31 -29
- package/dist/runtime/components/device/Scanner.vue.d.ts +31 -29
- package/dist/runtime/components/dialog/Confirm.d.vue.ts +7 -5
- package/dist/runtime/components/dialog/Confirm.vue.d.ts +7 -5
- package/dist/runtime/components/dialog/ImportProgress.d.vue.ts +5 -3
- package/dist/runtime/components/dialog/ImportProgress.vue.d.ts +5 -3
- package/dist/runtime/components/dialog/Index.d.vue.ts +5 -3
- package/dist/runtime/components/dialog/Index.vue.d.ts +5 -3
- package/dist/runtime/components/dialog/Loading.d.vue.ts +5 -3
- package/dist/runtime/components/dialog/Loading.vue.d.ts +5 -3
- package/dist/runtime/components/dialog/default/Confirm.d.vue.ts +7 -5
- package/dist/runtime/components/dialog/default/Confirm.vue.d.ts +7 -5
- package/dist/runtime/components/dialog/default/Loading.d.vue.ts +7 -5
- package/dist/runtime/components/dialog/default/Loading.vue.d.ts +7 -5
- package/dist/runtime/components/dialog/default/Printing.d.vue.ts +5 -3
- package/dist/runtime/components/dialog/default/Printing.vue.d.ts +5 -3
- package/dist/runtime/components/document/TemplateBuilderLiveView.d.vue.ts +88 -73
- package/dist/runtime/components/document/TemplateBuilderLiveView.vue +175 -68
- package/dist/runtime/components/document/TemplateBuilderLiveView.vue.d.ts +88 -73
- package/dist/runtime/components/document/TemplateInputAttributesHelper.d.vue.ts +14 -0
- package/dist/runtime/components/document/TemplateInputAttributesHelper.vue +154 -0
- package/dist/runtime/components/document/TemplateInputAttributesHelper.vue.d.ts +14 -0
- package/dist/runtime/components/document/TemplateItemForm.vue +46 -1
- package/dist/runtime/components/document/TemplatePalette.d.vue.ts +8 -6
- package/dist/runtime/components/document/TemplatePalette.vue +16 -0
- package/dist/runtime/components/document/TemplatePalette.vue.d.ts +8 -6
- package/dist/runtime/components/form/ActionPad.d.vue.ts +34 -32
- package/dist/runtime/components/form/ActionPad.vue.d.ts +34 -32
- package/dist/runtime/components/form/Date.d.vue.ts +20 -18
- package/dist/runtime/components/form/Date.vue.d.ts +20 -18
- package/dist/runtime/components/form/DateTime.d.vue.ts +1 -1
- package/dist/runtime/components/form/DateTime.vue.d.ts +1 -1
- package/dist/runtime/components/form/Dialog.d.vue.ts +24 -22
- package/dist/runtime/components/form/Dialog.vue.d.ts +24 -22
- package/dist/runtime/components/form/EditPad.d.vue.ts +34 -32
- package/dist/runtime/components/form/EditPad.vue.d.ts +34 -32
- package/dist/runtime/components/form/File.d.vue.ts +12 -10
- package/dist/runtime/components/form/File.vue.d.ts +12 -10
- package/dist/runtime/components/form/Iterator.d.vue.ts +121 -134
- package/dist/runtime/components/form/Iterator.vue.d.ts +121 -134
- package/dist/runtime/components/form/Login.d.vue.ts +5 -3
- package/dist/runtime/components/form/Login.vue.d.ts +5 -3
- package/dist/runtime/components/form/Pad.d.vue.ts +651 -649
- package/dist/runtime/components/form/Pad.vue.d.ts +651 -649
- package/dist/runtime/components/form/Table.d.vue.ts +69 -82
- package/dist/runtime/components/form/Table.vue.d.ts +69 -82
- package/dist/runtime/components/form/TableData.d.vue.ts +18 -24
- package/dist/runtime/components/form/TableData.vue.d.ts +18 -24
- package/dist/runtime/components/form/images/Capture.d.vue.ts +15 -13
- package/dist/runtime/components/form/images/Capture.vue.d.ts +15 -13
- package/dist/runtime/components/label/Date.d.vue.ts +1 -1
- package/dist/runtime/components/label/Date.vue.d.ts +1 -1
- package/dist/runtime/components/label/Field.d.vue.ts +16 -14
- package/dist/runtime/components/label/Field.vue.d.ts +16 -14
- package/dist/runtime/components/label/FormatMoney.d.vue.ts +1 -1
- package/dist/runtime/components/label/FormatMoney.vue.d.ts +1 -1
- package/dist/runtime/components/master/Autocomplete.d.vue.ts +3 -5
- package/dist/runtime/components/master/Autocomplete.vue.d.ts +3 -5
- package/dist/runtime/components/master/Combobox.d.vue.ts +3 -5
- package/dist/runtime/components/master/Combobox.vue.d.ts +3 -5
- package/dist/runtime/components/master/RadioGroup.d.vue.ts +3 -3
- package/dist/runtime/components/master/RadioGroup.vue.d.ts +3 -3
- package/dist/runtime/components/master/Select.d.vue.ts +3 -5
- package/dist/runtime/components/master/Select.vue.d.ts +3 -5
- package/dist/runtime/components/master/label.d.vue.ts +7 -3
- package/dist/runtime/components/master/label.vue +33 -15
- package/dist/runtime/components/master/label.vue.d.ts +7 -3
- package/dist/runtime/components/model/Autocomplete.d.vue.ts +3 -3
- package/dist/runtime/components/model/Autocomplete.vue.d.ts +3 -3
- package/dist/runtime/components/model/Combobox.d.vue.ts +3 -3
- package/dist/runtime/components/model/Combobox.vue.d.ts +3 -3
- package/dist/runtime/components/model/Pad.d.vue.ts +17 -15
- package/dist/runtime/components/model/Pad.vue.d.ts +17 -15
- package/dist/runtime/components/model/Select.d.vue.ts +3 -3
- package/dist/runtime/components/model/Select.vue.d.ts +3 -3
- package/dist/runtime/components/model/Table.d.vue.ts +102 -166
- package/dist/runtime/components/model/Table.vue.d.ts +102 -166
- package/dist/runtime/components/model/iterator.d.vue.ts +188 -240
- package/dist/runtime/components/model/iterator.vue.d.ts +188 -240
- package/dist/runtime/components/model/label.d.vue.ts +11 -5
- package/dist/runtime/components/model/label.vue +54 -4
- package/dist/runtime/components/model/label.vue.d.ts +11 -5
- package/dist/runtime/composables/batchLookup.d.ts +39 -0
- package/dist/runtime/composables/batchLookup.js +144 -0
- package/dist/runtime/composables/document/inputAttributeCatalog.generated.json +95 -0
- package/dist/runtime/composables/document/inputAttributes.d.ts +46 -0
- package/dist/runtime/composables/document/inputAttributes.js +196 -0
- package/dist/runtime/composables/document/template.d.ts +9 -1
- package/dist/runtime/composables/document/template.js +16 -3
- package/dist/runtime/composables/document/templateInputTypes.d.ts +36 -0
- package/dist/runtime/composables/document/templateInputTypes.js +86 -17
- package/dist/runtime/composables/document/templateMasterLabel.d.ts +32 -0
- package/dist/runtime/composables/document/templateMasterLabel.js +30 -0
- package/dist/runtime/composables/document/validateTemplate.js +11 -1
- package/dist/runtime/composables/masterItemBatch.d.ts +7 -0
- package/dist/runtime/composables/masterItemBatch.js +12 -0
- package/dist/runtime/composables/modelBatch.d.ts +61 -0
- package/dist/runtime/composables/modelBatch.js +192 -0
- package/dist/runtime/labs/form/EditMobile.d.vue.ts +1 -1
- package/dist/runtime/labs/form/EditMobile.vue.d.ts +1 -1
- package/dist/runtime/labs/form/TextFieldMask.d.vue.ts +3 -3
- package/dist/runtime/labs/form/TextFieldMask.vue.d.ts +3 -3
- package/dist/runtime/plugins/clientConfig.d.ts +1 -1
- package/dist/runtime/plugins/default.d.ts +1 -1
- package/dist/runtime/plugins/dialogManager.d.ts +1 -1
- package/dist/runtime/plugins/permission.d.ts +1 -1
- package/package.json +2 -2
- package/scripts/build-input-attribute-catalog.mjs +133 -0
|
@@ -17,6 +17,7 @@ interface Props {
|
|
|
17
17
|
sortable?: boolean;
|
|
18
18
|
palette?: boolean;
|
|
19
19
|
paletteTypes?: string[];
|
|
20
|
+
height?: number | string;
|
|
20
21
|
}
|
|
21
22
|
/**
|
|
22
23
|
* Public props accepted by DocumentTemplateBuilderLiveView.
|
|
@@ -30,9 +31,15 @@ interface Props {
|
|
|
30
31
|
* - **Preview** — the preview is a live, fillable form so you can try the
|
|
31
32
|
* validations; the data typed is shown in the "Preview data" panel.
|
|
32
33
|
*
|
|
33
|
-
* Items with no visual (`FormHidden`, `Separator`)
|
|
34
|
-
*
|
|
35
|
-
*
|
|
34
|
+
* Items with no visual (`FormHidden`, `Separator`) get a placeholder in Design
|
|
35
|
+
* mode (hidden in Preview mode), so they can be selected, moved and deleted
|
|
36
|
+
* like any field. They are also reachable from the **Outline** list (a click
|
|
37
|
+
* opens the editor dialog), which offers reordering and deletion for every item.
|
|
38
|
+
*
|
|
39
|
+
* Both the overlay and the outline carry a **move to position** button between
|
|
40
|
+
* their up / down arrows (DocumentTemplateBuilder's "Enter the new position"):
|
|
41
|
+
* it opens a small menu that takes the new 1-based position (the numbering the
|
|
42
|
+
* outline and the overlay show) and moves the item there on Move / Enter.
|
|
36
43
|
*
|
|
37
44
|
* In Design mode every rendered field is also a drag handle: drop it on the
|
|
38
45
|
* left / top half of another field to insert before it, on the right / bottom
|
|
@@ -44,6 +51,11 @@ interface Props {
|
|
|
44
51
|
* the preview appends), or click a card to add one after the selected item.
|
|
45
52
|
* The new item's settings dialog opens at once; cancelling it removes the
|
|
46
53
|
* item again, saving keeps it.
|
|
54
|
+
*
|
|
55
|
+
* With `height` set the card has a fixed height: the toolbar and the live
|
|
56
|
+
* view bar stay put and only the form (plus the outline and the palette,
|
|
57
|
+
* each on its own from `md` up) scrolls. Use it inside dialogs, where the
|
|
58
|
+
* natural height would scroll the toolbar out of reach.
|
|
47
59
|
*/
|
|
48
60
|
type __VLS_Props = Props;
|
|
49
61
|
/** Select (highlight + pin the edit overlay on) the item at `index`, or clear the selection with `null`. */
|
|
@@ -88,72 +100,74 @@ type __VLS_ModelProps = {
|
|
|
88
100
|
modelValue?: string | Record<string, any>[];
|
|
89
101
|
};
|
|
90
102
|
type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
|
|
91
|
-
declare
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
103
|
+
declare const __VLS_template: () => {
|
|
104
|
+
__VLS_Slots: {
|
|
105
|
+
title?: (props: {}) => any;
|
|
106
|
+
} & {
|
|
107
|
+
toolbarItems?: (props: {
|
|
108
|
+
items: Record<string, any>[];
|
|
109
|
+
operation: {
|
|
110
|
+
openCreate: typeof openCreate;
|
|
111
|
+
openEdit: typeof openEdit;
|
|
112
|
+
closeEditor: typeof closeEditor;
|
|
113
|
+
selectItem: typeof selectItem;
|
|
114
|
+
deleteItem: typeof deleteItem;
|
|
115
|
+
deleteSelected: typeof deleteSelected;
|
|
116
|
+
moveSelected: typeof moveSelected;
|
|
117
|
+
moveItemTo: typeof moveItemTo;
|
|
118
|
+
duplicateItem: typeof duplicateItem;
|
|
119
|
+
duplicateSelected: typeof duplicateSelected;
|
|
120
|
+
insertInputType: typeof insertInputType;
|
|
121
|
+
importItems: typeof importItems;
|
|
122
|
+
convertToAdvanceMode: () => Promise<void>;
|
|
123
|
+
};
|
|
124
|
+
}) => any;
|
|
125
|
+
} & {
|
|
126
|
+
empty?: (props: {
|
|
127
|
+
operation: {
|
|
128
|
+
openCreate: typeof openCreate;
|
|
129
|
+
openEdit: typeof openEdit;
|
|
130
|
+
closeEditor: typeof closeEditor;
|
|
131
|
+
selectItem: typeof selectItem;
|
|
132
|
+
deleteItem: typeof deleteItem;
|
|
133
|
+
deleteSelected: typeof deleteSelected;
|
|
134
|
+
moveSelected: typeof moveSelected;
|
|
135
|
+
moveItemTo: typeof moveItemTo;
|
|
136
|
+
duplicateItem: typeof duplicateItem;
|
|
137
|
+
duplicateSelected: typeof duplicateSelected;
|
|
138
|
+
insertInputType: typeof insertInputType;
|
|
139
|
+
importItems: typeof importItems;
|
|
140
|
+
convertToAdvanceMode: () => Promise<void>;
|
|
141
|
+
};
|
|
142
|
+
}) => any;
|
|
143
|
+
} & {
|
|
144
|
+
itemOverlay?: (props: {
|
|
145
|
+
index: number;
|
|
146
|
+
item: Record<string, any>;
|
|
147
|
+
operation: {
|
|
148
|
+
openCreate: typeof openCreate;
|
|
149
|
+
openEdit: typeof openEdit;
|
|
150
|
+
closeEditor: typeof closeEditor;
|
|
151
|
+
selectItem: typeof selectItem;
|
|
152
|
+
deleteItem: typeof deleteItem;
|
|
153
|
+
deleteSelected: typeof deleteSelected;
|
|
154
|
+
moveSelected: typeof moveSelected;
|
|
155
|
+
moveItemTo: typeof moveItemTo;
|
|
156
|
+
duplicateItem: typeof duplicateItem;
|
|
157
|
+
duplicateSelected: typeof duplicateSelected;
|
|
158
|
+
insertInputType: typeof insertInputType;
|
|
159
|
+
importItems: typeof importItems;
|
|
160
|
+
convertToAdvanceMode: () => Promise<void>;
|
|
161
|
+
};
|
|
162
|
+
}) => any;
|
|
163
|
+
} & {
|
|
164
|
+
palette?: (props: {
|
|
165
|
+
insert: typeof insertInputType;
|
|
166
|
+
disabled: boolean;
|
|
167
|
+
}) => any;
|
|
141
168
|
};
|
|
142
|
-
}, __VLS_291: {
|
|
143
|
-
insert: typeof insertInputType;
|
|
144
|
-
disabled: boolean;
|
|
145
|
-
};
|
|
146
|
-
type __VLS_Slots = {} & {
|
|
147
|
-
title?: (props: typeof __VLS_19) => any;
|
|
148
|
-
} & {
|
|
149
|
-
toolbarItems?: (props: typeof __VLS_27) => any;
|
|
150
|
-
} & {
|
|
151
|
-
empty?: (props: typeof __VLS_203) => any;
|
|
152
|
-
} & {
|
|
153
|
-
itemOverlay?: (props: typeof __VLS_224) => any;
|
|
154
|
-
} & {
|
|
155
|
-
palette?: (props: typeof __VLS_291) => any;
|
|
156
169
|
};
|
|
170
|
+
type __VLS_Slots = ReturnType<typeof __VLS_template>['__VLS_Slots'];
|
|
157
171
|
declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {
|
|
158
172
|
templateItems: import("vue").Ref<Record<string, any>[], Record<string, any>[]>;
|
|
159
173
|
previewData: import("vue").Ref<Record<string, any>, Record<string, any>>;
|
|
@@ -216,21 +230,22 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {
|
|
|
216
230
|
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
217
231
|
"onUpdate:modelValue"?: ((value: string | Record<string, any>[] | undefined) => any) | undefined;
|
|
218
232
|
}>, {
|
|
233
|
+
height: string | number;
|
|
219
234
|
title: string;
|
|
220
235
|
stringFields: string[];
|
|
221
236
|
initialData: Record<string, any>;
|
|
222
|
-
dialogFullscreen: boolean;
|
|
223
|
-
toolbarColor: string;
|
|
224
|
-
importable: boolean;
|
|
225
237
|
exportable: boolean;
|
|
238
|
+
importable: boolean;
|
|
239
|
+
outline: boolean;
|
|
240
|
+
palette: boolean;
|
|
226
241
|
sortable: boolean;
|
|
227
|
-
dialogMaxWidth: string | number;
|
|
228
242
|
roleCustomCode: string | string[];
|
|
229
243
|
disableAdvanceMode: boolean;
|
|
244
|
+
toolbarColor: string;
|
|
230
245
|
editorWidth: string | number;
|
|
231
|
-
|
|
246
|
+
dialogMaxWidth: string | number;
|
|
247
|
+
dialogFullscreen: boolean;
|
|
232
248
|
importMode: DocumentTemplateImportMode;
|
|
233
|
-
palette: boolean;
|
|
234
249
|
paletteTypes: string[];
|
|
235
250
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
236
251
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
interface Props {
|
|
2
|
+
inputType?: string;
|
|
3
|
+
modelValue?: string;
|
|
4
|
+
}
|
|
5
|
+
declare const __VLS_export: import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
6
|
+
"update:modelValue": (value: string) => any;
|
|
7
|
+
}, string, import("vue").PublicProps, Readonly<Props> & Readonly<{
|
|
8
|
+
"onUpdate:modelValue"?: ((value: string) => any) | undefined;
|
|
9
|
+
}>, {
|
|
10
|
+
modelValue: string;
|
|
11
|
+
inputType: string;
|
|
12
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
13
|
+
declare const _default: typeof __VLS_export;
|
|
14
|
+
export default _default;
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { computed, ref } from "vue";
|
|
3
|
+
import {
|
|
4
|
+
inputAttributeSnippet,
|
|
5
|
+
insertInputAttribute,
|
|
6
|
+
parseInputAttributeNames,
|
|
7
|
+
useInputAttributeCatalog
|
|
8
|
+
} from "../../composables/document/inputAttributes";
|
|
9
|
+
const props = defineProps({
|
|
10
|
+
inputType: { type: String, required: false, default: void 0 },
|
|
11
|
+
modelValue: { type: String, required: false, default: "" }
|
|
12
|
+
});
|
|
13
|
+
const emit = defineEmits(["update:modelValue"]);
|
|
14
|
+
const menu = ref(false);
|
|
15
|
+
const search = ref("");
|
|
16
|
+
const { attributes, isLoading } = useInputAttributeCatalog(() => props.inputType);
|
|
17
|
+
const usedNames = computed(() => new Set(parseInputAttributeNames(props.modelValue)));
|
|
18
|
+
const insertableCount = computed(() => attributes.value.filter((attribute) => !attribute.managed).length);
|
|
19
|
+
const filteredAttributes = computed(() => {
|
|
20
|
+
const term = (search.value ?? "").trim().toLowerCase();
|
|
21
|
+
if (!term) return attributes.value;
|
|
22
|
+
return attributes.value.filter((attribute) => attribute.name.includes(term) || (attribute.description ?? "").toLowerCase().includes(term));
|
|
23
|
+
});
|
|
24
|
+
function insert(attribute, value) {
|
|
25
|
+
if (attribute.managed) return;
|
|
26
|
+
emit("update:modelValue", insertInputAttribute(props.modelValue, attribute.name, inputAttributeSnippet(attribute, value)));
|
|
27
|
+
}
|
|
28
|
+
function shortType(type) {
|
|
29
|
+
if (!type) return "any";
|
|
30
|
+
return type.length > 40 ? `${type.slice(0, 39)}\u2026` : type;
|
|
31
|
+
}
|
|
32
|
+
function onRowClick(attribute) {
|
|
33
|
+
if (!attribute.values?.length) insert(attribute);
|
|
34
|
+
}
|
|
35
|
+
</script>
|
|
36
|
+
|
|
37
|
+
<template>
|
|
38
|
+
<v-menu
|
|
39
|
+
v-if="isLoading || insertableCount > 0"
|
|
40
|
+
v-model="menu"
|
|
41
|
+
:close-on-content-click="false"
|
|
42
|
+
location="bottom start"
|
|
43
|
+
min-width="420"
|
|
44
|
+
max-width="560"
|
|
45
|
+
>
|
|
46
|
+
<template #activator="{ props: activatorProps }">
|
|
47
|
+
<v-btn
|
|
48
|
+
v-bind="activatorProps"
|
|
49
|
+
:loading="isLoading"
|
|
50
|
+
class="text-none px-1"
|
|
51
|
+
density="comfortable"
|
|
52
|
+
prepend-icon="mdi mdi-format-list-bulleted"
|
|
53
|
+
size="small"
|
|
54
|
+
variant="text"
|
|
55
|
+
>
|
|
56
|
+
Available props ({{ insertableCount }})
|
|
57
|
+
</v-btn>
|
|
58
|
+
</template>
|
|
59
|
+
<v-card>
|
|
60
|
+
<v-card-text class="pa-2">
|
|
61
|
+
<v-text-field
|
|
62
|
+
v-model="search"
|
|
63
|
+
autofocus
|
|
64
|
+
clearable
|
|
65
|
+
density="compact"
|
|
66
|
+
hide-details
|
|
67
|
+
placeholder="Search name or description"
|
|
68
|
+
prepend-inner-icon="mdi mdi-magnify"
|
|
69
|
+
variant="outlined"
|
|
70
|
+
/>
|
|
71
|
+
</v-card-text>
|
|
72
|
+
<v-divider />
|
|
73
|
+
<v-list
|
|
74
|
+
class="py-0 doc-input-attributes__list"
|
|
75
|
+
density="compact"
|
|
76
|
+
max-height="360"
|
|
77
|
+
>
|
|
78
|
+
<v-list-item
|
|
79
|
+
v-for="attribute in filteredAttributes"
|
|
80
|
+
:key="attribute.name"
|
|
81
|
+
:class="{ 'doc-input-attributes__managed': attribute.managed }"
|
|
82
|
+
:link="!attribute.managed && !attribute.values?.length"
|
|
83
|
+
:data-attribute="attribute.name"
|
|
84
|
+
@click="onRowClick(attribute)"
|
|
85
|
+
>
|
|
86
|
+
<div class="d-flex align-start ga-2">
|
|
87
|
+
<div class="doc-input-attributes__name">
|
|
88
|
+
<code>{{ attribute.name }}</code>
|
|
89
|
+
<div
|
|
90
|
+
class="text-caption text-medium-emphasis"
|
|
91
|
+
:title="attribute.type"
|
|
92
|
+
>
|
|
93
|
+
{{ shortType(attribute.type) }} · {{ attribute.source }}
|
|
94
|
+
</div>
|
|
95
|
+
</div>
|
|
96
|
+
<div class="flex-grow-1 text-body-2">
|
|
97
|
+
<div :class="attribute.managed ? 'text-disabled' : 'text-medium-emphasis'">
|
|
98
|
+
{{ attribute.managed ? "Set by the builder." : attribute.description || "" }}
|
|
99
|
+
</div>
|
|
100
|
+
<div
|
|
101
|
+
v-if="attribute.values?.length && !attribute.managed"
|
|
102
|
+
class="d-flex flex-wrap ga-1 mt-1"
|
|
103
|
+
>
|
|
104
|
+
<v-chip
|
|
105
|
+
v-for="value in attribute.values"
|
|
106
|
+
:key="value"
|
|
107
|
+
:data-value="value"
|
|
108
|
+
label
|
|
109
|
+
size="x-small"
|
|
110
|
+
variant="outlined"
|
|
111
|
+
@click.stop="insert(attribute, value)"
|
|
112
|
+
>
|
|
113
|
+
{{ value }}
|
|
114
|
+
</v-chip>
|
|
115
|
+
</div>
|
|
116
|
+
</div>
|
|
117
|
+
<v-chip
|
|
118
|
+
v-if="attribute.managed"
|
|
119
|
+
label
|
|
120
|
+
size="x-small"
|
|
121
|
+
variant="tonal"
|
|
122
|
+
>
|
|
123
|
+
builder
|
|
124
|
+
</v-chip>
|
|
125
|
+
<v-chip
|
|
126
|
+
v-else-if="usedNames.has(attribute.name)"
|
|
127
|
+
color="success"
|
|
128
|
+
label
|
|
129
|
+
prepend-icon="mdi mdi-check"
|
|
130
|
+
size="x-small"
|
|
131
|
+
variant="tonal"
|
|
132
|
+
>
|
|
133
|
+
used
|
|
134
|
+
</v-chip>
|
|
135
|
+
</div>
|
|
136
|
+
</v-list-item>
|
|
137
|
+
<v-list-item
|
|
138
|
+
v-if="filteredAttributes.length === 0"
|
|
139
|
+
class="text-medium-emphasis text-body-2"
|
|
140
|
+
>
|
|
141
|
+
No props match "{{ search }}".
|
|
142
|
+
</v-list-item>
|
|
143
|
+
</v-list>
|
|
144
|
+
<v-divider />
|
|
145
|
+
<div class="px-3 py-1 text-caption text-medium-emphasis">
|
|
146
|
+
Click a prop to insert it. Enum props: click a value. Grey props are set by the builder.
|
|
147
|
+
</div>
|
|
148
|
+
</v-card>
|
|
149
|
+
</v-menu>
|
|
150
|
+
</template>
|
|
151
|
+
|
|
152
|
+
<style scoped>
|
|
153
|
+
.doc-input-attributes__name{flex:0 0 160px;min-width:0;overflow-wrap:anywhere}.doc-input-attributes__managed{cursor:default}
|
|
154
|
+
</style>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
interface Props {
|
|
2
|
+
inputType?: string;
|
|
3
|
+
modelValue?: string;
|
|
4
|
+
}
|
|
5
|
+
declare const __VLS_export: import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
6
|
+
"update:modelValue": (value: string) => any;
|
|
7
|
+
}, string, import("vue").PublicProps, Readonly<Props> & Readonly<{
|
|
8
|
+
"onUpdate:modelValue"?: ((value: string) => any) | undefined;
|
|
9
|
+
}>, {
|
|
10
|
+
modelValue: string;
|
|
11
|
+
inputType: string;
|
|
12
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
13
|
+
declare const _default: typeof __VLS_export;
|
|
14
|
+
export default _default;
|
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
useDocumentTemplateInputTypes
|
|
14
14
|
} from "../../composables/document/templateInputTypes";
|
|
15
15
|
import { autoActionHeader, templateToHeader } from "../../composables/document/templateFormTable";
|
|
16
|
+
import { formatMasterLabelOptions, isMasterLabelFixed } from "../../composables/document/templateMasterLabel";
|
|
16
17
|
import { useRules } from "../../composables/utils/validation";
|
|
17
18
|
import { useUserPermission } from "../../composables/userPermission";
|
|
18
19
|
const props = defineProps({
|
|
@@ -73,6 +74,17 @@ const inputOptionsLabel = computed(() => {
|
|
|
73
74
|
for (const t of inputTypes.value) if (t.optionsLabel) acc[t.value] = t.optionsLabel;
|
|
74
75
|
return acc;
|
|
75
76
|
});
|
|
77
|
+
const masterLabelOptions = computed(() => {
|
|
78
|
+
const current = props.data.inputOptions;
|
|
79
|
+
if (typeof current !== "string") return { groupKey: "", itemCode: "" };
|
|
80
|
+
const pipe = current.indexOf("|");
|
|
81
|
+
return pipe < 0 ? { groupKey: current, itemCode: "" } : { groupKey: current.slice(0, pipe), itemCode: current.slice(pipe + 1) };
|
|
82
|
+
});
|
|
83
|
+
function setMasterLabelOption(part, value) {
|
|
84
|
+
const { groupKey, itemCode } = masterLabelOptions.value;
|
|
85
|
+
props.data.inputOptions = part === "groupKey" ? formatMasterLabelOptions(value, itemCode) : formatMasterLabelOptions(groupKey, value);
|
|
86
|
+
}
|
|
87
|
+
const variableNameRequired = computed(() => !isMasterLabelFixed(props.data));
|
|
76
88
|
const ruleOptions = (inputType) => (value) => {
|
|
77
89
|
if (choiceOption.value.includes(inputType) && !/^[^'",]+(,[^'",]+)*$/.test(value)) return "Invalid options format";
|
|
78
90
|
return true;
|
|
@@ -115,7 +127,7 @@ const ruleOptions = (inputType) => (value) => {
|
|
|
115
127
|
<v-text-field
|
|
116
128
|
v-model="data.variableName"
|
|
117
129
|
label="Variable Name"
|
|
118
|
-
:rules="[rules.
|
|
130
|
+
:rules="[rules.requireIf(variableNameRequired)]"
|
|
119
131
|
/>
|
|
120
132
|
</v-col>
|
|
121
133
|
<v-col
|
|
@@ -288,6 +300,34 @@ const ruleOptions = (inputType) => (value) => {
|
|
|
288
300
|
:rules="[rules.requireIf(requireOption.includes(data.inputType)), ruleOptions(data.inputType)]"
|
|
289
301
|
v-if="!hasSpecificOption.includes(data.inputType) && !choiceOption.includes(data.inputType)"
|
|
290
302
|
/>
|
|
303
|
+
<v-row
|
|
304
|
+
v-if="data.inputType == 'MasterLabel'"
|
|
305
|
+
density="compact"
|
|
306
|
+
>
|
|
307
|
+
<v-col
|
|
308
|
+
cols="12"
|
|
309
|
+
md="6"
|
|
310
|
+
>
|
|
311
|
+
<v-text-field
|
|
312
|
+
:model-value="masterLabelOptions.groupKey"
|
|
313
|
+
label="Group Key"
|
|
314
|
+
:rules="[rules.require()]"
|
|
315
|
+
@update:model-value="setMasterLabelOption('groupKey', $event)"
|
|
316
|
+
/>
|
|
317
|
+
</v-col>
|
|
318
|
+
<v-col
|
|
319
|
+
cols="12"
|
|
320
|
+
md="6"
|
|
321
|
+
>
|
|
322
|
+
<v-text-field
|
|
323
|
+
:model-value="masterLabelOptions.itemCode"
|
|
324
|
+
label="Fixed Item Code"
|
|
325
|
+
hint="Leave empty to show the name of the code in Variable Name"
|
|
326
|
+
persistent-hint
|
|
327
|
+
@update:model-value="setMasterLabelOption('itemCode', $event)"
|
|
328
|
+
/>
|
|
329
|
+
</v-col>
|
|
330
|
+
</v-row>
|
|
291
331
|
</v-col>
|
|
292
332
|
|
|
293
333
|
<v-col
|
|
@@ -330,6 +370,11 @@ const ruleOptions = (inputType) => (value) => {
|
|
|
330
370
|
<v-text-field
|
|
331
371
|
v-model="data.inputAttributes"
|
|
332
372
|
label="Input Attributes"
|
|
373
|
+
hide-details="auto"
|
|
374
|
+
/>
|
|
375
|
+
<document-template-input-attributes-helper
|
|
376
|
+
v-model="data.inputAttributes"
|
|
377
|
+
:input-type="data.inputType"
|
|
333
378
|
/>
|
|
334
379
|
</v-col>
|
|
335
380
|
<v-col class="doc-item-form__half" v-if="!notRequireColumnAttributes.includes(data.inputType)">
|
|
@@ -7,7 +7,7 @@ interface Props {
|
|
|
7
7
|
grouped?: boolean;
|
|
8
8
|
disabled?: boolean;
|
|
9
9
|
}
|
|
10
|
-
type Thumb = 'text' | 'textarea' | 'date' | 'time' | 'datetime' | 'select' | 'radio' | 'radio-inline' | 'checkbox' | 'checkbox-group' | 'switch' | 'file' | 'images' | 'sign' | 'table' | 'header' | 'label' | 'separator' | 'hidden' | 'form' | 'code' | 'custom';
|
|
10
|
+
type Thumb = 'text' | 'textarea' | 'date' | 'time' | 'datetime' | 'select' | 'radio' | 'radio-inline' | 'checkbox' | 'checkbox-group' | 'switch' | 'file' | 'images' | 'sign' | 'table' | 'header' | 'label' | 'master-label' | 'separator' | 'hidden' | 'form' | 'code' | 'custom';
|
|
11
11
|
interface PaletteCard {
|
|
12
12
|
entry: DocumentTemplateInputType;
|
|
13
13
|
value: string;
|
|
@@ -16,10 +16,12 @@ interface PaletteCard {
|
|
|
16
16
|
thumb: Thumb;
|
|
17
17
|
icon?: string;
|
|
18
18
|
}
|
|
19
|
-
declare
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
declare const __VLS_template: () => {
|
|
20
|
+
__VLS_Slots: {
|
|
21
|
+
title?: (props: {}) => any;
|
|
22
|
+
};
|
|
22
23
|
};
|
|
24
|
+
type __VLS_Slots = ReturnType<typeof __VLS_template>['__VLS_Slots'];
|
|
23
25
|
declare const __VLS_base: import("vue").DefineComponent<Props, {
|
|
24
26
|
search: import("vue").Ref<string, string>;
|
|
25
27
|
cards: import("vue").ComputedRef<PaletteCard[]>;
|
|
@@ -39,10 +41,10 @@ declare const __VLS_base: import("vue").DefineComponent<Props, {
|
|
|
39
41
|
}>, {
|
|
40
42
|
disabled: boolean;
|
|
41
43
|
title: string;
|
|
42
|
-
searchable: boolean;
|
|
43
|
-
types: string[];
|
|
44
44
|
exclude: string[];
|
|
45
45
|
grouped: boolean;
|
|
46
|
+
searchable: boolean;
|
|
47
|
+
types: string[];
|
|
46
48
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
47
49
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
48
50
|
declare const _default: typeof __VLS_export;
|
|
@@ -35,6 +35,7 @@ const THUMBS = {
|
|
|
35
35
|
FormTableData: "table",
|
|
36
36
|
Header: "header",
|
|
37
37
|
LabelField: "label",
|
|
38
|
+
MasterLabel: "master-label",
|
|
38
39
|
Separator: "separator",
|
|
39
40
|
FormHidden: "hidden",
|
|
40
41
|
DocumentForm: "form",
|
|
@@ -75,6 +76,7 @@ const THUMB_GROUP = {
|
|
|
75
76
|
"table": "table",
|
|
76
77
|
"header": "layout",
|
|
77
78
|
"label": "layout",
|
|
79
|
+
"master-label": "layout",
|
|
78
80
|
"separator": "layout",
|
|
79
81
|
"hidden": "advanced",
|
|
80
82
|
"form": "advanced",
|
|
@@ -327,6 +329,20 @@ defineExpose({ search, cards, sections });
|
|
|
327
329
|
Value
|
|
328
330
|
</div>
|
|
329
331
|
</template>
|
|
332
|
+
<template v-else-if="card.thumb === 'master-label'">
|
|
333
|
+
<div class="doc-palette__label-caption">
|
|
334
|
+
Group key
|
|
335
|
+
</div>
|
|
336
|
+
<div class="doc-palette__label-value d-flex align-center">
|
|
337
|
+
<v-icon
|
|
338
|
+
size="14"
|
|
339
|
+
class="mr-1"
|
|
340
|
+
>
|
|
341
|
+
mdi:mdi-database-outline
|
|
342
|
+
</v-icon>
|
|
343
|
+
Name
|
|
344
|
+
</div>
|
|
345
|
+
</template>
|
|
330
346
|
<v-divider
|
|
331
347
|
v-else-if="card.thumb === 'separator'"
|
|
332
348
|
class="doc-palette__separator"
|
|
@@ -7,7 +7,7 @@ interface Props {
|
|
|
7
7
|
grouped?: boolean;
|
|
8
8
|
disabled?: boolean;
|
|
9
9
|
}
|
|
10
|
-
type Thumb = 'text' | 'textarea' | 'date' | 'time' | 'datetime' | 'select' | 'radio' | 'radio-inline' | 'checkbox' | 'checkbox-group' | 'switch' | 'file' | 'images' | 'sign' | 'table' | 'header' | 'label' | 'separator' | 'hidden' | 'form' | 'code' | 'custom';
|
|
10
|
+
type Thumb = 'text' | 'textarea' | 'date' | 'time' | 'datetime' | 'select' | 'radio' | 'radio-inline' | 'checkbox' | 'checkbox-group' | 'switch' | 'file' | 'images' | 'sign' | 'table' | 'header' | 'label' | 'master-label' | 'separator' | 'hidden' | 'form' | 'code' | 'custom';
|
|
11
11
|
interface PaletteCard {
|
|
12
12
|
entry: DocumentTemplateInputType;
|
|
13
13
|
value: string;
|
|
@@ -16,10 +16,12 @@ interface PaletteCard {
|
|
|
16
16
|
thumb: Thumb;
|
|
17
17
|
icon?: string;
|
|
18
18
|
}
|
|
19
|
-
declare
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
declare const __VLS_template: () => {
|
|
20
|
+
__VLS_Slots: {
|
|
21
|
+
title?: (props: {}) => any;
|
|
22
|
+
};
|
|
22
23
|
};
|
|
24
|
+
type __VLS_Slots = ReturnType<typeof __VLS_template>['__VLS_Slots'];
|
|
23
25
|
declare const __VLS_base: import("vue").DefineComponent<Props, {
|
|
24
26
|
search: import("vue").Ref<string, string>;
|
|
25
27
|
cards: import("vue").ComputedRef<PaletteCard[]>;
|
|
@@ -39,10 +41,10 @@ declare const __VLS_base: import("vue").DefineComponent<Props, {
|
|
|
39
41
|
}>, {
|
|
40
42
|
disabled: boolean;
|
|
41
43
|
title: string;
|
|
42
|
-
searchable: boolean;
|
|
43
|
-
types: string[];
|
|
44
44
|
exclude: string[];
|
|
45
45
|
grouped: boolean;
|
|
46
|
+
searchable: boolean;
|
|
47
|
+
types: string[];
|
|
46
48
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
47
49
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
48
50
|
declare const _default: typeof __VLS_export;
|
|
@@ -11,40 +11,42 @@ interface Props extends /* @vue-ignore */ InstanceType<typeof FormPadComponent['
|
|
|
11
11
|
declare function save(): void;
|
|
12
12
|
declare function cancel(): void;
|
|
13
13
|
declare function setOriginalData(originalData?: object): void;
|
|
14
|
-
declare
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
14
|
+
declare const __VLS_template: () => {
|
|
15
|
+
__VLS_Slots: {
|
|
16
|
+
titleToolbar?: (props: {
|
|
17
|
+
operation: {
|
|
18
|
+
isDataChange: boolean;
|
|
19
|
+
isCreating: boolean;
|
|
20
|
+
isSaving: boolean;
|
|
21
|
+
save: typeof save;
|
|
22
|
+
cancel: typeof cancel;
|
|
23
|
+
};
|
|
24
|
+
}) => any;
|
|
25
|
+
} & {
|
|
26
|
+
title?: (props: {
|
|
27
|
+
operation: {
|
|
28
|
+
isDataChange: boolean;
|
|
29
|
+
isCreating: boolean;
|
|
30
|
+
isSaving: boolean;
|
|
31
|
+
save: typeof save;
|
|
32
|
+
cancel: typeof cancel;
|
|
33
|
+
};
|
|
34
|
+
}) => any;
|
|
35
|
+
} & {
|
|
36
|
+
default?: (props: any) => any;
|
|
37
|
+
} & {
|
|
38
|
+
action?: (props: {
|
|
39
|
+
operation: {
|
|
40
|
+
isDataChange: boolean;
|
|
41
|
+
isCreating: boolean;
|
|
42
|
+
isSaving: boolean;
|
|
43
|
+
save: typeof save;
|
|
44
|
+
cancel: typeof cancel;
|
|
45
|
+
};
|
|
46
|
+
}) => any;
|
|
29
47
|
};
|
|
30
|
-
}, __VLS_36: any, __VLS_44: {
|
|
31
|
-
operation: {
|
|
32
|
-
isDataChange: boolean;
|
|
33
|
-
isCreating: boolean;
|
|
34
|
-
isSaving: boolean;
|
|
35
|
-
save: typeof save;
|
|
36
|
-
cancel: typeof cancel;
|
|
37
|
-
};
|
|
38
|
-
};
|
|
39
|
-
type __VLS_Slots = {} & {
|
|
40
|
-
titleToolbar?: (props: typeof __VLS_13) => any;
|
|
41
|
-
} & {
|
|
42
|
-
title?: (props: typeof __VLS_21) => any;
|
|
43
|
-
} & {
|
|
44
|
-
default?: (props: typeof __VLS_36) => any;
|
|
45
|
-
} & {
|
|
46
|
-
action?: (props: typeof __VLS_44) => any;
|
|
47
48
|
};
|
|
49
|
+
type __VLS_Slots = ReturnType<typeof __VLS_template>['__VLS_Slots'];
|
|
48
50
|
declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToOption<Props>, {
|
|
49
51
|
saveCaption: string;
|
|
50
52
|
cancelCaption: string;
|