@ukpc-lib/react 0.1.11 → 0.1.13
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/dist/components/index.cjs +65 -6
- package/dist/components/index.js +7665 -3036
- package/dist/{react-svg.css → index.css} +1 -1
- package/dist/index.es-4032ffe1.js +19562 -0
- package/dist/index.es-6cb46e89.cjs +173 -0
- package/dist/share/index.cjs +1 -101
- package/dist/share/index.js +57 -4374
- package/dist/src/components/NoData/index.d.ts +2 -0
- package/dist/src/components/NotFoundPage/index.d.ts +4 -0
- package/dist/src/components/PopUp/index.d.ts +8 -0
- package/dist/src/components/PopUp/types.d.ts +26 -0
- package/dist/src/components/StyledAutocomplete/AutocompleteOption.d.ts +11 -0
- package/dist/src/components/StyledAutocomplete/StyledAutocomplete.d.ts +29 -0
- package/dist/src/components/StyledAutocomplete/helpers.d.ts +1 -0
- package/dist/src/components/StyledAutocomplete/index.d.ts +3 -0
- package/dist/src/components/StyledAutocomplete/types.d.ts +46 -0
- package/dist/src/components/StyledAutocomplete/useStyledAutocomplete.d.ts +28 -0
- package/dist/src/components/StyledDateRangePicker/BlockIcon.d.ts +4 -0
- package/dist/src/components/StyledDateRangePicker/index.d.ts +13 -0
- package/dist/src/components/UnauthorizedPage/index.d.ts +2 -0
- package/dist/src/components/index.d.ts +6 -0
- package/dist/src/share/helpers/index.d.ts +1 -0
- package/dist/src/share/index.d.ts +1 -0
- package/dist/src/share/interceptor/index.d.ts +2 -2
- package/package.json +12 -3
- package/web-components-bundle/global-menu/index.cjs +64 -11
- package/web-components-bundle/global-menu/index.js +17881 -7392
- package/web-components-bundle/global-topbar/index.cjs +2 -2
- package/web-components-bundle/global-topbar/index.js +3 -3
- package/web-components-bundle/{index-9fa798a7.cjs → index-3a3447c8.cjs} +17 -17
- package/web-components-bundle/{index-4b7988de.js → index-688657b9.js} +195 -171
- package/dist/react-svg.esm-8385cab5.js +0 -11617
- package/dist/react-svg.esm-a6f3a530.cjs +0 -129
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { PopUpBaseProps, usePopUpProps } from './types';
|
|
2
|
+
export declare function PopUpBase(props: PopUpBaseProps): import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
export declare function usePopUp(props?: boolean | usePopUpProps): {
|
|
4
|
+
setTrue: () => void;
|
|
5
|
+
open: boolean;
|
|
6
|
+
onClose: () => void;
|
|
7
|
+
onConfirm: (() => void) | undefined;
|
|
8
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { SxProps, TypographyProps, Theme, DialogProps, DialogActionsProps } from "@mui/material";
|
|
2
|
+
import { ReactNode } from "react";
|
|
3
|
+
export type PopUpBaseProps = IPopUp & {
|
|
4
|
+
title?: ReactNode;
|
|
5
|
+
subTitle?: ReactNode;
|
|
6
|
+
desc: ReactNode;
|
|
7
|
+
fixOverflow?: boolean;
|
|
8
|
+
minWidthButton?: number;
|
|
9
|
+
subTitleProps?: TypographyProps;
|
|
10
|
+
contentProps?: SxProps<Theme>;
|
|
11
|
+
titleProps?: SxProps<Theme>;
|
|
12
|
+
hideTitle?: boolean;
|
|
13
|
+
};
|
|
14
|
+
export type IPopUp = {
|
|
15
|
+
open: boolean;
|
|
16
|
+
onClose?(): void;
|
|
17
|
+
onConfirm?: () => void;
|
|
18
|
+
dialogProps?: Omit<DialogProps, 'open' | 'onClose'>;
|
|
19
|
+
dialogActionsProps?: DialogActionsProps;
|
|
20
|
+
customActions?: ReactNode;
|
|
21
|
+
hideConfirm?: boolean;
|
|
22
|
+
hideClose?: boolean;
|
|
23
|
+
};
|
|
24
|
+
export type usePopUpProps = {
|
|
25
|
+
onConfirm?(): void;
|
|
26
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { StackProps } from '@mui/material';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
type Props<T> = {
|
|
4
|
+
option: T;
|
|
5
|
+
renderOption(option: T): ReactNode;
|
|
6
|
+
onClick?(option: T): any;
|
|
7
|
+
stackProps?: StackProps;
|
|
8
|
+
select?: boolean;
|
|
9
|
+
};
|
|
10
|
+
export declare function AutocompleteOption<T>(props: Props<T>): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { Paging } from './types';
|
|
3
|
+
export type StyledAutocompleteProps<T> = {
|
|
4
|
+
disabledAllOption?: boolean;
|
|
5
|
+
readOnly?: boolean;
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
isSync?: boolean;
|
|
8
|
+
label?: React.ReactNode;
|
|
9
|
+
value?: T;
|
|
10
|
+
placeholder?: string;
|
|
11
|
+
onChange?(value?: T): any;
|
|
12
|
+
isEqual?(option?: T, value?: T): boolean;
|
|
13
|
+
getOptionLabel(option: T): string;
|
|
14
|
+
renderOptionTooltip?(option: T): ReactNode;
|
|
15
|
+
handleChangeSearch?(text: string): void;
|
|
16
|
+
searchLoading: boolean;
|
|
17
|
+
loading?: boolean;
|
|
18
|
+
paging: Paging<T>;
|
|
19
|
+
error?: boolean;
|
|
20
|
+
helperText?: ReactNode;
|
|
21
|
+
hasNextPage: boolean;
|
|
22
|
+
isNextPageLoading: boolean;
|
|
23
|
+
loadNextPage(searchText: string): void;
|
|
24
|
+
wrapperWidth?: string | number;
|
|
25
|
+
isRequired?: boolean;
|
|
26
|
+
itemsNumber?: number;
|
|
27
|
+
placeHolderColor?: string;
|
|
28
|
+
};
|
|
29
|
+
export declare function StyledAutocomplete<T>(props: StyledAutocompleteProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function activeStyles<T>(props: T, active?: boolean): T | undefined;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
type Normal<S extends string> = S;
|
|
2
|
+
type AsTypeSort<T> = {
|
|
3
|
+
[P in keyof T as `-${Normal<string & P>}`]: T[P];
|
|
4
|
+
};
|
|
5
|
+
type Filter<T> = {
|
|
6
|
+
[P in keyof T]?: T[P] | T[P][] | Partial<Record<keyof typeof Op, T[P] | T[P][]>>;
|
|
7
|
+
};
|
|
8
|
+
interface Query<T> {
|
|
9
|
+
search?: Search<T>;
|
|
10
|
+
filter?: Filter<T>;
|
|
11
|
+
}
|
|
12
|
+
type NestedKeys<T> = {
|
|
13
|
+
[K in keyof T]: K extends string | number ? T[K] extends object ? `${(K & string) | number}.${NestedKeys<T[K]>}` : (K & string) | number : never;
|
|
14
|
+
}[keyof T];
|
|
15
|
+
interface Search<T> {
|
|
16
|
+
content: string;
|
|
17
|
+
fields?: (keyof T | NestedKeys<T>)[];
|
|
18
|
+
}
|
|
19
|
+
type Sort<T> = keyof T | keyof AsTypeSort<T>;
|
|
20
|
+
declare const Op: {
|
|
21
|
+
$eq: symbol;
|
|
22
|
+
$ne: symbol;
|
|
23
|
+
$gte: symbol;
|
|
24
|
+
$gt: symbol;
|
|
25
|
+
$lte: symbol;
|
|
26
|
+
$lt: symbol;
|
|
27
|
+
$not: symbol;
|
|
28
|
+
$notIn: symbol;
|
|
29
|
+
$notLike: symbol;
|
|
30
|
+
$notILike: symbol;
|
|
31
|
+
$regexp: symbol;
|
|
32
|
+
$bt: symbol;
|
|
33
|
+
};
|
|
34
|
+
export interface ListProps<T> extends Query<T> {
|
|
35
|
+
page?: number;
|
|
36
|
+
pageSize?: number;
|
|
37
|
+
sorts?: Sort<T>[];
|
|
38
|
+
}
|
|
39
|
+
export declare class Paging<T> {
|
|
40
|
+
rows: T[];
|
|
41
|
+
total: number;
|
|
42
|
+
page: number;
|
|
43
|
+
pageSize: number;
|
|
44
|
+
totalPages: number;
|
|
45
|
+
}
|
|
46
|
+
export {};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { DependencyList } from 'react';
|
|
2
|
+
import { ListProps, Paging } from './types';
|
|
3
|
+
import { StyledAutocompleteProps } from './StyledAutocomplete';
|
|
4
|
+
export declare function useStyledAutocomplete<T, P extends ListProps<T>>(props: UseAutocomplete<T, P>): TypeReturn<T, P>;
|
|
5
|
+
type SearchList<T> = {
|
|
6
|
+
searchFields: (keyof T)[];
|
|
7
|
+
searchOption?: never;
|
|
8
|
+
} | {
|
|
9
|
+
searchFields?: never;
|
|
10
|
+
searchOption: (option: T, searchText: string) => boolean;
|
|
11
|
+
};
|
|
12
|
+
export type UseAutocomplete<T, P extends ListProps<T>> = {
|
|
13
|
+
readOnly?: boolean;
|
|
14
|
+
loading?: boolean;
|
|
15
|
+
disabled?: boolean;
|
|
16
|
+
list?: {
|
|
17
|
+
options: T[];
|
|
18
|
+
} & SearchList<T>;
|
|
19
|
+
getList?(props: P): Promise<Paging<T>>;
|
|
20
|
+
listProps?: Partial<P>;
|
|
21
|
+
dependencyList?: DependencyList;
|
|
22
|
+
};
|
|
23
|
+
export type TypeReturn<T, P> = Pick<StyledAutocompleteProps<T>, 'loadNextPage' | 'handleChangeSearch' | 'paging' | 'hasNextPage' | 'isNextPageLoading' | 'searchLoading' | 'loading' | 'value' | 'onChange' | 'isSync' | 'readOnly'> & {
|
|
24
|
+
getList(props?: P): Promise<void>;
|
|
25
|
+
reset(): void;
|
|
26
|
+
toggleLoading: VoidFunction;
|
|
27
|
+
};
|
|
28
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
interface DateRangeValue {
|
|
2
|
+
startDate?: Date;
|
|
3
|
+
endDate?: Date;
|
|
4
|
+
}
|
|
5
|
+
type Props = {
|
|
6
|
+
value?: DateRangeValue;
|
|
7
|
+
onChange?(value: DateRangeValue): void;
|
|
8
|
+
initialSettings?: any;
|
|
9
|
+
label?: string;
|
|
10
|
+
dateReset?: DateRangeValue;
|
|
11
|
+
};
|
|
12
|
+
export declare function StyledDateRangePicker(props: Props): import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export {};
|
|
@@ -1,3 +1,9 @@
|
|
|
1
1
|
export * from './Topbar';
|
|
2
2
|
export * from './GlobalMenu';
|
|
3
3
|
export * from './Toast';
|
|
4
|
+
export * from './NoData';
|
|
5
|
+
export * from './PopUp';
|
|
6
|
+
export * from './NotFoundPage';
|
|
7
|
+
export * from './UnauthorizedPage';
|
|
8
|
+
export * from './StyledAutocomplete/index.ts';
|
|
9
|
+
export * from './StyledDateRangePicker';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function search<T>(option: T, searchText: string, fields: Array<keyof T>): boolean;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AxiosRequestConfig } from 'axios';
|
|
2
2
|
type TgetAxiosInstanceParams = {
|
|
3
3
|
config: AxiosRequestConfig;
|
|
4
4
|
pushError?: (message: string) => void;
|
|
5
5
|
};
|
|
6
|
-
export declare function getAxiosInstance({ config, pushError, }: TgetAxiosInstanceParams): AxiosInstance;
|
|
6
|
+
export declare function getAxiosInstance({ config, pushError, }: TgetAxiosInstanceParams): import("axios").AxiosInstance;
|
|
7
7
|
export {};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ukpc-lib/react",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.13",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/",
|
|
7
7
|
"module": "./dist/",
|
|
@@ -29,13 +29,14 @@
|
|
|
29
29
|
"web-components-bundle"
|
|
30
30
|
],
|
|
31
31
|
"scripts": {
|
|
32
|
-
"dev": "vite",
|
|
32
|
+
"dev": "vite --open --port 3000",
|
|
33
33
|
"build": "npm run build-react && npm run build-wc",
|
|
34
34
|
"build-react": "tsc && vite build --config vite.config.react.ts",
|
|
35
35
|
"build-wc": "tsc && vite build --config vite.config.wc.ts --mode production",
|
|
36
36
|
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
|
|
37
37
|
"preview": "vite preview",
|
|
38
|
-
"publish": "npm publish --access public"
|
|
38
|
+
"publish": "npm publish --access public",
|
|
39
|
+
"build-publish": "npm run build && npm version patch && npm run build && npm run publish && git push"
|
|
39
40
|
},
|
|
40
41
|
"dependencies": {
|
|
41
42
|
"@emotion/react": "^11.11.3",
|
|
@@ -45,20 +46,28 @@
|
|
|
45
46
|
"@r2wc/react-to-web-component": "^2.0.3",
|
|
46
47
|
"@rollup/plugin-replace": "^5.0.5",
|
|
47
48
|
"axios": "^1.6.5",
|
|
49
|
+
"bootstrap-daterangepicker": "^3.1.0",
|
|
48
50
|
"cssnano": "^6.0.3",
|
|
49
51
|
"framer-motion": "^10.18.0",
|
|
52
|
+
"jquery": "^3.7.1",
|
|
53
|
+
"moment": "^2.30.1",
|
|
54
|
+
"react-bootstrap-daterangepicker": "^8.0.0",
|
|
50
55
|
"react-query": "^3.39.3",
|
|
51
56
|
"react-router-dom": "^6.21.3",
|
|
52
57
|
"react-shadow": "^20.4.0",
|
|
53
58
|
"react-svg": "^16.1.32",
|
|
54
59
|
"react-toastify": "^10.0.4",
|
|
60
|
+
"react-window": "^1.8.10",
|
|
61
|
+
"react-window-infinite-loader": "^1.0.9",
|
|
55
62
|
"simplebar-react": "^3.2.4",
|
|
63
|
+
"usehooks-ts": "^2.15.1",
|
|
56
64
|
"vite-plugin-css-injected-by-js": "^3.3.1"
|
|
57
65
|
},
|
|
58
66
|
"devDependencies": {
|
|
59
67
|
"@types/node": "^20.8.10",
|
|
60
68
|
"@types/react": "^18.2.15",
|
|
61
69
|
"@types/react-dom": "^18.2.7",
|
|
70
|
+
"@types/react-window-infinite-loader": "^1.0.9",
|
|
62
71
|
"@typescript-eslint/eslint-plugin": "^6.0.0",
|
|
63
72
|
"@typescript-eslint/parser": "^6.0.0",
|
|
64
73
|
"@vitejs/plugin-react-swc": "^3.3.2",
|