linkmore-design 1.1.27-alpha.0 → 1.1.27-alpha.1

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 (48) hide show
  1. package/dist/LmEditTable/components/customRenderEmpty.d.ts +2 -0
  2. package/dist/LmEditTable/components/index.d.ts +2 -1
  3. package/dist/LmEditTable/util.d.ts +1 -0
  4. package/{lib/LmEditTable/virtual/VirtualRowBack.d.ts → dist/LmEditTable/virtual/VirtualRow2.d.ts} +7 -6
  5. package/dist/LmTable/virTual/VirtualRow.d.ts +1 -1
  6. package/dist/index.umd.js +280 -87
  7. package/dist/index.umd.min.js +21 -21
  8. package/dist/variables.css +27 -0
  9. package/es/LmEditTable/EditTable.js +19 -7
  10. package/es/LmEditTable/components/customRenderEmpty.d.ts +2 -0
  11. package/es/LmEditTable/components/customRenderEmpty.js +20 -0
  12. package/es/LmEditTable/components/index.d.ts +2 -1
  13. package/es/LmEditTable/components/index.js +2 -1
  14. package/es/LmEditTable/style/index.css +27 -0
  15. package/es/LmEditTable/style/variables.css +27 -0
  16. package/es/LmEditTable/util.d.ts +1 -0
  17. package/es/LmEditTable/util.js +11 -0
  18. package/es/LmEditTable/virtual/VirtualRow.js +94 -16
  19. package/{dist/LmEditTable/virtual/VirtualRowBack.d.ts → es/LmEditTable/virtual/VirtualRow2.d.ts} +7 -6
  20. package/es/LmEditTable/virtual/VirtualRow2.js +62 -0
  21. package/es/LmEditTable/virtual/VirtualTable.js +17 -9
  22. package/es/LmEditTable/virtual/context.js +14 -2
  23. package/es/LmTable/virTual/VirtualRow.d.ts +1 -1
  24. package/es/LmTable/virTual/VirtualRow.js +80 -44
  25. package/es/LmTable/virTual/VirtualTable.js +17 -9
  26. package/es/LmTable/virTual/context.js +14 -2
  27. package/es/styles/variables.css +27 -0
  28. package/lib/LmEditTable/EditTable.js +18 -5
  29. package/lib/LmEditTable/components/customRenderEmpty.d.ts +2 -0
  30. package/lib/LmEditTable/components/customRenderEmpty.js +32 -0
  31. package/lib/LmEditTable/components/index.d.ts +2 -1
  32. package/lib/LmEditTable/components/index.js +8 -0
  33. package/lib/LmEditTable/style/index.css +27 -0
  34. package/lib/LmEditTable/style/variables.css +27 -0
  35. package/lib/LmEditTable/util.d.ts +1 -0
  36. package/lib/LmEditTable/util.js +13 -0
  37. package/lib/LmEditTable/virtual/VirtualRow.js +93 -16
  38. package/{es/LmEditTable/virtual/VirtualRowBack.d.ts → lib/LmEditTable/virtual/VirtualRow2.d.ts} +1 -0
  39. package/lib/LmEditTable/virtual/{VirtualRowBack.js → VirtualRow2.js} +13 -48
  40. package/lib/LmEditTable/virtual/VirtualTable.js +16 -8
  41. package/lib/LmEditTable/virtual/context.js +14 -2
  42. package/lib/LmTable/virTual/VirtualRow.d.ts +1 -1
  43. package/lib/LmTable/virTual/VirtualRow.js +79 -44
  44. package/lib/LmTable/virTual/VirtualTable.js +16 -8
  45. package/lib/LmTable/virTual/context.js +14 -2
  46. package/lib/styles/variables.css +27 -0
  47. package/package.json +1 -1
  48. package/es/LmEditTable/virtual/VirtualRowBack.js +0 -100
@@ -1,100 +0,0 @@
1
- var __rest = this && this.__rest || function (s, e) {
2
- var t = {};
3
-
4
- for (var p in s) {
5
- if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
6
- }
7
-
8
- if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
9
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
10
- }
11
- return t;
12
- };
13
-
14
- import React, { useRef, useMemo, useEffect } from 'react';
15
- import { useStore } from './context';
16
- var VirtualRow = /*#__PURE__*/React.memo(function (_a, ref) {
17
- var children = _a.children,
18
- resetProps = __rest(_a, ["children"]);
19
-
20
- var _useStore = useStore(),
21
- state = _useStore.state,
22
- dispatch = _useStore.dispatch,
23
- instance = _useStore.instance;
24
-
25
- var rowHeight = state.rowHeight,
26
- totalLen = state.totalLen;
27
- var virtualItems = instance.columnVirtual.virtualItems;
28
- var trRef = useRef(null); // 非固定列长度
29
-
30
- var columnsLen = useMemo(function () {
31
- var _a;
32
-
33
- return (_a = children === null || children === void 0 ? void 0 : children.filter(function (v) {
34
- var _a, _b;
35
-
36
- return typeof ((_a = v.props) === null || _a === void 0 ? void 0 : _a.fixLeft) !== 'number' && typeof ((_b = v.props) === null || _b === void 0 ? void 0 : _b.fixRight) !== 'number';
37
- }).length) !== null && _a !== void 0 ? _a : 0;
38
- }, [children]);
39
- useEffect(function () {
40
- if (state.columnsLen !== columnsLen) {
41
- dispatch({
42
- type: 'changeColumnsLen',
43
- columnsLen: columnsLen !== null && columnsLen !== void 0 ? columnsLen : 0
44
- });
45
- }
46
- }, [columnsLen, dispatch, state.columnsLen]);
47
- useEffect(function () {
48
- var initHeight = function initHeight(tempRef) {
49
- var _a, _b, _c;
50
-
51
- if (((_a = tempRef === null || tempRef === void 0 ? void 0 : tempRef.current) === null || _a === void 0 ? void 0 : _a.offsetHeight) && !rowHeight && totalLen) {
52
- var tempRowHeight = (_c = (_b = tempRef === null || tempRef === void 0 ? void 0 : tempRef.current) === null || _b === void 0 ? void 0 : _b.offsetHeight) !== null && _c !== void 0 ? _c : 0;
53
- dispatch({
54
- type: 'initHeight',
55
- rowHeight: tempRowHeight
56
- });
57
- }
58
- };
59
-
60
- initHeight(Object.prototype.hasOwnProperty.call(ref, 'current') ? ref : trRef);
61
- }, [trRef, dispatch, rowHeight, totalLen, ref]); // return {fixedLeft: [], fixedRight: [], columns: []}
62
-
63
- var fixedColumns = useMemo(function () {
64
- return children === null || children === void 0 ? void 0 : children.reduce(function (pre, cur) {
65
- var _a, _b;
66
-
67
- if (typeof ((_a = cur.props) === null || _a === void 0 ? void 0 : _a.fixLeft) === 'number') {
68
- pre.fixedLeft.push(cur);
69
- return pre;
70
- }
71
-
72
- if (typeof ((_b = cur.props) === null || _b === void 0 ? void 0 : _b.fixRight) === 'number') {
73
- pre.fixedRight.push(cur);
74
- return pre;
75
- }
76
-
77
- pre.columns.push(cur);
78
- return pre;
79
- }, {
80
- fixedLeft: [],
81
- fixedRight: [],
82
- columns: []
83
- });
84
- }, [children]); // 横向单元格合并
85
-
86
- var colSpan = useMemo(function () {
87
- var _a;
88
-
89
- return (_a = virtualItems[0]) === null || _a === void 0 ? void 0 : _a.index;
90
- }, [virtualItems]);
91
- console.log('virtualItems', virtualItems);
92
- return /*#__PURE__*/React.createElement("tr", Object.assign({}, resetProps, {
93
- ref: Object.prototype.hasOwnProperty.call(ref, 'current') ? ref : trRef
94
- }), fixedColumns.fixedLeft, !!colSpan && /*#__PURE__*/React.createElement("td", {
95
- colSpan: colSpan
96
- }), virtualItems.map(function (virtualCol) {
97
- return fixedColumns.columns[virtualCol.index];
98
- }), fixedColumns.fixedRight);
99
- });
100
- export default VirtualRow;