linkmore-design 1.1.10 → 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.
Files changed (235) hide show
  1. package/dist/Button/demos/type.d.ts +2 -0
  2. package/dist/Cascader/demos/formItem.d.ts +2 -0
  3. package/dist/CustomTableOption/index.d.ts +1 -0
  4. package/dist/CustomTableOption/locale/en_US.d.ts +19 -0
  5. package/dist/CustomTableOption/locale/zh_CN.d.ts +19 -0
  6. package/dist/LmEditTable/demos/priceTable.d.ts +2 -0
  7. package/dist/LmEditTable/util.d.ts +1 -0
  8. package/dist/LmFilter/demos/filterControl.d.ts +2 -0
  9. package/dist/Locale/default.d.ts +4 -1
  10. package/dist/Locale/zh_CN.d.ts +4 -1
  11. package/dist/Modal/demos/locale.d.ts +2 -0
  12. package/dist/Modal/locale.d.ts +7 -0
  13. package/dist/Select/demos/formItem.d.ts +2 -0
  14. package/dist/Select/index.d.ts +1 -0
  15. package/dist/TreeSelect/demos/formItem.d.ts +2 -0
  16. package/dist/TreeSelect/index.d.ts +8 -3
  17. package/dist/base.css +1 -0
  18. package/dist/index.umd.js +394 -206
  19. package/dist/index.umd.min.js +6 -6
  20. package/dist/variables.css +45 -12
  21. package/es/Affix/style/index.css +1 -0
  22. package/es/Alert/style/index.css +1 -0
  23. package/es/Approval/style/index.css +1 -0
  24. package/es/AutoComplete/style/index.css +1 -0
  25. package/es/Avatar/style/index.css +1 -0
  26. package/es/Badge/style/index.css +1 -0
  27. package/es/Breadcrumb/style/index.css +1 -0
  28. package/es/Button/style/index.css +4 -1
  29. package/es/Button/style/variables.css +4 -1
  30. package/es/ButtonTags/style/index.css +1 -0
  31. package/es/Calendar/style/index.css +1 -0
  32. package/es/Card/style/index.css +1 -0
  33. package/es/CardTable/style/index.css +7 -9
  34. package/es/CardTable/style/variables.css +7 -9
  35. package/es/Carousel/style/index.css +1 -0
  36. package/es/Cascader/style/index.css +1 -0
  37. package/es/Col/style/index.css +1 -0
  38. package/es/Collapse/style/index.css +1 -0
  39. package/es/Comment/style/index.css +1 -0
  40. package/es/CustomTableOption/cardSort.js +21 -16
  41. package/es/CustomTableOption/columnsSort.js +16 -16
  42. package/es/CustomTableOption/filterSort.js +11 -11
  43. package/es/CustomTableOption/index.d.ts +1 -0
  44. package/es/CustomTableOption/index.js +45 -17
  45. package/es/CustomTableOption/locale/en_US.d.ts +19 -0
  46. package/es/CustomTableOption/locale/en_US.js +19 -0
  47. package/es/CustomTableOption/locale/zh_CN.d.ts +19 -0
  48. package/es/CustomTableOption/locale/zh_CN.js +19 -0
  49. package/es/CustomTableOption/style/index.css +5 -0
  50. package/es/CustomTableOption/style/variables.css +4 -0
  51. package/es/CustomerService/style/index.css +1 -0
  52. package/es/DatePicker/style/index.css +1 -0
  53. package/es/Descriptions/style/index.css +1 -0
  54. package/es/Divider/style/index.css +1 -0
  55. package/es/Drawer/style/index.css +1 -0
  56. package/es/Dropdown/style/index.css +3 -2
  57. package/es/Dropdown/style/variables.css +2 -2
  58. package/es/EditTable/style/index.css +1 -0
  59. package/es/Empty/style/index.css +1 -0
  60. package/es/Filter/style/index.css +1 -0
  61. package/es/Form/style/index.css +1 -0
  62. package/es/FullScreen/style/index.css +1 -0
  63. package/es/Grid/style/index.css +1 -0
  64. package/es/Icon/style/index.css +1 -0
  65. package/es/Image/style/index.css +1 -0
  66. package/es/Input/style/index.css +1 -0
  67. package/es/InputNumber/style/index.css +1 -0
  68. package/es/Layout/style/index.css +1 -0
  69. package/es/LeftTable/index.js +3 -1
  70. package/es/LeftTable/style/index.css +1 -0
  71. package/es/List/style/index.css +1 -0
  72. package/es/LmEditTable/EditTable.js +102 -98
  73. package/es/LmEditTable/style/index.css +23 -0
  74. package/es/LmEditTable/style/variables.css +22 -0
  75. package/es/LmEditTable/util.d.ts +1 -0
  76. package/es/LmEditTable/util.js +27 -0
  77. package/es/LmSelect/style/index.css +1 -0
  78. package/es/LmTable/style/index.css +1 -0
  79. package/es/Locale/default.d.ts +4 -1
  80. package/es/Locale/default.js +3 -1
  81. package/es/Locale/zh_CN.d.ts +4 -1
  82. package/es/Locale/zh_CN.js +3 -1
  83. package/es/Mentions/style/index.css +1 -0
  84. package/es/Menu/style/index.css +1 -0
  85. package/es/Modal/index.js +18 -14
  86. package/es/Modal/locale.d.ts +7 -0
  87. package/es/Modal/locale.js +12 -0
  88. package/es/Modal/style/index.css +1 -0
  89. package/es/PageHeader/style/index.css +1 -0
  90. package/es/Pagination/style/index.css +1 -0
  91. package/es/Popconfirm/style/index.css +1 -0
  92. package/es/Popover/style/index.css +1 -0
  93. package/es/Progress/style/index.css +1 -0
  94. package/es/QuickMenu/style/index.css +6 -0
  95. package/es/QuickMenu/style/variables.css +5 -0
  96. package/es/Rate/style/index.css +1 -0
  97. package/es/Result/style/index.css +1 -0
  98. package/es/Row/style/index.css +1 -0
  99. package/es/Segmented/style/index.css +1 -0
  100. package/es/Select/index.d.ts +1 -0
  101. package/es/Select/index.js +38 -4
  102. package/es/Select/style/index.css +1 -0
  103. package/es/Skeleton/style/index.css +1 -0
  104. package/es/Slider/style/index.css +1 -0
  105. package/es/Space/style/index.css +1 -0
  106. package/es/Spin/style/index.css +1 -0
  107. package/es/Statistic/style/index.css +1 -0
  108. package/es/Steps/style/index.css +1 -0
  109. package/es/Switch/style/index.css +1 -0
  110. package/es/Table/style/index.css +1 -0
  111. package/es/Tabs/style/index.css +1 -0
  112. package/es/Tag/style/index.css +1 -0
  113. package/es/TimePicker/style/index.css +1 -0
  114. package/es/Timeline/style/index.css +1 -0
  115. package/es/Tooltip/style/index.css +1 -0
  116. package/es/Transfer/style/index.css +1 -0
  117. package/es/Tree/style/index.css +1 -0
  118. package/es/TreeSelect/index.d.ts +8 -3
  119. package/es/TreeSelect/index.js +74 -1
  120. package/es/TreeSelect/style/index.css +1 -0
  121. package/es/Typography/style/index.css +1 -0
  122. package/es/Upload/style/index.css +1 -0
  123. package/es/locale-provider/style/index.css +1 -0
  124. package/es/message/style/index.css +1 -0
  125. package/es/notification/style/index.css +1 -0
  126. package/es/styles/main.css +1 -0
  127. package/es/styles/variables.css +45 -12
  128. package/lib/Affix/style/index.css +1 -0
  129. package/lib/Alert/style/index.css +1 -0
  130. package/lib/Approval/style/index.css +1 -0
  131. package/lib/AutoComplete/style/index.css +1 -0
  132. package/lib/Avatar/style/index.css +1 -0
  133. package/lib/Badge/style/index.css +1 -0
  134. package/lib/Breadcrumb/style/index.css +1 -0
  135. package/lib/Button/style/index.css +4 -1
  136. package/lib/Button/style/variables.css +4 -1
  137. package/lib/ButtonTags/style/index.css +1 -0
  138. package/lib/Calendar/style/index.css +1 -0
  139. package/lib/Card/style/index.css +1 -0
  140. package/lib/CardTable/style/index.css +7 -9
  141. package/lib/CardTable/style/variables.css +7 -9
  142. package/lib/Carousel/style/index.css +1 -0
  143. package/lib/Cascader/style/index.css +1 -0
  144. package/lib/Col/style/index.css +1 -0
  145. package/lib/Collapse/style/index.css +1 -0
  146. package/lib/Comment/style/index.css +1 -0
  147. package/lib/CustomTableOption/cardSort.js +20 -15
  148. package/lib/CustomTableOption/columnsSort.js +16 -16
  149. package/lib/CustomTableOption/filterSort.js +11 -11
  150. package/lib/CustomTableOption/index.d.ts +1 -0
  151. package/lib/CustomTableOption/index.js +45 -16
  152. package/lib/CustomTableOption/locale/en_US.d.ts +19 -0
  153. package/lib/CustomTableOption/locale/en_US.js +26 -0
  154. package/lib/CustomTableOption/locale/zh_CN.d.ts +19 -0
  155. package/lib/CustomTableOption/locale/zh_CN.js +26 -0
  156. package/lib/CustomTableOption/style/index.css +5 -0
  157. package/lib/CustomTableOption/style/variables.css +4 -0
  158. package/lib/CustomerService/style/index.css +1 -0
  159. package/lib/DatePicker/style/index.css +1 -0
  160. package/lib/Descriptions/style/index.css +1 -0
  161. package/lib/Divider/style/index.css +1 -0
  162. package/lib/Drawer/style/index.css +1 -0
  163. package/lib/Dropdown/style/index.css +3 -2
  164. package/lib/Dropdown/style/variables.css +2 -2
  165. package/lib/EditTable/style/index.css +1 -0
  166. package/lib/Empty/style/index.css +1 -0
  167. package/lib/Filter/style/index.css +1 -0
  168. package/lib/Form/style/index.css +1 -0
  169. package/lib/FullScreen/style/index.css +1 -0
  170. package/lib/Grid/style/index.css +1 -0
  171. package/lib/Icon/style/index.css +1 -0
  172. package/lib/Image/style/index.css +1 -0
  173. package/lib/Input/style/index.css +1 -0
  174. package/lib/InputNumber/style/index.css +1 -0
  175. package/lib/Layout/style/index.css +1 -0
  176. package/lib/LeftTable/index.js +3 -1
  177. package/lib/LeftTable/style/index.css +1 -0
  178. package/lib/List/style/index.css +1 -0
  179. package/lib/LmEditTable/EditTable.js +101 -96
  180. package/lib/LmEditTable/style/index.css +23 -0
  181. package/lib/LmEditTable/style/variables.css +22 -0
  182. package/lib/LmEditTable/util.d.ts +1 -0
  183. package/lib/LmEditTable/util.js +30 -0
  184. package/lib/LmSelect/style/index.css +1 -0
  185. package/lib/LmTable/style/index.css +1 -0
  186. package/lib/Locale/default.d.ts +4 -1
  187. package/lib/Locale/default.js +4 -1
  188. package/lib/Locale/zh_CN.d.ts +4 -1
  189. package/lib/Locale/zh_CN.js +4 -1
  190. package/lib/Mentions/style/index.css +1 -0
  191. package/lib/Menu/style/index.css +1 -0
  192. package/lib/Modal/index.js +22 -14
  193. package/lib/Modal/locale.d.ts +7 -0
  194. package/lib/Modal/locale.js +25 -0
  195. package/lib/Modal/style/index.css +1 -0
  196. package/lib/PageHeader/style/index.css +1 -0
  197. package/lib/Pagination/style/index.css +1 -0
  198. package/lib/Popconfirm/style/index.css +1 -0
  199. package/lib/Popover/style/index.css +1 -0
  200. package/lib/Progress/style/index.css +1 -0
  201. package/lib/QuickMenu/style/index.css +6 -0
  202. package/lib/QuickMenu/style/variables.css +5 -0
  203. package/lib/Rate/style/index.css +1 -0
  204. package/lib/Result/style/index.css +1 -0
  205. package/lib/Row/style/index.css +1 -0
  206. package/lib/Segmented/style/index.css +1 -0
  207. package/lib/Select/index.d.ts +1 -0
  208. package/lib/Select/index.js +37 -3
  209. package/lib/Select/style/index.css +1 -0
  210. package/lib/Skeleton/style/index.css +1 -0
  211. package/lib/Slider/style/index.css +1 -0
  212. package/lib/Space/style/index.css +1 -0
  213. package/lib/Spin/style/index.css +1 -0
  214. package/lib/Statistic/style/index.css +1 -0
  215. package/lib/Steps/style/index.css +1 -0
  216. package/lib/Switch/style/index.css +1 -0
  217. package/lib/Table/style/index.css +1 -0
  218. package/lib/Tabs/style/index.css +1 -0
  219. package/lib/Tag/style/index.css +1 -0
  220. package/lib/TimePicker/style/index.css +1 -0
  221. package/lib/Timeline/style/index.css +1 -0
  222. package/lib/Tooltip/style/index.css +1 -0
  223. package/lib/Transfer/style/index.css +1 -0
  224. package/lib/Tree/style/index.css +1 -0
  225. package/lib/TreeSelect/index.d.ts +8 -3
  226. package/lib/TreeSelect/index.js +78 -1
  227. package/lib/TreeSelect/style/index.css +1 -0
  228. package/lib/Typography/style/index.css +1 -0
  229. package/lib/Upload/style/index.css +1 -0
  230. package/lib/locale-provider/style/index.css +1 -0
  231. package/lib/message/style/index.css +1 -0
  232. package/lib/notification/style/index.css +1 -0
  233. package/lib/styles/main.css +1 -0
  234. package/lib/styles/variables.css +45 -12
  235. package/package.json +1 -1
@@ -53,9 +53,10 @@ 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
+ import { useControllableValue } from 'ahooks';
59
60
  import { produce } from 'immer';
60
61
  import DndContainer from './DndContainer';
61
62
  import SortableBox from './sortableBox';
@@ -64,7 +65,7 @@ import SortableItem from './sortableItem';
64
65
  import ColSortableItem from './sortableItemCol';
65
66
  import DragHandle from './DragHandle';
66
67
  import UploadOss from '../UploadOss';
67
- import { isObjEmpty, deepDataSourcePreKeys, isExpandRow } from './util';
68
+ import { isObjEmpty, deepDataSourcePreKeys, isExpandRow, checkRowKeyByDataSource } from './util';
68
69
  import cls from "classnames";
69
70
  var UploadBtn = UploadOss.UploadBtn;
70
71
  var EditableContext = /*#__PURE__*/React.createContext(null); // 表格行
@@ -237,11 +238,21 @@ var Opetate = function Opetate(_ref) {
237
238
  options = _ref$options === void 0 ? ['add', 'delete'] : _ref$options,
238
239
  getLength = _ref.getLength,
239
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
+
240
250
  return /*#__PURE__*/React.createElement("div", {
241
251
  style: {
242
252
  display: 'flex',
243
253
  alignItems: 'center',
244
- justifyContent: 'center'
254
+ justifyContent: 'flex-start',
255
+ marginLeft: '-4px'
245
256
  }
246
257
  }, options.includes('delete') && /*#__PURE__*/React.createElement(Button, {
247
258
  type: "link",
@@ -256,7 +267,27 @@ var Opetate = function Opetate(_ref) {
256
267
  onClick: function onClick() {
257
268
  return handleDelete(record[rowKey]);
258
269
  }
259
- }), 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, {
260
291
  type: "link",
261
292
  size: "small",
262
293
  icon: /*#__PURE__*/React.createElement(IconFont, {
@@ -266,7 +297,7 @@ var Opetate = function Opetate(_ref) {
266
297
  }
267
298
  }),
268
299
  onClick: function onClick() {
269
- return handleAdd(record);
300
+ return handleAdd(record, (options === null || options === void 0 ? void 0 : options.includes('addInChildren')) ? true : false);
270
301
  }
271
302
  }));
272
303
  }; // const isValidValue = (verifyValue) => {
@@ -683,35 +714,39 @@ var EditTable = /*#__PURE__*/forwardRef(function (props, ref) {
683
714
  recordCreatorProps = props.recordCreatorProps,
684
715
  _props$shouldUpdate = props.shouldUpdate,
685
716
  shouldUpdate = _props$shouldUpdate === void 0 ? false : _props$shouldUpdate,
686
- resetProps = __rest(props, ["value", "columns", "isEdit", "isAdd", "onChange", "rowKey", "rowHoverEdit", "isUseForm", "isHoverEdit", "useQuickOpetate", "quickOpetateClearAll", "rowSelection", "sortOpen", "colSortOpen", "filterChange", "size", "recordCreatorProps", "shouldUpdate"]);
717
+ resetProps = __rest(props, ["value", "columns", "isEdit", "isAdd", "onChange", "rowKey", "rowHoverEdit", "isUseForm", "isHoverEdit", "useQuickOpetate", "quickOpetateClearAll", "rowSelection", "sortOpen", "colSortOpen", "filterChange", "size", "recordCreatorProps", "shouldUpdate"]); // const [dataSource, setDataSource] = useState([]);
687
718
 
688
- var _useState5 = useState([]),
689
- _useState6 = _slicedToArray(_useState5, 2),
690
- dataSource = _useState6[0],
691
- setDataSource = _useState6[1]; // const [count, setCount] = useState(0);
719
+
720
+ var _useControllableValue = useControllableValue({
721
+ value: checkRowKeyByDataSource(props.value, _rowKey),
722
+ onChange: props.onChange
723
+ }),
724
+ _useControllableValue2 = _slicedToArray(_useControllableValue, 2),
725
+ dataSource = _useControllableValue2[0],
726
+ setDataSource = _useControllableValue2[1]; // const [count, setCount] = useState(0);
692
727
 
693
728
 
694
- var _useState7 = useState({}),
729
+ var _useState5 = useState({}),
730
+ _useState6 = _slicedToArray(_useState5, 2),
731
+ _valid = _useState6[0],
732
+ setValid = _useState6[1];
733
+
734
+ var _useState7 = useState([]),
695
735
  _useState8 = _slicedToArray(_useState7, 2),
696
- _valid = _useState8[0],
697
- setValid = _useState8[1];
736
+ localRowSelectList = _useState8[0],
737
+ setLocalRowSelectList = _useState8[1];
698
738
 
699
739
  var _useState9 = useState([]),
700
740
  _useState10 = _slicedToArray(_useState9, 2),
701
- localRowSelectList = _useState10[0],
702
- setLocalRowSelectList = _useState10[1];
703
-
704
- var _useState11 = useState([]),
705
- _useState12 = _slicedToArray(_useState11, 2),
706
- sortEditTable = _useState12[0],
707
- setCallBackFalg = _useState12[1];
741
+ sortEditTable = _useState10[0],
742
+ setCallBackFalg = _useState10[1];
708
743
  /** 当前展开的列 */
709
744
 
710
745
 
711
- var _useState13 = useState([]),
712
- _useState14 = _slicedToArray(_useState13, 2),
713
- expandedRowKeys = _useState14[0],
714
- setExpandedRowKeys = _useState14[1];
746
+ var _useState11 = useState([]),
747
+ _useState12 = _slicedToArray(_useState11, 2),
748
+ expandedRowKeys = _useState12[0],
749
+ setExpandedRowKeys = _useState12[1];
715
750
 
716
751
  var dataSourceRef = useRef([]);
717
752
  var sortDataSorceRef = useRef([]);
@@ -726,12 +761,7 @@ var EditTable = /*#__PURE__*/forwardRef(function (props, ref) {
726
761
  var newIndex = cloneArr.findIndex(function (v) {
727
762
  return v[_rowKey] === over;
728
763
  });
729
-
730
- if (onChange) {
731
- onChange === null || onChange === void 0 ? void 0 : onChange(arrayMove(cloneArr, oldIndex, newIndex));
732
- } else {
733
- setDataSource(arrayMove(cloneArr, oldIndex, newIndex));
734
- }
764
+ setDataSource(arrayMove(cloneArr, oldIndex, newIndex));
735
765
  };
736
766
 
737
767
  var onColSortEnd = function onColSortEnd(active, over) {
@@ -754,8 +784,9 @@ var EditTable = /*#__PURE__*/forwardRef(function (props, ref) {
754
784
  var handleDelete = function handleDelete(key) {
755
785
  var nValue = dataSource.filter(function (item) {
756
786
  return item[_rowKey] !== key;
757
- });
758
- onChange === null || onChange === void 0 ? void 0 : onChange(nValue);
787
+ }); // onChange?.(nValue)
788
+
789
+ setDataSource(nValue);
759
790
  };
760
791
  /** 点击添加按钮添加 */
761
792
 
@@ -767,14 +798,14 @@ var EditTable = /*#__PURE__*/forwardRef(function (props, ref) {
767
798
  var res = produce(dataSourceRef.current, function (draft) {
768
799
  draft.push(Object.assign(_defineProperty({}, _rowKey, "".concat(Date.now())), addDataInfo || {}));
769
800
  });
770
- setDataSource(res);
771
- onChange === null || onChange === void 0 ? void 0 : onChange(res);
801
+ setDataSource(res); // onChange?.(res)
772
802
  };
773
803
 
774
804
  useEffect(function () {
775
805
  var _a;
776
806
 
777
807
  dataSourceRef.current = dataSource;
808
+ deepDataSourceRef.current = deepDataSourcePreKeys(dataSource, _rowKey);
778
809
 
779
810
  if (sortOpen) {
780
811
  var dataSourceKeys = dataSource === null || dataSource === void 0 ? void 0 : dataSource.map(function (item) {
@@ -879,12 +910,7 @@ var EditTable = /*#__PURE__*/forwardRef(function (props, ref) {
879
910
  }
880
911
  }
881
912
  });
882
-
883
- if (onChange) {
884
- onChange === null || onChange === void 0 ? void 0 : onChange(res);
885
- } else {
886
- setDataSource(res);
887
- }
913
+ setDataSource(res);
888
914
  };
889
915
 
890
916
  var reWriteOriginSource = function reWriteOriginSource(rowKey, rowValue, dataIndex, nextValue) {
@@ -925,12 +951,7 @@ var EditTable = /*#__PURE__*/forwardRef(function (props, ref) {
925
951
  };
926
952
 
927
953
  var res = filter(dataSource, key);
928
-
929
- if (onChange) {
930
- onChange === null || onChange === void 0 ? void 0 : onChange(res);
931
- } else {
932
- setDataSource(res);
933
- }
954
+ setDataSource(res);
934
955
  } else {
935
956
  if (((_c = dataSourceRef.current) === null || _c === void 0 ? void 0 : _c.length) === 1 && !quickOpetateClearAll) {
936
957
  return false;
@@ -946,27 +967,37 @@ var EditTable = /*#__PURE__*/forwardRef(function (props, ref) {
946
967
  }
947
968
  });
948
969
 
949
- if (onChange) {
950
- onChange === null || onChange === void 0 ? void 0 : onChange(_res);
951
- } else {
952
- setDataSource(_res);
953
- }
970
+ setDataSource(_res);
954
971
  }
955
972
  };
956
973
  /** 快捷添加 */
957
974
 
958
975
 
959
- var handleTableRowAdd = function handleTableRowAdd(record) {
976
+ var handleTableRowAdd = function handleTableRowAdd(record, isAppendInChindren) {
960
977
  var _a, _b;
961
978
 
962
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;
963
980
  var res = produce(dataSourceRef.current, function (draft) {
981
+ var _a, _b, _c, _d;
982
+
964
983
  if (preKeys.length > 1) {
965
984
  var deeps = function deeps(children) {
966
985
  children === null || children === void 0 ? void 0 : children.forEach(function (item, index) {
986
+ var _a;
987
+
967
988
  if (preKeys === null || preKeys === void 0 ? void 0 : preKeys.includes(item[_rowKey])) {
968
989
  if (item[_rowKey] === record[_rowKey]) {
969
- 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
+ }
970
1001
  } else if (item.children) {
971
1002
  deeps(item.children);
972
1003
  }
@@ -981,16 +1012,21 @@ var EditTable = /*#__PURE__*/forwardRef(function (props, ref) {
981
1012
  });
982
1013
 
983
1014
  if (index !== -1) {
984
- 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
+ }
985
1026
  }
986
1027
  }
987
1028
  });
988
-
989
- if (onChange) {
990
- onChange === null || onChange === void 0 ? void 0 : onChange(res);
991
- } else {
992
- setDataSource(res);
993
- }
1029
+ setDataSource(res);
994
1030
  };
995
1031
 
996
1032
  var handleCopy = function handleCopy(key, value) {
@@ -999,12 +1035,7 @@ var EditTable = /*#__PURE__*/forwardRef(function (props, ref) {
999
1035
  return item[key] = value;
1000
1036
  });
1001
1037
  });
1002
-
1003
- if (onChange) {
1004
- onChange === null || onChange === void 0 ? void 0 : onChange(res);
1005
- } else {
1006
- setDataSource(res);
1007
- }
1038
+ setDataSource(res);
1008
1039
  };
1009
1040
  /** 判断columne中有没有带optionOnly参数 */
1010
1041
 
@@ -1028,9 +1059,9 @@ var EditTable = /*#__PURE__*/forwardRef(function (props, ref) {
1028
1059
 
1029
1060
  var DisableOptions = useMemo(function () {
1030
1061
  var newColumns = columns === null || columns === void 0 ? void 0 : columns.map(function (item) {
1031
- var _ref3 = item.componentProps || {},
1032
- optionOnly = _ref3.optionOnly,
1033
- options = _ref3.options;
1062
+ var _ref5 = item.componentProps || {},
1063
+ optionOnly = _ref5.optionOnly,
1064
+ options = _ref5.options;
1034
1065
 
1035
1066
  if (optionOnly && options) {
1036
1067
  var dataIndex = item.dataIndex;
@@ -1077,6 +1108,7 @@ var EditTable = /*#__PURE__*/forwardRef(function (props, ref) {
1077
1108
  width: 68,
1078
1109
  fixed: 'right',
1079
1110
  editable: 'lm_edit_opetate',
1111
+ className: 'lm_edit_opetate',
1080
1112
  componentProps: {
1081
1113
  options: Array.isArray(useQuickOpetate) ? useQuickOpetate : ['add', 'delete']
1082
1114
  }
@@ -1120,7 +1152,7 @@ var EditTable = /*#__PURE__*/forwardRef(function (props, ref) {
1120
1152
  editable = col.editable,
1121
1153
  relevanceCols = col.relevanceCols;
1122
1154
 
1123
- 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) {
1124
1156
  return true;
1125
1157
  }
1126
1158
 
@@ -1224,34 +1256,6 @@ var EditTable = /*#__PURE__*/forwardRef(function (props, ref) {
1224
1256
  components: component
1225
1257
  }, resetProps);
1226
1258
  }, [resultColumns, dataSource, sortOpen, colSortOpen, size]);
1227
- useEffect(function () {
1228
- // setDataSource(defaultData?.map((v, idx) => ({ ...v, [rowKey]: v[rowKey] || `v${idx + 1}` })))
1229
- var addRowKey = function addRowKey(children, pkey) {
1230
- return children === null || children === void 0 ? void 0 : children.map(function (item, index) {
1231
- if (item.children) {
1232
- var _Object$assign5;
1233
-
1234
- var rchildren = addRowKey(item.children, "".concat(pkey, "_").concat(index + 1));
1235
- return Object.assign(Object.assign({}, item), (_Object$assign5 = {}, _defineProperty(_Object$assign5, _rowKey, item[_rowKey] || "".concat(pkey, "_").concat(index + 1)), _defineProperty(_Object$assign5, "children", rchildren), _Object$assign5));
1236
- }
1237
-
1238
- return Object.assign(Object.assign({}, item), _defineProperty({}, _rowKey, item[_rowKey] || "".concat(pkey, "_").concat(index + 1)));
1239
- });
1240
- };
1241
-
1242
- var res = defaultData === null || defaultData === void 0 ? void 0 : defaultData.map(function (v, idx) {
1243
- if (v.children) {
1244
- var _Object$assign7;
1245
-
1246
- var rchildren = addRowKey(v.children, v[_rowKey] || "v".concat(idx + 1));
1247
- return Object.assign(Object.assign({}, v), (_Object$assign7 = {}, _defineProperty(_Object$assign7, _rowKey, v[_rowKey] || "v".concat(idx + 1)), _defineProperty(_Object$assign7, "children", rchildren), _Object$assign7));
1248
- }
1249
-
1250
- return Object.assign(Object.assign({}, v), _defineProperty({}, _rowKey, v[_rowKey] || "v".concat(idx + 1)));
1251
- });
1252
- deepDataSourceRef.current = deepDataSourcePreKeys(res, _rowKey);
1253
- setDataSource(res);
1254
- }, [defaultData]);
1255
1259
  useImperativeHandle(ref, function () {
1256
1260
  return {
1257
1261
  setRow: handleSave,
@@ -198,6 +198,7 @@
198
198
  --font-size-base: 14px;
199
199
  --font-size-lg: calc(var(--font-size-base) + 2px);
200
200
  --font-size-sm: 12px;
201
+ --border-radius: 2px;
201
202
  --color-contrast: #fff;
202
203
  --color-100: #000;
203
204
  --color-85: #262626;
@@ -579,6 +580,10 @@ p {
579
580
  .lm_editTable_warpper .ant-table .ant-table-tbody > .ant-table-measure-row > td {
580
581
  padding: 0 !important;
581
582
  }
583
+ .lm_editTable_warpper .lm_edit_opetate {
584
+ padding-left: 8px;
585
+ padding-right: 8px;
586
+ }
582
587
  .lm_editTable_warpper .ant-picker {
583
588
  height: 24px !important;
584
589
  padding: 2px 8px;
@@ -604,3 +609,21 @@ p {
604
609
  color: var(--color-85);
605
610
  margin-left: 0 !important;
606
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
+ }
@@ -68,6 +68,10 @@
68
68
  .lm_editTable_warpper .ant-table .ant-table-tbody > .ant-table-measure-row > td {
69
69
  padding: 0 !important;
70
70
  }
71
+ .lm_editTable_warpper .lm_edit_opetate {
72
+ padding-left: 8px;
73
+ padding-right: 8px;
74
+ }
71
75
  .lm_editTable_warpper .ant-picker {
72
76
  height: 24px !important;
73
77
  padding: 2px 8px;
@@ -93,3 +97,21 @@
93
97
  color: var(--color-85);
94
98
  margin-left: 0 !important;
95
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
+ }
@@ -1,6 +1,7 @@
1
1
  export declare function isObjEmpty(obj: Record<string, any>): boolean;
2
2
  export declare function deepDataSourcePreKeys(dataSource: any[], rowKey: string): any;
3
3
  export declare function isExpandRow(children: any): boolean;
4
+ export declare function checkRowKeyByDataSource(dataSource: any, rowKey: any): any;
4
5
  declare const _default: {
5
6
  isObjEmpty: typeof isObjEmpty;
6
7
  };
@@ -1,3 +1,4 @@
1
+ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
1
2
  import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
2
3
  import { keyBy } from 'lodash';
3
4
  export function isObjEmpty(obj) {
@@ -28,6 +29,32 @@ export function isExpandRow(children) {
28
29
 
29
30
  return ['Collapse row', 'Expand row'].includes((_e = (_d = (_c = (_b = (_a = children === null || children === void 0 ? void 0 : children[0]) === null || _a === void 0 ? void 0 : _a.props) === null || _b === void 0 ? void 0 : _b.children) === null || _c === void 0 ? void 0 : _c[1]) === null || _d === void 0 ? void 0 : _d.props) === null || _e === void 0 ? void 0 : _e['aria-label']);
30
31
  }
32
+ export function checkRowKeyByDataSource(dataSource, rowKey) {
33
+ var addRowKey = function addRowKey(children, pkey) {
34
+ return children === null || children === void 0 ? void 0 : children.map(function (item, index) {
35
+ if (item.children) {
36
+ var _Object$assign;
37
+
38
+ var rchildren = addRowKey(item.children, "".concat(pkey, "_").concat(index + 1));
39
+ return Object.assign(Object.assign({}, item), (_Object$assign = {}, _defineProperty(_Object$assign, rowKey, item[rowKey] || "".concat(pkey, "_").concat(index + 1)), _defineProperty(_Object$assign, "children", rchildren), _Object$assign));
40
+ }
41
+
42
+ return Object.assign(Object.assign({}, item), _defineProperty({}, rowKey, item[rowKey] || "".concat(pkey, "_").concat(index + 1)));
43
+ });
44
+ };
45
+
46
+ var res = dataSource === null || dataSource === void 0 ? void 0 : dataSource.map(function (v, idx) {
47
+ if (v.children) {
48
+ var _Object$assign3;
49
+
50
+ var rchildren = addRowKey(v.children, v[rowKey] || "v".concat(idx + 1));
51
+ return Object.assign(Object.assign({}, v), (_Object$assign3 = {}, _defineProperty(_Object$assign3, rowKey, v[rowKey] || "v".concat(idx + 1)), _defineProperty(_Object$assign3, "children", rchildren), _Object$assign3));
52
+ }
53
+
54
+ return Object.assign(Object.assign({}, v), _defineProperty({}, rowKey, v[rowKey] || "v".concat(idx + 1)));
55
+ });
56
+ return res;
57
+ }
31
58
  export default {
32
59
  isObjEmpty: isObjEmpty
33
60
  };
@@ -198,6 +198,7 @@
198
198
  --font-size-base: 14px;
199
199
  --font-size-lg: calc(var(--font-size-base) + 2px);
200
200
  --font-size-sm: 12px;
201
+ --border-radius: 2px;
201
202
  --color-contrast: #fff;
202
203
  --color-100: #000;
203
204
  --color-85: #262626;
@@ -198,6 +198,7 @@
198
198
  --font-size-base: 14px;
199
199
  --font-size-lg: calc(var(--font-size-base) + 2px);
200
200
  --font-size-sm: 12px;
201
+ --border-radius: 2px;
201
202
  --color-contrast: #fff;
202
203
  --color-100: #000;
203
204
  --color-85: #262626;
@@ -1,3 +1,6 @@
1
1
  import type { Locale } from 'antd/es/locale-provider';
2
- declare const localeValues: Locale;
2
+ interface ILocal extends Locale {
3
+ CustomTableOption?: any;
4
+ }
5
+ declare const localeValues: ILocal;
3
6
  export default localeValues;
@@ -3,6 +3,7 @@ import Pagination from 'rc-pagination/lib/locale/en_US';
3
3
  import Calendar from 'antd/es/calendar/locale/en_US';
4
4
  import DatePicker from 'antd/es/date-picker/locale/en_US';
5
5
  import TimePicker from 'antd/es/time-picker/locale/en_US';
6
+ import CustomTableOption from '../CustomTableOption/locale/en_US';
6
7
  var typeTemplate = '${label} is not a valid ${type}';
7
8
  var localeValues = {
8
9
  locale: 'en',
@@ -127,6 +128,7 @@ var localeValues = {
127
128
  },
128
129
  Image: {
129
130
  preview: 'Preview'
130
- }
131
+ },
132
+ CustomTableOption: CustomTableOption
131
133
  };
132
134
  export default localeValues;
@@ -1,3 +1,6 @@
1
1
  import type { Locale } from 'antd/es/locale-provider';
2
- declare const localeValues: Locale;
2
+ interface ILocal extends Locale {
3
+ CustomTableOption?: any;
4
+ }
5
+ declare const localeValues: ILocal;
3
6
  export default localeValues;
@@ -3,6 +3,7 @@ import Pagination from 'rc-pagination/lib/locale/zh_CN';
3
3
  import Calendar from 'antd/es/calendar/locale/zh_CN';
4
4
  import DatePicker from 'antd/es/date-picker/locale/zh_CN';
5
5
  import TimePicker from 'antd/es/time-picker/locale/zh_CN';
6
+ import CustomTableOption from '../CustomTableOption/locale/zh_CN';
6
7
  var typeTemplate = '${label}不是一个有效的${type}';
7
8
  var localeValues = {
8
9
  locale: 'zh-cn',
@@ -126,6 +127,7 @@ var localeValues = {
126
127
  },
127
128
  Image: {
128
129
  preview: '预览'
129
- }
130
+ },
131
+ CustomTableOption: CustomTableOption
130
132
  };
131
133
  export default localeValues;
@@ -198,6 +198,7 @@
198
198
  --font-size-base: 14px;
199
199
  --font-size-lg: calc(var(--font-size-base) + 2px);
200
200
  --font-size-sm: 12px;
201
+ --border-radius: 2px;
201
202
  --color-contrast: #fff;
202
203
  --color-100: #000;
203
204
  --color-85: #262626;
@@ -198,6 +198,7 @@
198
198
  --font-size-base: 14px;
199
199
  --font-size-lg: calc(var(--font-size-base) + 2px);
200
200
  --font-size-sm: 12px;
201
+ --border-radius: 2px;
201
202
  --color-contrast: #fff;
202
203
  --color-100: #000;
203
204
  --color-85: #262626;
package/es/Modal/index.js CHANGED
@@ -18,6 +18,8 @@ import React from 'react';
18
18
  import Button from '../Button';
19
19
  import classNames from 'classnames';
20
20
  import SizeContext from '../ConfigProvider/SizeContext';
21
+ import LocaleReceiver from '../locale-provider/LocaleReceiver';
22
+ import { getConfirmLocale } from './locale';
21
23
  var prefixCls = 'lm_modal';
22
24
 
23
25
  var CLMModal = function CLMModal(props) {
@@ -26,34 +28,36 @@ var CLMModal = function CLMModal(props) {
26
28
  size = _props$size === void 0 ? 'default' : _props$size,
27
29
  onOk = props.onOk,
28
30
  onCancel = props.onCancel,
29
- _props$okText = props.okText,
30
- okText = _props$okText === void 0 ? '确定' : _props$okText,
31
- _props$cancelText = props.cancelText,
32
- cancelText = _props$cancelText === void 0 ? '取消' : _props$cancelText,
33
31
  visible = props.visible,
34
32
  open = props.open,
35
- other = __rest(props, ["wrapClassName", "size", "onOk", "onCancel", "okText", "cancelText", "visible", "open"]);
33
+ other = __rest(props, ["wrapClassName", "size", "onOk", "onCancel", "visible", "open"]);
36
34
 
37
35
  var defaultFooterSize = React.useContext(SizeContext) || 'middle';
38
- return /*#__PURE__*/React.createElement(_Modal, Object.assign({
39
- wrapClassName: classNames(wrapClassName, prefixCls),
40
- width: size === 'default' ? 552 : 416,
41
- footer: [/*#__PURE__*/React.createElement(Button, {
36
+ var defaultFooter = /*#__PURE__*/React.createElement(LocaleReceiver, {
37
+ componentName: "Modal",
38
+ defaultLocale: getConfirmLocale()
39
+ }, function (contextLocale) {
40
+ var okText = props.okText,
41
+ cancelText = props.cancelText;
42
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Button, Object.assign({
42
43
  onClick: onCancel,
43
44
  key: 'canncel_button',
44
45
  size: defaultFooterSize
45
- }, cancelText), /*#__PURE__*/React.createElement(Button, {
46
+ }, props.cancelButtonProps), cancelText || contextLocale.cancelText), /*#__PURE__*/React.createElement(Button, Object.assign({
46
47
  type: "primary",
47
48
  onClick: onOk,
48
49
  key: 'ok_button',
49
50
  size: defaultFooterSize
50
- }, okText)]
51
+ }, props.okButtonProps), okText !== null && okText !== void 0 ? okText : contextLocale.okText));
52
+ });
53
+ return /*#__PURE__*/React.createElement(_Modal, Object.assign({
54
+ wrapClassName: classNames(wrapClassName, prefixCls),
55
+ width: size === 'default' ? 552 : 416,
56
+ footer: defaultFooter
51
57
  }, other, {
52
58
  onOk: onOk,
53
59
  onCancel: onCancel,
54
- okText: okText,
55
- visible: visible || open,
56
- cancelText: cancelText
60
+ visible: visible || open
57
61
  }));
58
62
  };
59
63
 
@@ -0,0 +1,7 @@
1
+ export interface ModalLocale {
2
+ okText: string;
3
+ cancelText: string;
4
+ justOkText: string;
5
+ }
6
+ export declare function changeConfirmLocale(newLocale?: ModalLocale): void;
7
+ export declare function getConfirmLocale(): ModalLocale;
@@ -0,0 +1,12 @@
1
+ import defaultLocale from '../Locale/default';
2
+ var runtimeLocale = Object.assign({}, defaultLocale.Modal);
3
+ export function changeConfirmLocale(newLocale) {
4
+ if (newLocale) {
5
+ runtimeLocale = Object.assign(Object.assign({}, runtimeLocale), newLocale);
6
+ } else {
7
+ runtimeLocale = Object.assign({}, defaultLocale.Modal);
8
+ }
9
+ }
10
+ export function getConfirmLocale() {
11
+ return runtimeLocale;
12
+ }
@@ -198,6 +198,7 @@
198
198
  --font-size-base: 14px;
199
199
  --font-size-lg: calc(var(--font-size-base) + 2px);
200
200
  --font-size-sm: 12px;
201
+ --border-radius: 2px;
201
202
  --color-contrast: #fff;
202
203
  --color-100: #000;
203
204
  --color-85: #262626;