ts-glitter 16.9.9 → 17.0.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
@@ -88,7 +88,7 @@ export class Entry {
88
88
  }
89
89
  window.renderClock = (_b = window.renderClock) !== null && _b !== void 0 ? _b : clockF();
90
90
  console.log(`Entry-time:`, window.renderClock.stop());
91
- glitter.share.editerVersion = 'V_16.9.9';
91
+ glitter.share.editerVersion = 'V_17.0.2';
92
92
  glitter.share.start = new Date();
93
93
  const vm = {
94
94
  appConfig: [],
package/lowcode/Entry.ts CHANGED
@@ -88,7 +88,7 @@ export class Entry {
88
88
  }
89
89
  (window as any).renderClock = (window as any).renderClock ?? clockF();
90
90
  console.log(`Entry-time:`, (window as any).renderClock.stop());
91
- glitter.share.editerVersion = 'V_16.9.9';
91
+ glitter.share.editerVersion = 'V_17.0.2';
92
92
  glitter.share.start = new Date();
93
93
  const vm: {
94
94
  appConfig: any;
@@ -626,17 +626,8 @@ function editor(cf) {
626
626
  };
627
627
  }));
628
628
  }
629
- function detail(gvc, cf, vm, cVm, page_tab) {
630
- vm.data.content.tag = vm.data.content.tag || `${new Date().getTime()}`;
631
- if (!vm.data.id && cf.is_page) {
632
- setTimeout(() => {
633
- cVm.type = 'template';
634
- vm.data.content.template = 'article';
635
- gvc.notifyDataChange(cVm.id);
636
- }, 100);
637
- return ``;
638
- }
639
- if (!vm.data.content.language_data) {
629
+ function initialData(content) {
630
+ if (!content.language_data) {
640
631
  function empty() {
641
632
  return {
642
633
  name: '',
@@ -650,18 +641,30 @@ function detail(gvc, cf, vm, cVm, page_tab) {
650
641
  config: ''
651
642
  };
652
643
  }
653
- vm.data.content.language_data = {
644
+ content.language_data = {
654
645
  'en-US': empty(),
655
646
  'zh-CN': empty(),
656
647
  'zh-TW': {
657
- name: vm.data.content.name,
658
- seo: vm.data.content.seo,
659
- text: vm.data.content.text,
660
- config: vm.data.content.config
648
+ name: content.name,
649
+ seo: content.seo,
650
+ text: content.text,
651
+ config: content.config
661
652
  }
662
653
  };
663
654
  }
664
- let language = window.parent.store_info.language_setting.def;
655
+ }
656
+ let language = window.parent.store_info.language_setting.def;
657
+ function detail(gvc, cf, vm, cVm, page_tab) {
658
+ vm.data.content.tag = vm.data.content.tag || `${new Date().getTime()}`;
659
+ if (!vm.data.id && cf.is_page) {
660
+ setTimeout(() => {
661
+ cVm.type = 'template';
662
+ vm.data.content.template = 'article';
663
+ gvc.notifyDataChange(cVm.id);
664
+ }, 100);
665
+ return ``;
666
+ }
667
+ initialData(vm.data.content);
665
668
  const domainPrefix = `${cf.is_page
666
669
  ? (() => {
667
670
  switch (page_tab) {
@@ -702,6 +705,9 @@ function detail(gvc, cf, vm, cVm, page_tab) {
702
705
  if (res) {
703
706
  next();
704
707
  }
708
+ else {
709
+ gvc.notifyDataChange(id);
710
+ }
705
711
  });
706
712
  }
707
713
  else {
@@ -738,14 +744,15 @@ function detail(gvc, cf, vm, cVm, page_tab) {
738
744
  })()
739
745
  : '編輯網誌')}
740
746
  <div class="flex-fill"></div>
741
- <div class="${cf.is_page ? `d-none` : ``}"> ${LanguageBackend.switchBtn({
747
+ <div class="${cf.is_page ? `d-none` : ``}"> ${LanguageBackend.switchBtn({
742
748
  gvc: gvc,
743
749
  language: language,
744
750
  callback: (lan) => {
745
751
  language = lan;
746
752
  refreshProductPage();
747
753
  }
748
- })}</div>
754
+ })}
755
+ </div>
749
756
  </div>
750
757
  <div class="flex-fill my-2 ${cf.is_page ? `` : `d-none`}"></div>
751
758
  <div class="d-flex ${cf.is_page ? `` : `d-none`} ${(document.body.clientWidth < 800) ? `w-100` : ``}">
@@ -816,7 +823,7 @@ function detail(gvc, cf, vm, cVm, page_tab) {
816
823
  html `
817
824
  <div>
818
825
  <div class="tx_normal fw-normal mb-2">
819
- 自訂網址
826
+ 自訂網址
820
827
  </div>
821
828
  <div
822
829
  style="justify-content: flex-start; align-items: center; display: inline-flex;border:1px solid #EAEAEA;border-radius: 10px;overflow: hidden; ${document
@@ -906,7 +913,7 @@ function detail(gvc, cf, vm, cVm, page_tab) {
906
913
  html `
907
914
  <div class="d-flex w-100 align-items-center justify-content-between p-0 my-2">
908
915
  <div class="tx_normal fw-normal">
909
- 網誌內文${BgWidget.languageInsignia(language, 'margin-left:5px;')}
916
+ 網誌內文${BgWidget.languageInsignia(language, 'margin-left:5px;')}
910
917
  </div>
911
918
  </div>`,
912
919
  gvc.bindView((() => {
@@ -916,10 +923,10 @@ function detail(gvc, cf, vm, cVm, page_tab) {
916
923
  view: () => {
917
924
  try {
918
925
  return html `
919
- <div
920
- class="d-flex justify-content-between align-items-center gap-3 mb-1"
921
- style="cursor: pointer;"
922
- onclick="${gvc.event(() => {
926
+ <div
927
+ class="d-flex justify-content-between align-items-center gap-3 mb-1"
928
+ style="cursor: pointer;"
929
+ onclick="${gvc.event(() => {
923
930
  const originContent = `${language_data.text}`;
924
931
  BgWidget.fullDialog({
925
932
  gvc: gvc,
@@ -938,8 +945,8 @@ function detail(gvc, cf, vm, cVm, page_tab) {
938
945
  },
939
946
  innerHTML: (gvc2) => {
940
947
  return html `
941
- <div>
942
- ${EditorElem.richText({
948
+ <div>
949
+ ${EditorElem.richText({
943
950
  gvc: gvc2,
944
951
  def: language_data.text,
945
952
  setHeight: '100vh',
@@ -954,15 +961,15 @@ function detail(gvc, cf, vm, cVm, page_tab) {
954
961
  const imgHTML = urlArray
955
962
  .map((url) => {
956
963
  return html `
957
- <img src="${url.data}"/>`;
964
+ <img src="${url.data}"/>`;
958
965
  })
959
966
  .join('');
960
967
  editor.html.set(editor.html
961
968
  .get(0)
962
969
  .replace(mark, html `
963
- <div class="d-flex flex-column">
964
- ${imgHTML}
965
- </div>`));
970
+ <div class="d-flex flex-column">
971
+ ${imgHTML}
972
+ </div>`));
966
973
  editor.undo.saveStep();
967
974
  }
968
975
  else {
@@ -970,12 +977,12 @@ function detail(gvc, cf, vm, cVm, page_tab) {
970
977
  dialog.errorMessage({ text: '請選擇至少一張圖片' });
971
978
  }
972
979
  }, html `
973
- <div
974
- class="d-flex flex-column"
975
- style="border-radius: 10px 10px 0px 0px;background: #F2F2F2;"
976
- >
977
- 圖片庫
978
- </div>`, {
980
+ <div
981
+ class="d-flex flex-column"
982
+ style="border-radius: 10px 10px 0px 0px;background: #F2F2F2;"
983
+ >
984
+ 圖片庫
985
+ </div>`, {
979
986
  mul: true,
980
987
  cancelEvent: () => {
981
988
  editor.html.set(editor.html.get(0).replace(mark, ''));
@@ -988,7 +995,7 @@ function detail(gvc, cf, vm, cVm, page_tab) {
988
995
  },
989
996
  rich_height: `calc(${window.parent.innerHeight}px - 70px - 58px - 49px - 64px - 40px + ${document.body.clientWidth < 800 ? `70` : `0`}px)`,
990
997
  })}
991
- </div>`;
998
+ </div>`;
992
999
  },
993
1000
  footer_html: (gvc2) => {
994
1001
  return [
@@ -1007,13 +1014,13 @@ function detail(gvc, cf, vm, cVm, page_tab) {
1007
1014
  },
1008
1015
  });
1009
1016
  })}"
1010
- >
1011
- ${(() => {
1017
+ >
1018
+ ${(() => {
1012
1019
  language_data.text = language_data.text || '';
1013
1020
  const text = gvc.glitter.utText.removeTag(language_data.text);
1014
1021
  return BgWidget.richTextView(Tool.truncateString(text, 100));
1015
1022
  })()}
1016
- </div>`;
1023
+ </div>`;
1017
1024
  }
1018
1025
  catch (e) {
1019
1026
  console.log(`error=>`, e);
@@ -1063,7 +1070,7 @@ function detail(gvc, cf, vm, cVm, page_tab) {
1063
1070
  return BgWidget.mainCard([
1064
1071
  BgWidget.title(html `商品顯示區塊 ${index + 1}`, 'font-size: 16px;'),
1065
1072
  html `
1066
- <div class="my-2"></div>`,
1073
+ <div class="my-2"></div>`,
1067
1074
  [
1068
1075
  html `${(() => {
1069
1076
  return gvc.bindView(() => {
@@ -1089,16 +1096,16 @@ function detail(gvc, cf, vm, cVm, page_tab) {
1089
1096
  return BgWidget.spinner();
1090
1097
  }
1091
1098
  return html `
1092
- <div class="d-flex flex-column p-2"
1093
- style="gap: 18px;">
1094
- <div class="d-flex align-items-center gray-bottom-line-18 "
1095
- style="gap: 24px; justify-content: space-between;">
1096
- <div class="form-check-label c_updown_label">
1097
- <div class="tx_normal">
1098
- 產品列表
1099
+ <div class="d-flex flex-column p-2"
1100
+ style="gap: 18px;">
1101
+ <div class="d-flex align-items-center gray-bottom-line-18 "
1102
+ style="gap: 24px; justify-content: space-between;">
1103
+ <div class="form-check-label c_updown_label">
1104
+ <div class="tx_normal">
1105
+ 產品列表
1106
+ </div>
1099
1107
  </div>
1100
- </div>
1101
- ${BgWidget.grayButton('搜尋商品', gvc.event(() => {
1108
+ ${BgWidget.grayButton('搜尋商品', gvc.event(() => {
1102
1109
  BgProduct.productsDialog({
1103
1110
  default: d1.value,
1104
1111
  gvc: gvc,
@@ -1109,8 +1116,8 @@ function detail(gvc, cf, vm, cVm, page_tab) {
1109
1116
  filter_visible: page_tab === 'hidden' ? 'false' : 'true',
1110
1117
  });
1111
1118
  }), { textStyle: 'font-weight: 400;' })}
1112
- </div>
1113
- ${dataList
1119
+ </div>
1120
+ ${dataList
1114
1121
  .map((opt, index) => {
1115
1122
  return `<div class="d-flex align-items-center form-check-label c_updown_label px-1"
1116
1123
  style="justify-content: space-between"
@@ -1139,8 +1146,8 @@ function detail(gvc, cf, vm, cVm, page_tab) {
1139
1146
  </div>`;
1140
1147
  })
1141
1148
  .join('')}
1142
- </div>
1143
- `;
1149
+ </div>
1150
+ `;
1144
1151
  },
1145
1152
  onCreate: () => {
1146
1153
  },
@@ -1154,12 +1161,12 @@ function detail(gvc, cf, vm, cVm, page_tab) {
1154
1161
  BgWidget.mbContainer(24),
1155
1162
  BgWidget.mainCard([
1156
1163
  BgWidget.title(html `預設加入購物車
1157
- <div class="badge ms-2"
1158
- style="background:#eaeaea;color:#393939;">
1159
- 以下設定的商品與規格會自動加入購物車
1160
- </div>`, 'font-size: 16px;'),
1164
+ <div class="badge ms-2"
1165
+ style="background:#eaeaea;color:#393939;">
1166
+ 以下設定的商品與規格會自動加入購物車
1167
+ </div>`, 'font-size: 16px;'),
1161
1168
  html `
1162
- <div class="my-2"></div>`,
1169
+ <div class="my-2"></div>`,
1163
1170
  [
1164
1171
  html `${(() => {
1165
1172
  return gvc.bindView(() => {
@@ -1175,16 +1182,16 @@ function detail(gvc, cf, vm, cVm, page_tab) {
1175
1182
  return BgWidget.spinner();
1176
1183
  }
1177
1184
  return html `
1178
- <div class="d-flex flex-column p-2"
1179
- style="gap: 18px;">
1180
- <div class="d-flex align-items-center gray-bottom-line-18 "
1181
- style="gap: 24px; justify-content: space-between;">
1182
- <div class="form-check-label c_updown_label">
1183
- <div class="tx_normal">
1184
- 產品列表
1185
+ <div class="d-flex flex-column p-2"
1186
+ style="gap: 18px;">
1187
+ <div class="d-flex align-items-center gray-bottom-line-18 "
1188
+ style="gap: 24px; justify-content: space-between;">
1189
+ <div class="form-check-label c_updown_label">
1190
+ <div class="tx_normal">
1191
+ 產品列表
1192
+ </div>
1185
1193
  </div>
1186
- </div>
1187
- ${BgWidget.grayButton('搜尋商品', gvc.event(() => {
1194
+ ${BgWidget.grayButton('搜尋商品', gvc.event(() => {
1188
1195
  BgProduct.variantsSelector({
1189
1196
  gvc: gvc,
1190
1197
  filter_variants: vm.data.content.relative_data.map((dd) => {
@@ -1205,37 +1212,37 @@ function detail(gvc, cf, vm, cVm, page_tab) {
1205
1212
  show_mode: 'all',
1206
1213
  });
1207
1214
  }), { textStyle: 'font-weight: 400;' })}
1208
- </div>
1209
- ${subVM.dataList
1215
+ </div>
1216
+ ${subVM.dataList
1210
1217
  .map((opt, index) => {
1211
1218
  return html `
1212
- <div class="d-flex align-items-center form-check-label c_updown_label gap-3">
1219
+ <div class="d-flex align-items-center form-check-label c_updown_label gap-3">
1213
1220
  <span class="tx_normal"
1214
1221
  style="min-width: 20px;">${index + 1} .</span>
1215
- ${BgWidget.validImageBox({
1222
+ ${BgWidget.validImageBox({
1216
1223
  gvc: gvc,
1217
1224
  image: opt.image,
1218
1225
  width: 40,
1219
1226
  })}
1220
- <div class="tx_normal ${opt.note ? 'mb-1' : ''} d-flex flex-column">
1221
- ${opt.value}
1222
- ${opt.note ? html `
1223
- <div class="tx_gray_12">
1224
- ${opt.note}
1225
- </div> ` : ''}
1226
- </div>
1227
- <div class="flex-fill"></div>
1228
- ${BgWidget.cancel(gvc.event(() => {
1227
+ <div class="tx_normal ${opt.note ? 'mb-1' : ''} d-flex flex-column">
1228
+ ${opt.value}
1229
+ ${opt.note ? html `
1230
+ <div class="tx_gray_12">
1231
+ ${opt.note}
1232
+ </div> ` : ''}
1233
+ </div>
1234
+ <div class="flex-fill"></div>
1235
+ ${BgWidget.cancel(gvc.event(() => {
1229
1236
  vm.data.content.relative_data.splice(index, 1);
1230
1237
  subVM.dataList.splice(index, 1);
1231
1238
  gvc.notifyDataChange(subVM.id);
1232
1239
  }), '移除')}
1233
- </div>
1234
- `;
1240
+ </div>
1241
+ `;
1235
1242
  })
1236
1243
  .join('') || `<div class="w-100 d-flex align-content-center justify-content-center">尚未加入任何賣場商品</div>`}
1237
- </div>
1238
- `;
1244
+ </div>
1245
+ `;
1239
1246
  },
1240
1247
  onCreate: () => {
1241
1248
  if (subVM.loading) {
@@ -1619,7 +1626,11 @@ function detail(gvc, cf, vm, cVm, page_tab) {
1619
1626
  vm.type = 'list';
1620
1627
  }), '取消')}
1621
1628
  ${BgWidget.save(gvc.event(() => __awaiter(this, void 0, void 0, function* () {
1622
- saveData(gvc, cf, vm, cVm, false);
1629
+ saveData(gvc, cf, vm, cVm, false).then((res) => {
1630
+ if (!res) {
1631
+ gvc.notifyDataChange(id);
1632
+ }
1633
+ });
1623
1634
  })))}
1624
1635
  </div>
1625
1636
  `;
@@ -1636,7 +1647,12 @@ function saveData(gvc, cf, vm, cVm, silence) {
1636
1647
  });
1637
1648
  res_(false);
1638
1649
  }
1639
- else if (!vm.data.content.name) {
1650
+ else if (window.parent.store_info.language_setting.support.find((d1) => {
1651
+ return !(vm.data.content.language_data[d1].name);
1652
+ })) {
1653
+ language = window.parent.store_info.language_setting.support.find((d1) => {
1654
+ return !(vm.data.content.language_data[d1].name);
1655
+ });
1640
1656
  yield cf.widget.event('error', {
1641
1657
  title: '請設定名稱',
1642
1658
  });
@@ -2148,6 +2164,7 @@ function template_select(gvc, cf, vm, cVm, page_type) {
2148
2164
  if (c2) {
2149
2165
  vm.data.content.config = c2;
2150
2166
  vm.data.content.name = c2.name;
2167
+ initialData(vm.data.content);
2151
2168
  saveData(gvc, cf, vm, cVm, false).then(() => {
2152
2169
  cVm.type = 'detail';
2153
2170
  });