ts-glitter 22.0.6 → 22.0.9

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
@@ -92,6 +92,9 @@ export class Entry {
92
92
  location.href = shopp;
93
93
  return;
94
94
  }
95
+ if (navigator.userAgent.includes('Googlebot')) {
96
+ Language.setLanguage(window.language);
97
+ }
95
98
  if (window.language !== Language.getLanguage()) {
96
99
  const url = new URL(`${glitter.root_path}${Language.getLanguageLinkPrefix()}${window.glitter_page}${new URL(location.href).search}`);
97
100
  if (glitter.getUrlParameter('appName')) {
@@ -151,7 +154,7 @@ export class Entry {
151
154
  }
152
155
  window.renderClock = (_b = window.renderClock) !== null && _b !== void 0 ? _b : createClock();
153
156
  console.log(`Entry-time:`, window.renderClock.stop());
154
- glitter.share.editerVersion = 'V_22.0.6';
157
+ glitter.share.editerVersion = 'V_22.0.9';
155
158
  glitter.share.start = new Date();
156
159
  const vm = { appConfig: [] };
157
160
  window.saasConfig = {
package/lowcode/Entry.ts CHANGED
@@ -95,6 +95,10 @@ export class Entry {
95
95
  location.href = shopp;
96
96
  return;
97
97
  }
98
+ //Google爬蟲的話語言為網址連結
99
+ if(navigator.userAgent.includes('Googlebot')){
100
+ Language.setLanguage((window as any).language)
101
+ }
98
102
  if ((window as any).language !== Language.getLanguage()) {
99
103
  const url = new URL(
100
104
  `${glitter.root_path}${Language.getLanguageLinkPrefix()}${(window as any).glitter_page}${new URL(location.href).search}`
@@ -155,7 +159,7 @@ export class Entry {
155
159
  }
156
160
  (window as any).renderClock = (window as any).renderClock ?? createClock();
157
161
  console.log(`Entry-time:`, (window as any).renderClock.stop());
158
- glitter.share.editerVersion = 'V_22.0.6';
162
+ glitter.share.editerVersion = 'V_22.0.9';
159
163
  glitter.share.start = new Date();
160
164
  const vm = { appConfig: [] };
161
165
  (window as any).saasConfig = {
@@ -143,6 +143,15 @@ export class OrderModule {
143
143
  const dialog = new ShareDialog(gvc.glitter);
144
144
  let shipment_date = gvc.glitter.ut.dateFormat(new Date(), 'yyyy-MM-dd');
145
145
  let shipment_time = gvc.glitter.ut.dateFormat(new Date(), 'hh:mm');
146
+ function print(html) {
147
+ const printWindow = (window).open('', '', 'width=800,height=600');
148
+ printWindow.document.write(html);
149
+ printWindow.focus();
150
+ setTimeout(() => {
151
+ printWindow.print();
152
+ }, 200);
153
+ printWindow.onafterprint = () => printWindow.close();
154
+ }
146
155
  function next() {
147
156
  dialog.dataLoading({ visible: true, text: '處理中...' });
148
157
  ApiDelivery.getOrderInfo({
@@ -160,25 +169,13 @@ export class OrderModule {
160
169
  const data = res.response.data;
161
170
  if (data.result) {
162
171
  if (data.link) {
163
- if (window.parent.glitter.share.PayConfig.posType === 'SUNMI') {
164
- glitter.runJsInterFace('print-web-view', {
165
- url: data.link,
166
- }, () => { });
167
- }
168
- else {
169
- glitter.openNewTab(data.link);
170
- }
172
+ glitter.openNewTab(data.link);
171
173
  }
172
174
  else if (data.id) {
173
- const url = ApiDelivery.getFormURL(data.id);
174
- if (window.parent.glitter.share.PayConfig.posType === 'SUNMI') {
175
- glitter.runJsInterFace('print-web-view', {
176
- url: url,
177
- }, () => { });
178
- }
179
- else {
180
- glitter.openNewTab(url);
181
- }
175
+ glitter.openNewTab(data.link);
176
+ }
177
+ else if (data.data) {
178
+ print(data.data);
182
179
  }
183
180
  else {
184
181
  dialog.errorMessage({ text: '列印失敗' });
@@ -154,6 +154,21 @@ export class OrderModule {
154
154
  const dialog = new ShareDialog(gvc.glitter);
155
155
  let shipment_date = gvc.glitter.ut.dateFormat(new Date(), 'yyyy-MM-dd');
156
156
  let shipment_time = gvc.glitter.ut.dateFormat(new Date(), 'hh:mm');
157
+ //
158
+ function print(html:string){
159
+ // 創建一個新的列印窗口
160
+ const printWindow:any = (window).open('', '', 'width=800,height=600');
161
+
162
+ // 設置列印窗口的內容
163
+ printWindow.document.write(html);
164
+
165
+ printWindow.focus();
166
+ setTimeout(()=>{
167
+ printWindow.print();
168
+ },200)
169
+ // 選擇性:列印後關閉視窗
170
+ printWindow.onafterprint = () => printWindow.close();
171
+ }
157
172
 
158
173
  function next() {
159
174
  dialog.dataLoading({ visible: true, text: '處理中...' });
@@ -171,31 +186,12 @@ export class OrderModule {
171
186
  const data = res.response.data;
172
187
  if (data.result) {
173
188
  if (data.link) {
174
- if ((window.parent as any).glitter.share.PayConfig.posType === 'SUNMI') {
175
- glitter.runJsInterFace(
176
- 'print-web-view',
177
- {
178
- url: data.link,
179
- },
180
- () => {}
181
- );
182
- } else {
183
- glitter.openNewTab(data.link);
184
- }
189
+ glitter.openNewTab(data.link);
185
190
  } else if (data.id) {
186
- const url = ApiDelivery.getFormURL(data.id);
187
- if ((window.parent as any).glitter.share.PayConfig.posType === 'SUNMI') {
188
- glitter.runJsInterFace(
189
- 'print-web-view',
190
- {
191
- url: url,
192
- },
193
- () => {}
194
- );
195
- } else {
196
- glitter.openNewTab(url);
197
- }
198
- } else {
191
+ glitter.openNewTab(data.link);
192
+ }else if(data.data){
193
+ print(data.data);
194
+ }else {
199
195
  dialog.errorMessage({ text: '列印失敗' });
200
196
  }
201
197
  } else {
@@ -779,30 +779,35 @@ export class ShoppingProductSetting {
779
779
  })));
780
780
  }
781
781
  if (postMD.product_category === 'commodity') {
782
- map_.push(BgWidget.mainCard(html `
783
- <div class="d-flex flex-column" style="gap:18px;">
782
+ map_.push(BgWidget.mainCard(gvc.bindView(() => {
783
+ const id = gvc.glitter.getUUID();
784
+ return {
785
+ bind: id,
786
+ view: () => {
787
+ var _b;
788
+ return ` <div class="d-flex flex-column" style="gap:18px;">
784
789
  <div class="d-flex flex-column guide5-7" style="gap:18px;">
785
790
  <div style="font-weight: 700;">商品材積</div>
786
791
  <div class="row">
787
792
  ${[
788
- {
789
- title: '長度',
790
- value: 'v_length',
791
- unit: '公分',
792
- },
793
- {
794
- title: '寬度',
795
- value: 'v_width',
796
- unit: '公分',
797
- },
798
- {
799
- title: '高度',
800
- value: 'v_height',
801
- unit: '公分',
802
- },
803
- ]
804
- .map(dd => {
805
- return html ` <div
793
+ {
794
+ title: '長度',
795
+ value: 'v_length',
796
+ unit: '公分',
797
+ },
798
+ {
799
+ title: '寬度',
800
+ value: 'v_width',
801
+ unit: '公分',
802
+ },
803
+ {
804
+ title: '高度',
805
+ value: 'v_height',
806
+ unit: '公分',
807
+ },
808
+ ]
809
+ .map(dd => {
810
+ return html ` <div
806
811
  style="display: flex;justify-content: center;align-items: center;gap: 10px;position: relative;"
807
812
  class=" col-12 col-sm-4 mb-2"
808
813
  >
@@ -812,14 +817,14 @@ export class ShoppingProductSetting {
812
817
  style="border-radius: 10px;border: 1px solid #DDD;height: 40px;width: calc(100% - 50px);"
813
818
  type="number"
814
819
  onchange="${gvc.event(e => {
815
- variant[dd.value] = e.value;
816
- })}"
820
+ variant[dd.value] = e.value;
821
+ })}"
817
822
  value="${variant[dd.value]}"
818
823
  />
819
824
  <div style="color: #8D8D8D;position: absolute;right: 25px;top: 7px;">${dd.unit}</div>
820
825
  </div>`;
821
- })
822
- .join('')}
826
+ })
827
+ .join('')}
823
828
  </div>
824
829
  </div>
825
830
  <div style="font-weight: 700;">商品重量</div>
@@ -828,23 +833,38 @@ export class ShoppingProductSetting {
828
833
  class="col-6"
829
834
  style="display: flex;height: 40px;padding: 10px 18px;align-items: center;gap: 10px;border-radius: 10px;border: 1px solid #DDD;"
830
835
  placeholder="請輸入商品重量"
831
- value="${variant.weight || 0}"
836
+ value="${(variant.weight || 0) * (variant.unit !== 'k' ? 1 : 1000)}"
832
837
  onchange="${gvc.event(e => {
833
- variant.weight = e.value;
834
- })}"
838
+ variant.weight = parseFloat(e.value) * (variant.unit !== 'k' ? 1 : 0.001);
839
+ })}"
835
840
  />
841
+
836
842
  <div class="col-6" style="display: flex;align-items: center;gap: 10px;">
837
843
  <div style="white-space: nowrap;">單位</div>
838
- <select
839
- class="form-select d-flex align-items-center flex-fill"
840
- style="border-radius: 10px;border: 1px solid #DDD;padding-left: 18px;"
841
- >
842
- <option value="kg">公斤</option>
843
- </select>
844
+ ${BgWidget.select({
845
+ title: '',
846
+ default: (_b = variant.unit) !== null && _b !== void 0 ? _b : 'kg',
847
+ callback: (value) => {
848
+ variant.unit = value;
849
+ gvc.notifyDataChange(id);
850
+ },
851
+ options: [
852
+ {
853
+ key: 'kg', value: '公斤'
854
+ },
855
+ {
856
+ key: 'k', value: '公克'
857
+ }
858
+ ],
859
+ gvc: gvc
860
+ })}
844
861
  </div>
845
862
  </div>
846
- </div>
847
- `));
863
+ </div>`;
864
+ },
865
+ divCreate: {}
866
+ };
867
+ })));
848
868
  }
849
869
  map_.push(BgWidget.mainCard(html `
850
870
  <div class="d-flex flex-column" style="gap: 18px;">
@@ -906,30 +906,34 @@ export class ShoppingProductSetting {
906
906
  }
907
907
  if (postMD.product_category === 'commodity') {
908
908
  map_.push(
909
- BgWidget.mainCard(html`
910
- <div class="d-flex flex-column" style="gap:18px;">
909
+ BgWidget.mainCard(gvc.bindView(()=>{
910
+ const id=gvc.glitter.getUUID()
911
+ return {
912
+ bind:id,
913
+ view:()=>{
914
+ return ` <div class="d-flex flex-column" style="gap:18px;">
911
915
  <div class="d-flex flex-column guide5-7" style="gap:18px;">
912
916
  <div style="font-weight: 700;">商品材積</div>
913
917
  <div class="row">
914
918
  ${[
915
- {
916
- title: '長度',
917
- value: 'v_length',
918
- unit: '公分',
919
- },
920
- {
921
- title: '寬度',
922
- value: 'v_width',
923
- unit: '公分',
924
- },
925
- {
926
- title: '高度',
927
- value: 'v_height',
928
- unit: '公分',
929
- },
930
- ]
931
- .map(dd => {
932
- return html` <div
919
+ {
920
+ title: '長度',
921
+ value: 'v_length',
922
+ unit: '公分',
923
+ },
924
+ {
925
+ title: '寬度',
926
+ value: 'v_width',
927
+ unit: '公分',
928
+ },
929
+ {
930
+ title: '高度',
931
+ value: 'v_height',
932
+ unit: '公分',
933
+ },
934
+ ]
935
+ .map(dd => {
936
+ return html` <div
933
937
  style="display: flex;justify-content: center;align-items: center;gap: 10px;position: relative;"
934
938
  class=" col-12 col-sm-4 mb-2"
935
939
  >
@@ -939,14 +943,14 @@ export class ShoppingProductSetting {
939
943
  style="border-radius: 10px;border: 1px solid #DDD;height: 40px;width: calc(100% - 50px);"
940
944
  type="number"
941
945
  onchange="${gvc.event(e => {
942
- variant[dd.value] = e.value;
943
- })}"
946
+ variant[dd.value] = e.value;
947
+ })}"
944
948
  value="${variant[dd.value]}"
945
949
  />
946
950
  <div style="color: #8D8D8D;position: absolute;right: 25px;top: 7px;">${dd.unit}</div>
947
951
  </div>`;
948
- })
949
- .join('')}
952
+ })
953
+ .join('')}
950
954
  </div>
951
955
  </div>
952
956
  <div style="font-weight: 700;">商品重量</div>
@@ -955,24 +959,39 @@ export class ShoppingProductSetting {
955
959
  class="col-6"
956
960
  style="display: flex;height: 40px;padding: 10px 18px;align-items: center;gap: 10px;border-radius: 10px;border: 1px solid #DDD;"
957
961
  placeholder="請輸入商品重量"
958
- value="${variant.weight || 0}"
962
+ value="${(variant.weight || 0) * (variant.unit!=='k' ? 1:1000)}"
959
963
  onchange="${gvc.event(e => {
960
- variant.weight = e.value;
961
- })}"
964
+ variant.weight = parseFloat(e.value) * (variant.unit!=='k' ? 1:0.001);
965
+ })}"
962
966
  />
967
+
963
968
  <div class="col-6" style="display: flex;align-items: center;gap: 10px;">
964
969
  <div style="white-space: nowrap;">單位</div>
965
- <select
966
- class="form-select d-flex align-items-center flex-fill"
967
- style="border-radius: 10px;border: 1px solid #DDD;padding-left: 18px;"
968
- >
969
- <option value="kg">公斤</option>
970
- </select>
970
+ ${BgWidget.select({
971
+ title:'',
972
+ default:variant.unit ?? 'kg',
973
+ callback:(value)=>{
974
+ variant.unit=value;
975
+ gvc.notifyDataChange(id)
976
+ },
977
+ options:[
978
+ {
979
+ key:'kg',value:'公斤'
980
+ },
981
+ {
982
+ key:'k',value:'公克'
983
+ }
984
+ ],
985
+ gvc:gvc
986
+ })}
971
987
  </div>
972
988
  </div>
973
- </div>
974
- `)
975
- );
989
+ </div>`
990
+ },
991
+ divCreate:{}
992
+ }
993
+ })
994
+ ))
976
995
  }
977
996
  map_.push(
978
997
  BgWidget.mainCard(html`
@@ -106,7 +106,7 @@ export class Glitter {
106
106
  printWindow.document.querySelector('img').onload = function () {
107
107
  printWindow.focus();
108
108
  printWindow.print();
109
- printWindow.close();
109
+ printWindow.onafterprint = () => printWindow.close();
110
110
  };
111
111
  },
112
112
  resize_img_url: (link) => {
@@ -783,8 +783,10 @@ ${(!error.message) ? `` : `錯誤訊息:${error.message}`}${(!error.lineNumber)
783
783
  printWindow.document.querySelector('img').onload = function() {
784
784
  printWindow.focus();
785
785
  printWindow.print();
786
- printWindow.close();
786
+ // 選擇性:列印後關閉視窗
787
+ printWindow.onafterprint = () => printWindow.close();
787
788
  };
789
+
788
790
  },
789
791
  resize_img_url: (link: string) => {
790
792
  let rela_link = link;