inviton-powerduck 0.0.7 → 0.0.9
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-system-resources.ts +1 -0
- package/app/vuetsx.ts +14 -9
- package/common/base-component.tsx +2 -2
- package/common/history-extended.ts +172 -0
- package/common/history-handler.ts +91 -135
- package/common/slot-unwrapper.ts +17 -0
- package/common/utils/broswer-image-compression.ts +19 -15
- package/common/utils/format-string.ts +5 -4
- package/common/utils/upload-image-helper.ts +5 -3
- package/common/validation.ts +4 -15
- package/components/accordion/accordion.tsx +3 -1
- package/components/bootstrap-toggle/index.tsx +1 -1
- package/components/button/button.tsx +54 -29
- package/components/button/excel-upload-button.tsx +2 -2
- package/components/button/ladda-button.tsx +2 -2
- package/components/button/text-button.tsx +12 -9
- package/components/button/upload-button.tsx +6 -6
- package/components/card/card-header-with-options.tsx +1 -1
- package/components/card/card.tsx +33 -20
- package/components/card/image-card.tsx +39 -34
- package/components/chart-js/bar-chart.tsx +63 -62
- package/components/chart-js/line-chart-flot.tsx +1 -1
- package/components/chart-js/line-chart.tsx +1 -1
- package/components/chart-js/pie-chart.tsx +2 -2
- package/components/chart-js/plot.tsx +1 -1
- package/components/collapse/index.tsx +42 -0
- package/components/counter/testall.tsx +1 -0
- package/components/datatable/col-vis-modal.tsx +8 -13
- package/components/datatable/css/datatable.css +28 -4
- package/components/datatable/datatable-static.tsx +11 -2
- package/components/datatable/datatable.tsx +199 -91
- package/components/datatable/export-excel-modal.tsx +75 -87
- package/components/datatable/filter-modal.tsx +4 -16
- package/components/dropdown/country-dropdown.tsx +138 -283
- package/components/dropdown/image-dropdown.tsx +2 -2
- package/components/dropdown/index.tsx +28 -6
- package/components/dropdown/mobile/legacy_fdd.css +59 -30
- package/components/dropdown/mobile/legacy_fdd.ts +287 -197
- package/components/dropdown/mobile/legacy_lvb.ts +56 -59
- package/components/dropdown/ts/select2-multi-checkboxes.ts +10 -2
- package/components/dropdown-button/css/dropdown-button.css +4 -0
- package/components/dropdown-button/dropdown-button-element.tsx +78 -0
- package/components/dropdown-button/dropdown-button.tsx +24 -23
- package/components/dropzone/gallery-dropzone.tsx +83 -58
- package/components/form/fieldset.tsx +7 -1
- package/components/form/form-item-flex.tsx +4 -3
- package/components/form/form-item-wrapper.tsx +6 -6
- package/components/fullcalendar/timegrid-calendar.tsx +1 -1
- package/components/google/places-autocomplete.tsx +3 -3
- package/components/image-crop/image-cropping-modal.tsx +2 -2
- package/components/image-crop/upload-and-crop.tsx +34 -27
- package/components/input/checkbox.tsx +4 -2
- package/components/input/color-picker.tsx +1 -1
- package/components/input/css/wysiwig.css +5 -0
- package/components/input/daterange-picker.tsx +1 -1
- package/components/input/datetime-picker.tsx +60 -50
- package/components/input/geo-json.tsx +2 -2
- package/components/input/gps-input.tsx +2 -2
- package/components/input/localized-info-input.tsx +2 -0
- package/components/input/localized-string-input.tsx +3 -3
- package/components/input/localized-string-wysiwyg.tsx +3 -0
- package/components/input/localized-url-input.tsx +4 -4
- package/components/input/numeric-input.tsx +9 -2
- package/components/input/plugins/trumbowyg/custom-upload.ts +325 -0
- package/components/input/plugins/trumbowyg/lang/sk.ts +6 -0
- package/components/input/plugins/trumbowyg/modal-issues-fix.ts +141 -0
- package/components/input/plugins/trumbowyg/wysiwyg-config.ts +55 -0
- package/components/input/radio-button-group.tsx +41 -27
- package/components/input/textarea.tsx +5 -0
- package/components/input/textbox.tsx +29 -2
- package/components/input/video-urls.tsx +2 -2
- package/components/input/wysiwig.tsx +100 -26
- package/components/modal/modal-utils.ts +35 -3
- package/components/modal/ts/file-manager-dialog.ts +6 -5
- package/components/modal-wrap/modal-section.tsx +1 -1
- package/components/open-street-map/open-street-map.tsx +44 -40
- package/components/progress-bar/index.tsx +93 -23
- package/components/quick-edit/quick-edit-modal-base.tsx +5 -5
- package/components/stars/css/stars.css +39 -0
- package/components/stars/stars.tsx +204 -0
- package/components/swiper/css/gallery-swiper.css +41 -0
- package/components/swiper/swiper-gallery.tsx +89 -0
- package/components/swiper/swiper-slide.tsx +12 -0
- package/components/swiper/swiper.tsx +134 -0
- package/components/tabs/tabs.tsx +7 -5
- package/components/tooltip/index.tsx +6 -4
- package/components/ui/notification.ts +23 -18
- package/components/wizard/wizard.tsx +2 -2
- package/package.json +3 -1
- package/common/static-wrappers/history-handler-ext.ts +0 -27
- package/components/input/plugins/trumbowyg/open-modal-fix.ts +0 -127
- package/components/ui/bootstrap-modal.ts +0 -52
package/app/vuetsx.ts
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { Prop, Vue, Component as OriginalComponent } from "vue-facing-decorator";
|
|
3
3
|
import { ComponentSetupFunction, Cons } from "vue-facing-decorator/dist/component";
|
|
4
4
|
import { ValidationRuleset, ValidationState } from "../common/static-wrappers/interfaces/validation-interface";
|
|
5
|
+
import { slotUnwrapper } from "../common/slot-unwrapper";
|
|
5
6
|
|
|
6
7
|
@Component
|
|
7
8
|
export default class TsxComponent<P> extends Vue {
|
|
@@ -31,16 +32,20 @@ export default class TsxComponent<P> extends Vue {
|
|
|
31
32
|
}
|
|
32
33
|
}
|
|
33
34
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
const fwId = (node as any).type?.__vfdConstructor?.$fwName;
|
|
38
|
-
if (fwId == type) {
|
|
39
|
-
retVal.push(node.props as any)
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
|
|
35
|
+
protected getSlotProperties<T>(type: string): Array<T> {
|
|
36
|
+
const slots = slotUnwrapper(this.$slots.default?.());
|
|
37
|
+
const retVal: Array<T> = [] = slots?.filter(node => (node as any)?.type?.__vfdConstructor?.$fwName == type).map(node => node.props as any);
|
|
43
38
|
return retVal;
|
|
39
|
+
|
|
40
|
+
// var retVal: Array<T> = [];
|
|
41
|
+
// for (const node of (this.$slots.default?.() || [])) {
|
|
42
|
+
// const fwId = (node as any).type?.__vfdConstructor?.$fwName;
|
|
43
|
+
// if (fwId == type) {
|
|
44
|
+
// retVal.push(node.props as any)
|
|
45
|
+
// }
|
|
46
|
+
// }
|
|
47
|
+
|
|
48
|
+
// return retVal;
|
|
44
49
|
}
|
|
45
50
|
}
|
|
46
51
|
|
|
@@ -179,7 +179,7 @@ export abstract class PowerduckViewModelBase extends Vue {
|
|
|
179
179
|
/**
|
|
180
180
|
* Validates current viewModel state based on given valdiation ruleset
|
|
181
181
|
*/
|
|
182
|
-
validate(showErrorMessage?: boolean, silent?: boolean): boolean {
|
|
182
|
+
async validate(showErrorMessage?: boolean, silent?: boolean): Promise<boolean> {
|
|
183
183
|
if (localStorage.getItem("disableValidation") == "1") {
|
|
184
184
|
return true;
|
|
185
185
|
}
|
|
@@ -188,7 +188,7 @@ export abstract class PowerduckViewModelBase extends Vue {
|
|
|
188
188
|
throw "Validation rules not specified, has to be specified in @Component declaration!";
|
|
189
189
|
}
|
|
190
190
|
|
|
191
|
-
var isInvalid = this.v$.$
|
|
191
|
+
var isInvalid = !(await this.v$.$validate());
|
|
192
192
|
if (isInvalid) {
|
|
193
193
|
if (showErrorMessage != false) {
|
|
194
194
|
this.showValidationErrorMessage();
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
export interface HistoryChangedData {
|
|
2
|
+
from: any
|
|
3
|
+
to: any
|
|
4
|
+
history: any[]
|
|
5
|
+
direction: 'back' | 'forward' | 'reload'
|
|
6
|
+
handled?: boolean
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export interface HistoryChangedEvent extends PopStateEvent {
|
|
10
|
+
detail: HistoryChangedData
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
interface HistoryOnSteroids extends History {
|
|
14
|
+
__historyExtendedInitialized: boolean
|
|
15
|
+
// stateIndex: number
|
|
16
|
+
// states: string[][]
|
|
17
|
+
// silentPop: boolean
|
|
18
|
+
|
|
19
|
+
silentBack: () => void
|
|
20
|
+
clearForward: () => void
|
|
21
|
+
nextBackWillNavigateAway: () => boolean
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
const history: HistoryOnSteroids = window.history as any;
|
|
26
|
+
if (!history.__historyExtendedInitialized) {
|
|
27
|
+
history.__historyExtendedInitialized = true;
|
|
28
|
+
|
|
29
|
+
(function () {
|
|
30
|
+
const originalPushState = history.pushState;
|
|
31
|
+
const originalReplaceState = history.replaceState;
|
|
32
|
+
|
|
33
|
+
let currentIndex = 0;
|
|
34
|
+
let previousState = null;
|
|
35
|
+
const stateHistory = []; // Array to store the timeline of states
|
|
36
|
+
let silentMode = false; // Flag to suppress events
|
|
37
|
+
|
|
38
|
+
// Function to log state into history
|
|
39
|
+
function logState(state, index) {
|
|
40
|
+
stateHistory[index] = { ...state, __heindex: index };
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// Function to dispatch the 'history-changed' event
|
|
44
|
+
function dispatchHistoryChangedEvent(direction, fromState, toState) {
|
|
45
|
+
const event = new CustomEvent("history-changed", {
|
|
46
|
+
detail: {
|
|
47
|
+
direction,
|
|
48
|
+
from: fromState,
|
|
49
|
+
to: toState,
|
|
50
|
+
history: stateHistory.slice(0, currentIndex + 1),
|
|
51
|
+
},
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
if (silentMode) {
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
window.dispatchEvent(event);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// Override pushState
|
|
62
|
+
history.pushState = function (state, title, url) {
|
|
63
|
+
previousState = { ...history.state, __heindex: currentIndex };
|
|
64
|
+
currentIndex++;
|
|
65
|
+
const enhancedState = { ...state, __heindex: currentIndex };
|
|
66
|
+
|
|
67
|
+
logState(enhancedState, currentIndex); // Log new state to history
|
|
68
|
+
originalPushState.call(history, enhancedState, title, url);
|
|
69
|
+
//dispatchHistoryChangedEvent("forward", previousState, enhancedState);
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
// Override replaceState
|
|
73
|
+
history.replaceState = function (state, title, url) {
|
|
74
|
+
const enhancedState = { ...state, __heindex: currentIndex };
|
|
75
|
+
logState(enhancedState, currentIndex); // Replace state in history
|
|
76
|
+
originalReplaceState.call(history, enhancedState, title, url);
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
// Popstate listener to detect navigation direction
|
|
80
|
+
window.addEventListener("popstate", (event) => {
|
|
81
|
+
if (silentMode) return; // Suppress event if in silent mode
|
|
82
|
+
|
|
83
|
+
const previousIndex = currentIndex;
|
|
84
|
+
previousState = stateHistory[previousIndex] || null;
|
|
85
|
+
|
|
86
|
+
currentIndex = event.state ? event.state.__heindex || 0 : 0;
|
|
87
|
+
const toState = stateHistory[currentIndex] || event.state || {};
|
|
88
|
+
|
|
89
|
+
if (currentIndex > previousIndex) {
|
|
90
|
+
dispatchHistoryChangedEvent("forward", previousState, toState);
|
|
91
|
+
} else if (currentIndex < previousIndex) {
|
|
92
|
+
dispatchHistoryChangedEvent("back", previousState, toState);
|
|
93
|
+
} else {
|
|
94
|
+
dispatchHistoryChangedEvent("reload", previousState, toState);
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
// Preserve current state on load and add index
|
|
99
|
+
window.addEventListener("load", () => {
|
|
100
|
+
const initialState = history.state || {};
|
|
101
|
+
if (!initialState.__heindex) {
|
|
102
|
+
history.replaceState({ ...initialState, __heindex: currentIndex }, "");
|
|
103
|
+
} else {
|
|
104
|
+
currentIndex = initialState.__heindex;
|
|
105
|
+
}
|
|
106
|
+
logState(history.state, currentIndex);
|
|
107
|
+
previousState = history.state;
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
// Add silent back navigation method
|
|
111
|
+
history.silentBack = function () {
|
|
112
|
+
silentMode = true; // Suppress events temporarily
|
|
113
|
+
history.back();
|
|
114
|
+
setTimeout(() => {
|
|
115
|
+
silentMode = false; // Restore normal behavior
|
|
116
|
+
}, 0);
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
// Add clear forward navigation method
|
|
120
|
+
history.clearForward = function () {
|
|
121
|
+
const currentState = { ...history.state };
|
|
122
|
+
silentMode = true; // Suppress events temporarily
|
|
123
|
+
originalReplaceState.call(history, currentState, "", location.href);
|
|
124
|
+
stateHistory.splice(currentIndex + 1); // Remove all forward history
|
|
125
|
+
setTimeout(() => {
|
|
126
|
+
silentMode = false; // Restore normal behavior
|
|
127
|
+
}, 0);
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
history.nextBackWillNavigateAway = function () {
|
|
131
|
+
return currentIndex < 1;
|
|
132
|
+
}
|
|
133
|
+
})();
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
export default class HistoryExtended {
|
|
137
|
+
static addPopstateListener(handler: (ev: HistoryChangedEvent) => any) {
|
|
138
|
+
addEventListener("history-changed" as any, handler);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
static removePopstateListener(handler: (ev: HistoryChangedEvent) => any) {
|
|
142
|
+
removeEventListener("history-changed" as any, handler);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
static nextBackWillNavigateAway(): boolean {
|
|
146
|
+
return history.nextBackWillNavigateAway();
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
static back(args?: { silent?: boolean }): void {
|
|
150
|
+
if (args?.silent == true) {
|
|
151
|
+
history.silentBack();
|
|
152
|
+
} else {
|
|
153
|
+
history.back();
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
static forward(): void {
|
|
158
|
+
history.forward();
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
static go(delta?: number): void {
|
|
162
|
+
history.go(delta);
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
static pushState(data: any, unused: string, url?: string | URL | null): void {
|
|
166
|
+
history.pushState(data, unused, url);
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
static replaceState(data: any, unused: string, url?: string | URL | null): void {
|
|
170
|
+
history.replaceState(data, unused, url);
|
|
171
|
+
}
|
|
172
|
+
}
|
|
@@ -1,155 +1,111 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
|
|
1
|
+
import { ModalUtils } from "./../components/modal/modal-utils";
|
|
2
|
+
import HistoryExtended from "./history-extended"
|
|
3
|
+
|
|
4
4
|
|
|
5
5
|
export const initHistory = () => {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
6
|
+
const randomString = (length: number): string => {
|
|
7
|
+
var result = "";
|
|
8
|
+
var chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
|
9
|
+
for (var i = length; i > 0; --i) result += chars[Math.floor(Math.random() * chars.length)];
|
|
10
|
+
return result;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const initializer = {
|
|
14
|
+
intializeModalListener() {
|
|
15
|
+
if ((window as any).__historyPowerduckInitialized == true) {
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
18
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
modalId: handleUUID,
|
|
26
|
-
},
|
|
27
|
-
null,
|
|
28
|
-
null,
|
|
29
|
-
)
|
|
30
|
-
})
|
|
31
|
-
|
|
32
|
-
$(document).on("fdd-show", function (this: any, e: any, context: JQuery) {
|
|
33
|
-
let handleUUID = PortalUtils.randomString(16)
|
|
34
|
-
$(context).attr("data-hist-uuid", handleUUID)
|
|
35
|
-
openArr.push(handleUUID)
|
|
36
|
-
|
|
37
|
-
window.history.pushState(
|
|
38
|
-
{
|
|
39
|
-
fddId: handleUUID,
|
|
40
|
-
},
|
|
41
|
-
null,
|
|
42
|
-
null,
|
|
43
|
-
)
|
|
44
|
-
})
|
|
45
|
-
|
|
46
|
-
$(document).on("hide.bs.modal", ".modal", function (this: any) {
|
|
47
|
-
if ($(this).attr("data-preventhistory") == "true") {
|
|
48
|
-
return
|
|
49
|
-
}
|
|
19
|
+
(window as any).__historyPowerduckInitialized = true;
|
|
20
|
+
$(document).on("show.bs.modal", ".modal", function (this: any) {
|
|
21
|
+
const elem = this as HTMLElement;
|
|
22
|
+
if (elem.getAttribute('data-preventhistory') == 'true') {
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
50
25
|
|
|
51
|
-
|
|
52
|
-
|
|
26
|
+
const modalId = randomString(16);
|
|
27
|
+
elem.setAttribute('data-history-uuid', modalId);
|
|
28
|
+
HistoryExtended.pushState({ modalId }, null, null);
|
|
29
|
+
});
|
|
53
30
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
}
|
|
60
|
-
})
|
|
31
|
+
$(document).on("fdd-show", function (this: any, e: any, context: JQuery) {
|
|
32
|
+
const elem = this as HTMLElement;
|
|
33
|
+
if (elem.getAttribute('data-preventhistory') == 'true') {
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
61
36
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
37
|
+
const fddId = randomString(16);
|
|
38
|
+
elem.setAttribute('data-history-uuid', fddId);
|
|
39
|
+
HistoryExtended.pushState({ fddId }, null, null);
|
|
40
|
+
});
|
|
65
41
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
42
|
+
$(document).on("hide.bs.modal", ".modal", function (this: any, e) {
|
|
43
|
+
const elem = this as HTMLElement;
|
|
44
|
+
if (elem.getAttribute('data-preventhistory') == 'true') {
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const backButtonTriggered = elem.getAttribute('data-history-bbtrigger');
|
|
49
|
+
elem.removeAttribute('data-history-bbtrigger');
|
|
50
|
+
|
|
51
|
+
if (backButtonTriggered != 'true') {
|
|
52
|
+
const isHandled = (e as any)._isNavHandled;
|
|
53
|
+
if (isHandled != true) {
|
|
54
|
+
(e as any)._isNavHandled = true;
|
|
55
|
+
|
|
56
|
+
if (!HistoryExtended.nextBackWillNavigateAway()) {
|
|
57
|
+
HistoryExtended.back({ silent: true });
|
|
81
58
|
}
|
|
82
59
|
}
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
$(document).on("fdd-hide", function (this: any, e: any, context: JQuery) {
|
|
64
|
+
const elem = this as HTMLElement;
|
|
65
|
+
if (elem.getAttribute('data-preventhistory') == 'true') {
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
83
68
|
|
|
84
|
-
|
|
85
|
-
|
|
69
|
+
const backButtonTriggered = elem.getAttribute('data-history-bbtrigger');
|
|
70
|
+
elem.removeAttribute('data-history-bbtrigger');
|
|
71
|
+
|
|
72
|
+
if (backButtonTriggered != 'true') {
|
|
73
|
+
const isHandled = (e as any)._isNavHandled;
|
|
74
|
+
if (isHandled != true) {
|
|
75
|
+
(e as any)._isNavHandled = true;
|
|
76
|
+
HistoryExtended.back({ silent: true });
|
|
86
77
|
}
|
|
78
|
+
}
|
|
79
|
+
});
|
|
87
80
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
//}, 20);
|
|
94
|
-
} else {
|
|
95
|
-
let handleUUID = openArr.pop()
|
|
96
|
-
if (!isNullOrEmpty(handleUUID)) {
|
|
97
|
-
skipModalHideCount += 1
|
|
98
|
-
|
|
99
|
-
let context = $("[data-hist-uuid='" + handleUUID + "']")
|
|
100
|
-
if (context.hasClass("modal")) {
|
|
101
|
-
context.hide()
|
|
102
|
-
} else if (context.attr("id") == "filterableSelectDropDown") {
|
|
103
|
-
$("#btn_fdd_FddCancel").click()
|
|
104
|
-
}
|
|
105
|
-
}
|
|
81
|
+
HistoryExtended.addPopstateListener((e) => {
|
|
82
|
+
const { detail } = e;
|
|
83
|
+
if (detail == null) {
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
106
86
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
87
|
+
if (detail.direction == 'back') {
|
|
88
|
+
const stateFrom = detail.from;
|
|
89
|
+
if (stateFrom == null) {
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
const modalId = stateFrom.modalId;
|
|
94
|
+
if (modalId != null && modalId.length > 0) {
|
|
95
|
+
const $modal = $("[data-history-uuid='" + modalId + "']");
|
|
96
|
+
$modal.attr('data-history-bbtrigger', 'true');
|
|
97
|
+
ModalUtils.hideModal($modal);
|
|
111
98
|
}
|
|
112
|
-
})
|
|
113
|
-
},
|
|
114
|
-
}
|
|
115
99
|
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
var highestZ = 0
|
|
120
|
-
|
|
121
|
-
$(".modal:visible").each(function (this: HTMLElement) {
|
|
122
|
-
let zi = this.style.zIndex
|
|
123
|
-
if (zi != null && zi.length > 0) {
|
|
124
|
-
let numZi = Number(zi)
|
|
125
|
-
if (numZi > highestZ && numZi > 1049) {
|
|
126
|
-
highestZ = numZi
|
|
100
|
+
const fddId = stateFrom.fddId;
|
|
101
|
+
if (fddId != null && fddId.length > 0) {
|
|
102
|
+
$("#btn_fdd_FddCancel").trigger('click');
|
|
127
103
|
}
|
|
128
104
|
}
|
|
129
|
-
})
|
|
130
105
|
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
}
|
|
134
109
|
|
|
135
|
-
|
|
136
|
-
$this.css("z-index", zIndex)
|
|
137
|
-
setTimeout(function () {
|
|
138
|
-
$(".modal-backdrop")
|
|
139
|
-
.not(".modal-stack")
|
|
140
|
-
.css("z-index", zIndex - 1)
|
|
141
|
-
.addClass("modal-stack")
|
|
142
|
-
}, 0)
|
|
143
|
-
})
|
|
144
|
-
|
|
145
|
-
$(document).on("hidden.bs.modal", ".modal", function (this: any) {
|
|
146
|
-
$(this).css("z-index", "")
|
|
147
|
-
})
|
|
148
|
-
|
|
149
|
-
//if (PortalUtils.treatAsMobileDevice()) {
|
|
150
|
-
initializer.intializeModalListener()
|
|
151
|
-
//}
|
|
152
|
-
|
|
153
|
-
// window['HistoryHandlerExt'] = historyHandler;
|
|
154
|
-
})
|
|
110
|
+
initializer.intializeModalListener();
|
|
155
111
|
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Fragment, VNode } from "vue";
|
|
2
|
+
|
|
3
|
+
export function slotUnwrapper(slots: VNode[]): VNode[] {
|
|
4
|
+
const extractNodes = (nodes: VNode | VNode[]): VNode[] => {
|
|
5
|
+
if (!nodes) {
|
|
6
|
+
return [];
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
if (Array.isArray(nodes)) {
|
|
10
|
+
return nodes.flatMap(node => (node.type === Fragment ? extractNodes(node.children as VNode[]) : node));
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
return [nodes];
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
return slots.flatMap(node => (node.type === Fragment ? extractNodes(node.children as VNode[]) : node));
|
|
17
|
+
}
|
|
@@ -1,27 +1,31 @@
|
|
|
1
|
-
import imageCompression from "browser-image-compression";
|
|
1
|
+
import imageCompression, { Options } from "browser-image-compression";
|
|
2
|
+
|
|
3
|
+
interface BrowserImageFile extends File {
|
|
4
|
+
isCompressed?: boolean
|
|
5
|
+
}
|
|
2
6
|
|
|
3
7
|
export class BrowserImageCompression {
|
|
4
|
-
static async compress(file:
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
};
|
|
8
|
+
static async compress(file: BrowserImageFile, args?: Options): Promise<BrowserImageFile> {
|
|
9
|
+
if (file.isCompressed) {
|
|
10
|
+
return file;
|
|
11
|
+
}
|
|
9
12
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
// console.log(`compressedFile size ${file.size / 1024 / 1024} MB`);
|
|
13
|
+
let options: Options = args || {};
|
|
14
|
+
options.useWebWorker = true;
|
|
13
15
|
|
|
14
|
-
|
|
16
|
+
if (options.maxSizeMB == null) {
|
|
17
|
+
options.maxSizeMB = 0.5;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
let compressedImage: BrowserImageFile = null;
|
|
15
21
|
|
|
16
22
|
try {
|
|
17
23
|
compressedImage = await imageCompression(file, options);
|
|
24
|
+
compressedImage.isCompressed = true;
|
|
25
|
+
return compressedImage;
|
|
18
26
|
} catch (error) {
|
|
19
27
|
console.log(error);
|
|
28
|
+
return file;
|
|
20
29
|
}
|
|
21
|
-
|
|
22
|
-
// console.log('After:');
|
|
23
|
-
// console.log('compressedFile instanceof Blob', file instanceof Blob);
|
|
24
|
-
// console.log(`compressedFile size ${file.size / 1024 / 1024} MB`);
|
|
25
|
-
return compressedImage;
|
|
26
30
|
}
|
|
27
31
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
export function formatString(str: string) {
|
|
2
|
-
var args = arguments;
|
|
1
|
+
export function formatString(str: string, ...args: any[]): string {
|
|
3
2
|
return str.replace(/\{\{|\}\}|\{(\d+)\}/g, function (m, n) {
|
|
4
3
|
if (m == "{{") {
|
|
5
4
|
return "{";
|
|
@@ -7,6 +6,8 @@ export function formatString(str: string) {
|
|
|
7
6
|
if (m == "}}") {
|
|
8
7
|
return "}";
|
|
9
8
|
}
|
|
10
|
-
|
|
9
|
+
|
|
10
|
+
const index = parseInt(n);
|
|
11
|
+
return args[index] ?? '';
|
|
11
12
|
});
|
|
12
|
-
};
|
|
13
|
+
};
|
|
@@ -6,9 +6,11 @@ import { BrowserImageCompression } from "./broswer-image-compression";
|
|
|
6
6
|
import StringUtils from "./string-utils";
|
|
7
7
|
|
|
8
8
|
export class UploadImageHelper {
|
|
9
|
-
static async postImage(file: File, attractionType: string): Promise<ImageResponse> {
|
|
10
|
-
if (file.type
|
|
11
|
-
file = await BrowserImageCompression.compress(file
|
|
9
|
+
static async postImage(file: File, attractionType: string, disableCompression: boolean = false, compressionMaxMb: number = 0.5): Promise<ImageResponse> {
|
|
10
|
+
if (!(disableCompression || file.type == "image/svg+xml")) {
|
|
11
|
+
file = await BrowserImageCompression.compress(file, {
|
|
12
|
+
maxSizeMB: compressionMaxMb
|
|
13
|
+
});
|
|
12
14
|
}
|
|
13
15
|
|
|
14
16
|
let formData: FormData = new FormData();
|
package/common/validation.ts
CHANGED
|
@@ -28,9 +28,10 @@ import PowerduckState from "../app/powerduck-state";
|
|
|
28
28
|
import { IValidationSet, ValidationRuleset, ValidationState } from "./static-wrappers/interfaces/validation-interface";
|
|
29
29
|
|
|
30
30
|
function getFirstUnsattisfiedValidatorName(valProp: Validation): string {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
31
|
+
const errors = valProp?.$errors || [];
|
|
32
|
+
for (var fieldError of errors) {
|
|
33
|
+
if (fieldError != null) {
|
|
34
|
+
return fieldError.$validator;
|
|
34
35
|
}
|
|
35
36
|
}
|
|
36
37
|
|
|
@@ -69,10 +70,6 @@ function getErrorMessage(valProp: Validation, invalidValidatorName: string): str
|
|
|
69
70
|
errMsg = PowerduckState.getResourceValue('validationErrorGeneric');
|
|
70
71
|
}
|
|
71
72
|
|
|
72
|
-
if (valProp.$params.customErrMsg) {
|
|
73
|
-
errMsg = valProp.$params.customErrMsg.errMsg;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
73
|
return errMsg;
|
|
77
74
|
}
|
|
78
75
|
|
|
@@ -256,12 +253,4 @@ export class ValidationBuilder {
|
|
|
256
253
|
this._validationArgs[name] = validationFunc;
|
|
257
254
|
return this;
|
|
258
255
|
}
|
|
259
|
-
|
|
260
|
-
withCustomErrorMessage(msg: string): ValidationBuilder {
|
|
261
|
-
this._validationArgs["customErrMsg"] = helpers.withParams({ type: "customErrMsg", errMsg: msg }, function (value, parentVm) {
|
|
262
|
-
return true;
|
|
263
|
-
});
|
|
264
|
-
|
|
265
|
-
return this;
|
|
266
|
-
}
|
|
267
256
|
}
|
|
@@ -61,7 +61,7 @@ class Accordion extends TsxComponent<AccordionArgs> implements AccordionArgs {
|
|
|
61
61
|
}
|
|
62
62
|
|
|
63
63
|
getSkin(): AccordionSkin {
|
|
64
|
-
return this.skin
|
|
64
|
+
return (this.skin === AccordionSkin.Light ? AccordionSkin.Light : AccordionSkin.Contrasting);
|
|
65
65
|
}
|
|
66
66
|
|
|
67
67
|
getCssClassSkin() {
|
|
@@ -81,6 +81,8 @@ class Accordion extends TsxComponent<AccordionArgs> implements AccordionArgs {
|
|
|
81
81
|
<a
|
|
82
82
|
data-toggle="collapse"
|
|
83
83
|
data-parent={"#" + componentId}
|
|
84
|
+
data-bs-toggle="collapse"
|
|
85
|
+
data-bs-parent={"#" + componentId}
|
|
84
86
|
href={"#" + componentId + "-coll-" + i}
|
|
85
87
|
aria-expanded="false"
|
|
86
88
|
aria-controls={componentId + "-coll-" + i}
|
|
@@ -140,7 +140,7 @@ class BootstrapToggle extends TsxComponent<BootstrapToggleArgs> implements Boots
|
|
|
140
140
|
}
|
|
141
141
|
}
|
|
142
142
|
|
|
143
|
-
|
|
143
|
+
beforeUnmount() {
|
|
144
144
|
$(this.getBootstrapToggleElement())["bootstrapToggle"]("destroy");
|
|
145
145
|
$(this.getBootstrapToggleElement()).off("change");
|
|
146
146
|
}
|