@antscorp/antsomi-ui 1.3.5-beta.383 → 1.3.5-beta.385
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/EditableName/EditableName.js +12 -11
- package/es/components/molecules/EditorTab/EditorTab.d.ts +1 -0
- package/es/components/molecules/EditorTab/EditorTab.js +10 -4
- package/es/components/organism/LeftMenu/hooks/usePermission.js +8 -3
- package/es/components/template/Layout/Layout.js +1 -1
- package/es/config/index.d.ts +1 -0
- package/es/config/index.js +1 -0
- package/es/constants/api.d.ts +5 -0
- package/es/constants/api.js +5 -0
- package/package.json +3 -2
|
@@ -3,12 +3,15 @@ import { InputWrapperStyled } from './styled';
|
|
|
3
3
|
import { Input, Tooltip } from 'antd';
|
|
4
4
|
import { THEME } from '@antscorp/antsomi-ui/es/constants';
|
|
5
5
|
import Icon from '@antscorp/icons';
|
|
6
|
+
import { useInView } from 'react-intersection-observer';
|
|
6
7
|
import { Spin } from '../../atoms';
|
|
7
8
|
export const EditableName = React.forwardRef((props, ref) => {
|
|
8
9
|
var _a;
|
|
9
|
-
const { className, isLoading,
|
|
10
|
+
const { className, isLoading, required, error, value, style, readonly, maxLength, onBlur, onChange, } = props;
|
|
11
|
+
const defaultValue = useRef(props.defaultValue);
|
|
10
12
|
const [inputWidth, setInputWidth] = useState(1);
|
|
11
|
-
const [internalValue, setInternalValue] = useState(value || defaultValue || '');
|
|
13
|
+
const [internalValue, setInternalValue] = useState(value || defaultValue.current || '');
|
|
14
|
+
const { ref: componentInViewRef, inView: componentInView } = useInView();
|
|
12
15
|
const requiredError = useMemo(() => {
|
|
13
16
|
const newValue = value ? value.trim() : internalValue.trim();
|
|
14
17
|
return required && newValue.length === 0 ? 'This field is required' : '';
|
|
@@ -29,16 +32,14 @@ export const EditableName = React.forwardRef((props, ref) => {
|
|
|
29
32
|
};
|
|
30
33
|
useEffect(() => {
|
|
31
34
|
var _a;
|
|
32
|
-
if (spanRef.current)
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}, [value]);
|
|
39
|
-
return (React.createElement(InputWrapperStyled, { className: className || '', style: style },
|
|
35
|
+
if (!spanRef.current || !componentInView)
|
|
36
|
+
return;
|
|
37
|
+
spanRef.current.innerText = value || defaultValue.current || '';
|
|
38
|
+
setInputWidth(((_a = spanRef.current) === null || _a === void 0 ? void 0 : _a.offsetWidth) || 1);
|
|
39
|
+
}, [value, componentInView]);
|
|
40
|
+
return (React.createElement(InputWrapperStyled, { className: className || '', style: style, ref: componentInViewRef },
|
|
40
41
|
React.createElement(Tooltip, { title: value || internalValue },
|
|
41
|
-
React.createElement(Input, { readOnly: readonly, ref: inputRef, style: { width: inputWidth + 2 }, defaultValue: defaultValue, value: value, onChange: event => {
|
|
42
|
+
React.createElement(Input, { readOnly: readonly, ref: inputRef, style: { width: inputWidth + 2 }, defaultValue: defaultValue.current, value: value, onChange: event => {
|
|
42
43
|
var _a;
|
|
43
44
|
const newValue = event.target.value;
|
|
44
45
|
if (spanRef.current)
|
|
@@ -26,6 +26,7 @@ interface EditorTabProps {
|
|
|
26
26
|
modalFuncProps?: ModalFuncProps;
|
|
27
27
|
onActiveTab: (id: string) => void;
|
|
28
28
|
onCloseTab: (tab: EditorTabItem, index: number, newTabs: EditorTabItem[]) => void;
|
|
29
|
+
onConfirmRemove?: (tab: EditorTabItem) => void;
|
|
29
30
|
onConfigure: (id: string) => void;
|
|
30
31
|
onSaveName?: (id: string, value: string) => void;
|
|
31
32
|
onAddTab: () => void;
|
|
@@ -22,7 +22,7 @@ export const EditorTab = props => {
|
|
|
22
22
|
var _a;
|
|
23
23
|
const { listTab = [], activeId = '', showArrow, showDropdown, editNameOnConfigure,
|
|
24
24
|
// disabledScroll,
|
|
25
|
-
onCloseTab, onActiveTab, onAddTab, onConfigure, onSaveName, newTabText, showComposeNewQuery, className, leftBlockClassName, tabItemClassName, confirmOnRemoveTab = true, modalFuncProps, } = props;
|
|
25
|
+
onCloseTab, onConfirmRemove, onActiveTab, onAddTab, onConfigure, onSaveName, newTabText, showComposeNewQuery, className, leftBlockClassName, tabItemClassName, confirmOnRemoveTab = true, modalFuncProps, } = props;
|
|
26
26
|
const [activeTabId, setActiveTabId] = useState(activeId || ((_a = listTab === null || listTab === void 0 ? void 0 : listTab[0]) === null || _a === void 0 ? void 0 : _a.id));
|
|
27
27
|
const [arrTabs, setArrTabs] = useState(listTab || []);
|
|
28
28
|
const [isEditable, setIsEditable] = useState();
|
|
@@ -49,7 +49,13 @@ export const EditorTab = props => {
|
|
|
49
49
|
const handleAddNew = () => {
|
|
50
50
|
onAddTab();
|
|
51
51
|
};
|
|
52
|
-
const modalConfirmAsync = useCallback(() =>
|
|
52
|
+
const modalConfirmAsync = useCallback((tab) => {
|
|
53
|
+
const modalInstance = modal.confirm(Object.assign({ title: 'Remove this tab', content: 'Removing this tab will delete it permanently. Are you sure you want to perform this action?', okText: 'Confirm', icon: React.createElement("span", { style: { display: 'none' } }), onOk: () => {
|
|
54
|
+
if (onConfirmRemove)
|
|
55
|
+
return onConfirmRemove(tab);
|
|
56
|
+
}, className: 'editor-tab__modal-confirm', centered: true }, modalFuncProps));
|
|
57
|
+
return modalInstance;
|
|
58
|
+
}, [modalFuncProps, modal, onConfirmRemove]);
|
|
53
59
|
const handleActiveTab = useCallback((tabId) => {
|
|
54
60
|
setActiveTabId(tabId);
|
|
55
61
|
if (onActiveTab)
|
|
@@ -60,7 +66,7 @@ export const EditorTab = props => {
|
|
|
60
66
|
if (arrTabs.length < 2) {
|
|
61
67
|
return;
|
|
62
68
|
}
|
|
63
|
-
const isConfirm = confirmOnRemoveTab ? yield modalConfirmAsync() : true;
|
|
69
|
+
const isConfirm = confirmOnRemoveTab ? yield modalConfirmAsync(tab) : true;
|
|
64
70
|
if (!isConfirm)
|
|
65
71
|
return;
|
|
66
72
|
if (activeTabId === tab.id) {
|
|
@@ -143,7 +149,7 @@ export const EditorTab = props => {
|
|
|
143
149
|
break;
|
|
144
150
|
}
|
|
145
151
|
}),
|
|
146
|
-
}, placement: "
|
|
152
|
+
}, placement: "bottomLeft", trigger: ['click'], destroyPopupOnHide: true },
|
|
147
153
|
React.createElement(Button, { icon: React.createElement(Icon, { type: "icon-ants-three-dot-vertical", overlayStyle: { fontSize: 12 } }), size: "small" }))) : closeable ? (React.createElement(Button, { onClick: e => handleCloseTab(e, tab, idx), icon: React.createElement(Icon, { type: "icon-ants-remove-slim", overlayStyle: { fontSize: 12 } }), size: "small" })) : null));
|
|
148
154
|
})
|
|
149
155
|
: null),
|
|
@@ -19,8 +19,13 @@ export const usePermission = () => {
|
|
|
19
19
|
const { data: menuList } = useGetListMenu({
|
|
20
20
|
args: {
|
|
21
21
|
auth: {
|
|
22
|
-
token: '
|
|
23
|
-
|
|
22
|
+
token: ['development', 'sandbox'].includes(env)
|
|
23
|
+
? '5474r2x214r2b4b4v2d4y444u2v5q2p5o4d4c4f424e4'
|
|
24
|
+
: auth === null || auth === void 0 ? void 0 : auth.token,
|
|
25
|
+
// url: 'https://sandbox-permission.ants.vn',
|
|
26
|
+
url: ['development', 'sandbox'].includes(env)
|
|
27
|
+
? 'https://sandbox-permission.ants.vn'
|
|
28
|
+
: permissionDomain, // NOTE: Hard for sandbox, development
|
|
24
29
|
portalId: auth === null || auth === void 0 ? void 0 : auth.portalId,
|
|
25
30
|
userId: auth === null || auth === void 0 ? void 0 : auth.userId,
|
|
26
31
|
accountId: auth === null || auth === void 0 ? void 0 : auth.accountId,
|
|
@@ -30,7 +35,7 @@ export const usePermission = () => {
|
|
|
30
35
|
},
|
|
31
36
|
},
|
|
32
37
|
options: {
|
|
33
|
-
enabled: !!(auth === null || auth === void 0 ? void 0 : auth.userId) && !!auth.portalId,
|
|
38
|
+
enabled: !!(auth === null || auth === void 0 ? void 0 : auth.userId) && !!auth.portalId && !!permissionDomain,
|
|
34
39
|
},
|
|
35
40
|
});
|
|
36
41
|
const { data: dashboardData, refetch: refetchDashboard } = useGetDashboard({
|
|
@@ -130,7 +130,7 @@ export const Layout = memo(props => {
|
|
|
130
130
|
return (React.createElement(LayoutWrapper, { showLeftMenu: !!showLeftMenu },
|
|
131
131
|
React.createElement(HeaderV2, Object.assign({}, mergeHeaderProps, { showLogo: !showLeftMenu })),
|
|
132
132
|
React.createElement(Flex, { className: "layout-body" },
|
|
133
|
-
showLeftMenu && (React.createElement(LeftMenu, Object.assign({ className: `layout-body__menu ${leftMenuClassName}
|
|
133
|
+
showLeftMenu && (React.createElement(LeftMenu, Object.assign({ className: `layout-body__menu ${leftMenuClassName}` }, mergeLeftMenuProps, { appConfig: Object.assign(Object.assign({}, appConfig), { permissionDomain }), onActiveMenuCodeChange: onActiveMenuCodeChange }))),
|
|
134
134
|
React.createElement(ContentWrapper, Object.assign({ "$noPadding": noPadding, "$noSpaceTopContent": noSpaceTopContent }, mergeContentWrapperProps), activeMenuCode === HOME_MENU_ITEMS.RECOMMENDATION.menu_item_code ? (React.createElement("div", { className: "layout-body__content" },
|
|
135
135
|
React.createElement(RecommendationWorkspace, null))) : (React.createElement("div", Object.assign({ className: `layout-body__content ${(workspaceProps === null || workspaceProps === void 0 ? void 0 : workspaceProps.className) || ''}` }, mergeWorkSpaceProps),
|
|
136
136
|
React.createElement(NotificationWrapper, { ref: notificationWrapperRef },
|
package/es/config/index.d.ts
CHANGED
package/es/config/index.js
CHANGED
package/es/constants/api.d.ts
CHANGED
|
@@ -5,11 +5,13 @@ export declare const TINYMCE_API_KEY = "scyw71pj8619analvxs56ppc2w2fj2kpy5vnmflh
|
|
|
5
5
|
export declare const CDP_API: {
|
|
6
6
|
development: string;
|
|
7
7
|
sandbox: string;
|
|
8
|
+
staging: string;
|
|
8
9
|
production: string;
|
|
9
10
|
};
|
|
10
11
|
export declare const ISSUE_API: {
|
|
11
12
|
development: string;
|
|
12
13
|
sandbox: string;
|
|
14
|
+
staging: string;
|
|
13
15
|
production: string;
|
|
14
16
|
};
|
|
15
17
|
export declare const PLATFORM_API = "https://platform.ants.tech";
|
|
@@ -20,18 +22,21 @@ export declare const APP_PERMISSION_DOMAIN: {
|
|
|
20
22
|
[x: string]: {
|
|
21
23
|
development: string;
|
|
22
24
|
sandbox: string;
|
|
25
|
+
staging: string;
|
|
23
26
|
production: string;
|
|
24
27
|
};
|
|
25
28
|
};
|
|
26
29
|
export declare const PERMISSION_ENV_API: {
|
|
27
30
|
development: string;
|
|
28
31
|
sandbox: string;
|
|
32
|
+
staging: string;
|
|
29
33
|
production: string;
|
|
30
34
|
};
|
|
31
35
|
export declare const APP_IAM_DOMAIN: {
|
|
32
36
|
[x: string]: {
|
|
33
37
|
development: string;
|
|
34
38
|
sandbox: string;
|
|
39
|
+
staging: string;
|
|
35
40
|
production: string;
|
|
36
41
|
};
|
|
37
42
|
};
|
package/es/constants/api.js
CHANGED
|
@@ -9,11 +9,13 @@ export const TINYMCE_API_KEY = 'scyw71pj8619analvxs56ppc2w2fj2kpy5vnmflhhc300y35
|
|
|
9
9
|
export const CDP_API = {
|
|
10
10
|
[ENV.DEV]: 'https://sandbox-app.cdp.asia',
|
|
11
11
|
[ENV.SANDBOX]: 'https://sandbox-app.cdp.asia',
|
|
12
|
+
[ENV.STAGING]: 'https://staging-cdp.antsomi.com',
|
|
12
13
|
[ENV.PROD]: 'https://cdp.antsomi.com',
|
|
13
14
|
};
|
|
14
15
|
export const ISSUE_API = {
|
|
15
16
|
[ENV.DEV]: 'https://sandbox-issue.antsomi.com',
|
|
16
17
|
[ENV.SANDBOX]: 'https://sandbox-issue.antsomi.com',
|
|
18
|
+
[ENV.STAGING]: 'https://issue.antsomi.com',
|
|
17
19
|
[ENV.PROD]: 'https://issue.antsomi.com',
|
|
18
20
|
};
|
|
19
21
|
export const PLATFORM_API = 'https://platform.ants.tech';
|
|
@@ -23,6 +25,7 @@ export const IAM_API = 'https://iam.ants.tech';
|
|
|
23
25
|
const PERMISSION_URLS = {
|
|
24
26
|
[ENV.DEV]: 'https://sandbox-permission.ants.vn',
|
|
25
27
|
[ENV.SANDBOX]: 'https://sandbox-permission.ants.vn',
|
|
28
|
+
[ENV.STAGING]: 'https://permission.antsomi.com',
|
|
26
29
|
[ENV.PROD]: 'https://permission.antsomi.com',
|
|
27
30
|
};
|
|
28
31
|
export const APP_PERMISSION_DOMAIN = {
|
|
@@ -34,11 +37,13 @@ export const APP_IAM_DOMAIN = {
|
|
|
34
37
|
[DATAFLOWS]: {
|
|
35
38
|
[ENV.DEV]: 'https://sandbox-aacm.ants.vn',
|
|
36
39
|
[ENV.SANDBOX]: 'https://sandbox-aacm.ants.vn',
|
|
40
|
+
[ENV.STAGING]: 'https://iam.ants.tech',
|
|
37
41
|
[ENV.PROD]: 'https://iam.ants.tech',
|
|
38
42
|
},
|
|
39
43
|
[APP_ANTALYSER]: {
|
|
40
44
|
[ENV.DEV]: 'https://sandbox-aacm.ants.vn',
|
|
41
45
|
[ENV.SANDBOX]: 'https://sandbox-aacm.ants.vn',
|
|
46
|
+
[ENV.STAGING]: 'https://iam.ants.tech',
|
|
42
47
|
[ENV.PROD]: 'https://iam.ants.tech',
|
|
43
48
|
},
|
|
44
49
|
};
|
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.385",
|
|
4
4
|
"description": "An enterprise-class UI design language and React UI library.",
|
|
5
5
|
"sideEffects": [
|
|
6
6
|
"dist/*",
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
"not op_mini all"
|
|
60
60
|
],
|
|
61
61
|
"dependencies": {
|
|
62
|
-
"@antscorp/icons": "0.27.
|
|
62
|
+
"@antscorp/icons": "0.27.37",
|
|
63
63
|
"@antscorp/image-editor": "1.0.2",
|
|
64
64
|
"@antscorp/processing-notification": "^1.0.3",
|
|
65
65
|
"@dnd-kit/core": "^6.1.0",
|
|
@@ -111,6 +111,7 @@
|
|
|
111
111
|
"react-draggable": "^4.4.5",
|
|
112
112
|
"react-frame-component": "^5.2.6",
|
|
113
113
|
"react-konva": "^18.2.10",
|
|
114
|
+
"react-intersection-observer": "^9.10.3",
|
|
114
115
|
"react-markdown": "^8.0.7",
|
|
115
116
|
"react-resizable": "^3.0.5",
|
|
116
117
|
"react-syntax-highlighter": "^15.5.0",
|