@antscorp/antsomi-ui 1.3.5-beta.143 → 1.3.5-beta.145

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.
@@ -178,7 +178,7 @@ export const TemplateSaveAs = props => {
178
178
  })
179
179
  : null),
180
180
  isShowShareAccess ? (React.createElement("div", { className: "share-access-container" },
181
- React.createElement(ShareAccess, Object.assign({ accessInfo: accessInfo, excludeUserAccess: ['to_editor'], generalAccessSettings: {
181
+ React.createElement(ShareAccess, Object.assign({ accessInfo: accessInfo, excludeUserAccess: ['to_editor', 'to_owner'], generalAccessSettings: {
182
182
  publicOnlyWith: true,
183
183
  }, onChange: value => handleChangeValue({ accessInfo: value }) }, shareAccessProps)))) : null))));
184
184
  };
@@ -34,7 +34,10 @@ export const TemplateSaveAsModal = props => {
34
34
  }
35
35
  };
36
36
  const handleOk = (event) => {
37
- if (onOk && (!errors || errors.length === 0)) {
37
+ var _a;
38
+ // Check form errors
39
+ const isError = ((_a = restTemplateProps.form) === null || _a === void 0 ? void 0 : _a.getFieldsError().some(field => field.errors.length)) || false;
40
+ if (onOk && (!errors || errors.length === 0) && !isError) {
38
41
  // NOTE: If there are templateValue and onChange => controlled component => return templateValue
39
42
  onOk(event, templateValue && onChange ? templateValue : internalValue);
40
43
  }
@@ -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'))));
@@ -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
  });
@@ -61,7 +61,7 @@ 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) => Promise<void>;
64
+ validateName: (rule: RuleObject, value: any, callback?: any) => Promise<void>;
65
65
  };
66
66
  form: import("antd").FormInstance<any>;
67
67
  errors: any[] | undefined;
@@ -96,7 +96,7 @@ export const useTemplateSave = (options) => {
96
96
  setValue(valueArg || {});
97
97
  };
98
98
  /* Validate Template Name */
99
- const validateName = (rule, value) => __awaiter(void 0, void 0, void 0, function* () {
99
+ const validateName = (rule, value, callback) => __awaiter(void 0, void 0, void 0, function* () {
100
100
  if (!value)
101
101
  return;
102
102
  const response = yield validateTemplateName({
@@ -140,7 +140,8 @@ export const useTemplateListing = (options) => {
140
140
  return undefined;
141
141
  }, [infiniteObjectTemplate, selectedTemplateId]);
142
142
  const categoryItems = useDeepCompareMemo(() => {
143
- const recursiveCategory = (categories = [], parentCategoryCode = '') => categories.map(category => {
143
+ const recursiveCategory = (categories = [], parentCategoryCode = '') => categories
144
+ .map(category => {
144
145
  const { categoryCode, categoryId, categoryName, children, total } = category;
145
146
  const key = Array.isArray(children) && children.length
146
147
  ? categoryCode
@@ -151,6 +152,13 @@ export const useTemplateListing = (options) => {
151
152
  total,
152
153
  children: recursiveCategory(children || [], categoryCode),
153
154
  };
155
+ })
156
+ .filter(category => {
157
+ // Filter category has no children and total template is 0
158
+ if (isEmpty(category.children) && !category.total) {
159
+ return false;
160
+ }
161
+ return true;
154
162
  });
155
163
  return recursiveCategory(categoryList || []);
156
164
  }, [categoryList]);
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,163 @@
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
11
  import React, { useState } 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 { Button, ConfigProvider, TemplateSaveAsModal, 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: onChangeTemplateValue, 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',
92
+ const [isOpenSaveTemplate, setIsOpenSaveTemplate] = useState(false);
93
+ return (
94
+ // <TemplateSaveAs
95
+ // form={form}
96
+ // imageReview={{
97
+ // thumbnails,
98
+ // skeleton: true,
99
+ // }}
100
+ // categories={categoryItems}
101
+ // templateNames={templateItems}
102
+ // shareAccess={{
103
+ // show: true,
104
+ // userId: 1600085510,
105
+ // userPermission: {
106
+ // edit: MENU_PERMISSION.CREATED_BY_USER,
107
+ // view: MENU_PERMISSION.NONE,
108
+ // },
109
+ // getUserInfo: getUserInfos,
110
+ // }}
111
+ // templateNamesOptions={{
112
+ // ...searchNameProps,
113
+ // }}
114
+ // value={templateValue}
115
+ // onChange={value => {
116
+ // onChangeValue(value);
117
+ // }}
118
+ // />
119
+ React.createElement(React.Fragment, null,
120
+ React.createElement(Button, { onClick: () => setIsOpenSaveTemplate(true) }, "Open Modal"),
121
+ React.createElement(TemplateSaveAsModal, { open: isOpenSaveTemplate, okButtonProps: { loading: false }, cancelButtonProps: { disabled: false },
122
+ // onCancel={() => {
123
+ // !loadingPersistTemplate && handleCancel();
124
+ // }}
125
+ onOk: (e, value) => {
126
+ console.log('e');
127
+ }, templateProps: {
128
+ form,
129
+ value: templateValue,
130
+ onChange: onChangeTemplateValue,
131
+ // onEvent: event => {
132
+ // if (event.templateName && event.templateName.id)
133
+ // setSelectedTemplate(event.templateName.id.toString());
134
+ // },
135
+ imageReview: {
136
+ thumbnails: [],
137
+ skeleton: true,
138
+ },
139
+ templateNames: templateItems,
140
+ categories: categoryItems,
141
+ omitCategories: ['device_type', 'template_type'],
142
+ shareAccess: {
143
+ // getUserInfo: email => permissionServices.getUserInfo(email, userInfo?.user_id!) as any,
144
+ show: true,
145
+ // userId: +userInfo?.user_id!,
146
+ userPermission: {
147
+ edit: MENU_PERMISSION.CREATED_BY_USER,
148
+ view: MENU_PERMISSION.CREATED_BY_USER,
149
+ },
150
+ placeholder: 'Add people',
151
+ generalAccessSettings: {
152
+ publicOnlyWith: true,
153
+ },
154
+ allowAddUser: true,
155
+ },
156
+ templateNamesOptions: Object.assign({}, searchNameProps),
226
157
  } })));
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
- // );
457
158
  };
458
159
  const container = document.getElementById('root');
459
160
  const root = createRoot(container);
460
- root.render(React.createElement(ConfigProvider, { locale: "en" },
461
- React.createElement(App, null)));
161
+ root.render(React.createElement(QueryClientProviderAntsomiUI, { client: queryClientAntsomiUI },
162
+ React.createElement(ConfigProvider, { locale: "en" },
163
+ 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.143",
3
+ "version": "1.3.5-beta.145",
4
4
  "description": "An enterprise-class UI design language and React UI library.",
5
5
  "sideEffects": [
6
6
  "dist/*",