inviton-powerduck 0.0.165 → 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 (56) 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/package.json +1 -1
  55. package/common/cdn-webpack-shim.ts +0 -5
  56. package/components/input/plugins/daterangepicker/jquery.daterangepicker.min.js +0 -1910
@@ -1,3 +1,5 @@
1
+ import { globalState } from '../app/global-state';
2
+
1
3
  export interface HistoryChangedData {
2
4
  from: any;
3
5
  to: any;
@@ -23,8 +25,8 @@ interface HistoryOnSteroids extends History {
23
25
  removeHistoryChangedListener: (listener: HistoryChangedListener) => void;
24
26
  }
25
27
 
26
- const history: HistoryOnSteroids = window.history as any;
27
- if (!history.__historyExtendedInitialized) {
28
+ const history: HistoryOnSteroids = globalState.history as any;
29
+ if (history != null && !history.__historyExtendedInitialized) {
28
30
  history.__historyExtendedInitialized = true;
29
31
 
30
32
  (function () {
@@ -44,9 +46,9 @@ if (!history.__historyExtendedInitialized) {
44
46
  let silentMode = false; // Flag to suppress events
45
47
 
46
48
  // Function to log state into history
47
- function logState(state, index) {
49
+ const logState = (state: any, index: number) => {
48
50
  stateHistory[index] = { ...state, __heindex: index };
49
- }
51
+ };
50
52
 
51
53
  // Override pushState
52
54
  history.pushState = function (
@@ -102,7 +104,7 @@ if (!history.__historyExtendedInitialized) {
102
104
  };
103
105
 
104
106
  // Popstate listener to detect navigation direction
105
- window.addEventListener('popstate', (event) => {
107
+ globalState.addEventListener('popstate', (event) => {
106
108
  const previousIndex = currentIndex;
107
109
  previousState = stateHistory[previousIndex] || null;
108
110
 
@@ -162,7 +164,7 @@ if (!history.__historyExtendedInitialized) {
162
164
  });
163
165
 
164
166
  // Preserve current state on load and add index
165
- window.addEventListener('load', () => {
167
+ globalState.addEventListener('load', () => {
166
168
  const initialState = history.state || {};
167
169
  if (!initialState.__heindex) {
168
170
  history.replaceState({ ...initialState, __heindex: currentIndex }, '');
@@ -212,18 +214,34 @@ if (!history.__historyExtendedInitialized) {
212
214
 
213
215
  export default class HistoryExtended {
214
216
  static addPopstateListener(handler: HistoryChangedListener) {
217
+ if (!history) {
218
+ return;
219
+ }
220
+
215
221
  history.addHistoryChangedListener(handler);
216
222
  }
217
223
 
218
224
  static removePopstateListener(handler: HistoryChangedListener) {
225
+ if (!history) {
226
+ return;
227
+ }
228
+
219
229
  history.removeHistoryChangedListener(handler);
220
230
  }
221
231
 
222
232
  static nextBackWillNavigateAway(): boolean {
233
+ if (!history) {
234
+ return;
235
+ }
236
+
223
237
  return history.nextBackWillNavigateAway();
224
238
  }
225
239
 
226
240
  static back(args?: { silent?: boolean }): void {
241
+ if (!history) {
242
+ return;
243
+ }
244
+
227
245
  if (args?.silent == true) {
228
246
  history.silentBack();
229
247
  } else {
@@ -232,10 +250,18 @@ export default class HistoryExtended {
232
250
  }
233
251
 
234
252
  static forward(): void {
253
+ if (!history) {
254
+ return;
255
+ }
256
+
235
257
  history.forward();
236
258
  }
237
259
 
238
260
  static go(delta?: number): void {
261
+ if (!history) {
262
+ return;
263
+ }
264
+
239
265
  history.go(delta);
240
266
  }
241
267
 
@@ -244,6 +270,10 @@ export default class HistoryExtended {
244
270
  unused: string,
245
271
  url?: string | URL | null,
246
272
  ): void {
273
+ if (!history) {
274
+ return;
275
+ }
276
+
247
277
  history.pushState(
248
278
  data,
249
279
  unused,
@@ -256,6 +286,10 @@ export default class HistoryExtended {
256
286
  unused: string,
257
287
  url?: string | URL | null,
258
288
  ): void {
289
+ if (!history) {
290
+ return;
291
+ }
292
+
259
293
  history.replaceState(
260
294
  data,
261
295
  unused,
@@ -264,6 +298,10 @@ export default class HistoryExtended {
264
298
  }
265
299
 
266
300
  static clearForward() {
301
+ if (!history) {
302
+ return;
303
+ }
304
+
267
305
  history.clearForward();
268
306
  }
269
307
  }
@@ -1,21 +1,29 @@
1
+ import { globalState } from '../app/global-state';
1
2
  import { ModalUtils } from './../components/modal/modal-utils';
2
3
  import HistoryExtended from './history-extended';
3
4
 
4
5
  export const initHistory = () => {
6
+ if (globalState.windowExists) {
7
+ return;
8
+ }
9
+
5
10
  const randomString = (length: number): string => {
6
11
  let result = '';
7
12
  const chars = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ';
8
- for (let i = length; i > 0; --i) { result += chars[Math.floor(Math.random() * chars.length)]; }
13
+ for (let i = length; i > 0; --i) {
14
+ result += chars[Math.floor(Math.random() * chars.length)];
15
+ }
16
+
9
17
  return result;
10
18
  };
11
19
 
12
20
  const initializer = {
13
21
  intializeModalListener() {
14
- if ((window as any).__historyPowerduckInitialized == true) {
22
+ if (globalState.__historyPowerduckInitialized == true) {
15
23
  return;
16
24
  }
17
25
 
18
- (window as any).__historyPowerduckInitialized = true;
26
+ globalState.__historyPowerduckInitialized = true;
19
27
  $(document).on(
20
28
  'show.bs.modal',
21
29
  '.modal',
@@ -35,11 +43,7 @@ export const initHistory = () => {
35
43
  },
36
44
  );
37
45
 
38
- $(document).on('fdd-show', function (
39
- this: any,
40
- e: any,
41
- elem: HTMLElement,
42
- ) {
46
+ $(document).on('fdd-show', (e: any, elem: HTMLElement) => {
43
47
  if (elem.getAttribute('data-preventhistory') == 'true') {
44
48
  return;
45
49
  }
@@ -78,11 +82,7 @@ export const initHistory = () => {
78
82
  },
79
83
  );
80
84
 
81
- $(document).on('fdd-hide', function (
82
- this: any,
83
- e: any,
84
- elem: HTMLElement,
85
- ) {
85
+ $(document).on('fdd-hide', (e: any, elem: HTMLElement) => {
86
86
  if (elem.getAttribute('data-preventhistory') == 'true') {
87
87
  return;
88
88
  }
@@ -131,11 +131,11 @@ export const initHistory = () => {
131
131
  });
132
132
  },
133
133
  initBackdropFix() {
134
- if ((window as any).__backdropFixInitialized == true) {
134
+ if (globalState.__backdropFixInitialized == true) {
135
135
  return;
136
136
  }
137
137
 
138
- (window as any).__backdropFixInitialized = true;
138
+ globalState.__backdropFixInitialized = true;
139
139
  $(document).on(
140
140
  'show.bs.modal',
141
141
  '.modal',
@@ -1,23 +1,37 @@
1
+ import { globalState } from '../app/global-state';
2
+
1
3
  export default class KeyboardOpenTracker {
2
4
  static bind() {
3
- if ((window as any)._keyboardOpenTrackerBound == true) {
5
+ if (globalState._keyboardOpenTrackerBound == true) {
4
6
  return;
5
7
  }
6
8
 
7
- (window as any)._keyboardOpenTrackerBound = true;
9
+ globalState._keyboardOpenTrackerBound = true;
8
10
 
9
11
  const getOrientation = () => {
10
- return window.matchMedia('(orientation: portrait)').matches ? 'portrait' : 'landscape';
12
+ if (!globalState.matchMedia) {
13
+ return 'portrait';
14
+ }
15
+
16
+ return globalState.matchMedia('(orientation: portrait)').matches ? 'portrait' : 'landscape';
11
17
  };
12
18
 
13
19
  const getScreenHeight = () => {
14
- return window.screen.height; // Constant physical screen height
20
+ if (!globalState.screen) {
21
+ return 0;
22
+ }
23
+
24
+ return globalState.screen.height; // Constant physical screen height
15
25
  };
16
26
 
17
27
  let lastOrientation = getOrientation();
18
28
  const handleResize = () => {
29
+ if (!globalState.windowExists) {
30
+ return;
31
+ }
32
+
19
33
  const currentOrientation = getOrientation();
20
- const currentInnerHeight = window.visualViewport?.height ?? window.innerHeight;
34
+ const currentInnerHeight = globalState.visualViewport?.height ?? globalState.innerHeight;
21
35
  const screenHeight = getScreenHeight();
22
36
 
23
37
  // Different thresholds for portrait/landscape
@@ -38,7 +52,7 @@ export default class KeyboardOpenTracker {
38
52
  document.body.classList.toggle('powerduck-keyboard-open', isKeyboardOpen);
39
53
  };
40
54
 
41
- window.addEventListener('resize', handleResize);
55
+ globalState.addEventListener('resize', handleResize);
42
56
  handleResize(); // Run initially
43
57
  }
44
58
  }
@@ -1,3 +1,4 @@
1
+ import { globalState } from '../app/global-state';
1
2
  import './css/ladda-themeless-zoomin.min.css';
2
3
 
3
4
  /*! Ladda http://lab.hakim.se/ladda MIT licensed Copyright (C) 2016 Hakim El Hattab, http://hakim.se ....Lightweight adaptation for Inviton API needs */
@@ -316,7 +317,7 @@ namespace laddaLiteUtils {
316
317
  function createSpinner(button: any) {
317
318
  let height = button.offsetHeight;
318
319
  if (height === 0) {
319
- height = parseFloat(<any>window.getComputedStyle(button).height);
320
+ height = parseFloat(globalState.getComputedStyle(button).height);
320
321
  }
321
322
 
322
323
  if (height > 32) {
@@ -354,6 +355,10 @@ namespace laddaLiteUtils {
354
355
  }
355
356
 
356
357
  export function createLaddaInstance(button: any) {
358
+ if (!globalState.windowExists) {
359
+ return;
360
+ }
361
+
357
362
  const laddaLabel = document.createElement('span');
358
363
  laddaLabel.setAttribute('class', 'ladda-label');
359
364
 
@@ -389,6 +394,10 @@ export class LaddaLite {
389
394
  return;
390
395
  }
391
396
 
397
+ if (!globalState.windowExists) {
398
+ return;
399
+ }
400
+
392
401
  let laddaInstance;
393
402
  const button = laddaLiteUtils.getTarget(target);
394
403
  const instanceId = laddaLiteUtils.getInstanceId(button);
@@ -410,6 +419,10 @@ export class LaddaLite {
410
419
  return;
411
420
  }
412
421
 
422
+ if (!globalState.windowExists) {
423
+ return;
424
+ }
425
+
413
426
  const button = laddaLiteUtils.getTarget(target);
414
427
  const instanceId = laddaLiteUtils.getInstanceId(button);
415
428
  const laddaInstance = laddaLiteUtils.instanceCache[instanceId];
@@ -1,52 +1,90 @@
1
- const storage = window.localStorage;
2
- delete (window as any).localStorage;
3
- (window as any).localStorage = {};
1
+ import { globalState } from '../app/global-state';
4
2
 
5
- export class LocalStorageImpl {
3
+ // Shim for SSR
4
+ class LocalStorageInMemory {
5
+ private _storage: any = {};
6
6
  get length(): number {
7
- return storage.length;
7
+ return this._storage.length;
8
8
  }
9
9
 
10
10
  clear(): void {
11
- storage.clear();
11
+ this._storage = {};
12
12
  }
13
13
 
14
14
  getItem(key: string): string | null {
15
- return storage.getItem(`public.${key}`);
15
+ return this._storage[key];
16
16
  }
17
17
 
18
18
  key(index: number): string | null {
19
- return storage.key(index);
19
+ return Object.keys(this._storage)[index];
20
20
  }
21
21
 
22
22
  removeItem(key: string): void {
23
- storage.removeItem(`public.${key}`);
23
+ this._storage[key] = null;
24
24
  }
25
25
 
26
26
  setItem(key: string, value: string): void {
27
- storage.setItem(`public.${key}`, value);
27
+ this._storage[key] = value;
28
28
  }
29
29
  }
30
30
 
31
- let newStorage = new LocalStorageImpl();
32
- if (window.Proxy && window.Reflect) {
33
- newStorage = new window.Proxy(newStorage, {
34
- get(target, prop: any) {
35
- if ((storage as any)[prop] != null) {
36
- return window.Reflect.get(target, prop);
37
- } else {
38
- return storage.getItem(`public.${prop}`);
31
+ const storage = globalState.localStorage ?? new LocalStorageInMemory();
32
+ if (!(storage as unknown as any).isPatched && globalState.localStorage != null) {
33
+ try {
34
+ delete (globalState as any).localStorage;
35
+ (globalState as any).localStorage = {};
36
+
37
+ class LocalStorageImpl {
38
+ isPatched = true;
39
+
40
+ get length(): number {
41
+ return storage.length;
39
42
  }
40
- },
41
- set(
42
- target,
43
- prop,
44
- value,
45
- ) {
46
- storage.setItem(`public.${prop as any}`, value);
47
- return true;
48
- },
49
- });
43
+
44
+ clear(): void {
45
+ storage.clear();
46
+ }
47
+
48
+ getItem(key: string): string | null {
49
+ return storage.getItem(`public.${key.replace('public.', '')}`);
50
+ }
51
+
52
+ key(index: number): string | null {
53
+ return storage.key(index);
54
+ }
55
+
56
+ removeItem(key: string): void {
57
+ storage.removeItem(`public.${key}`);
58
+ }
59
+
60
+ setItem(key: string, value: string): void {
61
+ storage.setItem(`public.${key}`, value);
62
+ }
63
+ }
64
+
65
+ let newStorage = new LocalStorageImpl();
66
+ if (globalState.Proxy && globalState.Reflect) {
67
+ newStorage = new globalState.Proxy(newStorage, {
68
+ get(target, prop: any) {
69
+ if ((storage as any)[prop] != null) {
70
+ return globalState.Reflect.get(target, prop);
71
+ } else {
72
+ return storage.getItem(`public.${prop}`);
73
+ }
74
+ },
75
+ set(
76
+ target,
77
+ prop,
78
+ value,
79
+ ) {
80
+ storage.setItem(`public.${prop as any}`, value);
81
+ return true;
82
+ },
83
+ });
84
+ }
85
+
86
+ (globalState as any).localStorage = newStorage;
87
+ } catch (error) { }
50
88
  }
51
89
 
52
90
  /**
@@ -132,5 +170,3 @@ export default class StorageProvider {
132
170
  StorageProvider.setString(key, storeVal);
133
171
  }
134
172
  }
135
-
136
- (window as any).localStorage = newStorage;
@@ -1,83 +1,89 @@
1
+ import { globalState } from "../app/global-state";
2
+
1
3
  export default class ResourceHelper {
2
- static loadResourcesDynamically(files: { src: string; type: 'js' | 'css'; mode?: 'normal' | 'module' }[]): Promise<boolean> {
3
- return new Promise((resolve) => {
4
- const loadScript = (
5
- src: string,
6
- mode?: 'normal' | 'module',
7
- retries = 3,
8
- ) => {
9
- return new Promise((resolve, reject) => {
10
- const attemptLoad = (attempt) => {
11
- const script = document.createElement('script');
12
- script.src = src;
13
- script.async = true;
4
+ static loadResourcesDynamically(files: { src: string; type: 'js' | 'css'; mode?: 'normal' | 'module' }[]): Promise<boolean> {
5
+ return new Promise((resolve) => {
6
+ const loadScript = (
7
+ src: string,
8
+ mode?: 'normal' | 'module',
9
+ retries = 3,
10
+ ) => {
11
+ return new Promise((resolve, reject) => {
12
+ if (!globalState.windowExists) {
13
+ resolve('Not supported for SSR');
14
+ }
15
+
16
+ const attemptLoad = (attempt) => {
17
+ const script = document.createElement('script');
18
+ script.src = src;
19
+ script.async = true;
14
20
 
15
- if (mode == 'module') {
16
- script.type = 'module';
17
- }
21
+ if (mode == 'module') {
22
+ script.type = 'module';
23
+ }
18
24
 
19
- script.onload = () => resolve(`Loaded: ${src}`);
20
- script.onerror = () => {
21
- if (attempt < retries) {
22
- const delay = Math.floor(Math.random() * (1200 - 500 + 1)) + 500;
23
- console.warn(`Retrying ${src} in ${delay}ms... (${attempt + 1}/${retries})`);
24
- setTimeout(() => attemptLoad(attempt + 1), delay);
25
- } else {
26
- reject(new Error(`Failed to load: ${src}`));
27
- }
28
- };
25
+ script.onload = () => resolve(`Loaded: ${src}`);
26
+ script.onerror = () => {
27
+ if (attempt < retries) {
28
+ const delay = Math.floor(Math.random() * (1200 - 500 + 1)) + 500;
29
+ console.warn(`Retrying ${src} in ${delay}ms... (${attempt + 1}/${retries})`);
30
+ setTimeout(() => attemptLoad(attempt + 1), delay);
31
+ } else {
32
+ reject(new Error(`Failed to load: ${src}`));
33
+ }
34
+ };
29
35
 
30
- document.head.appendChild(script);
31
- };
36
+ document.head.appendChild(script);
37
+ };
32
38
 
33
- attemptLoad(0);
34
- });
35
- };
39
+ attemptLoad(0);
40
+ });
41
+ };
36
42
 
37
- const loadCSS = (href: string, retries = 3) => {
38
- return new Promise((resolve, reject) => {
39
- const attemptLoad = (attempt) => {
40
- const link = document.createElement('link');
41
- link.rel = 'stylesheet';
42
- link.href = href;
43
+ const loadCSS = (href: string, retries = 3) => {
44
+ return new Promise((resolve, reject) => {
45
+ const attemptLoad = (attempt) => {
46
+ const link = document.createElement('link');
47
+ link.rel = 'stylesheet';
48
+ link.href = href;
43
49
 
44
- link.onload = () => resolve(`Loaded: ${href}`);
45
- link.onerror = () => {
46
- if (attempt < retries) {
47
- const delay = Math.floor(Math.random() * (1200 - 500 + 1)) + 500;
48
- console.warn(`Retrying ${href} in ${delay}ms... (${attempt + 1}/${retries})`);
49
- setTimeout(() => attemptLoad(attempt + 1), delay);
50
- } else {
51
- reject(new Error(`Failed to load: ${href}`));
52
- }
53
- };
50
+ link.onload = () => resolve(`Loaded: ${href}`);
51
+ link.onerror = () => {
52
+ if (attempt < retries) {
53
+ const delay = Math.floor(Math.random() * (1200 - 500 + 1)) + 500;
54
+ console.warn(`Retrying ${href} in ${delay}ms... (${attempt + 1}/${retries})`);
55
+ setTimeout(() => attemptLoad(attempt + 1), delay);
56
+ } else {
57
+ reject(new Error(`Failed to load: ${href}`));
58
+ }
59
+ };
54
60
 
55
- document.head.appendChild(link);
56
- };
61
+ document.head.appendChild(link);
62
+ };
57
63
 
58
- attemptLoad(0);
59
- });
60
- };
64
+ attemptLoad(0);
65
+ });
66
+ };
61
67
 
62
- Promise.all(files.map((file) => {
63
- if (file.type == 'js') {
64
- return loadScript(file.src, file.mode).then(result => ({ status: 'fulfilled', value: result }), error => ({ status: 'rejected', reason: error }));
65
- } else if (file.type == 'css') {
66
- return loadCSS(file.src).then(result => ({ status: 'fulfilled', value: result }), error => ({ status: 'rejected', reason: error }));
67
- } else {
68
- return Promise.resolve({ status: 'rejected', reason: new Error(`Unsupported file type: ${file}`) });
69
- }
70
- })).then((results) => {
71
- let allOk = true;
72
- results.forEach((result) => {
73
- if (result.status != 'fulfilled') {
74
- console.error((result as any).reason);
75
- allOk = false;
76
- }
77
- });
68
+ Promise.all(files.map((file) => {
69
+ if (file.type == 'js') {
70
+ return loadScript(file.src, file.mode).then(result => ({ status: 'fulfilled', value: result }), error => ({ status: 'rejected', reason: error }));
71
+ } else if (file.type == 'css') {
72
+ return loadCSS(file.src).then(result => ({ status: 'fulfilled', value: result }), error => ({ status: 'rejected', reason: error }));
73
+ } else {
74
+ return Promise.resolve({ status: 'rejected', reason: new Error(`Unsupported file type: ${file}`) });
75
+ }
76
+ })).then((results) => {
77
+ let allOk = true;
78
+ results.forEach((result) => {
79
+ if (result.status != 'fulfilled') {
80
+ console.error((result as any).reason);
81
+ allOk = false;
82
+ }
83
+ });
78
84
 
79
- resolve(allOk);
80
- });
81
- });
82
- }
85
+ resolve(allOk);
86
+ });
87
+ });
88
+ }
83
89
  }
@@ -1,4 +1,5 @@
1
1
  import type { Vue } from 'vue-facing-decorator';
2
+ import { globalState } from '../app/global-state';
2
3
  import PowerduckState from '../app/powerduck-state';
3
4
  import TemporalUtils from './utils/temporal-utils';
4
5
 
@@ -36,7 +37,7 @@ export default class ScrollUtils {
36
37
  animated?: boolean,
37
38
  instant?: boolean,
38
39
  ): void {
39
- if (elem == null) {
40
+ if (elem == null || !globalState.scrollTo) {
40
41
  return;
41
42
  }
42
43
 
@@ -46,7 +47,7 @@ export default class ScrollUtils {
46
47
  otherHeaderHeight = $('header').height();
47
48
  }
48
49
 
49
- if (($(window).width() as number < 768 && mobileOffset != false) || otherHeaderHeight > 0) {
50
+ if (($(globalState).width() as number < 768 && mobileOffset != false) || otherHeaderHeight > 0) {
50
51
  if ((mobileOffset as number) > 1) {
51
52
  offset = mobileOffset as number;
52
53
  } else {
@@ -87,15 +88,19 @@ export default class ScrollUtils {
87
88
  animated?: boolean,
88
89
  instant?: boolean,
89
90
  ): void {
91
+ if (!globalState.scrollTo) {
92
+ return;
93
+ }
94
+
90
95
  if (instant != true) {
91
96
  setTimeout(() => {
92
- (context?.length > 0 ? context[0] : window).scrollTo({
97
+ (context?.length > 0 ? context[0] : globalState).scrollTo({
93
98
  top: position,
94
99
  behavior: (animated != false ? 'smooth' : 'instant') as any,
95
100
  });
96
101
  });
97
102
  } else {
98
- (context?.length > 0 ? context[0] : window).scrollTo({
103
+ (context?.length > 0 ? context[0] : globalState).scrollTo({
99
104
  top: position,
100
105
  behavior: (animated != false ? 'smooth' : 'instant') as any,
101
106
  });
@@ -1,10 +1,11 @@
1
1
  import type { Vue } from 'vue-facing-decorator';
2
+ import { globalState } from '../app/global-state';
2
3
  import PowerduckState from '../app/powerduck-state';
3
4
 
4
5
  type VueType = typeof Vue.prototype;
5
- export function setCurrentUrl(instance: VueType, url: string) {
6
- const newUrl = new URL(url, window.location.origin);
7
- const currentUrl = new URL(window.location.href);
6
+ export const setCurrentUrl = (instance: VueType, url: string) => {
7
+ const newUrl = new URL(url, globalState.location.origin);
8
+ const currentUrl = new URL(globalState.location.href);
8
9
  const router = PowerduckState.getRouter();
9
10
  const route = PowerduckState.getCurrentRouteQuery();
10
11
 
@@ -14,7 +15,9 @@ export function setCurrentUrl(instance: VueType, url: string) {
14
15
 
15
16
  let nextTick = instance?.$nextTick;
16
17
  if (nextTick == null) {
17
- nextTick = (cb) => { cb(); };
18
+ nextTick = (cb) => {
19
+ cb();
20
+ };
18
21
  }
19
22
 
20
23
  if (currentUrl.href != newUrl.href) {
@@ -35,4 +38,4 @@ export function setCurrentUrl(instance: VueType, url: string) {
35
38
  }
36
39
  }, 500);
37
40
  }
38
- }
41
+ };
@@ -1,3 +1,5 @@
1
+ import { globalState } from "../../app/global-state";
2
+
1
3
  export default class CheckboxUtils {
2
4
  private static shiftClickBound: boolean = false;
3
5
 
@@ -5,6 +7,10 @@ export default class CheckboxUtils {
5
7
  if (!CheckboxUtils.shiftClickBound) {
6
8
  CheckboxUtils.shiftClickBound = true;
7
9
 
10
+ if (!globalState.windowExists) {
11
+ return;
12
+ }
13
+
8
14
  $(document).on(
9
15
  'click',
10
16
  '.dt-selection-checkbox .inv-chckb-clickable',