linkmore-design 1.1.17 → 1.1.18

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.
@@ -1153,7 +1153,11 @@ var EditTable = /*#__PURE__*/forwardRef(function (props, ref) {
1153
1153
  relevanceCols = col.relevanceCols,
1154
1154
  componentProps = col.componentProps;
1155
1155
 
1156
- 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 || componentProps && isFunction(componentProps)) {
1156
+ if (componentProps && isFunction(componentProps)) {
1157
+ return true;
1158
+ }
1159
+
1160
+ 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) {
1157
1161
  return true;
1158
1162
  }
1159
1163
 
@@ -2,6 +2,7 @@ import React from 'react';
2
2
  interface IMenuData {
3
3
  menuId: string;
4
4
  title: string | React.ReactNode;
5
+ hidden?: boolean;
5
6
  }
6
7
  export interface IQuickMenuProps {
7
8
  className?: string;
@@ -1,5 +1,5 @@
1
1
  import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
2
- import React, { useEffect, useState, useRef } from 'react';
2
+ import React, { useEffect, useState, useRef, useMemo } from 'react';
3
3
  import { IconFont, Button } from 'linkmore-design';
4
4
  import { useScroll, useDebounceEffect } from 'ahooks';
5
5
  import classNames from 'classnames';
@@ -31,6 +31,11 @@ var LMQuickMenu = function LMQuickMenu(props) {
31
31
  var scroll = useScroll(getTargetElement(warpElement || document), function () {
32
32
  return scrollOpenStatus;
33
33
  });
34
+ var filterMenuData = useMemo(function () {
35
+ return menuData === null || menuData === void 0 ? void 0 : menuData.filter(function (item) {
36
+ return item.hidden !== true;
37
+ });
38
+ }, [menuData]);
34
39
 
35
40
  function clearActiveToc() {
36
41
  [].forEach.call(document.querySelectorAll('.lm_menu_list li a'), function (node) {
@@ -54,7 +59,7 @@ var LMQuickMenu = function LMQuickMenu(props) {
54
59
  (_a = menuTimeEventRef.current) === null || _a === void 0 ? void 0 : _a.destroy();
55
60
  }
56
61
 
57
- if (!menuData.length) {
62
+ if (!filterMenuData.length) {
58
63
  return;
59
64
  } // eslint-disable-next-line global-require
60
65
 
@@ -66,11 +71,10 @@ var LMQuickMenu = function LMQuickMenu(props) {
66
71
 
67
72
  menuTimeEventRef.current = scrollama();
68
73
  (_c = (_b = menuTimeEventRef.current) === null || _b === void 0 ? void 0 : _b.setup({
69
- step: menuData.map(function (item) {
74
+ step: filterMenuData.map(function (item) {
70
75
  return document.getElementById("".concat(item.menuId));
71
- }).filter(Boolean) // required
72
- // offset: '10px',
73
-
76
+ }).filter(Boolean),
77
+ container: getTargetElement(warpElement || document)
74
78
  })) === null || _c === void 0 ? void 0 : _c.onStepEnter(function (_ref) {
75
79
  var element = _ref.element;
76
80
  updateActiveToc(element.id);
@@ -78,7 +82,7 @@ var LMQuickMenu = function LMQuickMenu(props) {
78
82
  };
79
83
 
80
84
  function setKeysDom() {
81
- menuData.forEach(function (item) {
85
+ filterMenuData.forEach(function (item) {
82
86
  var _a, _b;
83
87
 
84
88
  var warpTop = ((_a = getTargetElement(warpElement || document)) === null || _a === void 0 ? void 0 : _a.offsetTop) || 0;
@@ -156,7 +160,7 @@ var LMQuickMenu = function LMQuickMenu(props) {
156
160
  })
157
161
  }), /*#__PURE__*/React.createElement("ul", {
158
162
  className: classNames('lm_menu_list', hovering && 'show', className)
159
- }, menuData.map(function (item) {
163
+ }, filterMenuData.map(function (item) {
160
164
  return /*#__PURE__*/React.createElement("li", {
161
165
  key: item.menuId,
162
166
  onClick: function onClick() {
@@ -1185,7 +1185,11 @@ var EditTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
1185
1185
  relevanceCols = col.relevanceCols,
1186
1186
  componentProps = col.componentProps;
1187
1187
 
1188
- 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 || componentProps && (0, _lodash.isFunction)(componentProps)) {
1188
+ if (componentProps && (0, _lodash.isFunction)(componentProps)) {
1189
+ return true;
1190
+ }
1191
+
1192
+ 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) {
1189
1193
  return true;
1190
1194
  }
1191
1195
 
@@ -2,6 +2,7 @@ import React from 'react';
2
2
  interface IMenuData {
3
3
  menuId: string;
4
4
  title: string | React.ReactNode;
5
+ hidden?: boolean;
5
6
  }
6
7
  export interface IQuickMenuProps {
7
8
  className?: string;
@@ -48,6 +48,11 @@ var LMQuickMenu = function LMQuickMenu(props) {
48
48
  var scroll = (0, _ahooks.useScroll)((0, _domTarget.getTargetElement)(warpElement || document), function () {
49
49
  return scrollOpenStatus;
50
50
  });
51
+ var filterMenuData = (0, _react.useMemo)(function () {
52
+ return menuData === null || menuData === void 0 ? void 0 : menuData.filter(function (item) {
53
+ return item.hidden !== true;
54
+ });
55
+ }, [menuData]);
51
56
 
52
57
  function clearActiveToc() {
53
58
  [].forEach.call(document.querySelectorAll('.lm_menu_list li a'), function (node) {
@@ -71,7 +76,7 @@ var LMQuickMenu = function LMQuickMenu(props) {
71
76
  (_a = menuTimeEventRef.current) === null || _a === void 0 ? void 0 : _a.destroy();
72
77
  }
73
78
 
74
- if (!menuData.length) {
79
+ if (!filterMenuData.length) {
75
80
  return;
76
81
  } // eslint-disable-next-line global-require
77
82
 
@@ -83,11 +88,10 @@ var LMQuickMenu = function LMQuickMenu(props) {
83
88
 
84
89
  menuTimeEventRef.current = scrollama();
85
90
  (_c = (_b = menuTimeEventRef.current) === null || _b === void 0 ? void 0 : _b.setup({
86
- step: menuData.map(function (item) {
91
+ step: filterMenuData.map(function (item) {
87
92
  return document.getElementById("".concat(item.menuId));
88
- }).filter(Boolean) // required
89
- // offset: '10px',
90
-
93
+ }).filter(Boolean),
94
+ container: (0, _domTarget.getTargetElement)(warpElement || document)
91
95
  })) === null || _c === void 0 ? void 0 : _c.onStepEnter(function (_ref) {
92
96
  var element = _ref.element;
93
97
  updateActiveToc(element.id);
@@ -95,7 +99,7 @@ var LMQuickMenu = function LMQuickMenu(props) {
95
99
  };
96
100
 
97
101
  function setKeysDom() {
98
- menuData.forEach(function (item) {
102
+ filterMenuData.forEach(function (item) {
99
103
  var _a, _b;
100
104
 
101
105
  var warpTop = ((_a = (0, _domTarget.getTargetElement)(warpElement || document)) === null || _a === void 0 ? void 0 : _a.offsetTop) || 0;
@@ -173,7 +177,7 @@ var LMQuickMenu = function LMQuickMenu(props) {
173
177
  })
174
178
  }), /*#__PURE__*/_react.default.createElement("ul", {
175
179
  className: (0, _classnames.default)('lm_menu_list', hovering && 'show', className)
176
- }, menuData.map(function (item) {
180
+ }, filterMenuData.map(function (item) {
177
181
  return /*#__PURE__*/_react.default.createElement("li", {
178
182
  key: item.menuId,
179
183
  onClick: function onClick() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "linkmore-design",
3
- "version": "1.1.17",
3
+ "version": "1.1.18",
4
4
  "author": {
5
5
  "name": "nowthen",
6
6
  "email": "rnlvwyx@gmail.com"