@antscorp/antsomi-ui 1.3.5-beta.403 → 1.3.5-beta.404

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 (51) hide show
  1. package/es/components/molecules/AccountSelection/hooks/useAccountSelection.d.ts +1 -1
  2. package/es/components/molecules/AddDynamicContent/utils.d.ts +4 -4
  3. package/es/components/molecules/CalendarSelection/actions.d.ts +1 -1
  4. package/es/components/molecules/CalendarSelection/hooks/useStateContext.d.ts +2 -2
  5. package/es/components/molecules/CalendarSelection/utils.d.ts +2 -2
  6. package/es/components/molecules/DatePicker/components/AdvancedPicker/AdvancedPicker.d.ts +1 -0
  7. package/es/components/molecules/DatePicker/components/AdvancedPicker/AdvancedPicker.js +4 -2
  8. package/es/components/molecules/DatePicker/components/AdvancedRangePicker/AdvancedRangePicker.d.ts +1 -0
  9. package/es/components/molecules/DatePicker/components/AdvancedRangePicker/AdvancedRangePicker.js +6 -3
  10. package/es/components/molecules/DrawerDetail/styled.d.ts +1 -1
  11. package/es/components/molecules/EditorTab/EditorTab.d.ts +1 -1
  12. package/es/components/molecules/EditorTab/EditorTab.js +2 -2
  13. package/es/components/molecules/PreviewModal/styled.d.ts +1 -1
  14. package/es/components/molecules/ShareAccess/hooks/useShareAccess.d.ts +3 -3
  15. package/es/components/molecules/TemplateSaveAs/hooks/useTemplateSave.d.ts +1 -1
  16. package/es/components/molecules/index.d.ts +1 -1
  17. package/es/components/organism/AlgorithmsSetting/styled.d.ts +1 -1
  18. package/es/components/organism/ContentSources/provider.d.ts +1 -1
  19. package/es/components/organism/ContentSources/utils.d.ts +5 -5
  20. package/es/components/organism/DataTable/hooks/useAddFilterButton.d.ts +1 -1
  21. package/es/components/organism/DataTable/hooks/useDataTable.d.ts +2 -2
  22. package/es/components/organism/DataTable/providers/AntdTableConfigProvider.d.ts +1 -1
  23. package/es/components/organism/FilterSetting/components/common/InputSelectMulti/ColumnSuggestion/index.d.ts +1 -1
  24. package/es/components/organism/LeftMenu/LeftMenu.js +1 -1
  25. package/es/components/organism/LeftMenu/components/HomeMenu/useHomeMenu.d.ts +1 -1
  26. package/es/components/organism/LeftMenu/components/common/ChildMenu/index.js +64 -7
  27. package/es/components/organism/LeftMenu/hooks/useLeftMenu.d.ts +1 -1
  28. package/es/components/organism/LeftMenu/hooks/useLeftMenu.js +60 -27
  29. package/es/components/organism/LeftMenu/hooks/usePermission.js +2 -2
  30. package/es/components/organism/LeftMenu/index.d.ts +2 -1
  31. package/es/components/organism/LeftMenu/index.js +7 -4
  32. package/es/components/organism/LeftMenu/styled.d.ts +1 -3
  33. package/es/components/organism/LeftMenu/styled.js +2 -6
  34. package/es/components/organism/LeftMenu/utils/index.js +2 -2
  35. package/es/components/organism/Menu/styled.d.ts +1 -1
  36. package/es/components/organism/ModifyColumnModal/styled.d.ts +3 -3
  37. package/es/components/organism/index.d.ts +1 -1
  38. package/es/components/organism/index.js +1 -1
  39. package/es/components/template/Layout/components/RecommendationWorkspace/components/MenuMapping/components/OldLeftMenu/index.js +22 -3
  40. package/es/components/template/Layout/components/RecommendationWorkspace/components/MenuMapping/index.js +10 -3
  41. package/es/components/template/Layout/components/RecommendationWorkspace/index.js +5 -0
  42. package/es/components/template/TemplateListing/Loadable.d.ts +1 -1
  43. package/es/hooks/index.d.ts +3 -3
  44. package/es/hooks/index.js +3 -3
  45. package/es/providers/ConfigProvider/GlobalStyle.js +0 -1
  46. package/es/queries/BusinessObject/useGetListAttributeBO.d.ts +1 -3
  47. package/es/utils/common.d.ts +1 -1
  48. package/es/utils/index.d.ts +1 -0
  49. package/es/utils/index.js +1 -0
  50. package/es/utils/loadable.d.ts +1 -1
  51. package/package.json +4 -4
@@ -14,7 +14,7 @@ export declare const useAccountSelection: (apiConfig: {
14
14
  appCode?: string;
15
15
  menuCode?: string;
16
16
  }) => {
17
- recentData?: AccountRecent | undefined;
17
+ recentData?: AccountRecent;
18
18
  accountData: Array<AccountData>;
19
19
  };
20
20
  export {};
@@ -28,10 +28,10 @@ export declare const CUSTOM_TYPE: {
28
28
  };
29
29
  export declare const buildOptionAttrArchive: (list: any[], selected: any) => any[];
30
30
  export declare const checkStatusAttr: ({ listBO, itemTypeId, listAttribute, field, }: {
31
- listBO?: any[] | undefined;
32
- itemTypeId?: number | undefined;
33
- listAttribute?: any[] | undefined;
34
- field?: string | undefined;
31
+ listBO?: any[];
32
+ itemTypeId?: number;
33
+ listAttribute?: any[];
34
+ field?: string;
35
35
  }) => {
36
36
  errorMessage: string;
37
37
  isDisable: boolean;
@@ -9,7 +9,7 @@ export declare const ACTION_TYPES: {
9
9
  readonly apply: "apply";
10
10
  readonly resetValue: "reset_value";
11
11
  };
12
- export declare const changeRangeType: (rangeType: string, callback?: ((rangeInfo: RangeInfo) => void) | undefined) => {
12
+ export declare const changeRangeType: (rangeType: string, callback?: (rangeInfo: RangeInfo) => void) => {
13
13
  type: "change_range_type";
14
14
  payload: {
15
15
  rangeType: string;
@@ -1,4 +1,4 @@
1
1
  export declare const useCalendarSelectionContext: () => {
2
- state: import("@antscorp/antsomi-ui/es/components/molecules/CalendarSelection/types").ReducerState;
3
- action: import("@antscorp/antsomi-ui/es/components/molecules/CalendarSelection/types").ActionType;
2
+ state: import("../types").ReducerState;
3
+ action: import("../types").ActionType;
4
4
  };
@@ -29,7 +29,7 @@ export declare const getDefaultDate: () => {
29
29
  export declare const getRangeValue: ({ rangeInfo, currentRangeValue, limitNumOfDays, }: {
30
30
  rangeInfo: RangeInfo;
31
31
  currentRangeValue: RangeValue[];
32
- limitNumOfDays?: number | undefined;
32
+ limitNumOfDays?: number;
33
33
  }) => RangeValue[];
34
34
  export declare const getRangeValueSelctedTitle: (rangeValue: RangeValue[], options?: {
35
35
  formatStart?: string;
@@ -44,7 +44,7 @@ export declare const combineCurrentValue: (state: ReducerState) => {
44
44
  };
45
45
  export declare const genTriggerOut: ({ mode, id, }: {
46
46
  mode: ReducerState['triggerOut']['mode'];
47
- id?: number | undefined;
47
+ id?: number;
48
48
  }) => {
49
49
  mode: "auto" | "manual";
50
50
  id: number;
@@ -15,6 +15,7 @@ export interface AdvancedPickerProps {
15
15
  format?: string;
16
16
  formatInputDisplay?: string;
17
17
  inputStyle?: React.CSSProperties;
18
+ popupStyle?: React.CSSProperties;
18
19
  disableAfterDate?: string;
19
20
  disableBeforeDate?: string;
20
21
  errorMessage?: string;
@@ -1,3 +1,4 @@
1
+ var _a, _b;
1
2
  /* eslint-disable react/no-unused-prop-types */
2
3
  // Libraries
3
4
  import React, { useEffect, useMemo, useCallback, useState } from 'react';
@@ -29,7 +30,7 @@ const { Text } = Typography;
29
30
  export const AdvancedPicker = props => {
30
31
  var _a, _b;
31
32
  // Props
32
- const { label, inputStyle, dateTypeKeysShow, calculationTypeKeysShow, showCalculationTypeCondition, defaultDateTypeKey, valueType, option: propsOption, operatorKey, type, date: propsDate, format, formatInputDisplay, errorMessage, disableAfterDate, disableBeforeDate, showTime, disabled, timezone, isViewMode, onUpdatedNewDate, onApply, } = props;
33
+ const { label, inputStyle, popupStyle, dateTypeKeysShow, calculationTypeKeysShow, showCalculationTypeCondition, defaultDateTypeKey, valueType, option: propsOption, operatorKey, type, date: propsDate, format, formatInputDisplay, errorMessage, disableAfterDate, disableBeforeDate, showTime, disabled, timezone, isViewMode, onUpdatedNewDate, onApply, } = props;
33
34
  // Memo
34
35
  const newDateTypes = useMemo(() => {
35
36
  if (dateTypeKeysShow && dateTypeKeysShow.length) {
@@ -386,7 +387,7 @@ export const AdvancedPicker = props => {
386
387
  !!label && typeof label === 'string' ? (React.createElement(Text, { style: { color: '#666666' } }, label)) : (label),
387
388
  option.dateType.value === 'fixed' &&
388
389
  !['WEEK', 'DAY_OF_WEEK', 'MONTH_DAY', 'DAY'].includes(valueType) ? (React.createElement(Tooltip, { title: selectedDateTitle },
389
- React.createElement(DatePicker, { disabled: disabled, open: !disabled && isOpen, allowClear: false, inputReadOnly: true, style: Object.assign({ textOverflow: 'ellipsis' }, inputStyle), status: errorMessage ? 'error' : '', inputRender: () => (React.createElement(DatePickerCustomInput, { readOnly: true, placeholder: "Select Date", value: selectedDateTitle, onClick: () => toggleOpenDropdown() })), value: currDate,
390
+ React.createElement(DatePicker, { disabled: disabled, open: !disabled && isOpen, popupStyle: popupStyle, allowClear: false, inputReadOnly: true, style: Object.assign({ textOverflow: 'ellipsis' }, inputStyle), status: errorMessage ? 'error' : '', inputRender: () => (React.createElement(DatePickerCustomInput, { readOnly: true, placeholder: "Select Date", value: selectedDateTitle, onClick: () => toggleOpenDropdown() })), value: currDate,
390
391
  // style={{
391
392
  // width: 120,
392
393
  // }}
@@ -433,6 +434,7 @@ export const AdvancedPicker = props => {
433
434
  AdvancedPicker.defaultProps = {
434
435
  label: '',
435
436
  type: ADVANCED_PICKER_TYPE.START_DATE.value,
437
+ popupStyle: { borderRadius: (_b = (_a = THEME.token) === null || _a === void 0 ? void 0 : _a.borderRadiusLG) !== null && _b !== void 0 ? _b : 10 },
436
438
  operatorKey: 'after',
437
439
  dateTypeKeysShow: [],
438
440
  date: dayjs().format(DEFAULT_DATE_FORMAT),
@@ -19,6 +19,7 @@ export interface AdvancedRangePickerProps {
19
19
  timezone?: string;
20
20
  separator?: ReactNode;
21
21
  inputStyle?: React.CSSProperties;
22
+ popupStyle?: React.CSSProperties;
22
23
  isViewMode?: boolean;
23
24
  onChange?: ({ timeRange, mode }: TOnChangePayload) => void;
24
25
  }
@@ -1,3 +1,4 @@
1
+ var _a, _b;
1
2
  // Libraries
2
3
  import dayjs from 'dayjs';
3
4
  import React, { useState } from 'react';
@@ -10,6 +11,7 @@ import { Space } from '../../../../atoms';
10
11
  import { AdvancedPicker } from '../AdvancedPicker';
11
12
  // Constants
12
13
  import { ADVANCED_RANGE_PICKER_FORMAT } from './constants';
14
+ import { THEME } from '@antscorp/antsomi-ui/es/constants';
13
15
  // Utils
14
16
  import { handleError } from '@antscorp/antsomi-ui/es/utils';
15
17
  import { translations } from '@antscorp/antsomi-ui/es/locales/translations';
@@ -20,7 +22,7 @@ const PATH = '@antscorp/antsomi-ui/es/components/molecules/DatePicker/components
20
22
  export const AdvancedRangePicker = props => {
21
23
  const { t } = i18nInstance;
22
24
  // Props
23
- const { className, valueType, useFormatMapping, timeRange, errorMessage, showLabel, startDateConfig, endDateConfig, showTime, showCalculationTypeCondition, disabled, timezone, separator, inputStyle, isViewMode, onChange, } = props;
25
+ const { className, valueType, useFormatMapping, timeRange, errorMessage, showLabel, startDateConfig, endDateConfig, showTime, showCalculationTypeCondition, disabled, timezone, separator, inputStyle, popupStyle, isViewMode, onChange, } = props;
24
26
  const [timeRangeState, setTimeRange] = useState(timeRange);
25
27
  useDeepCompareEffect(() => {
26
28
  if (typeof onChange === 'function') {
@@ -60,13 +62,13 @@ export const AdvancedRangePicker = props => {
60
62
  ? getFormatDisplayFromValueType('startDate', valueType)
61
63
  : ADVANCED_RANGE_PICKER_FORMAT.startDate,
62
64
  // format={ADVANCED_RANGE_PICKER_FORMAT.startDate}
63
- errorMessage: errorMessage, disableAfterDate: timeRange.endDate.date, showTime: showTime, calculationTypeKeysShow: startDateConfig === null || startDateConfig === void 0 ? void 0 : startDateConfig.calculationTypeKeysShow, showCalculationTypeCondition: showCalculationTypeCondition, timezone: timezone, onUpdatedNewDate: ({ date }) => onUpdateTimeRange('startDate', { date }, 'system'), onApply: ({ date, option }) => onUpdateTimeRange('startDate', Object.assign({ date }, option), 'user'), inputStyle: inputStyle, isViewMode: isViewMode }),
65
+ errorMessage: errorMessage, disableAfterDate: timeRange.endDate.date, showTime: showTime, calculationTypeKeysShow: startDateConfig === null || startDateConfig === void 0 ? void 0 : startDateConfig.calculationTypeKeysShow, showCalculationTypeCondition: showCalculationTypeCondition, timezone: timezone, onUpdatedNewDate: ({ date }) => onUpdateTimeRange('startDate', { date }, 'system'), onApply: ({ date, option }) => onUpdateTimeRange('startDate', Object.assign({ date }, option), 'user'), inputStyle: inputStyle, popupStyle: popupStyle, isViewMode: isViewMode }),
64
66
  separator || null,
65
67
  React.createElement(AdvancedPicker, { valueType: valueType, disabled: disabled, label: showLabel ? t(translations.datePicker.endDate) || '' : '', date: timeRange.endDate.date, option: omit(timeRange.endDate, 'date'), operatorKey: "between", type: "endDate", format: useFormatMapping
66
68
  ? getFormatDisplayFromValueType('endDate', valueType)
67
69
  : ADVANCED_RANGE_PICKER_FORMAT.endDate,
68
70
  // format={ADVANCED_RANGE_PICKER_FORMAT.endDate}
69
- errorMessage: errorMessage, showTime: showTime, calculationTypeKeysShow: endDateConfig === null || endDateConfig === void 0 ? void 0 : endDateConfig.calculationTypeKeysShow, showCalculationTypeCondition: showCalculationTypeCondition, timezone: timezone, onUpdatedNewDate: ({ date }) => onUpdateTimeRange('endDate', { date }, 'system'), onApply: ({ date, option }) => onUpdateTimeRange('endDate', Object.assign({ date }, option), 'user'), inputStyle: inputStyle, isViewMode: isViewMode })));
71
+ errorMessage: errorMessage, showTime: showTime, calculationTypeKeysShow: endDateConfig === null || endDateConfig === void 0 ? void 0 : endDateConfig.calculationTypeKeysShow, showCalculationTypeCondition: showCalculationTypeCondition, timezone: timezone, onUpdatedNewDate: ({ date }) => onUpdateTimeRange('endDate', { date }, 'system'), onApply: ({ date, option }) => onUpdateTimeRange('endDate', Object.assign({ date }, option), 'user'), inputStyle: inputStyle, popupStyle: popupStyle, isViewMode: isViewMode })));
70
72
  };
71
73
  AdvancedRangePicker.defaultProps = {
72
74
  timeRange: {
@@ -85,6 +87,7 @@ AdvancedRangePicker.defaultProps = {
85
87
  dateType: 'today',
86
88
  },
87
89
  },
90
+ popupStyle: { borderRadius: (_b = (_a = THEME.token) === null || _a === void 0 ? void 0 : _a.borderRadiusLG) !== null && _b !== void 0 ? _b : 10 },
88
91
  errorMessage: '',
89
92
  disabled: false,
90
93
  showLabel: true,
@@ -1,6 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  import { DrawerHeaderProps } from './types';
3
- export declare const StyledDrawer: import("styled-components").StyledComponent<import("react").FC<import("@antscorp/antsomi-ui/es/components/molecules/Drawer/Drawer").DrawerProps>, any, {}, never>;
3
+ export declare const StyledDrawer: import("styled-components").StyledComponent<import("react").FC<import("../Drawer").DrawerProps>, any, {}, never>;
4
4
  export declare const Content: import("styled-components").StyledComponent<"div", any, {}, never>;
5
5
  export declare const LeftMenu: import("styled-components").StyledComponent<"div", any, {}, never>;
6
6
  export declare const CloseBtn: import("styled-components").StyledComponent<"div", any, {}, never>;
@@ -25,7 +25,7 @@ interface EditorTabProps {
25
25
  confirmOnRemoveTab?: boolean;
26
26
  modalFuncProps?: ModalFuncProps;
27
27
  onActiveTab: (id: string) => void;
28
- onCloseTab: (tab: EditorTabItem, index: number, newTabs: EditorTabItem[]) => void;
28
+ onCloseTab?: (tab: EditorTabItem, index: number, newTabs: EditorTabItem[]) => void;
29
29
  onClickRemoveTab?: (tab: EditorTabItem, index: number, newTabs: EditorTabItem[]) => void;
30
30
  onConfirmRemove?: (tab: EditorTabItem) => void;
31
31
  onConfigure: (id: string) => 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, onClickRemoveTab, onConfirmRemove, onActiveTab, onAddTab, onConfigure, onSaveName, newTabText, showComposeNewQuery, className, leftBlockClassName, tabItemClassName, confirmOnRemoveTab = true, modalFuncProps, } = props;
25
+ onCloseTab, onClickRemoveTab, onConfirmRemove, onActiveTab, onAddTab, onConfigure, onSaveName, newTabText, showComposeNewQuery, className, leftBlockClassName, tabItemClassName, confirmOnRemoveTab, 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();
@@ -115,7 +115,7 @@ export const EditorTab = props => {
115
115
  handleActiveTab(arrTabs[idx + 1].id);
116
116
  }
117
117
  }
118
- onCloseTab(tab, idx, newTabs);
118
+ onCloseTab === null || onCloseTab === void 0 ? void 0 : onCloseTab(tab, idx, newTabs);
119
119
  setArrTabs(newTabs);
120
120
  });
121
121
  const onWheelLeftBlock = useCallback(event => {
@@ -1,4 +1,4 @@
1
1
  /// <reference types="react" />
2
- export declare const StyledModal: import("styled-components").StyledComponent<import("react").FC<import("@antscorp/antsomi-ui/es/components/molecules/ModalV2/ModalV2").ModalV2Props>, any, {}, never>;
2
+ export declare const StyledModal: import("styled-components").StyledComponent<import("react").FC<import("../ModalV2").ModalV2Props>, any, {}, never>;
3
3
  export declare const ModalHeader: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("antd/es/flex/interface").FlexProps<import("antd/es/_util/type").AnyObject> & import("react").RefAttributes<HTMLElement>>, any, {}, never>;
4
4
  export declare const ModalBody: import("styled-components").StyledComponent<"div", any, {}, never>;
@@ -3,17 +3,17 @@ export declare const useShareAccess: () => {
3
3
  state: {
4
4
  allowEdit: boolean;
5
5
  allowView: boolean;
6
- accessInfo?: import("@antscorp/antsomi-ui/es/components/molecules/ShareAccess/types").ObjectAccessInfo | undefined;
6
+ accessInfo?: import("../types").ObjectAccessInfo | undefined;
7
7
  accessUserId?: number | undefined;
8
8
  accessUserPermission?: {
9
9
  view: number;
10
10
  edit: number;
11
11
  } | undefined;
12
- excludeUserAccess?: import("@antscorp/antsomi-ui/es/components/molecules/ShareAccess/types").ExcludeUserAccess | undefined;
12
+ excludeUserAccess?: import("../types").ExcludeUserAccess | undefined;
13
13
  modalTransferOwnership: {
14
14
  open: boolean;
15
15
  userToOwnerShipId: number;
16
16
  };
17
17
  };
18
- dispatch: import("react").Dispatch<import("@antscorp/antsomi-ui/es/components/molecules/ShareAccess/types").ShareAccessAction> | null;
18
+ dispatch: import("react").Dispatch<import("../types").ShareAccessAction> | null;
19
19
  };
@@ -66,7 +66,7 @@ export declare const useTemplateSave: (options: TemplateListingOptions) => {
66
66
  form: import("antd").FormInstance<FormValue>;
67
67
  errors: any[] | undefined;
68
68
  refetchCategoryList: <TPageData>(options?: (import("@tanstack/react-query").RefetchOptions & import("@tanstack/react-query").RefetchQueryFilters<TPageData>) | undefined) => Promise<import("@tanstack/react-query").QueryObserverResult<TemplateCategory[], any>>;
69
- refetchTemplateList: <TPageData_1>(options?: (import("@tanstack/react-query").RefetchOptions & import("@tanstack/react-query").RefetchQueryFilters<TPageData_1>) | undefined) => Promise<import("@tanstack/react-query").QueryObserverResult<import("@tanstack/react-query").InfiniteData<import("@antscorp/antsomi-ui/es/types").ResponseListing<import("@antscorp/antsomi-ui/es/models/ObjectTemplate").ObjectTemplate>>, any>>;
69
+ refetchTemplateList: <TPageData_1>(options?: (import("@tanstack/react-query").RefetchOptions & import("@tanstack/react-query").RefetchQueryFilters<TPageData_1>) | undefined) => Promise<import("@tanstack/react-query").QueryObserverResult<import("@tanstack/react-query").InfiniteData<import("@antscorp/antsomi-ui/es/types").ResponseListing<import("../../../../models/ObjectTemplate").ObjectTemplate>>, any>>;
70
70
  onLoadMore: () => void;
71
71
  onChange: (newValue: Partial<TemplateValueOptions>) => void;
72
72
  };
@@ -66,10 +66,10 @@ export type { TFontSettingProps, TFontSettingEditProps } from './FontSetting';
66
66
  export type { IResizeGridProps, TCell, TGrid } from './ResizeGrid';
67
67
  export type { ModalProps } from './ModalV2';
68
68
  export type { TemplateValueOptions } from './TemplateSaveAs';
69
+ export type { ImageResizeHandle } from './ImageEditor';
69
70
  export type { SelectProps as SelectV2Props } from './SelectV2';
70
71
  export type { InputNumberProps as InputNumberWithLabelProps } from './InputNumber';
71
72
  export type { ModalSelectProps } from './ModalSelect';
72
- export type { ImageResizeHandle } from './ImageEditor';
73
73
  export type { EditableNameHandle } from './EditableName';
74
74
  export type { AccountListingHandle, AccountSelectionProps } from './AccountSelection';
75
75
  export type { VirtualizedMenuProps } from './VirtualizedMenu';
@@ -10,7 +10,7 @@ export declare const AlgorithmWrapper: import("styled-components").StyledCompone
10
10
  mode: ContentSourceModeView;
11
11
  }, never>;
12
12
  export declare const StyledSelect: import("styled-components").StyledComponent<{
13
- (props: import("@antscorp/antsomi-ui/es/components/molecules/SelectV2").SelectProps): import("react").JSX.Element;
13
+ (props: import("../../molecules").SelectV2Props): import("react").JSX.Element;
14
14
  defaultProps: {
15
15
  suffixIcon: import("react").JSX.Element;
16
16
  filterOption: (input: any, option: any) => boolean;
@@ -9,7 +9,7 @@ export interface ContentSourceProviderProps {
9
9
  export declare const ContentSourceProvider: ({ children }: ContentSourceProviderProps) => React.JSX.Element;
10
10
  export declare const useContentSourceState: () => ContentSourceState;
11
11
  export declare const useContentSourceDispatch: () => React.Dispatch<UpdateGroupAction>;
12
- export declare const useSelectServiceAuth: () => import("@antscorp/antsomi-ui/es/types").PayloadInfo;
12
+ export declare const useSelectServiceAuth: () => import("../../..").PayloadInfo;
13
13
  export declare const useSelectContentSources: () => import("./types").TContentSourceSettings;
14
14
  export declare const useSelectCSGroups: () => import("./types").TContentSourceGroup[];
15
15
  export declare const useSelectModeView: () => import("./types").ContentSourceModeView;
@@ -17,11 +17,11 @@ export declare const isCheckStatusAttr: (listBO: any, itemTypeId: any, listAttri
17
17
  isDisable: boolean;
18
18
  };
19
19
  export declare const checkStatusCollection: ({ listBO, itemTypeId, listCollection, field, checkDisable, }: {
20
- listBO?: any[] | undefined;
21
- itemTypeId?: number | null | undefined;
22
- listCollection?: any[] | undefined;
23
- field?: string | undefined;
24
- checkDisable?: boolean | undefined;
20
+ listBO?: any[];
21
+ itemTypeId?: number | null;
22
+ listCollection?: any[];
23
+ field?: string;
24
+ checkDisable?: boolean;
25
25
  }) => {
26
26
  errorMessage: string;
27
27
  isDisable: boolean;
@@ -11,7 +11,7 @@ type OnApplyFilterMetricConditionValue = {
11
11
  existMetricIdx?: number;
12
12
  };
13
13
  export declare const useAddFilterCondition: () => {
14
- filters: import("@antscorp/antsomi-ui/es/components/organism/DataTable/types/filter").FilterItem[] | undefined;
14
+ filters: import("../types").FilterItem[] | undefined;
15
15
  setState: import("react").Dispatch<import("react").SetStateAction<TState>>;
16
16
  onSelectFilterMetric: (filterMetric?: FilterMetricItem) => void;
17
17
  onApplyFilterMetricCondition: (values: OnApplyFilterMetricConditionValue) => void;
@@ -1,5 +1,5 @@
1
1
  import { DataTableProps } from '../types';
2
2
  export declare const useDataTable: <TTableDataType>(props: DataTableProps<TTableDataType>) => {
3
- pagination: import("@antscorp/antsomi-ui/es/components/organism/DataTable/components").PaginationProps | undefined;
4
- setPagination: (pagination: Partial<import("@antscorp/antsomi-ui/es/components/organism/DataTable/components").PaginationProps>) => void;
3
+ pagination: import("../components").PaginationProps | undefined;
4
+ setPagination: (pagination: Partial<import("../components").PaginationProps>) => void;
5
5
  };
@@ -3,5 +3,5 @@ import { ConfigProviderProps } from 'antd';
3
3
  interface AntdConfigProviderV2Props extends ConfigProviderProps {
4
4
  }
5
5
  export declare const AntdTableConfigProvider: React.FC<AntdConfigProviderV2Props>;
6
- export declare const dataTableGlobalToken: (Partial<import("antd/es/theme/internal").AliasToken> & Partial<import("@antscorp/antsomi-ui/es/components/organism/DataTable/types/theme").TDataTableToken>) | undefined;
6
+ export declare const dataTableGlobalToken: (Partial<import("antd/es/theme/internal").AliasToken> & Partial<import("../types").TDataTableToken>) | undefined;
7
7
  export {};
@@ -11,5 +11,5 @@ export declare const WrapperContent: import("styled-components").StyledComponent
11
11
  export declare const List: import("styled-components").StyledComponent<"ul", any, {}, never>;
12
12
  export declare const ListItem: import("styled-components").StyledComponent<"li", any, {}, never>;
13
13
  export declare const Span: import("styled-components").StyledComponent<"div", any, {}, never>;
14
- export declare const TextField: import("styled-components").StyledComponent<React.FC<import("@antscorp/antsomi-ui/es/components/atoms/Text").TextProps>, any, {}, never>;
14
+ export declare const TextField: import("styled-components").StyledComponent<React.FC<import("../../../../../../atoms/Text").TextProps>, any, {}, never>;
15
15
  export {};
@@ -90,7 +90,7 @@ export const LeftMenuComponent = memo(props => {
90
90
  };
91
91
  return (React.createElement(LeftMenuNavWrapper, { style: style, "$isExpandMenu": state.isExpandMenu, className: className },
92
92
  React.createElement(LeftMenuNav, { className: "left-menu-nav" },
93
- React.createElement(FeatureMenuWrapper, { isExpandMenu: state.isExpandMenu, vertical: true },
93
+ React.createElement(FeatureMenuWrapper, { vertical: true },
94
94
  showLogo && (React.createElement(NavLogoWrapper, { align: "center", justify: "center", onMouseEnter: onHoverMenuBar },
95
95
  React.createElement("div", { className: "image-wrapper" },
96
96
  React.createElement("img", { src: SubLogoAntsomi, alt: "Antsomi sub logo" })))),
@@ -1,6 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  export declare const useHomeMenu: () => {
3
- children: import("@antscorp/antsomi-ui/es/components/organism/LeftMenu/types").TMenuItem[];
3
+ children: import("../../types").TMenuItem[];
4
4
  removedDashboardId: string;
5
5
  isDashboardRemoving: boolean;
6
6
  isRecommendation: boolean | undefined;
@@ -20,6 +20,8 @@ import { findItemByPermissionCode, recursiveFindItemByKey, recursiveFindParentOf
20
20
  import { useNavigatePath } from '../../../hooks';
21
21
  // Contexts
22
22
  import { useLeftMenuContext } from '../../../contexts';
23
+ import { MARKETING_CHANNEL_CODE } from '@antscorp/antsomi-ui/es/components/template/Layout/constants';
24
+ import { useDeepCompareEffect } from '@antscorp/antsomi-ui/es/hooks';
23
25
  const noDashboardItem = {
24
26
  key: 'no_dashboard',
25
27
  label: 'No dashboard available',
@@ -36,8 +38,10 @@ const styles = {
36
38
  menuItemTitle: { flex: '1 1 0%', maxWidth: '100%', overflow: 'hidden' },
37
39
  };
38
40
  export const ChildMenu = memo(props => {
41
+ var _a;
39
42
  const { items = [], onMenuClick } = props;
40
43
  const auth = useLeftMenuContext(store => { var _a; return (_a = store.appConfig) === null || _a === void 0 ? void 0 : _a.auth; });
44
+ const env = useLeftMenuContext(store => { var _a; return (_a = store.appConfig) === null || _a === void 0 ? void 0 : _a.env; });
41
45
  const activeAppCode = useLeftMenuContext(store => store.activeAppCode);
42
46
  const menuItems = useLeftMenuContext(store => store.menuItems);
43
47
  const customItems = useLeftMenuContext(store => store.customItems);
@@ -45,11 +49,16 @@ export const ChildMenu = memo(props => {
45
49
  const isRecommendation = useLeftMenuContext(store => store.isRecommendation);
46
50
  const customActiveCurrentKey = useLeftMenuContext(store => store.customActiveCurrentKey);
47
51
  const setLeftMenuState = useLeftMenuContext(store => store.setState);
52
+ const layout = JSON.parse(localStorage.getItem('layout') || '{}');
53
+ const openMenuKeys = ((_a = layout === null || layout === void 0 ? void 0 : layout.leftMenu) === null || _a === void 0 ? void 0 : _a.openMenuKeys) || [];
48
54
  const [currentActiveItem, setCurrentActiveItem] = useState('');
49
- const [openKeys, setOpenKeys] = useState([]);
55
+ const [openKeys, setOpenKeys] = useState(openMenuKeys);
50
56
  const { pathname, hash } = window.location;
51
57
  const { isPushDifferentDomain, getPath, navigatePath } = useNavigatePath();
52
58
  useLayoutEffect(() => {
59
+ localStorage.setItem('layout', JSON.stringify(Object.assign(Object.assign({}, layout), { leftMenu: Object.assign(Object.assign({}, layout === null || layout === void 0 ? void 0 : layout.leftMenu), { openMenuKeys: uniq(openKeys) }) })));
60
+ }, [layout, openKeys]);
61
+ useDeepCompareEffect(() => {
53
62
  var _a;
54
63
  switch (true) {
55
64
  case isCustomized: {
@@ -69,12 +78,54 @@ export const ChildMenu = memo(props => {
69
78
  permissionCode: customActiveCurrentKey,
70
79
  menuItems: items,
71
80
  });
72
- if (activeItem) {
73
- if (activeItem.permission_code !== 'JOURNEY')
74
- setCurrentActiveItem(activeItem === null || activeItem === void 0 ? void 0 : activeItem.key);
75
- // Find parent key of active menu item to open it
81
+ const { key, permission_code } = activeItem || {};
82
+ let menuActiveKey;
83
+ if (permission_code && key) {
84
+ switch (permission_code) {
85
+ case 'JOURNEY':
86
+ if (!Object.values(MARKETING_CHANNEL_CODE).includes(currentActiveItem)) {
87
+ menuActiveKey = MARKETING_CHANNEL_CODE.ALL_CHANNEL;
88
+ }
89
+ break;
90
+ case 'EVENT_SOURCES':
91
+ if (!['EVENT', 'EVENT_ATTRIBUTE', 'CONVERSION'].includes(currentActiveItem))
92
+ menuActiveKey = 'SOURCE';
93
+ break;
94
+ case 'DATAFLOWS':
95
+ if (!['BATCH_STREAMING', 'REALTIME_STREAMING'].includes(currentActiveItem))
96
+ menuActiveKey = 'BATCH_STREAM';
97
+ break;
98
+ case 'BUSINESS_OBJECT': {
99
+ if (!['UPLOAD', 'EXPORT'].includes(currentActiveItem)) {
100
+ menuActiveKey = 'UPLOAD';
101
+ }
102
+ break;
103
+ }
104
+ case 'DATASOURCES':
105
+ menuActiveKey = 'DATA_SOURCE';
106
+ break;
107
+ default:
108
+ menuActiveKey = key;
109
+ break;
110
+ }
111
+ }
112
+ else {
113
+ switch (customActiveCurrentKey) {
114
+ case 'DATASOURCES-SQL_WORKSPACE':
115
+ menuActiveKey = 'DATA_SOURCE';
116
+ break;
117
+ case 'DATASOURCES-DATAFLOWS':
118
+ menuActiveKey = 'DF_DATA_SOURCE';
119
+ break;
120
+ default:
121
+ break;
122
+ }
123
+ }
124
+ if (menuActiveKey) {
125
+ setCurrentActiveItem(menuActiveKey);
126
+ /** Find parent key of active menu item to open it */
76
127
  const parentKey = recursiveFindParentOfActiveItem({
77
- activeMenuItem: activeItem === null || activeItem === void 0 ? void 0 : activeItem.key,
128
+ activeMenuItem: menuActiveKey,
78
129
  menuItems: menuItems === null || menuItems === void 0 ? void 0 : menuItems.map(item => (Object.assign(Object.assign({}, getMenuItem(item)), { key: (item === null || item === void 0 ? void 0 : item.permission_code) || '' }))),
79
130
  });
80
131
  if (parentKey) {
@@ -86,7 +137,12 @@ export const ChildMenu = memo(props => {
86
137
  default: {
87
138
  const url = `${pathname}${hash}`;
88
139
  // Active menu item by current url
89
- const activeMenuItem = (_a = findLastMatchedItemByUrl({ url, menuItems, auth })) === null || _a === void 0 ? void 0 : _a.menu_item_code;
140
+ const activeMenuItem = (_a = findLastMatchedItemByUrl({
141
+ url,
142
+ menuItems,
143
+ auth,
144
+ env,
145
+ })) === null || _a === void 0 ? void 0 : _a.menu_item_code;
90
146
  if (activeMenuItem && activeMenuItem !== currentActiveItem) {
91
147
  setCurrentActiveItem(activeMenuItem);
92
148
  // Find parent key of active menu item to open it
@@ -119,6 +175,7 @@ export const ChildMenu = memo(props => {
119
175
  customActiveCurrentKey,
120
176
  customItems,
121
177
  isRecommendation,
178
+ env,
122
179
  ]);
123
180
  const onClick = e => {
124
181
  var _a;
@@ -6,7 +6,7 @@ interface TState {
6
6
  export declare const useLeftMenu: (props: LeftMenuProps) => {
7
7
  state: TState;
8
8
  activeAppCode: string;
9
- permissionMenu: import("@antscorp/antsomi-ui/es/models/LeftMenu").TFeatureMenu[];
9
+ permissionMenu: import("../../../../models/LeftMenu").TFeatureMenu[];
10
10
  customActiveAppKey: string;
11
11
  onToggleChildMenu: () => void;
12
12
  onMouseEnter: (key: string) => void;
@@ -1,6 +1,6 @@
1
1
  // Libraries
2
- import { useCallback, useEffect, useState } from 'react';
3
- import { isArray } from 'lodash';
2
+ import { useCallback, useEffect, useMemo, useState } from 'react';
3
+ import { isArray, isNil } from 'lodash';
4
4
  // Utils
5
5
  import { findActiveAppCodeByChild, findActiveAppCodeByUrl, recursiveGetMenuItemByPermission, } from '../utils';
6
6
  // Store
@@ -9,20 +9,41 @@ import { useLeftMenuContext } from '../contexts';
9
9
  import { DASHBOARD_MODULE_CONFIG } from '../../../template/Layout/constants';
10
10
  // Hooks
11
11
  import { usePermission } from './usePermission';
12
- const initialState = {
13
- hoverItem: '',
14
- isExpandMenu: true,
15
- };
12
+ import { Cookies } from 'react-cookie';
13
+ import { useDeepCompareEffect } from '@antscorp/antsomi-ui/es/hooks';
16
14
  export const useLeftMenu = (props) => {
17
15
  // Props
18
16
  const { objectType = DASHBOARD_MODULE_CONFIG.objectType, objectId = DASHBOARD_MODULE_CONFIG.objectId, isGrouped = DASHBOARD_MODULE_CONFIG.isGrouped, appConfig, customization, onActiveMenuCodeChange, } = props;
19
- const { isExpandable = true, isCustomized = false, isRecommendation = false, items, activeKey, onMenuItemClick, } = customization || {};
20
- const { pathname, hash } = window.location;
17
+ const { isExpandable = true, expandMenu = false, isCustomized = false, isRecommendation = false, items, activeKey, onMenuItemClick, } = customization || {};
18
+ const mappedActiveKey = useMemo(() => {
19
+ if (!isRecommendation)
20
+ return activeKey;
21
+ switch (activeKey) {
22
+ case 'BUSINESS_OBJECT':
23
+ case 'BUSINESS_OBJECT-APP_API_HUB':
24
+ return 'DATA_OBJECT';
25
+ case 'BUSINESS_OBJECT-PERMISSION_ACCOUNT':
26
+ return 'BUSINESS_OBJECT';
27
+ case 'ANALYSIS':
28
+ return 'SQL_WORKSPACE';
29
+ case 'DATASOURCES-APP_ANTALYSER':
30
+ return 'DATASOURCES-SQL_WORKSPACE';
31
+ default:
32
+ return activeKey;
33
+ }
34
+ }, [activeKey, isRecommendation]);
35
+ const cookie = new Cookies();
36
+ const { pathname, hash, origin } = window.location;
21
37
  const activeAppCode = useLeftMenuContext(store => store.activeAppCode);
22
38
  const customActiveAppKey = useLeftMenuContext(store => store.customActiveAppKey);
23
39
  const setLeftMenuContextState = useLeftMenuContext(store => store.setState);
24
40
  const { auth, env } = appConfig || {};
25
- const [state, setState] = useState(initialState);
41
+ const leftMenuCookies = cookie.get('_leftmenu_state');
42
+ const isOpenMenu = !isNil(leftMenuCookies === null || leftMenuCookies === void 0 ? void 0 : leftMenuCookies.expand) ? leftMenuCookies === null || leftMenuCookies === void 0 ? void 0 : leftMenuCookies.expand : true;
43
+ const [state, setState] = useState({
44
+ hoverItem: '',
45
+ isExpandMenu: expandMenu || isOpenMenu,
46
+ });
26
47
  const { mappingChildrenMenu, flattenMenuPermission, permissionMenu, activeItemPath } = usePermission();
27
48
  const onMenuClick = useCallback((key, keyPath) => {
28
49
  if (isRecommendation) {
@@ -30,7 +51,20 @@ export const useLeftMenu = (props) => {
30
51
  }
31
52
  onMenuItemClick === null || onMenuItemClick === void 0 ? void 0 : onMenuItemClick(key, [...keyPath, customActiveAppKey]);
32
53
  }, [customActiveAppKey, isRecommendation, onMenuItemClick, setLeftMenuContextState]);
33
- useEffect(() => {
54
+ useDeepCompareEffect(() => {
55
+ if (!expandMenu) {
56
+ cookie.set('_leftmenu_state', Object.assign(Object.assign({}, leftMenuCookies), { expand: state.isExpandMenu }));
57
+ // const domain = '.antsomi.com';
58
+ // const cookieValue = {
59
+ // ...leftMenuCookies,
60
+ // expand: state.isExpandMenu,
61
+ // };
62
+ // document.cookie = `_leftmenu_state=${JSON.stringify(
63
+ // cookieValue,
64
+ // )}; domain=${domain}; path=/; SameSite=None; Secure`;
65
+ }
66
+ }, [leftMenuCookies, origin, state.isExpandMenu]);
67
+ useDeepCompareEffect(() => {
34
68
  setLeftMenuContextState({
35
69
  appConfig,
36
70
  isCustomized,
@@ -49,7 +83,7 @@ export const useLeftMenu = (props) => {
49
83
  setLeftMenuContextState,
50
84
  ]);
51
85
  // Active Custom App Key when active key is changed
52
- useEffect(() => {
86
+ useDeepCompareEffect(() => {
53
87
  switch (true) {
54
88
  case isCustomized:
55
89
  setLeftMenuContextState({
@@ -63,10 +97,10 @@ export const useLeftMenu = (props) => {
63
97
  case isRecommendation: {
64
98
  setLeftMenuContextState({
65
99
  customActiveAppKey: findActiveAppCodeByChild({
66
- activeCurrentKey: activeKey || '',
100
+ activeCurrentKey: mappedActiveKey || '',
67
101
  menuItems: mappingChildrenMenu === null || mappingChildrenMenu === void 0 ? void 0 : mappingChildrenMenu.map(item => recursiveGetMenuItemByPermission(item)),
68
102
  }) || '',
69
- customActiveCurrentKey: activeKey,
103
+ customActiveCurrentKey: mappedActiveKey,
70
104
  });
71
105
  break;
72
106
  }
@@ -79,11 +113,12 @@ export const useLeftMenu = (props) => {
79
113
  isCustomized,
80
114
  isRecommendation,
81
115
  items,
116
+ mappedActiveKey,
82
117
  mappingChildrenMenu,
83
118
  setLeftMenuContextState,
84
119
  ]);
85
120
  // Change list menu children when hovering or activating items, giving priority to hovering items
86
- useEffect(() => {
121
+ useDeepCompareEffect(() => {
87
122
  var _a, _b, _c;
88
123
  const appActiveKey = state.hoverItem
89
124
  ? state.hoverItem
@@ -101,10 +136,6 @@ export const useLeftMenu = (props) => {
101
136
  case isRecommendation: {
102
137
  setLeftMenuContextState({
103
138
  menuItems: mappingChildrenMenu,
104
- // customMenuChildren:
105
- // mappingChildrenMenu
106
- // ?.find(item => item.permission_code === appActiveKey)
107
- // ?.children?.map(item => recursiveGetMenuItemByPermission(item)) || [],
108
139
  appMenuChildren: ((_b = mappingChildrenMenu === null || mappingChildrenMenu === void 0 ? void 0 : mappingChildrenMenu.find(item => item.permission_code === appActiveKey)) === null || _b === void 0 ? void 0 : _b.children) ||
109
140
  [],
110
141
  });
@@ -131,7 +162,7 @@ export const useLeftMenu = (props) => {
131
162
  isRecommendation,
132
163
  setLeftMenuContextState,
133
164
  ]);
134
- useEffect(() => {
165
+ useDeepCompareEffect(() => {
135
166
  switch (true) {
136
167
  case isCustomized:
137
168
  break;
@@ -177,15 +208,17 @@ export const useLeftMenu = (props) => {
177
208
  setState(prev => (Object.assign(Object.assign({}, prev), { isExpandMenu: !prev.isExpandMenu })));
178
209
  }, []);
179
210
  const onMouseEnter = useCallback((key) => {
180
- if (!state.isExpandMenu || !isExpandable) {
181
- setState(prev => (Object.assign(Object.assign({}, prev), { hoverItem: key })));
182
- }
183
- }, [isExpandable, state.isExpandMenu]);
211
+ setState(prev => (Object.assign(Object.assign({}, prev), { hoverItem: key })));
212
+ // if (!state.isExpandMenu || !isExpandable) {
213
+ // setState(prev => ({ ...prev, hoverItem: key }));
214
+ // }
215
+ }, []);
184
216
  const onMouseLeave = useCallback(() => {
185
- if (!state.isExpandMenu || !isExpandable) {
186
- setState(prev => (Object.assign(Object.assign({}, prev), { hoverItem: '' })));
187
- }
188
- }, [isExpandable, state.isExpandMenu]);
217
+ setState(prev => (Object.assign(Object.assign({}, prev), { hoverItem: '' })));
218
+ // if (!state.isExpandMenu || !isExpandable) {
219
+ // setState(prev => ({ ...prev, hoverItem: '' }));
220
+ // }
221
+ }, []);
189
222
  const onHoverMenuBar = () => {
190
223
  onMouseEnter(isCustomized ? customActiveAppKey : activeAppCode);
191
224
  };
@@ -67,7 +67,7 @@ export const usePermission = () => {
67
67
  portalId: auth === null || auth === void 0 ? void 0 : auth.portalId,
68
68
  },
69
69
  params: {
70
- objectType: 'DESTINATIONS',
70
+ objectType: 'GEN2_DESTINATION',
71
71
  languageCode,
72
72
  },
73
73
  },
@@ -111,7 +111,7 @@ export const usePermission = () => {
111
111
  })
112
112
  : [];
113
113
  }, [auth, hash, mappingChildrenMenu, pathname]);
114
- useEffect(() => setLeftMenuState({ dashboardList: [] }), [dashboardList, setLeftMenuState]);
114
+ useEffect(() => setLeftMenuState({ dashboardList }), [dashboardList, setLeftMenuState]);
115
115
  useEffect(() => {
116
116
  if (!isCustomized) {
117
117
  const receivePostMessage = (event) => {
@@ -17,8 +17,9 @@ export interface LeftMenuProps {
17
17
  isExpandable?: boolean;
18
18
  items?: TMenuItem[];
19
19
  activeKey?: string;
20
+ expandMenu?: boolean;
20
21
  onMenuItemClick?: (key: string, keyPath: string[]) => void;
21
22
  };
22
23
  onActiveMenuCodeChange?: (activeItemPath: TFeatureMenu[], flattenPermissionList?: FeatureMenuPermission[]) => void;
23
24
  }
24
- export declare const LeftMenu: (props: LeftMenuProps) => React.JSX.Element | null;
25
+ export declare const LeftMenu: React.MemoExoticComponent<(props: LeftMenuProps) => React.JSX.Element | null>;
@@ -1,12 +1,14 @@
1
1
  /* eslint-disable react/function-component-definition */
2
2
  // Libraries
3
- import React, { useRef } from 'react';
3
+ import React, { memo, useRef } from 'react';
4
+ import isEqual from 'react-fast-compare';
4
5
  // Providers
5
6
  import { LeftMenuProvider } from './providers';
6
7
  // Store
7
8
  import { createLeftMenuStore } from './stores';
8
9
  import { LeftMenuComponent } from './LeftMenu';
9
- export const LeftMenu = (props) => {
10
+ import { CookiesProvider } from 'react-cookie';
11
+ export const LeftMenu = memo((props) => {
10
12
  const storeRef = useRef();
11
13
  if (!storeRef.current) {
12
14
  storeRef.current = createLeftMenuStore(props);
@@ -14,5 +16,6 @@ export const LeftMenu = (props) => {
14
16
  if (!storeRef.current)
15
17
  return null;
16
18
  return (React.createElement(LeftMenuProvider, { store: storeRef.current },
17
- React.createElement(LeftMenuComponent, Object.assign({}, props))));
18
- };
19
+ React.createElement(CookiesProvider, null,
20
+ React.createElement(LeftMenuComponent, Object.assign({}, props)))));
21
+ }, (prevProps, nextProps) => isEqual(prevProps, nextProps));
@@ -1,9 +1,7 @@
1
1
  /// <reference types="react" />
2
2
  export declare const IconWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
3
3
  export declare const PopoverWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
4
- export declare const FeatureMenuWrapper: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("antd/es/flex/interface").FlexProps<import("antd/es/_util/type").AnyObject> & import("react").RefAttributes<HTMLElement>>, any, {
5
- isExpandMenu: boolean;
6
- }, never>;
4
+ export declare const FeatureMenuWrapper: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("antd/es/flex/interface").FlexProps<import("antd/es/_util/type").AnyObject> & import("react").RefAttributes<HTMLElement>>, any, {}, never>;
7
5
  export declare const ExpandWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
8
6
  export declare const LeftMenuNavWrapper: import("styled-components").StyledComponent<"div", any, {
9
7
  $isExpandMenu?: boolean | undefined;
@@ -39,12 +39,8 @@ export const FeatureMenuWrapper = styled(Flex) `
39
39
 
40
40
  &:hover {
41
41
  ${PopoverWrapper} {
42
- ${({ isExpandMenu }) => !isExpandMenu
43
- ? `
44
- visibility: visible;
45
- opacity: 1;
46
- `
47
- : ''}
42
+ visibility: visible;
43
+ opacity: 1;
48
44
  }
49
45
  }
50
46
  `;
@@ -52,10 +52,10 @@ export const flattenMenuArray = (menuItems, childKey) => {
52
52
  export const recursivePermissionMenu = (menuItems, menuPermissions) => {
53
53
  var _a, _b;
54
54
  const menu = (_b = (_a = menuItems === null || menuItems === void 0 ? void 0 : menuItems.filter(({ permission_code, menu_item_type }) => {
55
- if (Number(menu_item_type) !== MENU_ITEM_TYPE.MENU) {
55
+ if (Number(menu_item_type) === MENU_ITEM_TYPE.GROUP_MENU) {
56
56
  return true;
57
57
  }
58
- return menuPermissions === null || menuPermissions === void 0 ? void 0 : menuPermissions.find(({ app_code = '', menu_code = '' }) => !!permission_code && [app_code, menu_code].includes(permission_code));
58
+ return !!(menuPermissions === null || menuPermissions === void 0 ? void 0 : menuPermissions.find(({ app_code = '', menu_code = '' }) => !!permission_code && [app_code, menu_code].includes(permission_code)));
59
59
  })) === null || _a === void 0 ? void 0 : _a.map(item => (Object.assign(Object.assign({}, item), (isArray(item.children)
60
60
  ? {
61
61
  children: recursivePermissionMenu(sortBy(item.children || [], ['level_position']), menuPermissions),
@@ -1,3 +1,3 @@
1
- export declare const ExpandIcon: import("styled-components").StyledComponent<any, any, import("@antscorp/antsomi-ui/es/components/atoms/Icon").IconProps & {
1
+ export declare const ExpandIcon: import("styled-components").StyledComponent<any, any, import("../../atoms/Icon").IconProps & {
2
2
  $isOpen?: boolean | undefined;
3
3
  }, string | number | symbol>;
@@ -1,7 +1,7 @@
1
1
  /// <reference types="react" />
2
- export declare const StyledModal: import("styled-components").StyledComponent<import("react").FC<import("@antscorp/antsomi-ui/es/components/molecules/ModalV2/ModalV2").ModalV2Props>, any, {}, never>;
3
- export declare const ParentMetricWrapper: import("styled-components").StyledComponent<import("react").FC<import("@antscorp/antsomi-ui/es/components/atoms/Scrollbars/Scrollbars").ScrollbarsProps>, any, {}, never>;
4
- export declare const ChildrenMetricWrapper: import("styled-components").StyledComponent<import("react").FC<import("@antscorp/antsomi-ui/es/components/atoms/Scrollbars/Scrollbars").ScrollbarsProps>, any, {}, never>;
2
+ export declare const StyledModal: import("styled-components").StyledComponent<import("react").FC<import("../../molecules/ModalV2").ModalV2Props>, any, {}, never>;
3
+ export declare const ParentMetricWrapper: import("styled-components").StyledComponent<import("react").FC<import("../../atoms/Scrollbars").ScrollbarsProps>, any, {}, never>;
4
+ export declare const ChildrenMetricWrapper: import("styled-components").StyledComponent<import("react").FC<import("../../atoms/Scrollbars").ScrollbarsProps>, any, {}, never>;
5
5
  export declare const SelectedMetricsWrapper: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("antd/es/flex/interface").FlexProps<import("antd/es/_util/type").AnyObject> & import("react").RefAttributes<HTMLElement>>, any, {}, never>;
6
6
  export declare const SelectedMetricItem: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("antd/es/flex/interface").FlexProps<import("antd/es/_util/type").AnyObject> & import("react").RefAttributes<HTMLElement>>, any, {
7
7
  disabled?: boolean | undefined;
@@ -6,8 +6,8 @@ export { PositionSetting, PositionSettingPopover } from './PositionSetting';
6
6
  export { Table, ExplorePivotTable, EXPLORE_PIVOT_TABLE_TEST_DATA } from './Table';
7
7
  export { GenerativeInsights } from './GenerativeInsights';
8
8
  export { default as ContentSources } from './ContentSources';
9
- export { LeftMenu, type LeftMenuProps } from './LeftMenu';
10
9
  export * from './ContentSources/provider';
10
+ export { LeftMenu, type LeftMenuProps } from './LeftMenu';
11
11
  export { TicketEditor } from './TicketEditor';
12
12
  export * from './DataTable';
13
13
  export * from './ModifyColumnModal';
@@ -6,8 +6,8 @@ export { PositionSetting, PositionSettingPopover } from './PositionSetting';
6
6
  export { Table, ExplorePivotTable, EXPLORE_PIVOT_TABLE_TEST_DATA } from './Table';
7
7
  export { GenerativeInsights } from './GenerativeInsights';
8
8
  export { default as ContentSources } from './ContentSources';
9
- export { LeftMenu } from './LeftMenu';
10
9
  export * from './ContentSources/provider';
10
+ export { LeftMenu } from './LeftMenu';
11
11
  export { TicketEditor } from './TicketEditor';
12
12
  export * from './DataTable';
13
13
  export * from './ModifyColumnModal';
@@ -14,6 +14,25 @@ export const OldLeftMenu = memo(props => {
14
14
  const { activeKey, appConfig, onMenuItemClick } = props;
15
15
  const [openKeys, setOpenKeys] = useState([]);
16
16
  const { auth, languageCode } = appConfig || {};
17
+ const mappedActiveKey = useMemo(() => {
18
+ switch (activeKey) {
19
+ case 'SQL_WORKSPACE':
20
+ case 'SCHEDULE_QUERY':
21
+ return 'ANALYSIS';
22
+ case 'DATA_OBJECT':
23
+ case 'BUSINESS_OBJECT-APP_API_HUB':
24
+ case 'BUSINESS_OBJECT-PERMISSION_ACCOUNT':
25
+ case 'DATA_VIEW':
26
+ return 'BUSINESS_OBJECT';
27
+ case 'BATCH_STREAMING':
28
+ case 'REALTIME_STREAMING':
29
+ return 'DATAFLOWS';
30
+ case 'DATASOURCES-SQL_WORKSPACE':
31
+ return 'DATASOURCES-APP_ANTALYSER';
32
+ default:
33
+ return activeKey;
34
+ }
35
+ }, [activeKey]);
17
36
  const { data: menuListPermission } = useGetListMenuPermission({
18
37
  args: {
19
38
  auth: {
@@ -31,9 +50,9 @@ export const OldLeftMenu = memo(props => {
31
50
  },
32
51
  });
33
52
  const parentKeys = useMemo(() => recursiveFindParentOfActiveItem({
34
- activeMenuItem: activeKey,
53
+ activeMenuItem: mappedActiveKey,
35
54
  menuItems: menuListPermission || [],
36
- }), [activeKey, menuListPermission]);
55
+ }), [mappedActiveKey, menuListPermission]);
37
56
  useLayoutEffect(() => setOpenKeys(parentKeys ? [parentKeys] : []), [parentKeys]);
38
57
  const onMenuClick = e => {
39
58
  onMenuItemClick === null || onMenuItemClick === void 0 ? void 0 : onMenuItemClick(e.key, uniq(e.keyPath));
@@ -52,7 +71,7 @@ export const OldLeftMenu = memo(props => {
52
71
  };
53
72
  };
54
73
  const items = ((_a = orderBy(menuListPermission === null || menuListPermission === void 0 ? void 0 : menuListPermission.map(item => (Object.assign(Object.assign({}, item), { app_order: Number(item.app_order) }))), ['app_order'], ['asc'])) === null || _a === void 0 ? void 0 : _a.map(item => recursiveGetMenuItem(item))) || [];
55
- return (React.createElement(Menu, { selectedKeys: [activeKey], defaultOpenKeys: uniq(openKeys), openKeys: uniq(openKeys), mode: "inline", items: items, inlineIndent: 0, onOpenChange: openKeys => {
74
+ return (React.createElement(Menu, { selectedKeys: [mappedActiveKey], defaultOpenKeys: uniq(openKeys), openKeys: uniq(openKeys), mode: "inline", items: items, inlineIndent: 0, onOpenChange: openKeys => {
56
75
  setOpenKeys(uniq(openKeys));
57
76
  }, expandIcon: ({ isOpen }) => {
58
77
  var _a;
@@ -11,8 +11,15 @@ import { OldLeftMenu } from './components';
11
11
  import { AppConfigContext } from '@antscorp/antsomi-ui/es/providers';
12
12
  export const MenuMapping = () => {
13
13
  const [activeKey, setActiveKey] = useState('DASHBOARD');
14
- const onMenuItemClick = useCallback((key, _keyPath) => {
15
- setActiveKey(key);
14
+ const onMenuItemClick = useCallback((key, keyPath) => {
15
+ switch (key) {
16
+ case 'DATASOURCES':
17
+ case 'BUSINESS_OBJECT':
18
+ setActiveKey(`${key}-${keyPath === null || keyPath === void 0 ? void 0 : keyPath[1]}`);
19
+ break;
20
+ default:
21
+ setActiveKey(key);
22
+ }
16
23
  }, []);
17
24
  const appConfig = useContextSelector(AppConfigContext, state => state);
18
25
  return (React.createElement(MenuMappingWrapper, null,
@@ -21,5 +28,5 @@ export const MenuMapping = () => {
21
28
  React.createElement(OldLeftMenu, { activeKey: activeKey, appConfig: appConfig, onMenuItemClick: onMenuItemClick })),
22
29
  React.createElement(Icon, { type: "icon-ants-arrow-forward" }),
23
30
  React.createElement("div", { className: "new-menu-wrapper" },
24
- React.createElement(LeftMenu, { appConfig: appConfig, showLogo: false, style: { maxHeight: '100%' }, customization: { isRecommendation: true, activeKey, onMenuItemClick } })))));
31
+ React.createElement(LeftMenu, { appConfig: appConfig, showLogo: false, style: { maxHeight: '100%' }, customization: { isRecommendation: true, activeKey, expandMenu: true, onMenuItemClick } })))));
25
32
  };
@@ -10,6 +10,11 @@ export const RecommendationWorkspace = () => {
10
10
  setHeaderState({
11
11
  pageTitle: 'Recommendation',
12
12
  });
13
+ return () => {
14
+ setHeaderState({
15
+ pageTitle: '',
16
+ });
17
+ };
13
18
  }, [setHeaderState]);
14
19
  return (React.createElement(Flex, { gap: 220, align: "center", justify: "center", style: { height: '100%' } },
15
20
  React.createElement(RecommendationImage, null),
@@ -3,4 +3,4 @@
3
3
  * Asynchronously loads the component for TemplateListing
4
4
  *
5
5
  */
6
- export declare const TemplateListing: (props: import("@antscorp/antsomi-ui/es/components").TemplateListingProps<{}>) => JSX.Element;
6
+ export declare const TemplateListing: (props: import("./types").TemplateListingProps<{}>) => JSX.Element;
@@ -5,6 +5,9 @@ export * from './useIntersectionObserver';
5
5
  export * from './useEffectOnlyOnce';
6
6
  export * from './useForceUpdate';
7
7
  export * from './useListingItemResize';
8
+ export * from './useKeyEventCanvas';
9
+ export * from './useDragEvent';
10
+ export * from './useDropFile';
8
11
  export * from './useToggle';
9
12
  export * from './useIsFirstRender';
10
13
  export * from './useEffectDebugger';
@@ -16,9 +19,6 @@ export * from './useUnmount';
16
19
  export * from './createEffectWithTarget ';
17
20
  export * from './useEffectWithTarget';
18
21
  export * from './useMutationObserver';
19
- export * from './useKeyEventCanvas';
20
- export * from './useDragEvent';
21
- export * from './useDropFile';
22
22
  export * from './useEventListener';
23
23
  export * from './useDebounceCallback';
24
24
  export * from './useWindowSize';
package/es/hooks/index.js CHANGED
@@ -24,6 +24,9 @@ export * from './useIntersectionObserver';
24
24
  export * from './useEffectOnlyOnce';
25
25
  export * from './useForceUpdate';
26
26
  export * from './useListingItemResize';
27
+ export * from './useKeyEventCanvas';
28
+ export * from './useDragEvent';
29
+ export * from './useDropFile';
27
30
  export * from './useToggle';
28
31
  export * from './useIsFirstRender';
29
32
  export * from './useEffectDebugger';
@@ -35,9 +38,6 @@ export * from './useUnmount';
35
38
  export * from './createEffectWithTarget ';
36
39
  export * from './useEffectWithTarget';
37
40
  export * from './useMutationObserver';
38
- export * from './useKeyEventCanvas';
39
- export * from './useDragEvent';
40
- export * from './useDropFile';
41
41
  export * from './useEventListener';
42
42
  export * from './useDebounceCallback';
43
43
  export * from './useWindowSize';
@@ -835,7 +835,6 @@ export const GlobalStyle = () => {
835
835
  padding: 20px;
836
836
  }
837
837
  }
838
-
839
838
  .antsomi-modal-content {
840
839
  .antsomi-modal-header {
841
840
  .antsomi-modal-title {
@@ -9,9 +9,7 @@ type GetListAttributeBOProps<T> = {
9
9
  export declare const useGetListAttributeBO: <T = Record<string, any>>(apiParams: APIParams, infos: PayloadInfo, props?: GetListAttributeBOProps<T>) => UseQueryResult<T, unknown>;
10
10
  export declare const getListAttributeBOQuery: ({ itemTypeIds, url, infos, }: {
11
11
  itemTypeIds: (number | null)[];
12
- } & {
13
- url: string;
14
- } & Record<string, any> & {
12
+ } & APIParams & {
15
13
  infos: PayloadInfo;
16
14
  }) => Promise<any>;
17
15
  export {};
@@ -102,7 +102,7 @@ export declare const recursiveSearchItems: <T = any>({ list, childrenKey, search
102
102
  list: T[];
103
103
  searchValue: string;
104
104
  searchKeys: (keyof T)[];
105
- childrenKey?: keyof T | undefined;
105
+ childrenKey?: keyof T;
106
106
  }) => {
107
107
  results: T[];
108
108
  matchedParents: T[];
@@ -3,4 +3,5 @@ export * from './common';
3
3
  export * from './handleError';
4
4
  export * from './templateListing';
5
5
  export * from './styles';
6
+ export * from './variables';
6
7
  export * from './actionButtons';
package/es/utils/index.js CHANGED
@@ -3,4 +3,5 @@ export * from './common';
3
3
  export * from './handleError';
4
4
  export * from './templateListing';
5
5
  export * from './styles';
6
+ export * from './variables';
6
7
  export * from './actionButtons';
@@ -3,5 +3,5 @@ interface Opts {
3
3
  fallback: React.ReactNode;
4
4
  }
5
5
  type Unpromisify<T> = T extends Promise<infer P> ? P : never;
6
- export declare const lazyLoad: <T extends Promise<any>, U extends React.ComponentType<any>>(importFunc: () => T, selectorFunc?: ((s: Unpromisify<T>) => U) | undefined, opts?: Opts) => (props: React.ComponentProps<U>) => JSX.Element;
6
+ export declare const lazyLoad: <T extends Promise<any>, U extends React.ComponentType<any>>(importFunc: () => T, selectorFunc?: (s: Unpromisify<T>) => U, opts?: Opts) => (props: React.ComponentProps<U>) => JSX.Element;
7
7
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antscorp/antsomi-ui",
3
- "version": "1.3.5-beta.403",
3
+ "version": "1.3.5-beta.404",
4
4
  "description": "An enterprise-class UI design language and React UI library.",
5
5
  "sideEffects": [
6
6
  "dist/*",
@@ -124,11 +124,11 @@
124
124
  "swiper": "^11.0.7",
125
125
  "ts-dedent": "^2.2.0",
126
126
  "tui-image-editor": "^3.15.3",
127
+ "use-image": "^1.1.1",
128
+ "use-immer": "^0.9.0",
127
129
  "uniqid": "^5.4.0",
128
130
  "use-context-selector": "^1.4.4",
129
- "use-immer": "^0.9.0",
130
- "zustand": "^4.5.2",
131
- "use-image": "^1.1.1"
131
+ "zustand": "^4.5.2"
132
132
  },
133
133
  "devDependencies": {
134
134
  "@ant-design/cssinjs": "^1.6.2",