inviton-powerduck 0.0.164 → 0.0.166

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 (57) hide show
  1. package/app/global-state.ts +28 -0
  2. package/app/powerduck-initializer.ts +10 -9
  3. package/app/powerduck-state.ts +3 -2
  4. package/common/ajax-xhr.ts +2 -1
  5. package/common/api-http.ts +6 -5
  6. package/common/base-component.tsx +2 -1
  7. package/common/dialog-utils.ts +2 -1
  8. package/common/external-barcode-scanner.ts +244 -242
  9. package/common/history-extended.ts +44 -6
  10. package/common/history-handler.ts +15 -15
  11. package/common/keyboard-open-tracker.ts +20 -6
  12. package/common/ladda-lite.ts +14 -1
  13. package/common/local-storage-shim.ts +66 -30
  14. package/common/resource-helper.ts +77 -71
  15. package/common/scroll-utils.ts +9 -4
  16. package/common/set-current-url.ts +8 -5
  17. package/common/utils/checkbox-utils.ts +6 -0
  18. package/common/utils/clipboard-provider.ts +37 -34
  19. package/common/utils/cookie.ts +9 -0
  20. package/common/utils/dropdown-utils.ts +5 -0
  21. package/common/utils/string-utils.ts +46 -40
  22. package/common/utils/upload-image-helper.ts +2 -1
  23. package/common/utils/utils.ts +34 -14
  24. package/components/app/navigation-guard.ts +5 -2
  25. package/components/app/root-dynamic-component-container.tsx +2 -1
  26. package/components/app/vue-plugin-jsxtransform.ts +3 -1
  27. package/components/chart-js/line-chart-flot.tsx +4 -3
  28. package/components/chart-js/line-chart.tsx +5 -0
  29. package/components/chart-js/pie-chart.tsx +4 -3
  30. package/components/collapse/index.tsx +9 -0
  31. package/components/container-with-breakpoints/ts/breakpoint-handler.ts +7 -6
  32. package/components/counter/index.tsx +2 -1
  33. package/components/counter/testall.tsx +12 -9
  34. package/components/datatable/datatable.tsx +2363 -2362
  35. package/components/dropdown/mobile/legacy_fdd.ts +10 -9
  36. package/components/dropdown/mobile/legacy_lvb.ts +3 -1
  37. package/components/file-downloader/index.tsx +6 -5
  38. package/components/google/maps.tsx +18 -8
  39. package/components/google/places-autocomplete.tsx +6 -1
  40. package/components/google/ts/google-maps-api.ts +3 -2
  41. package/components/image-crop/image-cropping-modal.tsx +11 -6
  42. package/components/image-crop/upload-and-crop.tsx +163 -162
  43. package/components/input/daterange-picker.tsx +9 -0
  44. package/components/input/datetime-picker.tsx +11 -2
  45. package/components/input/localized-url-input.tsx +2 -1
  46. package/components/input/ts/bootstrapInputSpinner.ts +7 -2
  47. package/components/input/ts/dateInputHelper.ts +8 -7
  48. package/components/memory-cache/index.ts +7 -5
  49. package/components/modal/modal-utils.ts +2 -1
  50. package/components/modal/modal.tsx +5 -4
  51. package/components/modal/ts/file-manager-dialog.ts +3 -2
  52. package/components/share/share-modal.tsx +13 -12
  53. package/components/share/share.tsx +13 -12
  54. package/components/swiper/swiper.tsx +19 -15
  55. package/package.json +1 -1
  56. package/common/cdn-webpack-shim.ts +0 -5
  57. package/components/input/plugins/daterangepicker/jquery.daterangepicker.min.js +0 -1910
@@ -1,3 +1,4 @@
1
+ import { globalState } from '../../app/global-state';
1
2
  import { PortalUtils } from './utils';
2
3
 
3
4
  /**
@@ -10,46 +11,48 @@ export default class ClipboardProvider {
10
11
  * @param text Text for clipboard copy
11
12
  */
12
13
  static copyToClipboard(text: string): boolean {
13
- const container = document.createElement('div');
14
- document.body.appendChild(container);
14
+ let succeeded = false;
15
+ let cleanUp = () => {};
15
16
 
16
- const dummyElem = document.createElement('textarea');
17
- dummyElem.id = `txt-${PortalUtils.randomString(8)}`;
18
- dummyElem.style.fontSize = '12pt';
19
- dummyElem.style.border = '0';
20
- dummyElem.style.padding = '0';
21
- dummyElem.style.margin = '0';
22
- dummyElem.style.position = 'absolute';
23
- dummyElem.style.left = '0';
24
- dummyElem.setAttribute('readonly', '');
25
- dummyElem.style.opacity = '0.001';
17
+ try {
18
+ const container = document.createElement('div');
19
+ document.body.appendChild(container);
26
20
 
27
- const yPosition = window.pageYOffset || document.documentElement.scrollTop;
28
- dummyElem.style.top = `${yPosition}px`;
29
- dummyElem.value = text;
21
+ const dummyElem = document.createElement('textarea');
22
+ dummyElem.id = `txt-${PortalUtils.randomString(8)}`;
23
+ dummyElem.style.fontSize = '12pt';
24
+ dummyElem.style.border = '0';
25
+ dummyElem.style.padding = '0';
26
+ dummyElem.style.margin = '0';
27
+ dummyElem.style.position = 'absolute';
28
+ dummyElem.style.left = '0';
29
+ dummyElem.setAttribute('readonly', '');
30
+ dummyElem.style.opacity = '0.001';
30
31
 
31
- let fakeHandler: any;
32
- let fakeHandlerCallback: any;
33
- let cleanUp = () => {
34
- container.removeEventListener('click', fakeHandlerCallback);
35
- fakeHandler = null;
36
- fakeHandlerCallback = null;
37
- document.body.removeChild(container);
38
- cleanUp = null;
39
- };
32
+ const yPosition = globalState.pageYOffset || document.documentElement.scrollTop;
33
+ dummyElem.style.top = `${yPosition}px`;
34
+ dummyElem.value = text;
40
35
 
41
- fakeHandlerCallback = () => {
42
- cleanUp();
43
- };
44
- fakeHandler = container.addEventListener('click', fakeHandlerCallback);
36
+ let fakeHandler: any;
37
+ let fakeHandlerCallback: any;
38
+ cleanUp = () => {
39
+ container.removeEventListener('click', fakeHandlerCallback);
40
+ fakeHandler = null;
41
+ fakeHandlerCallback = null;
42
+ document.body.removeChild(container);
43
+ cleanUp = null;
44
+ };
45
45
 
46
- container.appendChild(dummyElem);
47
- dummyElem.focus();
48
- dummyElem.select();
49
- dummyElem.setSelectionRange(0, dummyElem.value.length);
46
+ fakeHandlerCallback = () => {
47
+ cleanUp();
48
+ };
49
+ fakeHandler = container.addEventListener('click', fakeHandlerCallback);
50
+
51
+ container.appendChild(dummyElem);
52
+ dummyElem.focus();
53
+ dummyElem.select();
54
+ dummyElem.setSelectionRange(0, dummyElem.value.length);
50
55
 
51
- let succeeded = false;
52
- try {
53
56
  succeeded = document.execCommand('copy');
54
57
  } catch (err) {
55
58
  succeeded = false;
@@ -1,5 +1,6 @@
1
1
  import { Temporal } from '@js-temporal/polyfill';
2
2
  import { DomainHelper } from './domain-helper';
3
+ import { globalState } from '../../app/global-state';
3
4
 
4
5
  // Cookie manipulation abstraction
5
6
  export class CookieProvider {
@@ -15,6 +16,10 @@ export class CookieProvider {
15
16
  value: string,
16
17
  expiration?: Temporal.PlainDateTime,
17
18
  ) {
19
+ if (!globalState.windowExists) {
20
+ return;
21
+ }
22
+
18
23
  let domain = DomainHelper.getCookieDomain();
19
24
  if (domain.length > 0) {
20
25
  domain = `;domain=.${domain}`;
@@ -36,6 +41,10 @@ export class CookieProvider {
36
41
  * @param name Name of the cookie
37
42
  */
38
43
  static read(name: string): string {
44
+ if (!globalState.windowExists) {
45
+ return null;
46
+ }
47
+
39
48
  name = `${name}=`;
40
49
  const ca = document.cookie.split(';');
41
50
  for (let i = 0; i < ca.length; i++) {
@@ -1,3 +1,4 @@
1
+ import { globalState } from '../../app/global-state';
1
2
  import { PortalUtils } from './utils';
2
3
 
3
4
  export default class DropdownUtils {
@@ -7,6 +8,10 @@ export default class DropdownUtils {
7
8
  clonedRootCssClass: string,
8
9
  hide: boolean,
9
10
  ): void {
11
+ if (!globalState.windowExists) {
12
+ return;
13
+ }
14
+
10
15
  if (DropdownUtils[cacheKey] == null) {
11
16
  DropdownUtils[cacheKey] = true;
12
17
 
@@ -1,42 +1,48 @@
1
+ import { globalState } from "../../app/global-state";
2
+
1
3
  export default class StringUtils {
2
- static getRandomString = (length: number) => {
3
- const characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
4
- const charactersLength = characters.length;
5
- let result = '';
6
-
7
- for (let i = 0; i < length; i++) {
8
- result += characters.charAt(Math.floor(Math.random() * charactersLength));
9
- }
10
-
11
- return result;
12
- };
13
-
14
- static normalizeFileName = (name: string) => {
15
- const nameSplit = name.split('.');
16
- const extension = nameSplit.pop();
17
- const justName = nameSplit.join('').replace(/\W/g, '');
18
- return `${justName}-${StringUtils.getRandomString(8)}.${extension}`;
19
- };
20
-
21
- static truncateString = (
22
- str: string,
23
- maxLength: number,
24
- ellipsis: string = '...',
25
- ) => {
26
- if (!str) {
27
- return '';
28
- }
29
-
30
- if (str.length > maxLength) {
31
- return str.slice(0, maxLength)?.trim() + ellipsis;
32
- }
33
-
34
- return str;
35
- };
36
-
37
- static stripHtmlTags = (html: string) => {
38
- const div = document.createElement('div');
39
- div.innerHTML = html;
40
- return div.textContent || div.innerText || '';
41
- };
4
+ static getRandomString = (length: number) => {
5
+ const characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
6
+ const charactersLength = characters.length;
7
+ let result = '';
8
+
9
+ for (let i = 0; i < length; i++) {
10
+ result += characters.charAt(Math.floor(Math.random() * charactersLength));
11
+ }
12
+
13
+ return result;
14
+ };
15
+
16
+ static normalizeFileName = (name: string) => {
17
+ const nameSplit = name.split('.');
18
+ const extension = nameSplit.pop();
19
+ const justName = nameSplit.join('').replace(/\W/g, '');
20
+ return `${justName}-${StringUtils.getRandomString(8)}.${extension}`;
21
+ };
22
+
23
+ static truncateString = (
24
+ str: string,
25
+ maxLength: number,
26
+ ellipsis: string = '...',
27
+ ) => {
28
+ if (!str) {
29
+ return '';
30
+ }
31
+
32
+ if (str.length > maxLength) {
33
+ return str.slice(0, maxLength)?.trim() + ellipsis;
34
+ }
35
+
36
+ return str;
37
+ };
38
+
39
+ static stripHtmlTags = (html: string) => {
40
+ if (!globalState.windowExists) {
41
+ return html;
42
+ }
43
+
44
+ const div = document.createElement('div');
45
+ div.innerHTML = html;
46
+ return div.textContent || div.innerText || '';
47
+ };
42
48
  }
@@ -1,4 +1,5 @@
1
1
  import type { ImageResponse, OnUploadImageResponse } from '../../data/image';
2
+ import { globalState } from '../../app/global-state';
2
3
  import PowerduckState from '../../app/powerduck-state';
3
4
  import { AppHttpProvider } from '../api-http';
4
5
  import { BrowserImageCompression } from './broswer-image-compression';
@@ -46,7 +47,7 @@ export class UploadImageHelper {
46
47
  }
47
48
 
48
49
  static onUploadImage(e: File): OnUploadImageResponse {
49
- const urlCreator = window.URL || window.webkitURL;
50
+ const urlCreator = globalState.URL || globalState.webkitURL;
50
51
  const imageUrl = urlCreator.createObjectURL(e);
51
52
 
52
53
  return {
@@ -1,3 +1,4 @@
1
+ import { globalState } from '../../app/global-state';
1
2
  import PowerduckState from '../../app/powerduck-state';
2
3
  import { latinize } from '../extensions/string-extensions';
3
4
  import TemporalUtils from './temporal-utils';
@@ -12,7 +13,7 @@ export class PortalUtils {
12
13
  */
13
14
  static isInIframe(): boolean {
14
15
  try {
15
- return window.self !== window.top;
16
+ return globalState.self !== globalState.top;
16
17
  } catch (e) {
17
18
  return true;
18
19
  }
@@ -22,7 +23,7 @@ export class PortalUtils {
22
23
  * Determines if current device runs iOS
23
24
  */
24
25
  static isIOS(): boolean {
25
- return ((/iPad|iPhone|iPod/.test(navigator.userAgent) && !(window as any).MSStream) || navigator.userAgent.match(/(iPad)/) != null || (navigator.platform === 'MacIntel' && navigator.maxTouchPoints > 1));
26
+ return ((/iPad|iPhone|iPod/.test(navigator.userAgent) && !globalState.MSStream) || navigator.userAgent.match(/(iPad)/) != null || (navigator.platform === 'MacIntel' && navigator.maxTouchPoints > 1));
26
27
  }
27
28
 
28
29
  /**
@@ -88,7 +89,9 @@ export class PortalUtils {
88
89
  static randomString(length: number): string {
89
90
  let result = '';
90
91
  const chars = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ';
91
- for (let i = length; i > 0; --i) { result += chars[Math.floor(Math.random() * chars.length)]; }
92
+ for (let i = length; i > 0; --i) {
93
+ result += chars[Math.floor(Math.random() * chars.length)];
94
+ }
92
95
  return result;
93
96
  }
94
97
 
@@ -112,8 +115,12 @@ export class PortalUtils {
112
115
  fileName: string,
113
116
  callback: () => void,
114
117
  ): void {
115
- if ((window.navigator as any).msSaveOrOpenBlob) {
116
- (window.navigator as any).msSaveOrOpenBlob(blob, fileName);
118
+ if (!globalState.windowExists) {
119
+ return;
120
+ }
121
+
122
+ if ((globalState.navigator as any).msSaveOrOpenBlob) {
123
+ (globalState.navigator as any).msSaveOrOpenBlob(blob, fileName);
117
124
  callback();
118
125
  } else {
119
126
  const _OBJECT_URL = URL.createObjectURL(blob);
@@ -131,7 +138,7 @@ export class PortalUtils {
131
138
  document.getElementById(randomId).click();
132
139
 
133
140
  setTimeout(() => {
134
- window.URL.revokeObjectURL(_OBJECT_URL);
141
+ globalState.URL.revokeObjectURL(_OBJECT_URL);
135
142
  document.body.removeChild(dummyLink);
136
143
  }, 5000);
137
144
 
@@ -156,7 +163,7 @@ export class PortalUtils {
156
163
  * @param data Accompanying action data
157
164
  */
158
165
  static postActionMessage(actionName: string, data: any): void {
159
- window.top.postMessage(`INV-${JSON.stringify({
166
+ globalState.top.postMessage(`INV-${JSON.stringify({
160
167
  action: actionName,
161
168
  data,
162
169
  })}`, '*');
@@ -166,6 +173,10 @@ export class PortalUtils {
166
173
  * Determines width of the scrollbar
167
174
  */
168
175
  static getScrollbarWidth(): number {
176
+ if (!globalState.windowExists) {
177
+ return 0;
178
+ }
179
+
169
180
  const outer = document.createElement('div');
170
181
  outer.style.visibility = 'hidden';
171
182
  outer.style.width = '100px';
@@ -207,10 +218,15 @@ export class PortalUtils {
207
218
  static isChromeDesktopBrowser(): boolean {
208
219
  if (PortalUtils._isChromeBrowser == null) {
209
220
  let retVal = false;
210
- const isChromium = (window as any).chrome;
211
- const winNav = window.navigator;
221
+ if (!globalState.windowExists) {
222
+ PortalUtils._isChromeBrowser = retVal;
223
+ return false;
224
+ }
225
+
226
+ const isChromium = globalState.chrome;
227
+ const winNav = globalState.navigator;
212
228
  const vendorName = winNav.vendor;
213
- const isOpera = typeof (window as any).opr !== 'undefined';
229
+ const isOpera = typeof globalState.opr !== 'undefined';
214
230
  const isIEedge = winNav.userAgent.includes('Edg');
215
231
  const isIOSChrome = winNav.userAgent.match('CriOS');
216
232
 
@@ -345,6 +361,10 @@ export class PortalUtils {
345
361
  scrollPos: number,
346
362
  offset?: number,
347
363
  ) {
364
+ if (!globalState.windowExists) {
365
+ return;
366
+ }
367
+
348
368
  if ((element as any).inviDom || (element as any).jquery) {
349
369
  element = element[0];
350
370
  }
@@ -358,7 +378,7 @@ export class PortalUtils {
358
378
  }
359
379
 
360
380
  // Open dialogs should not scroll unless scrolling inside the dialog
361
- if ((window as any).inviton && (window as any).inviton.dialogUtils && (window as any).inviton.dialogUtils.dialogIsOpen()) {
381
+ if (globalState.inviton && globalState.inviton.dialogUtils && globalState.inviton.dialogUtils.dialogIsOpen()) {
362
382
  const nodeName = (<HTMLElement>element).nodeName.toLowerCase();
363
383
  if (nodeName == 'html' || nodeName == 'body') {
364
384
  return;
@@ -377,11 +397,11 @@ export class PortalUtils {
377
397
 
378
398
  static handleMobileMenuClick(): void {
379
399
  try {
380
- if ($('html').hasClass('nav-open') && $(window).width() < 768) {
400
+ if ($('html').hasClass('nav-open') && $(globalState).width() < 768) {
381
401
  setTimeout(() => {
382
- if ((window as any)._nowDashboard?.misc.navbar_menu_visible == 1) {
402
+ if (globalState._nowDashboard?.misc.navbar_menu_visible == 1) {
383
403
  $('html').removeClass('nav-open');
384
- (window as any)._nowDashboard.misc.navbar_menu_visible = 0;
404
+ globalState._nowDashboard.misc.navbar_menu_visible = 0;
385
405
  setTimeout(() => {
386
406
  $('.navbar-toggle').removeClass('toggled');
387
407
  $('#bodyClick').remove();
@@ -1,3 +1,5 @@
1
+ import { globalState } from '../../app/global-state';
2
+
1
3
  export interface NavigationBeforeLeaveArgs {
2
4
  to?: any; // IAppRoute
3
5
  from?: any;
@@ -38,8 +40,9 @@ export default class NavigationGuardFactory {
38
40
 
39
41
  return {
40
42
  created() {
43
+ // eslint-disable-next-line ts/no-this-alias
41
44
  instance = this;
42
- window.addEventListener('beforeunload', windowNavigationHandler);
45
+ globalState.addEventListener('beforeunload', windowNavigationHandler);
43
46
  },
44
47
  beforeRouteLeave(
45
48
  to,
@@ -53,7 +56,7 @@ export default class NavigationGuardFactory {
53
56
  allowsAsync: true,
54
57
  next(result) {
55
58
  if (result != false) {
56
- window.removeEventListener('beforeunload', windowNavigationHandler);
59
+ globalState.removeEventListener('beforeunload', windowNavigationHandler);
57
60
  instance = null;
58
61
  }
59
62
 
@@ -1,12 +1,13 @@
1
1
  import type { DynamicComponentLazyLoadedModalArgs, IDynamicComponentContainer } from './dynamic-component-contracts';
2
2
  import { toNative, Vue } from 'vue-facing-decorator';
3
+ import { globalState } from '../../app/global-state';
3
4
  import { Component } from '../../app/vuetsx';
4
5
  import DynamicComponentContainer from './dynamic-component-container';
5
6
 
6
7
  @Component
7
8
  class RootDynamicComponentContainerComponent extends Vue implements IDynamicComponentContainer {
8
9
  created() {
9
- (window as any).RootDynamicContainerInstance = this;
10
+ globalState.RootDynamicContainerInstance = this;
10
11
  }
11
12
 
12
13
  getInstance<T>(uuid: string): T {
@@ -1,3 +1,5 @@
1
+ import { globalState } from '../../app/global-state';
2
+
1
3
  export const VueJsxTransform = {
2
4
  install(vue) {
3
5
  vue.mixin(vue.extend({
@@ -23,7 +25,7 @@ export const VueJsxTransform = {
23
25
 
24
26
  if (data?.onClick != null) {
25
27
  console.error(data);
26
- (window as any).kurek = data;
28
+ globalState.kurek = data;
27
29
  }
28
30
 
29
31
  return originalCreateElement(
@@ -2,6 +2,7 @@ import type { Temporal } from '@js-temporal/polyfill';
2
2
  import type { LineChartArgs, LineChartDataArgs } from './ts/line-chart-contracts';
3
3
  import { Prop, toNative } from 'vue-facing-decorator';
4
4
 
5
+ import { globalState } from '../../app/global-state';
5
6
  import TsxComponent, { Component } from '../../app/vuetsx';
6
7
  import { toDisplayString } from '../../common/extensions/temporal-extensions';
7
8
  import { isNullOrEmpty } from '../../common/utils/is-null-or-empty';
@@ -11,8 +12,8 @@ import arrowLeftIcon from './img/arrow-left.gif';
11
12
  import arrowRightIcon from './img/arrow-right.gif';
12
13
  import arrowTopIcon from './img/arrow-up.gif';
13
14
  import './thirdparty/flot/jquery.flot-patched.js';
14
- import './thirdparty/flot/jquery.flot.pie.js';
15
15
 
16
+ import './thirdparty/flot/jquery.flot.pie.js';
16
17
  import './thirdparty/flot/jquery.flot.stack.js';
17
18
  import './thirdparty/flot/jquery.flot.crosshair.js';
18
19
  import './thirdparty/flot/jquery.flot.resize.js';
@@ -41,11 +42,11 @@ class LineChartFlotComponent extends TsxComponent<LineChartArgs> implements Line
41
42
  }
42
43
 
43
44
  created() {
44
- window.addEventListener('resize', this.resizeFlot);
45
+ globalState.addEventListener('resize', this.resizeFlot);
45
46
  }
46
47
 
47
48
  unmounted() {
48
- window.removeEventListener('resize', this.resizeFlot);
49
+ globalState.removeEventListener('resize', this.resizeFlot);
49
50
  }
50
51
 
51
52
  resizeFlot() {
@@ -4,6 +4,7 @@ import { Prop, toNative } from 'vue-facing-decorator';
4
4
  import TsxComponent, { Component } from '../../app/vuetsx';
5
5
  import ChartColorHelper from './ts/color-helper';
6
6
  import 'chartjs-plugin-zoom';
7
+ import { globalState } from '../../app/global-state';
7
8
 
8
9
  @Component
9
10
  class LineChartComponent extends TsxComponent<LineChartArgs> implements LineChartArgs {
@@ -43,6 +44,10 @@ class LineChartComponent extends TsxComponent<LineChartArgs> implements LineChar
43
44
  }
44
45
 
45
46
  bindChart() {
47
+ if (!globalState.windowExists) {
48
+ return;
49
+ }
50
+
46
51
  this.$nextTick(() => {
47
52
  const canvas = document.getElementById(this._uuid) as HTMLCanvasElement;
48
53
  canvas.width = canvas.parentElement.offsetWidth;
@@ -1,5 +1,6 @@
1
1
  import Chart from 'chart.js';
2
2
  import { Prop, toNative } from 'vue-facing-decorator';
3
+ import { globalState } from '../../app/global-state';
3
4
  import PowerduckState from '../../app/powerduck-state';
4
5
  import TsxComponent, { Component } from '../../app/vuetsx';
5
6
  import ChartColorHelper from './ts/color-helper';
@@ -152,16 +153,16 @@ class PieChartComponent extends TsxComponent<PieArgs> implements PieArgs {
152
153
  }
153
154
 
154
155
  created() {
155
- window.addEventListener('resize', this.setSize);
156
+ globalState.addEventListener('resize', this.setSize);
156
157
  }
157
158
 
158
159
  unmounted() {
159
- window.removeEventListener('resize', this.setSize);
160
+ globalState.removeEventListener('resize', this.setSize);
160
161
  }
161
162
 
162
163
  setSize() {
163
164
  if (this.getSize != null) {
164
- this.size = this.getSize(window.innerWidth);
165
+ this.size = this.getSize(globalState.innerWidth);
165
166
  }
166
167
  }
167
168
 
@@ -1,6 +1,7 @@
1
1
  import { Prop, toNative } from 'vue-facing-decorator';
2
2
  import TsxComponent, { Component } from '../../app/vuetsx';
3
3
  import { PortalUtils } from '../../common/utils/utils';
4
+ import { globalState } from '../../app/global-state';
4
5
 
5
6
  interface CollapseArgs {
6
7
  cssClass?: string;
@@ -16,10 +17,18 @@ class CollapseComponent extends TsxComponent<CollapseArgs> implements CollapseAr
16
17
  }
17
18
 
18
19
  toggle() {
20
+ if (!globalState.windowExists) {
21
+ return;
22
+ }
23
+
19
24
  $(this.getInnerButton()).trigger('click');
20
25
  }
21
26
 
22
27
  isShown(): boolean {
28
+ if (!globalState.windowExists) {
29
+ return false;
30
+ }
31
+
23
32
  return this.getInnerButton().getAttribute('aria-expanded') == 'true';
24
33
  }
25
34
 
@@ -1,7 +1,8 @@
1
+ import { globalState } from '../../../app/global-state';
1
2
  import { remove } from '../../../common/extensions/array-extensions';
2
3
 
3
- if ((window as any).__powerduckBreakpointHandler == null) {
4
- (window as any).__powerduckBreakpointHandler = {
4
+ if (globalState.__powerduckBreakpointHandler == null) {
5
+ globalState.__powerduckBreakpointHandler = {
5
6
  _breakpointsBound: false,
6
7
  _handlers: [],
7
8
  };
@@ -9,7 +10,7 @@ if ((window as any).__powerduckBreakpointHandler == null) {
9
10
 
10
11
  export class BreakpointHandler {
11
12
  private static get handlers() {
12
- return (window as any).__powerduckBreakpointHandler._handlers;
13
+ return globalState.__powerduckBreakpointHandler._handlers;
13
14
  }
14
15
 
15
16
  static addResizeHandler(handler: () => any) {
@@ -22,12 +23,12 @@ export class BreakpointHandler {
22
23
  }
23
24
 
24
25
  static bindResizeHandler() {
25
- if ((window as any).__powerduckBreakpointHandler._breakpointsBound == true) {
26
+ if (globalState.__powerduckBreakpointHandler._breakpointsBound == true) {
26
27
  return;
27
28
  }
28
29
 
29
- (window as any).__powerduckBreakpointHandler._breakpointsBound = true;
30
- window.addEventListener('resize', BreakpointHandler.onWindowHasResized);
30
+ globalState.__powerduckBreakpointHandler._breakpointsBound = true;
31
+ globalState.addEventListener('resize', BreakpointHandler.onWindowHasResized);
31
32
  BreakpointHandler.onWindowHasResized();
32
33
  }
33
34
 
@@ -1,4 +1,5 @@
1
1
  import { toNative, Vue } from 'vue-facing-decorator';
2
+ import { globalState } from '../../app/global-state';
2
3
  import { Component } from '../../app/vuetsx';
3
4
 
4
5
  @Component
@@ -47,7 +48,7 @@ class CounterComponentComponent extends Vue {
47
48
  'November',
48
49
  'December',
49
50
  ];
50
- const color = (window as any).Chart.helpers.color;
51
+ const color = globalState.Chart.helpers.color;
51
52
  const barChartData = {
52
53
  labels: [
53
54
  'January',
@@ -10,6 +10,7 @@ import type { ImageDropdownDataItem } from '../dropdown/image-dropdown';
10
10
  import type { TimegridCalendarAddClickedArgs, TimegridCalendarEvent } from '../fullcalendar/timegrid-calendar';
11
11
  import { Temporal } from '@js-temporal/polyfill';
12
12
  import { Prop, toNative } from 'vue-facing-decorator';
13
+ import { globalState } from '../../app/global-state';
13
14
  import TsxComponent, { Component } from '../../app/vuetsx';
14
15
  import { PowerduckViewModelBase } from '../../common/base-component';
15
16
  import Accordion from '../accordion/accordion';
@@ -92,7 +93,7 @@ class TestAllComponentsPageComponent extends PowerduckViewModelBase {
92
93
  }
93
94
 
94
95
  mounted() {
95
- (window as any)._helloInstance = this;
96
+ globalState._helloInstance = this;
96
97
  }
97
98
 
98
99
  getLineChartHeaderOptions(): CardHeaderDropdownArgs[] {
@@ -218,15 +219,17 @@ class TestAllComponentsPageComponent extends PowerduckViewModelBase {
218
219
  autoClose={true}
219
220
  value={this.dateRange}
220
221
  changed={(e) => {
221
- this.dateRange = e
222
+ this.dateRange = e;
222
223
  }}
223
224
  />
224
- <DatetimePicker label="Pick a date"
225
+ <DatetimePicker
226
+ label="Pick a date"
225
227
  value={this.date}
226
228
  showTime={true}
227
229
  changed={(e) => {
228
230
  this.date = e;
229
- }} />
231
+ }}
232
+ />
230
233
  <NumericInput
231
234
  label="Spinner number input"
232
235
  value={this.numberVal}
@@ -330,11 +333,11 @@ class TestAllComponentsPageComponent extends PowerduckViewModelBase {
330
333
  <p>Some modal content1</p>
331
334
  </ModalSection>
332
335
  {this.boolValue == true
333
- && (
334
- <ModalSection icon="icon icon-settings" navCaption="Settings2">
335
- <p>Some modal content2</p>
336
- </ModalSection>
337
- )}
336
+ && (
337
+ <ModalSection icon="icon icon-settings" navCaption="Settings2">
338
+ <p>Some modal content2</p>
339
+ </ModalSection>
340
+ )}
338
341
 
339
342
  <ModalSection icon="icon icon-settings" navCaption="Settings4">
340
343
  <p>Some modal content4444</p>