@admin-layout/client 4.0.1-alpha.1 → 5.0.1-alpha.0

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.
@@ -9,11 +9,11 @@ interface ApplicationErrorHandlerCommonProps {
9
9
  plugins: Record<string, any>;
10
10
  children: ReactNode;
11
11
  }
12
- declare type IRendererComponentType = (props: {
12
+ type IRendererComponentType = (props: {
13
13
  applicationErrors: ApplicationErrorState[];
14
14
  backendError: ApplicationErrorState;
15
15
  }) => ReactElement;
16
- declare type IApplicationErrorSlotType = (props: {
16
+ type IApplicationErrorSlotType = (props: {
17
17
  name: string;
18
18
  fillProps: {
19
19
  active: boolean;
@@ -1,9 +1,9 @@
1
1
  import React, { ReactElement } from 'react';
2
- declare type IErrorBoundryState = {
2
+ type IErrorBoundryState = {
3
3
  hasError: boolean;
4
4
  error: Error | null;
5
5
  };
6
- declare type IErrorBoundryProps = {
6
+ type IErrorBoundryProps = {
7
7
  children: ReactElement;
8
8
  fallbackComponent: (props: {
9
9
  error: Error;
@@ -1,10 +1,10 @@
1
- export declare type BACKEND_ERROR = '@platform/BACKEND_ERROR';
1
+ export type BACKEND_ERROR = '@platform/BACKEND_ERROR';
2
2
  export declare const BACKEND_ERROR: BACKEND_ERROR;
3
- export declare type DISMISS_APPLICATION_ERROR = '@platform/DISMISS_APPLICATION_ERROR';
3
+ export type DISMISS_APPLICATION_ERROR = '@platform/DISMISS_APPLICATION_ERROR';
4
4
  export declare const DISMISS_APPLICATION_ERROR: DISMISS_APPLICATION_ERROR;
5
- export declare type CLEAR_APPLICATION_ERRORS = '@platform/CLEAR_APPLICATION_ERRORS';
5
+ export type CLEAR_APPLICATION_ERRORS = '@platform/CLEAR_APPLICATION_ERRORS';
6
6
  export declare const CLEAR_APPLICATION_ERRORS: CLEAR_APPLICATION_ERRORS;
7
- export declare type RESTORE_APPLICATION_ERRORS = '@platform/RESTORE_APPLICATION_ERRORS';
7
+ export type RESTORE_APPLICATION_ERRORS = '@platform/RESTORE_APPLICATION_ERRORS';
8
8
  export declare const RESTORE_APPLICATION_ERRORS: RESTORE_APPLICATION_ERRORS;
9
- export declare type LOG_APPLICATION_ERROR = '@platform/LOG_APPLICATION_ERROR';
9
+ export type LOG_APPLICATION_ERROR = '@platform/LOG_APPLICATION_ERROR';
10
10
  export declare const LOG_APPLICATION_ERROR: LOG_APPLICATION_ERROR;
@@ -1,6 +1,6 @@
1
1
  import { ApolloLink } from '@apollo/client';
2
2
  import { interfaces } from 'inversify';
3
- declare type IGetErrorLink = (container: interfaces.Container) => ApolloLink;
3
+ type IGetErrorLink = (container: interfaces.Container) => ApolloLink;
4
4
  interface IErrorLink {
5
5
  getErrorLink: IGetErrorLink;
6
6
  }
@@ -1,4 +1,4 @@
1
1
  import { ProSettings } from './pure-settings';
2
- export declare type DefaultSettings = Partial<ProSettings> & {
2
+ export type DefaultSettings = Partial<ProSettings> & {
3
3
  language?: string;
4
4
  };
@@ -1,4 +1,3 @@
1
- export * from './generated';
2
1
  export * from './default-settings';
3
2
  export * from './pure-settings';
4
3
  export * from './typings';
@@ -1,4 +1,4 @@
1
- export * from './generated';
1
+ // export * from './generated';
2
2
  export * from './default-settings';
3
3
  export * from './pure-settings';
4
4
  export * from './typings';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/interfaces/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,WAAW,CAAC;AAC1B,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/interfaces/index.ts"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,WAAW,CAAC;AAC1B,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC"}
@@ -2,7 +2,7 @@
2
2
  import { MenuTheme, PureSettings } from "../pure-settings";
3
3
  import { MenuDataItem, MessageDescriptor, Route, RouterTypes, WithFalse } from "../typings";
4
4
  import { MenuProps } from "./menu";
5
- export declare type MenuMode = 'vertical' | 'horizontal' | 'inline';
5
+ export type MenuMode = 'vertical' | 'horizontal' | 'inline';
6
6
  export interface BaseMenuProps extends Partial<RouterTypes<Route>>, Omit<MenuProps, 'openKeys' | 'onOpenChange' | 'title'>, Partial<PureSettings> {
7
7
  className?: string;
8
8
  /**
@@ -7,7 +7,7 @@ import { GetPageTitleProps } from './page';
7
7
  import { SiderMenuProps } from './sider-menu';
8
8
  import { ProSettings } from '../pure-settings';
9
9
  import { IPermissionType } from '@adminide-stack/core';
10
- export declare type LocaleType = {
10
+ export type LocaleType = {
11
11
  'zh-CN': {
12
12
  [key: string]: string;
13
13
  };
@@ -21,14 +21,14 @@ export declare type LocaleType = {
21
21
  [key: string]: string;
22
22
  };
23
23
  };
24
- declare type MergerSettingsType<T> = Partial<T> & {
24
+ type MergerSettingsType<T> = Partial<T> & {
25
25
  primaryColor?: string;
26
26
  colorWeak?: boolean;
27
27
  };
28
28
  interface MainHeaderPropsInterface {
29
29
  picture: string;
30
30
  }
31
- export declare type BasicLayoutProps = Partial<RouterTypes<Route>> & SiderMenuProps & HeaderViewProps & {
31
+ export type BasicLayoutProps = Partial<RouterTypes<Route>> & SiderMenuProps & HeaderViewProps & {
32
32
  pure?: boolean;
33
33
  /**
34
34
  *@name logo url
@@ -67,6 +67,6 @@ export declare type BasicLayoutProps = Partial<RouterTypes<Route>> & SiderMenuPr
67
67
  * Use both content margin
68
68
  */
69
69
  disableContentMargin?: boolean;
70
- mainHeaderProps: MainHeaderPropsInterface;
70
+ mainHeaderProps?: MainHeaderPropsInterface;
71
71
  };
72
72
  export {};
@@ -2,7 +2,7 @@
2
2
  import { PureSettings } from '../pure-settings';
3
3
  import { MenuDataItem, WithFalse } from '../typings';
4
4
  import { PrivateSiderMenuProps, SiderMenuProps } from './sider-menu';
5
- export declare type HeaderViewProps = GlobalHeaderProps & {
5
+ export type HeaderViewProps = GlobalHeaderProps & {
6
6
  isMobile?: boolean;
7
7
  collapsed?: boolean;
8
8
  logo?: React.ReactNode;
@@ -1,7 +1,7 @@
1
1
  /// <reference types="react" />
2
2
  import { WithFalse } from "../typings";
3
3
  import { BaseMenuProps } from "./base-menu";
4
- export declare type PrivateSiderMenuProps = {
4
+ export type PrivateSiderMenuProps = {
5
5
  matchMenuKeys: string[];
6
6
  };
7
7
  export interface SiderMenuProps extends Pick<BaseMenuProps, Exclude<keyof BaseMenuProps, ['onCollapse']>> {
@@ -21,8 +21,8 @@ export interface SiderMenuProps extends Pick<BaseMenuProps, Exclude<keyof BaseMe
21
21
  onOpenChange?: (openKeys: WithFalse<string[]>) => void;
22
22
  getContainer?: false;
23
23
  }
24
- declare type SiderTheme = 'light' | 'dark';
25
- declare type CollapseType = 'clickTrigger' | 'responsive';
24
+ type SiderTheme = 'light' | 'dark';
25
+ type CollapseType = 'clickTrigger' | 'responsive';
26
26
  export interface SiderProps extends React.HTMLAttributes<HTMLDivElement> {
27
27
  prefixCls?: string;
28
28
  collapsible?: boolean;
@@ -1,5 +1,5 @@
1
- export declare type ContentWidth = 'Fluid' | 'Fixed';
2
- export declare type MenuTheme = 'light' | 'dark';
1
+ export type ContentWidth = 'Fluid' | 'Fixed';
2
+ export type MenuTheme = 'light' | 'dark';
3
3
  export interface RenderSetting {
4
4
  showHeader?: boolean | any;
5
5
  headerRender?: boolean | any;
@@ -75,4 +75,4 @@ export interface PureSettings {
75
75
  splitMenus?: boolean;
76
76
  siderMenuType?: string;
77
77
  }
78
- export declare type ProSettings = PureSettings & RenderSetting;
78
+ export type ProSettings = PureSettings & RenderSetting;
@@ -64,7 +64,7 @@ export interface Route extends MenuDataItem {
64
64
  routes?: Route[];
65
65
  breadcrumbName: string;
66
66
  }
67
- export declare type WithFalse<T> = T | false;
67
+ export type WithFalse<T> = T | false;
68
68
  export interface RouterTypes<P> extends Omit<BasicRouteProps, 'location'> {
69
69
  computedMatch?: match<P>;
70
70
  route?: Route;
@@ -14,7 +14,7 @@ export declare const restoreApplicationError: (payload: ApplicationErrorState[])
14
14
  type: "@platform/RESTORE_APPLICATION_ERRORS";
15
15
  payload: ApplicationErrorState[];
16
16
  };
17
- export declare type ErrorActions = {
17
+ export type ErrorActions = {
18
18
  type: LOG_APPLICATION_ERROR;
19
19
  payload: Omit<ApplicationErrorState, 'date'>;
20
20
  } | {
@@ -0,0 +1,7 @@
1
+ import { useLayoutEffect } from 'react';
2
+ export declare const useIsomorphicLayoutEffect: typeof useLayoutEffect;
3
+ export declare const useComponentSize: () => {
4
+ width: any;
5
+ height: any;
6
+ ref: import("react").MutableRefObject<null>;
7
+ };
@@ -0,0 +1,48 @@
1
+ 'use strict';
2
+ import { useState, useRef, useCallback, useLayoutEffect, useEffect } from 'react';
3
+ export const useIsomorphicLayoutEffect = typeof window !== 'undefined' ? useLayoutEffect : useEffect;
4
+ const getSize = (el) => {
5
+ if (!el) {
6
+ return {
7
+ width: 0,
8
+ height: 0
9
+ };
10
+ }
11
+ return {
12
+ width: el.offsetWidth,
13
+ height: el.offsetHeight
14
+ };
15
+ };
16
+ export const useComponentSize = () => {
17
+ let ref = useRef(null);
18
+ const [componentSize, setComponentSize] = useState(getSize(ref ? ref.current : {}));
19
+ const handleResize = useCallback(() => {
20
+ if (ref.current) {
21
+ setComponentSize(getSize(ref.current));
22
+ }
23
+ }, [ref]);
24
+ useIsomorphicLayoutEffect(() => {
25
+ if (!ref.current) {
26
+ return;
27
+ }
28
+ handleResize();
29
+ if (typeof ResizeObserver === 'function') {
30
+ let resizeObserver = new ResizeObserver(() => {
31
+ handleResize();
32
+ });
33
+ resizeObserver.observe(ref.current);
34
+ return () => {
35
+ resizeObserver.disconnect();
36
+ resizeObserver = null;
37
+ };
38
+ }
39
+ else {
40
+ window.addEventListener('resize', handleResize);
41
+ return () => {
42
+ window.removeEventListener('resize', handleResize);
43
+ };
44
+ }
45
+ }, [ref.current]);
46
+ return Object.assign({ ref }, componentSize);
47
+ };
48
+ //# sourceMappingURL=componentSize.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"componentSize.js","sourceRoot":"","sources":["../../src/utils/componentSize.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AACb,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,WAAW,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAElF,MAAM,CAAC,MAAM,yBAAyB,GAAG,OAAO,MAAM,KAAK,WAAW,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,SAAS,CAAC;AAErG,MAAM,OAAO,GAAG,CAAC,EAAE,EAAE,EAAE;IACrB,IAAI,CAAC,EAAE,EAAE;QACP,OAAO;YACL,KAAK,EAAE,CAAC;YACR,MAAM,EAAE,CAAC;SACV,CAAC;KACH;IACD,OAAO;QACL,KAAK,EAAE,EAAE,CAAC,WAAW;QACrB,MAAM,EAAE,EAAE,CAAC,YAAY;KACxB,CAAC;AACJ,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,gBAAgB,GAAG,GAAG,EAAE;IACnC,IAAI,GAAG,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC;IACvB,MAAM,CAAC,aAAa,EAAE,gBAAgB,CAAC,GAAG,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAEpF,MAAM,YAAY,GAAG,WAAW,CAAC,GAAG,EAAE;QACpC,IAAI,GAAG,CAAC,OAAO,EAAE;YACf,gBAAgB,CAAC,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC;SACxC;IACH,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAEV,yBAAyB,CAAC,GAAG,EAAE;QAC7B,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE;YAChB,OAAO;SACR;QACD,YAAY,EAAE,CAAC;QAEf,IAAI,OAAO,cAAc,KAAK,UAAU,EAAE;YACxC,IAAI,cAAc,GAAG,IAAI,cAAc,CAAC,GAAG,EAAE;gBAC3C,YAAY,EAAE,CAAC;YACjB,CAAC,CAAC,CAAC;YACH,cAAc,CAAC,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;YAEpC,OAAO,GAAG,EAAE;gBACV,cAAc,CAAC,UAAU,EAAE,CAAC;gBAC3B,cAAsB,GAAG,IAAI,CAAC;YACjC,CAAC,CAAC;SACH;aAAM;YACL,MAAM,CAAC,gBAAgB,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAC;YAEhD,OAAO,GAAG,EAAE;gBACV,MAAM,CAAC,mBAAmB,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAC;YACrD,CAAC,CAAC;SACH;IACH,CAAC,EAAE,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC;IAElB,uBAAS,GAAG,IAAK,aAAa,EAAG;AACnC,CAAC,CAAA"}
@@ -1 +1,2 @@
1
1
  export * from './seperatedMenus';
2
+ export * from './componentSize';
@@ -1,2 +1,3 @@
1
1
  export * from './seperatedMenus';
2
+ export * from './componentSize';
2
3
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC"}
@@ -1,5 +1,5 @@
1
1
  import { MenuDataItem } from '../interfaces';
2
- export declare type SeparateMenusTypes = {
2
+ export type SeparateMenusTypes = {
3
3
  upperMenus?: MenuDataItem[];
4
4
  middleMenus?: MenuDataItem[];
5
5
  lowerMenus?: MenuDataItem[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@admin-layout/client",
3
- "version": "4.0.1-alpha.1",
3
+ "version": "5.0.1-alpha.0",
4
4
  "description": "Sample client for higher packages to depend on",
5
5
  "license": "ISC",
6
6
  "author": "CDMBase LLC",
@@ -34,5 +34,5 @@
34
34
  "typescript": {
35
35
  "definition": "lib/index.d.ts"
36
36
  },
37
- "gitHead": "240f43c7e32e1a421f003484585283e13086ed7e"
37
+ "gitHead": "9d126e98d4d350532dcb5da56fd6d282e4360c9b"
38
38
  }