@lemon-fe/components 1.1.6 → 1.1.8
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.js +5 -1
- package/es/index.d.ts +1 -0
- package/es/index.js +2 -1
- package/es/modal/index.d.ts +16 -0
- package/es/modal/index.js +116 -0
- package/es/modal/index.less +38 -0
- package/es/popup/index.d.ts +1 -1
- package/es/popup/index.js +2 -1
- package/es/styles/index.less +2 -1
- package/package.json +2 -2
package/es/data-grid/index.js
CHANGED
|
@@ -186,10 +186,14 @@ var DataGrid = /*#__PURE__*/function (_Component) {
|
|
|
186
186
|
value: value
|
|
187
187
|
});
|
|
188
188
|
}
|
|
189
|
+
var result = typeof value === 'string' ? value.replace(_this.fieldSuffix, '') : value;
|
|
190
|
+
if (Number.isNaN(+result)) {
|
|
191
|
+
return;
|
|
192
|
+
}
|
|
189
193
|
if (summary[field.id] === undefined) {
|
|
190
194
|
summary[field.id] = new BigNumber(0);
|
|
191
195
|
}
|
|
192
|
-
summary[field.id] = summary[field.id].plus(
|
|
196
|
+
summary[field.id] = summary[field.id].plus(result);
|
|
193
197
|
});
|
|
194
198
|
});
|
|
195
199
|
return summary;
|
package/es/index.d.ts
CHANGED
|
@@ -42,3 +42,4 @@ export { default as InputCompact } from './input-compact';
|
|
|
42
42
|
export { default as SelectPanel } from './select-panel';
|
|
43
43
|
export * from './component-configure';
|
|
44
44
|
export { default as EmptyImage } from './empty-image';
|
|
45
|
+
export { default as Modal, type ModalProps, type ModalFuncProps } from './modal';
|
package/es/index.js
CHANGED
|
@@ -33,4 +33,5 @@ export { default as InputNumber } from "./input-number";
|
|
|
33
33
|
export { default as InputCompact } from "./input-compact";
|
|
34
34
|
export { default as SelectPanel } from "./select-panel";
|
|
35
35
|
export * from "./component-configure";
|
|
36
|
-
export { default as EmptyImage } from "./empty-image";
|
|
36
|
+
export { default as EmptyImage } from "./empty-image";
|
|
37
|
+
export { default as Modal } from "./modal";
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type ModalProps as AntdModalProps } from 'antd';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
export declare type ModalProps = AntdModalProps & {
|
|
4
|
+
enableFullscreen?: boolean;
|
|
5
|
+
defaultFullscreen?: boolean;
|
|
6
|
+
fullscreen?: boolean;
|
|
7
|
+
onFullscreenChange?: (fullscreen: boolean) => void;
|
|
8
|
+
};
|
|
9
|
+
export type { ModalFuncProps } from 'antd';
|
|
10
|
+
declare function LemonModal(props: ModalProps): JSX.Element;
|
|
11
|
+
declare const Modal: Pick<React.FC<AntdModalProps> & import("antd/lib/modal/confirm").ModalStaticFunctions & {
|
|
12
|
+
useModal: typeof import("antd/lib/modal/useModal").default;
|
|
13
|
+
destroyAll: () => void;
|
|
14
|
+
config: typeof import("antd/lib/modal/confirm").modalGlobalConfig;
|
|
15
|
+
}, "success" | "error" | "warning" | "info" | "warn" | "confirm" | "useModal" | "destroyAll" | "config"> & typeof LemonModal;
|
|
16
|
+
export default Modal;
|
|
@@ -0,0 +1,116 @@
|
|
|
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 = ["enableFullscreen", "defaultFullscreen", "fullscreen", "onFullscreenChange", "title", "wrapClassName"];
|
|
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
|
+
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
|
+
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; }
|
|
6
|
+
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; }
|
|
7
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
8
|
+
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); }
|
|
9
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
10
|
+
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."); }
|
|
11
|
+
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); }
|
|
12
|
+
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; }
|
|
13
|
+
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; } }
|
|
14
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
15
|
+
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; }
|
|
16
|
+
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; }
|
|
17
|
+
import { Modal as AntdModal } from 'antd';
|
|
18
|
+
import React, { useState } from 'react';
|
|
19
|
+
import Icons from "../icons";
|
|
20
|
+
import { prefixClassName } from "../utils";
|
|
21
|
+
import classNames from 'classnames';
|
|
22
|
+
function LemonModal(props) {
|
|
23
|
+
var _ref;
|
|
24
|
+
var enableFullscreen = props.enableFullscreen,
|
|
25
|
+
defaultFullscreen = props.defaultFullscreen,
|
|
26
|
+
fullscreenProp = props.fullscreen,
|
|
27
|
+
onFullscreenChange = props.onFullscreenChange,
|
|
28
|
+
title = props.title,
|
|
29
|
+
wrapClassName = props.wrapClassName,
|
|
30
|
+
restProps = _objectWithoutProperties(props, _excluded);
|
|
31
|
+
var _useState = useState((_ref = fullscreenProp !== null && fullscreenProp !== void 0 ? fullscreenProp : defaultFullscreen) !== null && _ref !== void 0 ? _ref : false),
|
|
32
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
33
|
+
fullscreen = _useState2[0],
|
|
34
|
+
setFullscreen = _useState2[1];
|
|
35
|
+
var prefixCls = prefixClassName('modal');
|
|
36
|
+
var mergedFullscreen = fullscreenProp !== null && fullscreenProp !== void 0 ? fullscreenProp : fullscreen;
|
|
37
|
+
var handleFullscreenChange = function handleFullscreenChange(result) {
|
|
38
|
+
onFullscreenChange === null || onFullscreenChange === void 0 || onFullscreenChange(result);
|
|
39
|
+
setFullscreen(result);
|
|
40
|
+
};
|
|
41
|
+
return /*#__PURE__*/React.createElement(AntdModal, _extends({
|
|
42
|
+
closeIcon: /*#__PURE__*/React.createElement(Icons.CloseLight, null),
|
|
43
|
+
wrapClassName: classNames(prefixCls(), wrapClassName),
|
|
44
|
+
maskClosable: false,
|
|
45
|
+
title: enableFullscreen ? /*#__PURE__*/React.createElement("div", {
|
|
46
|
+
className: prefixCls('header')
|
|
47
|
+
}, title, /*#__PURE__*/React.createElement("button", {
|
|
48
|
+
className: prefixCls('fullscreen'),
|
|
49
|
+
onClick: function onClick() {
|
|
50
|
+
handleFullscreenChange(!mergedFullscreen);
|
|
51
|
+
}
|
|
52
|
+
}, mergedFullscreen ? /*#__PURE__*/React.createElement("svg", {
|
|
53
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
54
|
+
viewBox: "0 0 14 14"
|
|
55
|
+
}, /*#__PURE__*/React.createElement("g", null, /*#__PURE__*/React.createElement("path", {
|
|
56
|
+
d: "m9.828 9.121 2.829 2.829a.5.5 0 1 1-.707.707L9.12 9.828a.5.5 0 0 1 .707-.707ZM2.05 1.343l2.828 2.828a.5.5 0 0 1-.707.707L1.343 2.05a.5.5 0 1 1 .707-.707ZM4.879 9.828 2.05 12.657a.5.5 0 0 1-.638.058l-.069-.058a.5.5 0 0 1-.058-.638l.058-.07 2.829-2.828a.5.5 0 0 1 .707.707Z"
|
|
57
|
+
}), /*#__PURE__*/React.createElement("path", {
|
|
58
|
+
d: "M5 13.5a.5.5 0 0 1-.5-.5V9.499H1a.5.5 0 0 1-.492-.41L.5 8.999a.5.5 0 0 1 .5-.5h4a.5.5 0 0 1 .5.5V13a.5.5 0 0 1-.5.5Zm4 0a.5.5 0 0 1-.5-.5V8.999a.5.5 0 0 1 .5-.5h4a.5.5 0 1 1 0 1H9.5V13a.5.5 0 0 1-.41.492L9 13.5ZM1 5.499a.5.5 0 0 1 0-1h3.5V1a.5.5 0 0 1 .41-.492L5 .5a.5.5 0 0 1 .5.5v3.999a.5.5 0 0 1-.5.5H1Zm8 0a.5.5 0 0 1-.5-.5V1a.5.5 0 0 1 1 0v3.499H13a.5.5 0 0 1 .492.41L13.5 5a.5.5 0 0 1-.5.5H9Z"
|
|
59
|
+
}), /*#__PURE__*/React.createElement("path", {
|
|
60
|
+
d: "m9.122 4.171 2.828-2.828a.5.5 0 0 1 .707.707L9.829 4.878a.5.5 0 0 1-.638.058l-.07-.058a.5.5 0 0 1-.057-.638l.058-.069Z"
|
|
61
|
+
}))) : /*#__PURE__*/React.createElement("svg", {
|
|
62
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
63
|
+
viewBox: "0 0 14 14"
|
|
64
|
+
}, /*#__PURE__*/React.createElement("g", null, /*#__PURE__*/React.createElement("path", {
|
|
65
|
+
d: "m9.828 9.121 3.182 3.182-.707.707-3.182-3.182a.5.5 0 0 1 .707-.707ZM1.697.99 4.878 4.17a.5.5 0 0 1-.707.707L.99 1.697 1.697.99ZM4.879 9.828 1.697 13.01l-.707-.707 3.182-3.182a.5.5 0 0 1 .707.707Zm8.131-8.131L9.83 4.878a.5.5 0 0 1-.707-.707L12.303.99l.707.707Z"
|
|
66
|
+
}), /*#__PURE__*/React.createElement("path", {
|
|
67
|
+
d: "M1.5 8a.5.5 0 0 1 .5.5V12h3.5a.5.5 0 0 1 .492.41L6 12.5a.5.5 0 0 1-.5.5h-4a.5.5 0 0 1-.5-.5v-4a.5.5 0 0 1 .5-.5Zm11 0a.5.5 0 0 1 .5.5v4a.5.5 0 0 1-.5.5h-4a.5.5 0 1 1 0-1H12V8.5a.5.5 0 0 1 .41-.492L12.5 8Zm-7-7a.5.5 0 0 1 0 1H2v3.5a.5.5 0 0 1-.41.492L1.5 6a.5.5 0 0 1-.5-.5v-4a.5.5 0 0 1 .5-.5h4Zm7 0a.5.5 0 0 1 .5.5v4a.5.5 0 1 1-1 0V2H8.5a.5.5 0 0 1-.492-.41L8 1.5a.5.5 0 0 1 .5-.5h4Z"
|
|
68
|
+
}))))) : title
|
|
69
|
+
}, restProps, {
|
|
70
|
+
centered: fullscreen ? true : restProps.centered,
|
|
71
|
+
width: fullscreen ? '95vw' : restProps.width,
|
|
72
|
+
bodyStyle: fullscreen ? _objectSpread(_objectSpread({}, restProps.bodyStyle), {}, {
|
|
73
|
+
height: '85vh'
|
|
74
|
+
}) : restProps.bodyStyle
|
|
75
|
+
}));
|
|
76
|
+
}
|
|
77
|
+
var types = ['info', 'success', 'error', 'warning', 'warn', 'confirm'];
|
|
78
|
+
var Modal = LemonModal;
|
|
79
|
+
types.forEach(function (type) {
|
|
80
|
+
Modal[type] = function (props) {
|
|
81
|
+
return AntdModal[type](_objectSpread({
|
|
82
|
+
maskClosable: false,
|
|
83
|
+
title: '提示',
|
|
84
|
+
width: 400,
|
|
85
|
+
icon: /*#__PURE__*/React.createElement(Icons.Tip, {
|
|
86
|
+
type: type === 'confirm' ? 'info' : type
|
|
87
|
+
})
|
|
88
|
+
}, props));
|
|
89
|
+
};
|
|
90
|
+
});
|
|
91
|
+
Modal.config = AntdModal.config;
|
|
92
|
+
Modal.destroyAll = AntdModal.destroyAll;
|
|
93
|
+
Modal.useModal = function useModal() {
|
|
94
|
+
var _AntdModal$useModal = AntdModal.useModal.apply(AntdModal, arguments),
|
|
95
|
+
_AntdModal$useModal2 = _slicedToArray(_AntdModal$useModal, 2),
|
|
96
|
+
fns = _AntdModal$useModal2[0],
|
|
97
|
+
contextHolder = _AntdModal$useModal2[1];
|
|
98
|
+
var mFns = _objectSpread({}, fns);
|
|
99
|
+
types.forEach(function (type) {
|
|
100
|
+
if (fns.hasOwnProperty(type)) {
|
|
101
|
+
var key = type;
|
|
102
|
+
var staticFunc = fns[key];
|
|
103
|
+
mFns[key] = function (props) {
|
|
104
|
+
return staticFunc(_objectSpread({
|
|
105
|
+
title: '提示',
|
|
106
|
+
width: 400,
|
|
107
|
+
icon: /*#__PURE__*/React.createElement(Icons.Tip, {
|
|
108
|
+
type: type === 'confirm' ? 'info' : type
|
|
109
|
+
})
|
|
110
|
+
}, props));
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
return [mFns, contextHolder];
|
|
115
|
+
};
|
|
116
|
+
export default Modal;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
.@{prefixCls}-modal {
|
|
2
|
+
&-header {
|
|
3
|
+
display: flex;
|
|
4
|
+
justify-content: space-between;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
&-fullscreen {
|
|
8
|
+
display: block;
|
|
9
|
+
width: 24px;
|
|
10
|
+
height: 24px;
|
|
11
|
+
margin-right: 24px;
|
|
12
|
+
margin-left: auto;
|
|
13
|
+
padding: 0;
|
|
14
|
+
color: rgba(51, 51, 51, 0.5);
|
|
15
|
+
font-size: 14px;
|
|
16
|
+
font-style: normal;
|
|
17
|
+
line-height: 24px;
|
|
18
|
+
text-align: center;
|
|
19
|
+
text-transform: none;
|
|
20
|
+
background: transparent;
|
|
21
|
+
border: 0;
|
|
22
|
+
border-radius: 4px;
|
|
23
|
+
cursor: pointer;
|
|
24
|
+
transition: background-color 0.3s;
|
|
25
|
+
text-rendering: auto;
|
|
26
|
+
|
|
27
|
+
&:hover {
|
|
28
|
+
background-color: #f2f3f5;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
svg {
|
|
32
|
+
width: 1em;
|
|
33
|
+
height: 1em;
|
|
34
|
+
vertical-align: -0.125em;
|
|
35
|
+
fill: fade(#333, 50);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
package/es/popup/index.d.ts
CHANGED
package/es/popup/index.js
CHANGED
|
@@ -12,11 +12,12 @@ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" !=
|
|
|
12
12
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
13
13
|
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; }
|
|
14
14
|
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; }
|
|
15
|
+
import { Input, message, ConfigProvider } from 'antd';
|
|
15
16
|
import React, { useState, cloneElement, useRef, useEffect, useContext } from 'react';
|
|
16
17
|
import Icons from "../icons";
|
|
17
18
|
import SearchIcon from "../icons/search";
|
|
19
|
+
import Modal from "../modal";
|
|
18
20
|
import { prefixClassName } from "../utils";
|
|
19
|
-
import { Modal, Input, message, ConfigProvider } from 'antd';
|
|
20
21
|
var prefix = prefixClassName('popup');
|
|
21
22
|
|
|
22
23
|
// eslint-disable-next-line @typescript-eslint/unified-signatures
|
package/es/styles/index.less
CHANGED
|
@@ -24,5 +24,6 @@
|
|
|
24
24
|
@import '../state/index.less';
|
|
25
25
|
@import '../grey-panel/index.less';
|
|
26
26
|
@import '../input-number/index.less';
|
|
27
|
-
@import '
|
|
27
|
+
@import '../input-compact/index.less';
|
|
28
28
|
@import '../select-panel/index.less';
|
|
29
|
+
@import '../modal/index.less';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lemon-fe/components",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.8",
|
|
4
4
|
"description": "> TODO: description",
|
|
5
5
|
"homepage": "",
|
|
6
6
|
"license": "ISC",
|
|
@@ -62,5 +62,5 @@
|
|
|
62
62
|
"publishConfig": {
|
|
63
63
|
"registry": "https://registry.npmjs.org"
|
|
64
64
|
},
|
|
65
|
-
"gitHead": "
|
|
65
|
+
"gitHead": "c1976880d7e69d49e8b2416734ca3a4a137f535d"
|
|
66
66
|
}
|