@lemon-fe/components 0.0.23 → 0.0.26

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.
@@ -132,6 +132,8 @@ function Actions(props) {
132
132
  content: /*#__PURE__*/React.createElement("ul", {
133
133
  className: "".concat(prefixCls, "-actions-popover-list")
134
134
  }, collapsedBtns.map(function (item, index) {
135
+ var _classNames;
136
+
135
137
  if (item === null) {
136
138
  return item;
137
139
  }
@@ -142,15 +144,18 @@ function Actions(props) {
142
144
  }, item);
143
145
  }
144
146
 
147
+ var disabled = item.disabled;
145
148
  return /*#__PURE__*/React.createElement("li", {
146
- className: "".concat(prefixCls, "-actions-popover-item"),
149
+ className: classNames((_classNames = {}, _defineProperty(_classNames, "".concat(prefixCls, "-actions-popover-item-disabled"), disabled), _defineProperty(_classNames, "".concat(prefixCls, "-actions-popover-item"), !disabled), _classNames)),
147
150
  key: index,
148
151
  onClick: function onClick() {
149
- var handleClick = item.onClick || item.action;
150
- setVisible(false);
152
+ if (!disabled) {
153
+ var handleClick = item.onClick || item.action;
154
+ setVisible(false);
151
155
 
152
- if (handleClick) {
153
- handleClick();
156
+ if (handleClick) {
157
+ handleClick();
158
+ }
154
159
  }
155
160
  }
156
161
  }, item.text);
@@ -35,6 +35,19 @@
35
35
  color: .primary(1) [];
36
36
  background: .primary(0.08) [];
37
37
  }
38
+
39
+ &-disabled {
40
+ box-sizing: border-box;
41
+ width: 124px;
42
+ height: 38px;
43
+ padding: 8px;
44
+ color: rgba(0, 0, 0, 0.25);
45
+ line-height: 22px;
46
+ text-align: left;
47
+ list-style: none;
48
+ border-radius: 2px;
49
+ cursor: not-allowed;
50
+ }
38
51
  }
39
52
  }
40
53
 
@@ -5,7 +5,7 @@ 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 React, { useContext, useMemo } from 'react';
8
- import { FormContext } from 'antd/lib/form/context';
8
+ import { FormContext } from 'antd/es/form/context';
9
9
  import { PREFIX_CLS } from '../constants';
10
10
 
11
11
  function FormHorizontal(props) {
@@ -13,7 +13,7 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
13
13
 
14
14
  import React, { useContext, useMemo } from 'react';
15
15
  import { Row, Col } from 'antd';
16
- import { FormContext } from 'antd/lib/form/context';
16
+ import { FormContext } from 'antd/es/form/context';
17
17
  import { PREFIX_CLS } from '../constants';
18
18
 
19
19
  function FormInline(props) {
package/es/init.js CHANGED
@@ -7,8 +7,10 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
7
7
  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); }
8
8
 
9
9
  import React from 'react';
10
+ import { message, Modal, Empty, Select, ConfigProvider, Result, Button } from 'antd';
11
+ import { config } from '@lemon-fe/hooks';
12
+ import PageLoading from './PageLoading';
10
13
  import Icons from './Icons';
11
- import { message, Modal, Empty, Select } from 'antd';
12
14
  var Tip = Icons.Tip,
13
15
  EmptyIcon = Icons.Empty,
14
16
  Down = Icons.Down;
@@ -97,4 +99,36 @@ export default function init() {
97
99
  Empty.defaultProps = {
98
100
  image: Empty.PRESENTED_IMAGE_DEFAULT
99
101
  };
102
+ config({
103
+ showToast: function showToast() {
104
+ return message.loading('请稍等', 0);
105
+ },
106
+ cancelToast: function cancelToast(hide) {
107
+ hide();
108
+ },
109
+ showLoading: function showLoading() {
110
+ return /*#__PURE__*/React.createElement(PageLoading, null);
111
+ },
112
+ showError: function showError(err) {
113
+ message.error(err.message);
114
+ },
115
+ setPrimaryColor: function setPrimaryColor(color) {
116
+ ConfigProvider.config({
117
+ theme: {
118
+ primaryColor: color
119
+ }
120
+ });
121
+ },
122
+ errorResult: function errorResult(err, refresh) {
123
+ return /*#__PURE__*/React.createElement(Result, {
124
+ status: "500",
125
+ title: "500",
126
+ subTitle: err.message,
127
+ extra: /*#__PURE__*/React.createElement(Button, {
128
+ type: "primary",
129
+ onClick: refresh
130
+ }, "\u91CD\u65B0\u52A0\u8F7D")
131
+ });
132
+ }
133
+ });
100
134
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lemon-fe/components",
3
- "version": "0.0.23",
3
+ "version": "0.0.26",
4
4
  "description": "> TODO: description",
5
5
  "author": "鲁盛杰 <lusj@cnlemon.net>",
6
6
  "homepage": "",
@@ -16,7 +16,7 @@
16
16
  "registry": "https://registry.npmjs.org"
17
17
  },
18
18
  "dependencies": {
19
- "@lemon-fe/hooks": "^0.0.23",
19
+ "@lemon-fe/hooks": "^0.0.26",
20
20
  "antd": "^4.17.0",
21
21
  "classnames": "^2.2.6",
22
22
  "lodash": "^4.17.21",
@@ -39,5 +39,5 @@
39
39
  "@types/lodash": "^4.14.179",
40
40
  "@types/react-resizable": "^1.7.4"
41
41
  },
42
- "gitHead": "51cd80caa890be326c23be9c84fa1dfb42226e8c"
42
+ "gitHead": "4a28f2bfe86b3a48bb60ab4f988a70bcd3240ed5"
43
43
  }