@antscorp/antsomi-ui 1.3.5-beta.971 → 1.3.5-beta.973

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import type { PayloadInfo } from '@antscorp/antsomi-ui/es/types';
2
3
  export type TDisplayFormat = 'number' | 'percentage' | 'currency' | 'datetime';
3
4
  type DisplayFormatProps = {
@@ -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, Text } from '../../atoms';
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-flex-wrap ants-items-center ants-mt-1 ants-gap-2 ant-flex-row", style: { display: 'flex', alignItems: 'end', gap: '8px', marginBottom: '5px' }, ...rest, children: [_jsx(Text, { size: 11, className: "ants-flex", color: "#7F7F7F", dangerouslySetInnerHTML: {
47
- __html: `${translate(translations._ACT_PREVIEW)}: &nbsp;<bdo dir='ltr'>${formatDFValue}</bdo>`,
48
- } }), _jsx(Button, { disabled: disabled, size: "small", icon: _jsx(EditIcon, { width: 16, height: 16, color: "#005EB8" }), className: "ants-border-none", style: {
46
+ return (_jsxs("div", { className: "ants-flex ants-items-center ants-mt-1 ants-gap-2 ant-flex-row", style: {
47
+ display: 'flex',
48
+ alignItems: 'end',
49
+ gap: '8px',
50
+ marginBottom: '5px',
51
+ flexShrink: 0,
52
+ width: '100%',
53
+ flexWrap: 'nowrap',
54
+ overflow: 'hidden',
55
+ }, ...rest, children: [_jsxs(Typography.Text
56
+ // size={11}
57
+ , {
58
+ // size={11}
59
+ className: "ants-flex", style: {
60
+ color: '#7F7F7F',
61
+ fontSize: '11px',
62
+ whiteSpace: 'nowrap',
63
+ maxWidth: 'calc(89%)',
64
+ }, children: [translate(translations._ACT_PREVIEW), ": \u00A0", _jsx(Typography.Text, { style: {
65
+ color: '#7F7F7F',
66
+ fontSize: '11px',
67
+ whiteSpace: 'nowrap',
68
+ maxWidth: 'calc(85%)',
69
+ }, 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",
70
+ // className={`ants-border-none transition-colors duration-300 rounded-md ${
71
+ // showDetailEdit ? 'bg-[#DEEFFE]' : 'hover:bg-[#E0F2FE]'
72
+ // }`}
73
+ style: {
49
74
  marginTop: '1px',
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,7 +112,7 @@ export const FormatNumber = (props) => {
112
112
  ...settingValues,
113
113
  isCompact: checked,
114
114
  });
115
- }, children: t(translations.dynamicContent.modal.label.formNumberDisplayFormat.compact) }) }), _jsx(Form.Item, { label: decimalPlacesLabel, style: { marginBottom: 12 }, colon: false, labelCol: { span: 10 }, wrapperCol: { span: 14 }, 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({
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({
@@ -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
+ };
@@ -12,6 +12,7 @@ type Option = {
12
12
  export interface InputSelectAttributeProps {
13
13
  sourceOptions: Option[];
14
14
  codeOptions: Option[];
15
+ label?: string;
15
16
  errorMsg?: string;
16
17
  value: Value;
17
18
  onChange: (newValueData: {
@@ -1,6 +1,7 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
2
  // Libraries
3
- import { memo, useCallback, useState } from 'react';
3
+ import { memo, useCallback, useMemo, useState } from 'react';
4
+ import { get, keyBy } from 'lodash';
4
5
  // Translations
5
6
  import { translate, translations } from '@antscorp/antsomi-ui/es/locales';
6
7
  // Components
@@ -12,7 +13,7 @@ import { Modal } from '../Modal';
12
13
  // Constants
13
14
  import { THEME } from '@antscorp/antsomi-ui/es/constants';
14
15
  const InputSelectAttribute = (props) => {
15
- const { value, errorMsg, sourceOptions, codeOptions, onChange } = props;
16
+ const { value, errorMsg, label, sourceOptions, codeOptions, onChange } = props;
16
17
  // States
17
18
  const [openModal, setOpenModal] = useState(false);
18
19
  const [attributeState, setAttributeState] = useState(() => {
@@ -24,6 +25,8 @@ const InputSelectAttribute = (props) => {
24
25
  code: '',
25
26
  };
26
27
  });
28
+ // Memoized
29
+ const mapCodeOpts = useMemo(() => keyBy(codeOptions, 'value'), [codeOptions]);
27
30
  const onOpenModal = useCallback(() => {
28
31
  setOpenModal(true);
29
32
  }, []);
@@ -51,7 +54,7 @@ const InputSelectAttribute = (props) => {
51
54
  height: 32,
52
55
  padding: '4px 12px 4px 4px',
53
56
  borderBottom: `1px solid ${errorMsg ? THEME.token?.colorError : THEME.token?.blue1}`,
54
- }, children: [_jsx("div", { style: { width: '100%', cursor: 'pointer' }, onClick: onOpenModal, children: isObjValue && _jsx(Tag, { children: value.code }) }), _jsx(Icon, { type: "icon-ants-remove", style: { fontSize: 10, color: '#222', cursor: 'pointer' }, onClick: onDeselect })] }));
57
+ }, children: [_jsx("div", { style: { width: '100%', cursor: 'pointer' }, onClick: onOpenModal, children: isObjValue && _jsx(Tag, { children: get(mapCodeOpts, [value.code, 'label'], value.code) }) }), _jsx(Icon, { type: "icon-ants-remove", style: { fontSize: 10, color: '#222', cursor: 'pointer' }, onClick: onDeselect })] }));
55
58
  }
56
59
  else {
57
60
  element = (_jsx(StyledSelect, { mode: "multiple", options: [{ value: '', label: translate(translations.orSelectAField.title) }], notFoundContent: null, onSelect: onOpenModal, style: { width: '100%', borderTop: 'none', borderLeft: 'none', borderRight: 'none' }, onDeselect: onDeselect, autoClearSearchValue: false, searchValue: typeof value === 'string' ? value : '', onSearch: onChangeInput, status: errorMsg ? 'error' : undefined, placeholder: typeof value === 'string' ? value : translate(translations.inputYourValue.title), "$isPlaceholder": !value, "$isError": !!errorMsg, dropdownStyle: {
@@ -62,7 +65,7 @@ const InputSelectAttribute = (props) => {
62
65
  };
63
66
  return (_jsxs(_Fragment, { children: [renderInput(), errorMsg ? (_jsx(Typography.Text, { style: { marginLeft: 8, color: THEME.token?.red8, marginTop: 5 }, children: errorMsg })) : null, _jsx(Modal, { title: translate(translations._PREDICT_MODEL_SELECT_ATTRIBUTE, 'Select attribute'), okText: translate(translations._ACT_APPLY, 'Apply'), open: openModal, onOk: onOk, onCancel: onHideModal, children: _jsxs(Flex, { vertical: true, gap: 15, children: [_jsxs(Flex, { gap: 10, children: [_jsxs(Typography.Text, { style: { lineHeight: '30px', flexBasis: 130 }, children: [translate(translations._TITL_PERSONALIZATION_TYPE, 'Content Source'), _jsx("span", { style: { color: THEME.token?.red8 }, children: "\u00A0 *" })] }), _jsx(Select, { suffixIcon: _jsx(Icon, { type: "icon-ants-expand-more", style: { fontSize: '20px', color: THEME.token?.colorIcon } }), style: { flex: 1 }, options: sourceOptions, value: attributeState.source, onChange: newValue => {
64
67
  setAttributeState(state => ({ ...state, source: newValue }));
65
- } })] }), _jsxs(Flex, { gap: 10, children: [_jsxs(Typography.Text, { style: { lineHeight: '30px', flexBasis: 130 }, children: ["Allocated Code", _jsx("span", { style: { color: THEME.token?.red8 }, children: "\u00A0 *" })] }), _jsx(Select, { suffixIcon: _jsx(Icon, { type: "icon-ants-expand-more", style: { fontSize: '20px', color: THEME.token?.colorIcon } }), style: { flex: 1 }, value: attributeState.code, options: codeOptions, onChange: newValue => {
68
+ } })] }), _jsxs(Flex, { gap: 10, children: [_jsxs(Typography.Text, { style: { lineHeight: '30px', flexBasis: 130 }, children: [label || 'Allocated Code', _jsx("span", { style: { color: THEME.token?.red8 }, children: "\u00A0 *" })] }), _jsx(Select, { suffixIcon: _jsx(Icon, { type: "icon-ants-expand-more", style: { fontSize: '20px', color: THEME.token?.colorIcon } }), style: { flex: 1 }, value: attributeState.code, options: codeOptions, onChange: newValue => {
66
69
  setAttributeState(state => ({ ...state, code: newValue }));
67
70
  } })] })] }) })] }));
68
71
  };
@@ -3,4 +3,5 @@
3
3
  * Asynchronously loads the component for TemplateListing
4
4
  *
5
5
  */
6
+ /// <reference types="react" />
6
7
  export declare const TemplateListing: (props: import("./types").TemplateListingProps<{}>) => JSX.Element;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antscorp/antsomi-ui",
3
- "version": "1.3.5-beta.971",
3
+ "version": "1.3.5-beta.973",
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.32",
64
+ "@antscorp/antsomi-locales": "1.0.33",
65
65
  "@ant-design/cssinjs": "^1.6.2",
66
66
  "@antscorp/icons": "0.27.54",
67
67
  "@antscorp/image-editor": "1.0.2",