@lemon-fe/components 1.4.14 → 1.4.15-alpha.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.
- package/es/data-grid/index.d.ts +4 -4
- package/es/data-grid/index.js +8 -3
- package/es/data-grid/index.less +1 -0
- package/es/data-grid/typings.d.ts +4 -0
- package/es/index.d.ts +1 -0
- package/es/index.js +1 -0
- package/es/locale/en_US.js +3 -1
- package/es/locale/locale.d.ts +2 -0
- package/es/locale/vi.js +3 -1
- package/es/locale/zh_CN.js +3 -1
- package/es/locale/zh_Hant_HK.js +3 -1
- package/es/popup/index.js +9 -3
- package/es/request-error-message/index.d.ts +4 -0
- package/es/request-error-message/index.js +45 -0
- package/es/request-error-message/locale/en_US.d.ts +3 -0
- package/es/request-error-message/locale/en_US.js +4 -0
- package/es/request-error-message/locale/locale.d.ts +3 -0
- package/es/request-error-message/locale/locale.js +1 -0
- package/es/request-error-message/locale/vi.d.ts +3 -0
- package/es/request-error-message/locale/vi.js +4 -0
- package/es/request-error-message/locale/zh_CN.d.ts +3 -0
- package/es/request-error-message/locale/zh_CN.js +4 -0
- package/es/request-error-message/locale/zh_Hant_HK.d.ts +3 -0
- package/es/request-error-message/locale/zh_Hant_HK.js +4 -0
- package/package.json +4 -4
package/es/data-grid/index.d.ts
CHANGED
|
@@ -14,10 +14,10 @@ declare const SummaryFlag: unique symbol;
|
|
|
14
14
|
declare const IndexColId = "$$index";
|
|
15
15
|
declare const EmptyCol: ColType<any>;
|
|
16
16
|
declare const Editors: {
|
|
17
|
-
Text: React.ForwardRefExoticComponent<import("ag-grid-community").ICellEditorParams<any, any, any> & import("
|
|
18
|
-
Date: React.ForwardRefExoticComponent<import("ag-grid-community").ICellEditorParams<any, any, any> & import("
|
|
19
|
-
Number: React.ForwardRefExoticComponent<import("ag-grid-community").ICellEditorParams<any, any, any> & import("
|
|
20
|
-
Select: React.ForwardRefExoticComponent<import("ag-grid-community").ICellEditorParams<any, any, any> & Pick<import("antd").SelectProps<any, import("antd/lib/select").BaseOptionType>, "disabled" | "mode" | "
|
|
17
|
+
Text: React.ForwardRefExoticComponent<import("ag-grid-community").ICellEditorParams<any, any, any> & import("..").TextEditorParams<any> & React.RefAttributes<import("ag-grid-react").ICellEditorReactComp>>;
|
|
18
|
+
Date: React.ForwardRefExoticComponent<import("ag-grid-community").ICellEditorParams<any, any, any> & import("..").DateEditorParams<any> & React.RefAttributes<import("ag-grid-react").ICellEditorReactComp>>;
|
|
19
|
+
Number: React.ForwardRefExoticComponent<import("ag-grid-community").ICellEditorParams<any, any, any> & import("..").NumberEditorParams<any> & React.RefAttributes<import("ag-grid-react").ICellEditorReactComp>>;
|
|
20
|
+
Select: React.ForwardRefExoticComponent<import("ag-grid-community").ICellEditorParams<any, any, any> & Pick<import("antd").SelectProps<any, import("antd/lib/select").BaseOptionType>, "disabled" | "mode" | "virtual" | "allowClear" | "showSearch" | "optionFilterProp" | "options" | "listHeight"> & {
|
|
21
21
|
fieldNames?: {
|
|
22
22
|
label: string;
|
|
23
23
|
value: string;
|
package/es/data-grid/index.js
CHANGED
|
@@ -36,6 +36,7 @@ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" !=
|
|
|
36
36
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
37
37
|
import { Spin, Pagination } from 'antd';
|
|
38
38
|
import React, { Component, createRef, forwardRef, Fragment } from 'react';
|
|
39
|
+
import { RequestErrorMessage } from '..';
|
|
39
40
|
import { useComponentDefaultProps } from "../component-configure";
|
|
40
41
|
import { useLocaleReceiver } from "../locale-receiver";
|
|
41
42
|
import { parseLocalTemplate } from "../locale/locale";
|
|
@@ -111,10 +112,13 @@ function EmptyOverlay(props) {
|
|
|
111
112
|
return state.fetchError;
|
|
112
113
|
});
|
|
113
114
|
var _props$desc = props.desc,
|
|
114
|
-
desc = _props$desc === void 0 ? noDataText : _props$desc
|
|
115
|
+
desc = _props$desc === void 0 ? noDataText : _props$desc,
|
|
116
|
+
renderFetchError = props.renderFetchError;
|
|
115
117
|
return /*#__PURE__*/React.createElement("div", {
|
|
116
118
|
className: prefix('empty-overlay')
|
|
117
|
-
}, err ? err
|
|
119
|
+
}, err ? renderFetchError ? renderFetchError(err) : /*#__PURE__*/React.createElement(RequestErrorMessage, {
|
|
120
|
+
error: err
|
|
121
|
+
}) : desc);
|
|
118
122
|
}
|
|
119
123
|
var defaultProps = {
|
|
120
124
|
stopEditingWhenCellsLoseFocus: true,
|
|
@@ -330,7 +334,8 @@ var InternalDataGrid = /*#__PURE__*/function (_Component) {
|
|
|
330
334
|
}());
|
|
331
335
|
_defineProperty(_assertThisInitialized(_this), "NoRowsOverlay", function () {
|
|
332
336
|
return /*#__PURE__*/React.createElement(EmptyOverlay, {
|
|
333
|
-
desc: _this.props.emptyText
|
|
337
|
+
desc: _this.props.emptyText,
|
|
338
|
+
renderFetchError: _this.props.renderFetchError
|
|
334
339
|
});
|
|
335
340
|
});
|
|
336
341
|
_defineProperty(_assertThisInitialized(_this), "getMainMenuItems", function (params) {
|
package/es/data-grid/index.less
CHANGED
|
@@ -240,4 +240,8 @@ export interface DataGridProps<TData> extends Omit<AgGridReactProps<TData>, 'row
|
|
|
240
240
|
* @description 表格底部左侧额外的元素
|
|
241
241
|
*/
|
|
242
242
|
extraFooterLeft?: ReactElement;
|
|
243
|
+
/**
|
|
244
|
+
* @description 自定义数据获取异常时渲染
|
|
245
|
+
*/
|
|
246
|
+
renderFetchError?: (error: Error) => ReactNode;
|
|
243
247
|
}
|
package/es/index.d.ts
CHANGED
|
@@ -37,6 +37,7 @@ export { default as State } from './state';
|
|
|
37
37
|
export { default as GreyPanel } from './grey-panel';
|
|
38
38
|
export { default as InputCompact } from './input-compact';
|
|
39
39
|
export { default as SelectPanel } from './select-panel';
|
|
40
|
+
export { default as RequestErrorMessage } from './request-error-message';
|
|
40
41
|
export * from './component-configure';
|
|
41
42
|
export type { Locale } from './locale/locale';
|
|
42
43
|
export { useLocaleReceiver } from './locale-receiver';
|
package/es/index.js
CHANGED
|
@@ -31,6 +31,7 @@ export { default as State } from "./state";
|
|
|
31
31
|
export { default as GreyPanel } from "./grey-panel";
|
|
32
32
|
export { default as InputCompact } from "./input-compact";
|
|
33
33
|
export { default as SelectPanel } from "./select-panel";
|
|
34
|
+
export { default as RequestErrorMessage } from "./request-error-message";
|
|
34
35
|
export * from "./component-configure";
|
|
35
36
|
export { useLocaleReceiver } from "./locale-receiver";
|
|
36
37
|
export { parseLocalTemplate } from "./locale/locale";
|
package/es/locale/en_US.js
CHANGED
|
@@ -10,6 +10,7 @@ import { default as ColorPickerLocale } from "../color-picker/locale/en_US";
|
|
|
10
10
|
import { default as DataGridLocale } from "../data-grid/locale/en_US";
|
|
11
11
|
import { default as DurationPickerLocale } from "../duration-picker/locale/en_US";
|
|
12
12
|
import { default as Filter } from "../filter/locale/en_US";
|
|
13
|
+
import { default as RequestErrorMessageLocale } from "../request-error-message/locale/en_US";
|
|
13
14
|
import { default as SelectPanelLocale } from "../select-panel/locale/en_US";
|
|
14
15
|
import { default as SelectViewLocale } from "../select-view/locale/en_US";
|
|
15
16
|
import { default as SiderTreeLocale } from "../sider-tree/locale/en_US";
|
|
@@ -24,6 +25,7 @@ var enUS = _objectSpread(_objectSpread({}, antEnUS), {}, {
|
|
|
24
25
|
SiderTree: SiderTreeLocale,
|
|
25
26
|
SelectView: SelectViewLocale,
|
|
26
27
|
SelectPanel: SelectPanelLocale,
|
|
27
|
-
DurationPicker: DurationPickerLocale
|
|
28
|
+
DurationPicker: DurationPickerLocale,
|
|
29
|
+
RequestErrorMessage: RequestErrorMessageLocale
|
|
28
30
|
});
|
|
29
31
|
export default enUS;
|
package/es/locale/locale.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ import type { ColorPickerLocale } from '../color-picker/locale/locale';
|
|
|
4
4
|
import type { DataGridLocale } from '../data-grid/locale/locale';
|
|
5
5
|
import type { DurationPickerLocale } from '../duration-picker/locale/locale';
|
|
6
6
|
import type { FilterLocale } from '../filter/locale/locale';
|
|
7
|
+
import type { RequestErrorMessageLocale } from '../request-error-message/locale/locale';
|
|
7
8
|
import type { SelectPanelLocale } from '../select-panel/locale/locale';
|
|
8
9
|
import type { SelectViewLocale } from '../select-view/locale/locale';
|
|
9
10
|
import type { SiderTreeLocale } from '../sider-tree/locale/locale';
|
|
@@ -16,5 +17,6 @@ export interface Locale extends AntLocale {
|
|
|
16
17
|
SelectView: SelectViewLocale;
|
|
17
18
|
SelectPanel: SelectPanelLocale;
|
|
18
19
|
DurationPicker: DurationPickerLocale;
|
|
20
|
+
RequestErrorMessage: RequestErrorMessageLocale;
|
|
19
21
|
}
|
|
20
22
|
export declare function parseLocalTemplate(template: string, context: Record<string | number, any>): string;
|
package/es/locale/vi.js
CHANGED
|
@@ -10,6 +10,7 @@ import { default as ColorPickerLocale } from "../color-picker/locale/vi";
|
|
|
10
10
|
import { default as DataGridLocale } from "../data-grid/locale/vi";
|
|
11
11
|
import { default as DurationPickerLocale } from "../duration-picker/locale/vi";
|
|
12
12
|
import { default as Filter } from "../filter/locale/vi";
|
|
13
|
+
import { default as RequestErrorMessageLocale } from "../request-error-message/locale/vi";
|
|
13
14
|
import { default as SelectPanelLocale } from "../select-panel/locale/vi";
|
|
14
15
|
import { default as SelectViewLocale } from "../select-view/locale/vi";
|
|
15
16
|
import { default as SiderTreeLocale } from "../sider-tree/locale/vi";
|
|
@@ -24,6 +25,7 @@ var vi = _objectSpread(_objectSpread({}, antVi), {}, {
|
|
|
24
25
|
SiderTree: SiderTreeLocale,
|
|
25
26
|
SelectView: SelectViewLocale,
|
|
26
27
|
SelectPanel: SelectPanelLocale,
|
|
27
|
-
DurationPicker: DurationPickerLocale
|
|
28
|
+
DurationPicker: DurationPickerLocale,
|
|
29
|
+
RequestErrorMessage: RequestErrorMessageLocale
|
|
28
30
|
});
|
|
29
31
|
export default vi;
|
package/es/locale/zh_CN.js
CHANGED
|
@@ -10,6 +10,7 @@ import { default as ColorPickerLocale } from "../color-picker/locale/zh_CN";
|
|
|
10
10
|
import { default as DataGridLocale } from "../data-grid/locale/zh_CN";
|
|
11
11
|
import { default as DurationPickerLocale } from "../duration-picker/locale/zh_CN";
|
|
12
12
|
import { default as Filter } from "../filter/locale/zh_CN";
|
|
13
|
+
import { default as RequestErrorMessageLocale } from "../request-error-message/locale/zh_CN";
|
|
13
14
|
import { default as SelectPanelLocale } from "../select-panel/locale/zh_CN";
|
|
14
15
|
import { default as SelectViewLocale } from "../select-view/locale/zh_CN";
|
|
15
16
|
import { default as SiderTreeLocale } from "../sider-tree/locale/zh_CN";
|
|
@@ -24,6 +25,7 @@ var zhCN = _objectSpread(_objectSpread({}, antZhCN), {}, {
|
|
|
24
25
|
DurationPicker: DurationPickerLocale,
|
|
25
26
|
SiderTree: SiderTreeLocale,
|
|
26
27
|
SelectView: SelectViewLocale,
|
|
27
|
-
SelectPanel: SelectPanelLocale
|
|
28
|
+
SelectPanel: SelectPanelLocale,
|
|
29
|
+
RequestErrorMessage: RequestErrorMessageLocale
|
|
28
30
|
});
|
|
29
31
|
export default zhCN;
|
package/es/locale/zh_Hant_HK.js
CHANGED
|
@@ -10,6 +10,7 @@ import { default as ColorPickerLocale } from "../color-picker/locale/zh_Hant_HK"
|
|
|
10
10
|
import { default as DataGridLocale } from "../data-grid/locale/zh_Hant_HK";
|
|
11
11
|
import { default as DurationPickerLocale } from "../duration-picker/locale/zh_Hant_HK";
|
|
12
12
|
import { default as Filter } from "../filter/locale/zh_Hant_HK";
|
|
13
|
+
import { default as RequestErrorMessageLocale } from "../request-error-message/locale/zh_CN";
|
|
13
14
|
import { default as SelectPanelLocale } from "../select-panel/locale/zh_Hant_HK";
|
|
14
15
|
import { default as SelectViewLocale } from "../select-view/locale/zh_Hant_HK";
|
|
15
16
|
import { default as SiderTreeLocale } from "../sider-tree/locale/zh_Hant_HK";
|
|
@@ -24,6 +25,7 @@ var zhHantHk = _objectSpread(_objectSpread({}, antZhHk), {}, {
|
|
|
24
25
|
SiderTree: SiderTreeLocale,
|
|
25
26
|
SelectView: SelectViewLocale,
|
|
26
27
|
SelectPanel: SelectPanelLocale,
|
|
27
|
-
DurationPicker: DurationPickerLocale
|
|
28
|
+
DurationPicker: DurationPickerLocale,
|
|
29
|
+
RequestErrorMessage: RequestErrorMessageLocale
|
|
28
30
|
});
|
|
29
31
|
export default zhHantHk;
|
package/es/popup/index.js
CHANGED
|
@@ -62,6 +62,7 @@ function Popup(props) {
|
|
|
62
62
|
open = _useState4[0],
|
|
63
63
|
setOpen = _useState4[1];
|
|
64
64
|
var inputRef = useRef(null);
|
|
65
|
+
var wrapperRef = useRef(null);
|
|
65
66
|
var closeAction = useRef();
|
|
66
67
|
var shouldModalOpen = openProp !== null && openProp !== void 0 ? openProp : open;
|
|
67
68
|
useEffect(function () {
|
|
@@ -75,11 +76,14 @@ function Popup(props) {
|
|
|
75
76
|
var _useContext = useContext(ConfigProvider.ConfigContext),
|
|
76
77
|
getPrefixCls = _useContext.getPrefixCls;
|
|
77
78
|
var handleCancel = function handleCancel() {
|
|
78
|
-
var _inputRef$current;
|
|
79
79
|
setOpen(false);
|
|
80
80
|
onOpenChange === null || onOpenChange === void 0 || onOpenChange(false);
|
|
81
81
|
onCancel === null || onCancel === void 0 || onCancel();
|
|
82
|
-
(
|
|
82
|
+
if (inputRef.current !== null) {
|
|
83
|
+
inputRef.current.focus();
|
|
84
|
+
} else if (wrapperRef.current !== null) {
|
|
85
|
+
wrapperRef.current.focus();
|
|
86
|
+
}
|
|
83
87
|
};
|
|
84
88
|
var handleOpen = /*#__PURE__*/function () {
|
|
85
89
|
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
@@ -257,7 +261,9 @@ function Popup(props) {
|
|
|
257
261
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
258
262
|
className: prefix('wrapper'),
|
|
259
263
|
onClick: handleOpen,
|
|
260
|
-
role: "button"
|
|
264
|
+
role: "button",
|
|
265
|
+
ref: wrapperRef,
|
|
266
|
+
tabIndex: -1
|
|
261
267
|
}, trigger), modalElm);
|
|
262
268
|
}
|
|
263
269
|
export default Popup;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
2
|
+
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."); }
|
|
3
|
+
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); }
|
|
4
|
+
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; }
|
|
5
|
+
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; } }
|
|
6
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
7
|
+
import { ConfigProvider, Typography } from 'antd';
|
|
8
|
+
import React, { useContext } from 'react';
|
|
9
|
+
import { useLocaleReceiver } from "../locale-receiver";
|
|
10
|
+
import { CheckOutlined, CopyOutlined } from '@ant-design/icons';
|
|
11
|
+
import { isRequestError } from '@lemon-fe/utils';
|
|
12
|
+
export default function ErrorMessage(props) {
|
|
13
|
+
var err = props.error;
|
|
14
|
+
var _useLocaleReceiver = useLocaleReceiver('RequestErrorMessage'),
|
|
15
|
+
_useLocaleReceiver2 = _slicedToArray(_useLocaleReceiver, 1),
|
|
16
|
+
locale = _useLocaleReceiver2[0];
|
|
17
|
+
var _useContext = useContext(ConfigProvider.ConfigContext),
|
|
18
|
+
getPrefixCls = _useContext.getPrefixCls;
|
|
19
|
+
var prefixCls = getPrefixCls();
|
|
20
|
+
if (isRequestError(err)) {
|
|
21
|
+
var traceID = err.request.otlpTraceID;
|
|
22
|
+
var errorCode = /*#__PURE__*/React.createElement(Typography.Text, {
|
|
23
|
+
style: {
|
|
24
|
+
color: 'rgba(51, 51, 51, 0.7)'
|
|
25
|
+
},
|
|
26
|
+
copyable: {
|
|
27
|
+
text: traceID,
|
|
28
|
+
// 解决message内的 anticon颜色不对的问题
|
|
29
|
+
icon: [/*#__PURE__*/React.createElement(CopyOutlined, {
|
|
30
|
+
style: {
|
|
31
|
+
color: "var(--".concat(prefixCls, "-primary-color)")
|
|
32
|
+
},
|
|
33
|
+
key: "copy-icon"
|
|
34
|
+
}), /*#__PURE__*/React.createElement(CheckOutlined, {
|
|
35
|
+
style: {
|
|
36
|
+
color: "var(--".concat(prefixCls, "-success-color)")
|
|
37
|
+
},
|
|
38
|
+
key: "copied-icon"
|
|
39
|
+
})]
|
|
40
|
+
}
|
|
41
|
+
}, "".concat(locale.errorCode, ": ").concat(traceID || ''));
|
|
42
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, traceID ? /*#__PURE__*/React.createElement("span", null, err.message, /*#__PURE__*/React.createElement("br", null), errorCode) : err.message);
|
|
43
|
+
}
|
|
44
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, err.message);
|
|
45
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lemon-fe/components",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.15-alpha.0",
|
|
4
4
|
"description": "> TODO: description",
|
|
5
5
|
"homepage": "",
|
|
6
6
|
"license": "MIT",
|
|
@@ -21,8 +21,8 @@
|
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
23
|
"@dnd-kit/core": ">=6.0.0",
|
|
24
|
-
"@lemon-fe/hooks": "^1.4.
|
|
25
|
-
"@lemon-fe/utils": "^1.
|
|
24
|
+
"@lemon-fe/hooks": "^1.4.14-alpha.1",
|
|
25
|
+
"@lemon-fe/utils": "^1.4.14-alpha.2",
|
|
26
26
|
"ag-grid-community": "29.2.0",
|
|
27
27
|
"ag-grid-enterprise": "29.2.0",
|
|
28
28
|
"ag-grid-react": "29.2.0",
|
|
@@ -58,5 +58,5 @@
|
|
|
58
58
|
"publishConfig": {
|
|
59
59
|
"registry": "https://registry.npmjs.org"
|
|
60
60
|
},
|
|
61
|
-
"gitHead": "
|
|
61
|
+
"gitHead": "c53c6796b18cca8adbddb18ce4e2f6fa81b48e53"
|
|
62
62
|
}
|