@antscorp/antsomi-ui 1.3.5-beta.978 → 1.3.5-beta.979

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.
@@ -12,6 +12,7 @@ type Option = {
12
12
  export interface InputSelectAttributeProps {
13
13
  sourceOptions: Option[];
14
14
  codeOptions: Option[];
15
+ listSourceInit: Option[];
15
16
  label?: string;
16
17
  errorMsg?: string;
17
18
  value: Value;
@@ -13,7 +13,7 @@ import { StyledSelect } from './styled';
13
13
  // Constants
14
14
  import { THEME } from '@antscorp/antsomi-ui/es/constants';
15
15
  const InputSelectAttribute = (props) => {
16
- const { value, errorMsg, label, sourceOptions = [], codeOptions = [], onChange, onChangeSelectSource, } = props;
16
+ const { value, errorMsg, label, listSourceInit = [], sourceOptions = [], codeOptions = [], onChange, onChangeSelectSource, } = props;
17
17
  const [form] = Form.useForm();
18
18
  // States
19
19
  const [openModal, setOpenModal] = useState(false);
@@ -34,6 +34,7 @@ const InputSelectAttribute = (props) => {
34
34
  }, [attributeState, codeOptions, form]);
35
35
  // Memoized
36
36
  const mapCodeOpts = useMemo(() => keyBy(codeOptions, 'value'), [codeOptions]);
37
+ const listSourceInitOpts = useMemo(() => keyBy(listSourceInit, 'value'), [listSourceInit]);
37
38
  const onOpenModal = useCallback(() => {
38
39
  setOpenModal(true);
39
40
  }, []);
@@ -72,7 +73,7 @@ const InputSelectAttribute = (props) => {
72
73
  height: 32,
73
74
  padding: '4px 12px 4px 4px',
74
75
  borderBottom: `1px solid ${errorMsg ? THEME.token?.colorError : THEME.token?.blue1}`,
75
- }, 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 })] }));
76
+ }, children: [_jsx("div", { style: { width: '100%', cursor: 'pointer' }, onClick: onOpenModal, children: isObjValue && (_jsx(Tag, { children: get(mapCodeOpts, [value.code, 'label'], get(listSourceInitOpts, [value.code, 'label'])) })) }), _jsx(Icon, { type: "icon-ants-remove", style: { fontSize: 10, color: '#222', cursor: 'pointer' }, onClick: onDeselect })] }));
76
77
  }
77
78
  else {
78
79
  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: {
@@ -87,8 +88,6 @@ const InputSelectAttribute = (props) => {
87
88
  }, children: [_jsx(Form.Item, { label: translate(translations._TITL_PERSONALIZATION_TYPE, 'Content Source'), name: "sources", required: true, labelCol: { span: 6 }, labelAlign: "left", rules: [{ required: true, message: 'Please select field!' }], children: _jsx(Select, { suffixIcon: _jsx(Icon, { type: "icon-ants-expand-more", style: { fontSize: '20px', color: THEME.token?.colorIcon } }), options: sourceOptions, value: attributeState.source, onChange: newValue => {
88
89
  setAttributeState(state => ({ ...state, code: '', source: newValue }));
89
90
  onChangeSelectSource(newValue);
90
- } }) }), _jsx(Form.Item, { label: label || 'Allocated Code', required: true, labelCol: { span: 6 }, labelAlign: "left", name: "code", rules: [{ required: true, message: 'Please select field!' }], children: _jsx(Select, { suffixIcon: _jsx(Icon, { type: "icon-ants-expand-more", style: { fontSize: '20px', color: THEME.token?.colorIcon } }), value: attributeState.code, options: codeOptions, onChange: newValue => {
91
- setAttributeState(state => ({ ...state, source: newValue }));
92
- } }) })] }) })] }));
91
+ } }) }), _jsx(Form.Item, { label: label || 'Allocated Code', required: true, labelCol: { span: 6 }, labelAlign: "left", name: "code", rules: [{ required: true, message: 'Please select field!' }], children: _jsx(Select, { suffixIcon: _jsx(Icon, { type: "icon-ants-expand-more", style: { fontSize: '20px', color: THEME.token?.colorIcon } }), value: attributeState.code, options: codeOptions }) })] }) })] }));
93
92
  };
94
93
  export default memo(InputSelectAttribute);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antscorp/antsomi-ui",
3
- "version": "1.3.5-beta.978",
3
+ "version": "1.3.5-beta.979",
4
4
  "description": "An enterprise-class UI design language and React UI library.",
5
5
  "sideEffects": [
6
6
  "dist/*",