ts-glitter 21.7.2 → 21.7.3
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 +2 -2
- package/lowcode/Entry.ts +2 -2
- package/lowcode/api/pageConfig.js +15 -1
- package/lowcode/api/pageConfig.ts +15 -13
- package/lowcode/cms-plugin/line-auto-reply.js +1 -0
- package/lowcode/cms-plugin/line-auto-reply.ts +1 -0
- package/lowcode/cms-plugin/menus-setting.js +4 -4
- package/lowcode/cms-plugin/menus-setting.ts +4 -4
- package/lowcode/cms-plugin/shopping-market-shopee.js +2 -20
- package/lowcode/cms-plugin/shopping-market-shopee.ts +3 -19
- package/lowcode/cms-plugin/shopping-order-manager.ts +1 -0
- package/lowcode/editor-components/global-widget/bridge.js +95 -3
- package/lowcode/editor-components/global-widget/bridge.ts +124 -115
- package/lowcode/glitter-base/route/shopee.js +0 -2
- package/lowcode/glitter-base/route/shopee.ts +0 -2
- package/lowcode/glitterBundle/html-component/global-widget.js +37 -11
- package/lowcode/glitterBundle/html-component/global-widget.ts +75 -14
- package/lowcode/jspage/main.js +152 -68
- package/lowcode/jspage/main.ts +155 -80
- package/lowcode/modules/image-library.js +70 -86
- package/lowcode/modules/image-library.ts +98 -119
- package/lowcode/official_view_component/official/component.js +17 -15
- package/lowcode/official_view_component/official/component.ts +20 -15
- package/lowcode/official_view_component/official/form.js +186 -159
- package/lowcode/official_view_component/official/form.ts +1150 -1068
- package/lowcode/public-components/blogs/blogs-01.js +20 -4
- package/lowcode/public-components/blogs/blogs-01.ts +25 -4
- package/lowcode/public-components/footer/footer-01.js +1 -1
- package/lowcode/public-components/footer/footer-01.ts +2 -1
- package/lowcode/public-components/footer/footer-02.js +1 -1
- package/lowcode/public-components/footer/footer-02.ts +1 -1
- package/lowcode/public-components/footer/footer-03.js +1 -1
- package/lowcode/public-components/footer/footer-03.ts +1 -1
- package/package.json +1 -1
- package/src/api-public/controllers/shopee.js +10 -0
- package/src/api-public/controllers/shopee.js.map +1 -1
- package/src/api-public/controllers/shopee.ts +12 -12
- package/src/api-public/services/auto-send-email.js +16 -0
- package/src/api-public/services/auto-send-email.js.map +1 -1
- package/src/api-public/services/auto-send-email.ts +16 -0
- package/src/api-public/services/checkout-event.js +13 -17
- package/src/api-public/services/checkout-event.js.map +1 -1
- package/src/api-public/services/checkout-event.ts +9 -1
- package/src/api-public/services/data-analyze.d.ts +1 -1
- package/src/api-public/services/line-message.js +1 -0
- package/src/api-public/services/line-message.js.map +1 -1
- package/src/api-public/services/line-message.ts +2 -0
- package/src/api-public/services/shopee.d.ts +4 -3
- package/src/api-public/services/shopee.js +28 -24
- package/src/api-public/services/shopee.js.map +1 -1
- package/src/api-public/services/shopee.ts +30 -24
- package/src/api-public/services/shopping.js +2 -7
- package/src/api-public/services/shopping.js.map +1 -1
- package/src/api-public/services/shopping.ts +5 -14
- package/src/index.js +3 -3
- package/src/modules/database.d.ts +1 -1
- package/src/public-config-initial/auto-fcm.js +4 -0
- package/src/public-config-initial/auto-fcm.js.map +1 -1
- package/src/public-config-initial/auto-fcm.ts +7 -1
- package/src/seo-config.js +0 -1
- package/src/seo-config.js.map +1 -1
- package/src/seo-config.ts +0 -1
- package/src/services/template.js +10 -0
- package/src/services/template.js.map +1 -1
- package/src/services/template.ts +9 -0
|
@@ -14,6 +14,7 @@ import { getInitialData } from '../initial_data.js';
|
|
|
14
14
|
import autosize from '../../glitterBundle/plugins/autosize.js';
|
|
15
15
|
import { ApiPageConfig } from '../../api/pageConfig.js';
|
|
16
16
|
import { NormalPageEditor } from '../../editor/normal-page-editor.js';
|
|
17
|
+
const html = String.raw;
|
|
17
18
|
export class FormWidget {
|
|
18
19
|
static settingView(obj) {
|
|
19
20
|
var _a;
|
|
@@ -32,16 +33,16 @@ export class FormWidget {
|
|
|
32
33
|
bind: gvc.glitter.getUUID(),
|
|
33
34
|
view: () => {
|
|
34
35
|
const html = String.raw;
|
|
35
|
-
return new Promise(
|
|
36
|
+
return new Promise(resolve => {
|
|
36
37
|
window.glitter.getModule(glitter.root_path + `cms-plugin/module/form-module.js`, (module) => {
|
|
37
38
|
var _a;
|
|
38
39
|
resolve(module.editor(gvc, array, html `
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
40
|
+
<div class="tx_normal fw-bolder d-flex flex-column" style="margin-bottom: 12px;">
|
|
41
|
+
${(_a = obj.title) !== null && _a !== void 0 ? _a : '表單項目'}
|
|
42
|
+
</div>
|
|
43
|
+
`, () => {
|
|
42
44
|
refresh();
|
|
43
|
-
}) + html `
|
|
44
|
-
<div class="w-100 border-top my-3"></div>`);
|
|
45
|
+
}) + html ` <div class="w-100 border-top my-3"></div>`);
|
|
45
46
|
});
|
|
46
47
|
});
|
|
47
48
|
},
|
|
@@ -79,17 +80,17 @@ export class FormWidget {
|
|
|
79
80
|
view: () => {
|
|
80
81
|
const html = String.raw;
|
|
81
82
|
return html `${[
|
|
82
|
-
html `
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
83
|
+
html ` <div
|
|
84
|
+
class="position-relative bgf6 d-flex align-items-center justify-content-between mx-n2 mt-n2 p-2 border-bottom shadow"
|
|
85
|
+
>
|
|
86
|
+
<span class="fs-6 fw-bold " style="color:black;">表單插件設定</span>
|
|
87
|
+
</div>`,
|
|
87
88
|
EditorElem.editeInput({
|
|
88
89
|
gvc: gvc,
|
|
89
90
|
title: 'Label名稱',
|
|
90
91
|
placeHolder: `請輸入Label名稱`,
|
|
91
92
|
default: dd.title,
|
|
92
|
-
callback:
|
|
93
|
+
callback: text => {
|
|
93
94
|
dd.title = text;
|
|
94
95
|
if (obj.user_mode) {
|
|
95
96
|
dd.key = text;
|
|
@@ -111,7 +112,7 @@ export class FormWidget {
|
|
|
111
112
|
value: 'false',
|
|
112
113
|
},
|
|
113
114
|
],
|
|
114
|
-
callback:
|
|
115
|
+
callback: text => {
|
|
115
116
|
dd.require = text;
|
|
116
117
|
gvc.notifyDataChange(id);
|
|
117
118
|
},
|
|
@@ -147,53 +148,52 @@ export class FormWidget {
|
|
|
147
148
|
title: '選擇插件',
|
|
148
149
|
});
|
|
149
150
|
})),
|
|
151
|
+
html ` <div
|
|
152
|
+
class="position-relative bgf6 d-flex align-items-center justify-content-between mx-n2 border-top p-2 border-bottom shadow"
|
|
153
|
+
>
|
|
154
|
+
<span class="fs-6 fw-bold " style="color:black;">表單設計</span>
|
|
155
|
+
</div>`,
|
|
150
156
|
html `
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
<input
|
|
163
|
-
class="form-control flex-fill"
|
|
164
|
-
type="number"
|
|
165
|
-
placeholder=""
|
|
166
|
-
value="${dd.col}"
|
|
167
|
-
onchange="${obj.gvc.event((e, event) => {
|
|
157
|
+
<div class="alert alert-info fs-6 fw-500" style="white-space: normal;">
|
|
158
|
+
一列有12格,可自定義手機版與電腦版每列的顯示格數
|
|
159
|
+
</div>
|
|
160
|
+
<div class="d-flex align-items-center" style="gap:10px;">
|
|
161
|
+
<div class="fs-6 fw-500">電腦版</div>
|
|
162
|
+
<input
|
|
163
|
+
class="form-control flex-fill"
|
|
164
|
+
type="number"
|
|
165
|
+
placeholder=""
|
|
166
|
+
value="${dd.col}"
|
|
167
|
+
onchange="${obj.gvc.event((e, event) => {
|
|
168
168
|
dd.col = e.value;
|
|
169
169
|
})}"
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
170
|
+
/>
|
|
171
|
+
<div class="fs-6 fw-500">手機版</div>
|
|
172
|
+
<input
|
|
173
|
+
class="form-control flex-fill"
|
|
174
|
+
type="number"
|
|
175
|
+
value="${dd.col_sm}"
|
|
176
|
+
onchange="${obj.gvc.event((e, event) => {
|
|
177
177
|
dd.col_sm = e.value;
|
|
178
178
|
})}"
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
179
|
+
placeholder=""
|
|
180
|
+
/>
|
|
181
|
+
</div>
|
|
182
|
+
`,
|
|
183
183
|
];
|
|
184
184
|
if (!obj.user_mode) {
|
|
185
185
|
config_array = config_array.concat([
|
|
186
|
-
html `
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
186
|
+
html ` <div
|
|
187
|
+
class="position-relative bgf6 d-flex align-items-center justify-content-between mx-n2 border-top p-2 border-bottom shadow"
|
|
188
|
+
>
|
|
189
|
+
<span class="fs-6 fw-bold " style="color:black;">進階設定</span>
|
|
190
|
+
</div>`,
|
|
191
191
|
EditorElem.editeInput({
|
|
192
192
|
gvc: gvc,
|
|
193
193
|
title: 'Key標籤',
|
|
194
194
|
placeHolder: `請輸入Key標籤`,
|
|
195
195
|
default: dd.key,
|
|
196
|
-
callback:
|
|
196
|
+
callback: text => {
|
|
197
197
|
dd.key = text;
|
|
198
198
|
refresh();
|
|
199
199
|
},
|
|
@@ -203,7 +203,7 @@ export class FormWidget {
|
|
|
203
203
|
title: '分類標籤',
|
|
204
204
|
placeHolder: `請輸入分類標籤`,
|
|
205
205
|
default: dd.category,
|
|
206
|
-
callback:
|
|
206
|
+
callback: text => {
|
|
207
207
|
dd.category = text;
|
|
208
208
|
refresh();
|
|
209
209
|
},
|
|
@@ -221,7 +221,7 @@ export class FormWidget {
|
|
|
221
221
|
height: 500,
|
|
222
222
|
initial: dd.hidden_code || '',
|
|
223
223
|
title: '代碼區塊',
|
|
224
|
-
callback:
|
|
224
|
+
callback: text => {
|
|
225
225
|
dd.hidden_code = text;
|
|
226
226
|
},
|
|
227
227
|
structStart: `((form_data,form_key)=>{`,
|
|
@@ -252,22 +252,19 @@ export class FormWidget {
|
|
|
252
252
|
})).response.result[0].page_config.formFormat;
|
|
253
253
|
if (formFormat && formFormat.length > 0) {
|
|
254
254
|
dd.form_config = dd.form_config || {};
|
|
255
|
-
resolve(html `
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
<div class="mx-n2">
|
|
263
|
-
${FormWidget.editorView({
|
|
255
|
+
resolve(html ` <div
|
|
256
|
+
class="position-relative bgf6 d-flex align-items-center justify-content-between mx-n2 border-top p-2 border-bottom shadow"
|
|
257
|
+
>
|
|
258
|
+
<span class="fs-6 fw-bold " style="color:black;">插件內容編輯</span>
|
|
259
|
+
</div>
|
|
260
|
+
<div class="mx-n2">
|
|
261
|
+
${FormWidget.editorView({
|
|
264
262
|
gvc: gvc,
|
|
265
263
|
array: formFormat,
|
|
266
|
-
refresh: (key) => {
|
|
267
|
-
},
|
|
264
|
+
refresh: (key) => { },
|
|
268
265
|
formData: dd.form_config,
|
|
269
266
|
})}
|
|
270
|
-
|
|
267
|
+
</div>`);
|
|
271
268
|
}
|
|
272
269
|
else {
|
|
273
270
|
if (obj.user_mode) {
|
|
@@ -279,7 +276,7 @@ export class FormWidget {
|
|
|
279
276
|
height: 400,
|
|
280
277
|
initial: dd.formFormat,
|
|
281
278
|
title: 'Config配置檔',
|
|
282
|
-
callback:
|
|
279
|
+
callback: data => {
|
|
283
280
|
dd.form_config = undefined;
|
|
284
281
|
dd.formFormat = data;
|
|
285
282
|
},
|
|
@@ -294,8 +291,7 @@ export class FormWidget {
|
|
|
294
291
|
return config_array;
|
|
295
292
|
})(),
|
|
296
293
|
].join('<div class="my-2"></div>')}
|
|
297
|
-
|
|
298
|
-
`;
|
|
294
|
+
<div style="height:50px;"></div> `;
|
|
299
295
|
},
|
|
300
296
|
divCreate: {
|
|
301
297
|
class: `p-2`,
|
|
@@ -366,6 +362,34 @@ export class FormWidget {
|
|
|
366
362
|
customEditor: true,
|
|
367
363
|
});
|
|
368
364
|
}
|
|
365
|
+
static select(obj) {
|
|
366
|
+
var _a;
|
|
367
|
+
return html ` ${obj.title ? html ` <div class="tx_normal fw-normal mb-2">${obj.title}</div>` : ``}
|
|
368
|
+
<select
|
|
369
|
+
class="c_select c_select_w_100"
|
|
370
|
+
style="${(_a = obj.style) !== null && _a !== void 0 ? _a : ''}; ${obj.readonly ? 'background: #f7f7f7;' : ''}"
|
|
371
|
+
onchange="${obj.gvc.event(e => {
|
|
372
|
+
obj.callback(e.value);
|
|
373
|
+
})}"
|
|
374
|
+
${obj.readonly ? 'disabled' : ''}
|
|
375
|
+
>
|
|
376
|
+
${obj.gvc.map(obj.options.map(opt => html ` <option class="c_select_option" value="${opt.key}" ${obj.default === opt.key ? 'selected' : ''}>
|
|
377
|
+
${opt.value}
|
|
378
|
+
</option>`))}
|
|
379
|
+
${obj.options.find((opt) => {
|
|
380
|
+
return obj.default === opt.key;
|
|
381
|
+
})
|
|
382
|
+
? ``
|
|
383
|
+
: `<option class="d-none" selected>${obj.place_holder || `請選擇項目`}</option>`}
|
|
384
|
+
</select>`;
|
|
385
|
+
}
|
|
386
|
+
static grayButton(text, event, obj) {
|
|
387
|
+
var _a;
|
|
388
|
+
return html ` <button class="btn btn-gray ${(obj === null || obj === void 0 ? void 0 : obj.class) || ''}" type="button" onclick="${event}">
|
|
389
|
+
<i class="${obj && obj.icon && obj.icon.length > 0 ? obj.icon : 'd-none'}" style="color: #393939"></i>
|
|
390
|
+
${text.length > 0 ? html `<span class="tx_700" style="${(_a = obj === null || obj === void 0 ? void 0 : obj.textStyle) !== null && _a !== void 0 ? _a : ''}">${text}</span>` : ''}
|
|
391
|
+
</button>`;
|
|
392
|
+
}
|
|
369
393
|
static editorView(obj) {
|
|
370
394
|
const html = String.raw;
|
|
371
395
|
const glitter = obj.gvc.glitter;
|
|
@@ -381,8 +405,8 @@ export class FormWidget {
|
|
|
381
405
|
const inputCSS = glitter.htmlGenerate.editor_component(dd.style_data.input, gvc, obj.widget, obj.subData);
|
|
382
406
|
const containerCss = glitter.htmlGenerate.editor_component(dd.style_data.container, gvc, obj.widget, obj.subData);
|
|
383
407
|
const label = html `<label class="${labelCSS.class()}" style="${labelCSS.style()}"
|
|
384
|
-
|
|
385
|
-
|
|
408
|
+
><span class="text-danger ${dd.require === 'true' ? `` : 'd-none'}"> * </span>${dd.title}</label
|
|
409
|
+
>`;
|
|
386
410
|
const containerClass = `${dd.col ? `col-sm-${dd.col}` : 'col-sm-12'} ${dd.col_sm ? `col-${dd.col_sm}` : 'col-12'} ${(_a = containerCss.class()) !== null && _a !== void 0 ? _a : ``}`;
|
|
387
411
|
const containerStyle = (_b = containerCss.style()) !== null && _b !== void 0 ? _b : ``;
|
|
388
412
|
const inputClass = inputCSS.class() || 'form-control';
|
|
@@ -397,10 +421,9 @@ export class FormWidget {
|
|
|
397
421
|
switch (dd.type) {
|
|
398
422
|
case 'textArea':
|
|
399
423
|
const textID = gvc.glitter.getUUID();
|
|
400
|
-
return html `
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
${obj.gvc.bindView({
|
|
424
|
+
return html ` <div class="${containerClass}" style="${containerStyle}">
|
|
425
|
+
${label}
|
|
426
|
+
${obj.gvc.bindView({
|
|
404
427
|
bind: textID,
|
|
405
428
|
view: () => {
|
|
406
429
|
var _a;
|
|
@@ -413,7 +436,7 @@ export class FormWidget {
|
|
|
413
436
|
option: [
|
|
414
437
|
{
|
|
415
438
|
key: 'onchange',
|
|
416
|
-
value: obj.gvc.event(
|
|
439
|
+
value: obj.gvc.event(e => {
|
|
417
440
|
formData[dd.key] = e.value;
|
|
418
441
|
obj.refresh(dd.key);
|
|
419
442
|
}),
|
|
@@ -432,7 +455,7 @@ export class FormWidget {
|
|
|
432
455
|
autosize(obj.gvc.getBindViewElem(textID));
|
|
433
456
|
},
|
|
434
457
|
})}
|
|
435
|
-
|
|
458
|
+
</div>`;
|
|
436
459
|
case 'array':
|
|
437
460
|
formData[dd.key] = Array.isArray(formData[dd.key]) ? formData[dd.key] : [];
|
|
438
461
|
return gvc.bindView(() => {
|
|
@@ -440,10 +463,9 @@ export class FormWidget {
|
|
|
440
463
|
return {
|
|
441
464
|
bind: arrayViewID,
|
|
442
465
|
view: () => {
|
|
443
|
-
return html `
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
${EditorElem.arrayItem({
|
|
466
|
+
return html ` <div class="${containerClass} mt-2" style="${containerStyle}">
|
|
467
|
+
${label}
|
|
468
|
+
${EditorElem.arrayItem({
|
|
447
469
|
gvc: gvc,
|
|
448
470
|
title: '',
|
|
449
471
|
array: () => {
|
|
@@ -451,9 +473,8 @@ export class FormWidget {
|
|
|
451
473
|
return {
|
|
452
474
|
title: d2[dd.referTitile] || `選項:${index + 1}`,
|
|
453
475
|
innerHtml: (gvc) => {
|
|
454
|
-
return html `
|
|
455
|
-
|
|
456
|
-
${FormWidget.editorView({
|
|
476
|
+
return html ` <div class="my-2">
|
|
477
|
+
${FormWidget.editorView({
|
|
457
478
|
gvc: gvc,
|
|
458
479
|
array: dd.formList,
|
|
459
480
|
refresh: (key) => {
|
|
@@ -464,7 +485,7 @@ export class FormWidget {
|
|
|
464
485
|
formData: d2,
|
|
465
486
|
readonly: obj.readonly,
|
|
466
487
|
})}
|
|
467
|
-
|
|
488
|
+
</div>`;
|
|
468
489
|
},
|
|
469
490
|
};
|
|
470
491
|
});
|
|
@@ -484,7 +505,7 @@ export class FormWidget {
|
|
|
484
505
|
}),
|
|
485
506
|
},
|
|
486
507
|
})}
|
|
487
|
-
|
|
508
|
+
</div>`;
|
|
488
509
|
},
|
|
489
510
|
};
|
|
490
511
|
});
|
|
@@ -493,7 +514,7 @@ export class FormWidget {
|
|
|
493
514
|
title: label,
|
|
494
515
|
gvc: gvc,
|
|
495
516
|
def: formData[dd.key],
|
|
496
|
-
callback:
|
|
517
|
+
callback: text => {
|
|
497
518
|
formData[dd.key] = text;
|
|
498
519
|
obj.refresh(dd.key);
|
|
499
520
|
},
|
|
@@ -514,7 +535,7 @@ export class FormWidget {
|
|
|
514
535
|
};
|
|
515
536
|
}),
|
|
516
537
|
readonly: readonly !== null && readonly !== void 0 ? readonly : false,
|
|
517
|
-
callback:
|
|
538
|
+
callback: text => {
|
|
518
539
|
if (!readonly) {
|
|
519
540
|
formData[dd.key] = text;
|
|
520
541
|
obj.refresh(dd.key);
|
|
@@ -522,38 +543,36 @@ export class FormWidget {
|
|
|
522
543
|
},
|
|
523
544
|
});
|
|
524
545
|
case 'page_select':
|
|
525
|
-
return EditorElem.pageSelect(gvc, '選擇頁面', formData[dd.key],
|
|
546
|
+
return EditorElem.pageSelect(gvc, '選擇頁面', formData[dd.key], data => {
|
|
526
547
|
formData[dd.key] = data;
|
|
527
|
-
},
|
|
548
|
+
}, dd => {
|
|
528
549
|
return dd.group !== 'glitter-article';
|
|
529
550
|
});
|
|
530
551
|
case 'fontawesome':
|
|
531
|
-
return html `
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
前往<a
|
|
537
|
-
onclick="${gvc.event(() => {
|
|
552
|
+
return html ` <div class="${containerClass}" style="${containerStyle}">
|
|
553
|
+
${label}
|
|
554
|
+
<div class="alert alert-info p-2 mb-2" style="word-break: break-word;white-space: normal;">
|
|
555
|
+
前往<a
|
|
556
|
+
onclick="${gvc.event(() => {
|
|
538
557
|
glitter.openNewTab('https://fontawesome.com');
|
|
539
558
|
})}"
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
559
|
+
style="cursor: pointer;"
|
|
560
|
+
class="mx-2 fw-bold mb-1"
|
|
561
|
+
>Fontawesome</a
|
|
562
|
+
>官網,查找ICON標籤。
|
|
563
|
+
</div>
|
|
564
|
+
<input
|
|
565
|
+
type="text"
|
|
566
|
+
value="${(_e = formData[dd.key]) !== null && _e !== void 0 ? _e : ''}"
|
|
567
|
+
class="${inputClass}"
|
|
568
|
+
style="${inputStyle}"
|
|
569
|
+
onchange="${gvc.event((e, event) => {
|
|
551
570
|
formData[dd.key] = e.value;
|
|
552
571
|
obj.refresh(dd.key);
|
|
553
572
|
})}"
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
573
|
+
${readonly ? `readonly` : ``}
|
|
574
|
+
/>
|
|
575
|
+
</div>`;
|
|
557
576
|
case 'form_plugin':
|
|
558
577
|
return gvc.bindView(() => {
|
|
559
578
|
return {
|
|
@@ -577,9 +596,11 @@ export class FormWidget {
|
|
|
577
596
|
};
|
|
578
597
|
});
|
|
579
598
|
case 'form_plugin_v2':
|
|
580
|
-
if (dd.hidden_code &&
|
|
581
|
-
|
|
582
|
-
|
|
599
|
+
if (dd.hidden_code &&
|
|
600
|
+
dd.hidden_code.trim() &&
|
|
601
|
+
eval(`(() => {
|
|
602
|
+
${dd.hidden_code}
|
|
603
|
+
})()`)) {
|
|
583
604
|
return ``;
|
|
584
605
|
}
|
|
585
606
|
return gvc.bindView(() => {
|
|
@@ -593,8 +614,7 @@ export class FormWidget {
|
|
|
593
614
|
class: containerClass,
|
|
594
615
|
style: containerStyle,
|
|
595
616
|
},
|
|
596
|
-
onCreate: () => {
|
|
597
|
-
},
|
|
617
|
+
onCreate: () => { },
|
|
598
618
|
onInitial: () => {
|
|
599
619
|
const target = gvc.glitter.document.querySelector(`[gvc-id="${gvc.id(tempView)}"]`);
|
|
600
620
|
window.glitterInitialHelper.getPageData({
|
|
@@ -641,17 +661,14 @@ export class FormWidget {
|
|
|
641
661
|
class: containerClass,
|
|
642
662
|
style: containerStyle,
|
|
643
663
|
containerID: id,
|
|
644
|
-
jsFinish: () => {
|
|
645
|
-
},
|
|
646
|
-
onCreate: () => {
|
|
647
|
-
},
|
|
664
|
+
jsFinish: () => { },
|
|
665
|
+
onCreate: () => { },
|
|
648
666
|
}, createOption !== null && createOption !== void 0 ? createOption : {});
|
|
649
667
|
}
|
|
650
668
|
try {
|
|
651
669
|
target && (target.outerHTML = getView());
|
|
652
670
|
}
|
|
653
|
-
catch (e) {
|
|
654
|
-
}
|
|
671
|
+
catch (e) { }
|
|
655
672
|
});
|
|
656
673
|
},
|
|
657
674
|
};
|
|
@@ -659,22 +676,22 @@ export class FormWidget {
|
|
|
659
676
|
default:
|
|
660
677
|
}
|
|
661
678
|
return html `
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
679
|
+
<div class=" ${containerClass}" style="${containerStyle}">
|
|
680
|
+
${label}
|
|
681
|
+
<input
|
|
682
|
+
type="${dd.type}"
|
|
683
|
+
value="${(_f = formData[dd.key]) !== null && _f !== void 0 ? _f : ''}"
|
|
684
|
+
class="${inputClass}"
|
|
685
|
+
style="${inputStyle}"
|
|
686
|
+
onchange="${gvc.event((e, event) => {
|
|
670
687
|
formData[dd.key] = e.value;
|
|
671
688
|
obj.refresh(dd.key);
|
|
672
689
|
})}"
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
690
|
+
placeholder="${(_g = dd.placeHolder) !== null && _g !== void 0 ? _g : ''}"
|
|
691
|
+
${readonly ? `readonly` : ``}
|
|
692
|
+
/>
|
|
693
|
+
</div>
|
|
694
|
+
`;
|
|
678
695
|
})
|
|
679
696
|
.join('');
|
|
680
697
|
}
|
|
@@ -687,27 +704,38 @@ export class FormWidget {
|
|
|
687
704
|
groupList[dd.group].push(dd);
|
|
688
705
|
});
|
|
689
706
|
}
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
.
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
707
|
+
console.log(`oWidget=>`, obj.oWidget);
|
|
708
|
+
return gvc.bindView(() => {
|
|
709
|
+
const v_id = gvc.glitter.getUUID();
|
|
710
|
+
return {
|
|
711
|
+
bind: v_id,
|
|
712
|
+
view: () => {
|
|
713
|
+
return html `
|
|
714
|
+
${Object.keys(groupList)
|
|
715
|
+
.map(key => {
|
|
716
|
+
if (key) {
|
|
717
|
+
let toggle = {};
|
|
718
|
+
return html ` <div class="mt-2">
|
|
719
|
+
${EditorElem.toggleExpand({
|
|
720
|
+
gvc: gvc,
|
|
721
|
+
title: key,
|
|
722
|
+
data: toggle,
|
|
723
|
+
innerText: getRaw(groupList[key]),
|
|
724
|
+
})}
|
|
725
|
+
</div>`;
|
|
726
|
+
}
|
|
727
|
+
else {
|
|
728
|
+
return getRaw(groupList[key]);
|
|
729
|
+
}
|
|
730
|
+
})
|
|
731
|
+
.join('')}`;
|
|
732
|
+
},
|
|
733
|
+
divCreate: {
|
|
734
|
+
class: `row m-0 p-0`,
|
|
735
|
+
style: ``,
|
|
736
|
+
},
|
|
737
|
+
};
|
|
738
|
+
});
|
|
711
739
|
}
|
|
712
740
|
static checkLeakData(form_config_list, formData) {
|
|
713
741
|
formData = formData || {};
|
|
@@ -721,7 +749,7 @@ export class FormWidget {
|
|
|
721
749
|
formData = formData || {};
|
|
722
750
|
form_config_list = form_config_list || [];
|
|
723
751
|
const find = form_config_list.find((dd) => {
|
|
724
|
-
return
|
|
752
|
+
return `${dd.require}` === 'true' && !formData[dd.key];
|
|
725
753
|
});
|
|
726
754
|
return find;
|
|
727
755
|
}
|
|
@@ -786,7 +814,7 @@ Plugin.createComponent(import.meta.url, (glitter, editMode) => {
|
|
|
786
814
|
title: '表單ID',
|
|
787
815
|
placeHolder: `請輸入表單ID`,
|
|
788
816
|
default: config.formID,
|
|
789
|
-
callback:
|
|
817
|
+
callback: text => {
|
|
790
818
|
config.formID = text;
|
|
791
819
|
widget.refreshComponent();
|
|
792
820
|
},
|
|
@@ -811,7 +839,7 @@ Plugin.createComponent(import.meta.url, (glitter, editMode) => {
|
|
|
811
839
|
{ title: '動態', value: 'code' },
|
|
812
840
|
],
|
|
813
841
|
def: config.form_config_from,
|
|
814
|
-
callback:
|
|
842
|
+
callback: text => {
|
|
815
843
|
config.form_config_from = text;
|
|
816
844
|
gvc.notifyDataChange(id);
|
|
817
845
|
},
|
|
@@ -825,9 +853,8 @@ Plugin.createComponent(import.meta.url, (glitter, editMode) => {
|
|
|
825
853
|
});
|
|
826
854
|
}
|
|
827
855
|
else {
|
|
828
|
-
return html `
|
|
829
|
-
|
|
830
|
-
${FormWidget.settingView({
|
|
856
|
+
return html ` <div class="mx-n2">
|
|
857
|
+
${FormWidget.settingView({
|
|
831
858
|
gvc: gvc,
|
|
832
859
|
array: config.array,
|
|
833
860
|
refresh: () => {
|
|
@@ -836,7 +863,7 @@ Plugin.createComponent(import.meta.url, (glitter, editMode) => {
|
|
|
836
863
|
widget: widget,
|
|
837
864
|
subData: subData,
|
|
838
865
|
})}
|
|
839
|
-
|
|
866
|
+
</div>`;
|
|
840
867
|
}
|
|
841
868
|
})(),
|
|
842
869
|
].join('<div class="my-2"></div>');
|
|
@@ -894,7 +921,7 @@ Plugin.createComponent(import.meta.url, (glitter, editMode) => {
|
|
|
894
921
|
resolve(FormWidget.editorView({
|
|
895
922
|
gvc: gvc,
|
|
896
923
|
array: formConfig,
|
|
897
|
-
refresh:
|
|
924
|
+
refresh: key => {
|
|
898
925
|
TriggerEvent.trigger({
|
|
899
926
|
gvc: gvc,
|
|
900
927
|
widget: widget,
|