@sap-ux/ui-components 1.3.0 → 1.3.1
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/dist/components/UITranslationInput/UITranslationButton.d.ts +3 -13
- package/dist/components/UITranslationInput/UITranslationButton.d.ts.map +1 -1
- package/dist/components/UITranslationInput/UITranslationButton.js +5 -101
- package/dist/components/UITranslationInput/UITranslationButton.js.map +1 -1
- package/dist/components/UITranslationInput/UITranslationButton.types.d.ts +21 -8
- package/dist/components/UITranslationInput/UITranslationButton.types.d.ts.map +1 -1
- package/dist/components/UITranslationInput/UITranslationButton.types.js +7 -1
- package/dist/components/UITranslationInput/UITranslationButton.types.js.map +1 -1
- package/dist/components/UITranslationInput/UITranslationInput.d.ts +13 -1
- package/dist/components/UITranslationInput/UITranslationInput.d.ts.map +1 -1
- package/dist/components/UITranslationInput/UITranslationInput.js +106 -2
- package/dist/components/UITranslationInput/UITranslationInput.js.map +1 -1
- package/dist/components/UITranslationInput/defaults.d.ts +2 -2
- package/dist/components/UITranslationInput/defaults.d.ts.map +1 -1
- package/dist/components/UITranslationInput/defaults.js +5 -4
- package/dist/components/UITranslationInput/defaults.js.map +1 -1
- package/package.json +1 -1
- package/storybook/iframe.html +1 -1
- package/storybook/{main.5b8f5833.iframe.bundle.js → main.5b3dd4b6.iframe.bundle.js} +10 -9
- package/storybook/project.json +1 -1
|
@@ -1,13 +1,9 @@
|
|
|
1
1
|
import type { ReactElement } from 'react';
|
|
2
|
-
import type { UITranslationProps,
|
|
2
|
+
import type { UITranslationProps, TranslationSuggest } from './UITranslationButton.types';
|
|
3
3
|
import './UITranslationInput.scss';
|
|
4
|
-
export
|
|
5
|
-
Existing = "Existing",
|
|
6
|
-
Update = "Update",
|
|
7
|
-
New = "New"
|
|
8
|
-
}
|
|
9
|
-
interface UITranslationButtonProps extends UITranslationProps {
|
|
4
|
+
export interface UITranslationButtonProps extends UITranslationProps {
|
|
10
5
|
onUpdateValue?: (value: string) => void;
|
|
6
|
+
suggestion: TranslationSuggest;
|
|
11
7
|
}
|
|
12
8
|
/**
|
|
13
9
|
* Component to render translation button to provide helper callout with i18n generation option.
|
|
@@ -16,10 +12,4 @@ interface UITranslationButtonProps extends UITranslationProps {
|
|
|
16
12
|
* @returns Component to render translation button with callout.
|
|
17
13
|
*/
|
|
18
14
|
export declare function UITranslationButton(props: UITranslationButtonProps): ReactElement;
|
|
19
|
-
export declare namespace UITranslationButton {
|
|
20
|
-
var defaultProps: {
|
|
21
|
-
strings: TranslationButtonStrings;
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
|
-
export {};
|
|
25
15
|
//# sourceMappingURL=UITranslationButton.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UITranslationButton.d.ts","sourceRoot":"","sources":["../../../src/components/UITranslationInput/UITranslationButton.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"UITranslationButton.d.ts","sourceRoot":"","sources":["../../../src/components/UITranslationInput/UITranslationButton.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAI1C,OAAO,KAAK,EAAE,kBAAkB,EAA2B,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AAInH,OAAO,2BAA2B,CAAC;AAEnC,MAAM,WAAW,wBAAyB,SAAQ,kBAAkB;IAChE,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC,UAAU,EAAE,kBAAkB,CAAC;CAClC;AAcD;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,wBAAwB,GAAG,YAAY,CAoEjF"}
|
|
@@ -19,23 +19,14 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
19
19
|
return result;
|
|
20
20
|
};
|
|
21
21
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
-
exports.UITranslationButton =
|
|
22
|
+
exports.UITranslationButton = void 0;
|
|
23
23
|
const react_1 = __importStar(require("react"));
|
|
24
24
|
const UIButton_1 = require("../UIButton");
|
|
25
25
|
const UICallout_1 = require("../UICallout");
|
|
26
26
|
const Icons_1 = require("../Icons");
|
|
27
|
-
const defaults_1 = require("./defaults");
|
|
28
27
|
const UITranslationButton_types_1 = require("./UITranslationButton.types");
|
|
29
|
-
const UITranslationUtils_1 = require("./UITranslationUtils");
|
|
30
|
-
require("./UITranslationInput.scss");
|
|
31
|
-
const UIFormattedText_1 = require("./UIFormattedText");
|
|
32
28
|
const UILoadButton_1 = require("./UILoadButton");
|
|
33
|
-
|
|
34
|
-
(function (SuggestValueType) {
|
|
35
|
-
SuggestValueType["Existing"] = "Existing";
|
|
36
|
-
SuggestValueType["Update"] = "Update";
|
|
37
|
-
SuggestValueType["New"] = "New";
|
|
38
|
-
})(SuggestValueType = exports.SuggestValueType || (exports.SuggestValueType = {}));
|
|
29
|
+
require("./UITranslationInput.scss");
|
|
39
30
|
/**
|
|
40
31
|
* Method to resolve button component text strings for passed key.
|
|
41
32
|
* Component has default texts which can be overwritten using property `strings`.
|
|
@@ -47,89 +38,6 @@ var SuggestValueType;
|
|
|
47
38
|
const getStringText = (property, strings) => {
|
|
48
39
|
return strings?.[property] || '';
|
|
49
40
|
};
|
|
50
|
-
/**
|
|
51
|
-
* Method returns suggestion object with message and tooltip based on passed translation button props.
|
|
52
|
-
*
|
|
53
|
-
* @param props Properties of translation button component.
|
|
54
|
-
* @returns Translation suggestion object.
|
|
55
|
-
*/
|
|
56
|
-
const getTranslationSuggestion = (props) => {
|
|
57
|
-
const { value = '', allowedPatterns, entries, strings = defaults_1.defaultTranslationButtonStrings, namingConvention = UITranslationButton_types_1.TranslationKeyGenerator.CamelCase, defaultPattern, i18nPrefix, allowedI18nPrefixes } = props;
|
|
58
|
-
const i18nKey = UITranslationUtils_1.extractI18nKey(value, allowedPatterns, allowedI18nPrefixes || [i18nPrefix]);
|
|
59
|
-
let message = '';
|
|
60
|
-
let tooltip = '';
|
|
61
|
-
let suggest;
|
|
62
|
-
if (i18nKey) {
|
|
63
|
-
// There is already i18n binding as value
|
|
64
|
-
const entry = UITranslationUtils_1.getTranslationByKey(entries, i18nKey);
|
|
65
|
-
if (entry) {
|
|
66
|
-
tooltip = strings.i18nEntryExistsTooltip;
|
|
67
|
-
suggest = {
|
|
68
|
-
entry,
|
|
69
|
-
type: SuggestValueType.Existing,
|
|
70
|
-
icon: Icons_1.UiIcons.WorldArrow
|
|
71
|
-
};
|
|
72
|
-
}
|
|
73
|
-
else {
|
|
74
|
-
message = strings.i18nKeyMissingDescription;
|
|
75
|
-
tooltip = strings.i18nKeyMissingTooltip;
|
|
76
|
-
suggest = {
|
|
77
|
-
entry: {
|
|
78
|
-
key: {
|
|
79
|
-
value: i18nKey
|
|
80
|
-
},
|
|
81
|
-
value: {
|
|
82
|
-
value: i18nKey
|
|
83
|
-
}
|
|
84
|
-
},
|
|
85
|
-
type: SuggestValueType.New,
|
|
86
|
-
icon: Icons_1.UiIcons.WorldWarning
|
|
87
|
-
};
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
else {
|
|
91
|
-
// Use generation format passed from outside or use default as 'Standard';
|
|
92
|
-
const existingEntry = UITranslationUtils_1.getTranslationByText(entries, value);
|
|
93
|
-
if (existingEntry) {
|
|
94
|
-
message = strings.i18nReplaceWithExistingDescription;
|
|
95
|
-
tooltip = strings.i18nReplaceWithExistingTooltip;
|
|
96
|
-
suggest = {
|
|
97
|
-
entry: existingEntry,
|
|
98
|
-
type: SuggestValueType.Update
|
|
99
|
-
};
|
|
100
|
-
}
|
|
101
|
-
else {
|
|
102
|
-
message = strings.i18nValueMissingDescription;
|
|
103
|
-
tooltip = strings.i18nValueMissingTooltip;
|
|
104
|
-
const key = UITranslationUtils_1.generateI18nKey(value, namingConvention, entries);
|
|
105
|
-
suggest = {
|
|
106
|
-
entry: {
|
|
107
|
-
key: {
|
|
108
|
-
value: key
|
|
109
|
-
},
|
|
110
|
-
value: {
|
|
111
|
-
value
|
|
112
|
-
}
|
|
113
|
-
},
|
|
114
|
-
type: SuggestValueType.New
|
|
115
|
-
};
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
// I18n string to apply for input value
|
|
119
|
-
suggest.i18n = UITranslationUtils_1.applyI18nPattern(suggest.entry.key.value, defaultPattern, i18nPrefix);
|
|
120
|
-
// Format message to show in callout
|
|
121
|
-
const messageValues = {
|
|
122
|
-
key: suggest.entry.key.value,
|
|
123
|
-
value: suggest.entry.value.value,
|
|
124
|
-
i18n: suggest.i18n
|
|
125
|
-
};
|
|
126
|
-
tooltip = UIFormattedText_1.formatText(tooltip, messageValues);
|
|
127
|
-
return {
|
|
128
|
-
message: react_1.default.createElement(UIFormattedText_1.UIFormattedText, { values: messageValues }, message),
|
|
129
|
-
tooltip,
|
|
130
|
-
suggest
|
|
131
|
-
};
|
|
132
|
-
};
|
|
133
41
|
/**
|
|
134
42
|
* Component to render translation button to provide helper callout with i18n generation option.
|
|
135
43
|
*
|
|
@@ -137,12 +45,11 @@ const getTranslationSuggestion = (props) => {
|
|
|
137
45
|
* @returns Component to render translation button with callout.
|
|
138
46
|
*/
|
|
139
47
|
function UITranslationButton(props) {
|
|
140
|
-
const { id, strings, value, onCreateNewEntry, onUpdateValue, onShowExistingEntry, busy } = props;
|
|
48
|
+
const { id, strings, value, onCreateNewEntry, onUpdateValue, onShowExistingEntry, busy, suggestion } = props;
|
|
141
49
|
const [isCalloutVisible, setCalloutVisible] = react_1.useState(false);
|
|
142
|
-
const suggestion = getTranslationSuggestion(props);
|
|
143
50
|
// Callbacks
|
|
144
51
|
const onToggleCallout = react_1.useCallback(() => {
|
|
145
|
-
if (suggestion.suggest?.type === SuggestValueType.Existing) {
|
|
52
|
+
if (suggestion.suggest?.type === UITranslationButton_types_1.SuggestValueType.Existing) {
|
|
146
53
|
setCalloutVisible(false);
|
|
147
54
|
// Trigger show existing entry callbACK
|
|
148
55
|
onShowExistingEntry?.(suggestion.suggest.entry);
|
|
@@ -153,7 +60,7 @@ function UITranslationButton(props) {
|
|
|
153
60
|
}, [isCalloutVisible, suggestion]);
|
|
154
61
|
const onAccept = react_1.useCallback(() => {
|
|
155
62
|
if (suggestion.suggest) {
|
|
156
|
-
if (suggestion.suggest.type === SuggestValueType.New) {
|
|
63
|
+
if (suggestion.suggest.type === UITranslationButton_types_1.SuggestValueType.New) {
|
|
157
64
|
onCreateNewEntry?.(suggestion.suggest.entry);
|
|
158
65
|
}
|
|
159
66
|
if (value !== suggestion.suggest.i18n) {
|
|
@@ -175,7 +82,4 @@ function UITranslationButton(props) {
|
|
|
175
82
|
react_1.default.createElement(UIButton_1.UIDefaultButton, { id: `${id}-button-action-cancel`, onClick: onCancel }, getStringText('cancelButtonLabel', strings))))))));
|
|
176
83
|
}
|
|
177
84
|
exports.UITranslationButton = UITranslationButton;
|
|
178
|
-
UITranslationButton.defaultProps = {
|
|
179
|
-
strings: defaults_1.defaultTranslationButtonStrings
|
|
180
|
-
};
|
|
181
85
|
//# sourceMappingURL=UITranslationButton.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UITranslationButton.js","sourceRoot":"","sources":["../../../src/components/UITranslationInput/UITranslationButton.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,+CAAqD;AAErD,0CAA8C;AAC9C,4CAAkE;AAClE,oCAAmC;
|
|
1
|
+
{"version":3,"file":"UITranslationButton.js","sourceRoot":"","sources":["../../../src/components/UITranslationInput/UITranslationButton.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,+CAAqD;AAErD,0CAA8C;AAC9C,4CAAkE;AAClE,oCAAmC;AAEnC,2EAA+D;AAC/D,iDAA8C;AAE9C,qCAAmC;AAOnC;;;;;;;GAOG;AACH,MAAM,aAAa,GAAG,CAAC,QAAuC,EAAE,OAAiC,EAAU,EAAE;IACzG,OAAO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AE,OAAO,CAAC,CAC9B,CAChB,CACJ,CACE,CACf,CACC,CACT,CAAC;AACN,CAAC;AApED,kDAoEC"}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { UiIcons } from '../Icons';
|
|
3
|
+
export interface TranslationInputStrings {
|
|
2
4
|
acceptButtonLabel: string;
|
|
3
5
|
cancelButtonLabel: string;
|
|
4
6
|
i18nEntryExistsTooltip: string;
|
|
@@ -8,6 +10,7 @@ export interface TranslationButtonStrings {
|
|
|
8
10
|
i18nValueMissingDescription: string;
|
|
9
11
|
i18nReplaceWithExistingTooltip: string;
|
|
10
12
|
i18nReplaceWithExistingDescription: string;
|
|
13
|
+
i18nEntryExistsInputTooltip: string;
|
|
11
14
|
}
|
|
12
15
|
export declare enum TranslationKeyGenerator {
|
|
13
16
|
CamelCase = "CamelCase",
|
|
@@ -29,19 +32,29 @@ export interface UITranslationProps {
|
|
|
29
32
|
value?: string;
|
|
30
33
|
id: string;
|
|
31
34
|
disabled?: boolean;
|
|
32
|
-
entries: I18nBundle;
|
|
33
35
|
onShowExistingEntry?: (entry: TranslationEntry) => void;
|
|
34
36
|
onCreateNewEntry?: (entry: TranslationEntry) => void;
|
|
35
|
-
namingConvention?: TranslationKeyGenerator;
|
|
36
37
|
busy?: UILoadButtonBusyProps;
|
|
37
|
-
|
|
38
|
-
allowedI18nPrefixes?: string[];
|
|
39
|
-
defaultPattern: TranslationTextPattern;
|
|
40
|
-
allowedPatterns: TranslationTextPattern[];
|
|
41
|
-
strings?: TranslationButtonStrings;
|
|
38
|
+
strings?: TranslationInputStrings;
|
|
42
39
|
}
|
|
43
40
|
export interface UILoadButtonBusyProps {
|
|
44
41
|
busy?: boolean;
|
|
45
42
|
useMinWaitingTime?: boolean | number;
|
|
46
43
|
}
|
|
44
|
+
export declare enum SuggestValueType {
|
|
45
|
+
Existing = "Existing",
|
|
46
|
+
Update = "Update",
|
|
47
|
+
New = "New"
|
|
48
|
+
}
|
|
49
|
+
export interface TranslationSuggestValue {
|
|
50
|
+
entry: TranslationEntry;
|
|
51
|
+
icon?: UiIcons;
|
|
52
|
+
type: SuggestValueType;
|
|
53
|
+
i18n?: string;
|
|
54
|
+
}
|
|
55
|
+
export interface TranslationSuggest {
|
|
56
|
+
tooltip: string;
|
|
57
|
+
message?: React.ReactElement;
|
|
58
|
+
suggest?: TranslationSuggestValue;
|
|
59
|
+
}
|
|
47
60
|
//# sourceMappingURL=UITranslationButton.types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UITranslationButton.types.d.ts","sourceRoot":"","sources":["../../../src/components/UITranslationInput/UITranslationButton.types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,
|
|
1
|
+
{"version":3,"file":"UITranslationButton.types.d.ts","sourceRoot":"","sources":["../../../src/components/UITranslationInput/UITranslationButton.types.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAExC,MAAM,WAAW,uBAAuB;IACpC,iBAAiB,EAAE,MAAM,CAAC;IAC1B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,sBAAsB,EAAE,MAAM,CAAC;IAC/B,qBAAqB,EAAE,MAAM,CAAC;IAC9B,yBAAyB,EAAE,MAAM,CAAC;IAClC,uBAAuB,EAAE,MAAM,CAAC;IAChC,2BAA2B,EAAE,MAAM,CAAC;IACpC,8BAA8B,EAAE,MAAM,CAAC;IACvC,kCAAkC,EAAE,MAAM,CAAC;IAC3C,2BAA2B,EAAE,MAAM,CAAC;CACvC;AAED,oBAAY,uBAAuB;IAC/B,SAAS,cAAc;IACvB,UAAU,eAAe;CAC5B;AAED,oBAAY,sBAAsB;IAE9B,oBAAoB,yBAAyB;IAE7C,oBAAoB,yBAAyB;CAChD;AAED,MAAM,WAAW,qBAAqB;IAClC,KAAK,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,gBAAgB;IAC7B,GAAG,EAAE,qBAAqB,CAAC;IAC3B,KAAK,EAAE,qBAAqB,CAAC;CAChC;AAED,oBAAY,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,gBAAgB,EAAE,CAAC,CAAC;AAE5D,MAAM,WAAW,kBAAkB;IAC/B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB,mBAAmB,CAAC,EAAE,CAAC,KAAK,EAAE,gBAAgB,KAAK,IAAI,CAAC;IAExD,gBAAgB,CAAC,EAAE,CAAC,KAAK,EAAE,gBAAgB,KAAK,IAAI,CAAC;IAErD,IAAI,CAAC,EAAE,qBAAqB,CAAC;IAE7B,OAAO,CAAC,EAAE,uBAAuB,CAAC;CACrC;AAED,MAAM,WAAW,qBAAqB;IAClC,IAAI,CAAC,EAAE,OAAO,CAAC;IAEf,iBAAiB,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;CACxC;AAED,oBAAY,gBAAgB;IACxB,QAAQ,aAAa;IACrB,MAAM,WAAW;IACjB,GAAG,QAAQ;CACd;AAED,MAAM,WAAW,uBAAuB;IACpC,KAAK,EAAE,gBAAgB,CAAC;IACxB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,IAAI,EAAE,gBAAgB,CAAC;IACvB,IAAI,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,kBAAkB;IAC/B,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,KAAK,CAAC,YAAY,CAAC;IAC7B,OAAO,CAAC,EAAE,uBAAuB,CAAC;CACrC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.TranslationTextPattern = exports.TranslationKeyGenerator = void 0;
|
|
3
|
+
exports.SuggestValueType = exports.TranslationTextPattern = exports.TranslationKeyGenerator = void 0;
|
|
4
4
|
var TranslationKeyGenerator;
|
|
5
5
|
(function (TranslationKeyGenerator) {
|
|
6
6
|
TranslationKeyGenerator["CamelCase"] = "CamelCase";
|
|
@@ -13,4 +13,10 @@ var TranslationTextPattern;
|
|
|
13
13
|
// Pattern `{key>}`
|
|
14
14
|
TranslationTextPattern["SingleBracketBinding"] = "SingleBracketBinding";
|
|
15
15
|
})(TranslationTextPattern = exports.TranslationTextPattern || (exports.TranslationTextPattern = {}));
|
|
16
|
+
var SuggestValueType;
|
|
17
|
+
(function (SuggestValueType) {
|
|
18
|
+
SuggestValueType["Existing"] = "Existing";
|
|
19
|
+
SuggestValueType["Update"] = "Update";
|
|
20
|
+
SuggestValueType["New"] = "New";
|
|
21
|
+
})(SuggestValueType = exports.SuggestValueType || (exports.SuggestValueType = {}));
|
|
16
22
|
//# sourceMappingURL=UITranslationButton.types.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UITranslationButton.types.js","sourceRoot":"","sources":["../../../src/components/UITranslationInput/UITranslationButton.types.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"UITranslationButton.types.js","sourceRoot":"","sources":["../../../src/components/UITranslationInput/UITranslationButton.types.ts"],"names":[],"mappings":";;;AAeA,IAAY,uBAGX;AAHD,WAAY,uBAAuB;IAC/B,kDAAuB,CAAA;IACvB,oDAAyB,CAAA;AAC7B,CAAC,EAHW,uBAAuB,GAAvB,+BAAuB,KAAvB,+BAAuB,QAGlC;AAED,IAAY,sBAKX;AALD,WAAY,sBAAsB;IAC9B,iBAAiB;IACjB,uEAA6C,CAAA;IAC7C,mBAAmB;IACnB,uEAA6C,CAAA;AACjD,CAAC,EALW,sBAAsB,GAAtB,8BAAsB,KAAtB,8BAAsB,QAKjC;AAiCD,IAAY,gBAIX;AAJD,WAAY,gBAAgB;IACxB,yCAAqB,CAAA;IACrB,qCAAiB,CAAA;IACjB,+BAAW,CAAA;AACf,CAAC,EAJW,gBAAgB,GAAhB,wBAAgB,KAAhB,wBAAgB,QAI3B"}
|
|
@@ -1,8 +1,15 @@
|
|
|
1
1
|
import type { ReactElement } from 'react';
|
|
2
2
|
import type { ITextFieldProps } from '../UIInput';
|
|
3
|
-
import type { UITranslationProps } from './UITranslationButton.types';
|
|
3
|
+
import type { UITranslationProps, I18nBundle, TranslationTextPattern } from './UITranslationButton.types';
|
|
4
|
+
import { TranslationKeyGenerator } from './UITranslationButton.types';
|
|
4
5
|
export interface UITranslationInputProps extends ITextFieldProps, UITranslationProps {
|
|
5
6
|
id: string;
|
|
7
|
+
entries: I18nBundle;
|
|
8
|
+
namingConvention?: TranslationKeyGenerator;
|
|
9
|
+
i18nPrefix: string;
|
|
10
|
+
allowedI18nPrefixes?: string[];
|
|
11
|
+
defaultPattern: TranslationTextPattern;
|
|
12
|
+
allowedPatterns: TranslationTextPattern[];
|
|
6
13
|
}
|
|
7
14
|
/**
|
|
8
15
|
* Component to render translation input with button to provide helper callout with i18n generation option.
|
|
@@ -11,4 +18,9 @@ export interface UITranslationInputProps extends ITextFieldProps, UITranslationP
|
|
|
11
18
|
* @returns Component to render translation input.
|
|
12
19
|
*/
|
|
13
20
|
export declare function UITranslationInput(props: UITranslationInputProps): ReactElement;
|
|
21
|
+
export declare namespace UITranslationInput {
|
|
22
|
+
var defaultProps: {
|
|
23
|
+
strings: import("./UITranslationButton.types").TranslationInputStrings;
|
|
24
|
+
};
|
|
25
|
+
}
|
|
14
26
|
//# sourceMappingURL=UITranslationInput.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UITranslationInput.d.ts","sourceRoot":"","sources":["../../../src/components/UITranslationInput/UITranslationInput.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAE1C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"UITranslationInput.d.ts","sourceRoot":"","sources":["../../../src/components/UITranslationInput/UITranslationInput.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAE1C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAGlD,OAAO,KAAK,EACR,kBAAkB,EAGlB,UAAU,EACV,sBAAsB,EACzB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,uBAAuB,EAAoB,MAAM,6BAA6B,CAAC;AAWxF,MAAM,WAAW,uBAAwB,SAAQ,eAAe,EAAE,kBAAkB;IAChF,EAAE,EAAE,MAAM,CAAC;IAEX,OAAO,EAAE,UAAU,CAAC;IAGpB,gBAAgB,CAAC,EAAE,uBAAuB,CAAC;IAE3C,UAAU,EAAE,MAAM,CAAC;IAEnB,mBAAmB,CAAC,EAAE,MAAM,EAAE,CAAC;IAE/B,cAAc,EAAE,sBAAsB,CAAC;IAEvC,eAAe,EAAE,sBAAsB,EAAE,CAAC;CAC7C;AA4FD;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,uBAAuB,GAAG,YAAY,CAmF/E;yBAnFe,kBAAkB"}
|
|
@@ -22,7 +22,95 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
22
22
|
exports.UITranslationInput = void 0;
|
|
23
23
|
const react_1 = __importStar(require("react"));
|
|
24
24
|
const UIInput_1 = require("../UIInput");
|
|
25
|
+
const Icons_1 = require("../Icons");
|
|
25
26
|
const UITranslationButton_1 = require("./UITranslationButton");
|
|
27
|
+
const UITranslationButton_types_1 = require("./UITranslationButton.types");
|
|
28
|
+
const UITranslationUtils_1 = require("./UITranslationUtils");
|
|
29
|
+
const defaults_1 = require("./defaults");
|
|
30
|
+
const UIFormattedText_1 = require("./UIFormattedText");
|
|
31
|
+
/**
|
|
32
|
+
* Method returns suggestion object with message and tooltip based on passed translation button props.
|
|
33
|
+
*
|
|
34
|
+
* @param props Properties of translation input component.
|
|
35
|
+
* @returns Translation suggestion object.
|
|
36
|
+
*/
|
|
37
|
+
const getTranslationSuggestion = (props) => {
|
|
38
|
+
const { value = '', allowedPatterns, entries, strings = defaults_1.defaultTranslationInputStrings, namingConvention = UITranslationButton_types_1.TranslationKeyGenerator.CamelCase, defaultPattern, i18nPrefix, allowedI18nPrefixes } = props;
|
|
39
|
+
const i18nKey = UITranslationUtils_1.extractI18nKey(value, allowedPatterns, allowedI18nPrefixes || [i18nPrefix]);
|
|
40
|
+
let message = '';
|
|
41
|
+
let tooltip = '';
|
|
42
|
+
let suggest;
|
|
43
|
+
if (i18nKey) {
|
|
44
|
+
// There is already i18n binding as value
|
|
45
|
+
const entry = UITranslationUtils_1.getTranslationByKey(entries, i18nKey);
|
|
46
|
+
if (entry) {
|
|
47
|
+
tooltip = strings.i18nEntryExistsTooltip;
|
|
48
|
+
suggest = {
|
|
49
|
+
entry,
|
|
50
|
+
type: UITranslationButton_types_1.SuggestValueType.Existing,
|
|
51
|
+
icon: Icons_1.UiIcons.WorldArrow
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
message = strings.i18nKeyMissingDescription;
|
|
56
|
+
tooltip = strings.i18nKeyMissingTooltip;
|
|
57
|
+
suggest = {
|
|
58
|
+
entry: {
|
|
59
|
+
key: {
|
|
60
|
+
value: i18nKey
|
|
61
|
+
},
|
|
62
|
+
value: {
|
|
63
|
+
value: i18nKey
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
type: UITranslationButton_types_1.SuggestValueType.New,
|
|
67
|
+
icon: Icons_1.UiIcons.WorldWarning
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
// Use generation format passed from outside or use default as 'Standard';
|
|
73
|
+
const existingEntry = UITranslationUtils_1.getTranslationByText(entries, value);
|
|
74
|
+
if (existingEntry) {
|
|
75
|
+
message = strings.i18nReplaceWithExistingDescription;
|
|
76
|
+
tooltip = strings.i18nReplaceWithExistingTooltip;
|
|
77
|
+
suggest = {
|
|
78
|
+
entry: existingEntry,
|
|
79
|
+
type: UITranslationButton_types_1.SuggestValueType.Update
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
else {
|
|
83
|
+
message = strings.i18nValueMissingDescription;
|
|
84
|
+
tooltip = strings.i18nValueMissingTooltip;
|
|
85
|
+
const key = UITranslationUtils_1.generateI18nKey(value, namingConvention, entries);
|
|
86
|
+
suggest = {
|
|
87
|
+
entry: {
|
|
88
|
+
key: {
|
|
89
|
+
value: key
|
|
90
|
+
},
|
|
91
|
+
value: {
|
|
92
|
+
value
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
type: UITranslationButton_types_1.SuggestValueType.New
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
// I18n string to apply for input value
|
|
100
|
+
suggest.i18n = UITranslationUtils_1.applyI18nPattern(suggest.entry.key.value, defaultPattern, i18nPrefix);
|
|
101
|
+
// Format message to show in callout
|
|
102
|
+
const messageValues = {
|
|
103
|
+
key: suggest.entry.key.value,
|
|
104
|
+
value: suggest.entry.value.value,
|
|
105
|
+
i18n: suggest.i18n
|
|
106
|
+
};
|
|
107
|
+
tooltip = UIFormattedText_1.formatText(tooltip, messageValues);
|
|
108
|
+
return {
|
|
109
|
+
message: react_1.default.createElement(UIFormattedText_1.UIFormattedText, { values: messageValues }, message),
|
|
110
|
+
tooltip,
|
|
111
|
+
suggest
|
|
112
|
+
};
|
|
113
|
+
};
|
|
26
114
|
/**
|
|
27
115
|
* Component to render translation input with button to provide helper callout with i18n generation option.
|
|
28
116
|
*
|
|
@@ -30,7 +118,8 @@ const UITranslationButton_1 = require("./UITranslationButton");
|
|
|
30
118
|
* @returns Component to render translation input.
|
|
31
119
|
*/
|
|
32
120
|
function UITranslationInput(props) {
|
|
33
|
-
const {
|
|
121
|
+
const { id, className, onChange, value, allowedPatterns, defaultPattern, entries, busy, i18nPrefix, allowedI18nPrefixes, namingConvention, onCreateNewEntry, onShowExistingEntry, disabled, strings } = props;
|
|
122
|
+
const suggestion = getTranslationSuggestion(props);
|
|
34
123
|
let classNames = ' ui-translatable__input';
|
|
35
124
|
// Custom external classes
|
|
36
125
|
if (className) {
|
|
@@ -39,8 +128,20 @@ function UITranslationInput(props) {
|
|
|
39
128
|
const onUpdateValue = react_1.useCallback((newValue) => {
|
|
40
129
|
onChange?.({}, newValue);
|
|
41
130
|
}, [onChange]);
|
|
131
|
+
// Generate DOM id for i18n button
|
|
132
|
+
let buttonId = `${id}-i18n`;
|
|
133
|
+
let title = props.title;
|
|
134
|
+
if (suggestion.suggest?.type === UITranslationButton_types_1.SuggestValueType.Existing && strings?.i18nEntryExistsInputTooltip) {
|
|
135
|
+
// Change DOM id with additional suffix
|
|
136
|
+
buttonId += '-navigate';
|
|
137
|
+
// Overwrite title with information about reference entry
|
|
138
|
+
title = UIFormattedText_1.formatText(strings.i18nEntryExistsInputTooltip, {
|
|
139
|
+
value: value || '',
|
|
140
|
+
translation: suggestion.suggest.entry.value.value
|
|
141
|
+
});
|
|
142
|
+
}
|
|
42
143
|
const onRenderSuffix = react_1.useCallback(() => {
|
|
43
|
-
return (react_1.default.createElement(UITranslationButton_1.UITranslationButton, { id:
|
|
144
|
+
return (react_1.default.createElement(UITranslationButton_1.UITranslationButton, { id: buttonId, value: value, busy: busy, onCreateNewEntry: onCreateNewEntry, onShowExistingEntry: onShowExistingEntry, onUpdateValue: onUpdateValue, disabled: disabled, strings: strings, suggestion: suggestion }));
|
|
44
145
|
}, [
|
|
45
146
|
value,
|
|
46
147
|
allowedPatterns,
|
|
@@ -58,4 +159,7 @@ function UITranslationInput(props) {
|
|
|
58
159
|
return (react_1.default.createElement(UIInput_1.UITextInput, { ...props, title: title, onRenderSuffix: value?.trim() ? onRenderSuffix : undefined, className: classNames }));
|
|
59
160
|
}
|
|
60
161
|
exports.UITranslationInput = UITranslationInput;
|
|
162
|
+
UITranslationInput.defaultProps = {
|
|
163
|
+
strings: defaults_1.defaultTranslationInputStrings
|
|
164
|
+
};
|
|
61
165
|
//# sourceMappingURL=UITranslationInput.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UITranslationInput.js","sourceRoot":"","sources":["../../../src/components/UITranslationInput/UITranslationInput.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,+CAA2C;AAE3C,wCAAyC;AAEzC,+DAA4D;
|
|
1
|
+
{"version":3,"file":"UITranslationInput.js","sourceRoot":"","sources":["../../../src/components/UITranslationInput/UITranslationInput.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,+CAA2C;AAE3C,wCAAyC;AAEzC,oCAAmC;AACnC,+DAA4D;AAQ5D,2EAAwF;AACxF,6DAM8B;AAC9B,yCAA4D;AAC5D,uDAAgE;AAmBhE;;;;;GAKG;AACH,MAAM,wBAAwB,GAAG,CAAC,KAA8B,EAAsB,EAAE;IACpF,MAAM,EACF,KAAK,GAAG,EAAE,EACV,eAAe,EACf,OAAO,EACP,OAAO,GAAG,yCAA8B,EACxC,gBAAgB,GAAG,mDAAuB,CAAC,SAAS,EACpD,cAAc,EACd,UAAU,EACV,mBAAmB,EACtB,GAAG,KAAK,CAAC;IACV,MAAM,OAAO,GAAG,mCAAc,CAAC,KAAK,EAAE,eAAe,EAAE,mBAAmB,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC;IAC5F,IAAI,OAAO,GAAG,EAAE,CAAC;IACjB,IAAI,OAAO,GAAG,EAAE,CAAC;IACjB,IAAI,OAAgC,CAAC;IACrC,IAAI,OAAO,EAAE;QACT,yCAAyC;QACzC,MAAM,KAAK,GAAG,wCAAmB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QACpD,IAAI,KAAK,EAAE;YACP,OAAO,GAAG,OAAO,CAAC,sBAAsB,CAAC;YACzC,OAAO,GAAG;gBACN,KAAK;gBACL,IAAI,EAAE,4CAAgB,CAAC,QAAQ;gBAC/B,IAAI,EAAE,eAAO,CAAC,UAAU;aAC3B,CAAC;SACL;aA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AAU,CAAC,OAAO,CAAC,2BAA2B,EAAE;YACpD,KAAK,EAAE,KAAK,IAAI,EAAE;YAClB,WAAW,EAAE,UAAU,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK;SACpD,CAAC,CAAC;KACN;IAED,MAAM,cAAc,GAAG,mBAAW,CAAC,GAAuB,EAAE;QACxD,OAAO,CACH,8BAAC,yCAAmB,IAChB,EAAE,EAAE,QAAQ,EACZ,KAAK,EAAE,KAAK,EACZ,IAAI,EAAE,IAAI,EACV,gBAAgB,EAAE,gBAAgB,EAClC,mBAAmB,EAAE,mBAAmB,EACxC,aAAa,EAAE,aAAa,EAC5B,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,OAAO,EAChB,UAAU,EAAE,UAAU,GACxB,CACL,CAAC;IACN,CAAC,EAAE;QACC,KAAK;QACL,eAAe;QACf,cAAc;QACd,OAAO;QACP,IAAI;QACJ,QAAQ;QACR,UAAU;QACV,mBAAmB;QACnB,gBAAgB;QAChB,gBAAgB;QAChB,mBAAmB;QACnB,aAAa;KAChB,CAAC,CAAC;IAEH,OAAO,CACH,8BAAC,qBAAW,OACJ,KAAK,EACT,KAAK,EAAE,KAAK,EACZ,cAAc,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,SAAS,EAC1D,SAAS,EAAE,UAAU,GACvB,CACL,CAAC;AACN,CAAC;AAnFD,gDAmFC;AAED,kBAAkB,CAAC,YAAY,GAAG;IAC9B,OAAO,EAAE,yCAA8B;CAC1C,CAAC"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
export declare const
|
|
1
|
+
import type { TranslationInputStrings } from './UITranslationButton.types';
|
|
2
|
+
export declare const defaultTranslationInputStrings: TranslationInputStrings;
|
|
3
3
|
//# sourceMappingURL=defaults.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"defaults.d.ts","sourceRoot":"","sources":["../../../src/components/UITranslationInput/defaults.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"defaults.d.ts","sourceRoot":"","sources":["../../../src/components/UITranslationInput/defaults.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AAE3E,eAAO,MAAM,8BAA8B,EAAE,uBAa5C,CAAC"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
exports.
|
|
5
|
-
acceptButtonLabel: '
|
|
3
|
+
exports.defaultTranslationInputStrings = void 0;
|
|
4
|
+
exports.defaultTranslationInputStrings = {
|
|
5
|
+
acceptButtonLabel: 'Apply',
|
|
6
6
|
cancelButtonLabel: 'Cancel',
|
|
7
7
|
i18nKeyMissingTooltip: 'Text key or value is not available in i18n file.',
|
|
8
8
|
i18nKeyMissingDescription: 'Generate a text key {{{key}}} with value {{{value}}} in i18n file.',
|
|
@@ -10,6 +10,7 @@ exports.defaultTranslationButtonStrings = {
|
|
|
10
10
|
i18nValueMissingDescription: 'Generate a text key {{{key}}} in i18n file and substitute {{{value}}} by {{{i18n}}}.',
|
|
11
11
|
i18nReplaceWithExistingTooltip: 'Text key {{{key}}} for value {{{value}}} is available in i18n file. \nConsider substituting {{{value}}} by {{{i18n}}}.',
|
|
12
12
|
i18nReplaceWithExistingDescription: 'Text key {{{key}}} for value {{{value}}} is available in i18n file.Substitute {{{value}}} by {{{i18n}}}.',
|
|
13
|
-
i18nEntryExistsTooltip: 'Edit in source file'
|
|
13
|
+
i18nEntryExistsTooltip: 'Edit in source file',
|
|
14
|
+
i18nEntryExistsInputTooltip: "Value: '{{{value}}}'.\nTranslation: '{{{translation}}}'."
|
|
14
15
|
};
|
|
15
16
|
//# sourceMappingURL=defaults.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"defaults.js","sourceRoot":"","sources":["../../../src/components/UITranslationInput/defaults.ts"],"names":[],"mappings":";;;AAEa,QAAA
|
|
1
|
+
{"version":3,"file":"defaults.js","sourceRoot":"","sources":["../../../src/components/UITranslationInput/defaults.ts"],"names":[],"mappings":";;;AAEa,QAAA,8BAA8B,GAA4B;IACnE,iBAAiB,EAAE,OAAO;IAC1B,iBAAiB,EAAE,QAAQ;IAC3B,qBAAqB,EAAE,kDAAkD;IACzE,yBAAyB,EAAE,oEAAoE;IAC/F,uBAAuB,EAAE,kEAAkE;IAC3F,2BAA2B,EAAE,sFAAsF;IACnH,8BAA8B,EAC1B,wHAAwH;IAC5H,kCAAkC,EAC9B,0GAA0G;IAC9G,sBAAsB,EAAE,qBAAqB;IAC7C,2BAA2B,EAAE,0DAA0D;CAC1F,CAAC"}
|
package/package.json
CHANGED
package/storybook/iframe.html
CHANGED
|
@@ -377,4 +377,4 @@
|
|
|
377
377
|
|
|
378
378
|
|
|
379
379
|
|
|
380
|
-
window['STORIES'] = [{"titlePrefix":"","directory":"./stories","files":"*.story.tsx","importPathMatcher":"^\\.[\\\\/](?:stories\\/(?!\\.)(?=.)[^/]*?\\.story\\.tsx)$"}];</script><script src="runtime~main.d4909001.iframe.bundle.js"></script><script src="733.4fa1d656.iframe.bundle.js"></script><script src="main.
|
|
380
|
+
window['STORIES'] = [{"titlePrefix":"","directory":"./stories","files":"*.story.tsx","importPathMatcher":"^\\.[\\\\/](?:stories\\/(?!\\.)(?=.)[^/]*?\\.story\\.tsx)$"}];</script><script src="runtime~main.d4909001.iframe.bundle.js"></script><script src="733.4fa1d656.iframe.bundle.js"></script><script src="main.5b3dd4b6.iframe.bundle.js"></script></body></html>
|