ts-glitter 21.1.6 → 21.1.8

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 (61) hide show
  1. package/create.js +1 -0
  2. package/lowcode/Entry.js +1 -1
  3. package/lowcode/Entry.ts +1 -1
  4. package/lowcode/backend-manager/bg-product.js +39 -18
  5. package/lowcode/backend-manager/bg-product.ts +54 -23
  6. package/lowcode/cms-plugin/pos-pages/payment-page.js +37 -29
  7. package/lowcode/cms-plugin/pos-pages/payment-page.ts +61 -49
  8. package/lowcode/cms-plugin/pos-pages/pos-function.js +6 -1
  9. package/lowcode/cms-plugin/pos-pages/pos-function.ts +8 -1
  10. package/lowcode/cms-plugin/stock-history.js +1 -0
  11. package/lowcode/cms-plugin/stock-history.ts +1 -10
  12. package/lowcode/css/editor.css +2 -2
  13. package/lowcode/editor-components/global-widget/bridge.js +43 -0
  14. package/lowcode/editor-components/global-widget/bridge.ts +46 -0
  15. package/lowcode/editor-components/global-widget/global-widget.js +1 -1
  16. package/lowcode/editor-components/global-widget/global-widget.ts +1 -1
  17. package/lowcode/form-view/e-commerce/product-select.js +13 -11
  18. package/lowcode/form-view/e-commerce/product-select.ts +14 -12
  19. package/lowcode/glitterBundle/plugins/editor-elem.js +14 -4
  20. package/lowcode/glitterBundle/plugins/editor-elem.ts +13 -4
  21. package/lowcode/jspage/function-page/main_editor.js +14 -10
  22. package/lowcode/jspage/function-page/main_editor.ts +14 -10
  23. package/lowcode/jspage/function-page/tool-setting.js +259 -223
  24. package/lowcode/jspage/function-page/tool-setting.ts +349 -311
  25. package/lowcode/modules/tool.js +9 -0
  26. package/lowcode/modules/tool.ts +12 -0
  27. package/lowcode/official_view_component/official/component.ts +1 -0
  28. package/lowcode/public-components/checkout/index.js +216 -207
  29. package/lowcode/public-components/checkout/index.ts +1315 -1309
  30. package/package.json +3 -1
  31. package/src/api-public/models/glitter-finance.js +1 -2
  32. package/src/api-public/models/glitter-finance.js.map +1 -5
  33. package/src/api-public/services/checkout-event.js +17 -7
  34. package/src/api-public/services/checkout-event.js.map +1 -1
  35. package/src/api-public/services/data-analyze.d.ts +1 -1
  36. package/src/api-public/services/fb-service.js +4 -4
  37. package/src/api-public/services/fb-service.js.map +1 -1
  38. package/src/api-public/services/schedule.d.ts +1 -1
  39. package/src/api-public/services/schedule.js +18 -14
  40. package/src/api-public/services/schedule.js.map +1 -1
  41. package/src/api-public/services/schedule.ts +18 -14
  42. package/src/api-public/services/user.js +17 -7
  43. package/src/api-public/services/user.js.map +1 -1
  44. package/src/config.d.ts +1 -1
  45. package/src/modules/AWSLib.js +2 -3
  46. package/src/modules/AWSLib.js.map +1 -1
  47. package/src/modules/database.d.ts +1 -1
  48. package/src/modules/redis.d.ts +1 -1
  49. package/src/modules/tool.d.ts +4 -4
  50. package/src/modules/tool.js +1 -2
  51. package/src/modules/tool.js.map +1 -1
  52. package/src/services/app.js +17 -7
  53. package/src/services/app.js.map +1 -1
  54. package/src/services/backend-service.js +17 -7
  55. package/src/services/backend-service.js.map +1 -1
  56. package/src/services/create-instance.js +3 -4
  57. package/src/services/create-instance.js.map +1 -1
  58. package/src/services/saas-table-check.js +2 -2
  59. package/src/services/saas-table-check.js.map +1 -5
  60. package/src/services/tool.js +2 -3
  61. package/src/services/tool.js.map +1 -1
@@ -0,0 +1,43 @@
1
+ import { ToolSetting } from '../../jspage/function-page/tool-setting.js';
2
+ export class Bridge {
3
+ static main(obj) {
4
+ const gvc = obj.gvc;
5
+ const glitter = gvc.glitter;
6
+ return [
7
+ `<div style="height:5px;"></div>`,
8
+ ToolSetting.item({
9
+ gvc: gvc,
10
+ dd: (() => {
11
+ switch (glitter.share.editorViewModel.selectItem.data.tag) {
12
+ case 'c_header':
13
+ return {
14
+ title: '標頭選單',
15
+ tag: '標頭元件',
16
+ hint: `全館 (首頁,隱形賣場,一頁式網頁) 的標頭將預設為以下樣式`,
17
+ toggle: true
18
+ };
19
+ case 'footer':
20
+ return {
21
+ title: '頁腳選單',
22
+ tag: '頁腳元件',
23
+ hint: `全館 (首頁,隱形賣場,一頁式網頁) 的頁腳將預設為以下樣式`,
24
+ toggle: true
25
+ };
26
+ case 'SY00-normal-products':
27
+ case 'SY02_page_product':
28
+ case 'SY00-normal-scroll-products':
29
+ return {
30
+ title: '商品卡片',
31
+ tag: '商品卡片',
32
+ hint: `全館 (首頁,隱形賣場,一頁式網頁) 的商品卡片將預設為以下樣式`,
33
+ toggle: true,
34
+ editable: true
35
+ };
36
+ }
37
+ })(),
38
+ }),
39
+ `<div style="height:1px;" class="border-top mx-n3"></div>`,
40
+ ].join(`<div style="height:10px;"></div>`);
41
+ }
42
+ }
43
+ window.glitter.setModule(import.meta.url, Bridge);
@@ -0,0 +1,46 @@
1
+ import { GVC } from '../../glitterBundle/GVController.js';
2
+ import { ToolSetting } from '../../jspage/function-page/tool-setting.js';
3
+
4
+ export class Bridge {
5
+ public static main(obj: any) {
6
+ const gvc: GVC = obj.gvc;
7
+ const glitter = gvc.glitter;
8
+ return [
9
+ `<div style="height:5px;"></div>`,
10
+ ToolSetting.item({
11
+ gvc: gvc,
12
+ dd: (() => {
13
+ switch (glitter.share.editorViewModel.selectItem.data.tag){
14
+ case 'c_header':
15
+ return {
16
+ title: '標頭選單',
17
+ tag: '標頭元件',
18
+ hint: `全館 (首頁,隱形賣場,一頁式網頁) 的標頭將預設為以下樣式`,
19
+ toggle:true
20
+ };
21
+ case 'footer':
22
+ return {
23
+ title: '頁腳選單',
24
+ tag: '頁腳元件',
25
+ hint: `全館 (首頁,隱形賣場,一頁式網頁) 的頁腳將預設為以下樣式`,
26
+ toggle:true
27
+ };
28
+ case 'SY00-normal-products':
29
+ case 'SY02_page_product':
30
+ case 'SY00-normal-scroll-products':
31
+ return {
32
+ title: '商品卡片',
33
+ tag: '商品卡片',
34
+ hint: `全館 (首頁,隱形賣場,一頁式網頁) 的商品卡片將預設為以下樣式`,
35
+ toggle:true,
36
+ editable:true
37
+ }
38
+ }
39
+ })(),
40
+ }),
41
+ `<div style="height:1px;" class="border-top mx-n3"></div>`,
42
+ ].join(`<div style="height:10px;"></div>`);
43
+ }
44
+ }
45
+
46
+ (window as any).glitter.setModule(import.meta.url, Bridge);
@@ -110,7 +110,7 @@ export class GlobalWidget {
110
110
  return module_list
111
111
  .map((dd) => {
112
112
  return `
113
- <div class="d-flex align-items-center justify-content-center bgf6 hoverHidden position-relative py-4" style="">
113
+ <div class="d-flex align-items-center justify-content-center bgf6 hoverHidden position-relative py-4" style="min-height:200px;">
114
114
  <img class="w-100" src="${dd.template_config.image[0]}">
115
115
  <div
116
116
  class="position-absolute w-100 h-100 align-items-center justify-content-center rounded fs-6 flex-column"
@@ -135,7 +135,7 @@ export class GlobalWidget {
135
135
  return module_list
136
136
  .map((dd: any) => {
137
137
  return `
138
- <div class="d-flex align-items-center justify-content-center bgf6 hoverHidden position-relative py-4" style="">
138
+ <div class="d-flex align-items-center justify-content-center bgf6 hoverHidden position-relative py-4" style="min-height:200px;">
139
139
  <img class="w-100" src="${dd.template_config.image[0]}">
140
140
  <div
141
141
  class="position-absolute w-100 h-100 align-items-center justify-content-center rounded fs-6 flex-column"
@@ -124,9 +124,10 @@ export class ProductSelect {
124
124
  return [];
125
125
  }
126
126
  }))();
127
- resolve(html ` <div class="d-flex flex-column py-2 my-2 border-top" style="gap: 18px;">
127
+ resolve(html ` <div class="d-flex flex-column py-2" style="">
128
+ <div class="mx-n3 border-top" ></div>
128
129
  <div
129
- class="d-flex align-items-center gray-bottom-line-18 pb-2"
130
+ class="d-flex align-items-center pb-2"
130
131
  style="gap: 10px; justify-content: space-between;"
131
132
  >
132
133
  <div class="flex-fill ">
@@ -153,14 +154,7 @@ export class ProductSelect {
153
154
  class="${bundle.formData[bundle.key].select === 'all' ? `d-none` : ``}"
154
155
  style="margin-top: 30px;"
155
156
  >
156
- ${BgWidget.grayButton((() => {
157
- switch (bundle.formData[bundle.key].select) {
158
- case 'product':
159
- case 'collection':
160
- return `選取`;
161
- }
162
- return ``;
163
- })(), gvc.event(() => {
157
+ ${BgWidget.save(gvc.event(() => {
164
158
  var _a, _b;
165
159
  if (bundle.formData[bundle.key].select === 'product') {
166
160
  bundle.formData[bundle.key].value = (_a = bundle.formData[bundle.key].value) !== null && _a !== void 0 ? _a : [];
@@ -186,7 +180,14 @@ export class ProductSelect {
186
180
  }),
187
181
  });
188
182
  }
189
- }), { textStyle: 'font-weight: 400;' })}
183
+ }), (() => {
184
+ switch (bundle.formData[bundle.key].select) {
185
+ case 'product':
186
+ case 'collection':
187
+ return `選取`;
188
+ }
189
+ return ``;
190
+ })())}
190
191
  </div>
191
192
  </div>
192
193
  <div class="d-flex flex-column gap-2" id="${subVM.containerId}">
@@ -232,6 +233,7 @@ export class ProductSelect {
232
233
  }
233
234
  }))}
234
235
  </div>
236
+ <div class="mx-n3 border-top" ></div>
235
237
  </div>`);
236
238
  }));
237
239
  },
@@ -127,9 +127,10 @@ export class ProductSelect {
127
127
  }
128
128
  })();
129
129
  resolve(
130
- html` <div class="d-flex flex-column py-2 my-2 border-top" style="gap: 18px;">
130
+ html` <div class="d-flex flex-column py-2" style="">
131
+ <div class="mx-n3 border-top" ></div>
131
132
  <div
132
- class="d-flex align-items-center gray-bottom-line-18 pb-2"
133
+ class="d-flex align-items-center pb-2"
133
134
  style="gap: 10px; justify-content: space-between;"
134
135
  >
135
136
  <div class="flex-fill ">
@@ -156,15 +157,7 @@ export class ProductSelect {
156
157
  class="${bundle.formData[bundle.key].select === 'all' ? `d-none` : ``}"
157
158
  style="margin-top: 30px;"
158
159
  >
159
- ${BgWidget.grayButton(
160
- (() => {
161
- switch (bundle.formData[bundle.key].select) {
162
- case 'product':
163
- case 'collection':
164
- return `選取`;
165
- }
166
- return ``;
167
- })(),
160
+ ${BgWidget.save(
168
161
  gvc.event(() => {
169
162
  if (bundle.formData[bundle.key].select === 'product') {
170
163
  bundle.formData[bundle.key].value = bundle.formData[bundle.key].value ?? [];
@@ -190,7 +183,15 @@ export class ProductSelect {
190
183
  });
191
184
  }
192
185
  }),
193
- { textStyle: 'font-weight: 400;' }
186
+ (() => {
187
+ switch (bundle.formData[bundle.key].select) {
188
+ case 'product':
189
+ case 'collection':
190
+ return `選取`;
191
+ }
192
+ return ``;
193
+ })(),
194
+
194
195
  )}
195
196
  </div>
196
197
  </div>
@@ -241,6 +242,7 @@ export class ProductSelect {
241
242
  })
242
243
  )}
243
244
  </div>
245
+ <div class="mx-n3 border-top" ></div>
244
246
  </div>`
245
247
  );
246
248
  });
@@ -680,7 +680,17 @@ export class EditorElem {
680
680
  return html ` <iframe class="rounded-3" style="border: none;width:${cf.width}px;height:${cf.height}px;"></iframe>`;
681
681
  }
682
682
  static codeEditor(obj) {
683
+ var _a;
683
684
  const codeID = obj.gvc.glitter.getUUID();
685
+ console.log(`codeEditor`, {
686
+ type: 'getData',
687
+ value: `${obj.structStart ? obj.structStart : `(()=>{`} ${(_a = obj.initial) !== null && _a !== void 0 ? _a : ''}
688
+ ${obj.structEnd ? obj.structEnd : '})()'}`,
689
+ language: 'javascript',
690
+ refactor: true,
691
+ structStart: obj.structStart,
692
+ structEnd: obj.structEnd,
693
+ });
684
694
  function getComponent(gvc, height) {
685
695
  return gvc.bindView(() => {
686
696
  const id = obj.gvc.glitter.getUUID();
@@ -692,10 +702,10 @@ export class EditorElem {
692
702
  const childWindow = (document.getElementById(frameID) || window.parent.document.getElementById(frameID)).contentWindow;
693
703
  childWindow.postMessage({
694
704
  type: 'getData',
695
- value: `${obj.structStart ? obj.structStart : `(()=>{`} ${(_a = obj.initial) !== null && _a !== void 0 ? _a : ''}
696
- ${obj.structEnd ? obj.structEnd : '})()'}`,
705
+ value: `${obj.structStart ? obj.structStart : `(()=>{`} \n${(_a = obj.initial) !== null && _a !== void 0 ? _a : ''}
706
+ ${obj.structEnd ? obj.structEnd : '})()'}`,
697
707
  language: 'javascript',
698
- refactor: true,
708
+ refactor: false,
699
709
  structStart: obj.structStart,
700
710
  structEnd: obj.structEnd,
701
711
  }, domain);
@@ -974,7 +984,7 @@ export class EditorElem {
974
984
  快速插入
975
985
  ${obj.quick_insert
976
986
  .map(dd => {
977
- return html `<div
987
+ return html ` <div
978
988
  style="cursor: pointer;"
979
989
  onclick="${gvc.event(() => {
980
990
  editor.selection.restore();
@@ -775,6 +775,15 @@ export class EditorElem {
775
775
  structEnd?: string;
776
776
  }) {
777
777
  const codeID = obj.gvc.glitter.getUUID();
778
+ console.log(`codeEditor`, {
779
+ type: 'getData',
780
+ value: `${obj.structStart ? obj.structStart : `(()=>{`} ${obj.initial ?? ''}
781
+ ${obj.structEnd ? obj.structEnd : '})()'}`,
782
+ language: 'javascript',
783
+ refactor: true,
784
+ structStart: obj.structStart,
785
+ structEnd: obj.structEnd,
786
+ });
778
787
 
779
788
  function getComponent(gvc: GVC, height: number) {
780
789
  return gvc.bindView(() => {
@@ -789,10 +798,10 @@ export class EditorElem {
789
798
  childWindow.postMessage(
790
799
  {
791
800
  type: 'getData',
792
- value: `${obj.structStart ? obj.structStart : `(()=>{`} ${obj.initial ?? ''}
793
- ${obj.structEnd ? obj.structEnd : '})()'}`,
801
+ value: `${obj.structStart ? obj.structStart : `(()=>{`} \n${obj.initial ?? ''}
802
+ ${obj.structEnd ? obj.structEnd : '})()'}`,
794
803
  language: 'javascript',
795
- refactor: true,
804
+ refactor: false,
796
805
  structStart: obj.structStart,
797
806
  structEnd: obj.structEnd,
798
807
  },
@@ -1132,7 +1141,7 @@ export class EditorElem {
1132
1141
  快速插入
1133
1142
  ${obj.quick_insert
1134
1143
  .map(dd => {
1135
- return html`<div
1144
+ return html` <div
1136
1145
  style="cursor: pointer;"
1137
1146
  onclick="${gvc.event(() => {
1138
1147
  editor.selection.restore();
@@ -1046,14 +1046,7 @@ export class Main_editor {
1046
1046
  };
1047
1047
  })}
1048
1048
  <div style="height: 60px;"></div>
1049
- <div
1050
- class="${document.body.clientWidth < 800
1051
- ? `position-fixed`
1052
- : `position-absolute`} w-100 bottom-0 d-flex align-items-center p-3 shadow justify-content-end border-top bg-white "
1053
- style="height: 60px;${document.body.clientWidth < 800
1054
- ? `padding-bottom:${parseInt(glitter.share.bottom_inset, 10)}px !important;`
1055
- : ``}"
1056
- >
1049
+
1057
1050
  ${(() => {
1058
1051
  const view = [];
1059
1052
  if (viewModel.selectItem.deletable !== 'false') {
@@ -1098,9 +1091,20 @@ export class Main_editor {
1098
1091
  glitter.htmlGenerate.deleteWidget(glitter.share.editorViewModel.selectContainer, viewModel.selectItem, () => { });
1099
1092
  }), '刪除'));
1100
1093
  }
1101
- return view.join('<div class="mx-1"></div>');
1094
+ if (!view.join('')) {
1095
+ return ``;
1096
+ }
1097
+ else {
1098
+ return ` <div
1099
+ class="${document.body.clientWidth < 800
1100
+ ? `position-fixed`
1101
+ : `position-absolute`} w-100 bottom-0 d-flex align-items-center p-3 shadow justify-content-end border-top bg-white "
1102
+ style="height: 60px;${document.body.clientWidth < 800
1103
+ ? `padding-bottom:${parseInt(glitter.share.bottom_inset, 10)}px !important;`
1104
+ : ``}"
1105
+ >${view.join('<div class="mx-1"></div>')}</div>`;
1106
+ }
1102
1107
  })()}
1103
- </div>
1104
1108
  </div>
1105
1109
  `,
1106
1110
  gvc.bindView(() => {
@@ -1137,14 +1137,7 @@ export class Main_editor {
1137
1137
  };
1138
1138
  })}
1139
1139
  <div style="height: 60px;"></div>
1140
- <div
1141
- class="${document.body.clientWidth < 800
1142
- ? `position-fixed`
1143
- : `position-absolute`} w-100 bottom-0 d-flex align-items-center p-3 shadow justify-content-end border-top bg-white "
1144
- style="height: 60px;${document.body.clientWidth < 800
1145
- ? `padding-bottom:${parseInt(glitter.share.bottom_inset, 10)}px !important;`
1146
- : ``}"
1147
- >
1140
+
1148
1141
  ${(() => {
1149
1142
  const view: any = [];
1150
1143
  if (viewModel.selectItem.deletable !== 'false') {
@@ -1210,9 +1203,20 @@ export class Main_editor {
1210
1203
  )
1211
1204
  );
1212
1205
  }
1213
- return view.join('<div class="mx-1"></div>');
1206
+ if(!view.join('')){
1207
+ return ``
1208
+ }else{
1209
+ return ` <div
1210
+ class="${document.body.clientWidth < 800
1211
+ ? `position-fixed`
1212
+ : `position-absolute`} w-100 bottom-0 d-flex align-items-center p-3 shadow justify-content-end border-top bg-white "
1213
+ style="height: 60px;${document.body.clientWidth < 800
1214
+ ? `padding-bottom:${parseInt(glitter.share.bottom_inset, 10)}px !important;`
1215
+ : ``}"
1216
+ >${view.join('<div class="mx-1"></div>')}</div>`
1217
+ }
1218
+
1214
1219
  })()}
1215
- </div>
1216
1220
  </div>
1217
1221
  `,
1218
1222
  gvc.bindView(() => {