@antscorp/antsomi-ui 1.3.5-beta.370 → 1.3.5-beta.372

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.
@@ -74,7 +74,7 @@ export const ChildMenu = memo(props => {
74
74
  setOpenKeys(prev => [...prev, parentKey]);
75
75
  }
76
76
  // Active App Item having code matching url
77
- const matchAppCode = findActiveAppCodeByUrl({ menuItems, url, auth });
77
+ const matchAppCode = findActiveAppCodeByUrl({ menuItems, url, auth, env });
78
78
  if (matchAppCode && matchAppCode !== activeAppCode) {
79
79
  setLeftMenuState({ activeAppCode: matchAppCode });
80
80
  }
@@ -92,6 +92,7 @@ export const ChildMenu = memo(props => {
92
92
  isCustomized,
93
93
  customActiveCurrentKey,
94
94
  customItems,
95
+ env,
95
96
  ]);
96
97
  const onClick = e => {
97
98
  onMenuClick === null || onMenuClick === void 0 ? void 0 : onMenuClick(e.key, e.keyPath);
@@ -21,7 +21,7 @@ export const useLeftMenu = (props) => {
21
21
  const activeAppCode = useLeftMenuStore(store => store.state.activeAppCode);
22
22
  const customActiveAppKey = useLeftMenuStore(store => store.state.customActiveAppKey);
23
23
  const setLeftMenuState = useLeftMenuStore(store => store.setState);
24
- const { auth } = appConfig || {};
24
+ const { auth, env } = appConfig || {};
25
25
  const [state, setState] = useState(initialState);
26
26
  const { mappingChildrenMenu, flattenMenuPermission, permissionMenu, activeItemPath } = usePermission();
27
27
  useEffect(() => {
@@ -74,12 +74,26 @@ export const useLeftMenu = (props) => {
74
74
  if (!isCustomized) {
75
75
  const url = `${pathname}${hash}`;
76
76
  // Active App Item having code matching url
77
- const matchAppCode = findActiveAppCodeByUrl({ url, menuItems: mappingChildrenMenu, auth });
77
+ const matchAppCode = findActiveAppCodeByUrl({
78
+ url,
79
+ menuItems: mappingChildrenMenu,
80
+ auth,
81
+ env,
82
+ });
78
83
  if (matchAppCode && matchAppCode !== activeAppCode) {
79
84
  setLeftMenuState({ activeAppCode: matchAppCode });
80
85
  }
81
86
  }
82
- }, [activeAppCode, auth, hash, isCustomized, mappingChildrenMenu, pathname, setLeftMenuState]);
87
+ }, [
88
+ activeAppCode,
89
+ auth,
90
+ env,
91
+ hash,
92
+ isCustomized,
93
+ mappingChildrenMenu,
94
+ pathname,
95
+ setLeftMenuState,
96
+ ]);
83
97
  useEffect(() => {
84
98
  if (!isCustomized) {
85
99
  // Callback function using at Layout when url change
@@ -77,6 +77,7 @@ export declare const findActiveAppCodeByUrl: (args: {
77
77
  url: string;
78
78
  menuItems: TFeatureMenu[];
79
79
  auth?: Partial<PayloadInfo>;
80
+ env?: string;
80
81
  }) => string | undefined;
81
82
  export declare const findLastMatchedItemByUrl: (args: {
82
83
  url: string;
@@ -215,13 +215,13 @@ export const getMappingAppChildren = (args) => {
215
215
  */
216
216
  export const findActiveAppCodeByUrl = (args) => {
217
217
  try {
218
- const { url, menuItems, auth } = args;
218
+ const { url, menuItems, auth, env } = args;
219
219
  let matchAppCode;
220
220
  const recursiveCheckHasActiveChild = (items) => {
221
221
  let matchAppCode = false;
222
222
  for (const item of items) {
223
223
  if (!!(item === null || item === void 0 ? void 0 : item.menu_item_path) &&
224
- url.includes(getComparePath(getGeneratePath(item.menu_item_path, auth)))) {
224
+ url.includes(getComparePath(getGeneratePath(item.menu_item_path, auth), env))) {
225
225
  matchAppCode = true;
226
226
  break;
227
227
  }
@@ -236,7 +236,7 @@ export const findActiveAppCodeByUrl = (args) => {
236
236
  };
237
237
  for (const menuItem of menuItems) {
238
238
  if (!!(menuItem === null || menuItem === void 0 ? void 0 : menuItem.menu_item_path) &&
239
- url.includes(getComparePath(getGeneratePath(menuItem.menu_item_path, auth)))) {
239
+ url.includes(getComparePath(getGeneratePath(menuItem.menu_item_path, auth), env))) {
240
240
  matchAppCode = menuItem.menu_item_code;
241
241
  break;
242
242
  }
@@ -258,12 +258,12 @@ export const findActiveAppCodeByUrl = (args) => {
258
258
  };
259
259
  export const findLastMatchedItemByUrl = (args) => {
260
260
  try {
261
- const { url, menuItems, auth } = args;
261
+ const { url, menuItems, auth, env } = args;
262
262
  const matchedItems = [];
263
263
  const recursiveFindActiveItem = (items, parentId) => {
264
264
  for (const item of items) {
265
265
  if ((item === null || item === void 0 ? void 0 : item.menu_item_path) &&
266
- url.includes(getComparePath(getGeneratePath(item.menu_item_path, auth))) &&
266
+ url.includes(getComparePath(getGeneratePath(item.menu_item_path, auth), env)) &&
267
267
  (!parentId || item.menu_item_parent === parentId)) {
268
268
  matchedItems.push(item);
269
269
  }
@@ -1,5 +1,5 @@
1
1
  import { ThumbnailCardProps } from '../../../molecules';
2
- import { BlankTemplateProps, CategoryListingProps, TemplateListingProps, TemplatesProps } from '../types';
2
+ import { BlankTemplateProps, CategoryListingProps, TemplatesProps } from '../types';
3
3
  import { EmptyProps } from '../types/Empty';
4
4
  export declare const CATEGORY_LISTING_WITH = 230;
5
5
  export declare const THUMBNAIL_URL = "https://st-media-template.antsomi.com/base64-img/37563.png";
@@ -8,6 +8,5 @@ export declare const CATEGORY_DEBOUNCE = 400;
8
8
  export declare const TEMPLATE_ITEM_DEFAULT: Omit<ThumbnailCardProps, 'id'>;
9
9
  export declare const BLANK_TEMPLATE_DEFAULT: BlankTemplateProps;
10
10
  export declare const CATEGORY_LISTING_DEFAULT: Omit<CategoryListingProps, 'items'>;
11
- export declare const TEMPLATE_LISTING_DEFAULT: TemplateListingProps;
12
11
  export declare const EMPTY_DEFAULT: EmptyProps;
13
12
  export declare const TEMPLATES_DEFAULT: TemplatesProps;
@@ -14,10 +14,10 @@ export const CATEGORY_LISTING_DEFAULT = {
14
14
  checkedCategories: {},
15
15
  onMenuChange: () => { },
16
16
  };
17
- export const TEMPLATE_LISTING_DEFAULT = {
18
- templateItemProps: TEMPLATE_ITEM_DEFAULT,
19
- blankTemplateProps: BLANK_TEMPLATE_DEFAULT,
20
- };
17
+ // export const TEMPLATE_LISTING_DEFAULT: TemplateListingProps = {
18
+ // templateItemProps: TEMPLATE_ITEM_DEFAULT,
19
+ // blankTemplateProps: BLANK_TEMPLATE_DEFAULT,
20
+ // };
21
21
  export const EMPTY_DEFAULT = {
22
22
  description: 'No data',
23
23
  };
@@ -64,6 +64,7 @@ export declare const useTemplateListing: <T = undefined>(options: TemplateListin
64
64
  checkedCategories: TCheckedCategories;
65
65
  selectTemplateAction: string | T | undefined;
66
66
  previewTemplateCategories: TCategoryItem[];
67
+ isRefetching: boolean;
67
68
  isLoadingCategoryList: boolean;
68
69
  isLoadingTemplateList: boolean;
69
70
  isLoadingTemplateDetail: boolean;
@@ -91,7 +91,7 @@ export const useTemplateListing = (options) => {
91
91
  filter: JSON.stringify(filter),
92
92
  };
93
93
  // Queries
94
- const { data: infiniteObjectTemplate, isFetchingNextPage, isFetching, hasNextPage, fetchNextPage, refetch: refetchTemplateList, } = useGetObjectTemplateList({
94
+ const { data: infiniteObjectTemplate, isFetchingNextPage, isFetching, hasNextPage, fetchNextPage, refetch: refetchTemplateList, isRefetching, } = useGetObjectTemplateList({
95
95
  args: {
96
96
  auth: serviceAuth,
97
97
  params: getTemplateListParams,
@@ -273,6 +273,7 @@ export const useTemplateListing = (options) => {
273
273
  checkedCategories,
274
274
  selectTemplateAction,
275
275
  previewTemplateCategories,
276
+ isRefetching,
276
277
  isLoadingCategoryList,
277
278
  isLoadingTemplateList,
278
279
  isLoadingTemplateDetail: false,
@@ -18,7 +18,9 @@ import { Scrollbars, Spin } from '@antscorp/antsomi-ui/es/components/atoms';
18
18
  import { ThumbnailCard } from '@antscorp/antsomi-ui/es/components/molecules';
19
19
  import { PreviewTemplateModal } from '../../organism/PreviewTemplateModal';
20
20
  // Constants
21
- import { BLANK_TEMPLATE_DEFAULT, TEMPLATE_ITEM_DEFAULT, TEMPLATE_LISTING_DEFAULT, CATEGORY_LISTING_DEFAULT, EMPTY_DEFAULT, TEMPLATES_DEFAULT, LISTING_GAP_DEFAULT, } from './constants';
21
+ import { BLANK_TEMPLATE_DEFAULT, TEMPLATE_ITEM_DEFAULT,
22
+ // TEMPLATE_LISTING_DEFAULT,
23
+ CATEGORY_LISTING_DEFAULT, EMPTY_DEFAULT, TEMPLATES_DEFAULT, LISTING_GAP_DEFAULT, } from './constants';
22
24
  import { THUMBNAIL_CARD_DEFAULT_HEIGHT, THUMBNAIL_CARD_DEFAULT_WIDTH, } from '../../molecules/ThumbnailCard/constants';
23
25
  // Styled
24
26
  import { LoadMoreBlock, TemplateListingWrapper, TemplateWrapper } from './styled';
@@ -63,6 +65,7 @@ export const TemplateListing = memo(props => {
63
65
  return (React.createElement(TemplateListingWrapper, null,
64
66
  React.createElement(CategoryListing, Object.assign({}, categoryListingProps, { emptyProps: emptyProps })),
65
67
  React.createElement(TemplateWrapper, { className: wrapperClassName, style: wrapperStyle },
68
+ React.createElement("div", { className: "placeholder-test-template-listing" }),
66
69
  header,
67
70
  React.createElement(Spin, { spinning: loading || !itemPerRow, wrapperClassName: "template-listing__loading template-listing__loading--full" },
68
71
  React.createElement(Scrollbars, { className: "template-listing" },
@@ -87,4 +90,4 @@ export const TemplateListing = memo(props => {
87
90
  React.createElement(PreviewTemplateModal, Object.assign({ open: openPreviewModal, onOk: handleOkPreviewModal, onCancel: handleCancelPreviewModal }, restOfPreviewModalProps))));
88
91
  });
89
92
  TemplateListing.displayName = 'TemplateListing';
90
- TemplateListing.defaultProps = TEMPLATE_LISTING_DEFAULT;
93
+ // TemplateListing.defaultProps = TEMPLATE_LISTING_DEFAULT;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antscorp/antsomi-ui",
3
- "version": "1.3.5-beta.370",
3
+ "version": "1.3.5-beta.372",
4
4
  "description": "An enterprise-class UI design language and React UI library.",
5
5
  "sideEffects": [
6
6
  "dist/*",
@@ -71,7 +71,7 @@
71
71
  "@fortawesome/free-regular-svg-icons": "6.1.1",
72
72
  "@fortawesome/free-solid-svg-icons": "6.1.1",
73
73
  "@fortawesome/react-fontawesome": "0.2.0",
74
- "@storybook/test": "8.0.5",
74
+ "@storybook/test": "^8.0.5",
75
75
  "@swiper/core": "^0.0.21",
76
76
  "@tanstack/react-query": "4.20.4",
77
77
  "@tanstack/react-query-devtools": "4.20.4",
@@ -145,7 +145,7 @@
145
145
  "@babel/preset-env": "^7.20.2",
146
146
  "@babel/preset-react": "^7.18.6",
147
147
  "@babel/preset-typescript": "^7.23.3",
148
- "@chromatic-com/storybook": "1.3.3",
148
+ "@chromatic-com/storybook": "^1.3.3",
149
149
  "@commitlint/cli": "17.5.0",
150
150
  "@commitlint/config-conventional": "17.4.4",
151
151
  "@storybook/addon-actions": "^8.0.5",
@@ -153,11 +153,11 @@
153
153
  "@storybook/addon-interactions": "^8.0.5",
154
154
  "@storybook/addon-links": "^8.0.5",
155
155
  "@storybook/addon-styling-webpack": "^1.0.0",
156
- "@storybook/addon-webpack5-compiler-babel": "3.0.3",
157
- "@storybook/blocks": "8.0.5",
156
+ "@storybook/addon-webpack5-compiler-babel": "^3.0.3",
157
+ "@storybook/blocks": "^8.0.5",
158
158
  "@storybook/manager-api": "^8.0.5",
159
159
  "@storybook/react": "^8.0.5",
160
- "@storybook/react-webpack5": "8.0.5",
160
+ "@storybook/react-webpack5": "^8.0.5",
161
161
  "@storybook/theming": "^8.0.5",
162
162
  "@testing-library/jest-dom": "^5.16.5",
163
163
  "@testing-library/react": "^14.0.0",
@@ -213,7 +213,7 @@
213
213
  "react-router-dom": "5.1.0 || 6.14.2",
214
214
  "sass": "^1.60.0",
215
215
  "sass-loader": "^13.2.2",
216
- "storybook": "8.0.5",
216
+ "storybook": "^8.0.5",
217
217
  "style-loader": "^3.3.2",
218
218
  "styled-components": "^5.3.9",
219
219
  "terser-webpack-plugin": "^5.3.7",