inviton-powerduck 0.0.169 → 0.0.170
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/common/utils/utils.ts +51 -12
- package/components/input/plugins/currency-editor/currency-format.ts +6 -4
- package/components/input/ts/dateInputHelper.ts +1 -1
- package/components/open-street-map/ts/gesture-handling/gesture-handling.ts +8 -7
- package/components/share/share-modal.tsx +5 -8
- package/package.json +1 -1
package/common/utils/utils.ts
CHANGED
|
@@ -23,14 +23,40 @@ export class PortalUtils {
|
|
|
23
23
|
* Determines if current device runs iOS
|
|
24
24
|
*/
|
|
25
25
|
static isIOS(): boolean {
|
|
26
|
-
|
|
26
|
+
let retVal: boolean;
|
|
27
|
+
if (globalState.windowExists) {
|
|
28
|
+
retVal = ((/iPad|iPhone|iPod/.test(navigator.userAgent) && !globalState.MSStream) || navigator.userAgent.match(/(iPad)/) != null || (navigator.platform === 'MacIntel' && navigator.maxTouchPoints > 1));
|
|
29
|
+
} else {
|
|
30
|
+
retVal = false;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
if (retVal) {
|
|
34
|
+
PortalUtils.isIOS = () => true;
|
|
35
|
+
} else {
|
|
36
|
+
PortalUtils.isIOS = () => false;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
return retVal;
|
|
27
40
|
}
|
|
28
41
|
|
|
29
42
|
/**
|
|
30
43
|
* Determines if current device runs Android
|
|
31
44
|
*/
|
|
32
45
|
static isAndroid(): boolean {
|
|
33
|
-
|
|
46
|
+
let retVal: boolean;
|
|
47
|
+
if (globalState.windowExists) {
|
|
48
|
+
retVal = navigator.userAgent.toLowerCase().includes('android');
|
|
49
|
+
} else {
|
|
50
|
+
retVal = false;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
if (retVal) {
|
|
54
|
+
PortalUtils.isAndroid = () => true;
|
|
55
|
+
} else {
|
|
56
|
+
PortalUtils.isAndroid = () => false;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
return retVal;
|
|
34
60
|
}
|
|
35
61
|
|
|
36
62
|
/**
|
|
@@ -71,7 +97,20 @@ export class PortalUtils {
|
|
|
71
97
|
* Determines if current browser is Chrome
|
|
72
98
|
*/
|
|
73
99
|
static isBrowserChrome(): boolean {
|
|
74
|
-
|
|
100
|
+
let retVal: boolean;
|
|
101
|
+
if (globalState.windowExists) {
|
|
102
|
+
retVal = /Chrome/.test(navigator.userAgent) && /Google Inc/.test(navigator.vendor);
|
|
103
|
+
} else {
|
|
104
|
+
retVal = false;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
if (retVal) {
|
|
108
|
+
PortalUtils.isBrowserChrome = () => true;
|
|
109
|
+
} else {
|
|
110
|
+
PortalUtils.isBrowserChrome = () => false;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
return retVal;
|
|
75
114
|
}
|
|
76
115
|
|
|
77
116
|
/**
|
|
@@ -151,8 +190,8 @@ export class PortalUtils {
|
|
|
151
190
|
}
|
|
152
191
|
|
|
153
192
|
/*
|
|
154
|
-
|
|
155
|
-
|
|
193
|
+
* Obtains URL for asset either on CDN, or on local
|
|
194
|
+
*/
|
|
156
195
|
static getAssetPath(path: string): string {
|
|
157
196
|
return PowerduckState.getCdnPath() + path;
|
|
158
197
|
}
|
|
@@ -173,9 +212,9 @@ export class PortalUtils {
|
|
|
173
212
|
* Determines width of the scrollbar
|
|
174
213
|
*/
|
|
175
214
|
static getScrollbarWidth(): number {
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
215
|
+
if (!globalState.windowExists) {
|
|
216
|
+
return 0;
|
|
217
|
+
}
|
|
179
218
|
|
|
180
219
|
const outer = document.createElement('div');
|
|
181
220
|
outer.style.visibility = 'hidden';
|
|
@@ -280,7 +319,7 @@ export class PortalUtils {
|
|
|
280
319
|
* Determines if device supports Native share API
|
|
281
320
|
*/
|
|
282
321
|
static hasNativeShare(): boolean {
|
|
283
|
-
return navigator
|
|
322
|
+
return globalState.navigator?.share != null;
|
|
284
323
|
}
|
|
285
324
|
|
|
286
325
|
/**
|
|
@@ -361,9 +400,9 @@ export class PortalUtils {
|
|
|
361
400
|
scrollPos: number,
|
|
362
401
|
offset?: number,
|
|
363
402
|
) {
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
403
|
+
if (!globalState.windowExists) {
|
|
404
|
+
return;
|
|
405
|
+
}
|
|
367
406
|
|
|
368
407
|
if ((element as any).inviDom || (element as any).jquery) {
|
|
369
408
|
element = element[0];
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import type { CurrencyInputOptions } from './api';
|
|
2
|
+
import { globalState } from '../../../../app/global-state';
|
|
3
|
+
import PowerduckState from '../../../../app/powerduck-state';
|
|
2
4
|
import { CurrencyDisplay } from './api';
|
|
3
5
|
import { escapeRegExp, substringBefore } from './utils';
|
|
4
6
|
|
|
@@ -27,7 +29,7 @@ export default class CurrencyFormat {
|
|
|
27
29
|
|
|
28
30
|
constructor(options: CurrencyInputOptions) {
|
|
29
31
|
const { currency, currencyDisplay, locale, precision, accountingSign, useGrouping } = options;
|
|
30
|
-
this.locale = navigator
|
|
32
|
+
this.locale = PowerduckState.getCurrentLanguage() ?? globalState.navigator?.language ? navigator.language : (globalState.navigator as any)?.browserLanguage;
|
|
31
33
|
this.options = {
|
|
32
34
|
currency,
|
|
33
35
|
useGrouping,
|
|
@@ -102,9 +104,9 @@ export default class CurrencyFormat {
|
|
|
102
104
|
}
|
|
103
105
|
|
|
104
106
|
format(value: number | null, options: Intl.NumberFormatOptions = {
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
107
|
+
minimumFractionDigits: this.minimumFractionDigits,
|
|
108
|
+
maximumFractionDigits: this.maximumFractionDigits,
|
|
109
|
+
}): string {
|
|
108
110
|
return value != null ? value.toLocaleString(this.locale, { ...this.options, ...options }) : '';
|
|
109
111
|
}
|
|
110
112
|
|
|
@@ -21,7 +21,7 @@ export default class DateInputHelper {
|
|
|
21
21
|
|
|
22
22
|
static getLocale(): string {
|
|
23
23
|
const locale = PowerduckState.getCurrentLanguage();
|
|
24
|
-
if (locale == 'en') {
|
|
24
|
+
if (locale == 'en' && globalState.windowExists) {
|
|
25
25
|
const navigatorLang = navigator.language || (navigator as any).userLanguage;
|
|
26
26
|
if (navigatorLang != null && navigatorLang.indexOf('en-') == 0) {
|
|
27
27
|
return navigatorLang;
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
* * Version 1.1.8
|
|
4
4
|
*/
|
|
5
5
|
import L from 'leaflet';
|
|
6
|
+
import { globalState } from '../../../../app/global-state';
|
|
6
7
|
import PowerduckState from '../../../../app/powerduck-state';
|
|
7
8
|
import { Language } from '../../../../common/enums/language';
|
|
8
9
|
import './css/leaflet-gesture-handling.scss';
|
|
@@ -20,9 +21,9 @@ const LanguageContent = {
|
|
|
20
21
|
cs: {
|
|
21
22
|
touch: 'K\u00A0posunut\u00ED mapy pou\u017Eijte dva prsty',
|
|
22
23
|
scroll:
|
|
23
|
-
|
|
24
|
+
'Velikost zobrazen\u00ED mapy zm\u011B\u0148te podr\u017Een\u00EDm kl\u00E1vesy Ctrl a\u00A0posouv\u00E1n\u00EDm kole\u010Dka my\u0161i',
|
|
24
25
|
scrollMac:
|
|
25
|
-
|
|
26
|
+
'Velikost zobrazen\u00ED mapy zm\u011Bn\u00EDte podr\u017Een\u00EDm kl\u00E1vesy \u2318 a\u00A0posunut\u00EDm kole\u010Dka my\u0161i / touchpadu',
|
|
26
27
|
},
|
|
27
28
|
// German
|
|
28
29
|
de: {
|
|
@@ -40,17 +41,17 @@ const LanguageContent = {
|
|
|
40
41
|
pl: {
|
|
41
42
|
touch: 'Przesu\u0144 map\u0119 dwoma palcami',
|
|
42
43
|
scroll:
|
|
43
|
-
|
|
44
|
+
'Naci\u015Bnij CTRL i przewi\u0144, by przybli\u017Cy\u0107 map\u0119',
|
|
44
45
|
scrollMac:
|
|
45
|
-
|
|
46
|
+
'Naci\u015Bnij\u00A0\u2318 i przewi\u0144, by przybli\u017Cy\u0107 map\u0119',
|
|
46
47
|
},
|
|
47
48
|
// Slovak
|
|
48
49
|
sk: {
|
|
49
50
|
touch: 'Mapu m\u00F4\u017Eete posun\u00FA\u0165 dvoma prstami',
|
|
50
51
|
scroll:
|
|
51
|
-
|
|
52
|
+
'Ak chcete pribl\u00ED\u017Ei\u0165 mapu, stla\u010Dte kl\u00E1ves ctrl a\u00A0pos\u00FAvajte',
|
|
52
53
|
scrollMac:
|
|
53
|
-
|
|
54
|
+
'Ak chcete pribl\u00ED\u017Ei\u0165 mapu, stla\u010Dte kl\u00E1ves \u2318 a\u00A0pos\u00FAvajte kolieskom my\u0161i',
|
|
54
55
|
},
|
|
55
56
|
};
|
|
56
57
|
|
|
@@ -242,7 +243,7 @@ export default class LeafletGestureHandler {
|
|
|
242
243
|
|
|
243
244
|
// Check if they're on a mac for display of command instead of ctrl
|
|
244
245
|
let mac = false;
|
|
245
|
-
if (navigator
|
|
246
|
+
if ((globalState.navigator?.platform || '').toUpperCase().includes('MAC')) {
|
|
246
247
|
mac = true;
|
|
247
248
|
}
|
|
248
249
|
|
|
@@ -5,7 +5,7 @@ import { PortalUtils } from '../../common/utils/utils';
|
|
|
5
5
|
import Modal from '../modal/modal';
|
|
6
6
|
import ModalBody from '../modal/modal-body';
|
|
7
7
|
|
|
8
|
-
interface ShareComponentBindingArgs {}
|
|
8
|
+
interface ShareComponentBindingArgs { }
|
|
9
9
|
|
|
10
10
|
interface ShareComponentDisplayArgs {
|
|
11
11
|
dialogTitle: string;
|
|
@@ -21,7 +21,7 @@ class ShareModalComponent extends TsxComponent<ShareComponentBindingArgs> implem
|
|
|
21
21
|
FB_APP_ID: string = '144914712372771';
|
|
22
22
|
|
|
23
23
|
public share(args: ShareComponentDisplayArgs) {
|
|
24
|
-
if (navigator
|
|
24
|
+
if (globalState.navigator?.share) {
|
|
25
25
|
navigator.share({
|
|
26
26
|
title: args.shareTitle,
|
|
27
27
|
text: '',
|
|
@@ -79,12 +79,9 @@ class ShareModalComponent extends TsxComponent<ShareComponentBindingArgs> implem
|
|
|
79
79
|
if (this.isMobile()) {
|
|
80
80
|
globalState.open(`fb-messenger://share?link=${encodeURIComponent(this.getUrl())}&app_id=${encodeURIComponent(this.FB_APP_ID)}`, '_system');
|
|
81
81
|
} else {
|
|
82
|
-
globalState.open(`https://www.facebook.com/dialog/send?link=${
|
|
83
|
-
encodeURIComponent(this.
|
|
84
|
-
|
|
85
|
-
encodeURIComponent(this.FB_APP_ID)
|
|
86
|
-
}&redirect_uri=${
|
|
87
|
-
encodeURIComponent(this.getUrl())}`, '_system');
|
|
82
|
+
globalState.open(`https://www.facebook.com/dialog/send?link=${encodeURIComponent(this.getUrl())
|
|
83
|
+
}&app_id=${encodeURIComponent(this.FB_APP_ID)
|
|
84
|
+
}&redirect_uri=${encodeURIComponent(this.getUrl())}`, '_system');
|
|
88
85
|
}
|
|
89
86
|
}
|
|
90
87
|
|