inviton-powerduck 0.0.168 → 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/radio-button-group.tsx +36 -17
- 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
|
|
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
import type { DropdownButtonItemArgs } from '../dropdown-button/dropdown-button-item';
|
|
2
2
|
import type { FormItemWrapperArgs, HintType, MarginType } from '../form/form-item-wrapper';
|
|
3
|
+
import { render } from 'vue';
|
|
3
4
|
import { Prop, toNative } from 'vue-facing-decorator';
|
|
4
5
|
import TsxComponent, { Component } from '../../app/vuetsx';
|
|
6
|
+
import { capitalize } from '../../common/extensions/string-extensions';
|
|
5
7
|
import { PortalUtils } from '../../common/utils/utils';
|
|
6
8
|
import FormItemWrapper from '../form/form-item-wrapper';
|
|
7
9
|
import HtmlLiteral from '../html-literal/html-literal';
|
|
8
10
|
import './css/radio-button-group.css';
|
|
9
|
-
import { capitalize } from '../../common/extensions/string-extensions';
|
|
10
11
|
|
|
11
12
|
type RowToString = (row) => string;
|
|
12
13
|
interface RadioButtonGroupArgs extends FormItemWrapperArgs {
|
|
13
14
|
changed: (newValue: string | any) => void;
|
|
14
|
-
|
|
15
|
-
|
|
15
|
+
customRenderOption?: (h, state: RadioDisplayArgs) => any;
|
|
16
|
+
customRenderSelectionResult?: (h, state: RadioDisplayArgs) => any;
|
|
16
17
|
options: Array<string> | Array<any>;
|
|
17
18
|
displayMember?: string | RowToString;
|
|
18
19
|
valueMember?: string | RowToString;
|
|
@@ -53,12 +54,12 @@ class RadioButtonGroupComponent extends TsxComponent<RadioButtonGroupArgs> imple
|
|
|
53
54
|
@Prop() valueMember!: (row) => string | string;
|
|
54
55
|
@Prop() selected!: string | any;
|
|
55
56
|
@Prop() changed: (newValue: string | any) => void;
|
|
56
|
-
@Prop()
|
|
57
|
-
@Prop()
|
|
57
|
+
@Prop() customRenderOption?: (h, state: RadioDisplayArgs) => any;
|
|
58
|
+
@Prop() customRenderSelectionResult?: (h, state: RadioDisplayArgs) => any;
|
|
58
59
|
|
|
59
|
-
|
|
60
|
-
if (this.
|
|
61
|
-
return
|
|
60
|
+
getCustomFormatOptions(h, item: RadioDisplayArgs): string {
|
|
61
|
+
if (this.customRenderOption != null) {
|
|
62
|
+
return this.customRenderOption(h, item);
|
|
62
63
|
}
|
|
63
64
|
}
|
|
64
65
|
|
|
@@ -116,7 +117,7 @@ class RadioButtonGroupComponent extends TsxComponent<RadioButtonGroupArgs> imple
|
|
|
116
117
|
}
|
|
117
118
|
}
|
|
118
119
|
|
|
119
|
-
getOptions(): RadioDisplayArgs[] {
|
|
120
|
+
getOptions(h): RadioDisplayArgs[] {
|
|
120
121
|
const retVal: RadioDisplayArgs[] = [];
|
|
121
122
|
const opts = this.options as any;
|
|
122
123
|
|
|
@@ -130,7 +131,7 @@ class RadioButtonGroupComponent extends TsxComponent<RadioButtonGroupArgs> imple
|
|
|
130
131
|
opts.forEach((item) => {
|
|
131
132
|
retVal.push({
|
|
132
133
|
id: this.getReflectedRowValue(item, true),
|
|
133
|
-
text: this.
|
|
134
|
+
text: this.customRenderOption != null ? this.handleCustomRenderResult(h, this.customRenderOption(h, item)) : this.getReflectedRowValue(item, false),
|
|
134
135
|
dataRow: item,
|
|
135
136
|
});
|
|
136
137
|
});
|
|
@@ -140,8 +141,26 @@ class RadioButtonGroupComponent extends TsxComponent<RadioButtonGroupArgs> imple
|
|
|
140
141
|
return retVal;
|
|
141
142
|
}
|
|
142
143
|
|
|
143
|
-
|
|
144
|
-
|
|
144
|
+
private handleCustomRenderResult(h: any, renderResult: any): string {
|
|
145
|
+
if (renderResult == null) {
|
|
146
|
+
return '';
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
if (renderResult?.__v_isVNode) {
|
|
150
|
+
const container = document.createElement('div');
|
|
151
|
+
render(renderResult as any, container);
|
|
152
|
+
return container.innerHTML;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
if (renderResult instanceof HTMLElement) {
|
|
156
|
+
return renderResult.outerHTML;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
return renderResult;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
getSelectedItem(h, opts?: RadioDisplayArgs[]): RadioDisplayArgs {
|
|
163
|
+
opts = opts || this.getOptions(h);
|
|
145
164
|
|
|
146
165
|
if (this.selected == null || opts.length == 0) {
|
|
147
166
|
return opts[0];
|
|
@@ -189,10 +208,10 @@ class RadioButtonGroupComponent extends TsxComponent<RadioButtonGroupArgs> imple
|
|
|
189
208
|
);
|
|
190
209
|
}
|
|
191
210
|
|
|
192
|
-
handleRadioValueChanged() {
|
|
211
|
+
handleRadioValueChanged(h) {
|
|
193
212
|
const selectedValue = this.$el.querySelector('input[type="radio"]:checked').value;
|
|
194
213
|
if (selectedValue != null) {
|
|
195
|
-
const opts = this.getOptions();
|
|
214
|
+
const opts = this.getOptions(h);
|
|
196
215
|
for (let i = 0, len = opts.length; i < len; i++) {
|
|
197
216
|
const optItem = opts[i];
|
|
198
217
|
if (optItem.id == selectedValue) {
|
|
@@ -205,12 +224,12 @@ class RadioButtonGroupComponent extends TsxComponent<RadioButtonGroupArgs> imple
|
|
|
205
224
|
|
|
206
225
|
renderInput(h) {
|
|
207
226
|
const nameId = `iei-group-${PortalUtils.randomString(6)}`;
|
|
208
|
-
const selectedItem = this.getSelectedItem();
|
|
227
|
+
const selectedItem = this.getSelectedItem(h);
|
|
209
228
|
const isSmall = this.radioButtonSize === RadioButtonSize.Small;
|
|
210
229
|
|
|
211
230
|
return (
|
|
212
231
|
<div class="radio-group-wrap">
|
|
213
|
-
{this.getOptions().map((optionItem) => {
|
|
232
|
+
{this.getOptions(h).map((optionItem) => {
|
|
214
233
|
const uuid = `iei-input-${PortalUtils.randomString(10)}`;
|
|
215
234
|
const selected = optionItem.id == selectedItem?.id;
|
|
216
235
|
const disabled = optionItem.dataRow?.disabled ?? false;
|
|
@@ -234,7 +253,7 @@ class RadioButtonGroupComponent extends TsxComponent<RadioButtonGroupArgs> imple
|
|
|
234
253
|
id={uuid}
|
|
235
254
|
value={optionItem.id}
|
|
236
255
|
disabled={disabled}
|
|
237
|
-
onChange={() => this.handleRadioValueChanged()}
|
|
256
|
+
onChange={() => this.handleRadioValueChanged(h)}
|
|
238
257
|
/>
|
|
239
258
|
<label class="form-check-label" for={uuid}>
|
|
240
259
|
<HtmlLiteral innerHTML={optionItem.text} />
|
|
@@ -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
|
|