@ramathibodi/nuxt-commons 4.0.19 → 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/device/IdCardButton.d.vue.ts +2 -2
- package/dist/runtime/components/device/IdCardButton.vue.d.ts +2 -2
- package/dist/runtime/components/dialog/Confirm.d.vue.ts +1 -1
- package/dist/runtime/components/dialog/Confirm.vue.d.ts +1 -1
- package/dist/runtime/components/dialog/ImportResult.d.vue.ts +2 -2
- package/dist/runtime/components/dialog/ImportResult.vue.d.ts +2 -2
- package/dist/runtime/components/dialog/default/Confirm.d.vue.ts +2 -2
- package/dist/runtime/components/dialog/default/Confirm.vue.d.ts +2 -2
- package/dist/runtime/components/dialog/default/Notify.d.vue.ts +3 -3
- package/dist/runtime/components/dialog/default/Notify.vue.d.ts +3 -3
- package/dist/runtime/components/dialog/default/VerifyUser.d.vue.ts +2 -2
- package/dist/runtime/components/dialog/default/VerifyUser.vue.d.ts +2 -2
- 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/DateTime.d.vue.ts +1 -1
- package/dist/runtime/components/form/DateTime.vue.d.ts +1 -1
- package/dist/runtime/components/form/Login.d.vue.ts +1 -1
- package/dist/runtime/components/form/Login.vue.d.ts +1 -1
- package/dist/runtime/components/form/Pad.d.vue.ts +1 -1
- package/dist/runtime/components/form/Pad.vue +1 -1
- package/dist/runtime/components/form/Pad.vue.d.ts +1 -1
- package/dist/runtime/components/form/Time.vue +1 -2
- package/dist/runtime/components/form/images/Capture.d.vue.ts +1 -1
- package/dist/runtime/components/form/images/Capture.vue.d.ts +1 -1
- package/dist/runtime/components/label/Field.d.vue.ts +2 -2
- package/dist/runtime/components/label/Field.vue.d.ts +2 -2
- 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/dist/runtime/labs/Calendar.d.vue.ts +4 -4
- package/dist/runtime/labs/Calendar.vue.d.ts +4 -4
- package/package.json +1 -1
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { DocumentTemplateInputType } from '../../composables/document/templateInputTypes.js';
|
|
2
|
+
interface Props {
|
|
3
|
+
title?: string;
|
|
4
|
+
types?: string[];
|
|
5
|
+
exclude?: string[];
|
|
6
|
+
searchable?: boolean;
|
|
7
|
+
grouped?: boolean;
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
}
|
|
10
|
+
type Thumb = 'text' | 'textarea' | 'date' | 'time' | 'datetime' | 'select' | 'radio' | 'radio-inline' | 'checkbox' | 'checkbox-group' | 'switch' | 'file' | 'images' | 'sign' | 'table' | 'header' | 'separator' | 'hidden' | 'form' | 'code' | 'custom';
|
|
11
|
+
interface PaletteCard {
|
|
12
|
+
entry: DocumentTemplateInputType;
|
|
13
|
+
value: string;
|
|
14
|
+
label: string;
|
|
15
|
+
group: string;
|
|
16
|
+
thumb: Thumb;
|
|
17
|
+
icon?: string;
|
|
18
|
+
}
|
|
19
|
+
declare var __VLS_1: {};
|
|
20
|
+
type __VLS_Slots = {} & {
|
|
21
|
+
title?: (props: typeof __VLS_1) => any;
|
|
22
|
+
};
|
|
23
|
+
declare const __VLS_base: import("vue").DefineComponent<Props, {
|
|
24
|
+
search: import("vue").Ref<string, string>;
|
|
25
|
+
cards: import("vue").ComputedRef<PaletteCard[]>;
|
|
26
|
+
sections: import("vue").ComputedRef<{
|
|
27
|
+
key: string;
|
|
28
|
+
label: string;
|
|
29
|
+
cards: PaletteCard[];
|
|
30
|
+
}[]>;
|
|
31
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
32
|
+
select: (...args: any[]) => void;
|
|
33
|
+
dragend: (...args: any[]) => void;
|
|
34
|
+
dragstart: (...args: any[]) => void;
|
|
35
|
+
}, string, import("vue").PublicProps, Readonly<Props> & Readonly<{
|
|
36
|
+
onSelect?: ((...args: any[]) => any) | undefined;
|
|
37
|
+
onDragend?: ((...args: any[]) => any) | undefined;
|
|
38
|
+
onDragstart?: ((...args: any[]) => any) | undefined;
|
|
39
|
+
}>, {
|
|
40
|
+
disabled: boolean;
|
|
41
|
+
title: string;
|
|
42
|
+
types: string[];
|
|
43
|
+
exclude: string[];
|
|
44
|
+
searchable: boolean;
|
|
45
|
+
grouped: boolean;
|
|
46
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
47
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
48
|
+
declare const _default: typeof __VLS_export;
|
|
49
|
+
export default _default;
|
|
50
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
51
|
+
new (): {
|
|
52
|
+
$slots: S;
|
|
53
|
+
};
|
|
54
|
+
};
|
|
@@ -0,0 +1,362 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { computed, ref } from "vue";
|
|
3
|
+
import { useDocumentTemplateInputTypes } from "../../composables/document/templateInputTypes";
|
|
4
|
+
import { DOCUMENT_TEMPLATE_PALETTE_MIME } from "../../composables/document/templatePalette";
|
|
5
|
+
const props = defineProps({
|
|
6
|
+
title: { type: String, required: false, default: "" },
|
|
7
|
+
types: { type: Array, required: false, default: void 0 },
|
|
8
|
+
exclude: { type: Array, required: false, default: () => [] },
|
|
9
|
+
searchable: { type: Boolean, required: false, default: true },
|
|
10
|
+
grouped: { type: Boolean, required: false, default: true },
|
|
11
|
+
disabled: { type: Boolean, required: false, default: false }
|
|
12
|
+
});
|
|
13
|
+
const emit = defineEmits(["select", "dragstart", "dragend"]);
|
|
14
|
+
const search = ref("");
|
|
15
|
+
const draggingValue = ref(null);
|
|
16
|
+
const THUMBS = {
|
|
17
|
+
VTextField: "text",
|
|
18
|
+
VTextarea: "textarea",
|
|
19
|
+
FormDate: "date",
|
|
20
|
+
FormTime: "time",
|
|
21
|
+
FormDateTime: "datetime",
|
|
22
|
+
VSelect: "select",
|
|
23
|
+
VCombobox: "select",
|
|
24
|
+
VAutocomplete: "select",
|
|
25
|
+
MasterAutocomplete: "select",
|
|
26
|
+
VRadio: "radio",
|
|
27
|
+
VRadioInline: "radio-inline",
|
|
28
|
+
VCheckbox: "checkbox",
|
|
29
|
+
FormCheckboxGroup: "checkbox-group",
|
|
30
|
+
VSwitch: "switch",
|
|
31
|
+
FormFile: "file",
|
|
32
|
+
FormImagesField: "images",
|
|
33
|
+
FormSignPad: "sign",
|
|
34
|
+
FormTable: "table",
|
|
35
|
+
FormTableData: "table",
|
|
36
|
+
Header: "header",
|
|
37
|
+
Separator: "separator",
|
|
38
|
+
FormHidden: "hidden",
|
|
39
|
+
DocumentForm: "form",
|
|
40
|
+
CustomCode: "code"
|
|
41
|
+
};
|
|
42
|
+
const THUMB_ICON = {
|
|
43
|
+
images: "mdi:mdi-image-multiple-outline",
|
|
44
|
+
sign: "mdi:mdi-draw",
|
|
45
|
+
hidden: "mdi:mdi-eye-off-outline",
|
|
46
|
+
form: "mdi:mdi-file-document-outline",
|
|
47
|
+
code: "mdi:mdi-code-tags",
|
|
48
|
+
custom: "mdi:mdi-puzzle-outline"
|
|
49
|
+
};
|
|
50
|
+
const GROUPS = [
|
|
51
|
+
{ key: "text", label: "Text & dates" },
|
|
52
|
+
{ key: "choice", label: "Choices" },
|
|
53
|
+
{ key: "media", label: "Files & signature" },
|
|
54
|
+
{ key: "table", label: "Tables" },
|
|
55
|
+
{ key: "layout", label: "Layout" },
|
|
56
|
+
{ key: "advanced", label: "Advanced" },
|
|
57
|
+
{ key: "custom", label: "Custom" }
|
|
58
|
+
];
|
|
59
|
+
const THUMB_GROUP = {
|
|
60
|
+
"text": "text",
|
|
61
|
+
"textarea": "text",
|
|
62
|
+
"date": "text",
|
|
63
|
+
"time": "text",
|
|
64
|
+
"datetime": "text",
|
|
65
|
+
"select": "choice",
|
|
66
|
+
"radio": "choice",
|
|
67
|
+
"radio-inline": "choice",
|
|
68
|
+
"checkbox": "choice",
|
|
69
|
+
"checkbox-group": "choice",
|
|
70
|
+
"switch": "choice",
|
|
71
|
+
"file": "media",
|
|
72
|
+
"images": "media",
|
|
73
|
+
"sign": "media",
|
|
74
|
+
"table": "table",
|
|
75
|
+
"header": "layout",
|
|
76
|
+
"separator": "layout",
|
|
77
|
+
"hidden": "advanced",
|
|
78
|
+
"form": "advanced",
|
|
79
|
+
"code": "advanced",
|
|
80
|
+
"custom": "custom"
|
|
81
|
+
};
|
|
82
|
+
function toCard(entry) {
|
|
83
|
+
const match = entry.label.match(/^\[([^\]]+)\](.*)$/);
|
|
84
|
+
const thumb = THUMBS[entry.value] ?? "custom";
|
|
85
|
+
return {
|
|
86
|
+
entry,
|
|
87
|
+
value: entry.value,
|
|
88
|
+
label: match ? match[2].trim() : entry.label,
|
|
89
|
+
group: THUMB_GROUP[thumb],
|
|
90
|
+
thumb,
|
|
91
|
+
icon: THUMB_ICON[thumb]
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
const cards = computed(() => {
|
|
95
|
+
const all = useDocumentTemplateInputTypes();
|
|
96
|
+
const picked = props.types ? props.types.map((value) => all.find((t) => t.value === value) ?? { label: value, value }) : all;
|
|
97
|
+
const q = search.value.trim().toLowerCase();
|
|
98
|
+
return picked.filter((t) => !props.exclude.includes(t.value)).map(toCard).filter((c) => !q || c.label.toLowerCase().includes(q) || c.value.toLowerCase().includes(q));
|
|
99
|
+
});
|
|
100
|
+
const sections = computed(() => {
|
|
101
|
+
if (!props.grouped || props.types) return [{ key: "all", label: "", cards: cards.value }];
|
|
102
|
+
return GROUPS.map((g) => ({ ...g, cards: cards.value.filter((c) => c.group === g.key) })).filter((g) => g.cards.length);
|
|
103
|
+
});
|
|
104
|
+
function onDragStart(event, card) {
|
|
105
|
+
if (props.disabled) {
|
|
106
|
+
event.preventDefault();
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
if (event.dataTransfer) {
|
|
110
|
+
event.dataTransfer.effectAllowed = "copy";
|
|
111
|
+
event.dataTransfer.setData(DOCUMENT_TEMPLATE_PALETTE_MIME, card.value);
|
|
112
|
+
event.dataTransfer.setData("text/plain", card.value);
|
|
113
|
+
}
|
|
114
|
+
draggingValue.value = card.value;
|
|
115
|
+
emit("dragstart", card.value);
|
|
116
|
+
}
|
|
117
|
+
function onDragEnd(card) {
|
|
118
|
+
draggingValue.value = null;
|
|
119
|
+
emit("dragend", card.value);
|
|
120
|
+
}
|
|
121
|
+
function onSelect(card) {
|
|
122
|
+
if (props.disabled) return;
|
|
123
|
+
emit("select", card.value);
|
|
124
|
+
}
|
|
125
|
+
defineExpose({ search, cards, sections });
|
|
126
|
+
</script>
|
|
127
|
+
|
|
128
|
+
<template>
|
|
129
|
+
<div
|
|
130
|
+
class="doc-palette"
|
|
131
|
+
:class="{ 'doc-palette--disabled': disabled }"
|
|
132
|
+
>
|
|
133
|
+
<div
|
|
134
|
+
v-if="title || $slots.title || searchable"
|
|
135
|
+
class="doc-palette__head"
|
|
136
|
+
>
|
|
137
|
+
<div
|
|
138
|
+
v-if="title || $slots.title"
|
|
139
|
+
class="doc-palette__title text-overline"
|
|
140
|
+
>
|
|
141
|
+
<slot name="title">
|
|
142
|
+
{{ title }}
|
|
143
|
+
</slot>
|
|
144
|
+
</div>
|
|
145
|
+
<v-text-field
|
|
146
|
+
v-if="searchable"
|
|
147
|
+
v-model="search"
|
|
148
|
+
density="compact"
|
|
149
|
+
variant="solo-filled"
|
|
150
|
+
flat
|
|
151
|
+
rounded="lg"
|
|
152
|
+
hide-details
|
|
153
|
+
clearable
|
|
154
|
+
prepend-inner-icon="mdi:mdi-magnify"
|
|
155
|
+
placeholder="Find a field…"
|
|
156
|
+
class="doc-palette__search"
|
|
157
|
+
/>
|
|
158
|
+
</div>
|
|
159
|
+
|
|
160
|
+
<div class="doc-palette__body">
|
|
161
|
+
<section
|
|
162
|
+
v-for="section in sections"
|
|
163
|
+
:key="section.key"
|
|
164
|
+
class="doc-palette__section"
|
|
165
|
+
:data-group="section.key"
|
|
166
|
+
>
|
|
167
|
+
<div
|
|
168
|
+
v-if="section.label"
|
|
169
|
+
class="doc-palette__section-label text-overline"
|
|
170
|
+
>
|
|
171
|
+
{{ section.label }}
|
|
172
|
+
</div>
|
|
173
|
+
<div class="doc-palette__grid">
|
|
174
|
+
<div
|
|
175
|
+
v-for="card in section.cards"
|
|
176
|
+
:key="card.value"
|
|
177
|
+
class="doc-palette__card"
|
|
178
|
+
:class="{ 'doc-palette__card--dragging': draggingValue === card.value }"
|
|
179
|
+
role="button"
|
|
180
|
+
:tabindex="disabled ? -1 : 0"
|
|
181
|
+
:aria-disabled="disabled || void 0"
|
|
182
|
+
:draggable="!disabled"
|
|
183
|
+
:data-input-type="card.value"
|
|
184
|
+
:data-group="card.group"
|
|
185
|
+
@dragstart="onDragStart($event, card)"
|
|
186
|
+
@dragend="onDragEnd(card)"
|
|
187
|
+
@click="onSelect(card)"
|
|
188
|
+
@keydown.enter.prevent="onSelect(card)"
|
|
189
|
+
@keydown.space.prevent="onSelect(card)"
|
|
190
|
+
>
|
|
191
|
+
<!-- The miniature is decoration only: `inert` keeps it out of the tab order and off the pointer. -->
|
|
192
|
+
<div
|
|
193
|
+
class="doc-palette__thumb"
|
|
194
|
+
:class="`doc-palette__thumb--${card.thumb}`"
|
|
195
|
+
inert
|
|
196
|
+
>
|
|
197
|
+
<v-text-field
|
|
198
|
+
v-if="card.thumb === 'text'"
|
|
199
|
+
label="Text"
|
|
200
|
+
density="compact"
|
|
201
|
+
variant="outlined"
|
|
202
|
+
hide-details
|
|
203
|
+
readonly
|
|
204
|
+
/>
|
|
205
|
+
<v-textarea
|
|
206
|
+
v-else-if="card.thumb === 'textarea'"
|
|
207
|
+
label="Text"
|
|
208
|
+
rows="2"
|
|
209
|
+
no-resize
|
|
210
|
+
density="compact"
|
|
211
|
+
variant="outlined"
|
|
212
|
+
hide-details
|
|
213
|
+
readonly
|
|
214
|
+
/>
|
|
215
|
+
<v-text-field
|
|
216
|
+
v-else-if="card.thumb === 'date'"
|
|
217
|
+
label="Date"
|
|
218
|
+
append-inner-icon="mdi:mdi-calendar"
|
|
219
|
+
density="compact"
|
|
220
|
+
variant="outlined"
|
|
221
|
+
hide-details
|
|
222
|
+
readonly
|
|
223
|
+
/>
|
|
224
|
+
<v-text-field
|
|
225
|
+
v-else-if="card.thumb === 'time'"
|
|
226
|
+
label="Time"
|
|
227
|
+
append-inner-icon="mdi:mdi-clock-outline"
|
|
228
|
+
density="compact"
|
|
229
|
+
variant="outlined"
|
|
230
|
+
hide-details
|
|
231
|
+
readonly
|
|
232
|
+
/>
|
|
233
|
+
<v-text-field
|
|
234
|
+
v-else-if="card.thumb === 'datetime'"
|
|
235
|
+
label="Date & time"
|
|
236
|
+
append-inner-icon="mdi:mdi-calendar-clock"
|
|
237
|
+
density="compact"
|
|
238
|
+
variant="outlined"
|
|
239
|
+
hide-details
|
|
240
|
+
readonly
|
|
241
|
+
/>
|
|
242
|
+
<v-select
|
|
243
|
+
v-else-if="card.thumb === 'select'"
|
|
244
|
+
label="Choose"
|
|
245
|
+
:items="[]"
|
|
246
|
+
density="compact"
|
|
247
|
+
variant="outlined"
|
|
248
|
+
hide-details
|
|
249
|
+
readonly
|
|
250
|
+
/>
|
|
251
|
+
<v-radio-group
|
|
252
|
+
v-else-if="card.thumb === 'radio' || card.thumb === 'radio-inline'"
|
|
253
|
+
:inline="card.thumb === 'radio-inline'"
|
|
254
|
+
model-value="a"
|
|
255
|
+
density="compact"
|
|
256
|
+
hide-details
|
|
257
|
+
>
|
|
258
|
+
<v-radio
|
|
259
|
+
label="A"
|
|
260
|
+
value="a"
|
|
261
|
+
/>
|
|
262
|
+
<v-radio
|
|
263
|
+
label="B"
|
|
264
|
+
value="b"
|
|
265
|
+
/>
|
|
266
|
+
</v-radio-group>
|
|
267
|
+
<v-checkbox
|
|
268
|
+
v-else-if="card.thumb === 'checkbox'"
|
|
269
|
+
label="Yes"
|
|
270
|
+
:model-value="true"
|
|
271
|
+
density="compact"
|
|
272
|
+
hide-details
|
|
273
|
+
/>
|
|
274
|
+
<template v-else-if="card.thumb === 'checkbox-group'">
|
|
275
|
+
<v-checkbox
|
|
276
|
+
label="A"
|
|
277
|
+
:model-value="true"
|
|
278
|
+
density="compact"
|
|
279
|
+
hide-details
|
|
280
|
+
/>
|
|
281
|
+
<v-checkbox
|
|
282
|
+
label="B"
|
|
283
|
+
:model-value="false"
|
|
284
|
+
density="compact"
|
|
285
|
+
hide-details
|
|
286
|
+
/>
|
|
287
|
+
</template>
|
|
288
|
+
<v-switch
|
|
289
|
+
v-else-if="card.thumb === 'switch'"
|
|
290
|
+
label="On"
|
|
291
|
+
:model-value="true"
|
|
292
|
+
color="primary"
|
|
293
|
+
density="compact"
|
|
294
|
+
hide-details
|
|
295
|
+
/>
|
|
296
|
+
<v-file-input
|
|
297
|
+
v-else-if="card.thumb === 'file'"
|
|
298
|
+
label="File"
|
|
299
|
+
density="compact"
|
|
300
|
+
variant="outlined"
|
|
301
|
+
hide-details
|
|
302
|
+
/>
|
|
303
|
+
<v-table
|
|
304
|
+
v-else-if="card.thumb === 'table'"
|
|
305
|
+
density="compact"
|
|
306
|
+
class="doc-palette__table"
|
|
307
|
+
>
|
|
308
|
+
<thead><tr><th>A</th><th>B</th></tr></thead>
|
|
309
|
+
<tbody>
|
|
310
|
+
<tr><td>…</td><td>…</td></tr>
|
|
311
|
+
<tr><td>…</td><td>…</td></tr>
|
|
312
|
+
</tbody>
|
|
313
|
+
</v-table>
|
|
314
|
+
<template v-else-if="card.thumb === 'header'">
|
|
315
|
+
<div class="text-subtitle-2 font-weight-bold">
|
|
316
|
+
Heading
|
|
317
|
+
</div>
|
|
318
|
+
<v-divider class="mt-1" />
|
|
319
|
+
</template>
|
|
320
|
+
<v-divider
|
|
321
|
+
v-else-if="card.thumb === 'separator'"
|
|
322
|
+
class="doc-palette__separator"
|
|
323
|
+
/>
|
|
324
|
+
<div
|
|
325
|
+
v-else
|
|
326
|
+
class="doc-palette__icon"
|
|
327
|
+
>
|
|
328
|
+
<v-icon size="24">
|
|
329
|
+
{{ card.icon }}
|
|
330
|
+
</v-icon>
|
|
331
|
+
</div>
|
|
332
|
+
</div>
|
|
333
|
+
<div class="doc-palette__foot">
|
|
334
|
+
<span class="doc-palette__name">{{ card.label }}</span>
|
|
335
|
+
<v-btn
|
|
336
|
+
class="doc-palette__add"
|
|
337
|
+
icon="mdi:mdi-plus"
|
|
338
|
+
size="x-small"
|
|
339
|
+
variant="tonal"
|
|
340
|
+
color="primary"
|
|
341
|
+
density="comfortable"
|
|
342
|
+
:aria-label="`Add ${card.label}`"
|
|
343
|
+
:disabled="disabled"
|
|
344
|
+
@click.stop="onSelect(card)"
|
|
345
|
+
/>
|
|
346
|
+
</div>
|
|
347
|
+
</div>
|
|
348
|
+
</div>
|
|
349
|
+
</section>
|
|
350
|
+
<div
|
|
351
|
+
v-if="!cards.length"
|
|
352
|
+
class="doc-palette__empty text-caption text-medium-emphasis"
|
|
353
|
+
>
|
|
354
|
+
No input types match.
|
|
355
|
+
</div>
|
|
356
|
+
</div>
|
|
357
|
+
</div>
|
|
358
|
+
</template>
|
|
359
|
+
|
|
360
|
+
<style scoped>
|
|
361
|
+
.doc-palette{--doc-palette-radius:10px;display:flex;flex-direction:column;min-height:0}.doc-palette__head{background:rgb(var(--v-theme-surface));border-bottom:thin solid rgba(var(--v-border-color),var(--v-border-opacity));padding:10px 10px 8px;position:sticky;top:0;z-index:1}.doc-palette__title{color:rgba(var(--v-theme-on-surface),var(--v-medium-emphasis-opacity));letter-spacing:.12em;line-height:1.6;margin-bottom:4px}.doc-palette__search :deep(.v-field__input){font-size:.8125rem;min-height:34px}.doc-palette__body{max-height:70vh;overflow-y:auto;padding:8px 8px 12px}.doc-palette__section+.doc-palette__section{margin-top:12px}.doc-palette__section-label{color:rgba(var(--v-theme-on-surface),var(--v-medium-emphasis-opacity));font-size:.625rem;letter-spacing:.14em;line-height:1.6;padding:0 2px 6px}.doc-palette__grid{display:grid;gap:8px;grid-template-columns:repeat(auto-fill,minmax(96px,1fr))}.doc-palette__card{background:rgb(var(--v-theme-surface));border:thin solid rgba(var(--v-border-color),var(--v-border-opacity));border-radius:var(--doc-palette-radius);cursor:grab;display:flex;flex-direction:column;outline:none;position:relative;transition:border-color .14s ease,box-shadow .14s ease,transform .14s ease,opacity .14s ease;-webkit-user-select:none;-moz-user-select:none;user-select:none}.doc-palette__card:focus-visible,.doc-palette__card:hover{border-color:rgba(var(--v-theme-primary),.7);box-shadow:0 2px 10px rgba(var(--v-theme-on-surface),.08);transform:translateY(-1px)}.doc-palette__card:focus-visible{box-shadow:0 0 0 2px rgba(var(--v-theme-primary),.35)}.doc-palette__card:active{cursor:grabbing;transform:translateY(0)}.doc-palette__card--dragging{opacity:.45}.doc-palette__thumb{background:linear-gradient(rgba(var(--v-theme-on-surface),.035),rgba(var(--v-theme-on-surface),.035)),rgb(var(--v-theme-surface));border-radius:var(--doc-palette-radius) var(--doc-palette-radius) 0 0;display:flex;flex-direction:column;height:56px;justify-content:center;overflow:hidden;padding:4px 8px 0;pointer-events:none}.doc-palette__thumb :deep(.v-input){font-size:.75rem}.doc-palette__thumb :deep(.v-field){--v-field-padding-start:8px;--v-field-padding-end:6px}.doc-palette__thumb :deep(.v-field__input){min-height:32px;padding-bottom:0;padding-top:0}.doc-palette__thumb :deep(.v-label){font-size:.75rem}.doc-palette__thumb :deep(.v-selection-control){--v-selection-control-size:22px;min-height:0}.doc-palette__thumb :deep(.v-selection-control-group){-moz-column-gap:8px;column-gap:8px;row-gap:0}.doc-palette__thumb :deep(.v-selection-control .v-label){font-size:.7rem}.doc-palette__thumb :deep(.v-input__control){min-height:0}.doc-palette__thumb--textarea :deep(.v-field__input){min-height:40px}.doc-palette__thumb--checkbox-group,.doc-palette__thumb--radio,.doc-palette__thumb--table{justify-content:flex-start}.doc-palette__table{background:transparent;font-size:.65rem}.doc-palette__table :deep(td),.doc-palette__table :deep(th){height:16px!important;line-height:16px;padding:0 6px!important}.doc-palette__separator{border-style:dashed}.doc-palette__icon{align-items:center;color:rgba(var(--v-theme-on-surface),var(--v-medium-emphasis-opacity));display:flex;height:100%;justify-content:center}.doc-palette__foot{align-items:center;border-top:thin solid rgba(var(--v-border-color),var(--v-border-opacity));display:flex;gap:4px;min-height:30px;padding:2px 4px 2px 8px}.doc-palette__name{display:-webkit-box;flex:1 1 auto;font-size:.75rem;line-height:1.2;min-width:0;-webkit-box-orient:vertical;-webkit-line-clamp:2;overflow:hidden;overflow-wrap:anywhere}.doc-palette__add{flex:0 0 auto;opacity:0;transition:opacity .14s ease}.doc-palette__card:focus-within .doc-palette__add,.doc-palette__card:hover .doc-palette__add{opacity:1}@media (hover:none){.doc-palette__add{opacity:1}}.doc-palette--disabled .doc-palette__card{border-color:rgba(var(--v-border-color),var(--v-border-opacity));box-shadow:none;cursor:default;opacity:.55;transform:none}.doc-palette--disabled .doc-palette__add{display:none}.doc-palette__empty{padding:8px 2px}
|
|
362
|
+
</style>
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { DocumentTemplateInputType } from '../../composables/document/templateInputTypes.js';
|
|
2
|
+
interface Props {
|
|
3
|
+
title?: string;
|
|
4
|
+
types?: string[];
|
|
5
|
+
exclude?: string[];
|
|
6
|
+
searchable?: boolean;
|
|
7
|
+
grouped?: boolean;
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
}
|
|
10
|
+
type Thumb = 'text' | 'textarea' | 'date' | 'time' | 'datetime' | 'select' | 'radio' | 'radio-inline' | 'checkbox' | 'checkbox-group' | 'switch' | 'file' | 'images' | 'sign' | 'table' | 'header' | 'separator' | 'hidden' | 'form' | 'code' | 'custom';
|
|
11
|
+
interface PaletteCard {
|
|
12
|
+
entry: DocumentTemplateInputType;
|
|
13
|
+
value: string;
|
|
14
|
+
label: string;
|
|
15
|
+
group: string;
|
|
16
|
+
thumb: Thumb;
|
|
17
|
+
icon?: string;
|
|
18
|
+
}
|
|
19
|
+
declare var __VLS_1: {};
|
|
20
|
+
type __VLS_Slots = {} & {
|
|
21
|
+
title?: (props: typeof __VLS_1) => any;
|
|
22
|
+
};
|
|
23
|
+
declare const __VLS_base: import("vue").DefineComponent<Props, {
|
|
24
|
+
search: import("vue").Ref<string, string>;
|
|
25
|
+
cards: import("vue").ComputedRef<PaletteCard[]>;
|
|
26
|
+
sections: import("vue").ComputedRef<{
|
|
27
|
+
key: string;
|
|
28
|
+
label: string;
|
|
29
|
+
cards: PaletteCard[];
|
|
30
|
+
}[]>;
|
|
31
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
32
|
+
select: (...args: any[]) => void;
|
|
33
|
+
dragend: (...args: any[]) => void;
|
|
34
|
+
dragstart: (...args: any[]) => void;
|
|
35
|
+
}, string, import("vue").PublicProps, Readonly<Props> & Readonly<{
|
|
36
|
+
onSelect?: ((...args: any[]) => any) | undefined;
|
|
37
|
+
onDragend?: ((...args: any[]) => any) | undefined;
|
|
38
|
+
onDragstart?: ((...args: any[]) => any) | undefined;
|
|
39
|
+
}>, {
|
|
40
|
+
disabled: boolean;
|
|
41
|
+
title: string;
|
|
42
|
+
types: string[];
|
|
43
|
+
exclude: string[];
|
|
44
|
+
searchable: boolean;
|
|
45
|
+
grouped: boolean;
|
|
46
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
47
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
48
|
+
declare const _default: typeof __VLS_export;
|
|
49
|
+
export default _default;
|
|
50
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
51
|
+
new (): {
|
|
52
|
+
$slots: S;
|
|
53
|
+
};
|
|
54
|
+
};
|
|
@@ -22,9 +22,9 @@ declare const __VLS_export: import("vue").DefineComponent<Props, {}, {}, {}, {},
|
|
|
22
22
|
}, string, import("vue").PublicProps, Readonly<Props> & Readonly<{
|
|
23
23
|
"onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
|
|
24
24
|
}>, {
|
|
25
|
+
readonly: boolean;
|
|
25
26
|
locale: "TH" | "EN";
|
|
26
27
|
format: dateFormat | string;
|
|
27
|
-
readonly: boolean;
|
|
28
28
|
dense: boolean;
|
|
29
29
|
pickerOnly: boolean;
|
|
30
30
|
defaultDate: boolean | string;
|
|
@@ -22,9 +22,9 @@ declare const __VLS_export: import("vue").DefineComponent<Props, {}, {}, {}, {},
|
|
|
22
22
|
}, string, import("vue").PublicProps, Readonly<Props> & Readonly<{
|
|
23
23
|
"onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
|
|
24
24
|
}>, {
|
|
25
|
+
readonly: boolean;
|
|
25
26
|
locale: "TH" | "EN";
|
|
26
27
|
format: dateFormat | string;
|
|
27
|
-
readonly: boolean;
|
|
28
28
|
dense: boolean;
|
|
29
29
|
pickerOnly: boolean;
|
|
30
30
|
defaultDate: boolean | string;
|
|
@@ -15,8 +15,8 @@ declare const __VLS_base: import("vue").DefineComponent<Props, {}, {}, {}, {}, i
|
|
|
15
15
|
}, string, import("vue").PublicProps, Readonly<Props> & Readonly<{
|
|
16
16
|
"onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
|
|
17
17
|
}>, {
|
|
18
|
-
title: string;
|
|
19
18
|
loading: boolean;
|
|
19
|
+
title: string;
|
|
20
20
|
errorMessages: string;
|
|
21
21
|
hint: string;
|
|
22
22
|
btnSubmit: string;
|
|
@@ -15,8 +15,8 @@ declare const __VLS_base: import("vue").DefineComponent<Props, {}, {}, {}, {}, i
|
|
|
15
15
|
}, string, import("vue").PublicProps, Readonly<Props> & Readonly<{
|
|
16
16
|
"onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
|
|
17
17
|
}>, {
|
|
18
|
-
title: string;
|
|
19
18
|
loading: boolean;
|
|
19
|
+
title: string;
|
|
20
20
|
errorMessages: string;
|
|
21
21
|
hint: string;
|
|
22
22
|
btnSubmit: string;
|
|
@@ -681,9 +681,9 @@ declare const __VLS_base: import("vue").DefineComponent<Props, {
|
|
|
681
681
|
}>, {
|
|
682
682
|
disabled: boolean;
|
|
683
683
|
readonly: boolean;
|
|
684
|
+
parentTemplates: string | string[];
|
|
684
685
|
isolated: boolean;
|
|
685
686
|
decoration: object;
|
|
686
|
-
parentTemplates: string | string[];
|
|
687
687
|
dirtyClass: string;
|
|
688
688
|
dirtyOnCreate: boolean;
|
|
689
689
|
sanitizeDelay: number;
|
|
@@ -313,5 +313,5 @@ defineExpose({
|
|
|
313
313
|
</template>
|
|
314
314
|
|
|
315
315
|
<style>
|
|
316
|
-
.form-data-dirty:not(.v-input--error) :not(.v-chip):not(.v-chip *):not(.v-toolbar):not(.v-toolbar *):not(.dp__main):not(.dp__main *){color:color-mix(in srgb,currentColor 70%,rgb(var(--v-theme-primary)))!important;text-shadow:0 0 .02em currentColor}
|
|
316
|
+
.form-data-dirty:not(.v-input--error) :not(.v-chip):not(.v-chip *):not(.v-toolbar):not(.v-toolbar *):not(.dp__main):not(.dp__main *){color:color-mix(in srgb,currentColor 70%,rgb(var(--v-theme-primary)))!important;text-shadow:0 0 .02em currentColor}.v-radio>.v-label:has(>.form-radio-text-field){flex:1 1 auto}
|
|
317
317
|
</style>
|
|
@@ -681,9 +681,9 @@ declare const __VLS_base: import("vue").DefineComponent<Props, {
|
|
|
681
681
|
}>, {
|
|
682
682
|
disabled: boolean;
|
|
683
683
|
readonly: boolean;
|
|
684
|
+
parentTemplates: string | string[];
|
|
684
685
|
isolated: boolean;
|
|
685
686
|
decoration: object;
|
|
686
|
-
parentTemplates: string | string[];
|
|
687
687
|
dirtyClass: string;
|
|
688
688
|
dirtyOnCreate: boolean;
|
|
689
689
|
sanitizeDelay: number;
|
|
@@ -73,13 +73,12 @@ watchEffect(() => {
|
|
|
73
73
|
}
|
|
74
74
|
});
|
|
75
75
|
watch(time, (newValue) => {
|
|
76
|
-
|
|
76
|
+
emit("update:modelValue", newValue);
|
|
77
77
|
});
|
|
78
78
|
watch(isMenuOpen, () => {
|
|
79
79
|
if (isMenuOpen.value && !time.value) {
|
|
80
80
|
time.value = Datetime().now().toFormat(props.enableSeconds ? "HH:mm:ss" : "HH:mm:00");
|
|
81
81
|
}
|
|
82
|
-
if (!isMenuOpen.value) emit("update:modelValue", time.value);
|
|
83
82
|
});
|
|
84
83
|
watch(() => props.modelValue, () => {
|
|
85
84
|
setTime(props.modelValue || null);
|
|
@@ -78,10 +78,10 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {
|
|
|
78
78
|
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
79
79
|
"onUpdate:modelValue"?: ((value: string | undefined) => any) | undefined;
|
|
80
80
|
}>, {
|
|
81
|
-
buttonText: string;
|
|
82
81
|
disabled: boolean;
|
|
83
82
|
maxWidth: string | number;
|
|
84
83
|
readonly: boolean;
|
|
84
|
+
buttonText: string;
|
|
85
85
|
imageFormat: ImageFormat;
|
|
86
86
|
autoStart: boolean;
|
|
87
87
|
fileOnly: boolean;
|
|
@@ -78,10 +78,10 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {
|
|
|
78
78
|
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
79
79
|
"onUpdate:modelValue"?: ((value: string | undefined) => any) | undefined;
|
|
80
80
|
}>, {
|
|
81
|
-
buttonText: string;
|
|
82
81
|
disabled: boolean;
|
|
83
82
|
maxWidth: string | number;
|
|
84
83
|
readonly: boolean;
|
|
84
|
+
buttonText: string;
|
|
85
85
|
imageFormat: ImageFormat;
|
|
86
86
|
autoStart: boolean;
|
|
87
87
|
fileOnly: boolean;
|
|
@@ -22,11 +22,11 @@ type __VLS_Slots = {} & {
|
|
|
22
22
|
};
|
|
23
23
|
declare const __VLS_base: import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<Props> & Readonly<{}>, {
|
|
24
24
|
value: string | null;
|
|
25
|
-
label: string;
|
|
26
25
|
size: "large" | "medium";
|
|
26
|
+
label: string;
|
|
27
27
|
horizontal: boolean;
|
|
28
|
-
notFoundText: string;
|
|
29
28
|
truncate: boolean;
|
|
29
|
+
notFoundText: string;
|
|
30
30
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
31
31
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
32
32
|
declare const _default: typeof __VLS_export;
|
|
@@ -22,11 +22,11 @@ type __VLS_Slots = {} & {
|
|
|
22
22
|
};
|
|
23
23
|
declare const __VLS_base: import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<Props> & Readonly<{}>, {
|
|
24
24
|
value: string | null;
|
|
25
|
-
label: string;
|
|
26
25
|
size: "large" | "medium";
|
|
26
|
+
label: string;
|
|
27
27
|
horizontal: boolean;
|
|
28
|
-
notFoundText: string;
|
|
29
28
|
truncate: boolean;
|
|
29
|
+
notFoundText: string;
|
|
30
30
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
31
31
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
32
32
|
declare const _default: typeof __VLS_export;
|