@hzab/list-render 1.12.3-alpha.0 → 1.12.3

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  # @hzab/list-render@1.12.3
2
2
 
3
- feat: 新增 filterTag 配置
3
+ fix: 操作栏整体div增加样式className
4
4
 
5
5
  # @hzab/list-render@1.12.2
6
6
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hzab/list-render",
3
- "version": "1.12.3-alpha.0",
3
+ "version": "1.12.3",
4
4
  "description": "",
5
5
  "main": "src",
6
6
  "scripts": {
@@ -44,7 +44,9 @@
44
44
  "react": "^17.0.2",
45
45
  "react-dom": "^17.0.2",
46
46
  "react-router-dom": "^6.8.1",
47
- "typescript": "^4.9.4"
47
+ "typescript": "^4.9.4",
48
+ "@hzab/edit-table": "^0.0.1",
49
+ "@silevis/reactgrid": "^4.1.17"
48
50
  },
49
51
  "peerDependencies": {
50
52
  "@formily/core": "2.3.1",
@@ -60,8 +62,7 @@
60
62
  "c-formily-antd": "2.3.1",
61
63
  "lodash": ">=4.17.21",
62
64
  "react": ">=16.8.0",
63
- "react-dom": ">=16.8.0",
64
- "@hzab/edit-table": "^0.0.1"
65
+ "react-dom": ">=16.8.0"
65
66
  },
66
67
  "directories": {
67
68
  "lib": "lib"
@@ -13,7 +13,7 @@ import TableRender from "./table-render";
13
13
  import CardRender from "./card-render";
14
14
  import FormModal from "./FormModal";
15
15
  import DetailModal from "./DetailModal";
16
- import FilterTag from "./FilterTag"
16
+
17
17
  import { objToFormData } from "./common/utils";
18
18
  import {
19
19
  setURLObjectQueryParam,
@@ -60,7 +60,6 @@ const ListRender = forwardRef(function (props, parentRef) {
60
60
  * 自定义设置url query对象参数的key
61
61
  * */
62
62
  appendUrlQueryKey = URL_PARAM_NAME,
63
- hasFilterTag = false
64
63
  } = props;
65
64
  const { isAllSelect = false, isAllSelectKey = "isAllSelect" } = props.paginationConf || {};
66
65
 
@@ -84,7 +83,6 @@ const ListRender = forwardRef(function (props, parentRef) {
84
83
  const getListSourceRef = useRef();
85
84
  const [showSearch, setShowSearch] = useState(true);
86
85
  const tableRef = useRef({});
87
- const [searchQuery, setSearchQuery] = useState({})
88
86
 
89
87
  useImperativeHandle(parentRef, () => ({
90
88
  getList,
@@ -97,7 +95,6 @@ const ListRender = forwardRef(function (props, parentRef) {
97
95
  onCreate,
98
96
  onEdit,
99
97
  onDel,
100
- tableRef
101
98
  }));
102
99
 
103
100
  const { schema = {}, config = {}, model = {}, msgConf = {}, filters } = props;
@@ -266,7 +263,6 @@ const ListRender = forwardRef(function (props, parentRef) {
266
263
  * @returns
267
264
  */
268
265
  function onQueryFormSubmit(query, isReset) {
269
- setSearchQuery(query)
270
266
  // 是否开启 url query
271
267
  if (appendUrlQuery) {
272
268
  if (isReset) {
@@ -496,13 +492,6 @@ const ListRender = forwardRef(function (props, parentRef) {
496
492
  )}
497
493
  </div>
498
494
  </div>
499
- {
500
- hasFilterTag && <FilterTag
501
- searchQuery={searchQuery}
502
- schema={schema}
503
- queryRef={queryRef}
504
- ></FilterTag>
505
- }
506
495
  {Slots.HeaderOthersSuffix && <Slots.HeaderOthersSuffix onSearch={onSearch} getList={getList} />}
507
496
  {layout === "card" ? (
508
497
  <CardRender
@@ -10,7 +10,6 @@ import { createForm, onFormValuesChange, onFieldValueChange } from "@formily/cor
10
10
 
11
11
  import EnumRender from "@hzab/formily-result-utils/src/components/EnumRender";
12
12
  import { SHOW_MODE_TYPES } from "@hzab/formily-result-utils/src/common/constant";
13
- import CellEditTable from "@hzab/edit-table"
14
13
  import { FormilyField } from "../components/Formily/FormilyField";
15
14
  // getColRender 使用 observer 包裹一层 column 的 render 函数,解决数据无法响应的问题
16
15
  import { getColRender } from "../common/formily-utils";
@@ -18,6 +17,7 @@ import { getVal, getFieldList } from "../common/utils";
18
17
  import { handleReactions } from "../common/handleReactions";
19
18
 
20
19
  import { useEditTable, EditableCell } from "../components/Formily/FormilyEditTable";
20
+ import CellEditTable from "@hzab/edit-table"
21
21
  import "./index.less";
22
22
 
23
23
  const scenario = "table-render";
@@ -38,10 +38,8 @@ const TableRender = forwardRef(function (props, tableRef) {
38
38
  } = config || {};
39
39
  const { editMode = "modal" } = topProps || {};
40
40
  const isEditTable = editMode !== "modal";
41
- const cellEditTableRef = useRef()
42
41
  useImperativeHandle(tableRef, () => ({
43
42
  onEditByTable,
44
- cellEditTableRef
45
43
  }));
46
44
 
47
45
  const [columns, setColumns] = useState([]);
@@ -194,13 +192,11 @@ const TableRender = forwardRef(function (props, tableRef) {
194
192
  </span>
195
193
  );
196
194
  }
197
-
198
195
  const childSelectList = fieldSchemas?.[field?.name]?.dataSource?.map((el) => ({
199
196
  ...el,
200
197
  label: el?.[field?.["x-component-props"]?.["fieldNames"]?.["label"]] || el?.label,
201
198
  value: el?.[field?.["x-component-props"]?.["fieldNames"]?.["value"]] || el?.value,
202
199
  }))
203
-
204
200
  return {
205
201
  getField: () => field,
206
202
  editable: true,
@@ -218,7 +214,6 @@ const TableRender = forwardRef(function (props, tableRef) {
218
214
  cellProps: field.cellProps,
219
215
  children: handleChildColumns(field?.children),
220
216
  render: getColRender(colRender),
221
- required: field?.required
222
217
  }
223
218
 
224
219
  })?.filter((el) => (el))
@@ -294,7 +289,7 @@ const TableRender = forwardRef(function (props, tableRef) {
294
289
  hasDelTips && typeof hasDelTips === "function" ? hasDelTips(record, index) : hasDelTips || tableDelTip;
295
290
 
296
291
  return (
297
- <div style={{ width: _colConf?.width, maxWidth: "100%" }}>
292
+ <div style={{ width: _colConf?.width, maxWidth: "100%" }} className="table-render-action">
298
293
  {Slots?.actionPrefixSlot && <Slots.actionPrefixSlot {...slotProps} />}
299
294
  {_hasDetail ? (
300
295
  <Button
@@ -445,7 +440,6 @@ const TableRender = forwardRef(function (props, tableRef) {
445
440
  ) : null}
446
441
  {
447
442
  isCellEditTable ? <CellEditTable
448
- ref={cellEditTableRef}
449
443
  {...tableProps}
450
444
  {...cellEditTableProps}
451
445
  {...props}
@@ -1,15 +0,0 @@
1
- .has-filter {
2
- margin-bottom: 16px;
3
-
4
- .has-filter-tag {
5
- background: rgba(64, 62, 245, 0.2);
6
- border-radius: 4px 4px 4px 4px;
7
- color: #403EF5;
8
- margin-bottom: 8px;
9
-
10
- .anticon-close {
11
- color: #403EF5;
12
-
13
- }
14
- }
15
- }
@@ -1,58 +0,0 @@
1
- import { useEffect, useState } from "react";
2
- import "./index.less";
3
- import { Tag } from "antd";
4
- import { getVal } from "@hzab/list-render/src/common/utils";
5
- function hasValue(val) {
6
- return val !== null && val !== undefined;
7
- }
8
- const FilterTag = (props: any) => {
9
- const { searchQuery, schema, queryRef } = props;
10
- const [worldList, setWorldList] = useState<any>([]);
11
- useEffect(() => {
12
- if (queryRef) {
13
- const list = [];
14
- const fieldSchemas = queryRef.current?.formRef?.current?.formRender?.fields;
15
- for (let key in schema?.schema?.properties) {
16
- const field = schema?.schema?.properties[key];
17
- if (hasValue(searchQuery[key])) {
18
- let val = getVal({ ...field, ...fieldSchemas[field?.name] }, searchQuery, {
19
- fieldSchema: fieldSchemas?.[field?.name],
20
- });
21
- list.push({
22
- label: field?.title,
23
- value: val,
24
- filed: key,
25
- filedValue: searchQuery[key],
26
- });
27
- }
28
- }
29
- setWorldList(list);
30
- }
31
- }, [searchQuery, schema, queryRef]);
32
- const onClose = (e, item) => {
33
- e.preventDefault();
34
- queryRef.current?.formRef?.current?.formRender.setValues({
35
- [item?.filed]: null,
36
- });
37
- setWorldList((pre) => pre?.filter((el) => el?.filed != item?.filed));
38
- };
39
-
40
- return (
41
- <div className="has-filter">
42
- {worldList?.map((item) => {
43
- return (
44
- <Tag
45
- className="has-filter-tag"
46
- closable
47
- onClose={(e) => {
48
- onClose(e, item);
49
- }}
50
- >
51
- {item?.label}:{item?.value}
52
- </Tag>
53
- );
54
- })}
55
- </div>
56
- );
57
- };
58
- export default FilterTag;