@hw-component/table 0.0.7-beta-v9 → 0.0.7-beta-v12

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.
@@ -40,8 +40,7 @@ var Body = (function (_ref) {
40
40
  _ref$pagination = _ref.pagination,
41
41
  pagination = _ref$pagination === void 0 ? {} : _ref$pagination,
42
42
  onPageChange = _ref.onPageChange,
43
- _ref$rowSelection = _ref.rowSelection,
44
- rowSelection = _ref$rowSelection === void 0 ? {} : _ref$rowSelection,
43
+ rowSelection = _ref.rowSelection,
45
44
  _ref$rowKey = _ref.rowKey,
46
45
  rowKey = _ref$rowKey === void 0 ? "id" : _ref$rowKey,
47
46
  emptyRender = _ref.emptyRender,
@@ -57,7 +56,8 @@ var Body = (function (_ref) {
57
56
  goTop = _ref$goTop === void 0 ? true : _ref$goTop,
58
57
  size = _ref.size,
59
58
  props = _objectWithoutProperties(_ref, _excluded);
60
- var selectedRowKeys = rowSelection.selectedRowKeys;
59
+ var _ref2 = rowSelection || {},
60
+ selectedRowKeys = _ref2.selectedRowKeys;
61
61
  var _useHTableContext = useHTableContext(),
62
62
  tableInstance = _useHTableContext.tableInstance,
63
63
  contextConfigData = _useHTableContext.configData,
@@ -79,11 +79,12 @@ var Body = (function (_ref) {
79
79
  cuSize = _useSize.cuSize,
80
80
  setCuSize = _useSize.setCuSize;
81
81
  var bodyConfigData = configData || contextConfigData;
82
- var _ref2 = data || {},
83
- records = _ref2.records;
82
+ var _ref3 = data || {},
83
+ records = _ref3.records;
84
84
  var _useCols = useCols({
85
85
  configData: bodyConfigData,
86
- table: tableInstance
86
+ table: tableInstance,
87
+ rowSelection: rowSelection
87
88
  }),
88
89
  cols = _useCols.cols,
89
90
  changeCols = _useCols.changeCols;
@@ -55,7 +55,7 @@ var useCurrentTable = function useCurrentTable(_ref2) {
55
55
  return dialogTableInstance;
56
56
  };
57
57
  var useVisible = function useVisible(visible) {
58
- var _useState3 = useState(visible),
58
+ var _useState3 = useState(false),
59
59
  _useState4 = _slicedToArray(_useState3, 2),
60
60
  modalVisible = _useState4[0],
61
61
  setModalVisible = _useState4[1];
@@ -44,14 +44,16 @@ var index = (function (_ref) {
44
44
  setModalTableParams(function (oldParams) {
45
45
  var configData = oldParams.configData,
46
46
  request = oldParams.request,
47
- title = oldParams.title;
47
+ title = oldParams.title,
48
+ oldP = oldParams.params;
48
49
  var _showParams$title = showParams.title,
49
50
  showTitle = _showParams$title === void 0 ? title : _showParams$title,
50
51
  _showParams$configDat = showParams.configData,
51
52
  showConfigData = _showParams$configDat === void 0 ? configData : _showParams$configDat,
52
- showReq = showParams.request,
53
+ _showParams$request = showParams.request,
54
+ showReq = _showParams$request === void 0 ? request : _showParams$request,
53
55
  _showParams$params = showParams.params,
54
- params = _showParams$params === void 0 ? request : _showParams$params;
56
+ params = _showParams$params === void 0 ? oldP : _showParams$params;
55
57
  return {
56
58
  title: showTitle,
57
59
  request: showReq,
@@ -43,8 +43,7 @@ var Body = (function (_ref) {
43
43
  _ref$pagination = _ref.pagination,
44
44
  pagination = _ref$pagination === void 0 ? {} : _ref$pagination,
45
45
  onPageChange = _ref.onPageChange,
46
- _ref$rowSelection = _ref.rowSelection,
47
- rowSelection = _ref$rowSelection === void 0 ? {} : _ref$rowSelection,
46
+ rowSelection = _ref.rowSelection,
48
47
  _ref$rowKey = _ref.rowKey,
49
48
  rowKey = _ref$rowKey === void 0 ? "id" : _ref$rowKey,
50
49
  emptyRender = _ref.emptyRender,
@@ -60,7 +59,8 @@ var Body = (function (_ref) {
60
59
  goTop = _ref$goTop === void 0 ? true : _ref$goTop,
61
60
  size = _ref.size,
62
61
  props = _objectWithoutProperties(_ref, _excluded);
63
- var selectedRowKeys = rowSelection.selectedRowKeys;
62
+ var _ref2 = rowSelection || {},
63
+ selectedRowKeys = _ref2.selectedRowKeys;
64
64
  var _useHTableContext = context.useHTableContext(),
65
65
  tableInstance = _useHTableContext.tableInstance,
66
66
  contextConfigData = _useHTableContext.configData,
@@ -82,11 +82,12 @@ var Body = (function (_ref) {
82
82
  cuSize = _useSize.cuSize,
83
83
  setCuSize = _useSize.setCuSize;
84
84
  var bodyConfigData = configData || contextConfigData;
85
- var _ref2 = data || {},
86
- records = _ref2.records;
85
+ var _ref3 = data || {},
86
+ records = _ref3.records;
87
87
  var _useCols = hooks.useCols({
88
88
  configData: bodyConfigData,
89
- table: tableInstance
89
+ table: tableInstance,
90
+ rowSelection: rowSelection
90
91
  }),
91
92
  cols = _useCols.cols,
92
93
  changeCols = _useCols.changeCols;
@@ -56,7 +56,7 @@ var useCurrentTable = function useCurrentTable(_ref2) {
56
56
  return dialogTableInstance;
57
57
  };
58
58
  var useVisible = function useVisible(visible) {
59
- var _useState3 = React.useState(visible),
59
+ var _useState3 = React.useState(false),
60
60
  _useState4 = _slicedToArray(_useState3, 2),
61
61
  modalVisible = _useState4[0],
62
62
  setModalVisible = _useState4[1];
@@ -47,14 +47,16 @@ var index = (function (_ref) {
47
47
  setModalTableParams(function (oldParams) {
48
48
  var configData = oldParams.configData,
49
49
  request = oldParams.request,
50
- title = oldParams.title;
50
+ title = oldParams.title,
51
+ oldP = oldParams.params;
51
52
  var _showParams$title = showParams.title,
52
53
  showTitle = _showParams$title === void 0 ? title : _showParams$title,
53
54
  _showParams$configDat = showParams.configData,
54
55
  showConfigData = _showParams$configDat === void 0 ? configData : _showParams$configDat,
55
- showReq = showParams.request,
56
+ _showParams$request = showParams.request,
57
+ showReq = _showParams$request === void 0 ? request : _showParams$request,
56
58
  _showParams$params = showParams.params,
57
- params = _showParams$params === void 0 ? request : _showParams$params;
59
+ params = _showParams$params === void 0 ? oldP : _showParams$params;
58
60
  return {
59
61
  title: showTitle,
60
62
  request: showReq,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hw-component/table",
3
- "version": "0.0.7-beta-v9",
3
+ "version": "0.0.7-beta-v12",
4
4
  "description": "基于antd二次开发table组件",
5
5
  "keywords": [
6
6
  "table"
@@ -11,7 +11,7 @@ import { ColsSettingContent } from "./Content";
11
11
  import { Title } from "./Title";
12
12
  import type { IProps } from "./modal";
13
13
  import { useHTableContext } from "../../context";
14
- import {defaultKeys} from "@/components/HTableBody/Options/utils";
14
+ import {defaultKeys} from "./utils";
15
15
  export default ({
16
16
  reload,
17
17
  size = "middle",
@@ -42,7 +42,7 @@ export default ({
42
42
  configData,
43
43
  pagination = {},
44
44
  onPageChange,
45
- rowSelection = {},
45
+ rowSelection,
46
46
  rowKey = "id",
47
47
  emptyRender,
48
48
  errorRender,
@@ -57,7 +57,7 @@ export default ({
57
57
  ...props
58
58
  }: HTableBodyProps) => {
59
59
  // @ts-ignore
60
- const { selectedRowKeys } = rowSelection;
60
+ const { selectedRowKeys } = rowSelection||{};
61
61
  const {
62
62
  tableInstance,
63
63
  configData: contextConfigData,
@@ -78,6 +78,7 @@ export default ({
78
78
  const { cols, changeCols } = useCols({
79
79
  configData: bodyConfigData,
80
80
  table: tableInstance,
81
+ rowSelection
81
82
  });
82
83
  useSynchronousKeys({ selectedRowKeys, records, rowKey });
83
84
 
@@ -48,7 +48,7 @@ export const useCurrentTable = ({ show, hide, dialogTable }: ParamsModal) => {
48
48
  };
49
49
 
50
50
  export const useVisible = (visible: boolean) => {
51
- const [modalVisible, setModalVisible] = useState(visible);
51
+ const [modalVisible, setModalVisible] = useState(false);
52
52
  useEffect(() => {
53
53
  setModalVisible(visible);
54
54
  }, [visible]);
@@ -1,6 +1,6 @@
1
1
  import { Modal } from "antd";
2
2
  import Table from "../Table";
3
- import type { ModalTableProps } from "../modal";
3
+ import type {ModalTableProps, ParamsModal} from "../modal";
4
4
  import { useCurrentTable, useTableProps, useVisible } from "./hooks";
5
5
  export default ({
6
6
  configData: configDataProps,
@@ -23,12 +23,12 @@ export default ({
23
23
  show: (showParams) => {
24
24
  if (showParams) {
25
25
  setModalTableParams((oldParams) => {
26
- const { configData, request, title } = oldParams;
26
+ const { configData, request, title,params:oldP } = oldParams;
27
27
  const {
28
28
  title: showTitle = title,
29
29
  configData: showConfigData = configData,
30
- request: showReq,
31
- params = request,
30
+ request: showReq=request,
31
+ params=oldP ,
32
32
  } = showParams;
33
33
  return {
34
34
  title: showTitle,
@@ -46,11 +46,9 @@ export default ({
46
46
  dialogTable,
47
47
  });
48
48
  const { configData, request, title, params } = modalTableParams;
49
- const req = request
50
- ? (reqParams) => {
51
- return request({ ...params, ...reqParams });
52
- }
53
- : undefined;
49
+ const req=request?(reqParams)=>{
50
+ return request({ ...params, ...reqParams });
51
+ }:undefined;
54
52
  return (
55
53
  <Modal
56
54
  {...props}
@@ -25,8 +25,7 @@ export default ({
25
25
  }: HTableProps) => {
26
26
  const { run, loading, data, error, saveParams } = useReq({ request });
27
27
  const dispatch = useDispatch(action);
28
- const { selectedRowData, rowOnChange, allSelectChange, setSelectedRowData } =
29
- useRowObj();
28
+ const { selectedRowData, rowOnChange, allSelectChange, setSelectedRowData } = useRowObj();
30
29
  const [open, setOpen] = useState<boolean | undefined>();
31
30
  const tableInstance = useCurrentTable({
32
31
  table,
@@ -89,13 +89,13 @@ export default () => {
89
89
  <>
90
90
  <Button
91
91
  onClick={() => {
92
- dialogTable.show({ title: "3333", request: req2 });
92
+ dialogTable.show({ title: "3333"});
93
93
  }}
94
94
  >
95
95
  点我333
96
96
  </Button>
97
- <HModalTable dialogTable={dialogTable} configData={configData} />
98
- <HTable configData={[]} headerTitle={<Test />} />
97
+ <HModalTable dialogTable={dialogTable} request={req2} configData={configData} />
98
+ <HTable configData={configData} headerTitle={<Test />} />
99
99
  </>
100
100
  );
101
101
  };
@@ -54,7 +54,9 @@ export default () => {
54
54
  configData={configData}
55
55
  rowKey={"id"}
56
56
  table={hTable}
57
- rowSelection={{}}
57
+ rowSelection={{
58
+ allPageCheck:false
59
+ }}
58
60
  affixProps={{
59
61
  target: () => document.querySelector(".body"),
60
62
  }}