@hzab/list-render 1.12.4 → 1.12.6
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/CHANGELOG.md +18 -0
- package/LICENSE +21 -0
- package/dist/FilterTag/index.d.ts +3 -0
- package/dist/FormModal/index.d.ts +19 -0
- package/dist/common/cloneSchema.d.ts +7 -0
- package/dist/common/constant.d.ts +2 -0
- package/dist/common/handleQuerySchema.d.ts +165 -0
- package/dist/components/Formily/FormilyEditTable.d.ts +94 -0
- package/dist/components/Formily/FormilyField.d.ts +10 -0
- package/dist/components/PrefixNode/index.d.ts +21 -0
- package/dist/components/Tags/index.d.ts +16 -0
- package/dist/index.cjs +1 -0
- package/dist/index.css +2 -0
- package/dist/index.js +1660 -0
- package/package.json +77 -73
- package/src/FilterTag/index.tsx +3 -4
- package/src/FormModal/index.tsx +1 -1
- package/src/components/Formily/FormilyEditTable.tsx +3 -3
- package/src/components/Formily/FormilyField.tsx +5 -4
- package/src/components/PrefixNode/index.tsx +4 -4
- package/src/components/Tags/index.tsx +4 -4
- package/src/vite-env.d.ts +1 -0
- package/README.md +0 -612
- package/docs/effect.md +0 -2
- package/docs/form-linkage.md +0 -293
- package/docs/remote-data.md +0 -124
- package/docs/table.md +0 -86
package/package.json
CHANGED
|
@@ -1,73 +1,77 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@hzab/list-render",
|
|
3
|
-
"version": "1.12.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
"
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
"
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
"
|
|
16
|
-
"
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
"
|
|
22
|
-
],
|
|
23
|
-
"
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
"@
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
-
"
|
|
33
|
-
"
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
"@
|
|
37
|
-
"
|
|
38
|
-
"
|
|
39
|
-
"
|
|
40
|
-
"
|
|
41
|
-
"
|
|
42
|
-
"
|
|
43
|
-
"
|
|
44
|
-
"
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
"
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
"@formily/
|
|
51
|
-
"@formily/react": "2.3.1",
|
|
52
|
-
"@
|
|
53
|
-
"@
|
|
54
|
-
"@
|
|
55
|
-
"@
|
|
56
|
-
"
|
|
57
|
-
"
|
|
58
|
-
"antd": "
|
|
59
|
-
"
|
|
60
|
-
"
|
|
61
|
-
"
|
|
62
|
-
"react": "
|
|
63
|
-
"react-
|
|
64
|
-
"
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
"
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "@hzab/list-render",
|
|
3
|
+
"version": "1.12.6",
|
|
4
|
+
"private": false,
|
|
5
|
+
"src-direct": true,
|
|
6
|
+
"type": "module",
|
|
7
|
+
"description": "列表与表格渲染",
|
|
8
|
+
"license": "ISC",
|
|
9
|
+
"author": "CaiYansong",
|
|
10
|
+
"engines": {
|
|
11
|
+
"node": ">=24"
|
|
12
|
+
},
|
|
13
|
+
"main": "src",
|
|
14
|
+
"files": [
|
|
15
|
+
"src",
|
|
16
|
+
"dist",
|
|
17
|
+
"docs",
|
|
18
|
+
"CHANGELOG.md"
|
|
19
|
+
],
|
|
20
|
+
"sideEffects": [
|
|
21
|
+
"**/*.less"
|
|
22
|
+
],
|
|
23
|
+
"peerDependencies": {
|
|
24
|
+
"@formily/core": ">=2.0.0",
|
|
25
|
+
"@formily/json-schema": ">=2.0.0",
|
|
26
|
+
"@formily/react": ">=2.0.0",
|
|
27
|
+
"@formily/reactive": ">=2.0.0",
|
|
28
|
+
"antd": ">=4.0.0",
|
|
29
|
+
"array-move": "^4.0.0",
|
|
30
|
+
"c-formily-antd": ">=2.0.0",
|
|
31
|
+
"react": ">=16.8.0",
|
|
32
|
+
"react-dom": ">=16.8.0",
|
|
33
|
+
"react-sortable-hoc": ">=2.0.0"
|
|
34
|
+
},
|
|
35
|
+
"dependencies": {
|
|
36
|
+
"@ant-design/icons": "^4.8.0",
|
|
37
|
+
"dayjs": "^1.11.7",
|
|
38
|
+
"lodash": "^4.17.21",
|
|
39
|
+
"@hzab/data-model": ">=1.7.4",
|
|
40
|
+
"@hzab/edit-table": ">=0.0.1",
|
|
41
|
+
"@hzab/form-render": ">=1.0.0",
|
|
42
|
+
"@hzab/formily-result-utils": ">=1.2.0",
|
|
43
|
+
"@hzab/schema-descriptions": ">=1.0.0",
|
|
44
|
+
"@hzab/utils": ">=1.0.7"
|
|
45
|
+
},
|
|
46
|
+
"devDependencies": {
|
|
47
|
+
"@ant-design/icons": "^4.8.0",
|
|
48
|
+
"@formily/core": "2.3.1",
|
|
49
|
+
"@formily/json-schema": "^2.3.1",
|
|
50
|
+
"@formily/reactive": "^2.3.1",
|
|
51
|
+
"@formily/react": "2.3.1",
|
|
52
|
+
"@types/lodash": "^4.17.12",
|
|
53
|
+
"@types/react": "^17.0.62",
|
|
54
|
+
"@types/react-dom": "^17.0.20",
|
|
55
|
+
"@vitest/coverage-v8": "4.1.10",
|
|
56
|
+
"antd": "^4.24.12",
|
|
57
|
+
"array-move": "^4.0.0",
|
|
58
|
+
"c-formily-antd": "^2.3.1",
|
|
59
|
+
"happy-dom": "^20.11.1",
|
|
60
|
+
"lodash": "^4.17.21",
|
|
61
|
+
"react": "^17.0.2",
|
|
62
|
+
"react-dom": "^17.0.2",
|
|
63
|
+
"react-sortable-hoc": "^2.0.0",
|
|
64
|
+
"typescript": "^5.9.3",
|
|
65
|
+
"vite": "^8.0.0",
|
|
66
|
+
"vitest": "^4.1.10",
|
|
67
|
+
"@hzab/eslint-config": "^0.0.0",
|
|
68
|
+
"@hzab/typescript-config": "^0.0.0",
|
|
69
|
+
"@hzab/vite-config": "^0.0.3-alpha.0"
|
|
70
|
+
},
|
|
71
|
+
"scripts": {
|
|
72
|
+
"build": "vite build && tsc -p tsconfig.build.json",
|
|
73
|
+
"typecheck": "tsc -p tsconfig.json",
|
|
74
|
+
"test": "vitest run --passWithNoTests",
|
|
75
|
+
"test:watch": "vitest"
|
|
76
|
+
}
|
|
77
|
+
}
|
package/src/FilterTag/index.tsx
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useEffect, useState } from "react";
|
|
2
2
|
import "./index.less";
|
|
3
3
|
import { Tag } from "antd";
|
|
4
|
-
import { getVal } from "@hzab/
|
|
4
|
+
import { getVal } from "@hzab/utils/src/formily/field";
|
|
5
5
|
function hasValue(val) {
|
|
6
6
|
return val !== null && val !== undefined;
|
|
7
7
|
}
|
|
@@ -12,13 +12,12 @@ const FilterTag = (props: any) => {
|
|
|
12
12
|
if (queryRef) {
|
|
13
13
|
const list = [];
|
|
14
14
|
const fieldSchemas = queryRef.current?.formRef?.current?.formRender?.fields;
|
|
15
|
-
for (
|
|
15
|
+
for (const key in schema?.schema?.properties) {
|
|
16
16
|
const field = schema?.schema?.properties[key];
|
|
17
17
|
if (hasValue(searchQuery[key])) {
|
|
18
|
-
|
|
18
|
+
const val = getVal({ ...field, ...fieldSchemas[field?.name] }, searchQuery, {
|
|
19
19
|
fieldSchema: fieldSchemas?.[field?.name],
|
|
20
20
|
});
|
|
21
|
-
|
|
22
21
|
list.push({
|
|
23
22
|
label: field?.title,
|
|
24
23
|
value: val,
|
package/src/FormModal/index.tsx
CHANGED
|
@@ -26,7 +26,7 @@ export interface EditableCellProps extends React.HTMLAttributes<HTMLElement> {
|
|
|
26
26
|
record: Item;
|
|
27
27
|
index: number;
|
|
28
28
|
editable: boolean;
|
|
29
|
-
onEdit: (record: Partial<Item> & { key: React.Key }, dataIndex: string, opt:
|
|
29
|
+
onEdit: (record: Partial<Item> & { key: React.Key }, dataIndex: string, opt: object) => void;
|
|
30
30
|
onSave: (field: { type: string; name: string }) => void;
|
|
31
31
|
onCancel: () => void;
|
|
32
32
|
topProps: {
|
|
@@ -67,7 +67,7 @@ export const EditableCell: React.FC<EditableCellProps> = ({
|
|
|
67
67
|
}
|
|
68
68
|
// 无编辑权限或禁止编辑
|
|
69
69
|
const _hasEdit = hasEdit && typeof hasEdit === "function" ? hasEdit(record, index) : hasEdit !== false;
|
|
70
|
-
|
|
70
|
+
const _editable =
|
|
71
71
|
_hasEdit &&
|
|
72
72
|
editable &&
|
|
73
73
|
!(fPattern === "disabled" || fPattern === "readOnly" || fDisplay === "none") &&
|
|
@@ -150,7 +150,7 @@ export const useEditTable = (props) => {
|
|
|
150
150
|
|
|
151
151
|
// 创建 formily 表单相关参数
|
|
152
152
|
/** schema scope 解决父级无 schema Scope 导致 scope 对象刷新的问题 */
|
|
153
|
-
const schemaScopeRef = useRef<{ _$tempData:
|
|
153
|
+
const schemaScopeRef = useRef<{ _$tempData: object }>();
|
|
154
154
|
if (props.schemaScope && !schemaScopeRef.current) {
|
|
155
155
|
schemaScopeRef.current = props.schemaScope;
|
|
156
156
|
} else if (!schemaScopeRef.current) {
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { memo, useMemo, useCallback } from "react";
|
|
2
2
|
import { createForm } from "@formily/core";
|
|
3
3
|
import { antdComponents, customComponents } from "@hzab/form-render";
|
|
4
|
-
import {
|
|
4
|
+
import type { Schema } from "@formily/react";
|
|
5
|
+
import { createSchemaField, useField, useFieldSchema } from "@formily/react";
|
|
5
6
|
import { Form } from "c-formily-antd";
|
|
6
7
|
import { cloneSchema } from "@hzab/utils/src/formily/cloneSchema";
|
|
7
8
|
|
|
@@ -10,9 +11,9 @@ import { handleReaction } from "../../common/handleReactions";
|
|
|
10
11
|
type formilyFieldPropsT = {
|
|
11
12
|
schema: Schema;
|
|
12
13
|
formilyRef: any;
|
|
13
|
-
schemaScope:
|
|
14
|
-
components:
|
|
15
|
-
reactionOpts?:
|
|
14
|
+
schemaScope: object;
|
|
15
|
+
components: object;
|
|
16
|
+
reactionOpts?: object;
|
|
16
17
|
};
|
|
17
18
|
|
|
18
19
|
// TODO: 借住 formily 核心代码实现相关数据响应
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ReactNode } from "react";
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
2
|
import _ from "lodash";
|
|
3
3
|
|
|
4
4
|
import { getFieldOptItByVal } from "../../common/utils";
|
|
@@ -6,9 +6,9 @@ import { getFieldOptItByVal } from "../../common/utils";
|
|
|
6
6
|
import "./index.less";
|
|
7
7
|
|
|
8
8
|
export interface IPrefixNodeProps {
|
|
9
|
-
showPrefixNode?: boolean |
|
|
9
|
+
showPrefixNode?: boolean | object;
|
|
10
10
|
value: any;
|
|
11
|
-
field?:
|
|
11
|
+
field?: object;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
export interface ITagOption {
|
|
@@ -34,7 +34,7 @@ export const defaultSwitchEnum = [
|
|
|
34
34
|
|
|
35
35
|
export const PrefixNode = (props) => {
|
|
36
36
|
const { value, field } = props;
|
|
37
|
-
|
|
37
|
+
const showVal = Array.isArray(value) ? value : [value];
|
|
38
38
|
|
|
39
39
|
const _field = { enum: defaultSwitchEnum, ...field };
|
|
40
40
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ReactNode } from "react";
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
2
|
import { Tag } from "antd";
|
|
3
3
|
import _ from "lodash";
|
|
4
4
|
|
|
@@ -7,9 +7,9 @@ import { getFieldOptItByVal } from "../../common/utils";
|
|
|
7
7
|
import "./index.less";
|
|
8
8
|
|
|
9
9
|
export interface ITagsProps {
|
|
10
|
-
showTags?: boolean |
|
|
10
|
+
showTags?: boolean | object;
|
|
11
11
|
value: any;
|
|
12
|
-
field?:
|
|
12
|
+
field?: object;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
export interface ITagOption {
|
|
@@ -22,7 +22,7 @@ export interface ITagOption {
|
|
|
22
22
|
|
|
23
23
|
export const Tags = (props) => {
|
|
24
24
|
const { value, field } = props;
|
|
25
|
-
|
|
25
|
+
const showVal = Array.isArray(value) ? value : [value];
|
|
26
26
|
|
|
27
27
|
return showVal?.map((it, i) => {
|
|
28
28
|
const option = getFieldOptItByVal(it, field) || {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/// <reference types="vite/client" />
|