ts-glitter 13.9.5 → 13.9.7

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 CHANGED
@@ -70,7 +70,7 @@ export class Entry {
70
70
  }
71
71
  window.renderClock = (_a = window.renderClock) !== null && _a !== void 0 ? _a : clockF();
72
72
  console.log(`Entry-time:`, window.renderClock.stop());
73
- glitter.share.editerVersion = 'V_13.9.5';
73
+ glitter.share.editerVersion = 'V_13.9.7';
74
74
  glitter.share.start = new Date();
75
75
  const vm = {
76
76
  appConfig: [],
package/lowcode/Entry.ts CHANGED
@@ -72,7 +72,7 @@ export class Entry {
72
72
  }
73
73
  (window as any).renderClock = (window as any).renderClock ?? clockF();
74
74
  console.log(`Entry-time:`, (window as any).renderClock.stop());
75
- glitter.share.editerVersion = 'V_13.9.5';
75
+ glitter.share.editerVersion = 'V_13.9.7';
76
76
  glitter.share.start = new Date();
77
77
  const vm: {
78
78
  appConfig: any;
@@ -234,8 +234,13 @@ export class BgWidget {
234
234
  return html `<div
235
235
  class="bt_orange_lin"
236
236
  onclick="${obj.gvc.event(() => {
237
- window.parent.glitter.share.ai_message.vm.select_bt = obj.select;
238
- window.parent.glitter.share.ai_message.toggle(true);
237
+ if (obj.click) {
238
+ obj.click && obj.click();
239
+ }
240
+ else {
241
+ window.parent.glitter.share.ai_message.vm.select_bt = obj.select;
242
+ window.parent.glitter.share.ai_message.toggle(true);
243
+ }
239
244
  })}"
240
245
  >
241
246
  <img
@@ -2687,7 +2692,7 @@ ${(_c = obj.default) !== null && _c !== void 0 ? _c : ''}</textarea
2687
2692
  }
2688
2693
  return html ` <div class="bg-white shadow rounded-3" style="width: 100%; max-height: 100%; overflow-y: auto; position: relative;">
2689
2694
  <div class="w-100 d-flex align-items-center p-3 border-bottom" style="position: sticky; top: 0; z-index: 2; background: #fff;">
2690
- <div class="tx_700">${(_b = obj.title) !== null && _b !== void 0 ? _b : '產品列表'}</div>
2695
+ <div class="tx_700">${(typeof obj.title === 'function') ? obj.title(gvc) : ((_b = obj.title) !== null && _b !== void 0 ? _b : '產品列表')}</div>
2691
2696
  <div class="flex-fill"></div>
2692
2697
  <i
2693
2698
  class="fa-regular fa-circle-xmark fs-5 text-dark cursor_pointer"
@@ -316,7 +316,7 @@ export class BgWidget {
316
316
  </div>`;
317
317
  }
318
318
 
319
- static aiChatButton(obj: { gvc: GVC; select: 'writer' | 'order_analysis' | 'operation_guide'; title?: string }) {
319
+ static aiChatButton(obj: { gvc: GVC; select: 'writer' | 'order_analysis' | 'operation_guide'; title?: string ,click?:()=>void}) {
320
320
  const text =
321
321
  obj.title ??
322
322
  (() => {
@@ -333,8 +333,12 @@ export class BgWidget {
333
333
  return html`<div
334
334
  class="bt_orange_lin"
335
335
  onclick="${obj.gvc.event(() => {
336
- (window.parent as any).glitter.share.ai_message.vm.select_bt = obj.select;
337
- (window.parent as any).glitter.share.ai_message.toggle(true);
336
+ if(obj.click){
337
+ obj.click && obj.click()
338
+ }else{
339
+ (window.parent as any).glitter.share.ai_message.vm.select_bt = obj.select;
340
+ (window.parent as any).glitter.share.ai_message.toggle(true);
341
+ }
338
342
  })}"
339
343
  >
340
344
  <img
@@ -3125,7 +3129,7 @@ ${obj.default ?? ''}</textarea
3125
3129
  }, obj.timeout ?? 2000);
3126
3130
  }
3127
3131
 
3128
- static fullDialog(obj: { gvc: GVC; title: string; width?: number; height?: number; innerHTML: (gvc: GVC) => string; footer_html: (gvc: GVC) => string; closeCallback?: () => void }) {
3132
+ static fullDialog(obj: { gvc: GVC; title: string | ((data:GVC)=>string); width?: number; height?: number; innerHTML: (gvc: GVC) => string; footer_html: (gvc: GVC) => string; closeCallback?: () => void }) {
3129
3133
  const glitter = (() => {
3130
3134
  let glitter = obj.gvc.glitter;
3131
3135
  if (glitter.getUrlParameter('cms') === 'true' || glitter.getUrlParameter('type') === 'htmlEditor') {
@@ -3154,7 +3158,7 @@ ${obj.default ?? ''}</textarea
3154
3158
  }
3155
3159
  return html` <div class="bg-white shadow rounded-3" style="width: 100%; max-height: 100%; overflow-y: auto; position: relative;">
3156
3160
  <div class="w-100 d-flex align-items-center p-3 border-bottom" style="position: sticky; top: 0; z-index: 2; background: #fff;">
3157
- <div class="tx_700">${obj.title ?? '產品列表'}</div>
3161
+ <div class="tx_700">${(typeof obj.title==='function') ? obj.title(gvc):(obj.title ?? '產品列表')}</div>
3158
3162
  <div class="flex-fill"></div>
3159
3163
  <i
3160
3164
  class="fa-regular fa-circle-xmark fs-5 text-dark cursor_pointer"
@@ -21,7 +21,7 @@ export class ProductAi {
21
21
  `<div class="w-100 d-flex align-items-center justify-content-center my-3">${BgWidget.grayNote('透過 AI 可以幫你新增或調整商品內容', `font-weight: 500;`)}</div>`,
22
22
  html `
23
23
  <div class="w-100" ">
24
- ${BgWidget.textArea({
24
+ ${BgWidget.textArea({
25
25
  gvc: gvc,
26
26
  title: '',
27
27
  default: message,
@@ -117,6 +117,76 @@ ${BgWidget.save(gvc.event(() => {
117
117
  width: 500
118
118
  });
119
119
  }
120
+ static generateRichText(gvc, callback) {
121
+ const dialog = new ShareDialog(gvc.glitter);
122
+ BgWidget.settingDialog({
123
+ gvc: gvc,
124
+ title: 'AI 商品生成',
125
+ innerHTML: (gvc) => {
126
+ const html = String.raw;
127
+ let message = '';
128
+ return html `
129
+ <div class="">
130
+ ${[
131
+ html `
132
+ <lottie-player src="${gvc.glitter.root_path}lottie/ai.json" class="mx-auto my-n4"
133
+ speed="1"
134
+ style="max-width: 100%;width: 250px;height:250px;" loop
135
+ autoplay></lottie-player>`,
136
+ `<div class="w-100 d-flex align-items-center justify-content-center my-3">${BgWidget.grayNote('透過 AI 可以幫你生成商品描述', `font-weight: 500;`)}</div>`,
137
+ html `
138
+ <div class="w-100" ">
139
+ ${BgWidget.textArea({
140
+ gvc: gvc,
141
+ title: '',
142
+ default: message,
143
+ placeHolder: `幫我生成一個有關保健食品4*3的表格`,
144
+ callback: (text) => {
145
+ message = text;
146
+ },
147
+ style: `min-height:100px;`
148
+ })}
149
+ </div>`,
150
+ html `
151
+ <div class="w-100 d-flex align-items-center justify-content-end">
152
+ ${BgWidget.save(gvc.event(() => {
153
+ const dialog = new ShareDialog(gvc.glitter);
154
+ dialog.dataLoading({ visible: true });
155
+ AiChat.generateHtml({
156
+ token: window.parent.saasConfig.config.token,
157
+ app_name: window.parent.appName,
158
+ text: message
159
+ }).then((res) => {
160
+ if (res.result && res.response.data.usage === 0) {
161
+ dialog.dataLoading({ visible: false });
162
+ dialog.errorMessage({ text: `很抱歉你的AI代幣不足,請先前往加值` });
163
+ }
164
+ else if (res.result && (!res.response.data.obj.result)) {
165
+ dialog.dataLoading({ visible: false });
166
+ dialog.errorMessage({ text: `AI無法理解你的需求,請給出具體一點的描述` });
167
+ }
168
+ else if (!res.result) {
169
+ dialog.dataLoading({ visible: false });
170
+ dialog.errorMessage({ text: `發生錯誤` });
171
+ }
172
+ else {
173
+ callback(res.response.data.obj.html);
174
+ dialog.dataLoading({ visible: false });
175
+ dialog.successMessage({ text: `AI生成完畢,使用了『${res.response.data.usage}』點 AI Points.` });
176
+ gvc.closeDialog();
177
+ }
178
+ });
179
+ }), "確認生成", "w-100 mt-3 py-2")}
180
+ </div>`
181
+ ].join('<div class="my-2"></div>')}
182
+ </div>`;
183
+ },
184
+ footer_html: (gvc) => {
185
+ return ``;
186
+ },
187
+ width: 500
188
+ });
189
+ }
120
190
  }
121
191
  ProductAi.schema = {
122
192
  "name": "html_element_modification",
@@ -4,9 +4,10 @@ import {ApiUser} from "../../glitter-base/route/user.js";
4
4
  import {AiPointsApi} from "../../glitter-base/route/ai-points-api.js";
5
5
  import {ShareDialog} from "../../glitterBundle/dialog/ShareDialog.js";
6
6
  import {AiChat} from "../../glitter-base/route/ai-chat.js";
7
+ import {AddComponent} from "../../editor/add-component.js";
7
8
 
8
9
  export class ProductAi {
9
- public static schema={
10
+ public static schema = {
10
11
  "name": "html_element_modification",
11
12
  "strict": true,
12
13
  "schema": {
@@ -115,7 +116,8 @@ export class ProductAi {
115
116
  "additionalProperties": false
116
117
  }
117
118
  }
118
- public static setProduct(gvc: GVC,product_data:any,refresh:()=>void) {
119
+
120
+ public static setProduct(gvc: GVC, product_data: any, refresh: () => void) {
119
121
  const dialog = new ShareDialog(gvc.glitter)
120
122
  BgWidget.settingDialog({
121
123
  gvc: gvc,
@@ -134,58 +136,58 @@ export class ProductAi {
134
136
  `<div class="w-100 d-flex align-items-center justify-content-center my-3">${BgWidget.grayNote('透過 AI 可以幫你新增或調整商品內容', `font-weight: 500;`)}</div>`,
135
137
  html`
136
138
  <div class="w-100" ">
137
- ${BgWidget.textArea({
138
- gvc: gvc,
139
- title: '',
140
- default: message,
141
- placeHolder: `商品標題為Adidas衣服,規格有顏色和尺寸,其中有紅藍黃三種顏色,尺寸有S,M,L三種尺寸,紅色S號的販售價格為2000,紅色M號的價格為1500,其餘販售價格為1000元。`,
142
- callback: (text) => {
143
- message = text;
144
- },
145
- style: `min-height:100px;`
146
- })}
139
+ ${BgWidget.textArea({
140
+ gvc: gvc,
141
+ title: '',
142
+ default: message,
143
+ placeHolder: `商品標題為Adidas衣服,規格有顏色和尺寸,其中有紅藍黃三種顏色,尺寸有S,M,L三種尺寸,紅色S號的販售價格為2000,紅色M號的價格為1500,其餘販售價格為1000元。`,
144
+ callback: (text) => {
145
+ message = text;
146
+ },
147
+ style: `min-height:100px;`
148
+ })}
147
149
  </div>`,
148
150
  `<div class="w-100 d-flex align-items-center justify-content-end">
149
151
  ${BgWidget.save(gvc.event(() => {
150
- const dialog=new ShareDialog(gvc.glitter)
151
- dialog.dataLoading({visible:true})
152
+ const dialog = new ShareDialog(gvc.glitter)
153
+ dialog.dataLoading({visible: true})
152
154
  AiChat.editorHtml({
153
155
  text: message,
154
156
  format: ProductAi.schema,
155
- assistant:`你是後台商品上架小幫手,幫我過濾出要調整的項目和內容,另外一點請你非常注意,variants中的規格標題不要包含規格單位,像是『顏色:灰色,尺寸:XS』這樣是錯誤的,請顯示成這樣這樣就好["灰色","XS"]`,
156
- token:(window.parent as any).saasConfig.config.token
157
- }).then((res)=>{
158
- dialog.dataLoading({visible:false})
159
- const obj=res.response.data && res.response.data.obj
160
- if(obj){
161
- const usage=res.response.data.usage
162
- if(usage){
157
+ assistant: `你是後台商品上架小幫手,幫我過濾出要調整的項目和內容,另外一點請你非常注意,variants中的規格標題不要包含規格單位,像是『顏色:灰色,尺寸:XS』這樣是錯誤的,請顯示成這樣這樣就好["灰色","XS"]`,
158
+ token: (window.parent as any).saasConfig.config.token
159
+ }).then((res) => {
160
+ dialog.dataLoading({visible: false})
161
+ const obj = res.response.data && res.response.data.obj
162
+ if (obj) {
163
+ const usage = res.response.data.usage
164
+ if (usage) {
163
165
  //替換標題
164
- (obj.name) && (product_data.title=obj.name);
166
+ (obj.name) && (product_data.title = obj.name);
165
167
  //替換內文
166
- (obj.content) && (product_data.content=obj.content);
168
+ (obj.content) && (product_data.content = obj.content);
167
169
  //替換規格列表
168
- if(obj.spec_define && obj.spec_define.length>1){
169
- product_data.specs = obj.spec_define.map((dd:any)=>{
170
- return {
170
+ if (obj.spec_define && obj.spec_define.length > 1) {
171
+ product_data.specs = obj.spec_define.map((dd: any) => {
172
+ return {
171
173
  "title": dd.value,
172
- "option": dd.spec_define.map((dd:any)=>{
173
- return {
174
+ "option": dd.spec_define.map((dd: any) => {
175
+ return {
174
176
  "title": dd.value
175
177
  }
176
178
  })
177
179
  }
178
180
  })
179
-
181
+
180
182
  }
181
183
  //變體列表
182
- if(obj.spec && obj.spec.length){
183
- product_data.variants=obj.spec.map((dd:any)=>{
184
+ if (obj.spec && obj.spec.length) {
185
+ product_data.variants = obj.spec.map((dd: any) => {
184
186
  return {
185
187
  "sku": "",
186
188
  "cost": 0,
187
- "spec": (obj.spec.length===1) ? []:dd.value.map((dd:any)=>{
188
- if(dd.value.includes(':')){
189
+ "spec": (obj.spec.length === 1) ? [] : dd.value.map((dd: any) => {
190
+ if (dd.value.includes(':')) {
189
191
  return dd.value.split(':')[1]
190
192
  }
191
193
  return dd.value
@@ -200,7 +202,7 @@ ${BgWidget.save(gvc.event(() => {
200
202
  "v_height": 0,
201
203
  "v_length": 0,
202
204
  "sale_price": dd.sale_price,
203
- "compare_price": (dd.original_price === dd.sale_price) ? 0:dd.original_price,
205
+ "compare_price": (dd.original_price === dd.sale_price) ? 0 : dd.original_price,
204
206
  "preview_image": "",
205
207
  "shipment_type": "weight",
206
208
  "shipment_weight": 0,
@@ -209,21 +211,21 @@ ${BgWidget.save(gvc.event(() => {
209
211
  })
210
212
  }
211
213
  //seo_title
212
- (obj.seo_title) && (product_data.seo.title=obj.seo_title);
214
+ (obj.seo_title) && (product_data.seo.title = obj.seo_title);
213
215
  //seo_content
214
- (obj.seo_content) && (product_data.seo.content=obj.seo_content);
216
+ (obj.seo_content) && (product_data.seo.content = obj.seo_content);
215
217
  //ai描述語句
216
- obj.ai_description && (product_data.ai_description=obj.ai_description);
218
+ obj.ai_description && (product_data.ai_description = obj.ai_description);
217
219
  //
218
- console.log(`obj.ai_description==>`,obj.ai_description)
219
- dialog.successMessage({text:`生成成功,消耗了『${usage}』點 AI-Points`})
220
+ console.log(`obj.ai_description==>`, obj.ai_description)
221
+ dialog.successMessage({text: `生成成功,消耗了『${usage}』點 AI-Points`})
220
222
  refresh()
221
223
  gvc.closeDialog()
222
- }else{
223
- dialog.errorMessage({text:'AI Points 點數不足'})
224
+ } else {
225
+ dialog.errorMessage({text: 'AI Points 點數不足'})
224
226
  }
225
- }else{
226
- dialog.errorMessage({text:'發生錯誤'})
227
+ } else {
228
+ dialog.errorMessage({text: '發生錯誤'})
227
229
  }
228
230
  })
229
231
  }), "確認生成", "w-100 mt-3 py-2")}
@@ -234,7 +236,76 @@ ${BgWidget.save(gvc.event(() => {
234
236
  footer_html: (gvc: GVC) => {
235
237
  return ``
236
238
  },
237
- width:500
239
+ width: 500
240
+ });
241
+ }
242
+
243
+ public static generateRichText(gvc: GVC, callback: (text:string) => void) {
244
+ const dialog = new ShareDialog(gvc.glitter)
245
+ BgWidget.settingDialog({
246
+ gvc: gvc,
247
+ title: 'AI 商品生成',
248
+ innerHTML: (gvc: GVC) => {
249
+ const html = String.raw
250
+ let message = ''
251
+ return html`
252
+ <div class="">
253
+ ${[
254
+ html`
255
+ <lottie-player src="${gvc.glitter.root_path}lottie/ai.json" class="mx-auto my-n4"
256
+ speed="1"
257
+ style="max-width: 100%;width: 250px;height:250px;" loop
258
+ autoplay></lottie-player>`,
259
+ `<div class="w-100 d-flex align-items-center justify-content-center my-3">${BgWidget.grayNote('透過 AI 可以幫你生成商品描述', `font-weight: 500;`)}</div>`,
260
+ html`
261
+ <div class="w-100" ">
262
+ ${BgWidget.textArea({
263
+ gvc: gvc,
264
+ title: '',
265
+ default: message,
266
+ placeHolder: `幫我生成一個有關保健食品4*3的表格`,
267
+ callback: (text) => {
268
+ message = text;
269
+ },
270
+ style: `min-height:100px;`
271
+ })}
272
+ </div>`,
273
+ html`
274
+ <div class="w-100 d-flex align-items-center justify-content-end">
275
+ ${BgWidget.save(gvc.event(() => {
276
+ const dialog = new ShareDialog(gvc.glitter)
277
+ dialog.dataLoading({visible: true})
278
+ AiChat.generateHtml({
279
+ token:(window.parent as any).saasConfig.config.token,
280
+ app_name: (window.parent as any).appName,
281
+ text: message
282
+ }).then((res) => {
283
+ if (res.result && res.response.data.usage === 0) {
284
+ dialog.dataLoading({visible: false})
285
+ dialog.errorMessage({text: `很抱歉你的AI代幣不足,請先前往加值`})
286
+ } else if (res.result && (!res.response.data.obj.result)) {
287
+ dialog.dataLoading({visible: false})
288
+ dialog.errorMessage({text: `AI無法理解你的需求,請給出具體一點的描述`})
289
+ } else if (!res.result) {
290
+ dialog.dataLoading({visible: false})
291
+ dialog.errorMessage({text: `發生錯誤`})
292
+ } else {
293
+ callback(res.response.data.obj.html)
294
+ dialog.dataLoading({visible: false})
295
+ dialog.successMessage({text: `AI生成完畢,使用了『${res.response.data.usage}』點 AI Points.`})
296
+ gvc.closeDialog()
297
+
298
+ }
299
+ })
300
+ }), "確認生成", "w-100 mt-3 py-2")}
301
+ </div>`
302
+ ].join('<div class="my-2"></div>')}
303
+ </div>`
304
+ },
305
+ footer_html: (gvc: GVC) => {
306
+ return ``
307
+ },
308
+ width: 500
238
309
  });
239
310
  }
240
311
  }
@@ -2177,10 +2177,6 @@ export class ShoppingProductSetting {
2177
2177
  <div style="color: #393939; font-weight: 700;">
2178
2178
  商品描述
2179
2179
  </div>
2180
- ${BgWidget.aiChatButton({
2181
- gvc,
2182
- select: 'writer',
2183
- })}
2184
2180
  </div>
2185
2181
  <div class="flex-fill"></div>
2186
2182
  <div
@@ -2323,7 +2319,19 @@ export class ShoppingProductSetting {
2323
2319
  const originContent = `${postMD.content}`;
2324
2320
  BgWidget.fullDialog({
2325
2321
  gvc: gvc,
2326
- title: '商品描述',
2322
+ title: (gvc2) => {
2323
+ return `<div class="d-flex align-items-center me-2" style="gap:10px;">商品描述${BgWidget.aiChatButton({
2324
+ gvc: gvc2,
2325
+ select: 'writer',
2326
+ click: () => {
2327
+ ProductAi.generateRichText(gvc, (text) => {
2328
+ postMD.content += text;
2329
+ gvc.notifyDataChange(vm.id);
2330
+ gvc2.recreateView();
2331
+ });
2332
+ }
2333
+ })}</div>`;
2334
+ },
2327
2335
  innerHTML: (gvc2) => {
2328
2336
  return html `
2329
2337
  <div>
@@ -2591,10 +2591,6 @@ export class ShoppingProductSetting {
2591
2591
  <div style="color: #393939; font-weight: 700;">
2592
2592
  商品描述
2593
2593
  </div>
2594
- ${BgWidget.aiChatButton({
2595
- gvc,
2596
- select: 'writer',
2597
- })}
2598
2594
  </div>
2599
2595
  <div class="flex-fill"></div>
2600
2596
  <div
@@ -2747,7 +2743,19 @@ export class ShoppingProductSetting {
2747
2743
  const originContent = `${postMD.content}`;
2748
2744
  BgWidget.fullDialog({
2749
2745
  gvc: gvc,
2750
- title: '商品描述',
2746
+ title: (gvc2)=>{
2747
+ return `<div class="d-flex align-items-center me-2" style="gap:10px;">商品描述${BgWidget.aiChatButton({
2748
+ gvc:gvc2,
2749
+ select: 'writer',
2750
+ click:()=>{
2751
+ ProductAi.generateRichText(gvc,(text)=>{
2752
+ postMD.content+=text;
2753
+ gvc.notifyDataChange(vm.id)
2754
+ gvc2.recreateView()
2755
+ })
2756
+ }
2757
+ })}</div>`
2758
+ },
2751
2759
  innerHTML: (gvc2) => {
2752
2760
  return html`
2753
2761
  <div>
@@ -32,7 +32,7 @@ export class AiChat {
32
32
  "headers": {
33
33
  "Content-Type": "application/json",
34
34
  "g-app": json.app_name || getConfig().config.appName,
35
- "Authorization": GlobalUser.token
35
+ "Authorization": json.token || GlobalUser.token
36
36
  },
37
37
  "data": JSON.stringify(json)
38
38
  });
@@ -35,7 +35,8 @@ export class AiChat{
35
35
  }
36
36
 
37
37
  public static generateHtml(json: { app_name?:string,
38
- text:string
38
+ text:string,
39
+ token?:string
39
40
  }) {
40
41
  return BaseApi.create({
41
42
  "url": getBaseUrl() + `/api-public/v1/ai/generate-html`,
@@ -43,7 +44,7 @@ export class AiChat{
43
44
  "headers": {
44
45
  "Content-Type": "application/json",
45
46
  "g-app": json.app_name || getConfig().config.appName,
46
- "Authorization": GlobalUser.token
47
+ "Authorization": json.token || GlobalUser.token
47
48
  },
48
49
  "data":JSON.stringify(json)
49
50
  })
@@ -87,6 +87,7 @@ export class ProductDetail {
87
87
  <span class="mt-3">載入中</span>
88
88
  </div>`;
89
89
  }
90
+ gvc.glitter.addStyleLink(['https://cdn.jsdelivr.net/npm/froala-editor@latest/css/froala_editor.pkgd.min.css']);
90
91
  return gvc.bindView({
91
92
  bind: ids.page,
92
93
  view: () => {
@@ -191,6 +192,7 @@ export class ProductDetail {
191
192
  },
192
193
  divCreate: {
193
194
  style: document.body.clientWidth > 768 ? 'margin: 0 240px;' : '',
195
+ class: `fr-view`
194
196
  },
195
197
  })}
196
198
  </div>
@@ -229,7 +231,8 @@ export class ProductDetail {
229
231
  </div>
230
232
  </div>
231
233
  <div class="w-100 d-flex align-items-center justify-content-center py-3 py-sm-4">
232
- <div class="" style="${((product.length < glitter.ut.frSize({
234
+ <div class=""
235
+ style="${((product.length < glitter.ut.frSize({
233
236
  sm: 4,
234
237
  lg: 6
235
238
  }, 2))) ? `width:${200 * product.length}px;` : `width:100%;`}">
@@ -237,23 +240,23 @@ export class ProductDetail {
237
240
  <div class="swiper-wrapper">
238
241
  ${product.map((dd, index) => {
239
242
  return html `
240
- <div class="swiper-slide"
241
- style="width:100%;height: 350px;"
242
- >
243
- ${glitter.htmlGenerate.renderComponent({
243
+ <div class="swiper-slide"
244
+ style="width:100%;height: 350px;"
245
+ >
246
+ ${glitter.htmlGenerate.renderComponent({
244
247
  appName: window.appName,
245
248
  tag: 'product_widget',
246
249
  gvc: gvc,
247
250
  subData: dd,
248
251
  })}
249
- </div>`;
252
+ </div>`;
250
253
  }).join('')}
251
254
  </div>
252
255
  </div>
253
256
  </div>
254
257
  </div>
255
-
256
-
258
+
259
+
257
260
  `);
258
261
  }));
259
262
  }),
@@ -95,6 +95,7 @@ export class ProductDetail {
95
95
  </div>`;
96
96
  }
97
97
 
98
+ gvc.glitter.addStyleLink(['https://cdn.jsdelivr.net/npm/froala-editor@latest/css/froala_editor.pkgd.min.css'])
98
99
  return gvc.bindView({
99
100
  bind: ids.page,
100
101
  view: () => {
@@ -210,6 +211,7 @@ export class ProductDetail {
210
211
  },
211
212
  divCreate: {
212
213
  style: document.body.clientWidth > 768 ? 'margin: 0 240px;' : '',
214
+ class: `fr-view`
213
215
  },
214
216
  })}
215
217
  </div>
@@ -226,19 +228,19 @@ export class ProductDetail {
226
228
  page: 0,
227
229
  id_list: prod.relative_product.join(',')
228
230
  })).response.data;
229
- setTimeout(()=>{
231
+ setTimeout(() => {
230
232
  //@ts-ignore
231
233
  var swiper = new Swiper("#" + swipID, {
232
234
  slidesPerView: glitter.ut.frSize({
233
- sm:(product.length<4) ? product.length:4,
234
- lg:(product.length<6) ? product.length:6
235
- },(product.length<2) ? product.length:2),
235
+ sm: (product.length < 4) ? product.length : 4,
236
+ lg: (product.length < 6) ? product.length : 6
237
+ }, (product.length < 2) ? product.length : 2),
236
238
  spaceBetween: glitter.ut.frSize({
237
- sm:10,
238
- lg:30
239
- },10)
239
+ sm: 10,
240
+ lg: 30
241
+ }, 10)
240
242
  });
241
- },100)
243
+ }, 100)
242
244
  resolve(html`
243
245
  <div class="w-100 d-flex align-items-center justify-content-center ">
244
246
  <div class="mx-auto"
@@ -250,32 +252,33 @@ export class ProductDetail {
250
252
  </div>
251
253
  </div>
252
254
  <div class="w-100 d-flex align-items-center justify-content-center py-3 py-sm-4">
253
- <div class="" style="${((product.length<glitter.ut.frSize({
254
- sm:4,
255
- lg:6
256
- },2))) ? `width:${200 * product.length}px;`:`width:100%;`}">
255
+ <div class=""
256
+ style="${((product.length < glitter.ut.frSize({
257
+ sm: 4,
258
+ lg: 6
259
+ }, 2))) ? `width:${200 * product.length}px;` : `width:100%;`}">
257
260
  <div class="swiper w-100" style="" id="${swipID}">
258
261
  <div class="swiper-wrapper">
259
262
  ${product.map((dd: any, index: number) => {
260
263
  return html`
261
- <div class="swiper-slide"
262
- style="width:100%;height: 350px;"
263
- >
264
- ${glitter.htmlGenerate.renderComponent({
264
+ <div class="swiper-slide"
265
+ style="width:100%;height: 350px;"
266
+ >
267
+ ${glitter.htmlGenerate.renderComponent({
265
268
 
266
- appName: (window as any).appName,
267
- tag: 'product_widget',
268
- gvc: gvc,
269
- subData: dd,
270
- })}
271
- </div>`
269
+ appName: (window as any).appName,
270
+ tag: 'product_widget',
271
+ gvc: gvc,
272
+ subData: dd,
273
+ })}
274
+ </div>`
272
275
  }).join('')}
273
276
  </div>
274
277
  </div>
275
278
  </div>
276
279
  </div>
277
-
278
-
280
+
281
+
279
282
  `)
280
283
  })
281
284
  },
@@ -283,7 +286,7 @@ export class ProductDetail {
283
286
  class: `w-100`
284
287
  },
285
288
  onCreate: () => {
286
-
289
+
287
290
  }
288
291
  }
289
292
  })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ts-glitter",
3
- "version": "13.9.5",
3
+ "version": "13.9.7",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {