directus-extension-texttoanything 0.2.0 → 0.2.2
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/api.js +2 -21344
- package/dist/app.js +1 -983
- package/package.json +2 -2
- package/readme.md +5 -3
package/dist/app.js
CHANGED
|
@@ -1,983 +1 @@
|
|
|
1
|
-
import { defineOperationApp, useApi, useStores, defineModule, defineInterface } from '@directus/extensions-sdk';
|
|
2
|
-
import { resolveComponent, openBlock, createBlock, withCtx, createVNode, createCommentVNode, defineComponent, ref, computed, onMounted, watch, createTextVNode, unref, createElementBlock, createElementVNode, toDisplayString, resolveDynamicComponent, normalizeStyle, Fragment, pushScopeId, popScopeId, inject } from 'vue';
|
|
3
|
-
|
|
4
|
-
const types = [
|
|
5
|
-
"auspost",
|
|
6
|
-
"azteccode",
|
|
7
|
-
"azteccodecompact",
|
|
8
|
-
"aztecrune",
|
|
9
|
-
"bc412",
|
|
10
|
-
"channelcode",
|
|
11
|
-
"codablockf",
|
|
12
|
-
"code11",
|
|
13
|
-
"code128",
|
|
14
|
-
"code16k",
|
|
15
|
-
"code2of5",
|
|
16
|
-
"code32",
|
|
17
|
-
"code39",
|
|
18
|
-
"code39ext",
|
|
19
|
-
"code49",
|
|
20
|
-
"code93",
|
|
21
|
-
"code93ext",
|
|
22
|
-
"codeone",
|
|
23
|
-
"coop2of5",
|
|
24
|
-
"daft",
|
|
25
|
-
"databarexpanded",
|
|
26
|
-
"databarexpandedcomposite",
|
|
27
|
-
"databarexpandedstacked",
|
|
28
|
-
"databarexpandedstackedcomposite",
|
|
29
|
-
"databarlimited",
|
|
30
|
-
"databarlimitedcomposite",
|
|
31
|
-
"databaromni",
|
|
32
|
-
"databaromnicomposite",
|
|
33
|
-
"databarstacked",
|
|
34
|
-
"databarstackedcomposite",
|
|
35
|
-
"databarstackedomni",
|
|
36
|
-
"databarstackedomnicomposite",
|
|
37
|
-
"databartruncated",
|
|
38
|
-
"databartruncatedcomposite",
|
|
39
|
-
"datalogic2of5",
|
|
40
|
-
"datamatrix",
|
|
41
|
-
"datamatrixrectangular",
|
|
42
|
-
"datamatrixrectangularextension",
|
|
43
|
-
"dotcode",
|
|
44
|
-
"ean13",
|
|
45
|
-
"ean13composite",
|
|
46
|
-
"ean14",
|
|
47
|
-
"ean2",
|
|
48
|
-
"ean5",
|
|
49
|
-
"ean8",
|
|
50
|
-
"ean8composite",
|
|
51
|
-
"flattermarken",
|
|
52
|
-
"gs1-128",
|
|
53
|
-
"gs1-128composite",
|
|
54
|
-
"gs1-cc",
|
|
55
|
-
"gs1datamatrix",
|
|
56
|
-
"gs1datamatrixrectangular",
|
|
57
|
-
"gs1dldatamatrix",
|
|
58
|
-
"gs1dlqrcode",
|
|
59
|
-
"gs1dotcode",
|
|
60
|
-
"gs1northamericancoupon",
|
|
61
|
-
"gs1qrcode",
|
|
62
|
-
"hanxin",
|
|
63
|
-
"hibcazteccode",
|
|
64
|
-
"hibccodablockf",
|
|
65
|
-
"hibccode128",
|
|
66
|
-
"hibccode39",
|
|
67
|
-
"hibcdatamatrix",
|
|
68
|
-
"hibcdatamatrixrectangular",
|
|
69
|
-
"hibcmicropdf417",
|
|
70
|
-
"hibcpdf417",
|
|
71
|
-
"hibcqrcode",
|
|
72
|
-
"iata2of5",
|
|
73
|
-
"identcode",
|
|
74
|
-
"industrial2of5",
|
|
75
|
-
"interleaved2of5",
|
|
76
|
-
"isbn",
|
|
77
|
-
"ismn",
|
|
78
|
-
"issn",
|
|
79
|
-
"itf14",
|
|
80
|
-
"japanpost",
|
|
81
|
-
"kix",
|
|
82
|
-
"leitcode",
|
|
83
|
-
"mailmark",
|
|
84
|
-
"mands",
|
|
85
|
-
"matrix2of5",
|
|
86
|
-
"maxicode",
|
|
87
|
-
"micropdf417",
|
|
88
|
-
"microqrcode",
|
|
89
|
-
"msi",
|
|
90
|
-
"onecode",
|
|
91
|
-
"pdf417",
|
|
92
|
-
"pdf417compact",
|
|
93
|
-
"pharmacode",
|
|
94
|
-
"pharmacode2",
|
|
95
|
-
"planet",
|
|
96
|
-
"plessey",
|
|
97
|
-
"posicode",
|
|
98
|
-
"postnet",
|
|
99
|
-
"pzn",
|
|
100
|
-
"qrcode",
|
|
101
|
-
"rationalizedCodabar",
|
|
102
|
-
"raw",
|
|
103
|
-
"rectangularmicroqrcode",
|
|
104
|
-
"royalmail",
|
|
105
|
-
"sscc18",
|
|
106
|
-
"swissqrcode",
|
|
107
|
-
"symbol",
|
|
108
|
-
"telepen",
|
|
109
|
-
"telepennumeric",
|
|
110
|
-
"ultracode",
|
|
111
|
-
"upca",
|
|
112
|
-
"upcacomposite",
|
|
113
|
-
"upce",
|
|
114
|
-
"upcecomposite"
|
|
115
|
-
];
|
|
116
|
-
var e0 = defineOperationApp({
|
|
117
|
-
id: "ttabarcode",
|
|
118
|
-
name: "TTA generate barcode",
|
|
119
|
-
icon: "box",
|
|
120
|
-
description: "Generate a barcode trough Text to anything!",
|
|
121
|
-
overview: ({ barcodeContent }) => [
|
|
122
|
-
{
|
|
123
|
-
label: "barcode content",
|
|
124
|
-
text: barcodeContent
|
|
125
|
-
}
|
|
126
|
-
],
|
|
127
|
-
options: [
|
|
128
|
-
{
|
|
129
|
-
field: "barcodeContent",
|
|
130
|
-
name: "content",
|
|
131
|
-
type: "string",
|
|
132
|
-
meta: {
|
|
133
|
-
width: "full",
|
|
134
|
-
interface: "input"
|
|
135
|
-
}
|
|
136
|
-
},
|
|
137
|
-
{
|
|
138
|
-
field: "barcodeType",
|
|
139
|
-
name: "type",
|
|
140
|
-
type: "dropdown",
|
|
141
|
-
meta: {
|
|
142
|
-
interface: "select-dropdown",
|
|
143
|
-
options: {
|
|
144
|
-
choices: types.map((e) => ({ text: e, value: e }))
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
},
|
|
148
|
-
{
|
|
149
|
-
field: "scale",
|
|
150
|
-
name: "scale",
|
|
151
|
-
type: "number",
|
|
152
|
-
meta: {
|
|
153
|
-
width: "full",
|
|
154
|
-
interface: "input"
|
|
155
|
-
}
|
|
156
|
-
},
|
|
157
|
-
{
|
|
158
|
-
field: "height",
|
|
159
|
-
name: "height",
|
|
160
|
-
type: "number",
|
|
161
|
-
meta: {
|
|
162
|
-
width: "full",
|
|
163
|
-
interface: "input"
|
|
164
|
-
}
|
|
165
|
-
},
|
|
166
|
-
{
|
|
167
|
-
field: "includetext",
|
|
168
|
-
name: "include text",
|
|
169
|
-
type: "boolean",
|
|
170
|
-
meta: {
|
|
171
|
-
width: "full",
|
|
172
|
-
interface: "boolean"
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
]
|
|
176
|
-
});
|
|
177
|
-
|
|
178
|
-
var e1 = defineOperationApp({
|
|
179
|
-
id: "ttapdf",
|
|
180
|
-
name: "TTA generate PDF",
|
|
181
|
-
icon: "box",
|
|
182
|
-
description: "Generate a PDF trough Text to anything!",
|
|
183
|
-
overview: ({ filename }) => [
|
|
184
|
-
{
|
|
185
|
-
label: "File name",
|
|
186
|
-
text: filename
|
|
187
|
-
}
|
|
188
|
-
],
|
|
189
|
-
options: [
|
|
190
|
-
{
|
|
191
|
-
field: "filename",
|
|
192
|
-
name: "File name",
|
|
193
|
-
type: "string",
|
|
194
|
-
meta: {
|
|
195
|
-
width: "full",
|
|
196
|
-
interface: "input"
|
|
197
|
-
}
|
|
198
|
-
},
|
|
199
|
-
{
|
|
200
|
-
field: "pdfoptions",
|
|
201
|
-
name: "Options",
|
|
202
|
-
type: "json",
|
|
203
|
-
meta: {
|
|
204
|
-
width: "full",
|
|
205
|
-
interface: "input-code",
|
|
206
|
-
options: {
|
|
207
|
-
language: "json",
|
|
208
|
-
placeholder: JSON.stringify(
|
|
209
|
-
{
|
|
210
|
-
html: "<h1>Hello world!</h1>",
|
|
211
|
-
format: "A4",
|
|
212
|
-
landscape: false,
|
|
213
|
-
margin: 10,
|
|
214
|
-
marginRight: 5,
|
|
215
|
-
marginLeft: 5
|
|
216
|
-
},
|
|
217
|
-
null,
|
|
218
|
-
2
|
|
219
|
-
),
|
|
220
|
-
template: JSON.stringify(
|
|
221
|
-
{
|
|
222
|
-
html: "<h1>Hello world!</h1>",
|
|
223
|
-
format: "A4",
|
|
224
|
-
landscape: false,
|
|
225
|
-
margin: 10,
|
|
226
|
-
marginRight: 5,
|
|
227
|
-
marginLeft: 5
|
|
228
|
-
},
|
|
229
|
-
null,
|
|
230
|
-
2
|
|
231
|
-
)
|
|
232
|
-
}
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
]
|
|
236
|
-
});
|
|
237
|
-
|
|
238
|
-
var e2 = defineOperationApp({
|
|
239
|
-
id: "ttapdftemplate",
|
|
240
|
-
name: "TTA generate PDF from template",
|
|
241
|
-
icon: "box",
|
|
242
|
-
description: "Generate a PDF based on a template trough Text to anything!",
|
|
243
|
-
overview: ({ filename }) => [
|
|
244
|
-
{
|
|
245
|
-
label: "File name",
|
|
246
|
-
text: filename
|
|
247
|
-
}
|
|
248
|
-
],
|
|
249
|
-
options: [
|
|
250
|
-
{
|
|
251
|
-
field: "filename",
|
|
252
|
-
name: "File name",
|
|
253
|
-
type: "string",
|
|
254
|
-
meta: {
|
|
255
|
-
width: "full",
|
|
256
|
-
interface: "input"
|
|
257
|
-
}
|
|
258
|
-
},
|
|
259
|
-
{
|
|
260
|
-
field: "template",
|
|
261
|
-
name: "Template",
|
|
262
|
-
type: "string",
|
|
263
|
-
meta: {
|
|
264
|
-
interface: "TTA-pdf-template-selector",
|
|
265
|
-
options: {}
|
|
266
|
-
}
|
|
267
|
-
},
|
|
268
|
-
{
|
|
269
|
-
field: "templatevariables",
|
|
270
|
-
name: "Template variables",
|
|
271
|
-
type: "json",
|
|
272
|
-
meta: {
|
|
273
|
-
width: "full",
|
|
274
|
-
interface: "input-code",
|
|
275
|
-
options: {
|
|
276
|
-
language: "json"
|
|
277
|
-
}
|
|
278
|
-
}
|
|
279
|
-
}
|
|
280
|
-
]
|
|
281
|
-
});
|
|
282
|
-
|
|
283
|
-
var e3 = defineOperationApp({
|
|
284
|
-
id: "ttaqrcode",
|
|
285
|
-
name: "TTA generate QRcode",
|
|
286
|
-
icon: "box",
|
|
287
|
-
description: "Generate a QRcode trough Text to anything!",
|
|
288
|
-
overview: ({ qrcodeContent }) => [
|
|
289
|
-
{
|
|
290
|
-
label: "QRCode content",
|
|
291
|
-
text: qrcodeContent
|
|
292
|
-
}
|
|
293
|
-
],
|
|
294
|
-
options: [
|
|
295
|
-
{
|
|
296
|
-
field: "qrcodeContent",
|
|
297
|
-
name: "QRCode content",
|
|
298
|
-
type: "string",
|
|
299
|
-
meta: {
|
|
300
|
-
width: "full",
|
|
301
|
-
interface: "input"
|
|
302
|
-
}
|
|
303
|
-
},
|
|
304
|
-
{
|
|
305
|
-
field: "lightColor",
|
|
306
|
-
name: "Light color",
|
|
307
|
-
type: "string",
|
|
308
|
-
meta: {
|
|
309
|
-
width: "full",
|
|
310
|
-
interface: "input"
|
|
311
|
-
}
|
|
312
|
-
},
|
|
313
|
-
{
|
|
314
|
-
field: "darkColor",
|
|
315
|
-
name: "Dark color",
|
|
316
|
-
type: "string",
|
|
317
|
-
meta: {
|
|
318
|
-
width: "full",
|
|
319
|
-
interface: "input"
|
|
320
|
-
}
|
|
321
|
-
},
|
|
322
|
-
{
|
|
323
|
-
field: "margin",
|
|
324
|
-
name: "Margin",
|
|
325
|
-
type: "integer",
|
|
326
|
-
meta: {
|
|
327
|
-
width: "half",
|
|
328
|
-
interface: "input"
|
|
329
|
-
}
|
|
330
|
-
},
|
|
331
|
-
{
|
|
332
|
-
field: "width",
|
|
333
|
-
name: "Width",
|
|
334
|
-
type: "integer",
|
|
335
|
-
meta: {
|
|
336
|
-
width: "half",
|
|
337
|
-
interface: "input"
|
|
338
|
-
}
|
|
339
|
-
}
|
|
340
|
-
]
|
|
341
|
-
});
|
|
342
|
-
|
|
343
|
-
function render(_ctx, _cache) {
|
|
344
|
-
const _component_v_icon = resolveComponent("v-icon");
|
|
345
|
-
const _component_v_list_item_icon = resolveComponent("v-list-item-icon");
|
|
346
|
-
const _component_v_text_overflow = resolveComponent("v-text-overflow");
|
|
347
|
-
const _component_v_list_item_content = resolveComponent("v-list-item-content");
|
|
348
|
-
const _component_v_list_item = resolveComponent("v-list-item");
|
|
349
|
-
const _component_v_list = resolveComponent("v-list");
|
|
350
|
-
|
|
351
|
-
return (openBlock(), createBlock(_component_v_list, { nav: "" }, {
|
|
352
|
-
default: withCtx(() => [
|
|
353
|
-
createVNode(_component_v_list_item, { to: "/tta_settings/templates" }, {
|
|
354
|
-
default: withCtx(() => [
|
|
355
|
-
createVNode(_component_v_list_item_icon, null, {
|
|
356
|
-
default: withCtx(() => [
|
|
357
|
-
createVNode(_component_v_icon, { name: "code" })
|
|
358
|
-
]),
|
|
359
|
-
_: 1 /* STABLE */
|
|
360
|
-
}),
|
|
361
|
-
createVNode(_component_v_list_item_content, null, {
|
|
362
|
-
default: withCtx(() => [
|
|
363
|
-
createVNode(_component_v_text_overflow, { text: "Templates" })
|
|
364
|
-
]),
|
|
365
|
-
_: 1 /* STABLE */
|
|
366
|
-
})
|
|
367
|
-
]),
|
|
368
|
-
_: 1 /* STABLE */
|
|
369
|
-
}),
|
|
370
|
-
createVNode(_component_v_list_item, { to: "/tta_settings/settings" }, {
|
|
371
|
-
default: withCtx(() => [
|
|
372
|
-
createVNode(_component_v_list_item_icon, null, {
|
|
373
|
-
default: withCtx(() => [
|
|
374
|
-
createVNode(_component_v_icon, { name: "settings" })
|
|
375
|
-
]),
|
|
376
|
-
_: 1 /* STABLE */
|
|
377
|
-
}),
|
|
378
|
-
createVNode(_component_v_list_item_content, null, {
|
|
379
|
-
default: withCtx(() => [
|
|
380
|
-
createVNode(_component_v_text_overflow, { text: "Settings" })
|
|
381
|
-
]),
|
|
382
|
-
_: 1 /* STABLE */
|
|
383
|
-
})
|
|
384
|
-
]),
|
|
385
|
-
_: 1 /* STABLE */
|
|
386
|
-
}),
|
|
387
|
-
createCommentVNode(" <v-list-item to=\"/tta_settings/usage\">\n <v-list-item-icon><v-icon name=\"bar_chart\" /></v-list-item-icon>\n <v-list-item-content>\n <v-text-overflow text=\"Usage\" />\n </v-list-item-content>\n </v-list-item> ")
|
|
388
|
-
]),
|
|
389
|
-
_: 1 /* STABLE */
|
|
390
|
-
}))
|
|
391
|
-
}
|
|
392
|
-
|
|
393
|
-
const script$4 = {};
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
script$4.render = render;
|
|
397
|
-
script$4.__file = "settingsmodule/src/TTAnav.vue";
|
|
398
|
-
|
|
399
|
-
const _hoisted_1$1 = {
|
|
400
|
-
key: 0,
|
|
401
|
-
class: "TTA-popup"
|
|
402
|
-
};
|
|
403
|
-
const _hoisted_2$1 = { class: "TTA-toolbar" };
|
|
404
|
-
const _hoisted_3$1 = { class: "right-side" };
|
|
405
|
-
const _hoisted_4$1 = { class: "setwidth" };
|
|
406
|
-
const _hoisted_5 = { class: "TTA-action" };
|
|
407
|
-
const _hoisted_6 = { class: "TTA-wapper" };
|
|
408
|
-
const _hoisted_7 = ["srcdoc"];
|
|
409
|
-
var script$3 = /* @__PURE__ */ defineComponent({
|
|
410
|
-
__name: "templates",
|
|
411
|
-
setup(__props) {
|
|
412
|
-
const templates = ref([]), templateDetails = ref(false), editTemplate = ref(false), assetsKey = ref("");
|
|
413
|
-
const widthPartition = ref(50);
|
|
414
|
-
const previewWidth = computed(() => {
|
|
415
|
-
return 100 - widthPartition.value;
|
|
416
|
-
});
|
|
417
|
-
const editorWidth = computed(() => {
|
|
418
|
-
return 100 - previewWidth.value;
|
|
419
|
-
});
|
|
420
|
-
const api = useApi();
|
|
421
|
-
const currentTemplate = ref({
|
|
422
|
-
template: "",
|
|
423
|
-
id: -1,
|
|
424
|
-
name: "",
|
|
425
|
-
description: "",
|
|
426
|
-
collection: "",
|
|
427
|
-
format: "A4",
|
|
428
|
-
orientation: "portrait"
|
|
429
|
-
});
|
|
430
|
-
const { useCollectionsStore } = useStores();
|
|
431
|
-
const collectionsStore = useCollectionsStore();
|
|
432
|
-
const collections = computed(() => {
|
|
433
|
-
return collectionsStore.collections.filter((e) => e.collection != "TTA_htmltemplates").map((e) => ({
|
|
434
|
-
text: e.name,
|
|
435
|
-
value: e.collection
|
|
436
|
-
}));
|
|
437
|
-
});
|
|
438
|
-
const computedTemplate = computed(() => {
|
|
439
|
-
return `${currentTemplate.value.template}`;
|
|
440
|
-
});
|
|
441
|
-
onMounted(async () => {
|
|
442
|
-
const settings = await api.get("/settings");
|
|
443
|
-
assetsKey.value = settings.data.data.TTA_ASSETS_KEY;
|
|
444
|
-
widthPartition.value = parseInt(
|
|
445
|
-
localStorage.getItem("TTA-widthPartition") || "50"
|
|
446
|
-
);
|
|
447
|
-
fetchTemplates();
|
|
448
|
-
});
|
|
449
|
-
watch(
|
|
450
|
-
() => widthPartition.value,
|
|
451
|
-
(newval) => localStorage.setItem("TTA-widthPartition", newval + "")
|
|
452
|
-
);
|
|
453
|
-
async function fetchTemplates() {
|
|
454
|
-
const getTemplates = await api.get("/items/TTA_htmltemplates", {
|
|
455
|
-
params: {
|
|
456
|
-
limit: -1
|
|
457
|
-
}
|
|
458
|
-
});
|
|
459
|
-
templates.value = getTemplates.data.data;
|
|
460
|
-
}
|
|
461
|
-
async function saveTemplate() {
|
|
462
|
-
if (currentTemplate.value.id == -1) {
|
|
463
|
-
await api.post("/items/TTA_htmltemplates", {
|
|
464
|
-
...currentTemplate.value
|
|
465
|
-
});
|
|
466
|
-
} else {
|
|
467
|
-
await api.patch("/items/TTA_htmltemplates/" + currentTemplate.value.id, {
|
|
468
|
-
...currentTemplate.value,
|
|
469
|
-
id: void 0
|
|
470
|
-
});
|
|
471
|
-
}
|
|
472
|
-
templateDetails.value = false;
|
|
473
|
-
fetchTemplates();
|
|
474
|
-
}
|
|
475
|
-
function openTemplate({ item }) {
|
|
476
|
-
console.log(item);
|
|
477
|
-
currentTemplate.value = item;
|
|
478
|
-
editTemplate.value = true;
|
|
479
|
-
}
|
|
480
|
-
function closeEditor() {
|
|
481
|
-
currentTemplate.value = {
|
|
482
|
-
template: "",
|
|
483
|
-
id: -1,
|
|
484
|
-
name: "",
|
|
485
|
-
description: "",
|
|
486
|
-
collection: "",
|
|
487
|
-
format: "A4",
|
|
488
|
-
orientation: "portrait"
|
|
489
|
-
};
|
|
490
|
-
editTemplate.value = false;
|
|
491
|
-
}
|
|
492
|
-
return (_ctx, _cache) => {
|
|
493
|
-
const _component_v_icon = resolveComponent("v-icon");
|
|
494
|
-
const _component_v_button = resolveComponent("v-button");
|
|
495
|
-
const _component_v_card_title = resolveComponent("v-card-title");
|
|
496
|
-
const _component_v_input = resolveComponent("v-input");
|
|
497
|
-
const _component_v_list_item_content = resolveComponent("v-list-item-content");
|
|
498
|
-
const _component_v_list_item = resolveComponent("v-list-item");
|
|
499
|
-
const _component_v_select = resolveComponent("v-select");
|
|
500
|
-
const _component_v_list = resolveComponent("v-list");
|
|
501
|
-
const _component_v_card_text = resolveComponent("v-card-text");
|
|
502
|
-
const _component_v_card_actions = resolveComponent("v-card-actions");
|
|
503
|
-
const _component_v_card = resolveComponent("v-card");
|
|
504
|
-
const _component_v_dialog = resolveComponent("v-dialog");
|
|
505
|
-
const _component_v_slider = resolveComponent("v-slider");
|
|
506
|
-
const _component_v_table = resolveComponent("v-table");
|
|
507
|
-
const _component_private_view = resolveComponent("private-view");
|
|
508
|
-
return openBlock(), createBlock(_component_private_view, { title: "Templates" }, {
|
|
509
|
-
navigation: withCtx(() => [
|
|
510
|
-
createVNode(script$4)
|
|
511
|
-
]),
|
|
512
|
-
actions: withCtx(() => [
|
|
513
|
-
createVNode(_component_v_button, {
|
|
514
|
-
rounded: "",
|
|
515
|
-
icon: "",
|
|
516
|
-
onClick: _cache[0] || (_cache[0] = ($event) => templateDetails.value = true)
|
|
517
|
-
}, {
|
|
518
|
-
default: withCtx(() => [
|
|
519
|
-
createVNode(_component_v_icon, { name: "add" })
|
|
520
|
-
]),
|
|
521
|
-
_: 1
|
|
522
|
-
}),
|
|
523
|
-
createVNode(_component_v_dialog, {
|
|
524
|
-
modelValue: templateDetails.value,
|
|
525
|
-
"onUpdate:modelValue": _cache[7] || (_cache[7] = ($event) => templateDetails.value = $event),
|
|
526
|
-
persistent: true
|
|
527
|
-
}, {
|
|
528
|
-
default: withCtx(() => [
|
|
529
|
-
createVNode(_component_v_card, null, {
|
|
530
|
-
default: withCtx(() => [
|
|
531
|
-
createVNode(_component_v_card_title, null, {
|
|
532
|
-
default: withCtx(() => [
|
|
533
|
-
createTextVNode("Create a new HTML template")
|
|
534
|
-
]),
|
|
535
|
-
_: 1
|
|
536
|
-
}),
|
|
537
|
-
createVNode(_component_v_card_text, null, {
|
|
538
|
-
default: withCtx(() => [
|
|
539
|
-
createVNode(_component_v_list, null, {
|
|
540
|
-
default: withCtx(() => [
|
|
541
|
-
createVNode(_component_v_list_item, null, {
|
|
542
|
-
default: withCtx(() => [
|
|
543
|
-
createVNode(_component_v_list_item_content, null, {
|
|
544
|
-
default: withCtx(() => [
|
|
545
|
-
createVNode(_component_v_input, {
|
|
546
|
-
modelValue: currentTemplate.value.name,
|
|
547
|
-
"onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => currentTemplate.value.name = $event),
|
|
548
|
-
placeholder: "Template name"
|
|
549
|
-
}, null, 8, ["modelValue"])
|
|
550
|
-
]),
|
|
551
|
-
_: 1
|
|
552
|
-
})
|
|
553
|
-
]),
|
|
554
|
-
_: 1
|
|
555
|
-
}),
|
|
556
|
-
createVNode(_component_v_list_item, null, {
|
|
557
|
-
default: withCtx(() => [
|
|
558
|
-
createVNode(_component_v_list_item_content, null, {
|
|
559
|
-
default: withCtx(() => [
|
|
560
|
-
createVNode(_component_v_input, {
|
|
561
|
-
modelValue: currentTemplate.value.description,
|
|
562
|
-
"onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => currentTemplate.value.description = $event),
|
|
563
|
-
placeholder: "Description"
|
|
564
|
-
}, null, 8, ["modelValue"])
|
|
565
|
-
]),
|
|
566
|
-
_: 1
|
|
567
|
-
})
|
|
568
|
-
]),
|
|
569
|
-
_: 1
|
|
570
|
-
}),
|
|
571
|
-
createVNode(_component_v_list_item, null, {
|
|
572
|
-
default: withCtx(() => [
|
|
573
|
-
createVNode(_component_v_list_item_content, null, {
|
|
574
|
-
default: withCtx(() => [
|
|
575
|
-
createVNode(_component_v_select, {
|
|
576
|
-
modelValue: currentTemplate.value.format,
|
|
577
|
-
"onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => currentTemplate.value.format = $event),
|
|
578
|
-
placeholder: "Size",
|
|
579
|
-
items: [
|
|
580
|
-
"A1",
|
|
581
|
-
"A2",
|
|
582
|
-
"A3",
|
|
583
|
-
"A4",
|
|
584
|
-
"A5",
|
|
585
|
-
"A6",
|
|
586
|
-
"Letter",
|
|
587
|
-
"Legal",
|
|
588
|
-
"Tabloid",
|
|
589
|
-
"Ledger"
|
|
590
|
-
].map((e) => ({ text: e, value: e }))
|
|
591
|
-
}, null, 8, ["modelValue", "items"])
|
|
592
|
-
]),
|
|
593
|
-
_: 1
|
|
594
|
-
})
|
|
595
|
-
]),
|
|
596
|
-
_: 1
|
|
597
|
-
}),
|
|
598
|
-
createVNode(_component_v_list_item, null, {
|
|
599
|
-
default: withCtx(() => [
|
|
600
|
-
createVNode(_component_v_list_item_content, null, {
|
|
601
|
-
default: withCtx(() => [
|
|
602
|
-
createVNode(_component_v_select, {
|
|
603
|
-
modelValue: currentTemplate.value.orientation,
|
|
604
|
-
"onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => currentTemplate.value.orientation = $event),
|
|
605
|
-
placeholder: "Orientation",
|
|
606
|
-
items: ["portrait", "landscape"].map((e) => ({
|
|
607
|
-
text: e,
|
|
608
|
-
value: e
|
|
609
|
-
}))
|
|
610
|
-
}, null, 8, ["modelValue", "items"])
|
|
611
|
-
]),
|
|
612
|
-
_: 1
|
|
613
|
-
})
|
|
614
|
-
]),
|
|
615
|
-
_: 1
|
|
616
|
-
}),
|
|
617
|
-
createVNode(_component_v_list_item, null, {
|
|
618
|
-
default: withCtx(() => [
|
|
619
|
-
createVNode(_component_v_list_item_content, null, {
|
|
620
|
-
default: withCtx(() => [
|
|
621
|
-
createVNode(_component_v_select, {
|
|
622
|
-
modelValue: currentTemplate.value.collection,
|
|
623
|
-
"onUpdate:modelValue": _cache[5] || (_cache[5] = ($event) => currentTemplate.value.collection = $event),
|
|
624
|
-
items: unref(collections),
|
|
625
|
-
placeholder: "Collection"
|
|
626
|
-
}, null, 8, ["modelValue", "items"])
|
|
627
|
-
]),
|
|
628
|
-
_: 1
|
|
629
|
-
})
|
|
630
|
-
]),
|
|
631
|
-
_: 1
|
|
632
|
-
})
|
|
633
|
-
]),
|
|
634
|
-
_: 1
|
|
635
|
-
})
|
|
636
|
-
]),
|
|
637
|
-
_: 1
|
|
638
|
-
}),
|
|
639
|
-
createVNode(_component_v_card_actions, null, {
|
|
640
|
-
default: withCtx(() => [
|
|
641
|
-
createVNode(_component_v_button, {
|
|
642
|
-
secondary: "",
|
|
643
|
-
onClick: _cache[6] || (_cache[6] = ($event) => templateDetails.value = false)
|
|
644
|
-
}, {
|
|
645
|
-
default: withCtx(() => [
|
|
646
|
-
createTextVNode(" Cancel ")
|
|
647
|
-
]),
|
|
648
|
-
_: 1
|
|
649
|
-
}),
|
|
650
|
-
createVNode(_component_v_button, {
|
|
651
|
-
disabled: !currentTemplate.value.collection || !currentTemplate.value.name || !currentTemplate.value.format,
|
|
652
|
-
onClick: saveTemplate
|
|
653
|
-
}, {
|
|
654
|
-
default: withCtx(() => [
|
|
655
|
-
createTextVNode(" Save ")
|
|
656
|
-
]),
|
|
657
|
-
_: 1
|
|
658
|
-
}, 8, ["disabled"])
|
|
659
|
-
]),
|
|
660
|
-
_: 1
|
|
661
|
-
})
|
|
662
|
-
]),
|
|
663
|
-
_: 1
|
|
664
|
-
})
|
|
665
|
-
]),
|
|
666
|
-
_: 1
|
|
667
|
-
}, 8, ["modelValue"])
|
|
668
|
-
]),
|
|
669
|
-
default: withCtx(() => [
|
|
670
|
-
editTemplate.value ? (openBlock(), createElementBlock("div", _hoisted_1$1, [
|
|
671
|
-
createElementVNode("div", _hoisted_2$1, [
|
|
672
|
-
createElementVNode("div", {
|
|
673
|
-
onClick: _cache[8] || (_cache[8] = ($event) => templateDetails.value = true),
|
|
674
|
-
class: "TTA-template-title"
|
|
675
|
-
}, [
|
|
676
|
-
createTextVNode(toDisplayString(currentTemplate.value.name) + " ", 1),
|
|
677
|
-
createVNode(_component_v_icon, { name: "edit" })
|
|
678
|
-
]),
|
|
679
|
-
createElementVNode("div", _hoisted_3$1, [
|
|
680
|
-
createElementVNode("div", {
|
|
681
|
-
class: "TTA-action",
|
|
682
|
-
onClick: saveTemplate
|
|
683
|
-
}, [
|
|
684
|
-
createVNode(_component_v_icon, { name: "save" })
|
|
685
|
-
]),
|
|
686
|
-
createElementVNode("div", _hoisted_4$1, [
|
|
687
|
-
createVNode(_component_v_slider, {
|
|
688
|
-
modelValue: widthPartition.value,
|
|
689
|
-
"onUpdate:modelValue": _cache[9] || (_cache[9] = ($event) => widthPartition.value = $event),
|
|
690
|
-
min: 10,
|
|
691
|
-
max: 90,
|
|
692
|
-
class: "TTA-slider"
|
|
693
|
-
}, null, 8, ["modelValue"])
|
|
694
|
-
]),
|
|
695
|
-
createElementVNode("div", _hoisted_5, [
|
|
696
|
-
createVNode(_component_v_icon, {
|
|
697
|
-
name: "close",
|
|
698
|
-
onClick: closeEditor
|
|
699
|
-
})
|
|
700
|
-
])
|
|
701
|
-
])
|
|
702
|
-
]),
|
|
703
|
-
createElementVNode("div", _hoisted_6, [
|
|
704
|
-
(openBlock(), createBlock(resolveDynamicComponent("interface-input-rich-text-html"), {
|
|
705
|
-
class: "TTA-editor",
|
|
706
|
-
value: currentTemplate.value.template,
|
|
707
|
-
imageToken: assetsKey.value,
|
|
708
|
-
onInput: _cache[10] || (_cache[10] = (html) => currentTemplate.value.template = html),
|
|
709
|
-
style: normalizeStyle("width: " + unref(editorWidth) + "%")
|
|
710
|
-
}, null, 40, ["value", "imageToken", "style"])),
|
|
711
|
-
createElementVNode("iframe", {
|
|
712
|
-
class: "TTA-preview",
|
|
713
|
-
srcdoc: unref(computedTemplate),
|
|
714
|
-
style: normalizeStyle("width: " + unref(previewWidth) + "%")
|
|
715
|
-
}, null, 12, _hoisted_7)
|
|
716
|
-
])
|
|
717
|
-
])) : createCommentVNode("v-if", true),
|
|
718
|
-
createVNode(_component_v_table, {
|
|
719
|
-
headers: [
|
|
720
|
-
{
|
|
721
|
-
text: "Name",
|
|
722
|
-
value: "name"
|
|
723
|
-
},
|
|
724
|
-
{
|
|
725
|
-
text: "Description",
|
|
726
|
-
value: "description"
|
|
727
|
-
},
|
|
728
|
-
{
|
|
729
|
-
text: "Collection",
|
|
730
|
-
value: "collection"
|
|
731
|
-
},
|
|
732
|
-
{
|
|
733
|
-
text: "Format",
|
|
734
|
-
value: "format"
|
|
735
|
-
}
|
|
736
|
-
],
|
|
737
|
-
"onClick:row": openTemplate,
|
|
738
|
-
items: templates.value
|
|
739
|
-
}, null, 8, ["items"])
|
|
740
|
-
]),
|
|
741
|
-
_: 1
|
|
742
|
-
});
|
|
743
|
-
};
|
|
744
|
-
}
|
|
745
|
-
});
|
|
746
|
-
|
|
747
|
-
var e=[],t=[];function n(n,r){if(n&&"undefined"!=typeof document){var a,s=!0===r.prepend?"prepend":"append",d=!0===r.singleTag,i="string"==typeof r.container?document.querySelector(r.container):document.getElementsByTagName("head")[0];if(d){var u=e.indexOf(i);-1===u&&(u=e.push(i)-1,t[u]={}),a=t[u]&&t[u][s]?t[u][s]:t[u][s]=c();}else a=c();65279===n.charCodeAt(0)&&(n=n.substring(1)),a.styleSheet?a.styleSheet.cssText+=n:a.appendChild(document.createTextNode(n));}function c(){var e=document.createElement("style");if(e.setAttribute("type","text/css"),r.attributes)for(var t=Object.keys(r.attributes),n=0;n<t.length;n++)e.setAttribute(t[n],r.attributes[t[n]]);var a="prepend"===s?"afterbegin":"beforeend";return i.insertAdjacentElement(a,e),e}}
|
|
748
|
-
|
|
749
|
-
var css$1 = "\n.TTA-popup {\n position: fixed;\n left: 0;\n top: 0;\n width: 100%;\n height: 100%;\n z-index: 100;\n display: flex;\n flex-direction: column;\n background-color: var(--background-subdued);\n}\n.TTA-toolbar {\n background-color: var(--background-subdued);\n display: flex;\n justify-content: space-between;\n}\n.TTA-toolbar .right-side {\n display: flex;\n gap: 5px;\n}\n.TTA-toolbar .TTA-slider {\n padding-top: 5px;\n}\n.TTA-toolbar .TTA-action {\n padding: 5px;\n cursor: pointer;\n}\n.TTA-toolbar .setwidth {\n display: flex;\n gap: 10px;\n padding-top: 6px;\n}\n.TTA-toolbar .TTA-template-title {\n margin: auto 0;\n font-size: 18px;\n cursor: pointer;\n padding-right: 5px;\n padding-left: 20px;\n border-bottom: 1px solid var(--v-list-item-border-color);\n}\n.TTA-toolbar .TTA-template-title i {\n padding-left: 5px;\n}\n.TTA-wapper {\n display: flex;\n flex-grow: 1;\n}\n.TTA-preview {\n flex-grow: 1;\n background-color: white;\n border: 0;\n}\n.TTA-editor {\n flex-grow: 1;\n height: 100%;\n}\n.TTA-editor .tox.tox-tinymce {\n height: 100% !important;\n border-radius: 0 !important;\n}\n";
|
|
750
|
-
n(css$1,{});
|
|
751
|
-
|
|
752
|
-
script$3.__file = "settingsmodule/src/templates.vue";
|
|
753
|
-
|
|
754
|
-
const _withScopeId = (n) => (pushScopeId("data-v-014dce90"), n = n(), popScopeId(), n);
|
|
755
|
-
const _hoisted_1 = { class: "px-5" };
|
|
756
|
-
const _hoisted_2 = /* @__PURE__ */ _withScopeId(() => /* @__PURE__ */ createElementVNode("span", { class: "field-name" }, "RapidAPI token", -1));
|
|
757
|
-
const _hoisted_3 = /* @__PURE__ */ _withScopeId(() => /* @__PURE__ */ createElementVNode("span", { class: "field-name" }, "Directus Assets token", -1));
|
|
758
|
-
const _hoisted_4 = /* @__PURE__ */ _withScopeId(() => /* @__PURE__ */ createElementVNode("span", { class: "field-name" }, "Directus Assets folder", -1));
|
|
759
|
-
var script$2 = /* @__PURE__ */ defineComponent({
|
|
760
|
-
__name: "settings",
|
|
761
|
-
setup(__props) {
|
|
762
|
-
const rapidKey = ref("");
|
|
763
|
-
const assetsKey = ref("");
|
|
764
|
-
const assetsFolder = ref("");
|
|
765
|
-
const saving = ref(false);
|
|
766
|
-
const api = useApi();
|
|
767
|
-
const folder = ref([]);
|
|
768
|
-
onMounted(async () => {
|
|
769
|
-
const settings = await api.get("/settings");
|
|
770
|
-
rapidKey.value = settings.data.data.TTA_KEY;
|
|
771
|
-
assetsKey.value = settings.data.data.TTA_ASSETS_KEY;
|
|
772
|
-
assetsFolder.value = settings.data.data.TTA_ASSETS_FOLDER;
|
|
773
|
-
const folders = await api.get("/folders");
|
|
774
|
-
folder.value = folders.data.data.map((e) => ({
|
|
775
|
-
text: e.name,
|
|
776
|
-
value: e.id
|
|
777
|
-
}));
|
|
778
|
-
});
|
|
779
|
-
async function saveSettings() {
|
|
780
|
-
saving.value = true;
|
|
781
|
-
await api.patch("/settings", {
|
|
782
|
-
TTA_KEY: rapidKey.value,
|
|
783
|
-
TTA_ASSETS_KEY: assetsKey.value,
|
|
784
|
-
TTA_ASSETS_FOLDER: assetsFolder.value
|
|
785
|
-
});
|
|
786
|
-
setTimeout(() => {
|
|
787
|
-
saving.value = false;
|
|
788
|
-
}, 500);
|
|
789
|
-
}
|
|
790
|
-
return (_ctx, _cache) => {
|
|
791
|
-
const _component_v_card_title = resolveComponent("v-card-title");
|
|
792
|
-
const _component_v_input = resolveComponent("v-input");
|
|
793
|
-
const _component_v_select = resolveComponent("v-select");
|
|
794
|
-
const _component_v_card_text = resolveComponent("v-card-text");
|
|
795
|
-
const _component_v_icon = resolveComponent("v-icon");
|
|
796
|
-
const _component_v_button = resolveComponent("v-button");
|
|
797
|
-
const _component_v_progress_circular = resolveComponent("v-progress-circular");
|
|
798
|
-
const _component_v_card_actions = resolveComponent("v-card-actions");
|
|
799
|
-
const _component_v_card = resolveComponent("v-card");
|
|
800
|
-
const _component_private_view = resolveComponent("private-view");
|
|
801
|
-
return openBlock(), createBlock(_component_private_view, { title: "Settings" }, {
|
|
802
|
-
navigation: withCtx(() => [
|
|
803
|
-
createVNode(script$4)
|
|
804
|
-
]),
|
|
805
|
-
default: withCtx(() => [
|
|
806
|
-
createElementVNode("div", _hoisted_1, [
|
|
807
|
-
createVNode(_component_v_card, { class: "w-full" }, {
|
|
808
|
-
default: withCtx(() => [
|
|
809
|
-
createVNode(_component_v_card_title, null, {
|
|
810
|
-
default: withCtx(() => [
|
|
811
|
-
createTextVNode("API settings")
|
|
812
|
-
]),
|
|
813
|
-
_: 1
|
|
814
|
-
}),
|
|
815
|
-
createVNode(_component_v_card_text, { class: "fields-spacing" }, {
|
|
816
|
-
default: withCtx(() => [
|
|
817
|
-
createElementVNode("div", null, [
|
|
818
|
-
_hoisted_2,
|
|
819
|
-
createVNode(_component_v_input, {
|
|
820
|
-
modelValue: rapidKey.value,
|
|
821
|
-
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => rapidKey.value = $event)
|
|
822
|
-
}, null, 8, ["modelValue"])
|
|
823
|
-
]),
|
|
824
|
-
createElementVNode("div", null, [
|
|
825
|
-
_hoisted_3,
|
|
826
|
-
createVNode(_component_v_input, {
|
|
827
|
-
modelValue: assetsKey.value,
|
|
828
|
-
"onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => assetsKey.value = $event)
|
|
829
|
-
}, null, 8, ["modelValue"])
|
|
830
|
-
]),
|
|
831
|
-
createElementVNode("div", null, [
|
|
832
|
-
_hoisted_4,
|
|
833
|
-
createVNode(_component_v_select, {
|
|
834
|
-
modelValue: assetsFolder.value,
|
|
835
|
-
"onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => assetsFolder.value = $event),
|
|
836
|
-
items: folder.value,
|
|
837
|
-
placeholder: "Assets folder"
|
|
838
|
-
}, null, 8, ["modelValue", "items"])
|
|
839
|
-
])
|
|
840
|
-
]),
|
|
841
|
-
_: 1
|
|
842
|
-
}),
|
|
843
|
-
createVNode(_component_v_card_actions, null, {
|
|
844
|
-
default: withCtx(() => [
|
|
845
|
-
createVNode(_component_v_button, {
|
|
846
|
-
href: "https://rapidapi.com/Attacler/api/text-to-anything",
|
|
847
|
-
target: "_blank"
|
|
848
|
-
}, {
|
|
849
|
-
default: withCtx(() => [
|
|
850
|
-
createVNode(_component_v_icon, { name: "open_in_new" }),
|
|
851
|
-
createTextVNode(" Get RapidAPI token ")
|
|
852
|
-
]),
|
|
853
|
-
_: 1
|
|
854
|
-
}),
|
|
855
|
-
createVNode(_component_v_button, {
|
|
856
|
-
onClick: saveSettings,
|
|
857
|
-
disabled: saving.value
|
|
858
|
-
}, {
|
|
859
|
-
default: withCtx(() => [
|
|
860
|
-
!saving.value ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
861
|
-
createTextVNode(" Save ")
|
|
862
|
-
], 64)) : (openBlock(), createBlock(_component_v_progress_circular, {
|
|
863
|
-
key: 1,
|
|
864
|
-
small: true,
|
|
865
|
-
indeterminate: ""
|
|
866
|
-
}))
|
|
867
|
-
]),
|
|
868
|
-
_: 1
|
|
869
|
-
}, 8, ["disabled"])
|
|
870
|
-
]),
|
|
871
|
-
_: 1
|
|
872
|
-
})
|
|
873
|
-
]),
|
|
874
|
-
_: 1
|
|
875
|
-
})
|
|
876
|
-
])
|
|
877
|
-
]),
|
|
878
|
-
_: 1
|
|
879
|
-
});
|
|
880
|
-
};
|
|
881
|
-
}
|
|
882
|
-
});
|
|
883
|
-
|
|
884
|
-
var css = "\n.w-full[data-v-014dce90] {\n width: 100%;\n}\n.px-5[data-v-014dce90] {\n padding: 0 2.5rem;\n}\n.fields-spacing[data-v-014dce90] {\n display: flex;\n flex-direction: column;\n gap: 10px;\n}\n";
|
|
885
|
-
n(css,{});
|
|
886
|
-
|
|
887
|
-
script$2.__scopeId = "data-v-014dce90";
|
|
888
|
-
script$2.__file = "settingsmodule/src/settings.vue";
|
|
889
|
-
|
|
890
|
-
var script$1 = /* @__PURE__ */ defineComponent({
|
|
891
|
-
__name: "usage",
|
|
892
|
-
setup(__props) {
|
|
893
|
-
return (_ctx, _cache) => {
|
|
894
|
-
const _component_private_view = resolveComponent("private-view");
|
|
895
|
-
return openBlock(), createBlock(_component_private_view, { title: "Usage" }, {
|
|
896
|
-
navigation: withCtx(() => [
|
|
897
|
-
createVNode(script$4)
|
|
898
|
-
]),
|
|
899
|
-
default: withCtx(() => [
|
|
900
|
-
createTextVNode(" Comming soon! ")
|
|
901
|
-
]),
|
|
902
|
-
_: 1
|
|
903
|
-
});
|
|
904
|
-
};
|
|
905
|
-
}
|
|
906
|
-
});
|
|
907
|
-
|
|
908
|
-
script$1.__file = "settingsmodule/src/usage.vue";
|
|
909
|
-
|
|
910
|
-
var e4 = defineModule({
|
|
911
|
-
id: "tta_settings",
|
|
912
|
-
name: "Text to anything settings",
|
|
913
|
-
icon: "text_fields",
|
|
914
|
-
routes: [
|
|
915
|
-
{
|
|
916
|
-
path: "",
|
|
917
|
-
redirect: "/tta_settings/templates"
|
|
918
|
-
},
|
|
919
|
-
{
|
|
920
|
-
path: "templates",
|
|
921
|
-
component: script$3
|
|
922
|
-
},
|
|
923
|
-
{
|
|
924
|
-
path: "settings",
|
|
925
|
-
component: script$2
|
|
926
|
-
},
|
|
927
|
-
{
|
|
928
|
-
path: "usage",
|
|
929
|
-
component: script$1
|
|
930
|
-
}
|
|
931
|
-
]
|
|
932
|
-
});
|
|
933
|
-
|
|
934
|
-
var script = /* @__PURE__ */ defineComponent({
|
|
935
|
-
__name: "interface",
|
|
936
|
-
props: ["value"],
|
|
937
|
-
emits: ["input"],
|
|
938
|
-
setup(__props, { emit }) {
|
|
939
|
-
const props = __props;
|
|
940
|
-
const api = inject("api");
|
|
941
|
-
const value = ref(""), templates = ref([]);
|
|
942
|
-
onMounted(async () => {
|
|
943
|
-
value.value = props.value;
|
|
944
|
-
watch(
|
|
945
|
-
() => value.value,
|
|
946
|
-
(newval, oldval) => {
|
|
947
|
-
if (newval != oldval) {
|
|
948
|
-
emit("input", newval);
|
|
949
|
-
}
|
|
950
|
-
}
|
|
951
|
-
);
|
|
952
|
-
const getTemplates = await api.get("/items/TTA_htmltemplates");
|
|
953
|
-
templates.value = getTemplates.data.data.map((e) => ({
|
|
954
|
-
text: e.name,
|
|
955
|
-
value: e.id
|
|
956
|
-
}));
|
|
957
|
-
});
|
|
958
|
-
return (_ctx, _cache) => {
|
|
959
|
-
const _component_v_select = resolveComponent("v-select");
|
|
960
|
-
return openBlock(), createBlock(_component_v_select, {
|
|
961
|
-
modelValue: value.value,
|
|
962
|
-
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => value.value = $event),
|
|
963
|
-
items: templates.value
|
|
964
|
-
}, null, 8, ["modelValue", "items"]);
|
|
965
|
-
};
|
|
966
|
-
}
|
|
967
|
-
});
|
|
968
|
-
|
|
969
|
-
script.__file = "PDFTemplateSelector/src/interface.vue";
|
|
970
|
-
|
|
971
|
-
var e5 = defineInterface({
|
|
972
|
-
id: "TTA-pdf-template-selector",
|
|
973
|
-
name: "TTA PDF template selector",
|
|
974
|
-
icon: "box",
|
|
975
|
-
description: "Selector for a PDF template",
|
|
976
|
-
component: script,
|
|
977
|
-
options: null,
|
|
978
|
-
types: ["string"]
|
|
979
|
-
});
|
|
980
|
-
|
|
981
|
-
const interfaces = [e5];const displays = [];const layouts = [];const modules = [e4];const panels = [];const operations = [e0,e1,e2,e3];
|
|
982
|
-
|
|
983
|
-
export { displays, interfaces, layouts, modules, operations, panels };
|
|
1
|
+
import{defineOperationApp as e,useApi as t,useStores as a,defineModule as l,defineInterface as n}from"@directus/extensions-sdk";import{resolveComponent as i,openBlock as o,createBlock as d,withCtx as s,createVNode as r,createCommentVNode as c,defineComponent as u,ref as m,computed as p,onMounted as v,watch as f,createTextVNode as g,unref as T,createElementBlock as h,createElementVNode as b,toDisplayString as x,resolveDynamicComponent as _,normalizeStyle as A,Fragment as y,pushScopeId as w,popScopeId as k,inject as V}from"vue";var S=e({id:"ttabarcode",name:"TTA generate barcode",icon:"box",description:"Generate a barcode trough Text to anything!",overview:({barcodeContent:e})=>[{label:"barcode content",text:e}],options:[{field:"barcodeContent",name:"content",type:"string",meta:{width:"full",interface:"input"}},{field:"barcodeType",name:"type",type:"dropdown",meta:{interface:"select-dropdown",options:{choices:["auspost","azteccode","azteccodecompact","aztecrune","bc412","channelcode","codablockf","code11","code128","code16k","code2of5","code32","code39","code39ext","code49","code93","code93ext","codeone","coop2of5","daft","databarexpanded","databarexpandedcomposite","databarexpandedstacked","databarexpandedstackedcomposite","databarlimited","databarlimitedcomposite","databaromni","databaromnicomposite","databarstacked","databarstackedcomposite","databarstackedomni","databarstackedomnicomposite","databartruncated","databartruncatedcomposite","datalogic2of5","datamatrix","datamatrixrectangular","datamatrixrectangularextension","dotcode","ean13","ean13composite","ean14","ean2","ean5","ean8","ean8composite","flattermarken","gs1-128","gs1-128composite","gs1-cc","gs1datamatrix","gs1datamatrixrectangular","gs1dldatamatrix","gs1dlqrcode","gs1dotcode","gs1northamericancoupon","gs1qrcode","hanxin","hibcazteccode","hibccodablockf","hibccode128","hibccode39","hibcdatamatrix","hibcdatamatrixrectangular","hibcmicropdf417","hibcpdf417","hibcqrcode","iata2of5","identcode","industrial2of5","interleaved2of5","isbn","ismn","issn","itf14","japanpost","kix","leitcode","mailmark","mands","matrix2of5","maxicode","micropdf417","microqrcode","msi","onecode","pdf417","pdf417compact","pharmacode","pharmacode2","planet","plessey","posicode","postnet","pzn","qrcode","rationalizedCodabar","raw","rectangularmicroqrcode","royalmail","sscc18","swissqrcode","symbol","telepen","telepennumeric","ultracode","upca","upcacomposite","upce","upcecomposite"].map((e=>({text:e,value:e})))}}},{field:"scale",name:"scale",type:"number",meta:{width:"full",interface:"input"}},{field:"height",name:"height",type:"number",meta:{width:"full",interface:"input"}},{field:"includetext",name:"include text",type:"boolean",meta:{width:"full",interface:"boolean"}}]}),C=e({id:"ttapdf",name:"TTA generate PDF",icon:"box",description:"Generate a PDF trough Text to anything!",overview:({filename:e})=>[{label:"File name",text:e}],options:[{field:"filename",name:"File name",type:"string",meta:{width:"full",interface:"input"}},{field:"pdfoptions",name:"Options",type:"json",meta:{width:"full",interface:"input-code",options:{language:"json",placeholder:JSON.stringify({html:"<h1>Hello world!</h1>",format:"A4",landscape:!1,margin:10,marginRight:5,marginLeft:5},null,2),template:JSON.stringify({html:"<h1>Hello world!</h1>",format:"A4",landscape:!1,margin:10,marginRight:5,marginLeft:5},null,2)}}}]}),E=e({id:"ttapdftemplate",name:"TTA generate PDF from template",icon:"box",description:"Generate a PDF based on a template trough Text to anything!",overview:({filename:e})=>[{label:"File name",text:e}],options:[{field:"filename",name:"File name",type:"string",meta:{width:"full",interface:"input"}},{field:"template",name:"Template",type:"string",meta:{interface:"TTA-pdf-template-selector",options:{}}},{field:"templatevariables",name:"Template variables",type:"json",meta:{width:"full",interface:"input-code",options:{language:"json"}}}]}),D=e({id:"ttaqrcode",name:"TTA generate QRcode",icon:"box",description:"Generate a QRcode trough Text to anything!",overview:({qrcodeContent:e})=>[{label:"QRCode content",text:e}],options:[{field:"qrcodeContent",name:"QRCode content",type:"string",meta:{width:"full",interface:"input"}},{field:"lightColor",name:"Light color",type:"string",meta:{width:"full",interface:"input"}},{field:"darkColor",name:"Dark color",type:"string",meta:{width:"full",interface:"input"}},{field:"margin",name:"Margin",type:"integer",meta:{width:"half",interface:"input"}},{field:"width",name:"Width",type:"integer",meta:{width:"half",interface:"input"}}]});const F={render:function(e,t){const a=i("v-icon"),l=i("v-list-item-icon"),n=i("v-text-overflow"),u=i("v-list-item-content"),m=i("v-list-item"),p=i("v-list");return o(),d(p,{nav:""},{default:s((()=>[r(m,{to:"/tta_settings/templates"},{default:s((()=>[r(l,null,{default:s((()=>[r(a,{name:"code"})])),_:1}),r(u,null,{default:s((()=>[r(n,{text:"Templates"})])),_:1})])),_:1}),r(m,{to:"/tta_settings/settings"},{default:s((()=>[r(l,null,{default:s((()=>[r(a,{name:"settings"})])),_:1}),r(u,null,{default:s((()=>[r(n,{text:"Settings"})])),_:1})])),_:1}),c(' <v-list-item to="/tta_settings/usage">\n <v-list-item-icon><v-icon name="bar_chart" /></v-list-item-icon>\n <v-list-item-content>\n <v-text-overflow text="Usage" />\n </v-list-item-content>\n </v-list-item> ')])),_:1})},__file:"settingsmodule/src/TTAnav.vue"},U={key:0,class:"TTA-popup"},P={class:"TTA-toolbar"},q={class:"right-side"},R={class:"setwidth"},z={class:"TTA-action"},L={class:"TTA-wapper"},j=["srcdoc"];var I=u({__name:"templates",setup(e){const l=m([]),n=m(!1),u=m(!1),y=m(""),w=m(50),k=p((()=>100-w.value)),V=p((()=>100-k.value)),S=t(),C=m({template:"",id:-1,name:"",description:"",collection:"",format:"A4",orientation:"portrait"}),{useCollectionsStore:E}=a(),D=E(),I=p((()=>D.collections.filter((e=>"TTA_htmltemplates"!=e.collection)).map((e=>({text:e.name,value:e.collection}))))),O=p((()=>`${C.value.template}`));async function G(){const e=await S.get("/items/TTA_htmltemplates",{params:{limit:-1}});l.value=e.data.data}async function K(){-1==C.value.id?await S.post("/items/TTA_htmltemplates",{...C.value}):await S.patch("/items/TTA_htmltemplates/"+C.value.id,{...C.value,id:void 0}),n.value=!1,G()}function N({item:e}){console.log(e),C.value=e,u.value=!0}function Y(){C.value={template:"",id:-1,name:"",description:"",collection:"",format:"A4",orientation:"portrait"},u.value=!1}return v((async()=>{const e=await S.get("/settings");y.value=e.data.data.TTA_ASSETS_KEY,w.value=parseInt(localStorage.getItem("TTA-widthPartition")||"50"),G()})),f((()=>w.value),(e=>localStorage.setItem("TTA-widthPartition",e+""))),(e,t)=>{const a=i("v-icon"),m=i("v-button"),p=i("v-card-title"),v=i("v-input"),f=i("v-list-item-content"),S=i("v-list-item"),E=i("v-select"),D=i("v-list"),G=i("v-card-text"),Q=i("v-card-actions"),H=i("v-card"),J=i("v-dialog"),M=i("v-slider"),B=i("v-table"),W=i("private-view");return o(),d(W,{title:"Templates"},{navigation:s((()=>[r(F)])),actions:s((()=>[r(m,{rounded:"",icon:"",onClick:t[0]||(t[0]=e=>n.value=!0)},{default:s((()=>[r(a,{name:"add"})])),_:1}),r(J,{modelValue:n.value,"onUpdate:modelValue":t[7]||(t[7]=e=>n.value=e),persistent:!0},{default:s((()=>[r(H,null,{default:s((()=>[r(p,null,{default:s((()=>[g("Create a new HTML template")])),_:1}),r(G,null,{default:s((()=>[r(D,null,{default:s((()=>[r(S,null,{default:s((()=>[r(f,null,{default:s((()=>[r(v,{modelValue:C.value.name,"onUpdate:modelValue":t[1]||(t[1]=e=>C.value.name=e),placeholder:"Template name"},null,8,["modelValue"])])),_:1})])),_:1}),r(S,null,{default:s((()=>[r(f,null,{default:s((()=>[r(v,{modelValue:C.value.description,"onUpdate:modelValue":t[2]||(t[2]=e=>C.value.description=e),placeholder:"Description"},null,8,["modelValue"])])),_:1})])),_:1}),r(S,null,{default:s((()=>[r(f,null,{default:s((()=>[r(E,{modelValue:C.value.format,"onUpdate:modelValue":t[3]||(t[3]=e=>C.value.format=e),placeholder:"Size",items:["A1","A2","A3","A4","A5","A6","Letter","Legal","Tabloid","Ledger"].map((e=>({text:e,value:e})))},null,8,["modelValue","items"])])),_:1})])),_:1}),r(S,null,{default:s((()=>[r(f,null,{default:s((()=>[r(E,{modelValue:C.value.orientation,"onUpdate:modelValue":t[4]||(t[4]=e=>C.value.orientation=e),placeholder:"Orientation",items:["portrait","landscape"].map((e=>({text:e,value:e})))},null,8,["modelValue","items"])])),_:1})])),_:1}),r(S,null,{default:s((()=>[r(f,null,{default:s((()=>[r(E,{modelValue:C.value.collection,"onUpdate:modelValue":t[5]||(t[5]=e=>C.value.collection=e),items:T(I),placeholder:"Collection"},null,8,["modelValue","items"])])),_:1})])),_:1})])),_:1})])),_:1}),r(Q,null,{default:s((()=>[r(m,{secondary:"",onClick:t[6]||(t[6]=e=>n.value=!1)},{default:s((()=>[g(" Cancel ")])),_:1}),r(m,{disabled:!C.value.collection||!C.value.name||!C.value.format,onClick:K},{default:s((()=>[g(" Save ")])),_:1},8,["disabled"])])),_:1})])),_:1})])),_:1},8,["modelValue"])])),default:s((()=>[u.value?(o(),h("div",U,[b("div",P,[b("div",{onClick:t[8]||(t[8]=e=>n.value=!0),class:"TTA-template-title"},[g(x(C.value.name)+" ",1),r(a,{name:"edit"})]),b("div",q,[b("div",{class:"TTA-action",onClick:K},[r(a,{name:"save"})]),b("div",R,[r(M,{modelValue:w.value,"onUpdate:modelValue":t[9]||(t[9]=e=>w.value=e),min:10,max:90,class:"TTA-slider"},null,8,["modelValue"])]),b("div",z,[r(a,{name:"close",onClick:Y})])])]),b("div",L,[(o(),d(_("interface-input-rich-text-html"),{class:"TTA-editor",value:C.value.template,imageToken:y.value,onInput:t[10]||(t[10]=e=>C.value.template=e),style:A("width: "+T(V)+"%")},null,40,["value","imageToken","style"])),b("iframe",{class:"TTA-preview",srcdoc:T(O),style:A("width: "+T(k)+"%")},null,12,j)])])):c("v-if",!0),r(B,{headers:[{text:"Name",value:"name"},{text:"Description",value:"description"},{text:"Collection",value:"collection"},{text:"Format",value:"format"}],"onClick:row":N,items:l.value},null,8,["items"])])),_:1})}}}),O=[],G=[];function K(e,t){if(e&&"undefined"!=typeof document){var a,l=!0===t.prepend?"prepend":"append",n=!0===t.singleTag,i="string"==typeof t.container?document.querySelector(t.container):document.getElementsByTagName("head")[0];if(n){var o=O.indexOf(i);-1===o&&(o=O.push(i)-1,G[o]={}),a=G[o]&&G[o][l]?G[o][l]:G[o][l]=d()}else a=d();65279===e.charCodeAt(0)&&(e=e.substring(1)),a.styleSheet?a.styleSheet.cssText+=e:a.appendChild(document.createTextNode(e))}function d(){var e=document.createElement("style");if(e.setAttribute("type","text/css"),t.attributes)for(var a=Object.keys(t.attributes),n=0;n<a.length;n++)e.setAttribute(a[n],t.attributes[a[n]]);var o="prepend"===l?"afterbegin":"beforeend";return i.insertAdjacentElement(o,e),e}}K("\n.TTA-popup {\n position: fixed;\n left: 0;\n top: 0;\n width: 100%;\n height: 100%;\n z-index: 100;\n display: flex;\n flex-direction: column;\n background-color: var(--background-subdued);\n}\n.TTA-toolbar {\n background-color: var(--background-subdued);\n display: flex;\n justify-content: space-between;\n}\n.TTA-toolbar .right-side {\n display: flex;\n gap: 5px;\n}\n.TTA-toolbar .TTA-slider {\n padding-top: 5px;\n}\n.TTA-toolbar .TTA-action {\n padding: 5px;\n cursor: pointer;\n}\n.TTA-toolbar .setwidth {\n display: flex;\n gap: 10px;\n padding-top: 6px;\n}\n.TTA-toolbar .TTA-template-title {\n margin: auto 0;\n font-size: 18px;\n cursor: pointer;\n padding-right: 5px;\n padding-left: 20px;\n border-bottom: 1px solid var(--v-list-item-border-color);\n}\n.TTA-toolbar .TTA-template-title i {\n padding-left: 5px;\n}\n.TTA-wapper {\n display: flex;\n flex-grow: 1;\n}\n.TTA-preview {\n flex-grow: 1;\n background-color: white;\n border: 0;\n}\n.TTA-editor {\n flex-grow: 1;\n height: 100%;\n}\n.TTA-editor .tox.tox-tinymce {\n height: 100% !important;\n border-radius: 0 !important;\n}\n",{}),I.__file="settingsmodule/src/templates.vue";const N=e=>(w("data-v-014dce90"),e=e(),k(),e),Y={class:"px-5"},Q=N((()=>b("span",{class:"field-name"},"RapidAPI token",-1))),H=N((()=>b("span",{class:"field-name"},"Directus Assets token",-1))),J=N((()=>b("span",{class:"field-name"},"Directus Assets folder",-1)));var M=u({__name:"settings",setup(e){const a=m(""),l=m(""),n=m(""),c=m(!1),u=t(),p=m([]);async function f(){c.value=!0,await u.patch("/settings",{TTA_KEY:a.value,TTA_ASSETS_KEY:l.value,TTA_ASSETS_FOLDER:n.value}),setTimeout((()=>{c.value=!1}),500)}return v((async()=>{const e=await u.get("/settings");a.value=e.data.data.TTA_KEY,l.value=e.data.data.TTA_ASSETS_KEY,n.value=e.data.data.TTA_ASSETS_FOLDER;const t=await u.get("/folders");p.value=t.data.data.map((e=>({text:e.name,value:e.id})))})),(e,t)=>{const u=i("v-card-title"),m=i("v-input"),v=i("v-select"),T=i("v-card-text"),x=i("v-icon"),_=i("v-button"),A=i("v-progress-circular"),w=i("v-card-actions"),k=i("v-card"),V=i("private-view");return o(),d(V,{title:"Settings"},{navigation:s((()=>[r(F)])),default:s((()=>[b("div",Y,[r(k,{class:"w-full"},{default:s((()=>[r(u,null,{default:s((()=>[g("API settings")])),_:1}),r(T,{class:"fields-spacing"},{default:s((()=>[b("div",null,[Q,r(m,{modelValue:a.value,"onUpdate:modelValue":t[0]||(t[0]=e=>a.value=e)},null,8,["modelValue"])]),b("div",null,[H,r(m,{modelValue:l.value,"onUpdate:modelValue":t[1]||(t[1]=e=>l.value=e)},null,8,["modelValue"])]),b("div",null,[J,r(v,{modelValue:n.value,"onUpdate:modelValue":t[2]||(t[2]=e=>n.value=e),items:p.value,placeholder:"Assets folder"},null,8,["modelValue","items"])])])),_:1}),r(w,null,{default:s((()=>[r(_,{href:"https://rapidapi.com/Attacler/api/text-to-anything",target:"_blank"},{default:s((()=>[r(x,{name:"open_in_new"}),g(" Get RapidAPI token ")])),_:1}),r(_,{onClick:f,disabled:c.value},{default:s((()=>[c.value?(o(),d(A,{key:1,small:!0,indeterminate:""})):(o(),h(y,{key:0},[g(" Save ")],64))])),_:1},8,["disabled"])])),_:1})])),_:1})])])),_:1})}}});K("\n.w-full[data-v-014dce90] {\n width: 100%;\n}\n.px-5[data-v-014dce90] {\n padding: 0 2.5rem;\n}\n.fields-spacing[data-v-014dce90] {\n display: flex;\n flex-direction: column;\n gap: 10px;\n}\n",{}),M.__scopeId="data-v-014dce90",M.__file="settingsmodule/src/settings.vue";var B=u({__name:"usage",setup:e=>(e,t)=>{const a=i("private-view");return o(),d(a,{title:"Usage"},{navigation:s((()=>[r(F)])),default:s((()=>[g(" Comming soon! ")])),_:1})}});B.__file="settingsmodule/src/usage.vue";var W=l({id:"tta_settings",name:"Text to anything settings",icon:"text_fields",routes:[{path:"",redirect:"/tta_settings/templates"},{path:"templates",component:I},{path:"settings",component:M},{path:"usage",component:B}]}),$=u({__name:"interface",props:["value"],emits:["input"],setup(e,{emit:t}){const a=e,l=V("api"),n=m(""),s=m([]);return v((async()=>{n.value=a.value,f((()=>n.value),((e,a)=>{e!=a&&t("input",e)}));const e=await l.get("/items/TTA_htmltemplates");s.value=e.data.data.map((e=>({text:e.name,value:e.id})))})),(e,t)=>{const a=i("v-select");return o(),d(a,{modelValue:n.value,"onUpdate:modelValue":t[0]||(t[0]=e=>n.value=e),items:s.value},null,8,["modelValue","items"])}}});$.__file="PDFTemplateSelector/src/interface.vue";const X=[n({id:"TTA-pdf-template-selector",name:"PDF template selector",icon:"box",description:"Selector for a PDF template for Text To Anything",component:$,options:null,types:["string"]})],Z=[],ee=[],te=[W],ae=[],le=[S,C,E,D];export{Z as displays,X as interfaces,ee as layouts,te as modules,le as operations,ae as panels};
|