ts-glitter 21.9.6 → 21.9.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.
Files changed (38) hide show
  1. package/lowcode/Entry.js +1 -1
  2. package/lowcode/Entry.ts +1 -1
  3. package/lowcode/backend-manager/bg-blog.js +2 -0
  4. package/lowcode/backend-manager/bg-blog.ts +4 -0
  5. package/lowcode/backend-manager/bg-product.js +3 -3
  6. package/lowcode/backend-manager/bg-product.ts +3 -3
  7. package/lowcode/backend-manager/bg-widget.js +15 -11
  8. package/lowcode/backend-manager/bg-widget.ts +30 -21
  9. package/lowcode/cms-plugin/menus-setting.js +389 -141
  10. package/lowcode/cms-plugin/menus-setting.ts +519 -228
  11. package/lowcode/cms-plugin/shopping-collections.js +5 -38
  12. package/lowcode/cms-plugin/shopping-collections.ts +5 -47
  13. package/lowcode/jspage/function-page/setting_editor.js +0 -27
  14. package/lowcode/jspage/function-page/setting_editor.ts +27 -27
  15. package/lowcode/public-components/footer/footer-01.js +183 -158
  16. package/lowcode/public-components/footer/footer-01.ts +275 -256
  17. package/lowcode/public-components/footer/footer-02.js +83 -63
  18. package/lowcode/public-components/footer/footer-02.ts +160 -145
  19. package/lowcode/public-components/footer/footer-03.js +78 -60
  20. package/lowcode/public-components/footer/footer-03.ts +149 -137
  21. package/lowcode/public-components/headers/sy-02.js +17 -2
  22. package/lowcode/public-components/headers/sy-02.ts +18 -6
  23. package/lowcode/public-components/headers/sy-03.js +18 -4
  24. package/lowcode/public-components/headers/sy-03.ts +26 -15
  25. package/lowcode/public-components/headers/sy-04.js +18 -4
  26. package/lowcode/public-components/headers/sy-04.ts +26 -15
  27. package/lowcode/public-components/headers/sy-05.js +93 -68
  28. package/lowcode/public-components/headers/sy-05.ts +174 -151
  29. package/lowcode/public-components/product/pd-class.js +27 -8
  30. package/lowcode/public-components/product/pd-class.ts +60 -35
  31. package/package.json +1 -1
  32. package/src/api-public/services/shopee.js +17 -7
  33. package/src/api-public/services/user.js +17 -7
  34. package/src/index.js +17 -7
  35. package/src/services/app.js +17 -7
  36. package/src/services/app.js.map +1 -1
  37. package/src/services/backend-service.js +17 -7
  38. package/src/services/backend-service.js.map +1 -1
@@ -5,292 +5,311 @@ import { LanguageView } from '../public/language-view.js';
5
5
  import { Language } from '../../glitter-base/global/language.js';
6
6
  import { FooterInitial } from './footer-initial.js';
7
7
  import { Footer } from '../../app-component/footer.js';
8
+ import { PdClass } from '../product/pd-class.js';
8
9
 
9
10
  const html = String.raw;
10
11
 
11
12
  type FooterObject = {
12
- title: string;
13
- link: string;
13
+ title: string;
14
+ link: string;
14
15
  };
15
16
 
16
17
  type FooterItem = {
17
- title: string;
18
- link: string;
19
- items: FooterObject[];
18
+ title: string;
19
+ link: string;
20
+ items: FooterObject[];
20
21
  };
21
22
 
22
23
  export class Footer01 {
23
- static main(gvc: GVC, widget: any, subData: any) {
24
- return FooterInitial.initial({
25
- browser:()=>{
26
- const formData = widget.formData;
27
- const colors = Color.getTheme(gvc, formData);
28
- const footer = {
29
- list: [],
30
- };
31
- const css = String.raw;
32
- gvc.addStyle(css`
33
- .f-title {
34
- font-size: 16px;
35
- font-weight: 600;
36
- letter-spacing: 0.64px;
37
- word-break: break-all;
38
- color: ${colors.title};
39
- }
24
+ static main(gvc: GVC, widget: any, subData: any) {
25
+ return FooterInitial.initial({
26
+ browser: () => {
27
+ const formData = widget.formData;
28
+ const colors = Color.getTheme(gvc, formData);
29
+ const footer = {
30
+ list: [],
31
+ };
32
+ const css = String.raw;
33
+ gvc.addStyle(`
34
+ .f-title {
35
+ font-size: 16px;
36
+ font-weight: 600;
37
+ letter-spacing: 0.64px;
38
+ word-break: break-all;
39
+ color: ${colors.title};
40
+ }
40
41
 
41
- .f-ul {
42
- display: flex;
43
- flex-direction: column;
44
- gap: 5px;
45
- }
42
+ .f-ul {
43
+ display: flex;
44
+ flex-direction: column;
45
+ gap: 5px;
46
+ }
46
47
 
47
- .f-li {
48
- color: ${colors.content};
49
- }
48
+ .f-li {
49
+ color: ${colors.content};
50
+ }
50
51
 
51
- .f-aclass {
52
- color: ${colors.content} !important;
53
- }
52
+ .f-aclass {
53
+ color: ${colors.content} !important;
54
+ }
54
55
 
55
- .f-bgr {
56
- background: ${colors.bgr};
57
- }
56
+ .f-bgr {
57
+ background: ${colors.bgr};
58
+ }
58
59
 
59
- .f-container {
60
- margin-left: 10px;
61
- margin-right: 10px;
62
- }
60
+ .f-container {
61
+ margin-left: 10px;
62
+ margin-right: 10px;
63
+ }
63
64
 
64
- .f-title-container {
65
- margin-bottom: 18px;
66
- }
65
+ .f-title-container {
66
+ margin-bottom: 18px;
67
+ }
67
68
 
68
- .f-content-container {
69
- display: flex;
70
- justify-content: space-around;
71
- margin-bottom: 10px;
72
- }
69
+ .f-content-container {
70
+ display: flex;
71
+ justify-content: space-around;
72
+ margin-bottom: 10px;
73
+ }
73
74
 
74
- .f-copyright {
75
- font-size: 14px;
76
- color: ${colors.content};
77
- border-top: 1px solid ${colors.content};
78
- padding: 6px 0;
79
- }
75
+ .f-copyright {
76
+ font-size: 14px;
77
+ color: ${colors.content};
78
+ border-top: 1px solid ${colors.content};
79
+ padding: 6px 0;
80
+ }
80
81
 
81
- .f-icon-div {
82
- display: flex;
83
- align-items: center;
84
- justify-content: center;
85
- cursor: pointer;
86
- }
82
+ .f-icon-div {
83
+ display: flex;
84
+ align-items: center;
85
+ justify-content: center;
86
+ cursor: pointer;
87
+ }
87
88
 
88
- .f-icon-image {
89
- color: #ffffff;
90
- width: 30px;
91
- height: 30px;
92
- }
89
+ .f-icon-image {
90
+ color: #ffffff;
91
+ width: 30px;
92
+ height: 30px;
93
+ }
93
94
 
94
- .f-intro {
95
- margin-top: 12px;
96
- font-size: 14px;
97
- font-weight: 400;
98
- line-height: 160%;
99
- letter-spacing: 0.56px;
100
- color: ${colors.content};
101
- }
95
+ .f-intro {
96
+ margin-top: 12px;
97
+ font-size: 14px;
98
+ font-weight: 400;
99
+ line-height: 160%;
100
+ letter-spacing: 0.56px;
101
+ color: ${colors.content};
102
+ }
102
103
  `);
103
- gvc.addStyle(css`
104
- .f-copyright {
105
- font-size: 14px;
106
- color: ${colors.content};
107
- border-top: 1px solid ${colors.content};
108
- padding: 6px 0;
109
- }
104
+ gvc.addStyle(`
105
+ .f-copyright {
106
+ font-size: 14px;
107
+ color: ${colors.content};
108
+ border-top: 1px solid ${colors.content};
109
+ padding: 6px 0;
110
+ }
110
111
 
111
- .f-h4 {
112
- color: ${colors.title};
113
- font-size: 32px;
114
- font-weight: 700;
115
- }
112
+ .f-h4 {
113
+ color: ${colors.title};
114
+ font-size: 32px;
115
+ font-weight: 700;
116
+ }
116
117
 
117
- .f-icon-list {
118
- display: flex;
119
- align-items: center;
120
- gap: 5px;
121
- cursor: pointer;
122
- }
118
+ .f-icon-list {
119
+ display: flex;
120
+ align-items: center;
121
+ gap: 5px;
122
+ cursor: pointer;
123
+ }
123
124
 
124
- .f-icon {
125
- color: ${colors.content};
126
- }
125
+ .f-icon {
126
+ color: ${colors.content};
127
+ }
127
128
  `);
128
- return html`
129
- <footer class="f-bgr border-top">
130
- <div class="border-gray-700 f-padding-top">
131
- <div class="container">
132
- <div class="row py-sm-5 f-container ">
133
- <div
134
- class="col-12 col-md-3 col-lg-4 f-title-container pt-3 pt-sm-0 ${document.body.clientWidth < 800 ? ` d-flex flex-column align-items-center justify-content-center` : ``}">
135
- <img src="${formData.logo}" style="max-height: 90px" />
136
- ${((window as any).store_info.language_setting.support.length > 1 || (window as any).store_info.multi_currency) && document.body.clientWidth < 800 ? LanguageView.selectLanguage(gvc, colors) : ``}
137
- <ul class="d-flex list-unstyled list-inline mt-3 mb-md-0 text-gray-350">
138
- ${(() => {
139
- try {
140
- return formData.kkk.link
141
- .map((item: { link: string; type: string }) => {
142
- return html`
143
- <li class="list-inline-item f-icon-list">
144
- <div class="f-icon-div">
145
- <div
146
- onclick="${gvc.event(() => {
147
- gvc.glitter.href = item.link;
148
- })}"
149
- >
150
- <img
151
- class="f-icon-image"
152
- src="${(() => {
153
- switch (item.type) {
154
- case 'fb':
155
- return 'https://d3jnmi1tfjgtti.cloudfront.net/file/234285319/1722847285395-img_facebook.svg';
156
- case 'youtube':
157
- return 'https://d3jnmi1tfjgtti.cloudfront.net/file/234285319/1722847654029-771382_channel_circle_logo_media_social_icon.png';
158
- case 'twitter':
159
- return 'https://d3jnmi1tfjgtti.cloudfront.net/file/234285319/1722847853494-m2i8K9K9N4b1G6H7.png';
160
- case 'ig':
161
- return 'https://d3jnmi1tfjgtti.cloudfront.net/file/234285319/1722847430108-social.png';
162
- case 'line':
163
- return 'https://d3jnmi1tfjgtti.cloudfront.net/file/234285319/1722847342584-img_line.svg';
164
- default:
165
- return '';
166
- }
167
- })()}"
168
- />
169
- </div>
170
- </div>
171
- </li>`;
172
- })
173
- .join('');
174
- } catch (error) {
175
- return '';
176
- }
177
- })()}
178
- </ul>
179
- <div>
180
- <h4 class="f-intro mb-0">
181
- ${formData.intro ? formData.intro.replace(/\n/g, '<br/>') : ''}</h4>
129
+ return html` <!-- Footer 01 -->
130
+ <footer class="f-bgr border-top">
131
+ <div class="border-gray-700 f-padding-top">
132
+ <div class="container">
133
+ <div class="row py-sm-5 f-container ">
134
+ <div
135
+ class="col-12 col-md-3 col-lg-4 f-title-container pt-3 pt-sm-0 ${document.body.clientWidth < 800
136
+ ? ` d-flex flex-column align-items-center justify-content-center`
137
+ : ``}"
138
+ >
139
+ <img src="${formData.logo}" style="max-height: 90px" />
140
+ ${((window as any).store_info.language_setting.support.length > 1 ||
141
+ (window as any).store_info.multi_currency) &&
142
+ document.body.clientWidth < 800
143
+ ? LanguageView.selectLanguage(gvc, colors)
144
+ : ``}
145
+ <ul class="d-flex list-unstyled list-inline mt-3 mb-md-0 text-gray-350">
146
+ ${(() => {
147
+ try {
148
+ return formData.kkk.link
149
+ .map((item: { link: string; type: string }) => {
150
+ return html` <li class="list-inline-item f-icon-list">
151
+ <div class="f-icon-div">
152
+ <div
153
+ onclick="${gvc.event(() => {
154
+ gvc.glitter.href = item.link;
155
+ })}"
156
+ >
157
+ <img
158
+ class="f-icon-image"
159
+ src="${(() => {
160
+ switch (item.type) {
161
+ case 'fb':
162
+ return 'https://d3jnmi1tfjgtti.cloudfront.net/file/234285319/1722847285395-img_facebook.svg';
163
+ case 'youtube':
164
+ return 'https://d3jnmi1tfjgtti.cloudfront.net/file/234285319/1722847654029-771382_channel_circle_logo_media_social_icon.png';
165
+ case 'twitter':
166
+ return 'https://d3jnmi1tfjgtti.cloudfront.net/file/234285319/1722847853494-m2i8K9K9N4b1G6H7.png';
167
+ case 'ig':
168
+ return 'https://d3jnmi1tfjgtti.cloudfront.net/file/234285319/1722847430108-social.png';
169
+ case 'line':
170
+ return 'https://d3jnmi1tfjgtti.cloudfront.net/file/234285319/1722847342584-img_line.svg';
171
+ default:
172
+ return '';
173
+ }
174
+ })()}"
175
+ />
176
+ </div>
182
177
  </div>
183
- ${((window as any).store_info.language_setting.support.length > 1 || (window as any).store_info.multi_currency) && document.body.clientWidth >= 800 ? LanguageView.selectLanguage(gvc, colors) : ``}
184
- </div>
185
- <div class="col f-content-container ${document.body.clientWidth > 768 ? '' : 'row'}">
186
- ${(() => {
187
- try {
188
- return gvc.bindView(
189
- (() => {
190
- const id = gvc.glitter.getUUID();
191
- let loading = true;
192
- return {
193
- bind: id,
194
- view: () => {
195
- if (loading) {
178
+ </li>`;
179
+ })
180
+ .join('');
181
+ } catch (error) {
182
+ return '';
183
+ }
184
+ })()}
185
+ </ul>
186
+ <div>
187
+ <h4 class="f-intro mb-0">${formData.intro ? formData.intro.replace(/\n/g, '<br/>') : ''}</h4>
188
+ </div>
189
+ ${((window as any).store_info.language_setting.support.length > 1 ||
190
+ (window as any).store_info.multi_currency) &&
191
+ document.body.clientWidth >= 800
192
+ ? LanguageView.selectLanguage(gvc, colors)
193
+ : ``}
194
+ </div>
195
+ <div class="col f-content-container ${document.body.clientWidth > 768 ? '' : 'row'}">
196
+ ${(() => {
197
+ try {
198
+ return gvc.bindView(
199
+ (() => {
200
+ const id = gvc.glitter.getUUID();
201
+ let loading = true;
202
+ return {
203
+ bind: id,
204
+ view: async () => {
205
+ if (loading) {
206
+ return '';
207
+ } else {
208
+ const userData = await ApiUser.getUserData(gvc.glitter.share.GlobalUser.token, 'me');
209
+
210
+ return footer.list
211
+ .map((data: FooterItem) => {
212
+ if (!PdClass.menuVisibleVerify(userData, data)) {
213
+ return '';
214
+ }
215
+
216
+ return html` <div class="${document.body.clientWidth > 768 ? '' : 'col-12 mt-3'}">
217
+ <h6
218
+ class="heading-xxs mb-3 f-title"
219
+ onclick="${gvc.event(() => {
220
+ if (data.link) {
221
+ gvc.glitter.href = data.link;
222
+ }
223
+ })}"
224
+ >
225
+ ${data.title}
226
+ </h6>
227
+ <ul class="list-unstyled mb-7 f-ul">
228
+ ${data.items
229
+ .map(chi => {
230
+ if (!PdClass.menuVisibleVerify(userData, chi)) {
231
+ return '';
232
+ }
233
+ return html` <li
234
+ class="f-li"
235
+ style="${chi.link ? 'cursor: pointer;' : ''}"
236
+ onclick="${gvc.event(() => {
237
+ if (chi.link) {
238
+ gvc.glitter.href = chi.link;
239
+ }
240
+ })}"
241
+ >
242
+ <a
243
+ class="f-aclass"
244
+ title="${chi.title}"
245
+ onclick="${gvc.event((e, event) => {
246
+ event.preventDefault();
247
+ })}"
248
+ href="${chi.link}"
249
+ >${chi.title}</a
250
+ >
251
+ </li>`;
252
+ })
253
+ .join('')}
254
+ </ul>
255
+ </div>`;
256
+ })
257
+ .join('');
258
+ }
259
+ },
260
+ divCreate: {
261
+ class: document.body.clientWidth > 768 ? 'd-flex gap-5' : 'row p-0',
262
+ },
263
+ onCreate: () => {
264
+ if (loading) {
265
+ ApiUser.getPublicConfig(
266
+ widget.formData.menu_refer || 'footer-setting',
267
+ 'manager'
268
+ ).then(data => {
269
+ if (data.result && data.response.value) {
270
+ footer.list = data.response.value[Language.getLanguage()];
271
+ }
272
+ loading = false;
273
+ gvc.notifyDataChange(id);
274
+ });
275
+ }
276
+ },
277
+ };
278
+ })()
279
+ );
280
+ } catch (error) {
196
281
  return '';
197
- } else {
198
- return footer.list
199
- .map((data: FooterItem) => {
200
- return html`
201
- <div
202
- class="${document.body.clientWidth > 768 ? '' : 'col-12 mt-3'}">
203
- <h6
204
- class="heading-xxs mb-3 f-title"
205
- onclick="${gvc.event(() => {
206
- if (data.link) {
207
- gvc.glitter.href = data.link;
208
- }
209
- })}"
210
- >
211
- ${data.title}
212
- </h6>
213
- <ul class="list-unstyled mb-7 f-ul">
214
- ${data.items
215
- .map((chi) => {
216
- return html`
217
- <li
218
- class="f-li"
219
- style="${chi.link ? 'cursor: pointer;' : ''}"
220
- onclick="${gvc.event(() => {
221
- if (chi.link) {
222
- gvc.glitter.href = chi.link;
223
- }
224
- })}"
225
- >
226
- <a class="f-aclass"
227
- title="${chi.title}"
228
- onclick="${gvc.event((e, event) => {
229
- event.preventDefault();
230
- })}"
231
- href="${chi.link}">${chi.title}</a>
232
- </li>`;
233
- })
234
- .join('')}
235
- </ul>
236
- </div>`;
237
- })
238
- .join('');
239
- }
240
- },
241
- divCreate: {
242
- class: document.body.clientWidth > 768 ? 'd-flex gap-5' : 'row p-0',
243
- },
244
- onCreate: () => {
245
- if (loading) {
246
-
247
- ApiUser.getPublicConfig(widget.formData.menu_refer || 'footer-setting', 'manager').then((data) => {
248
- if (data.result && data.response.value) {
249
- footer.list = data.response.value[Language.getLanguage()];
250
- }
251
- loading = false;
252
- gvc.notifyDataChange(id);
253
- });
254
282
  }
255
- },
256
- };
257
- })(),
258
- );
259
- } catch (error) {
260
- return '';
261
- }
262
- })()}
263
- </div>
264
- </div>
265
- </div>
266
- </div>
267
- <div class="py-6">
268
- <div class="container">
269
- ${formData.copy_right
270
- ? html`
271
- <div class="row">
272
- <div class="col text-center">
273
- <p class="my-2 f-copyright">${formData.copy_right}</p>
274
- </div>
275
- </div>`
276
- : ''}
277
- </div>
283
+ })()}
284
+ </div>
278
285
  </div>
279
- </footer>`;
280
- },
281
- mobile:()=>{
282
-
283
- return Footer.main({
284
- gvc:gvc,
285
- formData:{},
286
- key:'',
287
- widget:widget,
288
- callback:()=>{}
289
- })
290
- },
291
- gvc:gvc
292
- })
293
- }
286
+ </div>
287
+ </div>
288
+ <div class="py-6">
289
+ <div class="container">
290
+ ${formData.copy_right
291
+ ? html` <div class="row">
292
+ <div class="col text-center">
293
+ <p class="my-2 f-copyright">${formData.copy_right}</p>
294
+ </div>
295
+ </div>`
296
+ : ''}
297
+ </div>
298
+ </div>
299
+ </footer>`;
300
+ },
301
+ mobile: () => {
302
+ return Footer.main({
303
+ gvc: gvc,
304
+ formData: {},
305
+ key: '',
306
+ widget: widget,
307
+ callback: () => {},
308
+ });
309
+ },
310
+ gvc: gvc,
311
+ });
312
+ }
294
313
  }
295
314
 
296
315
  (window as any).glitter.setModule(import.meta.url, Footer01);