@addev-be/ui 3.2.9 → 3.3.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/assets/icons/arrow-down-1-9.svg +1 -1
- package/assets/icons/arrow-down-a-z.svg +1 -1
- package/assets/icons/arrow-up-z-a.svg +1 -1
- package/assets/icons/check.svg +1 -1
- package/assets/icons/circle-check.svg +1 -1
- package/assets/icons/down.svg +1 -1
- package/assets/icons/filter-full.svg +1 -1
- package/assets/icons/filter.svg +1 -1
- package/assets/icons/hashtag.svg +1 -1
- package/assets/icons/image-slash.svg +1 -1
- package/assets/icons/left.svg +1 -1
- package/assets/icons/magnifier.svg +1 -1
- package/assets/icons/phone.svg +1 -1
- package/assets/icons/right.svg +1 -1
- package/assets/icons/sort-calendar-ascending.svg +5 -5
- package/assets/icons/spinner-third.svg +1 -1
- package/assets/icons/table-columns.svg +1 -1
- package/assets/icons/table-footer-slash.svg +4 -4
- package/assets/icons/table-footer.svg +3 -3
- package/assets/icons/table.svg +1 -1
- package/assets/icons/up.svg +1 -1
- package/assets/icons/user-tie.svg +1 -1
- package/assets/icons/x-bar.svg +3 -3
- package/dist/components/auth/PasswordResetForm.js +7 -2
- package/dist/components/common/Accordion/Accordion.d.ts +14 -0
- package/dist/components/common/Accordion/Accordion.js +81 -0
- package/dist/components/common/Accordion/index.d.ts +2 -0
- package/dist/components/common/PropertiesList/PropertyInput.d.ts +7 -0
- package/dist/components/common/PropertiesList/PropertyInput.js +142 -0
- package/dist/components/common/PropertiesList/index.d.ts +8 -0
- package/dist/components/common/PropertiesList/index.js +28 -0
- package/dist/components/common/PropertiesList/types.d.ts +44 -0
- package/dist/components/common/TabsView/styles.js +10 -8
- package/dist/components/common/TreeView/TreeContext.d.ts +55 -0
- package/dist/components/common/TreeView/TreeContext.js +172 -0
- package/dist/components/common/TreeView/TreeView.d.ts +19 -0
- package/dist/components/common/TreeView/TreeView.js +202 -0
- package/dist/components/common/TreeView/index.d.ts +3 -0
- package/dist/components/common/index.d.ts +3 -0
- package/dist/components/common/index.js +25 -16
- package/dist/components/grid/DataGrid/DataGridCell.js +30 -29
- package/dist/components/grid/DataGrid/DataGridEditableCell/index.d.ts +1 -1
- package/dist/components/grid/DataGrid/DataGridEditableCell/index.js +37 -27
- package/dist/components/grid/DataGrid/DataGridRowTemplate.js +71 -56
- package/dist/components/layout/ContextMenu/ContextMenu.d.ts +42 -0
- package/dist/components/layout/ContextMenu/ContextMenu.js +252 -0
- package/dist/components/layout/ContextMenu/index.d.ts +2 -0
- package/dist/components/layout/LeftMenu/LeftMenu.d.ts +22 -0
- package/dist/components/layout/LeftMenu/LeftMenu.js +43 -0
- package/dist/components/layout/LeftMenu/index.d.ts +2 -0
- package/dist/components/layout/PanelContainer/PanelContainer.d.ts +16 -0
- package/dist/components/layout/PanelContainer/PanelContainer.js +121 -0
- package/dist/components/layout/PanelContainer/index.d.ts +2 -0
- package/dist/components/layout/index.d.ts +3 -0
- package/dist/components/layout/index.js +30 -15
- package/dist/helpers/cn.d.ts +2 -0
- package/dist/helpers/cn.js +8 -0
- package/dist/helpers/index.d.ts +1 -0
- package/dist/helpers/index.js +33 -31
- package/eslint.config.js +3 -3
- package/package.json +5 -3
- package/src/components/auth/LoginForm.tsx +92 -92
- package/src/components/auth/LoginPage.tsx +32 -32
- package/src/components/auth/PasswordRecoveryForm.tsx +53 -53
- package/src/components/auth/PasswordResetForm.tsx +114 -114
- package/src/components/auth/index.ts +4 -4
- package/src/components/auth/styles.ts +14 -14
- package/src/components/common/Accordion/Accordion.tsx +140 -0
- package/src/components/common/Accordion/index.ts +2 -0
- package/src/components/common/Avatar/index.tsx +54 -54
- package/src/components/common/Avatar/styles.ts +61 -61
- package/src/components/common/Card/index.tsx +17 -17
- package/src/components/common/Card/styles.ts +38 -38
- package/src/components/common/ContextMenu/index.tsx +79 -79
- package/src/components/common/ContextMenu/styles.ts +119 -119
- package/src/components/common/Ellipsis.tsx +33 -33
- package/src/components/common/Label.tsx +93 -93
- package/src/components/common/Message/index.tsx +57 -57
- package/src/components/common/Message/styles.ts +44 -44
- package/src/components/common/PropertiesList/PropertyInput.tsx +173 -0
- package/src/components/common/PropertiesList/index.tsx +48 -0
- package/src/components/common/PropertiesList/types.ts +60 -0
- package/src/components/common/TabsView/TabsList.tsx +49 -49
- package/src/components/common/TabsView/TabsView.tsx +42 -42
- package/src/components/common/TabsView/index.ts +3 -3
- package/src/components/common/TabsView/styles.ts +83 -83
- package/src/components/common/TabsView/types.ts +12 -12
- package/src/components/common/TreeView/TreeContext.tsx +379 -0
- package/src/components/common/TreeView/TreeView.tsx +281 -0
- package/src/components/common/TreeView/index.ts +3 -0
- package/src/components/common/index.ts +10 -7
- package/src/components/forms/AutoTextArea.tsx +48 -48
- package/src/components/forms/BillitIdentifier/index.tsx +78 -78
- package/src/components/forms/BillitIdentifier/styles.tsx +43 -43
- package/src/components/forms/Button.tsx +130 -130
- package/src/components/forms/Form/Checkbox.tsx +12 -12
- package/src/components/forms/Form/CustomSelect.tsx +86 -86
- package/src/components/forms/Form/FormGroup.tsx +33 -33
- package/src/components/forms/Form/Input.tsx +16 -16
- package/src/components/forms/Form/Row.tsx +28 -28
- package/src/components/forms/Form/Select.tsx +99 -99
- package/src/components/forms/Form/TextArea.tsx +17 -17
- package/src/components/forms/Form/index.tsx +48 -48
- package/src/components/forms/Form/styles.ts +148 -148
- package/src/components/forms/IconButton.tsx +61 -61
- package/src/components/forms/IndeterminateCheckbox.tsx +46 -46
- package/src/components/forms/NumberInput.tsx +53 -53
- package/src/components/forms/Select.tsx +34 -34
- package/src/components/forms/VerticalLabel.tsx +20 -20
- package/src/components/forms/index.ts +11 -11
- package/src/components/forms/styles.ts +42 -42
- package/src/components/grid/DataGrid/DataGridCell.tsx +82 -81
- package/src/components/grid/DataGrid/DataGridColumnsModal/helpers.ts +9 -9
- package/src/components/grid/DataGrid/DataGridColumnsModal/hooks.tsx +59 -59
- package/src/components/grid/DataGrid/DataGridColumnsModal/index.tsx +182 -182
- package/src/components/grid/DataGrid/DataGridColumnsModal/styles.ts +104 -104
- package/src/components/grid/DataGrid/DataGridEditableCell/CheckboxEditableCell.tsx +37 -37
- package/src/components/grid/DataGrid/DataGridEditableCell/DateEditableCell.tsx +38 -38
- package/src/components/grid/DataGrid/DataGridEditableCell/NumberEditableCell.tsx +71 -71
- package/src/components/grid/DataGrid/DataGridEditableCell/TextEditableCell.tsx +37 -37
- package/src/components/grid/DataGrid/DataGridEditableCell/index.tsx +112 -106
- package/src/components/grid/DataGrid/DataGridEditableCell/styles.ts +35 -35
- package/src/components/grid/DataGrid/DataGridEditableCell/types.ts +18 -18
- package/src/components/grid/DataGrid/DataGridFilterMenu/FilterValuesScroller.tsx +129 -129
- package/src/components/grid/DataGrid/DataGridFilterMenu/helpers.ts +23 -23
- package/src/components/grid/DataGrid/DataGridFilterMenu/hooks.tsx +81 -81
- package/src/components/grid/DataGrid/DataGridFilterMenu/index.tsx +370 -370
- package/src/components/grid/DataGrid/DataGridFilterMenu/styles.ts +97 -97
- package/src/components/grid/DataGrid/DataGridFooter.tsx +48 -48
- package/src/components/grid/DataGrid/DataGridHeader.tsx +74 -74
- package/src/components/grid/DataGrid/DataGridHeaderCell.tsx +112 -112
- package/src/components/grid/DataGrid/DataGridRowTemplate.tsx +90 -83
- package/src/components/grid/DataGrid/DataGridToolbar.tsx +134 -134
- package/src/components/grid/DataGrid/FilterModalContent/index.tsx +137 -137
- package/src/components/grid/DataGrid/FilterModalContent/styles.ts +22 -22
- package/src/components/grid/DataGrid/constants.ts +6 -6
- package/src/components/grid/DataGrid/helpers/columns.tsx +452 -452
- package/src/components/grid/DataGrid/helpers/filters.ts +287 -287
- package/src/components/grid/DataGrid/helpers/index.ts +2 -2
- package/src/components/grid/DataGrid/hooks/index.ts +29 -29
- package/src/components/grid/DataGrid/hooks/useDataGrid.tsx +383 -383
- package/src/components/grid/DataGrid/hooks/useDataGridChangedRows.ts +97 -97
- package/src/components/grid/DataGrid/hooks/useDataGridCopy.ts +174 -174
- package/src/components/grid/DataGrid/hooks/useDataGridSettings.ts +48 -48
- package/src/components/grid/DataGrid/hooks/useRefreshModal.tsx +48 -48
- package/src/components/grid/DataGrid/index.tsx +111 -111
- package/src/components/grid/DataGrid/styles.ts +446 -446
- package/src/components/grid/DataGrid/types.ts +380 -380
- package/src/components/grid/SqlRequestDataGrid/helpers/columns.tsx +526 -526
- package/src/components/grid/SqlRequestDataGrid/helpers/index.ts +2 -2
- package/src/components/grid/SqlRequestDataGrid/helpers/rows.ts +24 -24
- package/src/components/grid/SqlRequestDataGrid/helpers/sqlRequests.ts +17 -17
- package/src/components/grid/SqlRequestDataGrid/index.tsx +417 -417
- package/src/components/grid/SqlRequestDataGrid/styles.ts +15 -15
- package/src/components/grid/SqlRequestDataGrid/types.ts +74 -74
- package/src/components/grid/SqlRequestForeignList/index.tsx +254 -254
- package/src/components/grid/SqlRequestForeignList/styles.ts +43 -43
- package/src/components/grid/SqlRequestForeignList/types.ts +32 -32
- package/src/components/grid/SqlRequestGrid/filters/FiltersSidebar.tsx +108 -108
- package/src/components/grid/SqlRequestGrid/filters/styles.ts +88 -88
- package/src/components/grid/SqlRequestGrid/helpers/index.ts +1 -1
- package/src/components/grid/SqlRequestGrid/helpers/sqlRequests.ts +16 -16
- package/src/components/grid/SqlRequestGrid/index.tsx +304 -304
- package/src/components/grid/SqlRequestGrid/styles.ts +20 -20
- package/src/components/grid/SqlRequestGrid/types.ts +73 -73
- package/src/components/grid/VirtualScroller/hooks.ts +71 -71
- package/src/components/grid/VirtualScroller/index.tsx +89 -89
- package/src/components/grid/VirtualScroller/styles.ts +57 -57
- package/src/components/grid/VirtualScroller/types.ts +10 -10
- package/src/components/grid/index.ts +11 -11
- package/src/components/layout/Columns.ts +28 -28
- package/src/components/layout/ContextMenu/ContextMenu.tsx +471 -0
- package/src/components/layout/ContextMenu/index.ts +23 -0
- package/src/components/layout/Dropdown/index.tsx +113 -113
- package/src/components/layout/Dropdown/styles.ts +53 -53
- package/src/components/layout/Flexbox.ts +21 -21
- package/src/components/layout/Grid/index.tsx +8 -8
- package/src/components/layout/Grid/styles.ts +34 -34
- package/src/components/layout/LeftMenu/LeftMenu.tsx +89 -0
- package/src/components/layout/LeftMenu/index.ts +2 -0
- package/src/components/layout/Loading/index.tsx +29 -29
- package/src/components/layout/Loading/styles.ts +29 -29
- package/src/components/layout/Masonry/index.tsx +29 -29
- package/src/components/layout/Masonry/styles.ts +20 -20
- package/src/components/layout/Modal/index.tsx +51 -51
- package/src/components/layout/Modal/styles.ts +125 -125
- package/src/components/layout/PanelContainer/PanelContainer.tsx +198 -0
- package/src/components/layout/PanelContainer/index.ts +2 -0
- package/src/components/layout/index.ts +10 -7
- package/src/components/search/HighlightedText.tsx +41 -41
- package/src/components/search/QuickSearchBar.tsx +125 -125
- package/src/components/search/QuickSearchResults.tsx +90 -90
- package/src/components/search/index.ts +5 -5
- package/src/components/search/styles.ts +96 -96
- package/src/components/search/types.ts +29 -29
- package/src/config/index.ts +10 -10
- package/src/helpers/cn.ts +6 -0
- package/src/helpers/components.ts +9 -9
- package/src/helpers/dates.ts +17 -17
- package/src/helpers/getScrollbarSize.ts +14 -14
- package/src/helpers/index.ts +8 -7
- package/src/helpers/numbers.ts +63 -63
- package/src/helpers/responsive.ts +83 -83
- package/src/helpers/styled/size.ts +24 -24
- package/src/helpers/styled/space.ts +111 -111
- package/src/helpers/styled/typography.ts +25 -25
- package/src/helpers/text.ts +13 -13
- package/src/helpers/types.ts +9 -9
- package/src/hooks/index.ts +9 -9
- package/src/hooks/providers.ts +14 -14
- package/src/hooks/useContainerMediaQuery.ts +7 -7
- package/src/hooks/useElementSize.ts +24 -24
- package/src/hooks/useMediaQuery.ts +9 -9
- package/src/hooks/useMediaQueryForWidth.ts +35 -35
- package/src/hooks/useMutableState.test.ts +410 -410
- package/src/hooks/useMutableState.ts +39 -39
- package/src/hooks/useShowArchived.ts +28 -28
- package/src/hooks/useWindowSize.ts +20 -20
- package/src/icons/index.tsx +138 -138
- package/src/providers/AuthenticationProvider/helpers.ts +3 -3
- package/src/providers/AuthenticationProvider/index.tsx +303 -303
- package/src/providers/LoadingProvider/index.tsx +47 -47
- package/src/providers/PortalsProvider/index.tsx +54 -54
- package/src/providers/PortalsProvider/styles.ts +31 -31
- package/src/providers/SettingsProvider/index.tsx +70 -70
- package/src/providers/ToastProvider/index.tsx +93 -93
- package/src/providers/TrackingProvider/hooks.ts +14 -14
- package/src/providers/TrackingProvider/index.tsx +71 -71
- package/src/providers/UiProviders/index.tsx +74 -74
- package/src/providers/UiProviders/styles.ts +10 -10
- package/src/providers/index.ts +6 -6
- package/src/services/HttpService.ts +92 -92
- package/src/services/WebSocketService.ts +155 -155
- package/src/services/advancedRequests.ts +102 -102
- package/src/services/base.ts +23 -23
- package/src/services/globalSearch.ts +32 -32
- package/src/services/hooks.ts +92 -92
- package/src/services/index.ts +20 -20
- package/src/services/requests/auth.ts +44 -44
- package/src/services/requests/generic.ts +76 -76
- package/src/services/requests/printing.ts +12 -12
- package/src/services/requests/tracking.ts +12 -12
- package/src/services/requests/userProfiles.ts +35 -35
- package/src/services/requests/users.ts +28 -28
- package/src/services/smartQueries.ts +122 -122
- package/src/services/sqlRequests.ts +119 -119
- package/src/services/types/auth.ts +98 -98
- package/src/services/types/base.ts +10 -10
- package/src/services/types/generic.ts +102 -102
- package/src/services/types/printing.ts +10 -10
- package/src/services/types/tracking.ts +29 -29
- package/src/services/types/userProfiles.ts +79 -79
- package/src/services/types/users.ts +74 -74
- package/src/services/updateSqlRequests.ts +32 -32
- package/src/styles/animations.scss +30 -30
- package/src/styles/index.scss +42 -42
- package/src/theme/ThemeProvider.ts +73 -73
- package/src/theme/defaultTheme.ts +471 -471
- package/src/theme/helpers.ts +89 -89
- package/src/theme/index.ts +4 -4
- package/src/theme/types.ts +139 -139
- package/src/types/index.ts +8 -8
- package/src/typings.d.ts +2 -2
- package/tsconfig.json +41 -41
- package/tsconfig.tsbuildinfo +0 -1
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { default as React, ReactNode } from 'react';
|
|
2
|
+
type DropPosition = {
|
|
3
|
+
nodeId: string;
|
|
4
|
+
position: 'before' | 'after' | 'inside';
|
|
5
|
+
} | null;
|
|
6
|
+
export type DragDropType = 'none' | true | 'level';
|
|
7
|
+
interface TreeContextValue {
|
|
8
|
+
idPropertyName?: string;
|
|
9
|
+
childrenPropertyName?: string;
|
|
10
|
+
displayPropertyName?: string;
|
|
11
|
+
ItemComponent?: React.FC<{
|
|
12
|
+
item: any;
|
|
13
|
+
}>;
|
|
14
|
+
expandedIds: Set<string>;
|
|
15
|
+
toggleExpand: (id: string) => void;
|
|
16
|
+
isExpanded: (id: string) => boolean;
|
|
17
|
+
draggedNodeId: string | null;
|
|
18
|
+
draggedNodeLevel: number | null;
|
|
19
|
+
dropPosition: DropPosition;
|
|
20
|
+
dragDropType: DragDropType;
|
|
21
|
+
handleDragStart: (e: React.DragEvent, nodeId: string, content: string, level: number) => void;
|
|
22
|
+
handleDragOver: (e: React.DragEvent, nodeId: string, level: number, isLastChild: boolean, parentId: string | null, hasChildren: boolean) => void;
|
|
23
|
+
handleDragLeave: (e: React.DragEvent) => void;
|
|
24
|
+
handleDrop: (e: React.DragEvent) => void;
|
|
25
|
+
handleDragEnd: () => void;
|
|
26
|
+
handleDrag: (e: React.DragEvent) => void;
|
|
27
|
+
}
|
|
28
|
+
export declare function useTreeContext(): TreeContextValue;
|
|
29
|
+
interface TreeProviderProps {
|
|
30
|
+
children: ReactNode;
|
|
31
|
+
treeId: string;
|
|
32
|
+
items: any[];
|
|
33
|
+
idPropertyName?: string;
|
|
34
|
+
childrenPropertyName?: string;
|
|
35
|
+
displayPropertyName?: string;
|
|
36
|
+
ItemComponent?: React.FC<{
|
|
37
|
+
item: any;
|
|
38
|
+
}>;
|
|
39
|
+
defaultExpanded?: boolean;
|
|
40
|
+
dragDropType?: DragDropType;
|
|
41
|
+
onItemMove?: (draggedId: string, targetId: string, position: 'before' | 'after' | 'inside') => void;
|
|
42
|
+
onItemsChanged?: (items: any[]) => void;
|
|
43
|
+
dragGhost: {
|
|
44
|
+
x: number;
|
|
45
|
+
y: number;
|
|
46
|
+
content: string;
|
|
47
|
+
} | null;
|
|
48
|
+
setDragGhost: (ghost: {
|
|
49
|
+
x: number;
|
|
50
|
+
y: number;
|
|
51
|
+
content: string;
|
|
52
|
+
} | null) => void;
|
|
53
|
+
}
|
|
54
|
+
export declare function TreeProvider({ children, treeId, items, idPropertyName, childrenPropertyName, displayPropertyName, ItemComponent, dragDropType, onItemMove, onItemsChanged, dragGhost, setDragGhost, }: TreeProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
55
|
+
export {};
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
import { jsx as G } from "react/jsx-runtime";
|
|
2
|
+
import { createContext as y, useState as Y, useCallback as s, useContext as nn } from "react";
|
|
3
|
+
const U = y(null);
|
|
4
|
+
function ln() {
|
|
5
|
+
const D = nn(U);
|
|
6
|
+
if (!D)
|
|
7
|
+
throw new Error("TreeNode must be used within TreeView");
|
|
8
|
+
return D;
|
|
9
|
+
}
|
|
10
|
+
function an({
|
|
11
|
+
children: D,
|
|
12
|
+
treeId: d,
|
|
13
|
+
items: Q,
|
|
14
|
+
idPropertyName: x,
|
|
15
|
+
childrenPropertyName: a,
|
|
16
|
+
displayPropertyName: W,
|
|
17
|
+
ItemComponent: q,
|
|
18
|
+
dragDropType: c = "none",
|
|
19
|
+
onItemMove: X,
|
|
20
|
+
onItemsChanged: L,
|
|
21
|
+
dragGhost: R,
|
|
22
|
+
setDragGhost: r
|
|
23
|
+
}) {
|
|
24
|
+
const [F, z] = Y(() => /* @__PURE__ */ new Set()), [u, C] = Y(null), [I, k] = Y(null), [A, l] = Y(null), H = s(
|
|
25
|
+
(n, e, t) => {
|
|
26
|
+
if (!L) return;
|
|
27
|
+
const f = structuredClone(Q), p = (o) => x && o[x] ? String(o[x]) : String(o), v = (o, h) => {
|
|
28
|
+
for (let S = 0; S < o.length; S++) {
|
|
29
|
+
const B = o[S];
|
|
30
|
+
if (p(B) === h)
|
|
31
|
+
return { node: B, parent: o, index: S };
|
|
32
|
+
if (a && B[a]) {
|
|
33
|
+
const j = v(
|
|
34
|
+
B[a],
|
|
35
|
+
h
|
|
36
|
+
);
|
|
37
|
+
if (j) return j;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
return null;
|
|
41
|
+
}, g = v(f, n);
|
|
42
|
+
if (!g || !g.parent) return;
|
|
43
|
+
const {
|
|
44
|
+
node: T,
|
|
45
|
+
parent: b,
|
|
46
|
+
index: E
|
|
47
|
+
} = g;
|
|
48
|
+
b.splice(E, 1);
|
|
49
|
+
const i = v(f, e);
|
|
50
|
+
if (!i) return;
|
|
51
|
+
const {
|
|
52
|
+
node: w,
|
|
53
|
+
parent: O,
|
|
54
|
+
index: V
|
|
55
|
+
} = i;
|
|
56
|
+
if (t === "inside")
|
|
57
|
+
a && (w[a] || (w[a] = []), w[a].push(T));
|
|
58
|
+
else {
|
|
59
|
+
if (!O) return;
|
|
60
|
+
const o = t === "before" ? V : V + 1;
|
|
61
|
+
O.splice(o, 0, T);
|
|
62
|
+
}
|
|
63
|
+
L(f);
|
|
64
|
+
},
|
|
65
|
+
[Q, x, a, L]
|
|
66
|
+
), J = s((n) => {
|
|
67
|
+
z((e) => {
|
|
68
|
+
const t = new Set(e);
|
|
69
|
+
return t.has(n) ? t.delete(n) : t.add(n), t;
|
|
70
|
+
});
|
|
71
|
+
}, []), K = s(
|
|
72
|
+
(n) => F.has(n),
|
|
73
|
+
[F]
|
|
74
|
+
), M = s(
|
|
75
|
+
(n, e, t, f) => {
|
|
76
|
+
if (c === "none") {
|
|
77
|
+
n.preventDefault();
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
C(e), k(f), n.dataTransfer.setData("text/plain", d), n.dataTransfer.setData("application/x-tree-id", d);
|
|
81
|
+
const p = new Image();
|
|
82
|
+
p.src = "data:image/gif;base64,R0lGODlhAQABAIAAAAUEBAAAACwAAAAAAQABAAACAkQBADs=", n.dataTransfer.effectAllowed = "move", n.dataTransfer.setDragImage(p, 0, 0), r({ x: n.clientX, y: n.clientY, content: t });
|
|
83
|
+
},
|
|
84
|
+
[d, r, c]
|
|
85
|
+
), Z = s(
|
|
86
|
+
(n, e, t, f, p, v) => {
|
|
87
|
+
n.preventDefault(), n.stopPropagation();
|
|
88
|
+
const g = n.dataTransfer.types.includes(
|
|
89
|
+
"application/x-tree-id"
|
|
90
|
+
) ? n.dataTransfer.getData("application/x-tree-id") || n.dataTransfer.getData("text/plain") : null;
|
|
91
|
+
if (g && g !== d) {
|
|
92
|
+
l(null);
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
if (u === e) {
|
|
96
|
+
l(null);
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
if (u && e.startsWith(u + "-")) {
|
|
100
|
+
l(null);
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
if (c === "level" && I !== null && I !== t) {
|
|
104
|
+
l(null);
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
const T = n.currentTarget.getBoundingClientRect(), b = n.clientY - T.top, E = T.height;
|
|
108
|
+
let i;
|
|
109
|
+
if (v) {
|
|
110
|
+
const w = E * 0.4;
|
|
111
|
+
b < w ? i = "before" : i = "inside";
|
|
112
|
+
} else
|
|
113
|
+
b < E / 2 ? i = "before" : i = "after";
|
|
114
|
+
if (c === "level" && i === "inside") {
|
|
115
|
+
l(null);
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
l({ nodeId: e, position: i });
|
|
119
|
+
},
|
|
120
|
+
[d, u, c, I]
|
|
121
|
+
), _ = s((n) => {
|
|
122
|
+
n.preventDefault();
|
|
123
|
+
const e = n.relatedTarget;
|
|
124
|
+
(!e || !n.currentTarget.contains(e)) && l(null);
|
|
125
|
+
}, []), $ = s(
|
|
126
|
+
(n) => {
|
|
127
|
+
if (n.preventDefault(), n.stopPropagation(), (n.dataTransfer.getData("application/x-tree-id") || n.dataTransfer.getData("text/plain")) !== d) {
|
|
128
|
+
C(null), l(null), r(null);
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
u && A && (X || H)(u, A.nodeId, A.position), C(null), l(null), r(null);
|
|
132
|
+
},
|
|
133
|
+
[
|
|
134
|
+
d,
|
|
135
|
+
u,
|
|
136
|
+
A,
|
|
137
|
+
X,
|
|
138
|
+
H,
|
|
139
|
+
r
|
|
140
|
+
]
|
|
141
|
+
), m = s(() => {
|
|
142
|
+
C(null), k(null), l(null), r(null);
|
|
143
|
+
}, [r]), P = s(
|
|
144
|
+
(n) => {
|
|
145
|
+
n.clientX === 0 && n.clientY === 0 || R && r({ ...R, x: n.clientX, y: n.clientY });
|
|
146
|
+
},
|
|
147
|
+
[R, r]
|
|
148
|
+
), N = {
|
|
149
|
+
idPropertyName: x,
|
|
150
|
+
childrenPropertyName: a,
|
|
151
|
+
displayPropertyName: W,
|
|
152
|
+
ItemComponent: q,
|
|
153
|
+
expandedIds: F,
|
|
154
|
+
toggleExpand: J,
|
|
155
|
+
isExpanded: K,
|
|
156
|
+
draggedNodeId: u,
|
|
157
|
+
draggedNodeLevel: I,
|
|
158
|
+
dropPosition: A,
|
|
159
|
+
dragDropType: c,
|
|
160
|
+
handleDragStart: M,
|
|
161
|
+
handleDragOver: Z,
|
|
162
|
+
handleDragLeave: _,
|
|
163
|
+
handleDrop: $,
|
|
164
|
+
handleDragEnd: m,
|
|
165
|
+
handleDrag: P
|
|
166
|
+
};
|
|
167
|
+
return /* @__PURE__ */ G(U.Provider, { value: N, children: D });
|
|
168
|
+
}
|
|
169
|
+
export {
|
|
170
|
+
an as TreeProvider,
|
|
171
|
+
ln as useTreeContext
|
|
172
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { DragDropType } from './TreeContext';
|
|
2
|
+
import { FC, HTMLAttributes } from 'react';
|
|
3
|
+
export interface TreeViewProps<TItem> extends Omit<HTMLAttributes<HTMLDivElement>, 'children'> {
|
|
4
|
+
items: TItem[];
|
|
5
|
+
idPropertyName?: keyof TItem & string;
|
|
6
|
+
childrenPropertyName?: keyof TItem & string;
|
|
7
|
+
itemComponent?: FC<{
|
|
8
|
+
item: TItem;
|
|
9
|
+
}>;
|
|
10
|
+
displayPropertyName?: keyof TItem & string;
|
|
11
|
+
defaultExpanded?: boolean;
|
|
12
|
+
dragDropType?: DragDropType;
|
|
13
|
+
onItemMove?: (draggedId: string, targetId: string, position: 'before' | 'after' | 'inside') => void;
|
|
14
|
+
onItemsChanged?: (items: TItem[]) => void;
|
|
15
|
+
}
|
|
16
|
+
export declare function TreeView<TItem>({ items, idPropertyName, childrenPropertyName, itemComponent: ItemComponent, displayPropertyName, defaultExpanded, dragDropType, onItemMove, onItemsChanged, className, ...props }: TreeViewProps<TItem>): import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
export declare namespace TreeView {
|
|
18
|
+
var displayName: string;
|
|
19
|
+
}
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
import { jsxs as C, jsx as n } from "react/jsx-runtime";
|
|
2
|
+
import { TreeProvider as _, useTreeContext as B } from "./TreeContext.js";
|
|
3
|
+
import q, { useState as F } from "react";
|
|
4
|
+
import H from "../../../assets/icons/chevron-right.svg.js";
|
|
5
|
+
import { cn as u } from "../../../helpers/cn.js";
|
|
6
|
+
function J(r, e) {
|
|
7
|
+
if (!e) return [];
|
|
8
|
+
const t = r[e];
|
|
9
|
+
return Array.isArray(t) ? t : [];
|
|
10
|
+
}
|
|
11
|
+
function K(r, e) {
|
|
12
|
+
if (!e) return String(r);
|
|
13
|
+
const t = r[e];
|
|
14
|
+
return t != null ? String(t) : "";
|
|
15
|
+
}
|
|
16
|
+
function z(r, e, t) {
|
|
17
|
+
if (e) {
|
|
18
|
+
const o = r[e];
|
|
19
|
+
if (o != null) return String(o);
|
|
20
|
+
}
|
|
21
|
+
return t || String(r);
|
|
22
|
+
}
|
|
23
|
+
function E({
|
|
24
|
+
item: r,
|
|
25
|
+
id: e,
|
|
26
|
+
parentId: t,
|
|
27
|
+
level: o,
|
|
28
|
+
isLastChild: c,
|
|
29
|
+
verticalLines: f
|
|
30
|
+
}) {
|
|
31
|
+
const {
|
|
32
|
+
idPropertyName: m,
|
|
33
|
+
childrenPropertyName: b,
|
|
34
|
+
displayPropertyName: v,
|
|
35
|
+
ItemComponent: s,
|
|
36
|
+
isExpanded: D,
|
|
37
|
+
toggleExpand: a,
|
|
38
|
+
draggedNodeId: x,
|
|
39
|
+
dropPosition: i,
|
|
40
|
+
dragDropType: d,
|
|
41
|
+
handleDragStart: g,
|
|
42
|
+
handleDragOver: h,
|
|
43
|
+
handleDragLeave: y,
|
|
44
|
+
handleDrop: S,
|
|
45
|
+
handleDragEnd: P,
|
|
46
|
+
handleDrag: V
|
|
47
|
+
} = B(), N = J(r, b), p = N.length > 0, L = D(e), j = x === e, w = i?.nodeId === e, A = w && i?.position === "before", $ = w && i?.position === "after", G = w && i?.position === "inside", I = s ? /* @__PURE__ */ n(s, { item: r }) : K(r, v);
|
|
48
|
+
return /* @__PURE__ */ C("div", { className: o > 1 ? "ml-4" : "", children: [
|
|
49
|
+
/* @__PURE__ */ C(
|
|
50
|
+
"div",
|
|
51
|
+
{
|
|
52
|
+
draggable: d !== "none",
|
|
53
|
+
onDragStart: (l) => g(
|
|
54
|
+
l,
|
|
55
|
+
e,
|
|
56
|
+
typeof I == "string" ? I : String(r),
|
|
57
|
+
o
|
|
58
|
+
),
|
|
59
|
+
onDragOver: (l) => h(l, e, o, c, t, p),
|
|
60
|
+
onDragLeave: y,
|
|
61
|
+
onDrop: S,
|
|
62
|
+
onDragEnd: P,
|
|
63
|
+
onDrag: V,
|
|
64
|
+
className: u(
|
|
65
|
+
"flex items-center gap-1 py-1.5 pr-theme-sm transition-colors pl-2",
|
|
66
|
+
"hover:bg-accent/50 text-foreground group",
|
|
67
|
+
"font-theme text-theme-sm relative",
|
|
68
|
+
d !== "none" && (j ? "opacity-40 cursor-grabbing" : "cursor-grab"),
|
|
69
|
+
G && "bg-accent/70 ring-2 ring-accent ring-inset"
|
|
70
|
+
),
|
|
71
|
+
children: [
|
|
72
|
+
A && /* @__PURE__ */ n("div", { className: "absolute right-0 top-0 h-0.5 bg-primary z-20 left-4" }),
|
|
73
|
+
$ && /* @__PURE__ */ n("div", { className: "absolute right-0 bottom-0 h-0.5 bg-primary z-20 left-4" }),
|
|
74
|
+
o > 1 && /* @__PURE__ */ n(
|
|
75
|
+
"div",
|
|
76
|
+
{
|
|
77
|
+
className: u(
|
|
78
|
+
"absolute h-px bg-border/60 left-0 top-1/2",
|
|
79
|
+
p ? "w-2.5" : "w-6"
|
|
80
|
+
)
|
|
81
|
+
}
|
|
82
|
+
),
|
|
83
|
+
p ? /* @__PURE__ */ n(
|
|
84
|
+
"button",
|
|
85
|
+
{
|
|
86
|
+
type: "button",
|
|
87
|
+
onClick: () => a(e),
|
|
88
|
+
className: "flex items-center justify-center w-5 h-5 hover:bg-accent/50 rounded transition-all shrink-0 relative z-10",
|
|
89
|
+
children: /* @__PURE__ */ n(
|
|
90
|
+
H,
|
|
91
|
+
{
|
|
92
|
+
className: u(
|
|
93
|
+
"w-3.5 h-3.5 text-muted-foreground transition-transform duration-200",
|
|
94
|
+
L && "rotate-90"
|
|
95
|
+
)
|
|
96
|
+
}
|
|
97
|
+
)
|
|
98
|
+
}
|
|
99
|
+
) : /* @__PURE__ */ n("span", { className: "w-5 shrink-0" }),
|
|
100
|
+
/* @__PURE__ */ n("div", { className: "flex-1 min-w-0", children: s ? /* @__PURE__ */ n(s, { item: r }) : /* @__PURE__ */ n("span", { className: "truncate block", children: I }) })
|
|
101
|
+
]
|
|
102
|
+
}
|
|
103
|
+
),
|
|
104
|
+
p && L && /* @__PURE__ */ n("div", { className: "relative before:absolute before:w-px before:top-0 before:left-4 before:bottom-4 before:bg-border/60", children: N.map((l, T) => {
|
|
105
|
+
const k = z(l, m, `${e}-${T}`), O = T === N.length - 1, R = [
|
|
106
|
+
...f,
|
|
107
|
+
c ? "none" : "line"
|
|
108
|
+
];
|
|
109
|
+
return /* @__PURE__ */ n(
|
|
110
|
+
E,
|
|
111
|
+
{
|
|
112
|
+
item: l,
|
|
113
|
+
id: k,
|
|
114
|
+
parentId: e,
|
|
115
|
+
level: o + 1,
|
|
116
|
+
isLastChild: O,
|
|
117
|
+
verticalLines: R
|
|
118
|
+
},
|
|
119
|
+
k
|
|
120
|
+
);
|
|
121
|
+
}) })
|
|
122
|
+
] });
|
|
123
|
+
}
|
|
124
|
+
function M({
|
|
125
|
+
items: r,
|
|
126
|
+
idPropertyName: e,
|
|
127
|
+
childrenPropertyName: t,
|
|
128
|
+
itemComponent: o,
|
|
129
|
+
displayPropertyName: c,
|
|
130
|
+
defaultExpanded: f = !1,
|
|
131
|
+
dragDropType: m = "none",
|
|
132
|
+
onItemMove: b,
|
|
133
|
+
onItemsChanged: v,
|
|
134
|
+
className: s,
|
|
135
|
+
...D
|
|
136
|
+
}) {
|
|
137
|
+
const [a, x] = F(null), i = q.useId();
|
|
138
|
+
return /* @__PURE__ */ C(
|
|
139
|
+
_,
|
|
140
|
+
{
|
|
141
|
+
treeId: i,
|
|
142
|
+
items: r,
|
|
143
|
+
idPropertyName: e,
|
|
144
|
+
childrenPropertyName: t,
|
|
145
|
+
displayPropertyName: c,
|
|
146
|
+
ItemComponent: o,
|
|
147
|
+
defaultExpanded: f,
|
|
148
|
+
dragDropType: m,
|
|
149
|
+
onItemMove: b,
|
|
150
|
+
onItemsChanged: v,
|
|
151
|
+
dragGhost: a,
|
|
152
|
+
setDragGhost: x,
|
|
153
|
+
children: [
|
|
154
|
+
/* @__PURE__ */ n(
|
|
155
|
+
"div",
|
|
156
|
+
{
|
|
157
|
+
className: u(
|
|
158
|
+
"border border-border bg-card overflow-hidden",
|
|
159
|
+
"py-theme-xs rounded-theme-md",
|
|
160
|
+
s
|
|
161
|
+
),
|
|
162
|
+
...D,
|
|
163
|
+
children: r.map((d, g) => {
|
|
164
|
+
const h = z(
|
|
165
|
+
d,
|
|
166
|
+
e,
|
|
167
|
+
`${g}`
|
|
168
|
+
), y = g === r.length - 1;
|
|
169
|
+
return /* @__PURE__ */ n(
|
|
170
|
+
E,
|
|
171
|
+
{
|
|
172
|
+
item: d,
|
|
173
|
+
id: h,
|
|
174
|
+
parentId: null,
|
|
175
|
+
level: 1,
|
|
176
|
+
isLastChild: y,
|
|
177
|
+
verticalLines: ["none"]
|
|
178
|
+
},
|
|
179
|
+
h
|
|
180
|
+
);
|
|
181
|
+
})
|
|
182
|
+
}
|
|
183
|
+
),
|
|
184
|
+
a && /* @__PURE__ */ n(
|
|
185
|
+
"div",
|
|
186
|
+
{
|
|
187
|
+
className: "fixed pointer-events-none z-50 bg-card border border-border rounded px-3 py-1.5 shadow-lg opacity-70",
|
|
188
|
+
style: {
|
|
189
|
+
left: a.x + 10,
|
|
190
|
+
top: a.y + 10
|
|
191
|
+
},
|
|
192
|
+
children: /* @__PURE__ */ n("span", { className: "text-sm text-foreground", children: a.content })
|
|
193
|
+
}
|
|
194
|
+
)
|
|
195
|
+
]
|
|
196
|
+
}
|
|
197
|
+
);
|
|
198
|
+
}
|
|
199
|
+
M.displayName = "TreeView";
|
|
200
|
+
export {
|
|
201
|
+
M as TreeView
|
|
202
|
+
};
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
+
export * from './Accordion';
|
|
1
2
|
export * from './Avatar';
|
|
2
3
|
export * from './Card';
|
|
3
4
|
export * from './ContextMenu';
|
|
4
5
|
export * from './Ellipsis';
|
|
5
6
|
export * from './Label';
|
|
6
7
|
export * from './Message';
|
|
8
|
+
export * from './PropertiesList';
|
|
7
9
|
export * from './TabsView';
|
|
10
|
+
export * from './TreeView';
|
|
@@ -1,20 +1,29 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
1
|
+
import { Accordion as o } from "./Accordion/Accordion.js";
|
|
2
|
+
import { Avatar as p } from "./Avatar/index.js";
|
|
3
|
+
import { Card as m } from "./Card/index.js";
|
|
4
|
+
import { ContextMenu as s, ParentMenuItem as a } from "./ContextMenu/index.js";
|
|
5
|
+
import { Ellipsis as n } from "./Ellipsis.js";
|
|
6
|
+
import { Label as T, StyledLabel as b } from "./Label.js";
|
|
6
7
|
import { Message as L } from "./Message/index.js";
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
8
|
+
import { PropertiesList as C } from "./PropertiesList/index.js";
|
|
9
|
+
import { TabsView as P } from "./TabsView/TabsView.js";
|
|
10
|
+
import { TabsList as v } from "./TabsView/TabsList.js";
|
|
11
|
+
import { TreeView as A } from "./TreeView/TreeView.js";
|
|
12
|
+
import { TreeProvider as g, useTreeContext as y } from "./TreeView/TreeContext.js";
|
|
9
13
|
export {
|
|
10
|
-
o as
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
s as
|
|
14
|
-
|
|
14
|
+
o as Accordion,
|
|
15
|
+
p as Avatar,
|
|
16
|
+
m as Card,
|
|
17
|
+
s as ContextMenu,
|
|
18
|
+
n as Ellipsis,
|
|
19
|
+
T as Label,
|
|
15
20
|
L as Message,
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
21
|
+
a as ParentMenuItem,
|
|
22
|
+
C as PropertiesList,
|
|
23
|
+
b as StyledLabel,
|
|
24
|
+
v as TabsList,
|
|
25
|
+
P as TabsView,
|
|
26
|
+
g as TreeProvider,
|
|
27
|
+
A as TreeView,
|
|
28
|
+
y as useTreeContext
|
|
20
29
|
};
|
|
@@ -1,57 +1,58 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as $ } from "react/jsx-runtime";
|
|
2
2
|
import { DataGridCell as S } from "./styles.js";
|
|
3
|
-
import { useMemo as
|
|
4
|
-
import { DataGridEditableCell as
|
|
3
|
+
import { useMemo as c, useCallback as A } from "react";
|
|
4
|
+
import { DataGridEditableCell as R } from "./DataGridEditableCell/index.js";
|
|
5
5
|
import { useDataGridContext as j } from "./hooks/index.js";
|
|
6
|
-
const v = (e) => e ? String(e) : "",
|
|
6
|
+
const v = (e) => e ? String(e) : "", B = ({
|
|
7
7
|
row: e,
|
|
8
8
|
rowIndex: i,
|
|
9
|
-
columnKey:
|
|
9
|
+
columnKey: b,
|
|
10
10
|
columnIndex: a,
|
|
11
11
|
column: t,
|
|
12
12
|
context: s,
|
|
13
|
-
style:
|
|
13
|
+
style: f
|
|
14
14
|
}) => {
|
|
15
15
|
const {
|
|
16
|
-
name:
|
|
16
|
+
name: D,
|
|
17
17
|
editable: g,
|
|
18
|
-
editingCell:
|
|
19
|
-
setEditingCell:
|
|
18
|
+
editingCell: o = [-1, -1],
|
|
19
|
+
setEditingCell: C,
|
|
20
20
|
onRowDoubleClick: d,
|
|
21
|
-
userSelect:
|
|
22
|
-
headerColor:
|
|
23
|
-
} = j(s),
|
|
24
|
-
(
|
|
25
|
-
|
|
21
|
+
userSelect: p,
|
|
22
|
+
headerColor: G
|
|
23
|
+
} = j(s), l = !!g && "editable" in t && !!t.editable && !!t.editComponent, E = l && o[0] === i && o[1] === a, h = t.component ?? S, k = c(() => t.getter(e), [t, e]), n = A(
|
|
24
|
+
(r) => {
|
|
25
|
+
r.stopPropagation(), r.preventDefault(), l ? C([i, a]) : d?.(e, r);
|
|
26
26
|
},
|
|
27
|
-
[a,
|
|
27
|
+
[a, l, d, e, i, C]
|
|
28
28
|
);
|
|
29
|
-
return
|
|
30
|
-
|
|
29
|
+
return E ? /* @__PURE__ */ $(
|
|
30
|
+
R,
|
|
31
31
|
{
|
|
32
32
|
row: e,
|
|
33
33
|
rowIndex: i,
|
|
34
|
-
columnKey:
|
|
34
|
+
columnKey: b,
|
|
35
35
|
columnIndex: a,
|
|
36
36
|
column: t,
|
|
37
37
|
context: s,
|
|
38
|
-
userSelect:
|
|
38
|
+
userSelect: p
|
|
39
39
|
},
|
|
40
|
-
|
|
41
|
-
) : /* @__PURE__ */
|
|
42
|
-
|
|
40
|
+
`editable-cell-${i}-${a}`
|
|
41
|
+
) : /* @__PURE__ */ $(
|
|
42
|
+
h,
|
|
43
43
|
{
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
44
|
+
"data-testid": `cell-${i}-${a}`,
|
|
45
|
+
onDoubleClick: n,
|
|
46
|
+
style: f,
|
|
47
|
+
$userSelect: p,
|
|
47
48
|
$color: t.color,
|
|
48
49
|
$textAlign: t.textAlign,
|
|
49
|
-
$headerColor:
|
|
50
|
-
children: (t.render ?? v)(
|
|
50
|
+
$headerColor: G,
|
|
51
|
+
children: (t.render ?? v)(k, e, t)
|
|
51
52
|
},
|
|
52
|
-
`${
|
|
53
|
+
`${D}-${i}-${a}`
|
|
53
54
|
);
|
|
54
55
|
};
|
|
55
56
|
export {
|
|
56
|
-
|
|
57
|
+
B as DataGridCell
|
|
57
58
|
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { EditableDataGridCellProps } from '../types';
|
|
2
|
-
export declare const DataGridEditableCell: <R, T>({ row, columnKey, column, context, }: EditableDataGridCellProps<R, T>) => import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
export declare const DataGridEditableCell: <R, T>({ row, columnKey, column, context, rowIndex, columnIndex, }: EditableDataGridCellProps<R, T>) => import("react/jsx-runtime").JSX.Element;
|