revdev-components 0.77.0 → 0.78.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.
- package/build/index.js +27 -14
- package/build/navigator/index.d.ts +1 -1
- package/package.json +1 -1
package/build/index.js
CHANGED
|
@@ -5226,29 +5226,42 @@ var HeaderActionPanel = function (_a) {
|
|
|
5226
5226
|
|
|
5227
5227
|
var s$2 = {"root":"index-module_root__t3gxi"};
|
|
5228
5228
|
|
|
5229
|
+
function getNavOption(mapper, part) {
|
|
5230
|
+
var _a = Array.isArray(part) ? part : [part, undefined], key = _a[0], param = _a[1];
|
|
5231
|
+
if (mapper) {
|
|
5232
|
+
var o = mapper[key];
|
|
5233
|
+
if (o) {
|
|
5234
|
+
return typeof o === "function" ? o((param === null || param === void 0 ? void 0 : param.toString()) || "") : o;
|
|
5235
|
+
}
|
|
5236
|
+
}
|
|
5237
|
+
return undefined;
|
|
5238
|
+
}
|
|
5229
5239
|
var AlfaNavigator = function (_a) {
|
|
5230
|
-
var className = _a.className, stepClassName = _a.stepClassName,
|
|
5240
|
+
var className = _a.className, stepClassName = _a.stepClassName, root = _a.root, _b = _a.options, options = _b === void 0 ? [] : _b, isMobile = _a.isMobile, mapper = _a.mapper, path = _a.path;
|
|
5231
5241
|
var innerOptions = React.useMemo(function () {
|
|
5232
5242
|
var result = [];
|
|
5233
|
-
if (
|
|
5234
|
-
|
|
5235
|
-
|
|
5236
|
-
|
|
5237
|
-
var
|
|
5238
|
-
if (
|
|
5239
|
-
|
|
5243
|
+
if (root) {
|
|
5244
|
+
var rootPath = root;
|
|
5245
|
+
var rootOption = root;
|
|
5246
|
+
if (typeof rootPath || (Array.isArray(rootPath) && mapper)) {
|
|
5247
|
+
var navOption = getNavOption(mapper, rootPath);
|
|
5248
|
+
if (navOption) {
|
|
5249
|
+
result.push(navOption);
|
|
5240
5250
|
}
|
|
5241
|
-
|
|
5242
|
-
|
|
5243
|
-
.
|
|
5251
|
+
}
|
|
5252
|
+
else if (typeof rootOption === "object") {
|
|
5253
|
+
result.push(rootOption);
|
|
5254
|
+
}
|
|
5255
|
+
}
|
|
5256
|
+
if (mapper && Array.isArray(path)) {
|
|
5257
|
+
result.push.apply(result, path.map(function (p) { return getNavOption(mapper, p); }).filter(function (x) { return x; }));
|
|
5244
5258
|
}
|
|
5245
5259
|
else {
|
|
5246
|
-
result
|
|
5260
|
+
result.push.apply(result, options);
|
|
5247
5261
|
}
|
|
5248
|
-
result = rootOption ? __spreadArray([rootOption], result, true) : result;
|
|
5249
5262
|
result = isMobile ? result.slice(options.length - 1) : result;
|
|
5250
5263
|
return result;
|
|
5251
|
-
}, [
|
|
5264
|
+
}, [root, options, isMobile, mapper, path]);
|
|
5252
5265
|
return innerOptions.length ? (React.createElement("div", { className: classNames(s$2.root, className) }, innerOptions.map(function (_a, index) {
|
|
5253
5266
|
var href = _a.href, label = _a.label;
|
|
5254
5267
|
return (React.createElement(React.Fragment, { key: index },
|
|
@@ -7,7 +7,7 @@ export type AlfaNavigatorMapper = Record<string, AlfaNavigatorOption | ((param:
|
|
|
7
7
|
export type AlfaNavigatorPathPart<TKey extends string = string> = TKey | [TKey, string | number];
|
|
8
8
|
export type AlfaNavigatorPath<TKey extends string = string> = AlfaNavigatorPathPart<TKey>[];
|
|
9
9
|
interface Props {
|
|
10
|
-
|
|
10
|
+
root?: AlfaNavigatorOption | AlfaNavigatorPathPart;
|
|
11
11
|
options?: AlfaNavigatorOption[];
|
|
12
12
|
className?: string;
|
|
13
13
|
stepClassName?: string;
|