@antscorp/antsomi-ui 1.3.5-beta.972 → 1.3.5-beta.975
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/AddDynamicContent/components/DisplayFormat/DisplayFormat.d.ts +1 -0
- package/es/components/molecules/DisplayFormat/DisplayFormatSettings.js +31 -5
- package/es/components/molecules/DisplayFormat/components/FormatNumber.js +3 -5
- package/es/components/molecules/DisplayFormat/constants.d.ts +21 -0
- package/es/components/molecules/DisplayFormat/constants.js +65 -0
- package/es/components/molecules/TagifyInput/patternHandlers.js +35 -41
- package/es/components/template/TemplateListing/Loadable.d.ts +1 -0
- package/package.json +2 -2
|
@@ -5,7 +5,7 @@ import { translate, translations } from '@antscorp/antsomi-locales';
|
|
|
5
5
|
// Components
|
|
6
6
|
import { FormatDatetime, FormatNumber, } from './components';
|
|
7
7
|
import { EditIcon } from '../../icons';
|
|
8
|
-
import { Button,
|
|
8
|
+
import { Button, Typography } from '../../atoms';
|
|
9
9
|
// Utils
|
|
10
10
|
import { formatDatetimeDF, formatNumberDF } from './utils';
|
|
11
11
|
// Constants
|
|
@@ -43,14 +43,40 @@ export const DisplayFormatSettings = props => {
|
|
|
43
43
|
if (displayFormatType === 'datetime') {
|
|
44
44
|
formatDFValue = formatDatetimeDF(DATE_TIME_EXAMPLE, settings);
|
|
45
45
|
}
|
|
46
|
-
return (_jsxs("div", { className: "ants-flex ants-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
46
|
+
return (_jsxs("div", { className: "ants-flex ants-items-center ants-gap-2 ant-flex-row", style: {
|
|
47
|
+
display: 'flex',
|
|
48
|
+
alignItems: 'center',
|
|
49
|
+
gap: '8px',
|
|
50
|
+
marginBottom: '5px',
|
|
51
|
+
flexShrink: 0,
|
|
52
|
+
width: '100%',
|
|
53
|
+
flexWrap: 'nowrap',
|
|
54
|
+
overflow: 'hidden',
|
|
55
|
+
marginTop: '5px',
|
|
56
|
+
}, ...rest, children: [_jsxs(Typography.Text
|
|
57
|
+
// size={11}
|
|
58
|
+
, {
|
|
59
|
+
// size={11}
|
|
60
|
+
className: "ants-flex", style: {
|
|
61
|
+
color: '#7F7F7F',
|
|
62
|
+
fontSize: '11px',
|
|
63
|
+
whiteSpace: 'nowrap',
|
|
64
|
+
maxWidth: 'calc(89%)',
|
|
65
|
+
}, children: [translate(translations._ACT_PREVIEW), ": \u00A0", _jsx(Typography.Text, { style: {
|
|
66
|
+
color: '#7F7F7F',
|
|
67
|
+
fontSize: '11px',
|
|
68
|
+
whiteSpace: 'nowrap',
|
|
69
|
+
maxWidth: 'calc(81%)',
|
|
70
|
+
}, ellipsis: { tooltip: true }, children: _jsx("bdo", { dir: "ltr", children: formatDFValue }) })] }), _jsx(Button, { disabled: disabled, size: "small", icon: _jsx(EditIcon, { width: 16, height: 16, color: "#005EB8" }), className: "ants-border-none",
|
|
71
|
+
// className={`ants-border-none transition-colors duration-300 rounded-md ${
|
|
72
|
+
// showDetailEdit ? 'bg-[#DEEFFE]' : 'hover:bg-[#E0F2FE]'
|
|
73
|
+
// }`}
|
|
74
|
+
style: {
|
|
50
75
|
backgroundColor: showDetailEdit ? '#DEEFFE' : 'transparent',
|
|
51
76
|
border: 'none',
|
|
52
77
|
boxShadow: 'none',
|
|
53
78
|
borderRadius: '5px',
|
|
79
|
+
flexShrink: 0,
|
|
54
80
|
}, onClick: () => setShowDetailEdit(prevShow => !prevShow) })] }));
|
|
55
81
|
};
|
|
56
82
|
const renderFormatSetting = () => {
|
|
@@ -112,18 +112,16 @@ export const FormatNumber = (props) => {
|
|
|
112
112
|
...settingValues,
|
|
113
113
|
isCompact: checked,
|
|
114
114
|
});
|
|
115
|
-
}, children:
|
|
115
|
+
}, children: translate(translations._TITL_EDIT_NUMBER_COMPACT) }) }), _jsx(Form.Item, { label: decimalPlacesLabel, style: { marginBottom: 12 }, colon: false, labelCol: { span: 11 }, wrapperCol: { span: 13 }, children: _jsxs("div", { style: { display: 'flex', marginLeft: '55px', gap: '15px' }, children: [_jsx(Button, { style: { border: 'none', boxShadow: 'none', borderRadius: '5px' }, disabled: decimalPlaces <= 0, onClick: () => onChangeSettingsHandle({
|
|
116
116
|
...settingValues,
|
|
117
117
|
decimalPlaces: decimalPlaces - 1,
|
|
118
118
|
}), size: "small", icon: _jsx(DecreaseDecimalIcon, { color: "#005EB8", style: { padding: '2px' } }) }), _jsx(Button, { style: { border: 'none', boxShadow: 'none', borderRadius: '5px' }, onClick: () => onChangeSettingsHandle({
|
|
119
119
|
...settingValues,
|
|
120
120
|
decimalPlaces: decimalPlaces + 1,
|
|
121
|
-
}), size: "small", icon: _jsx(IncreaseDecimalIcon, { color: "#005EB8", style: { padding: '2px' } }) })] }) }), _jsx(Form.Item, { label: _jsxs(_Fragment, { children: [_jsx("span", { style: { marginRight: '6px' }, children: translate(translations._DISPLAY_GROUPING) }), _jsx(Tooltip, { placement: "top", title:
|
|
122
|
-
.groupingIconTooltipTitle), style: { marginLeft: 4, opacity: 0.4 }, children: _jsx(ViewDetailsInformationIcon, { size: 14 }) })] }), colon: false, labelCol: { span: 10 }, wrapperCol: { span: 14 }, children: _jsx(Select, { style: { width: 100 }, value: grouping, onChange: value => onChangeSettingsHandle({
|
|
121
|
+
}), size: "small", icon: _jsx(IncreaseDecimalIcon, { color: "#005EB8", style: { padding: '2px' } }) })] }) }), _jsx(Form.Item, { label: _jsxs(_Fragment, { children: [_jsx("span", { style: { marginRight: '6px' }, children: translate(translations._DISPLAY_GROUPING) }), _jsx(Tooltip, { placement: "top", title: translate(translations._TOOLTIP__DISPLAY_DECIMAL), style: { marginLeft: 4, opacity: 0.4 }, children: _jsx(ViewDetailsInformationIcon, { size: 14 }) })] }), colon: false, labelCol: { span: 10 }, wrapperCol: { span: 14 }, children: _jsx(Select, { style: { width: 100 }, value: grouping, onChange: value => onChangeSettingsHandle({
|
|
123
122
|
...settingValues,
|
|
124
123
|
grouping: value,
|
|
125
|
-
}), options: listGroupingSeparatorOptions }) }), _jsx(Form.Item, { label: _jsxs(_Fragment, { children: [_jsx("span", { style: { marginRight: '6px' }, children: translate(translations._DISPLAY_DECIMAL) }), _jsx(Tooltip, { placement: "top", title:
|
|
126
|
-
.decimalIconTooltipTitle), style: { marginLeft: 4, opacity: 0.4 }, children: _jsx(ViewDetailsInformationIcon, { size: 14 }) })] }), labelCol: { span: 10 }, wrapperCol: { span: 14 }, colon: false, children: _jsx(Select, { style: { width: 100 }, value: decimal, onChange: value => onChangeSettingsHandle({
|
|
124
|
+
}), options: listGroupingSeparatorOptions }) }), _jsx(Form.Item, { label: _jsxs(_Fragment, { children: [_jsx("span", { style: { marginRight: '6px' }, children: translate(translations._DISPLAY_DECIMAL) }), _jsx(Tooltip, { placement: "top", title: translate(translations._TOOLTIP__DISPLAY_GROUPING), style: { marginLeft: 4, opacity: 0.4 }, children: _jsx(ViewDetailsInformationIcon, { size: 14 }) })] }), labelCol: { span: 10 }, wrapperCol: { span: 14 }, colon: false, children: _jsx(Select, { style: { width: 100 }, value: decimal, onChange: value => onChangeSettingsHandle({
|
|
127
125
|
...settingValues,
|
|
128
126
|
decimal: value,
|
|
129
127
|
}), options: listDecimalSeparatorOptions }) })] }));
|
|
@@ -149,3 +149,24 @@ export declare const DYNAMIC_CONTENT_DF_FORMAT_TYPE: {
|
|
|
149
149
|
number: string;
|
|
150
150
|
datetime: string;
|
|
151
151
|
};
|
|
152
|
+
export declare const TYPE_FORMAT_OPTIONS: {
|
|
153
|
+
SHORT: string;
|
|
154
|
+
MEDIUM: string;
|
|
155
|
+
LONG: string;
|
|
156
|
+
};
|
|
157
|
+
export declare const DATE_FORMAT_LIST_TEST: {
|
|
158
|
+
[x: string]: {
|
|
159
|
+
[x: string]: {
|
|
160
|
+
label: string;
|
|
161
|
+
value: string;
|
|
162
|
+
};
|
|
163
|
+
};
|
|
164
|
+
};
|
|
165
|
+
export declare const TIME_FORMAT_LIST_TEST: {
|
|
166
|
+
[x: string]: {
|
|
167
|
+
[x: string]: {
|
|
168
|
+
label: string;
|
|
169
|
+
value: string;
|
|
170
|
+
};
|
|
171
|
+
};
|
|
172
|
+
};
|
|
@@ -239,3 +239,68 @@ export const DYNAMIC_CONTENT_DF_FORMAT_TYPE = {
|
|
|
239
239
|
number: 'number',
|
|
240
240
|
datetime: 'datetime',
|
|
241
241
|
};
|
|
242
|
+
export const TYPE_FORMAT_OPTIONS = {
|
|
243
|
+
SHORT: 'short',
|
|
244
|
+
MEDIUM: 'medium',
|
|
245
|
+
LONG: 'long',
|
|
246
|
+
};
|
|
247
|
+
export const DATE_FORMAT_LIST_TEST = {
|
|
248
|
+
[DATE_FORMAT_OPTIONS[0].value]: {
|
|
249
|
+
[TYPE_FORMAT_OPTIONS.SHORT]: {
|
|
250
|
+
label: translate(translations._DATE_SHORT_FORMAT1),
|
|
251
|
+
value: 'MM/DD/YYYY',
|
|
252
|
+
},
|
|
253
|
+
[TYPE_FORMAT_OPTIONS.MEDIUM]: {
|
|
254
|
+
label: translate(translations._DATE_MEDIUM_FORMAT1),
|
|
255
|
+
value: 'MMM DD, YYYY',
|
|
256
|
+
},
|
|
257
|
+
[TYPE_FORMAT_OPTIONS.LONG]: {
|
|
258
|
+
label: translate(translations._DATE_LONG_FORMAT1),
|
|
259
|
+
value: 'MMMM DD, YYYY',
|
|
260
|
+
},
|
|
261
|
+
},
|
|
262
|
+
[DATE_FORMAT_OPTIONS[1].value]: {
|
|
263
|
+
[TYPE_FORMAT_OPTIONS.SHORT]: {
|
|
264
|
+
label: translate(translations._DATE_SHORT_FORMAT2),
|
|
265
|
+
value: 'DD/MM/YYYY',
|
|
266
|
+
},
|
|
267
|
+
[TYPE_FORMAT_OPTIONS.MEDIUM]: {
|
|
268
|
+
label: translate(translations._DATE_MEDIUM_FORMAT2),
|
|
269
|
+
value: 'DD MMM, YYYY',
|
|
270
|
+
},
|
|
271
|
+
[TYPE_FORMAT_OPTIONS.LONG]: {
|
|
272
|
+
label: translate(translations._DATE_LONG_FORMAT2),
|
|
273
|
+
value: 'DD MMMM, YYYY',
|
|
274
|
+
},
|
|
275
|
+
},
|
|
276
|
+
};
|
|
277
|
+
export const TIME_FORMAT_LIST_TEST = {
|
|
278
|
+
[TIME_FORMAT_OPTIONS[0].value]: {
|
|
279
|
+
[TYPE_FORMAT_OPTIONS.SHORT]: {
|
|
280
|
+
label: translate(translations._TIME_SHORT_FOTMAT1),
|
|
281
|
+
value: 'h:mm A',
|
|
282
|
+
},
|
|
283
|
+
[TYPE_FORMAT_OPTIONS.MEDIUM]: {
|
|
284
|
+
label: translate(translations._TIME_MEDIUM_FORMAT1),
|
|
285
|
+
value: 'h:mm:ss A',
|
|
286
|
+
},
|
|
287
|
+
[TYPE_FORMAT_OPTIONS.LONG]: {
|
|
288
|
+
label: translate(translations._TIME_LONG_FORMAT1),
|
|
289
|
+
value: 'h:mm:ss A [GMT]',
|
|
290
|
+
},
|
|
291
|
+
},
|
|
292
|
+
[TIME_FORMAT_OPTIONS[1].value]: {
|
|
293
|
+
[TYPE_FORMAT_OPTIONS.SHORT]: {
|
|
294
|
+
label: translate(translations._TIME_SHORT_FOTMAT2),
|
|
295
|
+
value: 'H:mm',
|
|
296
|
+
},
|
|
297
|
+
[TYPE_FORMAT_OPTIONS.MEDIUM]: {
|
|
298
|
+
label: translate(translations._TIME_MEDIUM_FORMAT2),
|
|
299
|
+
value: 'H:mm:ss',
|
|
300
|
+
},
|
|
301
|
+
[TYPE_FORMAT_OPTIONS.LONG]: {
|
|
302
|
+
label: translate(translations._TIME_LONG_FORMAT2),
|
|
303
|
+
value: 'H:mm:ss [GMT]',
|
|
304
|
+
},
|
|
305
|
+
},
|
|
306
|
+
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/* eslint-disable no-cond-assign */
|
|
2
2
|
/* eslint-disable no-console */
|
|
3
3
|
// Libraries
|
|
4
|
-
import { has } from 'lodash';
|
|
4
|
+
import { get, has } from 'lodash';
|
|
5
5
|
import { translate, translations } from '@antscorp/antsomi-locales';
|
|
6
6
|
// Utils
|
|
7
7
|
import { errorWrapper } from './errorWrapper';
|
|
@@ -261,7 +261,7 @@ export const getPersonalizeTagInfo = (originalTag, mapAttributes, mapErrorAttrib
|
|
|
261
261
|
true,
|
|
262
262
|
false,
|
|
263
263
|
];
|
|
264
|
-
if (!has(mapAttributes, type) && !has(tagProperties,
|
|
264
|
+
if (!has(mapAttributes, type) && !has(tagProperties, attributeName) && !isCsGroup) {
|
|
265
265
|
// return fallback if no mapping
|
|
266
266
|
return {
|
|
267
267
|
type,
|
|
@@ -279,55 +279,49 @@ export const getPersonalizeTagInfo = (originalTag, mapAttributes, mapErrorAttrib
|
|
|
279
279
|
const label = isCsGroup
|
|
280
280
|
? getContentSourceLabel(attributeName, subAttributeName, mapAttributes)
|
|
281
281
|
: getLabelAttribute(type, attributeName, subAttributeName, mapAttributes);
|
|
282
|
-
|
|
282
|
+
const tagType = type === CUSTOM_TAG ? get(tagProperties, [attributeName, 'type']) : type;
|
|
283
|
+
switch (tagType) {
|
|
283
284
|
case PROMOTION_CODE: {
|
|
284
|
-
|
|
285
|
-
const isExistPromotionPool = has(mapAttributes, [type, attributeName]) || has(tagProperties, attributeName);
|
|
286
|
-
if (!isExistPromotionPool) {
|
|
285
|
+
if (has(mapErrorAttributes, [tagType, attributeName])) {
|
|
287
286
|
isValid = false;
|
|
288
287
|
message = 'This pool does not exist anymore';
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
message = translate(translations._PERMISSION_ERR_POOL, 'You do not have permission on this pool');
|
|
317
|
-
}
|
|
288
|
+
const {
|
|
289
|
+
// isEdit = false,
|
|
290
|
+
isView = false, isExist = true, isArchived: _isArchived = false, isActive: _isActive = true, isExpired: _isExpired = false, } = mapErrorAttributes?.[tagType]?.[attributeName] || {};
|
|
291
|
+
if (!isExist) {
|
|
292
|
+
// Case Pool Removed
|
|
293
|
+
isRemoved = !isExist;
|
|
294
|
+
message = translate(translations._PERSONALIZATION_TAG_ERR_REMOVED, 'This pool is removed');
|
|
295
|
+
}
|
|
296
|
+
else if (_isArchived) {
|
|
297
|
+
// Case Pool is Archived
|
|
298
|
+
isArchived = true;
|
|
299
|
+
message = translate(translations._PERSONALIZATION_TAG_ERR_ATT_ARCHIVE, 'This attribute has been archived');
|
|
300
|
+
}
|
|
301
|
+
else if (!_isActive) {
|
|
302
|
+
// Case Pool is Inactive
|
|
303
|
+
isActive = false;
|
|
304
|
+
message = translate(translations._PERSONALIZATION_TAG_ERR_POOL_DEACTIVATE, 'This pool has been deactivated. You have to turn it on to use');
|
|
305
|
+
}
|
|
306
|
+
else if (_isExpired) {
|
|
307
|
+
// Case Pool is Expired
|
|
308
|
+
isExpired = true;
|
|
309
|
+
message = translate(translations._PERSONALIZATION_TAG_ERR_POOL_EXPIRE, 'This pool has expired, new codes could not be allocated');
|
|
310
|
+
}
|
|
311
|
+
else if (!isView) {
|
|
312
|
+
// Case Pool Can't View
|
|
313
|
+
canView = isView;
|
|
314
|
+
message = translate(translations._PERMISSION_ERR_POOL, 'You do not have permission on this pool');
|
|
318
315
|
}
|
|
319
316
|
}
|
|
317
|
+
// }
|
|
320
318
|
break;
|
|
321
319
|
}
|
|
322
320
|
default: {
|
|
323
|
-
if (combineAttribute
|
|
324
|
-
(!has(mapAttributes, [type, combineAttribute]) ||
|
|
325
|
-
!has(tagProperties, [type, combineAttribute]))) {
|
|
321
|
+
if (has(mapErrorAttributes, [tagType, combineAttribute])) {
|
|
326
322
|
isValid = false;
|
|
327
323
|
message = 'This attribute does not exist anymore';
|
|
328
|
-
|
|
329
|
-
if (has(mapErrorAttributes, [type, combineAttribute])) {
|
|
330
|
-
const { isArchived: _isArchived = false, isActive: _isActive = true, isExpired: _isExpired = false, } = mapErrorAttributes?.[type]?.[combineAttribute] || {};
|
|
324
|
+
const { isArchived: _isArchived = false, isActive: _isActive = true, isExpired: _isExpired = false, } = mapErrorAttributes?.[tagType]?.[combineAttribute] || {};
|
|
331
325
|
if (_isArchived) {
|
|
332
326
|
// Case Tag is Archived
|
|
333
327
|
isArchived = true;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@antscorp/antsomi-ui",
|
|
3
|
-
"version": "1.3.5-beta.
|
|
3
|
+
"version": "1.3.5-beta.975",
|
|
4
4
|
"description": "An enterprise-class UI design language and React UI library.",
|
|
5
5
|
"sideEffects": [
|
|
6
6
|
"dist/*",
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
"not op_mini all"
|
|
62
62
|
],
|
|
63
63
|
"dependencies": {
|
|
64
|
-
"@antscorp/antsomi-locales": "1.0.
|
|
64
|
+
"@antscorp/antsomi-locales": "1.0.34",
|
|
65
65
|
"@ant-design/cssinjs": "^1.6.2",
|
|
66
66
|
"@antscorp/icons": "0.27.54",
|
|
67
67
|
"@antscorp/image-editor": "1.0.2",
|