@antscorp/antsomi-ui 1.3.5-beta.142 → 1.3.5-beta.144

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.
@@ -69,7 +69,7 @@ export const CloseBtn = styled.div `
69
69
  export const MenuItem = styled.div `
70
70
  height: 36px;
71
71
  width: 36px;
72
- border-radius: 3px;
72
+ border-radius: 10px;
73
73
  background-color: transparent;
74
74
  display: flex;
75
75
  align-items: center;
@@ -25,9 +25,9 @@ export const TemplateSaveAs = props => {
25
25
  const { className, shareAccess, saveOptions, imageReview, isLoadingCategories, categories, omitCategories, templateNames: templateNameList, templateNamesOptions, descriptionOptions, form, value, onChange, onEvent, } = props;
26
26
  const { show: isShowShareAccess } = shareAccess, shareAccessProps = __rest(shareAccess, ["show"]);
27
27
  const { label: imageReviewLabel } = imageReview, restImageReviewProps = __rest(imageReview, ["label"]);
28
- 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', onSearch, onNamePopupScroll, onScrollToBottom, } = templateNamesOptions || {};
28
+ 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 || {};
29
29
  const { label: descriptionLabel, placeholder: descriptionPlaceholder } = descriptionOptions || {};
30
- const { saveNewText = 'Save as a new media Template', saveExistText = 'Save as an existing media Template', saveNewValue = 'save-new', saveExistValue = 'save-exist', } = saveOptions || {};
30
+ const { saveNewText = 'Save as a new media template', saveExistText = 'Save as an existing media template', saveNewValue = 'save-new', saveExistValue = 'save-exist', } = saveOptions || {};
31
31
  const { saveOption = saveNewValue, templateName = saveOption === saveNewValue || !saveOption
32
32
  ? { id: undefined, label: defaultNewTemplateName }
33
33
  : templateNameList === null || templateNameList === void 0 ? void 0 : templateNameList[0], description: defaultTemplateDesc, defaultThumbnail = 0, categories: categoriesValue = {}, accessInfo, } = value || {};
@@ -90,7 +90,21 @@ export const TemplateSaveAs = props => {
90
90
  React.createElement(Text, { className: "field-title field-title--start" },
91
91
  templateLabel || 'Template name',
92
92
  React.createElement("span", null, "\u2009*")),
93
- saveOption === saveNewValue ? (React.createElement(Form.Item, { label: "Template name", name: "template-name", validateTrigger: "onChange", noStyle: true, rules: [{ required: true, message: "This field can't be empty" }] },
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: [
100
+ {
101
+ required: true,
102
+ message: "This field can't be empty",
103
+ },
104
+ {
105
+ validator: validateName,
106
+ },
107
+ ] },
94
108
  React.createElement(Input, { className: "field-input", value: templateNameNew, placeholder: placeholder, debounce: 100, maxLength: 255, onAfterChange: value => {
95
109
  handleChangeValue({ templateName: { id: undefined, label: value } });
96
110
  setTemplateNameNew(value);
@@ -5,7 +5,7 @@ import Icon from '@antscorp/icons';
5
5
  export const BigImage = React.memo(props => {
6
6
  const { url, isDefaultThumbnail, isHideDefaultButton, index, onClickDefaultButton } = props;
7
7
  return (React.createElement("div", { className: "image-container--big" },
8
- url ? React.createElement(Image, { preview: false, width: "80%", height: "96%", src: url }) : null,
8
+ url ? (React.createElement(Image, { preview: false, width: "80%", height: "96%", src: url.includes('nocache') ? url : `${url}?nocache=${new Date().getTime()}` })) : null,
9
9
  isHideDefaultButton ? null : (React.createElement(Button, { className: "set-default-button", onClick: () => onClickDefaultButton && onClickDefaultButton(index) },
10
10
  isDefaultThumbnail ? React.createElement(Icon, { type: "icon-ants-check", style: { fontSize: '12px' } }) : null,
11
11
  isDefaultThumbnail ? 'Default thumbnail' : 'Set as default'))));
@@ -60,7 +60,7 @@ export const ImageSlider = props => {
60
60
  previewNavigation && !isLoading ? (React.createElement(React.Fragment, null,
61
61
  React.createElement(ButtonSlider, { direction: "left", type: "preview", onClick: handlePrevThumbnail }),
62
62
  React.createElement(ButtonSlider, { direction: "right", type: "preview", onClick: handleNextThumbnail }))) : null,
63
- hideThumbnailsList || isLoading || thumbnails.length <= 1 ? null : (React.createElement(React.Fragment, null,
63
+ hideThumbnailsList || isLoading || thumbnails.length <= 2 ? null : (React.createElement(React.Fragment, null,
64
64
  (!infinity && selectedThumbnail !== 0) || infinity ? (React.createElement(ButtonSlider, { direction: "left", type: "slider", onClick: handlePrevThumbnail })) : null,
65
65
  (!infinity && selectedThumbnail !== thumbnails.length - 1) || infinity ? (React.createElement(ButtonSlider, { direction: "right", type: "slider", onClick: handleNextThumbnail })) : null))));
66
66
  };
@@ -2,5 +2,5 @@ import React from 'react';
2
2
  import { Image } from 'antd';
3
3
  export const SmallImage = React.memo(props => {
4
4
  const { url, isSelected, index, onClick } = props;
5
- return (React.createElement("div", { className: `image-container--small ${isSelected ? 'image-container--selected' : ''}`, onClick: () => onClick && onClick(index) }, url ? React.createElement(Image, { preview: false, width: "80%", height: "96%", src: url }) : null));
5
+ return (React.createElement("div", { className: `image-container--small ${isSelected ? 'image-container--selected' : ''}`, onClick: () => onClick && onClick(index) }, url ? (React.createElement(Image, { preview: false, width: "80%", height: "96%", src: url.includes('nocache') ? url : `${url}?nocache=${new Date().getTime()}` })) : null));
6
6
  });
@@ -68,6 +68,10 @@ export const ImageSliderStyled = styled(Flex) `
68
68
  }
69
69
  }
70
70
 
71
+ .slider-button {
72
+ display: none;
73
+ }
74
+
71
75
  .thumbnail-preview-container:has(.antsomi-spin),
72
76
  .thumbnail-slider-container:has(.antsomi-spin) {
73
77
  box-shadow: rgba(159, 180, 180, 0.2) 0px 2px 8px;
@@ -80,6 +84,13 @@ export const ImageSliderStyled = styled(Flex) `
80
84
  background-color: #fcfcfc;
81
85
  }
82
86
 
87
+ &:has(.thumbnail-slider-container:hover),
88
+ &:has(.slider-button:hover) {
89
+ .slider-button {
90
+ display: flex;
91
+ }
92
+ }
93
+
83
94
  .thumbnail-preview-container {
84
95
  width: ${({ $imageWidth }) => `${$imageWidth}px`};
85
96
  overflow-x: scroll;
@@ -97,9 +97,8 @@ export const useTemplateSave = (options) => {
97
97
  };
98
98
  /* Validate Template Name */
99
99
  const validateName = (rule, value) => __awaiter(void 0, void 0, void 0, function* () {
100
- if (!value) {
101
- return Promise.reject(new Error('This field is required'));
102
- }
100
+ if (!value)
101
+ return;
103
102
  const response = yield validateTemplateName({
104
103
  auth: service,
105
104
  params: {
@@ -26,7 +26,8 @@ export const TemplateSaveAsStyled = styled(Flex) `
26
26
 
27
27
  .share-access-container {
28
28
  flex: 1 1 40%;
29
- padding-left: 28px;
29
+ padding-left: 20px;
30
+ margin-left: 5px;
30
31
  max-height: 60vh;
31
32
  overflow-y: auto;
32
33
  border-left: 1px solid #e5e5e5;
@@ -60,6 +61,10 @@ export const TemplateSaveAsStyled = styled(Flex) `
60
61
  width: 330px;
61
62
  }
62
63
 
64
+ .field-input.antsomi-select {
65
+ margin-bottom: 24px;
66
+ }
67
+
63
68
  .category-container {
64
69
  flex: 1;
65
70
  display: grid;
@@ -11,7 +11,6 @@ export const SimilarTemplateWrapper = styled(Flex) `
11
11
  }
12
12
  `;
13
13
  export const TemplateListWrapper = styled.div `
14
- display: grid;
15
- grid-template-columns: ${({ templateQuantity }) => `repeat(${templateQuantity}, minmax(0, 1fr))`};
16
- gap: 30px;
14
+ display: flex;
15
+ justify-content: space-between;
17
16
  `;
package/es/test.d.ts CHANGED
@@ -1,14 +1,3 @@
1
1
  import React from 'react';
2
2
  import '@antscorp/icons/main.css';
3
- export declare const BACKGROUND_COLOR_STYLE: {
4
- SOLID: {
5
- value: string;
6
- label: string;
7
- };
8
- GRADIENT: {
9
- value: string;
10
- label: string;
11
- };
12
- };
13
- export declare const customColors: string[];
14
3
  export declare const App: () => React.JSX.Element;
package/es/test.js CHANGED
@@ -1,461 +1,111 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
1
10
  /* eslint-disable @typescript-eslint/no-unused-vars */
2
- import React, { useState } from 'react';
11
+ import React from 'react';
3
12
  import { createRoot } from 'react-dom/client';
4
13
  import '@antscorp/icons/main.css';
5
- import { ConfigProvider, InputDynamic, SettingWrapper, UploadImage, } from './components';
14
+ import { ConfigProvider, TemplateSaveAs, useTemplateSave } from './components';
15
+ // Constants
16
+ import { GET_LIST_TYPE, OBJECT_TYPES, PUBLIC_LEVEL } from './constants';
17
+ // import { Slider } from 'antd';
6
18
  // Queries configs
7
- import ContentSource from './components/organism/ContentSources';
19
+ import axios from 'axios';
20
+ import { get } from 'lodash';
21
+ import { MENU_PERMISSION } from './components/molecules/ShareAccess/constants';
8
22
  import { QueryClientProviderAntsomiUI, queryClientAntsomiUI } from './queries';
9
- export const BACKGROUND_COLOR_STYLE = {
10
- SOLID: {
11
- value: 'color',
12
- label: 'Solid',
13
- },
14
- GRADIENT: {
15
- value: 'gradient',
16
- label: 'Gradient',
17
- },
23
+ const SHARE_ACCESS_DEFAULT_VALUE = {
24
+ ownerId: 1600085510,
25
+ isPublic: 1,
26
+ listAccess: [
27
+ {
28
+ userId: 1600085510,
29
+ role: 1,
30
+ email: 'vinlt@antsomi.com',
31
+ avatar: '//c0-platform.ants.tech/avatar/2023/05/04/b3rg0ye8oa.png',
32
+ fullName: 'Truong Vi',
33
+ allowEdit: 1,
34
+ allowView: 1,
35
+ allowComment: 1,
36
+ },
37
+ {
38
+ userId: 1600085513,
39
+ role: 2,
40
+ email: 'vinlt@antsomi.com',
41
+ avatar: '//c0-platform.ants.tech/avatar/2023/05/04/b3rg0ye8oa.png',
42
+ fullName: 'Truong Vi 2',
43
+ allowEdit: 0,
44
+ allowView: 0,
45
+ allowComment: 1,
46
+ },
47
+ ],
48
+ publicRole: null,
18
49
  };
19
- const DOMAIN_MEDIA_SANDBOX = 'https://sandbox-media-template.antsomi.com/cdp';
20
- export const customColors = [
21
- '#f7da64',
22
- '#8912dd',
23
- '#ed1515',
24
- '#230439',
25
- '#d11a66',
26
- '#ffbd64',
27
- '#f1ab96',
28
- '#824ccd',
29
- '#5858e9',
30
- '#57b8c2',
50
+ const thumbnailPortrait = [
51
+ 'https://images.unsplash.com/photo-1515734674582-29010bb37906?q=80&w=1887&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D',
52
+ 'https://images.unsplash.com/photo-1571423483570-eb27018d1ec0?q=80&w=1887&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D',
53
+ 'https://images.creativefabrica.com/products/previews/2023/11/03/jG9YjMvHg/2XfoTnjLlEvPMgjGeu0VIDk96mr-desktop.jpg',
54
+ ];
55
+ // const thumbnailPortrait = [];
56
+ const thumbnailLandscape = [
57
+ 'https://images.creativefabrica.com/products/previews/2023/10/27/mWT9IwQN7/2XL1J9SW0srS03MukpeIzEyg2Hb-desktop.jpg',
58
+ 'https://thedaily.case.edu/wp-content/uploads/2023/06/underwater-view-1024x439.jpg',
59
+ 'https://images.unsplash.com/photo-1502134249126-9f3755a50d78?q=80&w=1770&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D',
31
60
  ];
61
+ const thumbnails = [...thumbnailPortrait, ...thumbnailLandscape];
62
+ const userId = 1600084823;
63
+ const network_id = 33167;
64
+ const token = '5474r2x214z294d4v284y4b4q4l5g406y2r2y2n4f5';
65
+ const getUserInfos = (email) => __awaiter(void 0, void 0, void 0, function* () {
66
+ const type = 'search-user-info';
67
+ const res = yield axios.get(`https://permission.antsomi.com/api/account/info?userId=${userId}&network_id=${network_id}&_token=${token}&_user_id=${userId}&_account_id=${userId}&_lang=en&type=${type}&email=${email}`, {
68
+ method: 'GET',
69
+ });
70
+ const data = get(res, 'data.data');
71
+ return data;
72
+ });
32
73
  export const App = () => {
33
- // const [valueShortlink, setValueShortlink] = useState('#{shortlink(https://test.com.vn)}');
34
- const [valueShortlink, setValueShortlink] = useState('');
35
- const [state, setState] = useState({
36
- option: {
37
- dateType: 'today',
38
- calculationDate: 'years',
39
- calculationType: 'minus',
40
- value: 1,
74
+ const { categoryItems, templateItems, value: templateValue, onChange: onChangeValue, searchNameProps, form, } = useTemplateSave({
75
+ service: {
76
+ url: 'https://sandbox-media-template.antsomi.com/cdp/api/v1',
77
+ token: '5474r2x214z254a4u2a4y444m4j5p27444c4h4h4n5t5',
78
+ userId: '1600080515',
79
+ accountId: '1600080515',
41
80
  },
42
- date: '',
43
- format: 'YYYYMMDD',
44
- });
45
- const [colorSettingState, setColorSettingState] = useState({
46
- color: 'green',
47
- customColors,
48
- });
49
- const [stateSlideBar, setStateSlideBar] = useState({
50
- errors: [],
51
- disabled: true,
52
- prefix: 'Item',
53
- isViewMode: false,
54
- isShowAdd: true,
55
- limit: {
56
- min: 1,
57
- max: 2,
81
+ config: {
82
+ getListType: GET_LIST_TYPE.OWNER,
83
+ objectType: OBJECT_TYPES.MEDIA_TEMPLATE,
84
+ publicLevel: PUBLIC_LEVEL.RESTRICTED,
85
+ limitListPerPage: 20,
86
+ },
87
+ defaultValue: {
88
+ accessInfo: SHARE_ACCESS_DEFAULT_VALUE,
89
+ saveOption: 'save-new',
58
90
  },
59
- activeId: '1',
60
- options: Array.from({ length: 5 }, (_, index) => ({
61
- label: `Item ${index + 1}`,
62
- value: `${index + 1}`,
63
- })),
64
- isShowLabelSequentially: false,
65
91
  });
66
- const [radioValue, setRadioValue] = useState('color');
67
- const [sliderValue, setSliderValue] = useState(10);
68
- const [edge, setEdge] = useState(['auto', 'auto', 700, 700]);
69
- const [icon, setIcon] = useState('');
70
- // const {
71
- // categoryItems,
72
- // templateItems,
73
- // checkedCategories,
74
- // openCategoryKeys,
75
- // isLoadingCategoryList,
76
- // isLoadingTemplateList,
77
- // onLoadMore: onLoadMoreTemplates,
78
- // onChangeOpenCategoryKeys,
79
- // onChangeCheckedCategories,
80
- // onRemoveObjectTemplate,
81
- // } = useTemplateListing({
82
- // serviceAuth: {
83
- // url: 'https://sandbox-media-template.antsomi.com/cdp/api/v1',
84
- // token: '5474r2x214z254a4u2a4y444m4j5p27444c4h4h4n5t5',
85
- // userId: '1600080515',
86
- // accountId: '1600080515',
87
- // },
88
- // config: {
89
- // getListType: GET_LIST_TYPE.OWNER,
90
- // objectType: 1,
91
- // publicLevel: 0,
92
- // limitListPerPage: 10,
93
- // },
94
- // checkedCategoriesDefault: {
95
- // device_type: [1, 2],
96
- // template_type: [1, 2, 3, 4, 5],
97
- // },
98
- // });
99
- //
100
- const callbackColorSetting = (key, dataIn) => {
101
- switch (key) {
102
- case 'ON_ADD_NEW_PRESET':
103
- // eslint-disable-next-line no-case-declarations
104
- const { customColors = [] } = dataIn;
105
- setColorSettingState(prev => (Object.assign(Object.assign({}, prev), { customColors })));
106
- break;
107
- case 'ON_EDIT_CLICKED': {
108
- // eslint-disable-next-line no-console
109
- console.log('insideee.dev - clicked edit preset :>');
110
- break;
111
- }
112
- default:
113
- break;
114
- }
115
- };
116
- const handleChangeColorSetting = (colorOut) => {
117
- setColorSettingState(prev => (Object.assign(Object.assign({}, prev), { color: colorOut })));
118
- };
119
- const handleChangeRadio = e => {
120
- const { value = '' } = e.target;
121
- setRadioValue(value);
122
- };
123
- const handleChangeSlider = value => {
124
- setSliderValue(value);
125
- };
126
- const handleSetIcon = value => {
127
- setIcon(value);
128
- };
129
- const callbackSlideBar = (type, data) => {
130
- console.log({ type, data });
131
- };
132
- // --------------------------- Test SlideBar start -------------------------------------------
133
- // return (
134
- // <div
135
- // style={{
136
- // width: 500,
137
- // height: 500,
138
- // border: '1px solid black',
139
- // margin: '0 auto',
140
- // padding: 12,
141
- // borderRadius: '10px',
142
- // }}
143
- // >
144
- // <SlideBar {...stateSlideBar} callback={callbackSlideBar} />
145
- // </div>
146
- // );
147
- // --------------------------- Test SlideBar end -------------------------------------------
148
- // ---------------------------- Test Input Dynamic start ------------------------------
149
- // return (
150
- // <div
151
- // style={{
152
- // width: 500,
153
- // height: 500,
154
- // border: '1px solid black',
155
- // margin: '0 auto',
156
- // padding: 12,
157
- // borderRadius: '10px',
158
- // }}
159
- // >
160
- // <InputDynamic
161
- // errors={[]}
162
- // onChange={dataOut => setValueShortlink(dataOut)}
163
- // onError={() => {}}
164
- // isViewMode={false}
165
- // canMultipleLine={false}
166
- // value={valueShortlink}
167
- // />
168
- // </div>
169
- // );
170
- return (React.createElement(QueryClientProviderAntsomiUI, { client: queryClientAntsomiUI },
171
- React.createElement("div", { style: {
172
- width: 500,
173
- height: 500,
174
- border: '1px solid black',
175
- margin: '0 auto',
176
- padding: 12,
177
- borderRadius: '10px',
178
- } },
179
- React.createElement(InputDynamic, { errors: [], onChange: dataOut => setValueShortlink(dataOut), onError: () => { }, isViewMode: false, canMultipleLine: false, allowDynamicOptions: ['addPersonalization', 'shortlink'], value: valueShortlink }),
180
- React.createElement(SettingWrapper, { vertical: true, label: "Background Image", containerStyle: { gap: '20px' } },
181
- React.createElement(UploadImage, { domainMedia: "https://sandbox-media-template.antsomi.com", slug: "cdp/api/v1", labelButtonSelect: "Select Toggle from Computor", labelHeadingModal: "Toggle Selection", searchPlaceholder: "Search toggle", paramConfigs: {
182
- token: '5474r2x214z294b423a4y474d4j5q274p4g494f4k5p5',
183
- userId: '1600084695',
184
- accountId: '1600084695',
185
- },
186
- // title="Background Image"
187
- selectedImage: {
188
- url: 'https://th.bing.com/th?id=OSK.8664d1b5838c79a3d74a3e97739978b5&w=148&h=148&c=7&o=6&dpr=2&pid=SANGAM',
189
- }, onChangeImage: image => { }, onRemoveImage: () => {
190
- // onChangeSettings('backgroundImageObj', {
191
- // name: '',
192
- // previewUrl: '',
193
- // });
194
- } })))));
195
- // --------------------------- Test SlideBar end -------------------------------------------
196
- // ---------------------------- Test Input Dynamic start ------------------------------
197
- // return (
198
- // <div
199
- // style={{
200
- // width: 500,
201
- // height: 500,
202
- // border: '1px solid black',
203
- // margin: '0 auto',
204
- // padding: 12,
205
- // borderRadius: '10px',
206
- // }}
207
- // >
208
- // <SlideBar {...stateSlideBar} callback={callbackSlideBar} />
209
- // </div>
210
- // );
211
- // --------------------------- Test SlideBar end -------------------------------------------
212
- // --------------------------- Test Content Source start ----------------------------------
213
- return (React.createElement("div", { style: {
214
- width: 500,
215
- height: 500,
216
- border: '1px solid black',
217
- margin: '0 auto',
218
- padding: 12,
219
- borderRadius: '10px',
220
- } },
221
- React.createElement(ContentSource, { serviceAuth: {
222
- url: 'https://sandbox-media-template.antsomi.com/cdp/api/v1',
223
- token: '5474r2x214z2a4b403e4y4x5r4w524z5f4j464n4f5w5',
224
- userId: '1600085679',
225
- accountId: '1600085679',
226
- } })));
227
- // --------------------------- Test Content Source end ----------------------------------
228
- // ---------------------------- Test Input Dynamic start ------------------------------
229
- return (React.createElement("div", { style: {
230
- width: 500,
231
- height: 500,
232
- border: '1px solid black',
233
- margin: '0 auto',
234
- padding: 12,
235
- borderRadius: '10px',
236
- } },
237
- React.createElement(InputDynamic, { errors: [], onChange: dataOut => setValueShortlink(dataOut), onError: () => { }, isRealTime: true, isViewMode: false, canMultipleLine: false, value: valueShortlink })));
238
- // ---------------------------- Test Input Dynamic End ------------------------------
239
- // ---------------------------- Test Helps Start ------------------------------
240
- // return (
241
- // <div style={{ display: 'flex', justifyContent: 'center', width: '100vw', height: '100vh' }}>
242
- // <Help />
243
- // </div>
244
- // );
245
- // ---------------------------- Test Helps End ------------------------------
246
- // ------------------------ Media template components test start -------------------------
247
- // return (
248
- // <ConfigProvider>
249
- // <div
250
- // style={{
251
- // width: 500,
252
- // height: 1000,
253
- // border: '1px solid black',
254
- // margin: '0 auto',
255
- // padding: 12,
256
- // borderRadius: '10px',
257
- // marginTop: 12,
258
- // }}
259
- // >
260
- // <h2 style={{ textAlign: 'center' }}>Test component of media template</h2>
261
- // <Space size={20} direction="vertical">
262
- // {/* <SettingWrapper vertical label="Color Setting">
263
- // <ColorSetting
264
- // label="Background Color"
265
- // labelStyling={{ color: THEME.token?.colorIcon }}
266
- // color={colorSettingState.color}
267
- // customColors={colorSettingState.customColors}
268
- // callback={callbackColorSetting}
269
- // onChange={handleChangeColorSetting}
270
- // />
271
- // </SettingWrapper>
272
- // <SettingWrapper vertical label="Input number with unit">
273
- // <InputNumberWithUnit
274
- // unit="px"
275
- // min={0}
276
- // max={2000}
277
- // value={700}
278
- // onChange={value => {
279
- // console.log('onChange:: ', value);
280
- // }}
281
- // onChangeUnit={unit => {
282
- // console.log('onChangeUnit:: ', unit);
283
- // }}
284
- // />
285
- // </SettingWrapper>
286
- // <SettingWrapper label="Radio Group">
287
- // <RadioGroup
288
- // options={Object.values(BACKGROUND_COLOR_STYLE)}
289
- // value={radioValue}
290
- // onChange={e => handleChangeRadio(e)}
291
- // />
292
- // </SettingWrapper> */}
293
- // <SettingWrapper vertical label="Color Setting">
294
- // <GradientSetting />
295
- // </SettingWrapper>
296
- // <SliderWithInputNumber
297
- // label="Size (px)"
298
- // labelStyling={{ marginTop: 10 }}
299
- // min={0}
300
- // max={100}
301
- // value={sliderValue}
302
- // onAfterChange={handleChangeSlider}
303
- // />
304
- // <EdgeSetting
305
- // label="Notification Spacing"
306
- // unit="px"
307
- // linked={false}
308
- // values={edge}
309
- // // edgeLabels={[t(translations.column.title), t(translations.row.title)]}
310
- // onChange={({ values, linked, unit }) => {
311
- // setEdge(values);
312
- // // onUpdateSettings({
313
- // // gapX: values[0] + unit,
314
- // // gapY: values[1] + unit,
315
- // // gapSuffix: unit,
316
- // // linkedGapInput: linked,
317
- // // });
318
- // }}
319
- // />
320
- // <PositionSetting
321
- // settings={{ linkedPositionInput: false, positionSuffix: 'px' }}
322
- // styles={{ top: '10px', right: '20px', bottom: '30', left: '40' }}
323
- // onChange={() => {}}
324
- // />
325
- // </Space>
326
- // <Space size={10} direction="vertical">
327
- // <SettingWrapper vertical label="Background Image" containerStyle={{ gap: '20px' }}>
328
- // <UploadImage
329
- // domainMedia="https://sandbox-media-template.antsomi.com"
330
- // slug="cdp/api/v1"
331
- // labelButtonSelect="Select Toggle from Computor"
332
- // labelHeadingModal="Toggle Selection"
333
- // searchPlaceholder="Search toggle"
334
- // paramConfigs={{
335
- // token: '5474r2x214z294b423a4y474d4j5q274p4g494f4k5p5',
336
- // userId: '1600084695',
337
- // accountId: '1600084695',
338
- // }}
339
- // // title="Background Image"
340
- // selectedImage={{
341
- // url: 'https://th.bing.com/th?id=OSK.8664d1b5838c79a3d74a3e97739978b5&w=148&h=148&c=7&o=6&dpr=2&pid=SANGAM',
342
- // }}
343
- // onChangeImage={image =>
344
- // // onChangeSettings('backgroundImageObj', {
345
- // // name: image.name,
346
- // // previewUrl: image.url,
347
- // // })
348
- // {}
349
- // }
350
- // onRemoveImage={() => {
351
- // // onChangeSettings('backgroundImageObj', {
352
- // // name: '',
353
- // // previewUrl: '',
354
- // // });
355
- // }}
356
- // />
357
- // </SettingWrapper>
358
- // <SettingWrapper vertical label="Icon">
359
- // <IconSelection
360
- // isOpen={false}
361
- // labelHeadingModal="Toggle Selection"
362
- // searchPlaceholder="Search for toggle..."
363
- // icon={icon}
364
- // onChange={handleSetIcon}
365
- // iconTypes={['cus', 'font-awesome']}
366
- // onChangeSvg={value => {
367
- // console.log('onChangeSvg', value);
368
- // }}
369
- // />
370
- // </SettingWrapper>
371
- // </Space>
372
- // </div>
373
- // </ConfigProvider>
374
- // );
375
- // const [time, setTime] = useState<string[]>([]);
376
- // const [times, setTimes] = useState<Value>({
377
- // rangeInfo: { type: 'last_14_days' },
378
- // rangeValue: [{ start: null, end: null }],
379
- // });
380
- // return (
381
- // <ConfigProvider>
382
- // <div
383
- // style={{
384
- // width: 500,
385
- // height: 1000,
386
- // border: '1px solid black',
387
- // margin: '0 auto',
388
- // padding: 12,
389
- // borderRadius: '10px',
390
- // marginTop: 12,
391
- // }}
392
- // >
393
- // <h2 style={{ textAlign: 'center' }}>Test component of media template</h2>
394
- // <CalendarSelection
395
- // value={times}
396
- // onChange={(value, info) => {
397
- // console.log({ info, value });
398
- // // setTime([value.rangeValue[0].start, value.rangeValue[0].end]);
399
- // setTimes(value);
400
- // }}
401
- // />
402
- // </div>
403
- // </ConfigProvider>
404
- // );
405
- // ------------------------ Media template components test end -------------------------
406
- // return (
407
- // <div style={{ width: '500px', margin: '32px' }}>
408
- // <GradientSetting onChange={e => console.log('gradient change')} />
409
- // <br />
410
- // <br />
411
- // <br />
412
- // <br />
413
- // <Slider
414
- // className="test-classname"
415
- // min={-10}
416
- // max={10}
417
- // onChange={e => console.log('slider change', e)}
418
- // />
419
- // <br />
420
- // <br />
421
- // <Rate />
422
- // <br />
423
- // <br />
424
- // <Slider className="test-classname" />
425
- // </div>
426
- // );
427
- // ------------------------ Template Listing test -------------------------
428
- // return (
429
- // <div
430
- // style={{
431
- // height: '50vh',
432
- // }}
433
- // >
434
- // <TemplateListing
435
- // templatesProps={{
436
- // items: templateItems,
437
- // loading: isLoadingTemplateList,
438
- // onLoadMoreTemplates,
439
- // }}
440
- // categoryListingProps={{
441
- // loading: isLoadingCategoryList,
442
- // items: categoryItems,
443
- // checkedCategories,
444
- // openKeys: openCategoryKeys,
445
- // onOpenChange: onChangeOpenCategoryKeys,
446
- // onMenuChange: onChangeCheckedCategories,
447
- // }}
448
- // templateItemProps={{
449
- // removeModalProps: {
450
- // // onOk
451
- // onOk: onRemoveObjectTemplate,
452
- // },
453
- // }}
454
- // />
455
- // </div>
456
- // );
92
+ return (React.createElement(TemplateSaveAs, { form: form, imageReview: {
93
+ thumbnails,
94
+ skeleton: true,
95
+ }, categories: categoryItems, templateNames: templateItems, shareAccess: {
96
+ show: true,
97
+ userId: 1600085510,
98
+ userPermission: {
99
+ edit: MENU_PERMISSION.CREATED_BY_USER,
100
+ view: MENU_PERMISSION.NONE,
101
+ },
102
+ getUserInfo: getUserInfos,
103
+ }, templateNamesOptions: Object.assign({}, searchNameProps), value: templateValue, onChange: value => {
104
+ onChangeValue(value);
105
+ } }));
457
106
  };
458
107
  const container = document.getElementById('root');
459
108
  const root = createRoot(container);
460
- root.render(React.createElement(ConfigProvider, { locale: "en" },
461
- React.createElement(App, null)));
109
+ root.render(React.createElement(QueryClientProviderAntsomiUI, { client: queryClientAntsomiUI },
110
+ React.createElement(ConfigProvider, { locale: "en" },
111
+ React.createElement(App, null))));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antscorp/antsomi-ui",
3
- "version": "1.3.5-beta.142",
3
+ "version": "1.3.5-beta.144",
4
4
  "description": "An enterprise-class UI design language and React UI library.",
5
5
  "sideEffects": [
6
6
  "dist/*",