ts-glitter 22.0.4 → 22.0.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.
Files changed (30) hide show
  1. package/lowcode/Entry.js +1 -1
  2. package/lowcode/Entry.ts +1 -1
  3. package/lowcode/cms-plugin/shopping-collections.js +82 -100
  4. package/lowcode/cms-plugin/shopping-collections.ts +152 -172
  5. package/lowcode/cms-plugin/shopping-finance-setting.js +8 -12
  6. package/lowcode/cms-plugin/shopping-finance-setting.ts +8 -12
  7. package/lowcode/cms-plugin/shopping-product-setting.js +51 -33
  8. package/lowcode/cms-plugin/shopping-product-setting.ts +73 -64
  9. package/lowcode/cms-plugin/shopping-product-stock.js +70 -0
  10. package/lowcode/cms-plugin/shopping-product-stock.ts +86 -0
  11. package/lowcode/css/editor.css +2 -2
  12. package/lowcode/dialog/image-preview.js +33 -0
  13. package/lowcode/dialog/image-preview.ts +39 -0
  14. package/lowcode/glitter-base/route/shopping.js +1 -1
  15. package/lowcode/glitter-base/route/shopping.ts +3 -3
  16. package/lowcode/glitterBundle/Glitter.js +31 -0
  17. package/lowcode/glitterBundle/Glitter.ts +36 -0
  18. package/lowcode/jslib/barcode-min.js +2 -0
  19. package/lowcode/public-components/product/pd-class.js +4 -1
  20. package/lowcode/public-components/product/pd-class.ts +6 -1
  21. package/package.json +1 -1
  22. package/src/api-public/controllers/rebate.js +3 -1
  23. package/src/api-public/controllers/rebate.js.map +1 -1
  24. package/src/api-public/controllers/rebate.ts +97 -91
  25. package/src/api-public/services/rebate.js +1 -1
  26. package/src/api-public/services/rebate.js.map +1 -1
  27. package/src/api-public/services/rebate.ts +2 -3
  28. package/src/api-public/services/shopping.js +0 -1
  29. package/src/api-public/services/shopping.js.map +1 -1
  30. package/src/api-public/services/shopping.ts +0 -2
package/lowcode/Entry.js CHANGED
@@ -151,7 +151,7 @@ export class Entry {
151
151
  }
152
152
  window.renderClock = (_b = window.renderClock) !== null && _b !== void 0 ? _b : createClock();
153
153
  console.log(`Entry-time:`, window.renderClock.stop());
154
- glitter.share.editerVersion = 'V_22.0.4';
154
+ glitter.share.editerVersion = 'V_22.0.6';
155
155
  glitter.share.start = new Date();
156
156
  const vm = { appConfig: [] };
157
157
  window.saasConfig = {
package/lowcode/Entry.ts CHANGED
@@ -155,7 +155,7 @@ export class Entry {
155
155
  }
156
156
  (window as any).renderClock = (window as any).renderClock ?? createClock();
157
157
  console.log(`Entry-time:`, (window as any).renderClock.stop());
158
- glitter.share.editerVersion = 'V_22.0.4';
158
+ glitter.share.editerVersion = 'V_22.0.6';
159
159
  glitter.share.start = new Date();
160
160
  const vm = { appConfig: [] };
161
161
  (window as any).saasConfig = {
@@ -5,6 +5,7 @@ import { EditorElem } from '../glitterBundle/plugins/editor-elem.js';
5
5
  import { ShareDialog } from '../glitterBundle/dialog/ShareDialog.js';
6
6
  import { CheckInput } from '../modules/checkInput.js';
7
7
  import { Language } from '../glitter-base/global/language.js';
8
+ const html = String.raw;
8
9
  function getEmptyLanguageData() {
9
10
  return {
10
11
  title: '',
@@ -44,7 +45,6 @@ export class ShoppingCollections {
44
45
  query: '',
45
46
  allParents: [],
46
47
  };
47
- const html = String.raw;
48
48
  const dialog = new ShareDialog(gvc.glitter);
49
49
  const updateCollections = (data) => {
50
50
  const findCollection = (collections, path) => {
@@ -125,51 +125,7 @@ export class ShoppingCollections {
125
125
  bind: id,
126
126
  view: () => {
127
127
  if (loading) {
128
- gvc.addStyle(`
129
- .parent-container,
130
- .child-container {
131
- flex: 1;
132
- margin-right: 20px;
133
- }
134
-
135
- .parent-container:last-child,
136
- .child-container:last-child {
137
- margin-right: 0;
138
- }
139
-
140
- .ul-style {
141
- list-style-type: none;
142
- padding: 0;
143
- margin: 0;
144
- min-height: 200px;
145
- border: 1px solid #ccc;
146
- }
147
-
148
- .li-style {
149
- padding: 6px 10px;
150
- margin-bottom: 5px;
151
- background-color: #eee;
152
- cursor: move;
153
- border: 1px solid #ccc;
154
- display: flex;
155
- align-items: center;
156
- }
157
-
158
- .drag-icon {
159
- margin-right: 10px;
160
- cursor: move;
161
- }
162
-
163
- .drag-icon::before {
164
- content: '↕';
165
- font-size: 18px;
166
- margin-right: 10px;
167
- }
168
-
169
- .selectCol {
170
- background-color: #dcdcdc;
171
- }
172
- `);
128
+ this.addStyle(gvc);
173
129
  return '';
174
130
  }
175
131
  else {
@@ -321,7 +277,7 @@ export class ShoppingCollections {
321
277
  ApiShop.putCollections({
322
278
  data: { replace: dd, original },
323
279
  token: window.parent.config.token,
324
- }).then(r => {
280
+ }).then(() => {
325
281
  dialog.dataLoading({ visible: false });
326
282
  gvc.notifyDataChange(vm.id);
327
283
  });
@@ -394,7 +350,7 @@ export class ShoppingCollections {
394
350
  }
395
351
  });
396
352
  },
397
- rowClick: (data, index) => {
353
+ rowClick: (_, index) => {
398
354
  vm.data = vm.dataList[index];
399
355
  vm.type = 'replace';
400
356
  },
@@ -451,9 +407,56 @@ export class ShoppingCollections {
451
407
  };
452
408
  });
453
409
  }
410
+ static addStyle(gvc) {
411
+ gvc.addStyle(`
412
+ .parent-container,
413
+ .child-container {
414
+ flex: 1;
415
+ margin-right: 20px;
416
+ }
417
+
418
+ .parent-container:last-child,
419
+ .child-container:last-child {
420
+ margin-right: 0;
421
+ }
422
+
423
+ .ul-style {
424
+ list-style-type: none;
425
+ padding: 0;
426
+ margin: 0;
427
+ min-height: 200px;
428
+ border: 1px solid #ccc;
429
+ }
430
+
431
+ .li-style {
432
+ padding: 6px 10px;
433
+ margin-bottom: 5px;
434
+ background-color: #eee;
435
+ cursor: move;
436
+ border: 1px solid #ccc;
437
+ display: flex;
438
+ align-items: center;
439
+ }
440
+
441
+ .drag-icon {
442
+ margin-right: 10px;
443
+ cursor: move;
444
+ }
445
+
446
+ .drag-icon::before {
447
+ content: '↕';
448
+ font-size: 18px;
449
+ margin-right: 10px;
450
+ }
451
+
452
+ .selectCol {
453
+ background-color: #dcdcdc;
454
+ }
455
+ `);
456
+ }
454
457
  static editorDetail(obj) {
455
- const html = String.raw;
456
458
  const gvc = obj.gvc;
459
+ const glitter = gvc.glitter;
457
460
  const vm = obj.vm;
458
461
  const original = JSON.parse(JSON.stringify(vm.data));
459
462
  const dialog = new ShareDialog(gvc.glitter);
@@ -479,13 +482,13 @@ export class ShoppingCollections {
479
482
  });
480
483
  for (const data of lagDomain) {
481
484
  if (data.domains.includes(vm.data.language_data[data.lang].seo.domain)) {
482
- const langTExt = Language.getLanguageText({
485
+ const text = Language.getLanguageText({
483
486
  local: true,
484
487
  compare: data.lang,
485
488
  });
486
489
  return {
487
490
  result: false,
488
- text: `語系「${langTExt}」的連結網址「${vm.data.language_data[data.lang].seo.domain}」<br/>已存在於其他類別,請更換連結網址`,
491
+ text: `語系「${text}」的連結網址「${vm.data.language_data[data.lang].seo.domain}」<br />已存在於其他類別,請更換連結網址`,
489
492
  };
490
493
  }
491
494
  }
@@ -536,8 +539,6 @@ export class ShoppingCollections {
536
539
  innerHTML: (gvc) => {
537
540
  return gvc.bindView((() => {
538
541
  const id = gvc.glitter.getUUID();
539
- const glitter = gvc.glitter;
540
- const html = String.raw;
541
542
  return {
542
543
  bind: id,
543
544
  view: () => {
@@ -546,7 +547,6 @@ export class ShoppingCollections {
546
547
  >
547
548
  ${BgWidget.grayNote('前往商店設定->商店訊息中,設定支援的語言。')}
548
549
  ${gvc.bindView(() => {
549
- const html = String.raw;
550
550
  return {
551
551
  bind: glitter.getUUID(),
552
552
  view: () => {
@@ -613,7 +613,7 @@ export class ShoppingCollections {
613
613
  },
614
614
  title: '切換語系',
615
615
  footer_html: gvc => {
616
- return ``;
616
+ return '';
617
617
  },
618
618
  width: 300,
619
619
  });
@@ -622,7 +622,7 @@ export class ShoppingCollections {
622
622
  </div>`,
623
623
  BgWidget.container1x2({
624
624
  html: [
625
- BgWidget.mainCard(html ` <div class="tx_700" style="margin-bottom: 18px">分類標籤 ${BgWidget.requiredStar()}</div>
625
+ BgWidget.mainCard(html ` <div class="tx_700" style="margin-bottom: 12px">分類標籤 ${BgWidget.requiredStar()}</div>
626
626
  ${EditorElem.editeInput({
627
627
  gvc: gvc,
628
628
  title: '',
@@ -640,7 +640,7 @@ export class ShoppingCollections {
640
640
  gvc: gvc,
641
641
  title: '',
642
642
  default: language_data.title,
643
- placeHolder: vm.data.title || '',
643
+ placeHolder: vm.data.title || '預設為「分類標籤」輸入值',
644
644
  callback: text => {
645
645
  language_data.title = text;
646
646
  if (language_data.seo.domain === '') {
@@ -655,7 +655,7 @@ export class ShoppingCollections {
655
655
  bind: viewID,
656
656
  view: () => {
657
657
  return BgWidget.mainCard([
658
- html ` <div class="tx_normal fw-normal mb-2">
658
+ html ` <div class="tx_700 mb-2">
659
659
  連結網址 ${BgWidget.requiredStar()} ${BgWidget.languageInsignia(select_lan)}
660
660
  </div>`,
661
661
  gvc.bindView({
@@ -663,8 +663,8 @@ export class ShoppingCollections {
663
663
  view: () => {
664
664
  return html `<div
665
665
  class="${document.body.clientWidth < 800
666
- ? `w-100`
667
- : ``} justify-content-start justify-content-lg-center"
666
+ ? 'w-100'
667
+ : ''} justify-content-start justify-content-lg-center"
668
668
  style="padding: 9px 18px;background: #EAEAEA; justify-content: center; align-items: center; gap: 5px; display: flex"
669
669
  >
670
670
  <div
@@ -684,7 +684,6 @@ export class ShoppingCollections {
684
684
  onchange="${gvc.event(e => {
685
685
  let text = e.value;
686
686
  if (text.length > 0 && !CheckInput.isChineseEnglishNumberHyphen(text)) {
687
- const dialog = new ShareDialog(gvc.glitter);
688
687
  dialog.infoMessage({ text: '連結僅限使用中英文數字與連接號' });
689
688
  }
690
689
  else {
@@ -695,9 +694,7 @@ export class ShoppingCollections {
695
694
  />`;
696
695
  },
697
696
  divCreate: {
698
- style: `width: 100%; justify-content: flex-start; align-items: center; display: inline-flex;border:1px solid #EAEAEA;border-radius: 10px;overflow: hidden; ${document.body.clientWidth > 768
699
- ? 'gap: 18px; '
700
- : 'flex-direction: column; gap: 0px; '}`,
697
+ style: `width: 100%; justify-content: flex-start; align-items: center; display: inline-flex;border:1px solid #EAEAEA;border-radius: 10px;overflow: hidden; ${document.body.clientWidth > 768 ? 'gap: 18px;' : 'flex-direction: column; gap: 0px;'}`,
701
698
  },
702
699
  }),
703
700
  html ` <div class="mt-2 mb-1">
@@ -710,14 +707,11 @@ export class ShoppingCollections {
710
707
  ].join(BgWidget.mbContainer(12)));
711
708
  },
712
709
  divCreate: {
713
- class: `${gvc.glitter.ut.frSize({
714
- sm: ``,
715
- }, `p-0`)}`,
710
+ class: `${gvc.glitter.ut.frSize({ sm: '' }, 'p-0')}`,
716
711
  },
717
712
  };
718
713
  }),
719
- BgWidget.mainCard(html ` <div class="tx_700" style="margin-bottom: 18px">商品</div>
720
- ${(() => {
714
+ BgWidget.mainCard((() => {
721
715
  const pvm = {
722
716
  id: gvc.glitter.getUUID(),
723
717
  loading: true,
@@ -725,15 +719,10 @@ export class ShoppingCollections {
725
719
  productList: [],
726
720
  };
727
721
  return html `
728
- <div class="d-flex flex-column p-2" style="gap: 18px;">
729
- <div
730
- class="d-flex align-items-center gray-bottom-line-18"
731
- style="justify-content: space-between;"
732
- >
733
- <div class="form-check-label c_updown_label">
734
- <div class="tx_normal">商品名稱</div>
735
- </div>
736
- ${BgWidget.grayButton('選擇商品', gvc.event(() => {
722
+ <div class="d-flex flex-column">
723
+ <div class="d-flex align-items-center" style="justify-content: space-between;">
724
+ <div class="tx_700" style="margin-bottom: 12px">商品</div>
725
+ ${BgWidget.grayButton('選擇商品', gvc.event(() => {
737
726
  BgProduct.productsDialog({
738
727
  gvc: gvc,
739
728
  default: vm.data.product_id,
@@ -745,8 +734,8 @@ export class ShoppingCollections {
745
734
  },
746
735
  });
747
736
  }))}
748
- </div>
749
- ${gvc.bindView({
737
+ </div>
738
+ ${gvc.bindView({
750
739
  bind: pvm.id,
751
740
  view: () => {
752
741
  if (pvm.loading) {
@@ -756,22 +745,15 @@ export class ShoppingCollections {
756
745
  return '目前無選取任何商品';
757
746
  }
758
747
  return gvc.map(pvm.productList.map((opt, index) => {
759
- var _a;
760
748
  return html ` <div
761
- class="form-check-label c_updown_label"
762
- style="display: flex; align-items: center; min-height: 56px; gap: 8px;"
763
- >
764
- <span class="tx_normal">${index + 1} .</span>
765
- <div style="line-height: 40px;">
766
- <img
767
- class="rounded border me-1"
768
- src="${(_a = opt.image) !== null && _a !== void 0 ? _a : BgWidget.noImageURL}"
769
- style="width:40px; height:40px;"
770
- />
771
- </div>
772
- <span class="tx_normal">${opt.value}</span>
773
- ${opt.note ? html ` <span class="tx_gray_12 ms-2">${opt.note}</span> ` : ''}
774
- </div>`;
749
+ class="form-check-label c_updown_label"
750
+ style="display: flex; align-items: center; min-height: 60px; gap: 8px;"
751
+ >
752
+ <span class="tx_normal" style="min-width: 30px;">${index + 1}.</span>
753
+ ${BgWidget.validImageBox({ gvc, image: opt.image, width: 40 })}
754
+ <span class="tx_normal">${opt.value}</span>
755
+ ${opt.note ? html ` <span class="tx_gray_12 ms-2">${opt.note}</span> ` : ''}
756
+ </div>`;
775
757
  }));
776
758
  },
777
759
  onCreate: () => {
@@ -802,9 +784,9 @@ export class ShoppingCollections {
802
784
  }
803
785
  },
804
786
  })}
805
- </div>
806
- `;
807
- })()}`),
787
+ </div>
788
+ `;
789
+ })()),
808
790
  BgWidget.mainCard([
809
791
  html ` <div style="font-weight: 700;" class="mb-3">
810
792
  搜尋引擎列表 ${BgWidget.languageInsignia(select_lan, 'margin-left:5px;')}
@@ -853,7 +835,7 @@ export class ShoppingCollections {
853
835
  vm.data.parentTitles &&
854
836
  vm.data.parentTitles.length > 0) ||
855
837
  vm.type === 'add') {
856
- return html ` <div class="tx_700" style="margin-bottom: 18px">父層</div>
838
+ return html ` <div class="tx_700" style="margin-bottom: 12px">父層</div>
857
839
  ${BgWidget.select({
858
840
  gvc: gvc,
859
841
  callback: text => {
@@ -868,7 +850,7 @@ export class ShoppingCollections {
868
850
  }
869
851
  const id = gvc.glitter.getUUID();
870
852
  return html `
871
- <div class="tx_700" style="margin-bottom: 18px">子分類</div>
853
+ <div class="tx_700" style="margin-bottom: 12px">子分類</div>
872
854
  ${gvc.bindView({
873
855
  bind: id,
874
856
  view: () => {