@lemon-fe/components 0.1.82 → 0.1.85

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.
Files changed (115) hide show
  1. package/es/Actions/index.d.ts +26 -0
  2. package/es/Actions/index.js +171 -0
  3. package/es/BaseTable/Actions.d.ts +8 -0
  4. package/es/BaseTable/Actions.js +136 -0
  5. package/es/BaseTable/BaseTableContext.d.ts +6 -0
  6. package/es/BaseTable/BaseTableContext.js +6 -0
  7. package/es/BaseTable/ResizeHeaderCell.d.ts +8 -0
  8. package/es/BaseTable/ResizeHeaderCell.js +126 -0
  9. package/es/BaseTable/VirtualBody.d.ts +8 -0
  10. package/es/BaseTable/VirtualBody.js +165 -0
  11. package/es/BaseTable/index.d.ts +7 -0
  12. package/es/BaseTable/index.js +467 -0
  13. package/es/BaseTable/utils.d.ts +4 -0
  14. package/es/BaseTable/utils.js +26 -0
  15. package/es/ColorPicker/index.d.ts +13 -0
  16. package/es/ColorPicker/index.js +114 -0
  17. package/es/Dropdown/index.d.ts +14 -0
  18. package/es/Dropdown/index.js +53 -0
  19. package/es/DurationPicker/index.d.ts +25 -0
  20. package/es/DurationPicker/index.js +237 -0
  21. package/es/EditableTable/EditableCell.d.ts +11 -0
  22. package/es/EditableTable/EditableCell.js +37 -0
  23. package/es/EditableTable/EditableTableFormItem.d.ts +5 -0
  24. package/es/EditableTable/EditableTableFormItem.js +51 -0
  25. package/es/EditableTable/Table.d.ts +7 -0
  26. package/es/EditableTable/Table.js +363 -0
  27. package/es/EditableTable/index.d.ts +9 -0
  28. package/es/EditableTable/index.js +8 -0
  29. package/es/EditableTable/util.d.ts +25 -0
  30. package/es/EditableTable/util.js +387 -0
  31. package/es/Filter/index.d.ts +7 -0
  32. package/es/Filter/index.js +612 -0
  33. package/es/FormHorizontal/index.d.ts +6 -0
  34. package/es/FormHorizontal/index.js +35 -0
  35. package/es/FormInline/index.d.ts +15 -0
  36. package/es/FormInline/index.js +90 -0
  37. package/es/FormLayout/index.d.ts +32 -0
  38. package/es/FormLayout/index.js +41 -0
  39. package/es/FormTable/index.d.ts +6 -0
  40. package/es/FormTable/index.js +159 -0
  41. package/es/Icons/BigTip/index.d.ts +6 -0
  42. package/es/Icons/BigTip/index.js +50 -0
  43. package/es/Icons/Calendar.d.ts +5 -0
  44. package/es/Icons/Calendar.js +47 -0
  45. package/es/Icons/Close.d.ts +5 -0
  46. package/es/Icons/Close.js +29 -0
  47. package/es/Icons/CollapseUp.d.ts +5 -0
  48. package/es/Icons/CollapseUp.js +31 -0
  49. package/es/Icons/DarkSearch.d.ts +5 -0
  50. package/es/Icons/DarkSearch.js +38 -0
  51. package/es/Icons/Down.d.ts +5 -0
  52. package/es/Icons/Down.js +35 -0
  53. package/es/Icons/Empty.d.ts +2 -0
  54. package/es/Icons/Empty.js +267 -0
  55. package/es/Icons/LookUp.d.ts +5 -0
  56. package/es/Icons/LookUp.js +74 -0
  57. package/es/Icons/More.d.ts +5 -0
  58. package/es/Icons/More.js +44 -0
  59. package/es/Icons/Search.d.ts +5 -0
  60. package/es/Icons/Search.js +35 -0
  61. package/es/Icons/Tip.d.ts +6 -0
  62. package/es/Icons/Tip.js +169 -0
  63. package/es/Icons/index.d.ts +24 -0
  64. package/es/Icons/index.js +25 -0
  65. package/es/InputMaxLength/index.d.ts +14 -0
  66. package/es/InputMaxLength/index.js +92 -0
  67. package/es/Layout/index.d.ts +41 -0
  68. package/es/Layout/index.js +175 -0
  69. package/es/MainFramework/components/DropMenu/index.d.ts +10 -0
  70. package/es/MainFramework/components/DropMenu/index.js +104 -0
  71. package/es/MainFramework/components/Menu/index.d.ts +9 -0
  72. package/es/MainFramework/components/Menu/index.js +656 -0
  73. package/es/MainFramework/components/Menu/index.less +407 -0
  74. package/es/MainFramework/components/RefreshButton/index.d.ts +5 -0
  75. package/es/MainFramework/components/RefreshButton/index.js +72 -0
  76. package/es/MainFramework/components/RefreshButton/index.less +30 -0
  77. package/es/MainFramework/components/TabBar/index.d.ts +9 -0
  78. package/es/MainFramework/components/TabBar/index.js +116 -0
  79. package/es/MainFramework/index.d.ts +24 -0
  80. package/es/MainFramework/index.js +66 -0
  81. package/es/PageLoading/index.d.ts +5 -0
  82. package/es/PageLoading/index.js +15 -0
  83. package/es/Popup/index.d.ts +37 -0
  84. package/es/Popup/index.js +198 -0
  85. package/es/Portal/index.d.ts +12 -0
  86. package/es/Portal/index.js +72 -0
  87. package/es/Section/TabBar.d.ts +12 -0
  88. package/es/Section/TabBar.js +48 -0
  89. package/es/Section/index.d.ts +54 -0
  90. package/es/Section/index.js +96 -0
  91. package/es/SelectView/index.d.ts +53 -0
  92. package/es/SelectView/index.js +257 -0
  93. package/es/SiderTree/TreeNodeTitle.d.ts +8 -0
  94. package/es/SiderTree/TreeNodeTitle.js +107 -0
  95. package/es/SiderTree/index.d.ts +37 -0
  96. package/es/SiderTree/index.js +221 -0
  97. package/es/SymbolIcon/index.d.ts +8 -0
  98. package/es/SymbolIcon/index.js +32 -0
  99. package/es/TabBar/index.d.ts +14 -0
  100. package/es/TabBar/index.js +52 -0
  101. package/es/Table/index.d.ts +2 -0
  102. package/es/Table/index.js +236 -0
  103. package/es/Table/utils.d.ts +2 -0
  104. package/es/Table/utils.js +3 -0
  105. package/es/TipMark/index.d.ts +10 -0
  106. package/es/TipMark/index.js +45 -0
  107. package/es/constants.d.ts +1 -0
  108. package/es/constants.js +1 -0
  109. package/es/index.d.ts +33 -0
  110. package/es/index.js +28 -0
  111. package/es/init.d.ts +3 -0
  112. package/es/init.js +149 -0
  113. package/es/utils.d.ts +2 -0
  114. package/es/utils.js +14 -0
  115. package/package.json +2 -2
@@ -0,0 +1,8 @@
1
+ import type { CSSProperties } from 'react';
2
+ export default function Icon(props: {
3
+ name: string;
4
+ size?: number;
5
+ color?: string;
6
+ className?: string;
7
+ style?: CSSProperties;
8
+ }): JSX.Element;
@@ -0,0 +1,32 @@
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 classNames from 'classnames';
9
+ import { PREFIX_CLS } from '../constants';
10
+ export default function Icon(props) {
11
+ var name = props.name,
12
+ size = props.size,
13
+ color = props.color,
14
+ styleProp = props.style,
15
+ className = props.className;
16
+ var style = styleProp;
17
+
18
+ if (size || color) {
19
+ style = _objectSpread(_objectSpread({}, style), {}, {
20
+ fontSize: size,
21
+ color: color
22
+ });
23
+ }
24
+
25
+ return /*#__PURE__*/React.createElement("svg", {
26
+ className: classNames("".concat(PREFIX_CLS, "-symbol-icon"), className),
27
+ "aria-hidden": "true",
28
+ style: style
29
+ }, /*#__PURE__*/React.createElement("use", {
30
+ xlinkHref: "#".concat(name)
31
+ }));
32
+ }
@@ -0,0 +1,14 @@
1
+ import { CSSProperties } from 'react';
2
+ import type { MouseEvent } from 'react';
3
+ interface Props {
4
+ tabs: {
5
+ title: string;
6
+ key?: string;
7
+ }[];
8
+ activeKey?: string;
9
+ className?: string;
10
+ style?: CSSProperties;
11
+ onTabClick: (key: string, index: number, e: MouseEvent) => void;
12
+ }
13
+ export default function TabBar(props: Props): JSX.Element;
14
+ export {};
@@ -0,0 +1,52 @@
1
+ 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; }
2
+
3
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
4
+
5
+ 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."); }
6
+
7
+ 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); }
8
+
9
+ 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; }
10
+
11
+ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
12
+
13
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
14
+
15
+ import React, { useEffect, useState } from 'react';
16
+ import classNames from 'classnames';
17
+ import { PREFIX_CLS } from '../constants';
18
+ export default function TabBar(props) {
19
+ var tabs = props.tabs,
20
+ onTabClick = props.onTabClick,
21
+ activeKey = props.activeKey,
22
+ style = props.style,
23
+ className = props.className;
24
+ var prefixCls = "".concat(PREFIX_CLS, "-tab-bar");
25
+
26
+ var getKey = function getKey() {
27
+ return activeKey || (tabs.length > 0 ? tabs[0].key || tabs[0].title : undefined);
28
+ };
29
+
30
+ var _useState = useState(getKey()),
31
+ _useState2 = _slicedToArray(_useState, 2),
32
+ key = _useState2[0],
33
+ setKey = _useState2[1];
34
+
35
+ useEffect(function () {
36
+ setKey(getKey());
37
+ }, [activeKey]);
38
+ return /*#__PURE__*/React.createElement("div", {
39
+ className: classNames(prefixCls, className),
40
+ style: style
41
+ }, tabs.map(function (tab, index) {
42
+ var tabKey = tab.key || tab.title;
43
+ return /*#__PURE__*/React.createElement("div", {
44
+ key: tabKey,
45
+ className: classNames("".concat(prefixCls, "-item"), _defineProperty({}, "".concat(prefixCls, "-item-active"), key === tabKey)),
46
+ onClick: function onClick(e) {
47
+ setKey(tabKey);
48
+ onTabClick(tabKey, index, e);
49
+ }
50
+ }, tab.title);
51
+ }));
52
+ }
@@ -0,0 +1,2 @@
1
+ import type { TableProps } from './typings';
2
+ export default function Table<RecordType extends Record<string, any>>(props: TableProps<RecordType>): JSX.Element;
@@ -0,0 +1,236 @@
1
+ var _excluded = ["dataSource", "fetch", "actionRef", "onLoading", "columns", "pagination", "autoLoad"];
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 asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
10
+
11
+ function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
12
+
13
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
14
+
15
+ 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."); }
16
+
17
+ 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); }
18
+
19
+ 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; }
20
+
21
+ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
22
+
23
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
24
+
25
+ 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; }
26
+
27
+ 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; }
28
+
29
+ import React, { useMemo, useState, useImperativeHandle, useEffect } from 'react';
30
+ import { useRequest } from '@lemon-fe/hooks';
31
+ import BaseTable from '../BaseTable';
32
+ import { isSortValue } from './utils';
33
+ import empty from '../BaseTable/empty.png';
34
+ import { PREFIX_CLS } from '../constants';
35
+ export default function Table(props) {
36
+ var _props$dataSource = props.dataSource,
37
+ dataSource = _props$dataSource === void 0 ? [] : _props$dataSource,
38
+ fetch = props.fetch,
39
+ actionRef = props.actionRef,
40
+ onLoading = props.onLoading,
41
+ columns = props.columns,
42
+ pagination = props.pagination,
43
+ autoLoad = props.autoLoad,
44
+ restProps = _objectWithoutProperties(props, _excluded);
45
+
46
+ var defaultPageSize = 50;
47
+
48
+ var _useState = useState(1),
49
+ _useState2 = _slicedToArray(_useState, 2),
50
+ current = _useState2[0],
51
+ setCurrent = _useState2[1];
52
+
53
+ var _useState3 = useState(pagination && pagination.pageSize || defaultPageSize),
54
+ _useState4 = _slicedToArray(_useState3, 2),
55
+ pageSize = _useState4[0],
56
+ setPageSize = _useState4[1];
57
+
58
+ var _useState5 = useState([]),
59
+ _useState6 = _slicedToArray(_useState5, 2),
60
+ sort = _useState6[0],
61
+ setSort = _useState6[1];
62
+
63
+ var _useState7 = useState({}),
64
+ _useState8 = _slicedToArray(_useState7, 2),
65
+ remote = _useState8[0],
66
+ setRemote = _useState8[1];
67
+
68
+ var _useRequest = useRequest( /*#__PURE__*/function () {
69
+ var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(params) {
70
+ var result;
71
+ return regeneratorRuntime.wrap(function _callee$(_context) {
72
+ while (1) {
73
+ switch (_context.prev = _context.next) {
74
+ case 0:
75
+ if (onLoading) {
76
+ onLoading(true);
77
+ }
78
+
79
+ result = {
80
+ data: [],
81
+ total: 0
82
+ };
83
+
84
+ if (!fetch) {
85
+ _context.next = 6;
86
+ break;
87
+ }
88
+
89
+ _context.next = 5;
90
+ return fetch(params);
91
+
92
+ case 5:
93
+ result = _context.sent;
94
+
95
+ case 6:
96
+ return _context.abrupt("return", {
97
+ result: result,
98
+ pageSize: pageSize,
99
+ current: current
100
+ });
101
+
102
+ case 7:
103
+ case "end":
104
+ return _context.stop();
105
+ }
106
+ }
107
+ }, _callee);
108
+ }));
109
+
110
+ return function (_x) {
111
+ return _ref.apply(this, arguments);
112
+ };
113
+ }(), {
114
+ loadingState: onLoading === undefined,
115
+ onSuccess: function onSuccess(res) {
116
+ if (onLoading) {
117
+ onLoading(false);
118
+ }
119
+
120
+ setRemote(_objectSpread(_objectSpread({}, res.result), {}, {
121
+ error: undefined
122
+ }));
123
+ },
124
+ onError: function onError(error) {
125
+ if (onLoading) {
126
+ onLoading(false);
127
+ }
128
+
129
+ setRemote({
130
+ data: [],
131
+ total: 0,
132
+ error: error
133
+ });
134
+ }
135
+ }),
136
+ postData = _useRequest.run,
137
+ loading = _useRequest.loading;
138
+
139
+ useImperativeHandle(actionRef, function () {
140
+ return {
141
+ fetch: function fetch(page) {
142
+ var curr = page || 1;
143
+ setCurrent(curr);
144
+ postData({
145
+ current: curr,
146
+ pageSize: pageSize,
147
+ sort: sort
148
+ });
149
+ },
150
+ refresh: function refresh() {
151
+ postData({
152
+ current: current,
153
+ pageSize: pageSize,
154
+ sort: sort
155
+ });
156
+ }
157
+ };
158
+ }, [pageSize, postData, current, sort]);
159
+ useEffect(function () {
160
+ if (autoLoad) {
161
+ postData({
162
+ current: current,
163
+ pageSize: pageSize,
164
+ sort: sort
165
+ });
166
+ }
167
+ }, []);
168
+
169
+ var _useMemo = useMemo(function () {
170
+ if (fetch) {
171
+ return [remote.total, remote.data];
172
+ }
173
+
174
+ return [dataSource.length, dataSource];
175
+ }, [dataSource, fetch, remote]),
176
+ _useMemo2 = _slicedToArray(_useMemo, 2),
177
+ total = _useMemo2[0],
178
+ data = _useMemo2[1];
179
+
180
+ return /*#__PURE__*/React.createElement(BaseTable, _objectSpread({
181
+ columns: columns,
182
+ dataSource: data,
183
+ summaryRecord: remote.summary,
184
+ loading: loading,
185
+ scroll: {
186
+ y: true
187
+ },
188
+ onChange: function onChange(mPage, _, mSort) {
189
+ var _mPage$current = mPage.current,
190
+ page = _mPage$current === void 0 ? 1 : _mPage$current,
191
+ _mPage$pageSize = mPage.pageSize,
192
+ size = _mPage$pageSize === void 0 ? defaultPageSize : _mPage$pageSize;
193
+ setPageSize(size);
194
+ setCurrent(page);
195
+ var result = [];
196
+
197
+ if (Array.isArray(mSort)) {
198
+ mSort.forEach(function (item) {
199
+ if (isSortValue(item)) {
200
+ result.push({
201
+ field: item.field,
202
+ order: item.order
203
+ });
204
+ }
205
+ });
206
+ } else if (isSortValue(mSort)) {
207
+ result.push({
208
+ field: mSort.field,
209
+ order: mSort.order
210
+ });
211
+ }
212
+
213
+ setSort(result);
214
+
215
+ if (fetch !== undefined) {
216
+ postData({
217
+ current: page,
218
+ pageSize: size,
219
+ sort: result
220
+ });
221
+ }
222
+ },
223
+ locale: remote.error ? {
224
+ emptyText: /*#__PURE__*/React.createElement("div", {
225
+ className: "".concat(PREFIX_CLS, "-table-empty")
226
+ }, /*#__PURE__*/React.createElement("img", {
227
+ src: empty
228
+ }), /*#__PURE__*/React.createElement("div", null, remote.error.message))
229
+ } : undefined,
230
+ pagination: pagination !== false ? _objectSpread({
231
+ current: current,
232
+ pageSize: pageSize,
233
+ total: total
234
+ }, pagination) : false
235
+ }, restProps));
236
+ }
@@ -0,0 +1,2 @@
1
+ import { SortType } from './typings';
2
+ export declare function isSortValue(data: Partial<SortType>): data is SortType;
@@ -0,0 +1,3 @@
1
+ export function isSortValue(data) {
2
+ return data.order !== null && data.order !== undefined;
3
+ }
@@ -0,0 +1,10 @@
1
+ import type { ReactNode } from 'react';
2
+ import { TooltipProps, TooltipPlacement } from 'antd/lib/tooltip';
3
+ interface TipMarkProps extends Omit<TooltipProps, 'placement'> {
4
+ infoContent: string | ReactNode;
5
+ prefixCls?: string;
6
+ mode?: string;
7
+ placement?: TooltipPlacement;
8
+ }
9
+ declare const TipMark: ({ prefixCls, infoContent, mode, placement, ...props }: TipMarkProps) => JSX.Element;
10
+ export default TipMark;
@@ -0,0 +1,45 @@
1
+ var _excluded = ["prefixCls", "infoContent", "mode", "placement"];
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 { QuestionCircleFilled } from '@ant-design/icons';
15
+ import { Tooltip, Popover } from 'antd';
16
+ import { PREFIX_CLS } from '../constants';
17
+
18
+ var TipMark = function TipMark(_ref) {
19
+ var _ref$prefixCls = _ref.prefixCls,
20
+ prefixCls = _ref$prefixCls === void 0 ? PREFIX_CLS : _ref$prefixCls,
21
+ infoContent = _ref.infoContent,
22
+ _ref$mode = _ref.mode,
23
+ mode = _ref$mode === void 0 ? 'toolTip' : _ref$mode,
24
+ _ref$placement = _ref.placement,
25
+ placement = _ref$placement === void 0 ? 'bottom' : _ref$placement,
26
+ props = _objectWithoutProperties(_ref, _excluded);
27
+
28
+ if (mode === 'toolTip') {
29
+ return /*#__PURE__*/React.createElement(Tooltip, _objectSpread({
30
+ title: infoContent,
31
+ placement: placement
32
+ }, props), /*#__PURE__*/React.createElement(QuestionCircleFilled, {
33
+ className: "".concat(prefixCls, "-tip-mark-questionIcon")
34
+ }));
35
+ }
36
+
37
+ return /*#__PURE__*/React.createElement(Popover, _objectSpread({
38
+ content: infoContent,
39
+ placement: placement
40
+ }, props), /*#__PURE__*/React.createElement(QuestionCircleFilled, {
41
+ className: "".concat(prefixCls, "-tip-mark-questionIcon")
42
+ }));
43
+ };
44
+
45
+ export default TipMark;
@@ -0,0 +1 @@
1
+ export declare const PREFIX_CLS = "lemon";
@@ -0,0 +1 @@
1
+ export var PREFIX_CLS = 'lemon';
package/es/index.d.ts ADDED
@@ -0,0 +1,33 @@
1
+ export * from './constants';
2
+ export { default as PageLoading } from './PageLoading';
3
+ export { default as Actions } from './Actions';
4
+ export { default as Filter } from './Filter';
5
+ export type { FilterItemType } from './Filter/typings';
6
+ export { default as BaseTable } from './BaseTable';
7
+ export type { BaseTableProps, ColumnType, ColumnsType } from './BaseTable/typings';
8
+ export { default as Section } from './Section';
9
+ export { default as Layout } from './Layout';
10
+ export { default as Table } from './Table';
11
+ export type { TableProps, TableRef } from './Table/typings';
12
+ export { default as DurationPicker } from './DurationPicker';
13
+ export { default as InputMaxLength } from './InputMaxLength';
14
+ export { default as TipMark } from './TipMark';
15
+ export { default as ColorPicker } from './ColorPicker';
16
+ export { default as EditableTable } from './EditableTable';
17
+ export { default as EditableCell } from './EditableTable/EditableCell';
18
+ export { default as EditableTableFormItem } from './EditableTable/EditableTableFormItem';
19
+ export type { EditableTableProps, EditableTableColumnType, EditableCellFocusedType, EditableTableRef, EditableTableRule, } from './EditableTable/typings';
20
+ export { default as Popup } from './Popup';
21
+ export { default as SiderTree } from './SiderTree';
22
+ export { default as Icons } from './Icons';
23
+ export { default as FormLayout } from './FormLayout';
24
+ export { default as MainFramework } from './MainFramework';
25
+ export { default as init } from './init';
26
+ export { default as FormHorizontal } from './FormHorizontal';
27
+ export { default as FormInline } from './FormInline';
28
+ export { default as FormTable } from './FormTable';
29
+ export type { FormTableColumnType, FormTableProps, FormTableRef } from './FormTable/typings';
30
+ export { default as TabBar } from './TabBar';
31
+ export { default as SymbolIcon } from './SymbolIcon';
32
+ export { default as Dropdown } from './Dropdown';
33
+ export { default as SelectView } from './SelectView';
package/es/index.js ADDED
@@ -0,0 +1,28 @@
1
+ export * from './constants';
2
+ export { default as PageLoading } from './PageLoading';
3
+ export { default as Actions } from './Actions';
4
+ export { default as Filter } from './Filter';
5
+ export { default as BaseTable } from './BaseTable';
6
+ export { default as Section } from './Section';
7
+ export { default as Layout } from './Layout';
8
+ export { default as Table } from './Table';
9
+ export { default as DurationPicker } from './DurationPicker';
10
+ export { default as InputMaxLength } from './InputMaxLength';
11
+ export { default as TipMark } from './TipMark';
12
+ export { default as ColorPicker } from './ColorPicker';
13
+ export { default as EditableTable } from './EditableTable';
14
+ export { default as EditableCell } from './EditableTable/EditableCell';
15
+ export { default as EditableTableFormItem } from './EditableTable/EditableTableFormItem';
16
+ export { default as Popup } from './Popup';
17
+ export { default as SiderTree } from './SiderTree';
18
+ export { default as Icons } from './Icons';
19
+ export { default as FormLayout } from './FormLayout';
20
+ export { default as MainFramework } from './MainFramework';
21
+ export { default as init } from './init';
22
+ export { default as FormHorizontal } from './FormHorizontal';
23
+ export { default as FormInline } from './FormInline';
24
+ export { default as FormTable } from './FormTable';
25
+ export { default as TabBar } from './TabBar';
26
+ export { default as SymbolIcon } from './SymbolIcon';
27
+ export { default as Dropdown } from './Dropdown';
28
+ export { default as SelectView } from './SelectView';
package/es/init.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ export default function init(opts?: {
2
+ enableCNZZ?: boolean | string;
3
+ }): void;
package/es/init.js ADDED
@@ -0,0 +1,149 @@
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
+ 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
+
9
+ import React from 'react';
10
+ import { message, Modal, Select, ConfigProvider, Result, Button, version, DatePicker, Cascader, TreeSelect } from 'antd';
11
+ import { config } from '@lemon-fe/hooks';
12
+ import PageLoading from './PageLoading';
13
+ import Icons from './Icons';
14
+ var Tip = Icons.Tip,
15
+ Down = Icons.Down,
16
+ BigTip = Icons.BigTip,
17
+ Close = Icons.Close;
18
+ export default function init() {
19
+ var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
20
+
21
+ // 添加站长统计
22
+ if (opts.enableCNZZ) {
23
+ var _node = document.createElement('script');
24
+
25
+ _node.innerHTML = "\n var _czc = _czc || [];\n window._czc&&window._czc.push(['_setAutoPageview', false]);\n ";
26
+ document.body.appendChild(_node);
27
+ _node = document.createElement('script');
28
+
29
+ if (typeof opts.enableCNZZ === 'string') {
30
+ _node.src = opts.enableCNZZ;
31
+ } else {
32
+ _node.src = '//v1.cnzz.com/z_stat.php?id=1280732258&web_id=1280732258';
33
+ }
34
+
35
+ document.body.appendChild(_node);
36
+ }
37
+
38
+ var types = ['success', 'error', 'warning', 'info'];
39
+ types.forEach(function (item) {
40
+ var msgAPI = message[item].bind(message);
41
+ var modalAPI = Modal[item].bind(Modal);
42
+
43
+ message[item] = function () {
44
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
45
+ args[_key] = arguments[_key];
46
+ }
47
+
48
+ var args0 = args[0],
49
+ args1 = args[1],
50
+ args2 = args[2];
51
+
52
+ if (args.length === 1 && _typeof(args0) === 'object' && ! /*#__PURE__*/React.isValidElement(args0)) {
53
+ return msgAPI(_objectSpread({
54
+ icon: /*#__PURE__*/React.createElement(Tip, {
55
+ type: item
56
+ })
57
+ }, args0));
58
+ }
59
+
60
+ return msgAPI({
61
+ content: args0,
62
+ duration: args1,
63
+ onClose: args2,
64
+ icon: /*#__PURE__*/React.createElement(Tip, {
65
+ type: item
66
+ })
67
+ });
68
+ };
69
+
70
+ Modal[item] = function () {
71
+ return modalAPI(_objectSpread({
72
+ icon: /*#__PURE__*/React.createElement(BigTip, {
73
+ type: item
74
+ }),
75
+ title: '提示'
76
+ }, arguments.length <= 0 ? undefined : arguments[0]));
77
+ };
78
+ });
79
+ var modalConfirm = Modal.confirm.bind(Modal);
80
+
81
+ Modal.confirm = function () {
82
+ return modalConfirm(_objectSpread({
83
+ icon: /*#__PURE__*/React.createElement(BigTip, {
84
+ type: "info"
85
+ }),
86
+ title: '提示'
87
+ }, arguments.length <= 0 ? undefined : arguments[0]));
88
+ };
89
+
90
+ Modal.defaultProps = _objectSpread(_objectSpread({}, Modal.defaultProps), {}, {
91
+ closeIcon: /*#__PURE__*/React.createElement(Close, null)
92
+ });
93
+ var node = /*#__PURE__*/React.createElement(Down, {
94
+ style: {
95
+ marginRight: -1
96
+ }
97
+ }); //@ts-ignore
98
+
99
+ Select.defaultProps = {
100
+ suffixIcon: version >= '4.18.9' ? node : function () {
101
+ return node;
102
+ }
103
+ }; //@ts-ignore
104
+
105
+ TreeSelect.defaultProps = {
106
+ suffixIcon: version >= '4.18.9' ? node : function () {
107
+ return node;
108
+ }
109
+ }; //@ts-ignore
110
+
111
+ Cascader.defaultProps = {
112
+ suffixIcon: node
113
+ };
114
+ DatePicker.RangePicker.defaultProps = {
115
+ suffixIcon: /*#__PURE__*/React.createElement(Icons.Calendar, null)
116
+ };
117
+ config({
118
+ showToast: function showToast() {
119
+ return message.loading('请稍等', 0);
120
+ },
121
+ cancelToast: function cancelToast(hide) {
122
+ hide();
123
+ },
124
+ showLoading: function showLoading() {
125
+ return /*#__PURE__*/React.createElement(PageLoading, null);
126
+ },
127
+ showError: function showError(err) {
128
+ message.error(err.message);
129
+ },
130
+ setPrimaryColor: function setPrimaryColor(color) {
131
+ ConfigProvider.config({
132
+ theme: {
133
+ primaryColor: color
134
+ }
135
+ });
136
+ },
137
+ errorResult: function errorResult(err, refresh) {
138
+ return /*#__PURE__*/React.createElement(Result, {
139
+ status: "500",
140
+ title: "500",
141
+ subTitle: err.message,
142
+ extra: /*#__PURE__*/React.createElement(Button, {
143
+ type: "primary",
144
+ onClick: refresh
145
+ }, "\u91CD\u65B0\u52A0\u8F7D")
146
+ });
147
+ }
148
+ });
149
+ }
package/es/utils.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ import type { ReactNode } from 'react';
2
+ export declare const mapChildren: (children: ReactNode, cb: (node: ReactNode, index: number) => ReactNode) => ReactNode[];
package/es/utils.js ADDED
@@ -0,0 +1,14 @@
1
+ // 不使用Children.map的原因是由于它会给子节点生成一个key与tabs的activeTabKey无法对应
2
+ export var mapChildren = function mapChildren(children, cb) {
3
+ var nodes = [];
4
+
5
+ if (Array.isArray(children)) {
6
+ nodes = children;
7
+ } else {
8
+ nodes = [children];
9
+ }
10
+
11
+ return nodes.filter(function (item) {
12
+ return item !== null && item !== undefined;
13
+ }).map(cb);
14
+ };