ts-glitter 20.5.0 → 20.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.
Files changed (47) hide show
  1. package/lowcode/Entry.js +1 -1
  2. package/lowcode/Entry.ts +1 -1
  3. package/lowcode/cms-plugin/member-setting.js +2 -4
  4. package/lowcode/cms-plugin/member-setting.ts +2 -4
  5. package/lowcode/cms-plugin/shopping-collections.js +2 -2
  6. package/lowcode/cms-plugin/shopping-collections.ts +3 -2
  7. package/lowcode/cms-plugin/shopping-order-manager.js +1 -1
  8. package/lowcode/cms-plugin/shopping-order-manager.ts +1 -1
  9. package/lowcode/cms-plugin/stock-history.js +7 -2
  10. package/lowcode/cms-plugin/stock-history.ts +5 -2
  11. package/lowcode/cms-plugin/user-list.js +98 -97
  12. package/lowcode/cms-plugin/user-list.ts +111 -103
  13. package/lowcode/modules/checkInput.js +1 -1
  14. package/lowcode/modules/checkInput.ts +58 -60
  15. package/lowcode/public-components/checkout/index.js +0 -12
  16. package/lowcode/public-components/checkout/index.ts +1 -12
  17. package/lowcode/public-components/user-manager/um-info.js +49 -48
  18. package/lowcode/public-components/user-manager/um-info.ts +219 -204
  19. package/lowcode/public-components/user-manager/um-order.js +36 -22
  20. package/lowcode/public-components/user-manager/um-order.ts +43 -24
  21. package/lowcode/src/glitterBundle/module/Animation.js +7 -13
  22. package/lowcode/src/glitterBundle/module/Enum.js +2 -6
  23. package/lowcode/src/glitterBundle/module/Html_generate.js +50 -42
  24. package/lowcode/src/glitterBundle/module/PageManager.js +23 -30
  25. package/lowcode/src/glitterBundle/plugins/click-event.js +25 -19
  26. package/lowcode/src/glitterBundle/plugins/dialog-style-editor.js +13 -16
  27. package/lowcode/src/glitterBundle/plugins/editor-elem.js +1 -6
  28. package/lowcode/src/glitterBundle/plugins/editor.js +1 -5
  29. package/lowcode/src/glitterBundle/plugins/html-render.js +2 -5
  30. package/lowcode/src/glitterBundle/plugins/plugin-creater.js +28 -22
  31. package/lowcode/src/glitterBundle/plugins/seo-manager.js +1 -5
  32. package/lowcode/src/glitterBundle/plugins/style-attr.js +1 -5
  33. package/lowcode/src/glitterBundle/plugins/style-editor.js +1 -3
  34. package/package.json +1 -1
  35. package/src/api-public/services/financial-service.js +7 -6
  36. package/src/api-public/services/financial-service.js.map +1 -1
  37. package/src/api-public/services/financial-service.ts +11 -8
  38. package/src/api-public/services/model/handlePaymentTransaction.js +29 -2
  39. package/src/api-public/services/model/handlePaymentTransaction.js.map +1 -1
  40. package/src/api-public/services/model/handlePaymentTransaction.ts +8 -9
  41. package/src/api-public/services/shopping.d.ts +1 -1
  42. package/src/api-public/services/shopping.js +23 -10
  43. package/src/api-public/services/shopping.js.map +1 -1
  44. package/src/api-public/services/shopping.ts +15 -3
  45. package/src/api-public/services/user.js +44 -61
  46. package/src/api-public/services/user.js.map +1 -1
  47. package/src/api-public/services/user.ts +56 -66
package/lowcode/Entry.js CHANGED
@@ -144,7 +144,7 @@ export class Entry {
144
144
  }
145
145
  window.renderClock = (_b = window.renderClock) !== null && _b !== void 0 ? _b : createClock();
146
146
  console.log(`Entry-time:`, window.renderClock.stop());
147
- glitter.share.editerVersion = 'V_20.5.0';
147
+ glitter.share.editerVersion = 'V_20.5.2';
148
148
  glitter.share.start = new Date();
149
149
  const vm = { appConfig: [] };
150
150
  window.saasConfig = {
package/lowcode/Entry.ts CHANGED
@@ -146,7 +146,7 @@ export class Entry {
146
146
  }
147
147
  (window as any).renderClock = (window as any).renderClock ?? createClock();
148
148
  console.log(`Entry-time:`, (window as any).renderClock.stop());
149
- glitter.share.editerVersion = 'V_20.5.0';
149
+ glitter.share.editerVersion = 'V_20.5.2';
150
150
  glitter.share.start = new Date();
151
151
  const vm = { appConfig: [] };
152
152
  (window as any).saasConfig = {
@@ -132,7 +132,7 @@ export class MemberSetting {
132
132
  style="margin-bottom: 12px;"
133
133
  >
134
134
  註冊頁面表單
135
- <span class="" style="color:#8D8D8D;font-size: 12px;">於註冊頁面中設定顧客必須填寫的資料</span>
135
+ <span style="color:#8D8D8D;font-size: 12px;">於註冊頁面中設定顧客必須填寫的資料</span>
136
136
  </div>`,
137
137
  },
138
138
  {
@@ -142,9 +142,7 @@ export class MemberSetting {
142
142
  style="margin-bottom: 12px;"
143
143
  >
144
144
  設定頁面表單
145
- <span class="" style="color:#8D8D8D;font-size: 12px;"
146
- >於用戶設定頁面中設定顧客可填寫的額外資料</span
147
- >
145
+ <span style="color:#8D8D8D;font-size: 12px;">於用戶設定頁面中設定顧客可填寫的額外資料</span>
148
146
  </div>`,
149
147
  },
150
148
  ]);
@@ -148,7 +148,7 @@ export class MemberSetting {
148
148
  style="margin-bottom: 12px;"
149
149
  >
150
150
  註冊頁面表單
151
- <span class="" style="color:#8D8D8D;font-size: 12px;">於註冊頁面中設定顧客必須填寫的資料</span>
151
+ <span style="color:#8D8D8D;font-size: 12px;">於註冊頁面中設定顧客必須填寫的資料</span>
152
152
  </div>`,
153
153
  },
154
154
  {
@@ -158,9 +158,7 @@ export class MemberSetting {
158
158
  style="margin-bottom: 12px;"
159
159
  >
160
160
  設定頁面表單
161
- <span class="" style="color:#8D8D8D;font-size: 12px;"
162
- >於用戶設定頁面中設定顧客可填寫的額外資料</span
163
- >
161
+ <span style="color:#8D8D8D;font-size: 12px;">於用戶設定頁面中設定顧客可填寫的額外資料</span>
164
162
  </div>`,
165
163
  },
166
164
  ]);
@@ -960,8 +960,8 @@ export class ShoppingCollections {
960
960
  dialog.infoMessage({ text: '請填寫「標題」' });
961
961
  return;
962
962
  }
963
- const regexTitle = /[\s,\/\\]+/g;
964
- if (regexTitle.test(vm.data.title)) {
963
+ const forbiddenRegex = /[,/\\]/;
964
+ if (forbiddenRegex.test(vm.data.title)) {
965
965
  dialog.infoMessage({ text: '標題不可包含空白格與以下符號:<br />「 , 」「 / 」「 \\ 」' });
966
966
  return;
967
967
  }
@@ -1144,8 +1144,9 @@ export class ShoppingCollections {
1144
1144
  return;
1145
1145
  }
1146
1146
 
1147
- const regexTitle = /[\s,\/\\]+/g;
1148
- if (regexTitle.test(vm.data.title)) {
1147
+ // const regexTitle = /[\s,\/\\]+/g;
1148
+ const forbiddenRegex = /[,/\\]/;
1149
+ if (forbiddenRegex.test(vm.data.title)) {
1149
1150
  dialog.infoMessage({ text: '標題不可包含空白格與以下符號:<br />「 , 」「 / 」「 \\ 」' });
1150
1151
  return;
1151
1152
  }
@@ -1769,7 +1769,7 @@ export class ShoppingOrderManager {
1769
1769
  ${document.body.clientWidth > 768 ? getBadgeList() : ''}
1770
1770
  </div>
1771
1771
  ${document.body.clientWidth > 768 ? '' : html ` <div class="mt-1 mb-3">${getBadgeList()}</div>`}
1772
- <div class="d-flex justify-content-end">${funBTN().splitOrder()}</div>
1772
+ <div class="d-none justify-content-end">${funBTN().splitOrder()}</div>
1773
1773
  ${BgWidget.container1x2({
1774
1774
  html: [
1775
1775
  !is_shipment ? '' : shipment_card,
@@ -1963,7 +1963,7 @@ export class ShoppingOrderManager {
1963
1963
  ${document.body.clientWidth > 768 ? getBadgeList() : ''}
1964
1964
  </div>
1965
1965
  ${document.body.clientWidth > 768 ? '' : html` <div class="mt-1 mb-3">${getBadgeList()}</div>`}
1966
- <div class="d-flex justify-content-end">${funBTN().splitOrder()}</div>
1966
+ <div class="d-none justify-content-end">${funBTN().splitOrder()}</div>
1967
1967
  ${BgWidget.container1x2(
1968
1968
  {
1969
1969
  html: [
@@ -239,8 +239,13 @@ export class StockHistory {
239
239
  {
240
240
  key: '總金額',
241
241
  value: `<span class="fs-7">$ ${dd.content.product_list.reduce((sum, item) => {
242
- var _a;
243
- return sum + item.cost * ((_a = item.recent_count) !== null && _a !== void 0 ? _a : 0);
242
+ var _a, _b;
243
+ if (dd.type === 'restocking') {
244
+ return sum + item.cost * ((_a = item.transfer_count) !== null && _a !== void 0 ? _a : 0);
245
+ }
246
+ else {
247
+ return sum + item.cost * ((_b = item.recent_count) !== null && _b !== void 0 ? _b : 0);
248
+ }
244
249
  }, 0).toLocaleString()}</span>`,
245
250
  },
246
251
  {
@@ -12,7 +12,6 @@ import { StockVendors, VendorData } from './stock-vendors.js';
12
12
  import { CheckInput } from '../modules/checkInput.js';
13
13
  import { Tool } from '../modules/tool.js';
14
14
  import { BgProduct, OptionsItem } from '../backend-manager/bg-product.js';
15
- import { al } from '@faker-js/faker/dist/airline-CBNP41sR.js';
16
15
 
17
16
  const html = String.raw;
18
17
 
@@ -271,7 +270,11 @@ export class StockHistory {
271
270
  {
272
271
  key: '總金額',
273
272
  value: `<span class="fs-7">$ ${ dd.content.product_list.reduce((sum, item) => {
274
- return sum + item.cost * (item.recent_count ?? 0);
273
+ if(dd.type==='restocking'){
274
+ return sum + item.cost * (item.transfer_count ?? 0);
275
+ }else{
276
+ return sum + item.cost * (item.recent_count ?? 0);
277
+ }
275
278
  }, 0).toLocaleString()}</span>`,
276
279
  },
277
280
  {
@@ -1181,94 +1181,92 @@ export class UserList {
1181
1181
  </div>`,
1182
1182
  ].join(BgWidget.mbContainer(12)),
1183
1183
  [
1184
- html `<div class="tx_700">升級方式</div>`,
1184
+ html `
1185
+ <div class="d-flex align-items-center gap-2">
1186
+ <div class="tx_700">升級方式</div>
1187
+ ${BgWidget.blueNote('查看會員級數規則', gvc.event(() => {
1188
+ BgWidget.infoDialog({
1189
+ gvc: gvc,
1190
+ title: '會員規則',
1191
+ innerHTML: BgWidget.tableV3({
1192
+ gvc: gvc,
1193
+ getData: vd => {
1194
+ setTimeout(() => {
1195
+ vd.tableData = vm.data.member.map((leadData) => {
1196
+ return [
1197
+ {
1198
+ key: '會員等級',
1199
+ value: leadData.tag_name,
1200
+ },
1201
+ {
1202
+ key: '升級規則',
1203
+ value: (() => {
1204
+ let text = '';
1205
+ const val = parseInt(`${leadData.og.condition.value}`, 10).toLocaleString();
1206
+ const condition_type = leadData.og.condition.type === 'single' ? '單筆' : '累積';
1207
+ if (leadData.og.duration.type === 'noLimit') {
1208
+ text = `${condition_type}消費額達 NT$${val}`;
1209
+ }
1210
+ else {
1211
+ text = `${leadData.og.duration.value}天內${condition_type}消費額達 NT$${val}`;
1212
+ }
1213
+ return text;
1214
+ })(),
1215
+ },
1216
+ {
1217
+ key: '有效期限',
1218
+ value: (() => {
1219
+ const { type, value } = leadData.og.dead_line;
1220
+ let dead_line = '';
1221
+ if (type === 'date') {
1222
+ const deadlines = [
1223
+ {
1224
+ title: '一個月',
1225
+ value: 30,
1226
+ },
1227
+ {
1228
+ title: '三個月',
1229
+ value: 90,
1230
+ },
1231
+ {
1232
+ title: '六個月',
1233
+ value: 180,
1234
+ },
1235
+ {
1236
+ title: '一年',
1237
+ value: 365,
1238
+ },
1239
+ ];
1240
+ const matchedDeadline = deadlines.find(item => item.value === value);
1241
+ dead_line = matchedDeadline
1242
+ ? matchedDeadline.title
1243
+ : `${value}天`;
1244
+ }
1245
+ else if (type === 'noLimit') {
1246
+ dead_line = '沒有期限';
1247
+ }
1248
+ return dead_line;
1249
+ })(),
1250
+ },
1251
+ ];
1252
+ });
1253
+ vd.originalData = vm.data.member;
1254
+ vd.loading = false;
1255
+ vd.callback();
1256
+ }, 200);
1257
+ },
1258
+ filter: [],
1259
+ rowClick: () => { },
1260
+ hiddenPageSplit: true,
1261
+ }),
1262
+ });
1263
+ }))}
1264
+ </div>
1265
+ `,
1185
1266
  BgWidget.multiCheckboxContainer(gvc, [
1186
1267
  {
1187
1268
  key: 'auto',
1188
- name: html `<div>
1189
- 根據本站<span
1190
- style="color: #4D86DB; text-decoration: underline;"
1191
- onclick="${gvc.event((e, ev) => {
1192
- ev.stopPropagation();
1193
- BgWidget.infoDialog({
1194
- gvc: gvc,
1195
- title: '會員規則',
1196
- innerHTML: BgWidget.tableV3({
1197
- gvc: gvc,
1198
- getData: vd => {
1199
- setTimeout(() => {
1200
- vd.tableData = vm.data.member.map((leadData) => {
1201
- return [
1202
- {
1203
- key: '會員等級',
1204
- value: leadData.tag_name,
1205
- },
1206
- {
1207
- key: '升級條件',
1208
- value: (() => {
1209
- let text = '';
1210
- const val = parseInt(`${leadData.og.condition.value}`, 10).toLocaleString();
1211
- const condition_type = leadData.og.condition.type === 'single' ? '單筆' : '累積';
1212
- if (leadData.og.duration.type === 'noLimit') {
1213
- text = `${condition_type}消費額達 NT$${val}`;
1214
- }
1215
- else {
1216
- text = `${leadData.og.duration.value}天內${condition_type}消費額達 NT$${val}`;
1217
- }
1218
- return text;
1219
- })(),
1220
- },
1221
- {
1222
- key: '有效期限',
1223
- value: (() => {
1224
- const { type, value } = leadData.og.dead_line;
1225
- let dead_line = '';
1226
- if (type === 'date') {
1227
- const deadlines = [
1228
- {
1229
- title: '一個月',
1230
- value: 30,
1231
- },
1232
- {
1233
- title: '三個月',
1234
- value: 90,
1235
- },
1236
- {
1237
- title: '六個月',
1238
- value: 180,
1239
- },
1240
- {
1241
- title: '一年',
1242
- value: 365,
1243
- },
1244
- ];
1245
- const matchedDeadline = deadlines.find(item => item.value === value);
1246
- dead_line = matchedDeadline
1247
- ? matchedDeadline.title
1248
- : `${value}天`;
1249
- }
1250
- else if (type === 'noLimit') {
1251
- dead_line = '沒有期限';
1252
- }
1253
- return dead_line;
1254
- })(),
1255
- },
1256
- ];
1257
- });
1258
- vd.originalData = vm.data.member;
1259
- vd.loading = false;
1260
- vd.callback();
1261
- }, 200);
1262
- },
1263
- filter: [],
1264
- rowClick: () => { },
1265
- hiddenPageSplit: true,
1266
- }),
1267
- });
1268
- })}"
1269
- >會員規則</span
1270
- >自動升級
1271
- </div>`,
1269
+ name: '根據本站會員規則自動升級',
1272
1270
  },
1273
1271
  {
1274
1272
  key: 'manual',
@@ -1766,12 +1764,16 @@ export class UserList {
1766
1764
  bind: id,
1767
1765
  view: () => {
1768
1766
  return new Promise((resolve) => __awaiter(this, void 0, void 0, function* () {
1769
- var _a, _b, _c;
1770
- const response = yield saasConfig.api.getPrivateConfig(saasConfig.config.appName, 'glitterUserForm');
1771
- const result = (_c = (_b = (_a = response === null || response === void 0 ? void 0 : response.response) === null || _a === void 0 ? void 0 : _a.result) === null || _b === void 0 ? void 0 : _b[0]) === null || _c === void 0 ? void 0 : _c.value;
1772
- const data = Array.isArray(result) ? result : [];
1773
- function loopForm(data, refer_obj) {
1774
- return data
1767
+ var _a, _b, _c, _d, _e;
1768
+ const getDefaultForm = yield saasConfig.api.getPrivateConfig(saasConfig.config.appName, 'glitterUserForm');
1769
+ const defaultForm = (_c = (_b = (_a = getDefaultForm === null || getDefaultForm === void 0 ? void 0 : getDefaultForm.response) === null || _a === void 0 ? void 0 : _a.result) === null || _b === void 0 ? void 0 : _b[0]) === null || _c === void 0 ? void 0 : _c.value;
1770
+ const customerForm = ((_e = (_d = (yield ApiUser.getPublicConfig('customer_form_user_setting', 'manager'))) === null || _d === void 0 ? void 0 : _d.response) === null || _e === void 0 ? void 0 : _e.value) || { list: [] };
1771
+ const formList = [
1772
+ ...(Array.isArray(defaultForm) ? defaultForm : []),
1773
+ ...customerForm.list,
1774
+ ];
1775
+ function loopForm(dataArray, refer_obj) {
1776
+ return dataArray
1775
1777
  .map(item => {
1776
1778
  const { title, key, page } = item;
1777
1779
  const value = refer_obj[key] || '';
@@ -1821,7 +1823,7 @@ export class UserList {
1821
1823
  }
1822
1824
  const form_array_view = [
1823
1825
  html `<div style="display:flex; gap: 12px; flex-direction: column;">
1824
- ${loopForm(data, userData)}
1826
+ ${loopForm(formList, userData)}
1825
1827
  </div>`,
1826
1828
  ];
1827
1829
  resolve(form_array_view.join(html `<div class="my-4 border"></div>`));
@@ -1850,7 +1852,7 @@ export class UserList {
1850
1852
  dialog.infoMessage({ text: '請輸入正確的電子信箱格式' });
1851
1853
  return;
1852
1854
  }
1853
- if (!CheckInput.isEmpty(userData.phone) && !CheckInput.isTaiwanPhone(userData.phone)) {
1855
+ if (!CheckInput.isTaiwanPhone(userData.phone)) {
1854
1856
  dialog.infoMessage({ text: BgWidget.taiwanPhoneAlert() });
1855
1857
  return;
1856
1858
  }
@@ -1877,14 +1879,13 @@ export class UserList {
1877
1879
  pwd: gvc.glitter.getUUID(),
1878
1880
  userData: userData,
1879
1881
  }).then(r => {
1882
+ dialog.dataLoading({ visible: false });
1880
1883
  if (r.result) {
1881
- dialog.dataLoading({ visible: false });
1882
- dialog.infoMessage({ text: '成功新增會員' });
1884
+ dialog.successMessage({ text: '顧客新增成功' });
1883
1885
  vm.type = 'list';
1884
1886
  }
1885
1887
  else {
1886
- dialog.dataLoading({ visible: false });
1887
- dialog.errorMessage({ text: '會員建立失敗' });
1888
+ dialog.errorMessage({ text: '顧客新增失敗' });
1888
1889
  }
1889
1890
  });
1890
1891
  }