ts-glitter 16.5.1 → 16.5.2

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
@@ -79,7 +79,7 @@ export class Entry {
79
79
  }
80
80
  window.renderClock = (_a = window.renderClock) !== null && _a !== void 0 ? _a : clockF();
81
81
  console.log(`Entry-time:`, window.renderClock.stop());
82
- glitter.share.editerVersion = 'V_16.5.1';
82
+ glitter.share.editerVersion = 'V_16.5.2';
83
83
  glitter.share.start = new Date();
84
84
  const vm = {
85
85
  appConfig: [],
package/lowcode/Entry.ts CHANGED
@@ -78,7 +78,7 @@ export class Entry {
78
78
  }
79
79
  (window as any).renderClock = (window as any).renderClock ?? clockF();
80
80
  console.log(`Entry-time:`, (window as any).renderClock.stop());
81
- glitter.share.editerVersion = 'V_16.5.1';
81
+ glitter.share.editerVersion = 'V_16.5.2';
82
82
  glitter.share.start = new Date();
83
83
  const vm: {
84
84
  appConfig: any;
@@ -751,19 +751,22 @@ export class BgRecommend {
751
751
  gvc.bindView({
752
752
  bind: 'listProduct',
753
753
  view: () => {
754
- let returnHTML = '';
755
- if (newOrder.productCheck.length) {
756
- newOrder.productCheck.map((product, index) => {
757
- var _a;
758
- let selectVariant = product.content.variants[parseInt((_a = product.selectIndex) !== null && _a !== void 0 ? _a : 0)];
759
- let productIMG = typeof selectVariant.preview_image == 'string' ? selectVariant.preview_image : selectVariant.preview_image[0];
760
- productIMG = productIMG
761
- ? productIMG
762
- : product.content.preview_image[0]
763
- ? product.content.preview_image[0]
764
- : BgWidget.noImageURL;
765
- selectVariant.qty = selectVariant.qty || 1;
766
- returnHTML += html `
754
+ try {
755
+ let returnHTML = '';
756
+ if (newOrder.productCheck.length) {
757
+ newOrder.productCheck.map((product, index) => {
758
+ var _a, _b;
759
+ let selectVariant = product.content.variants[parseInt((_a = product.selectIndex) !== null && _a !== void 0 ? _a : 0)];
760
+ console.log(`selectVariant=>`, selectVariant);
761
+ selectVariant.preview_image = (_b = selectVariant.preview_image) !== null && _b !== void 0 ? _b : '';
762
+ let productIMG = typeof selectVariant.preview_image == 'string' ? selectVariant.preview_image : selectVariant.preview_image[0];
763
+ productIMG = productIMG
764
+ ? productIMG
765
+ : product.content.preview_image[0]
766
+ ? product.content.preview_image[0]
767
+ : BgWidget.noImageURL;
768
+ selectVariant.qty = selectVariant.qty || 1;
769
+ returnHTML += html `
767
770
  <div style="width: 100%;display: flex;align-items: center;position: relative;padding-right: 20px;">
768
771
  <div class="flex-fill d-flex align-items-center col-5" style="font-size: 16px;font-weight: 700;gap: 12px;">
769
772
  <div style="width: 54px;height: 54px; background: url('${productIMG}') lightgray 50% / cover no-repeat;"></div>
@@ -775,27 +778,27 @@ export class BgRecommend {
775
778
  </div>
776
779
  <div class="d-flex" style="gap:8px;font-weight: 400;">
777
780
  ${(() => {
778
- if (selectVariant.spec.length > 0) {
779
- let tempHTML = ``;
780
- selectVariant.spec.map((spec) => {
781
- tempHTML += html ` <div
781
+ if (selectVariant.spec.length > 0) {
782
+ let tempHTML = ``;
783
+ selectVariant.spec.map((spec) => {
784
+ tempHTML += html ` <div
782
785
  style="display: flex;height: 22px;padding: 4px 6px;justify-content: center;align-items: center;gap: 10px;border-radius: 7px;background: #EAEAEA;"
783
786
  >
784
787
  ${spec}
785
788
  </div>`;
786
- });
787
- return tempHTML;
788
- }
789
- else {
790
- return html `
789
+ });
790
+ return tempHTML;
791
+ }
792
+ else {
793
+ return html `
791
794
  <div
792
795
  style="display: flex;height: 22px;padding: 4px 6px;justify-content: center;align-items: center;gap: 10px;border-radius: 7px;background: #EAEAEA;"
793
796
  >
794
797
  單一規格
795
798
  </div>
796
799
  `;
797
- }
798
- })()}
800
+ }
801
+ })()}
799
802
  </div>
800
803
  <div style="color: #8D8D8D;font-size: 14px;font-weight: 400;">
801
804
  存貨單位 (SKU): ${selectVariant.sku.length ? selectVariant.sku : 'sku未指定'}
@@ -807,9 +810,9 @@ export class BgRecommend {
807
810
  style="display: flex;padding-right: 40px;align-items: flex-start;font-size: 16px;font-weight: 400;"
808
811
  >
809
812
  $${(() => {
810
- const price = parseInt(`${selectVariant.sale_price}`, 10);
811
- return isNaN(price) ? 0 : price.toLocaleString();
812
- })()}
813
+ const price = parseInt(`${selectVariant.sale_price}`, 10);
814
+ return isNaN(price) ? 0 : price.toLocaleString();
815
+ })()}
813
816
  </div>
814
817
  <div style="min-width: 6%;font-size: 16px;font-weight: 400;width: 100px;text-align: right;">
815
818
  <span>$${(selectVariant.sale_price * selectVariant.qty).toLocaleString()}</span>
@@ -817,9 +820,9 @@ export class BgRecommend {
817
820
  class="d-flex align-items-center cursor_pointer"
818
821
  style="position: absolute;right:0;top:50%;transform: translateY(-50%)"
819
822
  onclick="${gvc.event(() => {
820
- newOrder.productCheck.splice(index, 1);
821
- gvc.notifyDataChange('listProduct');
822
- })}"
823
+ newOrder.productCheck.splice(index, 1);
824
+ gvc.notifyDataChange('listProduct');
825
+ })}"
823
826
  >
824
827
  <svg xmlns="http://www.w3.org/2000/svg" width="11" height="10" viewBox="0 0 11 10" fill="none">
825
828
  <path
@@ -839,9 +842,14 @@ export class BgRecommend {
839
842
  </div>
840
843
  </div>
841
844
  `;
842
- });
845
+ });
846
+ }
847
+ return returnHTML;
848
+ }
849
+ catch (e) {
850
+ console.log(e);
851
+ return `error`;
843
852
  }
844
- return returnHTML;
845
853
  },
846
854
  divCreate: {
847
855
  style: `display: flex;flex-direction: column;align-items: flex-start;gap: 18px;align-self: stretch;`,
@@ -878,20 +878,23 @@ export class BgRecommend {
878
878
  gvc.bindView({
879
879
  bind: 'listProduct',
880
880
  view: () => {
881
- let returnHTML = '';
881
+ try {
882
+ let returnHTML = '';
882
883
 
883
- if (newOrder.productCheck.length) {
884
- newOrder.productCheck.map((product: any, index: number) => {
885
- let selectVariant = product.content.variants[parseInt(product.selectIndex ?? 0)];
886
- let productIMG =
887
- typeof selectVariant.preview_image == 'string' ? selectVariant.preview_image : selectVariant.preview_image[0];
888
- productIMG = productIMG
889
- ? productIMG
890
- : product.content.preview_image[0]
891
- ? product.content.preview_image[0]
892
- : BgWidget.noImageURL;
893
- selectVariant.qty = selectVariant.qty || 1;
894
- returnHTML += html`
884
+ if (newOrder.productCheck.length) {
885
+ newOrder.productCheck.map((product: any, index: number) => {
886
+ let selectVariant = product.content.variants[parseInt(product.selectIndex ?? 0)];
887
+ console.log(`selectVariant=>`,selectVariant)
888
+ selectVariant.preview_image=selectVariant.preview_image ?? ''
889
+ let productIMG =
890
+ typeof selectVariant.preview_image == 'string' ? selectVariant.preview_image : selectVariant.preview_image[0];
891
+ productIMG = productIMG
892
+ ? productIMG
893
+ : product.content.preview_image[0]
894
+ ? product.content.preview_image[0]
895
+ : BgWidget.noImageURL;
896
+ selectVariant.qty = selectVariant.qty || 1;
897
+ returnHTML += html`
895
898
  <div style="width: 100%;display: flex;align-items: center;position: relative;padding-right: 20px;">
896
899
  <div class="flex-fill d-flex align-items-center col-5" style="font-size: 16px;font-weight: 700;gap: 12px;">
897
900
  <div style="width: 54px;height: 54px; background: url('${productIMG}') lightgray 50% / cover no-repeat;"></div>
@@ -903,26 +906,26 @@ export class BgRecommend {
903
906
  </div>
904
907
  <div class="d-flex" style="gap:8px;font-weight: 400;">
905
908
  ${(() => {
906
- if (selectVariant.spec.length > 0) {
907
- let tempHTML = ``;
908
- selectVariant.spec.map((spec: string) => {
909
- tempHTML += html` <div
909
+ if (selectVariant.spec.length > 0) {
910
+ let tempHTML = ``;
911
+ selectVariant.spec.map((spec: string) => {
912
+ tempHTML += html` <div
910
913
  style="display: flex;height: 22px;padding: 4px 6px;justify-content: center;align-items: center;gap: 10px;border-radius: 7px;background: #EAEAEA;"
911
914
  >
912
915
  ${spec}
913
916
  </div>`;
914
- });
915
- return tempHTML;
916
- } else {
917
- return html`
917
+ });
918
+ return tempHTML;
919
+ } else {
920
+ return html`
918
921
  <div
919
922
  style="display: flex;height: 22px;padding: 4px 6px;justify-content: center;align-items: center;gap: 10px;border-radius: 7px;background: #EAEAEA;"
920
923
  >
921
924
  單一規格
922
925
  </div>
923
926
  `;
924
- }
925
- })()}
927
+ }
928
+ })()}
926
929
  </div>
927
930
  <div style="color: #8D8D8D;font-size: 14px;font-weight: 400;">
928
931
  存貨單位 (SKU): ${selectVariant.sku.length ? selectVariant.sku : 'sku未指定'}
@@ -934,9 +937,9 @@ export class BgRecommend {
934
937
  style="display: flex;padding-right: 40px;align-items: flex-start;font-size: 16px;font-weight: 400;"
935
938
  >
936
939
  $${(() => {
937
- const price = parseInt(`${selectVariant.sale_price}`, 10);
938
- return isNaN(price) ? 0 : price.toLocaleString();
939
- })()}
940
+ const price = parseInt(`${selectVariant.sale_price}`, 10);
941
+ return isNaN(price) ? 0 : price.toLocaleString();
942
+ })()}
940
943
  </div>
941
944
  <div style="min-width: 6%;font-size: 16px;font-weight: 400;width: 100px;text-align: right;">
942
945
  <span>$${(selectVariant.sale_price * selectVariant.qty).toLocaleString()}</span>
@@ -944,9 +947,9 @@ export class BgRecommend {
944
947
  class="d-flex align-items-center cursor_pointer"
945
948
  style="position: absolute;right:0;top:50%;transform: translateY(-50%)"
946
949
  onclick="${gvc.event(() => {
947
- newOrder.productCheck.splice(index, 1);
948
- gvc.notifyDataChange('listProduct');
949
- })}"
950
+ newOrder.productCheck.splice(index, 1);
951
+ gvc.notifyDataChange('listProduct');
952
+ })}"
950
953
  >
951
954
  <svg xmlns="http://www.w3.org/2000/svg" width="11" height="10" viewBox="0 0 11 10" fill="none">
952
955
  <path
@@ -966,9 +969,13 @@ export class BgRecommend {
966
969
  </div>
967
970
  </div>
968
971
  `;
969
- });
972
+ });
973
+ }
974
+ return returnHTML;
975
+ }catch (e) {
976
+ console.log(e)
977
+ return `error`
970
978
  }
971
- return returnHTML;
972
979
  },
973
980
  divCreate: {
974
981
  style: `display: flex;flex-direction: column;align-items: flex-start;gap: 18px;align-self: stretch;`,