@kne/system-layout 0.1.0-alpha.10 → 0.1.0-alpha.11
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.
- package/dist/index.js +13 -5
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +13 -5
- package/dist/index.modern.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -130,11 +130,19 @@ const Menu = ({
|
|
|
130
130
|
const hasGroup = item.group && item.group !== items[index - 1]?.group;
|
|
131
131
|
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
132
132
|
title: item.label,
|
|
133
|
-
onClick:
|
|
133
|
+
onClick: e => {
|
|
134
134
|
onChange && onChange(item, {
|
|
135
135
|
menuOpen,
|
|
136
136
|
base
|
|
137
137
|
});
|
|
138
|
+
if (typeof item.onClick === 'function') {
|
|
139
|
+
item.onClick(item, {
|
|
140
|
+
menuOpen,
|
|
141
|
+
base,
|
|
142
|
+
event: e
|
|
143
|
+
});
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
138
146
|
if (item.path) {
|
|
139
147
|
navigate(ensureSlash__default["default"](`${base}${item.path}`));
|
|
140
148
|
}
|
|
@@ -159,15 +167,15 @@ const Menu = ({
|
|
|
159
167
|
fontClassName: "system"
|
|
160
168
|
});
|
|
161
169
|
}
|
|
162
|
-
if (
|
|
170
|
+
if (/*#__PURE__*/react.isValidElement(icon)) {
|
|
171
|
+
return icon;
|
|
172
|
+
}
|
|
173
|
+
if (isPlainObject__default["default"](icon) && typeof icon.type === 'string') {
|
|
163
174
|
return /*#__PURE__*/jsxRuntime.jsx(Icon__default["default"], {
|
|
164
175
|
...icon,
|
|
165
176
|
className: classnames__default["default"]('menu-item-icon', style$1['menu-item-icon'])
|
|
166
177
|
});
|
|
167
178
|
}
|
|
168
|
-
if (/*#__PURE__*/react.isValidElement(icon)) {
|
|
169
|
-
return icon;
|
|
170
|
-
}
|
|
171
179
|
return null;
|
|
172
180
|
})(icon), menuOpen && item.label]
|
|
173
181
|
})]
|