linkmore-design 1.1.11 → 1.1.13-alpha.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 (88) hide show
  1. package/CHANGELOG.md +34 -0
  2. package/dist/Cascader/demos/formItem.d.ts +2 -0
  3. package/dist/LmEditTable/DndContainer.d.ts +4 -3
  4. package/dist/LmEditTable/EditTable.d.ts +2 -0
  5. package/dist/LmEditTable/components/DraggableContainer.d.ts +7 -0
  6. package/dist/LmEditTable/components/index.d.ts +11 -0
  7. package/dist/LmEditTable/sortableItem.d.ts +3 -2
  8. package/dist/LmEditTable/util.d.ts +2 -0
  9. package/dist/LmEditTable/virtual/VirtualRow.d.ts +6 -0
  10. package/dist/LmEditTable/virtual/VirtualRowBack.d.ts +6 -0
  11. package/dist/LmEditTable/virtual/VirtualTable.d.ts +3 -0
  12. package/dist/LmEditTable/virtual/VirtualWrapper.d.ts +3 -0
  13. package/dist/LmEditTable/virtual/context.d.ts +13 -0
  14. package/dist/LmEditTable/virtual/index.d.ts +4 -0
  15. package/dist/Select/demos/formItem.d.ts +2 -0
  16. package/dist/Select/index.d.ts +1 -0
  17. package/dist/TreeSelect/demos/formItem.d.ts +2 -0
  18. package/dist/TreeSelect/index.d.ts +8 -3
  19. package/dist/index.umd.js +629 -226
  20. package/dist/index.umd.min.js +5 -5
  21. package/dist/variables.css +47 -0
  22. package/es/IconFont/index.js +1 -1
  23. package/es/LmEditTable/DndContainer.d.ts +4 -3
  24. package/es/LmEditTable/DndContainer.js +2 -2
  25. package/es/LmEditTable/EditTable.d.ts +2 -0
  26. package/es/LmEditTable/EditTable.js +200 -158
  27. package/es/LmEditTable/components/DraggableContainer.d.ts +7 -0
  28. package/es/LmEditTable/components/DraggableContainer.js +32 -0
  29. package/es/LmEditTable/components/index.d.ts +11 -0
  30. package/es/LmEditTable/components/index.js +5 -0
  31. package/es/LmEditTable/sortableItem.d.ts +3 -2
  32. package/es/LmEditTable/sortableItem.js +15 -4
  33. package/es/LmEditTable/style/index.css +47 -0
  34. package/es/LmEditTable/style/variables.css +47 -0
  35. package/es/LmEditTable/util.d.ts +2 -0
  36. package/es/LmEditTable/util.js +37 -1
  37. package/es/LmEditTable/virtual/VirtualRow.d.ts +6 -0
  38. package/es/LmEditTable/virtual/VirtualRow.js +60 -0
  39. package/es/LmEditTable/virtual/VirtualRowBack.d.ts +6 -0
  40. package/es/LmEditTable/virtual/VirtualRowBack.js +102 -0
  41. package/es/LmEditTable/virtual/VirtualTable.d.ts +3 -0
  42. package/es/LmEditTable/virtual/VirtualTable.js +54 -0
  43. package/es/LmEditTable/virtual/VirtualWrapper.d.ts +3 -0
  44. package/es/LmEditTable/virtual/VirtualWrapper.js +60 -0
  45. package/es/LmEditTable/virtual/context.d.ts +13 -0
  46. package/es/LmEditTable/virtual/context.js +54 -0
  47. package/es/LmEditTable/virtual/index.d.ts +4 -0
  48. package/es/LmEditTable/virtual/index.js +4 -0
  49. package/es/Select/index.d.ts +1 -0
  50. package/es/Select/index.js +38 -4
  51. package/es/TreeSelect/index.d.ts +8 -3
  52. package/es/TreeSelect/index.js +74 -1
  53. package/es/hooks/useEvent/index.js +1 -1
  54. package/es/styles/variables.css +47 -0
  55. package/lib/IconFont/index.js +1 -1
  56. package/lib/LmEditTable/DndContainer.d.ts +4 -3
  57. package/lib/LmEditTable/DndContainer.js +4 -3
  58. package/lib/LmEditTable/EditTable.d.ts +2 -0
  59. package/lib/LmEditTable/EditTable.js +195 -153
  60. package/lib/LmEditTable/components/DraggableContainer.d.ts +7 -0
  61. package/lib/LmEditTable/components/DraggableContainer.js +45 -0
  62. package/lib/LmEditTable/components/index.d.ts +11 -0
  63. package/lib/LmEditTable/components/index.js +21 -0
  64. package/lib/LmEditTable/sortableItem.d.ts +3 -2
  65. package/lib/LmEditTable/sortableItem.js +18 -5
  66. package/lib/LmEditTable/style/index.css +47 -0
  67. package/lib/LmEditTable/style/variables.css +47 -0
  68. package/lib/LmEditTable/util.d.ts +2 -0
  69. package/lib/LmEditTable/util.js +40 -0
  70. package/lib/LmEditTable/virtual/VirtualRow.d.ts +6 -0
  71. package/lib/LmEditTable/virtual/VirtualRow.js +73 -0
  72. package/lib/LmEditTable/virtual/VirtualRowBack.d.ts +6 -0
  73. package/lib/LmEditTable/virtual/VirtualRowBack.js +115 -0
  74. package/lib/LmEditTable/virtual/VirtualTable.d.ts +3 -0
  75. package/lib/LmEditTable/virtual/VirtualTable.js +71 -0
  76. package/lib/LmEditTable/virtual/VirtualWrapper.d.ts +3 -0
  77. package/lib/LmEditTable/virtual/VirtualWrapper.js +73 -0
  78. package/lib/LmEditTable/virtual/context.d.ts +13 -0
  79. package/lib/LmEditTable/virtual/context.js +64 -0
  80. package/lib/LmEditTable/virtual/index.d.ts +4 -0
  81. package/lib/LmEditTable/virtual/index.js +31 -0
  82. package/lib/Select/index.d.ts +1 -0
  83. package/lib/Select/index.js +37 -3
  84. package/lib/TreeSelect/index.d.ts +8 -3
  85. package/lib/TreeSelect/index.js +78 -1
  86. package/lib/hooks/useEvent/index.js +1 -1
  87. package/lib/styles/variables.css +47 -0
  88. package/package.json +1 -1
@@ -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;
@@ -9,7 +9,7 @@ function useEvent(handler) {
9
9
 
10
10
  return useCallback(function () {
11
11
  var fn = handlerRef.current;
12
- return fn.apply(void 0, arguments);
12
+ return fn === null || fn === void 0 ? void 0 : fn.apply(void 0, arguments);
13
13
  }, []);
14
14
  }
15
15
 
@@ -9742,6 +9742,9 @@ p {
9742
9742
  letter-spacing: 0px;
9743
9743
  color: var(--color-85);
9744
9744
  }
9745
+ .lm_editTable_warpper .lm_custom_cell_td {
9746
+ position: relative;
9747
+ }
9745
9748
  .lm_editTable_warpper .lm_custom_cell_td .ant-form-item-control-input-content {
9746
9749
  display: flex;
9747
9750
  flex-direction: row;
@@ -9753,6 +9756,32 @@ p {
9753
9756
  .lm_editTable_warpper .lm_custom_cell_td .ant-table-row-expand-icon {
9754
9757
  margin-top: 6px;
9755
9758
  }
9759
+ .lm_editTable_warpper .lm_custom_cell_td .quick_copy_warp {
9760
+ font-size: 8px;
9761
+ position: absolute;
9762
+ left: calc(50% - 10px);
9763
+ z-index: 100;
9764
+ width: 20px;
9765
+ height: 10px;
9766
+ background-color: var(--color-6);
9767
+ display: flex;
9768
+ align-items: center;
9769
+ justify-content: center;
9770
+ color: #D8D8D8;
9771
+ }
9772
+ .lm_editTable_warpper .lm_custom_cell_td .quick_copy_warp:hover {
9773
+ cursor: pointer;
9774
+ background-color: var(--primary-color);
9775
+ color: #fff;
9776
+ }
9777
+ .lm_editTable_warpper .lm_custom_cell_td .quick_copy_up {
9778
+ top: -4px;
9779
+ left: calc(50% - 10px);
9780
+ }
9781
+ .lm_editTable_warpper .lm_custom_cell_td .quick_copy_down {
9782
+ bottom: -6px;
9783
+ left: calc(50% - 10px);
9784
+ }
9756
9785
  .lm_editTable_warpper .lm_editTable_cell_edit {
9757
9786
  height: 40px;
9758
9787
  padding: 8px 8px !important;
@@ -9802,6 +9831,24 @@ p {
9802
9831
  color: var(--color-85);
9803
9832
  margin-left: 0 !important;
9804
9833
  }
9834
+ .lm_table_append_add_popover .ant-popover-inner-content {
9835
+ padding: 0px;
9836
+ }
9837
+ .lm_table_append_add_popover .ant-popover-inner-content ul {
9838
+ margin: 0;
9839
+ }
9840
+ .lm_table_append_add_popover .ant-popover-inner-content ul li {
9841
+ font-size: 12px;
9842
+ padding: 4px 8px;
9843
+ height: 24px;
9844
+ display: flex;
9845
+ align-items: center;
9846
+ justify-content: center;
9847
+ cursor: pointer;
9848
+ }
9849
+ .lm_table_append_add_popover .ant-popover-inner-content ul li:hover {
9850
+ background-color: var(--color-15);
9851
+ }
9805
9852
  .lm_filter_wrapper .lm_filter_container .lm_filter {
9806
9853
  display: flex;
9807
9854
  flex-wrap: wrap;
@@ -8,7 +8,7 @@ exports.default = void 0;
8
8
  var _icons = require("@ant-design/icons");
9
9
 
10
10
  var IconFont = (0, _icons.createFromIconfontCN)({
11
- scriptUrl: '//at.alicdn.com/t/c/font_2966019_totaqlvhjak.js' // 在 iconfont.cn 上生成
11
+ scriptUrl: '//at.alicdn.com/t/c/font_2966019_neaxovtw4w.js' // 在 iconfont.cn 上生成
12
12
  // scriptUrl: require('./font/iconfont.js'),
13
13
 
14
14
  });
@@ -1,5 +1,6 @@
1
- declare const DndContainer: ({ children, move }: {
1
+ import React from 'react';
2
+ declare const _default: React.MemoExoticComponent<({ children, move }: {
2
3
  children: any;
3
4
  move: any;
4
- }) => JSX.Element;
5
- export default DndContainer;
5
+ }) => JSX.Element>;
6
+ export default _default;
@@ -1,13 +1,13 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
3
+ var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");
4
4
 
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
8
  exports.default = void 0;
9
9
 
10
- var _react = _interopRequireDefault(require("react"));
10
+ var _react = _interopRequireWildcard(require("react"));
11
11
 
12
12
  var _core = require("@dnd-kit/core");
13
13
 
@@ -45,5 +45,6 @@ var DndContainer = function DndContainer(_ref) {
45
45
  }, children);
46
46
  };
47
47
 
48
- var _default = DndContainer;
48
+ var _default = /*#__PURE__*/(0, _react.memo)(DndContainer);
49
+
49
50
  exports.default = _default;
@@ -36,9 +36,11 @@ interface ILmColumns extends TableColumnType<any> {
36
36
  export declare type TLmEditTable = {
37
37
  onChange?: (data: any[]) => void;
38
38
  columns: ILmColumns[];
39
+ virtual: boolean;
39
40
  } & ILmEditTable;
40
41
  declare const _default: React.MemoExoticComponent<React.ForwardRefExoticComponent<{
41
42
  onChange?: (data: any[]) => void;
42
43
  columns: ILmColumns[];
44
+ virtual: boolean;
43
45
  } & ILmEditTable & React.RefAttributes<unknown>>>;
44
46
  export default _default;