hc-busin-components 1.0.1 → 1.0.3

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,5 +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", "search", "fieldNames", "placeholder", "border", "prefixIcon", "addonBefore", "addonAfter", "request", "values", "setValues", "setting", "refresh", "topNode", "defaultAfterChange", "defaultSelectKey"];
2
+ var _excluded = ["columns", "search", "fieldNames", "placeholder", "border", "prefixIcon", "addonBefore", "addonAfter", "request", "values", "setValues", "setting", "refresh", "topNode", "defaultAfterChange", "defaultSelectKey", "pagination"],
3
+ _excluded2 = ["onChange", "className", "plain"];
3
4
  function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
4
5
  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; }
5
6
  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; }
@@ -19,6 +20,13 @@ import React, { useEffect, useMemo, useState } from 'react';
19
20
  import CombineSearch from "../CombineSearch";
20
21
  import Icon from "../Icon";
21
22
  import RenderContent from "./components/RenderContent";
23
+ import { useCombinTableStyles } from "./styles";
24
+ var DEFAULT_PAGINATION = {
25
+ hideOnSinglePage: false,
26
+ showSizeChanger: true,
27
+ showQuickJumper: true,
28
+ pageSize: 10
29
+ };
22
30
  var CombinTable = function CombinTable(props) {
23
31
  var columns = props.columns,
24
32
  _props$search = props.search,
@@ -43,7 +51,11 @@ var CombinTable = function CombinTable(props) {
43
51
  topNode = props.topNode,
44
52
  defaultAfterChange = props.defaultAfterChange,
45
53
  defaultSelectKey = props.defaultSelectKey,
54
+ paginationProp = props.pagination,
46
55
  tableProps = _objectWithoutProperties(props, _excluded);
56
+ var _useCombinTableStyles = useCombinTableStyles(),
57
+ styles = _useCombinTableStyles.styles,
58
+ cx = _useCombinTableStyles.cx;
47
59
  var SearchProps = {
48
60
  fieldNames: fieldNames,
49
61
  placeholder: placeholder,
@@ -171,6 +183,22 @@ var CombinTable = function CombinTable(props) {
171
183
  }
172
184
  return doms;
173
185
  }, [setting, refresh, values, search, request]);
186
+ var paginationConfig = useMemo(function () {
187
+ if (paginationProp === false) {
188
+ return false;
189
+ }
190
+ var userPagination = paginationProp === undefined ? DEFAULT_PAGINATION : paginationProp;
191
+ var userOnChange = userPagination.onChange,
192
+ className = userPagination.className,
193
+ plain = userPagination.plain,
194
+ restPagination = _objectWithoutProperties(userPagination, _excluded2);
195
+ return _objectSpread(_objectSpread({}, restPagination), {}, {
196
+ className: cx(!plain && styles.paginationHighlight, className),
197
+ onChange: function onChange(page, size) {
198
+ userOnChange === null || userOnChange === void 0 || userOnChange(page, size, values);
199
+ }
200
+ });
201
+ }, [paginationProp, values, styles.paginationHighlight, cx]);
174
202
 
175
203
  // 获取表头筛选项
176
204
  useEffect(function () {
@@ -201,13 +229,7 @@ var CombinTable = function CombinTable(props) {
201
229
  }, topNode) : null, /*#__PURE__*/React.createElement(Table, _extends({
202
230
  columns: resetColumns
203
231
  }, tableProps, {
204
- pagination: _objectSpread(_objectSpread({}, tableProps.pagination), {}, {
205
- onChange: function onChange(page, size) {
206
- if (tableProps !== null && tableProps !== void 0 && tableProps.pagination && tableProps !== null && tableProps !== void 0 && tableProps.pagination.onChange) {
207
- tableProps === null || tableProps === void 0 || tableProps.pagination.onChange(page, size, values);
208
- }
209
- }
210
- })
232
+ pagination: paginationConfig
211
233
  })), /*#__PURE__*/React.createElement(Modal, {
212
234
  title: localStorage.getItem('i18nextLng') === 'en-US' || localStorage.getItem('language') === 'en-US' ? 'Table Header Setting' : '表头设置',
213
235
  destroyOnClose: true,
@@ -1,3 +1,9 @@
1
+ export declare const useCombinTableStyles: (props?: unknown) => import("antd-style").ReturnStyles<{
2
+ container: import("antd-style").SerializedStyles;
3
+ paginationHighlight: import("antd-style").SerializedStyles;
4
+ }>;
5
+ /** @deprecated 使用 useCombinTableStyles */
1
6
  export declare const useFilterStyles: (props?: unknown) => import("antd-style").ReturnStyles<{
2
7
  container: import("antd-style").SerializedStyles;
8
+ paginationHighlight: import("antd-style").SerializedStyles;
3
9
  }>;
@@ -1,11 +1,15 @@
1
- var _templateObject;
1
+ var _templateObject, _templateObject2;
2
2
  function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
3
- import { createStyles } from "antd-style";
4
- export var useFilterStyles = createStyles(function (_ref) {
3
+ import { createStyles } from 'antd-style';
4
+ export var useCombinTableStyles = createStyles(function (_ref) {
5
5
  var prefixCls = _ref.prefixCls,
6
6
  token = _ref.token,
7
7
  css = _ref.css;
8
8
  return {
9
- container: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n /* transform: translateY(); */\n "])))
9
+ container: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n /* transform: translateY(); */\n "]))),
10
+ paginationHighlight: css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n .", "-pagination-item:not(.", "-pagination-item-active):hover {\n border-color: ", ";\n background: ", ";\n\n a {\n color: ", ";\n }\n }\n\n .", "-pagination-item-active {\n border-color: ", ";\n background: ", ";\n\n a {\n color: #fff;\n }\n\n &:hover {\n border-color: ", ";\n background: ", ";\n\n a {\n color: #fff;\n }\n }\n }\n\n .", "-pagination-prev:hover .", "-pagination-item-link,\n .", "-pagination-next:hover .", "-pagination-item-link,\n .", "-pagination-jump-prev:hover .", "-pagination-item-link,\n .", "-pagination-jump-next:hover .", "-pagination-item-link {\n border-color: ", ";\n color: ", ";\n }\n "])), prefixCls, prefixCls, token.colorPrimary, token.colorPrimaryBg, token.colorPrimary, prefixCls, token.colorPrimary, token.colorPrimary, token.colorPrimaryHover, token.colorPrimaryHover, prefixCls, prefixCls, prefixCls, prefixCls, prefixCls, prefixCls, prefixCls, prefixCls, token.colorPrimary, token.colorPrimary)
10
11
  };
11
- });
12
+ });
13
+
14
+ /** @deprecated 使用 useCombinTableStyles */
15
+ export var useFilterStyles = useCombinTableStyles;
@@ -3,13 +3,16 @@ import { GetProp, GetProps, Table, TablePaginationConfig } from 'antd';
3
3
  import ComBineSearchProps, { CombineOptionsType } from "../../CombineSearch/types";
4
4
  type TableProps = GetProps<typeof Table>;
5
5
  type column = GetProp<typeof Table, 'columns'>[number];
6
- type pagination = false | Omit<TablePaginationConfig, 'onChange'>;
6
+ export type CombinTablePaginationConfig = Omit<TablePaginationConfig, 'onChange'> & {
7
+ /** 朴素分页风格;`true` 为 antd 默认样式,不传或为 `false` 时高亮当前页 */
8
+ plain?: boolean;
9
+ onChange?: (page: number, size: number, values: Record<string, any>) => void;
10
+ };
11
+ type pagination = false | CombinTablePaginationConfig;
7
12
  export type ColumnProps = column & CombineOptionsType;
8
13
  interface AntTableProps extends Omit<TableProps, 'columns' | 'pagination'> {
9
14
  columns?: ColumnProps[];
10
- pagination?: pagination & {
11
- onChange?: (page: number, size: number, values: Record<string, any>) => void;
12
- };
15
+ pagination?: pagination;
13
16
  setting?: boolean;
14
17
  refresh?: boolean;
15
18
  topNode?: React.ReactNode;
@@ -5,7 +5,7 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
5
5
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
6
6
  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); }
7
7
  /* eslint-disable no-case-declarations */
8
- import { CloseCircleOutlined } from '@ant-design/icons';
8
+
9
9
  import { Divider, Space, Tag } from 'antd';
10
10
  import React, { useCallback, useMemo } from 'react';
11
11
  import Icon from "../../Icon";
@@ -64,7 +64,11 @@ var CombineTags = function CombineTags(_ref) {
64
64
  },
65
65
  className: styles.currentTag,
66
66
  key: key,
67
- closeIcon: /*#__PURE__*/React.createElement(CloseCircleOutlined, null),
67
+ closeIcon: /*#__PURE__*/React.createElement("span", {
68
+ className: styles.closeIcon
69
+ }, /*#__PURE__*/React.createElement(Icon, {
70
+ name: "v35_Failure_Filled"
71
+ })),
68
72
  onClose: function onClose() {
69
73
  setCombineValues(function (values) {
70
74
  return JSON.parse(JSON.stringify(_objectSpread(_objectSpread({}, values), {}, _defineProperty({}, key, undefined))));
@@ -97,7 +101,11 @@ var CombineTags = function CombineTags(_ref) {
97
101
  style: {
98
102
  display: 'flex',
99
103
  alignItems: 'center',
100
- width: '50px'
104
+ width: '60px'
105
+ },
106
+ onClick: function onClick() {
107
+ setCombineValues({});
108
+ setCurrent('');
101
109
  }
102
110
  }, /*#__PURE__*/React.createElement(Divider, {
103
111
  type: "vertical"
@@ -105,11 +113,13 @@ var CombineTags = function CombineTags(_ref) {
105
113
  name: "v35_TrashCan",
106
114
  style: {
107
115
  cursor: 'pointer'
108
- },
109
- onClick: function onClick() {
110
- setCombineValues({});
111
- setCurrent('');
112
116
  }
113
- })) : null);
117
+ }), /*#__PURE__*/React.createElement("p", {
118
+ style: {
119
+ fontSize: '12px',
120
+ marginLeft: '4px',
121
+ cursor: 'pointer'
122
+ }
123
+ }, "\u6E05\u7A7A")) : null);
114
124
  };
115
125
  export default CombineTags;
@@ -11,4 +11,5 @@ export declare const useTagsStyles: (props?: unknown) => import("antd-style").Re
11
11
  label: import("antd-style").SerializedStyles;
12
12
  value: import("antd-style").SerializedStyles;
13
13
  currentTag: import("antd-style").SerializedStyles;
14
+ closeIcon: import("antd-style").SerializedStyles;
14
15
  }>;
@@ -1,4 +1,4 @@
1
- var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7;
1
+ var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8;
2
2
  function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
3
3
  import { createStyles } from "antd-style";
4
4
  import edit from "./edit.svg";
@@ -8,7 +8,7 @@ export var useCombineBoxStyles = createStyles(function (_ref, props) {
8
8
  token = _ref.token,
9
9
  stylish = _ref.stylish;
10
10
  return {
11
- card: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n border-radius: ", "px;\n min-width: 300px;\n background-color: #f7f7f7;\n border: ", ";\n .icon-span {\n width: 28px;\n min-width: 28px;\n display: flex;\n justify-content: end;\n align-items: center;\n transform: translateX(5px)\n }\n .select-no-padding {\n .", "-select-selector {\n padding: 0 0 0 12px !important\n }\n }\n "])), token.borderRadius, props.focus ? "1px solid ".concat(token.colorPrimary) : "1px solid ".concat(props.border ? token.colorBorder : 'transparent'), prefixCls),
11
+ card: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n border-radius: ", "px;\n min-width: 300px;\n background-color: #f7f7f7;\n border: ", ";\n .icon-span {\n width: 28px;\n min-width: 28px;\n display: flex;\n justify-content: center;\n align-items: center;\n .hc-icon {\n transform: translateX(2px)\n }\n }\n .select-no-padding {\n .", "-select-selector {\n padding: 0px !important\n }\n }\n "])), token.borderRadius, props.focus ? "1px solid ".concat(token.colorPrimary) : "1px solid ".concat(props.border ? token.colorBorder : 'transparent'), prefixCls),
12
12
  box: css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n width: 100%;\n display: flex;\n gap: 8px;\n align-items: center;\n justify-content: space-between;\n "]))),
13
13
  left: css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n width: 100%;\n display: flex;\n gap: 8px;\n align-items: center;\n flex-wrap: wrap;\n "]))),
14
14
  right: css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n display: flex;\n gap: 2px;\n align-items: center;\n "])))
@@ -21,6 +21,7 @@ export var useTagsStyles = createStyles(function (_ref2) {
21
21
  return {
22
22
  label: css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n color: rgba(0, 0, 0, 0.3);\n cursor: url(", "), pointer;\n "])), edit),
23
23
  value: css(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n color: rgba(89, 89, 89, 1);\n padding-right: 12px;\n overflow: hidden;\n cursor: url(", "), pointer;\n "])), edit),
24
- currentTag: css(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n max-width: 350px;\n overflow: hidden;\n "])))
24
+ currentTag: css(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n max-width: 350px;\n background-color: #f4f4f4;\n border-color: #E0E0E0;\n display: flex;\n align-items: center;\n justify-content: center;\n "]))),
25
+ closeIcon: css(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["\n display: inline-flex;\n align-items: center;\n justify-content: center;\n line-height: 0;\n font-size: 12px;\n\n /* Icon \u4E3A 1em\uFF0C\u9700\u76F4\u63A5\u6539 svg \u5C3A\u5BF8 */\n .hc-icon {\n width: 12px;\n height: 12px;\n font-size: 12px;\n vertical-align: middle;\n }\n "])))
25
26
  };
26
27
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hc-busin-components",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "description": "",
5
5
  "module": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -57,11 +57,30 @@
57
57
  "react": ">=16.9.0",
58
58
  "react-dom": ">=16.9.0"
59
59
  },
60
+ "dependencies": {
61
+ "@ant-design/plots": "^1.0.9",
62
+ "@codemirror/lang-javascript": "^6.2.3",
63
+ "@codemirror/lang-yaml": "^6.1.2",
64
+ "@codemirror/language": "^6.11.0",
65
+ "@codemirror/state": "^6.5.2",
66
+ "@codemirror/view": "^6.36.5",
67
+ "@lezer/highlight": "^1.2.1",
68
+ "@uiw/react-codemirror": "^4.23.10",
69
+ "antd-style": "^3.7.1",
70
+ "copy-to-clipboard": "^3.3.3",
71
+ "js-yaml": "^4.1.0",
72
+ "lodash": "^4.17.21",
73
+ "moment": "^2.30.1",
74
+ "rc-calendar": "^9.15.11",
75
+ "rc-time-picker": "^3.7.3",
76
+ "xterm": "^4.19.0",
77
+ "xterm-addon-fit": "^0.5.0",
78
+ "yaml": "^1.10.2"
79
+ },
60
80
  "devDependencies": {
61
81
  "@ant-design/compatible": "^5.1.3",
62
82
  "@ant-design/happy-work-theme": "^1.0.0",
63
83
  "@ant-design/icons": "^5.5.2",
64
- "@ant-design/plots": "^1.0.9",
65
84
  "@codesandbox/sandpack-react": "^2.19.10",
66
85
  "@commitlint/cli": "^17.1.2",
67
86
  "@commitlint/config-conventional": "^17.1.0",
@@ -76,11 +95,9 @@
76
95
  "@types/react-dom": "^18.0.0",
77
96
  "@umijs/lint": "^4.0.0",
78
97
  "antd": "^5.24.3",
79
- "antd-style": "^3.7.1",
80
98
  "antd-token-previewer": "^2.0.8",
81
99
  "classnames": "^2.5.1",
82
100
  "cross-fetch": "^4.0.0",
83
- "dayjs": "^1.11.13",
84
101
  "dumi": "^2.3.0",
85
102
  "eslint": "^8.23.0",
86
103
  "eslint-plugin-unicorn": "^56.0.1",
@@ -88,7 +105,6 @@
88
105
  "husky": "^8.0.1",
89
106
  "jsonml-to-react-element": "^1.1.11",
90
107
  "lint-staged": "^13.0.3",
91
- "lodash": "^4.17.21",
92
108
  "prettier": "^2.7.1",
93
109
  "prettier-plugin-organize-imports": "^3.0.0",
94
110
  "prettier-plugin-packagejson": "^2.2.18",
@@ -100,22 +116,6 @@
100
116
  "styled-components": "^6.1.15",
101
117
  "stylelint": "^14.9.1",
102
118
  "sylvanas": "^0.6.1",
103
- "vanilla-tilt": "^1.8.1",
104
- "@codemirror/lang-javascript": "^6.2.3",
105
- "@codemirror/lang-yaml": "^6.1.2",
106
- "@codemirror/language": "^6.11.0",
107
- "@codemirror/state": "^6.5.2",
108
- "@codemirror/view": "^6.36.5",
109
- "@lezer/highlight": "^1.2.1",
110
- "@uiw/react-codemirror": "^4.23.10",
111
- "copy-to-clipboard": "^3.3.3",
112
- "js-yaml": "^4.1.0",
113
- "moment": "^2.30.1",
114
- "rc-calendar": "^9.15.11",
115
- "rc-time-picker": "^3.7.3",
116
- "xterm": "^4.19.0",
117
- "xterm-addon-fit": "^0.5.0",
118
- "yaml": "^1.10.2"
119
- },
120
- "dependencies": {}
119
+ "vanilla-tilt": "^1.8.1"
120
+ }
121
121
  }