@lemon-fe/components 0.1.0 → 0.1.4

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.
@@ -69,17 +69,27 @@ export default function Actions(props) {
69
69
  return null;
70
70
  }
71
71
 
72
+ var key = item.text;
72
73
  var dropDown = item.dropDown ? item.dropDown.filter(function (item) {
73
74
  return item !== null;
74
75
  }) : [];
75
- return /*#__PURE__*/React.createElement("button", {
76
- className: "".concat(prefixCls, "-item"),
76
+ return /*#__PURE__*/React.createElement("div", {
77
+ className: classNames("".concat(prefixCls, "-item"), _defineProperty({}, "".concat(prefixCls, "-item-disabled"), item.disabled)),
77
78
  key: item.text,
78
- disabled: item.disabled,
79
+ onMouseEnter: function onMouseEnter() {
80
+ if (pop !== null && pop.key !== key) {
81
+ closePop();
82
+ }
83
+ },
79
84
  onClick: function onClick(e) {
85
+ if (item.disabled) {
86
+ return;
87
+ }
88
+
80
89
  if (dropDown.length > 0) {
81
90
  var rect = e.target.getBoundingClientRect();
82
91
  openPop({
92
+ key: key,
83
93
  top: rect.top + rect.height,
84
94
  right: document.body.clientWidth - rect.right,
85
95
  items: dropDown
Binary file
@@ -1,3 +1,4 @@
1
+ /// <reference path="../../typings.d.ts" />
1
2
  import type { BaseTableProps as Props } from './typings';
2
3
  declare function BaseTable<T extends Record<string, any>>(props: Props<T>): JSX.Element;
3
4
  declare namespace BaseTable {
@@ -33,6 +33,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
33
33
 
34
34
  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; }
35
35
 
36
+ /// <reference path="../../typings.d.ts" />
36
37
  import React, { useMemo, useState, useEffect, useRef } from 'react';
37
38
  import { Table as AntdTable } from 'antd';
38
39
  import { get } from 'lodash';
@@ -43,6 +44,7 @@ import { PREFIX_CLS } from '../constants';
43
44
  import VirtualList from './VirtualBody';
44
45
  import BaseTableContext from './BaseTableContext';
45
46
  import Actions from './Actions';
47
+ import empty from './empty.png';
46
48
 
47
49
  function formatSummary(summary) {
48
50
  if (!summary) {
@@ -396,7 +398,14 @@ function BaseTable(props) {
396
398
  },
397
399
  components: components,
398
400
  onChange: handleChange,
399
- tableLayout: tableLayout
401
+ tableLayout: tableLayout,
402
+ locale: {
403
+ emptyText: /*#__PURE__*/React.createElement("div", {
404
+ className: "".concat(PREFIX_CLS, "-table-empty")
405
+ }, /*#__PURE__*/React.createElement("img", {
406
+ src: empty
407
+ }), /*#__PURE__*/React.createElement("div", null, "\u6682\u65E0\u6570\u636E"))
408
+ }
400
409
  }, restProps), {}, {
401
410
  pagination: paginationProp !== false ? _objectSpread({
402
411
  size: 'small',
@@ -94,15 +94,6 @@
94
94
  transition: background-color 0.2s;
95
95
  user-select: none;
96
96
 
97
- &:disabled {
98
- color: rgba(51, 51, 51, 0.5);
99
- cursor: not-allowed;
100
-
101
- &:hover {
102
- background-color: rgba(51, 51, 51, 0.06);
103
- }
104
- }
105
-
106
97
  &:hover {
107
98
  background-color: .primary(0.12) [];
108
99
  }
@@ -110,6 +101,15 @@
110
101
  &:active {
111
102
  color: .primary(0.8) [];
112
103
  }
104
+
105
+ &-disabled {
106
+ color: rgba(51, 51, 51, 0.5) !important;
107
+ cursor: not-allowed;
108
+
109
+ &:hover {
110
+ background-color: rgba(51, 51, 51, 0.06);
111
+ }
112
+ }
113
113
  }
114
114
 
115
115
  &-popover {
@@ -197,4 +197,15 @@
197
197
  font-size: 12px;
198
198
  }
199
199
  }
200
+
201
+ &-empty {
202
+ display: inline-block;
203
+ text-align: center;
204
+
205
+ & > img {
206
+ display: block;
207
+ width: 120px;
208
+ height: 120px;
209
+ }
210
+ }
200
211
  }
@@ -17,6 +17,7 @@
17
17
 
18
18
  .col(@colSpan: 8) {
19
19
  flex-shrink: 0;
20
+ flex-wrap: nowrap;
20
21
  width: percentage((@colSpan / 24));
21
22
  min-width: if((@colSpan >= 12), 2 * @minWidth, @minWidth);
22
23
  padding: 0 (@spaceX / 2);
Binary file
@@ -0,0 +1,6 @@
1
+ import { CSSProperties } from 'react';
2
+ export default function BigTip(props: {
3
+ type?: 'success' | 'error' | 'warning' | 'info';
4
+ style?: CSSProperties;
5
+ className?: string;
6
+ }): JSX.Element;
@@ -0,0 +1,50 @@
1
+ var _excluded = ["type"];
2
+
3
+ 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; }
4
+
5
+ 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; }
6
+
7
+ 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; }
8
+
9
+ 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; }
10
+
11
+ 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; }
12
+
13
+ import React from 'react';
14
+ import success from './success.png';
15
+ import error from './error.png';
16
+ import info from './info.png';
17
+ import warning from './warning.png';
18
+ export default function BigTip(props) {
19
+ var _props$type = props.type,
20
+ type = _props$type === void 0 ? 'success' : _props$type,
21
+ restProps = _objectWithoutProperties(props, _excluded);
22
+
23
+ var src;
24
+
25
+ switch (type) {
26
+ case 'warning':
27
+ src = warning;
28
+ break;
29
+
30
+ case 'error':
31
+ src = error;
32
+ break;
33
+
34
+ case 'info':
35
+ src = info;
36
+ break;
37
+
38
+ case 'success':
39
+ default:
40
+ src = success;
41
+ }
42
+
43
+ return /*#__PURE__*/React.createElement("img", _objectSpread({
44
+ src: src,
45
+ style: {
46
+ width: 48,
47
+ height: 48
48
+ }
49
+ }, restProps));
50
+ }
Binary file
Binary file
Binary file
@@ -4,6 +4,7 @@ import Tip from './Tip';
4
4
  import DarkSearch from './DarkSearch';
5
5
  import More from './More';
6
6
  import Calendar from './Calendar';
7
+ import BigTip from './BigTip';
7
8
  declare const Icons: {
8
9
  Search: typeof Search;
9
10
  Down: typeof Down;
@@ -12,5 +13,6 @@ declare const Icons: {
12
13
  DarkSearch: typeof DarkSearch;
13
14
  More: typeof More;
14
15
  Calendar: typeof Calendar;
16
+ BigTip: typeof BigTip;
15
17
  };
16
18
  export default Icons;
package/es/Icons/index.js CHANGED
@@ -5,6 +5,7 @@ import Empty from './Empty';
5
5
  import DarkSearch from './DarkSearch';
6
6
  import More from './More';
7
7
  import Calendar from './Calendar';
8
+ import BigTip from './BigTip';
8
9
  var Icons = {
9
10
  Search: Search,
10
11
  Down: Down,
@@ -12,6 +13,7 @@ var Icons = {
12
13
  Empty: Empty,
13
14
  DarkSearch: DarkSearch,
14
15
  More: More,
15
- Calendar: Calendar
16
+ Calendar: Calendar,
17
+ BigTip: BigTip
16
18
  };
17
19
  export default Icons;
@@ -228,7 +228,7 @@ export default function Menu(props) {
228
228
  var activeMenu = useMemo(function () {
229
229
  var check = function check(path) {
230
230
  if (path) {
231
- return new RegExp("".concat(path, "(?![^\\/])")).test(location.pathname);
231
+ return new RegExp("".concat(path.split('?')[0], "(?![^\\/])")).test(location.pathname);
232
232
  }
233
233
 
234
234
  return false;
Binary file
@@ -34,12 +34,13 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
34
34
  import React, { useMemo, useState } from 'react';
35
35
  import { useDebounce } from '@lemon-fe/hooks';
36
36
  import Tree from 'rc-tree';
37
- import { Empty, Input, Tabs } from 'antd';
37
+ import { Input, Tabs } from 'antd';
38
38
  import { PREFIX_CLS } from '../constants';
39
39
  import TreeNodeTitle from './TreeNodeTitle';
40
40
  import Icons from '../Icons';
41
41
  import TabBar from '../TabBar';
42
42
  import { mapChildren } from '../utils';
43
+ import empty from './empty.png';
43
44
 
44
45
  function SiderTreeTabs(props) {
45
46
  var tabs = props.tabs,
@@ -156,9 +157,11 @@ export default function SiderTree(props) {
156
157
  className: "".concat(prefixCls, "-header")
157
158
  }, mHeader), /*#__PURE__*/React.createElement("div", {
158
159
  className: "".concat(prefixCls, "-body")
159
- }, tree.length <= 0 ? /*#__PURE__*/React.createElement(Empty, {
160
- description: false
161
- }) : /*#__PURE__*/React.createElement(Tree, _objectSpread({
160
+ }, tree.length <= 0 ? /*#__PURE__*/React.createElement("div", {
161
+ className: "".concat(prefixCls, "-empty")
162
+ }, /*#__PURE__*/React.createElement("img", {
163
+ src: empty
164
+ }), /*#__PURE__*/React.createElement("div", null, "\u6682\u65E0\u6570\u636E")) : /*#__PURE__*/React.createElement(Tree, _objectSpread({
162
165
  treeData: tree,
163
166
  prefixCls: prefixCls,
164
167
  itemHeight: 40,
@@ -160,6 +160,26 @@
160
160
  }
161
161
  }
162
162
  }
163
+
164
+ &-empty {
165
+ width: 72px;
166
+ margin: 0 auto;
167
+ padding-top: 75px;
168
+ text-align: center;
169
+
170
+ img {
171
+ display: block;
172
+ width: 72px;
173
+ height: 72px;
174
+ }
175
+
176
+ div {
177
+ margin-top: 8px;
178
+ color: rgba(51, 51, 51, 0.5);
179
+ font-size: 14px;
180
+ line-height: 22px;
181
+ }
182
+ }
163
183
  }
164
184
 
165
185
  .@{prefixCls}-layout-left .@{prefixCls}-tree-wrapper:first-child .@{prefixCls}-tree-header {
package/es/init.js CHANGED
@@ -7,13 +7,13 @@ 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, version, DatePicker } from 'antd';
10
+ import { message, Modal, Select, ConfigProvider, Result, Button, version, DatePicker } from 'antd';
11
11
  import { config } from '@lemon-fe/hooks';
12
12
  import PageLoading from './PageLoading';
13
13
  import Icons from './Icons';
14
14
  var Tip = Icons.Tip,
15
- EmptyIcon = Icons.Empty,
16
- Down = Icons.Down;
15
+ Down = Icons.Down,
16
+ BigTip = Icons.BigTip;
17
17
  export default function init() {
18
18
  var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
19
19
 
@@ -62,12 +62,10 @@ export default function init() {
62
62
 
63
63
  Modal[item] = function () {
64
64
  return modalAPI(_objectSpread({
65
- icon: /*#__PURE__*/React.createElement(Tip, {
66
- type: item,
67
- style: {
68
- fontSize: 20
69
- }
70
- })
65
+ icon: /*#__PURE__*/React.createElement(BigTip, {
66
+ type: item
67
+ }),
68
+ title: '提示'
71
69
  }, arguments.length <= 0 ? undefined : arguments[0]));
72
70
  };
73
71
  });
@@ -75,12 +73,10 @@ export default function init() {
75
73
 
76
74
  Modal.confirm = function () {
77
75
  return modalConfirm(_objectSpread({
78
- icon: /*#__PURE__*/React.createElement(Tip, {
79
- type: "warning",
80
- style: {
81
- fontSize: 20
82
- }
83
- })
76
+ icon: /*#__PURE__*/React.createElement(BigTip, {
77
+ type: "info"
78
+ }),
79
+ title: '提示'
84
80
  }, arguments.length <= 0 ? undefined : arguments[0]));
85
81
  };
86
82
 
@@ -91,10 +87,6 @@ export default function init() {
91
87
  return node;
92
88
  }
93
89
  };
94
- Empty.PRESENTED_IMAGE_DEFAULT = /*#__PURE__*/React.createElement(EmptyIcon, null);
95
- Empty.defaultProps = {
96
- image: Empty.PRESENTED_IMAGE_DEFAULT
97
- };
98
90
  DatePicker.RangePicker.defaultProps = {
99
91
  suffixIcon: /*#__PURE__*/React.createElement(Icons.Calendar, null)
100
92
  };
package/es/overrides.less CHANGED
@@ -38,15 +38,10 @@ a[title='站长统计'] {
38
38
  padding: 40px 48px;
39
39
  overflow: hidden;
40
40
 
41
- & > .anticon:first-child {
41
+ & > img:first-child {
42
42
  position: absolute;
43
43
  top: 40px;
44
44
  left: 48px;
45
- padding: 2px;
46
- }
47
-
48
- & > .anticon + .ant-modal-confirm-title + .ant-modal-confirm-content {
49
- margin-left: 36px;
50
45
  }
51
46
  }
52
47
 
@@ -66,14 +61,14 @@ a[title='站长统计'] {
66
61
 
67
62
  .ant-modal-confirm-title {
68
63
  float: none;
69
- margin-left: 36px;
64
+ margin-left: 56px;
70
65
  font-weight: 600;
71
66
  line-height: 24px;
72
67
  }
73
68
 
74
69
  .ant-modal-confirm-content {
75
70
  float: none;
76
- margin: 2px 0 0 36px;
71
+ margin: 2px 0 0 56px;
77
72
  color: rgba(51, 51, 51, 0.5);
78
73
  line-height: 22px;
79
74
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lemon-fe/components",
3
- "version": "0.1.0",
3
+ "version": "0.1.4",
4
4
  "description": "> TODO: description",
5
5
  "author": "鲁盛杰 <lusj@cnlemon.net>",
6
6
  "homepage": "",
@@ -16,8 +16,8 @@
16
16
  "registry": "https://registry.npmjs.org"
17
17
  },
18
18
  "dependencies": {
19
- "@lemon-fe/hooks": "^0.0.33",
20
- "antd": "^4.17.0",
19
+ "@lemon-fe/hooks": "^0.1.2",
20
+ "antd": "^4.20.2",
21
21
  "classnames": "^2.2.6",
22
22
  "lodash": "^4.17.21",
23
23
  "react": "^17.0.2",
@@ -39,5 +39,5 @@
39
39
  "@types/lodash": "^4.14.179",
40
40
  "@types/react-resizable": "^1.7.4"
41
41
  },
42
- "gitHead": "194106879a74eb16c75e56c3832a2f555627a8ee"
42
+ "gitHead": "f0f512c0a2e59bedb7ec800d545d395580f07038"
43
43
  }