ts-glitter 21.6.2 → 21.6.6
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 +1 -1
- package/lowcode/Entry.ts +1 -1
- package/lowcode/backend-manager/bg-blog.js +186 -8
- package/lowcode/backend-manager/bg-blog.ts +206 -11
- package/lowcode/backend-manager/bg-widget.js +20 -17
- package/lowcode/backend-manager/bg-widget.ts +23 -19
- package/lowcode/cms-plugin/account-info.js +1 -1
- package/lowcode/cms-plugin/account-info.ts +1 -1
- package/lowcode/cms-plugin/permission-setting.js +2 -3
- package/lowcode/cms-plugin/permission-setting.ts +2 -3
- package/lowcode/cms-plugin/shopping-discount-setting.js +1711 -341
- package/lowcode/cms-plugin/shopping-discount-setting.ts +1938 -327
- package/lowcode/editor-components/global-widget/bridge.js +30 -0
- package/lowcode/editor-components/global-widget/bridge.ts +131 -2
- package/lowcode/form-view/e-commerce/product-select.js +6 -16
- package/lowcode/form-view/e-commerce/product-select.ts +16 -18
- package/lowcode/glitter-base/global/language.js +2 -0
- package/lowcode/glitter-base/global/language.ts +2 -0
- package/lowcode/glitterBundle/html-component/global-widget.js +0 -74
- package/lowcode/glitterBundle/html-component/global-widget.ts +1 -81
- package/lowcode/official_view_component/official/component.ts +0 -2
- package/lowcode/public-components/checkout/index.js +1 -1
- package/lowcode/public-components/checkout/index.ts +1 -1
- package/lowcode/public-components/user-manager/um-info.js +4 -0
- package/lowcode/public-components/user-manager/um-info.ts +4 -1
- package/lowcode/public-components/user-manager/um-login.js +3 -3
- package/lowcode/public-components/user-manager/um-login.ts +3 -6
- package/lowcode/public-components/user-manager/um-rebate.js +6 -2
- package/lowcode/public-components/user-manager/um-rebate.ts +28 -2
- package/lowcode/public-components/user-manager/um-receive.js +2 -0
- package/lowcode/public-components/user-manager/um-receive.ts +1 -2
- package/package.json +1 -1
- package/src/api-public/controllers/shop.js +1 -0
- package/src/api-public/controllers/shop.js.map +1 -1
- package/src/api-public/controllers/shop.ts +1 -0
- package/src/api-public/services/data-analyze.d.ts +1 -1
- package/src/api-public/services/rebate.d.ts +14 -2
- package/src/api-public/services/rebate.js +66 -24
- package/src/api-public/services/rebate.js.map +1 -1
- package/src/api-public/services/rebate.ts +91 -24
- package/src/api-public/services/schedule.js +1 -3
- package/src/api-public/services/schedule.js.map +1 -1
- package/src/api-public/services/schedule.ts +1 -1
- package/src/api-public/services/shopping.js +35 -6
- package/src/api-public/services/shopping.js.map +1 -1
- package/src/api-public/services/shopping.ts +45 -12
- package/src/index.js +17 -7
- package/src/index.js.map +1 -1
- package/src/modules/database.js +1 -1
- package/src/modules/database.js.map +1 -1
- package/src/modules/database.ts +1 -1
- package/src/run.js +1 -1
- package/src/run.js.map +1 -1
- package/src/run.ts +1 -1
- package/src/services/system-schedule.js +1 -1
- package/src/services/system-schedule.js.map +1 -1
- package/src/services/system-schedule.ts +3 -2
package/lowcode/Entry.js
CHANGED
|
@@ -146,7 +146,7 @@ export class Entry {
|
|
|
146
146
|
}
|
|
147
147
|
window.renderClock = (_b = window.renderClock) !== null && _b !== void 0 ? _b : createClock();
|
|
148
148
|
console.log(`Entry-time:`, window.renderClock.stop());
|
|
149
|
-
glitter.share.editerVersion = 'V_21.6.
|
|
149
|
+
glitter.share.editerVersion = 'V_21.6.6';
|
|
150
150
|
glitter.share.start = new Date();
|
|
151
151
|
const vm = { appConfig: [] };
|
|
152
152
|
window.saasConfig = {
|
package/lowcode/Entry.ts
CHANGED
|
@@ -150,7 +150,7 @@ export class Entry {
|
|
|
150
150
|
}
|
|
151
151
|
(window as any).renderClock = (window as any).renderClock ?? createClock();
|
|
152
152
|
console.log(`Entry-time:`, (window as any).renderClock.stop());
|
|
153
|
-
glitter.share.editerVersion = 'V_21.6.
|
|
153
|
+
glitter.share.editerVersion = 'V_21.6.6';
|
|
154
154
|
glitter.share.start = new Date();
|
|
155
155
|
const vm = { appConfig: [] };
|
|
156
156
|
(window as any).saasConfig = {
|
|
@@ -1132,7 +1132,7 @@ function detail(gvc, cf, vm, cVm, page_tab) {
|
|
|
1132
1132
|
}, 400);
|
|
1133
1133
|
function checkSwitchToUiEditor() {
|
|
1134
1134
|
function next() {
|
|
1135
|
-
Object.keys(window.glitterInitialHelper.share).map(
|
|
1135
|
+
Object.keys(window.glitterInitialHelper.share).map(dd => {
|
|
1136
1136
|
if (dd.startsWith('getPageData-')) {
|
|
1137
1137
|
window.glitterInitialHelper.share[dd] = undefined;
|
|
1138
1138
|
}
|
|
@@ -1359,7 +1359,7 @@ function detail(gvc, cf, vm, cVm, page_tab) {
|
|
|
1359
1359
|
BgWidget.fullDialog({
|
|
1360
1360
|
gvc: gvc,
|
|
1361
1361
|
title: gvc2 => {
|
|
1362
|
-
return html
|
|
1362
|
+
return html ` <div
|
|
1363
1363
|
class="d-flex align-items-center"
|
|
1364
1364
|
style="gap:10px;"
|
|
1365
1365
|
>
|
|
@@ -1501,6 +1501,187 @@ function detail(gvc, cf, vm, cVm, page_tab) {
|
|
|
1501
1501
|
html ` <div class="my-2"></div>`,
|
|
1502
1502
|
[
|
|
1503
1503
|
html `${(() => {
|
|
1504
|
+
const subVM = {
|
|
1505
|
+
dataList: [],
|
|
1506
|
+
id: gvc.glitter.getUUID(),
|
|
1507
|
+
containerId: Tool.randomString(6),
|
|
1508
|
+
loading: true,
|
|
1509
|
+
};
|
|
1510
|
+
console.log(`d1---->`, d1);
|
|
1511
|
+
return gvc.bindView(() => {
|
|
1512
|
+
return {
|
|
1513
|
+
bind: subVM.id,
|
|
1514
|
+
view: () => {
|
|
1515
|
+
if (subVM.loading) {
|
|
1516
|
+
return BgWidget.spinner();
|
|
1517
|
+
}
|
|
1518
|
+
return new Promise((resolve) => __awaiter(this, void 0, void 0, function* () {
|
|
1519
|
+
subVM.dataList = yield (() => __awaiter(this, void 0, void 0, function* () {
|
|
1520
|
+
try {
|
|
1521
|
+
switch (d1.select) {
|
|
1522
|
+
case 'product':
|
|
1523
|
+
return yield BgProduct.getProductOpts(d1.value);
|
|
1524
|
+
case 'collection':
|
|
1525
|
+
return d1.value;
|
|
1526
|
+
default:
|
|
1527
|
+
return [];
|
|
1528
|
+
}
|
|
1529
|
+
}
|
|
1530
|
+
catch (e) {
|
|
1531
|
+
return [];
|
|
1532
|
+
}
|
|
1533
|
+
}))();
|
|
1534
|
+
resolve(html ` <div class="d-flex flex-column py-2">
|
|
1535
|
+
<div class="mx-n3 border-top"></div>
|
|
1536
|
+
<div
|
|
1537
|
+
class="d-flex align-items-center pb-2 pt-3"
|
|
1538
|
+
style="gap: 10px; justify-content: space-between;"
|
|
1539
|
+
>
|
|
1540
|
+
<div class="flex-fill ">
|
|
1541
|
+
${EditorElem.select({
|
|
1542
|
+
title: '',
|
|
1543
|
+
gvc: gvc,
|
|
1544
|
+
def: d1.select,
|
|
1545
|
+
array: [
|
|
1546
|
+
{ value: 'collection', title: '商品系列' },
|
|
1547
|
+
{ value: 'product', title: '特定商品' },
|
|
1548
|
+
{ value: 'all', title: '所有商品' },
|
|
1549
|
+
],
|
|
1550
|
+
callback: text => {
|
|
1551
|
+
d1.select = text;
|
|
1552
|
+
d1.value = [];
|
|
1553
|
+
gvc.notifyDataChange(subVM.id);
|
|
1554
|
+
},
|
|
1555
|
+
})}
|
|
1556
|
+
</div>
|
|
1557
|
+
<div
|
|
1558
|
+
class="${d1.select === 'all' ? `d-none` : ``}"
|
|
1559
|
+
style=""
|
|
1560
|
+
>
|
|
1561
|
+
${BgWidget.save(gvc.event(() => {
|
|
1562
|
+
var _a, _b;
|
|
1563
|
+
if (d1.select === 'product') {
|
|
1564
|
+
d1.value = (_a = d1.value) !== null && _a !== void 0 ? _a : [];
|
|
1565
|
+
BgProduct.productsDialog({
|
|
1566
|
+
gvc: gvc,
|
|
1567
|
+
default: d1.value,
|
|
1568
|
+
callback: (value) => __awaiter(this, void 0, void 0, function* () {
|
|
1569
|
+
d1.value = value;
|
|
1570
|
+
gvc.notifyDataChange(subVM.id);
|
|
1571
|
+
}),
|
|
1572
|
+
});
|
|
1573
|
+
}
|
|
1574
|
+
else if (d1.select === 'collection') {
|
|
1575
|
+
d1.value = (_b = d1.value) !== null && _b !== void 0 ? _b : [];
|
|
1576
|
+
BgProduct.collectionsDialog({
|
|
1577
|
+
gvc: gvc,
|
|
1578
|
+
default: d1.value,
|
|
1579
|
+
callback: (value) => __awaiter(this, void 0, void 0, function* () {
|
|
1580
|
+
d1.value = value;
|
|
1581
|
+
gvc.notifyDataChange(subVM.id);
|
|
1582
|
+
}),
|
|
1583
|
+
});
|
|
1584
|
+
}
|
|
1585
|
+
}), (() => {
|
|
1586
|
+
switch (d1.select) {
|
|
1587
|
+
case 'product':
|
|
1588
|
+
case 'collection':
|
|
1589
|
+
return `選取`;
|
|
1590
|
+
}
|
|
1591
|
+
return ``;
|
|
1592
|
+
})())}
|
|
1593
|
+
</div>
|
|
1594
|
+
</div>
|
|
1595
|
+
<div class="d-flex flex-column gap-2" id="${subVM.containerId}">
|
|
1596
|
+
${gvc.map(subVM.dataList.map((opt, index) => {
|
|
1597
|
+
switch (d1.select) {
|
|
1598
|
+
case 'collection':
|
|
1599
|
+
return html ` <div
|
|
1600
|
+
class="d-flex align-items-center form-check-label c_updown_label gap-3"
|
|
1601
|
+
>
|
|
1602
|
+
<span class="tx_normal">${index + 1} . ${opt}</span>
|
|
1603
|
+
</div>`;
|
|
1604
|
+
case 'product':
|
|
1605
|
+
return html ` <div
|
|
1606
|
+
class="d-flex align-items-center form-check-label c_updown_label px-1"
|
|
1607
|
+
style="justify-content: space-between"
|
|
1608
|
+
data-index="${opt.key}"
|
|
1609
|
+
>
|
|
1610
|
+
<div
|
|
1611
|
+
class="d-flex align-items-center gap-3 cursor_move"
|
|
1612
|
+
style="max-width: calc(100% - 50px);"
|
|
1613
|
+
>
|
|
1614
|
+
<i
|
|
1615
|
+
class="fa-solid fa-grip-dots-vertical dragItem"
|
|
1616
|
+
></i>
|
|
1617
|
+
${BgWidget.validImageBox({
|
|
1618
|
+
gvc,
|
|
1619
|
+
image: opt.image,
|
|
1620
|
+
width: 40,
|
|
1621
|
+
})}
|
|
1622
|
+
<div
|
|
1623
|
+
class="tx_normal ${opt.note ? 'mb-1' : ''}"
|
|
1624
|
+
style="white-space:normal;"
|
|
1625
|
+
>
|
|
1626
|
+
${opt.value}
|
|
1627
|
+
</div>
|
|
1628
|
+
</div>
|
|
1629
|
+
<i
|
|
1630
|
+
class="fa-regular fa-trash cursor_pointer"
|
|
1631
|
+
onclick="${gvc.event(() => {
|
|
1632
|
+
d1.value = d1.value.filter((id) => {
|
|
1633
|
+
return id !== opt.key;
|
|
1634
|
+
});
|
|
1635
|
+
gvc.notifyDataChange(subVM.id);
|
|
1636
|
+
})}"
|
|
1637
|
+
></i>
|
|
1638
|
+
</div>`;
|
|
1639
|
+
case 'all':
|
|
1640
|
+
return ``;
|
|
1641
|
+
}
|
|
1642
|
+
}))}
|
|
1643
|
+
</div>
|
|
1644
|
+
<div class="mx-n3 border-top mt-3"></div>
|
|
1645
|
+
</div>`);
|
|
1646
|
+
}));
|
|
1647
|
+
},
|
|
1648
|
+
onCreate: () => {
|
|
1649
|
+
if (subVM.loading) {
|
|
1650
|
+
gvc.addMtScript([
|
|
1651
|
+
{
|
|
1652
|
+
src: 'https://cdn.jsdelivr.net/npm/sortablejs@1.15.0/Sortable.min.js',
|
|
1653
|
+
},
|
|
1654
|
+
], () => {
|
|
1655
|
+
const si = setInterval(() => {
|
|
1656
|
+
if (window.Sortable !== undefined) {
|
|
1657
|
+
subVM.loading = false;
|
|
1658
|
+
clearInterval(si);
|
|
1659
|
+
gvc.notifyDataChange(subVM.id);
|
|
1660
|
+
}
|
|
1661
|
+
}, 300);
|
|
1662
|
+
}, () => { });
|
|
1663
|
+
}
|
|
1664
|
+
else {
|
|
1665
|
+
const el = document.querySelector(`#${subVM.containerId}`);
|
|
1666
|
+
window.Sortable.create(el, {
|
|
1667
|
+
animation: 150,
|
|
1668
|
+
handle: '.dragItem',
|
|
1669
|
+
onEnd: function () {
|
|
1670
|
+
const elements = el.querySelectorAll('[data-index]');
|
|
1671
|
+
const dataIndices = Array.from(elements).map(element => element.getAttribute('data-index'));
|
|
1672
|
+
const value = dataIndices.map(index => {
|
|
1673
|
+
if (index) {
|
|
1674
|
+
return parseInt(index, 10);
|
|
1675
|
+
}
|
|
1676
|
+
});
|
|
1677
|
+
d1.value = value;
|
|
1678
|
+
gvc.notifyDataChange(subVM.id);
|
|
1679
|
+
},
|
|
1680
|
+
});
|
|
1681
|
+
}
|
|
1682
|
+
},
|
|
1683
|
+
};
|
|
1684
|
+
});
|
|
1504
1685
|
return gvc.bindView(() => {
|
|
1505
1686
|
const subVM = {
|
|
1506
1687
|
id: gvc.glitter.getUUID(),
|
|
@@ -1546,7 +1727,7 @@ function detail(gvc, cf, vm, cVm, page_tab) {
|
|
|
1546
1727
|
</div>
|
|
1547
1728
|
${dataList
|
|
1548
1729
|
.map((opt, index) => {
|
|
1549
|
-
return html
|
|
1730
|
+
return html ` <div
|
|
1550
1731
|
class="d-flex align-items-center form-check-label c_updown_label px-1"
|
|
1551
1732
|
style="justify-content: space-between"
|
|
1552
1733
|
data-index="${opt.key}"
|
|
@@ -1674,7 +1855,7 @@ function detail(gvc, cf, vm, cVm, page_tab) {
|
|
|
1674
1855
|
`;
|
|
1675
1856
|
})
|
|
1676
1857
|
.join('') ||
|
|
1677
|
-
html
|
|
1858
|
+
html ` <div
|
|
1678
1859
|
class="w-100 d-flex align-content-center justify-content-center"
|
|
1679
1860
|
>
|
|
1680
1861
|
尚未加入任何賣場商品
|
|
@@ -2166,10 +2347,7 @@ function loopFindProducts(config) {
|
|
|
2166
2347
|
function loop(array, container_cf) {
|
|
2167
2348
|
array.map((dd) => {
|
|
2168
2349
|
if (dd.type === 'component' && dd.data.tag === 'SY00-normal-products') {
|
|
2169
|
-
|
|
2170
|
-
dd.data.refer_form_data.product_select.select = 'product';
|
|
2171
|
-
dd.data.refer_form_data.product_select.value = [];
|
|
2172
|
-
}
|
|
2350
|
+
console.log(`loopFindProducts`, dd.data);
|
|
2173
2351
|
product_select.push(dd.data.refer_form_data.product_select);
|
|
2174
2352
|
}
|
|
2175
2353
|
else if (dd.type === 'container') {
|
|
@@ -1266,11 +1266,11 @@ function detail(gvc: GVC, cf: any, vm: any, cVm: any, page_tab: 'page' | 'hidden
|
|
|
1266
1266
|
|
|
1267
1267
|
function checkSwitchToUiEditor() {
|
|
1268
1268
|
function next() {
|
|
1269
|
-
Object.keys((window as any).glitterInitialHelper.share).map(
|
|
1270
|
-
if(dd.startsWith('getPageData-')){
|
|
1271
|
-
(window as any).glitterInitialHelper.share[dd]=undefined
|
|
1269
|
+
Object.keys((window as any).glitterInitialHelper.share).map(dd => {
|
|
1270
|
+
if (dd.startsWith('getPageData-')) {
|
|
1271
|
+
(window as any).glitterInitialHelper.share[dd] = undefined;
|
|
1272
1272
|
}
|
|
1273
|
-
})
|
|
1273
|
+
});
|
|
1274
1274
|
localStorage.setItem('preview_data', JSON.stringify(vm.data.content));
|
|
1275
1275
|
(window.parent as any).glitter.setUrlParameter('page-id', vm.data.id);
|
|
1276
1276
|
(window.parent as any).glitter.setUrlParameter('language', language);
|
|
@@ -1530,7 +1530,7 @@ function detail(gvc: GVC, cf: any, vm: any, cVm: any, page_tab: 'page' | 'hidden
|
|
|
1530
1530
|
BgWidget.fullDialog({
|
|
1531
1531
|
gvc: gvc,
|
|
1532
1532
|
title: gvc2 => {
|
|
1533
|
-
return html
|
|
1533
|
+
return html` <div
|
|
1534
1534
|
class="d-flex align-items-center"
|
|
1535
1535
|
style="gap:10px;"
|
|
1536
1536
|
>
|
|
@@ -1673,6 +1673,7 @@ function detail(gvc: GVC, cf: any, vm: any, cVm: any, page_tab: 'page' | 'hidden
|
|
|
1673
1673
|
auth: 'all',
|
|
1674
1674
|
value: '',
|
|
1675
1675
|
};
|
|
1676
|
+
|
|
1676
1677
|
return gvc.bindView(() => {
|
|
1677
1678
|
const id = gvc.glitter.getUUID();
|
|
1678
1679
|
return {
|
|
@@ -1692,6 +1693,199 @@ function detail(gvc: GVC, cf: any, vm: any, cVm: any, page_tab: 'page' | 'hidden
|
|
|
1692
1693
|
html` <div class="my-2"></div>`,
|
|
1693
1694
|
[
|
|
1694
1695
|
html`${(() => {
|
|
1696
|
+
const subVM: any = {
|
|
1697
|
+
dataList: [],
|
|
1698
|
+
id: gvc.glitter.getUUID(),
|
|
1699
|
+
containerId: Tool.randomString(6),
|
|
1700
|
+
loading: true,
|
|
1701
|
+
};
|
|
1702
|
+
console.log(`d1---->`, d1);
|
|
1703
|
+
return gvc.bindView(() => {
|
|
1704
|
+
return {
|
|
1705
|
+
bind: subVM.id,
|
|
1706
|
+
view: () => {
|
|
1707
|
+
if (subVM.loading) {
|
|
1708
|
+
return BgWidget.spinner();
|
|
1709
|
+
}
|
|
1710
|
+
// d1=d1.
|
|
1711
|
+
return new Promise(async resolve => {
|
|
1712
|
+
subVM.dataList = await (async () => {
|
|
1713
|
+
try {
|
|
1714
|
+
switch (d1.select) {
|
|
1715
|
+
case 'product':
|
|
1716
|
+
return await BgProduct.getProductOpts(d1.value);
|
|
1717
|
+
case 'collection':
|
|
1718
|
+
return d1.value;
|
|
1719
|
+
default:
|
|
1720
|
+
return [];
|
|
1721
|
+
}
|
|
1722
|
+
} catch (e) {
|
|
1723
|
+
return [];
|
|
1724
|
+
}
|
|
1725
|
+
})();
|
|
1726
|
+
resolve(
|
|
1727
|
+
html` <div class="d-flex flex-column py-2">
|
|
1728
|
+
<div class="mx-n3 border-top"></div>
|
|
1729
|
+
<div
|
|
1730
|
+
class="d-flex align-items-center pb-2 pt-3"
|
|
1731
|
+
style="gap: 10px; justify-content: space-between;"
|
|
1732
|
+
>
|
|
1733
|
+
<div class="flex-fill ">
|
|
1734
|
+
${EditorElem.select({
|
|
1735
|
+
title: '',
|
|
1736
|
+
gvc: gvc,
|
|
1737
|
+
def: d1.select,
|
|
1738
|
+
array: [
|
|
1739
|
+
{ value: 'collection', title: '商品系列' },
|
|
1740
|
+
{ value: 'product', title: '特定商品' },
|
|
1741
|
+
{ value: 'all', title: '所有商品' },
|
|
1742
|
+
],
|
|
1743
|
+
callback: text => {
|
|
1744
|
+
d1.select = text;
|
|
1745
|
+
d1.value = [];
|
|
1746
|
+
gvc.notifyDataChange(subVM.id);
|
|
1747
|
+
},
|
|
1748
|
+
})}
|
|
1749
|
+
</div>
|
|
1750
|
+
<div
|
|
1751
|
+
class="${d1.select === 'all' ? `d-none` : ``}"
|
|
1752
|
+
style=""
|
|
1753
|
+
>
|
|
1754
|
+
${BgWidget.save(
|
|
1755
|
+
gvc.event(() => {
|
|
1756
|
+
if (d1.select === 'product') {
|
|
1757
|
+
d1.value = d1.value ?? [];
|
|
1758
|
+
BgProduct.productsDialog({
|
|
1759
|
+
gvc: gvc,
|
|
1760
|
+
default: d1.value,
|
|
1761
|
+
callback: async value => {
|
|
1762
|
+
d1.value = value;
|
|
1763
|
+
gvc.notifyDataChange(subVM.id);
|
|
1764
|
+
},
|
|
1765
|
+
});
|
|
1766
|
+
} else if (d1.select === 'collection') {
|
|
1767
|
+
d1.value = d1.value ?? [];
|
|
1768
|
+
BgProduct.collectionsDialog({
|
|
1769
|
+
gvc: gvc,
|
|
1770
|
+
default: d1.value,
|
|
1771
|
+
callback: async value => {
|
|
1772
|
+
d1.value = value;
|
|
1773
|
+
gvc.notifyDataChange(subVM.id);
|
|
1774
|
+
},
|
|
1775
|
+
});
|
|
1776
|
+
}
|
|
1777
|
+
}),
|
|
1778
|
+
(() => {
|
|
1779
|
+
switch (d1.select) {
|
|
1780
|
+
case 'product':
|
|
1781
|
+
case 'collection':
|
|
1782
|
+
return `選取`;
|
|
1783
|
+
}
|
|
1784
|
+
return ``;
|
|
1785
|
+
})()
|
|
1786
|
+
)}
|
|
1787
|
+
</div>
|
|
1788
|
+
</div>
|
|
1789
|
+
<div class="d-flex flex-column gap-2" id="${subVM.containerId}">
|
|
1790
|
+
${gvc.map(
|
|
1791
|
+
subVM.dataList.map((opt: any, index: number) => {
|
|
1792
|
+
switch (d1.select) {
|
|
1793
|
+
case 'collection':
|
|
1794
|
+
return html` <div
|
|
1795
|
+
class="d-flex align-items-center form-check-label c_updown_label gap-3"
|
|
1796
|
+
>
|
|
1797
|
+
<span class="tx_normal">${index + 1} . ${opt}</span>
|
|
1798
|
+
</div>`;
|
|
1799
|
+
case 'product':
|
|
1800
|
+
return html` <div
|
|
1801
|
+
class="d-flex align-items-center form-check-label c_updown_label px-1"
|
|
1802
|
+
style="justify-content: space-between"
|
|
1803
|
+
data-index="${opt.key}"
|
|
1804
|
+
>
|
|
1805
|
+
<div
|
|
1806
|
+
class="d-flex align-items-center gap-3 cursor_move"
|
|
1807
|
+
style="max-width: calc(100% - 50px);"
|
|
1808
|
+
>
|
|
1809
|
+
<i
|
|
1810
|
+
class="fa-solid fa-grip-dots-vertical dragItem"
|
|
1811
|
+
></i>
|
|
1812
|
+
${BgWidget.validImageBox({
|
|
1813
|
+
gvc,
|
|
1814
|
+
image: opt.image,
|
|
1815
|
+
width: 40,
|
|
1816
|
+
})}
|
|
1817
|
+
<div
|
|
1818
|
+
class="tx_normal ${opt.note ? 'mb-1' : ''}"
|
|
1819
|
+
style="white-space:normal;"
|
|
1820
|
+
>
|
|
1821
|
+
${opt.value}
|
|
1822
|
+
</div>
|
|
1823
|
+
</div>
|
|
1824
|
+
<i
|
|
1825
|
+
class="fa-regular fa-trash cursor_pointer"
|
|
1826
|
+
onclick="${gvc.event(() => {
|
|
1827
|
+
d1.value = d1.value.filter((id: number) => {
|
|
1828
|
+
return id !== opt.key;
|
|
1829
|
+
});
|
|
1830
|
+
gvc.notifyDataChange(subVM.id);
|
|
1831
|
+
})}"
|
|
1832
|
+
></i>
|
|
1833
|
+
</div>`;
|
|
1834
|
+
case 'all':
|
|
1835
|
+
return ``;
|
|
1836
|
+
}
|
|
1837
|
+
})
|
|
1838
|
+
)}
|
|
1839
|
+
</div>
|
|
1840
|
+
<div class="mx-n3 border-top mt-3"></div>
|
|
1841
|
+
</div>`
|
|
1842
|
+
);
|
|
1843
|
+
});
|
|
1844
|
+
},
|
|
1845
|
+
onCreate: () => {
|
|
1846
|
+
if (subVM.loading) {
|
|
1847
|
+
gvc.addMtScript(
|
|
1848
|
+
[
|
|
1849
|
+
{
|
|
1850
|
+
src: 'https://cdn.jsdelivr.net/npm/sortablejs@1.15.0/Sortable.min.js',
|
|
1851
|
+
},
|
|
1852
|
+
],
|
|
1853
|
+
() => {
|
|
1854
|
+
const si = setInterval(() => {
|
|
1855
|
+
if ((window as any).Sortable !== undefined) {
|
|
1856
|
+
subVM.loading = false;
|
|
1857
|
+
clearInterval(si);
|
|
1858
|
+
gvc.notifyDataChange(subVM.id);
|
|
1859
|
+
}
|
|
1860
|
+
}, 300);
|
|
1861
|
+
},
|
|
1862
|
+
() => {}
|
|
1863
|
+
);
|
|
1864
|
+
} else {
|
|
1865
|
+
const el = document.querySelector(
|
|
1866
|
+
`#${subVM.containerId}`
|
|
1867
|
+
) as HTMLElement;
|
|
1868
|
+
(window as any).Sortable.create(el, {
|
|
1869
|
+
animation: 150,
|
|
1870
|
+
handle: '.dragItem',
|
|
1871
|
+
onEnd: function () {
|
|
1872
|
+
const elements = el.querySelectorAll('[data-index]');
|
|
1873
|
+
const dataIndices = Array.from(elements).map(element =>
|
|
1874
|
+
element.getAttribute('data-index')
|
|
1875
|
+
);
|
|
1876
|
+
const value = dataIndices.map(index => {
|
|
1877
|
+
if (index) {
|
|
1878
|
+
return parseInt(index, 10);
|
|
1879
|
+
}
|
|
1880
|
+
});
|
|
1881
|
+
d1.value = value;
|
|
1882
|
+
gvc.notifyDataChange(subVM.id);
|
|
1883
|
+
},
|
|
1884
|
+
});
|
|
1885
|
+
}
|
|
1886
|
+
},
|
|
1887
|
+
};
|
|
1888
|
+
});
|
|
1695
1889
|
return gvc.bindView(() => {
|
|
1696
1890
|
const subVM = {
|
|
1697
1891
|
id: gvc.glitter.getUUID(),
|
|
@@ -1741,7 +1935,7 @@ function detail(gvc: GVC, cf: any, vm: any, cVm: any, page_tab: 'page' | 'hidden
|
|
|
1741
1935
|
</div>
|
|
1742
1936
|
${dataList
|
|
1743
1937
|
.map((opt, index) => {
|
|
1744
|
-
return html
|
|
1938
|
+
return html` <div
|
|
1745
1939
|
class="d-flex align-items-center form-check-label c_updown_label px-1"
|
|
1746
1940
|
style="justify-content: space-between"
|
|
1747
1941
|
data-index="${opt.key}"
|
|
@@ -1884,7 +2078,7 @@ function detail(gvc: GVC, cf: any, vm: any, cVm: any, page_tab: 'page' | 'hidden
|
|
|
1884
2078
|
`;
|
|
1885
2079
|
})
|
|
1886
2080
|
.join('') ||
|
|
1887
|
-
html
|
|
2081
|
+
html` <div
|
|
1888
2082
|
class="w-100 d-flex align-content-center justify-content-center"
|
|
1889
2083
|
>
|
|
1890
2084
|
尚未加入任何賣場商品
|
|
@@ -2415,10 +2609,11 @@ function loopFindProducts(config: any) {
|
|
|
2415
2609
|
function loop(array: any, container_cf: any) {
|
|
2416
2610
|
array.map((dd: any) => {
|
|
2417
2611
|
if (dd.type === 'component' && dd.data.tag === 'SY00-normal-products') {
|
|
2418
|
-
if (dd.data.refer_form_data.product_select.select !== 'product') {
|
|
2419
|
-
|
|
2420
|
-
|
|
2421
|
-
}
|
|
2612
|
+
// if (dd.data.refer_form_data.product_select.select !== 'product') {
|
|
2613
|
+
// dd.data.refer_form_data.product_select.select = 'product';
|
|
2614
|
+
// dd.data.refer_form_data.product_select.value = [];
|
|
2615
|
+
// }
|
|
2616
|
+
console.log(`loopFindProducts`, dd.data);
|
|
2422
2617
|
product_select.push(dd.data.refer_form_data.product_select);
|
|
2423
2618
|
} else if (dd.type === 'container') {
|
|
2424
2619
|
loop(dd.data.setting, dd);
|
|
@@ -2329,8 +2329,8 @@ ${(_d = obj.default) !== null && _d !== void 0 ? _d : ''}</textarea
|
|
|
2329
2329
|
static multiCheckboxContainer(gvc, data, def, callback, obj) {
|
|
2330
2330
|
var _b;
|
|
2331
2331
|
const id = gvc.glitter.getUUID();
|
|
2332
|
-
const
|
|
2333
|
-
const randomString = obj
|
|
2332
|
+
const isReadonly = Boolean(obj && obj.readonly);
|
|
2333
|
+
const randomString = (obj === null || obj === void 0 ? void 0 : obj.single) ? this.getWhiteDotClass(gvc, isReadonly) : this.getCheckedClass(gvc, isReadonly);
|
|
2334
2334
|
const viewId = Tool.randomString(5);
|
|
2335
2335
|
return gvc.bindView({
|
|
2336
2336
|
bind: viewId,
|
|
@@ -2394,9 +2394,8 @@ ${(_d = obj.default) !== null && _d !== void 0 ? _d : ''}</textarea
|
|
|
2394
2394
|
});
|
|
2395
2395
|
}
|
|
2396
2396
|
static tripletCheckboxContainer(gvc, name, def, callback, obj) {
|
|
2397
|
-
const
|
|
2398
|
-
const
|
|
2399
|
-
const squareString = this.getSquareClass(gvc, inputColor);
|
|
2397
|
+
const checkedString = this.getCheckedClass(gvc);
|
|
2398
|
+
const squareString = this.getSquareClass(gvc);
|
|
2400
2399
|
const viewId = Tool.randomString(5);
|
|
2401
2400
|
const randomKey = Tool.randomString(5);
|
|
2402
2401
|
return gvc.bindView({
|
|
@@ -2458,8 +2457,7 @@ ${(_d = obj.default) !== null && _d !== void 0 ? _d : ''}</textarea
|
|
|
2458
2457
|
var _b;
|
|
2459
2458
|
obj.type = (_b = obj.type) !== null && _b !== void 0 ? _b : 'single';
|
|
2460
2459
|
const gvc = obj.gvc;
|
|
2461
|
-
const
|
|
2462
|
-
const randomString = obj.type === 'single' ? this.getWhiteDotClass(gvc, inputColor) : this.getCheckedClass(gvc, inputColor);
|
|
2460
|
+
const randomString = obj.type === 'single' ? this.getWhiteDotClass(gvc) : this.getCheckedClass(gvc);
|
|
2463
2461
|
return html `
|
|
2464
2462
|
${obj.title ? html ` <div class="tx_normal fw-normal">${obj.title}</div>` : ``}
|
|
2465
2463
|
${obj.gvc.bindView(() => {
|
|
@@ -4406,9 +4404,14 @@ ${(_d = obj.default) !== null && _d !== void 0 ? _d : ''}</textarea
|
|
|
4406
4404
|
color = color.replace('#', '%23');
|
|
4407
4405
|
return `"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 256 256' fill='${color}'%3e%3cpath d='M225.813 48.907L128 146.72 30.187 48.907 0 79.093l128 128 128-128z'/%3e%3c/svg%3e"`;
|
|
4408
4406
|
}
|
|
4409
|
-
static checkedDataImage(
|
|
4410
|
-
color =
|
|
4411
|
-
return `"data:image/svg+xml,%
|
|
4407
|
+
static checkedDataImage() {
|
|
4408
|
+
const color = '#fff'.replace('#', '%23');
|
|
4409
|
+
return `"data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2216%22%20height%3D%2217%22%20viewBox%3D%220%200%2016%2017%22%20fill%3D%22none%22%3E%0A%20%20%3Crect%20y%3D%220.5%22%20width%3D%2216%22%20height%3D%2216%22%20rx%3D%223%22%20fill%3D%22%23393939%22%2F%3E%0A%20%20%3Cpath%20d%3D%22M4.5%209L7%2011.5L11.5%205.5%22%20stroke%3D%22${color}%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%2F%3E%0A%3C%2Fsvg%3E"`;
|
|
4410
|
+
}
|
|
4411
|
+
static readonlyCheckedDataImage() {
|
|
4412
|
+
const color = '#fff'.replace('#', '%23');
|
|
4413
|
+
const bgr = '#8d8d8d'.replace('#', '%23');
|
|
4414
|
+
return `"data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2216%22%20height%3D%2217%22%20viewBox%3D%220%200%2016%2017%22%20fill%3D%22none%22%3E%0A%20%20%3Crect%20y%3D%220.5%22%20width%3D%2216%22%20height%3D%2216%22%20rx%3D%223%22%20fill%3D%22${bgr}%22%2F%3E%0A%20%20%3Cpath%20d%3D%22M4.5%209L7%2011.5L11.5%205.5%22%20stroke%3D%22${color}%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%2F%3E%0A%3C%2Fsvg%3E"`;
|
|
4412
4415
|
}
|
|
4413
4416
|
static squareDataImage(color) {
|
|
4414
4417
|
color = color.replace('#', '%23');
|
|
@@ -4422,17 +4425,17 @@ ${(_d = obj.default) !== null && _d !== void 0 ? _d : ''}</textarea
|
|
|
4422
4425
|
color = color.replace('#', '%23');
|
|
4423
4426
|
return `"data:image/svg+xml,%3csvg width='16' height='16' viewBox='0 0 16 16' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3crect width='16' height='16' rx='8' fill='${color}'/%3e%3crect x='4' y='4' width='8' height='8' rx='4' fill='white'/%3e%3c/svg%3e"`;
|
|
4424
4427
|
}
|
|
4425
|
-
static getCheckedClass(gvc,
|
|
4426
|
-
const className =
|
|
4428
|
+
static getCheckedClass(gvc, readonly) {
|
|
4429
|
+
const className = readonly ? 'checked-image-readonly' : 'checked-image';
|
|
4427
4430
|
gvc.addStyle(`
|
|
4428
4431
|
.${className} {
|
|
4429
4432
|
min-width: 1.25rem;
|
|
4430
4433
|
min-height: 1.25rem;
|
|
4431
4434
|
}
|
|
4432
4435
|
.${className}:checked[type='checkbox'] {
|
|
4433
|
-
border:
|
|
4436
|
+
border: 0;
|
|
4434
4437
|
background-color: #fff;
|
|
4435
|
-
background-image: url(${this.
|
|
4438
|
+
background-image: url(${readonly ? this.readonlyCheckedDataImage() : this.checkedDataImage()});
|
|
4436
4439
|
background-position: center center;
|
|
4437
4440
|
}
|
|
4438
4441
|
`);
|
|
@@ -4469,8 +4472,8 @@ ${(_d = obj.default) !== null && _d !== void 0 ? _d : ''}</textarea
|
|
|
4469
4472
|
`);
|
|
4470
4473
|
return className;
|
|
4471
4474
|
}
|
|
4472
|
-
static getWhiteDotClass(gvc,
|
|
4473
|
-
const className =
|
|
4475
|
+
static getWhiteDotClass(gvc, readonly) {
|
|
4476
|
+
const className = readonly ? 'white-dot-image-readonly' : 'white-dot-image';
|
|
4474
4477
|
gvc.addStyle(`
|
|
4475
4478
|
.${className} {
|
|
4476
4479
|
min-width: 1.15rem;
|
|
@@ -4480,7 +4483,7 @@ ${(_d = obj.default) !== null && _d !== void 0 ? _d : ''}</textarea
|
|
|
4480
4483
|
.${className}:checked[type='radio'] {
|
|
4481
4484
|
border: 0px solid #000;
|
|
4482
4485
|
background-color: #fff;
|
|
4483
|
-
background-image: url(${this.whiteDotDataImage(
|
|
4486
|
+
background-image: url(${this.whiteDotDataImage(readonly ? '#808080' : '#000')});
|
|
4484
4487
|
background-position: center center;
|
|
4485
4488
|
}
|
|
4486
4489
|
`);
|