triafly-ui-kit 1.0.12 → 1.0.14
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/assets/Tabs.css +1 -0
- package/dist/components/Ui/Tabs/Tabs.js +24 -0
- package/dist/components/Ui/Tabs/Tabs.stories.js +67 -0
- package/dist/components/Ui/Tabs/index.js +4 -0
- package/dist/main.d.ts +15 -24
- package/dist/main.js +2 -2
- package/package.json +1 -1
- package/dist/TreeList-Z1F3eQH6.js +0 -113
- package/dist/assets/Tree.css +0 -1
- package/dist/assets/TreeList.css +0 -1
- package/dist/components/Ui/Tree/Tree.stories.js +0 -241
- package/dist/components/Ui/Tree/TreeEl/Tree.js +0 -76
- package/dist/components/Ui/Tree/TreeEl/index.js +0 -4
- package/dist/components/Ui/Tree/TreeEl/tree-types.js +0 -1
- package/dist/components/Ui/Tree/TreeItem/TreeItem.js +0 -9
- package/dist/components/Ui/Tree/TreeItem/treeItem-types.js +0 -1
- package/dist/components/Ui/Tree/TreeList/TreeList.js +0 -5
- package/dist/components/Ui/Tree/TreeList/treeList-types.js +0 -1
- package/dist/components/Ui/Tree/index.js +0 -4
- package/dist/components/Ui/Tree/types-tree.js +0 -1
@@ -0,0 +1 @@
|
|
1
|
+
.tabs .tabs-bar{display:flex}.tabs .tab-button{height:44px;padding:0 12px;display:flex;justify-content:center;align-items:center;border:1px solid var(--color-border-primary-default);background-color:var(--color-bg-neutral-basic-default);cursor:pointer}.tabs .tab-button:not(:last-of-type){border-right:0 solid}.tabs .tab-button:first-of-type{border-radius:8px 0 0 8px}.tabs .tab-button:last-of-type{border-radius:0 8px 8px 0}.tabs .tab-button:hover{background:#ddd}.tabs .tab-button.active{background:var(--color-bg-neutral-light-default);font-weight:600}.tabs .tab-button.disabled{pointer-events:none}
|
@@ -0,0 +1,24 @@
|
|
1
|
+
import { jsxs as o, jsx as e } from "react/jsx-runtime";
|
2
|
+
import { useState as v } from "react";
|
3
|
+
import '../../../assets/Tabs.css';const f = ({ items: s, defaultActiveKey: t, onChange: d }) => {
|
4
|
+
var c, b;
|
5
|
+
const [l, i] = v(t || ((c = s[0]) == null ? void 0 : c.key)), n = (a) => {
|
6
|
+
s.some((r) => r.key === a && !r.disabled) && (i(a), d == null || d(a));
|
7
|
+
};
|
8
|
+
return /* @__PURE__ */ o("div", { className: "tabs", children: [
|
9
|
+
/* @__PURE__ */ e("div", { className: "tabs-bar", children: s.map((a) => /* @__PURE__ */ e(
|
10
|
+
"button",
|
11
|
+
{
|
12
|
+
onClick: () => !a.disabled && n(a.key),
|
13
|
+
className: `tab-button ${l === a.key ? "active" : ""} ${a.disabled ? "disabled" : ""}`,
|
14
|
+
disabled: a.disabled,
|
15
|
+
children: a.label
|
16
|
+
},
|
17
|
+
a.key
|
18
|
+
)) }),
|
19
|
+
/* @__PURE__ */ e("div", { className: "tabs-content", children: (b = s.find((a) => a.key === l)) == null ? void 0 : b.children })
|
20
|
+
] });
|
21
|
+
};
|
22
|
+
export {
|
23
|
+
f as Tabs
|
24
|
+
};
|
@@ -0,0 +1,67 @@
|
|
1
|
+
import { jsx as e } from "react/jsx-runtime";
|
2
|
+
import { Tabs as t } from "./Tabs.js";
|
3
|
+
const n = {
|
4
|
+
title: "UIKit/Tabs",
|
5
|
+
component: t,
|
6
|
+
tags: ["autodocs"],
|
7
|
+
argTypes: {
|
8
|
+
items: {
|
9
|
+
control: "object",
|
10
|
+
description: "Массив объектов вкладок {label: string, content: ReactNode}"
|
11
|
+
}
|
12
|
+
}
|
13
|
+
}, s = {
|
14
|
+
args: {
|
15
|
+
items: [
|
16
|
+
{
|
17
|
+
key: "profile",
|
18
|
+
label: "Профиль",
|
19
|
+
children: /* @__PURE__ */ e("div", { children: "Информация о пользователе" })
|
20
|
+
},
|
21
|
+
{
|
22
|
+
key: "settings",
|
23
|
+
label: "Настройки",
|
24
|
+
children: /* @__PURE__ */ e("div", { children: "Параметры аккаунта" })
|
25
|
+
},
|
26
|
+
{
|
27
|
+
key: "notifications",
|
28
|
+
label: "Уведомления",
|
29
|
+
children: /* @__PURE__ */ e("div", { children: "Настройки уведомлений" })
|
30
|
+
}
|
31
|
+
]
|
32
|
+
}
|
33
|
+
}, a = {
|
34
|
+
args: {
|
35
|
+
items: [
|
36
|
+
{
|
37
|
+
key: "favorites",
|
38
|
+
label: "Избранное",
|
39
|
+
children: /* @__PURE__ */ e("div", { children: "Ваши избранные элементы" })
|
40
|
+
},
|
41
|
+
{
|
42
|
+
key: "projects",
|
43
|
+
label: "Проекты",
|
44
|
+
children: /* @__PURE__ */ e("div", { children: "Список ваших проектов" })
|
45
|
+
}
|
46
|
+
]
|
47
|
+
},
|
48
|
+
decorators: [
|
49
|
+
(i) => /* @__PURE__ */ e("div", { style: { maxWidth: "500px", margin: "0 auto" }, children: /* @__PURE__ */ e(i, {}) })
|
50
|
+
]
|
51
|
+
}, c = {
|
52
|
+
args: {
|
53
|
+
items: [
|
54
|
+
{
|
55
|
+
key: "single",
|
56
|
+
label: "Единственная вкладка",
|
57
|
+
children: /* @__PURE__ */ e("div", { children: "Контент единственной вкладки" })
|
58
|
+
}
|
59
|
+
]
|
60
|
+
}
|
61
|
+
};
|
62
|
+
export {
|
63
|
+
s as Basic,
|
64
|
+
c as SingleTab,
|
65
|
+
a as StyledTabs,
|
66
|
+
n as default
|
67
|
+
};
|
package/dist/main.d.ts
CHANGED
@@ -1047,6 +1047,13 @@ declare type SwitchProps = {
|
|
1047
1047
|
name?: string;
|
1048
1048
|
};
|
1049
1049
|
|
1050
|
+
export declare interface TabItem {
|
1051
|
+
key: string;
|
1052
|
+
label: string;
|
1053
|
+
children: ReactNode;
|
1054
|
+
disabled?: boolean;
|
1055
|
+
}
|
1056
|
+
|
1050
1057
|
export declare const Table: <T extends object>(props: TablesProps<T>) => JSX.Element;
|
1051
1058
|
|
1052
1059
|
declare type TablesProps<T extends object = Record<string, unknown>> = {
|
@@ -1073,6 +1080,14 @@ declare type TablesProps<T extends object = Record<string, unknown>> = {
|
|
1073
1080
|
loading?: boolean;
|
1074
1081
|
};
|
1075
1082
|
|
1083
|
+
export declare const Tabs: React.FC<TabsProps>;
|
1084
|
+
|
1085
|
+
export declare interface TabsProps {
|
1086
|
+
items: TabItem[];
|
1087
|
+
defaultActiveKey?: string;
|
1088
|
+
onChange?: (activeKey: string) => void;
|
1089
|
+
}
|
1090
|
+
|
1076
1091
|
export declare const TextareaInput: ForwardRefExoticComponent<TextareaInputProps & RefAttributes<HTMLTextAreaElement>>;
|
1077
1092
|
|
1078
1093
|
declare type TextareaInputProps = {
|
@@ -1131,30 +1146,6 @@ declare interface TooltipProps {
|
|
1131
1146
|
className?: string;
|
1132
1147
|
}
|
1133
1148
|
|
1134
|
-
export declare const Tree: <T extends TreeNodeBase>({ data, childrenKey, idKey, nameKey, typeKey, onSelect, defaultExpandedKeys, autoExpandParent, expandedKeys: externalExpandedKeys, onExpandedKeysChange, selectedKey: controlledSelectedKey, isFetching, isAllExpanded, wrapperTreeClassName, TreeItemClassName, TreeItemContentClassName, }: TreeProps<T>) => JSX.Element;
|
1135
|
-
|
1136
|
-
declare type TreeNodeBase = Record<string, unknown>;
|
1137
|
-
|
1138
|
-
declare type TreeProps<T extends TreeNodeBase> = {
|
1139
|
-
data: T[];
|
1140
|
-
childrenKey?: keyof T | string;
|
1141
|
-
idKey?: keyof T | string;
|
1142
|
-
nameKey?: keyof T | string;
|
1143
|
-
typeKey?: keyof T | string;
|
1144
|
-
onSelect?: (node: T) => void;
|
1145
|
-
defaultExpandedKeys?: (string | number)[];
|
1146
|
-
expandedKeys?: (string | number)[];
|
1147
|
-
onExpandedKeysChange?: (keys: (string | number)[]) => void;
|
1148
|
-
autoExpandParent?: boolean;
|
1149
|
-
selectedKey?: string | number | null;
|
1150
|
-
setSectedKey?: (value: string | number | null) => void;
|
1151
|
-
isFetching?: boolean;
|
1152
|
-
isAllExpanded?: boolean;
|
1153
|
-
wrapperTreeClassName?: string;
|
1154
|
-
TreeItemClassName?: string;
|
1155
|
-
TreeItemContentClassName?: string;
|
1156
|
-
};
|
1157
|
-
|
1158
1149
|
export declare const TriaflyContext: Context<TriaflyContextType | undefined>;
|
1159
1150
|
|
1160
1151
|
declare interface TriaflyContextType {
|
package/dist/main.js
CHANGED
@@ -22,7 +22,7 @@ import { Table as E } from "./components/Ui/Table/Table.js";
|
|
22
22
|
import { TextInput as V } from "./components/Ui/TextInput/TextInput.js";
|
23
23
|
import { TextareaInput as z } from "./components/Ui/TextareaInput/TextareaInput.js";
|
24
24
|
import { Tooltip as Y } from "./components/Ui/Tooltip/Tooltip.js";
|
25
|
-
import {
|
25
|
+
import { Tabs as q } from "./components/Ui/Tabs/Tabs.js";
|
26
26
|
import { IconArrowBendUpRight as Z, IconArrowClockwise as _, IconArrowDown as $, IconArrowLeft as oo, IconArrowLineDown as no, IconArrowLineLeft as ro, IconArrowLineRight as eo, IconArrowLineUp as co, IconArrowRight as Io, IconArrowUp as to, IconArrowsOut as io, IconArticle as ao, IconAt as po, IconBellSimple as lo, IconBookOpenText as fo, IconCalendarBlank as mo, IconCaretDown as xo, IconCaretLeft as so, IconCaretRight as uo, IconCaretUp as Co, IconCaretUpDown as ho, IconChartPieSlice as wo, IconChatText as So, IconCheck as To, IconCheckCircle as go, IconChecks as Ao, IconCircleNotch as Lo, IconCopy as ko, IconCornersOut as Do, IconCsv as Po, IconCube as Uo, IconDatabase as yo, IconDotsNine as Fo, IconDotsThreeVertical as Bo, IconExport as vo, IconEye as Mo, IconEyeSlash as Ro, IconFile as Xo, IconFiles as bo, IconFloppyDisk as Ho, IconFolderSimple as No, IconFolderSimpleX as Oo, IconFunnel as Qo, IconGauge as Eo, IconGear as Go, IconGoogleDrive as Vo, IconHand as Wo, IconHeadCircuit as zo, IconHouse as Jo, IconIcon as Yo, IconInfo as jo, IconJoin as qo, IconLanguage as Ko, IconLink as Zo, IconList as _o, IconLock as $o, IconLockOpen as on, IconMariaDB as nn, IconMinus as rn, IconMongoDB as en, IconMoon as cn, IconMySQL as In, IconNavigationArrow as tn, IconNotePencil as an, IconPassword as pn, IconPen as ln, IconPlay as fn, IconPlugsX as mn, IconPlus as xn, IconPorsgteSQL as sn, IconPresentationChart as un, IconQuestion as Cn, IconQuestionFullfilled as dn, IconRedo as hn, IconRoleX as wn, IconSearch as Sn, IconSearchX as Tn, IconSelection as gn, IconServer as An, IconSlidersHorizontal as Ln, IconSticker as kn, IconSun as Dn, IconThreeDot as Pn, IconTrash as Un, IconTriangleDown as yn, IconTriangleUp as Fn, IconUndo as Bn, IconUploadSimple as vn, IconUser as Mn, IconUserX as Rn, IconWarningCircle as Xn, IconWrench as bn, IconX as Hn, IconYandexDisk as Nn } from "./components/Ui/Icons/Icons.js";
|
27
27
|
import { ToastProvider as Qn } from "./context/ToastContext/ToastContext.js";
|
28
28
|
import { TriaflyContext as Gn, TriaflyProvider as Vn, useTriafly as Wn } from "./context/TriaflyContext/TriaflyProvider.js";
|
@@ -143,11 +143,11 @@ export {
|
|
143
143
|
H as Skeleton,
|
144
144
|
O as Switch,
|
145
145
|
E as Table,
|
146
|
+
q as Tabs,
|
146
147
|
V as TextInput,
|
147
148
|
z as TextareaInput,
|
148
149
|
Qn as ToastProvider,
|
149
150
|
Y as Tooltip,
|
150
|
-
q as Tree,
|
151
151
|
Gn as TriaflyContext,
|
152
152
|
Vn as TriaflyProvider,
|
153
153
|
Jn as useBreakpointValueTriafly,
|
package/package.json
CHANGED
@@ -1,113 +0,0 @@
|
|
1
|
-
import { jsxs as b, jsx as e, Fragment as $ } from "react/jsx-runtime";
|
2
|
-
import { memo as w, useCallback as u } from "react";
|
3
|
-
import { IconCaretDown as D, IconCaretRight as O, IconFolderSimple as R, IconFile as q } from "./components/Ui/Icons/Icons.js";
|
4
|
-
import { Loader as z } from "./components/Ui/Loader/Loader.js";
|
5
|
-
import { c as v } from "./index-2QXL0WYc.js";
|
6
|
-
import './assets/TreeList.css';const A = "_selected_1oo5t_114", r = {
|
7
|
-
"tree-item": "_tree-item_1oo5t_76",
|
8
|
-
"tree-item-toggle": "_tree-item-toggle_1oo5t_83",
|
9
|
-
"tree-item-toggle-placeholder": "_tree-item-toggle-placeholder_1oo5t_86",
|
10
|
-
"tree-item-loader": "_tree-item-loader_1oo5t_89",
|
11
|
-
"tree-item-toggle-icon-folder": "_tree-item-toggle-icon-folder_1oo5t_97",
|
12
|
-
"tree-item-content": "_tree-item-content_1oo5t_103",
|
13
|
-
selected: A,
|
14
|
-
"tree-item-lebal": "_tree-item-lebal_1oo5t_118"
|
15
|
-
}, B = ({
|
16
|
-
node: o,
|
17
|
-
onSelect: l,
|
18
|
-
level: h = 0,
|
19
|
-
childrenKey: m = "children",
|
20
|
-
idKey: c = "id",
|
21
|
-
nameKey: g = "name",
|
22
|
-
typeKey: s = "type",
|
23
|
-
expandedKeys: d = [],
|
24
|
-
onExpand: i,
|
25
|
-
selectedKey: a,
|
26
|
-
isFetching: _ = !1,
|
27
|
-
TreeItemClassName: p = "",
|
28
|
-
TreeItemContentClassName: f = ""
|
29
|
-
}) => {
|
30
|
-
var T;
|
31
|
-
const n = o[c], k = o[g], L = o[s], N = d.includes(n), I = ((T = o[m]) == null ? void 0 : T.filter((t) => t[s] === "directory").length) > 0, j = a === n, C = a === n && _, F = u(
|
32
|
-
(t) => {
|
33
|
-
t.stopPropagation(), i == null || i(n);
|
34
|
-
},
|
35
|
-
[n, i]
|
36
|
-
), P = u(
|
37
|
-
(t) => {
|
38
|
-
t.stopPropagation(), l == null || l(o);
|
39
|
-
},
|
40
|
-
[o, l]
|
41
|
-
);
|
42
|
-
return /* @__PURE__ */ b("div", { className: v(r["tree-item"], p), children: [
|
43
|
-
/* @__PURE__ */ b(
|
44
|
-
"div",
|
45
|
-
{
|
46
|
-
className: v(
|
47
|
-
r["tree-item-content"],
|
48
|
-
j ? r.selected : "",
|
49
|
-
f
|
50
|
-
),
|
51
|
-
onClick: P,
|
52
|
-
children: [
|
53
|
-
C && /* @__PURE__ */ e("div", { className: r["tree-item-loader"], children: /* @__PURE__ */ e(z, {}) }),
|
54
|
-
I && !C ? /* @__PURE__ */ e("span", { onClick: F, className: r["tree-item-toggle"], children: N ? /* @__PURE__ */ e(D, {}) : /* @__PURE__ */ e(O, {}) }) : /* @__PURE__ */ e("span", { className: r["tree-item-toggle-placeholder"] }),
|
55
|
-
/* @__PURE__ */ e("span", { className: r["tree-item-toggle-icon-folder"], children: L === "directory" ? /* @__PURE__ */ e(R, { color: "gray" }) : /* @__PURE__ */ e(q, {}) }),
|
56
|
-
/* @__PURE__ */ e("span", { className: `${r["tree-item-lebal"]}`, children: k })
|
57
|
-
]
|
58
|
-
}
|
59
|
-
),
|
60
|
-
N && I && /* @__PURE__ */ e($, { children: o[m].filter((t) => t[s] === "directory").map((t) => /* @__PURE__ */ e(
|
61
|
-
H,
|
62
|
-
{
|
63
|
-
node: t,
|
64
|
-
isFetching: _,
|
65
|
-
level: h + 1,
|
66
|
-
onSelect: l,
|
67
|
-
selectedKey: a,
|
68
|
-
childrenKey: m,
|
69
|
-
idKey: c,
|
70
|
-
nameKey: g,
|
71
|
-
typeKey: s,
|
72
|
-
expandedKeys: d,
|
73
|
-
onExpand: i
|
74
|
-
},
|
75
|
-
t[c]
|
76
|
-
)) })
|
77
|
-
] });
|
78
|
-
}, G = w(B), H = ({
|
79
|
-
node: o,
|
80
|
-
onSelect: l,
|
81
|
-
childrenKey: h = "children",
|
82
|
-
expandedKeys: m = [],
|
83
|
-
onExpand: c,
|
84
|
-
level: g = 0,
|
85
|
-
selectedKey: s,
|
86
|
-
idKey: d = "id",
|
87
|
-
nameKey: i = "name",
|
88
|
-
typeKey: a = "type",
|
89
|
-
isFetching: _,
|
90
|
-
TreeItemClassName: p = "",
|
91
|
-
TreeItemContentClassName: f = ""
|
92
|
-
}) => /* @__PURE__ */ e(
|
93
|
-
G,
|
94
|
-
{
|
95
|
-
node: o,
|
96
|
-
isFetching: _,
|
97
|
-
level: g,
|
98
|
-
onSelect: l,
|
99
|
-
selectedKey: s,
|
100
|
-
childrenKey: h,
|
101
|
-
expandedKeys: m,
|
102
|
-
onExpand: c,
|
103
|
-
idKey: d,
|
104
|
-
nameKey: i,
|
105
|
-
typeKey: a,
|
106
|
-
TreeItemClassName: p,
|
107
|
-
TreeItemContentClassName: f
|
108
|
-
}
|
109
|
-
);
|
110
|
-
export {
|
111
|
-
H as T,
|
112
|
-
G as a
|
113
|
-
};
|
package/dist/assets/Tree.css
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
._tree-wrapper_1yvw0_1{max-height:100%;width:100%;overflow-y:auto}
|
package/dist/assets/TreeList.css
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
@font-face{font-family:Roboto Slab;src:url(../assets/fonts/RobotoSlab-SemiBold.ttf) format("truetype");font-weight:600}@font-face{font-family:Manrope;src:url(../assets/fonts/Manrope-Regular.ttf) format("truetype");font-weight:400}@font-face{font-family:Manrope;src:url(../assets/fonts/Manrope-Semibold.ttf) format("truetype");font-weight:600}@font-face{font-family:Manrope;src:url(../assets/fonts/Manrope-Bold.ttf) format("truetype");font-weight:700}@font-face{font-family:Fira Code;src:url(../assets/fonts/FiraCode-Regular.ttf) format("truetype");font-weight:400}*{font-family:Manrope,sans-serif;font-size:14px;line-height:1.2em;letter-spacing:.02em;font-weight:400;color:var(--color-text-primary-default)}h1,h2,h3,h4,h5,h6{margin:0}a{color:var(--color-text-brand-default);text-decoration:none}a:hover{color:var(--color-text-brand-hover)}a[href=""]{opacity:40%;cursor:default;pointer-events:none}p:not(:last-child){margin:0 0 8px}._tree-item_1oo5t_76{padding:4px;border-radius:4px;cursor:pointer;margin-left:10px;width:100%}._tree-item_1oo5t_76 ._tree-item-toggle_1oo5t_83{cursor:pointer}._tree-item_1oo5t_76 ._tree-item-toggle-placeholder_1oo5t_86{background-color:red}._tree-item_1oo5t_76 ._tree-item-loader_1oo5t_89{width:20px;height:20px;display:flex;align-items:center;justify-content:flex-end;position:relative}._tree-item_1oo5t_76 ._tree-item-toggle-icon-folder_1oo5t_97{color:var(--color-icon-secondary-default)}._tree-item_1oo5t_76 ._test_1oo5t_100{fill:var(--color-icon-secondary-default)}._tree-item_1oo5t_76 ._tree-item-content_1oo5t_103{display:flex;gap:8px;align-items:center;cursor:pointer;padding:9.5px 16px}._tree-item_1oo5t_76 ._tree-item-content_1oo5t_103 span{font-size:14px;font-weight:400}._tree-item_1oo5t_76 ._tree-item-content_1oo5t_103._selected_1oo5t_114{background-color:var(--color-bg-island-selected);border-radius:4px}._tree-item_1oo5t_76 ._tree-item-lebal_1oo5t_118{word-wrap:break-word;overflow-wrap:break-word;white-space:normal;-webkit-hyphens:auto;hyphens:auto;max-width:100px}
|
@@ -1,241 +0,0 @@
|
|
1
|
-
import { jsx as t } from "react/jsx-runtime";
|
2
|
-
import { Tree as i } from "./TreeEl/Tree.js";
|
3
|
-
const m = {
|
4
|
-
title: "Components/Tree",
|
5
|
-
component: i,
|
6
|
-
parameters: {
|
7
|
-
layout: "centered"
|
8
|
-
},
|
9
|
-
argTypes: {
|
10
|
-
data: { control: "object" },
|
11
|
-
onSelect: { action: "selected" },
|
12
|
-
defaultExpandedKeys: { control: "object" },
|
13
|
-
selectedKey: { control: "text" },
|
14
|
-
autoExpandParent: { control: "boolean" },
|
15
|
-
idKey: { control: "text" },
|
16
|
-
nameKey: { control: "text" },
|
17
|
-
typeKey: { control: "text" },
|
18
|
-
childrenKey: { control: "text" }
|
19
|
-
}
|
20
|
-
}, o = (d) => /* @__PURE__ */ t(i, { ...d }), a = o.bind({});
|
21
|
-
a.args = {
|
22
|
-
data: [
|
23
|
-
{
|
24
|
-
id: "1",
|
25
|
-
name: "Работа",
|
26
|
-
type: "folder",
|
27
|
-
modifiedAt: "05-02-2025 12:00",
|
28
|
-
size: "-",
|
29
|
-
branches: [
|
30
|
-
{
|
31
|
-
id: "1-1",
|
32
|
-
name: "Документы",
|
33
|
-
type: "folder",
|
34
|
-
modifiedAt: "05-02-2025 12:10",
|
35
|
-
size: "-",
|
36
|
-
branches: [
|
37
|
-
...Array.from({ length: 50 }, (d, e) => ({
|
38
|
-
id: `1-1-${e}`,
|
39
|
-
name: `Файл ${e + 1}.docx`,
|
40
|
-
type: "file",
|
41
|
-
modifiedAt: "05-02-2025 13:00",
|
42
|
-
size: `${(Math.random() * 2 + 0.5).toFixed(2)} MB`,
|
43
|
-
fileType: "docx"
|
44
|
-
})),
|
45
|
-
{
|
46
|
-
id: "1-1-51",
|
47
|
-
name: "Проекты",
|
48
|
-
type: "folder",
|
49
|
-
modifiedAt: "05-02-2025 13:10",
|
50
|
-
size: "-",
|
51
|
-
branches: Array.from({ length: 20 }, (d, e) => ({
|
52
|
-
id: `1-1-51-${e}`,
|
53
|
-
name: `Проект_${e + 1}.pptx`,
|
54
|
-
type: "file",
|
55
|
-
modifiedAt: "05-02-2025 14:00",
|
56
|
-
size: `${(Math.random() * 5 + 1).toFixed(2)} MB`,
|
57
|
-
fileType: "pptx"
|
58
|
-
}))
|
59
|
-
},
|
60
|
-
{
|
61
|
-
id: "1-1-52",
|
62
|
-
name: "Исследования",
|
63
|
-
type: "folder",
|
64
|
-
modifiedAt: "05-02-2025 14:20",
|
65
|
-
size: "-",
|
66
|
-
branches: [
|
67
|
-
{
|
68
|
-
id: "1-1-52-1",
|
69
|
-
name: "2023",
|
70
|
-
type: "folder",
|
71
|
-
modifiedAt: "05-02-2025 14:30",
|
72
|
-
size: "-",
|
73
|
-
branches: Array.from({ length: 15 }, (d, e) => ({
|
74
|
-
id: `1-1-52-1-${e}`,
|
75
|
-
name: `Отчет_2023_${e + 1}.pdf`,
|
76
|
-
type: "file",
|
77
|
-
modifiedAt: "05-02-2025 15:00",
|
78
|
-
size: `${(Math.random() * 3 + 1).toFixed(2)} MB`,
|
79
|
-
fileType: "pdf"
|
80
|
-
}))
|
81
|
-
},
|
82
|
-
{
|
83
|
-
id: "1-1-52-2",
|
84
|
-
name: "2024",
|
85
|
-
type: "folder",
|
86
|
-
modifiedAt: "05-02-2025 15:10",
|
87
|
-
size: "-",
|
88
|
-
branches: Array.from({ length: 15 }, (d, e) => ({
|
89
|
-
id: `1-1-52-2-${e}`,
|
90
|
-
name: `Отчет_2024_${e + 1}.pdf`,
|
91
|
-
type: "file",
|
92
|
-
modifiedAt: "05-02-2025 15:20",
|
93
|
-
size: `${(Math.random() * 3 + 1).toFixed(2)} MB`,
|
94
|
-
fileType: "pdf"
|
95
|
-
}))
|
96
|
-
}
|
97
|
-
]
|
98
|
-
}
|
99
|
-
]
|
100
|
-
},
|
101
|
-
{
|
102
|
-
id: "1-2",
|
103
|
-
name: "Продажи",
|
104
|
-
type: "folder",
|
105
|
-
modifiedAt: "05-02-2025 12:20",
|
106
|
-
size: "-",
|
107
|
-
branches: [
|
108
|
-
...Array.from({ length: 30 }, (d, e) => ({
|
109
|
-
id: `1-2-${e}`,
|
110
|
-
name: `Отчет_${e + 1}.xlsx`,
|
111
|
-
type: "file",
|
112
|
-
modifiedAt: "05-02-2025 13:40",
|
113
|
-
size: `${(Math.random() * 1.5 + 0.2).toFixed(2)} MB`,
|
114
|
-
fileType: "xlsx"
|
115
|
-
})),
|
116
|
-
{
|
117
|
-
id: "1-2-31",
|
118
|
-
name: "Контракты",
|
119
|
-
type: "folder",
|
120
|
-
modifiedAt: "05-02-2025 14:40",
|
121
|
-
size: "-",
|
122
|
-
branches: Array.from({ length: 10 }, (d, e) => ({
|
123
|
-
id: `1-2-31-${e}`,
|
124
|
-
name: `Контракт_${e + 1}.pdf`,
|
125
|
-
type: "file",
|
126
|
-
modifiedAt: "05-02-2025 15:50",
|
127
|
-
size: `${(Math.random() * 4 + 1).toFixed(2)} MB`,
|
128
|
-
fileType: "pdf"
|
129
|
-
}))
|
130
|
-
}
|
131
|
-
]
|
132
|
-
}
|
133
|
-
]
|
134
|
-
},
|
135
|
-
{
|
136
|
-
id: "2",
|
137
|
-
name: "Личное",
|
138
|
-
type: "folder",
|
139
|
-
modifiedAt: "05-02-2025 11:00",
|
140
|
-
size: "-",
|
141
|
-
branches: [
|
142
|
-
{
|
143
|
-
id: "2-1",
|
144
|
-
name: "Фото",
|
145
|
-
type: "folder",
|
146
|
-
modifiedAt: "05-02-2025 11:20",
|
147
|
-
size: "-",
|
148
|
-
branches: [
|
149
|
-
...Array.from({ length: 20 }, (d, e) => ({
|
150
|
-
id: `2-1-${e}`,
|
151
|
-
name: `Фото_${e + 1}.jpg`,
|
152
|
-
type: "file",
|
153
|
-
modifiedAt: "05-02-2025 12:30",
|
154
|
-
size: `${(Math.random() * 5 + 1).toFixed(2)} MB`,
|
155
|
-
fileType: "jpg"
|
156
|
-
})),
|
157
|
-
{
|
158
|
-
id: "2-1-21",
|
159
|
-
name: "Путешествия",
|
160
|
-
type: "folder",
|
161
|
-
modifiedAt: "05-02-2025 13:50",
|
162
|
-
size: "-",
|
163
|
-
branches: [
|
164
|
-
{
|
165
|
-
id: "2-1-21-1",
|
166
|
-
name: "Италия",
|
167
|
-
type: "folder",
|
168
|
-
modifiedAt: "05-02-2025 14:00",
|
169
|
-
size: "-",
|
170
|
-
branches: Array.from({ length: 10 }, (d, e) => ({
|
171
|
-
id: `2-1-21-1-${e}`,
|
172
|
-
name: `Италия_${e + 1}.jpg`,
|
173
|
-
type: "file",
|
174
|
-
modifiedAt: "05-02-2025 14:10",
|
175
|
-
size: `${(Math.random() * 5 + 1).toFixed(2)} MB`,
|
176
|
-
fileType: "jpg"
|
177
|
-
}))
|
178
|
-
},
|
179
|
-
{
|
180
|
-
id: "2-1-21-2",
|
181
|
-
name: "Япония",
|
182
|
-
type: "folder",
|
183
|
-
modifiedAt: "05-02-2025 14:20",
|
184
|
-
size: "-",
|
185
|
-
branches: Array.from({ length: 10 }, (d, e) => ({
|
186
|
-
id: `2-1-21-2-${e}`,
|
187
|
-
name: `Япония_${e + 1}.jpg`,
|
188
|
-
type: "file",
|
189
|
-
modifiedAt: "05-02-2025 14:30",
|
190
|
-
size: `${(Math.random() * 5 + 1).toFixed(2)} MB`,
|
191
|
-
fileType: "jpg"
|
192
|
-
}))
|
193
|
-
}
|
194
|
-
]
|
195
|
-
}
|
196
|
-
]
|
197
|
-
},
|
198
|
-
{
|
199
|
-
id: "2-2",
|
200
|
-
name: "Видео",
|
201
|
-
type: "folder",
|
202
|
-
modifiedAt: "05-02-2025 12:40",
|
203
|
-
size: "-",
|
204
|
-
branches: [
|
205
|
-
...Array.from({ length: 15 }, (d, e) => ({
|
206
|
-
id: `2-2-${e}`,
|
207
|
-
name: `Видео_${e + 1}.mp4`,
|
208
|
-
type: "file",
|
209
|
-
modifiedAt: "05-02-2025 14:50",
|
210
|
-
size: `${(Math.random() * 100 + 10).toFixed(2)} MB`,
|
211
|
-
fileType: "mp4"
|
212
|
-
})),
|
213
|
-
{
|
214
|
-
id: "2-2-16",
|
215
|
-
name: "Семейные Видео",
|
216
|
-
type: "folder",
|
217
|
-
modifiedAt: "05-02-2025 15:00",
|
218
|
-
size: "-",
|
219
|
-
branches: Array.from({ length: 10 }, (d, e) => ({
|
220
|
-
id: `2-2-16-${e}`,
|
221
|
-
name: `Семья_${e + 1}.mp4`,
|
222
|
-
type: "file",
|
223
|
-
modifiedAt: "05-02-2025 15:10",
|
224
|
-
size: `${(Math.random() * 50 + 5).toFixed(2)} MB`,
|
225
|
-
fileType: "mp4"
|
226
|
-
}))
|
227
|
-
}
|
228
|
-
]
|
229
|
-
}
|
230
|
-
]
|
231
|
-
}
|
232
|
-
],
|
233
|
-
idKey: "id",
|
234
|
-
nameKey: "name",
|
235
|
-
typeKey: "type",
|
236
|
-
childrenKey: "branches"
|
237
|
-
};
|
238
|
-
export {
|
239
|
-
a as WithCustomKeys,
|
240
|
-
m as default
|
241
|
-
};
|
@@ -1,76 +0,0 @@
|
|
1
|
-
import { jsx as I } from "react/jsx-runtime";
|
2
|
-
import { useState as T, useEffect as _, useCallback as x } from "react";
|
3
|
-
import { T as H } from "../../../../TreeList-Z1F3eQH6.js";
|
4
|
-
import { c as J } from "../../../../index-2QXL0WYc.js";
|
5
|
-
import '../../../../assets/Tree.css';const M = {
|
6
|
-
"tree-wrapper": "_tree-wrapper_1yvw0_1"
|
7
|
-
}, U = ({
|
8
|
-
data: n = [],
|
9
|
-
childrenKey: p = "children",
|
10
|
-
idKey: t = "id",
|
11
|
-
// ключ по умолчанию
|
12
|
-
nameKey: i = "name",
|
13
|
-
// ключ по умолчанию
|
14
|
-
typeKey: f = "type",
|
15
|
-
// ключ по умолчанию
|
16
|
-
onSelect: r,
|
17
|
-
defaultExpandedKeys: N = [],
|
18
|
-
// открытые элементы
|
19
|
-
autoExpandParent: b = !1,
|
20
|
-
// Автоматически раскрывать родительские элементы
|
21
|
-
expandedKeys: o,
|
22
|
-
// Управление извне
|
23
|
-
onExpandedKeysChange: u,
|
24
|
-
// Колбэк для изменения expandedKeys
|
25
|
-
selectedKey: a,
|
26
|
-
isFetching: j,
|
27
|
-
isAllExpanded: w = !1,
|
28
|
-
wrapperTreeClassName: l = "",
|
29
|
-
TreeItemClassName: D = "",
|
30
|
-
TreeItemContentClassName: L = ""
|
31
|
-
}) => {
|
32
|
-
const [q, c] = T(N), [z, e] = T(null), m = o !== void 0 ? o : q, B = a !== void 0 ? a : z;
|
33
|
-
_(() => {
|
34
|
-
a !== void 0 && e(a);
|
35
|
-
}, [a]), _(() => {
|
36
|
-
if (!w) return;
|
37
|
-
const s = A(n, t, f, p);
|
38
|
-
u ? u(s) : c(s);
|
39
|
-
}, [w]);
|
40
|
-
const E = x(
|
41
|
-
(s) => {
|
42
|
-
const v = m.includes(s) ? m.filter((G) => G !== s) : [...m, s];
|
43
|
-
u ? u(v) : c(v);
|
44
|
-
},
|
45
|
-
[m, u]
|
46
|
-
), F = x(
|
47
|
-
(s) => {
|
48
|
-
const v = s[t];
|
49
|
-
a === void 0 && e(v), r == null || r(s);
|
50
|
-
},
|
51
|
-
[a, r, t]
|
52
|
-
);
|
53
|
-
return /* @__PURE__ */ I("div", { className: J(M["tree-wrapper"], l), children: n.map((s) => /* @__PURE__ */ I(
|
54
|
-
H,
|
55
|
-
{
|
56
|
-
node: s,
|
57
|
-
level: 0,
|
58
|
-
isFetching: j,
|
59
|
-
onSelect: F,
|
60
|
-
selectedKey: B,
|
61
|
-
childrenKey: p,
|
62
|
-
idKey: t,
|
63
|
-
nameKey: i,
|
64
|
-
typeKey: f,
|
65
|
-
expandedKeys: m,
|
66
|
-
onExpand: E,
|
67
|
-
autoExpandParent: b,
|
68
|
-
TreeItemClassName: D,
|
69
|
-
TreeItemContentClassName: L
|
70
|
-
},
|
71
|
-
s[t]
|
72
|
-
)) });
|
73
|
-
}, A = (n, p, t, i) => n.reduce((f, r) => (r[t] === "directory" && (f.push(r[p]), r[i] && Array.isArray(r[i]) && f.push(...A(r[i], p, t, i))), f), []);
|
74
|
-
export {
|
75
|
-
U as Tree
|
76
|
-
};
|
@@ -1 +0,0 @@
|
|
1
|
-
|
@@ -1 +0,0 @@
|
|
1
|
-
|
@@ -1 +0,0 @@
|
|
1
|
-
|
@@ -1 +0,0 @@
|
|
1
|
-
|