ts-glitter 13.6.8 → 13.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 CHANGED
@@ -59,7 +59,7 @@ export class Entry {
59
59
  }
60
60
  window.renderClock = (_a = window.renderClock) !== null && _a !== void 0 ? _a : clockF();
61
61
  console.log(`Entry-time:`, window.renderClock.stop());
62
- glitter.share.editerVersion = "V_13.6.8";
62
+ glitter.share.editerVersion = "V_13.6.9";
63
63
  glitter.share.start = (new Date());
64
64
  const vm = {
65
65
  appConfig: [],
package/lowcode/Entry.ts CHANGED
@@ -60,7 +60,7 @@ export class Entry {
60
60
  }
61
61
  (window as any).renderClock = (window as any).renderClock ?? clockF();
62
62
  console.log(`Entry-time:`, (window as any).renderClock.stop());
63
- glitter.share.editerVersion = "V_13.6.8";
63
+ glitter.share.editerVersion = "V_13.6.9";
64
64
  glitter.share.start = (new Date());
65
65
  const vm: {
66
66
  appConfig: any;
@@ -43,12 +43,12 @@ export class ToolSetting {
43
43
  view: () => {
44
44
  if (vm.function === 'edit') {
45
45
  return html `
46
- <div class="px-2 pt-3">${vm.edit_view}</div>`;
46
+ <div class="px-2 pt-2">${vm.edit_view}</div>`;
47
47
  }
48
48
  return html `
49
49
  ${(() => {
50
50
  if (document.body.clientWidth < 800) {
51
- return `<div class="w-100 d-flex align-items-center p-3 border-bottom mt-n2">
51
+ return `<div class="w-100 d-flex align-items-center p-3 border-bottom">
52
52
  <h5 class="offcanvas-title " style="max-width: calc(100% - 50px);overflow: hidden;text-overflow: ellipsis;">統一元件設定</h5>
53
53
  <div class="flex-fill"></div>
54
54
  <div
@@ -274,59 +274,65 @@ export class ToolSetting {
274
274
  callback: (response) => {
275
275
  if (response) {
276
276
  dialog.dataLoading({ visible: true });
277
- widget.config[0] = {
278
- id: gvc.glitter.getUUID(),
279
- js: './official_view_component/official.js',
280
- css: {
281
- class: {},
282
- style: {},
283
- },
284
- data: {
285
- refer_app: dd.appName,
286
- tag: dd.tag,
287
- list: [],
288
- carryData: {},
289
- },
290
- type: 'component',
291
- class: 'w-100',
292
- index: 0,
293
- label: dd.name,
294
- style: '',
295
- bundle: {},
296
- global: [],
297
- toggle: false,
298
- stylist: [],
299
- dataType: 'static',
300
- style_from: 'code',
301
- classDataType: 'static',
302
- preloadEvenet: {},
303
- share: {},
304
- "arrayData": {
305
- "clickEvent": [{
306
- "clickEvent": {
307
- "src": "./official_event/event.js",
308
- "route": "code"
309
- },
310
- "codeVersion": "v2",
311
- "code": " //判斷不是APP在顯示\n if ((gvc.glitter.deviceType === glitter.deviceTypeEnum.Web) && (glitter.getUrlParameter('device') !== 'mobile')) {\n return [subData]\n } else {\n return []\n }"
312
- }]
313
- },
314
- "gCount": "multiple"
315
- };
316
- ApiPageConfig.setPage({
317
- id: widget.id,
318
- appName: widget.appName,
319
- tag: widget.tag,
320
- name: widget.name,
321
- config: widget.config,
322
- group: widget.group,
323
- page_config: widget.page_config,
324
- page_type: widget.page_type,
325
- preview_image: widget.preview_image,
326
- favorite: widget.favorite,
327
- }).then((api) => {
328
- dialog.dataLoading({ visible: false });
329
- location.reload();
277
+ (window.glitterInitialHelper).getPageData({
278
+ tag: dd.tag,
279
+ appName: dd.appName
280
+ }, (d3) => {
281
+ widget.config[0] = {
282
+ id: gvc.glitter.getUUID(),
283
+ js: './official_view_component/official.js',
284
+ css: {
285
+ class: {},
286
+ style: {},
287
+ },
288
+ data: {
289
+ refer_app: dd.appName,
290
+ refer_form_data: d3.response.result[0].page_config.formData,
291
+ tag: dd.tag,
292
+ list: [],
293
+ carryData: {},
294
+ },
295
+ type: 'component',
296
+ class: 'w-100',
297
+ index: 0,
298
+ label: dd.name,
299
+ style: '',
300
+ bundle: {},
301
+ global: [],
302
+ toggle: false,
303
+ stylist: [],
304
+ dataType: 'static',
305
+ style_from: 'code',
306
+ classDataType: 'static',
307
+ preloadEvenet: {},
308
+ share: {},
309
+ "arrayData": {
310
+ "clickEvent": [{
311
+ "clickEvent": {
312
+ "src": "./official_event/event.js",
313
+ "route": "code"
314
+ },
315
+ "codeVersion": "v2",
316
+ "code": " //判斷不是APP在顯示\n if ((gvc.glitter.deviceType === glitter.deviceTypeEnum.Web) && (glitter.getUrlParameter('device') !== 'mobile')) {\n return [subData]\n } else {\n return []\n }"
317
+ }]
318
+ },
319
+ "gCount": "multiple"
320
+ };
321
+ ApiPageConfig.setPage({
322
+ id: widget.id,
323
+ appName: widget.appName,
324
+ tag: widget.tag,
325
+ name: widget.name,
326
+ config: widget.config,
327
+ group: widget.group,
328
+ page_config: widget.page_config,
329
+ page_type: widget.page_type,
330
+ preview_image: widget.preview_image,
331
+ favorite: widget.favorite,
332
+ }).then((api) => {
333
+ dialog.dataLoading({ visible: false });
334
+ location.reload();
335
+ });
330
336
  });
331
337
  }
332
338
  },
@@ -392,7 +398,7 @@ export class ToolSetting {
392
398
  `;
393
399
  },
394
400
  divCreate: {
395
- class: `p-2 mx-n2`,
401
+ class: `p-2 mx-n2 mt-n2`,
396
402
  },
397
403
  };
398
404
  })].join('');
@@ -44,12 +44,12 @@ export class ToolSetting {
44
44
  view: () => {
45
45
  if (vm.function === 'edit') {
46
46
  return html`
47
- <div class="px-2 pt-3">${vm.edit_view}</div>`;
47
+ <div class="px-2 pt-2">${vm.edit_view}</div>`;
48
48
  }
49
49
  return html`
50
50
  ${(() => {
51
51
  if (document.body.clientWidth < 800) {
52
- return `<div class="w-100 d-flex align-items-center p-3 border-bottom mt-n2">
52
+ return `<div class="w-100 d-flex align-items-center p-3 border-bottom">
53
53
  <h5 class="offcanvas-title " style="max-width: calc(100% - 50px);overflow: hidden;text-overflow: ellipsis;">統一元件設定</h5>
54
54
  <div class="flex-fill"></div>
55
55
  <div
@@ -289,60 +289,66 @@ export class ToolSetting {
289
289
  callback: (response) => {
290
290
  if (response) {
291
291
  dialog.dataLoading({visible: true});
292
- widget.config[0] = {
293
- id: gvc.glitter.getUUID(),
294
- js: './official_view_component/official.js',
295
- css: {
296
- class: {},
297
- style: {},
298
- },
299
- data: {
300
- refer_app: dd.appName,
301
- tag: dd.tag,
302
- list: [],
303
- carryData: {},
304
- },
305
- type: 'component',
306
- class: 'w-100',
307
- index: 0,
308
- label: dd.name,
309
- style: '',
310
- bundle: {},
311
- global: [],
312
- toggle: false,
313
- stylist: [],
314
- dataType: 'static',
315
- style_from: 'code',
316
- classDataType: 'static',
317
- preloadEvenet: {},
318
- share: {},
319
- "arrayData": {
320
- "clickEvent": [{
321
- "clickEvent": {
322
- "src": "./official_event/event.js",
323
- "route": "code"
324
- },
325
- "codeVersion": "v2",
326
- "code": " //判斷不是APP在顯示\n if ((gvc.glitter.deviceType === glitter.deviceTypeEnum.Web) && (glitter.getUrlParameter('device') !== 'mobile')) {\n return [subData]\n } else {\n return []\n }"
327
- }]
328
- },
329
- "gCount": "multiple"
330
- };
331
- ApiPageConfig.setPage({
332
- id: widget.id,
333
- appName: widget.appName,
334
- tag: widget.tag,
335
- name: widget.name,
336
- config: widget.config,
337
- group: widget.group,
338
- page_config: widget.page_config,
339
- page_type: widget.page_type,
340
- preview_image: widget.preview_image,
341
- favorite: widget.favorite,
342
- }).then((api) => {
343
- dialog.dataLoading({visible: false});
344
- location.reload();
345
- });
292
+ ((window as any).glitterInitialHelper).getPageData({
293
+ tag: dd.tag,
294
+ appName: dd.appName
295
+ },(d3:any)=>{
296
+ widget.config[0] = {
297
+ id: gvc.glitter.getUUID(),
298
+ js: './official_view_component/official.js',
299
+ css: {
300
+ class: {},
301
+ style: {},
302
+ },
303
+ data: {
304
+ refer_app: dd.appName,
305
+ refer_form_data:d3.response.result[0].page_config.formData,
306
+ tag: dd.tag,
307
+ list: [],
308
+ carryData: {},
309
+ },
310
+ type: 'component',
311
+ class: 'w-100',
312
+ index: 0,
313
+ label: dd.name,
314
+ style: '',
315
+ bundle: {},
316
+ global: [],
317
+ toggle: false,
318
+ stylist: [],
319
+ dataType: 'static',
320
+ style_from: 'code',
321
+ classDataType: 'static',
322
+ preloadEvenet: {},
323
+ share: {},
324
+ "arrayData": {
325
+ "clickEvent": [{
326
+ "clickEvent": {
327
+ "src": "./official_event/event.js",
328
+ "route": "code"
329
+ },
330
+ "codeVersion": "v2",
331
+ "code": " //判斷不是APP在顯示\n if ((gvc.glitter.deviceType === glitter.deviceTypeEnum.Web) && (glitter.getUrlParameter('device') !== 'mobile')) {\n return [subData]\n } else {\n return []\n }"
332
+ }]
333
+ },
334
+ "gCount": "multiple"
335
+ };
336
+ ApiPageConfig.setPage({
337
+ id: widget.id,
338
+ appName: widget.appName,
339
+ tag: widget.tag,
340
+ name: widget.name,
341
+ config: widget.config,
342
+ group: widget.group,
343
+ page_config: widget.page_config,
344
+ page_type: widget.page_type,
345
+ preview_image: widget.preview_image,
346
+ favorite: widget.favorite,
347
+ }).then((api) => {
348
+ dialog.dataLoading({visible: false});
349
+ location.reload();
350
+ });
351
+ })
346
352
  }
347
353
  },
348
354
  });
@@ -408,7 +414,7 @@ export class ToolSetting {
408
414
  `
409
415
  },
410
416
  divCreate: {
411
- class: `p-2 mx-n2`,
417
+ class: `p-2 mx-n2 mt-n2`,
412
418
  },
413
419
  };
414
420
  })].join('');
@@ -601,10 +601,14 @@ export const component = Plugin.createComponent(import.meta.url, (glitter, editM
601
601
  let html = '';
602
602
  let spiltCount = 0;
603
603
  function appendHtml(pageData, widget, initial, p_id, parent_array) {
604
+ var _a;
604
605
  const oWidget = widget;
606
+ oWidget.data.refer_form_data = (_a = oWidget.data.refer_form_data) !== null && _a !== void 0 ? _a : {};
605
607
  initialReferData(widget);
606
608
  const page_config = pageData.page_config;
607
609
  function getReferForm(widget, type) {
610
+ var _a;
611
+ widget.data.refer_form_data = (_a = widget.data.refer_form_data) !== null && _a !== void 0 ? _a : {};
608
612
  if ((widget.data.refer_app)) {
609
613
  widget.data.refer_form_data = widget.data.refer_form_data || (oWidget.data.refer_form_data && JSON.parse(JSON.stringify(oWidget.data.refer_form_data))) || JSON.parse(JSON.stringify(page_config.formData));
610
614
  if (type !== 'def') {
@@ -613,10 +613,12 @@ export const component = Plugin.createComponent(import.meta.url, (glitter: Glitt
613
613
 
614
614
  function appendHtml(pageData: any, widget: any, initial: boolean, p_id: string, parent_array: any) {
615
615
  const oWidget = widget
616
+ oWidget.data.refer_form_data=oWidget.data.refer_form_data ?? {}
616
617
  initialReferData(widget)
617
618
  const page_config = pageData.page_config;
618
619
 
619
620
  function getReferForm(widget: any, type: string) {
621
+ widget.data.refer_form_data=widget.data.refer_form_data??{}
620
622
  if ((widget.data.refer_app)) {
621
623
  widget.data.refer_form_data = widget.data.refer_form_data || (oWidget.data.refer_form_data && JSON.parse(JSON.stringify(oWidget.data.refer_form_data))) || JSON.parse(JSON.stringify(page_config.formData))
622
624
  if (type !== 'def') {
@@ -0,0 +1,326 @@
1
+ import { ApiUser } from "../../glitter-base/route/user.js";
2
+ import { getCheckoutCount } from "../../official_event/e-commerce/get-count.js";
3
+ import { GlobalUser } from "../../glitter-base/global/global-user.js";
4
+ const html = String.raw;
5
+ export class Sy02 {
6
+ static main(gvc, widget, subData) {
7
+ var _a, _b, _c, _d, _e;
8
+ let changePage = (index, type, subData) => { };
9
+ gvc.glitter.getModule(new URL('./official_event/page/change-page.js', gvc.glitter.root_path).href, (cl) => {
10
+ changePage = cl.changePage;
11
+ });
12
+ return html `
13
+ <div style="height: 76px;"></div>
14
+ <nav class="navbar navbar-expand-lg vw-100 header header-place shadow position-fixed top-0 left-0 py-0"
15
+ style="background: ${(_a = widget.formData.theme_color['background']) !== null && _a !== void 0 ? _a : '#000'} !important;height: 76px;z-index:9999;">
16
+ <div class="container header-place h-100">
17
+
18
+ <!--LOGO顯示區塊-->
19
+ <div class="d-flex align-items-center justify-content-center h-100"
20
+ style="gap: 8px;cursor: pointer;">
21
+ <!--手機版選單-->
22
+ <div class="d-flex align-items-center justify-content-center"
23
+ style="width:40px !important;height:40px !important;" onclick="${gvc.event(() => {
24
+ gvc.glitter.setDrawer(gvc.bindView(() => {
25
+ var _a;
26
+ const id = gvc.glitter.getUUID();
27
+ return {
28
+ bind: id,
29
+ view: () => {
30
+ var _a;
31
+ return html `
32
+ <div class="div d-flex align-items-center flex-column w-100 p-3"
33
+ style="border-bottom:1px solid ${widget.formData.theme_color['title']};">
34
+ <div class="d-flex align-items-center ">
35
+ <div>
36
+ <div class="h-100" onclick="${gvc.event(() => {
37
+ changePage('index', 'home', {});
38
+ })}"> ${(widget.formData.logo.type === 'text') ? html `
39
+ <div class=" fw-bold d-flex align-items-center justify-content-center"
40
+ style="width: 150px; margin-bottom: 20px;font-size: 36px;color: ${(_a = widget.formData.theme_color['title']) !== null && _a !== void 0 ? _a : '#000'};">
41
+ ${widget.formData.logo.value}
42
+ </div>
43
+ ` : html `<img style="width: 150px;
44
+ background-position: center;
45
+ background-size: cover;
46
+ background-repeat: no-repeat;
47
+ border-radius: 10px;
48
+ margin-bottom: 20px;"
49
+ src="${widget.formData.logo.value}">
50
+ `}
51
+ </div>
52
+
53
+ </div>
54
+ </div>
55
+ <div class="position-relative"><input
56
+ class="form-control fw-500 "
57
+ placeholder="找商品"
58
+ autocomplete="off" value=""
59
+ onchange="${gvc.event((e, event) => {
60
+ gvc.glitter.href = `/all-product?search=${e.value}`;
61
+ })}">
62
+
63
+ <div style=" position: absolute;
64
+ right: 10px;
65
+ top: 50%;
66
+ transform: translateY(-50%);
67
+ color: rgb(107, 114, 128);"><i
68
+ class="fa-solid fa-magnifying-glass"></i></div>
69
+ </div>
70
+ </div>
71
+
72
+ <div class="offcanvas-body p-0 "
73
+ >
74
+ ${gvc.bindView(() => {
75
+ const id = gvc.glitter.getUUID();
76
+ const vm = {
77
+ data: []
78
+ };
79
+ ApiUser.getPublicConfig('menu-setting', 'manager', window.appName).then((res) => {
80
+ vm.data = res.response.value;
81
+ gvc.notifyDataChange(id);
82
+ });
83
+ return {
84
+ bind: id,
85
+ view: () => {
86
+ function resetToggle() {
87
+ function loop(data) {
88
+ data.map((dd) => {
89
+ var _a;
90
+ dd.open = false;
91
+ loop((_a = dd.items) !== null && _a !== void 0 ? _a : []);
92
+ });
93
+ }
94
+ loop(vm.data);
95
+ }
96
+ function loopItems(data, show_border) {
97
+ return data.map((dd) => {
98
+ var _a, _b, _c, _d, _e;
99
+ return html `
100
+ <li style="${(show_border) ? `border-bottom: 1px solid ${(_a = widget.formData.theme_color['title']) !== null && _a !== void 0 ? _a : '#000'} !important;` : ``}">
101
+ <div class="nav-link d-flex justify-content-between"
102
+ style="padding: 16px;"
103
+ onclick="${gvc.event(() => {
104
+ var _a;
105
+ if (((_a = dd.items) !== null && _a !== void 0 ? _a : []).length === 0) {
106
+ if (dd.link) {
107
+ gvc.glitter.href = dd.link;
108
+ gvc.glitter.closeDrawer();
109
+ }
110
+ }
111
+ else {
112
+ let og = dd.open;
113
+ resetToggle();
114
+ if (!og) {
115
+ dd.open = true;
116
+ }
117
+ gvc.notifyDataChange(id);
118
+ }
119
+ })}">
120
+ <div style="color: ${(_b = widget.formData.theme_color['title']) !== null && _b !== void 0 ? _b : '#000'} !important;"
121
+ onclick="${gvc.event((e, event) => {
122
+ if (dd.link) {
123
+ gvc.glitter.href = dd.link;
124
+ gvc.glitter.closeDrawer();
125
+ }
126
+ event.stopPropagation();
127
+ event.preventDefault();
128
+ })}">${dd.title}
129
+ </div>
130
+ ${((_c = dd.items) !== null && _c !== void 0 ? _c : []).length ? `<i class="fa-solid ${dd.open ? `fa-angle-up` : `fa-angle-down`}"
131
+ style="color: ${(_d = widget.formData.theme_color['title']) !== null && _d !== void 0 ? _d : '#000'} !important;"></i>` : ``}
132
+ </div>
133
+ ${dd.open ? `<ul class="ps-3 pb-2">${loopItems((_e = dd.items) !== null && _e !== void 0 ? _e : [], false)}</ul>` : ``}
134
+ </li>
135
+ `;
136
+ }).join('');
137
+ }
138
+ return loopItems(vm.data, true);
139
+ },
140
+ divCreate: {
141
+ class: `navbar-nav me-auto mb-2 mb-lg-0`,
142
+ style: ``,
143
+ elem: `ul`
144
+ }
145
+ };
146
+ })}
147
+ </div>`;
148
+ },
149
+ divCreate: {
150
+ class: `w-100 h-100`, style: `z-index: 9999;overflow-y:auto;
151
+ background: ${(_a = widget.formData.theme_color['background']) !== null && _a !== void 0 ? _a : '#000'};overflow-x: hidden;`
152
+ }
153
+ };
154
+ }), () => {
155
+ gvc.glitter.openDrawer(280);
156
+ });
157
+ })}">
158
+ <i class="fa-solid fa-bars fa-fw d-sm-none " style="font-size: 20px;
159
+ color: ${(_b = widget.formData.theme_color['title']) !== null && _b !== void 0 ? _b : '#000'};"></i>
160
+ </div>
161
+ <div class="${(widget.formData.logo.type === 'text') ? `` : `h-100`}"
162
+ onclick="${gvc.event(() => {
163
+ changePage('index', 'home', {});
164
+ })}"> ${(widget.formData.logo.type === 'text') ? html `
165
+ <div class=" fw-bold d-flex align-items-center h-100 mb-1 mb-sm-auto"
166
+ style="font-size: 28px;line-height: 28px;color: ${(_c = widget.formData.theme_color['title']) !== null && _c !== void 0 ? _c : '#000'};">
167
+ ${widget.formData.logo.value}
168
+ </div>
169
+ ` : html `
170
+ <img src="${widget.formData.logo.value}" style="height: 100%;">
171
+ `}
172
+ </div>
173
+ </div>
174
+ <!--選單列表顯示區塊-->
175
+ <ul class="navbar-nav d-none d-sm-block flex-fill ps-2"
176
+ style="">
177
+ ${gvc.bindView(() => {
178
+ const id = gvc.glitter.getUUID();
179
+ const vm = {
180
+ data: []
181
+ };
182
+ ApiUser.getPublicConfig('menu-setting', 'manager', window.appName).then((res) => {
183
+ vm.data = res.response.value;
184
+ gvc.notifyDataChange(id);
185
+ });
186
+ return {
187
+ bind: id,
188
+ view: () => {
189
+ function loopItems(data) {
190
+ return data.map((dd) => {
191
+ var _a, _b;
192
+ return html `
193
+ <li class="nav-item dropdown">
194
+ <a class="nav-link header-link "
195
+ style="color: ${(_a = widget.formData.theme_color['title']) !== null && _a !== void 0 ? _a : '#000'} !important;cursor: pointer;"
196
+ onclick="${gvc.event(() => {
197
+ if (dd.link) {
198
+ gvc.glitter.href = dd.link;
199
+ }
200
+ })}"
201
+ >${dd.title}
202
+ ${dd.items.length > 0 ? `<i class="fa-solid fa-angle-down ms-2"></i>` : ``}</a>
203
+ ${dd.items.length > 0 ? `<ul class="dropdown-menu" style="background:${(_b = widget.formData.theme_color['background']) !== null && _b !== void 0 ? _b : '#000'} !important;
204
+ cursor: pointer;
205
+ z-index: 99999;">${loopItems(dd.items)}</ul>` : ``}
206
+ </li>`;
207
+ }).join('');
208
+ }
209
+ return loopItems(vm.data);
210
+ },
211
+ divCreate: {
212
+ class: `navbar-nav ms-3 me-auto`, style: ``, elem: `ul`
213
+ }
214
+ };
215
+ })}
216
+ </ul>
217
+ <div class="d-flex align-items-center">
218
+ <!--固定按鈕顯示區塊-->
219
+ <ul class="navbar-nav flex-row ms-auto">
220
+ <li class="nav-item d-none d-sm-flex align-items-center justify-content-center"
221
+ style="width:40px !important;">
222
+ ${gvc.bindView(() => {
223
+ const vm = {
224
+ id: gvc.glitter.getUUID(),
225
+ toggle: false
226
+ };
227
+ return {
228
+ bind: vm.id,
229
+ view: () => {
230
+ var _a, _b;
231
+ if (!vm.toggle) {
232
+ return html `<i class="fa-regular fa-magnifying-glass"
233
+ style="color: ${(_a = widget.formData.theme_color['title']) !== null && _a !== void 0 ? _a : '#000'};cursor: pointer;font-size:20px;"
234
+ onclick="${gvc.event(() => {
235
+ vm.toggle = !vm.toggle;
236
+ gvc.notifyDataChange(vm.id);
237
+ })}"></i>`;
238
+ }
239
+ else {
240
+ return html `<a
241
+ class="nav-link search-container d-flex align-items-center"
242
+ ><i
243
+ class="fa-regular fa-circle-xmark"
244
+ style="color: ${(_b = widget.formData.theme_color['title']) !== null && _b !== void 0 ? _b : '#000'};cursor: pointer;font-size:20px;"
245
+ onclick="${gvc.event(() => {
246
+ vm.toggle = !vm.toggle;
247
+ gvc.notifyDataChange(vm.id);
248
+ })}"
249
+ ></i><input
250
+ class="ms-3 form-control" style="height:40px;"
251
+ placeholder="輸入商品關鍵字。" autocomplete="off"
252
+ onchange="${gvc.event((e, event) => {
253
+ gvc.glitter.href = `/all-product?search=${e.value}`;
254
+ vm.toggle = !vm.toggle;
255
+ gvc.notifyDataChange(vm.id);
256
+ })}">
257
+ </a>`;
258
+ }
259
+ },
260
+ divCreate: {
261
+ class: `nav-link search-container`, elem: `a`
262
+ }
263
+ };
264
+ })}
265
+ </li>
266
+ <li class="nav-item d-flex align-items-center justify-content-center"
267
+ style="width:40px !important;">
268
+ ${gvc.bindView(() => {
269
+ const vm = {
270
+ id: gvc.glitter.getUUID(),
271
+ count: 0
272
+ };
273
+ getCheckoutCount((count) => {
274
+ vm.count = count;
275
+ gvc.notifyDataChange(vm.id);
276
+ });
277
+ return {
278
+ bind: vm.id,
279
+ view: () => {
280
+ var _a;
281
+ return html `<span class="position-relative">
282
+ <i class="fa-duotone fa-cart-shopping"
283
+ style="color: ${(_a = widget.formData.theme_color['title']) !== null && _a !== void 0 ? _a : '#000'} !important;cursor: pointer;font-size:20px;"></i>
284
+ ${(vm.count) ? `<div class="position-absolute"
285
+ style="font-size: 10px;right: -10px;top: -6px;">
286
+ <div class="rounded-circle bg-danger text-white align-items-center justify-content-center fw-500 d-flex"
287
+ style="width:18px;height: 18px;color: white !important;background:#fe5541;">${vm.count}
288
+ </div>
289
+ </div>` : ``}
290
+ </span>`;
291
+ },
292
+ divCreate: {
293
+ class: `nav-link js-cart-count `
294
+ }
295
+ };
296
+ })}
297
+ </li>
298
+ <li class="nav-item d-flex align-items-center justify-content-center ms-3 ms-sm-4"
299
+ style="">
300
+ <div class=""
301
+ style="background: ${(_d = widget.formData.theme_color['solid-button-bg']) !== null && _d !== void 0 ? _d : '#000'};
302
+ color: ${(_e = widget.formData.theme_color['solid-button-text']) !== null && _e !== void 0 ? _e : '#000'}; cursor: pointer;
303
+ display: flex;
304
+ width: 100px;
305
+ padding: 7px;
306
+ justify-content: center;
307
+ align-items: center;
308
+ gap: 10px;
309
+ border-radius: 5px;"
310
+ onclick="${gvc.event(() => {
311
+ if (GlobalUser.token) {
312
+ changePage('account_userinfo', 'page', {});
313
+ }
314
+ else {
315
+ changePage('login', 'page', {});
316
+ }
317
+ })}">${(GlobalUser.token) ? `會員管理` : `會員登入`}</div>
318
+ </li>
319
+ </ul>
320
+ </div>
321
+ </div>
322
+
323
+ </nav>`;
324
+ }
325
+ }
326
+ window.glitter.setModule(import.meta.url, Sy02);
@@ -0,0 +1,324 @@
1
+ import {GVC} from "../../glitterBundle/GVController.js";
2
+ import {ApiUser} from "../../glitter-base/route/user.js";
3
+ import {getCheckoutCount} from "../../official_event/e-commerce/get-count.js";
4
+ import {GlobalUser} from "../../glitter-base/global/global-user.js";
5
+
6
+
7
+ const html = String.raw
8
+
9
+ export class Sy02 {
10
+ public static main(gvc: GVC, widget: any, subData: any) {
11
+ let changePage = (index: string, type: 'page' | 'home', subData: any) => {}
12
+ gvc.glitter.getModule(new URL('./official_event/page/change-page.js', gvc.glitter.root_path).href, (cl) => {
13
+ changePage = cl.changePage
14
+ })
15
+ return html`
16
+ <div style="height: 76px;"></div>
17
+ <nav class="navbar navbar-expand-lg vw-100 header header-place shadow position-fixed top-0 left-0 py-0"
18
+ style="background: ${widget.formData.theme_color['background'] ?? '#000'} !important;height: 76px;z-index:9999;">
19
+ <div class="container header-place h-100">
20
+
21
+ <!--LOGO顯示區塊-->
22
+ <div class="d-flex align-items-center justify-content-center h-100"
23
+ style="gap: 8px;cursor: pointer;">
24
+ <!--手機版選單-->
25
+ <div class="d-flex align-items-center justify-content-center"
26
+ style="width:40px !important;height:40px !important;" onclick="${gvc.event(() => {
27
+ gvc.glitter.setDrawer(gvc.bindView(() => {
28
+ const id = gvc.glitter.getUUID()
29
+ return {
30
+ bind: id,
31
+ view: () => {
32
+ return html`
33
+ <div class="div d-flex align-items-center flex-column w-100 p-3"
34
+ style="border-bottom:1px solid ${widget.formData.theme_color['title']};">
35
+ <div class="d-flex align-items-center ">
36
+ <div>
37
+ <div class="h-100" onclick="${gvc.event(() => {
38
+ changePage('index', 'home', {})
39
+ })}"> ${(widget.formData.logo.type === 'text') ? html`
40
+ <div class=" fw-bold d-flex align-items-center justify-content-center"
41
+ style="width: 150px; margin-bottom: 20px;font-size: 36px;color: ${widget.formData.theme_color['title'] ?? '#000'};">
42
+ ${widget.formData.logo.value}
43
+ </div>
44
+ ` : html`<img style="width: 150px;
45
+ background-position: center;
46
+ background-size: cover;
47
+ background-repeat: no-repeat;
48
+ border-radius: 10px;
49
+ margin-bottom: 20px;"
50
+ src="${widget.formData.logo.value}">
51
+ `}
52
+ </div>
53
+
54
+ </div>
55
+ </div>
56
+ <div class="position-relative"><input
57
+ class="form-control fw-500 "
58
+ placeholder="找商品"
59
+ autocomplete="off" value=""
60
+ onchange="${gvc.event((e, event) => {
61
+ gvc.glitter.href = `/all-product?search=${e.value}`
62
+ })}">
63
+
64
+ <div style=" position: absolute;
65
+ right: 10px;
66
+ top: 50%;
67
+ transform: translateY(-50%);
68
+ color: rgb(107, 114, 128);"><i
69
+ class="fa-solid fa-magnifying-glass"></i></div>
70
+ </div>
71
+ </div>
72
+
73
+ <div class="offcanvas-body p-0 "
74
+ >
75
+ ${gvc.bindView(() => {
76
+ const id = gvc.glitter.getUUID()
77
+ const vm = {
78
+ data: []
79
+ }
80
+ ApiUser.getPublicConfig('menu-setting', 'manager', (window as any).appName).then((res) => {
81
+ vm.data = res.response.value
82
+ gvc.notifyDataChange(id)
83
+ })
84
+ return {
85
+ bind: id,
86
+ view: () => {
87
+ function resetToggle() {
88
+ function loop(data: any) {
89
+ data.map((dd: any) => {
90
+ (dd as any).open = false
91
+ loop((dd as any).items ?? [])
92
+ })
93
+ }
94
+
95
+ loop(vm.data)
96
+ }
97
+
98
+ function loopItems(data: any,show_border:boolean) {
99
+ return data.map((dd: any) => {
100
+ return html`
101
+ <li style="${(show_border) ? `border-bottom: 1px solid ${widget.formData.theme_color['title'] ?? '#000'} !important;`:``}">
102
+ <div class="nav-link d-flex justify-content-between"
103
+ style="padding: 16px;"
104
+ onclick="${gvc.event(() => {
105
+ if (((dd as any).items ?? []).length === 0) {
106
+ if (dd.link) {
107
+ gvc.glitter.href = dd.link
108
+ gvc.glitter.closeDrawer()
109
+ }
110
+ } else {
111
+ let og = dd.open
112
+ resetToggle()
113
+ if (!og) {
114
+ dd.open = true
115
+ }
116
+ gvc.notifyDataChange(id)
117
+ }
118
+ })}">
119
+ <div style="color: ${widget.formData.theme_color['title'] ?? '#000'} !important;"
120
+ onclick="${gvc.event((e, event) => {
121
+ if (dd.link) {
122
+ gvc.glitter.href = dd.link
123
+ gvc.glitter.closeDrawer()
124
+ }
125
+ event.stopPropagation()
126
+ event.preventDefault()
127
+ })}">${dd.title}
128
+ </div>
129
+ ${(dd.items ?? []).length ? `<i class="fa-solid ${dd.open ? `fa-angle-up` : `fa-angle-down`}"
130
+ style="color: ${widget.formData.theme_color['title'] ?? '#000'} !important;"></i>` : ``}
131
+ </div>
132
+ ${dd.open ? `<ul class="ps-3 pb-2">${loopItems(dd.items ?? [],false)}</ul>`:``}
133
+ </li>
134
+ `
135
+ }).join('')
136
+ }
137
+
138
+ return loopItems(vm.data,true)
139
+ },
140
+ divCreate: {
141
+ class: `navbar-nav me-auto mb-2 mb-lg-0`,
142
+ style: ``,
143
+ elem: `ul`
144
+ }
145
+ }
146
+ })}
147
+ </div>`
148
+ },
149
+ divCreate: {
150
+ class: `w-100 h-100`, style: `z-index: 9999;overflow-y:auto;
151
+ background: ${widget.formData.theme_color['background'] ?? '#000'};overflow-x: hidden;`
152
+ }
153
+ }
154
+ }), () => {
155
+ gvc.glitter.openDrawer(280)
156
+ })
157
+ })}">
158
+ <i class="fa-solid fa-bars fa-fw d-sm-none " style="font-size: 20px;
159
+ color: ${widget.formData.theme_color['title'] ?? '#000'};"></i>
160
+ </div>
161
+ <div class="${(widget.formData.logo.type === 'text') ? `` : `h-100`}"
162
+ onclick="${gvc.event(() => {
163
+ changePage('index', 'home', {})
164
+ })}"> ${(widget.formData.logo.type === 'text') ? html`
165
+ <div class=" fw-bold d-flex align-items-center h-100 mb-1 mb-sm-auto"
166
+ style="font-size: 28px;line-height: 28px;color: ${widget.formData.theme_color['title'] ?? '#000'};">
167
+ ${widget.formData.logo.value}
168
+ </div>
169
+ ` : html`
170
+ <img src="${widget.formData.logo.value}" style="height: 100%;">
171
+ `}
172
+ </div>
173
+ </div>
174
+ <!--選單列表顯示區塊-->
175
+ <ul class="navbar-nav d-none d-sm-block flex-fill ps-2"
176
+ style="">
177
+ ${gvc.bindView(() => {
178
+ const id = gvc.glitter.getUUID()
179
+ const vm = {
180
+ data: []
181
+ }
182
+ ApiUser.getPublicConfig('menu-setting', 'manager', (window as any).appName).then((res) => {
183
+ vm.data = res.response.value
184
+ gvc.notifyDataChange(id)
185
+ })
186
+ return {
187
+ bind: id,
188
+ view: () => {
189
+ function loopItems(data: any) {
190
+ return data.map((dd: any) => {
191
+ return html`
192
+ <li class="nav-item dropdown">
193
+ <a class="nav-link header-link "
194
+ style="color: ${widget.formData.theme_color['title'] ?? '#000'} !important;cursor: pointer;"
195
+ onclick="${gvc.event(() => {
196
+ if (dd.link) {
197
+ gvc.glitter.href = dd.link
198
+ }
199
+ })}"
200
+ >${dd.title}
201
+ ${dd.items.length > 0 ? `<i class="fa-solid fa-angle-down ms-2"></i>` : ``}</a>
202
+ ${dd.items.length > 0 ? `<ul class="dropdown-menu" style="background:${widget.formData.theme_color['background'] ?? '#000'} !important;
203
+ cursor: pointer;
204
+ z-index: 99999;">${loopItems(dd.items)}</ul>` : ``}
205
+ </li>`
206
+ }).join('')
207
+ }
208
+
209
+ return loopItems(vm.data)
210
+ },
211
+ divCreate: {
212
+ class: `navbar-nav ms-3 me-auto`, style: ``, elem: `ul`
213
+ }
214
+ }
215
+ })}
216
+ </ul>
217
+ <div class="d-flex align-items-center">
218
+ <!--固定按鈕顯示區塊-->
219
+ <ul class="navbar-nav flex-row ms-auto">
220
+ <li class="nav-item d-none d-sm-flex align-items-center justify-content-center"
221
+ style="width:40px !important;">
222
+ ${gvc.bindView(() => {
223
+ const vm = {
224
+ id: gvc.glitter.getUUID(),
225
+ toggle: false
226
+ }
227
+ return {
228
+ bind: vm.id,
229
+ view: () => {
230
+ if (!vm.toggle) {
231
+ return html`<i class="fa-regular fa-magnifying-glass"
232
+ style="color: ${widget.formData.theme_color['title'] ?? '#000'};cursor: pointer;font-size:20px;"
233
+ onclick="${gvc.event(() => {
234
+ vm.toggle = !vm.toggle
235
+ gvc.notifyDataChange(vm.id)
236
+ })}"></i>`
237
+ } else {
238
+ return html`<a
239
+ class="nav-link search-container d-flex align-items-center"
240
+ ><i
241
+ class="fa-regular fa-circle-xmark"
242
+ style="color: ${widget.formData.theme_color['title'] ?? '#000'};cursor: pointer;font-size:20px;"
243
+ onclick="${gvc.event(() => {
244
+ vm.toggle = !vm.toggle
245
+ gvc.notifyDataChange(vm.id)
246
+ })}"
247
+ ></i><input
248
+ class="ms-3 form-control" style="height:40px;"
249
+ placeholder="輸入商品關鍵字。" autocomplete="off"
250
+ onchange="${gvc.event((e, event) => {
251
+ gvc.glitter.href = `/all-product?search=${e.value}`
252
+ vm.toggle = !vm.toggle
253
+ gvc.notifyDataChange(vm.id)
254
+ })}">
255
+ </a>`
256
+ }
257
+ },
258
+ divCreate: {
259
+ class: `nav-link search-container`, elem: `a`
260
+ }
261
+ }
262
+ })}
263
+ </li>
264
+ <li class="nav-item d-flex align-items-center justify-content-center"
265
+ style="width:40px !important;">
266
+ ${gvc.bindView(() => {
267
+ const vm = {
268
+ id: gvc.glitter.getUUID(),
269
+ count: 0
270
+ }
271
+ getCheckoutCount((count) => {
272
+ vm.count = count
273
+ gvc.notifyDataChange(vm.id)
274
+ })
275
+ return {
276
+ bind: vm.id,
277
+ view: () => {
278
+ return html`<span class="position-relative">
279
+ <i class="fa-duotone fa-cart-shopping"
280
+ style="color: ${widget.formData.theme_color['title'] ?? '#000'} !important;cursor: pointer;font-size:20px;"></i>
281
+ ${(vm.count) ? `<div class="position-absolute"
282
+ style="font-size: 10px;right: -10px;top: -6px;">
283
+ <div class="rounded-circle bg-danger text-white align-items-center justify-content-center fw-500 d-flex"
284
+ style="width:18px;height: 18px;color: white !important;background:#fe5541;">${vm.count}
285
+ </div>
286
+ </div>` : ``}
287
+ </span>`
288
+ },
289
+ divCreate: {
290
+ class: `nav-link js-cart-count `
291
+ }
292
+ }
293
+ })}
294
+ </li>
295
+ <li class="nav-item d-flex align-items-center justify-content-center ms-3 ms-sm-4"
296
+ style="">
297
+ <div class=""
298
+ style="background: ${widget.formData.theme_color['solid-button-bg'] ?? '#000'};
299
+ color: ${widget.formData.theme_color['solid-button-text'] ?? '#000'}; cursor: pointer;
300
+ display: flex;
301
+ width: 100px;
302
+ padding: 7px;
303
+ justify-content: center;
304
+ align-items: center;
305
+ gap: 10px;
306
+ border-radius: 5px;"
307
+ onclick="${gvc.event(() => {
308
+ if (GlobalUser.token) {
309
+ changePage('account_userinfo', 'page', {})
310
+ } else {
311
+ changePage('login', 'page', {})
312
+ }
313
+ })}">${(GlobalUser.token) ? `會員管理`:`會員登入`}</div>
314
+ </li>
315
+ </ul>
316
+ </div>
317
+ </div>
318
+
319
+ </nav>`
320
+ }
321
+
322
+ }
323
+
324
+ (window as any).glitter.setModule(import.meta.url, Sy02);
@@ -130,7 +130,7 @@ export class Sy04 {
130
130
  ${((_c = dd.items) !== null && _c !== void 0 ? _c : []).length ? `<i class="fa-solid ${dd.open ? `fa-angle-up` : `fa-angle-down`}"
131
131
  style="color: ${(_d = widget.formData.theme_color['title']) !== null && _d !== void 0 ? _d : '#000'} !important;"></i>` : ``}
132
132
  </div>
133
- ${dd.open ? `<ul class="ps-3 mt-n2">${loopItems((_e = dd.items) !== null && _e !== void 0 ? _e : [], false)}</ul>` : ``}
133
+ ${dd.open ? `<ul class="ps-3 pb-2">${loopItems((_e = dd.items) !== null && _e !== void 0 ? _e : [], false)}</ul>` : ``}
134
134
  </li>
135
135
  `;
136
136
  }).join('');
@@ -129,7 +129,7 @@ export class Sy04 {
129
129
  ${(dd.items ?? []).length ? `<i class="fa-solid ${dd.open ? `fa-angle-up` : `fa-angle-down`}"
130
130
  style="color: ${widget.formData.theme_color['title'] ?? '#000'} !important;"></i>` : ``}
131
131
  </div>
132
- ${dd.open ? `<ul class="ps-3 mt-n2">${loopItems(dd.items ?? [],false)}</ul>`:``}
132
+ ${dd.open ? `<ul class="ps-3 pb-2">${loopItems(dd.items ?? [],false)}</ul>`:``}
133
133
  </li>
134
134
  `
135
135
  }).join('')
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ts-glitter",
3
- "version": "13.6.8",
3
+ "version": "13.6.9",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {