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.
- package/app/powerduck-initializer.ts +3 -3
- package/common/api-http.ts +20 -14
- package/common/css/ladda-themeless-zoomin.min.css +89 -89
- package/common/enum-translation/day-translator.ts +3 -2
- package/common/excel/excel-reader.ts +2 -9
- package/common/extensions/array-extensions.ts +116 -0
- package/common/extensions/string-extensions.ts +92 -0
- package/common/extensions/temporal-extensions.ts +115 -0
- package/common/scroll-utils.ts +2 -1
- package/common/temporal-helpers.ts +551 -0
- package/common/timezone-helper.ts +39 -29
- package/common/utils/cookie.ts +11 -8
- package/common/utils/date-localization-utils.ts +25 -19
- package/common/utils/date-utils.ts +37 -47
- package/common/utils/form-utils.ts +3 -1
- package/common/utils/language-utils.ts +21 -27
- package/common/utils/temporal-utils.ts +43 -0
- package/common/utils/upload-image-helper.ts +1 -1
- package/common/utils/utils.ts +14 -14
- package/common/validation.ts +17 -5
- package/components/chart-js/line-chart-flot.tsx +9 -9
- package/components/chart-js/thirdparty/flot/jquery.flot.categories.min.js +93 -93
- package/components/chart-js/thirdparty/flot/jquery.flot.crosshair.min.js +83 -83
- package/components/chart-js/thirdparty/flot/jquery.flot.navigate.min.js +270 -270
- package/components/chart-js/thirdparty/flot/jquery.flot.pie.min.js +507 -507
- package/components/chart-js/thirdparty/flot/jquery.flot.resize.js +7 -9
- package/components/chart-js/thirdparty/flot/jquery.flot.resize.min.js +9 -11
- package/components/chart-js/thirdparty/flot/jquery.flot.stack.min.js +104 -104
- package/components/chart-js/ts/line-chart-contracts.ts +2 -2
- package/components/container-with-breakpoints/ts/breakpoint-handler.ts +2 -2
- package/components/counter/testall.tsx +89 -75
- package/components/datatable/datatable.tsx +2379 -2375
- package/components/datatable/export-excel-modal.tsx +12 -14
- package/components/datatable/ts/reorder.ts +4 -2
- package/components/dropdown/index.tsx +48 -22
- package/components/dropdown/mobile/legacy_fdd.ts +10 -11
- package/components/dropzone/gallery-dropzone.tsx +394 -382
- package/components/fullcalendar/fullcalendar-draggable-event.tsx +8 -7
- package/components/fullcalendar/timegrid-calendar.tsx +60 -67
- package/components/image-crop/image-cropping-modal.tsx +9 -8
- package/components/image-crop/upload-and-crop.tsx +162 -162
- package/components/image-crop/vendor/jquery.Jcrop.min.css +344 -344
- package/components/import/import-mapper.tsx +2 -2
- package/components/input/daterange-picker.tsx +502 -521
- package/components/input/datetime-picker.tsx +45 -50
- package/components/input/plugins/daterangepicker/daterangepicker.min.css +400 -400
- package/components/input/plugins/daterangepicker/jquery.daterangepicker.min.js +346 -339
- package/components/input/plugins/daterangepicker/jquery.daterangepicker.ts +580 -402
- package/components/input/radio-button-group.tsx +2 -2
- package/components/input/ts/dateInputHelper.ts +1 -0
- package/components/input/wysiwig.tsx +12 -7
- package/components/svg/skilift-svg.tsx +6 -6
- package/package.json +2 -1
- package/common/date-wrapper.ts +0 -422
- package/common/utils/array-extend.ts +0 -215
- package/common/utils/array-remove.ts +0 -10
- package/common/utils/array-sort.ts +0 -56
- package/common/utils/capitalize-string.ts +0 -11
- package/common/utils/format-string.ts +0 -14
- package/common/utils/latinize-string.ts +0 -7
|
@@ -1,215 +0,0 @@
|
|
|
1
|
-
import { arraySort } from './array-sort';
|
|
2
|
-
|
|
3
|
-
export interface ArrayExtended<T> extends Array<T> {
|
|
4
|
-
/**
|
|
5
|
-
* Removes given items from the Array
|
|
6
|
-
*
|
|
7
|
-
* @param items Items that should be removed from the Array
|
|
8
|
-
*/
|
|
9
|
-
remove: (...items: T[]) => void;
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Inserts item into the Array at given index
|
|
13
|
-
*
|
|
14
|
-
* @param items Item that should be added to the Array
|
|
15
|
-
* @param index Index at which the item should be added
|
|
16
|
-
*/
|
|
17
|
-
insertAt: (item: T, index: number) => void;
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Clones current array into new instance
|
|
21
|
-
*/
|
|
22
|
-
clone: () => ArrayExtended<T>;
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* Sorts array by given property
|
|
26
|
-
*
|
|
27
|
-
* @param propName Property name (or function returning the sort key), the array should be sorted by
|
|
28
|
-
*/
|
|
29
|
-
sortBy: (propName: string | ((item: T) => string | number)) => ArrayExtended<T>;
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* Determines if current array contains given object
|
|
33
|
-
*
|
|
34
|
-
* @param str Obj that should be checked
|
|
35
|
-
*/
|
|
36
|
-
contains: (item: T) => boolean;
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* LINQ Min function equivalent - returns lowest value from the collection
|
|
40
|
-
*
|
|
41
|
-
* @param callbackfn Lambda containing the desired property
|
|
42
|
-
* @param defaultValue Default value for case when sequence contains no elements
|
|
43
|
-
*
|
|
44
|
-
*/
|
|
45
|
-
min: (callbackfn: (value: T, index: number, array: T[]) => number, defaultValue?: number) => number;
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* LINQ Max function equivalent - returns highest value from the collection
|
|
49
|
-
*
|
|
50
|
-
* @param callbackfn Lambda containing the desired property
|
|
51
|
-
* @param defaultValue Default value for case when sequence contains no elements
|
|
52
|
-
*
|
|
53
|
-
*/
|
|
54
|
-
max: (callbackfn: (value: T, index: number, array: T[]) => number, defaultValue?: number) => number;
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
* LINQ Sum function equivalent - returns sum of the collection
|
|
58
|
-
*
|
|
59
|
-
* @param callbackfn Lambda containing the desired property
|
|
60
|
-
* @param defaultValue Default value for case when sequence contains no elements
|
|
61
|
-
*
|
|
62
|
-
*/
|
|
63
|
-
sum: (callbackfn: (value: T, index: number, array: T[]) => number, defaultValue?: number) => number;
|
|
64
|
-
|
|
65
|
-
/**
|
|
66
|
-
* LINQ SelectMany function equivalent - returns flatten collection of array's subcollection
|
|
67
|
-
*
|
|
68
|
-
* @param callbackfn Lambda containing the desired property
|
|
69
|
-
* @param thisArg
|
|
70
|
-
*/
|
|
71
|
-
selectMany: <U>(callbackfn: (value: T, index: number, array: T[]) => U, thisArg?: any) => U;
|
|
72
|
-
|
|
73
|
-
/**
|
|
74
|
-
* LINQ Distinct function equivalent - returns array with distinct items
|
|
75
|
-
*
|
|
76
|
-
* @param callbackfn Lambda containing the desired property
|
|
77
|
-
* @param thisArg
|
|
78
|
-
*/
|
|
79
|
-
distinct: <U>() => U;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
if (!(Array.prototype as any).find) {
|
|
83
|
-
(Array.prototype as any).find = function (callback, ...args) {
|
|
84
|
-
const list = new Object(this);
|
|
85
|
-
const length = (list as any).length >>> 0;
|
|
86
|
-
const thisArg = args[0];
|
|
87
|
-
for (let i = 0; i < length; i++) {
|
|
88
|
-
const element = list[i];
|
|
89
|
-
if (callback.call(
|
|
90
|
-
thisArg,
|
|
91
|
-
element,
|
|
92
|
-
i,
|
|
93
|
-
list,
|
|
94
|
-
)) {
|
|
95
|
-
return element;
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
};
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
export const arrayExtend = <T>(arr: T[]): ArrayExtended<T> => {
|
|
102
|
-
if (arr == null) {
|
|
103
|
-
arr = [];
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
((arr as any)).remove = (items: [], ...args): void => {
|
|
107
|
-
for (let i = 0, len = args.length; i < len; i++) {
|
|
108
|
-
const item = args[i];
|
|
109
|
-
const itemIndex = arr.indexOf(item);
|
|
110
|
-
|
|
111
|
-
if (itemIndex > -1) {
|
|
112
|
-
arr.splice(itemIndex, 1);
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
};
|
|
116
|
-
|
|
117
|
-
((arr as any)).clone = function () {
|
|
118
|
-
return arrayExtend(this.slice(0));
|
|
119
|
-
};
|
|
120
|
-
|
|
121
|
-
((arr as any)).insertAt = (item, index) => {
|
|
122
|
-
arr.splice(
|
|
123
|
-
index,
|
|
124
|
-
0,
|
|
125
|
-
item,
|
|
126
|
-
);
|
|
127
|
-
};
|
|
128
|
-
|
|
129
|
-
((arr as any)).contains = (item) => {
|
|
130
|
-
if (item != null) {
|
|
131
|
-
let idProp = 'Id';
|
|
132
|
-
if (item[idProp] == null) {
|
|
133
|
-
idProp = 'id';
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
const idVal = item[idProp];
|
|
137
|
-
if (idVal != null && arr.length > 0) {
|
|
138
|
-
for (let i = 0, len = arr.length; i < len; i++) {
|
|
139
|
-
if (arr[i][idProp] == idVal) {
|
|
140
|
-
return true;
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
return arr.includes(item);
|
|
147
|
-
};
|
|
148
|
-
|
|
149
|
-
((arr as any)).min = <T>(callbackfn: (value: T, index: number, array: T[]) => number, defaultValue?: number): number => {
|
|
150
|
-
if (arr.length == 0) {
|
|
151
|
-
return defaultValue;
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
return arr.reduce((
|
|
155
|
-
prevVal,
|
|
156
|
-
u,
|
|
157
|
-
i,
|
|
158
|
-
) => Math.min(prevVal, callbackfn(
|
|
159
|
-
u as any,
|
|
160
|
-
i,
|
|
161
|
-
arr as any,
|
|
162
|
-
)), Number.MAX_VALUE);
|
|
163
|
-
};
|
|
164
|
-
|
|
165
|
-
((arr as any)).max = <T>(callbackfn: (value: T, index: number, array: T[]) => number, defaultValue?: number): number => {
|
|
166
|
-
if (arr.length == 0) {
|
|
167
|
-
return defaultValue;
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
return arr.reduce((
|
|
171
|
-
prevVal,
|
|
172
|
-
u,
|
|
173
|
-
i,
|
|
174
|
-
) => Math.max(prevVal, callbackfn(
|
|
175
|
-
u as any,
|
|
176
|
-
i,
|
|
177
|
-
arr as any,
|
|
178
|
-
)), 0);
|
|
179
|
-
};
|
|
180
|
-
|
|
181
|
-
((arr as any)).sum = <T>(callbackfn: (value: T, index: number, array: T[]) => number, defaultValue?: number): number => {
|
|
182
|
-
if (arr.length == 0) {
|
|
183
|
-
return defaultValue;
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
return arr.reduce((
|
|
187
|
-
prevVal,
|
|
188
|
-
u,
|
|
189
|
-
i,
|
|
190
|
-
) => prevVal + callbackfn(
|
|
191
|
-
u as any,
|
|
192
|
-
i,
|
|
193
|
-
arr as any,
|
|
194
|
-
), 0);
|
|
195
|
-
};
|
|
196
|
-
|
|
197
|
-
((arr as any)).selectMany = (callback): any => arr.reduce((
|
|
198
|
-
prevVal,
|
|
199
|
-
u,
|
|
200
|
-
i,
|
|
201
|
-
) => [
|
|
202
|
-
...prevVal,
|
|
203
|
-
...(callback(
|
|
204
|
-
u,
|
|
205
|
-
i,
|
|
206
|
-
arr,
|
|
207
|
-
) as any),
|
|
208
|
-
], []);
|
|
209
|
-
|
|
210
|
-
((arr as any)).distinct = (): any => arr.reduce((un, u) => ({ ...un, u }), {});
|
|
211
|
-
|
|
212
|
-
((arr as any)).sortBy = <T>(propName: string | ((item: T) => string | number)): ArrayExtended<T> => arraySort(arr as any, propName) as any;
|
|
213
|
-
|
|
214
|
-
return arr as any;
|
|
215
|
-
};
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
export function arraySort<T>(arr: T[], propName: string | ((item: T) => string | number)): Array<T> {
|
|
2
|
-
function dynamicSort(property) {
|
|
3
|
-
if (propName && {}.toString.call(propName) === '[object Function]') {
|
|
4
|
-
return function (a, b) {
|
|
5
|
-
let v1 = (<any>propName)(a);
|
|
6
|
-
let v2 = (<any>propName)(b);
|
|
7
|
-
|
|
8
|
-
if (v1.constructor && v1.call && v1.apply) {
|
|
9
|
-
v1 = v1();
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
if (v2.constructor && v2.call && v2.apply) {
|
|
13
|
-
v2 = v2();
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
return v1 < v2 ? -1 : v1 > v2 ? 1 : 0;
|
|
17
|
-
};
|
|
18
|
-
} else {
|
|
19
|
-
let propArr: string[] = property;
|
|
20
|
-
if (typeof property === 'string' || property instanceof String) {
|
|
21
|
-
propArr = <any>[property];
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
return function (a, b) {
|
|
25
|
-
for (let i = 0, len = propArr.length; i < len; i++) {
|
|
26
|
-
let currProp = propArr[i];
|
|
27
|
-
let sortOrder = 1;
|
|
28
|
-
if (currProp[0] === '-') {
|
|
29
|
-
sortOrder = -1;
|
|
30
|
-
currProp = currProp.substr(1);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
let aVal = a[currProp];
|
|
34
|
-
let bVal = b[currProp];
|
|
35
|
-
if (aVal.constructor && aVal.call && aVal.apply) {
|
|
36
|
-
aVal = aVal();
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
if (bVal.constructor && bVal.call && bVal.apply) {
|
|
40
|
-
bVal = bVal();
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
const result = aVal < bVal ? -1 : aVal > bVal ? 1 : 0;
|
|
44
|
-
if (result != 0) {
|
|
45
|
-
return result * sortOrder;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
return 0;
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
arr.sort(dynamicSort(propName));
|
|
55
|
-
return arr;
|
|
56
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
export function formatString(str: string, ...args: any[]): string {
|
|
2
|
-
return str.replace(/\{\{|\}\}|\{(\d+)\}/g, (m, n) => {
|
|
3
|
-
if (m == '{{') {
|
|
4
|
-
return '{';
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
if (m == '}}') {
|
|
8
|
-
return '}';
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
const index = parseInt(n);
|
|
12
|
-
return args[index] ?? '';
|
|
13
|
-
});
|
|
14
|
-
};
|