@aloudata/aloudata-design 2.1.0 → 2.3.0

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,104 +1,147 @@
1
+ /* stylelint-disable selector-class-pattern */
2
+
1
3
  @import '../../style/index.less';
4
+ // @import '~@szhsin/react-menu/dist/index.css';
5
+ // @import '~@szhsin/react-menu/dist/transitions/slide.css';
6
+
7
+ @menu-item-horizontal-padding: 12px;
8
+ @menu-width: 168px + 2 * @menu-item-horizontal-padding;
9
+ @max-menu-width: 300px;
2
10
 
3
- // Menu 和子menu的 ul样式
4
- .menu-content {
11
+ .menuContainerStyle {
12
+ display: flex;
13
+ padding: var(--alias-padding-50minus1, 4px) 0;
14
+ flex-direction: column;
15
+ align-items: flex-start;
16
+ align-self: stretch;
17
+ border-radius: var(--alias-radius-75, 6px);
18
+ border: 1px solid var(--alias-colors-border-strong, #d1d5db);
5
19
  background: var(--alias-colors-bg-skeleton-subtler, #fff);
6
- border-radius: 0;
7
- box-shadow: none;
8
- padding: 0;
20
+ box-shadow: 0 10px 18px -2px #00000014;
21
+ min-width: @menu-width;
22
+ max-width: @max-menu-width;
23
+ z-index: 999;
24
+ }
25
+
26
+ .ald-menu {
27
+ position: relative !important;
9
28
 
10
- .ant-menu-item-divider,
11
- .ant-menu-submenu-title-divider {
12
- background-color: var(--alias-colors-border-subtle, #f3f4f6);
29
+ ul,
30
+ li {
31
+ list-style: none;
13
32
  margin: 0;
33
+ box-sizing: border-box;
14
34
  }
15
35
 
16
- .ant-menu-item-selected {
17
- background-color: unset;
36
+ & > .szh-menu {
37
+ position: relative !important;
38
+ top: auto !important;
39
+ left: auto !important;
18
40
  }
19
41
 
20
- // menu项样式
21
- .ant-menu-item,
22
- .ant-menu-submenu .ant-menu-submenu-title {
42
+ .szh-menu {
43
+ .menuContainerStyle();
44
+ }
45
+
46
+ .szh-menu__item {
23
47
  display: flex;
48
+ padding: var(--alias-padding-100minus1, 8px) var(--alias-padding-150, 12px)
49
+ var(--alias-padding-100, 8px) var(--alias-padding-150, 12px);
24
50
  align-items: center;
25
- justify-content: space-between;
26
- padding: var(--alias-padding-100, 8px) var(--alias-padding-150, 12px);
27
- color: var(--alias-colors-text-default, #1f2937);
28
- font-size: 14px;
29
- font-style: normal;
30
- font-weight: 400;
51
+ gap: var(--alias-spacing-75, 6px);
52
+ align-self: stretch;
53
+ background: var(--alias-colors-bg-transp, rgba(0, 0, 0, 0));
54
+ width: 100%;
31
55
  line-height: 20px;
32
- height: auto;
33
- margin: 0;
34
- width: auto;
35
- gap: var(--alias-spacing-50, 4px);
36
- border-radius: 0;
56
+ max-width: @max-menu-width;
57
+ cursor: pointer;
58
+ }
37
59
 
38
- &:hover {
39
- background-color: unset;
40
- }
60
+ .szh-menu__item--hover {
61
+ background: var(--alias-colors-bg-interaction-hover, rgba(0, 0, 0, 0.05));
62
+ }
41
63
 
42
- .ant-dropdown-menu-item-icon {
43
- font-size: 20px;
44
- margin: 0;
45
- }
64
+ .szh-menu__submenu {
65
+ width: 100%;
66
+ }
67
+
68
+ .szh-menu__item--disabled {
69
+ color: var(--alias-colors-text-disabled, rgba(0, 0, 0, 0.25));
70
+ cursor: default;
46
71
 
47
- .ant-menu-title-content.ant-menu-title-content {
48
- text-overflow: ellipsis;
49
- overflow: hidden;
50
- white-space: nowrap;
51
- margin-left: 0;
52
- flex: 1;
72
+ .ald-menu-item-label-icon,
73
+ &.ald-menu-item-selected {
74
+ color: var(--alias-colors-text-disabled, rgba(0, 0, 0, 0.25));
53
75
  }
76
+ }
54
77
 
55
- svg {
56
- flex-shrink: 0;
78
+ .szh-menu__divider {
79
+ width: 100%;
80
+ height: 0;
81
+ position: relative;
82
+ padding: 4px 0;
83
+
84
+ &::after {
85
+ content: '';
86
+ display: block;
87
+ position: absolute;
88
+ top: 50%;
89
+ left: 0;
90
+ right: 0;
91
+ height: 1px;
92
+ background: var(--alias-colors-border-subtle, #f3f4f6);
57
93
  }
58
94
  }
59
95
 
60
- .ant-menu-submenu {
61
- border-radius: 0;
96
+ .ald-menu-item-danger {
97
+ color: #b91c1c;
62
98
  }
63
99
 
64
- .ant-menu-item.ant-menu-item-disabled {
65
- cursor: default;
66
- color: var(--alias-colors-text-disabled, rgba(0, 0, 0, 0.25));
100
+ .ald-menu-item-label {
101
+ display: flex;
102
+ width: 100%;
103
+ gap: var(--alias-spacing-75, 6px);
104
+ justify-content: space-between;
105
+ }
67
106
 
68
- &:hover {
69
- background-color: var(--alias-colors-bg-transp, rgba(0, 0, 0, 0));
70
- }
107
+ .ald-menu-item-label-icon {
108
+ flex: 0 0 auto;
71
109
  }
72
110
 
73
- .ant-menu-item:hover,
74
- .ant-menu-submenu:hover,
75
- .ant-menu-submenu.ant-menu-submenu-active {
76
- background-color: var(
77
- --alias-colors-bg-interaction-hover,
78
- rgba(0, 0, 0, 0.05)
79
- );
111
+ .ald-menu-item-label-text {
112
+ flex: 1 1 auto;
113
+ overflow: hidden;
114
+ text-overflow: ellipsis;
115
+ white-space: nowrap;
80
116
  }
81
- }
82
117
 
83
- // 容器样式
84
- .menu-wrap {
85
- border: 1px solid var(--alias-colors-border-strong, #d1d5db);
86
- border-radius: var(--alias-radius-75, 6px);
87
- box-shadow: 0 10px 18px -2px rgba(0, 0, 0, 0.08);
88
- overflow: hidden;
89
- padding: 2px 0;
90
- }
118
+ .ald-menu-item-right {
119
+ flex: 0 0 auto;
120
+ display: flex;
121
+ align-items: center;
122
+ color: #9ca3af;
123
+ gap: var(--alias-spacing-75, 6px);
124
+ }
91
125
 
92
- // menu菜单
93
- .ant-menu-root.ant-menu {
94
- border: none !important;
95
- .menu-content();
96
- }
126
+ .ald-menu-item-selected {
127
+ color: #126fdd;
128
+ }
129
+
130
+ .ald-menu-item-selected-icon {
131
+ display: flex;
132
+ align-items: center;
133
+ }
97
134
 
98
- .ant-menu-submenu.ant-menu-submenu-popup {
99
- .menu-wrap();
100
- // 二级菜单中的ul
101
- .ant-menu-sub {
102
- .menu-content();
135
+ .ald-menu-submenu-popup {
136
+ transform: translateY(-4px);
137
+ }
138
+
139
+ .szh-menu__header {
140
+ padding: var(--alias-padding-100, 8px) var(--alias-padding-150, 12px)
141
+ var(--alias-padding-50, 4px) var(--alias-padding-150, 12px);
142
+ color: var(--alias-colors-text-subtlest, #9ca3af);
143
+ line-height: 16px;
144
+ font-size: 12px;
145
+ cursor: default;
103
146
  }
104
147
  }
@@ -369,11 +369,8 @@ var Select = /*#__PURE__*/forwardRef(function (props, ref) {
369
369
  var classList = target.classList;
370
370
  if (classList.contains('ant-select')) {
371
371
  if (classList.contains('ant-select-focused')) {
372
- console.log(222, JSON.stringify(classList));
373
372
  setIsFocus(true);
374
373
  } else {
375
- console.log(111);
376
- console.log(JSON.stringify(classList));
377
374
  setIsFocus(false);
378
375
  }
379
376
  }
@@ -5,7 +5,9 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
5
5
  function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
6
6
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
7
7
  import { Switch as AntdSwitch } from 'antd';
8
+ import { getMergedStatus, getStatusClassNames } from 'antd/lib/_util/statusUtils';
8
9
  import DisabledContext from 'antd/lib/config-provider/DisabledContext';
10
+ import { FormItemInputContext } from 'antd/lib/form/context';
9
11
  import classnames from 'classnames';
10
12
  import React, { useContext, useEffect, useState } from 'react';
11
13
  import SizeContext from "../ConfigProvider/sizeContext";
@@ -31,6 +33,9 @@ var Switch = function Switch(_ref) {
31
33
  // ===================== Disabled =====================
32
34
  var disabled = React.useContext(DisabledContext);
33
35
  var mergedDisabled = customDisabled !== null && customDisabled !== void 0 ? customDisabled : disabled;
36
+ var _useContext = useContext(FormItemInputContext),
37
+ contextStatus = _useContext.status;
38
+ var mergedStatus = getMergedStatus(contextStatus);
34
39
  var onChangeCB = function onChangeCB(isChecked, event) {
35
40
  if (checked === undefined) {
36
41
  setUserChecked(isChecked);
@@ -47,7 +52,7 @@ var Switch = function Switch(_ref) {
47
52
  className: classnames(className, 'ald-switch', "ald-switch-".concat(size), {
48
53
  'ald-switch-disabled': currentDisabled,
49
54
  'ald-switch-checked': userChecked
50
- })
55
+ }, getStatusClassNames('ald-switch', mergedStatus))
51
56
  }, /*#__PURE__*/React.createElement(AntdSwitch, {
52
57
  disabled: currentDisabled,
53
58
  loading: loading,
@@ -1,4 +1,5 @@
1
1
  @import '../../style/index.less';
2
+ @import './status.less';
2
3
 
3
4
  @switch-btn-width-large: 36px;
4
5
  @switch-btn-height-large: 20px;
@@ -0,0 +1,12 @@
1
+ .ald-switch.ald-switch.ald-switch-status {
2
+ &-error {
3
+ .ald-switch-btn:not(.ant-switch-checked) {
4
+ box-shadow: 0 0 0 1px var(--alias-colors-icon-inverse-default, #fff),
5
+ 0 0 0 2.5px var(--alias-color-icon-danger, #ef4444);
6
+ }
7
+
8
+ .ald-switch-btn.ant-switch-checked {
9
+ background-color: var(--alias-color-icon-danger, #ef4444);
10
+ }
11
+ }
12
+ }
@@ -1,6 +1,6 @@
1
1
  import { Column, Row } from '@tanstack/react-table';
2
2
  import React from 'react';
3
- export default function Cell<T>(props: IProps<T>): React.JSX.Element;
3
+ export default function CellWithErrorBoundary<T>(props: IProps<T>): React.JSX.Element;
4
4
  export interface IProps<T> {
5
5
  row: Row<T>;
6
6
  column: Column<T>;
@@ -1,8 +1,9 @@
1
1
  import classnames from 'classnames';
2
2
  import _ from 'lodash';
3
- import React from 'react';
3
+ import React, { useCallback } from 'react';
4
4
  import { prefixCls } from "../helper";
5
- export default function Cell(props) {
5
+ import ErrorBoundary from "./ErrorBoundary";
6
+ function Cell(props) {
6
7
  var column = props.column,
7
8
  row = props.row;
8
9
  var meta = column.columnDef.meta;
@@ -17,4 +18,25 @@ export default function Cell(props) {
17
18
  }, ellipsis ? /*#__PURE__*/React.createElement("div", {
18
19
  className: prefixCls('td-ellipsis-content')
19
20
  }, node) : node);
21
+ }
22
+ export default function CellWithErrorBoundary(props) {
23
+ var column = props.column;
24
+ var meta = column.columnDef.meta;
25
+ var dataIndex = meta.dataIndex,
26
+ onError = meta.onError;
27
+ var reportError = useCallback(function (err, stack) {
28
+ if (onError) {
29
+ onError({
30
+ error: err,
31
+ stack: stack,
32
+ extra: {
33
+ place: 'bodyCell',
34
+ dataIndex: dataIndex
35
+ }
36
+ });
37
+ }
38
+ }, [onError, dataIndex]);
39
+ return /*#__PURE__*/React.createElement(ErrorBoundary, {
40
+ onError: reportError
41
+ }, /*#__PURE__*/React.createElement(Cell, props));
20
42
  }
@@ -0,0 +1,15 @@
1
+ import React, { ReactNode } from 'react';
2
+ interface ErrorBoundaryProps {
3
+ children: ReactNode;
4
+ onError: (error: Error, stack: string) => void;
5
+ }
6
+ interface ErrorBoundaryState {
7
+ hasError: boolean;
8
+ }
9
+ export default class ErrorBoundary extends React.Component<ErrorBoundaryProps, ErrorBoundaryState> {
10
+ constructor(props: ErrorBoundaryProps);
11
+ static getDerivedStateFromError(): ErrorBoundaryState;
12
+ componentDidCatch(error: Error, info: React.ErrorInfo): void;
13
+ render(): ReactNode;
14
+ }
15
+ export {};
@@ -0,0 +1,56 @@
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
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
3
+ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
4
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
5
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
6
+ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
7
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
8
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
9
+ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
10
+ function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
11
+ function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
12
+ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
13
+ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
14
+ import React from 'react';
15
+ import { prefixCls } from "../helper";
16
+ var ErrorBoundary = /*#__PURE__*/function (_React$Component) {
17
+ _inherits(ErrorBoundary, _React$Component);
18
+ var _super = _createSuper(ErrorBoundary);
19
+ function ErrorBoundary(props) {
20
+ var _this;
21
+ _classCallCheck(this, ErrorBoundary);
22
+ _this = _super.call(this, props);
23
+ _this.state = {
24
+ hasError: false
25
+ };
26
+ return _this;
27
+ }
28
+ _createClass(ErrorBoundary, [{
29
+ key: "componentDidCatch",
30
+ value: function componentDidCatch(error, info) {
31
+ // 在这里上报错误信息
32
+ this.props.onError(error, info.componentStack);
33
+ }
34
+ }, {
35
+ key: "render",
36
+ value: function render() {
37
+ if (this.state.hasError) {
38
+ // 你可以渲染任何自定义后备 UI
39
+ return /*#__PURE__*/React.createElement("div", {
40
+ className: prefixCls('td-default')
41
+ }, "\u53D1\u751F\u4E86\u9519\u8BEF");
42
+ }
43
+ return this.props.children;
44
+ }
45
+ }], [{
46
+ key: "getDerivedStateFromError",
47
+ value: function getDerivedStateFromError() {
48
+ // 更新状态,以便下一次渲染将显示后备 UI。
49
+ return {
50
+ hasError: true
51
+ };
52
+ }
53
+ }]);
54
+ return ErrorBoundary;
55
+ }(React.Component);
56
+ export { ErrorBoundary as default };
@@ -1,18 +1,28 @@
1
1
  /// <reference types="react" />
2
- import { ITableColumn } from './types';
3
- export declare function getTableColumns<TDataItem extends object>({ columns, columnSizing, totalWidth, }: {
2
+ import { ITableColumn, ITableProps } from './types';
3
+ export declare function getTableColumns<TDataItem extends object>({ columns, columnSizing, totalWidth, onError, }: {
4
4
  columns: ITableColumn<TDataItem>[];
5
5
  columnSizing: boolean;
6
6
  totalWidth: number;
7
+ onError: ITableProps<TDataItem>['onError'];
7
8
  }): {
8
9
  accessorKey: string;
9
10
  header: (props: import("./components/Header").IProps<TDataItem>) => import("react").JSX.Element;
10
11
  cell: (props: import("./components/Cell").IProps<TDataItem>) => import("react").JSX.Element;
11
12
  size: number;
12
- meta: ITableColumn<TDataItem>;
13
+ meta: {
14
+ onError: ((errorInfo: import("./types").ITableCellErrorInfo) => void) | undefined;
15
+ title: import("react").ReactNode;
16
+ dataIndex?: string | undefined;
17
+ width?: string | number | undefined;
18
+ render?: ((text: any, record: TDataItem, rowIndex: number) => import("react").ReactNode) | undefined;
19
+ ellipsis?: boolean | undefined;
20
+ noPadding?: boolean | undefined;
21
+ align?: "center" | "left" | "right" | undefined;
22
+ };
13
23
  }[];
14
24
  /**
15
- * 计算
25
+ * 计算列宽
16
26
  * @param columns
17
27
  * @param columnSizing
18
28
  * @param totalWidth
@@ -1,10 +1,17 @@
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
+ 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; }
3
+ 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; }
4
+ 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; }
5
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
6
+ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
1
7
  import _ from 'lodash';
2
8
  import Cell from "./components/Cell";
3
9
  import Header from "./components/Header";
4
10
  export function getTableColumns(_ref) {
5
11
  var columns = _ref.columns,
6
12
  columnSizing = _ref.columnSizing,
7
- totalWidth = _ref.totalWidth;
13
+ totalWidth = _ref.totalWidth,
14
+ onError = _ref.onError;
8
15
  var columnWidths = getColumnWidths(columns, columnSizing, totalWidth);
9
16
  return _.map(columns, function (col, index) {
10
17
  return {
@@ -13,13 +20,15 @@ export function getTableColumns(_ref) {
13
20
  header: Header,
14
21
  cell: Cell,
15
22
  size: columnWidths[index],
16
- meta: col
23
+ meta: _objectSpread(_objectSpread({}, col), {}, {
24
+ onError: onError
25
+ })
17
26
  };
18
27
  });
19
28
  }
20
29
 
21
30
  /**
22
- * 计算
31
+ * 计算列宽
23
32
  * @param columns
24
33
  * @param columnSizing
25
34
  * @param totalWidth
@@ -35,7 +35,8 @@ function Table(props, ref) {
35
35
  rowClassName = _props$rowClassName === void 0 ? function () {
36
36
  return '';
37
37
  } : _props$rowClassName,
38
- onRowClick = props.onRowClick;
38
+ onRowClick = props.onRowClick,
39
+ onError = props.onError;
39
40
  var _useState = useState(null),
40
41
  _useState2 = _slicedToArray(_useState, 2),
41
42
  totalSize = _useState2[0],
@@ -67,9 +68,10 @@ function Table(props, ref) {
67
68
  return getTableColumns({
68
69
  columns: columns,
69
70
  columnSizing: !!columnSizing,
70
- totalWidth: realWidth
71
+ totalWidth: realWidth,
72
+ onError: onError
71
73
  });
72
- }, [columns, totalSize, columnSizing, realWidth]);
74
+ }, [columns, totalSize, columnSizing, realWidth, onError]);
73
75
  var tableInstance = useReactTable({
74
76
  columns: tableColumns,
75
77
  data: data,
@@ -134,8 +136,7 @@ function Table(props, ref) {
134
136
 
135
137
  // 渲染 body
136
138
  var bodyContent = /*#__PURE__*/React.createElement(Spin, {
137
- spinning: !!loading,
138
- tip: "Loading..."
139
+ spinning: !!loading
139
140
  }, /*#__PURE__*/React.createElement("div", {
140
141
  className: prefixCls('body'),
141
142
  style: {
@@ -144,7 +145,6 @@ function Table(props, ref) {
144
145
  }, rows.length === 0 && !loading ? emptyComponent || /*#__PURE__*/React.createElement("div", {
145
146
  className: prefixCls('empty')
146
147
  }, /*#__PURE__*/React.createElement(Empty, {
147
- title: "No Data",
148
148
  image: Empty.PRESENTED_IMAGE_SEARCH
149
149
  })) : _.map(rows, function (row, rowIndex) {
150
150
  return /*#__PURE__*/React.createElement("div", {
@@ -14,6 +14,14 @@ export interface ITableProps<TDataItem extends object> {
14
14
  empty?: React.ReactNode;
15
15
  rowClassName?: (record: TDataItem, index: number) => string;
16
16
  onRowClick?: (record: TDataItem, index: number) => void;
17
+ onError?: (errorInfo: ITableCellErrorInfo) => void;
18
+ }
19
+ export interface ITableCellErrorInfo {
20
+ error: Error;
21
+ stack: React.ErrorInfo['componentStack'];
22
+ extra?: {
23
+ [key: string]: unknown;
24
+ };
17
25
  }
18
26
  export interface ITableRef {
19
27
  scrollToFirstRow: () => void;
@@ -0,0 +1,25 @@
1
+ import React from 'react';
2
+ export interface IFont {
3
+ color?: string;
4
+ fontSize?: number | string;
5
+ fontWeight?: 'normal' | 'light' | 'weight' | number;
6
+ fontStyle?: 'none' | 'normal' | 'italic' | 'oblique';
7
+ fontFamily?: string;
8
+ }
9
+ export interface IWatermarkProps {
10
+ zIndex?: number;
11
+ rotate?: number;
12
+ width?: number;
13
+ height?: number;
14
+ image?: string;
15
+ content?: string | string[];
16
+ font?: IFont;
17
+ style?: React.CSSProperties;
18
+ className?: string;
19
+ rootClassName?: string;
20
+ gap?: [number, number];
21
+ offset?: [number, number];
22
+ children?: React.ReactNode;
23
+ }
24
+ declare function Watermark(props: IWatermarkProps): React.JSX.Element;
25
+ export default Watermark;
@@ -0,0 +1,6 @@
1
+ import { Watermark as AntdWatermark } from 'antd';
2
+ import React from 'react';
3
+ function Watermark(props) {
4
+ return /*#__PURE__*/React.createElement(AntdWatermark, props);
5
+ }
6
+ export default Watermark;
@@ -0,0 +1,2 @@
1
+ import '../../style';
2
+ import './index.less';
@@ -0,0 +1,2 @@
1
+ import "../../style";
2
+ import "./index.less";
@@ -0,0 +1 @@
1
+ @import '../../style/index.less';