ts-glitter 13.8.666 → 13.8.669

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
@@ -64,7 +64,7 @@ export class Entry {
64
64
  }
65
65
  window.renderClock = (_a = window.renderClock) !== null && _a !== void 0 ? _a : clockF();
66
66
  console.log(`Entry-time:`, window.renderClock.stop());
67
- glitter.share.editerVersion = 'V_13.8.666';
67
+ glitter.share.editerVersion = 'V_13.8.669';
68
68
  glitter.share.start = new Date();
69
69
  const vm = {
70
70
  appConfig: [],
@@ -163,7 +163,8 @@ export class Entry {
163
163
  if (glitter.getUrlParameter('type') === 'editor') {
164
164
  const dialog = new ShareDialog(glitter);
165
165
  dialog.dataLoading({ visible: true, text: '後台載入中' });
166
- Entry.toBackendEditor(glitter, () => { });
166
+ Entry.toBackendEditor(glitter, () => {
167
+ });
167
168
  }
168
169
  else if (glitter.getUrlParameter('type') === 'htmlEditor') {
169
170
  Entry.toHtmlEditor(glitter, vm, () => {
@@ -202,7 +203,8 @@ export class Entry {
202
203
  }
203
204
  }
204
205
  static toBackendEditor(glitter, callback) {
205
- if (localStorage.getItem('on-pos') === 'true') {
206
+ if ((localStorage.getItem('on-pos') === 'true') && glitter.getUrlParameter('page') !== 'pos') {
207
+ localStorage.removeItem('on-pos');
206
208
  location.href = glitter.root_path + 'pos?app-id=t_1725992531001';
207
209
  }
208
210
  glitter.addStyle(`
@@ -296,7 +298,9 @@ export class Entry {
296
298
  {
297
299
  src: 'https://kit.fontawesome.com/cccedec0f8.js',
298
300
  },
299
- ], () => { }, () => { });
301
+ ], () => {
302
+ }, () => {
303
+ });
300
304
  glitter.addStyle(`
301
305
  @media (prefers-reduced-motion: no-preference) {
302
306
  :root {
@@ -330,7 +334,9 @@ export class Entry {
330
334
  src: `${glitter.htmlGenerate.configureCDN(glitter.htmlGenerate.resourceHook(dd.js))}`,
331
335
  type: 'module',
332
336
  };
333
- }), () => { }, () => { }, [{ key: 'async', value: 'true' }]);
337
+ }), () => {
338
+ }, () => {
339
+ }, [{ key: 'async', value: 'true' }]);
334
340
  glitter.htmlGenerate.loadScript(glitter, window.parent.editerData.setting
335
341
  .filter((dd) => {
336
342
  return ['widget', 'container', 'code'].indexOf(dd.type) === -1;
@@ -394,7 +400,8 @@ export class Entry {
394
400
  .map((dd) => {
395
401
  return {
396
402
  src: `${glitter.htmlGenerate.configureCDN(glitter.htmlGenerate.resourceHook(dd.js))}`,
397
- callback: () => { },
403
+ callback: () => {
404
+ },
398
405
  };
399
406
  }));
400
407
  function authPass() {
@@ -425,6 +432,20 @@ export class Entry {
425
432
  });
426
433
  }
427
434
  static resourceInitial(glitter, vm, callback) {
435
+ glitter.runJsInterFace('getTopInset', {}, (response) => {
436
+ glitter.share.top_inset = (response.data);
437
+ }, {
438
+ webFunction: () => {
439
+ return { data: 0 };
440
+ },
441
+ });
442
+ glitter.runJsInterFace('getBottomInset', {}, (response) => {
443
+ glitter.share.bottom_inset = (response.data);
444
+ }, {
445
+ webFunction: () => {
446
+ return { data: 0 };
447
+ },
448
+ });
428
449
  window.glitterInitialHelper.getPlugin((dd) => {
429
450
  var _a, _b, _c, _d, _e;
430
451
  console.log(`getPlugin-time:`, window.renderClock.stop());
@@ -503,6 +524,35 @@ export class Entry {
503
524
  static globalStyle(glitter, dd) {
504
525
  return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
505
526
  var _a, _b;
527
+ function loopVersion() {
528
+ ApiPageConfig.getGlitterVersion().then((res) => {
529
+ console.log('glitterVersion:', res.response.result);
530
+ if (!glitter.share.editerVersion.includes(res.response.result)) {
531
+ const dialog = new ShareDialog(glitter);
532
+ dialog.checkYesOrNot({
533
+ text: '新版本已發佈,是否進行更新?',
534
+ callback: (response) => {
535
+ if (response) {
536
+ location.reload();
537
+ }
538
+ else {
539
+ setTimeout(() => {
540
+ loopVersion();
541
+ }, 1000 * 300);
542
+ }
543
+ }
544
+ });
545
+ }
546
+ else {
547
+ setTimeout(() => {
548
+ loopVersion();
549
+ }, 1000 * 300);
550
+ }
551
+ });
552
+ }
553
+ if (glitter.getUrlParameter('type') === 'editor' || glitter.getUrlParameter('page') === 'pos') {
554
+ loopVersion();
555
+ }
506
556
  let countI = dd.response.data.initialList.length;
507
557
  const vm = {
508
558
  get count() {
package/lowcode/Entry.ts CHANGED
@@ -1,11 +1,11 @@
1
1
  'use strict';
2
- import { Glitter } from './glitterBundle/Glitter.js';
3
- import { config } from './config.js';
4
- import { ApiPageConfig } from './api/pageConfig.js';
5
- import { BaseApi } from './glitterBundle/api/base.js';
6
- import { GlobalUser } from './glitter-base/global/global-user.js';
7
- import { EditorConfig } from './editor-config.js';
8
- import { ShareDialog } from './glitterBundle/dialog/ShareDialog.js';
2
+ import {Glitter} from './glitterBundle/Glitter.js';
3
+ import {config} from './config.js';
4
+ import {ApiPageConfig} from './api/pageConfig.js';
5
+ import {BaseApi} from './glitterBundle/api/base.js';
6
+ import {GlobalUser} from './glitter-base/global/global-user.js';
7
+ import {EditorConfig} from './editor-config.js';
8
+ import {ShareDialog} from './glitterBundle/dialog/ShareDialog.js';
9
9
 
10
10
  export class Entry {
11
11
  public static onCreate(glitter: Glitter) {
@@ -64,7 +64,7 @@ export class Entry {
64
64
  }
65
65
  (window as any).renderClock = (window as any).renderClock ?? clockF();
66
66
  console.log(`Entry-time:`, (window as any).renderClock.stop());
67
- glitter.share.editerVersion = 'V_13.8.666';
67
+ glitter.share.editerVersion = 'V_13.8.669';
68
68
  glitter.share.start = new Date();
69
69
  const vm: {
70
70
  appConfig: any;
@@ -83,14 +83,14 @@ export class Entry {
83
83
  Entry.resourceInitial(glitter, vm, async (dd) => {
84
84
  glitter.addStyle(`
85
85
  ${
86
- parseInt((window.parent as any).glitter.share.bottom_inset, 10)
87
- ? `
86
+ parseInt((window.parent as any).glitter.share.bottom_inset, 10)
87
+ ? `
88
88
  .update-bar-container {
89
89
  padding-bottom: ${(window.parent as any).glitter.share.bottom_inset}px !important;
90
90
  }
91
91
  `
92
- : ``
93
- }
92
+ : ``
93
+ }
94
94
 
95
95
  .editorParent .editorChild {
96
96
  display: none;
@@ -171,9 +171,10 @@ export class Entry {
171
171
  await Entry.globalStyle(glitter, dd);
172
172
  if (glitter.getUrlParameter('type') === 'editor') {
173
173
  const dialog = new ShareDialog(glitter);
174
- dialog.dataLoading({ visible: true, text: '後台載入中' });
174
+ dialog.dataLoading({visible: true, text: '後台載入中'});
175
175
  // 頁面編輯器
176
- Entry.toBackendEditor(glitter, () => {});
176
+ Entry.toBackendEditor(glitter, () => {
177
+ });
177
178
  } else if (glitter.getUrlParameter('type') === 'htmlEditor') {
178
179
  // Iframe預覽區塊
179
180
  Entry.toHtmlEditor(glitter, vm, () => {
@@ -215,7 +216,8 @@ export class Entry {
215
216
 
216
217
  // 跳轉至頁面編輯器
217
218
  public static toBackendEditor(glitter: Glitter, callback: () => void) {
218
- if (localStorage.getItem('on-pos') === 'true') {
219
+ if ((localStorage.getItem('on-pos') === 'true') && glitter.getUrlParameter('page')!=='pos') {
220
+ localStorage.removeItem('on-pos')
219
221
  location.href = glitter.root_path + 'pos?app-id=t_1725992531001';
220
222
  }
221
223
  glitter.addStyle(`
@@ -324,8 +326,10 @@ export class Entry {
324
326
  src: 'https://kit.fontawesome.com/cccedec0f8.js',
325
327
  },
326
328
  ],
327
- () => {},
328
- () => {}
329
+ () => {
330
+ },
331
+ () => {
332
+ }
329
333
  );
330
334
  glitter.addStyle(`
331
335
  @media (prefers-reduced-motion: no-preference) {
@@ -366,9 +370,11 @@ export class Entry {
366
370
  type: 'module',
367
371
  };
368
372
  }),
369
- () => {},
370
- () => {},
371
- [{ key: 'async', value: 'true' }]
373
+ () => {
374
+ },
375
+ () => {
376
+ },
377
+ [{key: 'async', value: 'true'}]
372
378
  );
373
379
 
374
380
  // Preload page script
@@ -389,7 +395,7 @@ export class Entry {
389
395
  return eval(evals);
390
396
  };
391
397
  setTimeout(() => {
392
- (window.parent as any).glitter.share.loading_dialog.dataLoading({ text: '', visible: false });
398
+ (window.parent as any).glitter.share.loading_dialog.dataLoading({text: '', visible: false});
393
399
  }, 2000);
394
400
  glitter.htmlGenerate.setHome({
395
401
  app_config: vm.appConfig,
@@ -444,7 +450,8 @@ export class Entry {
444
450
  .map((dd: any) => {
445
451
  return {
446
452
  src: `${glitter.htmlGenerate.configureCDN(glitter.htmlGenerate.resourceHook(dd.js))}`,
447
- callback: () => {},
453
+ callback: () => {
454
+ },
448
455
  };
449
456
  })
450
457
  );
@@ -484,6 +491,32 @@ export class Entry {
484
491
 
485
492
  // 資源初始化
486
493
  public static resourceInitial(glitter: Glitter, vm: any, callback: (data: any) => void) {
494
+ //取得APP的上間隔距離
495
+ glitter.runJsInterFace(
496
+ 'getTopInset',
497
+ {},
498
+ (response: any) => {
499
+ glitter.share.top_inset=(response.data);
500
+ },
501
+ {
502
+ webFunction: () => {
503
+ return {data: 0};
504
+ },
505
+ }
506
+ );
507
+ //取得APP的底部間隔距離
508
+ glitter.runJsInterFace(
509
+ 'getBottomInset',
510
+ {},
511
+ (response: any) => {
512
+ glitter.share.bottom_inset=(response.data);
513
+ },
514
+ {
515
+ webFunction: () => {
516
+ return {data: 0};
517
+ },
518
+ }
519
+ );
487
520
  (window as any).glitterInitialHelper.getPlugin((dd: any) => {
488
521
  console.log(`getPlugin-time:`, (window as any).renderClock.stop());
489
522
  (window as any).saasConfig.appConfig = dd.response.data;
@@ -511,11 +544,11 @@ export class Entry {
511
544
  glitter.addStyle(`
512
545
  @charset "UTF-8";
513
546
  ${glitter.share.font_theme
514
- .map((dd: any) => {
515
- glitter.share.initial_fonts.push(dd.value);
516
- return `@import url('https://fonts.googleapis.com/css2?family=${dd.value}&display=swap');`;
517
- })
518
- .join('\n')}
547
+ .map((dd: any) => {
548
+ glitter.share.initial_fonts.push(dd.value);
549
+ return `@import url('https://fonts.googleapis.com/css2?family=${dd.value}&display=swap');`;
550
+ })
551
+ .join('\n')}
519
552
  body {
520
553
  font-family: '${glitter.share.font_theme[0].value}' !important;
521
554
  font-optical-sizing: auto;
@@ -563,20 +596,36 @@ export class Entry {
563
596
  // 載入全域資源
564
597
  public static globalStyle(glitter: Glitter, dd: any) {
565
598
  return new Promise(async (resolve, reject) => {
566
- // Initial Global style
567
- // if (glitter.getUrlParameter("type") !== 'editor') {
568
- // for (const data of (dd.response.data.initialStyleSheet ?? [])) {
569
- // try {
570
- // if (data.type === 'script') {
571
- // glitter.addStyleLink(data.src.link)
572
- // } else {
573
- // glitter.addStyle(data.src.official)
574
- // }
575
- // } catch (e) {
576
- // console.error(e)
577
- // }
578
- // }
579
- // }
599
+ //定期確認版本號碼
600
+ function loopVersion() {
601
+ ApiPageConfig.getGlitterVersion().then((res) => {
602
+ console.log('glitterVersion:', res.response.result);
603
+ if (!glitter.share.editerVersion.includes(res.response.result)) {
604
+ const dialog = new ShareDialog(glitter)
605
+ dialog.checkYesOrNot({
606
+ text: '新版本已發佈,是否進行更新?',
607
+ callback: (response) => {
608
+ if (response) {
609
+ location.reload()
610
+ }else{
611
+ setTimeout(() => {
612
+ loopVersion()
613
+ }, 1000 * 300)
614
+ }
615
+ }
616
+ })
617
+ }else{
618
+ setTimeout(() => {
619
+ loopVersion()
620
+ }, 1000 * 300)
621
+ }
622
+
623
+ })
624
+ }
625
+ if (glitter.getUrlParameter('type')==='editor' || glitter.getUrlParameter('page')==='pos'){
626
+ loopVersion()
627
+ }
628
+
580
629
  let countI = dd.response.data.initialList.length;
581
630
  const vm = {
582
631
  // @ts-ignore
@@ -635,6 +684,8 @@ export class Entry {
635
684
  glitter.setUrlParameter('page', 'login');
636
685
  }
637
686
  }
687
+
688
+
638
689
  }
639
690
 
640
691
  let clockF = () => {
@@ -28,6 +28,16 @@ export class ApiPageConfig {
28
28
  }
29
29
  });
30
30
  }
31
+ static getGlitterVersion() {
32
+ return BaseApi.create({
33
+ "url": config.url + `/api/v1/app/version?library=ts-glitter`,
34
+ "type": "GET",
35
+ "timeout": 0,
36
+ "headers": {
37
+ "Content-Type": "application/json"
38
+ }
39
+ });
40
+ }
31
41
  static getTemplateList() {
32
42
  return BaseApi.create({
33
43
  "url": config.url + `/api/v1/app/template?template_from=all`,
@@ -25,6 +25,17 @@ export class ApiPageConfig {
25
25
  })
26
26
  }
27
27
 
28
+ public static getGlitterVersion() {
29
+ return BaseApi.create({
30
+ "url": config.url + `/api/v1/app/version?library=ts-glitter`,
31
+ "type": "GET",
32
+ "timeout": 0,
33
+ "headers": {
34
+ "Content-Type": "application/json"
35
+ }
36
+ })
37
+ }
38
+
28
39
  public static getTemplateList() {
29
40
  return BaseApi.create({
30
41
  "url": config.url + `/api/v1/app/template?template_from=all`,
@@ -156,7 +156,6 @@ height: 51px;
156
156
  }
157
157
  static main(gvc) {
158
158
  const glitter = gvc.glitter;
159
- localStorage.setItem('on-pos', 'true');
160
159
  gvc.glitter.runJsInterFace("pos-device", {}, (res) => {
161
160
  PayConfig.deviceType = res.deviceType === 'neostra' ? 'pos' : 'web';
162
161
  if (PayConfig.deviceType === 'pos') {
@@ -315,14 +314,14 @@ height: 51px;
315
314
  return html `
316
315
  <div
317
316
  class="d-flex nav-top"
318
- style="z-index:20;height: ${(() => {
317
+ style="z-index:20;min-height: ${(() => {
319
318
  if (document.body.offsetWidth > 800) {
320
319
  return `86px`;
321
320
  }
322
321
  else {
323
322
  return `66px`;
324
323
  }
325
- })()};width: 100%;background: #FFF;box-shadow: 0 1px 10px 0 rgba(0, 0, 0, 0.10);position: fixed;left: 0;top: 0;"
324
+ })()};padding-top:${glitter.share.top_inset}px;width: 100%;background: #FFF;box-shadow: 0 1px 10px 0 rgba(0, 0, 0, 0.10);position: fixed;left: 0;top: 0;"
326
325
  >
327
326
  <div
328
327
  class="POS-logo h-100 d-flex align-items-center ${document.body.offsetWidth < 800 ? `justify-content-center` : ``} mx-2 w-100"
@@ -612,7 +611,7 @@ cursor: pointer;
612
611
  }),
613
612
  divCreate: {
614
613
  class: `h-100 ${document.body.clientWidth < 768 ? `` : `d-flex`}`,
615
- style: `background: #F7F7F7;`,
614
+ style: `background: #F7F7F7;padding-top:${glitter.share.top_inset}px;`,
616
615
  },
617
616
  })}
618
617
  ${gvc.bindView({
@@ -184,7 +184,6 @@ height: 51px;
184
184
 
185
185
  public static main(gvc: GVC) {
186
186
  const glitter = gvc.glitter
187
- localStorage.setItem('on-pos', 'true')
188
187
  // https://unpkg.com/html5-qrcode/minified/html5-qrcode.min.js
189
188
  //設定裝置類型
190
189
  gvc.glitter.runJsInterFace("pos-device", {}, (res) => {
@@ -356,13 +355,13 @@ height: 51px;
356
355
  return html`
357
356
  <div
358
357
  class="d-flex nav-top"
359
- style="z-index:20;height: ${(() => {
358
+ style="z-index:20;min-height: ${(() => {
360
359
  if (document.body.offsetWidth > 800) {
361
360
  return `86px`
362
361
  } else {
363
362
  return `66px`
364
363
  }
365
- })()};width: 100%;background: #FFF;box-shadow: 0 1px 10px 0 rgba(0, 0, 0, 0.10);position: fixed;left: 0;top: 0;"
364
+ })()};padding-top:${glitter.share.top_inset}px;width: 100%;background: #FFF;box-shadow: 0 1px 10px 0 rgba(0, 0, 0, 0.10);position: fixed;left: 0;top: 0;"
366
365
  >
367
366
  <div
368
367
  class="POS-logo h-100 d-flex align-items-center ${document.body.offsetWidth < 800 ? `justify-content-center` : ``} mx-2 w-100"
@@ -655,7 +654,7 @@ cursor: pointer;
655
654
  },
656
655
  divCreate: {
657
656
  class: `h-100 ${document.body.clientWidth < 768 ? `` : `d-flex`}`,
658
- style: `background: #F7F7F7;`,
657
+ style: `background: #F7F7F7;padding-top:${glitter.share.top_inset}px;`,
659
658
  },
660
659
  })}
661
660
  ${gvc.bindView({
@@ -180,15 +180,6 @@ init(import.meta.url, (gvc, glitter, gBundle) => {
180
180
  else {
181
181
  dialog.dataLoading({ visible: true });
182
182
  }
183
- glitter.share.top_inset = yield new Promise((resolve, reject) => {
184
- glitter.runJsInterFace('getTopInset', {}, (response) => {
185
- resolve(response.data);
186
- }, {
187
- webFunction: () => {
188
- return { data: 0 };
189
- },
190
- });
191
- });
192
183
  if (parseInt(glitter.share.top_inset, 10)) {
193
184
  gvc.addStyle(css `
194
185
  .scroll-in {
@@ -200,15 +191,6 @@ init(import.meta.url, (gvc, glitter, gBundle) => {
200
191
  }
201
192
  `);
202
193
  }
203
- glitter.share.bottom_inset = yield new Promise((resolve, reject) => {
204
- glitter.runJsInterFace('getBottomInset', {}, (response) => {
205
- resolve(response.data);
206
- }, {
207
- webFunction: () => {
208
- return { data: 0 };
209
- },
210
- });
211
- });
212
194
  const waitGetData = [
213
195
  () => __awaiter(this, void 0, void 0, function* () {
214
196
  return yield new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
@@ -203,20 +203,7 @@ init(import.meta.url, (gvc, glitter, gBundle) => {
203
203
  } else {
204
204
  dialog.dataLoading({visible: true})
205
205
  }
206
- glitter.share.top_inset = await new Promise((resolve, reject) => {
207
- glitter.runJsInterFace(
208
- 'getTopInset',
209
- {},
210
- (response: any) => {
211
- resolve(response.data);
212
- },
213
- {
214
- webFunction: () => {
215
- return {data: 0};
216
- },
217
- }
218
- )
219
- })
206
+
220
207
  if (parseInt(glitter.share.top_inset, 10)) {
221
208
  gvc.addStyle(css`
222
209
  .scroll-in {
@@ -229,20 +216,6 @@ init(import.meta.url, (gvc, glitter, gBundle) => {
229
216
  `)
230
217
  }
231
218
 
232
- glitter.share.bottom_inset = await new Promise((resolve, reject) => {
233
- glitter.runJsInterFace(
234
- 'getBottomInset',
235
- {},
236
- (response: any) => {
237
- resolve(response.data);
238
- },
239
- {
240
- webFunction: () => {
241
- return {data: 0};
242
- },
243
- }
244
- )
245
- })
246
219
 
247
220
 
248
221
  const waitGetData = [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ts-glitter",
3
- "version": "13.8.666",
3
+ "version": "13.8.669",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {