ts-glitter 13.4.7 → 13.4.8
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/lowcode/Entry.js +1 -1
- package/lowcode/Entry.ts +1 -1
- package/lowcode/backend-manager/bg-blog.js +466 -413
- package/lowcode/backend-manager/bg-blog.ts +1298 -1244
- package/lowcode/form-view/editor/array-items.js +1 -1
- package/lowcode/form-view/editor/array-items.ts +1 -1
- package/lowcode/form-view/editor/color-selector.ts +1 -1
- package/lowcode/glitterBundle/Glitter.js +9 -2
- package/lowcode/glitterBundle/Glitter.ts +9 -2
- package/lowcode/jspage/editor.js +15 -9
- package/lowcode/jspage/editor.ts +16 -10
- package/lowcode/jspage/main.js +52 -24
- package/lowcode/jspage/main.ts +91 -50
- package/lowcode/official_view_component/official/form.js +110 -78
- package/lowcode/official_view_component/official/form.ts +238 -192
- package/package.json +1 -1
- package/src/api-public/controllers/article.js +3 -0
- package/src/api-public/controllers/article.js.map +1 -1
- package/src/api-public/controllers/article.ts +3 -0
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
1
|
+
import {HtmlJson, Plugin} from '../../glitterBundle/plugins/plugin-creater.js';
|
|
2
|
+
import {Glitter} from '../../glitterBundle/Glitter.js';
|
|
3
|
+
import {GVC} from '../../glitterBundle/GVController.js';
|
|
4
|
+
import {TriggerEvent} from '../../glitterBundle/plugins/trigger-event.js';
|
|
5
|
+
import {EditorElem} from '../../glitterBundle/plugins/editor-elem.js';
|
|
6
|
+
import {getInitialData} from '../initial_data.js';
|
|
7
7
|
//@ts-ignore
|
|
8
8
|
import autosize from '../../glitterBundle/plugins/autosize.js';
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
9
|
+
import {ApiPageConfig} from '../../api/pageConfig.js';
|
|
10
|
+
import {NormalPageEditor} from '../../editor/normal-page-editor.js';
|
|
11
11
|
|
|
12
12
|
export class FormWidget {
|
|
13
13
|
public static settingView(obj: {
|
|
@@ -24,9 +24,11 @@ export class FormWidget {
|
|
|
24
24
|
const gvc = obj.gvc;
|
|
25
25
|
const array = obj.array;
|
|
26
26
|
const glitter = obj.gvc.glitter;
|
|
27
|
-
|
|
27
|
+
|
|
28
|
+
function refresh() {
|
|
28
29
|
obj.refresh && obj.refresh();
|
|
29
30
|
}
|
|
31
|
+
|
|
30
32
|
if (obj.user_mode) {
|
|
31
33
|
array.map((dd: any) => {
|
|
32
34
|
dd.toggle = false;
|
|
@@ -39,9 +41,13 @@ export class FormWidget {
|
|
|
39
41
|
return new Promise((resolve) => {
|
|
40
42
|
(window as any).glitter.getModule(glitter.root_path + `cms-plugin/module/form-module.js`, (module: any) => {
|
|
41
43
|
resolve(
|
|
42
|
-
module.editor(gvc, array, html`
|
|
44
|
+
module.editor(gvc, array, html`
|
|
45
|
+
<div class="tx_normal fw-bolder d-flex flex-column"
|
|
46
|
+
style="margin-bottom: 12px;">${obj.title ?? '表單項目'}
|
|
47
|
+
</div> `, () => {
|
|
43
48
|
refresh();
|
|
44
|
-
}) + html
|
|
49
|
+
}) + html`
|
|
50
|
+
<div class="w-100 border-top my-3"></div>`
|
|
45
51
|
);
|
|
46
52
|
});
|
|
47
53
|
});
|
|
@@ -79,9 +85,11 @@ export class FormWidget {
|
|
|
79
85
|
view: () => {
|
|
80
86
|
const html = String.raw;
|
|
81
87
|
return html`${[
|
|
82
|
-
html
|
|
83
|
-
<
|
|
84
|
-
|
|
88
|
+
html`
|
|
89
|
+
<div class="position-relative bgf6 d-flex align-items-center justify-content-between mx-n2 mt-n2 p-2 border-bottom shadow">
|
|
90
|
+
<span class="fs-6 fw-bold "
|
|
91
|
+
style="color:black;">表單插件設定</span>
|
|
92
|
+
</div>`,
|
|
85
93
|
EditorElem.editeInput({
|
|
86
94
|
gvc: gvc,
|
|
87
95
|
title: 'Label名稱',
|
|
@@ -159,40 +167,47 @@ export class FormWidget {
|
|
|
159
167
|
});
|
|
160
168
|
})
|
|
161
169
|
),
|
|
162
|
-
html`<div class="position-relative bgf6 d-flex align-items-center justify-content-between mx-n2 border-top p-2 border-bottom shadow">
|
|
163
|
-
<span class="fs-6 fw-bold " style="color:black;">表單設計</span>
|
|
164
|
-
</div>`,
|
|
165
170
|
html`
|
|
166
|
-
<div class="
|
|
167
|
-
|
|
171
|
+
<div class="position-relative bgf6 d-flex align-items-center justify-content-between mx-n2 border-top p-2 border-bottom shadow">
|
|
172
|
+
<span class="fs-6 fw-bold " style="color:black;">表單設計</span>
|
|
173
|
+
</div>`,
|
|
174
|
+
html`
|
|
175
|
+
<div class="alert alert-info fs-6 fw-500"
|
|
176
|
+
style="white-space: normal;">
|
|
177
|
+
一列有12格,可自定義手機版與電腦版每列的顯示格數
|
|
178
|
+
</div>
|
|
179
|
+
<div class="d-flex align-items-center"
|
|
180
|
+
style="gap:10px;">
|
|
168
181
|
<div class="fs-6 fw-500">電腦版</div>
|
|
169
182
|
<input
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
183
|
+
class="form-control flex-fill"
|
|
184
|
+
type="number"
|
|
185
|
+
placeholder=""
|
|
186
|
+
value="${dd.col}"
|
|
187
|
+
onchange="${obj.gvc.event((e, event) => {
|
|
188
|
+
dd.col = e.value;
|
|
189
|
+
})}"
|
|
177
190
|
/>
|
|
178
191
|
<div class="fs-6 fw-500">手機版</div>
|
|
179
192
|
<input
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
193
|
+
class="form-control flex-fill"
|
|
194
|
+
type="number"
|
|
195
|
+
value="${dd.col_sm}"
|
|
196
|
+
onchange="${obj.gvc.event((e, event) => {
|
|
197
|
+
dd.col_sm = e.value;
|
|
198
|
+
})}"
|
|
199
|
+
placeholder=""
|
|
187
200
|
/>
|
|
188
201
|
</div>
|
|
189
202
|
`,
|
|
190
203
|
];
|
|
191
204
|
if (!obj.user_mode) {
|
|
192
205
|
config_array = config_array.concat([
|
|
193
|
-
html
|
|
194
|
-
<
|
|
195
|
-
|
|
206
|
+
html`
|
|
207
|
+
<div class="position-relative bgf6 d-flex align-items-center justify-content-between mx-n2 border-top p-2 border-bottom shadow">
|
|
208
|
+
<span class="fs-6 fw-bold "
|
|
209
|
+
style="color:black;">進階設定</span>
|
|
210
|
+
</div>`,
|
|
196
211
|
EditorElem.editeInput({
|
|
197
212
|
gvc: gvc,
|
|
198
213
|
title: 'Key標籤',
|
|
@@ -266,16 +281,19 @@ export class FormWidget {
|
|
|
266
281
|
if (formFormat && formFormat.length > 0) {
|
|
267
282
|
dd.form_config = dd.form_config || {};
|
|
268
283
|
resolve(
|
|
269
|
-
html
|
|
270
|
-
|
|
284
|
+
html`
|
|
285
|
+
<div
|
|
286
|
+
class="position-relative bgf6 d-flex align-items-center justify-content-between mx-n2 border-top p-2 border-bottom shadow"
|
|
271
287
|
>
|
|
272
|
-
<span class="fs-6 fw-bold "
|
|
288
|
+
<span class="fs-6 fw-bold "
|
|
289
|
+
style="color:black;">插件內容編輯</span>
|
|
273
290
|
</div>
|
|
274
291
|
<div class="mx-n2">
|
|
275
292
|
${FormWidget.editorView({
|
|
276
293
|
gvc: gvc,
|
|
277
294
|
array: formFormat,
|
|
278
|
-
refresh: (key: string) => {
|
|
295
|
+
refresh: (key: string) => {
|
|
296
|
+
},
|
|
279
297
|
formData: dd.form_config,
|
|
280
298
|
})}
|
|
281
299
|
</div>`
|
|
@@ -378,11 +396,20 @@ export class FormWidget {
|
|
|
378
396
|
});
|
|
379
397
|
}
|
|
380
398
|
|
|
381
|
-
public static editorView(obj: {
|
|
399
|
+
public static editorView(obj: {
|
|
400
|
+
gvc: GVC;
|
|
401
|
+
array: any;
|
|
402
|
+
refresh: (key: string) => void;
|
|
403
|
+
widget?: any;
|
|
404
|
+
subData?: any;
|
|
405
|
+
formData: any;
|
|
406
|
+
readonly?: 'read' | 'write' | 'block'
|
|
407
|
+
}) {
|
|
382
408
|
const html = String.raw;
|
|
383
409
|
const glitter = obj.gvc.glitter;
|
|
384
410
|
const gvc = obj.gvc;
|
|
385
411
|
const formData = obj.formData;
|
|
412
|
+
|
|
386
413
|
function getRaw(array: []) {
|
|
387
414
|
return array
|
|
388
415
|
.map(
|
|
@@ -417,13 +444,13 @@ export class FormWidget {
|
|
|
417
444
|
col?: any;
|
|
418
445
|
col_sm?: any;
|
|
419
446
|
}) => {
|
|
420
|
-
const form_data=formData;
|
|
421
|
-
const form_key=dd.key;
|
|
447
|
+
const form_data = formData;
|
|
448
|
+
const form_key = dd.key;
|
|
422
449
|
const labelCSS = glitter.htmlGenerate.editor_component(dd.style_data.label, gvc, obj.widget, obj.subData);
|
|
423
450
|
const inputCSS = glitter.htmlGenerate.editor_component(dd.style_data.input, gvc, obj.widget as any, obj.subData);
|
|
424
451
|
const containerCss = glitter.htmlGenerate.editor_component(dd.style_data.container, gvc, obj.widget, obj.subData);
|
|
425
452
|
const label = html`<label class="${labelCSS.class()}" style="${labelCSS.style()}"
|
|
426
|
-
|
|
453
|
+
><span class="text-danger ${dd.require === 'true' ? `` : 'd-none'}"> * </span>${dd.title}</label
|
|
427
454
|
>`;
|
|
428
455
|
const containerClass = `${dd.col ? `col-sm-${dd.col}` : 'col-sm-12'} ${dd.col_sm ? `col-${dd.col_sm}` : 'col-12'} ${containerCss.class() ?? ``}`;
|
|
429
456
|
const containerStyle = containerCss.style() ?? ``;
|
|
@@ -440,39 +467,40 @@ export class FormWidget {
|
|
|
440
467
|
switch (dd.type) {
|
|
441
468
|
case 'textArea':
|
|
442
469
|
const textID = gvc.glitter.getUUID();
|
|
443
|
-
return html`
|
|
444
|
-
${
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
470
|
+
return html`
|
|
471
|
+
<div class="${containerClass}" style="${containerStyle}">
|
|
472
|
+
${label}
|
|
473
|
+
${obj.gvc.bindView({
|
|
474
|
+
bind: textID,
|
|
475
|
+
view: () => {
|
|
476
|
+
return formData[dd.key] ?? '';
|
|
477
|
+
},
|
|
478
|
+
divCreate: {
|
|
479
|
+
elem: `textArea`,
|
|
480
|
+
style: inputStyle,
|
|
481
|
+
class: inputClass,
|
|
482
|
+
option: [
|
|
483
|
+
{
|
|
484
|
+
key: 'onchange',
|
|
485
|
+
value: obj.gvc.event((e) => {
|
|
486
|
+
formData[dd.key] = e.value;
|
|
487
|
+
obj.refresh(dd.key);
|
|
488
|
+
}),
|
|
489
|
+
},
|
|
490
|
+
...(() => {
|
|
491
|
+
if (readonly) {
|
|
492
|
+
return [{key: 'readonly', value: ''}];
|
|
493
|
+
} else {
|
|
494
|
+
return [];
|
|
495
|
+
}
|
|
496
|
+
})(),
|
|
497
|
+
],
|
|
498
|
+
},
|
|
499
|
+
onCreate: () => {
|
|
500
|
+
autosize(obj.gvc.getBindViewElem(textID));
|
|
501
|
+
},
|
|
502
|
+
})}
|
|
503
|
+
</div>`;
|
|
476
504
|
case 'array':
|
|
477
505
|
formData[dd.key] = Array.isArray(formData[dd.key]) ? formData[dd.key] : [];
|
|
478
506
|
return gvc.bindView(() => {
|
|
@@ -480,49 +508,51 @@ export class FormWidget {
|
|
|
480
508
|
return {
|
|
481
509
|
bind: arrayViewID,
|
|
482
510
|
view: () => {
|
|
483
|
-
return html`
|
|
484
|
-
${
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
return {
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
},
|
|
516
|
-
plus: {
|
|
517
|
-
title: dd.plusBtn!,
|
|
518
|
-
event: gvc.event(() => {
|
|
519
|
-
formData[dd.key].push({});
|
|
520
|
-
gvc.notifyDataChange(arrayViewID);
|
|
511
|
+
return html`
|
|
512
|
+
<div class="${containerClass} mt-2" style="${containerStyle}">
|
|
513
|
+
${label}
|
|
514
|
+
${EditorElem.arrayItem({
|
|
515
|
+
gvc: gvc,
|
|
516
|
+
title: '',
|
|
517
|
+
array: () => {
|
|
518
|
+
return formData[dd.key].map((d2: any, index: number) => {
|
|
519
|
+
return {
|
|
520
|
+
title: d2[dd.referTitile!] || `選項:${index + 1}`,
|
|
521
|
+
innerHtml: (gvc: GVC) => {
|
|
522
|
+
return html`
|
|
523
|
+
<div class="my-2">
|
|
524
|
+
${FormWidget.editorView({
|
|
525
|
+
gvc: gvc,
|
|
526
|
+
array: dd.formList,
|
|
527
|
+
refresh: (key: string) => {
|
|
528
|
+
obj.refresh(dd.key);
|
|
529
|
+
},
|
|
530
|
+
widget: obj.widget,
|
|
531
|
+
subData: obj.subData,
|
|
532
|
+
formData: d2,
|
|
533
|
+
readonly: obj.readonly,
|
|
534
|
+
})}
|
|
535
|
+
</div>`;
|
|
536
|
+
},
|
|
537
|
+
};
|
|
538
|
+
});
|
|
539
|
+
},
|
|
540
|
+
originalArray: formData[dd.key],
|
|
541
|
+
expand: {},
|
|
542
|
+
refreshComponent: () => {
|
|
521
543
|
obj.refresh(dd.key);
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
544
|
+
gvc.notifyDataChange(arrayViewID);
|
|
545
|
+
},
|
|
546
|
+
plus: {
|
|
547
|
+
title: dd.plusBtn!,
|
|
548
|
+
event: gvc.event(() => {
|
|
549
|
+
formData[dd.key].push({});
|
|
550
|
+
gvc.notifyDataChange(arrayViewID);
|
|
551
|
+
obj.refresh(dd.key);
|
|
552
|
+
}),
|
|
553
|
+
},
|
|
554
|
+
})}
|
|
555
|
+
</div>`;
|
|
526
556
|
},
|
|
527
557
|
};
|
|
528
558
|
});
|
|
@@ -572,30 +602,32 @@ export class FormWidget {
|
|
|
572
602
|
}
|
|
573
603
|
);
|
|
574
604
|
case 'fontawesome':
|
|
575
|
-
return html
|
|
576
|
-
${
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
605
|
+
return html`
|
|
606
|
+
<div class="${containerClass}" style="${containerStyle}">
|
|
607
|
+
${label}
|
|
608
|
+
<div class="alert alert-info p-2 mb-2"
|
|
609
|
+
style="word-break: break-word;white-space: normal;">
|
|
610
|
+
前往<a
|
|
611
|
+
onclick="${gvc.event(() => {
|
|
612
|
+
glitter.openNewTab('https://fontawesome.com');
|
|
613
|
+
})}"
|
|
614
|
+
style="cursor: pointer;"
|
|
615
|
+
class="mx-2 fw-bold mb-1"
|
|
616
|
+
>Fontawesome</a
|
|
585
617
|
>官網,查找ICON標籤。
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
618
|
+
</div>
|
|
619
|
+
<input
|
|
620
|
+
type="text"
|
|
621
|
+
value="${formData[dd.key] ?? ''}"
|
|
622
|
+
class="${inputClass}"
|
|
623
|
+
style="${inputStyle}"
|
|
624
|
+
onchange="${gvc.event((e, event) => {
|
|
625
|
+
formData[dd.key] = e.value;
|
|
626
|
+
obj.refresh(dd.key);
|
|
627
|
+
})}"
|
|
628
|
+
${readonly ? `readonly` : ``}
|
|
629
|
+
/>
|
|
630
|
+
</div>`;
|
|
599
631
|
case 'form_plugin':
|
|
600
632
|
return gvc.bindView(() => {
|
|
601
633
|
return {
|
|
@@ -621,10 +653,13 @@ export class FormWidget {
|
|
|
621
653
|
};
|
|
622
654
|
});
|
|
623
655
|
case 'form_plugin_v2':
|
|
624
|
-
if (dd.hidden_code && dd.hidden_code.trim() && eval(`(() => {
|
|
656
|
+
if (dd.hidden_code && dd.hidden_code.trim() && eval(`(() => {
|
|
657
|
+
${dd.hidden_code}
|
|
658
|
+
})()`)) {
|
|
625
659
|
return ``;
|
|
626
660
|
}
|
|
627
661
|
return gvc.bindView(() => {
|
|
662
|
+
|
|
628
663
|
const tempView = gvc.glitter.getUUID();
|
|
629
664
|
return {
|
|
630
665
|
bind: tempView,
|
|
@@ -635,7 +670,8 @@ export class FormWidget {
|
|
|
635
670
|
class: containerClass,
|
|
636
671
|
style: containerStyle,
|
|
637
672
|
},
|
|
638
|
-
onCreate: () => {
|
|
673
|
+
onCreate: () => {
|
|
674
|
+
},
|
|
639
675
|
onInitial: () => {
|
|
640
676
|
const target = gvc.glitter.document.querySelector(`[gvc-id="${gvc.id(tempView)}"]`);
|
|
641
677
|
(window as any).glitterInitialHelper.getPageData(
|
|
@@ -668,8 +704,9 @@ export class FormWidget {
|
|
|
668
704
|
dd.formData = undefined;
|
|
669
705
|
});
|
|
670
706
|
}
|
|
671
|
-
|
|
672
707
|
loop(viewConfig);
|
|
708
|
+
console.log(`formPage==>`,(dd as any).page)
|
|
709
|
+
console.log(`viewConfig===>`,viewConfig)
|
|
673
710
|
return new glitter.htmlGenerate(viewConfig, [], {
|
|
674
711
|
root_form_data: obj.widget && obj.widget.formData,
|
|
675
712
|
root_widget: obj.widget,
|
|
@@ -686,8 +723,10 @@ export class FormWidget {
|
|
|
686
723
|
class: containerClass,
|
|
687
724
|
style: containerStyle,
|
|
688
725
|
containerID: id,
|
|
689
|
-
jsFinish: () => {
|
|
690
|
-
|
|
726
|
+
jsFinish: () => {
|
|
727
|
+
},
|
|
728
|
+
onCreate: () => {
|
|
729
|
+
},
|
|
691
730
|
},
|
|
692
731
|
createOption ?? {}
|
|
693
732
|
);
|
|
@@ -695,7 +734,8 @@ export class FormWidget {
|
|
|
695
734
|
|
|
696
735
|
try {
|
|
697
736
|
target && (target!.outerHTML = getView());
|
|
698
|
-
} catch (e) {
|
|
737
|
+
} catch (e) {
|
|
738
|
+
}
|
|
699
739
|
}
|
|
700
740
|
);
|
|
701
741
|
},
|
|
@@ -707,16 +747,16 @@ export class FormWidget {
|
|
|
707
747
|
<div class=" ${containerClass}" style="${containerStyle}">
|
|
708
748
|
${label}
|
|
709
749
|
<input
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
750
|
+
type="${dd.type}"
|
|
751
|
+
value="${formData[dd.key] ?? ''}"
|
|
752
|
+
class="${inputClass}"
|
|
753
|
+
style="${inputStyle}"
|
|
754
|
+
onchange="${gvc.event((e, event) => {
|
|
755
|
+
formData[dd.key] = e.value;
|
|
756
|
+
obj.refresh(dd.key);
|
|
757
|
+
})}"
|
|
758
|
+
placeholder="${dd.placeHolder ?? ''}"
|
|
759
|
+
${readonly ? `readonly` : ``}
|
|
720
760
|
/>
|
|
721
761
|
</div>
|
|
722
762
|
`;
|
|
@@ -734,25 +774,27 @@ export class FormWidget {
|
|
|
734
774
|
});
|
|
735
775
|
}
|
|
736
776
|
|
|
737
|
-
return html
|
|
738
|
-
|
|
739
|
-
.
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
777
|
+
return html`
|
|
778
|
+
<div class="row m-0 p-0">
|
|
779
|
+
${Object.keys(groupList)
|
|
780
|
+
.map((key) => {
|
|
781
|
+
if (key) {
|
|
782
|
+
let toggle = {};
|
|
783
|
+
return html`
|
|
784
|
+
<div class="mt-2">
|
|
785
|
+
${EditorElem.toggleExpand({
|
|
786
|
+
gvc: gvc,
|
|
787
|
+
title: key,
|
|
788
|
+
data: toggle,
|
|
789
|
+
innerText: getRaw(groupList[key]),
|
|
790
|
+
})}
|
|
791
|
+
</div>`;
|
|
792
|
+
} else {
|
|
793
|
+
return getRaw(groupList[key]);
|
|
794
|
+
}
|
|
795
|
+
})
|
|
796
|
+
.join('')}
|
|
797
|
+
</div>`;
|
|
756
798
|
}
|
|
757
799
|
}
|
|
758
800
|
|
|
@@ -824,8 +866,8 @@ Plugin.createComponent(import.meta.url, (glitter: Glitter, editMode: boolean) =>
|
|
|
824
866
|
title: '表單ID來源',
|
|
825
867
|
gvc: gvc,
|
|
826
868
|
array: [
|
|
827
|
-
{
|
|
828
|
-
{
|
|
869
|
+
{title: '靜態', value: 'static'},
|
|
870
|
+
{title: '動態', value: 'code'},
|
|
829
871
|
],
|
|
830
872
|
def: config.form_id_from,
|
|
831
873
|
callback: (text: any) => {
|
|
@@ -867,8 +909,8 @@ Plugin.createComponent(import.meta.url, (glitter: Glitter, editMode: boolean) =>
|
|
|
867
909
|
title: '表單格式來源',
|
|
868
910
|
gvc: gvc,
|
|
869
911
|
array: [
|
|
870
|
-
{
|
|
871
|
-
{
|
|
912
|
+
{title: '靜態', value: 'static'},
|
|
913
|
+
{title: '動態', value: 'code'},
|
|
872
914
|
],
|
|
873
915
|
def: config.form_config_from,
|
|
874
916
|
callback: (text) => {
|
|
@@ -884,17 +926,18 @@ Plugin.createComponent(import.meta.url, (glitter: Glitter, editMode: boolean) =>
|
|
|
884
926
|
title: '取得表單格式',
|
|
885
927
|
});
|
|
886
928
|
} else {
|
|
887
|
-
return html
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
929
|
+
return html`
|
|
930
|
+
<div class="mx-n2">
|
|
931
|
+
${FormWidget.settingView({
|
|
932
|
+
gvc: gvc,
|
|
933
|
+
array: config.array,
|
|
934
|
+
refresh: () => {
|
|
935
|
+
widget.refreshComponent();
|
|
936
|
+
},
|
|
937
|
+
widget: widget,
|
|
938
|
+
subData: subData,
|
|
939
|
+
})}
|
|
940
|
+
</div>`;
|
|
898
941
|
}
|
|
899
942
|
})(),
|
|
900
943
|
].join('<div class="my-2"></div>');
|
|
@@ -907,6 +950,7 @@ Plugin.createComponent(import.meta.url, (glitter: Glitter, editMode: boolean) =>
|
|
|
907
950
|
view: () => {
|
|
908
951
|
return gvc.bindView(() => {
|
|
909
952
|
let form_config_list: any = config.array;
|
|
953
|
+
|
|
910
954
|
function checkEditFinish() {
|
|
911
955
|
return !form_config_list.find((dd: any) => {
|
|
912
956
|
return dd.require === 'true' && !formData[dd.key];
|
|
@@ -915,6 +959,7 @@ Plugin.createComponent(import.meta.url, (glitter: Glitter, editMode: boolean) =>
|
|
|
915
959
|
|
|
916
960
|
const id = glitter.getUUID();
|
|
917
961
|
let formID: any = config.formID;
|
|
962
|
+
|
|
918
963
|
async function getFormData() {
|
|
919
964
|
const data = await TriggerEvent.trigger({
|
|
920
965
|
gvc: gvc,
|
|
@@ -937,6 +982,7 @@ Plugin.createComponent(import.meta.url, (glitter: Glitter, editMode: boolean) =>
|
|
|
937
982
|
gvc.notifyDataChange(id);
|
|
938
983
|
return formData;
|
|
939
984
|
}
|
|
985
|
+
|
|
940
986
|
let dyView = '';
|
|
941
987
|
let defineHeight = 0;
|
|
942
988
|
|