linkmore-design 1.1.11 → 1.1.12

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.
@@ -9802,6 +9802,24 @@ p {
9802
9802
  color: var(--color-85);
9803
9803
  margin-left: 0 !important;
9804
9804
  }
9805
+ .lm_table_append_add_popover .ant-popover-inner-content {
9806
+ padding: 0px;
9807
+ }
9808
+ .lm_table_append_add_popover .ant-popover-inner-content ul {
9809
+ margin: 0;
9810
+ }
9811
+ .lm_table_append_add_popover .ant-popover-inner-content ul li {
9812
+ font-size: 12px;
9813
+ padding: 4px 8px;
9814
+ height: 24px;
9815
+ display: flex;
9816
+ align-items: center;
9817
+ justify-content: center;
9818
+ cursor: pointer;
9819
+ }
9820
+ .lm_table_append_add_popover .ant-popover-inner-content ul li:hover {
9821
+ background-color: var(--color-15);
9822
+ }
9805
9823
  .lm_filter_wrapper .lm_filter_container .lm_filter {
9806
9824
  display: flex;
9807
9825
  flex-wrap: wrap;
@@ -53,7 +53,7 @@ var __rest = this && this.__rest || function (s, e) {
53
53
  import { PlusCircleOutlined } from '@ant-design/icons';
54
54
  import moment from 'moment';
55
55
  import { arrayMove } from '@dnd-kit/sortable';
56
- import { Button, Checkbox, IconFont, Input, InputNumber, Radio, Select, Table, Switch, DatePicker, Form } from 'linkmore-design';
56
+ import { Button, Checkbox, IconFont, Input, InputNumber, Radio, Select, Table, Switch, DatePicker, Form, Popover } from 'linkmore-design';
57
57
  import { get, set, isFunction, omit } from 'lodash';
58
58
  import React, { forwardRef, useContext, useEffect, useImperativeHandle, useMemo, useRef, useState, memo, useCallback } from 'react';
59
59
  import { useControllableValue } from 'ahooks';
@@ -238,6 +238,15 @@ var Opetate = function Opetate(_ref) {
238
238
  options = _ref$options === void 0 ? ['add', 'delete'] : _ref$options,
239
239
  getLength = _ref.getLength,
240
240
  quickOpetateClearAll = _ref.quickOpetateClearAll;
241
+
242
+ var appendChildren = function appendChildren() {
243
+ handleAdd === null || handleAdd === void 0 ? void 0 : handleAdd(record, true);
244
+ };
245
+
246
+ var appendAdd = function appendAdd() {
247
+ handleAdd === null || handleAdd === void 0 ? void 0 : handleAdd(record);
248
+ };
249
+
241
250
  return /*#__PURE__*/React.createElement("div", {
242
251
  style: {
243
252
  display: 'flex',
@@ -258,7 +267,27 @@ var Opetate = function Opetate(_ref) {
258
267
  onClick: function onClick() {
259
268
  return handleDelete(record[rowKey]);
260
269
  }
261
- }), options.includes('add') && /*#__PURE__*/React.createElement(Button, {
270
+ }), (options === null || options === void 0 ? void 0 : options.includes('add')) && (options === null || options === void 0 ? void 0 : options.includes('addInChildren')) ? /*#__PURE__*/React.createElement(Popover, {
271
+ placement: "bottom",
272
+ overlayClassName: 'lm_table_append_add_popover',
273
+ open: open,
274
+ title: null,
275
+ content: /*#__PURE__*/React.createElement("ul", null, /*#__PURE__*/React.createElement("li", {
276
+ onClick: appendAdd
277
+ }, "\u6DFB\u52A0\u5E73\u7EA7"), /*#__PURE__*/React.createElement("li", {
278
+ onClick: appendChildren
279
+ }, "\u6DFB\u52A0\u5B50\u7EA7")),
280
+ trigger: "hover"
281
+ }, /*#__PURE__*/React.createElement(Button, {
282
+ type: "link",
283
+ size: "small",
284
+ icon: /*#__PURE__*/React.createElement(IconFont, {
285
+ type: "lmweb-plus-circle-fill",
286
+ style: {
287
+ fontSize: 16
288
+ }
289
+ })
290
+ })) : /*#__PURE__*/React.createElement(Button, {
262
291
  type: "link",
263
292
  size: "small",
264
293
  icon: /*#__PURE__*/React.createElement(IconFont, {
@@ -268,7 +297,7 @@ var Opetate = function Opetate(_ref) {
268
297
  }
269
298
  }),
270
299
  onClick: function onClick() {
271
- return handleAdd(record);
300
+ return handleAdd(record, (options === null || options === void 0 ? void 0 : options.includes('addInChildren')) ? true : false);
272
301
  }
273
302
  }));
274
303
  }; // const isValidValue = (verifyValue) => {
@@ -944,17 +973,31 @@ var EditTable = /*#__PURE__*/forwardRef(function (props, ref) {
944
973
  /** 快捷添加 */
945
974
 
946
975
 
947
- var handleTableRowAdd = function handleTableRowAdd(record) {
976
+ var handleTableRowAdd = function handleTableRowAdd(record, isAppendInChindren) {
948
977
  var _a, _b;
949
978
 
950
979
  var preKeys = (_b = (_a = deepDataSourceRef === null || deepDataSourceRef === void 0 ? void 0 : deepDataSourceRef.current) === null || _a === void 0 ? void 0 : _a[record[_rowKey]]) === null || _b === void 0 ? void 0 : _b.preKeys;
951
980
  var res = produce(dataSourceRef.current, function (draft) {
981
+ var _a, _b, _c, _d;
982
+
952
983
  if (preKeys.length > 1) {
953
984
  var deeps = function deeps(children) {
954
985
  children === null || children === void 0 ? void 0 : children.forEach(function (item, index) {
986
+ var _a;
987
+
955
988
  if (preKeys === null || preKeys === void 0 ? void 0 : preKeys.includes(item[_rowKey])) {
956
989
  if (item[_rowKey] === record[_rowKey]) {
957
- children.splice(index + 1, 0, _defineProperty({}, _rowKey, "".concat(Date.now())));
990
+ if (isAppendInChindren) {
991
+ if (item === null || item === void 0 ? void 0 : item.children) {
992
+ (_a = item === null || item === void 0 ? void 0 : item.children) === null || _a === void 0 ? void 0 : _a.push(_defineProperty({}, _rowKey, "".concat(Date.now())));
993
+ } else {
994
+ item.children = [_defineProperty({}, _rowKey, "".concat(Date.now()))];
995
+ }
996
+
997
+ !expandedRowKeys.includes(item[_rowKey]) && setExpandedRowKeys([].concat(_toConsumableArray(expandedRowKeys), [item[_rowKey]]));
998
+ } else {
999
+ children.splice(index + 1, 0, _defineProperty({}, _rowKey, "".concat(Date.now())));
1000
+ }
958
1001
  } else if (item.children) {
959
1002
  deeps(item.children);
960
1003
  }
@@ -969,7 +1012,17 @@ var EditTable = /*#__PURE__*/forwardRef(function (props, ref) {
969
1012
  });
970
1013
 
971
1014
  if (index !== -1) {
972
- draft.splice(index + 1, 0, _defineProperty({}, _rowKey, "".concat(Date.now())));
1015
+ if (isAppendInChindren) {
1016
+ if ((_a = draft[index].children) === null || _a === void 0 ? void 0 : _a.length) {
1017
+ (_b = draft[index].children) === null || _b === void 0 ? void 0 : _b.push(_defineProperty({}, _rowKey, "".concat(Date.now())));
1018
+ } else {
1019
+ draft[index].children = [_defineProperty({}, _rowKey, "".concat(Date.now()))];
1020
+ }
1021
+
1022
+ !expandedRowKeys.includes((_c = draft[index]) === null || _c === void 0 ? void 0 : _c[_rowKey]) && setExpandedRowKeys([].concat(_toConsumableArray(expandedRowKeys), [(_d = draft[index]) === null || _d === void 0 ? void 0 : _d[_rowKey]]));
1023
+ } else {
1024
+ draft.splice(index + 1, 0, _defineProperty({}, _rowKey, "".concat(Date.now())));
1025
+ }
973
1026
  }
974
1027
  }
975
1028
  });
@@ -1006,9 +1059,9 @@ var EditTable = /*#__PURE__*/forwardRef(function (props, ref) {
1006
1059
 
1007
1060
  var DisableOptions = useMemo(function () {
1008
1061
  var newColumns = columns === null || columns === void 0 ? void 0 : columns.map(function (item) {
1009
- var _ref3 = item.componentProps || {},
1010
- optionOnly = _ref3.optionOnly,
1011
- options = _ref3.options;
1062
+ var _ref5 = item.componentProps || {},
1063
+ optionOnly = _ref5.optionOnly,
1064
+ options = _ref5.options;
1012
1065
 
1013
1066
  if (optionOnly && options) {
1014
1067
  var dataIndex = item.dataIndex;
@@ -1099,7 +1152,7 @@ var EditTable = /*#__PURE__*/forwardRef(function (props, ref) {
1099
1152
  editable = col.editable,
1100
1153
  relevanceCols = col.relevanceCols;
1101
1154
 
1102
- if ((col === null || col === void 0 ? void 0 : col.fixed) || hasDisableOptions && hasDisableOptions.includes(dataIndex) || ((_a = col.componentProps) === null || _a === void 0 ? void 0 : _a.options) || editable === 'render' || !!relevanceCols || !!shouldUpdate) {
1155
+ if ((col === null || col === void 0 ? void 0 : col.fixed) || hasDisableOptions && hasDisableOptions.includes(dataIndex) || ((_a = col.componentProps) === null || _a === void 0 ? void 0 : _a.options) || editable === 'render' || !!relevanceCols || !!shouldUpdate || !!record.children) {
1103
1156
  return true;
1104
1157
  }
1105
1158
 
@@ -609,3 +609,21 @@ p {
609
609
  color: var(--color-85);
610
610
  margin-left: 0 !important;
611
611
  }
612
+ .lm_table_append_add_popover .ant-popover-inner-content {
613
+ padding: 0px;
614
+ }
615
+ .lm_table_append_add_popover .ant-popover-inner-content ul {
616
+ margin: 0;
617
+ }
618
+ .lm_table_append_add_popover .ant-popover-inner-content ul li {
619
+ font-size: 12px;
620
+ padding: 4px 8px;
621
+ height: 24px;
622
+ display: flex;
623
+ align-items: center;
624
+ justify-content: center;
625
+ cursor: pointer;
626
+ }
627
+ .lm_table_append_add_popover .ant-popover-inner-content ul li:hover {
628
+ background-color: var(--color-15);
629
+ }
@@ -97,3 +97,21 @@
97
97
  color: var(--color-85);
98
98
  margin-left: 0 !important;
99
99
  }
100
+ .lm_table_append_add_popover .ant-popover-inner-content {
101
+ padding: 0px;
102
+ }
103
+ .lm_table_append_add_popover .ant-popover-inner-content ul {
104
+ margin: 0;
105
+ }
106
+ .lm_table_append_add_popover .ant-popover-inner-content ul li {
107
+ font-size: 12px;
108
+ padding: 4px 8px;
109
+ height: 24px;
110
+ display: flex;
111
+ align-items: center;
112
+ justify-content: center;
113
+ cursor: pointer;
114
+ }
115
+ .lm_table_append_add_popover .ant-popover-inner-content ul li:hover {
116
+ background-color: var(--color-15);
117
+ }
@@ -5,6 +5,7 @@ export interface ISelectProps extends SelectProps {
5
5
  style?: React.CSSProperties;
6
6
  Option?: typeof Select.Option;
7
7
  OptGroup?: typeof Select.OptGroup;
8
+ defaultLabel?: string;
8
9
  }
9
10
  declare type SelectType = typeof Select & typeof Select.Option & typeof Select.OptGroup;
10
11
  declare const LMSelect: SelectType;
@@ -14,7 +14,7 @@ var __rest = this && this.__rest || function (s, e) {
14
14
  return t;
15
15
  };
16
16
 
17
- import React, { forwardRef } from 'react';
17
+ import React, { forwardRef, useMemo } from 'react';
18
18
  import classNames from 'classnames';
19
19
  import SizeContext from '../ConfigProvider/SizeContext';
20
20
  var prefixCls = 'lm_select';
@@ -23,13 +23,47 @@ var CLMSelect = /*#__PURE__*/forwardRef(function (props, ref) {
23
23
  className = props.className,
24
24
  customizeSize = props.size,
25
25
  dropdownClassName = props.dropdownClassName,
26
- others = __rest(props, ["children", "className", "size", "dropdownClassName"]);
26
+ options = props.options,
27
+ value = props.value,
28
+ defaultLabel = props.defaultLabel,
29
+ others = __rest(props, ["children", "className", "size", "dropdownClassName", "options", "value", "defaultLabel"]);
27
30
 
28
- var size = customizeSize || React.useContext(SizeContext) || 'middle';
31
+ var size = customizeSize || React.useContext(SizeContext) || 'middle'; // 当前值是否存于选项中
32
+
33
+ var hasOption = useMemo(function () {
34
+ var flag = false;
35
+
36
+ if (children) {
37
+ React.Children.forEach(children, function (child) {
38
+ if ( /*#__PURE__*/React.isValidElement(child)) {
39
+ var childValue = child.props.value;
40
+
41
+ if (!flag) {
42
+ flag = childValue === value;
43
+ }
44
+ }
45
+ });
46
+ }
47
+
48
+ if (options) {
49
+ flag = !!options.some(function (v) {
50
+ return v.value === value;
51
+ });
52
+ }
53
+
54
+ return flag;
55
+ }, [children, value, options]); // 重组value: 传入value但找不到options项时,展示默认label
56
+
57
+ var resetValue = useMemo(function () {
58
+ if (value && !hasOption) return defaultLabel !== null && defaultLabel !== void 0 ? defaultLabel : value;
59
+ return value;
60
+ }, [value, hasOption]);
29
61
  return /*#__PURE__*/React.createElement(_Select, Object.assign({
30
62
  className: classNames(className, prefixCls),
31
63
  size: size,
32
- ref: ref
64
+ ref: ref,
65
+ value: resetValue,
66
+ options: options
33
67
  }, others, {
34
68
  dropdownClassName: classNames('lm_select_dropdown', dropdownClassName)
35
69
  }), children);
@@ -1,3 +1,8 @@
1
- import { TreeSelect } from 'antd';
2
- export type { TreeSelectProps } from 'antd';
3
- export default TreeSelect;
1
+ import { TreeSelect, TreeSelectProps as OriginTreeSelectProps } from 'antd';
2
+ export interface TreeSelectProps extends OriginTreeSelectProps {
3
+ defaultLabel?: string;
4
+ children?: any;
5
+ }
6
+ declare type TreeSelectType = typeof TreeSelect & typeof TreeSelect.TreeNode;
7
+ declare const LMTreeSelect: TreeSelectType;
8
+ export default LMTreeSelect;
@@ -1,3 +1,76 @@
1
1
  import "antd/es/tree-select/style";
2
2
  import _TreeSelect from "antd/es/tree-select";
3
- export default _TreeSelect;
3
+
4
+ var __rest = this && this.__rest || function (s, e) {
5
+ var t = {};
6
+
7
+ for (var p in s) {
8
+ if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
9
+ }
10
+
11
+ if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
12
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
13
+ }
14
+ return t;
15
+ };
16
+
17
+ import React, { forwardRef, useCallback, useMemo } from 'react';
18
+ var CLMTreeSelect = /*#__PURE__*/forwardRef(function (props, ref) {
19
+ var children = props.children,
20
+ treeData = props.treeData,
21
+ value = props.value,
22
+ defaultLabel = props.defaultLabel,
23
+ resetProps = __rest(props, ["children", "treeData", "value", "defaultLabel"]);
24
+
25
+ var deepChildren = useCallback(function (arr) {
26
+ var flag = false;
27
+ React.Children.forEach(arr, function (child) {
28
+ if ( /*#__PURE__*/React.isValidElement(child)) {
29
+ var _child$props = child.props,
30
+ childValue = _child$props.value,
31
+ childChildren = _child$props.children;
32
+
33
+ if (!flag) {
34
+ if (childValue === value) {
35
+ flag = true;
36
+ } else if (childChildren) {
37
+ flag = deepChildren(childChildren);
38
+ }
39
+ }
40
+ }
41
+ });
42
+ return flag;
43
+ }, [value]);
44
+ var hasOption = useMemo(function () {
45
+ var flag = false;
46
+
47
+ if (children) {
48
+ flag = deepChildren(children);
49
+ }
50
+
51
+ if (treeData) {
52
+ var deepFind = function deepFind(arr) {
53
+ return arr.some(function (v) {
54
+ if (v.value === value) return true;
55
+ return v.children && deepFind(v.children);
56
+ });
57
+ };
58
+
59
+ flag = deepFind(treeData);
60
+ }
61
+
62
+ return flag;
63
+ }, [children, value, deepChildren]); // 重组value: 传入value但找不到options项时,展示默认label
64
+
65
+ var resetValue = useMemo(function () {
66
+ if (value && !hasOption) return defaultLabel !== null && defaultLabel !== void 0 ? defaultLabel : value;
67
+ return value;
68
+ }, [value, hasOption]);
69
+ return /*#__PURE__*/React.createElement(_TreeSelect, Object.assign({
70
+ ref: ref,
71
+ value: resetValue
72
+ }, resetProps), children);
73
+ });
74
+ var LMTreeSelect = CLMTreeSelect;
75
+ LMTreeSelect.TreeNode = _TreeSelect.TreeNode;
76
+ export default LMTreeSelect;
@@ -9802,6 +9802,24 @@ p {
9802
9802
  color: var(--color-85);
9803
9803
  margin-left: 0 !important;
9804
9804
  }
9805
+ .lm_table_append_add_popover .ant-popover-inner-content {
9806
+ padding: 0px;
9807
+ }
9808
+ .lm_table_append_add_popover .ant-popover-inner-content ul {
9809
+ margin: 0;
9810
+ }
9811
+ .lm_table_append_add_popover .ant-popover-inner-content ul li {
9812
+ font-size: 12px;
9813
+ padding: 4px 8px;
9814
+ height: 24px;
9815
+ display: flex;
9816
+ align-items: center;
9817
+ justify-content: center;
9818
+ cursor: pointer;
9819
+ }
9820
+ .lm_table_append_add_popover .ant-popover-inner-content ul li:hover {
9821
+ background-color: var(--color-15);
9822
+ }
9805
9823
  .lm_filter_wrapper .lm_filter_container .lm_filter {
9806
9824
  display: flex;
9807
9825
  flex-wrap: wrap;
@@ -271,6 +271,15 @@ var Opetate = function Opetate(_ref) {
271
271
  options = _ref$options === void 0 ? ['add', 'delete'] : _ref$options,
272
272
  getLength = _ref.getLength,
273
273
  quickOpetateClearAll = _ref.quickOpetateClearAll;
274
+
275
+ var appendChildren = function appendChildren() {
276
+ handleAdd === null || handleAdd === void 0 ? void 0 : handleAdd(record, true);
277
+ };
278
+
279
+ var appendAdd = function appendAdd() {
280
+ handleAdd === null || handleAdd === void 0 ? void 0 : handleAdd(record);
281
+ };
282
+
274
283
  return /*#__PURE__*/_react.default.createElement("div", {
275
284
  style: {
276
285
  display: 'flex',
@@ -291,7 +300,27 @@ var Opetate = function Opetate(_ref) {
291
300
  onClick: function onClick() {
292
301
  return handleDelete(record[rowKey]);
293
302
  }
294
- }), options.includes('add') && /*#__PURE__*/_react.default.createElement(_linkmoreDesign.Button, {
303
+ }), (options === null || options === void 0 ? void 0 : options.includes('add')) && (options === null || options === void 0 ? void 0 : options.includes('addInChildren')) ? /*#__PURE__*/_react.default.createElement(_linkmoreDesign.Popover, {
304
+ placement: "bottom",
305
+ overlayClassName: 'lm_table_append_add_popover',
306
+ open: open,
307
+ title: null,
308
+ content: /*#__PURE__*/_react.default.createElement("ul", null, /*#__PURE__*/_react.default.createElement("li", {
309
+ onClick: appendAdd
310
+ }, "\u6DFB\u52A0\u5E73\u7EA7"), /*#__PURE__*/_react.default.createElement("li", {
311
+ onClick: appendChildren
312
+ }, "\u6DFB\u52A0\u5B50\u7EA7")),
313
+ trigger: "hover"
314
+ }, /*#__PURE__*/_react.default.createElement(_linkmoreDesign.Button, {
315
+ type: "link",
316
+ size: "small",
317
+ icon: /*#__PURE__*/_react.default.createElement(_linkmoreDesign.IconFont, {
318
+ type: "lmweb-plus-circle-fill",
319
+ style: {
320
+ fontSize: 16
321
+ }
322
+ })
323
+ })) : /*#__PURE__*/_react.default.createElement(_linkmoreDesign.Button, {
295
324
  type: "link",
296
325
  size: "small",
297
326
  icon: /*#__PURE__*/_react.default.createElement(_linkmoreDesign.IconFont, {
@@ -301,7 +330,7 @@ var Opetate = function Opetate(_ref) {
301
330
  }
302
331
  }),
303
332
  onClick: function onClick() {
304
- return handleAdd(record);
333
+ return handleAdd(record, (options === null || options === void 0 ? void 0 : options.includes('addInChildren')) ? true : false);
305
334
  }
306
335
  }));
307
336
  }; // const isValidValue = (verifyValue) => {
@@ -976,17 +1005,31 @@ var EditTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
976
1005
  /** 快捷添加 */
977
1006
 
978
1007
 
979
- var handleTableRowAdd = function handleTableRowAdd(record) {
1008
+ var handleTableRowAdd = function handleTableRowAdd(record, isAppendInChindren) {
980
1009
  var _a, _b;
981
1010
 
982
1011
  var preKeys = (_b = (_a = deepDataSourceRef === null || deepDataSourceRef === void 0 ? void 0 : deepDataSourceRef.current) === null || _a === void 0 ? void 0 : _a[record[_rowKey]]) === null || _b === void 0 ? void 0 : _b.preKeys;
983
1012
  var res = (0, _immer.produce)(dataSourceRef.current, function (draft) {
1013
+ var _a, _b, _c, _d;
1014
+
984
1015
  if (preKeys.length > 1) {
985
1016
  var deeps = function deeps(children) {
986
1017
  children === null || children === void 0 ? void 0 : children.forEach(function (item, index) {
1018
+ var _a;
1019
+
987
1020
  if (preKeys === null || preKeys === void 0 ? void 0 : preKeys.includes(item[_rowKey])) {
988
1021
  if (item[_rowKey] === record[_rowKey]) {
989
- children.splice(index + 1, 0, (0, _defineProperty2.default)({}, _rowKey, "".concat(Date.now())));
1022
+ if (isAppendInChindren) {
1023
+ if (item === null || item === void 0 ? void 0 : item.children) {
1024
+ (_a = item === null || item === void 0 ? void 0 : item.children) === null || _a === void 0 ? void 0 : _a.push((0, _defineProperty2.default)({}, _rowKey, "".concat(Date.now())));
1025
+ } else {
1026
+ item.children = [(0, _defineProperty2.default)({}, _rowKey, "".concat(Date.now()))];
1027
+ }
1028
+
1029
+ !expandedRowKeys.includes(item[_rowKey]) && setExpandedRowKeys([].concat((0, _toConsumableArray2.default)(expandedRowKeys), [item[_rowKey]]));
1030
+ } else {
1031
+ children.splice(index + 1, 0, (0, _defineProperty2.default)({}, _rowKey, "".concat(Date.now())));
1032
+ }
990
1033
  } else if (item.children) {
991
1034
  deeps(item.children);
992
1035
  }
@@ -1001,7 +1044,17 @@ var EditTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
1001
1044
  });
1002
1045
 
1003
1046
  if (index !== -1) {
1004
- draft.splice(index + 1, 0, (0, _defineProperty2.default)({}, _rowKey, "".concat(Date.now())));
1047
+ if (isAppendInChindren) {
1048
+ if ((_a = draft[index].children) === null || _a === void 0 ? void 0 : _a.length) {
1049
+ (_b = draft[index].children) === null || _b === void 0 ? void 0 : _b.push((0, _defineProperty2.default)({}, _rowKey, "".concat(Date.now())));
1050
+ } else {
1051
+ draft[index].children = [(0, _defineProperty2.default)({}, _rowKey, "".concat(Date.now()))];
1052
+ }
1053
+
1054
+ !expandedRowKeys.includes((_c = draft[index]) === null || _c === void 0 ? void 0 : _c[_rowKey]) && setExpandedRowKeys([].concat((0, _toConsumableArray2.default)(expandedRowKeys), [(_d = draft[index]) === null || _d === void 0 ? void 0 : _d[_rowKey]]));
1055
+ } else {
1056
+ draft.splice(index + 1, 0, (0, _defineProperty2.default)({}, _rowKey, "".concat(Date.now())));
1057
+ }
1005
1058
  }
1006
1059
  }
1007
1060
  });
@@ -1038,9 +1091,9 @@ var EditTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
1038
1091
 
1039
1092
  var DisableOptions = (0, _react.useMemo)(function () {
1040
1093
  var newColumns = columns === null || columns === void 0 ? void 0 : columns.map(function (item) {
1041
- var _ref3 = item.componentProps || {},
1042
- optionOnly = _ref3.optionOnly,
1043
- options = _ref3.options;
1094
+ var _ref5 = item.componentProps || {},
1095
+ optionOnly = _ref5.optionOnly,
1096
+ options = _ref5.options;
1044
1097
 
1045
1098
  if (optionOnly && options) {
1046
1099
  var dataIndex = item.dataIndex;
@@ -1131,7 +1184,7 @@ var EditTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
1131
1184
  editable = col.editable,
1132
1185
  relevanceCols = col.relevanceCols;
1133
1186
 
1134
- if ((col === null || col === void 0 ? void 0 : col.fixed) || hasDisableOptions && hasDisableOptions.includes(dataIndex) || ((_a = col.componentProps) === null || _a === void 0 ? void 0 : _a.options) || editable === 'render' || !!relevanceCols || !!shouldUpdate) {
1187
+ if ((col === null || col === void 0 ? void 0 : col.fixed) || hasDisableOptions && hasDisableOptions.includes(dataIndex) || ((_a = col.componentProps) === null || _a === void 0 ? void 0 : _a.options) || editable === 'render' || !!relevanceCols || !!shouldUpdate || !!record.children) {
1135
1188
  return true;
1136
1189
  }
1137
1190
 
@@ -609,3 +609,21 @@ p {
609
609
  color: var(--color-85);
610
610
  margin-left: 0 !important;
611
611
  }
612
+ .lm_table_append_add_popover .ant-popover-inner-content {
613
+ padding: 0px;
614
+ }
615
+ .lm_table_append_add_popover .ant-popover-inner-content ul {
616
+ margin: 0;
617
+ }
618
+ .lm_table_append_add_popover .ant-popover-inner-content ul li {
619
+ font-size: 12px;
620
+ padding: 4px 8px;
621
+ height: 24px;
622
+ display: flex;
623
+ align-items: center;
624
+ justify-content: center;
625
+ cursor: pointer;
626
+ }
627
+ .lm_table_append_add_popover .ant-popover-inner-content ul li:hover {
628
+ background-color: var(--color-15);
629
+ }
@@ -97,3 +97,21 @@
97
97
  color: var(--color-85);
98
98
  margin-left: 0 !important;
99
99
  }
100
+ .lm_table_append_add_popover .ant-popover-inner-content {
101
+ padding: 0px;
102
+ }
103
+ .lm_table_append_add_popover .ant-popover-inner-content ul {
104
+ margin: 0;
105
+ }
106
+ .lm_table_append_add_popover .ant-popover-inner-content ul li {
107
+ font-size: 12px;
108
+ padding: 4px 8px;
109
+ height: 24px;
110
+ display: flex;
111
+ align-items: center;
112
+ justify-content: center;
113
+ cursor: pointer;
114
+ }
115
+ .lm_table_append_add_popover .ant-popover-inner-content ul li:hover {
116
+ background-color: var(--color-15);
117
+ }
@@ -5,6 +5,7 @@ export interface ISelectProps extends SelectProps {
5
5
  style?: React.CSSProperties;
6
6
  Option?: typeof Select.Option;
7
7
  OptGroup?: typeof Select.OptGroup;
8
+ defaultLabel?: string;
8
9
  }
9
10
  declare type SelectType = typeof Select & typeof Select.Option & typeof Select.OptGroup;
10
11
  declare const LMSelect: SelectType;
@@ -38,13 +38,47 @@ var CLMSelect = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
38
38
  className = props.className,
39
39
  customizeSize = props.size,
40
40
  dropdownClassName = props.dropdownClassName,
41
- others = __rest(props, ["children", "className", "size", "dropdownClassName"]);
41
+ options = props.options,
42
+ value = props.value,
43
+ defaultLabel = props.defaultLabel,
44
+ others = __rest(props, ["children", "className", "size", "dropdownClassName", "options", "value", "defaultLabel"]);
42
45
 
43
- var size = customizeSize || _react.default.useContext(_SizeContext.default) || 'middle';
46
+ var size = customizeSize || _react.default.useContext(_SizeContext.default) || 'middle'; // 当前值是否存于选项中
47
+
48
+ var hasOption = (0, _react.useMemo)(function () {
49
+ var flag = false;
50
+
51
+ if (children) {
52
+ _react.default.Children.forEach(children, function (child) {
53
+ if ( /*#__PURE__*/_react.default.isValidElement(child)) {
54
+ var childValue = child.props.value;
55
+
56
+ if (!flag) {
57
+ flag = childValue === value;
58
+ }
59
+ }
60
+ });
61
+ }
62
+
63
+ if (options) {
64
+ flag = !!options.some(function (v) {
65
+ return v.value === value;
66
+ });
67
+ }
68
+
69
+ return flag;
70
+ }, [children, value, options]); // 重组value: 传入value但找不到options项时,展示默认label
71
+
72
+ var resetValue = (0, _react.useMemo)(function () {
73
+ if (value && !hasOption) return defaultLabel !== null && defaultLabel !== void 0 ? defaultLabel : value;
74
+ return value;
75
+ }, [value, hasOption]);
44
76
  return /*#__PURE__*/_react.default.createElement(_select.default, Object.assign({
45
77
  className: (0, _classnames.default)(className, prefixCls),
46
78
  size: size,
47
- ref: ref
79
+ ref: ref,
80
+ value: resetValue,
81
+ options: options
48
82
  }, others, {
49
83
  dropdownClassName: (0, _classnames.default)('lm_select_dropdown', dropdownClassName)
50
84
  }), children);
@@ -1,3 +1,8 @@
1
- import { TreeSelect } from 'antd';
2
- export type { TreeSelectProps } from 'antd';
3
- export default TreeSelect;
1
+ import { TreeSelect, TreeSelectProps as OriginTreeSelectProps } from 'antd';
2
+ export interface TreeSelectProps extends OriginTreeSelectProps {
3
+ defaultLabel?: string;
4
+ children?: any;
5
+ }
6
+ declare type TreeSelectType = typeof TreeSelect & typeof TreeSelect.TreeNode;
7
+ declare const LMTreeSelect: TreeSelectType;
8
+ export default LMTreeSelect;