xph-crud 0.0.7 → 0.0.9

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.
@@ -1,9 +1,12 @@
1
1
  import { MouseEvent } from 'react';
2
2
 
3
- declare const useResizeDialog: ({ visible, container, dialogRef, setDialogSize, setDialogPosition, }: {
4
- visible: boolean;
3
+ declare const useResizeDialog: ({ container, dialogRef, minResizeRecord, setDialogSize, setDialogPosition, }: {
5
4
  container: HTMLElement;
6
5
  dialogRef: React.RefObject<HTMLDivElement>;
6
+ minResizeRecord: React.MutableRefObject<{
7
+ width: number;
8
+ height: number;
9
+ } | null>;
7
10
  setDialogSize: (size: {
8
11
  width: number | string;
9
12
  height: number | string;
@@ -23,6 +23,6 @@ export interface IDialogProps {
23
23
  getPopperContainer?: () => HTMLElement | null;
24
24
  }
25
25
  export interface IDialogActionType {
26
- open: () => void;
26
+ open: () => Promise<void>;
27
27
  close: () => void;
28
28
  }
@@ -1,3 +1,4 @@
1
1
  import { IExtendProps as IXphExtendProps, IExtendComponentProps as IXphExtendComponentProps, ExtendCompPropsProvider as XphExtendCompPropsProvider, useExtendCompProps as useXphExtendCompProps } from './useExtendCompProps';
2
+ import { useAsyncState } from './useAsyncState';
2
3
 
3
- export { IXphExtendProps, IXphExtendComponentProps, XphExtendCompPropsProvider, useXphExtendCompProps, };
4
+ export { IXphExtendProps, IXphExtendComponentProps, XphExtendCompPropsProvider, useXphExtendCompProps, useAsyncState, };
@@ -0,0 +1,6 @@
1
+ /**
2
+ * 自定义 Hook 用于异步更新状态
3
+ * @param initialState 初始状态
4
+ * @returns [state, setAsyncState] state 是当前状态,setAsyncState 是更新状态的函数
5
+ */
6
+ export declare const useAsyncState: <T>(initialState: T) => [T, (newState: T) => Promise<void>];
@@ -0,0 +1,9 @@
1
+ export declare const getValueByPath: (obj: Record<string, any>, path: string) => any;
2
+ /**
3
+ * @description 通过属性为包含.的字符串的对象从值对象中获取值
4
+ * @param fields = { current: 'data.current', pageSize: 'data.pageSize' }
5
+ * @param values = { data: { current: 1, pageSize: 10 } }
6
+ * @returns = { current: 1, pageSize: 10 }
7
+ *
8
+ */
9
+ export declare const getValuesByPathObj: (fields: Record<string, string>, values: Record<string, any>) => Record<string, any>;
@@ -1 +1,2 @@
1
1
  export * from './uuid';
2
+ export * from './getValueByPath';
@@ -5,4 +5,5 @@ export type TCrudFormDialogProps<T extends TXphExtendComponentPropsMap = {}> = I
5
5
  formProps: IXphFormProps<T>;
6
6
  };
7
7
  export interface ICrudFormDialogActionType extends IXphFormActionType, IXphDialogActionType {
8
+ open: (data?: Record<string, any>) => Promise<void>;
8
9
  }
package/package.json CHANGED
@@ -1,63 +1,63 @@
1
- {
2
- "name": "xph-crud",
3
- "version": "0.0.7",
4
- "type": "module",
5
- "main": "dist/index.js",
6
- "types": "dist/types/index.d.ts",
7
- "description": "This is a configurable component library based on React",
8
- "keywords": [
9
- "react",
10
- "ant-design",
11
- "configurable-component"
12
- ],
13
- "scripts": {
14
- "examples": "vite",
15
- "build": "tsc && vite build",
16
- "docs": "cd docs && npm run start",
17
- "build:docs": "cd docs && npm run build",
18
- "lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0"
19
- },
20
- "files": [
21
- "dist",
22
- "README.md"
23
- ],
24
- "peerDependencies": {
25
- "@ant-design/icons": "5.3.2",
26
- "antd": "^5.14.2",
27
- "react": "^18.2.0",
28
- "react-dom": "^18.2.0"
29
- },
30
- "dependencies": {
31
- "dayjs": "^1.11.10",
32
- "lodash-es": "^4.17.21"
33
- },
34
- "devDependencies": {
35
- "@types/lodash-es": "^4.17.12",
36
- "@types/node": "^20.14.2",
37
- "@types/react": "^18.2.66",
38
- "@types/react-dom": "^18.2.22",
39
- "@typescript-eslint/eslint-plugin": "^7.2.0",
40
- "@typescript-eslint/parser": "^7.2.0",
41
- "@vitejs/plugin-react": "^4.2.1",
42
- "eslint": "^8.57.0",
43
- "eslint-plugin-react-hooks": "^4.6.0",
44
- "eslint-plugin-react-refresh": "^0.4.6",
45
- "typescript": "^5.2.2",
46
- "vite": "^5.2.0",
47
- "vite-plugin-dts": "^3.9.1"
48
- },
49
- "license": "ISC",
50
- "author": "XiaoPiHong",
51
- "homepage": "https://github.com/XiaoPiHong/xph-crud",
52
- "bugs": {
53
- "url": "https://github.com/XiaoPiHong/xph-crud/issues",
54
- "email": "260094892@qq.com"
55
- },
56
- "repository": {
57
- "type": "git",
58
- "url": "https://github.com/XiaoPiHong/xph-crud.git"
59
- },
60
- "engines": {
61
- "node": ">=16"
62
- }
63
- }
1
+ {
2
+ "name": "xph-crud",
3
+ "version": "0.0.9",
4
+ "type": "module",
5
+ "main": "dist/index.js",
6
+ "types": "dist/types/index.d.ts",
7
+ "description": "This is a configurable component library based on React",
8
+ "keywords": [
9
+ "react",
10
+ "ant-design",
11
+ "configurable-component"
12
+ ],
13
+ "files": [
14
+ "dist",
15
+ "README.md"
16
+ ],
17
+ "peerDependencies": {
18
+ "@ant-design/icons": "5.3.2",
19
+ "antd": "^5.14.2",
20
+ "react": "^18.2.0",
21
+ "react-dom": "^18.2.0"
22
+ },
23
+ "dependencies": {
24
+ "dayjs": "^1.11.10",
25
+ "lodash-es": "^4.17.21"
26
+ },
27
+ "devDependencies": {
28
+ "@types/lodash-es": "^4.17.12",
29
+ "@types/node": "^20.14.2",
30
+ "@types/react": "^18.2.66",
31
+ "@types/react-dom": "^18.2.22",
32
+ "@typescript-eslint/eslint-plugin": "^7.2.0",
33
+ "@typescript-eslint/parser": "^7.2.0",
34
+ "@vitejs/plugin-react": "^4.2.1",
35
+ "eslint": "^8.57.0",
36
+ "eslint-plugin-react-hooks": "^4.6.0",
37
+ "eslint-plugin-react-refresh": "^0.4.6",
38
+ "typescript": "^5.2.2",
39
+ "vite": "^5.2.0",
40
+ "vite-plugin-dts": "^3.9.1"
41
+ },
42
+ "license": "ISC",
43
+ "author": "XiaoPiHong",
44
+ "homepage": "https://github.com/XiaoPiHong/xph-crud",
45
+ "bugs": {
46
+ "url": "https://github.com/XiaoPiHong/xph-crud/issues",
47
+ "email": "260094892@qq.com"
48
+ },
49
+ "repository": {
50
+ "type": "git",
51
+ "url": "https://github.com/XiaoPiHong/xph-crud.git"
52
+ },
53
+ "engines": {
54
+ "node": ">=16"
55
+ },
56
+ "scripts": {
57
+ "examples": "vite",
58
+ "build": "tsc && vite build",
59
+ "docs": "cd docs && npm run start",
60
+ "build:docs": "cd docs && npm run build",
61
+ "lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0"
62
+ }
63
+ }