@pisell/materials 1.0.270 → 1.0.272

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({
@@ -10,6 +10,7 @@ export interface CustomHeaderCellProps {
10
10
  style?: any;
11
11
  lock?: 0 | 1;
12
12
  editable?: boolean;
13
+ position: 'start' | 'end' | "";
13
14
  }
14
15
  declare const _default: {
15
16
  Row: React.FC<any>;
@@ -1,6 +1,6 @@
1
1
  function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
2
2
  var _excluded = ["index"],
3
- _excluded2 = ["onResize", "width", "field_type", "lock", "editable", "dataIndex"];
3
+ _excluded2 = ["onResize", "width", "field_type", "lock", "editable", "dataIndex", "position"];
4
4
  var _templateObject;
5
5
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
6
6
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
@@ -29,6 +29,7 @@ var CustomHeaderCell = function CustomHeaderCell(props) {
29
29
  lock = props.lock,
30
30
  editable = props.editable,
31
31
  dataIndex = props.dataIndex,
32
+ position = props.position,
32
33
  restProps = _objectWithoutProperties(props, _excluded2);
33
34
  var isCheckbox = !props.record;
34
35
 
@@ -36,6 +37,11 @@ var CustomHeaderCell = function CustomHeaderCell(props) {
36
37
  if (isCheckbox) {
37
38
  restProps.style = _objectSpread({}, restProps.style);
38
39
  }
40
+
41
+ // 最后一列不增加拖拽功能
42
+ if (position === 'end') {
43
+ return /*#__PURE__*/React.createElement("td", restProps, /*#__PURE__*/React.createElement(CellProvider, props));
44
+ }
39
45
  return /*#__PURE__*/React.createElement(ResizeCellStyle, {
40
46
  width: width || 200,
41
47
  height: 0,
@@ -175,7 +175,8 @@ var useTransColumns = function useTransColumns(params) {
175
175
  return _objectSpread(_objectSpread({
176
176
  record: record
177
177
  }, item), {}, {
178
- onResize: handleResize === null || handleResize === void 0 ? void 0 : handleResize(index)
178
+ onResize: handleResize === null || handleResize === void 0 ? void 0 : handleResize(index),
179
+ position: position
179
180
  });
180
181
  }
181
182
  });
@@ -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({
@@ -10,6 +10,7 @@ export interface CustomHeaderCellProps {
10
10
  style?: any;
11
11
  lock?: 0 | 1;
12
12
  editable?: boolean;
13
+ position: 'start' | 'end' | "";
13
14
  }
14
15
  declare const _default: {
15
16
  Row: React.FC<any>;
@@ -80,6 +80,7 @@ var CustomHeaderCell = (props) => {
80
80
  lock,
81
81
  editable,
82
82
  dataIndex,
83
+ position,
83
84
  ...restProps
84
85
  } = props;
85
86
  const isCheckbox = !props.record;
@@ -89,6 +90,9 @@ var CustomHeaderCell = (props) => {
89
90
  // paddingInlineStart: 8,
90
91
  };
91
92
  }
93
+ if (position === "end") {
94
+ return /* @__PURE__ */ import_react.default.createElement("td", { ...restProps }, /* @__PURE__ */ import_react.default.createElement(import_CellProvider.default, { ...props }));
95
+ }
92
96
  return /* @__PURE__ */ import_react.default.createElement(
93
97
  ResizeCellStyle,
94
98
  {
@@ -186,7 +186,8 @@ var useTransColumns = (params) => {
186
186
  onHeaderCell: (record) => ({
187
187
  record,
188
188
  ...item,
189
- onResize: handleResize == null ? void 0 : handleResize(index)
189
+ onResize: handleResize == null ? void 0 : handleResize(index),
190
+ position
190
191
  })
191
192
  };
192
193
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pisell/materials",
3
- "version": "1.0.270",
3
+ "version": "1.0.272",
4
4
  "main": "./lib/index.js",
5
5
  "module": "./es/index.js",
6
6
  "types": "./lib/index.d.ts",
@@ -62,9 +62,9 @@
62
62
  "react-window": "^1.8.10",
63
63
  "react-virtualized-auto-sizer": "^1.0.20",
64
64
  "crypto-js": "^4.2.0",
65
- "@pisell/utils": "1.0.25",
65
+ "@pisell/date-picker": "1.0.72",
66
66
  "@pisell/icon": "0.0.8",
67
- "@pisell/date-picker": "1.0.72"
67
+ "@pisell/utils": "1.0.25"
68
68
  },
69
69
  "peerDependencies": {
70
70
  "react": "^18.0.0",