@lemon-fe/kits 1.0.0-190 → 1.0.0-192

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.
@@ -52,7 +52,7 @@ export default class DataGrid<TData extends Record<string, any>> extends Compone
52
52
  Text: React.ForwardRefExoticComponent<import("@ag-grid-community/core").ICellEditorParams<any, any, any> & import("./typings").TextEditorParams<any> & React.RefAttributes<import("@ag-grid-community/react").ICellEditorReactComp>>;
53
53
  Date: React.ForwardRefExoticComponent<import("@ag-grid-community/core").ICellEditorParams<any, any, any> & import("./typings").DateEditorParams<any> & React.RefAttributes<import("@ag-grid-community/react").ICellEditorReactComp>>;
54
54
  Number: React.ForwardRefExoticComponent<import("@ag-grid-community/core").ICellEditorParams<any, any, any> & import("./typings").NumberEditorParams<any> & React.RefAttributes<import("@ag-grid-community/react").ICellEditorReactComp>>;
55
- Select: React.ForwardRefExoticComponent<import("@ag-grid-community/core").ICellEditorParams<any, any, any> & Pick<import("antd").SelectProps<any, import("antd/lib/select").BaseOptionType>, "disabled" | "allowClear" | "mode" | "options" | "virtual" | "showSearch" | "listHeight"> & {
55
+ Select: React.ForwardRefExoticComponent<import("@ag-grid-community/core").ICellEditorParams<any, any, any> & Pick<import("antd").SelectProps<any, import("antd/lib/select").BaseOptionType>, "disabled" | "mode" | "virtual" | "allowClear" | "options" | "showSearch" | "listHeight"> & {
56
56
  fieldNames?: {
57
57
  label: string;
58
58
  value: string;
@@ -60,6 +60,10 @@
60
60
  flex: 1 1 0;
61
61
  min-width: 0;
62
62
  }
63
+
64
+ &-explain-error {
65
+ margin-top: 2px;
66
+ }
63
67
  }
64
68
 
65
69
  &-row {
@@ -52,6 +52,10 @@ interface Props<RecordType, ParamsType extends Record<string, any>> extends Pick
52
52
  style?: CSSProperties;
53
53
  }) => ReactElement;
54
54
  } & FilterProps<ParamsType>;
55
+ /**
56
+ * 筛选参数校验,如日期范围,true: 校验通过
57
+ */
58
+ checkSearchParams?: (params: ParamsType) => boolean;
55
59
  loading?: boolean;
56
60
  readOnly?: boolean;
57
61
  }
@@ -55,7 +55,8 @@ export default function SelectView(props) {
55
55
  defaultColDef = props.defaultColDef,
56
56
  rowHeight = props.rowHeight,
57
57
  cellDisplayFlex = props.cellDisplayFlex,
58
- isRowSelectable = props.isRowSelectable;
58
+ isRowSelectable = props.isRowSelectable,
59
+ checkSearchParams = props.checkSearchParams;
59
60
  var prefix = prefixClassName("select-view");
60
61
 
61
62
  var _useState = useState(value || emptyValue),
@@ -158,6 +159,10 @@ export default function SelectView(props) {
158
159
  filter.onChange(mParams, 'submit');
159
160
  }
160
161
 
162
+ if (checkSearchParams && !checkSearchParams(mParams)) {
163
+ return;
164
+ }
165
+
161
166
  setParams(mParams);
162
167
  };
163
168
 
@@ -1,3 +1,11 @@
1
+ var _excluded = ["shape", "type", "children"];
2
+
3
+ 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 _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; }
6
+
7
+ 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; }
8
+
1
9
  import classNames from 'classnames';
2
10
  import React from 'react';
3
11
  import { prefixClassName } from "../utils";
@@ -8,8 +16,10 @@ export default function State(props) {
8
16
  _props$type = props.type,
9
17
  type = _props$type === void 0 ? 'default' : _props$type,
10
18
  _props$children = props.children,
11
- children = _props$children === void 0 ? '' : _props$children;
12
- return /*#__PURE__*/React.createElement("div", {
19
+ children = _props$children === void 0 ? '' : _props$children,
20
+ restProps = _objectWithoutProperties(props, _excluded);
21
+
22
+ return /*#__PURE__*/React.createElement("div", _extends({
13
23
  className: classNames(prefix(), prefix("shape-".concat(shape)), prefix("type-".concat(type)))
14
- }, /*#__PURE__*/React.createElement("span", null, children));
24
+ }, restProps), /*#__PURE__*/React.createElement("span", null, children));
15
25
  }
@@ -5,8 +5,10 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
5
5
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
6
6
 
7
7
  import { useLastestRef } from '@lemon-fe/hooks';
8
+ import { Button, Result } from 'antd';
8
9
  import React, { memo, useEffect } from 'react';
9
10
  import { useMemo } from 'react';
11
+ import { ErrorBoundary } from 'react-error-boundary';
10
12
  import { matchPath, useHistory } from 'react-router-dom';
11
13
  import RouteTab from "../components/RouteTab";
12
14
 
@@ -134,6 +136,22 @@ function MicroLayout(props) {
134
136
  width: '100%',
135
137
  height: '100%'
136
138
  }
139
+ }, /*#__PURE__*/React.createElement(ErrorBoundary, {
140
+ fallbackRender: function fallbackRender(_ref) {
141
+ var error = _ref.error,
142
+ resetErrorBoundary = _ref.resetErrorBoundary;
143
+ return /*#__PURE__*/React.createElement(Result, {
144
+ status: "500",
145
+ title: "\u9875\u9762\u5F02\u5E38",
146
+ subTitle: error.message,
147
+ extra: /*#__PURE__*/React.createElement(Button, {
148
+ type: "primary",
149
+ onClick: function onClick() {
150
+ resetErrorBoundary();
151
+ }
152
+ }, "\u91CD\u65B0\u52A0\u8F7D")
153
+ });
154
+ }
137
155
  }, route !== null && tab.match !== null && /*#__PURE__*/React.createElement(RouteTab, {
138
156
  routerBase: basename,
139
157
  authorities: auth,
@@ -144,7 +162,7 @@ function MicroLayout(props) {
144
162
  location: tab.location,
145
163
  match: tab.match,
146
164
  instance: tab.instance
147
- }));
165
+ })));
148
166
  }));
149
167
  }
150
168
 
@@ -306,16 +306,11 @@ span.@{ant-prefix}-radio + * {
306
306
 
307
307
  /** form **/
308
308
  .@{ant-prefix}-form-item {
309
- &-has-error{
310
- & + *{
311
- margin-top: 16px;
312
- }
313
- }
314
- &-explain-error{
315
- font-size: 12px;
309
+ &-explain-error {
310
+ margin-top: 4px;
311
+ color: #ff4128;
316
312
  font-weight: 400;
317
- color: #FF4128;
313
+ font-size: 12px;
318
314
  line-height: 20px;
319
- margin-top: 4px;
320
315
  }
321
316
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lemon-fe/kits",
3
- "version": "1.0.0-190",
3
+ "version": "1.0.0-192",
4
4
  "scripts": {
5
5
  "start": "dumi dev",
6
6
  "docs:build": "dumi build",
@@ -56,6 +56,7 @@
56
56
  "moment": "^2.29.4",
57
57
  "rc-resize-observer": "^1.0.0",
58
58
  "react-color": "^2.19.3",
59
+ "react-error-boundary": "^4.0.11",
59
60
  "react-gcolor-picker": "^1.2.4",
60
61
  "react-resizable": "^3.0.4",
61
62
  "react-router": "^5.0.0",