ts-glitter 13.8.56 → 13.8.58

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 (32) hide show
  1. package/lowcode/Entry.js +1 -1
  2. package/lowcode/Entry.ts +1 -1
  3. package/lowcode/backend-manager/bg-blog.js +6 -3
  4. package/lowcode/backend-manager/bg-blog.ts +5 -3
  5. package/lowcode/backend-manager/bg-widget.js +173 -164
  6. package/lowcode/backend-manager/bg-widget.ts +208 -199
  7. package/lowcode/cms-plugin/ai-message.js +1 -1
  8. package/lowcode/cms-plugin/ai-message.ts +1 -1
  9. package/lowcode/cms-plugin/shopping-product-stock.js +69 -48
  10. package/lowcode/cms-plugin/shopping-product-stock.ts +81 -48
  11. package/lowcode/css/editor.css +4 -0
  12. package/lowcode/editor/add-component.js +59 -45
  13. package/lowcode/editor/add-component.ts +65 -50
  14. package/lowcode/editor/basic-component.js +9889 -58
  15. package/lowcode/editor/basic-component.ts +9962 -89
  16. package/lowcode/glitter-base/route/shopping.ts +1 -1
  17. package/lowcode/glitterBundle/plugins/add_item_dia.js +1 -1
  18. package/lowcode/glitterBundle/plugins/add_item_dia.ts +1 -1
  19. package/lowcode/jspage/function-page/main_editor.js +1 -1
  20. package/lowcode/jspage/function-page/main_editor.ts +1 -1
  21. package/lowcode/jspage/function-page/tool-setting.js +1 -1
  22. package/lowcode/jspage/function-page/tool-setting.ts +1 -1
  23. package/lowcode/jspage/main.js +2 -2
  24. package/lowcode/jspage/main.ts +2 -2
  25. package/package.json +1 -1
  26. package/src/api-public/services/notify.js +7 -0
  27. package/src/api-public/services/notify.js.map +1 -1
  28. package/src/api-public/services/notify.ts +8 -0
  29. package/src/api-public/services/shopping.js +18 -7
  30. package/src/api-public/services/shopping.js.map +1 -1
  31. package/src/api-public/services/shopping.ts +17 -6
  32. package/src/index.html +1 -0
package/lowcode/Entry.js CHANGED
@@ -64,7 +64,7 @@ export class Entry {
64
64
  }
65
65
  window.renderClock = (_a = window.renderClock) !== null && _a !== void 0 ? _a : clockF();
66
66
  console.log(`Entry-time:`, window.renderClock.stop());
67
- glitter.share.editerVersion = 'V_13.8.56';
67
+ glitter.share.editerVersion = 'V_13.8.58';
68
68
  glitter.share.start = new Date();
69
69
  const vm = {
70
70
  appConfig: [],
package/lowcode/Entry.ts CHANGED
@@ -64,7 +64,7 @@ export class Entry {
64
64
  }
65
65
  (window as any).renderClock = (window as any).renderClock ?? clockF();
66
66
  console.log(`Entry-time:`, (window as any).renderClock.stop());
67
- glitter.share.editerVersion = 'V_13.8.56';
67
+ glitter.share.editerVersion = 'V_13.8.58';
68
68
  glitter.share.start = new Date();
69
69
  const vm: {
70
70
  appConfig: any;
@@ -769,15 +769,18 @@ function detail(gvc, cf, vm, cVm, page_tab) {
769
769
  return [dd.product_id].concat(dd.variant.spec).join('-');
770
770
  }),
771
771
  callback: (value) => __awaiter(this, void 0, void 0, function* () {
772
- vm.data.content.relative_data = value.map((dd) => {
772
+ var _a;
773
+ vm.data.content.relative_data = (_a = vm.data.content.relative_data) !== null && _a !== void 0 ? _a : [];
774
+ vm.data.content.relative_data = vm.data.content.relative_data.concat(value.map((dd) => {
773
775
  return {
774
- variant: dd.variant_content,
776
+ variant: dd.variant,
775
777
  product_id: dd.product_id,
776
778
  };
777
- });
779
+ }));
778
780
  subVM.loading = true;
779
781
  gvc.notifyDataChange(subVM.id);
780
782
  }),
783
+ show_mode: 'all'
781
784
  });
782
785
  }), { textStyle: 'font-weight: 400;' })}
783
786
  </div>
@@ -837,15 +837,17 @@ function detail(gvc: GVC, cf: any, vm: any, cVm: any, page_tab: 'page' | 'hidden
837
837
  return [dd.product_id].concat(dd.variant.spec).join('-');
838
838
  }),
839
839
  callback: async (value) => {
840
- vm.data.content.relative_data = value.map((dd: any) => {
840
+ vm.data.content.relative_data= vm.data.content.relative_data ?? []
841
+ vm.data.content.relative_data = vm.data.content.relative_data.concat(value.map((dd: any) => {
841
842
  return {
842
- variant: dd.variant_content,
843
+ variant: dd.variant,
843
844
  product_id: dd.product_id,
844
845
  };
845
- });
846
+ }));
846
847
  subVM.loading = true;
847
848
  gvc.notifyDataChange(subVM.id);
848
849
  },
850
+ show_mode:'all'
849
851
  });
850
852
  }),
851
853
  { textStyle: 'font-weight: 400;' }
@@ -1204,195 +1204,198 @@ ${(_c = obj.default) !== null && _c !== void 0 ? _c : ''}</textarea
1204
1204
  return {
1205
1205
  bind: ids.container,
1206
1206
  view: () => {
1207
- if (vm.loading) {
1208
- return html `
1207
+ try {
1208
+ if (vm.loading) {
1209
+ return html `
1209
1210
  <div style="text-align: center; padding: 24px; font-size: 24px; font-weight: 700;">資料載入中
1210
1211
  ....
1211
1212
  </div>`;
1212
- }
1213
- if (vm.tableData.length === 0) {
1214
- return html `
1213
+ }
1214
+ if (vm.tableData.length === 0) {
1215
+ return html `
1215
1216
  <div style="text-align: center; padding: 24px; font-size: 24px; font-weight: 700;">
1216
1217
  暫無資料
1217
1218
  </div>`;
1218
- }
1219
- function checkAllBox(changeView) {
1220
- return EditorElem.checkBoxOnly({
1221
- gvc: gvc,
1222
- def: vm.originalData.every((item) => item.checked),
1223
- callback: (result) => {
1224
- vm.originalData.map((dd, index) => {
1225
- const checkboxParent = document.querySelector(`[gvc-checkbox="checkbox${index}"]`);
1226
- if (checkboxParent) {
1227
- const checkboxIcon = checkboxParent.querySelector(result ? 'i.fa-regular.fa-square' : 'i.fa-solid.fa-square-check ');
1228
- if (checkboxIcon) {
1229
- checkboxIcon.click();
1219
+ }
1220
+ function checkAllBox(changeView) {
1221
+ return EditorElem.checkBoxOnly({
1222
+ gvc: gvc,
1223
+ def: vm.originalData.every((item) => item.checked),
1224
+ callback: (result) => {
1225
+ vm.originalData.map((dd, index) => {
1226
+ const checkboxParent = gvc.glitter.document.querySelector(`[gvc-checkbox="checkbox${index}"]`);
1227
+ if (checkboxParent) {
1228
+ const checkboxIcon = checkboxParent.querySelector(result ? 'i.fa-regular.fa-square' : 'i.fa-solid.fa-square-check ');
1229
+ if (checkboxIcon) {
1230
+ checkboxIcon.click();
1231
+ }
1230
1232
  }
1231
- }
1232
- });
1233
- gvc.notifyDataChange(ids.filter);
1234
- changeHeaderStyle();
1235
- },
1236
- stopChangeView: changeView,
1237
- });
1238
- }
1239
- function changeHeaderStyle() {
1240
- const target = document.querySelector(`[gvc-id="${gvc.id(ids.header)}"]`);
1241
- if (target) {
1242
- if (vm.originalData.find((dd) => dd.checked)) {
1243
- target.style.position = 'sticky';
1244
- target.style.top = '0';
1245
- target.style.left = '0';
1246
- }
1247
- else {
1248
- target.style.position = 'relative';
1249
- target.style.top = '';
1250
- target.style.left = '';
1251
- }
1233
+ });
1234
+ gvc.notifyDataChange(ids.filter);
1235
+ obj.item_select && obj.item_select();
1236
+ changeHeaderStyle();
1237
+ },
1238
+ stopChangeView: changeView,
1239
+ });
1252
1240
  }
1253
- }
1254
- if (!created.checkbox) {
1255
- vm.tableData = vm.tableData.map((item, index) => {
1256
- if (obj.filter.length > 0) {
1257
- return [
1258
- {
1259
- key: checkAllBox(true),
1260
- value: EditorElem.checkBoxOnly({
1261
- gvc: gvc,
1262
- def: false,
1263
- callback: (result) => {
1264
- vm.originalData[index].checked = result;
1265
- gvc.notifyDataChange(ids.filter);
1266
- changeHeaderStyle();
1267
- },
1268
- }),
1269
- },
1270
- ...item,
1271
- ];
1241
+ function changeHeaderStyle() {
1242
+ const target = document.querySelector(`[gvc-id="${gvc.id(ids.header)}"]`);
1243
+ if (target) {
1244
+ if (vm.originalData.find((dd) => dd.checked)) {
1245
+ target.style.position = 'sticky';
1246
+ target.style.top = '0';
1247
+ target.style.left = '0';
1248
+ }
1249
+ else {
1250
+ target.style.position = 'relative';
1251
+ target.style.top = '';
1252
+ target.style.left = '';
1253
+ }
1272
1254
  }
1273
- return item;
1274
- });
1275
- created.checkbox = !created.checkbox;
1276
- }
1277
- return html `
1255
+ }
1256
+ if (!created.checkbox) {
1257
+ vm.tableData = vm.tableData.map((item, index) => {
1258
+ if (obj.filter.length > 0) {
1259
+ return [
1260
+ {
1261
+ key: checkAllBox(true),
1262
+ value: EditorElem.checkBoxOnly({
1263
+ gvc: gvc,
1264
+ def: false,
1265
+ callback: (result) => {
1266
+ vm.originalData[index].checked = result;
1267
+ gvc.notifyDataChange(ids.filter);
1268
+ changeHeaderStyle();
1269
+ obj.item_select && obj.item_select();
1270
+ },
1271
+ }),
1272
+ },
1273
+ ...item,
1274
+ ];
1275
+ }
1276
+ return item;
1277
+ });
1278
+ created.checkbox = !created.checkbox;
1279
+ }
1280
+ return html `
1278
1281
  <div style="margin-top: 4px; overflow-x: scroll; position: relative; min-height: 350px">
1279
1282
  <div class="w-100 h-100 bg-white top-0"
1280
1283
  style="position: absolute; z-index: ${defWidth > 0 ? 0 : 2}; display: ${defWidth > 0 ? 'none' : 'block'};"></div>
1281
1284
  ${gvc.bindView({
1282
- bind: ids.header,
1283
- view: () => {
1284
- return gvc.bindView({
1285
- bind: ids.filter,
1286
- view: () => {
1287
- if (vm.originalData.find((dd) => dd.checked)) {
1288
- const checkedData = vm.originalData.filter((dd) => dd.checked);
1289
- if (document.body.clientWidth < 768) {
1290
- return BgWidget.selNavbar({
1291
- checkbox: checkAllBox(false),
1292
- count: checkedData.length,
1293
- buttonList: [
1285
+ bind: ids.header,
1286
+ view: () => {
1287
+ return gvc.bindView({
1288
+ bind: ids.filter,
1289
+ view: () => {
1290
+ if (vm.originalData.find((dd) => dd.checked)) {
1291
+ const checkedData = vm.originalData.filter((dd) => dd.checked);
1292
+ if (document.body.clientWidth < 768) {
1293
+ return BgWidget.selNavbar({
1294
+ checkbox: checkAllBox(false),
1295
+ count: checkedData.length,
1296
+ buttonList: [
1297
+ BgWidget.selEventDropmenu({
1298
+ gvc: gvc,
1299
+ options: obj.filter.map((item) => {
1300
+ return {
1301
+ name: item.name,
1302
+ event: gvc.event(() => item.event(checkedData)),
1303
+ };
1304
+ }),
1305
+ text: '',
1306
+ }),
1307
+ ],
1308
+ });
1309
+ }
1310
+ const inButtons = obj.filter.filter((item) => item.option);
1311
+ const outButtons = obj.filter.filter((item) => !item.option);
1312
+ const inList = inButtons.length > 0
1313
+ ? [
1294
1314
  BgWidget.selEventDropmenu({
1295
1315
  gvc: gvc,
1296
- options: obj.filter.map((item) => {
1316
+ options: inButtons.map((item) => {
1297
1317
  return {
1298
1318
  name: item.name,
1299
1319
  event: gvc.event(() => item.event(checkedData)),
1300
1320
  };
1301
1321
  }),
1302
- text: '',
1322
+ text: '更多操作',
1303
1323
  }),
1304
- ],
1324
+ ]
1325
+ : [];
1326
+ const outList = outButtons.map((item) => {
1327
+ return BgWidget.selEventButton(item.name, gvc.event(() => item.event(checkedData)));
1328
+ });
1329
+ return BgWidget.selNavbar({
1330
+ checkbox: checkAllBox(false),
1331
+ count: checkedData.length,
1332
+ buttonList: [...inList, ...outList],
1305
1333
  });
1306
1334
  }
1307
- const inButtons = obj.filter.filter((item) => item.option);
1308
- const outButtons = obj.filter.filter((item) => !item.option);
1309
- const inList = inButtons.length > 0
1310
- ? [
1311
- BgWidget.selEventDropmenu({
1312
- gvc: gvc,
1313
- options: inButtons.map((item) => {
1314
- return {
1315
- name: item.name,
1316
- event: gvc.event(() => item.event(checkedData)),
1317
- };
1318
- }),
1319
- text: '更多操作',
1320
- }),
1321
- ]
1322
- : [];
1323
- const outList = outButtons.map((item) => {
1324
- return BgWidget.selEventButton(item.name, gvc.event(() => item.event(checkedData)));
1325
- });
1326
- return BgWidget.selNavbar({
1327
- checkbox: checkAllBox(false),
1328
- count: checkedData.length,
1329
- buttonList: [...inList, ...outList],
1330
- });
1331
- }
1332
- return vm.tableData[0]
1333
- .map((dd, index) => {
1334
- return html `
1335
+ return vm.tableData[0]
1336
+ .map((dd, index) => {
1337
+ return html `
1335
1338
  <div class="${ids.headerCell} ${ids.textClass} tx_700"
1336
1339
  style="min-width: ${widthList[index]}px;">${dd.key}
1337
1340
  </div>`;
1338
- })
1339
- .join('');
1340
- },
1341
- divCreate: {
1342
- class: `d-flex align-items-center mb-2 ${ids.header}`,
1343
- style: `height: 40px !important;`,
1344
- },
1345
- onCreate: () => {
1346
- if (!created.header) {
1347
- let timer = 0;
1348
- const si = setInterval(() => {
1349
- timer++;
1350
- const header = document.querySelector(`.${ids.header}`);
1351
- if (!created.header && header && header.offsetWidth > 0) {
1352
- let n = 0;
1353
- const htmlTags = new RegExp(/<[^>]*>/);
1354
- header === null || header === void 0 ? void 0 : header.querySelectorAll('div').forEach((div) => {
1355
- if (div.classList.contains(ids.headerCell)) {
1356
- const baseWidth = htmlTags.test(div.innerHTML) ? 0 : div.innerHTML.replace(/\n/g, '').trim().length * 24;
1357
- widthList[n] = div.offsetWidth > baseWidth ? div.offsetWidth : baseWidth;
1358
- n++;
1359
- }
1360
- });
1361
- fullWidth = header.offsetWidth;
1362
- created.header = !created.header;
1363
- clearInterval(si);
1364
- }
1365
- if (timer > 500) {
1366
- clearInterval(si);
1367
- }
1368
- }, 50);
1369
- }
1370
- },
1371
- });
1372
- },
1373
- })}
1341
+ })
1342
+ .join('');
1343
+ },
1344
+ divCreate: {
1345
+ class: `d-flex align-items-center mb-2 ${ids.header}`,
1346
+ style: `height: 40px !important;`,
1347
+ },
1348
+ onCreate: () => {
1349
+ if (!created.header) {
1350
+ let timer = 0;
1351
+ const si = setInterval(() => {
1352
+ timer++;
1353
+ const header = gvc.glitter.document.querySelector(`.${ids.header}`);
1354
+ if (!created.header && header && header.offsetWidth > 0) {
1355
+ let n = 0;
1356
+ const htmlTags = new RegExp(/<[^>]*>/);
1357
+ header === null || header === void 0 ? void 0 : header.querySelectorAll('div').forEach((div) => {
1358
+ if (div.classList.contains(ids.headerCell)) {
1359
+ const baseWidth = htmlTags.test(div.innerHTML) ? 0 : div.innerHTML.replace(/\n/g, '').trim().length * 24;
1360
+ widthList[n] = div.offsetWidth > baseWidth ? div.offsetWidth : baseWidth;
1361
+ n++;
1362
+ }
1363
+ });
1364
+ fullWidth = header.offsetWidth;
1365
+ created.header = !created.header;
1366
+ clearInterval(si);
1367
+ }
1368
+ if (timer > 500) {
1369
+ clearInterval(si);
1370
+ }
1371
+ }, 50);
1372
+ }
1373
+ },
1374
+ });
1375
+ },
1376
+ })}
1374
1377
  <table class="table table-centered table-nowrap text-center table-hover"
1375
1378
  style="width: ${defWidth}px;">
1376
1379
  <tbody>
1377
1380
  ${vm.tableData
1378
- .map((dd, trIndex) => {
1379
- return html `
1381
+ .map((dd, trIndex) => {
1382
+ return html `
1380
1383
  <tr
1381
1384
  class="${trIndex === 0 ? ids.tr : ''}"
1382
1385
  onclick="${gvc.event(() => {
1383
- obj.rowClick && obj.rowClick(dd, trIndex);
1384
- })}"
1386
+ obj.rowClick && obj.rowClick(dd, trIndex);
1387
+ })}"
1385
1388
  onmouseover="${gvc.event(() => {
1386
- $(`#${ids.pencil}${trIndex}`).removeClass('d-none');
1387
- })}"
1389
+ $(`#${ids.pencil}${trIndex}`).removeClass('d-none');
1390
+ })}"
1388
1391
  onmouseout="${gvc.event(() => {
1389
- $(`#${ids.pencil}${trIndex}`).addClass('d-none');
1390
- })}"
1392
+ $(`#${ids.pencil}${trIndex}`).addClass('d-none');
1393
+ })}"
1391
1394
  >
1392
1395
  ${dd
1393
- .map((d3, tdIndex) => {
1394
- const tdClass = Tool.randomString(5);
1395
- gvc.addStyle(`
1396
+ .map((d3, tdIndex) => {
1397
+ const tdClass = Tool.randomString(5);
1398
+ gvc.addStyle(`
1396
1399
  .${tdClass} {
1397
1400
  border: none;
1398
1401
  vertical-align: middle;
@@ -1402,7 +1405,7 @@ ${(_c = obj.default) !== null && _c !== void 0 ? _c : ''}</textarea
1402
1405
  ${dd.length === 1 ? 'border-radius: 10px;' : ''}
1403
1406
  }
1404
1407
  `);
1405
- return html `
1408
+ return html `
1406
1409
  <td
1407
1410
  class="${ids.textClass} ${tdClass} tx_normal"
1408
1411
  ${obj.filter.length !== 0 && tdIndex === 0 ? `gvc-checkbox="checkbox${trIndex}"` : ''}
@@ -1412,24 +1415,29 @@ ${(_c = obj.default) !== null && _c !== void 0 ? _c : ''}</textarea
1412
1415
  ${d3.value}
1413
1416
  </div>
1414
1417
  </td>`;
1418
+ })
1419
+ .join('')}
1420
+ </tr>`;
1415
1421
  })
1416
1422
  .join('')}
1417
- </tr>`;
1418
- })
1419
- .join('')}
1420
1423
  </tbody>
1421
1424
  </table>
1422
1425
  </div>
1423
1426
  <div>
1424
1427
  ${obj.hiddenPageSplit
1425
- ? ''
1426
- : ps.pageSplitV2(vm.pageSize, vm.page, (page) => {
1427
- vm.tableData = [];
1428
- vm.page = page;
1429
- vm.loading = true;
1430
- gvc.notifyDataChange(ids.container);
1431
- }, false)}
1428
+ ? ''
1429
+ : ps.pageSplitV2(vm.pageSize, vm.page, (page) => {
1430
+ vm.tableData = [];
1431
+ vm.page = page;
1432
+ vm.loading = true;
1433
+ gvc.notifyDataChange(ids.container);
1434
+ }, false)}
1432
1435
  </div>`;
1436
+ }
1437
+ catch (e) {
1438
+ console.log(e);
1439
+ return `${e}`;
1440
+ }
1433
1441
  },
1434
1442
  divCreate: {},
1435
1443
  onCreate: () => {
@@ -1443,7 +1451,8 @@ ${(_c = obj.default) !== null && _c !== void 0 ? _c : ''}</textarea
1443
1451
  timer++;
1444
1452
  if (created.header) {
1445
1453
  const checkbox = obj.filter.length > 0;
1446
- const tr = document.querySelector(`.${ids.tr}`);
1454
+ console.log(`query==>`, ids.tr);
1455
+ const tr = gvc.glitter.document.querySelector(`.${ids.tr}`);
1447
1456
  tr === null || tr === void 0 ? void 0 : tr.querySelectorAll('td').forEach((td, index) => {
1448
1457
  if (checkbox && index === 0) {
1449
1458
  widthList[index] = 60;