@antscorp/antsomi-ui 1.3.6-beta.10 → 1.3.6-beta.2

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.
Files changed (49) hide show
  1. package/es/components/molecules/AddDynamicContent/components/DisplayFormat/DisplayFormat.d.ts +0 -1
  2. package/es/components/molecules/CodeStructure/CodeStructure.d.ts +0 -21
  3. package/es/components/molecules/CodeStructure/CodeStructure.js +27 -73
  4. package/es/components/molecules/CodeStructure/constants.js +2 -2
  5. package/es/components/molecules/CodeStructure/styled.d.ts +0 -3
  6. package/es/components/molecules/CodeStructure/styled.js +0 -6
  7. package/es/components/molecules/CodeStructure/type.d.ts +1 -1
  8. package/es/components/molecules/CodeStructure/type.js +1 -1
  9. package/es/components/molecules/CodeStructure/utils.js +2 -4
  10. package/es/components/molecules/InputSelectAttribute/index.js +5 -9
  11. package/es/components/molecules/SearchPopover/components/PopoverSelect/PopoverSelect.js +2 -2
  12. package/es/components/molecules/index.d.ts +0 -1
  13. package/es/components/molecules/index.js +0 -1
  14. package/es/components/template/TemplateListing/Loadable.d.ts +0 -1
  15. package/package.json +2 -2
  16. package/es/components/molecules/EditingListV2/EditingList.d.ts +0 -2
  17. package/es/components/molecules/EditingListV2/EditingList.js +0 -15
  18. package/es/components/molecules/EditingListV2/components/Action/Action.d.ts +0 -6
  19. package/es/components/molecules/EditingListV2/components/Action/Action.js +0 -10
  20. package/es/components/molecules/EditingListV2/components/Action/index.d.ts +0 -1
  21. package/es/components/molecules/EditingListV2/components/Action/index.js +0 -1
  22. package/es/components/molecules/EditingListV2/components/List/List.d.ts +0 -9
  23. package/es/components/molecules/EditingListV2/components/List/List.js +0 -38
  24. package/es/components/molecules/EditingListV2/components/List/index.d.ts +0 -1
  25. package/es/components/molecules/EditingListV2/components/List/index.js +0 -1
  26. package/es/components/molecules/EditingListV2/components/Loadable.d.ts +0 -14
  27. package/es/components/molecules/EditingListV2/components/Loadable.js +0 -3
  28. package/es/components/molecules/EditingListV2/components/Popover/Popover.d.ts +0 -11
  29. package/es/components/molecules/EditingListV2/components/Popover/Popover.js +0 -17
  30. package/es/components/molecules/EditingListV2/components/Popover/index.d.ts +0 -1
  31. package/es/components/molecules/EditingListV2/components/Popover/index.js +0 -1
  32. package/es/components/molecules/EditingListV2/components/Search/Search.d.ts +0 -4
  33. package/es/components/molecules/EditingListV2/components/Search/Search.js +0 -8
  34. package/es/components/molecules/EditingListV2/components/Search/index.d.ts +0 -1
  35. package/es/components/molecules/EditingListV2/components/Search/index.js +0 -1
  36. package/es/components/molecules/EditingListV2/components/Title/Title.d.ts +0 -9
  37. package/es/components/molecules/EditingListV2/components/Title/Title.js +0 -16
  38. package/es/components/molecules/EditingListV2/components/Title/index.d.ts +0 -1
  39. package/es/components/molecules/EditingListV2/components/Title/index.js +0 -1
  40. package/es/components/molecules/EditingListV2/components/index.d.ts +0 -6
  41. package/es/components/molecules/EditingListV2/components/index.js +0 -6
  42. package/es/components/molecules/EditingListV2/index.d.ts +0 -2
  43. package/es/components/molecules/EditingListV2/index.js +0 -1
  44. package/es/components/molecules/EditingListV2/styled.d.ts +0 -5
  45. package/es/components/molecules/EditingListV2/styled.js +0 -38
  46. package/es/components/molecules/EditingListV2/types.d.ts +0 -18
  47. package/es/components/molecules/EditingListV2/types.js +0 -1
  48. package/es/components/molecules/EditingListV2/utils.d.ts +0 -27
  49. package/es/components/molecules/EditingListV2/utils.js +0 -28
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import type { PayloadInfo } from '@antscorp/antsomi-ui/es/types';
3
2
  export type TDisplayFormat = 'number' | 'percentage' | 'currency' | 'datetime';
4
3
  type DisplayFormatProps = {
@@ -7,26 +7,5 @@ interface CodeStructureProps {
7
7
  isError: boolean;
8
8
  }) => void;
9
9
  }
10
- /**
11
- * Component to configure the code structure for a pool rule.
12
- *
13
- * The component contains a form with fields for:
14
- * - Prefix
15
- * - Infix (character type, number of digits, number of letters, capitalization, character order)
16
- * - Suffix
17
- * - Separator
18
- * - Quantity (number of codes per time)
19
- * - Refill interval (manual or automatic)
20
- * - Refill threshold (number of codes remaining)
21
- * - Refill unit (codes or percent)
22
- *
23
- * The form also displays a preview of the generated code sample.
24
- *
25
- * The component calls the `onChange` callback with the updated form values and an `isError` flag
26
- * indicating whether the form is valid or not.
27
- *
28
- * @param {CodeStructureProps} props The component props.
29
- * @returns {React.ReactElement} The rendered component.
30
- */
31
10
  export declare const CodeStructure: React.FC<CodeStructureProps>;
32
11
  export {};
@@ -1,42 +1,20 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  // Libraries
3
- import { memo } from 'react';
3
+ import { useEffect } from 'react';
4
4
  import { Form, InputNumber, Radio, Select, Typography, Flex, Input, Row, Col } from 'antd';
5
5
  import { useImmer } from 'use-immer';
6
6
  import { translate, translations } from '@antscorp/antsomi-locales';
7
- import { isEmpty } from 'lodash';
8
7
  // Utils
9
8
  import { calculateTotalCodes, generateCodeWithPrefixAndSuffix, generateRandomCodeWithConfig, } from './utils';
10
9
  // Types
11
- import { CapitalizationType, CharacterOrderType, CharacterType, RefillUnitType, SeparatorType, } from './type';
10
+ import { CapitalizationType, CharacterOrderType, CharacterType, RefillType, RefillUnitType, SeparatorType, } from './type';
12
11
  // Constants
13
12
  import { CAPITALIZATION_OPTIONS, CHARACTER_ORDER_OPTIONS, CHARACTER_TYPE_OPTIONS, REFILL_UNIT_OPTIONS, SEPARATOR_OPTIONS, } from './constants';
14
- import { BlockAbsolute, CodeStructureWrapper } from './styled';
15
- import { useDebouncedCallbackV2, useDeepCompareEffect } from '@antscorp/antsomi-ui/es/hooks';
13
+ import { CodeStructureWrapper } from './styled';
14
+ import { useDebouncedCallbackV2 } from '@antscorp/antsomi-ui/es/hooks';
16
15
  const { Title } = Typography;
17
- /**
18
- * Component to configure the code structure for a pool rule.
19
- *
20
- * The component contains a form with fields for:
21
- * - Prefix
22
- * - Infix (character type, number of digits, number of letters, capitalization, character order)
23
- * - Suffix
24
- * - Separator
25
- * - Quantity (number of codes per time)
26
- * - Refill interval (manual or automatic)
27
- * - Refill threshold (number of codes remaining)
28
- * - Refill unit (codes or percent)
29
- *
30
- * The form also displays a preview of the generated code sample.
31
- *
32
- * The component calls the `onChange` callback with the updated form values and an `isError` flag
33
- * indicating whether the form is valid or not.
34
- *
35
- * @param {CodeStructureProps} props The component props.
36
- * @returns {React.ReactElement} The rendered component.
37
- */
38
- export const CodeStructure = memo(({ initialData, onChange }) => {
39
- const { characterType = CharacterType.DIGIT_AND_LETTERS, digitalNumbers = 2, alphabetLetters = 3, capitalization = CapitalizationType.UPPERCASE, characterOrder = CharacterOrderType.RANDOM, separator = SeparatorType.UNDERSCORE, quantity = 50, suffix = '', refillInterval, prefix = '', refillThreshold = 10, refillUnit = RefillUnitType.CODES, } = initialData;
16
+ export const CodeStructure = ({ initialData, onChange }) => {
17
+ const { characterType = CharacterType.DIGIT_AND_LETTERS, digitalNumbers = 2, alphabetLetters = 3, capitalization = CapitalizationType.UPPERCASE, characterOrder = CharacterOrderType.RANDOM, separator = SeparatorType.UNDERSCORE, quantity = 1, suffix = '', refillInterval = RefillType.MANUAL, prefix = '', refillThreshold = 10, refillUnit = RefillUnitType.CODES, } = initialData;
40
18
  const [form] = Form.useForm();
41
19
  const [state, setState] = useImmer({
42
20
  codeSample: '',
@@ -64,7 +42,7 @@ export const CodeStructure = memo(({ initialData, onChange }) => {
64
42
  draft.codeWithPrefixAndSuffix = value;
65
43
  });
66
44
  };
67
- const debouncedOnChange = useDebouncedCallbackV2(onChange, 700);
45
+ const debouncedOnChange = useDebouncedCallbackV2(onChange, 350);
68
46
  const updateFormValues = async (fieldKeyChange, isError) => {
69
47
  // Get all values from the form
70
48
  const allValues = form.getFieldsValue();
@@ -89,12 +67,11 @@ export const CodeStructure = memo(({ initialData, onChange }) => {
89
67
  totalPredicted = total;
90
68
  setMaxCodes(total);
91
69
  }
92
- const codeExample = generateRandomCodeWithConfig(form.getFieldsValue());
93
70
  if (isRelevantChangeCodeKey) {
94
- setCodeSample(codeExample);
71
+ setCodeSample(generateRandomCodeWithConfig(form.getFieldsValue()));
95
72
  }
96
73
  if (isChangePrefix) {
97
- setCodeWithPrefixAndSuffix(generateCodeWithPrefixAndSuffix(codeExample, form.getFieldValue('prefix'), form.getFieldValue('suffix'), form.getFieldValue('separator')));
74
+ setCodeWithPrefixAndSuffix(generateCodeWithPrefixAndSuffix(codeSample, form.getFieldValue('prefix'), form.getFieldValue('suffix'), form.getFieldValue('separator')));
98
75
  }
99
76
  const dataOnChange = {
100
77
  ...allValues,
@@ -105,18 +82,15 @@ export const CodeStructure = memo(({ initialData, onChange }) => {
105
82
  isError,
106
83
  });
107
84
  };
108
- useDeepCompareEffect(() => {
85
+ useEffect(() => {
109
86
  setMaxCodes(calculateTotalCodes(alphabetLetters, digitalNumbers, characterType));
110
87
  }, [alphabetLetters, digitalNumbers, characterType]);
111
- useDeepCompareEffect(() => {
88
+ useEffect(() => {
112
89
  setCodeSample(generateRandomCodeWithConfig(initialData));
113
90
  }, [characterType, digitalNumbers, alphabetLetters, capitalization, characterOrder]);
114
- useDeepCompareEffect(() => {
115
- setCodeWithPrefixAndSuffix(generateCodeWithPrefixAndSuffix(codeSample, prefix, suffix, separator));
116
- }, [codeSample, prefix, suffix, separator]);
117
- // useEffect(() => {
118
- // form.setFieldsValue(initialData);
119
- // }, [initialData, form]);
91
+ useEffect(() => {
92
+ form.setFieldsValue(initialData);
93
+ }, [initialData, form]);
120
94
  return (_jsx(CodeStructureWrapper, { children: _jsxs(Form, { form: form, layout: "horizontal", labelCol: { span: 6 }, colon: false, wrapperCol: { span: 24 }, labelAlign: "left", initialValues: {
121
95
  characterType,
122
96
  digitalNumbers,
@@ -134,50 +108,30 @@ export const CodeStructure = memo(({ initialData, onChange }) => {
134
108
  const fieldKeyChange = changedFields[0].name[0];
135
109
  const isValidate = form.getFieldsError().some(field => field.errors.length > 0);
136
110
  updateFormValues(fieldKeyChange, isValidate);
137
- }, children: [_jsx(Title, { level: 5, children: translate(translations._POOL_RULE_SETTING_CODE_STRUCTURE, 'Code Structure') }), _jsx(Form.Item, { label: translate(translations._POOL_RULE_SETTING_CODE_STRUCTURE_PREFIX, 'Prefix'), name: "prefix", rules: [
138
- {
139
- pattern: /^[a-zA-Z@~`!@#$%^&*()_=+\\\\';:\"\\/?>.<,-]+$/i,
140
- message: 'Must not contain accent marks',
141
- },
142
- ], children: _jsx(Input, { placeholder: "", style: {
111
+ }, children: [_jsx(Title, { level: 5, children: translate(translations._POOL_RULE_SETTING_CODE_STRUCTURE, 'Code Structure') }), _jsx(Form.Item, { label: translate(translations._POOL_RULE_SETTING_CODE_STRUCTURE_PREFIX, 'Prefix'), name: "prefix", children: _jsx(Input, { placeholder: "", style: {
143
112
  maxWidth: 465,
144
- } }) }), _jsxs(Row, { children: [_jsx(Col, { span: 6, offset: 0, children: translate(translations._POOL_RULE_SETTING_CODE_STRUCTURE_INFIX, 'Infix') }), _jsx(Col, { span: 16, offset: 0, children: _jsxs(Flex, { vertical: true, gap: 10, children: [_jsx(Row, { children: _jsx(Col, { offset: 0, children: translate(translations._POOL_RULE_SETTING_CODE_STRUCTURE_CHAC_TYPE, 'Character Type') }) }), _jsx(Form.Item, { name: "characterType", children: _jsx(Radio.Group, { options: CHARACTER_TYPE_OPTIONS }) })] }) })] }), _jsx(Row, { children: _jsx(Col, { offset: 6, children: _jsxs(Flex, { gap: 10, align: "center", style: {
145
- position: 'relative',
146
- }, children: [_jsx(Form.Item, { name: "digitalNumbers", rules: [{ required: true, message: `This field can't be empty` }], children: _jsx(InputNumber, { min: 1, max: 50, style: { width: '40px' } }) }), _jsx(BlockAbsolute, { children: translate(translations._POOL_RULE_SETTING_CODE_STRUCTURE_CHAC_TYPE_DIG_NO, 'digital numbers') })] }) }) }), _jsx(Row, { children: _jsx(Col, { offset: 6, children: _jsxs(Flex, { gap: 10, align: "center", style: {
147
- position: 'relative',
148
- }, children: [_jsx(Form.Item, { name: "alphabetLetters", rules: [{ required: true, message: `This field can't be empty` }], children: _jsx(InputNumber, { min: 1, max: 50, style: { width: '40px' } }) }), _jsx(BlockAbsolute, { children: translate(translations._POOL_RULE_SETTING_CODE_STRUCTURE_CHAC_TYPE_LET_NO, 'alphabet letters') })] }) }) }), _jsxs(Flex, { vertical: true, gap: 10, children: [_jsx(Row, { children: _jsx(Col, { offset: 6, children: translate(translations._POOL_RULE_SETTING_CODE_STRUCTURE_CAP, 'Letters Capitalization') }) }), _jsx(Form.Item, { label: _jsx("span", { children: "\u00A0" }), name: "capitalization", children: _jsx(Radio.Group, { options: CAPITALIZATION_OPTIONS }) })] }), _jsxs(Flex, { vertical: true, gap: 10, children: [_jsx(Row, { children: _jsx(Col, { offset: 6, children: translate(translations._POOL_RULE_SETTING_CODE_STRUCTURE_CHAC_ORDER, 'Character Order') }) }), _jsx(Form.Item, { label: _jsx("span", { children: "\u00A0" }), name: "characterOrder", children: _jsx(Radio.Group, { options: CHARACTER_ORDER_OPTIONS }) })] }), _jsx(Form.Item, { label: translate(translations._POOL_RULE_SETTING_CODE_STRUCTURE_SUFFIX, 'Suffix'), name: "suffix", rules: [
149
- {
150
- pattern: /^[a-zA-Z@~`!@#$%^&*()_=+\\\\';:\"\\/?>.<,-]+$/i,
151
- message: 'Must not contain accent marks',
152
- },
153
- ], children: _jsx(Input, { placeholder: "", style: {
113
+ } }) }), _jsxs(Row, { children: [_jsx(Col, { span: 6, offset: 0, children: translate(translations._POOL_RULE_SETTING_CODE_STRUCTURE_INFIX, 'Infix') }), _jsx(Col, { span: 16, offset: 0, children: _jsxs(Flex, { vertical: true, gap: 10, children: [_jsx(Row, { children: _jsx(Col, { offset: 0, children: translate(translations._POOL_RULE_SETTING_CODE_STRUCTURE_CHAC_TYPE, 'Character Type') }) }), _jsx(Form.Item, { name: "characterType", children: _jsx(Radio.Group, { options: CHARACTER_TYPE_OPTIONS }) })] }) })] }), _jsx(Row, { children: _jsx(Col, { offset: 6, children: _jsxs(Flex, { gap: 10, align: "center", children: [_jsx(Form.Item, { name: "digitalNumbers", children: _jsx(InputNumber, { min: 1, max: 50, style: { width: '40px' } }) }), _jsx("div", { style: { marginBottom: '15px' }, children: translate(translations._POOL_RULE_SETTING_CODE_STRUCTURE_CHAC_TYPE_DIG_NO, 'digital numbers') })] }) }) }), _jsx(Row, { children: _jsx(Col, { offset: 6, children: _jsxs(Flex, { gap: 10, align: "center", children: [_jsx(Form.Item, { name: "alphabetLetters", children: _jsx(InputNumber, { min: 1, max: 50, style: { width: '40px' } }) }), _jsx("div", { style: { marginBottom: '15px' }, children: translate(translations._POOL_RULE_SETTING_CODE_STRUCTURE_CHAC_TYPE_LET_NO, 'alphabet letters') })] }) }) }), _jsxs(Flex, { vertical: true, gap: 10, children: [_jsx(Row, { children: _jsx(Col, { offset: 6, children: translate(translations._POOL_RULE_SETTING_CODE_STRUCTURE_CAP, 'Letters Capitalization') }) }), _jsx(Form.Item, { label: _jsx("span", { children: "\u00A0" }), name: "capitalization", children: _jsx(Radio.Group, { options: CAPITALIZATION_OPTIONS }) })] }), _jsxs(Flex, { vertical: true, gap: 10, children: [_jsx(Row, { children: _jsx(Col, { offset: 6, children: translate(translations._POOL_RULE_SETTING_CODE_STRUCTURE_CHAC_ORDER, 'Character Order') }) }), _jsx(Form.Item, { label: _jsx("span", { children: "\u00A0" }), name: "characterOrder", children: _jsx(Radio.Group, { options: CHARACTER_ORDER_OPTIONS }) })] }), _jsx(Form.Item, { label: translate(translations._POOL_RULE_SETTING_CODE_STRUCTURE_SUFFIX, 'Suffix'), name: "suffix", children: _jsx(Input, { placeholder: "", style: {
154
114
  maxWidth: 465,
155
- } }) }), _jsx(Form.Item, { label: translate(translations._POOL_RULE_SETTING_CODE_STRUCTURE_SEPARATOR, 'Separator'), name: "separator", children: _jsx(Select, { options: SEPARATOR_OPTIONS, style: { width: '180px' } }) }), _jsxs(Row, { children: [_jsx(Col, { span: 6, children: _jsxs(Flex, { justify: "start", align: "center", gap: 5, children: [translate(translations._POOL_RULE_SETTING_CODE_STRUCTURE_QUANTITY, 'Quantity'), ' ', _jsx("span", { style: { color: 'red' }, children: "*" })] }) }), _jsx(Col, { children: _jsxs(Flex, { gap: 10, align: "center", style: { position: 'relative' }, children: [_jsx(Form.Item, { required: true, name: "quantity", rules: [{ required: true, message: `This field can't be empty` }], children: _jsx(InputNumber, { min: 1, max: 10000 }) }), _jsx(BlockAbsolute, { left: 100, children: "code(s) per time" })] }) })] }), _jsxs(Form.Item, { label: translate(translations._ACT_PREVIEW, 'Preview'), children: ["Maximum of ", _jsx("b", { children: maxCodes.toLocaleString() }), " codes (sample", ' ', state.codeWithPrefixAndSuffix, " ) to be generated"] }), _jsx(Title, { level: 5, children: "Code Refill" }), _jsx(Form.Item, { label: "Refill Interval", name: "refillInterval", children: _jsxs(Radio.Group, { style: { display: 'flex', flexDirection: 'column', gap: '10px' }, onChange: e => {
156
- if (e.target.value === 'manual' && isEmpty(form.getFieldValue('refillThreshold'))) {
157
- form.setFieldsValue({ refillThreshold: 10 });
158
- form.validateFields(['refillThreshold']);
159
- }
160
- }, children: [_jsx(Radio, { value: "manual", children: "Manual refill only" }), _jsx(Radio, { value: "auto", children: _jsxs(Flex, { gap: 10, align: "center", children: [_jsx(Typography.Text, { style: { whiteSpace: 'nowrap' }, children: "Add codes when less than" }), _jsx(Form.Item, { noStyle: true, shouldUpdate: true, children: ({ getFieldValue }) => {
115
+ } }) }), _jsx(Form.Item, { label: translate(translations._POOL_RULE_SETTING_CODE_STRUCTURE_SEPARATOR, 'Separator'), name: "separator", children: _jsx(Select, { options: SEPARATOR_OPTIONS, style: { width: '180px' } }) }), _jsxs(Row, { children: [_jsx(Col, { span: 6, children: _jsxs(Flex, { justify: "start", align: "center", gap: 5, children: [translate(translations._POOL_RULE_SETTING_CODE_STRUCTURE_QUANTITY, 'Quantity'), ' ', _jsx("span", { style: { color: 'red' }, children: "*" })] }) }), _jsx(Col, { children: _jsxs(Flex, { gap: 10, align: "center", children: [_jsx(Form.Item, { required: true, name: "quantity", rules: [{ required: true }], children: _jsx(InputNumber, { min: 1, max: 10000 }) }), _jsx("div", { style: { marginBottom: '15px' }, children: "code(s) per time" })] }) })] }), _jsxs(Form.Item, { label: translate(translations._ACT_PREVIEW, 'Preview'), children: ["Maximum of ", _jsx("b", { children: maxCodes.toLocaleString() }), " codes (sample", ' ', generateCodeWithPrefixAndSuffix(codeSample, form.getFieldValue('prefix'), form.getFieldValue('suffix'), form.getFieldValue('separator')), ") to be generated"] }), _jsx(Title, { level: 5, children: "Code Refill" }), _jsx(Form.Item, { label: "Refill Interval", name: "refillInterval", children: _jsxs(Radio.Group, { style: { display: 'flex', flexDirection: 'column', gap: '10px' }, children: [_jsx(Radio, { value: "manual", children: "Manual refill only" }), _jsx(Radio, { value: "auto", children: _jsxs(Flex, { gap: 10, align: "center", children: [_jsx(Typography.Text, { style: { whiteSpace: 'nowrap' }, children: "Add codes when less than" }), _jsx(Form.Item, { noStyle: true, shouldUpdate: true, children: ({ getFieldValue }) => {
161
116
  const refillUnit = getFieldValue('refillUnit');
162
117
  return (_jsx(Form.Item, { name: "refillThreshold", noStyle: true, rules: [
163
118
  { required: true, message: '' },
164
119
  {
165
120
  validator: (_, value) => {
166
121
  if (refillUnit === RefillUnitType.PERCENT) {
167
- if (value > 100) {
168
- form.setFieldsValue({ refillThreshold: 100 });
122
+ if (value < 1 || value > 100) {
123
+ return Promise.reject(new Error(''));
124
+ }
125
+ }
126
+ else if (refillUnit === RefillUnitType.CODES) {
127
+ if (value < 0) {
128
+ return Promise.reject(new Error(''));
169
129
  }
170
130
  }
171
131
  return Promise.resolve();
172
132
  },
173
133
  },
174
- ], children: _jsx(InputNumber, { onBlur: e => {
175
- const { value } = e.target;
176
- if (isEmpty(value)) {
177
- form.setFieldsValue({ refillThreshold: 1 });
178
- form.validateFields(['refillThreshold']);
179
- }
180
- }, min: 1, max: refillUnit === RefillUnitType.PERCENT ? 100 : undefined, style: { width: '63px' } }) }));
134
+ ], children: _jsx(InputNumber, { min: refillUnit === RefillUnitType.CODES ? 0 : 1, max: refillUnit === RefillUnitType.PERCENT ? 100 : undefined, style: { width: '63px' } }) }));
181
135
  } }), _jsx(Form.Item, { noStyle: true, shouldUpdate: true, children: () => (_jsx(Form.Item, { name: "refillUnit", noStyle: true, rules: [
182
136
  { required: true, message: '' },
183
137
  {
@@ -185,5 +139,5 @@ export const CodeStructure = memo(({ initialData, onChange }) => {
185
139
  form.validateFields(['refillThreshold']);
186
140
  },
187
141
  },
188
- ], children: _jsx(Select, { defaultValue: RefillUnitType.CODES, options: REFILL_UNIT_OPTIONS, style: { width: '63px' }, onClick: e => e.preventDefault() }) })) }), "remaining"] }) })] }) })] }) }));
189
- });
142
+ ], children: _jsx(Select, { options: REFILL_UNIT_OPTIONS, style: { width: '63px' }, onClick: e => e.preventDefault() }) })) }), "remaining"] }) })] }) })] }) }));
143
+ };
@@ -30,8 +30,8 @@ export const CAPITALIZATION_OPTIONS = [
30
30
  label: translate(translations._POOL_RULE_SETTING_CODE_STRUCTURE_CAP_LOW, 'lowercase'),
31
31
  },
32
32
  {
33
- value: CapitalizationType.RANDOM,
34
- label: translate(translations._POOL_RULE_SETTING_CODE_STRUCTURE_CHAC_ORDER_RANDOM, 'Random'),
33
+ value: CapitalizationType.TITLE_CASE,
34
+ label: translate(translations._POOL_RULE_SETTING_CODE_STRUCTURE_CAP_TITL, 'Title case'),
35
35
  },
36
36
  ];
37
37
  export const CHARACTER_ORDER_OPTIONS = [
@@ -1,4 +1 @@
1
1
  export declare const CodeStructureWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
2
- export declare const BlockAbsolute: import("styled-components").StyledComponent<"div", any, {
3
- left?: number | undefined;
4
- }, never>;
@@ -1,8 +1,2 @@
1
1
  import styled from 'styled-components';
2
2
  export const CodeStructureWrapper = styled.div ``;
3
- export const BlockAbsolute = styled.div `
4
- position: absolute;
5
- left: ${p => p.left || 50}px;
6
- white-space: nowrap;
7
- margin-bottom: 15px;
8
- `;
@@ -11,7 +11,7 @@ export declare enum CharacterOrderType {
11
11
  export declare enum CapitalizationType {
12
12
  UPPERCASE = "upper",
13
13
  LOWERCASE = "lower",
14
- RANDOM = "random"
14
+ TITLE_CASE = "title"
15
15
  }
16
16
  export declare enum SeparatorType {
17
17
  HYPHEN = "hyphen",
@@ -14,7 +14,7 @@ export var CapitalizationType;
14
14
  (function (CapitalizationType) {
15
15
  CapitalizationType["UPPERCASE"] = "upper";
16
16
  CapitalizationType["LOWERCASE"] = "lower";
17
- CapitalizationType["RANDOM"] = "random";
17
+ CapitalizationType["TITLE_CASE"] = "title";
18
18
  })(CapitalizationType || (CapitalizationType = {}));
19
19
  export var SeparatorType;
20
20
  (function (SeparatorType) {
@@ -18,10 +18,8 @@ export const generateRandomCodeWithConfig = ({ characterType, digitalNumbers, al
18
18
  else if (capitalization === CapitalizationType.LOWERCASE) {
19
19
  letterPart = letterPart.toLowerCase();
20
20
  }
21
- else if (capitalization === CapitalizationType.RANDOM) {
22
- letterPart = Array.from(letterPart)
23
- .map(char => (Math.random() < 0.5 ? char.toUpperCase() : char.toLowerCase()))
24
- .join('');
21
+ else if (capitalization === CapitalizationType.TITLE_CASE && letterPart.length > 0) {
22
+ letterPart = letterPart.charAt(0).toUpperCase() + letterPart.slice(1).toLowerCase();
25
23
  }
26
24
  // Order characters
27
25
  let finalCode = '';
@@ -1,7 +1,7 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
2
  // Libraries
3
3
  import { memo, useCallback, useMemo, useState } from 'react';
4
- import { get, has, keyBy, upperFirst } from 'lodash';
4
+ import { get, keyBy, upperFirst } from 'lodash';
5
5
  import { Flex, Form, Select, Tooltip, Typography } from 'antd';
6
6
  // Translations
7
7
  import { translate, translations } from '@antscorp/antsomi-ui/es/locales';
@@ -14,7 +14,6 @@ import { EmptyData } from '../EmptyData';
14
14
  import { Dashboard30Icon, ErrorIcon } from '../../icons';
15
15
  // Constants
16
16
  import { THEME } from '@antscorp/antsomi-ui/es/constants';
17
- import { TAG_TYPE } from '../TagifyInput';
18
17
  const InputSelectAttribute = (props) => {
19
18
  const { value, errorMsg, label, isErrorTag, sourceOptions = [], mapCodeOptions = {}, onChange, } = props;
20
19
  const [form] = Form.useForm();
@@ -28,7 +27,7 @@ const InputSelectAttribute = (props) => {
28
27
  return [];
29
28
  }, [sourceValue, mapCodeOptions]);
30
29
  const initCodeTitleField = useMemo(() => {
31
- if (sourceValue === TAG_TYPE.PROMOTION_CODE) {
30
+ if (sourceValue === 'allocated_code') {
32
31
  return 'Allocated Code';
33
32
  }
34
33
  return upperFirst(translate(translations._ITEM_NAME_ATTRIBUTE, 'attribute'));
@@ -41,8 +40,7 @@ const InputSelectAttribute = (props) => {
41
40
  const getCodeDefaultBySource = useCallback((source) => get(mapCodeOptions, [source, '0', 'value'], ''), [mapCodeOptions]);
42
41
  const onOpenModal = useCallback(() => {
43
42
  if (value && typeof value !== 'string') {
44
- const isExist = has(mapCodeBySource, [value?.code, 'label']);
45
- form.setFieldsValue({ source: value?.source, code: isExist ? value?.code : undefined });
43
+ form.setFieldsValue({ source: value?.source, code: value?.code });
46
44
  }
47
45
  else {
48
46
  const source = sourceOptions[0]?.value || '';
@@ -50,7 +48,7 @@ const InputSelectAttribute = (props) => {
50
48
  form.setFieldsValue({ source, code });
51
49
  }
52
50
  setOpenModal(true);
53
- }, [value, mapCodeBySource, form, sourceOptions, getCodeDefaultBySource]);
51
+ }, [value, form, sourceOptions, getCodeDefaultBySource]);
54
52
  const onDeselect = useCallback(() => {
55
53
  onChange({ value: '', valueType: 'input' });
56
54
  }, [onChange]);
@@ -99,9 +97,7 @@ const InputSelectAttribute = (props) => {
99
97
  height: 32,
100
98
  padding: '4px 12px 4px 4px',
101
99
  borderBottom: `1px solid ${errorMsg ? THEME.token?.colorError : THEME.token?.blue1}`,
102
- }, children: [_jsx("div", { style: { width: '100%', cursor: 'pointer' }, onClick: onOpenModal, children: isObjValue && (_jsx(Tag, { isError: isErrorTag, children: isErrorTag ? (_jsxs(Flex, { gap: 5, align: "center", children: ["Unknown", _jsx(Tooltip, { title: "The used dynamic content is removed", children: _jsx(ErrorIcon, { size: 16 }) })] })) : (_jsx(Typography.Text, { ellipsis: {
103
- tooltip: get(mapCodeBySource, [value?.code, 'label'], value?.code),
104
- }, style: { maxWidth: 150 }, children: get(mapCodeBySource, [value?.code, 'label'], value?.code) })) })) }), _jsx(Icon, { type: "icon-ants-remove", style: { fontSize: 10, color: '#222', cursor: 'pointer' }, onClick: onDeselect })] }));
100
+ }, children: [_jsx("div", { style: { width: '100%', cursor: 'pointer' }, onClick: onOpenModal, children: isObjValue && (_jsx(Tag, { isError: isErrorTag, children: isErrorTag ? (_jsxs(Flex, { gap: 5, align: "center", children: ["Unknown", _jsx(Tooltip, { title: "The used dynamic content is removed", children: _jsx(ErrorIcon, { size: 16 }) })] })) : (get(mapCodeBySource, [value?.code, 'label'], value?.code)) })) }), _jsx(Icon, { type: "icon-ants-remove", style: { fontSize: 10, color: '#222', cursor: 'pointer' }, onClick: onDeselect })] }));
105
101
  }
106
102
  else {
107
103
  element = (_jsx(StyledSelect, { mode: "multiple", options: [{ value: '', label: 'Or select a field' }], 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: {
@@ -113,11 +113,11 @@ export const PopoverSelect = (props) => {
113
113
  key: opt.key,
114
114
  label: (_jsx(Checkbox, { onChange: e => handleToggleField(opt, e.target.checked), checked: selectedKeys.has(opt.key), children: renderCheckBoxLabel(opt) })),
115
115
  }));
116
- return (_jsx(SearchPopover, { destroyTooltipOnHide: true, placement: "bottomLeft", ...rest, content: _jsxs(_Fragment, { children: [optionsProp.length > 0 && (_jsxs(StyledAction, { children: [_jsx(Button, { type: "link", size: "small", onClick: () => setShowSelected(current => !current), children: showSelected ? showAllLabel : showSelectedLabel }), selectedKeys.size === options.length ? (_jsx(Button, { type: "link", onClick: handleDeselectAll, children: deselectAllLabel })) : (_jsx(Button, { type: "link", onClick: handleSelectAll, children: selectAllLabel }))] })), filteredOptions.length ? (_jsx(StyledListFieldsWrapper, { "$minHeight": calDefaultListHeightInPopover({
116
+ return (_jsx(SearchPopover, { destroyTooltipOnHide: true, ...rest, content: _jsxs(_Fragment, { children: [optionsProp.length > 0 && (_jsxs(StyledAction, { children: [_jsx(Button, { type: "link", size: "small", onClick: () => setShowSelected(current => !current), children: showSelected ? showAllLabel : showSelectedLabel }), selectedKeys.size === options.length ? (_jsx(Button, { type: "link", onClick: handleDeselectAll, children: deselectAllLabel })) : (_jsx(Button, { type: "link", onClick: handleSelectAll, children: selectAllLabel }))] })), filteredOptions.length ? (_jsx(StyledListFieldsWrapper, { "$minHeight": calDefaultListHeightInPopover({
117
117
  listLength: filteredOptions.length,
118
118
  itemSize,
119
119
  itemSpacing,
120
- }), children: _jsx(VirtualizedMenu, { ...menuProps, itemSize: itemSize, items: items }) })) : (_jsx(EmptyData, { showIcon: false, description: t(translations.noData).toString() })), _jsxs(StyledFooter, { children: [_jsx(Button, { onClick: handleCancel, children: "Cancel" }), _jsx(Button, { onClick: handleApply, disabled: applyDisabled, type: "primary", children: "Apply" })] })] }), trigger: ['click'], open: open, inputSearchProps: {
120
+ }), children: _jsx(VirtualizedMenu, { ...menuProps, itemSize: itemSize, items: items }) })) : (_jsx(EmptyData, { showIcon: false, description: t(translations.noData).toString() })), _jsxs(StyledFooter, { children: [_jsx(Button, { onClick: handleCancel, children: "Cancel" }), _jsx(Button, { onClick: handleApply, disabled: applyDisabled, type: "primary", children: "Apply" })] })] }), trigger: ['click'], placement: "bottomLeft", open: open, inputSearchProps: {
121
121
  ...restInputSearchProps,
122
122
  value: search,
123
123
  onAfterChange: handleOnSearch,
@@ -6,7 +6,6 @@ export { Select } from './Select';
6
6
  export { SelectV2 } from './SelectV2';
7
7
  export { DatePicker } from './DatePicker';
8
8
  export { ChatBox, ChatBoxInsight } from './ChatBox';
9
- export { EditingListV2 } from './EditingListV2';
10
9
  export { PopupDraggable } from './PopupDraggable';
11
10
  export { CaptureScreen } from './CaptureScreen';
12
11
  export { SettingWrapper } from './SettingWrapper';
@@ -6,7 +6,6 @@ export { Select } from './Select';
6
6
  export { SelectV2 } from './SelectV2';
7
7
  export { DatePicker } from './DatePicker';
8
8
  export { ChatBox, ChatBoxInsight } from './ChatBox';
9
- export { EditingListV2 } from './EditingListV2';
10
9
  export { PopupDraggable } from './PopupDraggable';
11
10
  export { CaptureScreen } from './CaptureScreen';
12
11
  export { SettingWrapper } from './SettingWrapper';
@@ -3,5 +3,4 @@
3
3
  * Asynchronously loads the component for TemplateListing
4
4
  *
5
5
  */
6
- /// <reference types="react" />
7
6
  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.6-beta.010",
3
+ "version": "1.3.6-beta.002",
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.37",
64
+ "@antscorp/antsomi-locales": "1.0.35",
65
65
  "@ant-design/cssinjs": "^1.6.2",
66
66
  "@antscorp/icons": "0.27.56",
67
67
  "@antscorp/image-editor": "1.0.2",
@@ -1,2 +0,0 @@
1
- import { EditingListProps } from './types';
2
- export declare const EditingListV2: (props: EditingListProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,15 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useMemo } from 'react';
3
- import { Suspense } from '../../atoms';
4
- import { ListItem, LazyComponent } from './components';
5
- const { Popover } = LazyComponent;
6
- export const EditingListV2 = (props) => {
7
- const { isLoading = false, addButtonLabel = 'Add', options = [], selected = [], removable = true, popupPlacement = 'right', className, onChange, } = props;
8
- const selectedOptions = useMemo(() => options.filter(opt => selected.includes(opt.key)), [selected, options]);
9
- // const isSelectAll = selectedOptions.length === options.length;
10
- const handleRemove = (removedKey) => {
11
- const selectedKeys = selectedOptions.filter(opt => opt.key !== removedKey).map(opt => opt.key);
12
- onChange?.(selectedKeys);
13
- };
14
- return (_jsxs("div", { className: className, children: [_jsx(ListItem, { isLoading: isLoading, selectOptions: selectedOptions, removable: removable, onClickRemove: handleRemove }), !isLoading && (_jsx(Suspense, { children: _jsx(Popover, { placement: popupPlacement, options: options, selected: selected, addButtonLabel: addButtonLabel, onChange: onChange }) }))] }));
15
- };
@@ -1,6 +0,0 @@
1
- type ActionProps = {
2
- removable: boolean;
3
- onClickRemove: () => void;
4
- };
5
- export declare const Action: (props: ActionProps) => import("react/jsx-runtime").JSX.Element | null;
6
- export {};
@@ -1,10 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { CloseIcon } from '@antscorp/antsomi-ui/es/components/icons';
3
- import { globalToken } from '@antscorp/antsomi-ui/es/constants';
4
- import { CLS } from '../../utils';
5
- export const Action = (props) => {
6
- const { removable, onClickRemove } = props;
7
- if (!removable)
8
- return null;
9
- return (_jsx(CloseIcon, { className: CLS.RemoveButton.default, size: 20, color: globalToken?.bw8, onClick: onClickRemove }));
10
- };
@@ -1 +0,0 @@
1
- export { Action } from './Action';
@@ -1 +0,0 @@
1
- export { Action } from './Action';
@@ -1,9 +0,0 @@
1
- import { Option } from '../../types';
2
- type ListProps = {
3
- isLoading: boolean;
4
- selectOptions: Option[];
5
- removable?: boolean;
6
- onClickRemove?: (key: string) => void;
7
- };
8
- export declare const ListItem: (props: ListProps) => import("react/jsx-runtime").JSX.Element | undefined;
9
- export {};
@@ -1,38 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { Spin, Typography } from '../../../../atoms';
3
- import { isEmpty } from 'lodash';
4
- import { CLS } from '../../utils';
5
- import { List } from 'antd';
6
- import { CloseIcon } from '@antscorp/antsomi-ui/es/components/icons';
7
- import { globalToken } from '@antscorp/antsomi-ui/es/constants';
8
- import { useState } from 'react';
9
- export const ListItem = (props) => {
10
- const { isLoading, selectOptions, onClickRemove, removable } = props;
11
- const [hover, setHover] = useState('');
12
- const renderLabel = (label) => {
13
- if (typeof label === 'string') {
14
- return _jsx(Typography.Text, { ellipsis: { tooltip: true }, children: label });
15
- }
16
- return label;
17
- };
18
- const items = selectOptions.map(opt => ({
19
- className: CLS.ListItem.default,
20
- key: opt.key,
21
- label: renderLabel(opt.label),
22
- }));
23
- if (isLoading) {
24
- return _jsx(Spin, { indicatorSize: 24 });
25
- }
26
- if (isEmpty(selectOptions)) {
27
- return;
28
- }
29
- return (_jsx(List, { dataSource: items, renderItem: item => (_jsxs(List.Item, { style: {
30
- display: 'flex',
31
- alignItems: 'center',
32
- border: '1px solid #B8CFE6',
33
- borderRadius: '4px',
34
- padding: '10px',
35
- marginBottom: '10px',
36
- minHeight: '40px',
37
- }, onMouseEnter: () => setHover(item.key), onMouseLeave: () => setHover(''), children: [item.label, ' ', hover === item.key && removable && (_jsx(CloseIcon, { size: 18, color: globalToken?.bw8, style: { flexShrink: 0 }, onClick: onClickRemove ? () => onClickRemove(item.key) : undefined }))] })) }));
38
- };
@@ -1 +0,0 @@
1
- export { ListItem } from './List';
@@ -1 +0,0 @@
1
- export { ListItem } from './List';
@@ -1,14 +0,0 @@
1
- /// <reference types="react" />
2
- export declare const Title: import("react").LazyExoticComponent<(props: {
3
- title: import("react").ReactNode;
4
- showNum: boolean;
5
- selectedAmount?: number | undefined;
6
- optionAmount?: number | undefined;
7
- }) => import("react/jsx-runtime").JSX.Element>;
8
- export declare const Popover: import("react").LazyExoticComponent<(props: {
9
- placement?: "leftTop" | "leftBottom" | "rightTop" | "rightBottom" | "left" | "right" | "bottom" | "top" | "bottomLeft" | "topLeft" | "topRight" | "bottomRight" | undefined;
10
- options: import("../types").Option[];
11
- selected: string[];
12
- addButtonLabel: import("react").ReactNode;
13
- onChange?: ((selected: string[]) => void) | undefined;
14
- }) => import("react/jsx-runtime").JSX.Element>;
@@ -1,3 +0,0 @@
1
- import { lazy } from 'react';
2
- export const Title = lazy(() => import('./Title').then(module => ({ default: module.Title })));
3
- export const Popover = lazy(() => import('./Popover').then(module => ({ default: module.Popover })));
@@ -1,11 +0,0 @@
1
- /// <reference types="react" />
2
- import { Option } from '../../types';
3
- type PopoverProps = {
4
- placement?: 'left' | 'right' | 'top' | 'bottom' | 'topLeft' | 'topRight' | 'bottomLeft' | 'bottomRight' | 'leftTop' | 'leftBottom' | 'rightTop' | 'rightBottom';
5
- options: Option[];
6
- selected: string[];
7
- addButtonLabel: React.ReactNode;
8
- onChange?: (selected: string[]) => void;
9
- };
10
- export declare const Popover: (props: PopoverProps) => import("react/jsx-runtime").JSX.Element;
11
- export {};
@@ -1,17 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
- import { Button } from '@antscorp/antsomi-ui/es/components/atoms';
3
- import { AddIcon } from '../../../../icons';
4
- import { PopoverAddField } from '../../../SearchPopover';
5
- export const Popover = (props) => {
6
- const { options, selected, addButtonLabel, onChange, placement } = props;
7
- return (_jsx(_Fragment, { children: _jsx(PopoverAddField, { style: { margin: 0 }, fields: options, placement: placement, selected: selected,
8
- // onApply={value =>
9
- // updateUnsubscribeSetting([
10
- // {
11
- // fieldPath: 'settings.unsubscribePreferences.preferenceListIds',
12
- // data: value as unknown as string,
13
- // },
14
- // ])
15
- // }
16
- onApply: onChange, children: _jsxs(Button, { type: "text", children: [_jsx(AddIcon, { size: 14 }), addButtonLabel] }) }) }));
17
- };
@@ -1 +0,0 @@
1
- export { Popover } from './Popover';
@@ -1 +0,0 @@
1
- export { Popover } from './Popover';
@@ -1,4 +0,0 @@
1
- /// <reference types="react" />
2
- type SearchProps = {} & React.ComponentProps<'input'>;
3
- export declare const Search: (props: SearchProps) => import("react/jsx-runtime").JSX.Element;
4
- export {};
@@ -1,8 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import clsx from 'clsx';
3
- import { InputSearch } from '../../../InputSearch';
4
- import { CLS } from '../../utils';
5
- export const Search = (props) => {
6
- const { className, placeholder, onChange } = props;
7
- return (_jsx(InputSearch, { className: clsx(CLS.Search, className), placeholder: placeholder || 'Search...', onChange: onChange }));
8
- };
@@ -1 +0,0 @@
1
- export { Search } from './Search';
@@ -1 +0,0 @@
1
- export { Search } from './Search';
@@ -1,9 +0,0 @@
1
- /// <reference types="react" />
2
- type TitleProps = {
3
- title: React.ReactNode;
4
- showNum: boolean;
5
- selectedAmount?: number;
6
- optionAmount?: number;
7
- };
8
- export declare const Title: (props: TitleProps) => import("react/jsx-runtime").JSX.Element;
9
- export {};
@@ -1,16 +0,0 @@
1
- import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
2
- import { Flex, Typography } from 'antd';
3
- import { AmountSelected } from '../../styled';
4
- import { CLS } from '../../utils';
5
- export const Title = (props) => {
6
- const { title, showNum } = props;
7
- const renderSelectedAmount = () => {
8
- if (!showNum)
9
- return null;
10
- const { optionAmount, selectedAmount } = props;
11
- if (!optionAmount || !selectedAmount)
12
- return null;
13
- return (_jsxs(AmountSelected, { children: ["(", selectedAmount, "/", optionAmount, ")"] }));
14
- };
15
- return (_jsxs(Flex, { className: CLS.Title.default, align: "center", gap: 8, children: [_jsx(Typography.Text, { strong: true, children: title }), renderSelectedAmount()] }));
16
- };
@@ -1 +0,0 @@
1
- export { Title } from './Title';
@@ -1 +0,0 @@
1
- export { Title } from './Title';
@@ -1,6 +0,0 @@
1
- export { ListItem } from './List';
2
- export { Action } from './Action';
3
- export { Search } from './Search';
4
- export { Popover } from './Popover';
5
- export { Title } from './Title';
6
- export * as LazyComponent from './Loadable';
@@ -1,6 +0,0 @@
1
- export { ListItem } from './List';
2
- export { Action } from './Action';
3
- export { Search } from './Search';
4
- export { Popover } from './Popover';
5
- export { Title } from './Title';
6
- export * as LazyComponent from './Loadable';
@@ -1,2 +0,0 @@
1
- export { EditingListV2 } from './EditingList';
2
- export type { EditingListProps } from './types';
@@ -1 +0,0 @@
1
- export { EditingListV2 } from './EditingList';
@@ -1,5 +0,0 @@
1
- /// <reference types="react" />
2
- export declare const EditingListRoot: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("antd").FlexProps<import("antd/es/_util/type").AnyObject> & import("react").RefAttributes<HTMLElement>>, any, {}, never>;
3
- export declare const StyledListWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
4
- export declare const StyledAddBtn: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("antd").FlexProps<import("antd/es/_util/type").AnyObject> & import("react").RefAttributes<HTMLElement>>, any, {}, never>;
5
- export declare const AmountSelected: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("antd/es/typography/Text").TextProps & import("react").RefAttributes<HTMLSpanElement>>, any, {}, never>;
@@ -1,38 +0,0 @@
1
- import { globalToken } from '@antscorp/antsomi-ui/es/constants';
2
- import { Flex, Typography } from 'antd';
3
- import styled from 'styled-components';
4
- import { CLS } from './utils';
5
- export const EditingListRoot = styled(Flex) `
6
- /* height: 100%; */
7
- `;
8
- export const StyledListWrapper = styled.div `
9
- /* flex: auto; */
10
- /* height: auto; */
11
-
12
- .${CLS.ListItem.default} {
13
- .${CLS.RemoveButton.default} {
14
- flex-shrink: 0;
15
- display: none;
16
- }
17
-
18
- &:hover {
19
- .${CLS.RemoveButton.default} {
20
- display: block;
21
- }
22
- }
23
- }
24
- `;
25
- export const StyledAddBtn = styled(Flex) `
26
- color: ${globalToken?.colorPrimary};
27
- cursor: pointer;
28
- font-weight: bold;
29
- align-items: center;
30
- justify-content: space-between;
31
- gap: 4px;
32
- width: fit-content;
33
- `;
34
- export const AmountSelected = styled(Typography.Text) `
35
- &.antsomi-typography {
36
- font-size: 11px;
37
- }
38
- `;
@@ -1,18 +0,0 @@
1
- /// <reference types="react" />
2
- export type Option = {
3
- key: string;
4
- label: React.ReactNode;
5
- search?: string;
6
- };
7
- export type EditingListProps = {
8
- popupPlacement?: 'left' | 'right' | 'top' | 'bottom' | 'topLeft' | 'topRight' | 'bottomLeft' | 'bottomRight' | 'leftTop' | 'leftBottom' | 'rightTop' | 'rightBottom';
9
- addButtonLabel?: string;
10
- options?: Option[];
11
- selected?: string[];
12
- showNum?: boolean;
13
- className?: string;
14
- isLoading?: boolean;
15
- emptyDescription?: string;
16
- removable?: boolean;
17
- onChange?: (selected: string[]) => void;
18
- };
@@ -1 +0,0 @@
1
- export {};
@@ -1,27 +0,0 @@
1
- export declare const componentCls: (className: string) => string;
2
- export declare const CLS: {
3
- readonly Root: {
4
- readonly default: string;
5
- };
6
- readonly Title: {
7
- readonly default: string;
8
- };
9
- readonly Search: {
10
- readonly default: string;
11
- };
12
- readonly RemoveButton: {
13
- readonly default: string;
14
- };
15
- readonly AddButton: {
16
- readonly default: string;
17
- };
18
- readonly ListWapper: {
19
- readonly default: string;
20
- };
21
- readonly List: {
22
- readonly default: string;
23
- };
24
- readonly ListItem: {
25
- readonly default: string;
26
- };
27
- };
@@ -1,28 +0,0 @@
1
- import { antsomiClsx } from '@antscorp/antsomi-ui/es/utils';
2
- export const componentCls = antsomiClsx('editing-list');
3
- export const CLS = {
4
- Root: {
5
- default: componentCls('root'),
6
- },
7
- Title: {
8
- default: componentCls('title'),
9
- },
10
- Search: {
11
- default: componentCls('search'),
12
- },
13
- RemoveButton: {
14
- default: componentCls('remove-btn'),
15
- },
16
- AddButton: {
17
- default: componentCls('add-btn'),
18
- },
19
- ListWapper: {
20
- default: componentCls('selected-list-wrapper'),
21
- },
22
- List: {
23
- default: componentCls('selected-list'),
24
- },
25
- ListItem: {
26
- default: componentCls('selected-list-item'),
27
- },
28
- };