ts-glitter 17.0.3 → 17.0.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/cms-plugin/image-manager.js +17 -0
- package/lowcode/cms-plugin/image-manager.ts +21 -0
- package/lowcode/cms-plugin/shopping-product-setting.ts +1 -1
- package/lowcode/cms-plugin/shopping-setting-basic.js +24 -0
- package/lowcode/cms-plugin/shopping-setting-basic.ts +25 -0
- package/lowcode/css/editor.css +16 -0
- package/lowcode/form-view/editor/array-items.js +39 -23
- package/lowcode/form-view/editor/array-items.ts +131 -105
- package/lowcode/form-view/editor/image-selector.js +123 -0
- package/lowcode/form-view/editor/image-selector.ts +129 -0
- package/lowcode/jspage/function-page/setting_editor.js +20 -0
- package/lowcode/jspage/function-page/setting_editor.ts +27 -0
- package/lowcode/modules/image-library.js +4 -3
- package/lowcode/modules/image-library.ts +6 -3
- package/lowcode/official_view_component/official/component.js +1 -1
- package/lowcode/official_view_component/official/component.ts +1 -1
- package/lowcode/official_view_component/official/form.js +3 -1
- package/lowcode/official_view_component/official/form.ts +3 -1
- package/lowcode/public-components/banner/sy-01.js +4 -1
- package/lowcode/public-components/banner/sy-01.ts +4 -2
- package/package.json +1 -1
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_17.0.
|
|
91
|
+
glitter.share.editerVersion = 'V_17.0.6';
|
|
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_17.0.
|
|
91
|
+
glitter.share.editerVersion = 'V_17.0.6';
|
|
92
92
|
glitter.share.start = new Date();
|
|
93
93
|
const vm: {
|
|
94
94
|
appConfig: any;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { BgWidget } from "../backend-manager/bg-widget.js";
|
|
2
|
+
export class ImageManager {
|
|
3
|
+
static main(gvc) {
|
|
4
|
+
const id = gvc.glitter.getUUID();
|
|
5
|
+
return BgWidget.container(gvc.bindView(() => {
|
|
6
|
+
return {
|
|
7
|
+
bind: id,
|
|
8
|
+
view: () => {
|
|
9
|
+
return [
|
|
10
|
+
BgWidget.title('圖庫管理'),
|
|
11
|
+
].join('');
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
}));
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
window.glitter.setModule(import.meta.url, ImageManager);
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import {GVC} from "../glitterBundle/GVController.js";
|
|
2
|
+
import {BgWidget} from "../backend-manager/bg-widget.js";
|
|
3
|
+
|
|
4
|
+
export class ImageManager {
|
|
5
|
+
public static main(gvc: GVC) {
|
|
6
|
+
const id = gvc.glitter.getUUID();
|
|
7
|
+
return BgWidget.container(gvc.bindView(() => {
|
|
8
|
+
return {
|
|
9
|
+
bind: id,
|
|
10
|
+
view: () => {
|
|
11
|
+
return [
|
|
12
|
+
BgWidget.title('圖庫管理'),
|
|
13
|
+
].join('')
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}))
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
(window as any).glitter.setModule(import.meta.url, ImageManager)
|
|
@@ -16,7 +16,7 @@ import {ProductConfig} from './product-config.js';
|
|
|
16
16
|
import {ShoppingSettingBasic} from "./shopping-setting-basic.js";
|
|
17
17
|
import {ShoppingSettingAdvance} from "./shopping-setting-advance.js";
|
|
18
18
|
import {ActiveSchedule, Product, ProductInitial} from "../public-models/product.js";
|
|
19
|
-
|
|
19
|
+
|
|
20
20
|
|
|
21
21
|
|
|
22
22
|
export class ShoppingProductSetting {
|
|
@@ -1786,6 +1786,30 @@ export class ShoppingSettingBasic {
|
|
|
1786
1786
|
>
|
|
1787
1787
|
運費計算方式
|
|
1788
1788
|
</div>
|
|
1789
|
+
<div
|
|
1790
|
+
style="cursor: pointer;"
|
|
1791
|
+
onclick="${gvc.event(() => {
|
|
1792
|
+
const language_data = postMD.language_data[ShoppingProductSetting.select_language];
|
|
1793
|
+
imageLibrary.selectImageFromArray(language_data.preview_image, {
|
|
1794
|
+
gvc: gvc,
|
|
1795
|
+
title: html `
|
|
1796
|
+
<div class="d-flex flex-column"
|
|
1797
|
+
style="border-radius: 10px 10px 0px 0px;background: #F2F2F2;">
|
|
1798
|
+
圖片庫
|
|
1799
|
+
</div>`,
|
|
1800
|
+
getSelect: (imageUrl) => {
|
|
1801
|
+
postMD.variants.filter((dd) => {
|
|
1802
|
+
if (dd.checked) {
|
|
1803
|
+
dd[`preview_image_${ShoppingProductSetting.select_language}`] = imageUrl;
|
|
1804
|
+
}
|
|
1805
|
+
});
|
|
1806
|
+
gvc.notifyDataChange(vm.id);
|
|
1807
|
+
},
|
|
1808
|
+
});
|
|
1809
|
+
})}"
|
|
1810
|
+
>
|
|
1811
|
+
編輯規格圖片
|
|
1812
|
+
</div>
|
|
1789
1813
|
<div
|
|
1790
1814
|
style="cursor: pointer;"
|
|
1791
1815
|
onclick="${gvc.event(() => {
|
|
@@ -1950,6 +1950,31 @@ export class ShoppingSettingBasic {
|
|
|
1950
1950
|
>
|
|
1951
1951
|
運費計算方式
|
|
1952
1952
|
</div>
|
|
1953
|
+
<div
|
|
1954
|
+
style="cursor: pointer;"
|
|
1955
|
+
onclick="${gvc.event(() => {
|
|
1956
|
+
const language_data: any = (postMD.language_data as any)[ShoppingProductSetting.select_language];
|
|
1957
|
+
imageLibrary.selectImageFromArray(language_data.preview_image, {
|
|
1958
|
+
gvc: gvc,
|
|
1959
|
+
title: html`
|
|
1960
|
+
<div class="d-flex flex-column"
|
|
1961
|
+
style="border-radius: 10px 10px 0px 0px;background: #F2F2F2;">
|
|
1962
|
+
圖片庫
|
|
1963
|
+
</div>`,
|
|
1964
|
+
getSelect: (imageUrl) => {
|
|
1965
|
+
postMD.variants.filter((dd) => {
|
|
1966
|
+
if ((dd as any).checked) {
|
|
1967
|
+
(dd as any)[`preview_image_${ShoppingProductSetting.select_language}`] = imageUrl;
|
|
1968
|
+
}
|
|
1969
|
+
});
|
|
1970
|
+
gvc.notifyDataChange(vm.id)
|
|
1971
|
+
|
|
1972
|
+
},
|
|
1973
|
+
})
|
|
1974
|
+
})}"
|
|
1975
|
+
>
|
|
1976
|
+
編輯規格圖片
|
|
1977
|
+
</div>
|
|
1953
1978
|
<div
|
|
1954
1979
|
style="cursor: pointer;"
|
|
1955
1980
|
onclick="${gvc.event(() => {
|
package/lowcode/css/editor.css
CHANGED
|
@@ -109,9 +109,11 @@ h6 {
|
|
|
109
109
|
color: var(--item-primary);
|
|
110
110
|
background: var(--background-1);
|
|
111
111
|
}
|
|
112
|
+
|
|
112
113
|
.active_F2F2F2 {
|
|
113
114
|
background: #f2f2f2;
|
|
114
115
|
}
|
|
116
|
+
|
|
115
117
|
.editor_item .primary {
|
|
116
118
|
color: var(--item-primary);
|
|
117
119
|
}
|
|
@@ -435,6 +437,7 @@ h6 {
|
|
|
435
437
|
-webkit-background-clip: text;
|
|
436
438
|
-webkit-text-fill-color: transparent;
|
|
437
439
|
}
|
|
440
|
+
|
|
438
441
|
.bt_orange_lin {
|
|
439
442
|
cursor: pointer;
|
|
440
443
|
height: 36px;
|
|
@@ -461,6 +464,7 @@ h6 {
|
|
|
461
464
|
-webkit-background-clip: unset;
|
|
462
465
|
-webkit-text-fill-color: unset;
|
|
463
466
|
}
|
|
467
|
+
|
|
464
468
|
.bt_orange_lin_mb {
|
|
465
469
|
cursor: pointer;
|
|
466
470
|
height: 36px;
|
|
@@ -487,6 +491,7 @@ h6 {
|
|
|
487
491
|
-webkit-background-clip: unset;
|
|
488
492
|
-webkit-text-fill-color: unset;
|
|
489
493
|
}
|
|
494
|
+
|
|
490
495
|
.bt_c39 {
|
|
491
496
|
border-radius: 10px;
|
|
492
497
|
background: var(--main-black);
|
|
@@ -1140,6 +1145,7 @@ h6 {
|
|
|
1140
1145
|
background-color: #393939 !important;
|
|
1141
1146
|
border-color: #393939 !important;
|
|
1142
1147
|
}
|
|
1148
|
+
|
|
1143
1149
|
h6,
|
|
1144
1150
|
.h6,
|
|
1145
1151
|
h5,
|
|
@@ -1154,6 +1160,7 @@ h1,
|
|
|
1154
1160
|
.h1 {
|
|
1155
1161
|
color: #393939;
|
|
1156
1162
|
}
|
|
1163
|
+
|
|
1157
1164
|
.select-label-ai-message_ {
|
|
1158
1165
|
gap: 10px;
|
|
1159
1166
|
cursor: pointer;
|
|
@@ -1172,3 +1179,12 @@ h1,
|
|
|
1172
1179
|
-webkit-background-clip: text;
|
|
1173
1180
|
-webkit-text-fill-color: transparent;
|
|
1174
1181
|
}
|
|
1182
|
+
|
|
1183
|
+
.editor-label {
|
|
1184
|
+
width: 100%;
|
|
1185
|
+
color: #393939;
|
|
1186
|
+
font-size: 15px;
|
|
1187
|
+
font-weight: 400;
|
|
1188
|
+
white-space: normal !important;
|
|
1189
|
+
word-break: break-all !important;
|
|
1190
|
+
}
|
|
@@ -9,6 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
};
|
|
10
10
|
import { NormalPageEditor } from '../../editor/normal-page-editor.js';
|
|
11
11
|
import { ShareDialog } from "../../glitterBundle/dialog/ShareDialog.js";
|
|
12
|
+
import { BgWidget } from "../../backend-manager/bg-widget.js";
|
|
12
13
|
const html = String.raw;
|
|
13
14
|
export class ArrayItems {
|
|
14
15
|
static main(cf) {
|
|
@@ -34,16 +35,23 @@ export class ArrayItems {
|
|
|
34
35
|
bind: id,
|
|
35
36
|
view: () => {
|
|
36
37
|
return (cf.formData[cf.key] || []).map((dd, index) => {
|
|
37
|
-
return
|
|
38
|
+
return html `
|
|
39
|
+
<li onclick="${gvc.event(() => {
|
|
38
40
|
})}">
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
41
|
+
<div class="w-100 fw-500 d-flex align-items-center fs-6 hoverBtn h_item rounded px-2 hoverF2 mb-1"
|
|
42
|
+
style="gap:5px;color:#393939;">
|
|
43
|
+
<div class=" p-1 dragItem ">
|
|
44
|
+
<i class="fa-solid fa-grip-dots-vertical d-flex align-items-center justify-content-center "
|
|
45
|
+
style="width:15px;height:15px;" aria-hidden="true"></i>
|
|
46
|
+
</div>
|
|
47
|
+
${widget.bundle.form_config.preview_img ? `
|
|
48
|
+
<div class="rounded-3 me-1" style="width:32px;height: 32px; background-image: url('${dd[widget.bundle.form_config.preview_img] || BgWidget.noImageURL}');background-size: cover;background-repeat: no-repeat;background-position: center;"></div>
|
|
49
|
+
` : ``}
|
|
50
|
+
|
|
51
|
+
<span style="text-overflow: ellipsis;max-width: calc(100% - 100px);overflow: hidden;white-space: nowrap;">${dd[widget.bundle.form_config.refer_title] || `選項 ${index + 1}`}</span>
|
|
52
|
+
<div class="flex-fill"></div>
|
|
53
|
+
|
|
54
|
+
<div class="hoverBtn p-1 child" onclick="${gvc.event((e, event) => {
|
|
47
55
|
event.stopPropagation();
|
|
48
56
|
event.preventDefault();
|
|
49
57
|
const dialog = new ShareDialog(gvc.glitter);
|
|
@@ -58,9 +66,10 @@ export class ArrayItems {
|
|
|
58
66
|
}
|
|
59
67
|
});
|
|
60
68
|
})}">
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
69
|
+
<i class="fa-regular fa-trash d-flex align-items-center justify-content-center "
|
|
70
|
+
aria-hidden="true"></i>
|
|
71
|
+
</div>
|
|
72
|
+
<div class="hoverBtn p-1 child " onclick="${gvc.event((e, event) => {
|
|
64
73
|
event.stopPropagation();
|
|
65
74
|
event.preventDefault();
|
|
66
75
|
const edit_data = dd;
|
|
@@ -102,10 +111,10 @@ export class ArrayItems {
|
|
|
102
111
|
title: edit_data[widget.bundle.form_config.refer_title] || `選項 ${index + 1}`
|
|
103
112
|
});
|
|
104
113
|
})}">
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
114
|
+
<i class="fa-solid fa-pencil"></i>
|
|
115
|
+
</div>
|
|
116
|
+
</div>
|
|
117
|
+
</li>`;
|
|
109
118
|
}).join('');
|
|
110
119
|
},
|
|
111
120
|
divCreate: {
|
|
@@ -149,23 +158,30 @@ export class ArrayItems {
|
|
|
149
158
|
},
|
|
150
159
|
});
|
|
151
160
|
}
|
|
152
|
-
catch (e) {
|
|
161
|
+
catch (e) {
|
|
162
|
+
}
|
|
153
163
|
clearInterval(interval);
|
|
154
164
|
}
|
|
155
165
|
}, 100);
|
|
156
|
-
}, () => {
|
|
166
|
+
}, () => {
|
|
167
|
+
});
|
|
157
168
|
}
|
|
158
169
|
};
|
|
159
170
|
}));
|
|
160
|
-
viewArray.push(
|
|
161
|
-
|
|
171
|
+
viewArray.push(html `
|
|
172
|
+
<div class="w-100"
|
|
173
|
+
style="justify-content: center; align-items: center; gap: 4px; display: flex;color: #3366BB;cursor: pointer;"
|
|
174
|
+
data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false"
|
|
175
|
+
onclick="${gvc.event(() => {
|
|
162
176
|
cf.formData[cf.key].push({});
|
|
163
177
|
cf.callback(cf.formData[cf.key]);
|
|
164
178
|
cf.gvc.notifyDataChange(id);
|
|
165
179
|
})}">
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
180
|
+
<div style="font-size: 16px; font-family: Noto Sans; font-weight: 400; word-wrap: break-word">
|
|
181
|
+
${cf.widget.bundle.form_config['plus_title'] || '新增選項'}
|
|
182
|
+
</div>
|
|
183
|
+
<i class="fa-solid fa-plus" aria-hidden="true"></i>
|
|
184
|
+
</div>`);
|
|
169
185
|
return viewArray.join('<div class="my-2"></div>');
|
|
170
186
|
},
|
|
171
187
|
divCreate: {
|
|
@@ -4,117 +4,134 @@ import {Main_editor} from '../../jspage/function-page/main_editor.js';
|
|
|
4
4
|
import {NormalPageEditor} from '../../editor/normal-page-editor.js';
|
|
5
5
|
import {EditorConfig} from "../../editor-config.js";
|
|
6
6
|
import {ShareDialog} from "../../glitterBundle/dialog/ShareDialog.js";
|
|
7
|
+
import {BgWidget} from "../../backend-manager/bg-widget.js";
|
|
7
8
|
|
|
8
9
|
|
|
9
10
|
const html = String.raw;
|
|
10
11
|
|
|
11
12
|
export class ArrayItems {
|
|
12
|
-
public static main(cf: {
|
|
13
|
-
|
|
13
|
+
public static main(cf: {
|
|
14
|
+
gvc: GVC;
|
|
15
|
+
bundle: any,
|
|
16
|
+
formData: any;
|
|
17
|
+
widget: any;
|
|
18
|
+
key: string;
|
|
19
|
+
callback: (data: any) => void
|
|
20
|
+
}) {
|
|
21
|
+
const gvc = cf.gvc;
|
|
14
22
|
return gvc.bindView(() => {
|
|
15
|
-
cf.widget.bundle=cf.widget.bundle??{}
|
|
16
|
-
cf.formData[cf.key]=cf.formData[cf.key]||[]
|
|
17
|
-
cf.widget.bundle.form_config=cf.widget.bundle.form_config??{}
|
|
18
|
-
const widget=cf.widget;
|
|
23
|
+
cf.widget.bundle = cf.widget.bundle ?? {}
|
|
24
|
+
cf.formData[cf.key] = cf.formData[cf.key] || []
|
|
25
|
+
cf.widget.bundle.form_config = cf.widget.bundle.form_config ?? {}
|
|
26
|
+
const widget = cf.widget;
|
|
19
27
|
const id = gvc.glitter.getUUID()
|
|
20
|
-
const parId=gvc.glitter.getUUID()
|
|
28
|
+
const parId = gvc.glitter.getUUID()
|
|
21
29
|
|
|
22
30
|
return {
|
|
23
31
|
bind: id,
|
|
24
32
|
view: () => {
|
|
25
33
|
let viewArray: string[] = []
|
|
26
|
-
viewArray.push(gvc.bindView(()=>{
|
|
27
|
-
const id=gvc.glitter.getUUID()
|
|
28
|
-
|
|
34
|
+
viewArray.push(gvc.bindView(() => {
|
|
35
|
+
const id = gvc.glitter.getUUID()
|
|
36
|
+
|
|
37
|
+
function refresh() {
|
|
29
38
|
gvc.notifyDataChange(id)
|
|
30
39
|
}
|
|
40
|
+
|
|
31
41
|
return {
|
|
32
|
-
bind:id,
|
|
33
|
-
view:()=>{
|
|
34
|
-
return (cf.formData[cf.key] || []).map((dd: any,index:number) => {
|
|
35
|
-
return
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
42
|
+
bind: id,
|
|
43
|
+
view: () => {
|
|
44
|
+
return (cf.formData[cf.key] || []).map((dd: any, index: number) => {
|
|
45
|
+
return html`
|
|
46
|
+
<li onclick="${gvc.event(() => {
|
|
47
|
+
})}">
|
|
48
|
+
<div class="w-100 fw-500 d-flex align-items-center fs-6 hoverBtn h_item rounded px-2 hoverF2 mb-1"
|
|
49
|
+
style="gap:5px;color:#393939;">
|
|
50
|
+
<div class=" p-1 dragItem ">
|
|
51
|
+
<i class="fa-solid fa-grip-dots-vertical d-flex align-items-center justify-content-center "
|
|
52
|
+
style="width:15px;height:15px;" aria-hidden="true"></i>
|
|
53
|
+
</div>
|
|
54
|
+
${widget.bundle.form_config.preview_img ? `
|
|
55
|
+
<div class="rounded-3 me-1" style="width:32px;height: 32px; background-image: url('${dd[widget.bundle.form_config.preview_img] || BgWidget.noImageURL}');background-size: cover;background-repeat: no-repeat;background-position: center;"></div>
|
|
56
|
+
`:``}
|
|
57
|
+
|
|
58
|
+
<span style="text-overflow: ellipsis;max-width: calc(100% - 100px);overflow: hidden;white-space: nowrap;">${dd[widget.bundle.form_config.refer_title] || `選項 ${index + 1}`}</span>
|
|
59
|
+
<div class="flex-fill"></div>
|
|
48
60
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
const id=gvc.glitter.getUUID()
|
|
79
|
-
return {
|
|
80
|
-
bind:id,
|
|
81
|
-
view:async ()=>{
|
|
82
|
-
let view = [];
|
|
83
|
-
const dialog=new ShareDialog(gvc.glitter)
|
|
84
|
-
dialog.dataLoading({visible:true})
|
|
85
|
-
view.push(await new Promise((resolve, reject) => {
|
|
86
|
-
gvc.glitter.getModule(new URL('./official_view_component/official/form.js', gvc.glitter.root_path).href, (res:any) => {
|
|
87
|
-
resolve(res.editorView({
|
|
88
|
-
gvc: gvc,
|
|
89
|
-
array: widget.bundle.form_config['form_array'] || [],
|
|
90
|
-
formData: edit_data as any,
|
|
91
|
-
refresh: ()=>{
|
|
92
|
-
refresh();
|
|
93
|
-
((widget.bundle.refresh && widget.bundle.refresh) || (() => {
|
|
94
|
-
widget.refreshComponent()
|
|
95
|
-
}))();
|
|
96
|
-
}
|
|
97
|
-
}));
|
|
98
|
-
})
|
|
99
|
-
}))
|
|
100
|
-
dialog.dataLoading({visible:false})
|
|
101
|
-
return view.join('')
|
|
61
|
+
<div class="hoverBtn p-1 child" onclick="${gvc.event((e, event) => {
|
|
62
|
+
event.stopPropagation();
|
|
63
|
+
event.preventDefault();
|
|
64
|
+
const dialog = new ShareDialog(gvc.glitter);
|
|
65
|
+
dialog.checkYesOrNot({
|
|
66
|
+
text: '是否確認刪除?',
|
|
67
|
+
callback: (b) => {
|
|
68
|
+
if (b) {
|
|
69
|
+
cf.formData[cf.key].splice(index, 1)
|
|
70
|
+
cf.callback({})
|
|
71
|
+
gvc.notifyDataChange(id)
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
})
|
|
75
|
+
})}">
|
|
76
|
+
<i class="fa-regular fa-trash d-flex align-items-center justify-content-center "
|
|
77
|
+
aria-hidden="true"></i>
|
|
78
|
+
</div>
|
|
79
|
+
<div class="hoverBtn p-1 child " onclick="${gvc.event((e, event) => {
|
|
80
|
+
event.stopPropagation();
|
|
81
|
+
event.preventDefault();
|
|
82
|
+
const edit_data = dd;
|
|
83
|
+
|
|
84
|
+
const gvc_ref = (gvc.glitter.getUrlParameter('cms') !== 'true') ? gvc : (window.parent as any).glitter.pageConfig[0].gvc
|
|
85
|
+
const pageEditor = (gvc.glitter.getUrlParameter('cms') === 'true') ? (window.parent as any).glitter.share.NormalPageEditor : NormalPageEditor;
|
|
86
|
+
pageEditor.closeEvent = () => {
|
|
87
|
+
// ((widget.bundle.refresh && widget.bundle.refresh) || (() => {
|
|
88
|
+
// widget.refreshComponent()
|
|
89
|
+
// }))()
|
|
102
90
|
}
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
91
|
+
pageEditor.toggle({
|
|
92
|
+
visible: true,
|
|
93
|
+
view: gvc_ref.bindView(() => {
|
|
94
|
+
const gvc = gvc_ref;
|
|
95
|
+
const id = gvc.glitter.getUUID()
|
|
96
|
+
return {
|
|
97
|
+
bind: id,
|
|
98
|
+
view: async () => {
|
|
99
|
+
let view = [];
|
|
100
|
+
const dialog = new ShareDialog(gvc.glitter)
|
|
101
|
+
dialog.dataLoading({visible: true})
|
|
102
|
+
view.push(await new Promise((resolve, reject) => {
|
|
103
|
+
gvc.glitter.getModule(new URL('./official_view_component/official/form.js', gvc.glitter.root_path).href, (res: any) => {
|
|
104
|
+
resolve(res.editorView({
|
|
105
|
+
gvc: gvc,
|
|
106
|
+
array: widget.bundle.form_config['form_array'] || [],
|
|
107
|
+
formData: edit_data as any,
|
|
108
|
+
refresh: () => {
|
|
109
|
+
refresh();
|
|
110
|
+
((widget.bundle.refresh && widget.bundle.refresh) || (() => {
|
|
111
|
+
widget.refreshComponent()
|
|
112
|
+
}))();
|
|
113
|
+
}
|
|
114
|
+
}));
|
|
115
|
+
})
|
|
116
|
+
}))
|
|
117
|
+
dialog.dataLoading({visible: false})
|
|
118
|
+
return view.join('')
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}),
|
|
122
|
+
title: edit_data[widget.bundle.form_config.refer_title] || `選項 ${index + 1}`
|
|
123
|
+
})
|
|
124
|
+
})}">
|
|
125
|
+
<i class="fa-solid fa-pencil"></i>
|
|
126
|
+
</div>
|
|
127
|
+
</div>
|
|
128
|
+
</li>`
|
|
112
129
|
}).join('')
|
|
113
130
|
},
|
|
114
|
-
divCreate:{
|
|
115
|
-
class
|
|
131
|
+
divCreate: {
|
|
132
|
+
class: `mx-n2`, elem: 'ul', option: [{key: 'id', value: parId}],
|
|
116
133
|
},
|
|
117
|
-
onCreate:()=>{
|
|
134
|
+
onCreate: () => {
|
|
118
135
|
gvc.glitter.addMtScript(
|
|
119
136
|
[
|
|
120
137
|
{
|
|
@@ -131,11 +148,13 @@ const gvc=cf.gvc;
|
|
|
131
148
|
padding: 0;
|
|
132
149
|
}
|
|
133
150
|
`);
|
|
151
|
+
|
|
134
152
|
function swapArr(arr: any, index1: number, index2: number) {
|
|
135
153
|
const data = arr[index1];
|
|
136
154
|
arr.splice(index1, 1);
|
|
137
155
|
arr.splice(index2, 0, data);
|
|
138
156
|
}
|
|
157
|
+
|
|
139
158
|
let startIndex = 0;
|
|
140
159
|
//@ts-ignore
|
|
141
160
|
Sortable.create(gvc.glitter.document.getElementById(parId), {
|
|
@@ -144,36 +163,43 @@ const gvc=cf.gvc;
|
|
|
144
163
|
|
|
145
164
|
animation: 100,
|
|
146
165
|
onChange: function (evt: any) {
|
|
147
|
-
|
|
148
|
-
startIndex=evt.newIndex
|
|
166
|
+
swapArr(cf.formData[cf.key], startIndex, evt.newIndex);
|
|
167
|
+
startIndex = evt.newIndex
|
|
149
168
|
},
|
|
150
169
|
onEnd: (evt: any) => {
|
|
151
|
-
cf.callback(
|
|
170
|
+
cf.callback(cf.formData[cf.key])
|
|
152
171
|
gvc.notifyDataChange(id)
|
|
153
172
|
},
|
|
154
173
|
onStart: function (evt: any) {
|
|
155
174
|
startIndex = evt.oldIndex;
|
|
156
175
|
},
|
|
157
176
|
});
|
|
158
|
-
} catch (e) {
|
|
177
|
+
} catch (e) {
|
|
178
|
+
}
|
|
159
179
|
clearInterval(interval);
|
|
160
180
|
}
|
|
161
181
|
}, 100);
|
|
162
182
|
},
|
|
163
|
-
() => {
|
|
183
|
+
() => {
|
|
184
|
+
}
|
|
164
185
|
);
|
|
165
186
|
}
|
|
166
187
|
}
|
|
167
188
|
}))
|
|
168
|
-
viewArray.push(
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
189
|
+
viewArray.push(html`
|
|
190
|
+
<div class="w-100"
|
|
191
|
+
style="justify-content: center; align-items: center; gap: 4px; display: flex;color: #3366BB;cursor: pointer;"
|
|
192
|
+
data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false"
|
|
193
|
+
onclick="${gvc.event(() => {
|
|
194
|
+
cf.formData[cf.key].push({})
|
|
195
|
+
cf.callback(cf.formData[cf.key])
|
|
196
|
+
cf.gvc.notifyDataChange(id)
|
|
197
|
+
})}">
|
|
198
|
+
<div style="font-size: 16px; font-family: Noto Sans; font-weight: 400; word-wrap: break-word">
|
|
199
|
+
${cf.widget.bundle.form_config['plus_title'] || '新增選項'}
|
|
200
|
+
</div>
|
|
201
|
+
<i class="fa-solid fa-plus" aria-hidden="true"></i>
|
|
202
|
+
</div>`)
|
|
177
203
|
|
|
178
204
|
return viewArray.join('<div class="my-2"></div>')
|
|
179
205
|
},
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import { ApiUser } from "../../glitter-base/route/user.js";
|
|
11
|
+
import { imageLibrary } from "../../modules/image-library.js";
|
|
12
|
+
import { BgWidget } from "../../backend-manager/bg-widget.js";
|
|
13
|
+
export class ImageSelector {
|
|
14
|
+
static main(cf) {
|
|
15
|
+
const widget = cf.widget;
|
|
16
|
+
const gvc = cf.gvc;
|
|
17
|
+
const id = gvc.glitter.getUUID();
|
|
18
|
+
const html = String.raw;
|
|
19
|
+
return gvc.bindView(() => {
|
|
20
|
+
return {
|
|
21
|
+
bind: id,
|
|
22
|
+
view: () => {
|
|
23
|
+
if (typeof widget.bundle.form_data[widget.bundle.form_key] === 'object') {
|
|
24
|
+
widget.bundle.form_data[widget.bundle.form_key] = widget.bundle.form_data[widget.bundle.form_key].value;
|
|
25
|
+
}
|
|
26
|
+
const src = widget.bundle.form_data[widget.bundle.form_key];
|
|
27
|
+
return html `
|
|
28
|
+
<div class="fw-normal mt-2 fs-6">${widget.bundle.form_title}</div>
|
|
29
|
+
<div
|
|
30
|
+
class="d-flex align-items-center justify-content-center rounded-3 shadow mt-2"
|
|
31
|
+
|
|
32
|
+
style="width:145px;height:145px;cursor:pointer;background: 50%/cover url('${src || BgWidget.noImageURL}');"
|
|
33
|
+
>
|
|
34
|
+
<div
|
|
35
|
+
class="w-100 h-100 d-flex align-items-center justify-content-center rounded-3 p-hover-image position-relative"
|
|
36
|
+
style="opacity:0;background: rgba(0,0,0,0.5);gap:20px;color:white;font-size:22px;"
|
|
37
|
+
>
|
|
38
|
+
${(src && (src !== BgWidget.noImageURL)) ? ` <button
|
|
39
|
+
class="btn-size-sm btn-gray position-absolute"
|
|
40
|
+
style="top:5px;right:5px;"
|
|
41
|
+
type="button"
|
|
42
|
+
onclick="${gvc.event(() => {
|
|
43
|
+
window.glitter.getModule(gvc.glitter.root_path + `backend-manager/bg-widget.js`, (BgWidget) => __awaiter(this, void 0, void 0, function* () {
|
|
44
|
+
const tag = gvc.glitter.generateCheckSum(src, 9);
|
|
45
|
+
let alt = (yield ApiUser.getPublicConfig(`alt_` + tag, 'manager')).response.value || { alt: '' };
|
|
46
|
+
function set_alt() {
|
|
47
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
48
|
+
ApiUser.setPublicConfig({
|
|
49
|
+
key: `alt_` + tag,
|
|
50
|
+
value: alt,
|
|
51
|
+
user_id: 'manager',
|
|
52
|
+
});
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
BgWidget.settingDialog({
|
|
56
|
+
gvc: gvc,
|
|
57
|
+
title: '設定圖片描述',
|
|
58
|
+
innerHTML: (gvc) => {
|
|
59
|
+
return `<div>${BgWidget.textArea({
|
|
60
|
+
gvc: gvc,
|
|
61
|
+
title: `ALT描述`,
|
|
62
|
+
default: alt.alt,
|
|
63
|
+
placeHolder: `請輸入ALT描述`,
|
|
64
|
+
callback: (text) => {
|
|
65
|
+
alt.alt = text;
|
|
66
|
+
},
|
|
67
|
+
})}</div>`;
|
|
68
|
+
},
|
|
69
|
+
footer_html: (gvc) => {
|
|
70
|
+
let array = [
|
|
71
|
+
BgWidget.cancel(gvc.event(() => {
|
|
72
|
+
gvc.closeDialog();
|
|
73
|
+
})),
|
|
74
|
+
BgWidget.save(gvc.event(() => {
|
|
75
|
+
set_alt();
|
|
76
|
+
gvc.closeDialog();
|
|
77
|
+
})),
|
|
78
|
+
];
|
|
79
|
+
return array.join('');
|
|
80
|
+
},
|
|
81
|
+
});
|
|
82
|
+
}));
|
|
83
|
+
})}"
|
|
84
|
+
>
|
|
85
|
+
<span class="tx_700" style="">ALT</span>
|
|
86
|
+
</button>
|
|
87
|
+
<i
|
|
88
|
+
class="fa-regular fa-eye"
|
|
89
|
+
onclick="${gvc.event(() => {
|
|
90
|
+
window.parent.glitter.openDiaLog(new URL('../../dialog/image-preview.js', import.meta.url).href, 'preview', src);
|
|
91
|
+
})}"
|
|
92
|
+
></i>
|
|
93
|
+
<i
|
|
94
|
+
class="fa-regular fa-trash"
|
|
95
|
+
onclick="${gvc.event(() => {
|
|
96
|
+
widget.bundle.form_data[widget.bundle.form_key] = BgWidget.noImageURL;
|
|
97
|
+
widget.bundle.refresh && widget.bundle.refresh();
|
|
98
|
+
gvc.notifyDataChange(id);
|
|
99
|
+
})}"
|
|
100
|
+
></i>` : `
|
|
101
|
+
<button
|
|
102
|
+
class="btn-size-sm btn-gray "
|
|
103
|
+
style=""
|
|
104
|
+
type="button"
|
|
105
|
+
onclick="${gvc.event(() => {
|
|
106
|
+
imageLibrary.selectImageLibrary(gvc, (urlArray) => {
|
|
107
|
+
widget.bundle.form_data[widget.bundle.form_key] = urlArray[0].data;
|
|
108
|
+
widget.bundle.refresh && widget.bundle.refresh();
|
|
109
|
+
gvc.notifyDataChange(id);
|
|
110
|
+
}, html ` <div class="d-flex flex-column" style="border-radius: 10px 10px 0px 0px;background: #F2F2F2;">圖片庫</div>`, { mul: false });
|
|
111
|
+
})}"
|
|
112
|
+
>
|
|
113
|
+
<span class="tx_700" style="">選擇圖片</span>
|
|
114
|
+
</button>
|
|
115
|
+
`}
|
|
116
|
+
</div>
|
|
117
|
+
</div>`;
|
|
118
|
+
}
|
|
119
|
+
};
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
window.glitter.setModule(import.meta.url, ImageSelector);
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import {GVC} from "../../glitterBundle/GVController.js";
|
|
2
|
+
import {ApiUser} from "../../glitter-base/route/user.js";
|
|
3
|
+
import {imageLibrary} from "../../modules/image-library.js";
|
|
4
|
+
import {ShareDialog} from "../../glitterBundle/dialog/ShareDialog.js";
|
|
5
|
+
import {BgWidget} from "../../backend-manager/bg-widget.js";
|
|
6
|
+
|
|
7
|
+
export class ImageSelector {
|
|
8
|
+
public static main(cf: { gvc: GVC; formData: any; widget: any }) {
|
|
9
|
+
const widget = cf.widget;
|
|
10
|
+
const gvc = cf.gvc;
|
|
11
|
+
const id = gvc.glitter.getUUID();
|
|
12
|
+
const html = String.raw
|
|
13
|
+
return gvc.bindView(() => {
|
|
14
|
+
return {
|
|
15
|
+
bind: id,
|
|
16
|
+
view: () => {
|
|
17
|
+
if(typeof widget.bundle.form_data[widget.bundle.form_key]==='object'){
|
|
18
|
+
widget.bundle.form_data[widget.bundle.form_key]=widget.bundle.form_data[widget.bundle.form_key].value
|
|
19
|
+
}
|
|
20
|
+
const src = widget.bundle.form_data[widget.bundle.form_key];
|
|
21
|
+
|
|
22
|
+
return html`
|
|
23
|
+
<div class="fw-normal mt-2 fs-6">${widget.bundle.form_title}</div>
|
|
24
|
+
<div
|
|
25
|
+
class="d-flex align-items-center justify-content-center rounded-3 shadow mt-2"
|
|
26
|
+
|
|
27
|
+
style="width:145px;height:145px;cursor:pointer;background: 50%/cover url('${src || BgWidget.noImageURL}');"
|
|
28
|
+
>
|
|
29
|
+
<div
|
|
30
|
+
class="w-100 h-100 d-flex align-items-center justify-content-center rounded-3 p-hover-image position-relative"
|
|
31
|
+
style="opacity:0;background: rgba(0,0,0,0.5);gap:20px;color:white;font-size:22px;"
|
|
32
|
+
>
|
|
33
|
+
${(src && (src !== BgWidget.noImageURL)) ? ` <button
|
|
34
|
+
class="btn-size-sm btn-gray position-absolute"
|
|
35
|
+
style="top:5px;right:5px;"
|
|
36
|
+
type="button"
|
|
37
|
+
onclick="${gvc.event(() => {
|
|
38
|
+
(window as any).glitter.getModule(gvc.glitter.root_path + `backend-manager/bg-widget.js`, async (BgWidget: any) => {
|
|
39
|
+
const tag = gvc.glitter.generateCheckSum(src, 9);
|
|
40
|
+
let alt = (await ApiUser.getPublicConfig(`alt_` + tag, 'manager')).response.value || {alt: ''};
|
|
41
|
+
|
|
42
|
+
async function set_alt() {
|
|
43
|
+
ApiUser.setPublicConfig({
|
|
44
|
+
key: `alt_` + tag,
|
|
45
|
+
value: alt,
|
|
46
|
+
user_id: 'manager',
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
BgWidget.settingDialog({
|
|
51
|
+
gvc: gvc,
|
|
52
|
+
title: '設定圖片描述',
|
|
53
|
+
innerHTML: (gvc: GVC) => {
|
|
54
|
+
return `<div>${BgWidget.textArea({
|
|
55
|
+
gvc: gvc,
|
|
56
|
+
title: `ALT描述`,
|
|
57
|
+
default: alt.alt,
|
|
58
|
+
placeHolder: `請輸入ALT描述`,
|
|
59
|
+
callback: (text: string) => {
|
|
60
|
+
alt.alt = text;
|
|
61
|
+
},
|
|
62
|
+
})}</div>`;
|
|
63
|
+
},
|
|
64
|
+
footer_html: (gvc: GVC) => {
|
|
65
|
+
let array = [
|
|
66
|
+
BgWidget.cancel(
|
|
67
|
+
gvc.event(() => {
|
|
68
|
+
gvc.closeDialog();
|
|
69
|
+
})
|
|
70
|
+
),
|
|
71
|
+
BgWidget.save(
|
|
72
|
+
gvc.event(() => {
|
|
73
|
+
set_alt();
|
|
74
|
+
gvc.closeDialog();
|
|
75
|
+
})
|
|
76
|
+
),
|
|
77
|
+
];
|
|
78
|
+
return array.join('');
|
|
79
|
+
},
|
|
80
|
+
});
|
|
81
|
+
});
|
|
82
|
+
})}"
|
|
83
|
+
>
|
|
84
|
+
<span class="tx_700" style="">ALT</span>
|
|
85
|
+
</button>
|
|
86
|
+
<i
|
|
87
|
+
class="fa-regular fa-eye"
|
|
88
|
+
onclick="${gvc.event(() => {
|
|
89
|
+
(window.parent as any).glitter.openDiaLog(new URL('../../dialog/image-preview.js', import.meta.url).href, 'preview', src);
|
|
90
|
+
// gvc.glitter.openDiaLog(new URL('../../dialog/image-preview.js', import.meta.url).href, 'preview', dd);
|
|
91
|
+
})}"
|
|
92
|
+
></i>
|
|
93
|
+
<i
|
|
94
|
+
class="fa-regular fa-trash"
|
|
95
|
+
onclick="${gvc.event(() => {
|
|
96
|
+
widget.bundle.form_data[widget.bundle.form_key] = BgWidget.noImageURL;
|
|
97
|
+
widget.bundle.refresh && widget.bundle.refresh();
|
|
98
|
+
gvc.notifyDataChange(id);
|
|
99
|
+
})}"
|
|
100
|
+
></i>`:`
|
|
101
|
+
<button
|
|
102
|
+
class="btn-size-sm btn-gray "
|
|
103
|
+
style=""
|
|
104
|
+
type="button"
|
|
105
|
+
onclick="${gvc.event(() => {
|
|
106
|
+
imageLibrary.selectImageLibrary(
|
|
107
|
+
gvc,
|
|
108
|
+
(urlArray) => {
|
|
109
|
+
widget.bundle.form_data[widget.bundle.form_key]=urlArray[0].data;
|
|
110
|
+
widget.bundle.refresh && widget.bundle.refresh();
|
|
111
|
+
gvc.notifyDataChange(id)
|
|
112
|
+
},
|
|
113
|
+
html` <div class="d-flex flex-column" style="border-radius: 10px 10px 0px 0px;background: #F2F2F2;">圖片庫</div>`,
|
|
114
|
+
{ mul: false }
|
|
115
|
+
)
|
|
116
|
+
})}"
|
|
117
|
+
>
|
|
118
|
+
<span class="tx_700" style="">選擇圖片</span>
|
|
119
|
+
</button>
|
|
120
|
+
`}
|
|
121
|
+
</div>
|
|
122
|
+
</div>`
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
})
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
(window as any).glitter.setModule(import.meta.url, ImageSelector);
|
|
@@ -17,6 +17,7 @@ import { EditorConfig } from '../../editor-config.js';
|
|
|
17
17
|
import { ApiUser } from '../../glitter-base/route/user.js';
|
|
18
18
|
import { BgWidget } from '../../backend-manager/bg-widget.js';
|
|
19
19
|
import { GlobalUser } from '../../glitter-base/global/global-user.js';
|
|
20
|
+
import { imageLibrary } from "../../modules/image-library.js";
|
|
20
21
|
export class Setting_editor {
|
|
21
22
|
static left(gvc, viewModel, createID, gBundle) {
|
|
22
23
|
const html = String.raw;
|
|
@@ -258,6 +259,15 @@ export class Setting_editor {
|
|
|
258
259
|
class="w-100 fw-500 d-flex align-items-center fs-6 hoverBtn h_item rounded px-2 tx_700 ${(_b = (_a = dd === null || dd === void 0 ? void 0 : dd.info) === null || _a === void 0 ? void 0 : _a.guideClass) !== null && _b !== void 0 ? _b : ''} ${dd.type === 'container' ? `mainRow${index}` : ''}"
|
|
259
260
|
style="gap:7px; color:#393939; ${dd.toggle ? `border-radius: 5px; background: #F2F2F2;` : ``}"
|
|
260
261
|
onclick="${gvc.event(() => __awaiter(this, void 0, void 0, function* () {
|
|
262
|
+
try {
|
|
263
|
+
if (items[parseInt(dd.index)].page === 'image_manager') {
|
|
264
|
+
imageLibrary.selectImageLibrary(gvc, (urlArray) => {
|
|
265
|
+
}, html ` <div class="d-flex flex-column" style="border-radius: 10px 10px 0px 0px;background: #F2F2F2;">圖片庫</div>`, { mul: true }, true);
|
|
266
|
+
return;
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
catch (e) {
|
|
270
|
+
}
|
|
261
271
|
gvc.glitter.setUrlParameter('page-id');
|
|
262
272
|
if (dd.type === 'container') {
|
|
263
273
|
list.forEach((item, index2) => {
|
|
@@ -1295,6 +1305,16 @@ Setting_editor.menuItems = () => {
|
|
|
1295
1305
|
groupIcon: 'https://d3jnmi1tfjgtti.cloudfront.net/file/234285319/1716654741305-Component 56 (5).svg',
|
|
1296
1306
|
moduleName: '網誌管理',
|
|
1297
1307
|
},
|
|
1308
|
+
{
|
|
1309
|
+
icon: '',
|
|
1310
|
+
page: 'image_manager',
|
|
1311
|
+
group: '品牌官網',
|
|
1312
|
+
title: '圖庫管理',
|
|
1313
|
+
appName: 'cms_system',
|
|
1314
|
+
groupIcon: 'https://d3jnmi1tfjgtti.cloudfront.net/file/234285319/1716654741305-Component 56 (5).svg',
|
|
1315
|
+
moduleName: '商店設計',
|
|
1316
|
+
guideClass: '',
|
|
1317
|
+
},
|
|
1298
1318
|
{
|
|
1299
1319
|
icon: '',
|
|
1300
1320
|
page: 'app-design',
|
|
@@ -9,6 +9,7 @@ import { EditorConfig } from '../../editor-config.js';
|
|
|
9
9
|
import { ApiUser } from '../../glitter-base/route/user.js';
|
|
10
10
|
import { BgWidget } from '../../backend-manager/bg-widget.js';
|
|
11
11
|
import { GlobalUser } from '../../glitter-base/global/global-user.js';
|
|
12
|
+
import {imageLibrary} from "../../modules/image-library.js";
|
|
12
13
|
|
|
13
14
|
export class Setting_editor {
|
|
14
15
|
static pluginUrl = '';
|
|
@@ -643,6 +644,16 @@ export class Setting_editor {
|
|
|
643
644
|
groupIcon: 'https://d3jnmi1tfjgtti.cloudfront.net/file/234285319/1716654741305-Component 56 (5).svg',
|
|
644
645
|
moduleName: '網誌管理',
|
|
645
646
|
},
|
|
647
|
+
{
|
|
648
|
+
icon: '',
|
|
649
|
+
page: 'image_manager',
|
|
650
|
+
group: '品牌官網',
|
|
651
|
+
title: '圖庫管理',
|
|
652
|
+
appName: 'cms_system',
|
|
653
|
+
groupIcon: 'https://d3jnmi1tfjgtti.cloudfront.net/file/234285319/1716654741305-Component 56 (5).svg',
|
|
654
|
+
moduleName: '商店設計',
|
|
655
|
+
guideClass: '',
|
|
656
|
+
},
|
|
646
657
|
{
|
|
647
658
|
icon: '',
|
|
648
659
|
page: 'app-design',
|
|
@@ -1008,6 +1019,22 @@ export class Setting_editor {
|
|
|
1008
1019
|
''} ${dd.type === 'container' ? `mainRow${index}` : ''}"
|
|
1009
1020
|
style="gap:7px; color:#393939; ${dd.toggle ? `border-radius: 5px; background: #F2F2F2;` : ``}"
|
|
1010
1021
|
onclick="${gvc.event(async () => {
|
|
1022
|
+
try {
|
|
1023
|
+
if(items[parseInt(dd.index)].page==='image_manager'){
|
|
1024
|
+
imageLibrary.selectImageLibrary(
|
|
1025
|
+
gvc,
|
|
1026
|
+
(urlArray) => {
|
|
1027
|
+
|
|
1028
|
+
},
|
|
1029
|
+
html` <div class="d-flex flex-column" style="border-radius: 10px 10px 0px 0px;background: #F2F2F2;">圖片庫</div>`,
|
|
1030
|
+
{ mul: true },
|
|
1031
|
+
true
|
|
1032
|
+
)
|
|
1033
|
+
return
|
|
1034
|
+
}
|
|
1035
|
+
}catch (e) {
|
|
1036
|
+
|
|
1037
|
+
}
|
|
1011
1038
|
gvc.glitter.setUrlParameter('page-id');
|
|
1012
1039
|
if (dd.type === 'container') {
|
|
1013
1040
|
list.forEach((item: any, index2: number) => {
|
|
@@ -87,7 +87,7 @@ export class imageLibrary {
|
|
|
87
87
|
const userAgent = navigator.userAgent.toLowerCase();
|
|
88
88
|
return userAgent.includes('safari') && !userAgent.includes('chrome') && !userAgent.includes('edg');
|
|
89
89
|
})();
|
|
90
|
-
BgWidget.imageLibraryDialog({
|
|
90
|
+
return BgWidget.imageLibraryDialog({
|
|
91
91
|
gvc: gvc,
|
|
92
92
|
title: cf.title,
|
|
93
93
|
innerHTML: (gvc) => {
|
|
@@ -957,7 +957,7 @@ export class imageLibrary {
|
|
|
957
957
|
});
|
|
958
958
|
}
|
|
959
959
|
if (cf.key == 'image-manager' || cf.key == 'folderEdit') {
|
|
960
|
-
if (select.length > 0) {
|
|
960
|
+
if (select.length > 0 || cf.edit_only) {
|
|
961
961
|
save(() => {
|
|
962
962
|
cf.getSelect(select);
|
|
963
963
|
gvc.closeDialog();
|
|
@@ -1133,7 +1133,7 @@ export class imageLibrary {
|
|
|
1133
1133
|
},
|
|
1134
1134
|
});
|
|
1135
1135
|
}
|
|
1136
|
-
static selectImageLibrary(gvc, callback, title, opt) {
|
|
1136
|
+
static selectImageLibrary(gvc, callback, title, opt, edit_only) {
|
|
1137
1137
|
var _a, _b, _c;
|
|
1138
1138
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1139
1139
|
let alt = '';
|
|
@@ -1203,6 +1203,7 @@ export class imageLibrary {
|
|
|
1203
1203
|
}
|
|
1204
1204
|
imageLibrary.fileSystem({
|
|
1205
1205
|
getSelect: callback,
|
|
1206
|
+
edit_only: edit_only,
|
|
1206
1207
|
gvc: gvc,
|
|
1207
1208
|
key: opt ? (_a = opt.key) !== null && _a !== void 0 ? _a : 'image-manager' : 'image-manager',
|
|
1208
1209
|
title: title,
|
|
@@ -28,6 +28,7 @@ export class imageLibrary {
|
|
|
28
28
|
plus: (gvc: GVC, callback: (file: FileItem[]) => void, fileType?: string) => void;
|
|
29
29
|
edit: (file: FileItem, callback: (file?: FileItem) => void) => void;
|
|
30
30
|
cancelEvent?: () => void;
|
|
31
|
+
edit_only?:boolean
|
|
31
32
|
}) {
|
|
32
33
|
const gvc = cf.gvc;
|
|
33
34
|
const vm: {
|
|
@@ -116,7 +117,7 @@ export class imageLibrary {
|
|
|
116
117
|
return userAgent.includes('safari') && !userAgent.includes('chrome') && !userAgent.includes('edg');
|
|
117
118
|
})();
|
|
118
119
|
|
|
119
|
-
BgWidget.imageLibraryDialog({
|
|
120
|
+
return BgWidget.imageLibraryDialog({
|
|
120
121
|
gvc: gvc,
|
|
121
122
|
title: cf.title,
|
|
122
123
|
innerHTML: (gvc: GVC) => {
|
|
@@ -1101,7 +1102,7 @@ export class imageLibrary {
|
|
|
1101
1102
|
});
|
|
1102
1103
|
}
|
|
1103
1104
|
if (cf.key == 'image-manager' || cf.key == 'folderEdit') {
|
|
1104
|
-
if (select.length > 0) {
|
|
1105
|
+
if (select.length > 0 || cf.edit_only) {
|
|
1105
1106
|
save(() => {
|
|
1106
1107
|
cf.getSelect(select);
|
|
1107
1108
|
gvc.closeDialog();
|
|
@@ -1304,7 +1305,8 @@ export class imageLibrary {
|
|
|
1304
1305
|
mul?: boolean;
|
|
1305
1306
|
tag?: string;
|
|
1306
1307
|
cancelEvent?: () => void;
|
|
1307
|
-
}
|
|
1308
|
+
},
|
|
1309
|
+
edit_only?:boolean
|
|
1308
1310
|
) {
|
|
1309
1311
|
let alt: any = '';
|
|
1310
1312
|
let saveAlt = function () {
|
|
@@ -1377,6 +1379,7 @@ export class imageLibrary {
|
|
|
1377
1379
|
|
|
1378
1380
|
imageLibrary.fileSystem({
|
|
1379
1381
|
getSelect: callback,
|
|
1382
|
+
edit_only:edit_only,
|
|
1380
1383
|
gvc: gvc,
|
|
1381
1384
|
key: opt ? opt.key ?? 'image-manager' : 'image-manager',
|
|
1382
1385
|
title: title,
|
|
@@ -6,8 +6,11 @@ export class BannerSy01 {
|
|
|
6
6
|
const pb = widget.formData.ratio.split(':').map((dd) => {
|
|
7
7
|
return parseInt(dd, 10);
|
|
8
8
|
});
|
|
9
|
+
if (typeof widget.formData.back_img === 'object') {
|
|
10
|
+
widget.formData.back_img = widget.formData.back_img.value;
|
|
11
|
+
}
|
|
9
12
|
const colors = Color.getThemeColors(obj.gvc, widget.formData.theme_color);
|
|
10
|
-
return `<div class="w-100 position-relative" style="padding-bottom: ${(pb[1] / pb[0] * 100).toFixed(0)}%;background-image: url('${widget.formData.back_img
|
|
13
|
+
return `<div class="w-100 position-relative" style="padding-bottom: ${(pb[1] / pb[0] * 100).toFixed(0)}%;background-image: url('${widget.formData.back_img}');background-position: center;background-size: cover;">
|
|
11
14
|
<div class="position-absolute w-100 h-100 " style="background: ${widget.formData.cover_color};"></div>
|
|
12
15
|
<div class="position-absolute w-100 h-100 d-flex align-items-center" style="position: relative;z-index: 2;${document.body.clientWidth < 800 ? `padding: 20px;` : `padding-left: 150px;`}">
|
|
13
16
|
<div class="d-flex flex-column position-relative" style="gap:12px;width: 623px;max-width: 100%;">
|
|
@@ -13,9 +13,11 @@ export class BannerSy01 {
|
|
|
13
13
|
const pb = widget.formData.ratio.split(':').map((dd: any) => {
|
|
14
14
|
return parseInt(dd, 10)
|
|
15
15
|
});
|
|
16
|
-
|
|
16
|
+
if(typeof widget.formData.back_img==='object'){
|
|
17
|
+
widget.formData.back_img=widget.formData.back_img.value
|
|
18
|
+
}
|
|
17
19
|
const colors = Color.getThemeColors(obj.gvc, widget.formData.theme_color);
|
|
18
|
-
return `<div class="w-100 position-relative" style="padding-bottom: ${(pb[1] / pb[0] * 100).toFixed(0)}%;background-image: url('${widget.formData.back_img
|
|
20
|
+
return `<div class="w-100 position-relative" style="padding-bottom: ${(pb[1] / pb[0] * 100).toFixed(0)}%;background-image: url('${widget.formData.back_img}');background-position: center;background-size: cover;">
|
|
19
21
|
<div class="position-absolute w-100 h-100 " style="background: ${widget.formData.cover_color};"></div>
|
|
20
22
|
<div class="position-absolute w-100 h-100 d-flex align-items-center" style="position: relative;z-index: 2;${document.body.clientWidth < 800 ? `padding: 20px;`:`padding-left: 150px;`}">
|
|
21
23
|
<div class="d-flex flex-column position-relative" style="gap:12px;width: 623px;max-width: 100%;">
|