pds-dev-kit-web 2.2.243 → 2.2.245
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.
|
@@ -1,17 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { LocalizedContentModalProps } from '../../desktop/panels/LocalizedContentModal/LocalizedContentModal';
|
|
2
2
|
type LanguageCode = 'en' | 'ko' | 'ja' | 'zh' | 'zh-Hant' | 'fr' | 'de' | 'es' | 'it' | 'pt' | 'ru' | 'vi' | 'th' | 'id' | 'ms' | 'ar' | 'tr' | 'pl' | 'nl' | 'sv' | 'fi' | 'no' | 'da' | 'he' | 'hi' | 'bn' | 'ta' | 'el' | 'cs' | 'ro';
|
|
3
|
-
type LocalizedContentConfig =
|
|
4
|
-
size?: 'large' | 'medium' | 'small' | 'rlarge';
|
|
5
|
-
textFieldLineType?: 'single' | 'multi' | 'auto' | 'tinyeditor';
|
|
6
|
-
originalText?: string;
|
|
7
|
-
initialValues?: {
|
|
8
|
-
[key in LanguageCode]?: string;
|
|
9
|
-
};
|
|
10
|
-
visibleLanguages?: LanguageCode[];
|
|
11
|
-
readonly?: boolean;
|
|
12
|
-
richEditorConfig?: RichEditorConfig;
|
|
13
|
-
onApply?: (values: {
|
|
14
|
-
[key in LanguageCode]?: string;
|
|
15
|
-
}) => void;
|
|
16
|
-
};
|
|
3
|
+
type LocalizedContentConfig = Omit<LocalizedContentModalProps, 'isOpen' | 'onClose'>;
|
|
17
4
|
export type { LanguageCode, LocalizedContentConfig };
|
|
@@ -12,7 +12,7 @@ export type ImageConfig = ImageViewProps & {
|
|
|
12
12
|
onValid: (file: File) => boolean;
|
|
13
13
|
onImageUpload: ImageUploadHandler;
|
|
14
14
|
};
|
|
15
|
-
type LocalizedContentModalProps = {
|
|
15
|
+
export type LocalizedContentModalProps = {
|
|
16
16
|
isOpen: boolean;
|
|
17
17
|
size?: 'large' | 'medium' | 'small' | 'rlarge';
|
|
18
18
|
originalFieldType?: 'text' | 'image';
|
|
@@ -92,6 +92,9 @@ function LocalizedContentModal(_a) {
|
|
|
92
92
|
var form = (0, react_hook_form_1.useForm)({
|
|
93
93
|
defaultValues: initialValues
|
|
94
94
|
});
|
|
95
|
+
var watchedValues = (0, react_hook_form_1.useWatch)({
|
|
96
|
+
control: form.control
|
|
97
|
+
});
|
|
95
98
|
(0, react_1.useLayoutEffect)(function () {
|
|
96
99
|
if (isOpen && initialValues) {
|
|
97
100
|
form.reset(initialValues);
|
|
@@ -131,6 +134,9 @@ function LocalizedContentModal(_a) {
|
|
|
131
134
|
}
|
|
132
135
|
});
|
|
133
136
|
}); };
|
|
137
|
+
var handleDelete = function (code) {
|
|
138
|
+
form.setValue(code, '');
|
|
139
|
+
};
|
|
134
140
|
var handleApply = function () {
|
|
135
141
|
var formValues = form.getValues();
|
|
136
142
|
if (onApply) {
|
|
@@ -155,7 +161,7 @@ function LocalizedContentModal(_a) {
|
|
|
155
161
|
'link insertfile image media',
|
|
156
162
|
'undo redo',
|
|
157
163
|
'code'
|
|
158
|
-
] }))), textFieldLineType !== 'tinyeditor' && ((0, jsx_runtime_1.jsx)(components_1.TextField, { responsiveMode: "use", multiRows: textFieldLineType === 'multi' ? 5 : undefined, autoMaxRows: textFieldLineType === 'auto' ? 5 : undefined, autoMinRows: textFieldLineType === 'auto' ? 1 : undefined, name: languageCode, hintText: t('str_9071'), placeholder: "Input Text", textLineType: textFieldLineType, state: readonly ? 'disabled' : 'normal' }))] })), originalFieldType === 'image' && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [!readonly && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(components_2.Spacing, { size: "spacing_d" }), (0, jsx_runtime_1.jsxs)(S_ImageUploadButtonWrapper, { children: [(0, jsx_runtime_1.jsx)(index_1.D_UploadMainButton, { text: t('str_upload'), styleTheme: "secondary", size: "small", accept: (imageConfig === null || imageConfig === void 0 ? void 0 : imageConfig.accept) || 'image/png, image/jpg, image/jpeg, image/gif', onClick: function (e) { return handleImageUpload(e, languageCode); } }), (0, jsx_runtime_1.jsx)(components_2.Spacing, { size: "spacing_b", spacingType: "width" }), (0, jsx_runtime_1.jsx)(components_1.MainButton, { text: t('str_delete'), styleTheme: "secondary", size: "small", state:
|
|
164
|
+
] }))), textFieldLineType !== 'tinyeditor' && ((0, jsx_runtime_1.jsx)(components_1.TextField, { responsiveMode: "use", multiRows: textFieldLineType === 'multi' ? 5 : undefined, autoMaxRows: textFieldLineType === 'auto' ? 5 : undefined, autoMinRows: textFieldLineType === 'auto' ? 1 : undefined, name: languageCode, hintText: t('str_9071'), placeholder: "Input Text", textLineType: textFieldLineType, state: readonly ? 'disabled' : 'normal' }))] })), originalFieldType === 'image' && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [!readonly && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(components_2.Spacing, { size: "spacing_d" }), (0, jsx_runtime_1.jsxs)(S_ImageUploadButtonWrapper, { children: [(0, jsx_runtime_1.jsx)(index_1.D_UploadMainButton, { text: t('str_upload'), styleTheme: "secondary", size: "small", accept: (imageConfig === null || imageConfig === void 0 ? void 0 : imageConfig.accept) || 'image/png, image/jpg, image/jpeg, image/gif', onClick: function (e) { return handleImageUpload(e, languageCode); } }), (0, jsx_runtime_1.jsx)(components_2.Spacing, { size: "spacing_b", spacingType: "width" }), (0, jsx_runtime_1.jsx)(components_1.MainButton, { text: t('str_delete'), styleTheme: "secondary", size: "small", state: (watchedValues === null || watchedValues === void 0 ? void 0 : watchedValues[languageCode]) ? 'normal' : 'disabled', onClick: function () { return handleDelete(languageCode); } })] })] })), (watchedValues === null || watchedValues === void 0 ? void 0 : watchedValues[languageCode]) && ((0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)(components_2.Spacing, { size: "spacing_d" }), (0, jsx_runtime_1.jsx)(components_3.ImageView, __assign({ width: "responsive", height: "responsive" }, imageConfig, { src: watchedValues === null || watchedValues === void 0 ? void 0 : watchedValues[languageCode] }))] })), (0, jsx_runtime_1.jsx)(components_2.Spacing, { size: "spacing_f" })] })), index < ((visibleLanguages === null || visibleLanguages === void 0 ? void 0 : visibleLanguages.length) || 0) - 1 && (0, jsx_runtime_1.jsx)(components_2.Spacing, { size: "spacing_f" })] }, "".concat(languageCode, "_field")));
|
|
159
165
|
})] })) })));
|
|
160
166
|
}
|
|
161
167
|
var S_LanguageField = styled_components_1.default.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n width: 100%;\n"], ["\n width: 100%;\n"])));
|
package/package.json
CHANGED
package/release-note.md
CHANGED