ts-glitter 21.8.4 → 21.8.6

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
@@ -146,7 +146,7 @@ export class Entry {
146
146
  }
147
147
  window.renderClock = (_b = window.renderClock) !== null && _b !== void 0 ? _b : createClock();
148
148
  console.log(`Entry-time:`, window.renderClock.stop());
149
- glitter.share.editerVersion = 'V_21.8.4';
149
+ glitter.share.editerVersion = 'V_21.8.6';
150
150
  glitter.share.start = new Date();
151
151
  const vm = { appConfig: [] };
152
152
  window.saasConfig = {
package/lowcode/Entry.ts CHANGED
@@ -150,7 +150,7 @@ export class Entry {
150
150
  }
151
151
  (window as any).renderClock = (window as any).renderClock ?? createClock();
152
152
  console.log(`Entry-time:`, (window as any).renderClock.stop());
153
- glitter.share.editerVersion = 'V_21.8.4';
153
+ glitter.share.editerVersion = 'V_21.8.6';
154
154
  glitter.share.start = new Date();
155
155
  const vm = { appConfig: [] };
156
156
  (window as any).saasConfig = {
@@ -347,6 +347,13 @@ export class POSSetting {
347
347
  });
348
348
  return product.content.variants.find((variant) => arraysEqual(variant.spec, emptyArray));
349
349
  }
350
+ data.content.specs.map((dd, index) => {
351
+ dd.option.map((d1, index) => {
352
+ d1.select = index === 0;
353
+ });
354
+ });
355
+ selectVariant = changeSelectVariant(data);
356
+ obj.callback(selectVariant);
350
357
  gvc.glitter.innerDialog(gvc => {
351
358
  return gvc.bindView({
352
359
  bind: 'productDialog',
@@ -354,10 +361,14 @@ export class POSSetting {
354
361
  var _a;
355
362
  try {
356
363
  selectVariant.preview_image = selectVariant.preview_image || [];
357
- selectVariant.stock =
358
- (selectVariant.stockList[POSSetting.config.where_store] &&
359
- parseInt(selectVariant.stockList[POSSetting.config.where_store].count, 10)) ||
360
- 0;
364
+ selectVariant.stock = gvc.glitter.share.store_list.filter((dd) => {
365
+ var _a;
366
+ return (dd.id === POSSetting.config.where_store) || ((_a = gvc.glitter.share.store_list.find((dd) => {
367
+ return dd.id === POSSetting.config.where_store;
368
+ }).support_store) !== null && _a !== void 0 ? _a : []).includes(dd.id);
369
+ }).map((d1) => {
370
+ return selectVariant.stockList[d1.id].count;
371
+ }).reduce((acc, val) => acc + val, 0);
361
372
  return html ` <div
362
373
  class="w-100 h-100 d-flex align-items-center justify-content-center"
363
374
  onclick="${gvc.event(() => gvc.glitter.closeDiaLog())}"
@@ -507,7 +518,7 @@ export class POSSetting {
507
518
  </div>
508
519
  ${selectVariant.show_understocking === 'false'
509
520
  ? ''
510
- : BgWidget.blueNote('查看其他庫存點', gvc.event(() => {
521
+ : BgWidget.blueNote('查看各庫存點數量', gvc.event(() => {
511
522
  BgWidget.settingDialog({
512
523
  gvc,
513
524
  title: '其他庫存點',
@@ -528,7 +539,7 @@ export class POSSetting {
528
539
  return dataList.map((dd) => {
529
540
  return [
530
541
  {
531
- key: '門市名稱',
542
+ key: '門市/庫存點',
532
543
  value: `<span class="fs-7">${dd.name}</span>`,
533
544
  },
534
545
  {
@@ -540,6 +551,7 @@ export class POSSetting {
540
551
  }
541
552
  ApiUser.getPublicConfig('store_manager', 'manager').then((dd) => {
542
553
  var _a;
554
+ console.log(`selectVariant===>`, selectVariant);
543
555
  if (dd.result && Array.isArray((_a = dd.response.value) === null || _a === void 0 ? void 0 : _a.list)) {
544
556
  dd.response.value.list.map((store) => {
545
557
  var _a, _b, _c;
@@ -385,6 +385,7 @@ export class POSSetting {
385
385
  const data = obj.defaultData;
386
386
  const orderDetail = obj.orderDetail;
387
387
  let selectVariant = obj.selectVariant;
388
+
388
389
  let count = 1;
389
390
 
390
391
  function arraysEqual(arr1: any[], arr2: any[]) {
@@ -399,7 +400,13 @@ export class POSSetting {
399
400
  });
400
401
  return product.content.variants.find((variant: any) => arraysEqual(variant.spec, emptyArray));
401
402
  }
402
-
403
+ data.content.specs.map((dd:any,index:number)=>{
404
+ dd.option.map((d1:any,index:number)=>{
405
+ d1.select = index===0;
406
+ })
407
+ });
408
+ selectVariant = changeSelectVariant(data);
409
+ obj.callback(selectVariant);
403
410
  gvc.glitter.innerDialog(
404
411
  gvc => {
405
412
  return gvc.bindView({
@@ -407,10 +414,16 @@ export class POSSetting {
407
414
  view: () => {
408
415
  try {
409
416
  selectVariant.preview_image = selectVariant.preview_image || [];
410
- selectVariant.stock =
411
- (selectVariant.stockList[POSSetting.config.where_store] &&
412
- parseInt(selectVariant.stockList[POSSetting.config.where_store].count, 10)) ||
413
- 0;
417
+ selectVariant.stock = gvc.glitter.share.store_list.filter((dd:any)=>{
418
+ return (dd.id===POSSetting.config.where_store) || (
419
+ gvc.glitter.share.store_list.find((dd:any)=>{
420
+ return dd.id === POSSetting.config.where_store;
421
+ }).support_store ?? []
422
+ ).includes(dd.id);
423
+ }).map((d1:any)=>{
424
+ return selectVariant.stockList[d1.id].count
425
+ }).reduce((acc: any, val: any) => acc + val,0)
426
+
414
427
 
415
428
  return html` <div
416
429
  class="w-100 h-100 d-flex align-items-center justify-content-center"
@@ -453,7 +466,7 @@ export class POSSetting {
453
466
  'zh-TW': string;
454
467
  };
455
468
  }[] = data.content.specs;
456
-
469
+
457
470
  return productSpecs
458
471
  .map((spec, index1) => {
459
472
  return html` <div>
@@ -577,7 +590,7 @@ export class POSSetting {
577
590
  ${selectVariant.show_understocking === 'false'
578
591
  ? ''
579
592
  : BgWidget.blueNote(
580
- '查看其他庫存點',
593
+ '查看各庫存點數量',
581
594
  gvc.event(() => {
582
595
  BgWidget.settingDialog({
583
596
  gvc,
@@ -588,7 +601,6 @@ export class POSSetting {
588
601
  filter: [],
589
602
  getData: vmi => {
590
603
  const dataList: { name: string; count: number }[] = [];
591
-
592
604
  function callback() {
593
605
  vmi.pageSize = 1;
594
606
  vmi.originalData = dataList;
@@ -596,12 +608,11 @@ export class POSSetting {
596
608
  vmi.loading = false;
597
609
  vmi.callback();
598
610
  }
599
-
600
611
  function getDatalist() {
601
612
  return dataList.map((dd: any) => {
602
613
  return [
603
614
  {
604
- key: '門市名稱',
615
+ key: '門市/庫存點',
605
616
  value: `<span class="fs-7">${dd.name}</span>`,
606
617
  },
607
618
  {
@@ -613,6 +624,7 @@ export class POSSetting {
613
624
  }
614
625
 
615
626
  ApiUser.getPublicConfig('store_manager', 'manager').then((dd: any) => {
627
+ console.log(`selectVariant===>`,selectVariant)
616
628
  if (dd.result && Array.isArray(dd.response.value?.list)) {
617
629
  dd.response.value.list.map((store: any) => {
618
630
  const n = selectVariant.stockList?.[store.id]?.count ?? 0;
@@ -228,8 +228,15 @@ export class PaymentPage {
228
228
  if (`${data.show_understocking}` === 'false') {
229
229
  return '不追蹤庫存';
230
230
  }
231
- const stock = data.stockList[POSSetting.config.where_store];
232
- return `庫存: ${(stock === null || stock === void 0 ? void 0 : stock.count) || 0}`;
231
+ const stock = gvc.glitter.share.store_list.filter((dd) => {
232
+ var _a;
233
+ return (dd.id === POSSetting.config.where_store) || ((_a = gvc.glitter.share.store_list.find((dd) => {
234
+ return dd.id === POSSetting.config.where_store;
235
+ }).support_store) !== null && _a !== void 0 ? _a : []).includes(dd.id);
236
+ }).map((d1) => {
237
+ return data.stockList[d1.id].count;
238
+ }).reduce((acc, val) => acc + val, 0);
239
+ return `庫存: ${stock || 0}`;
233
240
  })()}
234
241
  </div>
235
242
  </div>
@@ -265,9 +265,17 @@ export class PaymentPage {
265
265
  if (`${data.show_understocking}` === 'false') {
266
266
  return '不追蹤庫存';
267
267
  }
268
-
269
- const stock = data.stockList[POSSetting.config.where_store];
270
- return `庫存: ${stock?.count || 0}`;
268
+ const stock = gvc.glitter.share.store_list.filter((dd:any)=>{
269
+ return (dd.id===POSSetting.config.where_store) || (
270
+ gvc.glitter.share.store_list.find((dd:any)=>{
271
+ return dd.id === POSSetting.config.where_store;
272
+ }).support_store ?? []
273
+ ).includes(dd.id);
274
+ }).map((d1:any)=>{
275
+ return data.stockList[d1.id].count
276
+ }).reduce((acc: any, val: any) => acc + val,0)
277
+
278
+ return `庫存: ${stock || 0}`;
271
279
  })()}
272
280
  </div>
273
281
  </div>
@@ -52,6 +52,7 @@ export class StockStores {
52
52
  manager_phone: '',
53
53
  note: '',
54
54
  is_shop: is_shop,
55
+ support_store: []
55
56
  };
56
57
  }
57
58
  static list(gvc, vm, isShop) {
@@ -161,6 +162,7 @@ export class StockStores {
161
162
  manager_phone: '',
162
163
  note: '',
163
164
  is_shop: false,
165
+ support_store: []
164
166
  },
165
167
  ];
166
168
  ApiUser.setPublicConfig({
@@ -290,6 +292,59 @@ export class StockStores {
290
292
  })}
291
293
  </div>
292
294
  </div>`,
295
+ (() => {
296
+ if (vm.data.is_shop) {
297
+ return gvc.bindView(() => {
298
+ var _a;
299
+ const id = gvc.glitter.getUUID();
300
+ vm.data.support_store = (_a = vm.data.support_store) !== null && _a !== void 0 ? _a : [];
301
+ let manager = undefined;
302
+ ApiUser.getPublicConfig('store_manager', 'manager').then(res => {
303
+ manager = res;
304
+ gvc.notifyDataChange(id);
305
+ });
306
+ return {
307
+ bind: id,
308
+ view: () => {
309
+ if (!manager) {
310
+ return BgWidget.spinner();
311
+ }
312
+ if (!manager.response.value.list.filter((dd) => {
313
+ return !dd.is_shop;
314
+ }).length) {
315
+ return ``;
316
+ }
317
+ return BgWidget.inlineCheckBox({
318
+ title: '門市相關庫存點',
319
+ gvc: gvc,
320
+ def: vm.data.support_store,
321
+ type: 'multiple',
322
+ array: manager.response.value.list
323
+ .filter((dd) => {
324
+ return !dd.is_shop;
325
+ })
326
+ .map((dd) => {
327
+ return {
328
+ title: dd.name,
329
+ value: dd.id,
330
+ };
331
+ }),
332
+ callback: text => {
333
+ vm.data.support_store = text;
334
+ gvc.notifyDataChange(id);
335
+ },
336
+ });
337
+ },
338
+ divCreate: {
339
+ class: `col-12`,
340
+ },
341
+ };
342
+ });
343
+ }
344
+ else {
345
+ return ``;
346
+ }
347
+ })(),
293
348
  html ` <div class="tx_normal">備註</div>
294
349
  ${EditorElem.editeText({
295
350
  gvc: gvc,
@@ -20,6 +20,7 @@ export type StoreData = {
20
20
  manager_phone: string;
21
21
  note: string;
22
22
  is_shop: boolean;
23
+ support_store: string[];
23
24
  };
24
25
 
25
26
  type VM = {
@@ -83,6 +84,7 @@ export class StockStores {
83
84
  manager_phone: '',
84
85
  note: '',
85
86
  is_shop: is_shop,
87
+ support_store:[]
86
88
  };
87
89
  }
88
90
  static list(gvc: GVC, vm: VM, isShop: boolean) {
@@ -208,6 +210,7 @@ export class StockStores {
208
210
  manager_phone: '',
209
211
  note: '',
210
212
  is_shop: false,
213
+ support_store:[]
211
214
  },
212
215
  ];
213
216
  ApiUser.setPublicConfig({
@@ -347,6 +350,62 @@ export class StockStores {
347
350
  })}
348
351
  </div>
349
352
  </div>`,
353
+ (()=>{
354
+ if(vm.data.is_shop){
355
+ return gvc.bindView(() => {
356
+
357
+ const id = gvc.glitter.getUUID();
358
+
359
+ vm.data.support_store = vm.data.support_store ?? [];
360
+ let manager: any = undefined;
361
+ ApiUser.getPublicConfig('store_manager', 'manager').then(res => {
362
+ manager = res;
363
+ gvc.notifyDataChange(id);
364
+ });
365
+ return {
366
+ bind: id,
367
+ view: () => {
368
+ if (!manager) {
369
+ return BgWidget.spinner();
370
+ }
371
+ if (
372
+ !manager.response.value.list.filter((dd: any) => {
373
+ return !dd.is_shop;
374
+ }).length
375
+ ) {
376
+ return ``;
377
+ }
378
+ return BgWidget.inlineCheckBox({
379
+ title: '門市相關庫存點',
380
+ gvc: gvc,
381
+ def: vm.data.support_store!,
382
+ type: 'multiple',
383
+ array: manager.response.value.list
384
+ .filter((dd: any) => {
385
+ return !dd.is_shop;
386
+ })
387
+ .map((dd: any) => {
388
+ return {
389
+ title: dd.name,
390
+ value: dd.id,
391
+ };
392
+ }),
393
+ callback: text => {
394
+ vm.data.support_store = text as any;
395
+ gvc.notifyDataChange(id);
396
+ },
397
+ });
398
+ },
399
+ divCreate: {
400
+ class: `col-12`,
401
+ },
402
+ };
403
+ })
404
+ }else{
405
+ return ``
406
+ }
407
+ })()
408
+ ,
350
409
  html` <div class="tx_normal">備註</div>
351
410
  ${EditorElem.editeText({
352
411
  gvc: gvc,
@@ -77,7 +77,7 @@ export class Setting_editor {
77
77
  ].includes(item.page)) {
78
78
  return userPlan > 1;
79
79
  }
80
- if (['app-design', 'app-upload', 'cloud_subscrible', 'notify_message_list'].includes(item.page)) {
80
+ if (['app-design', 'app-upload', 'cloud_subscrible', 'notify_message_list', 'auto_fcm_push', 'auto_fcm_advertise', 'upload', 'auto_fcm_history'].includes(item.page)) {
81
81
  return userPlan > 2;
82
82
  }
83
83
  return true;
@@ -964,7 +964,7 @@ export class Setting_editor {
964
964
  ) {
965
965
  return userPlan > 1;
966
966
  }
967
- if (['app-design', 'app-upload', 'cloud_subscrible', 'notify_message_list'].includes(item.page)) {
967
+ if (['app-design', 'app-upload', 'cloud_subscrible', 'notify_message_list','auto_fcm_push','auto_fcm_advertise','upload','auto_fcm_history'].includes(item.page)) {
968
968
  return userPlan > 2;
969
969
  }
970
970
  return true;
@@ -23,17 +23,33 @@ export class SocialLinks01 {
23
23
  };
24
24
  const gotoTopImg = 'https://d3jnmi1tfjgtti.cloudfront.net/file/234285319/arrow-up-to-line-light.svg';
25
25
  gvc.addStyle(css `
26
- .floating-action-panel {
27
- position: fixed;
28
- bottom: 30px;
29
- right: 30px;
30
- display: flex;
31
- flex-direction: column; /* 垂直排列 */
32
- align-items: center;
33
- gap: 10px; /* 按鈕間距 */
34
- z-index: 1000;
26
+ @media (max-width: 768px) {
27
+ .floating-action-panel {
28
+ position: fixed;
29
+ bottom: 20px;
30
+ right: 10px;
31
+ display: flex;
32
+ flex-direction: column; /* 垂直排列 */
33
+ align-items: center;
34
+ gap: 10px; /* 按鈕間距 */
35
+ z-index: 1000;
36
+ }
35
37
  }
36
38
 
39
+ @media (min-width: 769px) {
40
+ .floating-action-panel {
41
+ position: fixed;
42
+ bottom: 30px;
43
+ right: 30px;
44
+ display: flex;
45
+ flex-direction: column; /* 垂直排列 */
46
+ align-items: center;
47
+ gap: 10px; /* 按鈕間距 */
48
+ z-index: 1000;
49
+ }
50
+ }
51
+
52
+
37
53
  .social-links {
38
54
  display: flex;
39
55
  flex-direction: column;
@@ -59,57 +75,62 @@ export class SocialLinks01 {
59
75
  border: none;
60
76
  padding: 2px;
61
77
  cursor: pointer;
78
+ width: 40px;
79
+ height: 40px;
62
80
  border-radius: 50%;
63
81
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
64
82
  }
65
83
 
66
- .component-img {
67
- width: 40px;
68
- height: 40px;
69
- object-fit: contain;
70
- }
71
84
 
72
- .component-circle:hover .component-img {
85
+
86
+ .component-circle:hover {
73
87
  opacity: 0.8;
74
88
  }
75
89
 
76
90
  .up-to-top.hidden {
77
- display: none;
91
+ display: none !important;
78
92
  }
79
93
  `);
80
94
  return gvc.bindView({
81
95
  bind: vm.id,
82
96
  view: () => {
83
97
  return html `
84
- <div class="floating-action-panel">
85
- <div class="social-links">
86
- ${socialList
98
+ <div class="floating-action-panel">
99
+ <div class="social-links">
100
+ ${socialList
87
101
  .map(socialLink => {
88
102
  var _a;
103
+ if (socialLink.icon === 'https://d3jnmi1tfjgtti.cloudfront.net/file/234285319/1722936949034-default_image.jpg') {
104
+ socialLink.icon = undefined;
105
+ }
89
106
  const imgSrc = supportSocial.includes(socialLink.social_type)
90
107
  ? socialIMG[socialLink.social_type]
91
108
  : socialIMG.other;
92
109
  return html `
93
- <a href="${socialLink.link}" class="component-circle">
94
- <img src="${(_a = socialLink.icon) !== null && _a !== void 0 ? _a : imgSrc}" alt="Go to top" class="component-img" />
95
- </a>
96
- `;
110
+ <div onclick="${gvc.event(() => {
111
+ gvc.glitter.href = socialLink.link;
112
+ })}" class="component-circle" style="overflow: hidden;
113
+ background-image: url('${(_a = socialLink.icon) !== null && _a !== void 0 ? _a : imgSrc}');background-size: cover;background-position: center;"
114
+ >
115
+ </div>
116
+ `;
97
117
  })
98
118
  .join('')}
99
- </div>
100
- <button
101
- class="component-circle up-to-top hidden"
102
- onclick="${gvc.event(() => {
119
+ </div>
120
+ <button
121
+ class="component-circle up-to-top hidden rounded-circle align-items-center justify-content-center"
122
+ style="overflow: hidden; background-color: white;display: flex; "
123
+ onclick="${gvc.event(() => {
103
124
  scrollToTop();
104
125
  })}"
105
- >
106
- <img src="${gotoTopImg}" alt="Go to top" class="component-img" />
107
- </button>
108
- </div>
109
- `;
126
+ >
127
+ <i class="fa-solid fa-angle-up fs-3"></i>
128
+ </button>
129
+ </div>
130
+ `;
110
131
  }, divCreate: {},
111
132
  onInitial: () => {
112
- window.onscroll = function () {
133
+ window.addEventListener('scroll', function () {
113
134
  const scrollPosition = window.scrollY;
114
135
  const threshold = window.innerHeight / 2;
115
136
  const panel = document.querySelector('.up-to-top');
@@ -119,7 +140,7 @@ export class SocialLinks01 {
119
140
  else {
120
141
  panel.classList.add('hidden');
121
142
  }
122
- };
143
+ });
123
144
  }
124
145
  });
125
146
  }