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
@@ -0,0 +1,64 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.useStore = exports.useRealive = exports.TableContext = void 0;
7
+
8
+ var _react = require("react");
9
+
10
+ // =============== context ============== //
11
+ var TableContext = /*#__PURE__*/(0, _react.createContext)({
12
+ state: null,
13
+ dispatch: null,
14
+ instance: {}
15
+ });
16
+ exports.TableContext = TableContext;
17
+
18
+ var useStore = function useStore() {
19
+ return (0, _react.useContext)(TableContext);
20
+ };
21
+
22
+ exports.useStore = useStore;
23
+ var initialState = {
24
+ // 行高度
25
+ rowHeight: 0,
26
+ columnsLen: 0,
27
+ // 总行数
28
+ totalLen: 0
29
+ };
30
+
31
+ var reducer = function reducer(state, action) {
32
+ var totalLen = action.totalLen,
33
+ columnsLen = action.columnsLen,
34
+ rowHeight = action.rowHeight;
35
+
36
+ switch (action.type) {
37
+ // 数据数量
38
+ case 'changeTotalLen':
39
+ return Object.assign(Object.assign({}, state), {
40
+ totalLen: totalLen
41
+ });
42
+ // 列数量
43
+
44
+ case 'changeColumnsLen':
45
+ return Object.assign(Object.assign({}, state), {
46
+ columnsLen: columnsLen
47
+ });
48
+ // 初始化行高度
49
+
50
+ case 'initHeight':
51
+ return Object.assign(Object.assign({}, state), {
52
+ rowHeight: rowHeight
53
+ });
54
+
55
+ default:
56
+ throw new Error();
57
+ }
58
+ };
59
+
60
+ var useRealive = function useRealive() {
61
+ return (0, _react.useReducer)(reducer, initialState);
62
+ };
63
+
64
+ exports.useRealive = useRealive;
@@ -0,0 +1,4 @@
1
+ import VirtualTable from './VirtualTable';
2
+ import VirtualWrapper from './VirtualWrapper';
3
+ import VirtualRow from './VirtualRow';
4
+ export { VirtualTable, VirtualWrapper, VirtualRow };
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ Object.defineProperty(exports, "VirtualRow", {
9
+ enumerable: true,
10
+ get: function get() {
11
+ return _VirtualRow.default;
12
+ }
13
+ });
14
+ Object.defineProperty(exports, "VirtualTable", {
15
+ enumerable: true,
16
+ get: function get() {
17
+ return _VirtualTable.default;
18
+ }
19
+ });
20
+ Object.defineProperty(exports, "VirtualWrapper", {
21
+ enumerable: true,
22
+ get: function get() {
23
+ return _VirtualWrapper.default;
24
+ }
25
+ });
26
+
27
+ var _VirtualTable = _interopRequireDefault(require("./VirtualTable"));
28
+
29
+ var _VirtualWrapper = _interopRequireDefault(require("./VirtualWrapper"));
30
+
31
+ var _VirtualRow = _interopRequireDefault(require("./VirtualRow"));
@@ -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;
@@ -1,5 +1,7 @@
1
1
  "use strict";
2
2
 
3
+ var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");
4
+
3
5
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
6
 
5
7
  Object.defineProperty(exports, "__esModule", {
@@ -11,5 +13,80 @@ require("antd/es/tree-select/style");
11
13
 
12
14
  var _treeSelect = _interopRequireDefault(require("antd/es/tree-select"));
13
15
 
14
- var _default = _treeSelect.default;
16
+ var _react = _interopRequireWildcard(require("react"));
17
+
18
+ var __rest = void 0 && (void 0).__rest || function (s, e) {
19
+ var t = {};
20
+
21
+ for (var p in s) {
22
+ if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
23
+ }
24
+
25
+ if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
26
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
27
+ }
28
+ return t;
29
+ };
30
+
31
+ var CLMTreeSelect = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
32
+ var children = props.children,
33
+ treeData = props.treeData,
34
+ value = props.value,
35
+ defaultLabel = props.defaultLabel,
36
+ resetProps = __rest(props, ["children", "treeData", "value", "defaultLabel"]);
37
+
38
+ var deepChildren = (0, _react.useCallback)(function (arr) {
39
+ var flag = false;
40
+
41
+ _react.default.Children.forEach(arr, function (child) {
42
+ if ( /*#__PURE__*/_react.default.isValidElement(child)) {
43
+ var _child$props = child.props,
44
+ childValue = _child$props.value,
45
+ childChildren = _child$props.children;
46
+
47
+ if (!flag) {
48
+ if (childValue === value) {
49
+ flag = true;
50
+ } else if (childChildren) {
51
+ flag = deepChildren(childChildren);
52
+ }
53
+ }
54
+ }
55
+ });
56
+
57
+ return flag;
58
+ }, [value]);
59
+ var hasOption = (0, _react.useMemo)(function () {
60
+ var flag = false;
61
+
62
+ if (children) {
63
+ flag = deepChildren(children);
64
+ }
65
+
66
+ if (treeData) {
67
+ var deepFind = function deepFind(arr) {
68
+ return arr.some(function (v) {
69
+ if (v.value === value) return true;
70
+ return v.children && deepFind(v.children);
71
+ });
72
+ };
73
+
74
+ flag = deepFind(treeData);
75
+ }
76
+
77
+ return flag;
78
+ }, [children, value, deepChildren]); // 重组value: 传入value但找不到options项时,展示默认label
79
+
80
+ var resetValue = (0, _react.useMemo)(function () {
81
+ if (value && !hasOption) return defaultLabel !== null && defaultLabel !== void 0 ? defaultLabel : value;
82
+ return value;
83
+ }, [value, hasOption]);
84
+ return /*#__PURE__*/_react.default.createElement(_treeSelect.default, Object.assign({
85
+ ref: ref,
86
+ value: resetValue
87
+ }, resetProps), children);
88
+ });
89
+ var LMTreeSelect = CLMTreeSelect;
90
+ LMTreeSelect.TreeNode = _treeSelect.default.TreeNode;
91
+ var _default = LMTreeSelect;
15
92
  exports.default = _default;
@@ -17,7 +17,7 @@ function useEvent(handler) {
17
17
 
18
18
  return (0, _react.useCallback)(function () {
19
19
  var fn = handlerRef.current;
20
- return fn.apply(void 0, arguments);
20
+ return fn === null || fn === void 0 ? void 0 : fn.apply(void 0, arguments);
21
21
  }, []);
22
22
  }
23
23
 
@@ -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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "linkmore-design",
3
- "version": "1.1.11",
3
+ "version": "1.1.13-alpha.0",
4
4
  "author": {
5
5
  "name": "nowthen",
6
6
  "email": "rnlvwyx@gmail.com"