inviton-powerduck 0.0.165 → 0.0.167
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/global-state.ts +28 -0
- package/app/powerduck-initializer.ts +10 -9
- package/app/powerduck-state.ts +3 -2
- package/common/ajax-xhr.ts +2 -1
- package/common/api-http.ts +6 -5
- package/common/base-component.tsx +2 -1
- package/common/dialog-utils.ts +2 -1
- package/common/extensions/array-extensions.ts +1 -3
- package/common/external-barcode-scanner.ts +244 -242
- package/common/history-extended.ts +44 -6
- package/common/history-handler.ts +15 -15
- package/common/keyboard-open-tracker.ts +20 -6
- package/common/ladda-lite.ts +14 -1
- package/common/local-storage-shim.ts +74 -30
- package/common/resource-helper.ts +77 -71
- package/common/scroll-utils.ts +9 -4
- package/common/set-current-url.ts +8 -5
- package/common/utils/checkbox-utils.ts +6 -0
- package/common/utils/clipboard-provider.ts +37 -34
- package/common/utils/cookie.ts +9 -0
- package/common/utils/dropdown-utils.ts +5 -0
- package/common/utils/string-utils.ts +46 -40
- package/common/utils/upload-image-helper.ts +2 -1
- package/common/utils/utils.ts +34 -14
- package/components/app/navigation-guard.ts +5 -2
- package/components/app/root-dynamic-component-container.tsx +2 -1
- package/components/app/vue-plugin-jsxtransform.ts +3 -1
- package/components/chart-js/line-chart-flot.tsx +4 -3
- package/components/chart-js/line-chart.tsx +5 -0
- package/components/chart-js/pie-chart.tsx +4 -3
- package/components/collapse/index.tsx +9 -0
- package/components/container-with-breakpoints/ts/breakpoint-handler.ts +7 -6
- package/components/counter/index.tsx +2 -1
- package/components/counter/testall.tsx +12 -9
- package/components/datatable/datatable.tsx +2363 -2362
- package/components/dropdown/mobile/legacy_fdd.ts +10 -9
- package/components/dropdown/mobile/legacy_lvb.ts +3 -1
- package/components/file-downloader/index.tsx +6 -5
- package/components/google/maps.tsx +18 -8
- package/components/google/places-autocomplete.tsx +6 -1
- package/components/google/ts/google-maps-api.ts +3 -2
- package/components/image-crop/image-cropping-modal.tsx +11 -6
- package/components/image-crop/upload-and-crop.tsx +163 -162
- package/components/input/daterange-picker.tsx +9 -0
- package/components/input/datetime-picker.tsx +11 -2
- package/components/input/localized-url-input.tsx +2 -1
- package/components/input/ts/bootstrapInputSpinner.ts +7 -2
- package/components/input/ts/dateInputHelper.ts +8 -7
- package/components/memory-cache/index.ts +7 -5
- package/components/modal/modal-utils.ts +2 -1
- package/components/modal/modal.tsx +5 -4
- package/components/modal/ts/file-manager-dialog.ts +3 -2
- package/components/share/share-modal.tsx +13 -12
- package/components/share/share.tsx +13 -12
- package/package.json +1 -1
- package/common/cdn-webpack-shim.ts +0 -5
- package/components/input/plugins/daterangepicker/jquery.daterangepicker.min.js +0 -1910
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
type GlobalState = typeof Window.prototype & { windowExists: boolean } & Record<PropertyKey, any>;
|
|
2
|
+
type DocumentShim = typeof Document.prototype & { windowExists: boolean };
|
|
3
|
+
|
|
4
|
+
const globalState: GlobalState = (typeof window !== 'undefined')
|
|
5
|
+
? window
|
|
6
|
+
: {
|
|
7
|
+
addEventListener() { },
|
|
8
|
+
removeEventListener() { },
|
|
9
|
+
matchMedia() { return {}; },
|
|
10
|
+
getComputedStyle() { return {}; },
|
|
11
|
+
fetch,
|
|
12
|
+
} as any;
|
|
13
|
+
|
|
14
|
+
const documentWrap: DocumentShim = (typeof window !== 'undefined')
|
|
15
|
+
? document
|
|
16
|
+
: {
|
|
17
|
+
querySelector() { return null }
|
|
18
|
+
} as any;
|
|
19
|
+
|
|
20
|
+
if (typeof window !== 'undefined') {
|
|
21
|
+
globalState.windowExists = true;
|
|
22
|
+
documentWrap.windowExists = true;
|
|
23
|
+
} else {
|
|
24
|
+
globalState.windowExists = false;
|
|
25
|
+
documentWrap.windowExists = false;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export { globalState, documentWrap };
|
|
@@ -7,6 +7,7 @@ import select2 from 'select2';
|
|
|
7
7
|
import { isNullOrEmpty } from '../common/utils/is-null-or-empty';
|
|
8
8
|
import { LanguageUtils } from '../common/utils/language-utils';
|
|
9
9
|
import TemporalUtils from '../common/utils/temporal-utils';
|
|
10
|
+
import { globalState } from './global-state';
|
|
10
11
|
import PowerduckState from './powerduck-state';
|
|
11
12
|
|
|
12
13
|
export interface PoweduckInitFrameworkArgs {
|
|
@@ -15,22 +16,22 @@ export interface PoweduckInitFrameworkArgs {
|
|
|
15
16
|
|
|
16
17
|
export default class PowerduckInitializer {
|
|
17
18
|
static initFramework(args?: PoweduckInitFrameworkArgs) {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
globalState.jQuery = jquery;
|
|
20
|
+
globalState.$ = globalState.jQuery;
|
|
21
|
+
globalState.moment = moment;
|
|
22
|
+
globalState.select2 = select2();
|
|
22
23
|
|
|
23
|
-
if (
|
|
24
|
-
|
|
24
|
+
if (globalState.__viteErrHandlerBound != true) {
|
|
25
|
+
globalState.__viteErrHandlerBound = true;
|
|
25
26
|
|
|
26
|
-
|
|
27
|
+
globalState.addEventListener('vite:preloadError', (event) => {
|
|
27
28
|
const key = `${PowerduckState.getAppPrefix()}errLastReload`;
|
|
28
29
|
const lastTry = Number(localStorage.getItem(key) || '0');
|
|
29
30
|
if (TemporalUtils.dateNowMs() - lastTry > 3000) {
|
|
30
31
|
localStorage.setItem(key, TemporalUtils.dateNowMs().toString());
|
|
31
32
|
|
|
32
|
-
if (
|
|
33
|
-
location.href =
|
|
33
|
+
if (globalState.__routerNextTo != null && !isNullOrEmpty(globalState.__routerNextTo.path)) {
|
|
34
|
+
location.href = globalState.__routerNextTo.path;
|
|
34
35
|
} else {
|
|
35
36
|
location.reload();
|
|
36
37
|
}
|
package/app/powerduck-state.ts
CHANGED
|
@@ -3,6 +3,7 @@ import type { IPowerduckSystemResources } from './powerduck-system-resources';
|
|
|
3
3
|
import { Language } from '../common/enums/language';
|
|
4
4
|
import { ModalSectionMode } from '../common/enums/modal';
|
|
5
5
|
import { isNullOrEmpty } from '../common/utils/is-null-or-empty';
|
|
6
|
+
import { documentWrap, globalState } from './global-state';
|
|
6
7
|
|
|
7
8
|
type PublicStaticMethods<T> = {
|
|
8
9
|
[K in keyof T]: T[K] extends (...args: any[]) => any ? T[K] : never;
|
|
@@ -16,7 +17,7 @@ export type PowerduckStateInitArgs = Partial<PublicStaticMethods<typeof Powerduc
|
|
|
16
17
|
export default class PowerduckState {
|
|
17
18
|
private static _resources: IPowerduckSystemResources;
|
|
18
19
|
private static _language: Language;
|
|
19
|
-
private static _fullBlockerHtml =
|
|
20
|
+
private static _fullBlockerHtml = documentWrap?.querySelector('.loading-full-overlay')?.outerHTML || `<div class="loading-full-overlay"><div class="loading-inner"><div class="loading-indicator-wrap"><div class="holdon-white holdon-overlay holdon-element"><div class="holdon-content"><div class="sk-rect"><div class="rect1"></div><div class="rect2"></div><div class="rect3"></div><div class="rect4"></div><div class="rect5"></div></div></div></div></div></div></div>`;
|
|
20
21
|
private static _blockerHtml = '<div class="holdon-white holdon-overlay holdon-element"><div class="holdon-content"><div class="sk-rect"><div class="rect1"></div><div class="rect2"></div><div class="rect3"></div><div class="rect4"></div><div class="rect5"></div></div></div></div>';
|
|
21
22
|
private static _blockerSelector = '.holdon-overlay';
|
|
22
23
|
private static _stickyMap: { [index: string]: IStickyDeclaration } = {};
|
|
@@ -145,7 +146,7 @@ export default class PowerduckState {
|
|
|
145
146
|
}
|
|
146
147
|
|
|
147
148
|
static get rootDynamicComponentContainer(): IDynamicComponentContainer {
|
|
148
|
-
return
|
|
149
|
+
return globalState.RootDynamicContainerInstance;
|
|
149
150
|
}
|
|
150
151
|
|
|
151
152
|
static registerStickyTabs(id: string, state: IStickyDeclaration): void {
|
package/common/ajax-xhr.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { AjaxRequestProvider, AjaxRequestProviderRequestArgs, AjaxRequestProviderRequestResponse } from './api-http';
|
|
2
|
+
import { globalState } from '../app/global-state';
|
|
2
3
|
|
|
3
4
|
export class AjaxProviderXhr implements AjaxRequestProvider {
|
|
4
5
|
sendRequest<T>(args: AjaxRequestProviderRequestArgs): Promise<AjaxRequestProviderRequestResponse> {
|
|
@@ -41,7 +42,7 @@ export class AjaxProviderXhr implements AjaxRequestProvider {
|
|
|
41
42
|
export class AjaxProviderCordova implements AjaxRequestProvider {
|
|
42
43
|
sendRequest<T>(args: AjaxRequestProviderRequestArgs): Promise<AjaxRequestProviderRequestResponse> {
|
|
43
44
|
return new Promise((resolve) => {
|
|
44
|
-
const cordova =
|
|
45
|
+
const cordova = globalState.cordova;
|
|
45
46
|
let timeout: number = 45;
|
|
46
47
|
|
|
47
48
|
if (args.timeout > 0) {
|
package/common/api-http.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { globalState } from '../app/global-state';
|
|
1
2
|
import PowerduckState from './../app/powerduck-state';
|
|
2
3
|
import { AjaxProviderXhr } from './ajax-xhr';
|
|
3
4
|
import TemporalUtils from './utils/temporal-utils';
|
|
@@ -278,7 +279,7 @@ export class AppHttpProvider {
|
|
|
278
279
|
}
|
|
279
280
|
|
|
280
281
|
private static performAjaxCall<T>(args: AjaxDefinition<T>, url: string): Promise<T> {
|
|
281
|
-
return new
|
|
282
|
+
return new Promise((resolve, reject) => {
|
|
282
283
|
const tryGetJSON = (resp: any): any => {
|
|
283
284
|
try {
|
|
284
285
|
return JSON.parse(resp);
|
|
@@ -869,10 +870,10 @@ export class AppHttpProvider {
|
|
|
869
870
|
}
|
|
870
871
|
|
|
871
872
|
private static getApiUrlBuilders(): AjaxUrlBuilder[] {
|
|
872
|
-
if (
|
|
873
|
-
return
|
|
874
|
-
} else if (
|
|
875
|
-
return
|
|
873
|
+
if (globalState.inviton && globalState.inviton.ajaxUrlBuilders) {
|
|
874
|
+
return globalState.inviton.ajaxUrlBuilders;
|
|
875
|
+
} else if (globalState.appAjaxUrlBuilders) {
|
|
876
|
+
return globalState.appAjaxUrlBuilders;
|
|
876
877
|
}
|
|
877
878
|
|
|
878
879
|
return null;
|
|
@@ -5,6 +5,7 @@ import type { Language } from './enums/language';
|
|
|
5
5
|
import type { IValidation, ValidationState } from './static-wrappers/interfaces/validation-interface';
|
|
6
6
|
import { useVuelidate } from '@vuelidate/core';
|
|
7
7
|
import { Vue } from 'vue-facing-decorator';
|
|
8
|
+
import { globalState } from '../app/global-state';
|
|
8
9
|
import PowerduckState from '../app/powerduck-state';
|
|
9
10
|
import NotificationProvider from './../components/ui/notification';
|
|
10
11
|
import { TryCallApiResult } from './enums/api';
|
|
@@ -101,7 +102,7 @@ export abstract class PowerduckViewModelBase extends Vue {
|
|
|
101
102
|
}
|
|
102
103
|
|
|
103
104
|
if (err.authorized == false || e == 'not authorized, token expired') {
|
|
104
|
-
|
|
105
|
+
globalState.loginModalRootInstance.show();
|
|
105
106
|
}
|
|
106
107
|
|
|
107
108
|
if (!err.authorized && args.toggleAuthorization) {
|
package/common/dialog-utils.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Modal as BootstrapModal } from 'bootstrap';
|
|
2
|
+
import { globalState } from '../app/global-state';
|
|
2
3
|
import PowerduckState from '../app/powerduck-state';
|
|
3
4
|
import { ButtonLayout } from '../components/button/button-layout';
|
|
4
5
|
import { DialogIcons } from './enums/dialog-icons';
|
|
@@ -587,5 +588,5 @@ export class DialogUtils {
|
|
|
587
588
|
}
|
|
588
589
|
|
|
589
590
|
(() => {
|
|
590
|
-
|
|
591
|
+
globalState.DialogUtils = DialogUtils;
|
|
591
592
|
})();
|
|
@@ -21,9 +21,7 @@ function groupByImpl<T, K>(this: Array<T>, keySelector: (item: T) => K): Map<K,
|
|
|
21
21
|
|
|
22
22
|
export const remove = Symbol('remove');
|
|
23
23
|
function removeImpl<T>(this: Array<T>, ...items: T[]) {
|
|
24
|
-
|
|
25
|
-
// eslint-disable-next-line prefer-rest-params
|
|
26
|
-
const item = arguments[i];
|
|
24
|
+
for (const item of items) {
|
|
27
25
|
const itemIndex = this.indexOf(item);
|
|
28
26
|
|
|
29
27
|
if (itemIndex > -1) {
|