ts-glitter 21.1.5 → 21.1.7
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/create.js +1 -0
- package/lowcode/Entry.js +1 -1
- package/lowcode/Entry.ts +1 -1
- package/lowcode/cms-plugin/module/order-excel.js +256 -132
- package/lowcode/cms-plugin/module/order-excel.ts +228 -81
- package/lowcode/cms-plugin/shopping-finance-setting.js +1 -1
- package/lowcode/cms-plugin/shopping-finance-setting.ts +1 -1
- package/lowcode/cms-plugin/shopping-order-manager.js +33 -29
- package/lowcode/cms-plugin/shopping-order-manager.ts +36 -30
- package/lowcode/editor-components/global-widget/bridge.js +43 -0
- package/lowcode/editor-components/global-widget/bridge.ts +46 -0
- package/lowcode/editor-components/global-widget/global-widget.js +254 -0
- package/lowcode/editor-components/global-widget/global-widget.ts +269 -0
- package/lowcode/editor-components/global-widget/src/banner.jpg +0 -0
- package/lowcode/editor-components/global-widget/src/footer.jpg +0 -0
- package/lowcode/editor-components/global-widget/src/header.png +0 -0
- package/lowcode/editor-components/global-widget/src/product.jpg +0 -0
- package/lowcode/glitterBundle/plugins/editor-elem.js +14 -4
- package/lowcode/glitterBundle/plugins/editor-elem.ts +13 -4
- package/lowcode/jspage/function-page/main_editor.js +14 -10
- package/lowcode/jspage/function-page/main_editor.ts +14 -10
- package/lowcode/jspage/function-page/tool-setting.js +260 -300
- package/lowcode/jspage/function-page/tool-setting.ts +350 -384
- package/lowcode/official_view_component/official/component.ts +1 -0
- package/lowcode/public-components/checkout/index.js +32 -1
- package/lowcode/public-components/checkout/index.ts +32 -1
- package/lowcode/public-components/product/pd-card-01.js +0 -58
- package/lowcode/public-components/product/pd-card-01.ts +0 -45
- package/lowcode/public-components/product/pd-card-02.js +1 -59
- package/lowcode/public-components/product/pd-card-02.ts +1 -45
- package/lowcode/public-components/product/pd-card-03.js +2 -59
- package/lowcode/public-components/product/pd-card-03.ts +2 -46
- package/package.json +3 -1
- package/src/api-public/services/financial-serviceV2.js +17 -7
- package/src/api-public/services/financial-serviceV2.js.map +1 -1
- package/src/api-public/services/post.js +17 -7
- package/src/api-public/services/post.js.map +1 -1
- package/src/api-public/services/shopee.js +17 -7
- package/src/api-public/services/shopee.js.map +1 -1
- package/src/api-public/services/shopping.js.map +1 -1
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { ToolSetting } from '../../jspage/function-page/tool-setting.js';
|
|
2
|
+
export class Bridge {
|
|
3
|
+
static main(obj) {
|
|
4
|
+
const gvc = obj.gvc;
|
|
5
|
+
const glitter = gvc.glitter;
|
|
6
|
+
return [
|
|
7
|
+
`<div style="height:5px;"></div>`,
|
|
8
|
+
ToolSetting.item({
|
|
9
|
+
gvc: gvc,
|
|
10
|
+
dd: (() => {
|
|
11
|
+
switch (glitter.share.editorViewModel.selectItem.data.tag) {
|
|
12
|
+
case 'c_header':
|
|
13
|
+
return {
|
|
14
|
+
title: '標頭選單',
|
|
15
|
+
tag: '標頭元件',
|
|
16
|
+
hint: `全館 (首頁,隱形賣場,一頁式網頁) 的標頭將預設為以下樣式`,
|
|
17
|
+
toggle: true
|
|
18
|
+
};
|
|
19
|
+
case 'footer':
|
|
20
|
+
return {
|
|
21
|
+
title: '頁腳選單',
|
|
22
|
+
tag: '頁腳元件',
|
|
23
|
+
hint: `全館 (首頁,隱形賣場,一頁式網頁) 的頁腳將預設為以下樣式`,
|
|
24
|
+
toggle: true
|
|
25
|
+
};
|
|
26
|
+
case 'SY00-normal-products':
|
|
27
|
+
case 'SY02_page_product':
|
|
28
|
+
case 'SY00-normal-scroll-products':
|
|
29
|
+
return {
|
|
30
|
+
title: '商品卡片',
|
|
31
|
+
tag: '商品卡片',
|
|
32
|
+
hint: `全館 (首頁,隱形賣場,一頁式網頁) 的商品卡片將預設為以下樣式`,
|
|
33
|
+
toggle: true,
|
|
34
|
+
editable: true
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
})(),
|
|
38
|
+
}),
|
|
39
|
+
`<div style="height:1px;" class="border-top mx-n3"></div>`,
|
|
40
|
+
].join(`<div style="height:10px;"></div>`);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
window.glitter.setModule(import.meta.url, Bridge);
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { GVC } from '../../glitterBundle/GVController.js';
|
|
2
|
+
import { ToolSetting } from '../../jspage/function-page/tool-setting.js';
|
|
3
|
+
|
|
4
|
+
export class Bridge {
|
|
5
|
+
public static main(obj: any) {
|
|
6
|
+
const gvc: GVC = obj.gvc;
|
|
7
|
+
const glitter = gvc.glitter;
|
|
8
|
+
return [
|
|
9
|
+
`<div style="height:5px;"></div>`,
|
|
10
|
+
ToolSetting.item({
|
|
11
|
+
gvc: gvc,
|
|
12
|
+
dd: (() => {
|
|
13
|
+
switch (glitter.share.editorViewModel.selectItem.data.tag){
|
|
14
|
+
case 'c_header':
|
|
15
|
+
return {
|
|
16
|
+
title: '標頭選單',
|
|
17
|
+
tag: '標頭元件',
|
|
18
|
+
hint: `全館 (首頁,隱形賣場,一頁式網頁) 的標頭將預設為以下樣式`,
|
|
19
|
+
toggle:true
|
|
20
|
+
};
|
|
21
|
+
case 'footer':
|
|
22
|
+
return {
|
|
23
|
+
title: '頁腳選單',
|
|
24
|
+
tag: '頁腳元件',
|
|
25
|
+
hint: `全館 (首頁,隱形賣場,一頁式網頁) 的頁腳將預設為以下樣式`,
|
|
26
|
+
toggle:true
|
|
27
|
+
};
|
|
28
|
+
case 'SY00-normal-products':
|
|
29
|
+
case 'SY02_page_product':
|
|
30
|
+
case 'SY00-normal-scroll-products':
|
|
31
|
+
return {
|
|
32
|
+
title: '商品卡片',
|
|
33
|
+
tag: '商品卡片',
|
|
34
|
+
hint: `全館 (首頁,隱形賣場,一頁式網頁) 的商品卡片將預設為以下樣式`,
|
|
35
|
+
toggle:true,
|
|
36
|
+
editable:true
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
})(),
|
|
40
|
+
}),
|
|
41
|
+
`<div style="height:1px;" class="border-top mx-n3"></div>`,
|
|
42
|
+
].join(`<div style="height:10px;"></div>`);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
(window as any).glitter.setModule(import.meta.url, Bridge);
|
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import { NormalPageEditor } from '../../editor/normal-page-editor.js';
|
|
11
|
+
import { ApiPageConfig } from '../../api/pageConfig.js';
|
|
12
|
+
import { ShareDialog } from '../../glitterBundle/dialog/ShareDialog.js';
|
|
13
|
+
export class GlobalWidget {
|
|
14
|
+
static main(obg) {
|
|
15
|
+
const gvc = obg.gvc;
|
|
16
|
+
const vm = {
|
|
17
|
+
select: obg.def || '標頭元件',
|
|
18
|
+
left_id: gvc.glitter.getUUID(),
|
|
19
|
+
right_id: gvc.glitter.getUUID(),
|
|
20
|
+
};
|
|
21
|
+
let data = undefined;
|
|
22
|
+
const html = String.raw;
|
|
23
|
+
return html ` <div class="w-100 d-flex">
|
|
24
|
+
<div class="d-flex flex-column border-end" style="width:200px;">
|
|
25
|
+
${gvc.bindView(() => {
|
|
26
|
+
return {
|
|
27
|
+
bind: vm.left_id,
|
|
28
|
+
view: () => {
|
|
29
|
+
return html `
|
|
30
|
+
<div class="w-100" style=" overflow-y: auto;">
|
|
31
|
+
<div class="d-flex flex-column ">
|
|
32
|
+
${GlobalWidget.leftSelect
|
|
33
|
+
.map((dd, index) => {
|
|
34
|
+
return html `
|
|
35
|
+
<div class="rounded-3">
|
|
36
|
+
<div
|
|
37
|
+
class="d-flex flex-column justify-content-center w-100 "
|
|
38
|
+
style="gap:5px;cursor:pointer;${vm.select === dd.tag
|
|
39
|
+
? `overflow:hidden;background: #FFB400;border: 1px solid #FF6C02;padding:10px;border-radius: 5px;`
|
|
40
|
+
: ``}"
|
|
41
|
+
>
|
|
42
|
+
<div
|
|
43
|
+
class="card w-100 position-relative rounded hoverHidden bgf6 rounded-3"
|
|
44
|
+
style="padding-bottom: 56%;"
|
|
45
|
+
onclick="${gvc.event(() => {
|
|
46
|
+
vm.select = dd.tag;
|
|
47
|
+
gvc.notifyDataChange([vm.left_id, vm.right_id]);
|
|
48
|
+
})}"
|
|
49
|
+
>
|
|
50
|
+
<div
|
|
51
|
+
class="position-absolute w-100 h-100 d-flex align-items-center justify-content-center rounded-3"
|
|
52
|
+
style="overflow: hidden;"
|
|
53
|
+
>
|
|
54
|
+
<img class="w-100 " src="${dd.src}" />
|
|
55
|
+
</div>
|
|
56
|
+
|
|
57
|
+
<div
|
|
58
|
+
class="position-absolute w-100 h-100 align-items-center justify-content-center rounded fs-6 flex-column"
|
|
59
|
+
style="background: rgba(0,0,0,0.5);gap:5px;"
|
|
60
|
+
>
|
|
61
|
+
<button
|
|
62
|
+
class="btn btn-secondary d-flex align-items-center "
|
|
63
|
+
style="height: 28px;width: 75px;gap:5px;"
|
|
64
|
+
>
|
|
65
|
+
選擇
|
|
66
|
+
</button>
|
|
67
|
+
</div>
|
|
68
|
+
</div>
|
|
69
|
+
<div
|
|
70
|
+
class="mb-0 d-flex justify-content-center align-items-center fw-bold"
|
|
71
|
+
style="font-size:15px;"
|
|
72
|
+
>
|
|
73
|
+
${dd.title}
|
|
74
|
+
</div>
|
|
75
|
+
</div>
|
|
76
|
+
</div>
|
|
77
|
+
`;
|
|
78
|
+
})
|
|
79
|
+
.join(`<div class="my-2"></div>`)}
|
|
80
|
+
</div>
|
|
81
|
+
</div>
|
|
82
|
+
`;
|
|
83
|
+
},
|
|
84
|
+
divCreate: {
|
|
85
|
+
style: 'height: calc(100vh - 125px) !important;overflow-y:auto;',
|
|
86
|
+
class: `p-2`,
|
|
87
|
+
},
|
|
88
|
+
};
|
|
89
|
+
})}
|
|
90
|
+
</div>
|
|
91
|
+
<div class="" style="${document.body.clientWidth < 768 ? `width: calc(100%)` : `width: calc(100% - 200px)`};">
|
|
92
|
+
${gvc.bindView(() => {
|
|
93
|
+
return {
|
|
94
|
+
bind: vm.right_id,
|
|
95
|
+
view: () => __awaiter(this, void 0, void 0, function* () {
|
|
96
|
+
if (!vm.select) {
|
|
97
|
+
return `<div class="w-100 p-3 d-flex align-items-center justify-content-center flex-column"
|
|
98
|
+
style="gap: 10px;">
|
|
99
|
+
<div class="spinner-border fs-5"></div>
|
|
100
|
+
<div class="fs-6 fw-500">載入中...</div>
|
|
101
|
+
</div>`;
|
|
102
|
+
}
|
|
103
|
+
let module_list = (yield ApiPageConfig.getPageTemplate({
|
|
104
|
+
template_from: 'all',
|
|
105
|
+
page: '0',
|
|
106
|
+
limit: '3000',
|
|
107
|
+
type: 'module',
|
|
108
|
+
tag: vm.select,
|
|
109
|
+
})).response.result.data;
|
|
110
|
+
return module_list
|
|
111
|
+
.map((dd) => {
|
|
112
|
+
return `
|
|
113
|
+
<div class="d-flex align-items-center justify-content-center bgf6 hoverHidden position-relative py-4" style="min-height:200px;">
|
|
114
|
+
<img class="w-100" src="${dd.template_config.image[0]}">
|
|
115
|
+
<div
|
|
116
|
+
class="position-absolute w-100 h-100 align-items-center justify-content-center rounded fs-6 flex-column"
|
|
117
|
+
style="background: rgba(0,0,0,0.5);gap:5px;"
|
|
118
|
+
>
|
|
119
|
+
<button
|
|
120
|
+
class="btn btn-secondary d-flex align-items-center "
|
|
121
|
+
style="height: 28px;width: 75px;gap:5px;"
|
|
122
|
+
onclick="${gvc.event(() => __awaiter(this, void 0, void 0, function* () {
|
|
123
|
+
const ci_tag = (() => {
|
|
124
|
+
switch (vm.select) {
|
|
125
|
+
case '標頭元件':
|
|
126
|
+
return 'c_header';
|
|
127
|
+
case '頁腳元件':
|
|
128
|
+
return `footer`;
|
|
129
|
+
case '商品卡片':
|
|
130
|
+
return `product_widget`;
|
|
131
|
+
case '廣告輪播':
|
|
132
|
+
return 'advertise';
|
|
133
|
+
}
|
|
134
|
+
})();
|
|
135
|
+
let widget = yield (() => __awaiter(this, void 0, void 0, function* () {
|
|
136
|
+
if (['標頭元件', '頁腳元件', '商品卡片', '廣告輪播'].includes(vm.select)) {
|
|
137
|
+
return (yield ApiPageConfig.getPage({
|
|
138
|
+
appName: window.appName,
|
|
139
|
+
type: 'template',
|
|
140
|
+
tag: ci_tag,
|
|
141
|
+
})).response.result[0];
|
|
142
|
+
}
|
|
143
|
+
else {
|
|
144
|
+
return {};
|
|
145
|
+
}
|
|
146
|
+
}))();
|
|
147
|
+
const dialog = new ShareDialog(gvc.glitter);
|
|
148
|
+
dialog.checkYesOrNot({
|
|
149
|
+
text: '是否確認替換樣式?',
|
|
150
|
+
callback: (response) => {
|
|
151
|
+
if (response) {
|
|
152
|
+
dialog.dataLoading({ visible: true });
|
|
153
|
+
(window.glitterInitialHelper).getPageData({
|
|
154
|
+
tag: dd.tag,
|
|
155
|
+
appName: dd.appName
|
|
156
|
+
}, (d3) => {
|
|
157
|
+
widget.config[0] = {
|
|
158
|
+
id: gvc.glitter.getUUID(),
|
|
159
|
+
js: './official_view_component/official.js',
|
|
160
|
+
css: {
|
|
161
|
+
class: {},
|
|
162
|
+
style: {},
|
|
163
|
+
},
|
|
164
|
+
data: {
|
|
165
|
+
refer_app: dd.appName,
|
|
166
|
+
refer_form_data: d3.response.result[0].page_config.formData,
|
|
167
|
+
tag: dd.tag,
|
|
168
|
+
list: [],
|
|
169
|
+
carryData: {},
|
|
170
|
+
},
|
|
171
|
+
type: 'component',
|
|
172
|
+
class: 'w-100',
|
|
173
|
+
index: 0,
|
|
174
|
+
label: dd.name,
|
|
175
|
+
style: '',
|
|
176
|
+
bundle: {},
|
|
177
|
+
global: [],
|
|
178
|
+
toggle: false,
|
|
179
|
+
stylist: [],
|
|
180
|
+
dataType: 'static',
|
|
181
|
+
style_from: 'code',
|
|
182
|
+
classDataType: 'static',
|
|
183
|
+
preloadEvenet: {},
|
|
184
|
+
share: {},
|
|
185
|
+
"gCount": "single"
|
|
186
|
+
};
|
|
187
|
+
ApiPageConfig.setPage({
|
|
188
|
+
id: widget.id,
|
|
189
|
+
appName: widget.appName,
|
|
190
|
+
tag: widget.tag,
|
|
191
|
+
name: widget.name,
|
|
192
|
+
config: widget.config,
|
|
193
|
+
group: widget.group,
|
|
194
|
+
page_config: widget.page_config,
|
|
195
|
+
page_type: widget.page_type,
|
|
196
|
+
preview_image: widget.preview_image,
|
|
197
|
+
favorite: widget.favorite,
|
|
198
|
+
}).then((api) => {
|
|
199
|
+
dialog.dataLoading({ visible: false });
|
|
200
|
+
location.reload();
|
|
201
|
+
});
|
|
202
|
+
});
|
|
203
|
+
}
|
|
204
|
+
},
|
|
205
|
+
});
|
|
206
|
+
}))}"
|
|
207
|
+
>
|
|
208
|
+
選擇
|
|
209
|
+
</button>
|
|
210
|
+
</div>
|
|
211
|
+
</div>`;
|
|
212
|
+
})
|
|
213
|
+
.join(`<div class="w-100 border-top"></div>`) + `<div class="w-100 border-top"></div>`;
|
|
214
|
+
}),
|
|
215
|
+
divCreate: {
|
|
216
|
+
style: `position:relative;height:calc(100vh - 65px) !important;overflow-y:auto;`,
|
|
217
|
+
class: `w-100`,
|
|
218
|
+
},
|
|
219
|
+
};
|
|
220
|
+
})}
|
|
221
|
+
</div>
|
|
222
|
+
</div>`;
|
|
223
|
+
}
|
|
224
|
+
static open(gvc, def) {
|
|
225
|
+
NormalPageEditor.toggle({
|
|
226
|
+
visible: true,
|
|
227
|
+
title: `全站設計元件`,
|
|
228
|
+
view: GlobalWidget.main({
|
|
229
|
+
gvc: gvc,
|
|
230
|
+
type: 'idea',
|
|
231
|
+
def: def
|
|
232
|
+
}),
|
|
233
|
+
width: document.body.clientWidth < 992 ? document.body.clientWidth : 800,
|
|
234
|
+
});
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
GlobalWidget.leftSelect = [
|
|
238
|
+
{
|
|
239
|
+
title: '標頭樣式',
|
|
240
|
+
src: new URL(`./src/header.png`, import.meta.url).href,
|
|
241
|
+
tag: '標頭元件',
|
|
242
|
+
},
|
|
243
|
+
{
|
|
244
|
+
title: '商品卡片樣式',
|
|
245
|
+
src: new URL(`./src/product.jpg`, import.meta.url).href,
|
|
246
|
+
tag: '商品卡片',
|
|
247
|
+
},
|
|
248
|
+
{
|
|
249
|
+
title: '頁腳樣式',
|
|
250
|
+
src: new URL(`./src/footer.jpg`, import.meta.url).href,
|
|
251
|
+
tag: '頁腳元件',
|
|
252
|
+
}
|
|
253
|
+
];
|
|
254
|
+
window.glitter.setModule(import.meta.url, GlobalWidget);
|
|
@@ -0,0 +1,269 @@
|
|
|
1
|
+
//找靈感
|
|
2
|
+
import { NormalPageEditor } from '../../editor/normal-page-editor.js';
|
|
3
|
+
import { GVC } from '../../glitterBundle/GVController.js';
|
|
4
|
+
import { BgWidget } from '../../backend-manager/bg-widget.js';
|
|
5
|
+
import { ApiPageConfig } from '../../api/pageConfig.js';
|
|
6
|
+
import { ShareDialog } from '../../glitterBundle/dialog/ShareDialog.js';
|
|
7
|
+
|
|
8
|
+
export class GlobalWidget {
|
|
9
|
+
public static leftSelect = [
|
|
10
|
+
{
|
|
11
|
+
title: '標頭樣式',
|
|
12
|
+
src: new URL(`./src/header.png`, import.meta.url).href,
|
|
13
|
+
tag: '標頭元件',
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
title: '商品卡片樣式',
|
|
17
|
+
src: new URL(`./src/product.jpg`, import.meta.url).href,
|
|
18
|
+
tag: '商品卡片',
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
title: '頁腳樣式',
|
|
22
|
+
src: new URL(`./src/footer.jpg`, import.meta.url).href,
|
|
23
|
+
tag: '頁腳元件',
|
|
24
|
+
}
|
|
25
|
+
];
|
|
26
|
+
|
|
27
|
+
public static main(obg: {
|
|
28
|
+
gvc: GVC;
|
|
29
|
+
type?: 'idea' | 'template';
|
|
30
|
+
def?: string;
|
|
31
|
+
selectCallback?: (app_data: any) => void;
|
|
32
|
+
}) {
|
|
33
|
+
const gvc = obg.gvc;
|
|
34
|
+
|
|
35
|
+
const vm: {
|
|
36
|
+
select: string;
|
|
37
|
+
left_id: string;
|
|
38
|
+
right_id: string;
|
|
39
|
+
} = {
|
|
40
|
+
select: obg.def || '標頭元件',
|
|
41
|
+
left_id: gvc.glitter.getUUID(),
|
|
42
|
+
right_id: gvc.glitter.getUUID(),
|
|
43
|
+
};
|
|
44
|
+
let data: any = undefined;
|
|
45
|
+
const html = String.raw;
|
|
46
|
+
return html` <div class="w-100 d-flex">
|
|
47
|
+
<div class="d-flex flex-column border-end" style="width:200px;">
|
|
48
|
+
${gvc.bindView(() => {
|
|
49
|
+
return {
|
|
50
|
+
bind: vm.left_id,
|
|
51
|
+
view: () => {
|
|
52
|
+
return html`
|
|
53
|
+
<div class="w-100" style=" overflow-y: auto;">
|
|
54
|
+
<div class="d-flex flex-column ">
|
|
55
|
+
${GlobalWidget.leftSelect
|
|
56
|
+
.map((dd, index: number) => {
|
|
57
|
+
return html`
|
|
58
|
+
<div class="rounded-3">
|
|
59
|
+
<div
|
|
60
|
+
class="d-flex flex-column justify-content-center w-100 "
|
|
61
|
+
style="gap:5px;cursor:pointer;${vm.select === dd.tag
|
|
62
|
+
? `overflow:hidden;background: #FFB400;border: 1px solid #FF6C02;padding:10px;border-radius: 5px;`
|
|
63
|
+
: ``}"
|
|
64
|
+
>
|
|
65
|
+
<div
|
|
66
|
+
class="card w-100 position-relative rounded hoverHidden bgf6 rounded-3"
|
|
67
|
+
style="padding-bottom: 56%;"
|
|
68
|
+
onclick="${gvc.event(() => {
|
|
69
|
+
vm.select = dd.tag;
|
|
70
|
+
gvc.notifyDataChange([vm.left_id, vm.right_id]);
|
|
71
|
+
})}"
|
|
72
|
+
>
|
|
73
|
+
<div
|
|
74
|
+
class="position-absolute w-100 h-100 d-flex align-items-center justify-content-center rounded-3"
|
|
75
|
+
style="overflow: hidden;"
|
|
76
|
+
>
|
|
77
|
+
<img class="w-100 " src="${dd.src}" />
|
|
78
|
+
</div>
|
|
79
|
+
|
|
80
|
+
<div
|
|
81
|
+
class="position-absolute w-100 h-100 align-items-center justify-content-center rounded fs-6 flex-column"
|
|
82
|
+
style="background: rgba(0,0,0,0.5);gap:5px;"
|
|
83
|
+
>
|
|
84
|
+
<button
|
|
85
|
+
class="btn btn-secondary d-flex align-items-center "
|
|
86
|
+
style="height: 28px;width: 75px;gap:5px;"
|
|
87
|
+
>
|
|
88
|
+
選擇
|
|
89
|
+
</button>
|
|
90
|
+
</div>
|
|
91
|
+
</div>
|
|
92
|
+
<div
|
|
93
|
+
class="mb-0 d-flex justify-content-center align-items-center fw-bold"
|
|
94
|
+
style="font-size:15px;"
|
|
95
|
+
>
|
|
96
|
+
${dd.title}
|
|
97
|
+
</div>
|
|
98
|
+
</div>
|
|
99
|
+
</div>
|
|
100
|
+
`;
|
|
101
|
+
})
|
|
102
|
+
.join(`<div class="my-2"></div>`)}
|
|
103
|
+
</div>
|
|
104
|
+
</div>
|
|
105
|
+
`;
|
|
106
|
+
},
|
|
107
|
+
divCreate: {
|
|
108
|
+
style: 'height: calc(100vh - 125px) !important;overflow-y:auto;',
|
|
109
|
+
class: `p-2`,
|
|
110
|
+
},
|
|
111
|
+
};
|
|
112
|
+
})}
|
|
113
|
+
</div>
|
|
114
|
+
<div class="" style="${document.body.clientWidth < 768 ? `width: calc(100%)` : `width: calc(100% - 200px)`};">
|
|
115
|
+
${gvc.bindView(() => {
|
|
116
|
+
return {
|
|
117
|
+
bind: vm.right_id,
|
|
118
|
+
view: async () => {
|
|
119
|
+
if (!vm.select) {
|
|
120
|
+
return `<div class="w-100 p-3 d-flex align-items-center justify-content-center flex-column"
|
|
121
|
+
style="gap: 10px;">
|
|
122
|
+
<div class="spinner-border fs-5"></div>
|
|
123
|
+
<div class="fs-6 fw-500">載入中...</div>
|
|
124
|
+
</div>`;
|
|
125
|
+
}
|
|
126
|
+
let module_list = (
|
|
127
|
+
await ApiPageConfig.getPageTemplate({
|
|
128
|
+
template_from: 'all',
|
|
129
|
+
page: '0',
|
|
130
|
+
limit: '3000',
|
|
131
|
+
type: 'module',
|
|
132
|
+
tag: vm.select,
|
|
133
|
+
})
|
|
134
|
+
).response.result.data;
|
|
135
|
+
return module_list
|
|
136
|
+
.map((dd: any) => {
|
|
137
|
+
return `
|
|
138
|
+
<div class="d-flex align-items-center justify-content-center bgf6 hoverHidden position-relative py-4" style="min-height:200px;">
|
|
139
|
+
<img class="w-100" src="${dd.template_config.image[0]}">
|
|
140
|
+
<div
|
|
141
|
+
class="position-absolute w-100 h-100 align-items-center justify-content-center rounded fs-6 flex-column"
|
|
142
|
+
style="background: rgba(0,0,0,0.5);gap:5px;"
|
|
143
|
+
>
|
|
144
|
+
<button
|
|
145
|
+
class="btn btn-secondary d-flex align-items-center "
|
|
146
|
+
style="height: 28px;width: 75px;gap:5px;"
|
|
147
|
+
onclick="${gvc.event(async ()=>{
|
|
148
|
+
// obg.selectCallback && obg.selectCallback(dd)
|
|
149
|
+
//Real tag
|
|
150
|
+
const ci_tag=(()=>{
|
|
151
|
+
switch (vm.select){
|
|
152
|
+
case '標頭元件':
|
|
153
|
+
return 'c_header'
|
|
154
|
+
case '頁腳元件':
|
|
155
|
+
return `footer`
|
|
156
|
+
case '商品卡片':
|
|
157
|
+
return `product_widget`
|
|
158
|
+
case '廣告輪播':
|
|
159
|
+
return 'advertise'
|
|
160
|
+
}
|
|
161
|
+
})()
|
|
162
|
+
//參照元件
|
|
163
|
+
let widget = await (async () => {
|
|
164
|
+
if (['標頭元件', '頁腳元件', '商品卡片', '廣告輪播'].includes(vm.select)) {
|
|
165
|
+
return (
|
|
166
|
+
await ApiPageConfig.getPage({
|
|
167
|
+
appName: (window as any).appName,
|
|
168
|
+
type: 'template',
|
|
169
|
+
tag:ci_tag,
|
|
170
|
+
})
|
|
171
|
+
).response.result[0];
|
|
172
|
+
}else{
|
|
173
|
+
return {}
|
|
174
|
+
}
|
|
175
|
+
})();
|
|
176
|
+
|
|
177
|
+
const dialog = new ShareDialog(gvc.glitter);
|
|
178
|
+
dialog.checkYesOrNot({
|
|
179
|
+
text: '是否確認替換樣式?',
|
|
180
|
+
callback: (response) => {
|
|
181
|
+
if (response) {
|
|
182
|
+
dialog.dataLoading({visible: true});
|
|
183
|
+
((window as any).glitterInitialHelper).getPageData({
|
|
184
|
+
tag: dd.tag,
|
|
185
|
+
appName: dd.appName
|
|
186
|
+
}, (d3: any) => {
|
|
187
|
+
widget.config[0] = {
|
|
188
|
+
id: gvc.glitter.getUUID(),
|
|
189
|
+
js: './official_view_component/official.js',
|
|
190
|
+
css: {
|
|
191
|
+
class: {},
|
|
192
|
+
style: {},
|
|
193
|
+
},
|
|
194
|
+
data: {
|
|
195
|
+
refer_app: dd.appName,
|
|
196
|
+
refer_form_data: d3.response.result[0].page_config.formData,
|
|
197
|
+
tag: dd.tag,
|
|
198
|
+
list: [],
|
|
199
|
+
carryData: {},
|
|
200
|
+
},
|
|
201
|
+
type: 'component',
|
|
202
|
+
class: 'w-100',
|
|
203
|
+
index: 0,
|
|
204
|
+
label: dd.name,
|
|
205
|
+
style: '',
|
|
206
|
+
bundle: {},
|
|
207
|
+
global: [],
|
|
208
|
+
toggle: false,
|
|
209
|
+
stylist: [],
|
|
210
|
+
dataType: 'static',
|
|
211
|
+
style_from: 'code',
|
|
212
|
+
classDataType: 'static',
|
|
213
|
+
preloadEvenet: {},
|
|
214
|
+
share: {},
|
|
215
|
+
"gCount": "single"
|
|
216
|
+
};
|
|
217
|
+
ApiPageConfig.setPage({
|
|
218
|
+
id: widget.id,
|
|
219
|
+
appName: widget.appName,
|
|
220
|
+
tag: widget.tag,
|
|
221
|
+
name: widget.name,
|
|
222
|
+
config: widget.config,
|
|
223
|
+
group: widget.group,
|
|
224
|
+
page_config: widget.page_config,
|
|
225
|
+
page_type: widget.page_type,
|
|
226
|
+
preview_image: widget.preview_image,
|
|
227
|
+
favorite: widget.favorite,
|
|
228
|
+
}).then((api) => {
|
|
229
|
+
dialog.dataLoading({visible: false});
|
|
230
|
+
location.reload();
|
|
231
|
+
});
|
|
232
|
+
})
|
|
233
|
+
}
|
|
234
|
+
},
|
|
235
|
+
});
|
|
236
|
+
})}"
|
|
237
|
+
>
|
|
238
|
+
選擇
|
|
239
|
+
</button>
|
|
240
|
+
</div>
|
|
241
|
+
</div>`;
|
|
242
|
+
})
|
|
243
|
+
.join(`<div class="w-100 border-top"></div>`)+`<div class="w-100 border-top"></div>`;
|
|
244
|
+
},
|
|
245
|
+
divCreate: {
|
|
246
|
+
style: `position:relative;height:calc(100vh - 65px) !important;overflow-y:auto;`,
|
|
247
|
+
class: `w-100`,
|
|
248
|
+
},
|
|
249
|
+
};
|
|
250
|
+
})}
|
|
251
|
+
</div>
|
|
252
|
+
</div>`;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
public static open(gvc: GVC,def:string) {
|
|
256
|
+
NormalPageEditor.toggle({
|
|
257
|
+
visible: true,
|
|
258
|
+
title: `全站設計元件`,
|
|
259
|
+
view: GlobalWidget.main({
|
|
260
|
+
gvc: gvc,
|
|
261
|
+
type: 'idea',
|
|
262
|
+
def:def
|
|
263
|
+
}),
|
|
264
|
+
width: document.body.clientWidth < 992 ? document.body.clientWidth : 800,
|
|
265
|
+
});
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
(window as any).glitter.setModule(import.meta.url, GlobalWidget);
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -680,7 +680,17 @@ export class EditorElem {
|
|
|
680
680
|
return html ` <iframe class="rounded-3" style="border: none;width:${cf.width}px;height:${cf.height}px;"></iframe>`;
|
|
681
681
|
}
|
|
682
682
|
static codeEditor(obj) {
|
|
683
|
+
var _a;
|
|
683
684
|
const codeID = obj.gvc.glitter.getUUID();
|
|
685
|
+
console.log(`codeEditor`, {
|
|
686
|
+
type: 'getData',
|
|
687
|
+
value: `${obj.structStart ? obj.structStart : `(()=>{`} ${(_a = obj.initial) !== null && _a !== void 0 ? _a : ''}
|
|
688
|
+
${obj.structEnd ? obj.structEnd : '})()'}`,
|
|
689
|
+
language: 'javascript',
|
|
690
|
+
refactor: true,
|
|
691
|
+
structStart: obj.structStart,
|
|
692
|
+
structEnd: obj.structEnd,
|
|
693
|
+
});
|
|
684
694
|
function getComponent(gvc, height) {
|
|
685
695
|
return gvc.bindView(() => {
|
|
686
696
|
const id = obj.gvc.glitter.getUUID();
|
|
@@ -692,10 +702,10 @@ export class EditorElem {
|
|
|
692
702
|
const childWindow = (document.getElementById(frameID) || window.parent.document.getElementById(frameID)).contentWindow;
|
|
693
703
|
childWindow.postMessage({
|
|
694
704
|
type: 'getData',
|
|
695
|
-
value: `${obj.structStart ? obj.structStart : `(()=>{`} ${(_a = obj.initial) !== null && _a !== void 0 ? _a : ''}
|
|
696
|
-
|
|
705
|
+
value: `${obj.structStart ? obj.structStart : `(()=>{`} \n${(_a = obj.initial) !== null && _a !== void 0 ? _a : ''}
|
|
706
|
+
${obj.structEnd ? obj.structEnd : '})()'}`,
|
|
697
707
|
language: 'javascript',
|
|
698
|
-
refactor:
|
|
708
|
+
refactor: false,
|
|
699
709
|
structStart: obj.structStart,
|
|
700
710
|
structEnd: obj.structEnd,
|
|
701
711
|
}, domain);
|
|
@@ -974,7 +984,7 @@ export class EditorElem {
|
|
|
974
984
|
快速插入
|
|
975
985
|
${obj.quick_insert
|
|
976
986
|
.map(dd => {
|
|
977
|
-
return html
|
|
987
|
+
return html ` <div
|
|
978
988
|
style="cursor: pointer;"
|
|
979
989
|
onclick="${gvc.event(() => {
|
|
980
990
|
editor.selection.restore();
|