inviton-powerduck 0.0.154 → 0.0.155

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 (60) hide show
  1. package/app/powerduck-initializer.ts +3 -3
  2. package/common/api-http.ts +20 -14
  3. package/common/css/ladda-themeless-zoomin.min.css +89 -89
  4. package/common/enum-translation/day-translator.ts +3 -2
  5. package/common/excel/excel-reader.ts +2 -9
  6. package/common/extensions/array-extensions.ts +116 -0
  7. package/common/extensions/string-extensions.ts +92 -0
  8. package/common/extensions/temporal-extensions.ts +115 -0
  9. package/common/scroll-utils.ts +2 -1
  10. package/common/temporal-helpers.ts +551 -0
  11. package/common/timezone-helper.ts +39 -29
  12. package/common/utils/cookie.ts +11 -8
  13. package/common/utils/date-localization-utils.ts +25 -19
  14. package/common/utils/date-utils.ts +37 -47
  15. package/common/utils/form-utils.ts +3 -1
  16. package/common/utils/language-utils.ts +21 -27
  17. package/common/utils/temporal-utils.ts +43 -0
  18. package/common/utils/upload-image-helper.ts +1 -1
  19. package/common/utils/utils.ts +14 -14
  20. package/common/validation.ts +17 -5
  21. package/components/chart-js/line-chart-flot.tsx +9 -9
  22. package/components/chart-js/thirdparty/flot/jquery.flot.categories.min.js +93 -93
  23. package/components/chart-js/thirdparty/flot/jquery.flot.crosshair.min.js +83 -83
  24. package/components/chart-js/thirdparty/flot/jquery.flot.navigate.min.js +270 -270
  25. package/components/chart-js/thirdparty/flot/jquery.flot.pie.min.js +507 -507
  26. package/components/chart-js/thirdparty/flot/jquery.flot.resize.js +7 -9
  27. package/components/chart-js/thirdparty/flot/jquery.flot.resize.min.js +9 -11
  28. package/components/chart-js/thirdparty/flot/jquery.flot.stack.min.js +104 -104
  29. package/components/chart-js/ts/line-chart-contracts.ts +2 -2
  30. package/components/container-with-breakpoints/ts/breakpoint-handler.ts +2 -2
  31. package/components/counter/testall.tsx +89 -75
  32. package/components/datatable/datatable.tsx +2379 -2375
  33. package/components/datatable/export-excel-modal.tsx +12 -14
  34. package/components/datatable/ts/reorder.ts +4 -2
  35. package/components/dropdown/index.tsx +48 -22
  36. package/components/dropdown/mobile/legacy_fdd.ts +10 -11
  37. package/components/dropzone/gallery-dropzone.tsx +394 -382
  38. package/components/fullcalendar/fullcalendar-draggable-event.tsx +8 -7
  39. package/components/fullcalendar/timegrid-calendar.tsx +60 -67
  40. package/components/image-crop/image-cropping-modal.tsx +9 -8
  41. package/components/image-crop/upload-and-crop.tsx +162 -162
  42. package/components/image-crop/vendor/jquery.Jcrop.min.css +344 -344
  43. package/components/import/import-mapper.tsx +2 -2
  44. package/components/input/daterange-picker.tsx +502 -521
  45. package/components/input/datetime-picker.tsx +45 -50
  46. package/components/input/plugins/daterangepicker/daterangepicker.min.css +400 -400
  47. package/components/input/plugins/daterangepicker/jquery.daterangepicker.min.js +346 -339
  48. package/components/input/plugins/daterangepicker/jquery.daterangepicker.ts +580 -402
  49. package/components/input/radio-button-group.tsx +2 -2
  50. package/components/input/ts/dateInputHelper.ts +1 -0
  51. package/components/input/wysiwig.tsx +12 -7
  52. package/components/svg/skilift-svg.tsx +6 -6
  53. package/package.json +2 -1
  54. package/common/date-wrapper.ts +0 -422
  55. package/common/utils/array-extend.ts +0 -215
  56. package/common/utils/array-remove.ts +0 -10
  57. package/common/utils/array-sort.ts +0 -56
  58. package/common/utils/capitalize-string.ts +0 -11
  59. package/common/utils/format-string.ts +0 -14
  60. package/common/utils/latinize-string.ts +0 -7
@@ -97,22 +97,21 @@ class TableExportModalComponent extends TsxComponent<TableExportModalBindingArgs
97
97
  }
98
98
  }
99
99
 
100
- const mySelf = this;
101
100
  apiClient[apiMethod](ajaxArgs).then((data: any) => {
102
101
  const attrName = exportConfig != null && exportConfig.attrName != null ? exportConfig.attrName : 'Rows';
103
102
  const rows = data[attrName];
104
103
 
105
104
  rows.forEach((row) => {
106
- mySelf.rows.push(row);
105
+ this.rows.push(row);
107
106
  });
108
107
 
109
- mySelf.downloadedCount += rows.length;
108
+ this.downloadedCount += rows.length;
110
109
  if (rows.length < STEP_COUNT) {
111
- mySelf.totalFilteredCount = mySelf.downloadedCount;
112
- mySelf.dataLoaded = true;
113
- mySelf.exportExcel();
110
+ this.totalFilteredCount = this.downloadedCount;
111
+ this.dataLoaded = true;
112
+ this.exportExcel();
114
113
  } else {
115
- mySelf.downloadDataChunk(
114
+ this.downloadDataChunk(
116
115
  apiClient,
117
116
  apiMethod,
118
117
  ajaxArgs,
@@ -121,7 +120,7 @@ class TableExportModalComponent extends TsxComponent<TableExportModalBindingArgs
121
120
  exportConfig,
122
121
  );
123
122
  }
124
- }).catch((err) => {
123
+ }).catch(() => {
125
124
  NotificationProvider.showErrorMessage(PowerduckState.getResourceValue('errorFetchingData'));
126
125
  this.hideExportModal();
127
126
  });
@@ -144,8 +143,11 @@ class TableExportModalComponent extends TsxComponent<TableExportModalBindingArgs
144
143
  });
145
144
 
146
145
  const workbook = new (ExcelJsProvider.excelJsInstance()).Workbook();
146
+ // eslint-disable-next-line no-restricted-syntax
147
147
  workbook.created = new Date();
148
+ // eslint-disable-next-line no-restricted-syntax
148
149
  workbook.modified = new Date();
150
+ // eslint-disable-next-line no-restricted-syntax
149
151
  workbook.lastPrinted = new Date();
150
152
 
151
153
  const worksheet = workbook.addWorksheet('Export');
@@ -182,7 +184,6 @@ class TableExportModalComponent extends TsxComponent<TableExportModalBindingArgs
182
184
  worksheet.addRow(rowExportData);
183
185
  });
184
186
 
185
- const mySelf = this;
186
187
  workbook.xlsx.writeBuffer().then((data: any) => {
187
188
  const blob = new Blob([data], { type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' });
188
189
  PortalUtils.downloadBlob(
@@ -190,15 +191,12 @@ class TableExportModalComponent extends TsxComponent<TableExportModalBindingArgs
190
191
  'export.xlsx',
191
192
  () => {
192
193
  setTimeout(() => {
193
- mySelf.hideExportModal();
194
+ this.hideExportModal();
194
195
  }, 300);
195
196
  },
196
197
  );
197
198
  }).catch((err) => {
198
- const omg = err;
199
- if (omg == 'wtf') {
200
- alert('wtf..');
201
- }
199
+ console.error(err);
202
200
  });
203
201
  }
204
202
  }
@@ -1,4 +1,6 @@
1
+ /* eslint-disable func-style */
1
2
  // Based on https://github.com/loonywizard/native-js-dnd-list by Vladimir Nikitin
3
+ import TemporalUtils from '../../../common/utils/temporal-utils';
2
4
  import { PortalUtils } from '../../../common/utils/utils';
3
5
  import './../css/reorder.css';
4
6
 
@@ -113,7 +115,7 @@ function raiseOnReorderedEvent() {
113
115
  }
114
116
 
115
117
  function raiseOnClickedEvent() {
116
- const now = new Date().getTime();
118
+ const now = TemporalUtils.dateNowMs();
117
119
  if (now - timeStart < CLICK_THRESHOLD) {
118
120
  onClick();
119
121
  }
@@ -175,7 +177,7 @@ export default class ReorderProvider {
175
177
  wasDragged = false;
176
178
  draggingItem = e.target;
177
179
  isMouseDown = true;
178
- timeStart = new Date().getTime();
180
+ timeStart = TemporalUtils.dateNowMs();
179
181
  onClick = onClickHandler;
180
182
  onReorder = onReorderHandler;
181
183
  }
@@ -1,12 +1,11 @@
1
1
  import type { DropdownButtonItemArgs } from '../dropdown-button/dropdown-button-item';
2
2
  import type { FormItemWrapperArgs, MarginType } from '../form/form-item-wrapper';
3
- import { h as _h, h, render, VNodeChild } from 'vue'
4
3
  import Sortable from 'sortablejs';
4
+ import { h as _h, h, render, VNodeChild } from 'vue';
5
5
  import { Prop, toNative } from 'vue-facing-decorator';
6
6
  import PowerduckState from '../../app/powerduck-state';
7
7
  import TsxComponent, { Component } from '../../app/vuetsx';
8
- import { arrayRemove } from '../../common/utils/array-remove';
9
- import { capitalize } from '../../common/utils/capitalize-string';
8
+ import { remove } from '../../common/extensions/array-extensions';
10
9
  import { isNullOrEmpty } from '../../common/utils/is-null-or-empty';
11
10
  import { PortalUtils } from '../../common/utils/utils';
12
11
  import FormItemWrapper from '../form/form-item-wrapper';
@@ -16,6 +15,7 @@ import 'select2';
16
15
  import './ts/select2-multi-checkboxes';
17
16
  import 'select2/dist/css/select2.css';
18
17
  import './css/dropdown.css';
18
+ import { capitalize } from '../../common/extensions/string-extensions';
19
19
 
20
20
  type RowToString = (row) => string;
21
21
  export enum MultiselectMode {
@@ -85,8 +85,8 @@ interface DropdownListArgs extends FormItemWrapperArgs {
85
85
  changed: (newValue: string | any | Array<string> | Array<any>, exclusivity?: MultiSelectExclusivity) => void;
86
86
  afterBound?: (elem: JQuery<Element>, select2Instance: any) => void;
87
87
  noResultsFound?: () => void;
88
- customRenderOption?: (h, state: DropdownDisplayArgs, originator?: CustomRenderOriginator) => any
89
- customRenderSelectionResult?: (h, state: DropdownDisplayArgs, originator?: CustomRenderOriginator) => any
88
+ customRenderOption?: (h, state: DropdownDisplayArgs, originator?: CustomRenderOriginator) => any;
89
+ customRenderSelectionResult?: (h, state: DropdownDisplayArgs, originator?: CustomRenderOriginator) => any;
90
90
  customIdProperty?: string;
91
91
  }
92
92
 
@@ -162,8 +162,8 @@ class DropdownListComponent extends TsxComponent<DropdownListArgs> implements Dr
162
162
  @Prop() placeholder: string;
163
163
  @Prop() noResultsFound: () => void;
164
164
  @Prop() marginType?: MarginType;
165
- @Prop() customRenderOption?: (h, state: DropdownDisplayArgs, originator?: CustomRenderOriginator) => any
166
- @Prop() customRenderSelectionResult?: (h, state: DropdownDisplayArgs, originator?: CustomRenderOriginator) => any
165
+ @Prop() customRenderOption?: (h, state: DropdownDisplayArgs, originator?: CustomRenderOriginator) => any;
166
+ @Prop() customRenderSelectionResult?: (h, state: DropdownDisplayArgs, originator?: CustomRenderOriginator) => any;
167
167
  @Prop() disabled?: boolean;
168
168
  @Prop() disableSearch?: boolean;
169
169
  @Prop() containerCssClass?: string;
@@ -197,7 +197,7 @@ class DropdownListComponent extends TsxComponent<DropdownListArgs> implements Dr
197
197
  for (let i = 0, len = paramArr.length; i < len; i++) {
198
198
  let val = row[paramArr[i]];
199
199
  if (val == null) {
200
- val = row[capitalize(paramArr[i])];
200
+ val = row[paramArr[i][capitalize]()];
201
201
  }
202
202
 
203
203
  if (val != null) {
@@ -447,10 +447,10 @@ class DropdownListComponent extends TsxComponent<DropdownListArgs> implements Dr
447
447
  const self = this;
448
448
  return (row) => {
449
449
  const retVal = $(`<span class="s2-ri-withtb">${row.text
450
- }<button class="s2-trailing-button ${self.trailingButton.cssClass || ''
451
- } btn-sm">${self.trailingButton.icon != null ? `<i class="${self.trailingButton.icon}"></i> ` : ''
452
- }${self.trailingButton.text || ''
453
- }</button></span>`);
450
+ }<button class="s2-trailing-button ${self.trailingButton.cssClass || ''
451
+ } btn-sm">${self.trailingButton.icon != null ? `<i class="${self.trailingButton.icon}"></i> ` : ''
452
+ }${self.trailingButton.text || ''
453
+ }</button></span>`);
454
454
  retVal.find('button').click((e) => {
455
455
  try {
456
456
  clearTimeout(self.preventDefaultTimeout);
@@ -473,20 +473,32 @@ class DropdownListComponent extends TsxComponent<DropdownListArgs> implements Dr
473
473
  }
474
474
 
475
475
  if (this.customRenderOption) {
476
- return this.handleCustomRenderResult(h, this.customRenderOption, originator);
476
+ return this.handleCustomRenderResult(
477
+ h,
478
+ this.customRenderOption,
479
+ originator,
480
+ );
477
481
  }
478
482
 
479
483
  return null;
480
484
  }
481
485
 
482
- private handleCustomRenderResult(h: any, renderFunc: any, originator: CustomRenderOriginator) {
486
+ private handleCustomRenderResult(
487
+ h: any,
488
+ renderFunc: any,
489
+ originator: CustomRenderOriginator,
490
+ ) {
483
491
  return (item: any, container: any) => {
484
- const result = renderFunc(h, item?.dataRow ?? item, originator);
492
+ const result = renderFunc(
493
+ h,
494
+ item?.dataRow ?? item,
495
+ originator,
496
+ );
485
497
  if (result?.__v_isVNode) {
486
- const container = document.createElement('span')
498
+ const container = document.createElement('span');
487
499
  // vue render accepts VNodeChild
488
- render(result as any, container)
489
- return (container.firstElementChild ?? container) as HTMLElement
500
+ render(result as any, container);
501
+ return (container.firstElementChild ?? container) as HTMLElement;
490
502
  }
491
503
 
492
504
  return result;
@@ -527,7 +539,13 @@ class DropdownListComponent extends TsxComponent<DropdownListArgs> implements Dr
527
539
  autoInputFocus: !PortalUtils.treatAsMobileDevice(),
528
540
  selectedIds: selectedItems.map(p => p.id),
529
541
  useListviewBuilder: false,
530
- formatSelection: this.customRenderSelectionResult != null ? this.handleCustomRenderResult(h, this.customRenderSelectionResult, 'mobile') : null,
542
+ formatSelection: this.customRenderSelectionResult != null
543
+ ? this.handleCustomRenderResult(
544
+ h,
545
+ this.customRenderSelectionResult,
546
+ 'mobile',
547
+ )
548
+ : null,
531
549
  formatResult: this.getCustomFormatOptions(h, 'mobile'),
532
550
  onItemSelected: (items, exclusivity) => {
533
551
  this.currentExclusivity = exclusivity;
@@ -562,7 +580,11 @@ class DropdownListComponent extends TsxComponent<DropdownListArgs> implements Dr
562
580
  textContext.attr('title', selectedText);
563
581
  textContext.text(selectedText);
564
582
  } else {
565
- const renderFunc = this.handleCustomRenderResult(h, this.customRenderSelectionResult, 'mobile');
583
+ const renderFunc = this.handleCustomRenderResult(
584
+ h,
585
+ this.customRenderSelectionResult,
586
+ 'mobile',
587
+ );
566
588
  textContext.html('');
567
589
  for (const item of items) {
568
590
  const response = renderFunc(item, textContext[0]);
@@ -954,7 +976,11 @@ class DropdownListComponent extends TsxComponent<DropdownListArgs> implements Dr
954
976
  }
955
977
 
956
978
  if (this.customRenderSelectionResult != null) {
957
- s2Args.templateSelection = this.handleCustomRenderResult(h, this.customRenderSelectionResult, 'default');
979
+ s2Args.templateSelection = this.handleCustomRenderResult(
980
+ h,
981
+ this.customRenderSelectionResult,
982
+ 'default',
983
+ );
958
984
  }
959
985
 
960
986
  const modalContent = $(this.$el).closest('.modal-content');
@@ -1123,7 +1149,7 @@ class DropdownListComponent extends TsxComponent<DropdownListArgs> implements Dr
1123
1149
  for (let i = 0, len = selected.length; i < len; i++) {
1124
1150
  const item = selected[i];
1125
1151
  if (item.id == data.id) {
1126
- arrayRemove(selected, item);
1152
+ selected[remove](item);
1127
1153
  break;
1128
1154
  }
1129
1155
  }
@@ -1,6 +1,7 @@
1
- import { latinize } from '../../../common/utils/latinize-string';
1
+ import TemporalUtils from '../../../common/utils/temporal-utils';
2
2
  import ListviewBuilder from './legacy_lvb';
3
3
  import './legacy_fdd.css';
4
+ import { latinize } from '../../../common/extensions/string-extensions';
4
5
 
5
6
  const $ = jQuery;
6
7
 
@@ -88,7 +89,7 @@ export default function FilterableSelect(this: any, args: FilterableSelectArgs):
88
89
  return false;
89
90
  }
90
91
 
91
- const timeNow = new Date().getTime();
92
+ const timeNow = TemporalUtils.dateNowMs();
92
93
  const timeDiff = timeNow - openClickTime;
93
94
  return !(timeDiff > 700);
94
95
  };
@@ -234,7 +235,7 @@ export default function FilterableSelect(this: any, args: FilterableSelectArgs):
234
235
  const sender = $(targetElem);
235
236
  const liSender = (sender.is('li') ? sender : sender.closest('li'));
236
237
  const exlusivity = ($('.fdd-incl-excl-chb input').prop('checked') == true ? 1 : 0);
237
- openClickTime = new Date().getTime();
238
+ openClickTime = TemporalUtils.dateNowMs();
238
239
 
239
240
  if (liSender.hasClass('filterabledd-optgroup')) {
240
241
  return;
@@ -338,7 +339,7 @@ export default function FilterableSelect(this: any, args: FilterableSelectArgs):
338
339
  let lastClick = 0;
339
340
 
340
341
  listContainer.onclick = (e) => {
341
- const now = new Date().getTime();
342
+ const now = TemporalUtils.dateNowMs();
342
343
  const diff = now - lastClick;
343
344
 
344
345
  if (diff > 150) {
@@ -366,7 +367,7 @@ export default function FilterableSelect(this: any, args: FilterableSelectArgs):
366
367
  } else {
367
368
  _setRowValue = (item, el) => {
368
369
  el.innerHTML = htmlEscape(item.text);
369
- }
370
+ };
370
371
  }
371
372
 
372
373
  if (filter?.length > 0) {
@@ -387,8 +388,6 @@ export default function FilterableSelect(this: any, args: FilterableSelectArgs):
387
388
  newEl.innerHTML = `<a href="javascript:" class="fdd-item-link fdd-item-content"><div class="fdd-item-inner fdd-inner"><div class="fdd-item-title fdd-item"></div></div></a>`;
388
389
  const targetElem = newEl.querySelector('.fdd-item');
389
390
  _setRowValue(item, targetElem as any);
390
-
391
-
392
391
  } else {
393
392
  if (this.selectedIds == null || !this.selectedIds.includes(item.id)) {
394
393
  newEl.setAttribute('class', 'filterabledd-item filterabledd-item-perf fdd-noselected');
@@ -404,7 +403,7 @@ export default function FilterableSelect(this: any, args: FilterableSelectArgs):
404
403
 
405
404
  listContainer.innerHTML = '';
406
405
  listContainer.appendChild(frag);
407
- }
406
+ };
408
407
 
409
408
  rebuildData(null);
410
409
 
@@ -427,7 +426,7 @@ export default function FilterableSelect(this: any, args: FilterableSelectArgs):
427
426
  currentTimeOut = setTimeout(() => {
428
427
  currentTimeOut = null;
429
428
  this._pageIndex = 0;
430
- const currVal = latinize((searchInput.val() || '').toString().toLowerCase());
429
+ const currVal = (searchInput.val() || '').toString().toLowerCase()[latinize]();
431
430
  if (currVal != this._filterVal) {
432
431
  this._filterVal = currVal;
433
432
  rebuildData(currVal);
@@ -471,7 +470,7 @@ export default function FilterableSelect(this: any, args: FilterableSelectArgs):
471
470
  }
472
471
 
473
472
  currentContext.find('.paginator-container').attr('style', 'margin-top:20px;margin-bottom:10px;');
474
- openClickTime = new Date().getTime();
473
+ openClickTime = TemporalUtils.dateNowMs();
475
474
 
476
475
  if (useIscroll) {
477
476
  contextWindow._filterableIscroll = (window as any).utils.bindIscroll($(contextBody).find('#filterableSelectDropWrap'));
@@ -536,7 +535,7 @@ export default function FilterableSelect(this: any, args: FilterableSelectArgs):
536
535
 
537
536
  if (data != null) {
538
537
  $.each(data, (i, dataItem) => {
539
- (dataItem as any).filterValue = latinize(dataItem.text.toLowerCase());
538
+ (dataItem as any).filterValue = dataItem.text.toLowerCase()[latinize]();
540
539
  });
541
540
 
542
541
  this.data = data; // fadeInFddOverlay fdd-ovl-animated