ts-glitter 21.1.1 → 21.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (29) hide show
  1. package/lowcode/Entry.js +1 -1
  2. package/lowcode/Entry.ts +1 -1
  3. package/lowcode/assets/css/theme.css +1 -1
  4. package/lowcode/backend-manager/bg-customer-message.js +1 -1
  5. package/lowcode/backend-manager/bg-customer-message.ts +1 -1
  6. package/lowcode/cms-plugin/POS-setting.js +10 -6
  7. package/lowcode/cms-plugin/POS-setting.ts +11 -5
  8. package/lowcode/cms-plugin/ai-message.js +1 -1
  9. package/lowcode/cms-plugin/ai-message.ts +1 -1
  10. package/lowcode/cms-plugin/pos-basic-setting.ts +1 -0
  11. package/lowcode/cms-plugin/pos-config-setting.js +56 -8
  12. package/lowcode/cms-plugin/pos-config-setting.ts +81 -28
  13. package/lowcode/cms-plugin/pos-pages/products-page.js +13 -2
  14. package/lowcode/cms-plugin/pos-pages/products-page.ts +14 -2
  15. package/lowcode/editor-components/font-select.js +1 -0
  16. package/lowcode/editor-components/font-select.ts +64 -0
  17. package/lowcode/official_view_component/official/component.js +10 -5
  18. package/lowcode/official_view_component/official/component.ts +22 -13
  19. package/lowcode/setting/fonts-config.js +119 -59
  20. package/lowcode/setting/fonts-config.ts +7075 -6999
  21. package/package.json +1 -1
  22. package/src/api-public/services/data-analyze.d.ts +4 -4
  23. package/src/api-public/services/data-analyze.js +16 -8
  24. package/src/api-public/services/data-analyze.js.map +1 -1
  25. package/src/api-public/services/data-analyze.ts +16 -8
  26. package/src/api-public/services/shopping.js +2 -3
  27. package/src/api-public/services/shopping.js.map +1 -1
  28. package/src/api-public/services/shopping.ts +2 -3
  29. package/src/api-public/utils/ut-permission.d.ts +0 -1
@@ -1,5 +1,4 @@
1
1
  import { BgWidget } from '../backend-manager/bg-widget.js';
2
- import { EditorElem } from '../glitterBundle/plugins/editor-elem.js';
3
2
  import { ShareDialog } from '../glitterBundle/dialog/ShareDialog.js';
4
3
  export class FontsConfig {
5
4
  static fontsSettingView(gvc, globalValue, detail) {
@@ -17,79 +16,140 @@ export class FontsConfig {
17
16
  bind: vm_c.id,
18
17
  view: () => {
19
18
  if (vm_c.loading) {
20
- return html `<div class="w-100 d-flex align-items-center justify-content-center p-3">
21
- <div class="spinner-border"></div>
22
- </div>`;
19
+ return html ` <div class="w-100 d-flex align-items-center justify-content-center p-3">
20
+ <div class="spinner-border"></div>
21
+ </div>`;
23
22
  }
24
23
  const array = [
25
24
  html ` <div
26
- class="hoverF2 d-flex align-items-center p-3 ${detail ? `d-none` : ``}"
27
- onclick="${gvc.event(() => {
25
+ class="hoverF2 d-flex align-items-center p-3 ${detail ? `d-none` : ``}"
26
+ onclick="${gvc.event(() => {
28
27
  vm_c.toggle = !vm_c.toggle;
29
28
  gvc.notifyDataChange(vm_c.id);
30
29
  })}"
31
- >
32
- <span class="fw-500" style="max-width: calc(100% - 50px);text-overflow: ellipsis;white-space: nowrap;overflow: hidden;">字型樣式</span>
33
- <div class="flex-fill"></div>
34
- ${vm_c.toggle ? ` <i class="fa-solid fa-chevron-down"></i>` : ` <i class="fa-solid fa-chevron-right"></i>`}
35
- </div>`,
30
+ >
31
+ <span
32
+ class="fw-500"
33
+ style="max-width: calc(100% - 50px);text-overflow: ellipsis;white-space: nowrap;overflow: hidden;"
34
+ >字型樣式</span
35
+ >
36
+ <div class="flex-fill"></div>
37
+ ${vm_c.toggle
38
+ ? ` <i class="fa-solid fa-chevron-down"></i>`
39
+ : ` <i class="fa-solid fa-chevron-right"></i>`}
40
+ </div>`,
36
41
  ];
37
42
  if (vm_c.toggle) {
38
- array.push(html ` <div class="row ${globalValue.font_theme.length === 0 ? `d-none` : ``} px-0 pt-2 pb-0 m-0" style="margin: 18px 18px 0px;">
39
- ${globalValue.font_theme
43
+ array.push(html ` <div
44
+ class="row ${globalValue.font_theme.length === 0 ? `d-none` : ``} px-0 pt-2 pb-0 m-0"
45
+ style="margin: 18px 18px 0px;"
46
+ >
47
+ ${globalValue.font_theme
40
48
  .map((dd, index) => {
41
- return html `<div class="col-12 mb-3" style="cursor: pointer;">
42
- <div class="rounded border p-2 d-flex w-100 flex-column" style="gap:10px;">
49
+ return gvc.bindView(() => {
50
+ const id = gvc.glitter.getUUID();
51
+ function refresh() {
52
+ gvc.notifyDataChange(id);
53
+ }
54
+ return {
55
+ bind: id,
56
+ view: () => {
57
+ return ` <div class="rounded border p-2 d-flex w-100 flex-column" style="gap:10px;">
43
58
  ${BgWidget.title(index === 0 ? `預設字型` : dd.value || `字型樣式 ${index}`, 'font-size: 16px;')}
44
59
  <div class="d-flex align-items-center" style="gap:10px;">
45
- ${EditorElem.searchInput({
46
- title: '',
47
- gvc: gvc,
48
- def: dd.value,
49
- array: vm_c.fonts.map((dd, index) => {
50
- return dd.title;
51
- }),
52
- callback: (text) => {
53
- if (vm_c.fonts.find((dd, index) => {
54
- return dd.title === text;
55
- })) {
56
- dd.title = text;
57
- dd.value = text;
58
- FontsConfig.reInitialFontTheme(globalValue, gvc);
59
- }
60
- gvc.notifyDataChange(vm_c.id);
61
- },
62
- placeHolder: '搜尋字體',
63
- })}
60
+ <div class="form-control" style="cursor:pointer;" onclick="${gvc.event(() => {
61
+ BgWidget.settingDialog({
62
+ gvc: gvc,
63
+ title: '選擇字型',
64
+ innerHTML: (gvc) => {
65
+ const input_id = gvc.glitter.getUUID();
66
+ const container_id = gvc.glitter.getUUID();
67
+ let search = '';
68
+ return `<div class="w-100">
69
+ ${[
70
+ BgWidget.editeInput({
71
+ gvc: gvc,
72
+ default: search,
73
+ title: `<div class="d-flex align-items-center" style="gap:5px;">快速搜尋${BgWidget.greenNote(`<div onclick="${gvc.event(() => {
74
+ gvc.glitter.openNewTab('https://fonts.google.com/');
75
+ })}" style="cursor:pointer;">採用Google Fonts 標準字型</div>`)}</div>`,
76
+ placeHolder: '快速搜尋',
77
+ oninput: (text) => {
78
+ search = text;
79
+ gvc.notifyDataChange(container_id);
80
+ },
81
+ callback: text => { },
82
+ }),
83
+ gvc.bindView(() => {
84
+ return {
85
+ bind: container_id,
86
+ view: () => {
87
+ return vm_c.fonts
88
+ .map((dd, index) => {
89
+ return dd.title;
90
+ })
91
+ .filter((dd) => {
92
+ return dd.toLowerCase().includes(search.toLowerCase());
93
+ })
94
+ .map((d1, index) => {
95
+ return html ` <div class="d-flex">
96
+ ${BgWidget.title(`${index + 1}. ${d1}`)}
97
+ <div class="flex-fill"></div>
98
+ ${BgWidget.save(gvc.event(() => {
99
+ dd.value = d1;
100
+ refresh();
101
+ gvc.closeDialog();
102
+ }), '選擇')}
103
+ </div>`;
104
+ }).join('<div class="w-100 my-2 border-top"></div>');
105
+ },
106
+ };
107
+ }),
108
+ ].join(BgWidget.horizontalLine())}
109
+ </div>`;
110
+ },
111
+ footer_html: (gvc) => {
112
+ return [].join('');
113
+ },
114
+ });
115
+ })}">
116
+ ${dd.value || '尚未設定'}
117
+ </div>
64
118
  ${index !== 0
65
- ? BgWidget.cancel(gvc.event(() => {
66
- const dialog = new ShareDialog(gvc.glitter);
67
- dialog.checkYesOrNot({
68
- text: '是否確認刪除此字型?',
69
- callback: (response) => {
70
- if (response) {
71
- globalValue.font_theme.splice(index, 1);
72
- gvc.notifyDataChange(vm_c.id);
73
- }
74
- },
75
- });
76
- }), '<i class="fa-solid fa-trash-can"></i>')
77
- : ``}
119
+ ? BgWidget.cancel(gvc.event(() => {
120
+ const dialog = new ShareDialog(gvc.glitter);
121
+ dialog.checkYesOrNot({
122
+ text: '是否確認刪除此字型?',
123
+ callback: response => {
124
+ if (response) {
125
+ globalValue.font_theme.splice(index, 1);
126
+ gvc.notifyDataChange(vm_c.id);
127
+ }
128
+ },
129
+ });
130
+ }), '<i class="fa-solid fa-trash-can"></i>')
131
+ : ``}
78
132
  </div>
79
133
  </div>
80
134
  <div class="d-flex p-2 align-items-center" style="gap:10px;">
81
135
  <div class="fs-6">預覽字體:</div>
82
136
  <div class="fs-6 bgf6 p-2" style="font-family: '${dd.value}' !important;">字型</div>
83
137
  <div class="fs-6 bgf6 p-2" style="font-family: '${dd.value}' !important;">fonts</div>
84
- </div>
85
- </div>`;
138
+ </div>`;
139
+ },
140
+ divCreate: {
141
+ class: `col-12 mb-3`,
142
+ style: `cursor: pointer;`,
143
+ },
144
+ };
145
+ });
86
146
  })
87
147
  .join('')}
88
- </div>
89
- <div class="px-2 mb-2" style="${globalValue.font_theme.length === 0 ? `` : ``}">
90
- <div
91
- class="bt_border_editor"
92
- onclick="${gvc.event((e, event) => {
148
+ </div>
149
+ <div class="px-2 mb-2" style="${globalValue.font_theme.length === 0 ? `` : ``}">
150
+ <div
151
+ class="bt_border_editor"
152
+ onclick="${gvc.event((e, event) => {
93
153
  event.preventDefault();
94
154
  event.stopPropagation();
95
155
  globalValue.font_theme.push({
@@ -99,10 +159,10 @@ export class FontsConfig {
99
159
  FontsConfig.reInitialFontTheme(globalValue, gvc);
100
160
  gvc.notifyDataChange(vm_c.id);
101
161
  })}"
102
- >
103
- 新增字型
104
- </div>
105
- </div>`);
162
+ >
163
+ 新增字型
164
+ </div>
165
+ </div>`);
106
166
  }
107
167
  return array.join('');
108
168
  },
@@ -124,7 +184,7 @@ export class FontsConfig {
124
184
  }
125
185
  });
126
186
  const element = window.glitter.elementCallback;
127
- Object.keys(element).map((dd) => {
187
+ Object.keys(element).map(dd => {
128
188
  try {
129
189
  element[dd].updateAttribute();
130
190
  }