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
|
@@ -5,184 +5,184 @@ import { Prop, toNative } from 'vue-facing-decorator';
|
|
|
5
5
|
import PowerduckState from '../../app/powerduck-state';
|
|
6
6
|
import TsxComponent, { Component } from '../../app/vuetsx';
|
|
7
7
|
import { BrowserImageCompression } from '../../common/utils/broswer-image-compression';
|
|
8
|
-
import { formatString } from '../../common/utils/format-string';
|
|
9
8
|
import { PortalUtils } from '../../common/utils/utils';
|
|
10
9
|
import UploadButton from '../button/upload-button';
|
|
11
10
|
import LoadingIndicator from '../loading-indicator';
|
|
12
11
|
import NotificationProvider from '../ui/notification';
|
|
13
12
|
import ImageCropModal from './image-cropping-modal';
|
|
13
|
+
import { format } from '../../common/extensions/string-extensions';
|
|
14
14
|
|
|
15
15
|
export interface UploadImageAndCropFileCompleteArgs {
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
imageSrc: string;
|
|
17
|
+
fileName: string;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
export interface UploadImageAndCropUploadEventArgs extends ImageCroppedUploadArgs { }
|
|
21
21
|
|
|
22
22
|
interface UploadImageAndCropButtonArgs extends _ButtonArgsBase {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
23
|
+
title?: string;
|
|
24
|
+
aspectRatio?: number;
|
|
25
|
+
useCropper?: boolean;
|
|
26
|
+
uploadUrl?: string;
|
|
27
|
+
targetBlobContainer: string;
|
|
28
|
+
imageCropperTitleMessage?: string;
|
|
29
|
+
uploadArgs: (e: UploadImageAndCropUploadEventArgs) => any;
|
|
30
|
+
uploadComplete: (args: any) => void;
|
|
31
|
+
autoCommit?: boolean;
|
|
32
|
+
disableCompression?: boolean;
|
|
33
|
+
allowedTypes?: string[];
|
|
34
|
+
compressionMaxSizeMb?: number;
|
|
35
|
+
isLoading?: boolean;
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
@Component
|
|
39
39
|
class UploadImageAndCropButtonComponent extends TsxComponent<UploadImageAndCropButtonArgs> implements UploadImageAndCropButtonArgs {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
40
|
+
@Prop() cssClass!: string;
|
|
41
|
+
@Prop() layout!: ButtonLayout;
|
|
42
|
+
@Prop() text!: string;
|
|
43
|
+
@Prop() size!: ButtonSize;
|
|
44
|
+
@Prop() round!: boolean;
|
|
45
|
+
@Prop() outlined!: boolean;
|
|
46
|
+
@Prop() dismissModal!: boolean;
|
|
47
|
+
@Prop() icon!: string;
|
|
48
|
+
@Prop() disabled!: boolean;
|
|
49
|
+
@Prop() useCropper!: boolean;
|
|
50
|
+
@Prop() fullWidth!: boolean;
|
|
51
|
+
@Prop() title!: string;
|
|
52
|
+
@Prop() aspectRatio!: number;
|
|
53
|
+
@Prop() uploadUrl: string;
|
|
54
|
+
@Prop() isLoading?: boolean;
|
|
55
|
+
@Prop() targetBlobContainer: string;
|
|
56
|
+
@Prop() imageCropperTitleMessage!: string;
|
|
57
|
+
@Prop() uploadArgs: (e: UploadImageAndCropUploadEventArgs) => any;
|
|
58
|
+
@Prop() uploadComplete: (args: any) => void;
|
|
59
|
+
@Prop() autoCommit: boolean;
|
|
60
|
+
@Prop() disableCompression: boolean;
|
|
61
|
+
@Prop() allowedTypes: string[];
|
|
62
|
+
@Prop() compressionMaxSizeMb?: number;
|
|
63
|
+
isInternalLoading: boolean = false;
|
|
64
|
+
|
|
65
|
+
handleFileObtained(e: UploadButtonFileObtainedArgs): void {
|
|
66
|
+
const urlCreator = window.URL || window.webkitURL;
|
|
67
|
+
const imgUrl = urlCreator.createObjectURL(e.file);
|
|
68
|
+
|
|
69
|
+
if (this.allowedTypes?.length > 0 && !this.allowedTypes.includes(e.file.type)) {
|
|
70
|
+
NotificationProvider.showErrorMessage(PowerduckState.getResourceValue('uploadImageInvalidFileType')[format](PortalUtils.htmlEscape(this.allowedTypes.join(', '))));
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
if (this.useCropper != false) {
|
|
75
|
+
(this.$refs.imgCrop as typeof ImageCropModal.prototype).show({
|
|
76
|
+
fileName: e.file.name,
|
|
77
|
+
imageSrc: imgUrl,
|
|
78
|
+
aspectRatio: (this.aspectRatio || (5 / 3)),
|
|
79
|
+
title: null,
|
|
80
|
+
titleMessageHtml: this.imageCropperTitleMessage,
|
|
81
|
+
handleCropUpload: (e) => {
|
|
82
|
+
return this.getUploadPromise(e);
|
|
83
|
+
},
|
|
84
|
+
});
|
|
85
|
+
} else {
|
|
86
|
+
this.isInternalLoading = true;
|
|
87
|
+
this.getUploadPromise({
|
|
88
|
+
file: e.file,
|
|
89
|
+
fileName: e.file.name,
|
|
90
|
+
dataUrl: null,
|
|
91
|
+
}).then(() => {
|
|
92
|
+
this.isInternalLoading = false;
|
|
93
|
+
}).catch((_err) => {
|
|
94
|
+
this.isInternalLoading = false;
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
getUploadButton() {
|
|
100
|
+
return this.$refs.uploadButton as typeof UploadButton.prototype;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
async getUploadPromise(args: ImageCroppedUploadArgs): Promise<any> {
|
|
104
|
+
if (!(this.disableCompression || args.file.type == 'image/svg+xml')) {
|
|
105
|
+
args.file = await BrowserImageCompression.compress(args.file, {
|
|
106
|
+
maxSizeMB: this.compressionMaxSizeMb,
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
return new Promise((resolve, reject) => {
|
|
111
|
+
const formData = new FormData();
|
|
112
|
+
if (this.uploadArgs != null) {
|
|
113
|
+
const argsVal = this.uploadArgs(args);
|
|
114
|
+
if (argsVal != null) {
|
|
115
|
+
for (const key in argsVal) {
|
|
116
|
+
formData.append(key, argsVal[key]);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
if (this.autoCommit === true) {
|
|
122
|
+
const request = new XMLHttpRequest();
|
|
123
|
+
request.open('POST', this.uploadUrl);
|
|
124
|
+
request.onreadystatechange = () => {
|
|
125
|
+
if (request.readyState == 4) {
|
|
126
|
+
let response;
|
|
127
|
+
try {
|
|
128
|
+
response = JSON.parse(request.responseText);
|
|
129
|
+
} catch (e) {
|
|
130
|
+
response = request.responseText;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
if (request.status == 200) {
|
|
134
|
+
if (this.uploadComplete) {
|
|
135
|
+
this.uploadComplete(response);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
resolve(response);
|
|
139
|
+
} else {
|
|
140
|
+
try {
|
|
141
|
+
if (response.responseText) {
|
|
142
|
+
NotificationProvider.showErrorMessage(response.responseText);
|
|
143
|
+
} else {
|
|
144
|
+
NotificationProvider.showErrorMessage(response);
|
|
145
|
+
}
|
|
146
|
+
} catch (e) { }
|
|
147
|
+
|
|
148
|
+
reject(response);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
};
|
|
152
|
+
|
|
153
|
+
request.send(formData);
|
|
154
|
+
} else {
|
|
155
|
+
const argsVal = this.uploadArgs(args);
|
|
156
|
+
this.uploadComplete(argsVal);
|
|
157
|
+
resolve(formData);
|
|
158
|
+
}
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
render(h) {
|
|
163
|
+
return (
|
|
164
|
+
<span style="position:relative;">
|
|
165
|
+
<LoadingIndicator visible={(this.isLoading || this.isInternalLoading)} />
|
|
166
|
+
<UploadButton
|
|
167
|
+
ref="uploadButton"
|
|
168
|
+
fileObtained={async (e) => {
|
|
169
|
+
await this.handleFileObtained(e);
|
|
170
|
+
}}
|
|
171
|
+
onlyImages={true}
|
|
172
|
+
cssClass={this.cssClass}
|
|
173
|
+
layout={this.layout}
|
|
174
|
+
text={this.text}
|
|
175
|
+
size={this.size}
|
|
176
|
+
round={this.round}
|
|
177
|
+
outlined={this.outlined}
|
|
178
|
+
icon={this.icon}
|
|
179
|
+
disabled={this.disabled}
|
|
180
|
+
/>
|
|
181
|
+
|
|
182
|
+
<ImageCropModal ref="imgCrop" />
|
|
183
|
+
</span>
|
|
184
|
+
);
|
|
185
|
+
}
|
|
186
186
|
}
|
|
187
187
|
|
|
188
188
|
const UploadImageAndCropButton = toNative(UploadImageAndCropButtonComponent);
|