ebaoferc 1.0.8 → 2.0.1

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.
@@ -1,9 +1,9 @@
1
1
  .custom-filter-card-container-wrapper {
2
2
  .ant-pro-card-body {
3
- padding-bottom: 0 !important;
3
+ padding: 24px 16px 0 !important;
4
4
  }
5
5
 
6
6
  .ant-form-item {
7
- margin-bottom: 16px;
7
+ margin-bottom: 24px;
8
8
  }
9
9
  }
@@ -1,10 +1,19 @@
1
- import type { ProFormProps } from '@ant-design/pro-components';
1
+ import { QueryFilterProps } from '@ant-design/pro-components';
2
2
  import React from 'react';
3
3
  import './index.less';
4
- export default function StyledQueryFilter(props: ProFormProps & {
5
- children?: React.ReactNode;
6
- labelWidth?: number;
7
- itemWith?: number;
8
- collapsedLineCount?: number;
9
- maxColCount?: number;
10
- }): import("react/jsx-runtime").JSX.Element;
4
+ export interface StyledQueryFilterProps extends Omit<QueryFilterProps, 'colon' | 'labelWidth' | 'defaultFormItemsNumber'> {
5
+ colon?: boolean;
6
+ labelWidth?: number | 'auto';
7
+ defaultFormItemsNumber?: number;
8
+ }
9
+ /**
10
+ * 增强的 QueryFilter 组件
11
+ *
12
+ * 默认参数:
13
+ * - colon: false (不显示冒号)
14
+ * - labelWidth: 80 (标签宽度为80px)
15
+ * - defaultFormItemsNumber: 7 (默认展示7个表单项)
16
+ * ```
17
+ */
18
+ declare const StyledQueryFilter: React.FC<StyledQueryFilterProps>;
19
+ export default StyledQueryFilter;
@@ -1,110 +1,42 @@
1
1
  function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
- var _excluded = ["children", "labelWidth", "form", "className", "itemWith", "onReset", "collapsedLineCount", "maxColCount"];
2
+ var _excluded = ["colon", "labelWidth", "defaultFormItemsNumber"];
3
3
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
4
4
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
5
5
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
6
6
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
7
7
  function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
8
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
9
- function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
10
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
11
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
12
- function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
13
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
14
8
  function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
15
9
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
16
- import { DownOutlined } from '@ant-design/icons';
17
- import { ProForm } from '@ant-design/pro-components';
18
- import { Button, Form } from 'antd';
19
- import classNames from 'classnames';
20
- import React, { useCallback, useState } from 'react';
21
- import FlexRowCol from "../FlexRowCol";
10
+ import { QueryFilter } from '@ant-design/pro-components';
11
+ import React from 'react';
22
12
  import "./index.less";
13
+
14
+ // 继承 QueryFilterProps 并重写我们想要设置默认值的属性为可选
23
15
  import { jsx as _jsx } from "react/jsx-runtime";
24
- import { jsxs as _jsxs } from "react/jsx-runtime";
25
- export default function StyledQueryFilter(props) {
26
- var children = props.children,
27
- labelWidth = props.labelWidth,
28
- form = props.form,
29
- className = props.className,
30
- itemWith = props.itemWith,
31
- onReset = props.onReset,
32
- _props$collapsedLineC = props.collapsedLineCount,
33
- collapsedLineCount = _props$collapsedLineC === void 0 ? 2 : _props$collapsedLineC,
34
- maxColCount = props.maxColCount,
35
- rest = _objectWithoutProperties(props, _excluded);
36
- var _Form$useForm = Form.useForm(form),
37
- _Form$useForm2 = _slicedToArray(_Form$useForm, 1),
38
- _form = _Form$useForm2[0];
39
- var _useState = useState(false),
40
- _useState2 = _slicedToArray(_useState, 2),
41
- collapsed = _useState2[0],
42
- setCollapsed = _useState2[1];
43
- var _useState3 = useState(false),
44
- _useState4 = _slicedToArray(_useState3, 2),
45
- showExpandButton = _useState4[0],
46
- setShowExpandButton = _useState4[1];
47
- if (labelWidth) {
48
- rest.labelCol = {
49
- flex: "0 0 ".concat(labelWidth, "px")
50
- };
51
- }
52
- var reset = function reset(e) {
53
- _form.resetFields();
54
- if (onReset) {
55
- onReset(e); // 类型断言,因为 onReset 可能期望 FormEvent
56
- }
57
- };
58
- var handleLineCountChange = useCallback(function (count) {
59
- setShowExpandButton(count > collapsedLineCount);
60
- }, [collapsedLineCount]);
61
- return /*#__PURE__*/_jsxs("div", {
16
+ /**
17
+ * 增强的 QueryFilter 组件
18
+ *
19
+ * 默认参数:
20
+ * - colon: false (不显示冒号)
21
+ * - labelWidth: 80 (标签宽度为80px)
22
+ * - defaultFormItemsNumber: 7 (默认展示7个表单项)
23
+ * ```
24
+ */
25
+ var StyledQueryFilter = function StyledQueryFilter(props) {
26
+ var _props$colon = props.colon,
27
+ colon = _props$colon === void 0 ? false : _props$colon,
28
+ _props$labelWidth = props.labelWidth,
29
+ labelWidth = _props$labelWidth === void 0 ? 80 : _props$labelWidth,
30
+ _props$defaultFormIte = props.defaultFormItemsNumber,
31
+ defaultFormItemsNumber = _props$defaultFormIte === void 0 ? 7 : _props$defaultFormIte,
32
+ restProps = _objectWithoutProperties(props, _excluded);
33
+ return /*#__PURE__*/_jsx("div", {
62
34
  className: "custom-styled-query-filter",
63
- children: [/*#__PURE__*/_jsx(ProForm, _objectSpread(_objectSpread({
64
- layout: "horizontal",
65
- className: classNames('custom-styled-query-filter__form', className),
66
- form: _form,
67
- colon: false
68
- }, rest), {}, {
69
- submitter: false,
70
- children: /*#__PURE__*/_jsx(FlexRowCol, {
71
- collapsed: collapsed,
72
- collapsedLineCount: collapsedLineCount,
73
- lineCountChange: handleLineCountChange,
74
- width: itemWith,
75
- showAfterSize: true,
76
- maxColCount: maxColCount,
77
- children: children
78
- })
79
- })), /*#__PURE__*/_jsxs("div", {
80
- className: "custom-styled-query-filter__right",
81
- children: [/*#__PURE__*/_jsxs("div", {
82
- className: "custom-styled-query-filter__submitter",
83
- children: [/*#__PURE__*/_jsx(Button, {
84
- onClick: reset,
85
- children: "\u91CD\u7F6E"
86
- }), /*#__PURE__*/_jsx(Button, {
87
- type: "primary",
88
- onClick: function onClick() {
89
- return _form.submit();
90
- },
91
- children: "\u67E5\u8BE2"
92
- })]
93
- }), showExpandButton && /*#__PURE__*/_jsx("div", {
94
- children: /*#__PURE__*/_jsxs(Button, {
95
- type: "link",
96
- onClick: function onClick() {
97
- return setCollapsed(!collapsed);
98
- },
99
- children: [collapsed ? '展开' : '收起', /*#__PURE__*/_jsx(DownOutlined, {
100
- style: {
101
- marginInlineStart: '0.5em',
102
- transition: '0.3s all',
103
- transform: "rotate(".concat(collapsed ? 0 : 0.5, "turn)")
104
- }
105
- })]
106
- })
107
- })]
108
- })]
35
+ children: /*#__PURE__*/_jsx(QueryFilter, _objectSpread({
36
+ colon: colon,
37
+ labelWidth: labelWidth,
38
+ defaultFormItemsNumber: defaultFormItemsNumber
39
+ }, restProps))
109
40
  });
110
- }
41
+ };
42
+ export default StyledQueryFilter;
@@ -1,29 +1,21 @@
1
1
  .custom-styled-query-filter {
2
- display: flex;
3
- justify-content: space-between;
4
- column-gap: 16px;
2
+ /** QueryFilter 查询表单样式复写 **/
3
+ .ant-pro-query-filter {
4
+ padding: 0;
5
5
 
6
- &__form {
7
- flex: 1;
8
- }
6
+ .ant-pro-query-filter-row {
7
+ row-gap: 0;
9
8
 
10
- &__right {
11
- display: flex;
12
- flex-direction: column;
13
- justify-content: space-between;
14
- align-items: flex-end;
9
+ .ant-form-item {
10
+ margin-bottom: 24px;
11
+ }
15
12
 
16
- .ant-btn-link {
17
- padding-right: 0;
18
- margin-bottom: 28px;
13
+ .ant-form-item-control .ant-space-align-center {
14
+ flex-direction: row-reverse;
15
+ }
19
16
  }
20
17
  }
21
18
 
22
- &__submitter {
23
- display: flex;
24
- column-gap: 8px;
25
- }
26
-
27
19
  .ant-form-item-no-colon {
28
20
  margin-right: 10px;
29
21
 
@@ -2,7 +2,6 @@ import type { TableProps } from 'antd';
2
2
  import { SetStateAction } from 'react';
3
3
  import './index.less';
4
4
  type StyledTableProps = TableProps<any> & {
5
- maxCellWidth?: number;
6
5
  maxTooltipWidth?: number;
7
6
  maxTooltipHeight?: number;
8
7
  };
@@ -11,7 +10,7 @@ export declare const PaginationCommonProps: {
11
10
  showQuickJumper: boolean;
12
11
  showTotal: (total: number) => string;
13
12
  };
14
- export declare const TableCellText: (text: string | number, cellWidth: any, maxTooltipWidth: any, maxTooltipHeight: any) => "-" | import("react/jsx-runtime").JSX.Element;
13
+ export declare const TableCellText: (text: string | number, maxTooltipWidth: any, maxTooltipHeight: any) => "-" | import("react/jsx-runtime").JSX.Element;
15
14
  export default function (props: StyledTableProps): import("react/jsx-runtime").JSX.Element;
16
15
  export declare const useRowSelection: () => {
17
16
  selectedRowKeys: any[];
@@ -1,6 +1,6 @@
1
1
  function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
- var _excluded = ["columns", "pagination", "maxCellWidth", "maxTooltipWidth", "maxTooltipHeight"],
3
- _excluded2 = ["longTextWidth", "maxTooltipWidth", "maxTooltipHeight"];
2
+ var _excluded = ["columns", "pagination", "maxTooltipWidth", "maxTooltipHeight", "scroll"],
3
+ _excluded2 = ["width", "maxTooltipWidth", "maxTooltipHeight"];
4
4
  function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
5
5
  function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
6
6
  function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
@@ -31,10 +31,9 @@ export var PaginationCommonProps = {
31
31
  showQuickJumper: true,
32
32
  showTotal: showTotal
33
33
  };
34
- export var TableCellText = function TableCellText(text, cellWidth, maxTooltipWidth, maxTooltipHeight) {
34
+ export var TableCellText = function TableCellText(text, maxTooltipWidth, maxTooltipHeight) {
35
35
  var val = text || text === 0 ? text : '-';
36
36
  if (val === '-') return '-';
37
- var _maxWidth = maxTooltipWidth || cellWidth + 100;
38
37
  return /*#__PURE__*/_jsx(Typography.Text, {
39
38
  ellipsis: {
40
39
  tooltip: {
@@ -44,7 +43,7 @@ export var TableCellText = function TableCellText(text, cellWidth, maxTooltipWid
44
43
  styles: {
45
44
  body: {
46
45
  color: '#000',
47
- width: _maxWidth,
46
+ width: maxTooltipWidth,
48
47
  lineHeight: '22px',
49
48
  maxHeight: maxTooltipHeight,
50
49
  overflow: 'auto',
@@ -53,42 +52,42 @@ export var TableCellText = function TableCellText(text, cellWidth, maxTooltipWid
53
52
  }
54
53
  }
55
54
  },
56
- style: {
57
- maxWidth: cellWidth
58
- },
59
55
  children: val
60
56
  });
61
57
  };
62
58
  export default function (props) {
63
59
  var columns = props.columns,
64
60
  pagination = props.pagination,
65
- _props$maxCellWidth = props.maxCellWidth,
66
- maxCellWidth = _props$maxCellWidth === void 0 ? 230 : _props$maxCellWidth,
67
61
  maxTooltipWidth = props.maxTooltipWidth,
68
62
  _props$maxTooltipHeig = props.maxTooltipHeight,
69
63
  maxTooltipHeight = _props$maxTooltipHeig === void 0 ? 300 : _props$maxTooltipHeig,
64
+ scroll = props.scroll,
70
65
  rest = _objectWithoutProperties(props, _excluded);
71
66
  var _columns = columns === null || columns === void 0 ? void 0 : columns.map(function (item) {
72
- var longTextWidth = item.longTextWidth,
73
- _maxTooltipWidth = item.maxTooltipWidth,
74
- _maxTooltipHeight = item.maxTooltipHeight,
67
+ var width = item.width,
68
+ col_maxTooltipWidth = item.maxTooltipWidth,
69
+ col_maxTooltipHeight = item.maxTooltipHeight,
75
70
  rest = _objectWithoutProperties(item, _excluded2);
76
71
  return _objectSpread(_objectSpread({}, rest), {}, {
72
+ width: width,
77
73
  ellipsis: false,
78
74
  render: function render(val, record, index) {
79
75
  var renderVal = item.render ? item.render(val, record, index) : val;
80
- return /*#__PURE__*/isValidElement(renderVal) ? renderVal : TableCellText(renderVal, longTextWidth || maxCellWidth, _maxTooltipWidth || maxTooltipWidth, _maxTooltipHeight || maxTooltipHeight);
76
+ return /*#__PURE__*/isValidElement(renderVal) ? renderVal : TableCellText(renderVal, col_maxTooltipWidth || maxTooltipWidth || width + 100, col_maxTooltipHeight || maxTooltipHeight);
81
77
  }
82
78
  });
83
79
  });
80
+ var _scroll = _objectSpread(_objectSpread({}, scroll || {}), {}, {
81
+ x: scroll !== null && scroll !== void 0 && scroll.x ? scroll === null || scroll === void 0 ? void 0 : scroll.x : _columns === null || _columns === void 0 ? void 0 : _columns.reduce(function (sum, cur) {
82
+ return sum + (cur.width || 230);
83
+ }, 0)
84
+ });
84
85
  return /*#__PURE__*/_jsx(Table, _objectSpread(_objectSpread({
85
86
  rowKey: "id",
86
- scroll: {
87
- x: 'max-content'
88
- },
89
87
  columns: _columns,
90
88
  pagination: pagination ? _objectSpread(_objectSpread({}, PaginationCommonProps), pagination) : pagination
91
89
  }, rest), {}, {
90
+ scroll: _scroll,
92
91
  rowClassName: function rowClassName(record, index, indent) {
93
92
  var _props$rowClassName;
94
93
  var origin = typeof (props === null || props === void 0 ? void 0 : props.rowClassName) === 'string' ? props === null || props === void 0 ? void 0 : props.rowClassName : props === null || props === void 0 || (_props$rowClassName = props.rowClassName) === null || _props$rowClassName === void 0 ? void 0 : _props$rowClassName.call(props, record, index, indent);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ebaoferc",
3
- "version": "1.0.8",
3
+ "version": "2.0.1",
4
4
  "description": "A react library developed with dumi",
5
5
  "module": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -61,6 +61,7 @@
61
61
  "@vitest/coverage-v8": "^0.34.6",
62
62
  "ahooks": "^3.7.10",
63
63
  "antd": "^5.24.7",
64
+ "child_process": "^1.0.2",
64
65
  "classnames": "^2.5.1",
65
66
  "connect-history-api-fallback": "^2.0.0",
66
67
  "cross-env": "^7.0.3",
@@ -69,9 +70,11 @@
69
70
  "eslint": "^8.23.0",
70
71
  "express": "^4.19.2",
71
72
  "father": "^4.1.0",
73
+ "fs-extra": "^11.3.2",
72
74
  "husky": "^8.0.1",
73
75
  "lint-staged": "^13.0.3",
74
76
  "lodash": "^4.17.21",
77
+ "path": "^0.12.7",
75
78
  "prettier": "^2.7.1",
76
79
  "prettier-plugin-organize-imports": "^3.0.0",
77
80
  "prettier-plugin-packagejson": "^2.2.18",