@hw-component/table 1.9.87 → 1.9.89
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/.eslintcache +1 -1
- package/es/HTableBody/HeaderTitle/hooks.d.ts +8 -0
- package/es/HTableBody/HeaderTitle/hooks.js +54 -0
- package/es/HTableBody/HeaderTitle/index.js +7 -31
- package/es/HTableBody/Options/utils.d.ts +5 -2
- package/es/HTableBody/RowCheckBox/RowItem.d.ts +2 -8
- package/es/HTableBody/RowCheckBox/hooks.d.ts +2 -2
- package/es/HTableBody/RowRadioBoxSelection.d.ts +1 -8
- package/es/HTableBody/hooks/useRowClassName.d.ts +4 -0
- package/es/HTableBody/hooks/useRowClassName.js +39 -0
- package/es/HTableBody/index.js +8 -25
- package/es/HTableBody/modal.d.ts +7 -1
- package/es/HTableBody/utils.d.ts +1 -0
- package/es/HTableHeader/RangePickerSearch.d.ts +1 -1
- package/es/TableConfig.d.ts +2 -0
- package/es/TableConfig.js +4 -2
- package/es/modal.d.ts +2 -1
- package/lib/HTableBody/HeaderTitle/hooks.d.ts +8 -0
- package/lib/HTableBody/HeaderTitle/hooks.js +55 -0
- package/lib/HTableBody/HeaderTitle/index.js +6 -30
- package/lib/HTableBody/Options/utils.d.ts +5 -2
- package/lib/HTableBody/RowCheckBox/RowItem.d.ts +2 -8
- package/lib/HTableBody/RowCheckBox/hooks.d.ts +2 -2
- package/lib/HTableBody/RowRadioBoxSelection.d.ts +1 -8
- package/lib/HTableBody/hooks/useRowClassName.d.ts +4 -0
- package/lib/HTableBody/hooks/useRowClassName.js +42 -0
- package/lib/HTableBody/index.js +7 -24
- package/lib/HTableBody/modal.d.ts +7 -1
- package/lib/HTableBody/utils.d.ts +1 -0
- package/lib/HTableHeader/RangePickerSearch.d.ts +1 -1
- package/lib/TableConfig.d.ts +2 -0
- package/lib/TableConfig.js +4 -2
- package/lib/modal.d.ts +2 -1
- package/package.json +1 -1
- package/src/components/HTableBody/HeaderTitle/hooks.ts +48 -0
- package/src/components/HTableBody/HeaderTitle/index.tsx +10 -31
- package/src/components/HTableBody/RowCheckBox/RowItem.tsx +2 -8
- package/src/components/HTableBody/RowCheckBox/hooks.ts +2 -2
- package/src/components/HTableBody/RowRadioBoxSelection.tsx +1 -7
- package/src/components/HTableBody/hooks/useRowClassName.ts +33 -0
- package/src/components/HTableBody/index.tsx +3 -21
- package/src/components/HTableBody/modal.ts +8 -1
- package/src/components/HTableBody/utils.ts +5 -0
- package/src/components/TableConfig.tsx +3 -0
- package/src/components/hooks/useRowObj.ts +1 -1
- package/src/components/modal.ts +6 -1
- package/src/pages/Table/index.tsx +56 -63
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { MutableRefObject } from "react";
|
|
2
|
+
interface HeaderStyleParams {
|
|
3
|
+
bodyRef: MutableRefObject<HTMLDivElement | null>;
|
|
4
|
+
titleContentRef: MutableRefObject<HTMLDivElement | null>;
|
|
5
|
+
rightNodeRef: MutableRefObject<HTMLDivElement | null>;
|
|
6
|
+
}
|
|
7
|
+
export declare const useHeaderStyle: ({ bodyRef, titleContentRef, rightNodeRef }: HeaderStyleParams) => {};
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
// welcome to hoo hoo hoo
|
|
2
|
+
import _slicedToArray from '@babel/runtime-corejs3/helpers/slicedToArray';
|
|
3
|
+
import { useState, useLayoutEffect, useEffect } from 'react';
|
|
4
|
+
|
|
5
|
+
var useHeaderStyle = function useHeaderStyle(_ref) {
|
|
6
|
+
var bodyRef = _ref.bodyRef,
|
|
7
|
+
titleContentRef = _ref.titleContentRef,
|
|
8
|
+
rightNodeRef = _ref.rightNodeRef;
|
|
9
|
+
var _useState = useState({}),
|
|
10
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
11
|
+
style = _useState2[0],
|
|
12
|
+
setStyle = _useState2[1];
|
|
13
|
+
var setHeaderStyle = function setHeaderStyle() {
|
|
14
|
+
var _bodyRef$current, _titleContentRef$curr, _rightNodeRef$current;
|
|
15
|
+
var headerWidth = ((_bodyRef$current = bodyRef.current) === null || _bodyRef$current === void 0 ? void 0 : _bodyRef$current.clientWidth) || 0;
|
|
16
|
+
console.log(headerWidth, "headerWidth");
|
|
17
|
+
var titleWidth = ((_titleContentRef$curr = titleContentRef.current) === null || _titleContentRef$curr === void 0 ? void 0 : _titleContentRef$curr.clientWidth) || 0;
|
|
18
|
+
var rightNodeWidth = ((_rightNodeRef$current = rightNodeRef.current) === null || _rightNodeRef$current === void 0 ? void 0 : _rightNodeRef$current.clientWidth) || 0;
|
|
19
|
+
if (rightNodeWidth + titleWidth >= headerWidth) {
|
|
20
|
+
setStyle({
|
|
21
|
+
overflow: "auto"
|
|
22
|
+
});
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
setStyle({});
|
|
26
|
+
};
|
|
27
|
+
useLayoutEffect(function () {
|
|
28
|
+
setHeaderStyle();
|
|
29
|
+
}, []);
|
|
30
|
+
useEffect(function () {
|
|
31
|
+
var resizeFn = function resizeFn() {
|
|
32
|
+
setHeaderStyle();
|
|
33
|
+
};
|
|
34
|
+
window.addEventListener("resize", resizeFn);
|
|
35
|
+
return function () {
|
|
36
|
+
window.removeEventListener("resize", resizeFn);
|
|
37
|
+
};
|
|
38
|
+
}, []);
|
|
39
|
+
useEffect(function () {
|
|
40
|
+
var element = titleContentRef.current;
|
|
41
|
+
if (!element || !window.ResizeObserver) return;
|
|
42
|
+
var observer = new ResizeObserver(function () {
|
|
43
|
+
setHeaderStyle();
|
|
44
|
+
});
|
|
45
|
+
observer.observe(element);
|
|
46
|
+
return function () {
|
|
47
|
+
observer.disconnect();
|
|
48
|
+
};
|
|
49
|
+
}, []);
|
|
50
|
+
return style;
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
export { useHeaderStyle };
|
|
54
|
+
// powered by hdj
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// welcome to hoo hoo hoo
|
|
2
|
-
import _slicedToArray from '@babel/runtime-corejs3/helpers/slicedToArray';
|
|
3
2
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
4
|
-
import React, { useRef
|
|
3
|
+
import React, { useRef } from 'react';
|
|
5
4
|
import { useHTableContext } from '../../context.js';
|
|
6
5
|
import { useClassName } from '../../hooks/index.js';
|
|
6
|
+
import { useHeaderStyle } from './hooks.js';
|
|
7
7
|
|
|
8
8
|
var HeaderTitle = (function (_ref) {
|
|
9
9
|
var headerTitle = _ref.headerTitle,
|
|
@@ -17,39 +17,15 @@ var HeaderTitle = (function (_ref) {
|
|
|
17
17
|
var bodyRef = useRef();
|
|
18
18
|
var titleContentRef = useRef();
|
|
19
19
|
var rightNodeRef = useRef();
|
|
20
|
-
var _useState = useState({}),
|
|
21
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
22
|
-
style = _useState2[0],
|
|
23
|
-
setStyle = _useState2[1];
|
|
24
20
|
var headerBox = useClassName("hw-table-header-title-box");
|
|
25
21
|
var headerBoxContent = useClassName("hw-table-header-title-box-content");
|
|
26
22
|
var titleClassname = useClassName("hw-table-header-title");
|
|
27
23
|
var rightNodeClassname = useClassName("hw-table-header-right-node");
|
|
28
|
-
var
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
if (rightNodeWidth + titleWidth >= headerWidth) {
|
|
34
|
-
setStyle({
|
|
35
|
-
overflow: "auto"
|
|
36
|
-
});
|
|
37
|
-
return;
|
|
38
|
-
}
|
|
39
|
-
setStyle({});
|
|
40
|
-
};
|
|
41
|
-
useLayoutEffect(function () {
|
|
42
|
-
setHeaderStyle();
|
|
43
|
-
}, []);
|
|
44
|
-
useEffect(function () {
|
|
45
|
-
var resizeFn = function resizeFn() {
|
|
46
|
-
setHeaderStyle();
|
|
47
|
-
};
|
|
48
|
-
window.addEventListener("resize", resizeFn);
|
|
49
|
-
return function () {
|
|
50
|
-
window.removeEventListener("resize", resizeFn);
|
|
51
|
-
};
|
|
52
|
-
}, []);
|
|
24
|
+
var style = useHeaderStyle({
|
|
25
|
+
bodyRef: bodyRef,
|
|
26
|
+
titleContentRef: titleContentRef,
|
|
27
|
+
rightNodeRef: rightNodeRef
|
|
28
|
+
});
|
|
53
29
|
if (!headerTitle && !rNode) {
|
|
54
30
|
return null;
|
|
55
31
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ConfigItemModal } from "../../modal";
|
|
2
2
|
import React from "react";
|
|
3
3
|
export declare const getItemValue: (data: ConfigItemModal) => {
|
|
4
|
-
name?: string | undefined;
|
|
4
|
+
name?: string | any[] | undefined;
|
|
5
5
|
labelAlign?: import("@hw-component/form/es/Form/modal").LabelAlignModal | undefined;
|
|
6
6
|
label?: React.ReactNode | import("@hw-component/form/es/Form/modal").HelperModal;
|
|
7
7
|
hidden?: boolean | import("@hw-component/form/es/Form/modal").HideModal | undefined;
|
|
@@ -9,7 +9,7 @@ export declare const getItemValue: (data: ConfigItemModal) => {
|
|
|
9
9
|
dependencies?: import("rc-field-form/lib/interface").NamePath[] | undefined;
|
|
10
10
|
getValueFromEvent?: ((...args: import("rc-field-form/lib/interface").EventArgs) => any) | undefined;
|
|
11
11
|
normalize?: ((value: any, prevValue: any, allValues: import("rc-field-form/lib/interface").Store) => any) | undefined;
|
|
12
|
-
rules?: import("
|
|
12
|
+
rules?: import("antd").FormRule[] | undefined;
|
|
13
13
|
shouldUpdate?: import("rc-field-form/lib/Field").ShouldUpdate<any> | undefined;
|
|
14
14
|
trigger?: string | undefined;
|
|
15
15
|
validateTrigger?: string | false | string[] | undefined;
|
|
@@ -52,6 +52,9 @@ export declare const getItemValue: (data: ConfigItemModal) => {
|
|
|
52
52
|
dispatch?: import("@hw-component/form/es/Form/modal").DispatchModal<string | string[]> | undefined;
|
|
53
53
|
itemSpan?: import("antd").ColProps | undefined;
|
|
54
54
|
hideLabel?: boolean | undefined;
|
|
55
|
+
rowWrapper?: boolean | undefined;
|
|
56
|
+
nameKey?: string | undefined;
|
|
57
|
+
flexBox?: boolean | undefined;
|
|
55
58
|
render?: ((dom: React.ReactNode, data: any, index: number, tableInstance: import("../../modal").HTableInstance) => React.ReactNode) | undefined;
|
|
56
59
|
showSearch?: boolean | undefined;
|
|
57
60
|
searchType?: string | undefined;
|
|
@@ -1,10 +1,4 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
data: any;
|
|
5
|
-
onChange?: HRowSelection["onChange"];
|
|
6
|
-
getCheckboxProps?: HRowSelection["getCheckboxProps"];
|
|
7
|
-
index: number;
|
|
8
|
-
}
|
|
9
|
-
declare const _default: ({ data, onChange, index, getCheckboxProps, }: RowSelectionBoxProps) => JSX.Element;
|
|
2
|
+
import { RowRadioSelectionProps } from "@/components/HTableBody/modal";
|
|
3
|
+
declare const _default: ({ data, onChange, index, getCheckboxProps, }: RowRadioSelectionProps) => JSX.Element;
|
|
10
4
|
export default _default;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Key } from "react";
|
|
2
|
-
import
|
|
2
|
+
import { RowRadioSelectionProps } from '../modal';
|
|
3
3
|
export declare const useAllChecked: (keys?: Key[], data?: any[]) => boolean;
|
|
4
|
-
export declare const useCheckControl: (data: any[] | undefined, onChange:
|
|
4
|
+
export declare const useCheckControl: (data: any[] | undefined, onChange: RowRadioSelectionProps["onChange"]) => {
|
|
5
5
|
checkChange: (e: any) => void;
|
|
6
6
|
menuClick: ({ key }: {
|
|
7
7
|
key: any;
|
|
@@ -1,10 +1,3 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import
|
|
3
|
-
interface RowRadioSelectionProps {
|
|
4
|
-
data: any;
|
|
5
|
-
onChange?: HRowSelection["onChange"];
|
|
6
|
-
getCheckboxProps?: HRowSelection["getCheckboxProps"];
|
|
7
|
-
index: number;
|
|
8
|
-
}
|
|
2
|
+
import { RowRadioSelectionProps } from './modal';
|
|
9
3
|
export declare const RowRadioSelection: ({ data, onChange, index, getCheckboxProps, }: RowRadioSelectionProps) => JSX.Element;
|
|
10
|
-
export {};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// welcome to hoo hoo hoo
|
|
2
|
+
import _keysInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/keys';
|
|
3
|
+
import _indexOfInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/index-of';
|
|
4
|
+
import _concatInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/concat';
|
|
5
|
+
import { useHTableContext } from '../../context.js';
|
|
6
|
+
import { useContext } from 'react';
|
|
7
|
+
import { ConfigProvider } from 'antd';
|
|
8
|
+
import { useHTableConfigContext } from '../../TableConfig.js';
|
|
9
|
+
|
|
10
|
+
var useRowClassName = (function (_ref) {
|
|
11
|
+
var rowClassName = _ref.rowClassName,
|
|
12
|
+
_ref$rowKey = _ref.rowKey,
|
|
13
|
+
rowKey = _ref$rowKey === void 0 ? "id" : _ref$rowKey;
|
|
14
|
+
var _useHTableContext = useHTableContext(),
|
|
15
|
+
selectedRowData = _useHTableContext.selectedRowData;
|
|
16
|
+
var _useHTableConfigConte = useHTableConfigContext({}),
|
|
17
|
+
defaultSelectedRowClassName = _useHTableConfigConte.defaultSelectedRowClassName;
|
|
18
|
+
var _selectedRowData$keys = _keysInstanceProperty(selectedRowData),
|
|
19
|
+
keys = _selectedRowData$keys === void 0 ? [] : _selectedRowData$keys;
|
|
20
|
+
var _useContext = useContext(ConfigProvider.ConfigContext),
|
|
21
|
+
getPrefixCls = _useContext.getPrefixCls;
|
|
22
|
+
return function (record, index, indent) {
|
|
23
|
+
var _context2;
|
|
24
|
+
var key = typeof rowKey === "function" ? rowKey(record, index) : record[rowKey];
|
|
25
|
+
var propsRowClassName = typeof rowClassName === "function" ? rowClassName(record, index, indent) : rowClassName;
|
|
26
|
+
var relPropsRowClassName = propsRowClassName || "";
|
|
27
|
+
if ((keys === null || keys === void 0 ? void 0 : _indexOfInstanceProperty(keys).call(keys, key)) === -1) {
|
|
28
|
+
return relPropsRowClassName;
|
|
29
|
+
}
|
|
30
|
+
if (typeof defaultSelectedRowClassName === "undefined") {
|
|
31
|
+
var _context;
|
|
32
|
+
return _concatInstanceProperty(_context = "".concat(getPrefixCls("table-row-selected"), " ")).call(_context, relPropsRowClassName);
|
|
33
|
+
}
|
|
34
|
+
return _concatInstanceProperty(_context2 = "".concat(defaultSelectedRowClassName || "", " ")).call(_context2, relPropsRowClassName);
|
|
35
|
+
};
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
export { useRowClassName as default };
|
|
39
|
+
// powered by hdj
|
package/es/HTableBody/index.js
CHANGED
|
@@ -9,15 +9,12 @@ import _Object$defineProperties from '@babel/runtime-corejs3/core-js-stable/obje
|
|
|
9
9
|
import _Object$defineProperty from '@babel/runtime-corejs3/core-js-stable/object/define-property';
|
|
10
10
|
import _defineProperty from '@babel/runtime-corejs3/helpers/defineProperty';
|
|
11
11
|
import _objectWithoutProperties from '@babel/runtime-corejs3/helpers/objectWithoutProperties';
|
|
12
|
-
import _keysInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/keys';
|
|
13
|
-
import _indexOfInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/index-of';
|
|
14
|
-
import _concatInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/concat';
|
|
15
12
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
16
13
|
import ProTable from '@ant-design/pro-table';
|
|
17
14
|
import { useSize, useSynchronousKeys, useAlwaysShowAlert, useTableChange } from './hooks/useControl.js';
|
|
18
15
|
import { useCols, useColumnsStateType } from './hooks/useColData.js';
|
|
19
16
|
import { useHTableContext } from '../context.js';
|
|
20
|
-
import {
|
|
17
|
+
import { Space, Alert, ConfigProvider } from 'antd';
|
|
21
18
|
import { useHTableConfigContext } from '../TableConfig.js';
|
|
22
19
|
import HTablePagination from '../HTablePagination/index.js';
|
|
23
20
|
import { useClassName } from '../hooks/index.js';
|
|
@@ -25,13 +22,12 @@ import AlertMsg from './AlertMsg.js';
|
|
|
25
22
|
import Options from './Options/index.js';
|
|
26
23
|
import HeaderTitle from './HeaderTitle/index.js';
|
|
27
24
|
import { emptyDefaultRender, errorDefaultRender } from './defaultRender.js';
|
|
28
|
-
import
|
|
25
|
+
import useRowClassName from './hooks/useRowClassName.js';
|
|
29
26
|
|
|
30
27
|
var _excluded = ["configData", "pagination", "onPageChange", "rowSelection", "rowKey", "emptyRender", "errorRender", "tableStyle", "paginationStyle", "headerTitle", "options", "actionRender", "affixProps", "goTop", "size", "optionsRender", "paginationActionRender", "localSorter", "columnsState", "tableExtraRender", "table", "onChange", "bordered", "rowClassName"],
|
|
31
28
|
_excluded2 = ["value", "onChange", "reset"];
|
|
32
29
|
function ownKeys(e, r) { var t = _Object$keys(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = _filterInstanceProperty(o).call(o, function (r) { return _Object$getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
33
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var
|
|
34
|
-
var ConfigContext = ConfigProvider.ConfigContext;
|
|
30
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context = ownKeys(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context2 = ownKeys(Object(t))).call(_context2, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
35
31
|
var Body = (function (bodyProps) {
|
|
36
32
|
var configData = bodyProps.configData,
|
|
37
33
|
_bodyProps$pagination = bodyProps.pagination,
|
|
@@ -59,10 +55,9 @@ var Body = (function (bodyProps) {
|
|
|
59
55
|
tableExtraRender = bodyProps.tableExtraRender,
|
|
60
56
|
table = bodyProps.table,
|
|
61
57
|
tableOnchange = bodyProps.onChange,
|
|
62
|
-
bordered = bodyProps.bordered
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
props = _objectWithoutProperties(bodyProps, _excluded);
|
|
58
|
+
bordered = bodyProps.bordered;
|
|
59
|
+
bodyProps.rowClassName;
|
|
60
|
+
var props = _objectWithoutProperties(bodyProps, _excluded);
|
|
66
61
|
var _ref = rowSelection || {},
|
|
67
62
|
selectedRowKeys = _ref.selectedRowKeys,
|
|
68
63
|
configAlwaysShowAlert = _ref.alwaysShowAlert;
|
|
@@ -133,11 +128,7 @@ var Body = (function (bodyProps) {
|
|
|
133
128
|
table: tableInstance,
|
|
134
129
|
localSorter: localSorter
|
|
135
130
|
});
|
|
136
|
-
var
|
|
137
|
-
keys = _selectedRowData$keys === void 0 ? [] : _selectedRowData$keys;
|
|
138
|
-
selectedRowData.selectAll;
|
|
139
|
-
var _useContext = useContext(ConfigContext),
|
|
140
|
-
getPrefixCls = _useContext.getPrefixCls;
|
|
131
|
+
var rowClassNameFn = useRowClassName(bodyProps);
|
|
141
132
|
return jsx("div", {
|
|
142
133
|
style: defaultTableStyle,
|
|
143
134
|
className: "hw_table_body ".concat(className),
|
|
@@ -163,15 +154,7 @@ var Body = (function (bodyProps) {
|
|
|
163
154
|
return tableEmptyRender === null || tableEmptyRender === void 0 ? void 0 : tableEmptyRender(tableInstance);
|
|
164
155
|
},
|
|
165
156
|
children: [jsx(ProTable, _objectSpread(_objectSpread({}, props), {}, {
|
|
166
|
-
rowClassName:
|
|
167
|
-
var key = typeof rowKey === "function" ? rowKey(record, index) : record[rowKey];
|
|
168
|
-
var propsRowClassName = typeof _rowClassName === "function" ? _rowClassName(record, index, indent) : _rowClassName;
|
|
169
|
-
if ((keys === null || keys === void 0 ? void 0 : _indexOfInstanceProperty(keys).call(keys, key)) !== -1) {
|
|
170
|
-
var _context;
|
|
171
|
-
return _concatInstanceProperty(_context = "".concat(getPrefixCls("table-row-selected"), " ")).call(_context, propsRowClassName);
|
|
172
|
-
}
|
|
173
|
-
return propsRowClassName;
|
|
174
|
-
},
|
|
157
|
+
rowClassName: rowClassNameFn,
|
|
175
158
|
bordered: bordered,
|
|
176
159
|
columnsState: _objectSpread(_objectSpread({}, selfColStatus), {}, {
|
|
177
160
|
value: value
|
package/es/HTableBody/modal.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { OptionConfig } from "@ant-design/pro-table/lib/components/ToolBar";
|
|
2
|
-
import
|
|
2
|
+
import React, { Key } from "react";
|
|
3
3
|
import type { ProTableProps } from "@ant-design/pro-table";
|
|
4
4
|
import type { ActionRenderFn, ConfigDataModal, HRowSelection, HTableInstance, ParamsModal } from "@/components/modal";
|
|
5
5
|
import type { AffixProps } from "antd/lib/affix";
|
|
@@ -25,3 +25,9 @@ export interface HTableBodyProps extends Omit<ProTableProps<any, any>, "dataSour
|
|
|
25
25
|
table?: HTableInstance;
|
|
26
26
|
pagination?: IPaginationProps | false;
|
|
27
27
|
}
|
|
28
|
+
export interface RowRadioSelectionProps {
|
|
29
|
+
data: any;
|
|
30
|
+
onChange?: (keys: Key[], data: any[]) => void;
|
|
31
|
+
getCheckboxProps?: HRowSelection["getCheckboxProps"];
|
|
32
|
+
index: number;
|
|
33
|
+
}
|
package/es/HTableBody/utils.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
declare const _default: import("react").ForwardRefExoticComponent<any
|
|
2
|
+
declare const _default: import("react").ForwardRefExoticComponent<import("@hw-component/form/es/Form/modal").HFormItemProps & import("react").RefAttributes<any>>;
|
|
3
3
|
export default _default;
|
package/es/TableConfig.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ interface HTableConfigContextModal {
|
|
|
7
7
|
tableStyle?: React.CSSProperties;
|
|
8
8
|
paginationStyle?: React.CSSProperties;
|
|
9
9
|
valueTypeConfig?: ValueTypeConfigModal;
|
|
10
|
+
defaultSelectedRowClassName?: string | null;
|
|
10
11
|
}
|
|
11
12
|
export declare const HTableConfigContext: React.Context<HTableConfigContextModal | null>;
|
|
12
13
|
export declare const useHTableConfigContext: ({ emptyRender, errorRender, headerStyle, tableStyle, paginationStyle, }: HTableConfigContextModal) => {
|
|
@@ -16,6 +17,7 @@ export declare const useHTableConfigContext: ({ emptyRender, errorRender, header
|
|
|
16
17
|
tableStyle: React.CSSProperties | undefined;
|
|
17
18
|
paginationStyle: React.CSSProperties | undefined;
|
|
18
19
|
valueTypeConfig: ValueTypeConfigModal;
|
|
20
|
+
defaultSelectedRowClassName: string | null | undefined;
|
|
19
21
|
};
|
|
20
22
|
declare const Index: React.FC<HTableConfigContextModal>;
|
|
21
23
|
export default Index;
|
package/es/TableConfig.js
CHANGED
|
@@ -18,14 +18,16 @@ var useHTableConfigContext = function useHTableConfigContext(_ref) {
|
|
|
18
18
|
configTableStyle = _ref2.tableStyle,
|
|
19
19
|
configPaginationStyle = _ref2.paginationStyle,
|
|
20
20
|
_ref2$valueTypeConfig = _ref2.valueTypeConfig,
|
|
21
|
-
valueTypeConfig = _ref2$valueTypeConfig === void 0 ? {} : _ref2$valueTypeConfig
|
|
21
|
+
valueTypeConfig = _ref2$valueTypeConfig === void 0 ? {} : _ref2$valueTypeConfig,
|
|
22
|
+
defaultSelectedRowClassName = _ref2.defaultSelectedRowClassName;
|
|
22
23
|
return {
|
|
23
24
|
errorRender: errorRender || configErrorRender,
|
|
24
25
|
emptyRender: emptyRender || configEmptyRender,
|
|
25
26
|
headerStyle: headerStyle || configHeaderStyle,
|
|
26
27
|
tableStyle: tableStyle || configTableStyle,
|
|
27
28
|
paginationStyle: paginationStyle || configPaginationStyle,
|
|
28
|
-
valueTypeConfig: valueTypeConfig
|
|
29
|
+
valueTypeConfig: valueTypeConfig,
|
|
30
|
+
defaultSelectedRowClassName: defaultSelectedRowClassName
|
|
29
31
|
};
|
|
30
32
|
};
|
|
31
33
|
var Index = function Index(_ref3) {
|
package/es/modal.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import type { ProColumns } from "@ant-design/pro-table/lib/typing";
|
|
|
2
2
|
import type { ProTableProps } from "@ant-design/pro-table";
|
|
3
3
|
import type { HItemProps, HFormInstance } from "@hw-component/form/es/Form/modal";
|
|
4
4
|
import type { ColProps, FormInstance } from "antd";
|
|
5
|
-
import
|
|
5
|
+
import React, { Key } from "react";
|
|
6
6
|
import type { ModalProps } from "antd";
|
|
7
7
|
import type { TableProps } from "antd/lib/table";
|
|
8
8
|
import type { AffixProps } from "antd/lib/affix";
|
|
@@ -44,6 +44,7 @@ export type FooterBtnRenderFn = (dom: React.ReactNode, total: string, selectedRo
|
|
|
44
44
|
export type actionFn = (...arg: any[]) => void;
|
|
45
45
|
export interface RowSelectionOuter {
|
|
46
46
|
allPageCheck?: boolean;
|
|
47
|
+
onChange?: (keys: Key[], data: any[]) => void;
|
|
47
48
|
}
|
|
48
49
|
export type HRowSelection = RowSelectionOuter & (TableProps<any>["rowSelection"] & {
|
|
49
50
|
alwaysShowAlert?: boolean;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { MutableRefObject } from "react";
|
|
2
|
+
interface HeaderStyleParams {
|
|
3
|
+
bodyRef: MutableRefObject<HTMLDivElement | null>;
|
|
4
|
+
titleContentRef: MutableRefObject<HTMLDivElement | null>;
|
|
5
|
+
rightNodeRef: MutableRefObject<HTMLDivElement | null>;
|
|
6
|
+
}
|
|
7
|
+
export declare const useHeaderStyle: ({ bodyRef, titleContentRef, rightNodeRef }: HeaderStyleParams) => {};
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var _slicedToArray = require('@babel/runtime-corejs3/helpers/slicedToArray');
|
|
4
|
+
var React = require('react');
|
|
5
|
+
|
|
6
|
+
var useHeaderStyle = function useHeaderStyle(_ref) {
|
|
7
|
+
var bodyRef = _ref.bodyRef,
|
|
8
|
+
titleContentRef = _ref.titleContentRef,
|
|
9
|
+
rightNodeRef = _ref.rightNodeRef;
|
|
10
|
+
var _useState = React.useState({}),
|
|
11
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
12
|
+
style = _useState2[0],
|
|
13
|
+
setStyle = _useState2[1];
|
|
14
|
+
var setHeaderStyle = function setHeaderStyle() {
|
|
15
|
+
var _bodyRef$current, _titleContentRef$curr, _rightNodeRef$current;
|
|
16
|
+
var headerWidth = ((_bodyRef$current = bodyRef.current) === null || _bodyRef$current === void 0 ? void 0 : _bodyRef$current.clientWidth) || 0;
|
|
17
|
+
console.log(headerWidth, "headerWidth");
|
|
18
|
+
var titleWidth = ((_titleContentRef$curr = titleContentRef.current) === null || _titleContentRef$curr === void 0 ? void 0 : _titleContentRef$curr.clientWidth) || 0;
|
|
19
|
+
var rightNodeWidth = ((_rightNodeRef$current = rightNodeRef.current) === null || _rightNodeRef$current === void 0 ? void 0 : _rightNodeRef$current.clientWidth) || 0;
|
|
20
|
+
if (rightNodeWidth + titleWidth >= headerWidth) {
|
|
21
|
+
setStyle({
|
|
22
|
+
overflow: "auto"
|
|
23
|
+
});
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
setStyle({});
|
|
27
|
+
};
|
|
28
|
+
React.useLayoutEffect(function () {
|
|
29
|
+
setHeaderStyle();
|
|
30
|
+
}, []);
|
|
31
|
+
React.useEffect(function () {
|
|
32
|
+
var resizeFn = function resizeFn() {
|
|
33
|
+
setHeaderStyle();
|
|
34
|
+
};
|
|
35
|
+
window.addEventListener("resize", resizeFn);
|
|
36
|
+
return function () {
|
|
37
|
+
window.removeEventListener("resize", resizeFn);
|
|
38
|
+
};
|
|
39
|
+
}, []);
|
|
40
|
+
React.useEffect(function () {
|
|
41
|
+
var element = titleContentRef.current;
|
|
42
|
+
if (!element || !window.ResizeObserver) return;
|
|
43
|
+
var observer = new ResizeObserver(function () {
|
|
44
|
+
setHeaderStyle();
|
|
45
|
+
});
|
|
46
|
+
observer.observe(element);
|
|
47
|
+
return function () {
|
|
48
|
+
observer.disconnect();
|
|
49
|
+
};
|
|
50
|
+
}, []);
|
|
51
|
+
return style;
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
exports.useHeaderStyle = useHeaderStyle;
|
|
55
|
+
// powered by h
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var _slicedToArray = require('@babel/runtime-corejs3/helpers/slicedToArray');
|
|
6
5
|
var jsxRuntime = require('react/jsx-runtime');
|
|
7
6
|
var React = require('react');
|
|
8
7
|
var context = require('../../context.js');
|
|
9
8
|
var index = require('../../hooks/index.js');
|
|
9
|
+
var hooks = require('./hooks.js');
|
|
10
10
|
|
|
11
11
|
var HeaderTitle = (function (_ref) {
|
|
12
12
|
var headerTitle = _ref.headerTitle,
|
|
@@ -20,39 +20,15 @@ var HeaderTitle = (function (_ref) {
|
|
|
20
20
|
var bodyRef = React.useRef();
|
|
21
21
|
var titleContentRef = React.useRef();
|
|
22
22
|
var rightNodeRef = React.useRef();
|
|
23
|
-
var _useState = React.useState({}),
|
|
24
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
25
|
-
style = _useState2[0],
|
|
26
|
-
setStyle = _useState2[1];
|
|
27
23
|
var headerBox = index.useClassName("hw-table-header-title-box");
|
|
28
24
|
var headerBoxContent = index.useClassName("hw-table-header-title-box-content");
|
|
29
25
|
var titleClassname = index.useClassName("hw-table-header-title");
|
|
30
26
|
var rightNodeClassname = index.useClassName("hw-table-header-right-node");
|
|
31
|
-
var
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
if (rightNodeWidth + titleWidth >= headerWidth) {
|
|
37
|
-
setStyle({
|
|
38
|
-
overflow: "auto"
|
|
39
|
-
});
|
|
40
|
-
return;
|
|
41
|
-
}
|
|
42
|
-
setStyle({});
|
|
43
|
-
};
|
|
44
|
-
React.useLayoutEffect(function () {
|
|
45
|
-
setHeaderStyle();
|
|
46
|
-
}, []);
|
|
47
|
-
React.useEffect(function () {
|
|
48
|
-
var resizeFn = function resizeFn() {
|
|
49
|
-
setHeaderStyle();
|
|
50
|
-
};
|
|
51
|
-
window.addEventListener("resize", resizeFn);
|
|
52
|
-
return function () {
|
|
53
|
-
window.removeEventListener("resize", resizeFn);
|
|
54
|
-
};
|
|
55
|
-
}, []);
|
|
27
|
+
var style = hooks.useHeaderStyle({
|
|
28
|
+
bodyRef: bodyRef,
|
|
29
|
+
titleContentRef: titleContentRef,
|
|
30
|
+
rightNodeRef: rightNodeRef
|
|
31
|
+
});
|
|
56
32
|
if (!headerTitle && !rNode) {
|
|
57
33
|
return null;
|
|
58
34
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ConfigItemModal } from "../../modal";
|
|
2
2
|
import React from "react";
|
|
3
3
|
export declare const getItemValue: (data: ConfigItemModal) => {
|
|
4
|
-
name?: string | undefined;
|
|
4
|
+
name?: string | any[] | undefined;
|
|
5
5
|
labelAlign?: import("@hw-component/form/es/Form/modal").LabelAlignModal | undefined;
|
|
6
6
|
label?: React.ReactNode | import("@hw-component/form/es/Form/modal").HelperModal;
|
|
7
7
|
hidden?: boolean | import("@hw-component/form/es/Form/modal").HideModal | undefined;
|
|
@@ -9,7 +9,7 @@ export declare const getItemValue: (data: ConfigItemModal) => {
|
|
|
9
9
|
dependencies?: import("rc-field-form/lib/interface").NamePath[] | undefined;
|
|
10
10
|
getValueFromEvent?: ((...args: import("rc-field-form/lib/interface").EventArgs) => any) | undefined;
|
|
11
11
|
normalize?: ((value: any, prevValue: any, allValues: import("rc-field-form/lib/interface").Store) => any) | undefined;
|
|
12
|
-
rules?: import("
|
|
12
|
+
rules?: import("antd").FormRule[] | undefined;
|
|
13
13
|
shouldUpdate?: import("rc-field-form/lib/Field").ShouldUpdate<any> | undefined;
|
|
14
14
|
trigger?: string | undefined;
|
|
15
15
|
validateTrigger?: string | false | string[] | undefined;
|
|
@@ -52,6 +52,9 @@ export declare const getItemValue: (data: ConfigItemModal) => {
|
|
|
52
52
|
dispatch?: import("@hw-component/form/es/Form/modal").DispatchModal<string | string[]> | undefined;
|
|
53
53
|
itemSpan?: import("antd").ColProps | undefined;
|
|
54
54
|
hideLabel?: boolean | undefined;
|
|
55
|
+
rowWrapper?: boolean | undefined;
|
|
56
|
+
nameKey?: string | undefined;
|
|
57
|
+
flexBox?: boolean | undefined;
|
|
55
58
|
render?: ((dom: React.ReactNode, data: any, index: number, tableInstance: import("../../modal").HTableInstance) => React.ReactNode) | undefined;
|
|
56
59
|
showSearch?: boolean | undefined;
|
|
57
60
|
searchType?: string | undefined;
|
|
@@ -1,10 +1,4 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
data: any;
|
|
5
|
-
onChange?: HRowSelection["onChange"];
|
|
6
|
-
getCheckboxProps?: HRowSelection["getCheckboxProps"];
|
|
7
|
-
index: number;
|
|
8
|
-
}
|
|
9
|
-
declare const _default: ({ data, onChange, index, getCheckboxProps, }: RowSelectionBoxProps) => JSX.Element;
|
|
2
|
+
import { RowRadioSelectionProps } from "@/components/HTableBody/modal";
|
|
3
|
+
declare const _default: ({ data, onChange, index, getCheckboxProps, }: RowRadioSelectionProps) => JSX.Element;
|
|
10
4
|
export default _default;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Key } from "react";
|
|
2
|
-
import
|
|
2
|
+
import { RowRadioSelectionProps } from '../modal';
|
|
3
3
|
export declare const useAllChecked: (keys?: Key[], data?: any[]) => boolean;
|
|
4
|
-
export declare const useCheckControl: (data: any[] | undefined, onChange:
|
|
4
|
+
export declare const useCheckControl: (data: any[] | undefined, onChange: RowRadioSelectionProps["onChange"]) => {
|
|
5
5
|
checkChange: (e: any) => void;
|
|
6
6
|
menuClick: ({ key }: {
|
|
7
7
|
key: any;
|
|
@@ -1,10 +1,3 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import
|
|
3
|
-
interface RowRadioSelectionProps {
|
|
4
|
-
data: any;
|
|
5
|
-
onChange?: HRowSelection["onChange"];
|
|
6
|
-
getCheckboxProps?: HRowSelection["getCheckboxProps"];
|
|
7
|
-
index: number;
|
|
8
|
-
}
|
|
2
|
+
import { RowRadioSelectionProps } from './modal';
|
|
9
3
|
export declare const RowRadioSelection: ({ data, onChange, index, getCheckboxProps, }: RowRadioSelectionProps) => JSX.Element;
|
|
10
|
-
export {};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var _keysInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/keys');
|
|
6
|
+
var _indexOfInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/index-of');
|
|
7
|
+
var _concatInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/concat');
|
|
8
|
+
var context = require('../../context.js');
|
|
9
|
+
var React = require('react');
|
|
10
|
+
var antd = require('antd');
|
|
11
|
+
var TableConfig = require('../../TableConfig.js');
|
|
12
|
+
|
|
13
|
+
var useRowClassName = (function (_ref) {
|
|
14
|
+
var rowClassName = _ref.rowClassName,
|
|
15
|
+
_ref$rowKey = _ref.rowKey,
|
|
16
|
+
rowKey = _ref$rowKey === void 0 ? "id" : _ref$rowKey;
|
|
17
|
+
var _useHTableContext = context.useHTableContext(),
|
|
18
|
+
selectedRowData = _useHTableContext.selectedRowData;
|
|
19
|
+
var _useHTableConfigConte = TableConfig.useHTableConfigContext({}),
|
|
20
|
+
defaultSelectedRowClassName = _useHTableConfigConte.defaultSelectedRowClassName;
|
|
21
|
+
var _selectedRowData$keys = _keysInstanceProperty(selectedRowData),
|
|
22
|
+
keys = _selectedRowData$keys === void 0 ? [] : _selectedRowData$keys;
|
|
23
|
+
var _useContext = React.useContext(antd.ConfigProvider.ConfigContext),
|
|
24
|
+
getPrefixCls = _useContext.getPrefixCls;
|
|
25
|
+
return function (record, index, indent) {
|
|
26
|
+
var _context2;
|
|
27
|
+
var key = typeof rowKey === "function" ? rowKey(record, index) : record[rowKey];
|
|
28
|
+
var propsRowClassName = typeof rowClassName === "function" ? rowClassName(record, index, indent) : rowClassName;
|
|
29
|
+
var relPropsRowClassName = propsRowClassName || "";
|
|
30
|
+
if ((keys === null || keys === void 0 ? void 0 : _indexOfInstanceProperty(keys).call(keys, key)) === -1) {
|
|
31
|
+
return relPropsRowClassName;
|
|
32
|
+
}
|
|
33
|
+
if (typeof defaultSelectedRowClassName === "undefined") {
|
|
34
|
+
var _context;
|
|
35
|
+
return _concatInstanceProperty(_context = "".concat(getPrefixCls("table-row-selected"), " ")).call(_context, relPropsRowClassName);
|
|
36
|
+
}
|
|
37
|
+
return _concatInstanceProperty(_context2 = "".concat(defaultSelectedRowClassName || "", " ")).call(_context2, relPropsRowClassName);
|
|
38
|
+
};
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
exports.default = useRowClassName;
|
|
42
|
+
// powered by h
|