@hzab/list-render 1.9.8 → 1.9.10-beta
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 +7 -0
- package/package.json +4 -1
- package/src/list-render.jsx +2 -2
- package/src/table-render/index.jsx +15 -19
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hzab/list-render",
|
|
3
|
-
"version": "1.9.
|
|
3
|
+
"version": "1.9.10-beta",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "src",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"dev": "webpack serve -c ./config/webpack.config.js --env local",
|
|
8
8
|
"build": "webpack -c ./config/webpack.config.js --env production",
|
|
9
|
+
"publish-beta": "npm publish --beta",
|
|
9
10
|
"publish-patch": "npm version patch && npm publish --access public",
|
|
10
11
|
"publish-minor": "npm version minor && npm publish --access public",
|
|
11
12
|
"publish-major": "npm version major && npm publish --access public"
|
|
@@ -22,6 +23,7 @@
|
|
|
22
23
|
"@ant-design/icons": "^4.8.1",
|
|
23
24
|
"@hzab/data-model": "^1.7.4",
|
|
24
25
|
"@hzab/form-render": "^1.6.12",
|
|
26
|
+
"@hzab/formily-result-utils": "^1.2.0",
|
|
25
27
|
"@hzab/schema-descriptions": "^1.3.0",
|
|
26
28
|
"@hzab/webpack-config": "^0.7.2",
|
|
27
29
|
"@types/react": "^17.0.62",
|
|
@@ -42,6 +44,7 @@
|
|
|
42
44
|
"@formily/reactive-react": "2.3.1",
|
|
43
45
|
"@hzab/data-model": ">=1.7.4",
|
|
44
46
|
"@hzab/form-render": ">=1.0.0",
|
|
47
|
+
"@hzab/formily-result-utils": ">=1.2.0",
|
|
45
48
|
"@hzab/schema-descriptions": ">=1.0.0",
|
|
46
49
|
"antd": "4.x",
|
|
47
50
|
"axios": ">=1.4.0",
|
package/src/list-render.jsx
CHANGED
|
@@ -154,7 +154,7 @@ const ListRender = forwardRef(function (props, parentRef) {
|
|
|
154
154
|
delete mergedQueries.$timerange;
|
|
155
155
|
}
|
|
156
156
|
|
|
157
|
-
model.query = mergedQueries;
|
|
157
|
+
// model.query = mergedQueries;
|
|
158
158
|
|
|
159
159
|
// 取消上一次请求
|
|
160
160
|
getListSourceRef.current?.cancel({ code: 601, message: "取消上一次请求" });
|
|
@@ -210,7 +210,7 @@ const ListRender = forwardRef(function (props, parentRef) {
|
|
|
210
210
|
model.query.pageSize = pageSizeOptions[0];
|
|
211
211
|
}
|
|
212
212
|
formQueryRef.current = query;
|
|
213
|
-
model.query = Object.assign(model.query, query);
|
|
213
|
+
// model.query = Object.assign(model.query, query);
|
|
214
214
|
getList(query);
|
|
215
215
|
}
|
|
216
216
|
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { useEffect, useState, useMemo, useCallback, useRef } from "react";
|
|
2
2
|
import { Table, Button, Popconfirm, Tooltip, Checkbox, Popover } from "antd";
|
|
3
|
-
import { Schema } from "@formily/json-schema";
|
|
4
3
|
import { QuestionCircleOutlined, FilterOutlined, SettingOutlined } from "@ant-design/icons";
|
|
5
4
|
import _ from "lodash";
|
|
6
5
|
|
|
6
|
+
import EnumRender from "@hzab/formily-result-utils/src/components/EnumRender";
|
|
7
|
+
import { SHOW_MODE_TYPES } from "@hzab/formily-result-utils/src/common/constant";
|
|
7
8
|
import { FormilyField } from "../components/Formily/FormilyField";
|
|
8
|
-
import Tags from "../components/Tags";
|
|
9
|
-
import PrefixNode from "../components/PrefixNode";
|
|
10
9
|
// getColRender 使用 observer 包裹一层 column 的 render 函数,解决数据无法响应的问题
|
|
11
10
|
import { getColRender } from "../common/formily-utils";
|
|
12
11
|
import { getVal, getFieldList } from "../common/utils";
|
|
@@ -106,7 +105,7 @@ function TableRender(props) {
|
|
|
106
105
|
};
|
|
107
106
|
} else {
|
|
108
107
|
colRender = function (text, record, index, ...args) {
|
|
109
|
-
const { width, ellipsis, emptyValue, showTags, showPrefixNode } = _colConf || {};
|
|
108
|
+
const { width, ellipsis, emptyValue, showTags, showPrefixNode, showMode, enumRenderProps } = _colConf || {};
|
|
110
109
|
const schemaDefaultValue = fieldSchemas[name]?.componentProps?.emptyValue;
|
|
111
110
|
const defaultValue = emptyValue ?? schemaDefaultValue ?? tableEmptyValue ?? "";
|
|
112
111
|
|
|
@@ -130,25 +129,22 @@ function TableRender(props) {
|
|
|
130
129
|
</Tooltip>
|
|
131
130
|
);
|
|
132
131
|
}
|
|
133
|
-
|
|
134
|
-
if (showTags) {
|
|
135
|
-
// field 通过 fieldSchemas 获取最新的 field 数据
|
|
136
|
-
return (
|
|
137
|
-
<Tags
|
|
138
|
-
value={_.get(record, name)}
|
|
139
|
-
config={typeof showTags === "object" ? showTags : undefined}
|
|
140
|
-
field={{ ...field, ...fieldSchemas?.[name] }}
|
|
141
|
-
/>
|
|
142
|
-
);
|
|
143
|
-
}
|
|
144
|
-
// 使用 前缀节点 渲染内容
|
|
145
|
-
if (showPrefixNode || (showPrefixNode !== false && comName === "Switch")) {
|
|
132
|
+
|
|
133
|
+
if (showMode || showTags || showPrefixNode || (showPrefixNode !== false && comName === "Switch")) {
|
|
146
134
|
// field 通过 fieldSchemas 获取最新的 field 数据
|
|
135
|
+
let _showMode = showMode;
|
|
136
|
+
if (showTags) {
|
|
137
|
+
_showMode = SHOW_MODE_TYPES.tags;
|
|
138
|
+
} else if (showPrefixNode) {
|
|
139
|
+
_showMode = SHOW_MODE_TYPES.prefixNode;
|
|
140
|
+
}
|
|
141
|
+
|
|
147
142
|
return (
|
|
148
|
-
<
|
|
143
|
+
<EnumRender
|
|
144
|
+
showMode={_showMode}
|
|
149
145
|
value={_.get(record, name)}
|
|
150
|
-
config={typeof showPrefixNode === "object" ? showPrefixNode : undefined}
|
|
151
146
|
field={{ ...field, ...fieldSchemas?.[name] }}
|
|
147
|
+
{...enumRenderProps}
|
|
152
148
|
/>
|
|
153
149
|
);
|
|
154
150
|
}
|