revdev-components 0.120.0 → 0.122.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/backLayout/index.d.ts +2 -3
- package/build/backSidebar/hooks.d.ts +1 -2
- package/build/backSidebar/index.d.ts +4 -2
- package/build/backSidebar/interfaces.d.ts +2 -8
- package/build/backSidebar/menuItem/index.d.ts +3 -1
- package/build/backSidebar/shortMenuItem/index.d.ts +3 -1
- package/build/backSidebar/subMenuItem/index.d.ts +3 -3
- package/build/index.js +25 -21
- package/build/interfaces/index.d.ts +1 -0
- package/build/interfaces/nav.d.ts +9 -0
- package/build/navigator/index.d.ts +1 -7
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { BackSidebarProps } from "src/backSidebar";
|
|
3
|
-
interface
|
|
3
|
+
export interface BackLayoutProps {
|
|
4
4
|
loading?: boolean;
|
|
5
5
|
contentLoading?: boolean;
|
|
6
6
|
header?: React.ReactNode;
|
|
@@ -14,5 +14,4 @@ interface Props {
|
|
|
14
14
|
loadingClassName?: string;
|
|
15
15
|
sidebarProps: Omit<BackSidebarProps, "shortMode">;
|
|
16
16
|
}
|
|
17
|
-
export declare const BackLayout: React.FC<
|
|
18
|
-
export {};
|
|
17
|
+
export declare const BackLayout: React.FC<BackLayoutProps>;
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export declare function useIsOptionActive(activePath: string, options: BackSidebarSubOption[]): boolean;
|
|
1
|
+
export declare function useIsOptionActive(activePath: string, keys: string[]): boolean;
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { BackSidebarOption } from "./interfaces";
|
|
3
|
+
import { AlfaNavigatorMapper } from "..";
|
|
3
4
|
export * from "./interfaces";
|
|
4
5
|
export interface BackSidebarProps {
|
|
5
6
|
className?: string;
|
|
6
7
|
options: BackSidebarOption[];
|
|
8
|
+
mapper: AlfaNavigatorMapper;
|
|
7
9
|
top?: React.ReactNode;
|
|
8
10
|
shortMode?: boolean;
|
|
9
|
-
|
|
10
|
-
|
|
11
|
+
activePathKey?: string;
|
|
12
|
+
defaultPathKey?: string;
|
|
11
13
|
}
|
|
12
14
|
export declare const BackSidebar: React.FC<BackSidebarProps>;
|
|
@@ -1,12 +1,6 @@
|
|
|
1
|
-
import { PagePath } from "page-path";
|
|
2
1
|
import { RegularIconName } from "src/icon";
|
|
3
|
-
export interface
|
|
2
|
+
export interface BackSidebarOption<TKey extends string = string> {
|
|
4
3
|
label: string;
|
|
5
4
|
icon?: RegularIconName;
|
|
6
|
-
|
|
7
|
-
}
|
|
8
|
-
export interface BackSidebarOption {
|
|
9
|
-
label: string;
|
|
10
|
-
icon?: RegularIconName;
|
|
11
|
-
options?: BackSidebarSubOption[];
|
|
5
|
+
keys?: TKey[];
|
|
12
6
|
}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { BackSidebarOption } from "../interfaces";
|
|
3
|
+
import { AlfaNavigatorMapper } from "src/interfaces";
|
|
3
4
|
interface Props {
|
|
4
5
|
option: BackSidebarOption;
|
|
5
|
-
|
|
6
|
+
activePathKey?: string;
|
|
7
|
+
mapper: AlfaNavigatorMapper;
|
|
6
8
|
}
|
|
7
9
|
export declare const BackSidebarMenuItem: React.FC<Props>;
|
|
8
10
|
export {};
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { BackSidebarOption } from "../interfaces";
|
|
3
|
+
import { AlfaNavigatorMapper } from "src/index";
|
|
3
4
|
interface Props {
|
|
4
5
|
option: BackSidebarOption;
|
|
5
|
-
|
|
6
|
+
activePathKey?: string;
|
|
7
|
+
mapper: AlfaNavigatorMapper;
|
|
6
8
|
}
|
|
7
9
|
export declare const BackSidebarShortMenuItem: React.FC<Props>;
|
|
8
10
|
export {};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import {
|
|
2
|
+
import { AlfaNavigatorOption } from "src/interfaces";
|
|
3
3
|
interface Props {
|
|
4
|
-
option:
|
|
5
|
-
|
|
4
|
+
option: AlfaNavigatorOption;
|
|
5
|
+
isActive: boolean;
|
|
6
6
|
}
|
|
7
7
|
export declare const BackSidebarSubMenuItem: React.FC<Props>;
|
|
8
8
|
export {};
|
package/build/index.js
CHANGED
|
@@ -5088,28 +5088,27 @@ var s$f = {"root":"index-module_root__AZ9HE","root__active":"index-module_root__
|
|
|
5088
5088
|
|
|
5089
5089
|
var BackSidebarSubMenuItem = function (_a) {
|
|
5090
5090
|
var _b;
|
|
5091
|
-
var
|
|
5091
|
+
var isActive = _a.isActive, option = _a.option;
|
|
5092
5092
|
var icon = option.icon, label = option.label, path = option.path;
|
|
5093
|
-
|
|
5094
|
-
return (React.createElement(AppLink, { className: classNames(s$f.root, (_b = {}, _b[s$f.root__active] = isActive, _b)), href: path.build() },
|
|
5093
|
+
return (React.createElement(AppLink, { className: classNames(s$f.root, (_b = {}, _b[s$f.root__active] = isActive, _b)), href: path },
|
|
5095
5094
|
icon && React.createElement(RegularIcon, { name: icon }),
|
|
5096
5095
|
React.createElement("span", null, label)));
|
|
5097
5096
|
};
|
|
5098
5097
|
|
|
5099
|
-
function useIsOptionActive(activePath,
|
|
5098
|
+
function useIsOptionActive(activePath, keys) {
|
|
5100
5099
|
if (activePath === void 0) { activePath = ""; }
|
|
5101
5100
|
return React.useMemo(function () {
|
|
5102
|
-
return !!
|
|
5103
|
-
return x
|
|
5101
|
+
return !!keys.find(function (x) {
|
|
5102
|
+
return x === activePath;
|
|
5104
5103
|
});
|
|
5105
|
-
}, [activePath,
|
|
5104
|
+
}, [activePath, keys]);
|
|
5106
5105
|
}
|
|
5107
5106
|
|
|
5108
5107
|
var BackSidebarMenuItem = function (_a) {
|
|
5109
5108
|
var _b, _c;
|
|
5110
|
-
var option = _a.option,
|
|
5111
|
-
var icon = option.icon, label = option.label, _d = option.
|
|
5112
|
-
var isActive = useIsOptionActive(
|
|
5109
|
+
var option = _a.option, activePathKey = _a.activePathKey, mapper = _a.mapper;
|
|
5110
|
+
var icon = option.icon, label = option.label, _d = option.keys, keys = _d === void 0 ? [] : _d;
|
|
5111
|
+
var isActive = useIsOptionActive(activePathKey, keys);
|
|
5113
5112
|
var _e = React.useState(isActive), open = _e[0], setOpen = _e[1];
|
|
5114
5113
|
React.useEffect(function () {
|
|
5115
5114
|
if (isActive) {
|
|
@@ -5124,8 +5123,11 @@ var BackSidebarMenuItem = function (_a) {
|
|
|
5124
5123
|
icon && React.createElement(RegularIcon, { name: icon }),
|
|
5125
5124
|
React.createElement("span", { className: s$g.title__label }, label),
|
|
5126
5125
|
React.createElement(RegularIcon, { name: open ? "keyboard-arrow-down" : "keyboard-arrow-right" })),
|
|
5127
|
-
React.createElement("div", { className: classNames(s$g.list, (_c = {}, _c[s$g.list__open] = open, _c)) },
|
|
5128
|
-
|
|
5126
|
+
React.createElement("div", { className: classNames(s$g.list, (_c = {}, _c[s$g.list__open] = open, _c)) }, keys.map(function (x) {
|
|
5127
|
+
var option = mapper[x];
|
|
5128
|
+
if (typeof option === "object") {
|
|
5129
|
+
return React.createElement(BackSidebarSubMenuItem, { key: x, option: option, isActive: x === activePathKey });
|
|
5130
|
+
}
|
|
5129
5131
|
}))));
|
|
5130
5132
|
};
|
|
5131
5133
|
|
|
@@ -5133,9 +5135,9 @@ var s$e = {"root":"index-module_root__yMCtx","list":"index-module_list__Xr6Z5","
|
|
|
5133
5135
|
|
|
5134
5136
|
var BackSidebarShortMenuItem = function (_a) {
|
|
5135
5137
|
var _b;
|
|
5136
|
-
var option = _a.option,
|
|
5137
|
-
var icon = option.icon, _c = option.
|
|
5138
|
-
var isActive = useIsOptionActive(
|
|
5138
|
+
var option = _a.option, activePathKey = _a.activePathKey, mapper = _a.mapper;
|
|
5139
|
+
var icon = option.icon, _c = option.keys, keys = _c === void 0 ? [] : _c;
|
|
5140
|
+
var isActive = useIsOptionActive(activePathKey, keys);
|
|
5139
5141
|
var _d = React.useState(isActive), open = _d[0], setOpen = _d[1];
|
|
5140
5142
|
React.useEffect(function () {
|
|
5141
5143
|
if (isActive) {
|
|
@@ -5147,8 +5149,11 @@ var BackSidebarShortMenuItem = function (_a) {
|
|
|
5147
5149
|
}, [open]);
|
|
5148
5150
|
return (React.createElement("div", { className: s$e.root },
|
|
5149
5151
|
React.createElement("div", { className: classNames(s$e.master, (_b = {}, _b[s$e.master__active] = isActive, _b)), onClick: handleClick }, icon && React.createElement(RegularIcon, { name: icon })),
|
|
5150
|
-
React.createElement("div", { className: classNames(s$e.list) },
|
|
5151
|
-
|
|
5152
|
+
React.createElement("div", { className: classNames(s$e.list) }, keys.map(function (x) {
|
|
5153
|
+
var option = mapper[x];
|
|
5154
|
+
if (typeof option === "object") {
|
|
5155
|
+
return React.createElement(BackSidebarSubMenuItem, { key: x, option: option, isActive: x === activePathKey });
|
|
5156
|
+
}
|
|
5152
5157
|
}))));
|
|
5153
5158
|
};
|
|
5154
5159
|
|
|
@@ -5156,12 +5161,11 @@ var s$d = {"root":"index-module_root__r4Egx"};
|
|
|
5156
5161
|
|
|
5157
5162
|
// https://www.einfosoft.com/templates/admin/spice/source/edit_booking.html#
|
|
5158
5163
|
var BackSidebar = function (_a) {
|
|
5159
|
-
var className = _a.className, options = _a.options, top = _a.top, shortMode = _a.shortMode,
|
|
5160
|
-
var path = (activePath || "").replace("/", "") ? activePath : defaultPath;
|
|
5164
|
+
var className = _a.className, options = _a.options, mapper = _a.mapper, top = _a.top, shortMode = _a.shortMode, activePathKey = _a.activePathKey, defaultPathKey = _a.defaultPathKey;
|
|
5161
5165
|
return (React.createElement("div", { className: classNames(s$d.root, className) },
|
|
5162
5166
|
top ? React.createElement("div", { className: classNames(s$d.top) }, top) : null,
|
|
5163
5167
|
React.createElement("div", { className: s$d.menu }, options.map(function (option, i) {
|
|
5164
|
-
return shortMode ? (React.createElement(BackSidebarShortMenuItem, { key: i, option: option,
|
|
5168
|
+
return shortMode ? (React.createElement(BackSidebarShortMenuItem, { key: i, mapper: mapper, option: option, activePathKey: activePathKey || defaultPathKey })) : (React.createElement(BackSidebarMenuItem, { key: i, mapper: mapper, option: option, activePathKey: activePathKey || defaultPathKey }));
|
|
5165
5169
|
}))));
|
|
5166
5170
|
};
|
|
5167
5171
|
|
|
@@ -5432,7 +5436,7 @@ var AlfaNavigator = function (_a) {
|
|
|
5432
5436
|
return result;
|
|
5433
5437
|
}, [root, options, isMobile, mapper, path]);
|
|
5434
5438
|
return innerOptions.length ? (React.createElement("div", { className: classNames(s$3.root, className) }, innerOptions.map(function (_a, index) {
|
|
5435
|
-
var href = _a.
|
|
5439
|
+
var href = _a.path, label = _a.label;
|
|
5436
5440
|
return (React.createElement(React.Fragment, { key: index },
|
|
5437
5441
|
index > 0 ? React.createElement("span", null, "\u203A") : null,
|
|
5438
5442
|
React.createElement(AppLink, { className: classNames(s$3.step, stepClassName), href: href }, label)));
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { RegularIconName } from "src/icon";
|
|
2
|
+
export interface AlfaNavigatorOption {
|
|
3
|
+
path: string;
|
|
4
|
+
label: string;
|
|
5
|
+
icon?: RegularIconName;
|
|
6
|
+
}
|
|
7
|
+
export type AlfaNavigatorMapper = Record<string, AlfaNavigatorOption | ((param: any) => AlfaNavigatorOption)>;
|
|
8
|
+
export type AlfaNavigatorPathPart<TKey extends string = string> = TKey | [TKey, any];
|
|
9
|
+
export type AlfaNavigatorPath<TKey extends string = string> = AlfaNavigatorPathPart<TKey>[];
|
|
@@ -1,11 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
|
|
3
|
-
href: string;
|
|
4
|
-
label: string;
|
|
5
|
-
}
|
|
6
|
-
export type AlfaNavigatorMapper = Record<string, AlfaNavigatorOption | ((param: any) => AlfaNavigatorOption)>;
|
|
7
|
-
export type AlfaNavigatorPathPart<TKey extends string = string> = TKey | [TKey, any];
|
|
8
|
-
export type AlfaNavigatorPath<TKey extends string = string> = AlfaNavigatorPathPart<TKey>[];
|
|
2
|
+
import { AlfaNavigatorMapper, AlfaNavigatorOption, AlfaNavigatorPath, AlfaNavigatorPathPart } from "src/interfaces";
|
|
9
3
|
export interface AlfaNavigatorChangeEvent {
|
|
10
4
|
path?: string[];
|
|
11
5
|
}
|