@ukpc-lib/react 0.1.11 → 0.1.12
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 +7101 -3032
- package/dist/index-9b2c9629.js +15460 -0
- package/dist/index-b4299ca4.cjs +155 -0
- package/dist/share/index.cjs +1 -101
- package/dist/share/index.js +56 -4374
- 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/index.d.ts +1 -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 +6 -2
- package/web-components-bundle/global-menu/index.cjs +37 -11
- package/web-components-bundle/global-menu/index.js +8433 -4630
- package/web-components-bundle/global-topbar/index.cjs +1 -1
- package/web-components-bundle/global-topbar/index.js +1 -1
- package/web-components-bundle/{index-4b7988de.js → index-094a6d97.js} +10 -8
- package/web-components-bundle/{index-9fa798a7.cjs → index-9fa9d5f1.cjs} +17 -17
- package/dist/react-svg.esm-8385cab5.js +0 -11617
- package/dist/react-svg.esm-a6f3a530.cjs +0 -129
- /package/dist/{react-svg.css → index.css} +0 -0
|
@@ -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 @@
|
|
|
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.12",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/",
|
|
7
7
|
"module": "./dist/",
|
|
@@ -35,7 +35,8 @@
|
|
|
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"
|
|
39
40
|
},
|
|
40
41
|
"dependencies": {
|
|
41
42
|
"@emotion/react": "^11.11.3",
|
|
@@ -52,6 +53,8 @@
|
|
|
52
53
|
"react-shadow": "^20.4.0",
|
|
53
54
|
"react-svg": "^16.1.32",
|
|
54
55
|
"react-toastify": "^10.0.4",
|
|
56
|
+
"react-window": "^1.8.10",
|
|
57
|
+
"react-window-infinite-loader": "^1.0.9",
|
|
55
58
|
"simplebar-react": "^3.2.4",
|
|
56
59
|
"vite-plugin-css-injected-by-js": "^3.3.1"
|
|
57
60
|
},
|
|
@@ -59,6 +62,7 @@
|
|
|
59
62
|
"@types/node": "^20.8.10",
|
|
60
63
|
"@types/react": "^18.2.15",
|
|
61
64
|
"@types/react-dom": "^18.2.7",
|
|
65
|
+
"@types/react-window-infinite-loader": "^1.0.9",
|
|
62
66
|
"@typescript-eslint/eslint-plugin": "^6.0.0",
|
|
63
67
|
"@typescript-eslint/parser": "^6.0.0",
|
|
64
68
|
"@vitejs/plugin-react-swc": "^3.3.2",
|