inviton-powerduck 0.0.159 → 0.0.161
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.
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
.pd-dropdown-open-animation {
|
|
2
|
+
animation: pdInputShowAnimationIn 180ms cubic-bezier(.2, .8, .2, 1);
|
|
3
|
+
transform-origin: top center;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
.pd-dropdown-open-animation-above {
|
|
7
|
+
animation: pdInputShowAnimationInAbove 180ms cubic-bezier(.2, .8, .2, 1);
|
|
8
|
+
transform-origin: bottom center;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.pd-dropdown-close-animation {
|
|
12
|
+
animation: pdInputHideAnimationInAbove 160ms cubic-bezier(.4, .2, .2, 1);
|
|
13
|
+
transform-origin: top center;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.pd-dropdown-close-animation-above {
|
|
17
|
+
animation: pdInputHideAnimationInAboveAbove 160ms cubic-bezier(.4, .2, .2, 1);
|
|
18
|
+
transform-origin: bottom center;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
@keyframes pdInputShowAnimationIn {
|
|
23
|
+
0% {
|
|
24
|
+
opacity: 0;
|
|
25
|
+
transform: translateY(-6px) scale(.95);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
100% {
|
|
29
|
+
opacity: 1;
|
|
30
|
+
transform: translateY(0) scale(1);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
@keyframes pdInputShowAnimationInAbove {
|
|
35
|
+
0% {
|
|
36
|
+
opacity: 0;
|
|
37
|
+
transform: translateY(6px) scale(.95);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
100% {
|
|
41
|
+
opacity: 1;
|
|
42
|
+
transform: translateY(0) scale(1);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
@keyframes pdInputHideAnimationInAbove {
|
|
47
|
+
0% {
|
|
48
|
+
opacity: 1;
|
|
49
|
+
transform: translateY(0) scale(1);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
100% {
|
|
53
|
+
opacity: 0;
|
|
54
|
+
transform: translateY(-6px) scale(.96);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
@keyframes pdInputHideAnimationInAboveAbove {
|
|
59
|
+
0% {
|
|
60
|
+
opacity: 1;
|
|
61
|
+
transform: translateY(0) scale(1);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
100% {
|
|
65
|
+
opacity: 0;
|
|
66
|
+
transform: translateY(6px) scale(.96);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
@media (prefers-reduced-motion: reduce) {
|
|
72
|
+
|
|
73
|
+
.pd-dropdown-open-animation,
|
|
74
|
+
.pd-dropdown-open-animation-above-above {
|
|
75
|
+
animation: none;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
@@ -2,14 +2,23 @@ import type { ImageResponse, OnUploadImageResponse } from '../../data/image';
|
|
|
2
2
|
import PowerduckState from '../../app/powerduck-state';
|
|
3
3
|
import { AppHttpProvider } from '../api-http';
|
|
4
4
|
import { BrowserImageCompression } from './broswer-image-compression';
|
|
5
|
+
import { isNullOrEmpty } from './is-null-or-empty';
|
|
5
6
|
import StringUtils from './string-utils';
|
|
6
7
|
|
|
8
|
+
export class UploadImageHelperConfig {
|
|
9
|
+
/**
|
|
10
|
+
* The base path for uploaded files.
|
|
11
|
+
*/
|
|
12
|
+
static basePath: string = 'files';
|
|
13
|
+
}
|
|
14
|
+
|
|
7
15
|
export class UploadImageHelper {
|
|
8
16
|
static async postImage(
|
|
9
17
|
file: File,
|
|
10
18
|
attractionType: string,
|
|
11
|
-
disableCompression: boolean = false,
|
|
12
|
-
compressionMaxMb: number = 0.5,
|
|
19
|
+
disableCompression: boolean = false,
|
|
20
|
+
compressionMaxMb: number = 0.5,
|
|
21
|
+
url?: string,
|
|
13
22
|
): Promise<ImageResponse> {
|
|
14
23
|
if (!(disableCompression || file.type == 'image/svg+xml')) {
|
|
15
24
|
file = await BrowserImageCompression.compress(file, {
|
|
@@ -19,11 +28,12 @@ compressionMaxMb: number = 0.5,
|
|
|
19
28
|
|
|
20
29
|
const formData: FormData = new FormData();
|
|
21
30
|
const fileObj = new File([file], StringUtils.normalizeFileName(file.name));
|
|
31
|
+
url = !isNullOrEmpty(url) ? url : `${AppHttpProvider.enforceDomain}${UploadImageHelperConfig.basePath}`;
|
|
22
32
|
|
|
23
33
|
formData.append('pathToFolder', `photos/${attractionType}/`);
|
|
24
34
|
formData.append('file', fileObj);
|
|
25
35
|
|
|
26
|
-
const response = await fetch(
|
|
36
|
+
const response = await fetch(url, {
|
|
27
37
|
method: 'POST',
|
|
28
38
|
body: formData,
|
|
29
39
|
headers: {
|
|
@@ -14,6 +14,7 @@ import FilterableSelect from './mobile/legacy_fdd';
|
|
|
14
14
|
import 'select2';
|
|
15
15
|
import './ts/select2-multi-checkboxes';
|
|
16
16
|
import 'select2/dist/css/select2.css';
|
|
17
|
+
import './../../app/css/input-effects.css';
|
|
17
18
|
import './css/dropdown.css';
|
|
18
19
|
import { capitalize } from '../../common/extensions/string-extensions';
|
|
19
20
|
|
|
@@ -447,10 +448,10 @@ class DropdownListComponent extends TsxComponent<DropdownListArgs> implements Dr
|
|
|
447
448
|
const self = this;
|
|
448
449
|
return (row) => {
|
|
449
450
|
const retVal = $(`<span class="s2-ri-withtb">${row.text
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
451
|
+
}<button class="s2-trailing-button ${self.trailingButton.cssClass || ''
|
|
452
|
+
} btn-sm">${self.trailingButton.icon != null ? `<i class="${self.trailingButton.icon}"></i> ` : ''
|
|
453
|
+
}${self.trailingButton.text || ''
|
|
454
|
+
}</button></span>`);
|
|
454
455
|
retVal.find('button').click((e) => {
|
|
455
456
|
try {
|
|
456
457
|
clearTimeout(self.preventDefaultTimeout);
|
|
@@ -541,10 +542,10 @@ class DropdownListComponent extends TsxComponent<DropdownListArgs> implements Dr
|
|
|
541
542
|
useListviewBuilder: false,
|
|
542
543
|
formatSelection: this.customRenderSelectionResult != null
|
|
543
544
|
? this.handleCustomRenderResult(
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
545
|
+
h,
|
|
546
|
+
this.customRenderSelectionResult,
|
|
547
|
+
'mobile',
|
|
548
|
+
)
|
|
548
549
|
: null,
|
|
549
550
|
formatResult: this.getCustomFormatOptions(h, 'mobile'),
|
|
550
551
|
onItemSelected: (items, exclusivity) => {
|
|
@@ -759,6 +760,21 @@ class DropdownListComponent extends TsxComponent<DropdownListArgs> implements Dr
|
|
|
759
760
|
s2Elem
|
|
760
761
|
.attr('data-vebound', 'true')
|
|
761
762
|
.on('select2:close', () => {
|
|
763
|
+
const $container = DropdownSelect2Helper.getSelect2Instance(this.getSelect2RootElement()).$dropdown;
|
|
764
|
+
$container.removeClass('pd-dropdown-open-animation pd-dropdown-open-animation-above');
|
|
765
|
+
$container[0].offsetWidth;
|
|
766
|
+
|
|
767
|
+
if ($container.hasClass('select2-container--above')) {
|
|
768
|
+
$container.addClass('pd-dropdown-close-animation-above');
|
|
769
|
+
} else {
|
|
770
|
+
$container.addClass('pd-dropdown-close-animation');
|
|
771
|
+
}
|
|
772
|
+
|
|
773
|
+
$container.one('animationend', function () {
|
|
774
|
+
$container.removeClass('pd-dropdown-close-animation pd-dropdown-close-animation-above');
|
|
775
|
+
});
|
|
776
|
+
|
|
777
|
+
|
|
762
778
|
if (self.pendingChange != null) {
|
|
763
779
|
const data = self.pendingChange?.data;
|
|
764
780
|
self.pendingChange = null;
|
|
@@ -772,6 +788,17 @@ class DropdownListComponent extends TsxComponent<DropdownListArgs> implements Dr
|
|
|
772
788
|
e.stopPropagation();
|
|
773
789
|
}
|
|
774
790
|
})
|
|
791
|
+
.on('select2:open', () => {
|
|
792
|
+
const $container = DropdownSelect2Helper.getSelect2Instance(this.getSelect2RootElement()).$dropdown;
|
|
793
|
+
$container.removeClass('pd-dropdown-open-animation pd-dropdown-open-animation-above pd-dropdown-close-animation pd-dropdown-close-animation-above');
|
|
794
|
+
$container[0].offsetWidth; // reflow
|
|
795
|
+
|
|
796
|
+
if ($container.hasClass('select2-container--above')) {
|
|
797
|
+
$container.addClass('pd-dropdown-open-animation-above');
|
|
798
|
+
} else {
|
|
799
|
+
$container.addClass('pd-dropdown-open-animation');
|
|
800
|
+
}
|
|
801
|
+
})
|
|
775
802
|
.on('select2:unselect', (e) => {
|
|
776
803
|
(self as any).preventOpen = true;
|
|
777
804
|
setTimeout(() => {
|
|
@@ -1069,11 +1069,15 @@ import { utcEpochMilliseconds } from '../../../../common/extensions/temporal-ext
|
|
|
1069
1069
|
});
|
|
1070
1070
|
});
|
|
1071
1071
|
} else {
|
|
1072
|
-
box
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1072
|
+
box.show();
|
|
1073
|
+
box.removeClass('pd-dropdown-open-animation pd-dropdown-open-animation-above');
|
|
1074
|
+
box[0].offsetWidth; // reflow
|
|
1075
|
+
|
|
1076
|
+
if (box.hasClass('select2-container--above')) {
|
|
1077
|
+
box.addClass('pd-dropdown-open-animation-above');
|
|
1078
|
+
} else {
|
|
1079
|
+
box.addClass('pd-dropdown-open-animation');
|
|
1080
|
+
}
|
|
1077
1081
|
}
|
|
1078
1082
|
|
|
1079
1083
|
$(self).trigger('datepicker-open', {
|
|
@@ -1932,7 +1936,9 @@ import { utcEpochMilliseconds } from '../../../../common/extensions/temporal-ext
|
|
|
1932
1936
|
}
|
|
1933
1937
|
|
|
1934
1938
|
function closeDatePicker(): void {
|
|
1935
|
-
if (opt.alwaysOpen) {
|
|
1939
|
+
if (opt.alwaysOpen) {
|
|
1940
|
+
return;
|
|
1941
|
+
}
|
|
1936
1942
|
|
|
1937
1943
|
const afterAnim = function () {
|
|
1938
1944
|
$(self).data('date-picker-opened', false);
|
|
@@ -1943,7 +1949,14 @@ import { utcEpochMilliseconds } from '../../../../common/extensions/temporal-ext
|
|
|
1943
1949
|
if (opt.customCloseAnimation) {
|
|
1944
1950
|
opt.customCloseAnimation.call(box.get(0), afterAnim);
|
|
1945
1951
|
} else {
|
|
1946
|
-
|
|
1952
|
+
box.removeClass('pd-dropdown-open-animation pd-dropdown-open-animation-above pd-dropdown-close-animation pd-dropdown-close-animation-above');
|
|
1953
|
+
box[0].offsetWidth; // reflow
|
|
1954
|
+
box.addClass('pd-dropdown-close-animation');
|
|
1955
|
+
|
|
1956
|
+
box.one('animationend', function () {
|
|
1957
|
+
box.hide();
|
|
1958
|
+
box.removeClass('pd-dropdown-open-animation pd-dropdown-open-animation-above pd-dropdown-close-animation pd-dropdown-close-animation-above');
|
|
1959
|
+
});
|
|
1947
1960
|
}
|
|
1948
1961
|
|
|
1949
1962
|
$(self).trigger('datepicker-close', {
|