ts-glitter 22.4.7 → 22.5.0
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/lib/glitterBundle/Glitter.css +74 -62
- package/lowcode/Entry.js +1 -1
- package/lowcode/Entry.ts +1 -1
- package/lowcode/backend-manager/bg-product.js +49 -32
- package/lowcode/backend-manager/bg-product.ts +57 -39
- package/lowcode/backend-manager/bg-widget.js +17 -0
- package/lowcode/backend-manager/bg-widget.ts +18 -0
- package/lowcode/cms-plugin/information/information-module.js +5 -5
- package/lowcode/cms-plugin/information/information-module.ts +9 -5
- package/lowcode/cms-plugin/menus-setting.js +69 -55
- package/lowcode/cms-plugin/menus-setting.ts +77 -61
- package/lowcode/cms-plugin/module/form-module.js +109 -89
- package/lowcode/cms-plugin/module/form-module.ts +680 -650
- package/lowcode/cms-plugin/module/product-excel.js +1 -0
- package/lowcode/cms-plugin/module/product-excel.ts +2 -0
- package/lowcode/cms-plugin/pos-pages/payment-page.js +28 -10
- package/lowcode/cms-plugin/pos-pages/payment-page.ts +29 -10
- package/lowcode/cms-plugin/shopping-allowance-manager.js +0 -1
- package/lowcode/cms-plugin/shopping-allowance-manager.ts +0 -1
- package/lowcode/cms-plugin/shopping-collections.js +367 -193
- package/lowcode/cms-plugin/shopping-collections.ts +664 -243
- package/lowcode/cms-plugin/shopping-information.js +392 -38
- package/lowcode/cms-plugin/shopping-information.ts +479 -87
- package/lowcode/cms-plugin/shopping-product-setting.js +2 -2
- package/lowcode/cms-plugin/shopping-product-setting.ts +2 -2
- package/lowcode/cms-plugin/shopping-setting-advance.js +906 -766
- package/lowcode/cms-plugin/shopping-setting-advance.ts +977 -841
- package/lowcode/cms-plugin/shopping-setting-basic.js +1547 -1285
- package/lowcode/cms-plugin/shopping-setting-basic.ts +1742 -1466
- package/lowcode/cms-plugin/stock-stores.js +1 -0
- package/lowcode/cms-plugin/stock-stores.ts +1 -0
- package/lowcode/cms-plugin/user-list.js +47 -12
- package/lowcode/cms-plugin/user-list.ts +52 -14
- package/lowcode/css/editor.css +6 -0
- package/lowcode/glitterBundle/Glitter.css +74 -62
- package/lowcode/jslib/nestable/index.html +317 -0
- package/lowcode/jslib/nestable/jquery.nestable.js +484 -0
- package/lowcode/official_view_component/form-widget/input-custom.js +98 -6
- package/lowcode/official_view_component/form-widget/input-custom.ts +121 -16
- package/lowcode/public-components/headers/header-class.js +63 -0
- package/lowcode/public-components/headers/header-class.ts +65 -0
- package/lowcode/public-components/headers/sy-02.js +386 -400
- package/lowcode/public-components/headers/sy-02.ts +482 -492
- package/lowcode/public-components/headers/sy-03.js +42 -43
- package/lowcode/public-components/headers/sy-03.ts +46 -43
- package/lowcode/public-components/headers/sy-04.js +43 -41
- package/lowcode/public-components/headers/sy-04.ts +48 -41
- package/lowcode/public-components/headers/sy-05.js +30 -27
- package/lowcode/public-components/headers/sy-05.ts +33 -27
- package/lowcode/public-components/product/product-list.js +160 -148
- package/lowcode/public-components/product/product-list.ts +186 -165
- package/lowcode/public-models/product.ts +26 -1
- package/lowcode/src/glitterBundle/Glitter.css +74 -62
- package/package.json +1 -1
- package/rxmnt81tnk.json +1 -0
- package/src/api-public/controllers/shop.js +10 -4
- package/src/api-public/controllers/shop.js.map +1 -1
- package/src/api-public/controllers/shop.ts +14 -9
- package/src/api-public/services/ezpay/tool.d.ts +1 -0
- package/src/api-public/services/mail.js +1 -1
- package/src/api-public/services/mail.js.map +1 -1
- package/src/api-public/services/mail.ts +1 -1
- package/src/api-public/services/schedule.d.ts +0 -1
- package/src/api-public/services/schedule.js +12 -35
- package/src/api-public/services/schedule.js.map +1 -1
- package/src/api-public/services/schedule.ts +15 -39
- package/src/api-public/services/shopee.js +7 -17
- package/src/api-public/services/shopping.d.ts +27 -6
- package/src/api-public/services/shopping.js +364 -85
- package/src/api-public/services/shopping.js.map +1 -1
- package/src/api-public/services/shopping.ts +510 -101
- package/src/api-public/services/updated-table-checked.js +58 -1
- package/src/api-public/services/updated-table-checked.js.map +1 -1
- package/src/api-public/services/updated-table-checked.ts +62 -1
- package/src/api-public/services/user-update.js +14 -0
- package/src/api-public/services/user-update.js.map +1 -1
- package/src/api-public/services/user-update.ts +15 -0
- package/src/api-public/services/user.js +1 -1
- package/src/api-public/services/user.js.map +1 -1
- package/src/api-public/services/user.ts +1 -1
- package/src/app-project/serverless/src/modules/database.d.ts +1 -1
- package/src/app-project/serverless/src/modules/redis.d.ts +1 -1
- package/src/helper/glitter-util.d.ts +1 -0
- package/src/index.js +7 -5
- package/src/index.js.map +1 -1
- package/src/index.ts +45 -38
- package/src/modules/firebase.js +1 -0
- package/src/modules/firebase.js.map +1 -1
- package/src/modules/firebase.ts +1 -0
- package/src/seo-config.d.ts +1 -1
- package/src/seo-config.js +1 -2
- package/src/seo-config.js.map +1 -1
- package/src/seo-config.ts +1 -2
- package/src/services/saas-table-check.js.map +1 -1
- package/src/services/ses.js +4 -3
- package/src/services/ses.js.map +1 -1
- package/src/services/system-schedule.js.map +1 -1
- package/src/services/system-schedule.ts +1 -0
|
@@ -3,664 +3,694 @@ import { ShareDialog } from '../../glitterBundle/dialog/ShareDialog.js';
|
|
|
3
3
|
import { GVC } from '../../glitterBundle/GVController.js';
|
|
4
4
|
import { EditorElem } from '../../glitterBundle/plugins/editor-elem.js';
|
|
5
5
|
import { ApiPageConfig } from '../../api/pageConfig.js';
|
|
6
|
-
import {Language} from
|
|
6
|
+
import { Language } from '../../glitter-base/global/language.js';
|
|
7
7
|
|
|
8
8
|
export class FormModule {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
9
|
+
|
|
10
|
+
public static editor(gvc: GVC, data: any, title: string, update?: () => void) {
|
|
11
|
+
const html = String.raw;
|
|
12
|
+
const vm: {
|
|
13
|
+
id: string;
|
|
14
|
+
add_btn: boolean;
|
|
15
|
+
data: any;
|
|
16
|
+
} = {
|
|
17
|
+
id: gvc.glitter.getUUID(),
|
|
18
|
+
add_btn: false,
|
|
19
|
+
data: data,
|
|
20
|
+
};
|
|
21
|
+
const option = [
|
|
22
|
+
{
|
|
23
|
+
icon: '<i class="fa-solid fa-text "></i>',
|
|
24
|
+
title: '輸入框',
|
|
25
|
+
key: 'input',
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
icon: '<i class="fa-regular fa-square-chevron-down "></i>',
|
|
29
|
+
title: '下拉選單',
|
|
30
|
+
key: 'form-select',
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
icon: '<i class="fa-regular fa-circle-dot "></i>',
|
|
34
|
+
title: '單選',
|
|
35
|
+
key: 'check_box',
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
icon: '<i class="fa-solid fa-square-check "></i>',
|
|
39
|
+
title: '多選',
|
|
40
|
+
key: 'mutiple_select',
|
|
41
|
+
},
|
|
42
|
+
];
|
|
43
|
+
|
|
44
|
+
return [
|
|
45
|
+
title,
|
|
46
|
+
gvc.bindView(() => {
|
|
47
|
+
gvc.glitter.addMtScript(
|
|
48
|
+
[
|
|
36
49
|
{
|
|
37
|
-
|
|
38
|
-
title: '多選',
|
|
39
|
-
key: 'mutiple_select',
|
|
50
|
+
src: `https://raw.githack.com/SortableJS/Sortable/master/Sortable.js`,
|
|
40
51
|
},
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
()
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
default:
|
|
92
|
-
return opc.icon;
|
|
93
|
-
}
|
|
94
|
-
})()}
|
|
95
|
-
</div>
|
|
96
|
-
${(Language.getLanguageCustomText(dd.title || opc.title))}${(() => {
|
|
97
|
-
if (dd.deletable === false) {
|
|
98
|
-
return `<div class="ms-2">${BgWidget.blueNote(`系統預設`)}</div>`;
|
|
99
|
-
} else {
|
|
100
|
-
return ``;
|
|
101
|
-
}
|
|
102
|
-
})()}
|
|
103
|
-
<div class="flex-fill"></div>
|
|
104
|
-
${dd.toggle ? `<i class="fa-solid fa-angle-up"></i>` : `<i class="fa-solid fa-angle-down"></i>`}
|
|
105
|
-
</div>
|
|
106
|
-
${dd.toggle
|
|
107
|
-
? html`
|
|
108
|
-
<div class="w-100 p-3">
|
|
109
|
-
${(() => {
|
|
110
|
-
const editor_option = [
|
|
111
|
-
BgWidget.multiCheckboxContainer(gvc, [{ key: 'true', name: '設定為必填項目' }], [`${dd.require ?? ''}` || 'false'], () => {
|
|
112
|
-
if (dd.require) {
|
|
113
|
-
const dialog = new ShareDialog(gvc.glitter);
|
|
114
|
-
if (
|
|
115
|
-
dd.key === 'email' &&
|
|
116
|
-
!vm.data.find((dd: any) => {
|
|
117
|
-
return dd.key === 'phone' && dd.require;
|
|
118
|
-
})
|
|
119
|
-
) {
|
|
120
|
-
dialog.errorMessage({ text: '電話或信箱,必須有一個為必填' });
|
|
121
|
-
gvc.notifyDataChange(vm.id);
|
|
122
|
-
return;
|
|
123
|
-
} else if (
|
|
124
|
-
dd.key === 'phone' &&
|
|
125
|
-
!vm.data.find((dd: any) => {
|
|
126
|
-
return dd.key === 'email' && dd.require;
|
|
127
|
-
})
|
|
128
|
-
) {
|
|
129
|
-
dialog.errorMessage({ text: '電話或信箱,必須有一個為必填' });
|
|
130
|
-
gvc.notifyDataChange(vm.id);
|
|
131
|
-
return;
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
dd.require = !dd.require;
|
|
135
|
-
if (dd.require) {
|
|
136
|
-
dd.hidden = false;
|
|
137
|
-
}
|
|
138
|
-
update && update();
|
|
139
|
-
gvc.notifyDataChange(vm.id);
|
|
140
|
-
}),
|
|
141
|
-
...(() => {
|
|
142
|
-
if (dd.require) {
|
|
143
|
-
return [];
|
|
144
|
-
} else {
|
|
145
|
-
return [
|
|
146
|
-
BgWidget.multiCheckboxContainer(gvc, [{ key: 'true', name: '隱藏此欄位' }], [`${dd.hidden ?? ''}` || 'false'], () => {
|
|
147
|
-
dd.hidden = !dd.hidden;
|
|
148
|
-
update && update();
|
|
149
|
-
gvc.notifyDataChange(vm.id);
|
|
150
|
-
}),
|
|
151
|
-
];
|
|
152
|
-
}
|
|
153
|
-
})(),
|
|
154
|
-
html`<div class="d-flex align-items-center justify-content-end ${dd.deletable === false ? `d-none` : ``}">
|
|
155
|
-
${BgWidget.cancel(
|
|
156
|
-
gvc.event(() => {
|
|
157
|
-
const dialog = new ShareDialog(gvc.glitter);
|
|
158
|
-
dialog.checkYesOrNot({
|
|
159
|
-
text: '是否確認刪除欄位?',
|
|
160
|
-
callback: (response) => {
|
|
161
|
-
if (response) {
|
|
162
|
-
vm.data.splice(index, 1);
|
|
163
|
-
gvc.notifyDataChange(vm.id);
|
|
164
|
-
update && update();
|
|
165
|
-
}
|
|
166
|
-
},
|
|
167
|
-
});
|
|
168
|
-
}),
|
|
169
|
-
'刪除欄位'
|
|
170
|
-
)}
|
|
171
|
-
</div>`,
|
|
172
|
-
];
|
|
173
|
-
switch (dd.page) {
|
|
174
|
-
case 'multiple_line_text':
|
|
175
|
-
case 'input':
|
|
176
|
-
return [
|
|
177
|
-
(() => {
|
|
178
|
-
if (dd.deletable === false) {
|
|
179
|
-
return [];
|
|
180
|
-
} else {
|
|
181
|
-
return [
|
|
182
|
-
EditorElem.select({
|
|
183
|
-
title: html`<div class="tx_normal fw-normal">資料類型</div>`,
|
|
184
|
-
gvc: gvc,
|
|
185
|
-
callback: (value) => {
|
|
186
|
-
dd.form_config.type = value;
|
|
187
|
-
if (value === 'textArea') {
|
|
188
|
-
dd.page = 'multiple_line_text';
|
|
189
|
-
} else {
|
|
190
|
-
dd.page = 'input';
|
|
191
|
-
}
|
|
192
|
-
update && update();
|
|
193
|
-
gvc.notifyDataChange(vm.id);
|
|
194
|
-
},
|
|
195
|
-
def: dd.form_config.type,
|
|
196
|
-
array: [
|
|
197
|
-
{
|
|
198
|
-
key: 'default',
|
|
199
|
-
name: '單行文字',
|
|
200
|
-
value: 'text',
|
|
201
|
-
visible: 'visible',
|
|
202
|
-
},
|
|
203
|
-
{
|
|
204
|
-
key: 'default',
|
|
205
|
-
name: '多行文字',
|
|
206
|
-
value: 'textArea',
|
|
207
|
-
visible: 'visible',
|
|
208
|
-
},
|
|
209
|
-
{
|
|
210
|
-
key: 'default',
|
|
211
|
-
name: '名稱',
|
|
212
|
-
value: 'name',
|
|
213
|
-
visible: 'visible',
|
|
214
|
-
},
|
|
215
|
-
{
|
|
216
|
-
key: 'default',
|
|
217
|
-
name: '日期',
|
|
218
|
-
value: 'date',
|
|
219
|
-
visible: 'visible',
|
|
220
|
-
},
|
|
221
|
-
{
|
|
222
|
-
key: 'default',
|
|
223
|
-
name: '時間',
|
|
224
|
-
value: 'time',
|
|
225
|
-
visible: 'visible',
|
|
226
|
-
},
|
|
227
|
-
{
|
|
228
|
-
key: 'default',
|
|
229
|
-
name: 'email',
|
|
230
|
-
value: 'email',
|
|
231
|
-
visible: 'visible',
|
|
232
|
-
},
|
|
233
|
-
{
|
|
234
|
-
key: 'default',
|
|
235
|
-
name: '電話',
|
|
236
|
-
value: 'phone',
|
|
237
|
-
visible: 'visible',
|
|
238
|
-
},
|
|
239
|
-
{
|
|
240
|
-
key: 'default',
|
|
241
|
-
name: '顏色',
|
|
242
|
-
value: 'color',
|
|
243
|
-
visible: 'visible',
|
|
244
|
-
},
|
|
245
|
-
{
|
|
246
|
-
key: 'default',
|
|
247
|
-
name: '數字',
|
|
248
|
-
value: 'number',
|
|
249
|
-
visible: 'visible',
|
|
250
|
-
},
|
|
251
|
-
{
|
|
252
|
-
key: 'default',
|
|
253
|
-
name: '地址',
|
|
254
|
-
value: 'address',
|
|
255
|
-
visible: 'visible',
|
|
256
|
-
},
|
|
257
|
-
{
|
|
258
|
-
key: 'default',
|
|
259
|
-
name: '密碼',
|
|
260
|
-
value: 'password',
|
|
261
|
-
visible: 'visible',
|
|
262
|
-
},
|
|
263
|
-
].map((dd) => {
|
|
264
|
-
return {
|
|
265
|
-
title: dd.name,
|
|
266
|
-
value: dd.value,
|
|
267
|
-
};
|
|
268
|
-
}) as any,
|
|
269
|
-
}),
|
|
270
|
-
];
|
|
271
|
-
}
|
|
272
|
-
})(),
|
|
273
|
-
BgWidget.editeInput({
|
|
274
|
-
gvc: gvc,
|
|
275
|
-
title: '自訂欄位名稱',
|
|
276
|
-
default: dd.title || '',
|
|
277
|
-
callback: (text) => {
|
|
278
|
-
dd.title = text;
|
|
279
|
-
update && update();
|
|
280
|
-
gvc.notifyDataChange(vm.id);
|
|
281
|
-
},
|
|
282
|
-
placeHolder: '請輸入自訂欄位名稱',
|
|
283
|
-
global_language:true
|
|
284
|
-
}),
|
|
285
|
-
BgWidget.editeInput({
|
|
286
|
-
gvc: gvc,
|
|
287
|
-
title: '提示文字',
|
|
288
|
-
default: dd.form_config.place_holder || '',
|
|
289
|
-
callback: (text) => {
|
|
290
|
-
dd.form_config.place_holder = text;
|
|
291
|
-
update && update();
|
|
292
|
-
gvc.notifyDataChange(vm.id);
|
|
293
|
-
},
|
|
294
|
-
placeHolder: '請輸入關於這項欄位的描述或指引',
|
|
295
|
-
global_language:true
|
|
296
|
-
}),
|
|
297
|
-
...((dd.form_config.type==='date') ? [
|
|
298
|
-
BgWidget.editeInput({
|
|
299
|
-
gvc: gvc,
|
|
300
|
-
title: '最小起始日',
|
|
301
|
-
default: dd.form_config.start_time || '',
|
|
302
|
-
callback: (text) => {
|
|
303
|
-
dd.form_config.start_time = text;
|
|
304
|
-
update && update();
|
|
305
|
-
gvc.notifyDataChange(vm.id);
|
|
306
|
-
},
|
|
307
|
-
placeHolder: '幾天前,0為當下,未輸入則不限制',
|
|
308
|
-
global_language:true
|
|
309
|
-
}),
|
|
310
|
-
BgWidget.editeInput({
|
|
311
|
-
gvc: gvc,
|
|
312
|
-
title: '最大結束日',
|
|
313
|
-
default: dd.form_config.end_time || '',
|
|
314
|
-
callback: (text) => {
|
|
315
|
-
dd.form_config.end_time = text;
|
|
316
|
-
update && update();
|
|
317
|
-
gvc.notifyDataChange(vm.id);
|
|
318
|
-
},
|
|
319
|
-
placeHolder: '幾天後,0為當下,未輸入則不限制',
|
|
320
|
-
global_language:true
|
|
321
|
-
})
|
|
322
|
-
]:[]),
|
|
323
|
-
...editor_option,
|
|
324
|
-
|
|
325
|
-
].filter((dd)=>{
|
|
326
|
-
return dd
|
|
327
|
-
}).join('<div class="my-2"></div>');
|
|
328
|
-
case 'form-select':
|
|
329
|
-
case 'check_box':
|
|
330
|
-
case 'mutiple_select':
|
|
331
|
-
return [
|
|
332
|
-
BgWidget.editeInput({
|
|
333
|
-
gvc: gvc,
|
|
334
|
-
title: '自訂欄位名稱',
|
|
335
|
-
default: dd.title || '',
|
|
336
|
-
callback: (text) => {
|
|
337
|
-
dd.title = text;
|
|
338
|
-
update && update();
|
|
339
|
-
gvc.notifyDataChange(vm.id);
|
|
340
|
-
},
|
|
341
|
-
placeHolder: '請輸入自訂欄位名稱',
|
|
342
|
-
global_language:true
|
|
343
|
-
}),
|
|
344
|
-
html`
|
|
345
|
-
<div class="tx_normal fw-normal mb-2">選項</div>
|
|
346
|
-
${gvc.bindView(() => {
|
|
347
|
-
const cVm = {
|
|
348
|
-
id: gvc.glitter.getUUID(),
|
|
349
|
-
};
|
|
350
|
-
return {
|
|
351
|
-
bind: cVm.id,
|
|
352
|
-
view: () => {
|
|
353
|
-
return (
|
|
354
|
-
dd.form_config.option
|
|
355
|
-
.map((d1: any, index: number) => {
|
|
356
|
-
return html`
|
|
357
|
-
<div class="d-flex align-items-center mb-2 w-100" style="gap: 10px;">
|
|
358
|
-
${
|
|
359
|
-
BgWidget.editeInput({
|
|
360
|
-
gvc: gvc,
|
|
361
|
-
title: '',
|
|
362
|
-
default: d1.value || '',
|
|
363
|
-
callback: (text) => {
|
|
364
|
-
d1.value = text;
|
|
365
|
-
d1.name = text;
|
|
366
|
-
update && update();
|
|
367
|
-
gvc.notifyDataChange(cVm.id);
|
|
368
|
-
},
|
|
369
|
-
placeHolder: '請輸入自訂欄位名稱',
|
|
370
|
-
global_language:true,
|
|
371
|
-
divStyle:`width:100%;`
|
|
372
|
-
})
|
|
373
|
-
}
|
|
374
|
-
<i
|
|
375
|
-
class="fa-solid fa-xmark"
|
|
376
|
-
style="color:#8d8d8d;cursor: pointer; "
|
|
377
|
-
onclick="${gvc.event(() => {
|
|
378
|
-
dd.form_config.option.splice(index, 1);
|
|
379
|
-
update && update();
|
|
380
|
-
gvc.notifyDataChange(cVm.id);
|
|
381
|
-
})}"
|
|
382
|
-
></i>
|
|
383
|
-
</div>
|
|
384
|
-
`;
|
|
385
|
-
})
|
|
386
|
-
.join('') +
|
|
387
|
-
html` <div
|
|
388
|
-
|
|
389
|
-
style="width: 100px; height: 34px; padding: 6px 18px;background: #EAEAEA; border-radius: 10px; overflow: hidden; justify-content: center; align-items: center; gap: 8px; display: inline-flex; cursor: pointer;"
|
|
390
|
-
onclick="${gvc.event(() => {
|
|
391
|
-
dd.form_config.option.push({
|
|
392
|
-
index: 0,
|
|
393
|
-
name: '',
|
|
394
|
-
value: '',
|
|
395
|
-
});
|
|
396
|
-
update && update();
|
|
397
|
-
gvc.notifyDataChange(cVm.id);
|
|
398
|
-
})}"
|
|
399
|
-
>
|
|
400
|
-
<div
|
|
401
|
-
style="color: #393939; font-size: 16px; font-family: Noto Sans; font-weight: 400; word-wrap: break-word"
|
|
402
|
-
>
|
|
403
|
-
新增選項
|
|
404
|
-
</div>
|
|
405
|
-
</div>`
|
|
406
|
-
);
|
|
407
|
-
},
|
|
408
|
-
};
|
|
409
|
-
})}
|
|
410
|
-
`,
|
|
411
|
-
...editor_option,
|
|
412
|
-
].join('<div class="my-2"></div>');
|
|
413
|
-
default:
|
|
414
|
-
return '';
|
|
415
|
-
}
|
|
416
|
-
})()}
|
|
417
|
-
</div>
|
|
418
|
-
`
|
|
419
|
-
: ''}
|
|
420
|
-
</li>`;
|
|
421
|
-
})
|
|
422
|
-
.join('');
|
|
423
|
-
return view;
|
|
424
|
-
} catch (e) {
|
|
425
|
-
console.log(e);
|
|
426
|
-
return e;
|
|
52
|
+
],
|
|
53
|
+
() => {},
|
|
54
|
+
() => {}
|
|
55
|
+
);
|
|
56
|
+
return {
|
|
57
|
+
bind: vm.id,
|
|
58
|
+
view: () => {
|
|
59
|
+
try {
|
|
60
|
+
const view = vm.data
|
|
61
|
+
.map((dd: any, index: number) => {
|
|
62
|
+
const opc = option.find(d1 => {
|
|
63
|
+
if (dd.page === 'multiple_line_text') {
|
|
64
|
+
return d1.key === 'input';
|
|
65
|
+
}
|
|
66
|
+
return d1.key === dd.page;
|
|
67
|
+
})!;
|
|
68
|
+
if (!opc) {
|
|
69
|
+
return ``;
|
|
70
|
+
}
|
|
71
|
+
return html` <li class="w-100 border rounded-3 mb-2" style="overflow: hidden;">
|
|
72
|
+
<div
|
|
73
|
+
class="d-flex align-items-center w-100 py-2"
|
|
74
|
+
style="padding-left: 20px; padding-right: 20px;background: #F7F7F7;cursor: pointer;overflow: hidden;"
|
|
75
|
+
onclick="${gvc.event(() => {
|
|
76
|
+
dd.toggle = !dd.toggle;
|
|
77
|
+
gvc.notifyDataChange(vm.id);
|
|
78
|
+
})}"
|
|
79
|
+
>
|
|
80
|
+
<i class="fa-sharp fa-solid fa-grip-dots-vertical me-3 dragItem "></i>
|
|
81
|
+
<div style="width:12px;" class="d-flex align-items-center justify-content-center me-3">
|
|
82
|
+
${(() => {
|
|
83
|
+
switch (dd.form_config.type) {
|
|
84
|
+
case 'email':
|
|
85
|
+
return `<i class="fa-solid fa-envelope "></i>`;
|
|
86
|
+
case 'phone':
|
|
87
|
+
return `<i class="fa-solid fa-phone "></i>`;
|
|
88
|
+
case 'date':
|
|
89
|
+
return `<i class="fa-solid fa-calendar-days "></i>`;
|
|
90
|
+
case 'consignee':
|
|
91
|
+
return `<i class="fa-solid fa-box-taped"></i>`;
|
|
92
|
+
default:
|
|
93
|
+
return opc.icon;
|
|
94
|
+
}
|
|
95
|
+
})()}
|
|
96
|
+
</div>
|
|
97
|
+
${Language.getLanguageCustomText(dd.title || opc.title)}${(() => {
|
|
98
|
+
if (dd.deletable === false) {
|
|
99
|
+
return `<div class="ms-2">${BgWidget.blueNote(`系統預設`)}</div>`;
|
|
100
|
+
} else {
|
|
101
|
+
return ``;
|
|
427
102
|
}
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
103
|
+
})()}
|
|
104
|
+
<div class="flex-fill"></div>
|
|
105
|
+
${dd.toggle ? `<i class="fa-solid fa-angle-up"></i>` : `<i class="fa-solid fa-angle-down"></i>`}
|
|
106
|
+
</div>
|
|
107
|
+
${dd.toggle
|
|
108
|
+
? html`
|
|
109
|
+
<div class="w-100 p-3">
|
|
110
|
+
${(() => {
|
|
111
|
+
const editor_option = [
|
|
112
|
+
BgWidget.multiCheckboxContainer(
|
|
113
|
+
gvc,
|
|
114
|
+
[
|
|
115
|
+
{
|
|
116
|
+
key: 'true',
|
|
117
|
+
name: '設定為必填項目',
|
|
118
|
+
},
|
|
119
|
+
],
|
|
120
|
+
[`${dd.require ?? ''}` || 'false'],
|
|
121
|
+
() => {
|
|
122
|
+
if (dd.require) {
|
|
123
|
+
const dialog = new ShareDialog(gvc.glitter);
|
|
124
|
+
if (
|
|
125
|
+
dd.key === 'email' &&
|
|
126
|
+
!vm.data.find((dd: any) => {
|
|
127
|
+
return dd.key === 'phone' && dd.require;
|
|
128
|
+
})
|
|
129
|
+
) {
|
|
130
|
+
dialog.errorMessage({ text: '電話或信箱,必須有一個為必填' });
|
|
131
|
+
gvc.notifyDataChange(vm.id);
|
|
132
|
+
return;
|
|
133
|
+
} else if (
|
|
134
|
+
dd.key === 'phone' &&
|
|
135
|
+
!vm.data.find((dd: any) => {
|
|
136
|
+
return dd.key === 'email' && dd.require;
|
|
137
|
+
})
|
|
138
|
+
) {
|
|
139
|
+
dialog.errorMessage({ text: '電話或信箱,必須有一個為必填' });
|
|
140
|
+
gvc.notifyDataChange(vm.id);
|
|
141
|
+
return;
|
|
142
|
+
}
|
|
444
143
|
}
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
144
|
+
dd.require = !dd.require;
|
|
145
|
+
if (dd.require) {
|
|
146
|
+
dd.hidden = false;
|
|
147
|
+
}
|
|
148
|
+
update && update();
|
|
149
|
+
gvc.notifyDataChange(vm.id);
|
|
150
|
+
}
|
|
151
|
+
),
|
|
152
|
+
...(() => {
|
|
153
|
+
if (dd.require) {
|
|
154
|
+
return [];
|
|
155
|
+
} else {
|
|
156
|
+
return [
|
|
157
|
+
BgWidget.multiCheckboxContainer(
|
|
158
|
+
gvc,
|
|
159
|
+
[
|
|
160
|
+
{
|
|
161
|
+
key: 'true',
|
|
162
|
+
name: '隱藏此欄位',
|
|
163
|
+
},
|
|
164
|
+
],
|
|
165
|
+
[`${dd.hidden ?? ''}` || 'false'],
|
|
166
|
+
() => {
|
|
167
|
+
dd.hidden = !dd.hidden;
|
|
168
|
+
update && update();
|
|
169
|
+
gvc.notifyDataChange(vm.id);
|
|
170
|
+
}
|
|
171
|
+
),
|
|
172
|
+
];
|
|
173
|
+
}
|
|
174
|
+
})(),
|
|
175
|
+
html` <div
|
|
176
|
+
class="d-flex align-items-center justify-content-end ${dd.deletable === false
|
|
177
|
+
? `d-none`
|
|
178
|
+
: ``}"
|
|
179
|
+
>
|
|
180
|
+
${BgWidget.cancel(
|
|
181
|
+
gvc.event(() => {
|
|
182
|
+
const dialog = new ShareDialog(gvc.glitter);
|
|
183
|
+
dialog.checkYesOrNot({
|
|
184
|
+
text: '是否確認刪除欄位?',
|
|
185
|
+
callback: response => {
|
|
186
|
+
if (response) {
|
|
187
|
+
vm.data.splice(index, 1);
|
|
188
|
+
gvc.notifyDataChange(vm.id);
|
|
189
|
+
update && update();
|
|
190
|
+
}
|
|
457
191
|
},
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
192
|
+
});
|
|
193
|
+
}),
|
|
194
|
+
'刪除欄位'
|
|
195
|
+
)}
|
|
196
|
+
</div>`,
|
|
197
|
+
];
|
|
198
|
+
switch (dd.page) {
|
|
199
|
+
case 'multiple_line_text':
|
|
200
|
+
case 'input':
|
|
201
|
+
return [
|
|
202
|
+
(() => {
|
|
203
|
+
if (dd.deletable === false) {
|
|
204
|
+
return [];
|
|
205
|
+
} else {
|
|
206
|
+
return [
|
|
207
|
+
EditorElem.select({
|
|
208
|
+
title: html` <div class="tx_normal fw-normal">資料類型</div>`,
|
|
209
|
+
gvc: gvc,
|
|
210
|
+
callback: value => {
|
|
211
|
+
dd.form_config.type = value;
|
|
212
|
+
if (value === 'textArea') {
|
|
213
|
+
dd.page = 'multiple_line_text';
|
|
214
|
+
} else {
|
|
215
|
+
dd.page = 'input';
|
|
216
|
+
}
|
|
217
|
+
update && update();
|
|
218
|
+
gvc.notifyDataChange(vm.id);
|
|
219
|
+
},
|
|
220
|
+
def: dd.form_config.type,
|
|
221
|
+
array: [
|
|
222
|
+
{
|
|
223
|
+
key: 'default',
|
|
224
|
+
name: '單行文字',
|
|
225
|
+
value: 'text',
|
|
226
|
+
visible: 'visible',
|
|
227
|
+
},
|
|
228
|
+
{
|
|
229
|
+
key: 'default',
|
|
230
|
+
name: '多行文字',
|
|
231
|
+
value: 'textArea',
|
|
232
|
+
visible: 'visible',
|
|
233
|
+
},
|
|
234
|
+
{
|
|
235
|
+
key: 'default',
|
|
236
|
+
name: '名稱',
|
|
237
|
+
value: 'name',
|
|
238
|
+
visible: 'visible',
|
|
239
|
+
},
|
|
240
|
+
{
|
|
241
|
+
key: 'default',
|
|
242
|
+
name: '日期',
|
|
243
|
+
value: 'date',
|
|
244
|
+
visible: 'visible',
|
|
245
|
+
},
|
|
246
|
+
{
|
|
247
|
+
key: 'default',
|
|
248
|
+
name: '時間',
|
|
249
|
+
value: 'time',
|
|
250
|
+
visible: 'visible',
|
|
251
|
+
},
|
|
252
|
+
{
|
|
253
|
+
key: 'default',
|
|
254
|
+
name: 'email',
|
|
255
|
+
value: 'email',
|
|
256
|
+
visible: 'visible',
|
|
257
|
+
},
|
|
258
|
+
{
|
|
259
|
+
key: 'default',
|
|
260
|
+
name: '電話',
|
|
261
|
+
value: 'phone',
|
|
262
|
+
visible: 'visible',
|
|
263
|
+
},
|
|
264
|
+
{
|
|
265
|
+
key: 'default',
|
|
266
|
+
name: '顏色',
|
|
267
|
+
value: 'color',
|
|
268
|
+
visible: 'visible',
|
|
269
|
+
},
|
|
270
|
+
{
|
|
271
|
+
key: 'default',
|
|
272
|
+
name: '數字',
|
|
273
|
+
value: 'number',
|
|
274
|
+
visible: 'visible',
|
|
275
|
+
},
|
|
276
|
+
{
|
|
277
|
+
key: 'default',
|
|
278
|
+
name: '地址',
|
|
279
|
+
value: 'address',
|
|
280
|
+
visible: 'visible',
|
|
281
|
+
},
|
|
282
|
+
{
|
|
283
|
+
key: 'default',
|
|
284
|
+
name: '密碼',
|
|
285
|
+
value: 'password',
|
|
286
|
+
visible: 'visible',
|
|
287
|
+
},
|
|
288
|
+
].map(dd => {
|
|
289
|
+
return {
|
|
290
|
+
title: dd.name,
|
|
291
|
+
value: dd.value,
|
|
292
|
+
};
|
|
293
|
+
}) as any,
|
|
294
|
+
}),
|
|
295
|
+
];
|
|
296
|
+
}
|
|
297
|
+
})(),
|
|
298
|
+
BgWidget.editeInput({
|
|
299
|
+
gvc: gvc,
|
|
300
|
+
title: '自訂欄位名稱',
|
|
301
|
+
default: dd.title || '',
|
|
302
|
+
callback: text => {
|
|
303
|
+
dd.title = text;
|
|
304
|
+
update && update();
|
|
305
|
+
gvc.notifyDataChange(vm.id);
|
|
306
|
+
},
|
|
307
|
+
placeHolder: '請輸入自訂欄位名稱',
|
|
308
|
+
global_language: true,
|
|
309
|
+
}),
|
|
310
|
+
BgWidget.editeInput({
|
|
311
|
+
gvc: gvc,
|
|
312
|
+
title: '提示文字',
|
|
313
|
+
default: dd.form_config.place_holder || '',
|
|
314
|
+
callback: text => {
|
|
315
|
+
dd.form_config.place_holder = text;
|
|
316
|
+
update && update();
|
|
317
|
+
gvc.notifyDataChange(vm.id);
|
|
318
|
+
},
|
|
319
|
+
placeHolder: '請輸入關於這項欄位的描述或指引',
|
|
320
|
+
global_language: true,
|
|
321
|
+
}),
|
|
322
|
+
...(dd.form_config.type === 'date'
|
|
323
|
+
? [
|
|
324
|
+
BgWidget.editeInput({
|
|
325
|
+
gvc: gvc,
|
|
326
|
+
title: '最小起始日',
|
|
327
|
+
default: dd.form_config.start_time || '',
|
|
328
|
+
callback: text => {
|
|
329
|
+
dd.form_config.start_time = text;
|
|
330
|
+
update && update();
|
|
331
|
+
gvc.notifyDataChange(vm.id);
|
|
332
|
+
},
|
|
333
|
+
placeHolder: '幾天前,0為當下,未輸入則不限制',
|
|
334
|
+
global_language: true,
|
|
335
|
+
}),
|
|
336
|
+
BgWidget.editeInput({
|
|
337
|
+
gvc: gvc,
|
|
338
|
+
title: '最大結束日',
|
|
339
|
+
default: dd.form_config.end_time || '',
|
|
340
|
+
callback: text => {
|
|
341
|
+
dd.form_config.end_time = text;
|
|
342
|
+
update && update();
|
|
343
|
+
gvc.notifyDataChange(vm.id);
|
|
344
|
+
},
|
|
345
|
+
placeHolder: '幾天後,0為當下,未輸入則不限制',
|
|
346
|
+
global_language: true,
|
|
347
|
+
}),
|
|
348
|
+
]
|
|
349
|
+
: []),
|
|
350
|
+
...editor_option,
|
|
351
|
+
]
|
|
352
|
+
.filter(dd => {
|
|
353
|
+
return dd;
|
|
354
|
+
})
|
|
355
|
+
.join('<div class="my-2"></div>');
|
|
356
|
+
case 'form-select':
|
|
357
|
+
case 'check_box':
|
|
358
|
+
case 'mutiple_select':
|
|
359
|
+
return [
|
|
360
|
+
BgWidget.editeInput({
|
|
361
|
+
gvc: gvc,
|
|
362
|
+
title: '自訂欄位名稱',
|
|
363
|
+
default: dd.title || '',
|
|
364
|
+
callback: text => {
|
|
365
|
+
dd.title = text;
|
|
366
|
+
update && update();
|
|
367
|
+
gvc.notifyDataChange(vm.id);
|
|
368
|
+
},
|
|
369
|
+
placeHolder: '請輸入自訂欄位名稱',
|
|
370
|
+
global_language: true,
|
|
371
|
+
}),
|
|
372
|
+
html`
|
|
373
|
+
<div class="tx_normal fw-normal mb-2">選項</div>
|
|
374
|
+
${gvc.bindView(() => {
|
|
375
|
+
const cVm = {
|
|
376
|
+
id: gvc.glitter.getUUID(),
|
|
377
|
+
};
|
|
378
|
+
return {
|
|
379
|
+
bind: cVm.id,
|
|
380
|
+
view: () => {
|
|
381
|
+
return (
|
|
382
|
+
dd.form_config.option
|
|
383
|
+
.map((d1: any, index: number) => {
|
|
384
|
+
return html`
|
|
385
|
+
<div
|
|
386
|
+
class="d-flex align-items-center mb-2 w-100"
|
|
387
|
+
style="gap: 10px;"
|
|
388
|
+
>
|
|
389
|
+
${BgWidget.editeInput({
|
|
390
|
+
gvc: gvc,
|
|
391
|
+
title: '',
|
|
392
|
+
default: d1.value || '',
|
|
393
|
+
callback: text => {
|
|
394
|
+
d1.value = text;
|
|
395
|
+
d1.name = text;
|
|
396
|
+
update && update();
|
|
397
|
+
gvc.notifyDataChange(cVm.id);
|
|
398
|
+
},
|
|
399
|
+
placeHolder: '請輸入自訂欄位名稱',
|
|
400
|
+
global_language: true,
|
|
401
|
+
divStyle: `width:100%;`,
|
|
402
|
+
})}
|
|
403
|
+
<i
|
|
404
|
+
class="fa-solid fa-xmark"
|
|
405
|
+
style="color:#8d8d8d;cursor: pointer; "
|
|
406
|
+
onclick="${gvc.event(() => {
|
|
407
|
+
dd.form_config.option.splice(index, 1);
|
|
408
|
+
update && update();
|
|
409
|
+
gvc.notifyDataChange(cVm.id);
|
|
410
|
+
})}"
|
|
411
|
+
></i>
|
|
412
|
+
</div>
|
|
413
|
+
`;
|
|
414
|
+
})
|
|
415
|
+
.join('') +
|
|
416
|
+
html` <div
|
|
417
|
+
style="width: 100px; height: 34px; padding: 6px 18px;background: #EAEAEA; border-radius: 10px; overflow: hidden; justify-content: center; align-items: center; gap: 8px; display: inline-flex; cursor: pointer;"
|
|
418
|
+
onclick="${gvc.event(() => {
|
|
419
|
+
dd.form_config.option.push({
|
|
420
|
+
index: 0,
|
|
421
|
+
name: '',
|
|
422
|
+
value: '',
|
|
423
|
+
});
|
|
424
|
+
update && update();
|
|
425
|
+
gvc.notifyDataChange(cVm.id);
|
|
426
|
+
})}"
|
|
427
|
+
>
|
|
428
|
+
<div
|
|
429
|
+
style="color: #393939; font-size: 16px; font-family: Noto Sans; font-weight: 400; word-wrap: break-word"
|
|
430
|
+
>
|
|
431
|
+
新增選項
|
|
432
|
+
</div>
|
|
433
|
+
</div>`
|
|
434
|
+
);
|
|
435
|
+
},
|
|
436
|
+
};
|
|
437
|
+
})}
|
|
438
|
+
`,
|
|
439
|
+
...editor_option,
|
|
440
|
+
].join('<div class="my-2"></div>');
|
|
441
|
+
default:
|
|
442
|
+
return '';
|
|
443
|
+
}
|
|
444
|
+
})()}
|
|
445
|
+
</div>
|
|
446
|
+
`
|
|
447
|
+
: ''}
|
|
448
|
+
</li>`;
|
|
449
|
+
})
|
|
450
|
+
.join('');
|
|
451
|
+
return view;
|
|
452
|
+
} catch (e) {
|
|
453
|
+
console.log(e);
|
|
454
|
+
return e;
|
|
455
|
+
}
|
|
456
|
+
},
|
|
457
|
+
divCreate: {
|
|
458
|
+
elem: 'ul',
|
|
459
|
+
option: [{ key: 'id', value: vm.id }],
|
|
460
|
+
class: '',
|
|
461
|
+
},
|
|
462
|
+
onCreate: () => {
|
|
463
|
+
let n = 0;
|
|
464
|
+
const interval = setInterval(() => {
|
|
465
|
+
n++;
|
|
466
|
+
if ((gvc.glitter.window as any).Sortable) {
|
|
467
|
+
try {
|
|
468
|
+
function swapArr(arr: any, index1: number, index2: number) {
|
|
469
|
+
const data = arr[index1];
|
|
470
|
+
arr.splice(index1, 1);
|
|
471
|
+
arr.splice(index2, 0, data);
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
let startIndex = 0;
|
|
475
|
+
//@ts-ignore
|
|
476
|
+
gvc.glitter.window.Sortable.create(gvc.glitter.document.getElementById(vm.id), {
|
|
477
|
+
group: gvc.glitter.getUUID(),
|
|
478
|
+
animation: 100,
|
|
479
|
+
handle: '.dragItem',
|
|
480
|
+
onChange: function (evt: any) {},
|
|
481
|
+
onStart: function (evt: any) {
|
|
482
|
+
startIndex = evt.oldIndex;
|
|
466
483
|
},
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
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
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
484
|
+
onEnd: (evt: any) => {
|
|
485
|
+
swapArr(vm.data, startIndex, evt.newIndex);
|
|
486
|
+
},
|
|
487
|
+
});
|
|
488
|
+
} catch (e) {}
|
|
489
|
+
clearInterval(interval);
|
|
490
|
+
}
|
|
491
|
+
if (n > 100) {
|
|
492
|
+
clearInterval(interval);
|
|
493
|
+
}
|
|
494
|
+
}, 100);
|
|
495
|
+
},
|
|
496
|
+
};
|
|
497
|
+
}),
|
|
498
|
+
BgWidget.dropPlusButton({
|
|
499
|
+
gvc: gvc,
|
|
500
|
+
title: '新增一個欄位',
|
|
501
|
+
options: option.map((dd: any) => {
|
|
502
|
+
dd.callback = () => {
|
|
503
|
+
switch (dd.key) {
|
|
504
|
+
case 'input':
|
|
505
|
+
vm.data.push({
|
|
506
|
+
key: `${new Date().getTime()}`,
|
|
507
|
+
page: 'input',
|
|
508
|
+
type: 'form_plugin_v2',
|
|
509
|
+
group: '',
|
|
510
|
+
toggle: true,
|
|
511
|
+
title: '',
|
|
512
|
+
appName: 'cms_system',
|
|
513
|
+
require: 'true',
|
|
514
|
+
readonly: 'write',
|
|
515
|
+
formFormat: '{}',
|
|
516
|
+
style_data: {
|
|
517
|
+
input: {
|
|
518
|
+
list: [],
|
|
519
|
+
class: '',
|
|
520
|
+
style: '',
|
|
521
|
+
version: 'v2',
|
|
522
|
+
},
|
|
523
|
+
label: {
|
|
524
|
+
list: [],
|
|
525
|
+
class: 'form-label fs-base ',
|
|
526
|
+
style: '',
|
|
527
|
+
version: 'v2',
|
|
528
|
+
},
|
|
529
|
+
container: {
|
|
530
|
+
list: [],
|
|
531
|
+
class: '',
|
|
532
|
+
style: '',
|
|
533
|
+
version: 'v2',
|
|
534
|
+
},
|
|
535
|
+
},
|
|
536
|
+
form_config: {
|
|
537
|
+
type: 'text',
|
|
538
|
+
title: '',
|
|
539
|
+
input_style: {
|
|
540
|
+
list: [],
|
|
541
|
+
version: 'v2',
|
|
542
|
+
},
|
|
543
|
+
title_style: {
|
|
544
|
+
list: [],
|
|
545
|
+
version: 'v2',
|
|
546
|
+
},
|
|
547
|
+
place_holder: '',
|
|
548
|
+
},
|
|
549
|
+
col: '12',
|
|
550
|
+
col_sm: '12',
|
|
551
|
+
});
|
|
552
|
+
break;
|
|
553
|
+
case 'multiple_line_text':
|
|
554
|
+
vm.data.push({
|
|
555
|
+
key: `${new Date().getTime()}`,
|
|
556
|
+
page: 'multiple_line_text',
|
|
557
|
+
type: 'form_plugin_v2',
|
|
558
|
+
toggle: true,
|
|
559
|
+
group: '',
|
|
560
|
+
title: '',
|
|
561
|
+
appName: 'cms_system',
|
|
562
|
+
require: 'true',
|
|
563
|
+
readonly: 'write',
|
|
564
|
+
formFormat: '{}',
|
|
565
|
+
moduleName: '多行文字區塊',
|
|
566
|
+
style_data: {
|
|
567
|
+
input: {
|
|
568
|
+
list: [],
|
|
569
|
+
class: '',
|
|
570
|
+
style: '',
|
|
571
|
+
version: 'v2',
|
|
572
|
+
},
|
|
573
|
+
label: {
|
|
574
|
+
list: [],
|
|
575
|
+
class: 'form-label fs-base ',
|
|
576
|
+
style: '',
|
|
577
|
+
version: 'v2',
|
|
578
|
+
},
|
|
579
|
+
container: {
|
|
580
|
+
list: [],
|
|
581
|
+
class: '',
|
|
582
|
+
style: '',
|
|
583
|
+
version: 'v2',
|
|
584
|
+
},
|
|
585
|
+
},
|
|
586
|
+
form_config: {
|
|
587
|
+
type: 'name',
|
|
588
|
+
title: '',
|
|
589
|
+
place_holder: '',
|
|
590
|
+
title_style: {},
|
|
591
|
+
input_style: {},
|
|
592
|
+
},
|
|
593
|
+
col: '12',
|
|
594
|
+
col_sm: '12',
|
|
595
|
+
});
|
|
567
596
|
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
597
|
+
break;
|
|
598
|
+
case 'form-select':
|
|
599
|
+
vm.data.push({
|
|
600
|
+
key: `${new Date().getTime()}`,
|
|
601
|
+
page: 'form-select',
|
|
602
|
+
type: 'form_plugin_v2',
|
|
603
|
+
group: '',
|
|
604
|
+
title: '',
|
|
605
|
+
appName: 'cms_system',
|
|
606
|
+
require: 'true',
|
|
607
|
+
readonly: 'write',
|
|
608
|
+
formFormat: '{}',
|
|
609
|
+
moduleName: '下拉選單',
|
|
610
|
+
style_data: {
|
|
611
|
+
input: { list: [], class: '', style: '', version: 'v2' },
|
|
612
|
+
label: { list: [], class: 'form-label fs-base ', style: '', version: 'v2' },
|
|
613
|
+
container: { list: [], class: '', style: '', version: 'v2' },
|
|
614
|
+
},
|
|
615
|
+
form_config: {
|
|
616
|
+
type: 'name',
|
|
617
|
+
title: '',
|
|
618
|
+
place_holder: '',
|
|
619
|
+
title_style: {},
|
|
620
|
+
input_style: {},
|
|
621
|
+
option: [],
|
|
622
|
+
},
|
|
623
|
+
col: '12',
|
|
624
|
+
col_sm: '12',
|
|
625
|
+
});
|
|
626
|
+
break;
|
|
627
|
+
case 'check_box':
|
|
628
|
+
vm.data.push({
|
|
629
|
+
key: `${new Date().getTime()}`,
|
|
630
|
+
page: 'check_box',
|
|
631
|
+
type: 'form_plugin_v2',
|
|
632
|
+
group: '',
|
|
633
|
+
title: '',
|
|
634
|
+
appName: 'cms_system',
|
|
635
|
+
require: 'true',
|
|
636
|
+
readonly: 'write',
|
|
637
|
+
formFormat: '{}',
|
|
638
|
+
moduleName: '單選題',
|
|
639
|
+
style_data: {
|
|
640
|
+
input: { list: [], class: '', style: '', version: 'v2' },
|
|
641
|
+
label: { list: [], class: 'form-label fs-base ', style: '', version: 'v2' },
|
|
642
|
+
container: { list: [], class: '', style: '', version: 'v2' },
|
|
643
|
+
},
|
|
644
|
+
form_config: {
|
|
645
|
+
type: 'name',
|
|
646
|
+
title: '',
|
|
647
|
+
place_holder: '',
|
|
648
|
+
title_style: {},
|
|
649
|
+
input_style: {},
|
|
650
|
+
option: [],
|
|
651
|
+
},
|
|
652
|
+
col: '12',
|
|
653
|
+
col_sm: '12',
|
|
654
|
+
});
|
|
655
|
+
break;
|
|
656
|
+
case 'mutiple_select':
|
|
657
|
+
vm.data.push({
|
|
658
|
+
key: `${new Date().getTime()}`,
|
|
659
|
+
page: 'mutiple_select',
|
|
660
|
+
type: 'form_plugin_v2',
|
|
661
|
+
group: '',
|
|
662
|
+
title: '',
|
|
663
|
+
appName: 'cms_system',
|
|
664
|
+
require: 'true',
|
|
665
|
+
readonly: 'write',
|
|
666
|
+
formFormat: '{}',
|
|
667
|
+
moduleName: '多選題',
|
|
668
|
+
style_data: {
|
|
669
|
+
input: { list: [], class: '', style: '', version: 'v2' },
|
|
670
|
+
label: { list: [], class: 'form-label fs-base ', style: '', version: 'v2' },
|
|
671
|
+
container: { list: [], class: '', style: '', version: 'v2' },
|
|
672
|
+
},
|
|
673
|
+
form_config: {
|
|
674
|
+
type: 'name',
|
|
675
|
+
title: '',
|
|
676
|
+
place_holder: '',
|
|
677
|
+
title_style: {},
|
|
678
|
+
input_style: {},
|
|
679
|
+
option: [],
|
|
680
|
+
},
|
|
681
|
+
col: '12',
|
|
682
|
+
col_sm: '12',
|
|
683
|
+
});
|
|
684
|
+
break;
|
|
685
|
+
}
|
|
686
|
+
update && update();
|
|
687
|
+
gvc.notifyDataChange(vm.id);
|
|
688
|
+
};
|
|
689
|
+
return dd;
|
|
690
|
+
}) as any,
|
|
691
|
+
}),
|
|
692
|
+
].join('<div class="my-3"></div>');
|
|
693
|
+
}
|
|
665
694
|
}
|
|
695
|
+
|
|
666
696
|
(window as any).glitter.setModule(import.meta.url, FormModule);
|