@lemon-fe/components 0.1.77 → 0.1.81

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.
@@ -24,18 +24,16 @@
24
24
  align-items: center;
25
25
  justify-content: flex-end;
26
26
  height: 100%;
27
- padding-left: 16px;
28
27
  white-space: nowrap;
29
- // background-color: @table-row-hover-bg;
30
- // background-clip: content-box;
28
+ background-color: inherit;
31
29
 
32
30
  &::before {
33
31
  position: absolute;
34
32
  top: 0;
35
- left: 0;
33
+ left: -16px;
36
34
  width: 16px;
37
35
  height: 100%;
38
- // background: linear-gradient(90deg, rgba(248, 248, 248, 0) 0%, @table-row-hover-bg 100%);
36
+ box-shadow: inset -16px 0 8px -8px @table-row-hover-bg;
39
37
  content: '';
40
38
  }
41
39
 
@@ -114,6 +112,14 @@
114
112
  }
115
113
  }
116
114
 
115
+ .ant-table-row-selected &-operator::before {
116
+ box-shadow: inset -16px 0 8px -8px var(--ant-primary-1);
117
+ }
118
+
119
+ .ant-table-row-selected:hover &-operator::before {
120
+ box-shadow: inset -16px 0 8px -8px var(--ant-primary-color-2);
121
+ }
122
+
117
123
  &-resizable-handle {
118
124
  position: absolute;
119
125
  top: 50%;
@@ -45,5 +45,7 @@ export default function EditableTableFormItem(props) {
45
45
  return;
46
46
  }
47
47
  }]
48
- }, /*#__PURE__*/React.createElement(Table, _objectSpread({}, tableProps)));
48
+ }, /*#__PURE__*/React.createElement(Table, _objectSpread({
49
+ ref: ref
50
+ }, tableProps)));
49
51
  }
@@ -282,7 +282,7 @@ function Filter(props) {
282
282
  form.resetFields();
283
283
 
284
284
  if (onChange) {
285
- onChange(form.getFieldsValue());
285
+ onChange(form.getFieldsValue(true));
286
286
  }
287
287
  };
288
288
 
@@ -332,13 +332,13 @@ function Filter(props) {
332
332
  if (index !== active) {
333
333
  setActive(index);
334
334
  form.setFieldsValue(tabs[index].value);
335
- handleFinish(form.getFieldsValue());
335
+ handleFinish();
336
336
  }
337
337
  };
338
338
 
339
- var handleFinish = function handleFinish(value) {
339
+ var handleFinish = function handleFinish() {
340
340
  if (onChange) {
341
- onChange(value);
341
+ onChange(form.getFieldsValue(true));
342
342
  }
343
343
  };
344
344
 
@@ -387,40 +387,33 @@ function Filter(props) {
387
387
  return [result, false];
388
388
  }
389
389
 
390
- var rows = [];
391
- var currRow = [];
392
- var value = 0;
393
- result.forEach(function (item) {
390
+ var btnsWidth = simple ? 208 : 248;
391
+ var btnsVisible = false;
392
+ var size = 0;
393
+ var end = result.length;
394
+
395
+ for (var i = 0; i < result.length; i++) {
394
396
  var _compMap$get;
395
397
 
398
+ var item = result[i];
396
399
  var itemWidth = getColStyle(item.colSpan || (item.type ? (_compMap$get = compMap.get(item.type)) === null || _compMap$get === void 0 ? void 0 : _compMap$get.colSpan : 1)).width;
400
+ size += itemWidth;
397
401
 
398
- if (value + itemWidth > width) {
399
- if (currRow.length > 0) {
400
- rows.push(currRow);
401
- }
402
-
403
- currRow = [item];
404
- value = itemWidth;
405
- } else {
406
- currRow.push(item);
407
- value += itemWidth;
402
+ if (size > width - btnsWidth) {
403
+ end = i;
404
+ btnsVisible = true;
405
+ break;
408
406
  }
409
- });
410
- rows.push(currRow);
411
- value += simple ? 208 : 248;
412
-
413
- if (currRow.length > 0 && value >= width + getColStyle(1).width) {
414
- rows.push([]);
415
407
  }
416
408
 
417
- var visible = rows.length > 1;
409
+ end = end || 1;
410
+ btnsVisible = btnsVisible && result.length > 1;
418
411
 
419
- if (!collapsed || !visible) {
420
- return [result, visible];
412
+ if (!collapsed) {
413
+ return [result, btnsVisible];
421
414
  }
422
415
 
423
- return [rows[0], visible];
416
+ return [result.slice(0, end), btnsVisible];
424
417
  }, [data, width, collapsed, simple, activeKeys]),
425
418
  _useMemo2 = _slicedToArray(_useMemo, 2),
426
419
  cols = _useMemo2[0],
@@ -50,6 +50,10 @@
50
50
  position: absolute;
51
51
  left: -11px;
52
52
  }
53
+
54
+ &-with-help &-explain {
55
+ margin-bottom: -@spaceY;
56
+ }
53
57
  }
54
58
 
55
59
  &-row {
@@ -0,0 +1,5 @@
1
+ import { CSSProperties } from 'react';
2
+ export default function Close(props: {
3
+ className?: string;
4
+ style?: CSSProperties;
5
+ }): JSX.Element;
@@ -0,0 +1,29 @@
1
+ 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; }
2
+
3
+ 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; }
4
+
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
+
7
+ import React from 'react';
8
+ import Icon from '@ant-design/icons';
9
+
10
+ var Svg = function Svg(props) {
11
+ return /*#__PURE__*/React.createElement("svg", _objectSpread({
12
+ viewBox: "0 0 1024 1024",
13
+ xmlns: "http://www.w3.org/2000/svg",
14
+ width: "16",
15
+ height: "16"
16
+ }, props), /*#__PURE__*/React.createElement("path", {
17
+ d: "m597.796 511.488 215.769-215.77c23.834-23.834 23.834-62.475 0-86.308-23.832-23.832-62.474-23.833-86.307 0l-215.77 215.77-215.77-215.77c-23.834-23.833-62.476-23.833-86.308 0-23.833 23.833-23.834 62.475 0 86.31l215.77 215.768-215.77 215.77c-23.833 23.834-23.833 62.475 0 86.308 23.834 23.834 62.475 23.834 86.309 0l215.768-215.768 215.769 215.77c23.835 23.833 62.476 23.832 86.309 0 23.834-23.835 23.834-62.476 0-86.308l-215.77-215.772z",
18
+ fill: "currentColor"
19
+ }));
20
+ };
21
+
22
+ export default function Close(props) {
23
+ return /*#__PURE__*/React.createElement(Icon, _objectSpread({
24
+ style: {
25
+ pointerEvents: 'none'
26
+ },
27
+ component: Svg
28
+ }, props));
29
+ }
@@ -7,6 +7,7 @@ import Calendar from './Calendar';
7
7
  import BigTip from './BigTip';
8
8
  import LookUp from './LookUp';
9
9
  import CollapseUp from './CollapseUp';
10
+ import Close from './Close';
10
11
  declare const Icons: {
11
12
  Search: typeof Search;
12
13
  Down: typeof Down;
@@ -18,5 +19,6 @@ declare const Icons: {
18
19
  BigTip: typeof BigTip;
19
20
  LookUp: typeof LookUp;
20
21
  CollapseUp: typeof CollapseUp;
22
+ Close: typeof Close;
21
23
  };
22
24
  export default Icons;
package/es/Icons/index.js CHANGED
@@ -8,6 +8,7 @@ import Calendar from './Calendar';
8
8
  import BigTip from './BigTip';
9
9
  import LookUp from './LookUp';
10
10
  import CollapseUp from './CollapseUp';
11
+ import Close from './Close';
11
12
  var Icons = {
12
13
  Search: Search,
13
14
  Down: Down,
@@ -18,6 +19,7 @@ var Icons = {
18
19
  Calendar: Calendar,
19
20
  BigTip: BigTip,
20
21
  LookUp: LookUp,
21
- CollapseUp: CollapseUp
22
+ CollapseUp: CollapseUp,
23
+ Close: Close
22
24
  };
23
25
  export default Icons;
@@ -19,6 +19,7 @@ interface Props {
19
19
  header?: ReactNode;
20
20
  footer?: ReactNode;
21
21
  body?: ReactNode;
22
+ onCollapse?: (collapsed: boolean) => void;
22
23
  }
23
24
  declare function Layout(props: Props): JSX.Element;
24
25
  declare namespace Layout {
@@ -27,7 +28,7 @@ declare namespace Layout {
27
28
  children?: React.ReactNode;
28
29
  left?: React.ReactNode;
29
30
  tab?: string | undefined;
30
- }) => JSX.Element;
31
+ } & Pick<Props, "onCollapse">) => JSX.Element;
31
32
  }
32
33
  export default Layout;
33
34
  declare function LayoutTabs(props: {
@@ -31,7 +31,8 @@ import { mapChildren } from '../utils';
31
31
  var prefixCls = "".concat(PREFIX_CLS, "-layout");
32
32
 
33
33
  function Sider(props) {
34
- var children = props.children;
34
+ var children = props.children,
35
+ onCollapse = props.onCollapse;
35
36
 
36
37
  var _useState = useState(false),
37
38
  _useState2 = _slicedToArray(_useState, 2),
@@ -47,7 +48,9 @@ function Sider(props) {
47
48
  }, children)), /*#__PURE__*/React.createElement("div", {
48
49
  className: "".concat(prefixCls, "-left-collapse"),
49
50
  onClick: function onClick() {
50
- return setCollapsed(!collapsed);
51
+ var result = !collapsed;
52
+ onCollapse === null || onCollapse === void 0 ? void 0 : onCollapse(result);
53
+ setCollapsed(result);
51
54
  }
52
55
  }, /*#__PURE__*/React.createElement("svg", {
53
56
  width: "12",
@@ -95,10 +98,13 @@ function Sider(props) {
95
98
 
96
99
  function Content(props) {
97
100
  var left = props.left,
98
- children = props.children;
101
+ children = props.children,
102
+ onCollapse = props.onCollapse;
99
103
  return /*#__PURE__*/React.createElement("div", {
100
104
  className: "".concat(prefixCls, "-content")
101
- }, left ? /*#__PURE__*/React.createElement(Sider, null, left) : null, /*#__PURE__*/React.createElement("div", {
105
+ }, left ? /*#__PURE__*/React.createElement(Sider, {
106
+ onCollapse: onCollapse
107
+ }, left) : null, /*#__PURE__*/React.createElement("div", {
102
108
  className: "".concat(prefixCls, "-main")
103
109
  }, children));
104
110
  }
@@ -114,7 +120,8 @@ export default function Layout(props) {
114
120
  header = props.header,
115
121
  left = props.left,
116
122
  footer = props.footer,
117
- body = props.body;
123
+ body = props.body,
124
+ onCollapse = props.onCollapse;
118
125
  return /*#__PURE__*/React.createElement("div", {
119
126
  className: classNames(prefixCls, className, _defineProperty({}, "".concat(prefixCls, "-full"), full)),
120
127
  style: style
@@ -123,6 +130,7 @@ export default function Layout(props) {
123
130
  }, header) : null, /*#__PURE__*/React.createElement("div", {
124
131
  className: "".concat(prefixCls, "-body")
125
132
  }, body || /*#__PURE__*/React.createElement(Content, {
133
+ onCollapse: onCollapse,
126
134
  left: left
127
135
  }, children)), footer ? /*#__PURE__*/React.createElement("div", {
128
136
  className: "".concat(prefixCls, "-footer")
package/es/Table/index.js CHANGED
@@ -50,7 +50,7 @@ export default function Table(props) {
50
50
  current = _useState2[0],
51
51
  setCurrent = _useState2[1];
52
52
 
53
- var _useState3 = useState((pagination === null || pagination === void 0 ? void 0 : pagination.pageSize) || defaultPageSize),
53
+ var _useState3 = useState(pagination && pagination.pageSize || defaultPageSize),
54
54
  _useState4 = _slicedToArray(_useState3, 2),
55
55
  pageSize = _useState4[0],
56
56
  setPageSize = _useState4[1];
@@ -227,10 +227,10 @@ export default function Table(props) {
227
227
  src: empty
228
228
  }), /*#__PURE__*/React.createElement("div", null, remote.error.message))
229
229
  } : undefined,
230
- pagination: _objectSpread({
230
+ pagination: pagination !== false ? _objectSpread({
231
231
  current: current,
232
232
  pageSize: pageSize,
233
233
  total: total
234
- }, pagination)
234
+ }, pagination) : false
235
235
  }, restProps));
236
236
  }
@@ -22,5 +22,4 @@ export interface TableProps<RecordType> extends BaseTableProps<RecordType> {
22
22
  autoLoad?: boolean;
23
23
  actionRef?: RefObject<TableRef<RecordType>>;
24
24
  onLoading?: (loading: boolean) => void;
25
- pagination?: PaginationProps;
26
25
  }
package/es/init.js CHANGED
@@ -7,13 +7,14 @@ 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, Select, ConfigProvider, Result, Button, version, DatePicker, Cascader } from 'antd';
10
+ import { message, Modal, Select, ConfigProvider, Result, Button, version, DatePicker, Cascader, TreeSelect } 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
15
  Down = Icons.Down,
16
- BigTip = Icons.BigTip;
16
+ BigTip = Icons.BigTip,
17
+ Close = Icons.Close;
17
18
  export default function init() {
18
19
  var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
19
20
 
@@ -86,6 +87,9 @@ export default function init() {
86
87
  }, arguments.length <= 0 ? undefined : arguments[0]));
87
88
  };
88
89
 
90
+ Modal.defaultProps = _objectSpread(_objectSpread({}, Modal.defaultProps), {}, {
91
+ closeIcon: /*#__PURE__*/React.createElement(Close, null)
92
+ });
89
93
  var node = /*#__PURE__*/React.createElement(Down, null); //@ts-ignore
90
94
 
91
95
  Select.defaultProps = {
@@ -94,6 +98,12 @@ export default function init() {
94
98
  }
95
99
  }; //@ts-ignore
96
100
 
101
+ TreeSelect.defaultProps = {
102
+ suffixIcon: version >= '4.18.9' ? node : function () {
103
+ return node;
104
+ }
105
+ }; //@ts-ignore
106
+
97
107
  Cascader.defaultProps = {
98
108
  suffixIcon: node
99
109
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lemon-fe/components",
3
- "version": "0.1.77",
3
+ "version": "0.1.81",
4
4
  "description": "> TODO: description",
5
5
  "author": "鲁盛杰 <lusj@cnlemon.net>",
6
6
  "homepage": "",
@@ -41,5 +41,5 @@
41
41
  "react": "^17.0.2",
42
42
  "react-dom": "^17.0.2"
43
43
  },
44
- "gitHead": "05d50e243e97f75d4f70667c57d66137a0311457"
44
+ "gitHead": "64ff3935c062ee3fffcdae9f4f22f9368fa989e2"
45
45
  }