inviton-powerduck 0.0.167 → 0.0.169

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.
@@ -4,17 +4,17 @@ type DocumentShim = typeof Document.prototype & { windowExists: boolean };
4
4
  const globalState: GlobalState = (typeof window !== 'undefined')
5
5
  ? window
6
6
  : {
7
- addEventListener() { },
8
- removeEventListener() { },
9
- matchMedia() { return {}; },
10
- getComputedStyle() { return {}; },
7
+ addEventListener: () => { },
8
+ removeEventListener: () => { },
9
+ matchMedia: () => ({}),
10
+ getComputedStyle: () => ({}),
11
11
  fetch,
12
12
  } as any;
13
13
 
14
14
  const documentWrap: DocumentShim = (typeof window !== 'undefined')
15
15
  ? document
16
16
  : {
17
- querySelector() { return null }
17
+ querySelector: () => null,
18
18
  } as any;
19
19
 
20
20
  if (typeof window !== 'undefined') {
@@ -25,4 +25,4 @@ if (typeof window !== 'undefined') {
25
25
  documentWrap.windowExists = false;
26
26
  }
27
27
 
28
- export { globalState, documentWrap };
28
+ export { documentWrap, globalState };
@@ -19,7 +19,10 @@ export default class PowerduckInitializer {
19
19
  globalState.jQuery = jquery;
20
20
  globalState.$ = globalState.jQuery;
21
21
  globalState.moment = moment;
22
- globalState.select2 = select2();
22
+
23
+ if (globalState.windowExists) {
24
+ globalState.select2 = select2();
25
+ }
23
26
 
24
27
  if (globalState.__viteErrHandlerBound != true) {
25
28
  globalState.__viteErrHandlerBound = true;
@@ -3,7 +3,7 @@ import { ModalUtils } from './../components/modal/modal-utils';
3
3
  import HistoryExtended from './history-extended';
4
4
 
5
5
  export const initHistory = () => {
6
- if (globalState.windowExists) {
6
+ if (!globalState.windowExists) {
7
7
  return;
8
8
  }
9
9
 
@@ -1,11 +1,13 @@
1
1
  import type { DropdownButtonItemArgs } from '../dropdown-button/dropdown-button-item';
2
2
  import type { FormItemWrapperArgs, MarginType } from '../form/form-item-wrapper';
3
+ import { globalState } from '../../app/global-state';
3
4
  import Sortable from 'sortablejs';
4
5
  import { h as _h, h, render, VNodeChild } from 'vue';
5
6
  import { Prop, toNative } from 'vue-facing-decorator';
6
7
  import PowerduckState from '../../app/powerduck-state';
7
8
  import TsxComponent, { Component } from '../../app/vuetsx';
8
9
  import { remove } from '../../common/extensions/array-extensions';
10
+ import { capitalize } from '../../common/extensions/string-extensions';
9
11
  import { isNullOrEmpty } from '../../common/utils/is-null-or-empty';
10
12
  import { PortalUtils } from '../../common/utils/utils';
11
13
  import FormItemWrapper from '../form/form-item-wrapper';
@@ -16,7 +18,6 @@ import './ts/select2-multi-checkboxes';
16
18
  import 'select2/dist/css/select2.css';
17
19
  import './../../app/css/input-effects.css';
18
20
  import './css/dropdown.css';
19
- import { capitalize } from '../../common/extensions/string-extensions';
20
21
 
21
22
  type RowToString = (row) => string;
22
23
  export enum MultiselectMode {
@@ -110,7 +111,7 @@ export interface DropdownTrailingButtonArgs {
110
111
  clicked: (row: any) => void;
111
112
  }
112
113
 
113
- const s2Utils = ($ as any).fn.select2.amd.require('select2/utils');
114
+ const s2Utils = globalState.windowExists ? ($ as any).fn.select2.amd.require('select2/utils') : {};
114
115
  class DropdownSelect2Helper {
115
116
  static getSelect2Instance(s2Elem: JQuery<Element>): any {
116
117
  return s2Utils.GetData(s2Elem[0], 'select2');
@@ -770,11 +771,10 @@ class DropdownListComponent extends TsxComponent<DropdownListArgs> implements Dr
770
771
  $container.addClass('pd-dropdown-close-animation');
771
772
  }
772
773
 
773
- $container.one('animationend', function () {
774
+ $container.one('animationend', () => {
774
775
  $container.removeClass('pd-dropdown-close-animation pd-dropdown-close-animation-above');
775
776
  });
776
777
 
777
-
778
778
  if (self.pendingChange != null) {
779
779
  const data = self.pendingChange?.data;
780
780
  self.pendingChange = null;
@@ -4,8 +4,6 @@ import TemporalUtils from '../../../common/utils/temporal-utils';
4
4
  import ListviewBuilder from './legacy_lvb';
5
5
  import './legacy_fdd.css';
6
6
 
7
- const $ = jQuery;
8
-
9
7
  export interface FilterableSelectArgs {
10
8
  elem: JQuery | string;
11
9
  data: FilterableSelectDataSource[];
@@ -39,6 +37,7 @@ export interface FilterableSelectDataSource {
39
37
  }
40
38
 
41
39
  export default function FilterableSelect(this: any, args: FilterableSelectArgs): void {
40
+ const $ = jQuery;
42
41
  const iframeTopMode = !(args.iframeTopMode == false);
43
42
  let contextWindow, contextBody;
44
43
 
@@ -1,8 +1,14 @@
1
+ /* eslint-disable unicorn/new-for-builtins */
2
+ /* eslint-disable no-new-wrappers */
3
+ /* eslint-disable no-empty */
4
+ /* eslint-disable ts/no-use-before-define */
5
+ /* eslint-disable ts/no-this-alias */
6
+ /* eslint-disable new-cap */
1
7
  import { globalState } from '../../../app/global-state';
2
8
 
3
- const $ = jQuery;
4
-
5
9
  export default function ListviewBuilder(this: any): void {
10
+ const $ = jQuery;
11
+
6
12
  const self = this;
7
13
  self.parentTemplate = null;
8
14
  self.itemTemplate = null;
@@ -19,7 +25,7 @@ export default function ListviewBuilder(this: any): void {
19
25
  self.pageText = 'Page';
20
26
  self._filterResults = null;
21
27
 
22
- self.build = function () {
28
+ self.build = () => {
23
29
  self._filterVal = '';
24
30
  self.internal.getTemplates();
25
31
  self.internal.buildFilter();
@@ -28,7 +34,7 @@ export default function ListviewBuilder(this: any): void {
28
34
  self.internal.buildPagination();
29
35
  };
30
36
 
31
- self._getRowLine = function (item) {
37
+ self._getRowLine = (item) => {
32
38
  let itemLine = self.itemTemplate;
33
39
  for (const prop in item) {
34
40
  itemLine = itemLine.replace(new RegExp(`{${prop}}`, 'g'), item[prop]);
@@ -36,7 +42,7 @@ export default function ListviewBuilder(this: any): void {
36
42
  return itemLine;
37
43
  };
38
44
 
39
- self.appendRowLine = function (item, isSorted) {
45
+ self.appendRowLine = (item, isSorted) => {
40
46
  const newIndex = self.data.length;
41
47
  const itemLine = self._getRowLine(item);
42
48
  self.data.push(item);
@@ -44,16 +50,16 @@ export default function ListviewBuilder(this: any): void {
44
50
  self.internal.buildRows();
45
51
  };
46
52
 
47
- self.refreshRowLine = function (item, index) {
53
+ self.refreshRowLine = (item, index) => {
48
54
  const itemLine = self._getRowLine(item);
49
55
  self._itemRows[index] = itemLine;
50
56
  };
51
57
 
52
- self.filterFunc = function (
58
+ self.filterFunc = (
53
59
  filterValue,
54
60
  pageLimit,
55
61
  builder,
56
- ) {
62
+ ) => {
57
63
  const data = self.data;
58
64
  const field = self.filterField;
59
65
  const key = filterValue.toLowerCase();
@@ -79,7 +85,7 @@ export default function ListviewBuilder(this: any): void {
79
85
  };
80
86
 
81
87
  this.internals = function () {
82
- this.getTemplates = function () {
88
+ this.getTemplates = () => {
83
89
  self._prodSearchTemplate = '<div class="lvb-filter-erase"><span class="far fa-trash-alt"></span></div><input type="text" class="lvb-filter-input">';
84
90
 
85
91
  let displayPagination;
@@ -95,7 +101,7 @@ export default function ListviewBuilder(this: any): void {
95
101
  self.targetElem.html(`${filterPart}<div class="items-container"></div><div class="paginator-container" ${displayPagination}></div>`);
96
102
  };
97
103
 
98
- this.buildFilter = function () {
104
+ this.buildFilter = () => {
99
105
  if (self.filter) {
100
106
  const filterContext = $('.lvb-filter-container', self.targetElem).first();
101
107
  filterContext.html(self._prodSearchTemplate);
@@ -140,7 +146,7 @@ export default function ListviewBuilder(this: any): void {
140
146
  }
141
147
  };
142
148
 
143
- this.buildRowLines = function () {
149
+ this.buildRowLines = () => {
144
150
  self._itemRows = new Object();
145
151
  if (self.data != null && self.data.length > 0) {
146
152
  for (let i = 0; i < self.data.length; i++) {
@@ -150,19 +156,19 @@ export default function ListviewBuilder(this: any): void {
150
156
  }
151
157
  };
152
158
 
153
- function replaceHtml(el, html) {
159
+ const replaceHtml = (el, html) => {
154
160
  const oldEl = typeof el === 'string' ? document.getElementById(el) : el;
155
161
  /* @cc_on // Pure innerHTML is slightly faster in IE
156
- oldEl.innerHTML = html;
157
- return oldEl;
158
- @ */
162
+ oldEl.innerHTML = html;
163
+ return oldEl;
164
+ @ */
159
165
  const newEl = oldEl.cloneNode(false);
160
166
  newEl.innerHTML = html;
161
167
  oldEl.parentNode.replaceChild(newEl, oldEl);
162
168
  /* Since we just removed the old element from the DOM, return a reference
163
- to the new element, which can be used to restore variable references. */
169
+ to the new element, which can be used to restore variable references. */
164
170
  return newEl;
165
- };
171
+ };;
166
172
 
167
173
  this.buildRows = function () {
168
174
  const rows = self._itemRows;
@@ -223,13 +229,13 @@ export default function ListviewBuilder(this: any): void {
223
229
  }
224
230
  };
225
231
 
226
- this.replaceInnerHTML = function (oldDiv, html) {
232
+ this.replaceInnerHTML = (oldDiv, html) => {
227
233
  const newDiv = oldDiv.cloneNode(false);
228
234
  newDiv.innerHTML = html;
229
235
  oldDiv.parentNode.replaceChild(newDiv, oldDiv);
230
236
  };
231
237
 
232
- this.bindClickHandler = function () {
238
+ this.bindClickHandler = () => {
233
239
  if (self.itemClicked != null) {
234
240
  $('li', $('.items-container', self.targetElem)).bind(self.clickEventName, self.itemClicked);
235
241
  }
@@ -291,7 +297,7 @@ export default function ListviewBuilder(this: any): void {
291
297
  $('.current-pg-page', self._paginatorContainer).text(self._pageIndex + 1);
292
298
  };
293
299
 
294
- this.getPageLimit = function () {
300
+ this.getPageLimit = () => {
295
301
  if (self.pagingCount != null) {
296
302
  return self.pagingCount;
297
303
  } else {
@@ -299,7 +305,7 @@ export default function ListviewBuilder(this: any): void {
299
305
  }
300
306
  };
301
307
 
302
- this.getCurrentIndex = function () {
308
+ this.getCurrentIndex = () => {
303
309
  if (self._pageIndex != null) {
304
310
  return self._pageIndex;
305
311
  } else {
@@ -316,16 +322,16 @@ export default function ListviewBuilder(this: any): void {
316
322
  }
317
323
  };
318
324
 
319
- this.getFilledParent = function (content) {
320
- return self.parentTemplate.replace(/\{content\}/g, content);
321
- };
325
+ this.getFilledParent = content => self.parentTemplate.replace(/\{content\}/g, content);
322
326
 
323
327
  this.stringBuilder = function () {
324
328
  let strings = [];
325
329
 
326
- this.append = function (string) {
330
+ this.append = (string) => {
327
331
  string = verify(string);
328
- if (string.length > 0) { strings[strings.length] = string; }
332
+ if (string.length > 0) {
333
+ strings[strings.length] = string;
334
+ }
329
335
  };
330
336
 
331
337
  this.appendLine = function (string) {
@@ -333,33 +339,38 @@ export default function ListviewBuilder(this: any): void {
333
339
  if (this.isEmpty()) {
334
340
  if (string.length > 0) {
335
341
  strings[strings.length] = string;
336
- } else {}
342
+ } else { }
337
343
  } else {
338
344
  strings[strings.length] = string.length > 0 ? `\r\n${string}` : '\r\n';
339
345
  }
340
346
  };
341
347
 
342
- this.clear = function () { strings = []; };
348
+ this.clear = () => {
349
+ strings = [];
350
+ };
343
351
 
344
- this.isEmpty = function () { return strings.length == 0; };
352
+ this.isEmpty = () => strings.length == 0;
345
353
 
346
- this.toString = function () { return strings.join(''); };
354
+ this.toString = () => strings.join('');
347
355
 
348
- var verify = function (string) {
349
- if (!defined(string)) { return ''; }
356
+ let verify = (string) => {
357
+ if (!defined(string)) {
358
+ return '';
359
+ }
350
360
 
351
- if (getType(string) != getType(new String())) { return String(string); }
361
+ if (getType(string) != getType(new String())) {
362
+ return String(string);
363
+ }
352
364
 
353
365
  return string;
354
366
  };
355
367
 
356
- var defined = function (el) {
357
- // Changed per Ryan O'Hara's comment:
358
- return el != null && typeof (el) != 'undefined';
359
- };
368
+ let defined = el => el != null && typeof (el) != 'undefined';
360
369
 
361
- var getType = function (instance) {
362
- if (!defined(instance.constructor)) { throw new Error('Unexpected object type'); }
370
+ let getType = (instance) => {
371
+ if (!defined(instance.constructor)) {
372
+ throw new Error('Unexpected object type');
373
+ }
363
374
 
364
375
  const type = String(instance.constructor).match(/function\s+(\w+)/);
365
376
 
@@ -1,3 +1,5 @@
1
+ /* eslint-disable */
2
+ import { globalState } from '@powerduck/app/global-state';
1
3
  import PowerduckState from '../../../app/powerduck-state';
2
4
  import { PortalUtils } from '../../../common/utils/utils';
3
5
 
@@ -11,6 +13,11 @@ import { PortalUtils } from '../../../common/utils/utils';
11
13
  * License : MIT
12
14
  */
13
15
  (function ($) {
16
+ if (!globalState.windowExists) {
17
+ $.fn.select2MultiCheckboxes = () => { };
18
+ return;
19
+ }
20
+
14
21
  const s2Utils = ($ as any).fn.select2.amd.require('select2/utils');
15
22
  const exclusiveBinder = function (jqElem, s2Instance) {
16
23
  const uuid = PortalUtils.randomString(10);
@@ -84,7 +91,7 @@ import { PortalUtils } from '../../../common/utils/utils';
84
91
  self.$element.select2({
85
92
  allowClear: true,
86
93
  ajax: {
87
- transport (
94
+ transport(
88
95
  params,
89
96
  success,
90
97
  failure,
@@ -285,4 +292,4 @@ import { PortalUtils } from '../../../common/utils/utils';
285
292
  });
286
293
  },
287
294
  });
288
- })(jQuery);
295
+ })(globalState.$);
@@ -14,8 +14,8 @@ import TemporalUtils from '../../common/utils/temporal-utils';
14
14
  import { PortalUtils } from '../../common/utils/utils';
15
15
  import FormItemWrapper from '../form/form-item-wrapper';
16
16
  import DateInputHelper, { DateInputUsage } from './ts/dateInputHelper';
17
- import 'bootstrap-datetime-picker';
18
- import 'bootstrap-datetime-picker/css/bootstrap-datetimepicker.min.css';
17
+ import './plugins/datetimepicker/datetimepicker';
18
+ import './plugins/datetimepicker/css/bootstrap-datetimepicker.css';
19
19
 
20
20
  interface DatetimePickerArgs extends FormItemWrapperArgs {
21
21
  value: Temporal.PlainDateTime;
@@ -10,6 +10,7 @@ import TemporalUtils from '../../../../common/utils/temporal-utils';
10
10
  import DaterangePickerConfig from './daterangepicker-config';
11
11
  import './daterangepicker.css';
12
12
  import { utcEpochMilliseconds } from '../../../../common/extensions/temporal-extensions';
13
+ import { globalState } from '../../../../app/global-state';
13
14
 
14
15
  (function ($: any) {
15
16
  $.dateRangePickerLanguages = {
@@ -2628,4 +2629,4 @@ import { utcEpochMilliseconds } from '../../../../common/extensions/temporal-ext
2628
2629
  showGap();
2629
2630
  }
2630
2631
  };
2631
- })($);
2632
+ })(globalState.$);