@pisell/materials 1.0.269 → 1.0.271

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.
@@ -18,6 +18,7 @@ import { Table, Form } from "antd";
18
18
  import React, { useState, useMemo, useCallback } from "react";
19
19
  import { FormPagination } from "../../Pagination";
20
20
  import { calcFilterSort } from "../Table/utils";
21
+ import { isArr } from "@pisell/utils";
21
22
  var BasicTable = function BasicTable(props) {
22
23
  var _pagination$pageSizeO;
23
24
  var dataSource = props.dataSource,
@@ -38,6 +39,13 @@ var BasicTable = function BasicTable(props) {
38
39
  page: 1,
39
40
  size: 10
40
41
  };
42
+ var group = Form.useWatch("group_by", {
43
+ form: form,
44
+ preserve: true
45
+ });
46
+ var isGroup = useMemo(function () {
47
+ return isArr(group) && group.length > 0;
48
+ }, [group]);
41
49
  var showTotal = pagination.showTotal,
42
50
  localPagination = pagination.localPagination;
43
51
  var _showTotal = useCallback(function (total, range) {
@@ -92,6 +100,8 @@ var BasicTable = function BasicTable(props) {
92
100
  return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Table, _extends({
93
101
  key: defaultExpandedRowKeys.join("-")
94
102
  }, other, {
103
+ // 开启分组条件后关闭行选择功能
104
+ rowSelection: isGroup ? false : other === null || other === void 0 ? void 0 : other.rowSelection,
95
105
  virtual: virtual,
96
106
  onChange: function onChange(pagination, filters, sorter) {
97
107
  form.setFieldsValue({
@@ -76,7 +76,8 @@ var GridViewTable = function GridViewTable(_ref) {
76
76
  localPagination: !!(tableProps !== null && tableProps !== void 0 && (_tableProps$paginatio = tableProps.pagination) !== null && _tableProps$paginatio !== void 0 && _tableProps$paginatio.localPagination),
77
77
  handleResize: handleResize,
78
78
  handleSave: handleSave,
79
- dragSort: tableProps === null || tableProps === void 0 ? void 0 : tableProps.dragSort
79
+ dragSort: tableProps === null || tableProps === void 0 ? void 0 : tableProps.dragSort,
80
+ bordered: tableProps.bordered
80
81
  }),
81
82
  columns = _useTransColumns.columns;
82
83
  var dataSource = useTransDataSource({
@@ -6,6 +6,7 @@ declare type UseTransColumnsProps = {
6
6
  handleSave?: (row: Record<string, any>) => void;
7
7
  handleResize?: (index: number) => (e: any, p2: any) => void;
8
8
  dragSort: boolean;
9
+ bordered: boolean;
9
10
  };
10
11
  declare const useTransColumns: (params: UseTransColumnsProps) => {
11
12
  columns: any[];
@@ -13,26 +13,29 @@ import getColumnSelectProps from "../TableFilter/selectFilter";
13
13
  import SortIcon from "../TableFilter/SortIcon";
14
14
  import { getValueByKeys } from "../Table/fields/utils";
15
15
  import { getText } from "../../../locales";
16
- var genOnCell = function genOnCell(position) {
16
+ var genOnCell = function genOnCell(_ref) {
17
+ var bordered = _ref.bordered,
18
+ position = _ref.position;
17
19
  return function (_) {
18
20
  var styleObj = {};
19
21
  var notGroupStyle = {};
22
+ var borderStr = bordered ? "1px solid #EAECF0" : "";
20
23
  if (position === "start") {
21
24
  styleObj = {
22
- borderLeft: "1px solid #EAECF0",
25
+ borderLeft: borderStr,
23
26
  borderRadius: "8px 0px 0px 0px",
24
27
  padding: "12px"
25
28
  };
26
29
  notGroupStyle = {
27
- borderLeft: "1px solid #EAECF0"
30
+ borderLeft: borderStr
28
31
  };
29
32
  } else if (position === "end") {
30
33
  styleObj = {
31
- borderRight: "1px solid #EAECF0",
34
+ borderRight: borderStr,
32
35
  borderRadius: "0px 8px 0px 0px"
33
36
  };
34
37
  notGroupStyle = {
35
- borderRight: "1px solid #EAECF0"
38
+ borderRight: borderStr
36
39
  };
37
40
  }
38
41
  return {
@@ -48,7 +51,8 @@ var useTransColumns = function useTransColumns(params) {
48
51
  form = params.form,
49
52
  handleSave = params.handleSave,
50
53
  handleResize = params.handleResize,
51
- dragSort = params.dragSort;
54
+ dragSort = params.dragSort,
55
+ bordered = params.bordered;
52
56
  var group = Form.useWatch("group_by", {
53
57
  form: form,
54
58
  preserve: true
@@ -60,9 +64,9 @@ var useTransColumns = function useTransColumns(params) {
60
64
  var fieldCol = columns.find(function (item) {
61
65
  return "".concat(item.dataIndex) === groupField;
62
66
  });
63
- var _ref = fieldCol || {},
64
- render = _ref.render,
65
- dataIndex = _ref.dataIndex;
67
+ var _ref2 = fieldCol || {},
68
+ render = _ref2.render,
69
+ dataIndex = _ref2.dataIndex;
66
70
  var dom = /*#__PURE__*/React.createElement("div", null, getValueByKeys(children === null || children === void 0 ? void 0 : children[0], dataIndex || groupField.split(",")));
67
71
  if (render) {
68
72
  dom = render(getValueByKeys(children === null || children === void 0 ? void 0 : children[0], dataIndex), record.children[0]);
@@ -160,7 +164,10 @@ var useTransColumns = function useTransColumns(params) {
160
164
  onCell: function onCell(record) {
161
165
  return _objectSpread(_objectSpread(_objectSpread({
162
166
  record: record
163
- }, item), genOnCell(position)(record)), {}, {
167
+ }, item), genOnCell({
168
+ position: position,
169
+ bordered: bordered
170
+ })(record)), {}, {
164
171
  handleSave: handleSave
165
172
  });
166
173
  },
@@ -173,7 +180,7 @@ var useTransColumns = function useTransColumns(params) {
173
180
  }
174
181
  });
175
182
  });
176
- }, [columns, groupFieldRender, dragSort, groupField]);
183
+ }, [columns, groupFieldRender, dragSort, groupField, bordered]);
177
184
  return {
178
185
  columns: _columns
179
186
  };
@@ -69,10 +69,10 @@
69
69
  .pisell-lowcode-table-wrapper .pisell-lowcode-table.pisell-lowcode-table-bordered >.pisell-lowcode-table-container {
70
70
  border-left: none;
71
71
  }
72
- .pisell-lowcode-table-wrapper .pisell-lowcode-table-thead tr td:first-child {
72
+ .pisell-lowcode-table-wrapper .pisell-lowcode-table-bordered .pisell-lowcode-table-thead tr td:first-child {
73
73
  border-left: 1px solid #EAECF0;
74
74
  }
75
- .pisell-lowcode-table-wrapper .pisell-lowcode-table-thead tr th:first-child {
75
+ .pisell-lowcode-table-wrapper .pisell-lowcode-table-bordered .pisell-lowcode-table-thead tr th:first-child {
76
76
  border-left: 1px solid #EAECF0;
77
77
  }
78
78
  div.pisell-lowcode-table-selection-column {
@@ -80,6 +80,9 @@
80
80
  align-items: center;
81
81
  justify-content: center;
82
82
  }
83
+ .pisell-lowcode-table-bordered .pisell-lowcode-table-tbody .pisell-lowcode-table-selection-column {
84
+ border-left: 1px solid #EAECF0;
85
+ }
83
86
  .drag-sort-cell {
84
87
  .editable-cell-value-wrap {
85
88
  display: flex;
@@ -36,6 +36,7 @@ var import_antd = require("antd");
36
36
  var import_react = __toESM(require("react"));
37
37
  var import_Pagination = require("../../Pagination");
38
38
  var import_utils = require("../Table/utils");
39
+ var import_utils2 = require("@pisell/utils");
39
40
  var BasicTable = (props) => {
40
41
  var _a;
41
42
  const { dataSource, pagination, value, virtual, ...other } = props;
@@ -46,6 +47,8 @@ var BasicTable = (props) => {
46
47
  page: 1,
47
48
  size: 10
48
49
  };
50
+ const group = import_antd.Form.useWatch("group_by", { form, preserve: true });
51
+ const isGroup = (0, import_react.useMemo)(() => (0, import_utils2.isArr)(group) && group.length > 0, [group]);
49
52
  const { showTotal, localPagination } = pagination;
50
53
  const _showTotal = (0, import_react.useCallback)(
51
54
  (total2, range) => {
@@ -105,6 +108,7 @@ var BasicTable = (props) => {
105
108
  {
106
109
  key: defaultExpandedRowKeys.join("-"),
107
110
  ...other,
111
+ rowSelection: isGroup ? false : other == null ? void 0 : other.rowSelection,
108
112
  virtual,
109
113
  onChange: (pagination2, filters, sorter) => {
110
114
  form.setFieldsValue({
@@ -83,7 +83,8 @@ var GridViewTable = ({ tableProps, filter, setTableSetting, onDataSourceChange }
83
83
  localPagination: !!((_a = tableProps == null ? void 0 : tableProps.pagination) == null ? void 0 : _a.localPagination),
84
84
  handleResize,
85
85
  handleSave,
86
- dragSort: tableProps == null ? void 0 : tableProps.dragSort
86
+ dragSort: tableProps == null ? void 0 : tableProps.dragSort,
87
+ bordered: tableProps.bordered
87
88
  });
88
89
  const dataSource = (0, import_useTransDataSource.default)({
89
90
  dataSource: originDataSource,
@@ -6,6 +6,7 @@ declare type UseTransColumnsProps = {
6
6
  handleSave?: (row: Record<string, any>) => void;
7
7
  handleResize?: (index: number) => (e: any, p2: any) => void;
8
8
  dragSort: boolean;
9
+ bordered: boolean;
9
10
  };
10
11
  declare const useTransColumns: (params: UseTransColumnsProps) => {
11
12
  columns: any[];
@@ -41,25 +41,26 @@ var import_selectFilter = __toESM(require("../TableFilter/selectFilter"));
41
41
  var import_SortIcon = __toESM(require("../TableFilter/SortIcon"));
42
42
  var import_utils2 = require("../Table/fields/utils");
43
43
  var import_locales = require("../../../locales");
44
- var genOnCell = (position) => (_) => {
44
+ var genOnCell = ({ bordered, position }) => (_) => {
45
45
  let styleObj = {};
46
46
  let notGroupStyle = {};
47
+ const borderStr = bordered ? "1px solid #EAECF0" : "";
47
48
  if (position === "start") {
48
49
  styleObj = {
49
- borderLeft: "1px solid #EAECF0",
50
+ borderLeft: borderStr,
50
51
  borderRadius: "8px 0px 0px 0px",
51
52
  padding: "12px"
52
53
  };
53
54
  notGroupStyle = {
54
- borderLeft: "1px solid #EAECF0"
55
+ borderLeft: borderStr
55
56
  };
56
57
  } else if (position === "end") {
57
58
  styleObj = {
58
- borderRight: "1px solid #EAECF0",
59
+ borderRight: borderStr,
59
60
  borderRadius: "0px 8px 0px 0px"
60
61
  };
61
62
  notGroupStyle = {
62
- borderRight: "1px solid #EAECF0"
63
+ borderRight: borderStr
63
64
  };
64
65
  }
65
66
  return {
@@ -73,7 +74,7 @@ var genOnCell = (position) => (_) => {
73
74
  };
74
75
  var useTransColumns = (params) => {
75
76
  var _a;
76
- const { columns, form, handleSave, handleResize, dragSort } = params;
77
+ const { columns, form, handleSave, handleResize, dragSort, bordered } = params;
77
78
  const group = import_antd.Form.useWatch("group_by", { form, preserve: true });
78
79
  const groupField = (_a = group == null ? void 0 : group[0]) == null ? void 0 : _a.field;
79
80
  const groupFieldRender = (0, import_react.useCallback)(
@@ -179,7 +180,7 @@ var useTransColumns = (params) => {
179
180
  onCell: (record) => ({
180
181
  record,
181
182
  ...item,
182
- ...genOnCell(position)(record),
183
+ ...genOnCell({ position, bordered })(record),
183
184
  handleSave
184
185
  }),
185
186
  onHeaderCell: (record) => ({
@@ -189,7 +190,7 @@ var useTransColumns = (params) => {
189
190
  })
190
191
  };
191
192
  });
192
- }, [columns, groupFieldRender, dragSort, groupField]);
193
+ }, [columns, groupFieldRender, dragSort, groupField, bordered]);
193
194
  return {
194
195
  columns: _columns
195
196
  };
@@ -69,10 +69,10 @@
69
69
  .pisell-lowcode-table-wrapper .pisell-lowcode-table.pisell-lowcode-table-bordered >.pisell-lowcode-table-container {
70
70
  border-left: none;
71
71
  }
72
- .pisell-lowcode-table-wrapper .pisell-lowcode-table-thead tr td:first-child {
72
+ .pisell-lowcode-table-wrapper .pisell-lowcode-table-bordered .pisell-lowcode-table-thead tr td:first-child {
73
73
  border-left: 1px solid #EAECF0;
74
74
  }
75
- .pisell-lowcode-table-wrapper .pisell-lowcode-table-thead tr th:first-child {
75
+ .pisell-lowcode-table-wrapper .pisell-lowcode-table-bordered .pisell-lowcode-table-thead tr th:first-child {
76
76
  border-left: 1px solid #EAECF0;
77
77
  }
78
78
  div.pisell-lowcode-table-selection-column {
@@ -80,6 +80,9 @@
80
80
  align-items: center;
81
81
  justify-content: center;
82
82
  }
83
+ .pisell-lowcode-table-bordered .pisell-lowcode-table-tbody .pisell-lowcode-table-selection-column {
84
+ border-left: 1px solid #EAECF0;
85
+ }
83
86
  .drag-sort-cell {
84
87
  .editable-cell-value-wrap {
85
88
  display: flex;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pisell/materials",
3
- "version": "1.0.269",
3
+ "version": "1.0.271",
4
4
  "main": "./lib/index.js",
5
5
  "module": "./es/index.js",
6
6
  "types": "./lib/index.d.ts",