ts-glitter 20.6.7 → 20.6.9
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/backend-manager/bg-blog.js +617 -621
- package/lowcode/backend-manager/bg-blog.ts +2323 -2325
- package/lowcode/backend-manager/bg-line.js +5 -4
- package/lowcode/backend-manager/bg-line.ts +5 -4
- package/lowcode/backend-manager/bg-list-component.js +9 -0
- package/lowcode/backend-manager/bg-list-component.ts +15 -1
- package/lowcode/backend-manager/bg-notify.js +6 -4
- package/lowcode/backend-manager/bg-notify.ts +6 -4
- package/lowcode/backend-manager/bg-product.js +145 -0
- package/lowcode/backend-manager/bg-product.ts +153 -0
- package/lowcode/backend-manager/bg-sns.js +5 -3
- package/lowcode/backend-manager/bg-sns.ts +5 -3
- package/lowcode/backend-manager/bg-widget.js +92 -4
- package/lowcode/backend-manager/bg-widget.ts +122 -6
- package/lowcode/backend-manager/splitPage.js +0 -39
- package/lowcode/backend-manager/splitPage.ts +0 -40
- package/lowcode/cms-plugin/auto-fcm-advertise.js +17 -5
- package/lowcode/cms-plugin/auto-fcm-advertise.ts +19 -6
- package/lowcode/cms-plugin/auto-fcm-history.js +2732 -0
- package/lowcode/cms-plugin/auto-fcm-history.ts +2995 -0
- package/lowcode/cms-plugin/cms-router.js +5 -0
- package/lowcode/cms-plugin/cms-router.ts +6 -0
- package/lowcode/cms-plugin/filter-options.js +80 -27
- package/lowcode/cms-plugin/filter-options.ts +83 -27
- package/lowcode/cms-plugin/language-backend.js +50 -39
- package/lowcode/cms-plugin/language-backend.ts +109 -95
- package/lowcode/cms-plugin/menus-setting.js +175 -151
- package/lowcode/cms-plugin/menus-setting.ts +620 -591
- package/lowcode/cms-plugin/model/order.d.ts +1 -0
- package/lowcode/cms-plugin/module/data.js +7 -7
- package/lowcode/cms-plugin/module/data.ts +262 -233
- package/lowcode/cms-plugin/module/delivery-html.js +18 -10
- package/lowcode/cms-plugin/module/delivery-html.ts +26 -10
- package/lowcode/cms-plugin/module/order-setting.js +458 -328
- package/lowcode/cms-plugin/module/order-setting.ts +622 -351
- package/lowcode/cms-plugin/module/product-excel.js +1 -1
- package/lowcode/cms-plugin/module/product-excel.ts +2 -1
- package/lowcode/cms-plugin/order/order-module.js +90 -1
- package/lowcode/cms-plugin/order/order-module.ts +106 -1
- package/lowcode/cms-plugin/pos-pages/payment-page.js +11 -8
- package/lowcode/cms-plugin/pos-pages/payment-page.ts +28 -15
- package/lowcode/cms-plugin/pos-pages/products-page.js +0 -39
- package/lowcode/cms-plugin/pos-pages/products-page.ts +0 -40
- package/lowcode/cms-plugin/shopping-collections.ts +1 -3
- package/lowcode/cms-plugin/shopping-finance-setting.js +19 -80
- package/lowcode/cms-plugin/shopping-finance-setting.ts +19 -87
- package/lowcode/cms-plugin/shopping-order-manager.js +122 -38
- package/lowcode/cms-plugin/shopping-order-manager.ts +160 -58
- package/lowcode/cms-plugin/shopping-product-setting.js +364 -376
- package/lowcode/cms-plugin/shopping-product-setting.ts +406 -415
- package/lowcode/cms-plugin/shopping-setting-advance.js +57 -16
- package/lowcode/cms-plugin/shopping-setting-advance.ts +69 -18
- package/lowcode/cms-plugin/user/user-module.js +2 -43
- package/lowcode/cms-plugin/user/user-module.ts +2 -46
- package/lowcode/cms-plugin/user-list.js +4 -6
- package/lowcode/cms-plugin/user-list.ts +35 -38
- package/lowcode/css/editor.css +42 -3
- package/lowcode/glitter-base/global/language.js +6 -1
- package/lowcode/glitter-base/global/language.ts +10 -4
- package/lowcode/glitter-base/global/payment-config.js +19 -16
- package/lowcode/glitter-base/global/payment-config.ts +22 -16
- package/lowcode/glitter-base/global/shipment-config.js +6 -5
- package/lowcode/glitter-base/global/shipment-config.ts +12 -10
- package/lowcode/glitter-base/route/fcm.js +21 -1
- package/lowcode/glitter-base/route/fcm.ts +22 -2
- package/lowcode/glitter-base/route/shopping.js +8 -32
- package/lowcode/glitter-base/route/shopping.ts +10 -33
- package/lowcode/glitter-base/route/user.js +11 -2
- package/lowcode/glitter-base/route/user.ts +23 -12
- package/lowcode/jspage/function-page/setting_editor.js +9 -0
- package/lowcode/jspage/function-page/setting_editor.ts +9 -0
- package/lowcode/public-components/blogs/list.js +223 -195
- package/lowcode/public-components/blogs/list.ts +383 -352
- package/lowcode/public-components/product/product-list.js +8 -4
- package/lowcode/public-components/product/product-list.ts +9 -4
- package/lowcode/public-components/terms-related/index.js +1 -1
- package/lowcode/public-components/terms-related/index.ts +1 -1
- package/lowcode/public-components/user-manager/um-login.js +1 -1
- package/lowcode/public-components/user-manager/um-login.ts +2 -2
- package/lowcode/public-components/user-manager/um-order.js +41 -5
- package/lowcode/public-components/user-manager/um-order.ts +58 -20
- package/lowcode/public-components/user-manager/um-voucher.ts +2 -2
- package/nhi4veq3gk.json +1 -0
- package/package.json +1 -1
- package/src/Language.d.ts +2 -0
- package/src/Language.js +66 -65
- package/src/Language.js.map +1 -1
- package/src/Language.ts +719 -715
- package/src/api-public/config/shipment-config.js +3 -2
- package/src/api-public/config/shipment-config.js.map +1 -1
- package/src/api-public/config/shipment-config.ts +3 -2
- package/src/api-public/controllers/ai-chat.js.map +1 -1
- package/src/api-public/controllers/ai-chat.ts +1 -2
- package/src/api-public/controllers/fcm.js +23 -58
- package/src/api-public/controllers/fcm.js.map +1 -1
- package/src/api-public/controllers/fcm.ts +28 -56
- package/src/api-public/controllers/shop.js +7 -1
- package/src/api-public/controllers/shop.js.map +1 -1
- package/src/api-public/controllers/shop.ts +17 -10
- package/src/api-public/controllers/user.js +1 -0
- package/src/api-public/controllers/user.js.map +1 -1
- package/src/api-public/controllers/user.ts +2 -0
- package/src/api-public/services/auto-send-email.js +247 -187
- package/src/api-public/services/auto-send-email.js.map +1 -1
- package/src/api-public/services/auto-send-email.ts +568 -505
- package/src/api-public/services/delivery.js +1 -1
- package/src/api-public/services/delivery.js.map +1 -1
- package/src/api-public/services/delivery.ts +6 -5
- package/src/api-public/services/financial-service.js +1 -2
- package/src/api-public/services/financial-service.js.map +1 -1
- package/src/api-public/services/financial-service.ts +4 -6
- package/src/api-public/services/manager.d.ts +4 -3
- package/src/api-public/services/manager.js +8 -12
- package/src/api-public/services/manager.js.map +1 -1
- package/src/api-public/services/manager.ts +57 -59
- package/src/api-public/services/model/handlePaymentTransaction.d.ts +1 -1
- package/src/api-public/services/model/handlePaymentTransaction.js +23 -3
- package/src/api-public/services/model/handlePaymentTransaction.js.map +1 -1
- package/src/api-public/services/model/handlePaymentTransaction.ts +25 -36
- package/src/api-public/services/schedule.d.ts +1 -0
- package/src/api-public/services/schedule.js +27 -0
- package/src/api-public/services/schedule.js.map +1 -1
- package/src/api-public/services/schedule.ts +30 -0
- package/src/api-public/services/shopping.d.ts +22 -2
- package/src/api-public/services/shopping.js +362 -90
- package/src/api-public/services/shopping.js.map +1 -1
- package/src/api-public/services/shopping.ts +481 -134
- package/src/api-public/services/user.d.ts +1 -0
- package/src/api-public/services/user.js +36 -16
- package/src/api-public/services/user.js.map +1 -1
- package/src/api-public/services/user.ts +42 -23
- package/src/api-public/services/workers.js +3 -3
- package/src/api-public/services/workers.js.map +1 -1
- package/src/api-public/services/workers.ts +103 -103
- package/src/app-project/serverless/src/modules/database.js +1 -1
- package/src/app-project/serverless/src/modules/database.js.map +1 -1
- package/src/app-project/serverless/src/modules/database.ts +171 -171
- package/src/controllers/template.d.ts +1 -1
- package/src/controllers/template.js +16 -16
- package/src/controllers/template.js.map +1 -1
- package/src/controllers/template.ts +98 -84
- package/src/modules/database.js +3 -1
- package/src/modules/database.js.map +1 -1
- package/src/modules/database.ts +185 -181
- package/src/modules/firebase.d.ts +17 -0
- package/src/modules/firebase.js +126 -0
- package/src/modules/firebase.js.map +1 -1
- package/src/modules/firebase.ts +169 -0
- package/src/public-config-initial/auto-fcm.js +8 -2
- package/src/public-config-initial/auto-fcm.js.map +1 -1
- package/src/public-config-initial/auto-fcm.ts +15 -6
- package/src/services/app.d.ts +2 -1
- package/src/services/app.js.map +1 -1
- package/src/services/app.ts +2 -1
- package/src/services/template.d.ts +3 -2
- package/src/services/template.js +2 -1
- package/src/services/template.js.map +1 -1
- package/src/services/template.ts +13 -20
|
@@ -2,639 +2,668 @@ import { GVC } from '../glitterBundle/GVController.js';
|
|
|
2
2
|
import { BgWidget } from '../backend-manager/bg-widget.js';
|
|
3
3
|
import { ApiUser } from '../glitter-base/route/user.js';
|
|
4
4
|
import { EditorElem } from '../glitterBundle/plugins/editor-elem.js';
|
|
5
|
-
import {
|
|
5
|
+
import { LanguageLocation } from '../glitter-base/global/language.js';
|
|
6
|
+
import { LanguageBackend } from './language-backend.js';
|
|
6
7
|
|
|
7
8
|
const html = String.raw;
|
|
8
9
|
|
|
9
10
|
interface MenuItem {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
link: string;
|
|
12
|
+
title: string;
|
|
13
|
+
items: MenuItem[];
|
|
13
14
|
}
|
|
14
15
|
|
|
15
16
|
export class MenusSetting {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
const vm: {
|
|
21
|
-
type: 'list' | 'add' | 'replace' | 'select';
|
|
22
|
-
index: number;
|
|
23
|
-
dataList: any;
|
|
24
|
-
query?: string;
|
|
17
|
+
public static main(gvc: GVC, widget: any) {
|
|
18
|
+
const html = String.raw;
|
|
19
|
+
const glitter = gvc.glitter;
|
|
25
20
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
21
|
+
const vm: {
|
|
22
|
+
type: 'list' | 'add' | 'replace' | 'select';
|
|
23
|
+
index: number;
|
|
24
|
+
dataList: any;
|
|
25
|
+
query?: string;
|
|
26
|
+
} = {
|
|
27
|
+
type: 'list',
|
|
28
|
+
index: 0,
|
|
29
|
+
dataList: undefined,
|
|
30
|
+
query: '',
|
|
31
|
+
};
|
|
32
|
+
const filterID = gvc.glitter.getUUID();
|
|
33
|
+
let vmi: any = undefined;
|
|
31
34
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
+
function getDatalist() {
|
|
36
|
+
return vm.dataList.map((dd: any, index: number) => {
|
|
37
|
+
return [
|
|
38
|
+
{
|
|
39
|
+
key: '選單名稱',
|
|
40
|
+
value: html`<span class="tx_normal">${dd.title}</span>`,
|
|
41
|
+
},
|
|
42
|
+
];
|
|
43
|
+
});
|
|
44
|
+
}
|
|
35
45
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
46
|
+
return gvc.bindView(() => {
|
|
47
|
+
const id = glitter.getUUID();
|
|
48
|
+
function refresh() {
|
|
49
|
+
gvc.notifyDataChange(id);
|
|
50
|
+
}
|
|
51
|
+
return {
|
|
52
|
+
bind: id,
|
|
53
|
+
dataList: [{ obj: vm, key: 'type' }],
|
|
54
|
+
view: () => {
|
|
55
|
+
if (vm.type === 'list') {
|
|
56
|
+
return BgWidget.container(html`
|
|
57
|
+
<div class="title-container">
|
|
58
|
+
${BgWidget.title('選單管理')}
|
|
59
|
+
<div class="flex-fill"></div>
|
|
60
|
+
${false
|
|
61
|
+
? BgWidget.darkButton(
|
|
62
|
+
'新增',
|
|
63
|
+
gvc.event(() => {
|
|
64
|
+
vm.type = 'add';
|
|
65
|
+
gvc.notifyDataChange(id);
|
|
66
|
+
})
|
|
67
|
+
)
|
|
68
|
+
: ''}
|
|
69
|
+
</div>
|
|
70
|
+
${BgWidget.container(
|
|
71
|
+
BgWidget.mainCard(
|
|
72
|
+
BgWidget.tableV3({
|
|
73
|
+
gvc: gvc,
|
|
74
|
+
getData: vmi => {
|
|
75
|
+
vm.dataList = [
|
|
76
|
+
{ tag: 'menu-setting', title: '主選單' },
|
|
77
|
+
{ tag: 'footer-setting', title: '頁腳' },
|
|
78
|
+
];
|
|
79
|
+
vmi.pageSize = 1;
|
|
80
|
+
vmi.originalData = vm.dataList;
|
|
81
|
+
vmi.tableData = getDatalist();
|
|
82
|
+
vmi.loading = false;
|
|
83
|
+
vmi.callback();
|
|
42
84
|
},
|
|
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
|
-
BgWidget.mainCard(
|
|
73
|
-
BgWidget.tableV3({
|
|
74
|
-
gvc: gvc,
|
|
75
|
-
getData: (vmi) => {
|
|
76
|
-
vm.dataList = [
|
|
77
|
-
{ tag: 'menu-setting', title: '主選單' },
|
|
78
|
-
{ tag: 'footer-setting', title: '頁腳' },
|
|
79
|
-
];
|
|
80
|
-
vmi.pageSize = 1;
|
|
81
|
-
vmi.originalData = vm.dataList;
|
|
82
|
-
vmi.tableData = getDatalist();
|
|
83
|
-
vmi.loading = false;
|
|
84
|
-
vmi.callback();
|
|
85
|
-
},
|
|
86
|
-
rowClick: (data, index) => {
|
|
87
|
-
vm.index = index;
|
|
88
|
-
vm.type = 'replace';
|
|
89
|
-
},
|
|
90
|
-
filter: [],
|
|
91
|
-
})
|
|
92
|
-
)
|
|
93
|
-
)}
|
|
94
|
-
`);
|
|
95
|
-
} else if (vm.type == 'add') {
|
|
96
|
-
return BgWidget.container(
|
|
97
|
-
this.setMenu({
|
|
98
|
-
gvc: gvc,
|
|
99
|
-
widget: widget,
|
|
100
|
-
title: '新增選單',
|
|
101
|
-
key: vm.dataList[vm.index].tag,
|
|
102
|
-
goBack: () => {},
|
|
103
|
-
})
|
|
104
|
-
);
|
|
105
|
-
} else {
|
|
106
|
-
return BgWidget.container(
|
|
107
|
-
this.setMenu({
|
|
108
|
-
gvc: gvc,
|
|
109
|
-
widget: widget,
|
|
110
|
-
key: vm.dataList[vm.index].tag,
|
|
111
|
-
title: vm.dataList[vm.index].title,
|
|
112
|
-
goBack: () => {
|
|
113
|
-
vm.type = 'list';
|
|
114
|
-
gvc.notifyDataChange(id);
|
|
115
|
-
},
|
|
116
|
-
})
|
|
117
|
-
);
|
|
118
|
-
}
|
|
119
|
-
},
|
|
120
|
-
divCreate: {
|
|
121
|
-
class: `mx-auto `,
|
|
122
|
-
style: `max-width:100%;width:960px;`,
|
|
85
|
+
rowClick: (data, index) => {
|
|
86
|
+
vm.index = index;
|
|
87
|
+
vm.type = 'replace';
|
|
88
|
+
},
|
|
89
|
+
filter: [],
|
|
90
|
+
})
|
|
91
|
+
)
|
|
92
|
+
)}
|
|
93
|
+
`);
|
|
94
|
+
} else if (vm.type == 'add') {
|
|
95
|
+
return BgWidget.container(
|
|
96
|
+
this.setMenu({
|
|
97
|
+
gvc: gvc,
|
|
98
|
+
widget: widget,
|
|
99
|
+
title: '新增選單',
|
|
100
|
+
key: vm.dataList[vm.index].tag,
|
|
101
|
+
goBack: () => {},
|
|
102
|
+
})
|
|
103
|
+
);
|
|
104
|
+
} else {
|
|
105
|
+
return BgWidget.container(
|
|
106
|
+
this.setMenu({
|
|
107
|
+
gvc: gvc,
|
|
108
|
+
widget: widget,
|
|
109
|
+
key: vm.dataList[vm.index].tag,
|
|
110
|
+
title: vm.dataList[vm.index].title,
|
|
111
|
+
goBack: () => {
|
|
112
|
+
vm.type = 'list';
|
|
113
|
+
gvc.notifyDataChange(id);
|
|
123
114
|
},
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
115
|
+
})
|
|
116
|
+
);
|
|
117
|
+
}
|
|
118
|
+
},
|
|
119
|
+
divCreate: {
|
|
120
|
+
class: `mx-auto `,
|
|
121
|
+
style: `max-width:100%;width:960px;`,
|
|
122
|
+
},
|
|
123
|
+
};
|
|
124
|
+
});
|
|
125
|
+
}
|
|
127
126
|
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
127
|
+
public static setMenu(cf: {
|
|
128
|
+
goBack: () => void;
|
|
129
|
+
gvc: GVC;
|
|
130
|
+
widget: any;
|
|
131
|
+
key: 'menu-setting' | 'footer-setting' | 'text-manager';
|
|
132
|
+
title: string;
|
|
133
|
+
}) {
|
|
134
|
+
const vm: {
|
|
135
|
+
id: string;
|
|
136
|
+
link: {
|
|
137
|
+
'en-US': MenuItem[];
|
|
138
|
+
'zh-CN': MenuItem[];
|
|
139
|
+
'zh-TW': MenuItem[];
|
|
140
|
+
};
|
|
141
|
+
loading: boolean;
|
|
142
|
+
selected: boolean;
|
|
143
|
+
language: LanguageLocation;
|
|
144
|
+
} = {
|
|
145
|
+
id: cf.gvc.glitter.getUUID(),
|
|
146
|
+
link: {
|
|
147
|
+
'en-US': [],
|
|
148
|
+
'zh-CN': [],
|
|
149
|
+
'zh-TW': [],
|
|
150
|
+
},
|
|
151
|
+
selected: false,
|
|
152
|
+
loading: true,
|
|
153
|
+
language: (window.parent as any).store_info.language_setting.def,
|
|
154
|
+
};
|
|
150
155
|
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
156
|
+
ApiUser.getPublicConfig(cf.key, 'manager').then((data: any) => {
|
|
157
|
+
if (data.response.value) {
|
|
158
|
+
vm.link = data.response.value;
|
|
159
|
+
}
|
|
160
|
+
gvc.notifyDataChange(vm.id);
|
|
161
|
+
});
|
|
157
162
|
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
163
|
+
function clearNoNeedData(items: MenuItem[]) {
|
|
164
|
+
items.map(dd => {
|
|
165
|
+
(dd as any).selected = undefined;
|
|
166
|
+
clearNoNeedData(dd.items || []);
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
function save() {
|
|
170
|
+
for (const a of ['en-US', 'zh-CN', 'zh-TW']) {
|
|
171
|
+
clearNoNeedData((vm.link as any)[a]);
|
|
172
|
+
}
|
|
168
173
|
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
174
|
+
cf.widget.event('loading', {
|
|
175
|
+
title: '儲存中...',
|
|
176
|
+
});
|
|
177
|
+
ApiUser.setPublicConfig({
|
|
178
|
+
key: cf.key,
|
|
179
|
+
value: vm.link,
|
|
180
|
+
user_id: 'manager',
|
|
181
|
+
}).then(data => {
|
|
182
|
+
setTimeout(() => {
|
|
183
|
+
cf.widget.event('loading', {
|
|
184
|
+
visible: false,
|
|
185
|
+
});
|
|
186
|
+
cf.widget.event('success', {
|
|
187
|
+
title: '儲存成功',
|
|
188
|
+
});
|
|
189
|
+
}, 1000);
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
function selectAll(array: MenuItem) {
|
|
193
|
+
(array as any).selected = true;
|
|
194
|
+
array.items.map(dd => {
|
|
195
|
+
(dd as any).selected = true;
|
|
196
|
+
selectAll(dd);
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
function clearAll(array: MenuItem) {
|
|
200
|
+
(array as any).selected = false;
|
|
201
|
+
array.items.map(dd => {
|
|
202
|
+
(dd as any).selected = false;
|
|
203
|
+
clearAll(dd);
|
|
204
|
+
});
|
|
205
|
+
}
|
|
206
|
+
function allSelect(dd: any) {
|
|
207
|
+
return (
|
|
208
|
+
!dd.items.find((d1: any) => {
|
|
209
|
+
return !(d1 as any).selected;
|
|
210
|
+
}) && (dd as any).selected
|
|
211
|
+
);
|
|
212
|
+
}
|
|
213
|
+
function getSelectCount(dd: any) {
|
|
214
|
+
let count = 0;
|
|
215
|
+
if (dd.selected) {
|
|
216
|
+
count++;
|
|
217
|
+
}
|
|
218
|
+
dd.items.map((d1: any) => {
|
|
219
|
+
count += getSelectCount(d1);
|
|
220
|
+
});
|
|
221
|
+
return count;
|
|
222
|
+
}
|
|
223
|
+
function deleteSelect(items: MenuItem[]) {
|
|
224
|
+
return items.filter(d1 => {
|
|
225
|
+
d1.items = deleteSelect(d1.items || []);
|
|
226
|
+
return !(d1 as any).selected;
|
|
227
|
+
});
|
|
228
|
+
}
|
|
224
229
|
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
230
|
+
const gvc = cf.gvc;
|
|
231
|
+
function refresh() {
|
|
232
|
+
gvc.notifyDataChange(vm.id);
|
|
233
|
+
}
|
|
234
|
+
return gvc.bindView(() => {
|
|
235
|
+
return {
|
|
236
|
+
bind: vm.id,
|
|
237
|
+
view: () => {
|
|
238
|
+
const link = vm.link[vm.language];
|
|
239
|
+
return html`<div class="title-container" style="width: 856px; max-width: 100%;">
|
|
240
|
+
${BgWidget.goBack(
|
|
241
|
+
cf.gvc.event(() => {
|
|
242
|
+
cf.goBack();
|
|
243
|
+
})
|
|
244
|
+
)}${BgWidget.title(cf.title ?? '選單設定')}
|
|
245
|
+
<div class="flex-fill"></div>
|
|
246
|
+
${LanguageBackend.switchBtn({
|
|
247
|
+
gvc: gvc,
|
|
248
|
+
language: vm.language,
|
|
249
|
+
callback: language => {
|
|
250
|
+
vm.language = language;
|
|
251
|
+
refresh();
|
|
252
|
+
},
|
|
253
|
+
})}
|
|
254
|
+
</div>
|
|
255
|
+
${BgWidget.container(
|
|
256
|
+
html`<div
|
|
257
|
+
style="max-width:100%;width: 856px; padding: 20px; background: white; box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.08); border-radius: 10px; overflow: hidden; justify-content: center; align-items: center; display: inline-flex"
|
|
258
|
+
>
|
|
259
|
+
<div style="width: 100%; position: relative">
|
|
260
|
+
<div
|
|
261
|
+
style="width: 100%; left: 0px; top: 0px; flex-direction: column; justify-content: flex-start; align-items: flex-start; gap: 20px; display: inline-flex"
|
|
262
|
+
>
|
|
263
|
+
<div
|
|
264
|
+
class="w-100 ${getSelectCount({
|
|
265
|
+
items: link,
|
|
266
|
+
}) > 0
|
|
267
|
+
? ``
|
|
268
|
+
: `d-none`}"
|
|
269
|
+
style="height: 40px; padding: 12px 18px;background: #F7F7F7; border-radius: 10px; justify-content: flex-end; align-items: center; gap: 8px; display: inline-flex"
|
|
270
|
+
>
|
|
271
|
+
<div
|
|
272
|
+
style="flex: 1 1 0; color: #393939; font-size: 14px; font-family: Noto Sans; font-weight: 700; word-wrap: break-word"
|
|
273
|
+
>
|
|
274
|
+
已選取${getSelectCount({
|
|
275
|
+
items: link,
|
|
276
|
+
})}項
|
|
277
|
+
</div>
|
|
278
|
+
<div
|
|
279
|
+
style="cursor:pointer;padding: 4px 14px;background: white; box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.10); border-radius: 20px; border: 1px #DDDDDD solid; justify-content: flex-start; align-items: flex-start; gap: 10px; display: flex"
|
|
280
|
+
>
|
|
281
|
+
<div
|
|
282
|
+
style="color: #393939; font-size: 14px; font-family: Noto Sans; font-weight: 400; word-wrap: break-word"
|
|
283
|
+
onclick="${gvc.event(() => {
|
|
284
|
+
vm.link[vm.language] = deleteSelect(link);
|
|
285
|
+
gvc.notifyDataChange(vm.id);
|
|
286
|
+
})}"
|
|
287
|
+
>
|
|
288
|
+
刪除
|
|
249
289
|
</div>
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
290
|
+
</div>
|
|
291
|
+
</div>
|
|
292
|
+
<div
|
|
293
|
+
class="d-flex align-items-center"
|
|
294
|
+
style="width: 100%; height: 22px; position: relative;gap:29px;"
|
|
295
|
+
>
|
|
296
|
+
<div
|
|
297
|
+
class="${allSelect({
|
|
298
|
+
items: link,
|
|
299
|
+
selected: !link.find(dd => {
|
|
300
|
+
return !(dd as any).selected;
|
|
301
|
+
}),
|
|
302
|
+
})
|
|
303
|
+
? `fa-solid fa-square-check`
|
|
304
|
+
: `fa-regular fa-square`}"
|
|
305
|
+
style="color:#393939;width: 16px; height: 16px;cursor: pointer;"
|
|
306
|
+
onclick="${cf.gvc.event((e, event) => {
|
|
307
|
+
event.stopPropagation();
|
|
308
|
+
|
|
309
|
+
if (
|
|
310
|
+
link.find(dd => {
|
|
311
|
+
return !(dd as any).selected;
|
|
312
|
+
})
|
|
313
|
+
) {
|
|
314
|
+
selectAll({
|
|
315
|
+
items: link,
|
|
316
|
+
} as any);
|
|
317
|
+
} else {
|
|
318
|
+
clearAll({
|
|
319
|
+
items: link,
|
|
320
|
+
} as any);
|
|
321
|
+
}
|
|
322
|
+
gvc.notifyDataChange(vm.id);
|
|
323
|
+
})}"
|
|
324
|
+
></div>
|
|
325
|
+
<div
|
|
326
|
+
style="left: 61px; top: 0px; color: #393939; font-size: 16px; font-family: Noto Sans; font-weight: 700; word-wrap: break-word"
|
|
327
|
+
>
|
|
328
|
+
選單名稱 ${BgWidget.languageInsignia(vm.language, 'margin-left:5px;')}
|
|
329
|
+
</div>
|
|
330
|
+
</div>
|
|
331
|
+
<div
|
|
332
|
+
style="align-self: stretch; flex-direction: column; justify-content: flex-start; align-items: flex-start; gap: 18px; display: flex"
|
|
333
|
+
>
|
|
334
|
+
${(() => {
|
|
335
|
+
function renderItems(array: MenuItem[]): string {
|
|
336
|
+
const id = gvc.glitter.getUUID();
|
|
337
|
+
return (
|
|
338
|
+
gvc.bindView(() => {
|
|
339
|
+
return {
|
|
340
|
+
bind: id,
|
|
341
|
+
view: () => {
|
|
342
|
+
return array
|
|
343
|
+
.map((dd, index) => {
|
|
344
|
+
const list = html`
|
|
256
345
|
<div
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
346
|
+
class=" w-100 "
|
|
347
|
+
style="width: 100%; justify-content: flex-start; align-items: center; gap: 5px; display: inline-flex;cursor: pointer;"
|
|
348
|
+
onclick="${cf.gvc.event(() => {
|
|
349
|
+
if (dd.items && dd.items.length > 0) {
|
|
350
|
+
(dd as any).toggle = !(dd as any).toggle;
|
|
351
|
+
gvc.notifyDataChange(vm.id);
|
|
352
|
+
}
|
|
353
|
+
})}"
|
|
263
354
|
>
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
355
|
+
<div
|
|
356
|
+
class="${allSelect(dd)
|
|
357
|
+
? `fa-solid fa-square-check`
|
|
358
|
+
: `fa-regular fa-square`}"
|
|
359
|
+
style="color:#393939;width: 16px; height: 16px;"
|
|
360
|
+
onclick="${cf.gvc.event((e, event) => {
|
|
361
|
+
event.stopPropagation();
|
|
362
|
+
(dd as any).selected = !(dd as any).selected;
|
|
363
|
+
if ((dd as any).selected) {
|
|
364
|
+
selectAll(dd);
|
|
365
|
+
} else {
|
|
366
|
+
clearAll(dd);
|
|
367
|
+
}
|
|
368
|
+
gvc.notifyDataChange(vm.id);
|
|
369
|
+
})}"
|
|
370
|
+
></div>
|
|
371
|
+
<div
|
|
372
|
+
class="hoverF2 pe-2 my-1"
|
|
373
|
+
style="width: 100%; justify-content: flex-start; align-items: center; gap: 8px; display: flex"
|
|
374
|
+
>
|
|
375
|
+
<i
|
|
376
|
+
class="ms-2 fa-solid fa-grip-dots-vertical color39 dragItem hoverBtn d-flex align-items-center justify-content-center"
|
|
377
|
+
style="cursor: pointer;width:25px;height: 25px;"
|
|
378
|
+
></i>
|
|
269
379
|
<div
|
|
270
|
-
|
|
380
|
+
style="flex-direction: column; justify-content: center; align-items: flex-start; gap: 2px; display: inline-flex;white-space: normal;word-break: break-all;"
|
|
271
381
|
>
|
|
382
|
+
<div
|
|
383
|
+
style="justify-content: flex-start; align-items: center; gap: 8px; display: inline-flex"
|
|
384
|
+
>
|
|
272
385
|
<div
|
|
273
|
-
|
|
274
|
-
onclick="${gvc.event(() => {
|
|
275
|
-
vm.link[vm.language] = deleteSelect(link);
|
|
276
|
-
gvc.notifyDataChange(vm.id);
|
|
277
|
-
})}"
|
|
386
|
+
style="color: #393939; font-size: 16px; font-family: Noto Sans; font-weight: 400; word-break: break-all;"
|
|
278
387
|
>
|
|
279
|
-
|
|
388
|
+
${dd.title}
|
|
280
389
|
</div>
|
|
390
|
+
${dd.items && dd.items.length > 0
|
|
391
|
+
? !(dd as any).toggle
|
|
392
|
+
? `<i class="fa-solid fa-angle-down color39"></i>`
|
|
393
|
+
: `<i class="fa-solid fa-angle-up color39"></i>`
|
|
394
|
+
: ``}
|
|
395
|
+
</div>
|
|
396
|
+
<div
|
|
397
|
+
style="justify-content: flex-start; align-items: center; gap: 8px; display: inline-flex;white-space: normal;word-break: break-all;"
|
|
398
|
+
>
|
|
399
|
+
<div
|
|
400
|
+
style="color: #3366BB; font-size: 14px; font-family: Noto Sans; font-weight: 400; line-height: 14px; word-wrap: break-word"
|
|
401
|
+
>
|
|
402
|
+
${dd.title}
|
|
403
|
+
</div>
|
|
404
|
+
<div
|
|
405
|
+
style="color: #159240; font-size: 14px; font-family: Noto Sans; font-weight: 400; word-wrap: break-word"
|
|
406
|
+
>
|
|
407
|
+
${dd.link}
|
|
408
|
+
</div>
|
|
409
|
+
</div>
|
|
281
410
|
</div>
|
|
282
|
-
|
|
283
|
-
<div class="d-flex align-items-center" style="width: 100%; height: 22px; position: relative;gap:29px;">
|
|
411
|
+
<div class="flex-fill"></div>
|
|
284
412
|
<div
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
:
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
if (
|
|
298
|
-
link.find((dd) => {
|
|
299
|
-
return !(dd as any).selected;
|
|
300
|
-
})
|
|
301
|
-
) {
|
|
302
|
-
selectAll({
|
|
303
|
-
items: link,
|
|
304
|
-
} as any);
|
|
305
|
-
} else {
|
|
306
|
-
clearAll({
|
|
307
|
-
items: link,
|
|
308
|
-
} as any);
|
|
309
|
-
}
|
|
413
|
+
class="child me-2"
|
|
414
|
+
onclick="${cf.gvc.event((e, event) => {
|
|
415
|
+
event.stopPropagation();
|
|
416
|
+
MenusSetting.editEvent(
|
|
417
|
+
{
|
|
418
|
+
link: '',
|
|
419
|
+
title: '',
|
|
420
|
+
items: [],
|
|
421
|
+
},
|
|
422
|
+
data => {
|
|
423
|
+
dd.items = dd.items || [];
|
|
424
|
+
dd.items.push(data);
|
|
310
425
|
gvc.notifyDataChange(vm.id);
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
426
|
+
}
|
|
427
|
+
);
|
|
428
|
+
})}"
|
|
429
|
+
>
|
|
430
|
+
<i class="fa-solid fa-plus" style="color:#393939;"></i>
|
|
431
|
+
</div>
|
|
432
|
+
<div
|
|
433
|
+
class="child"
|
|
434
|
+
onclick="${cf.gvc.event((e, event) => {
|
|
435
|
+
event.stopPropagation();
|
|
436
|
+
MenusSetting.editEvent(dd, data => {
|
|
437
|
+
array[index] = data;
|
|
438
|
+
gvc.notifyDataChange(vm.id);
|
|
439
|
+
});
|
|
440
|
+
})}"
|
|
441
|
+
>
|
|
442
|
+
<i class="fa-solid fa-pencil" style="color:#393939;"></i>
|
|
443
|
+
</div>
|
|
444
|
+
</div>
|
|
314
445
|
</div>
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
></div>
|
|
351
|
-
<div
|
|
352
|
-
class="hoverF2 pe-2 my-1"
|
|
353
|
-
style="width: 100%; justify-content: flex-start; align-items: center; gap: 8px; display: flex"
|
|
354
|
-
>
|
|
355
|
-
<i
|
|
356
|
-
class="ms-2 fa-solid fa-grip-dots-vertical color39 dragItem hoverBtn d-flex align-items-center justify-content-center"
|
|
357
|
-
style="cursor: pointer;width:25px;height: 25px;"
|
|
358
|
-
></i>
|
|
359
|
-
<div
|
|
360
|
-
style="flex-direction: column; justify-content: center; align-items: flex-start; gap: 2px; display: inline-flex;white-space: normal;word-break: break-all;"
|
|
361
|
-
>
|
|
362
|
-
<div style="justify-content: flex-start; align-items: center; gap: 8px; display: inline-flex">
|
|
363
|
-
<div
|
|
364
|
-
style="color: #393939; font-size: 16px; font-family: Noto Sans; font-weight: 400; word-break: break-all;"
|
|
365
|
-
>
|
|
366
|
-
${dd.title}
|
|
367
|
-
</div>
|
|
368
|
-
${dd.items && dd.items.length > 0
|
|
369
|
-
? !(dd as any).toggle
|
|
370
|
-
? `<i class="fa-solid fa-angle-down color39"></i>`
|
|
371
|
-
: `<i class="fa-solid fa-angle-up color39"></i>`
|
|
372
|
-
: ``}
|
|
373
|
-
</div>
|
|
374
|
-
<div
|
|
375
|
-
style="justify-content: flex-start; align-items: center; gap: 8px; display: inline-flex;white-space: normal;word-break: break-all;"
|
|
376
|
-
>
|
|
377
|
-
<div
|
|
378
|
-
style="color: #3366BB; font-size: 14px; font-family: Noto Sans; font-weight: 400; line-height: 14px; word-wrap: break-word"
|
|
379
|
-
>
|
|
380
|
-
${dd.title}
|
|
381
|
-
</div>
|
|
382
|
-
<div
|
|
383
|
-
style="color: #159240; font-size: 14px; font-family: Noto Sans; font-weight: 400; word-wrap: break-word"
|
|
384
|
-
>
|
|
385
|
-
${dd.link}
|
|
386
|
-
</div>
|
|
387
|
-
</div>
|
|
388
|
-
</div>
|
|
389
|
-
<div class="flex-fill"></div>
|
|
390
|
-
<div
|
|
391
|
-
class="child me-2"
|
|
392
|
-
onclick="${cf.gvc.event((e, event) => {
|
|
393
|
-
event.stopPropagation();
|
|
394
|
-
MenusSetting.editEvent(
|
|
395
|
-
{
|
|
396
|
-
link: '',
|
|
397
|
-
title: '',
|
|
398
|
-
items: [],
|
|
399
|
-
},
|
|
400
|
-
(data) => {
|
|
401
|
-
dd.items = dd.items || [];
|
|
402
|
-
dd.items.push(data);
|
|
403
|
-
gvc.notifyDataChange(vm.id);
|
|
404
|
-
}
|
|
405
|
-
);
|
|
406
|
-
})}"
|
|
407
|
-
>
|
|
408
|
-
<i class="fa-solid fa-plus" style="color:#393939;"></i>
|
|
409
|
-
</div>
|
|
410
|
-
<div
|
|
411
|
-
class="child"
|
|
412
|
-
onclick="${cf.gvc.event((e, event) => {
|
|
413
|
-
event.stopPropagation();
|
|
414
|
-
MenusSetting.editEvent(dd, (data) => {
|
|
415
|
-
array[index] = data;
|
|
416
|
-
gvc.notifyDataChange(vm.id);
|
|
417
|
-
});
|
|
418
|
-
})}"
|
|
419
|
-
>
|
|
420
|
-
<i class="fa-solid fa-pencil" style="color:#393939;"></i>
|
|
421
|
-
</div>
|
|
422
|
-
</div>
|
|
423
|
-
</div>
|
|
424
|
-
${dd.items && dd.items.length > 0
|
|
425
|
-
? html`
|
|
426
|
-
<div class=" w-100 ${(dd as any).toggle ? `` : `d-none`}" style="padding-left: 35px;">
|
|
427
|
-
${renderItems(dd.items as MenuItem[]) as any}
|
|
428
|
-
</div>
|
|
429
|
-
`
|
|
430
|
-
: ``}
|
|
431
|
-
`;
|
|
432
|
-
return html`<li class="w-100 ">${list}</li>`;
|
|
433
|
-
})
|
|
434
|
-
.join('');
|
|
435
|
-
},
|
|
436
|
-
divCreate: {
|
|
437
|
-
elem: 'ul',
|
|
438
|
-
class: `w-100 my-2`,
|
|
439
|
-
style: `display:flex;flex-direction: column;gap:18px;`,
|
|
440
|
-
},
|
|
441
|
-
onCreate: () => {
|
|
442
|
-
gvc.glitter.addMtScript(
|
|
443
|
-
[
|
|
444
|
-
{
|
|
445
|
-
src: `https://raw.githack.com/SortableJS/Sortable/master/Sortable.js`,
|
|
446
|
-
},
|
|
447
|
-
],
|
|
448
|
-
() => {},
|
|
449
|
-
() => {}
|
|
450
|
-
);
|
|
451
|
-
const interval = setInterval(() => {
|
|
452
|
-
//@ts-ignore
|
|
453
|
-
if (window.Sortable) {
|
|
454
|
-
try {
|
|
455
|
-
gvc.addStyle(`
|
|
446
|
+
${dd.items && dd.items.length > 0
|
|
447
|
+
? html`
|
|
448
|
+
<div
|
|
449
|
+
class=" w-100 ${(dd as any).toggle ? `` : `d-none`}"
|
|
450
|
+
style="padding-left: 35px;"
|
|
451
|
+
>
|
|
452
|
+
${renderItems(dd.items as MenuItem[]) as any}
|
|
453
|
+
</div>
|
|
454
|
+
`
|
|
455
|
+
: ``}
|
|
456
|
+
`;
|
|
457
|
+
return html`<li class="w-100 ">${list}</li>`;
|
|
458
|
+
})
|
|
459
|
+
.join('');
|
|
460
|
+
},
|
|
461
|
+
divCreate: {
|
|
462
|
+
elem: 'ul',
|
|
463
|
+
class: `w-100 my-2`,
|
|
464
|
+
style: `display:flex;flex-direction: column;gap:18px;`,
|
|
465
|
+
},
|
|
466
|
+
onCreate: () => {
|
|
467
|
+
gvc.glitter.addMtScript(
|
|
468
|
+
[
|
|
469
|
+
{
|
|
470
|
+
src: `https://raw.githack.com/SortableJS/Sortable/master/Sortable.js`,
|
|
471
|
+
},
|
|
472
|
+
],
|
|
473
|
+
() => {},
|
|
474
|
+
() => {}
|
|
475
|
+
);
|
|
476
|
+
const interval = setInterval(() => {
|
|
477
|
+
//@ts-ignore
|
|
478
|
+
if (window.Sortable) {
|
|
479
|
+
try {
|
|
480
|
+
gvc.addStyle(`
|
|
456
481
|
ul {
|
|
457
482
|
list-style: none;
|
|
458
483
|
padding: 0;
|
|
459
484
|
}
|
|
460
485
|
`);
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
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
|
-
return renderItems(link);
|
|
515
|
-
})()}
|
|
516
|
-
</div>
|
|
517
|
-
</div>
|
|
486
|
+
function swapArr(arr: any, index1: number, index2: number) {
|
|
487
|
+
const data = arr[index1];
|
|
488
|
+
arr.splice(index1, 1);
|
|
489
|
+
arr.splice(index2, 0, data);
|
|
490
|
+
}
|
|
491
|
+
let startIndex = 0;
|
|
492
|
+
//@ts-ignore
|
|
493
|
+
Sortable.create(gvc.getBindViewElem(id).get(0), {
|
|
494
|
+
group: id,
|
|
495
|
+
animation: 100,
|
|
496
|
+
handle: '.dragItem',
|
|
497
|
+
onChange: function (evt: any) {},
|
|
498
|
+
onEnd: (evt: any) => {
|
|
499
|
+
swapArr(array, startIndex, evt.newIndex);
|
|
500
|
+
gvc.notifyDataChange(id);
|
|
501
|
+
},
|
|
502
|
+
onStart: function (evt: any) {
|
|
503
|
+
startIndex = evt.oldIndex;
|
|
504
|
+
},
|
|
505
|
+
});
|
|
506
|
+
} catch (e) {}
|
|
507
|
+
clearInterval(interval);
|
|
508
|
+
}
|
|
509
|
+
}, 100);
|
|
510
|
+
},
|
|
511
|
+
};
|
|
512
|
+
}) +
|
|
513
|
+
html` <div
|
|
514
|
+
style="cursor:pointer;align-self: stretch; height: 50px; flex-direction: column; justify-content: flex-start; align-items: flex-start; gap: 10px; display: flex"
|
|
515
|
+
onclick="${cf.gvc.event(() => {
|
|
516
|
+
MenusSetting.editEvent(
|
|
517
|
+
{
|
|
518
|
+
link: '',
|
|
519
|
+
title: '',
|
|
520
|
+
items: [],
|
|
521
|
+
},
|
|
522
|
+
data => {
|
|
523
|
+
array.push(data);
|
|
524
|
+
gvc.notifyDataChange(vm.id);
|
|
525
|
+
}
|
|
526
|
+
);
|
|
527
|
+
})}"
|
|
528
|
+
>
|
|
529
|
+
<div
|
|
530
|
+
style="align-self: stretch; height: 54px; border-radius: 10px; border: 1px #DDDDDD solid; justify-content: center; align-items: center; gap: 6px; display: inline-flex"
|
|
531
|
+
>
|
|
532
|
+
<i class="fa-solid fa-plus" style="color: #3366BB;font-size: 16px; "></i>
|
|
533
|
+
<div
|
|
534
|
+
style="color: #3366BB; font-size: 16px; font-family: Noto Sans; font-weight: 400; word-wrap: break-word"
|
|
535
|
+
>
|
|
536
|
+
新增選單
|
|
518
537
|
</div>
|
|
538
|
+
</div>
|
|
519
539
|
</div>`
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
${BgWidget.cancel(
|
|
523
|
-
gvc.event(() => {
|
|
524
|
-
cf.goBack();
|
|
525
|
-
})
|
|
526
|
-
)}
|
|
527
|
-
${BgWidget.save(
|
|
528
|
-
gvc.event(() => {
|
|
529
|
-
save();
|
|
530
|
-
})
|
|
531
|
-
)}
|
|
532
|
-
</div>`;
|
|
533
|
-
},
|
|
534
|
-
divCreate: {
|
|
535
|
-
style: `padding-bottom:60px;`,
|
|
536
|
-
},
|
|
537
|
-
};
|
|
538
|
-
});
|
|
539
|
-
}
|
|
540
|
+
);
|
|
541
|
+
}
|
|
540
542
|
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
543
|
+
return renderItems(link);
|
|
544
|
+
})()}
|
|
545
|
+
</div>
|
|
546
|
+
</div>
|
|
547
|
+
</div>
|
|
548
|
+
</div>`
|
|
549
|
+
)}
|
|
550
|
+
<div class="update-bar-container">
|
|
551
|
+
${BgWidget.cancel(
|
|
552
|
+
gvc.event(() => {
|
|
553
|
+
cf.goBack();
|
|
554
|
+
})
|
|
555
|
+
)}
|
|
556
|
+
${BgWidget.save(
|
|
557
|
+
gvc.event(() => {
|
|
558
|
+
save();
|
|
559
|
+
})
|
|
560
|
+
)}
|
|
561
|
+
</div>`;
|
|
562
|
+
},
|
|
563
|
+
divCreate: {
|
|
564
|
+
style: `padding-bottom:60px;`,
|
|
565
|
+
},
|
|
566
|
+
};
|
|
567
|
+
});
|
|
568
|
+
}
|
|
544
569
|
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
default: data.link || '',
|
|
573
|
-
placeHolder: '選擇或貼上外部連結',
|
|
574
|
-
callback: (text) => {
|
|
575
|
-
data.link = text;
|
|
576
|
-
},
|
|
577
|
-
}),
|
|
578
|
-
].join('');
|
|
579
|
-
},
|
|
580
|
-
divCreate: {
|
|
581
|
-
style: `padding:20px;`,
|
|
582
|
-
},
|
|
583
|
-
};
|
|
570
|
+
public static editEvent(data: MenuItem, save: (data: MenuItem) => void) {
|
|
571
|
+
const gvc: GVC = (window.parent as any).glitter.pageConfig[0].gvc;
|
|
572
|
+
const rightMenu = (window.parent as any).glitter.share.NormalPageEditor;
|
|
573
|
+
|
|
574
|
+
rightMenu.closeEvent = () => {
|
|
575
|
+
if (data.title.length > 0 || data.link.length > 0) {
|
|
576
|
+
save(data);
|
|
577
|
+
}
|
|
578
|
+
};
|
|
579
|
+
rightMenu.toggle({
|
|
580
|
+
visible: true,
|
|
581
|
+
title: '新增選單',
|
|
582
|
+
view: [
|
|
583
|
+
gvc.bindView(() => {
|
|
584
|
+
const id = gvc.glitter.getUUID();
|
|
585
|
+
return {
|
|
586
|
+
bind: id,
|
|
587
|
+
view: () => {
|
|
588
|
+
return [
|
|
589
|
+
EditorElem.editeInput({
|
|
590
|
+
gvc: gvc,
|
|
591
|
+
title: '選單名稱',
|
|
592
|
+
default: data.title || '',
|
|
593
|
+
placeHolder: '請輸入選單名稱',
|
|
594
|
+
callback: text => {
|
|
595
|
+
data.title = text;
|
|
596
|
+
},
|
|
584
597
|
}),
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
598
|
+
BgWidget.linkList({
|
|
599
|
+
gvc: gvc,
|
|
600
|
+
title: '',
|
|
601
|
+
default: data.link || '',
|
|
602
|
+
placeHolder: '選擇或貼上外部連結',
|
|
603
|
+
callback: text => {
|
|
604
|
+
data.link = text;
|
|
605
|
+
},
|
|
606
|
+
}),
|
|
607
|
+
].join('');
|
|
608
|
+
},
|
|
609
|
+
divCreate: {
|
|
610
|
+
style: `padding:20px;`,
|
|
611
|
+
},
|
|
612
|
+
};
|
|
613
|
+
}),
|
|
614
|
+
].join(''),
|
|
615
|
+
right: true,
|
|
616
|
+
});
|
|
617
|
+
}
|
|
589
618
|
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
619
|
+
public static collectionEvent(data: MenuItem, save: (data: MenuItem) => boolean) {
|
|
620
|
+
const gvc: GVC = (window.parent as any).glitter.pageConfig[0].gvc;
|
|
621
|
+
const rightMenu = (window.parent as any).glitter.share.NormalPageEditor;
|
|
622
|
+
const id = gvc.glitter.getUUID();
|
|
594
623
|
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
}),
|
|
618
|
-
BgWidget.editeInput({
|
|
619
|
-
gvc: gvc,
|
|
620
|
-
title: '',
|
|
621
|
-
default: data.link || '',
|
|
622
|
-
placeHolder: '請輸入分類標籤',
|
|
623
|
-
callback: (text) => {
|
|
624
|
-
data.link = text;
|
|
625
|
-
},
|
|
626
|
-
}),
|
|
627
|
-
].join('');
|
|
628
|
-
},
|
|
629
|
-
divCreate: {
|
|
630
|
-
style: `padding:20px;`,
|
|
631
|
-
},
|
|
632
|
-
};
|
|
624
|
+
rightMenu.closeEvent = () => {
|
|
625
|
+
if (data.title.length > 0 && data.link.length > 0) {
|
|
626
|
+
save(data);
|
|
627
|
+
}
|
|
628
|
+
};
|
|
629
|
+
rightMenu.toggle({
|
|
630
|
+
visible: true,
|
|
631
|
+
title: '新增分類',
|
|
632
|
+
view: [
|
|
633
|
+
gvc.bindView(() => {
|
|
634
|
+
return {
|
|
635
|
+
bind: id,
|
|
636
|
+
view: () => {
|
|
637
|
+
return [
|
|
638
|
+
BgWidget.editeInput({
|
|
639
|
+
gvc: gvc,
|
|
640
|
+
title: '分類名稱',
|
|
641
|
+
default: data.title || '',
|
|
642
|
+
placeHolder: '請輸入分類名稱',
|
|
643
|
+
callback: text => {
|
|
644
|
+
data.title = text;
|
|
645
|
+
},
|
|
633
646
|
}),
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
647
|
+
BgWidget.editeInput({
|
|
648
|
+
gvc: gvc,
|
|
649
|
+
title: '',
|
|
650
|
+
default: data.link || '',
|
|
651
|
+
placeHolder: '請輸入分類標籤',
|
|
652
|
+
callback: text => {
|
|
653
|
+
data.link = text;
|
|
654
|
+
},
|
|
655
|
+
}),
|
|
656
|
+
].join('');
|
|
657
|
+
},
|
|
658
|
+
divCreate: {
|
|
659
|
+
style: `padding:20px;`,
|
|
660
|
+
},
|
|
661
|
+
};
|
|
662
|
+
}),
|
|
663
|
+
].join(''),
|
|
664
|
+
right: true,
|
|
665
|
+
});
|
|
666
|
+
}
|
|
638
667
|
}
|
|
639
668
|
|
|
640
669
|
(window as any).glitter.setModule(import.meta.url, MenusSetting);
|