ts-glitter 13.8.3 → 13.8.31

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
@@ -52,6 +52,9 @@ export class Entry {
52
52
  .hide-elem {
53
53
  display: none !important;
54
54
  }
55
+ .hy-drawer-left {
56
+ left:-1000px !important;
57
+ }
55
58
  `);
56
59
  if (glitter.getUrlParameter('appName')) {
57
60
  window.appName = glitter.getUrlParameter('appName');
@@ -59,7 +62,7 @@ export class Entry {
59
62
  }
60
63
  window.renderClock = (_a = window.renderClock) !== null && _a !== void 0 ? _a : clockF();
61
64
  console.log(`Entry-time:`, window.renderClock.stop());
62
- glitter.share.editerVersion = "V_13.8.3";
65
+ glitter.share.editerVersion = "V_13.8.31";
63
66
  glitter.share.start = (new Date());
64
67
  const vm = {
65
68
  appConfig: [],
package/lowcode/Entry.ts CHANGED
@@ -52,6 +52,9 @@ export class Entry {
52
52
  .hide-elem {
53
53
  display: none !important;
54
54
  }
55
+ .hy-drawer-left {
56
+ left:-1000px !important;
57
+ }
55
58
  `);
56
59
  if (glitter.getUrlParameter('appName')) {
57
60
  (window as any).appName = glitter.getUrlParameter('appName');
@@ -59,7 +62,7 @@ export class Entry {
59
62
  }
60
63
  (window as any).renderClock = (window as any).renderClock ?? clockF();
61
64
  console.log(`Entry-time:`, (window as any).renderClock.stop());
62
- glitter.share.editerVersion = "V_13.8.3";
65
+ glitter.share.editerVersion = "V_13.8.31";
63
66
  glitter.share.start = (new Date());
64
67
  const vm: {
65
68
  appConfig: any;
@@ -14,90 +14,58 @@ import { AiChat } from '../glitter-base/route/ai-chat.js';
14
14
  import { ShareDialog } from '../glitterBundle/dialog/ShareDialog.js';
15
15
  import { AiPointsApi } from "../glitter-base/route/ai-points-api.js";
16
16
  export class AiMessage {
17
- static aiRobot(cf) {
18
- const gvc = cf.gvc;
19
- const html = String.raw;
20
- cf.userID = `${cf.userID}`;
21
- const chatID = [cf.userID, cf.toUser || 'manager'].sort().join('-');
22
- const vm = {
23
- visible: false,
24
- id: gvc.glitter.getUUID(),
25
- };
26
- return gvc.bindView(() => {
27
- AiMessage.toggle = (vis, option) => {
28
- if (!option) {
29
- AiMessage.ai_support = [
30
- {
31
- key: 'writer',
32
- label: '文案寫手',
33
- },
34
- {
35
- key: 'order_analysis',
36
- label: '訂單分析',
37
- },
38
- {
39
- key: 'design',
40
- label: '圖片生成',
41
- },
42
- {
43
- key: 'operation_guide',
44
- label: '操作引導',
45
- }
46
- ];
47
- }
48
- else {
49
- AiMessage.ai_support = option;
17
+ static setDrawer(gvc, option) {
18
+ if (!option) {
19
+ AiMessage.ai_support = [
20
+ {
21
+ key: 'writer',
22
+ label: '文案寫手',
23
+ },
24
+ {
25
+ key: 'order_analysis',
26
+ label: '訂單分析',
27
+ },
28
+ {
29
+ key: 'design',
30
+ label: '圖片生成',
31
+ },
32
+ {
33
+ key: 'operation_guide',
34
+ label: '操作引導',
50
35
  }
51
- vm.visible = vis;
52
- $(document.querySelector('.ai-left')).addClass(`scroll-out`);
53
- setTimeout(() => {
54
- gvc.notifyDataChange(vm.id);
55
- }, 250);
56
- };
57
- return {
58
- bind: vm.id,
59
- view: () => {
60
- if (!vm.visible) {
61
- return ``;
62
- }
63
- return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
64
- resolve(html `
65
- <div
36
+ ];
37
+ }
38
+ else {
39
+ AiMessage.ai_support = option;
40
+ }
41
+ gvc.glitter.setDrawer(`<div
66
42
  class="position-fixed start-0 top-0 vw-100 vh-100"
67
43
  style="background: rgba(0,0,0,0.5);z-index:999;"
68
44
  onclick="${gvc.event(() => {
69
- AiMessage.toggle(false);
70
- })}"
45
+ gvc.glitter.closeDrawer();
46
+ })}"
71
47
  >
72
48
  <div
73
49
  class="position-fixed vh-100 top-0 scroll-in bg-white ai-left"
74
50
  style="top:0px;width: 500px;height: 100vh;max-width: 100vw;"
75
51
  onclick="${gvc.event((e, event) => {
76
- event.stopPropagation();
77
- })}"
52
+ event.stopPropagation();
53
+ })}"
78
54
  >
79
55
  ${AiMessage.detail({
80
- gvc: gvc,
81
- user_id: cf.userID,
82
- containerHeight: $('body').height() + 10 + 'px',
83
- document: document,
84
- goBack: () => {
85
- },
86
- close: () => {
87
- AiMessage.toggle(false);
88
- },
89
- })}
56
+ gvc: gvc,
57
+ user_id: 'manager',
58
+ containerHeight: $('body').height() + 10 + 'px',
59
+ document: document,
60
+ goBack: () => {
61
+ },
62
+ close: () => {
63
+ gvc.glitter.closeDrawer();
64
+ },
65
+ })}
90
66
  </div>
91
- </div>`);
92
- }));
93
- },
94
- divCreate: {
95
- elem: 'div',
96
- style: `z-index:99999;bottom:0px;left:0px;`,
97
- },
98
- onCreate: () => __awaiter(this, void 0, void 0, function* () {
99
- }),
100
- };
67
+ </div>`, () => {
68
+ gvc.glitter.openDrawer((document.body.clientWidth > 768) ? 500 : document.body.clientWidth);
101
69
  });
102
70
  }
103
71
  static detail(cf) {
@@ -827,7 +795,5 @@ AiMessage.vm = {
827
795
  select_bt: 'writer',
828
796
  };
829
797
  AiMessage.id = `dsmdklweew3`;
830
- AiMessage.toggle = (visible) => {
831
- };
832
798
  AiMessage.ai_support = [];
833
799
  window.glitter.setModule(import.meta.url, AiMessage);
@@ -26,109 +26,66 @@ export class AiMessage {
26
26
  select_bt: 'writer',
27
27
  };
28
28
 
29
- public static id = `dsmdklweew3`;
30
-
31
- public static toggle: (visible: boolean, option?: { key: string, label: string }[]) => void = (visible) => {
32
- };
33
-
34
- public static ai_support: { key: string, label: string }[] = []
35
29
 
36
- public static aiRobot(cf: {
37
- gvc: GVC;
38
- userID: string;
39
- toUser?: string;
40
- viewType?: string;
41
- open?: boolean;
42
- type?: 'preview' | 'def'
43
- }) {
44
- const gvc = cf.gvc;
45
- const html = String.raw;
46
- cf.userID = `${cf.userID}`;
47
- const chatID = [cf.userID, cf.toUser || 'manager'].sort().join('-');
48
- const vm = {
49
- visible: false,
50
- id: gvc.glitter.getUUID(),
51
- };
30
+ public static id = `dsmdklweew3`;
52
31
 
53
- return gvc.bindView(() => {
54
- AiMessage.toggle = (vis, option?: { key: string, label: string }[]) => {
55
- if (!option) {
56
- AiMessage.ai_support = [
57
- {
58
- key: 'writer',
59
- label: '文案寫手',
60
- },
61
- {
62
- key: 'order_analysis',
63
- label: '訂單分析',
64
- },
65
- {
66
- key: 'design',
67
- label: '圖片生成',
68
- },
69
- {
70
- key: 'operation_guide',
71
- label: '操作引導',
72
- }
73
- ]
74
- } else {
75
- AiMessage.ai_support = option!
32
+ public static setDrawer(gvc: GVC,option?: { key: string, label: string }[]) {
33
+ if (!option) {
34
+ AiMessage.ai_support = [
35
+ {
36
+ key: 'writer',
37
+ label: '文案寫手',
38
+ },
39
+ {
40
+ key: 'order_analysis',
41
+ label: '訂單分析',
42
+ },
43
+ {
44
+ key: 'design',
45
+ label: '圖片生成',
46
+ },
47
+ {
48
+ key: 'operation_guide',
49
+ label: '操作引導',
76
50
  }
77
- vm.visible = vis;
78
- $(document.querySelector('.ai-left')!).addClass(`scroll-out`);
79
- setTimeout(() => {
80
- gvc.notifyDataChange(vm.id);
81
- }, 250);
82
- };
83
- return {
84
- bind: vm.id,
85
- view: () => {
86
- if (!vm.visible) {
87
- return ``;
88
- }
89
- return new Promise(async (resolve, reject) => {
90
- resolve(
91
- html`
92
- <div
51
+ ]
52
+ } else {
53
+ AiMessage.ai_support = option!
54
+ }
55
+ gvc.glitter.setDrawer(`<div
93
56
  class="position-fixed start-0 top-0 vw-100 vh-100"
94
57
  style="background: rgba(0,0,0,0.5);z-index:999;"
95
58
  onclick="${gvc.event(() => {
96
- AiMessage.toggle(false);
97
- })}"
59
+ gvc.glitter.closeDrawer()
60
+ })}"
98
61
  >
99
62
  <div
100
63
  class="position-fixed vh-100 top-0 scroll-in bg-white ai-left"
101
64
  style="top:0px;width: 500px;height: 100vh;max-width: 100vw;"
102
65
  onclick="${gvc.event((e, event) => {
103
- event.stopPropagation();
104
- })}"
66
+ event.stopPropagation();
67
+ })}"
105
68
  >
106
69
  ${AiMessage.detail({
107
- gvc: gvc,
108
- user_id: cf.userID,
109
- containerHeight: ($('body').height() as any) + 10 + 'px',
110
- document: document,
111
- goBack: () => {
112
- },
113
- close: () => {
114
- AiMessage.toggle(false);
115
- },
116
- })}
70
+ gvc: gvc,
71
+ user_id: 'manager',
72
+ containerHeight: ($('body').height() as any) + 10 + 'px',
73
+ document: document,
74
+ goBack: () => {
75
+ },
76
+ close: () => {
77
+ gvc.glitter.closeDrawer()
78
+ },
79
+ })}
117
80
  </div>
118
- </div>`
119
- );
120
- });
121
- },
122
- divCreate: {
123
- elem: 'div',
124
- style: `z-index:99999;bottom:0px;left:0px;`,
125
- },
126
- onCreate: async () => {
127
- },
128
- };
129
- });
81
+ </div>`, () => {
82
+ gvc.glitter.openDrawer((document.body.clientWidth>768) ? 500:document.body.clientWidth)
83
+ })
130
84
  }
131
85
 
86
+ public static ai_support: { key: string, label: string }[] = []
87
+
88
+
132
89
  public static detail(cf: {
133
90
  gvc: GVC;
134
91
  user_id: string;
@@ -369,7 +326,7 @@ export class AiMessage {
369
326
  dd.user_data = AiMessage.config;
370
327
  }
371
328
  const replacedString = markdownToHTML(dd.message.text);
372
- const width = (document.body.clientWidth < 768)? document.body.clientWidth - 120:348
329
+ const width = (document.body.clientWidth < 768) ? document.body.clientWidth - 120 : 348
373
330
  if (cf.user_id !== dd.user_id) {
374
331
  return html`
375
332
  <div class="mt-auto d-flex align-items-start ${vm.data[index + 1] && vm.data[index + 1].user_id === dd.user_id ? `mb-1` : `mb-3`}">
@@ -448,7 +448,32 @@ h6 {
448
448
  -webkit-background-clip: unset;
449
449
  -webkit-text-fill-color: unset;
450
450
  }
451
+ .bt_orange_lin_mb {
452
+ cursor: pointer;
453
+ height: 36px;
454
+ padding: 8px 12px;
455
+ border-radius: 8px;
456
+ border: 1px var(--main-orange) solid;
457
+ justify-content: center;
458
+ align-items: center;
459
+ display: inline-flex;
460
+ background: linear-gradient(135deg, var(--main-orange) 0%, #ff6c02 100%);
461
+ background-clip: text;
462
+ -webkit-background-clip: text;
463
+ -webkit-text-fill-color: transparent;
464
+ font-size: 16px;
465
+ font-weight: 700;
466
+ letter-spacing: 0.64px;
467
+ word-wrap: break-word;
468
+ }
451
469
 
470
+ .bt_orange_lin_mb:hover {
471
+ background: linear-gradient(135deg, var(--main-orange) 0%, #ff6c02 100%);
472
+ color: white;
473
+ background-clip: unset;
474
+ -webkit-background-clip: unset;
475
+ -webkit-text-fill-color: unset;
476
+ }
452
477
  .bt_c39 {
453
478
  border-radius: 10px;
454
479
  background: var(--main-black);
@@ -757,6 +757,7 @@ ${(!error.message) ? `` : `錯誤訊息:${error.message}`}${(!error.lineNumber)
757
757
  }
758
758
  ;
759
759
  openDrawer(width) {
760
+ width = width || 300;
760
761
  if (window.drawer !== undefined) {
761
762
  $("#Navigation").show();
762
763
  window.drawer.open();
@@ -321,6 +321,7 @@ ${(!error.message) ? `` : `錯誤訊息:${error.message}`}${(!error.lineNumber)
321
321
  };
322
322
 
323
323
  public openDrawer(width?:number) {
324
+ width=width || 300
324
325
  if ((window as any).drawer !== undefined) {
325
326
  $("#Navigation").show();
326
327
  (window as any).drawer.open();
@@ -281,7 +281,7 @@ color: transparent;"
281
281
  style="width:56px;height: 56px;cursor: pointer;"
282
282
  onclick="${gvc.event(() => {
283
283
  if ((EditorConfig.backend_page() === 'backend-manger')) {
284
- glitter.openDrawer();
284
+ glitter.share.toggle_left_bar();
285
285
  }
286
286
  else {
287
287
  goBack();
@@ -329,7 +329,7 @@ color: transparent;"
329
329
  gvc.glitter.share.editorViewModel.selectItem = undefined;
330
330
  Storage.page_setting_item = dd.index;
331
331
  if (document.body.clientWidth < 800) {
332
- glitter.openDrawer();
332
+ glitter.share.toggle_left_bar();
333
333
  }
334
334
  Storage.lastSelect = '';
335
335
  gvc.notifyDataChange(["MainEditorLeft", "top_sm_bar"]);
@@ -339,9 +339,27 @@ ${dd.title}</a></li>`;
339
339
  }).join('')}
340
340
  </ul>
341
341
  </li>
342
+ <div class="border-end d-flex align-items-center justify-content-center flex-column fs-3 pt-2"
343
+ style="width:56px;height: 56px;cursor: pointer;"
344
+ onclick="${gvc.event(() => {
345
+ AiMessage.setDrawer(gvc, [
346
+ {
347
+ key: 'writer',
348
+ label: '文案寫手',
349
+ },
350
+ {
351
+ key: 'design',
352
+ label: '圖片生成',
353
+ }
354
+ ]);
355
+ })}">
356
+ <img src="https://d3jnmi1tfjgtti.cloudfront.net/file/234285319/size1440_s*px$_sas0s9s0s1sesas0_1697354801736-Glitterlogo.png"
357
+ class="" style="width:24px;height: 24px;">
358
+ <span class="fw-500" style="font-size: 10px;">AI 助手</span>
359
+ </div>
342
360
  `}
343
361
  <div class="border-end d-none d-sm-block"
344
- style="width:${glitter.getUrlParameter('blogEditor') ? `100px` : `39.5px`};height: 56px; "></div>
362
+ style="width:38px;height: 56px; "></div>
345
363
 
346
364
  ${(() => {
347
365
  if (Storage.select_function === 'backend-manger') {
@@ -381,26 +399,6 @@ ${dd.title}</a></li>`;
381
399
  view: () => {
382
400
  const size = document.body.clientWidth > 768 ? 24 : 18;
383
401
  return [
384
- html `
385
- <div
386
- class="ms-auto me-2 bt_orange_lin"
387
- style=""
388
- onclick="${gvc.event(() => {
389
- AiMessage.toggle(true, [
390
- {
391
- key: 'writer',
392
- label: '文案寫手',
393
- },
394
- {
395
- key: 'design',
396
- label: '圖片生成',
397
- }
398
- ]);
399
- })}"
400
- >
401
- <img src="https://d3jnmi1tfjgtti.cloudfront.net/file/234285319/size1440_s*px$_sas0s9s0s1sesas0_1697354801736-Glitterlogo.png"
402
- class="me-2" style="width:${size}px;height: ${size}px;">AI助手
403
- </div>`,
404
402
  html `
405
403
  <div class="hoverBtn d-flex align-items-center justify-content-center border ${Storage.select_function === 'user-editor' ? `d-none` : ``}"
406
404
  style="height:36px;width:36px;border-radius:10px;cursor:pointer;color:#151515;"
@@ -767,21 +765,15 @@ color:white;
767
765
  儲存
768
766
  </button>`}
769
767
  </div>
770
- <div>${AiMessage.aiRobot({
771
- gvc: gvc,
772
- userID: 'manager',
773
- toUser: 'robot'
774
- })}
775
- </div>
776
768
  ${(() => {
777
769
  if (Storage.select_function === 'backend-manger') {
778
770
  const size = document.body.clientWidth > 768 ? 24 : 18;
779
771
  return (html `
780
772
  <div
781
- class="ms-auto me-2 bt_orange_lin"
773
+ class="ms-auto me-2 bt_orange_lin_mb"
782
774
  style=""
783
775
  onclick="${gvc.event(() => {
784
- AiMessage.toggle(true);
776
+ AiMessage.setDrawer(gvc);
785
777
  })}"
786
778
  >
787
779
  <img src="https://d3jnmi1tfjgtti.cloudfront.net/file/234285319/size1440_s*px$_sas0s9s0s1sesas0_1697354801736-Glitterlogo.png"
@@ -789,7 +781,7 @@ color:white;
789
781
  </div>
790
782
  <div class="position-relative">
791
783
  <div
792
- class="me-2 bt_orange_lin position-relative"
784
+ class="me-2 bt_orange_lin_mb position-relative"
793
785
  style="width:42px;"
794
786
  onclick="${gvc.event(() => {
795
787
  BgCustomerMessage.toggle(true, gvc);
@@ -918,7 +910,7 @@ color:white;
918
910
  let view = [
919
911
  html `
920
912
  <div
921
- class="me-2 bt_orange_lin position-relative"
913
+ class="me-2 bt_orange_lin_mb position-relative"
922
914
  style="width: 42px;"
923
915
  onclick="${gvc.event(() => {
924
916
  toggle = !toggle;