inviton-powerduck 0.0.85 → 0.0.87
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/localized-text.ts +11 -1
- package/common/localized-value-helper.ts +9 -7
- package/common/validation.ts +2 -2
- package/components/app/dynamic-component-container.tsx +1 -1
- package/components/app/root-dynamic-component-container.tsx +1 -1
- package/components/button/button.tsx +1 -1
- package/components/button/excel-upload-button.tsx +1 -1
- package/components/button/ladda-button.tsx +1 -1
- package/components/button/text-button.tsx +1 -1
- package/components/button/upload-button.tsx +1 -1
- package/components/card/card-body.tsx +1 -1
- package/components/card/card-header-with-options.tsx +1 -1
- package/components/card/card-header.tsx +1 -1
- package/components/card/card.tsx +1 -1
- package/components/collapse/index.tsx +1 -1
- package/components/contenteditable/index.tsx +1 -1
- package/components/context-menu/context-menu.tsx +1 -1
- package/components/counter/fetchdata.tsx +1 -1
- package/components/counter/index.tsx +1 -1
- package/components/datatable/col-vis-modal.tsx +1 -1
- package/components/datatable/filter-modal.tsx +1 -1
- package/components/dropdown/image-dropdown.tsx +1 -1
- package/components/dropdown/timezone-picker.tsx +1 -1
- package/components/dropdown-button/dropdown-button-element.tsx +1 -1
- package/components/dropdown-button/dropdown-button-heading.tsx +1 -1
- package/components/dropdown-button/dropdown-button-item.tsx +1 -1
- package/components/dropdown-button/dropdown-button-separator.tsx +1 -1
- package/components/dropdown-button/language-dropdown-button.tsx +1 -1
- package/components/file-downloader/index.tsx +1 -1
- package/components/form/footer-buttons.tsx +1 -1
- package/components/form/form.tsx +1 -1
- package/components/form/separator.tsx +1 -1
- package/components/form/validation-result-displayer.tsx +1 -1
- package/components/fullcalendar/fullcalendar-draggable-event.tsx +1 -1
- package/components/fullcalendar/timegrid-calendar.tsx +1 -1
- package/components/google/maps.tsx +1 -1
- package/components/highlight-js/index.tsx +1 -1
- package/components/home/index.tsx +1 -1
- package/components/html-literal/html-literal.tsx +1 -1
- package/components/image-crop/image-cropping-modal.tsx +1 -1
- package/components/image-crop/upload-and-crop.tsx +1 -1
- package/components/input/checkbox-without-label.tsx +1 -1
- package/components/input/geo-json.tsx +1 -1
- package/components/input/localized-info-input.tsx +8 -8
- package/components/input/localized-string-input.tsx +15 -15
- package/components/input/localized-string-textarea.tsx +9 -9
- package/components/input/localized-string-wysiwyg.tsx +9 -9
- package/components/input/localized-url-input.tsx +15 -15
- package/components/loading-indicator/index.tsx +1 -1
- package/components/modal/animation-error.tsx +1 -1
- package/components/modal/animation-success.tsx +1 -1
- package/components/modal/icon-question.tsx +1 -1
- package/components/modal/icon-warning.tsx +1 -1
- package/components/modal/modal-body.tsx +1 -1
- package/components/modal/modal-footer.tsx +1 -1
- package/components/modal-wrap/modal-section-wrapper.tsx +1 -1
- package/components/modal-wrap/modal-subtitle.tsx +1 -1
- package/components/progress-bar/index.tsx +1 -1
- package/components/rating/rating-displayer.tsx +1 -1
- package/components/rating/rating-picker.tsx +1 -1
- package/components/share/share-modal.tsx +1 -1
- package/components/share/share.tsx +1 -1
- package/components/sortable/sortable-container.tsx +1 -1
- package/components/sortable/sortable-item.tsx +1 -1
- package/components/spreadsheet/spreadsheet.tsx +1 -1
- package/components/summary-stats/summary-stats.tsx +1 -1
- package/components/swiper/swiper-gallery.tsx +1 -1
- package/components/swiper/swiper-slide.tsx +1 -1
- package/components/swiper/swiper.tsx +1 -1
- package/components/table-wrapper/table-wrapper.tsx +1 -1
- package/components/tilebox/tilebox.tsx +1 -1
- package/components/tooltip/index.tsx +1 -1
- package/components/transition/index.tsx +1 -1
- package/components/wizard/wizard-subtitle.tsx +1 -1
- package/package.json +1 -1
- package/common/utils/localized-string.ts +0 -83
- package/common/utils/localized-text-util.ts +0 -36
package/common/localized-text.ts
CHANGED
|
@@ -1,4 +1,14 @@
|
|
|
1
|
-
export
|
|
1
|
+
export interface ILocalizedText {
|
|
2
|
+
sk?: string
|
|
3
|
+
cs?: string
|
|
4
|
+
pl?: string
|
|
5
|
+
en?: string
|
|
6
|
+
de?: string
|
|
7
|
+
it?: string
|
|
8
|
+
hu?: string
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export default class LocalizedText implements ILocalizedText {
|
|
2
12
|
sk: string = null as any;
|
|
3
13
|
cs: string = null as any;
|
|
4
14
|
pl: string = null as any;
|
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
import PowerduckState from '../app/powerduck-state';
|
|
2
2
|
import { Language } from './enums/language';
|
|
3
|
-
import
|
|
3
|
+
import { ILocalizedText } from './localized-text';
|
|
4
4
|
import { isNullOrEmpty } from './utils/is-null-or-empty';
|
|
5
5
|
|
|
6
|
-
export default class LocalizedValueHelper {
|
|
7
|
-
static
|
|
6
|
+
export default class LocalizedValueHelper {
|
|
7
|
+
static getValue(value: ILocalizedText, lang?: Language | string): string {
|
|
8
8
|
if (value == null) {
|
|
9
9
|
return null as any;
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
if (lang == null) {
|
|
13
|
+
lang = PowerduckState.getCurrentLanguage()
|
|
14
|
+
}
|
|
14
15
|
|
|
16
|
+
const inLang = value[lang];
|
|
15
17
|
if (inLang != null) {
|
|
16
18
|
return inLang;
|
|
17
19
|
}
|
|
@@ -42,8 +44,8 @@ export default class LocalizedValueHelper {
|
|
|
42
44
|
return null as any;
|
|
43
45
|
}
|
|
44
46
|
|
|
45
|
-
static validateLocalizedValue(locValArr:
|
|
46
|
-
if (isNullOrEmpty(LocalizedValueHelper.
|
|
47
|
+
static validateLocalizedValue(locValArr: ILocalizedText): boolean {
|
|
48
|
+
if (isNullOrEmpty(LocalizedValueHelper.getValue(locValArr))) {
|
|
47
49
|
return false;
|
|
48
50
|
}
|
|
49
51
|
|
package/common/validation.ts
CHANGED
|
@@ -21,11 +21,11 @@
|
|
|
21
21
|
} from "@vuelidate/validators";
|
|
22
22
|
import { PowerduckViewModelBase } from "./base-component";
|
|
23
23
|
import { Validation } from "@vuelidate/core";
|
|
24
|
-
import LocalizedStringHelper from "./utils/localized-string";
|
|
25
24
|
import { isNullOrEmpty } from "./utils/is-null-or-empty";
|
|
26
25
|
import { capitalize } from "./utils/capitalize-string";
|
|
27
26
|
import PowerduckState from "../app/powerduck-state";
|
|
28
27
|
import { IValidationSet, ValidationRuleset, ValidationState } from "./static-wrappers/interfaces/validation-interface";
|
|
28
|
+
import LocalizedValueHelper from "./localized-value-helper";
|
|
29
29
|
|
|
30
30
|
function getFirstUnsattisfiedValidatorName(valProp: Validation): string {
|
|
31
31
|
const errors = valProp?.$errors || [];
|
|
@@ -158,7 +158,7 @@ export class ValidationBuilder {
|
|
|
158
158
|
|
|
159
159
|
requiredLocalizedString(): ValidationBuilder {
|
|
160
160
|
this._validationArgs.requiredLocalizedString = (value) => {
|
|
161
|
-
if (value == null || isNullOrEmpty(
|
|
161
|
+
if (value == null || isNullOrEmpty(LocalizedValueHelper.getValue(value, 'sk'))) {
|
|
162
162
|
return false;
|
|
163
163
|
}
|
|
164
164
|
|
|
@@ -85,5 +85,5 @@ class DynamicComponentContainerComponent extends Vue implements IDynamicComponen
|
|
|
85
85
|
}
|
|
86
86
|
}
|
|
87
87
|
|
|
88
|
-
const DynamicComponentContainer = toNative(DynamicComponentContainerComponent)
|
|
88
|
+
const DynamicComponentContainer = toNative(DynamicComponentContainerComponent)
|
|
89
89
|
export default DynamicComponentContainer
|
|
@@ -30,5 +30,5 @@ class RootDynamicComponentContainerComponent extends Vue implements IDynamicComp
|
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
const RootDynamicComponentContainer = toNative(RootDynamicComponentContainerComponent)
|
|
33
|
+
const RootDynamicComponentContainer = toNative(RootDynamicComponentContainerComponent)
|
|
34
34
|
export default RootDynamicComponentContainer
|
|
@@ -54,5 +54,5 @@ class CardHeaderWithOptionsComponent extends TsxComponent<CardHeaderWithOptionsA
|
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
-
const CardHeaderWithOptions = toNative(CardHeaderWithOptionsComponent)
|
|
57
|
+
const CardHeaderWithOptions = toNative(CardHeaderWithOptionsComponent)
|
|
58
58
|
export default CardHeaderWithOptions
|
package/components/card/card.tsx
CHANGED
|
@@ -75,5 +75,5 @@ class DropdownButtonElementComponent extends TsxComponent<DropdownButtonElementA
|
|
|
75
75
|
}
|
|
76
76
|
}
|
|
77
77
|
|
|
78
|
-
const DropdownButtonElement = toNative(DropdownButtonElementComponent)
|
|
78
|
+
const DropdownButtonElement = toNative(DropdownButtonElementComponent)
|
|
79
79
|
export default DropdownButtonElement
|
|
@@ -13,5 +13,5 @@ class DropdownButtonHeadingComponent extends TsxComponent<DropdownButtonHeadingA
|
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
const DropdownButtonHeading = toNative(DropdownButtonHeadingComponent)
|
|
16
|
+
const DropdownButtonHeading = toNative(DropdownButtonHeadingComponent)
|
|
17
17
|
export default DropdownButtonHeading
|
|
@@ -92,5 +92,5 @@ class DropdownButtonItemComponent extends TsxComponent<DropdownButtonItemArgs> i
|
|
|
92
92
|
}
|
|
93
93
|
}
|
|
94
94
|
|
|
95
|
-
const DropdownButtonItem = toNative(DropdownButtonItemComponent)
|
|
95
|
+
const DropdownButtonItem = toNative(DropdownButtonItemComponent)
|
|
96
96
|
export default DropdownButtonItem
|
|
@@ -9,5 +9,5 @@ class DropdownButtonSeparatorComponent extends TsxComponent<DropdownButtonItemAr
|
|
|
9
9
|
}
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
const DropdownButtonSeparator = toNative(DropdownButtonSeparatorComponent)
|
|
12
|
+
const DropdownButtonSeparator = toNative(DropdownButtonSeparatorComponent)
|
|
13
13
|
export default DropdownButtonSeparator
|
|
@@ -50,5 +50,5 @@ class LanguageDropdownButtonComponent extends TsxComponent<LanguageDropdownButto
|
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
-
const LanguageDropdownButton = toNative(LanguageDropdownButtonComponent)
|
|
53
|
+
const LanguageDropdownButton = toNative(LanguageDropdownButtonComponent)
|
|
54
54
|
export default LanguageDropdownButton
|
|
@@ -262,5 +262,5 @@ class FileDownloadDialogComponent extends TsxComponent<FileDownloadDialogBinding
|
|
|
262
262
|
}
|
|
263
263
|
}
|
|
264
264
|
|
|
265
|
-
const FileDownloadDialog = toNative(FileDownloadDialogComponent)
|
|
265
|
+
const FileDownloadDialog = toNative(FileDownloadDialogComponent)
|
|
266
266
|
export default FileDownloadDialog
|
package/components/form/form.tsx
CHANGED
|
@@ -32,5 +32,5 @@ class ValidationResultDisplayerComponent extends TsxComponent<ValidationResultDi
|
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
const ValidationResultDisplayer = toNative(ValidationResultDisplayerComponent)
|
|
35
|
+
const ValidationResultDisplayer = toNative(ValidationResultDisplayerComponent)
|
|
36
36
|
export default ValidationResultDisplayer
|
|
@@ -82,5 +82,5 @@ class FullCalendarDraggableEventComponent extends TsxComponent<FullCalendarDragg
|
|
|
82
82
|
}
|
|
83
83
|
}
|
|
84
84
|
|
|
85
|
-
const FullCalendarDraggableEvent = toNative(FullCalendarDraggableEventComponent)
|
|
85
|
+
const FullCalendarDraggableEvent = toNative(FullCalendarDraggableEventComponent)
|
|
86
86
|
export default FullCalendarDraggableEvent
|
|
@@ -496,5 +496,5 @@ class TimegridCalendarComponent extends TsxComponent<TimegridCalendarArgs> imple
|
|
|
496
496
|
}
|
|
497
497
|
}
|
|
498
498
|
|
|
499
|
-
const TimegridCalendar = toNative(TimegridCalendarComponent)
|
|
499
|
+
const TimegridCalendar = toNative(TimegridCalendarComponent)
|
|
500
500
|
export default TimegridCalendar
|
|
@@ -175,5 +175,5 @@ class UploadImageAndCropButtonComponent extends TsxComponent<UploadImageAndCropB
|
|
|
175
175
|
}
|
|
176
176
|
}
|
|
177
177
|
|
|
178
|
-
const UploadImageAndCropButton = toNative(UploadImageAndCropButtonComponent)
|
|
178
|
+
const UploadImageAndCropButton = toNative(UploadImageAndCropButtonComponent)
|
|
179
179
|
export default UploadImageAndCropButton
|
|
@@ -62,5 +62,5 @@ class CheckBoxWithoutLabelComponent extends TsxComponent<CheckBoxArgs> implement
|
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
-
const CheckBoxWithoutLabel = toNative(CheckBoxWithoutLabelComponent)
|
|
65
|
+
const CheckBoxWithoutLabel = toNative(CheckBoxWithoutLabelComponent)
|
|
66
66
|
export default CheckBoxWithoutLabel
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Prop, toNative } from "vue-facing-decorator";
|
|
2
|
-
import
|
|
2
|
+
import { ILocalizedText } from "../../common/localized-text";
|
|
3
3
|
import TsxComponent, { Component } from "../../app/vuetsx";
|
|
4
4
|
import { Language } from "../../common/enums/language";
|
|
5
5
|
import { isNullOrEmpty } from "../../common/utils/is-null-or-empty";
|
|
@@ -12,13 +12,13 @@ import { ValidationState } from "../../common/static-wrappers/interfaces/validat
|
|
|
12
12
|
interface LocalizedInfoInputArgs {
|
|
13
13
|
label: string;
|
|
14
14
|
wrap?: boolean;
|
|
15
|
-
value:
|
|
15
|
+
value: ILocalizedText;
|
|
16
16
|
placeholder?: string;
|
|
17
17
|
subtitle?: string;
|
|
18
18
|
hint?: string;
|
|
19
19
|
displayType?: "input" | "textarea";
|
|
20
20
|
validationState?: ValidationState;
|
|
21
|
-
changed: (e:
|
|
21
|
+
changed: (e: ILocalizedText) => void;
|
|
22
22
|
mandatory?: boolean;
|
|
23
23
|
}
|
|
24
24
|
|
|
@@ -26,19 +26,19 @@ interface LocalizedInfoInputArgs {
|
|
|
26
26
|
class LocalizedInfoInputComponent extends TsxComponent<LocalizedInfoInputArgs> implements LocalizedInfoInputArgs {
|
|
27
27
|
@Prop() label: string;
|
|
28
28
|
@Prop() wrap?: boolean;
|
|
29
|
-
@Prop() value:
|
|
29
|
+
@Prop() value: ILocalizedText;
|
|
30
30
|
@Prop() placeholder!: string;
|
|
31
31
|
@Prop() subtitle!: string;
|
|
32
32
|
@Prop() hint!: string;
|
|
33
33
|
@Prop() displayType: "input" | "textarea";
|
|
34
|
-
@Prop() changed: (e:
|
|
34
|
+
@Prop() changed: (e: ILocalizedText) => void;
|
|
35
35
|
@Prop() mandatory?: boolean;
|
|
36
36
|
|
|
37
37
|
getValueForTmrLanguage(lang: Language): string {
|
|
38
38
|
return this.value[lang];
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
getValue(value:
|
|
41
|
+
getValue(value: ILocalizedText): ILocalizedText {
|
|
42
42
|
if (value == null) {
|
|
43
43
|
return {
|
|
44
44
|
cs: null,
|
|
@@ -62,13 +62,13 @@ class LocalizedInfoInputComponent extends TsxComponent<LocalizedInfoInputArgs> i
|
|
|
62
62
|
};
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
-
valueChanged(e:
|
|
65
|
+
valueChanged(e: ILocalizedText): void {
|
|
66
66
|
if (e == null) {
|
|
67
67
|
this.changed(null);
|
|
68
68
|
return;
|
|
69
69
|
}
|
|
70
70
|
|
|
71
|
-
let retObj:
|
|
71
|
+
let retObj: ILocalizedText = {} as any;
|
|
72
72
|
const addLocalizedValue = (lang: Language, value: string): void => {
|
|
73
73
|
if (!isNullOrEmpty(value)) {
|
|
74
74
|
retObj[lang] = value;
|
|
@@ -9,17 +9,17 @@ import { ButtonLayout } from "../button/button-layout";
|
|
|
9
9
|
import { DropdownButtonItemArgs } from "../dropdown-button/dropdown-button-item";
|
|
10
10
|
import { PortalUtils } from "../../common/utils/utils";
|
|
11
11
|
import { LanguageUtils } from "../../common/utils/language-utils";
|
|
12
|
-
import LocalizedStringHelper from "../../common/utils/localized-string";
|
|
13
12
|
import { Language } from "../../common/enums/language";
|
|
14
13
|
import { isNullOrEmpty } from "../../common/utils/is-null-or-empty";
|
|
15
14
|
import globalIcon from './img/global.png';
|
|
16
15
|
import PowerduckState from "../../app/powerduck-state";
|
|
17
|
-
import
|
|
16
|
+
import { ILocalizedText } from "../../common/localized-text";
|
|
18
17
|
import "./css/localized-string-input.css";
|
|
18
|
+
import LocalizedValueHelper from "../../common/localized-value-helper";
|
|
19
19
|
|
|
20
20
|
interface LocalizedStringInputArgs extends FormItemWrapperArgs {
|
|
21
|
-
value:
|
|
22
|
-
changed: (e:
|
|
21
|
+
value: ILocalizedText;
|
|
22
|
+
changed: (e: ILocalizedText) => void;
|
|
23
23
|
supportedLanguages?: Language[];
|
|
24
24
|
placeholder?: string;
|
|
25
25
|
}
|
|
@@ -29,8 +29,8 @@ class LocalizedStringInputComponent extends TsxComponent<LocalizedStringInputArg
|
|
|
29
29
|
@Prop() label!: string;
|
|
30
30
|
@Prop() labelButtons!: DropdownButtonItemArgs[];
|
|
31
31
|
@Prop() subtitle!: string;
|
|
32
|
-
@Prop() value!:
|
|
33
|
-
@Prop() changed: (e:
|
|
32
|
+
@Prop() value!: ILocalizedText;
|
|
33
|
+
@Prop() changed: (e: ILocalizedText) => void;
|
|
34
34
|
@Prop() supportedLanguages?: Language[];
|
|
35
35
|
@Prop() marginType?: MarginType;
|
|
36
36
|
@Prop() maxWidth?: number;
|
|
@@ -45,11 +45,11 @@ class LocalizedStringInputComponent extends TsxComponent<LocalizedStringInputArg
|
|
|
45
45
|
@Prop() prependIcon: string;
|
|
46
46
|
@Prop() appendClicked: () => void;
|
|
47
47
|
@Prop() prependClicked: () => void;
|
|
48
|
-
currentValue:
|
|
48
|
+
currentValue: ILocalizedText = null;
|
|
49
49
|
modalWillShow: boolean = false;
|
|
50
50
|
uuid: string = "lsw-" + PortalUtils.randomString(10);
|
|
51
51
|
|
|
52
|
-
raiseChangeEvent(newValue:
|
|
52
|
+
raiseChangeEvent(newValue: ILocalizedText): void {
|
|
53
53
|
this.populateValidationDeclaration();
|
|
54
54
|
|
|
55
55
|
if (this.changed != null) {
|
|
@@ -60,10 +60,10 @@ class LocalizedStringInputComponent extends TsxComponent<LocalizedStringInputArg
|
|
|
60
60
|
isAllSame(): boolean {
|
|
61
61
|
if (this.value != null) {
|
|
62
62
|
let langList = LanguageUtils.getLanguageList();
|
|
63
|
-
let skValue =
|
|
63
|
+
let skValue = LocalizedValueHelper.getValue(this.value, Language.sk);
|
|
64
64
|
|
|
65
65
|
for (let i = 0, len = langList.length; i < len; i++) {
|
|
66
|
-
if (
|
|
66
|
+
if (LocalizedValueHelper.getValue(this.value, langList[i].id) != skValue) {
|
|
67
67
|
return false;
|
|
68
68
|
}
|
|
69
69
|
}
|
|
@@ -73,7 +73,7 @@ class LocalizedStringInputComponent extends TsxComponent<LocalizedStringInputArg
|
|
|
73
73
|
}
|
|
74
74
|
|
|
75
75
|
hasSomeValue(): boolean {
|
|
76
|
-
return !isNullOrEmpty(
|
|
76
|
+
return !isNullOrEmpty(LocalizedValueHelper.getValue(this.value, Language.sk));
|
|
77
77
|
}
|
|
78
78
|
|
|
79
79
|
getModalContext(): JQuery {
|
|
@@ -117,7 +117,7 @@ class LocalizedStringInputComponent extends TsxComponent<LocalizedStringInputArg
|
|
|
117
117
|
|
|
118
118
|
if (currentVal == null || currentVal.length == 0) {
|
|
119
119
|
var language: Language = $this.attr("data-inv-lang") as any;
|
|
120
|
-
var lsValue =
|
|
120
|
+
var lsValue = LocalizedValueHelper.getValue(value, language) || "";
|
|
121
121
|
$this.attr("placeholder", lsValue);
|
|
122
122
|
}
|
|
123
123
|
});
|
|
@@ -175,7 +175,7 @@ class LocalizedStringInputComponent extends TsxComponent<LocalizedStringInputArg
|
|
|
175
175
|
return (
|
|
176
176
|
<div class={PowerduckState.getFormControlCssClass() + " localized-input"} onClick={(e) => this.showInputModal()}>
|
|
177
177
|
<img src={globalIcon} />
|
|
178
|
-
{
|
|
178
|
+
{LocalizedValueHelper.getValue(this.value, Language.sk)}
|
|
179
179
|
</div>
|
|
180
180
|
);
|
|
181
181
|
}
|
|
@@ -190,7 +190,7 @@ class LocalizedStringInputComponent extends TsxComponent<LocalizedStringInputArg
|
|
|
190
190
|
|
|
191
191
|
let langValue = this.value[lang.id];
|
|
192
192
|
let hasValue = !isNullOrEmpty(langValue);
|
|
193
|
-
langValue = hasValue ? langValue :
|
|
193
|
+
langValue = hasValue ? langValue : LocalizedValueHelper.getValue(this.value, lang.id);
|
|
194
194
|
|
|
195
195
|
return (
|
|
196
196
|
<div class={"localized-input-item" + (hasValue ? "" : " lii-auto")}>
|
|
@@ -216,7 +216,7 @@ class LocalizedStringInputComponent extends TsxComponent<LocalizedStringInputArg
|
|
|
216
216
|
|
|
217
217
|
let langValue = this.currentValue[lang.id];
|
|
218
218
|
let hasValue = !isNullOrEmpty(langValue);
|
|
219
|
-
langValue = hasValue ? langValue :
|
|
219
|
+
langValue = hasValue ? langValue : LocalizedValueHelper.getValue(this.currentValue, lang.id);
|
|
220
220
|
|
|
221
221
|
return (
|
|
222
222
|
<div class="row align-items-end lsi-form-group">
|
|
@@ -8,11 +8,11 @@ import TextArea from "./textarea";
|
|
|
8
8
|
import { LanguageUtils } from "../../common/utils/language-utils";
|
|
9
9
|
import { Language } from "../../common/enums/language";
|
|
10
10
|
import PowerduckState from "../../app/powerduck-state";
|
|
11
|
-
import
|
|
11
|
+
import {ILocalizedText} from "../../common/localized-text";
|
|
12
12
|
|
|
13
13
|
interface LocalizedStringInputArgs extends FormItemWrapperArgs {
|
|
14
|
-
value:
|
|
15
|
-
changed: (e:
|
|
14
|
+
value: ILocalizedText;
|
|
15
|
+
changed: (e: ILocalizedText) => void;
|
|
16
16
|
supportedLanguages?: Language[];
|
|
17
17
|
placeholder?: string;
|
|
18
18
|
}
|
|
@@ -22,8 +22,8 @@ class LocalizedStringTextareaComponent extends TsxComponent<LocalizedStringInput
|
|
|
22
22
|
@Prop() label!: string;
|
|
23
23
|
@Prop() labelButtons!: DropdownButtonItemArgs[];
|
|
24
24
|
@Prop() subtitle!: string;
|
|
25
|
-
@Prop() value!:
|
|
26
|
-
@Prop() changed: (e:
|
|
25
|
+
@Prop() value!: ILocalizedText;
|
|
26
|
+
@Prop() changed: (e: ILocalizedText) => void;
|
|
27
27
|
@Prop() supportedLanguages?: Language[];
|
|
28
28
|
@Prop() marginType?: MarginType;
|
|
29
29
|
@Prop() maxWidth?: number;
|
|
@@ -37,9 +37,9 @@ class LocalizedStringTextareaComponent extends TsxComponent<LocalizedStringInput
|
|
|
37
37
|
@Prop() prependIcon: string;
|
|
38
38
|
@Prop() appendClicked: () => void;
|
|
39
39
|
@Prop() prependClicked: () => void;
|
|
40
|
-
currentValue:
|
|
40
|
+
currentValue: ILocalizedText = null;
|
|
41
41
|
|
|
42
|
-
raiseChangeEvent (newValue:
|
|
42
|
+
raiseChangeEvent (newValue: ILocalizedText): void {
|
|
43
43
|
this.populateValidationDeclaration();
|
|
44
44
|
|
|
45
45
|
if (this.changed != null) {
|
|
@@ -52,12 +52,12 @@ class LocalizedStringTextareaComponent extends TsxComponent<LocalizedStringInput
|
|
|
52
52
|
}
|
|
53
53
|
|
|
54
54
|
changeValue(lang: Language, newValue: string): void {
|
|
55
|
-
let value = this.value || ({} as
|
|
55
|
+
let value = this.value || ({} as ILocalizedText);
|
|
56
56
|
value[lang] = newValue;
|
|
57
57
|
this.raiseChangeEvent(value);
|
|
58
58
|
}
|
|
59
59
|
|
|
60
|
-
getActualValue (lang: Language, value:
|
|
60
|
+
getActualValue (lang: Language, value: ILocalizedText): string {
|
|
61
61
|
if (value == null) {
|
|
62
62
|
return null;
|
|
63
63
|
}
|
|
@@ -5,14 +5,14 @@ import Tabs, { TabsRenderMode } from "../tabs/tabs";
|
|
|
5
5
|
import { TabPage } from "../tabs/tab-page";
|
|
6
6
|
import { DropdownButtonItemArgs } from "../dropdown-button/dropdown-button-item";
|
|
7
7
|
import WysiwigEditor from "./wysiwig";
|
|
8
|
-
import
|
|
8
|
+
import {ILocalizedText} from "../../common/localized-text";
|
|
9
9
|
import { LanguageUtils } from "../../common/utils/language-utils";
|
|
10
10
|
import { Language } from "../../common/enums/language";
|
|
11
11
|
import PowerduckState from "../../app/powerduck-state";
|
|
12
12
|
|
|
13
13
|
interface LocalizedStringInputArgs extends FormItemWrapperArgs {
|
|
14
|
-
value:
|
|
15
|
-
changed: (e:
|
|
14
|
+
value: ILocalizedText;
|
|
15
|
+
changed: (e: ILocalizedText) => void;
|
|
16
16
|
supportedLanguages?: Language[];
|
|
17
17
|
placeholder?: string;
|
|
18
18
|
resizable?: boolean
|
|
@@ -23,8 +23,8 @@ class LocalizedStringWysiwigComponent extends TsxComponent<LocalizedStringInputA
|
|
|
23
23
|
@Prop() label!: string;
|
|
24
24
|
@Prop() labelButtons!: DropdownButtonItemArgs[];
|
|
25
25
|
@Prop() subtitle!: string;
|
|
26
|
-
@Prop() value!:
|
|
27
|
-
@Prop() changed: (e:
|
|
26
|
+
@Prop() value!: ILocalizedText;
|
|
27
|
+
@Prop() changed: (e: ILocalizedText) => void;
|
|
28
28
|
@Prop() supportedLanguages?: Language[];
|
|
29
29
|
@Prop() marginType?: MarginType;
|
|
30
30
|
@Prop() maxWidth?: number;
|
|
@@ -38,9 +38,9 @@ class LocalizedStringWysiwigComponent extends TsxComponent<LocalizedStringInputA
|
|
|
38
38
|
@Prop() prependIcon: string;
|
|
39
39
|
@Prop() appendClicked: () => void;
|
|
40
40
|
@Prop() prependClicked: () => void;
|
|
41
|
-
currentValue:
|
|
41
|
+
currentValue: ILocalizedText = null;
|
|
42
42
|
|
|
43
|
-
raiseChangeEvent(newValue:
|
|
43
|
+
raiseChangeEvent(newValue: ILocalizedText): void {
|
|
44
44
|
this.populateValidationDeclaration();
|
|
45
45
|
|
|
46
46
|
if (this.changed != null) {
|
|
@@ -53,12 +53,12 @@ class LocalizedStringWysiwigComponent extends TsxComponent<LocalizedStringInputA
|
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
changeValue(lang: Language, newValue: string): void {
|
|
56
|
-
let value = this.value || ({} as
|
|
56
|
+
let value = this.value || ({} as ILocalizedText);
|
|
57
57
|
value[lang] = newValue;
|
|
58
58
|
this.raiseChangeEvent(value);
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
-
getActualValue(lang: Language, value:
|
|
61
|
+
getActualValue(lang: Language, value: ILocalizedText): string {
|
|
62
62
|
if (value == null) {
|
|
63
63
|
return null;
|
|
64
64
|
}
|
|
@@ -13,16 +13,16 @@ import FlexFormItem from "../form/form-item-flex";
|
|
|
13
13
|
import { FileManagerDialog, FileManagerModalFileType } from "../modal/ts/file-manager-dialog";
|
|
14
14
|
import { PortalUtils } from "../../common/utils/utils";
|
|
15
15
|
import { LanguageUtils } from "../../common/utils/language-utils";
|
|
16
|
-
import LocalizedStringHelper from "../../common/utils/localized-string";
|
|
17
16
|
import { Language } from "../../common/enums/language";
|
|
18
17
|
import { isNullOrEmpty } from "../../common/utils/is-null-or-empty";
|
|
19
18
|
import globalIcon from './img/global.png';
|
|
20
19
|
import PowerduckState from "../../app/powerduck-state";
|
|
21
|
-
import
|
|
20
|
+
import {ILocalizedText} from "../../common/localized-text";
|
|
21
|
+
import LocalizedValueHelper from "../../common/localized-value-helper";
|
|
22
22
|
|
|
23
23
|
interface LocalizedUrlInputArgs extends FormItemWrapperArgs {
|
|
24
|
-
value:
|
|
25
|
-
changed: (e:
|
|
24
|
+
value: ILocalizedText;
|
|
25
|
+
changed: (e: ILocalizedText) => void;
|
|
26
26
|
supportedLanguages?: Language[];
|
|
27
27
|
placeholder?: string;
|
|
28
28
|
}
|
|
@@ -32,8 +32,8 @@ class LocalizedUrlInputComponent extends TsxComponent<LocalizedUrlInputArgs> imp
|
|
|
32
32
|
@Prop() label!: string;
|
|
33
33
|
@Prop() labelButtons!: DropdownButtonItemArgs[];
|
|
34
34
|
@Prop() subtitle!: string;
|
|
35
|
-
@Prop() value!:
|
|
36
|
-
@Prop() changed: (e:
|
|
35
|
+
@Prop() value!: ILocalizedText;
|
|
36
|
+
@Prop() changed: (e: ILocalizedText) => void;
|
|
37
37
|
@Prop() supportedLanguages?: Language[];
|
|
38
38
|
@Prop() marginType?: MarginType;
|
|
39
39
|
@Prop() maxWidth?: number;
|
|
@@ -47,12 +47,12 @@ class LocalizedUrlInputComponent extends TsxComponent<LocalizedUrlInputArgs> imp
|
|
|
47
47
|
@Prop() prependIcon: string;
|
|
48
48
|
@Prop() appendClicked: () => void;
|
|
49
49
|
@Prop() prependClicked: () => void;
|
|
50
|
-
currentValue:
|
|
50
|
+
currentValue: ILocalizedText = null;
|
|
51
51
|
modalWillShow: boolean = false;
|
|
52
52
|
isModal: boolean = false;
|
|
53
53
|
uuid: string = "lsw-" + PortalUtils.randomString(10);
|
|
54
54
|
|
|
55
|
-
raiseChangeEvent (newValue:
|
|
55
|
+
raiseChangeEvent (newValue: ILocalizedText): void {
|
|
56
56
|
this.populateValidationDeclaration();
|
|
57
57
|
|
|
58
58
|
if (this.changed != null) {
|
|
@@ -63,10 +63,10 @@ class LocalizedUrlInputComponent extends TsxComponent<LocalizedUrlInputArgs> imp
|
|
|
63
63
|
isAllSame(): boolean {
|
|
64
64
|
if (this.value != null) {
|
|
65
65
|
let langList = LanguageUtils.getLanguageList();
|
|
66
|
-
let skValue =
|
|
66
|
+
let skValue = LocalizedValueHelper.getValue(this.value, Language.sk);
|
|
67
67
|
|
|
68
68
|
for (let i = 0, len = langList.length; i < len; i++) {
|
|
69
|
-
if (
|
|
69
|
+
if (LocalizedValueHelper.getValue(this.value, langList[i].id) != skValue) {
|
|
70
70
|
return false;
|
|
71
71
|
}
|
|
72
72
|
}
|
|
@@ -76,7 +76,7 @@ class LocalizedUrlInputComponent extends TsxComponent<LocalizedUrlInputArgs> imp
|
|
|
76
76
|
}
|
|
77
77
|
|
|
78
78
|
hasSomeValue(): boolean {
|
|
79
|
-
return !isNullOrEmpty(
|
|
79
|
+
return !isNullOrEmpty(LocalizedValueHelper.getValue(this.value, Language.sk));
|
|
80
80
|
}
|
|
81
81
|
|
|
82
82
|
getModalContext(): JQuery {
|
|
@@ -133,7 +133,7 @@ class LocalizedUrlInputComponent extends TsxComponent<LocalizedUrlInputArgs> imp
|
|
|
133
133
|
|
|
134
134
|
if (currentVal == null || currentVal.length == 0) {
|
|
135
135
|
var language: Language = $this.attr("data-inv-lang") as any;
|
|
136
|
-
var lsValue =
|
|
136
|
+
var lsValue = LocalizedValueHelper.getValue(value, language) || "";
|
|
137
137
|
$this.attr("placeholder", lsValue);
|
|
138
138
|
}
|
|
139
139
|
});
|
|
@@ -207,7 +207,7 @@ class LocalizedUrlInputComponent extends TsxComponent<LocalizedUrlInputArgs> imp
|
|
|
207
207
|
}
|
|
208
208
|
|
|
209
209
|
renderInputGlobalValue(h) {
|
|
210
|
-
let langValue =
|
|
210
|
+
let langValue = LocalizedValueHelper.getValue(this.value, Language.sk);
|
|
211
211
|
return (
|
|
212
212
|
<FlexContainer cssClass={"mb-1"} fullWidthOnMobile={false}>
|
|
213
213
|
<FlexFormItem flexFill={true}>
|
|
@@ -255,7 +255,7 @@ class LocalizedUrlInputComponent extends TsxComponent<LocalizedUrlInputArgs> imp
|
|
|
255
255
|
|
|
256
256
|
let langValue = this.value[lang.id];
|
|
257
257
|
let hasValue = !isNullOrEmpty(langValue);
|
|
258
|
-
langValue = hasValue ? langValue :
|
|
258
|
+
langValue = hasValue ? langValue : LocalizedValueHelper.getValue(this.value, lang.id);
|
|
259
259
|
|
|
260
260
|
return (
|
|
261
261
|
<div class={"localized-input-item" + (hasValue ? "" : " lii-auto")}>
|
|
@@ -281,7 +281,7 @@ class LocalizedUrlInputComponent extends TsxComponent<LocalizedUrlInputArgs> imp
|
|
|
281
281
|
|
|
282
282
|
let langValue = this.currentValue[lang.id];
|
|
283
283
|
let hasValue = !isNullOrEmpty(langValue);
|
|
284
|
-
langValue = hasValue ? langValue :
|
|
284
|
+
langValue = hasValue ? langValue : LocalizedValueHelper.getValue(this.currentValue, lang.id);
|
|
285
285
|
|
|
286
286
|
return (
|
|
287
287
|
<FlexContainer cssClass={"mb-1"} fullWidthOnMobile={false}>
|
|
@@ -25,5 +25,5 @@ class ModalAnimationErrorComponent extends TsxComponent<ModalAnimationErrorArgs>
|
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
const ModalAnimationError = toNative(ModalAnimationErrorComponent)
|
|
28
|
+
const ModalAnimationError = toNative(ModalAnimationErrorComponent)
|
|
29
29
|
export default ModalAnimationError
|
|
@@ -27,5 +27,5 @@ class ModalAnimationSuccessComponent extends TsxComponent<ModalAnimationSuccessA
|
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
const ModalAnimationSuccess = toNative(ModalAnimationSuccessComponent)
|
|
30
|
+
const ModalAnimationSuccess = toNative(ModalAnimationSuccessComponent)
|
|
31
31
|
export default ModalAnimationSuccess
|
|
@@ -61,5 +61,5 @@ class ModalSectionWrapperComponent extends TsxComponent<ModalSectionWrapperArgs>
|
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
-
const ModalSectionWrapper = toNative(ModalSectionWrapperComponent)
|
|
64
|
+
const ModalSectionWrapper = toNative(ModalSectionWrapperComponent)
|
|
65
65
|
export default ModalSectionWrapper
|
package/package.json
CHANGED
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
import { Language } from "../enums/language";
|
|
2
|
-
import LocalizedText from "../localized-text";
|
|
3
|
-
import { isNullOrEmpty } from "./is-null-or-empty";
|
|
4
|
-
import { LanguageUtils } from "./language-utils";
|
|
5
|
-
|
|
6
|
-
export interface ILocalizedString {
|
|
7
|
-
Slovak: string;
|
|
8
|
-
English: string;
|
|
9
|
-
Czech: string;
|
|
10
|
-
German: string;
|
|
11
|
-
Latvian: string;
|
|
12
|
-
Polish: string;
|
|
13
|
-
Italian: string;
|
|
14
|
-
Hungarian: string;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
function getValueForPair(localizedString: any, langCode: string, lang: Language): string {
|
|
18
|
-
return localizedString[langCode] || localizedString[lang];
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export default class LocalizedStringHelper {
|
|
22
|
-
static getValue(value: ILocalizedString | LocalizedText, lang: Language | string) {
|
|
23
|
-
if (value == null) {
|
|
24
|
-
return null;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
if (lang == Language.sk) {
|
|
28
|
-
const skVal = getValueForPair(value, 'sk', Language.sk);
|
|
29
|
-
if (!isNullOrEmpty(skVal)) {
|
|
30
|
-
return skVal;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
const csVal = getValueForPair(value, 'cs', Language.cs);
|
|
34
|
-
if (!isNullOrEmpty(csVal)) {
|
|
35
|
-
return csVal;
|
|
36
|
-
}
|
|
37
|
-
} else if (lang == Language.cs) {
|
|
38
|
-
const csVal = getValueForPair(value, 'cs', Language.cs);
|
|
39
|
-
if (!isNullOrEmpty(csVal)) {
|
|
40
|
-
return csVal;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
const skVal = getValueForPair(value, 'sk', Language.sk);
|
|
44
|
-
if (!isNullOrEmpty(skVal)) {
|
|
45
|
-
return skVal;
|
|
46
|
-
}
|
|
47
|
-
} else if (lang == Language.de) {
|
|
48
|
-
const val = getValueForPair(value, 'de', Language.de);
|
|
49
|
-
if (!isNullOrEmpty(val)) {
|
|
50
|
-
return val;
|
|
51
|
-
}
|
|
52
|
-
} else if (lang == Language.pl) {
|
|
53
|
-
const val = getValueForPair(value, 'pl', Language.pl);
|
|
54
|
-
if (!isNullOrEmpty(val)) {
|
|
55
|
-
return val;
|
|
56
|
-
}
|
|
57
|
-
} else if (lang == Language.it) {
|
|
58
|
-
const val = getValueForPair(value, 'it', Language.it);
|
|
59
|
-
if (!isNullOrEmpty(val)) {
|
|
60
|
-
return val;
|
|
61
|
-
}
|
|
62
|
-
} else if (lang == Language.hu) {
|
|
63
|
-
const val = getValueForPair(value, 'hu', Language.hu);
|
|
64
|
-
if (!isNullOrEmpty(val)) {
|
|
65
|
-
return val;
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
const lastTry = getValueForPair(value, 'sk', Language.sk);
|
|
70
|
-
if (!isNullOrEmpty(lastTry)) {
|
|
71
|
-
return lastTry;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
for (const propName in value) {
|
|
75
|
-
const text = (value as any)[propName];
|
|
76
|
-
if (text != null && text.toString().length > 0) {
|
|
77
|
-
return text;
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
return null;
|
|
82
|
-
}
|
|
83
|
-
}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import LocalizedText from './../localized-text';
|
|
2
|
-
import { Language } from './../enums/language';
|
|
3
|
-
|
|
4
|
-
export default class LocalizedTextUtil {
|
|
5
|
-
static getLocalizedTextValue(value: LocalizedText, langKey: string | Language): string {
|
|
6
|
-
if (value == null) {
|
|
7
|
-
return null as any;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
let retVal = (value as any)[langKey];
|
|
11
|
-
if (retVal == null) {
|
|
12
|
-
if (langKey == "sk") {
|
|
13
|
-
retVal = value.cs;
|
|
14
|
-
} else if (langKey == "cs") {
|
|
15
|
-
retVal = value.sk;
|
|
16
|
-
} else {
|
|
17
|
-
retVal = value.en;
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
if (retVal == null) {
|
|
22
|
-
if (value.sk != null) {
|
|
23
|
-
return value.sk;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
for (const propName in value) {
|
|
27
|
-
const text = (value as any)[propName];
|
|
28
|
-
if (text != null && text.toString().length > 0) {
|
|
29
|
-
return text;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
return retVal || value.sk;
|
|
35
|
-
}
|
|
36
|
-
}
|