@antscorp/antsomi-ui 1.3.5-beta.154 → 1.3.5-beta.156
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/es/components/molecules/TemplateSaveAs/TemplateSaveAs.d.ts +5 -1
- package/es/components/molecules/TemplateSaveAs/TemplateSaveAs.js +114 -87
- package/es/components/molecules/TemplateSaveAs/hooks/useTemplateSave.d.ts +3 -3
- package/es/components/molecules/TemplateSaveAs/hooks/useTemplateSave.js +5 -3
- package/es/constants/theme.js +3 -0
- package/es/test.js +7 -9
- package/package.json +1 -1
|
@@ -22,6 +22,10 @@ export interface TemplateValueOptions {
|
|
|
22
22
|
};
|
|
23
23
|
accessInfo?: ShareAccessProps['accessInfo'];
|
|
24
24
|
}
|
|
25
|
+
export interface FormValue extends Required<Omit<TemplateValueOptions, 'templateName' | 'accessInfo'>> {
|
|
26
|
+
templateName: string;
|
|
27
|
+
templateNameSelect: number | string | undefined;
|
|
28
|
+
}
|
|
25
29
|
export interface TemplateSaveAsProps {
|
|
26
30
|
className?: string;
|
|
27
31
|
shareAccess: Omit<{
|
|
@@ -68,7 +72,7 @@ export interface TemplateSaveAsProps {
|
|
|
68
72
|
label?: string;
|
|
69
73
|
placeholder?: string;
|
|
70
74
|
};
|
|
71
|
-
form?: FormInstance<
|
|
75
|
+
form?: FormInstance<FormValue>;
|
|
72
76
|
value?: TemplateValueOptions;
|
|
73
77
|
onChange?: (value: Partial<TemplateValueOptions>, errors?: any[]) => void;
|
|
74
78
|
onEvent?: (value: Partial<TemplateValueOptions>) => void;
|
|
@@ -20,9 +20,15 @@ import { useDebounce } from '@antscorp/antsomi-ui/es/hooks/useDebounceV2';
|
|
|
20
20
|
// Styles
|
|
21
21
|
import { TemplateSaveAsStyled } from './styled';
|
|
22
22
|
import { Category, ImageSlider } from './components';
|
|
23
|
+
import { cloneDeep } from 'lodash';
|
|
23
24
|
const { Text } = Typography;
|
|
24
25
|
export const TemplateSaveAs = props => {
|
|
25
|
-
|
|
26
|
+
var _a;
|
|
27
|
+
const { className, shareAccess, saveOptions, imageReview, isLoadingCategories, categories, omitCategories, templateNames: templateNameList, templateNamesOptions, descriptionOptions,
|
|
28
|
+
// form,
|
|
29
|
+
form: formProps, value, onChange, onEvent, } = props;
|
|
30
|
+
const [internalForm] = Form.useForm();
|
|
31
|
+
const form = formProps || internalForm;
|
|
26
32
|
const { show: isShowShareAccess } = shareAccess, shareAccessProps = __rest(shareAccess, ["show"]);
|
|
27
33
|
const { label: imageReviewLabel } = imageReview, restImageReviewProps = __rest(imageReview, ["label"]);
|
|
28
34
|
const { isLoading, label: templateLabel, defaultNewTemplateName = `Untitled Media Template#${dayjs().format('YYYY-MM-DD HH:mm:ss')}`, selectPlaceholder = 'Please select an item', placeholder = 'Enter your media template name', validateName, onSearch, onNamePopupScroll, onScrollToBottom, } = templateNamesOptions || {};
|
|
@@ -31,72 +37,81 @@ export const TemplateSaveAs = props => {
|
|
|
31
37
|
const { saveOption = saveNewValue, templateName = saveOption === saveNewValue || !saveOption
|
|
32
38
|
? { id: undefined, label: defaultNewTemplateName }
|
|
33
39
|
: templateNameList === null || templateNameList === void 0 ? void 0 : templateNameList[0], description: defaultTemplateDesc, defaultThumbnail = 0, categories: categoriesValue = {}, accessInfo, } = value || {};
|
|
40
|
+
const initFormValue = {
|
|
41
|
+
saveOption,
|
|
42
|
+
templateName: defaultNewTemplateName,
|
|
43
|
+
templateNameSelect: (templateName === null || templateName === void 0 ? void 0 : templateName.id) || ((_a = templateNameList === null || templateNameList === void 0 ? void 0 : templateNameList[0]) === null || _a === void 0 ? void 0 : _a.id),
|
|
44
|
+
description: defaultTemplateDesc || '',
|
|
45
|
+
categories: categoriesValue,
|
|
46
|
+
defaultThumbnail,
|
|
47
|
+
};
|
|
34
48
|
const [searchValue, setSearchValue] = useState('');
|
|
35
49
|
const searchValueDebounce = useDebounce(searchValue, 1000);
|
|
36
50
|
useEffect(() => {
|
|
37
51
|
if (searchValueDebounce && onSearch)
|
|
38
52
|
onSearch(searchValueDebounce);
|
|
39
53
|
}, [searchValueDebounce, onSearch]);
|
|
40
|
-
const [templateNameNew, setTemplateNameNew] = useState(defaultNewTemplateName);
|
|
41
|
-
const [templateNameExist, setTemplateNameExist] = useState(
|
|
54
|
+
// const [templateNameNew, setTemplateNameNew] = useState(defaultNewTemplateName);
|
|
55
|
+
// const [templateNameExist, setTemplateNameExist] = useState(
|
|
56
|
+
// templateName?.id ? templateName : templateNameList?.[0],
|
|
57
|
+
// );
|
|
42
58
|
// NOTE: HOTFIX templateNameExist not update when value outside changed
|
|
43
|
-
useEffect(() => {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
}, [templateName]);
|
|
59
|
+
// useEffect(() => {
|
|
60
|
+
// if (templateName?.id) {
|
|
61
|
+
// setTemplateNameExist(templateName);
|
|
62
|
+
// }
|
|
63
|
+
// }, [templateName]);
|
|
48
64
|
const handleChangeValue = (newValue) => {
|
|
49
|
-
var _a
|
|
65
|
+
var _a;
|
|
50
66
|
if (onEvent) {
|
|
51
67
|
onEvent(newValue);
|
|
52
68
|
}
|
|
53
69
|
if (onChange) {
|
|
54
|
-
|
|
70
|
+
const formValue = cloneDeep(form.getFieldsValue(true));
|
|
71
|
+
formValue.templateName =
|
|
72
|
+
formValue.saveOption === saveNewValue
|
|
73
|
+
? { id: undefined, label: formValue.templateName }
|
|
74
|
+
: {
|
|
75
|
+
id: formValue.templateNameSelect,
|
|
76
|
+
label: ((_a = templateNameList.find(item => item.id === formValue.templateNameSelect)) === null || _a === void 0 ? void 0 : _a.label) ||
|
|
77
|
+
formValue.templateName ||
|
|
78
|
+
'',
|
|
79
|
+
};
|
|
80
|
+
delete formValue.templateNameSelect;
|
|
81
|
+
onChange(Object.assign(Object.assign(Object.assign({}, value), formValue), newValue), form.getFieldsError().flatMap(item => item.errors));
|
|
55
82
|
}
|
|
56
83
|
};
|
|
57
84
|
const handleAddCategory = ({ parentKey, childKey }) => {
|
|
58
|
-
|
|
59
|
-
const
|
|
85
|
+
var _a;
|
|
86
|
+
const currCategory = ((_a = form.getFieldValue('categories')) === null || _a === void 0 ? void 0 : _a[parentKey]) || [];
|
|
87
|
+
const newCategory = Object.assign(Object.assign({}, form.getFieldValue('categories')), { [parentKey]: [...currCategory, +childKey] });
|
|
88
|
+
form.setFieldValue('categories', newCategory);
|
|
60
89
|
handleChangeValue({ categories: newCategory });
|
|
61
90
|
};
|
|
62
91
|
const handleRemoveCategory = ({ parentKey, childKey }) => {
|
|
63
|
-
|
|
92
|
+
var _a;
|
|
93
|
+
const currCategory = (_a = form.getFieldValue('categories')) === null || _a === void 0 ? void 0 : _a[parentKey];
|
|
64
94
|
if (!currCategory)
|
|
65
95
|
return;
|
|
66
96
|
const newChildren = currCategory.filter(child => child !== childKey);
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
});
|
|
97
|
+
const newCategory = Object.assign(Object.assign({}, form.getFieldValue('categories')), { [parentKey]: newChildren });
|
|
98
|
+
form.setFieldValue('categories', newCategory);
|
|
99
|
+
handleChangeValue({ categories: newCategory });
|
|
70
100
|
};
|
|
71
|
-
return (React.createElement(Form, { form: form, initialValues:
|
|
72
|
-
'template-name': defaultNewTemplateName ||
|
|
73
|
-
`Untitled Media Template#${dayjs().format('YYYY-MM-DD HH:mm:ss')}`,
|
|
74
|
-
} },
|
|
101
|
+
return (React.createElement(Form, { form: form, initialValues: initFormValue },
|
|
75
102
|
React.createElement(TemplateSaveAsStyled, { className: className || '', vertical: true },
|
|
76
103
|
React.createElement(Flex, { className: "save-options-container" },
|
|
77
|
-
React.createElement(
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
? { id: undefined, label: templateNameNew }
|
|
82
|
-
: templateNameExist,
|
|
83
|
-
});
|
|
84
|
-
} },
|
|
85
|
-
React.createElement(Radio, { value: saveNewValue }, saveNewText),
|
|
86
|
-
React.createElement(Radio, { value: saveExistValue }, saveExistText))),
|
|
104
|
+
React.createElement(Form.Item, { name: "saveOption", noStyle: true },
|
|
105
|
+
React.createElement(RadioGroup, { onChange: e => handleChangeValue({ saveOption: e.target.value }) },
|
|
106
|
+
React.createElement(Radio, { value: saveNewValue }, saveNewText),
|
|
107
|
+
React.createElement(Radio, { value: saveExistValue }, saveExistText)))),
|
|
87
108
|
React.createElement(Flex, null,
|
|
88
109
|
React.createElement(Flex, { vertical: true, gap: 20, className: "template-container" },
|
|
89
110
|
React.createElement(Flex, { className: "field-container" },
|
|
90
111
|
React.createElement(Text, { className: "field-title field-title--start" },
|
|
91
112
|
templateLabel || 'Template name',
|
|
92
113
|
React.createElement("span", null, "\u2009*")),
|
|
93
|
-
saveOption === saveNewValue ? (React.createElement(Form.Item
|
|
94
|
-
// label="Template name"
|
|
95
|
-
, {
|
|
96
|
-
// label="Template name"
|
|
97
|
-
name: "template-name", validateTrigger: "onChange",
|
|
98
|
-
// noStyle
|
|
99
|
-
rules: [
|
|
114
|
+
React.createElement(Form.Item, { noStyle: true, shouldUpdate: (prevValues, currentValues) => prevValues.saveOption !== currentValues.saveOption }, ({ getFieldValue, isFieldValidating }) => getFieldValue('saveOption') === saveNewValue ? (React.createElement(Form.Item, { name: "templateName", validateDebounce: 1000, validateTrigger: "onChange", hasFeedback: isFieldValidating('templateName'), validateStatus: "validating", rules: [
|
|
100
115
|
{
|
|
101
116
|
required: true,
|
|
102
117
|
message: "This field can't be empty",
|
|
@@ -105,60 +120,66 @@ export const TemplateSaveAs = props => {
|
|
|
105
120
|
validator: validateName,
|
|
106
121
|
},
|
|
107
122
|
] },
|
|
108
|
-
React.createElement(Input, { className: "field-input",
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
123
|
+
React.createElement(Input, { className: "field-input", placeholder: placeholder, maxLength: 255, onBlur: e => handleChangeValue({
|
|
124
|
+
templateName: { id: undefined, label: e.target.value },
|
|
125
|
+
}) }))) : (React.createElement(Form.Item, { name: "templateNameSelect", noStyle: true },
|
|
126
|
+
React.createElement(Select, { className: "field-input", placeholder: selectPlaceholder, showSearch: true, searchValue: searchValue, onSearch: setSearchValue, onPopupScroll: e => {
|
|
127
|
+
if (onNamePopupScroll)
|
|
128
|
+
onNamePopupScroll(e);
|
|
129
|
+
if (onScrollToBottom) {
|
|
130
|
+
const { scrollHeight, scrollTop, clientHeight } = e.currentTarget;
|
|
131
|
+
if (scrollHeight === clientHeight + scrollTop) {
|
|
132
|
+
onScrollToBottom();
|
|
133
|
+
}
|
|
118
134
|
}
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
135
|
+
}, filterOption: false, dropdownRender: menu => (React.createElement(React.Fragment, null,
|
|
136
|
+
isLoading && templateNameList.length === 0 ? null : menu,
|
|
137
|
+
isLoading ? (React.createElement(Space, { style: {
|
|
138
|
+
padding: '4px 0',
|
|
139
|
+
width: '100%',
|
|
140
|
+
justifyContent: 'center',
|
|
141
|
+
alignItems: 'center',
|
|
142
|
+
} },
|
|
143
|
+
React.createElement(Spin, { size: "small" }))) : null)), options:
|
|
144
|
+
// If template exist is not in templateNames list => add to begin of options array
|
|
145
|
+
(templateNameList === null || templateNameList === void 0 ? void 0 : templateNameList.length) > 0
|
|
146
|
+
? [
|
|
147
|
+
...(templateNameList.find(item => item.id === getFieldValue('templateNameSelect'))
|
|
148
|
+
? []
|
|
149
|
+
: [
|
|
150
|
+
{
|
|
151
|
+
value: getFieldValue('templateNameSelect'),
|
|
152
|
+
label: getFieldValue('templateName'),
|
|
153
|
+
},
|
|
154
|
+
]),
|
|
155
|
+
...templateNameList.map(item => ({
|
|
156
|
+
value: item.id,
|
|
157
|
+
label: item.label,
|
|
158
|
+
})),
|
|
159
|
+
]
|
|
160
|
+
: [], onChange: value => {
|
|
161
|
+
var _a;
|
|
162
|
+
return handleChangeValue({
|
|
163
|
+
templateName: {
|
|
164
|
+
id: value,
|
|
165
|
+
label: ((_a = templateNameList.find(item => item.id === value)) === null || _a === void 0 ? void 0 : _a.label) || '',
|
|
166
|
+
},
|
|
167
|
+
});
|
|
168
|
+
} }))))),
|
|
153
169
|
React.createElement(Flex, { className: "field-container", style: { marginTop: '-20px' } },
|
|
154
170
|
React.createElement(Text, { className: "field-title field-title--middle" }, descriptionLabel || 'Description'),
|
|
155
|
-
React.createElement(
|
|
171
|
+
React.createElement(Form.Item, { name: "description" },
|
|
172
|
+
React.createElement(Input, { placeholder: descriptionPlaceholder || 'Describe your media template', className: "field-input", maxLength: 400, onBlur: e => handleChangeValue({ description: e.target.value }) }))),
|
|
156
173
|
React.createElement(Flex, { className: "field-container" },
|
|
157
174
|
React.createElement(Text, { className: "field-title" },
|
|
158
175
|
imageReviewLabel || 'Thumbnail template',
|
|
159
176
|
" ",
|
|
160
177
|
React.createElement("span", null, "*")),
|
|
161
|
-
React.createElement(
|
|
178
|
+
React.createElement(Form.Item, { name: "defaultThumbnail", shouldUpdate: true, noStyle: true },
|
|
179
|
+
React.createElement(ImageSlider, Object.assign({ defaultThumbnail: form.getFieldValue('defaultThumbnail'), onSelectDefault: value => {
|
|
180
|
+
form.setFieldValue('defaultThumbnail', value);
|
|
181
|
+
handleChangeValue({ defaultThumbnail: value });
|
|
182
|
+
} }, restImageReviewProps)))),
|
|
162
183
|
isLoadingCategories ? (React.createElement(Flex, { className: "field-container" },
|
|
163
184
|
React.createElement(Text, { className: "field-title" }, "Categories"),
|
|
164
185
|
React.createElement(Space, { style: {
|
|
@@ -168,17 +189,23 @@ export const TemplateSaveAs = props => {
|
|
|
168
189
|
alignItems: 'center',
|
|
169
190
|
} },
|
|
170
191
|
React.createElement(Spin, { size: "small" })))) : null,
|
|
171
|
-
!isLoadingCategories && categories
|
|
192
|
+
React.createElement(Form.Item, { noStyle: true, shouldUpdate: (prevValues, currentValues) => prevValues.categories !== currentValues.categories }, ({ getFieldValue }) => !isLoadingCategories && categories
|
|
172
193
|
? categories.map(parentCategory => {
|
|
173
|
-
|
|
194
|
+
var _a;
|
|
195
|
+
const selectedChildren = (_a = getFieldValue('categories')) === null || _a === void 0 ? void 0 : _a[parentCategory.key];
|
|
196
|
+
// const selectedChildren = categoriesValue[parentCategory.key];
|
|
174
197
|
// NOTE: filter to remove device and template categories
|
|
175
198
|
if (omitCategories === null || omitCategories === void 0 ? void 0 : omitCategories.includes(parentCategory.key.toString()))
|
|
176
199
|
return null;
|
|
177
200
|
return (React.createElement(Category, { key: parentCategory.key, categoryKey: parentCategory.key, categoryChildren: parentCategory.children, label: parentCategory.label, selected: selectedChildren, onAddCategory: handleAddCategory, onRemoveCategory: handleRemoveCategory }));
|
|
178
201
|
})
|
|
179
|
-
: null),
|
|
202
|
+
: null)),
|
|
180
203
|
isShowShareAccess ? (React.createElement("div", { className: "share-access-container" },
|
|
181
|
-
React.createElement(ShareAccess
|
|
204
|
+
React.createElement(ShareAccess
|
|
205
|
+
// accessInfo={form.getFieldValue('accessInfo')}
|
|
206
|
+
, Object.assign({
|
|
207
|
+
// accessInfo={form.getFieldValue('accessInfo')}
|
|
208
|
+
accessInfo: accessInfo, excludeUserAccess: ['to_editor', 'to_owner'], generalAccessSettings: {
|
|
182
209
|
publicOnlyWith: true,
|
|
183
210
|
}, onChange: value => handleChangeValue({ accessInfo: value }) }, shareAccessProps)))) : null))));
|
|
184
211
|
};
|
|
@@ -3,7 +3,7 @@ import { PayloadInfo } from '@antscorp/antsomi-ui/es/types';
|
|
|
3
3
|
import { TGetTemplateCategoryList, TGetObjectTEmplateList } from '@antscorp/antsomi-ui/es/queries/TemplateListing';
|
|
4
4
|
import { TTemplateListingConfig } from '@antscorp/antsomi-ui/es/types/templateListing';
|
|
5
5
|
import { TemplateCategory } from '@antscorp/antsomi-ui/es/models/TemplateCategory';
|
|
6
|
-
import { TemplateValueOptions, categoriesProps } from '../TemplateSaveAs';
|
|
6
|
+
import { FormValue, TemplateValueOptions, categoriesProps } from '../TemplateSaveAs';
|
|
7
7
|
import { RuleObject } from 'antd/es/form';
|
|
8
8
|
interface TemplateListingOptions {
|
|
9
9
|
service: PayloadInfo;
|
|
@@ -61,9 +61,9 @@ export declare const useTemplateSave: (options: TemplateListingOptions) => {
|
|
|
61
61
|
onSearch: import("react").Dispatch<import("react").SetStateAction<string>>;
|
|
62
62
|
onScrollToBottom: () => void;
|
|
63
63
|
isLoading: boolean;
|
|
64
|
-
validateName: (rule: RuleObject, value: any
|
|
64
|
+
validateName: (rule: RuleObject, value: any) => Promise<void>;
|
|
65
65
|
};
|
|
66
|
-
form: import("antd").FormInstance<
|
|
66
|
+
form: import("antd").FormInstance<FormValue>;
|
|
67
67
|
errors: any[] | undefined;
|
|
68
68
|
refetchCategoryList: <TPageData>(options?: (import("@tanstack/query-core").RefetchOptions & import("@tanstack/query-core").RefetchQueryFilters<TPageData>) | undefined) => Promise<import("@tanstack/query-core").QueryObserverResult<TemplateCategory[], any>>;
|
|
69
69
|
refetchTemplateList: <TPageData_1>(options?: (import("@tanstack/query-core").RefetchOptions & import("@tanstack/query-core").RefetchQueryFilters<TPageData_1>) | undefined) => Promise<import("@tanstack/query-core").QueryObserverResult<import("@tanstack/query-core").InfiniteData<import("@antscorp/antsomi-ui/es/types").ResponseListing<import("@antscorp/antsomi-ui/es/models/ObjectTemplate").ObjectTemplate>>, any>>;
|
|
@@ -39,8 +39,10 @@ export const useTemplateSave = (options) => {
|
|
|
39
39
|
const camelCase = snakeCaseToCamelCase(categories || {});
|
|
40
40
|
return { camelCase, snakeCase };
|
|
41
41
|
};
|
|
42
|
-
const formattedCategoriesValue = useMemo(() => handleFormatCategories(value.categories), [value]);
|
|
42
|
+
const formattedCategoriesValue = useMemo(() => handleFormatCategories(value.categories), [value.categories]);
|
|
43
|
+
// const form = Form.useFormInstance<FormValue>();
|
|
43
44
|
const [form] = Form.useForm();
|
|
45
|
+
// console.log('form instance in hook:: ', form.getFieldsValue());
|
|
44
46
|
const { data: categoryList, isLoading: isLoadingCategoryList, refetch: refetchCategoryList, } = useGetTemplateCategoryList({
|
|
45
47
|
args: {
|
|
46
48
|
auth: service,
|
|
@@ -96,7 +98,7 @@ export const useTemplateSave = (options) => {
|
|
|
96
98
|
setValue(valueArg || {});
|
|
97
99
|
};
|
|
98
100
|
/* Validate Template Name */
|
|
99
|
-
const validateName = (rule, value
|
|
101
|
+
const validateName = (rule, value) => __awaiter(void 0, void 0, void 0, function* () {
|
|
100
102
|
if (!value)
|
|
101
103
|
return;
|
|
102
104
|
const response = yield validateTemplateName({
|
|
@@ -104,7 +106,7 @@ export const useTemplateSave = (options) => {
|
|
|
104
106
|
params: {
|
|
105
107
|
object_type: objectType,
|
|
106
108
|
public_level: publicLevel,
|
|
107
|
-
template_name: value,
|
|
109
|
+
template_name: value.trim(),
|
|
108
110
|
},
|
|
109
111
|
});
|
|
110
112
|
if (response.existed) {
|
package/es/constants/theme.js
CHANGED
package/es/test.js
CHANGED
|
@@ -71,7 +71,7 @@ const getUserInfos = (email) => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
71
71
|
return data;
|
|
72
72
|
});
|
|
73
73
|
export const App = () => {
|
|
74
|
-
const { categoryItems, templateItems, value: templateValue, onChange: onChangeTemplateValue, searchNameProps, form, } = useTemplateSave({
|
|
74
|
+
const { categoryItems, templateItems, value: templateValue, onChange: onChangeTemplateValue, searchNameProps, form, errors, } = useTemplateSave({
|
|
75
75
|
service: {
|
|
76
76
|
url: 'https://sandbox-media-template.antsomi.com/cdp/api/v1',
|
|
77
77
|
token: '5474r2x214z254a4u2a4y444m4j5p27444c4h4h4n5t5',
|
|
@@ -118,12 +118,10 @@ export const App = () => {
|
|
|
118
118
|
// />
|
|
119
119
|
React.createElement(React.Fragment, null,
|
|
120
120
|
React.createElement(Button, { onClick: () => setIsOpenSaveTemplate(true) }, "Open Modal"),
|
|
121
|
-
React.createElement(TemplateSaveAsModal, { open: isOpenSaveTemplate, okButtonProps: { loading: false }, cancelButtonProps: { disabled: false },
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
onOk: (e, value) => {
|
|
126
|
-
console.log('e');
|
|
121
|
+
React.createElement(TemplateSaveAsModal, { open: isOpenSaveTemplate, destroyOnClose: true, okButtonProps: { loading: false }, cancelButtonProps: { disabled: false }, onCancel: () => setIsOpenSaveTemplate(false), onOk: (e, value) => {
|
|
122
|
+
console.log('submit:: errors - ', errors, ' - value - ', value);
|
|
123
|
+
if (!(errors === null || errors === void 0 ? void 0 : errors.length))
|
|
124
|
+
setIsOpenSaveTemplate(false);
|
|
127
125
|
}, templateProps: {
|
|
128
126
|
form,
|
|
129
127
|
value: templateValue,
|
|
@@ -133,7 +131,7 @@ export const App = () => {
|
|
|
133
131
|
// setSelectedTemplate(event.templateName.id.toString());
|
|
134
132
|
// },
|
|
135
133
|
imageReview: {
|
|
136
|
-
thumbnails
|
|
134
|
+
thumbnails,
|
|
137
135
|
skeleton: true,
|
|
138
136
|
},
|
|
139
137
|
templateNames: templateItems,
|
|
@@ -153,7 +151,7 @@ export const App = () => {
|
|
|
153
151
|
},
|
|
154
152
|
allowAddUser: true,
|
|
155
153
|
},
|
|
156
|
-
templateNamesOptions:
|
|
154
|
+
templateNamesOptions: searchNameProps,
|
|
157
155
|
} })));
|
|
158
156
|
};
|
|
159
157
|
const container = document.getElementById('root');
|