@lemon-fe/components 0.0.0

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 (91) hide show
  1. package/README.md +11 -0
  2. package/es/Actions/index.d.ts +25 -0
  3. package/es/Actions/index.js +164 -0
  4. package/es/Actions/index.less +82 -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 +115 -0
  9. package/es/BaseTable/Sort.d.ts +10 -0
  10. package/es/BaseTable/Sort.js +122 -0
  11. package/es/BaseTable/VirtualBody.d.ts +8 -0
  12. package/es/BaseTable/VirtualBody.js +165 -0
  13. package/es/BaseTable/index.d.ts +7 -0
  14. package/es/BaseTable/index.js +371 -0
  15. package/es/BaseTable/index.less +103 -0
  16. package/es/BaseTable/typings.d.ts +32 -0
  17. package/es/BaseTable/utils.d.ts +4 -0
  18. package/es/BaseTable/utils.js +26 -0
  19. package/es/DurationPicker/index.d.ts +26 -0
  20. package/es/DurationPicker/index.js +234 -0
  21. package/es/DurationPicker/index.less +63 -0
  22. package/es/EditableTable/EditableCell.d.ts +11 -0
  23. package/es/EditableTable/EditableCell.js +37 -0
  24. package/es/EditableTable/EditableTableFormItem.d.ts +6 -0
  25. package/es/EditableTable/EditableTableFormItem.js +49 -0
  26. package/es/EditableTable/Table.d.ts +7 -0
  27. package/es/EditableTable/Table.js +363 -0
  28. package/es/EditableTable/index.d.ts +9 -0
  29. package/es/EditableTable/index.js +8 -0
  30. package/es/EditableTable/index.less +19 -0
  31. package/es/EditableTable/typings.d.ts +86 -0
  32. package/es/EditableTable/util.d.ts +25 -0
  33. package/es/EditableTable/util.js +387 -0
  34. package/es/Filter/index.d.ts +7 -0
  35. package/es/Filter/index.js +469 -0
  36. package/es/Filter/index.less +77 -0
  37. package/es/Filter/typings.d.ts +27 -0
  38. package/es/FormLayout/index.d.ts +32 -0
  39. package/es/FormLayout/index.js +41 -0
  40. package/es/FormLayout/index.less +89 -0
  41. package/es/Icons/DarkSearch.d.ts +5 -0
  42. package/es/Icons/DarkSearch.js +38 -0
  43. package/es/Icons/Down.d.ts +5 -0
  44. package/es/Icons/Down.js +30 -0
  45. package/es/Icons/Empty.d.ts +2 -0
  46. package/es/Icons/Empty.js +267 -0
  47. package/es/Icons/Search.d.ts +5 -0
  48. package/es/Icons/Search.js +39 -0
  49. package/es/Icons/Tip.d.ts +6 -0
  50. package/es/Icons/Tip.js +169 -0
  51. package/es/Icons/index.d.ts +12 -0
  52. package/es/Icons/index.js +13 -0
  53. package/es/InputMaxLength/index.d.ts +14 -0
  54. package/es/InputMaxLength/index.js +92 -0
  55. package/es/InputMaxLength/index.less +8 -0
  56. package/es/Layout/index.d.ts +21 -0
  57. package/es/Layout/index.js +35 -0
  58. package/es/Layout/index.less +92 -0
  59. package/es/PageLoading/index.d.ts +5 -0
  60. package/es/PageLoading/index.js +15 -0
  61. package/es/PageLoading/index.less +10 -0
  62. package/es/Popup/index.d.ts +27 -0
  63. package/es/Popup/index.js +191 -0
  64. package/es/Popup/index.less +14 -0
  65. package/es/Section/index.d.ts +54 -0
  66. package/es/Section/index.js +111 -0
  67. package/es/Section/index.less +177 -0
  68. package/es/SiderTree/TreeNodeTitle.d.ts +9 -0
  69. package/es/SiderTree/TreeNodeTitle.js +124 -0
  70. package/es/SiderTree/index.d.ts +35 -0
  71. package/es/SiderTree/index.js +237 -0
  72. package/es/SiderTree/index.less +170 -0
  73. package/es/SiderTree/typings.d.ts +19 -0
  74. package/es/Table/index.d.ts +3 -0
  75. package/es/Table/index.js +224 -0
  76. package/es/Table/index.less +1 -0
  77. package/es/Table/typings.d.ts +26 -0
  78. package/es/Table/utils.d.ts +2 -0
  79. package/es/Table/utils.js +3 -0
  80. package/es/TipMark/index.d.ts +10 -0
  81. package/es/TipMark/index.js +45 -0
  82. package/es/TipMark/index.less +8 -0
  83. package/es/constants.d.ts +1 -0
  84. package/es/constants.js +1 -0
  85. package/es/index.d.ts +21 -0
  86. package/es/index.js +17 -0
  87. package/es/index.less +50 -0
  88. package/es/init.d.ts +3 -0
  89. package/es/init.js +100 -0
  90. package/es/theme.less +13 -0
  91. package/package.json +43 -0
@@ -0,0 +1,26 @@
1
+ export function isColumnType(col) {
2
+ return col.children === undefined;
3
+ }
4
+ export function getColumnKey(col) {
5
+ if (typeof col.dataIndex === 'string' || typeof col.dataIndex === 'number') {
6
+ return col.dataIndex;
7
+ }
8
+
9
+ if (Array.isArray(col.dataIndex)) {
10
+ return col.dataIndex.join('-');
11
+ }
12
+
13
+ return col.key;
14
+ }
15
+ export function randomStr() {
16
+ var len = 8;
17
+ var chars = 'ABCDEFGHJKMNPQRSTWXYZabcdefhijkmnprstwxyz';
18
+ var maxPos = chars.length;
19
+ var pwd = '';
20
+
21
+ for (var i = 0; i < len; i += 1) {
22
+ pwd += chars.charAt(Math.floor(Math.random() * maxPos));
23
+ }
24
+
25
+ return pwd;
26
+ }
@@ -0,0 +1,26 @@
1
+ /// <reference types="react" />
2
+ import type { Moment } from 'moment';
3
+ import type { RangePickerProps } from 'antd/lib/date-picker';
4
+ declare type Value = {
5
+ type: string;
6
+ option: string;
7
+ dates?: [string, string];
8
+ };
9
+ declare type DateType = {
10
+ label: string;
11
+ value: string;
12
+ };
13
+ declare type Option = {
14
+ label: string;
15
+ value: (() => [Moment, Moment]) | null;
16
+ };
17
+ interface Props extends Omit<RangePickerProps, 'value' | 'onChange'> {
18
+ prefixCls?: string;
19
+ types: DateType[];
20
+ options?: Option[];
21
+ dateFormat?: string;
22
+ value?: Value;
23
+ onChange?: (value: Value) => void;
24
+ }
25
+ export default function DurationPicker(props: Props): JSX.Element;
26
+ export {};
@@ -0,0 +1,234 @@
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 _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
8
+
9
+ 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."); }
10
+
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
+
13
+ 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; }
14
+
15
+ 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; }
16
+
17
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
18
+
19
+ import React, { useMemo, useState, useEffect } from 'react';
20
+ import { DatePicker, Dropdown, Menu } from 'antd';
21
+ import moment from 'moment';
22
+ import { PREFIX_CLS } from '../constants';
23
+ import Down from '../Icons/Down';
24
+ var defaultOptions = [{
25
+ label: '今天',
26
+ value: function value() {
27
+ return [moment().startOf('day'), moment().endOf('day')];
28
+ }
29
+ }, {
30
+ label: '昨天',
31
+ value: function value() {
32
+ return [moment().add(-1, 'days').startOf('day'), moment().add(-1, 'days').endOf('day')];
33
+ }
34
+ }, {
35
+ label: '最近3日',
36
+ value: function value() {
37
+ return [moment().add(-2, 'days'), moment()];
38
+ }
39
+ }, {
40
+ label: '本周',
41
+ value: function value() {
42
+ return [moment().startOf('isoWeek'), moment().endOf('isoWeek')];
43
+ }
44
+ }, {
45
+ label: '上周',
46
+ value: function value() {
47
+ return [moment().startOf('isoWeek').add(-1, 'week'), moment().endOf('isoWeek').add(-1, 'week')];
48
+ }
49
+ }, {
50
+ label: '最近7日',
51
+ value: function value() {
52
+ return [moment().add(-6, 'days'), moment()];
53
+ }
54
+ }, {
55
+ label: '本月',
56
+ value: function value() {
57
+ return [moment().startOf('month'), moment().endOf('month')];
58
+ }
59
+ }, {
60
+ label: '上月',
61
+ value: function value() {
62
+ return [moment().add(-1, 'months').startOf('month'), moment().add(-1, 'months').endOf('month')];
63
+ }
64
+ }, {
65
+ label: '最近30日',
66
+ value: function value() {
67
+ return [moment().add(-29, 'days').startOf('day'), moment().endOf('day')];
68
+ }
69
+ }, {
70
+ label: '本季',
71
+ value: function value() {
72
+ return [moment().startOf('quarter'), moment().endOf('quarter')];
73
+ }
74
+ }, {
75
+ label: '上季',
76
+ value: function value() {
77
+ return [moment().add(-1, 'quarters').startOf('quarter'), moment().add(-1, 'quarters').endOf('quarter')];
78
+ }
79
+ }, {
80
+ label: '最近90日',
81
+ value: function value() {
82
+ return [moment().add(-89, 'days').startOf('day'), moment().endOf('day')];
83
+ }
84
+ }, {
85
+ label: '最近120日',
86
+ value: function value() {
87
+ return [moment().add(-119, 'days').startOf('day'), moment().endOf('day')];
88
+ }
89
+ }, {
90
+ label: '今年',
91
+ value: function value() {
92
+ return [moment().startOf('year'), moment().endOf('year')];
93
+ }
94
+ }, {
95
+ label: '自定义时段',
96
+ value: null
97
+ }];
98
+ export default function DurationPicker(props) {
99
+ var _result$type, _result$option, _result$option2;
100
+
101
+ var _props$prefixCls = props.prefixCls,
102
+ prefixCls = _props$prefixCls === void 0 ? PREFIX_CLS : _props$prefixCls,
103
+ types = props.types,
104
+ _props$options = props.options,
105
+ options = _props$options === void 0 ? defaultOptions : _props$options,
106
+ valueProp = props.value,
107
+ _props$dateFormat = props.dateFormat,
108
+ dateFormat = _props$dateFormat === void 0 ? 'YYYY-MM-DD' : _props$dateFormat,
109
+ onChange = props.onChange;
110
+ var defaultValue = useMemo(function () {
111
+ if (valueProp === undefined) {
112
+ var _options$0$value, _options$;
113
+
114
+ return {
115
+ type: types[0].value,
116
+ option: options[0].label,
117
+ dates: (_options$0$value = (_options$ = options[0]).value) === null || _options$0$value === void 0 ? void 0 : _options$0$value.call(_options$).map(function (item) {
118
+ return item.format(dateFormat);
119
+ })
120
+ };
121
+ }
122
+
123
+ return valueProp;
124
+ }, []);
125
+
126
+ var _useState = useState(defaultValue),
127
+ _useState2 = _slicedToArray(_useState, 2),
128
+ value = _useState2[0],
129
+ setValue = _useState2[1];
130
+
131
+ useEffect(function () {
132
+ if (value !== defaultValue && value !== valueProp && onChange) {
133
+ onChange(value);
134
+ }
135
+ }, [value]);
136
+ useEffect(function () {
137
+ if (valueProp !== undefined) {
138
+ setValue(valueProp);
139
+ }
140
+ }, [valueProp]);
141
+ var result = useMemo(function () {
142
+ var type = types.find(function (item) {
143
+ return item.value === value.type;
144
+ });
145
+ var option = options.find(function (item) {
146
+ return item.label === value.option;
147
+ });
148
+ var dates = value.dates ? value.dates.map(function (date) {
149
+ return moment(date, dateFormat);
150
+ }) : undefined;
151
+ return {
152
+ type: type,
153
+ option: option,
154
+ dates: dates
155
+ };
156
+ }, [value]);
157
+
158
+ var handleChangeType = function handleChangeType(item) {
159
+ setValue(function (prev) {
160
+ if (item.value === prev.type) {
161
+ return prev;
162
+ }
163
+
164
+ return _objectSpread(_objectSpread({}, prev), {}, {
165
+ type: item.value
166
+ });
167
+ });
168
+ };
169
+
170
+ var handleChangeOption = function handleChangeOption(item) {
171
+ setValue(function (prev) {
172
+ if (item.label === prev.option) {
173
+ return prev;
174
+ }
175
+
176
+ return _objectSpread(_objectSpread({}, prev), {}, {
177
+ option: item.label,
178
+ dates: item.value !== null ? item.value().map(function (date) {
179
+ return date.format(dateFormat);
180
+ }) : undefined
181
+ });
182
+ });
183
+ };
184
+
185
+ var handleChangeDates = function handleChangeDates(dates) {
186
+ setValue(function (prev) {
187
+ return _objectSpread(_objectSpread({}, prev), {}, {
188
+ dates: dates ? dates.map(function (item) {
189
+ return item.format(dateFormat);
190
+ }) : undefined
191
+ });
192
+ });
193
+ };
194
+
195
+ return /*#__PURE__*/React.createElement("div", {
196
+ className: "".concat(prefixCls, "-duration")
197
+ }, /*#__PURE__*/React.createElement(Dropdown, {
198
+ overlay: /*#__PURE__*/React.createElement(Menu, null, types.map(function (item) {
199
+ return /*#__PURE__*/React.createElement(Menu.Item, {
200
+ onClick: function onClick() {
201
+ return handleChangeType(item);
202
+ },
203
+ key: item.value
204
+ }, item.label);
205
+ }))
206
+ }, /*#__PURE__*/React.createElement("div", {
207
+ className: "".concat(prefixCls, "-duration-type")
208
+ }, (_result$type = result.type) === null || _result$type === void 0 ? void 0 : _result$type.label, /*#__PURE__*/React.createElement(Down, {
209
+ style: {
210
+ color: '#BFBFBF'
211
+ }
212
+ }))), /*#__PURE__*/React.createElement("div", {
213
+ className: "".concat(prefixCls, "-duration-picker")
214
+ }, /*#__PURE__*/React.createElement(Dropdown, {
215
+ overlay: /*#__PURE__*/React.createElement(Menu, null, options.map(function (item) {
216
+ return /*#__PURE__*/React.createElement(Menu.Item, {
217
+ key: item.label,
218
+ onClick: function onClick() {
219
+ return handleChangeOption(item);
220
+ }
221
+ }, item.label);
222
+ }))
223
+ }, /*#__PURE__*/React.createElement("div", {
224
+ className: "".concat(prefixCls, "-duration-option")
225
+ }, (_result$option = result.option) === null || _result$option === void 0 ? void 0 : _result$option.label, /*#__PURE__*/React.createElement(Down, {
226
+ style: {
227
+ color: '#BFBFBF'
228
+ }
229
+ }))), /*#__PURE__*/React.createElement(DatePicker.RangePicker, {
230
+ value: result.dates,
231
+ onChange: handleChangeDates,
232
+ disabled: ((_result$option2 = result.option) === null || _result$option2 === void 0 ? void 0 : _result$option2.value) !== null
233
+ })));
234
+ }
@@ -0,0 +1,63 @@
1
+ @import '../theme.less';
2
+
3
+ .@{prefixCls}-duration {
4
+ display: flex;
5
+ width: 100%;
6
+ height: @height-base;
7
+
8
+ .ant-dropdown-trigger {
9
+ display: flex;
10
+ align-items: center;
11
+ justify-content: space-between;
12
+ height: 100%;
13
+ padding: 0 12px 0 16px;
14
+ color: #686868;
15
+ font-size: 14px;
16
+ text-align: center;
17
+ cursor: pointer;
18
+
19
+ & > .anticon {
20
+ margin-left: 8px;
21
+ font-size: 16px;
22
+ }
23
+ }
24
+
25
+ &-type.ant-dropdown-trigger {
26
+ flex: 0 0 138px;
27
+ margin-right: 8px;
28
+ border: 1px solid @select-border-color;
29
+ border-radius: @border-radius-base;
30
+ }
31
+
32
+ &-option.ant-dropdown-trigger {
33
+ position: relative;
34
+ flex: 0 0 122px;
35
+
36
+ &::after {
37
+ position: absolute;
38
+ top: 50%;
39
+ right: 0;
40
+ display: block;
41
+ width: 1px;
42
+ height: 14px;
43
+ margin-top: -7px;
44
+ background-color: #d8d8d8;
45
+ content: '';
46
+ }
47
+ }
48
+
49
+ &-picker {
50
+ display: flex;
51
+ flex: 1;
52
+ height: 100%;
53
+ border: 1px solid @select-border-color;
54
+ border-radius: @border-radius-base;
55
+
56
+ .ant-picker {
57
+ flex: 1;
58
+ border: none;
59
+ outline: none;
60
+ box-shadow: none;
61
+ }
62
+ }
63
+ }
@@ -0,0 +1,11 @@
1
+ import { ReactNode } from 'react';
2
+ import { EditableCellFocusedType } from './typings';
3
+ export default function EditableCell(props: {
4
+ focused: EditableCellFocusedType;
5
+ children: ReactNode;
6
+ bordered?: boolean;
7
+ disableUpDown?: boolean;
8
+ disableLeftRight?: boolean;
9
+ errors?: string[];
10
+ onFocus: () => void;
11
+ }): JSX.Element;
@@ -0,0 +1,37 @@
1
+ import React from 'react';
2
+ import { message } from 'antd';
3
+ import classNames from 'classnames';
4
+ import { get } from 'lodash';
5
+ import { PREFIX_CLS } from '../constants';
6
+ import Icons from '../Icons';
7
+ export default function EditableCell(props) {
8
+ var focused = props.focused,
9
+ onFocus = props.onFocus,
10
+ children = props.children,
11
+ disableUpDown = props.disableUpDown,
12
+ disableLeftRight = props.disableLeftRight,
13
+ errors = props.errors,
14
+ _props$bordered = props.bordered,
15
+ bordered = _props$bordered === void 0 ? true : _props$bordered;
16
+ var disabled = get(children, 'props.disabled');
17
+ return /*#__PURE__*/React.createElement("div", {
18
+ onFocus: onFocus,
19
+ "data-up-down": disableUpDown ? '0' : '1',
20
+ "data-left-right": disableLeftRight ? '0' : '1',
21
+ className: classNames("".concat(PREFIX_CLS, "-form-item"), {
22
+ 'ant-input': focused >= 1 && bordered,
23
+ 'ant-input-focused': focused >= 2 && bordered,
24
+ 'ant-input-disabled': disabled
25
+ })
26
+ }, children, errors !== undefined ? /*#__PURE__*/React.createElement("div", {
27
+ className: "".concat(PREFIX_CLS, "-form-item-error"),
28
+ onClick: function onClick() {
29
+ return message.warning(errors.join('\n'));
30
+ },
31
+ onFocus: function onFocus(e) {
32
+ return e.stopPropagation();
33
+ }
34
+ }, /*#__PURE__*/React.createElement(Icons.Tip, {
35
+ type: "warning"
36
+ })) : null);
37
+ }
@@ -0,0 +1,6 @@
1
+ /// <reference types="react" />
2
+ import { FormItemProps } from 'antd';
3
+ import { EditableTableProps } from './typings';
4
+ declare type Props<T> = Pick<FormItemProps, 'name' | 'label' | 'labelCol' | 'wrapperCol' | 'className' | 'required' | 'style' | 'colon'> & EditableTableProps<T>;
5
+ export default function EditableTableFormItem<T>(props: Props<T>): JSX.Element;
6
+ export {};
@@ -0,0 +1,49 @@
1
+ var _excluded = ["name", "label", "labelCol", "wrapperCol", "className", "required", "style", "colon"];
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, { useRef } from 'react';
14
+ import { Form } from 'antd';
15
+ import Table from './Table';
16
+ export default function EditableTableFormItem(props) {
17
+ var name = props.name,
18
+ label = props.label,
19
+ labelCol = props.labelCol,
20
+ wrapperCol = props.wrapperCol,
21
+ className = props.className,
22
+ required = props.required,
23
+ style = props.style,
24
+ colon = props.colon,
25
+ tableProps = _objectWithoutProperties(props, _excluded);
26
+
27
+ var ref = useRef(null);
28
+ return /*#__PURE__*/React.createElement(Form.Item, {
29
+ name: name,
30
+ noStyle: true,
31
+ label: label,
32
+ labelCol: labelCol,
33
+ wrapperCol: wrapperCol,
34
+ className: className,
35
+ required: required,
36
+ style: style,
37
+ colon: colon,
38
+ validateTrigger: [],
39
+ rules: [{
40
+ validator: function validator() {
41
+ if (ref.current) {
42
+ return ref.current.validate();
43
+ }
44
+
45
+ return;
46
+ }
47
+ }]
48
+ }, /*#__PURE__*/React.createElement(Table, _objectSpread({}, tableProps)));
49
+ }
@@ -0,0 +1,7 @@
1
+ import { MutableRefObject } from 'react';
2
+ import { EditableTableProps, EditableTableRef } from './typings';
3
+ declare type RefType = ((instance: EditableTableRef | null) => void) | MutableRefObject<EditableTableRef | null> | null;
4
+ declare const _default: <T>(props: EditableTableProps<T> & {
5
+ ref?: RefType | undefined;
6
+ }) => JSX.Element;
7
+ export default _default;