@vanillabp/bc-ui 0.0.3
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/README.md +1 -0
- package/dist/chunk-YH4NJHER.js +58 -0
- package/dist/components/ListCell.d.ts +27 -0
- package/dist/components/ListCell.js +123 -0
- package/dist/components/ListColumnHeader.d.ts +22 -0
- package/dist/components/ListColumnHeader.js +135 -0
- package/dist/components/ListOfTasks.d.ts +35 -0
- package/dist/components/ListOfTasks.js +1327 -0
- package/dist/components/ListOfWorkflows.d.ts +36 -0
- package/dist/components/ListOfWorkflows.js +974 -0
- package/dist/components/NoElementGivenByModule.d.ts +10 -0
- package/dist/components/NoElementGivenByModule.js +54 -0
- package/dist/components/NoUserTaskGiven.d.ts +10 -0
- package/dist/components/NoUserTaskGiven.js +23 -0
- package/dist/components/NoWorkflowGiven.d.ts +10 -0
- package/dist/components/NoWorkflowGiven.js +22 -0
- package/dist/components/SearchableAndSortableUpdatingList.d.ts +49 -0
- package/dist/components/SearchableAndSortableUpdatingList.js +200 -0
- package/dist/components/SnapScrolling.d.ts +15 -0
- package/dist/components/SnapScrolling.js +17 -0
- package/dist/components/SnapScrollingDataTable.d.ts +17 -0
- package/dist/components/SnapScrollingDataTable.js +113 -0
- package/dist/components/User.d.ts +11 -0
- package/dist/components/User.js +39 -0
- package/dist/components/UserAvatar.d.ts +12 -0
- package/dist/components/UserAvatar.js +133 -0
- package/dist/components/UserTaskPage.d.ts +24 -0
- package/dist/components/UserTaskPage.js +121 -0
- package/dist/components/WorkflowPage.d.ts +16 -0
- package/dist/components/WorkflowPage.js +124 -0
- package/dist/components/index.d.ts +25 -0
- package/dist/components/index.js +13 -0
- package/dist/index.d.ts +25 -0
- package/dist/index.js +3 -0
- package/dist/types/apis.d.ts +50 -0
- package/dist/types/apis.js +0 -0
- package/dist/types/index.d.ts +7 -0
- package/dist/types/index.js +3 -0
- package/dist/types/lists.d.ts +12 -0
- package/dist/types/lists.js +0 -0
- package/dist/types/navigate.d.ts +6 -0
- package/dist/types/navigate.js +0 -0
- package/dist/utils/index.d.ts +2 -0
- package/dist/utils/index.js +1 -0
- package/dist/utils/module-federation.d.ts +40 -0
- package/dist/utils/module-federation.js +182 -0
- package/package.json +66 -0
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ShowLoadingIndicatorFunction, TranslationFunction } from '@vanillabp/bc-shared';
|
|
2
|
+
|
|
3
|
+
declare const NoElementGivenByModule: ({ loading, retry, showLoadingIndicator, t, }: {
|
|
4
|
+
loading?: boolean | undefined;
|
|
5
|
+
retry?: ((callback?: () => void) => void) | undefined;
|
|
6
|
+
showLoadingIndicator: ShowLoadingIndicatorFunction;
|
|
7
|
+
t: TranslationFunction;
|
|
8
|
+
}) => JSX.Element;
|
|
9
|
+
|
|
10
|
+
export { NoElementGivenByModule };
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import "../chunk-YH4NJHER.js";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useEffect } from "react";
|
|
4
|
+
import { Box, Button, Text } from "grommet";
|
|
5
|
+
const NoElementGivenByModule = ({
|
|
6
|
+
loading = false,
|
|
7
|
+
retry,
|
|
8
|
+
showLoadingIndicator,
|
|
9
|
+
t
|
|
10
|
+
}) => {
|
|
11
|
+
useEffect(() => {
|
|
12
|
+
showLoadingIndicator(loading);
|
|
13
|
+
}, [showLoadingIndicator, loading]);
|
|
14
|
+
const retryLoadingModule = () => {
|
|
15
|
+
showLoadingIndicator(true);
|
|
16
|
+
if (retry) {
|
|
17
|
+
retry(() => showLoadingIndicator(false));
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
return /* @__PURE__ */ jsx(
|
|
21
|
+
Box,
|
|
22
|
+
{
|
|
23
|
+
fill: "horizontal",
|
|
24
|
+
margin: { top: "large" },
|
|
25
|
+
align: "center",
|
|
26
|
+
children: loading ? void 0 : retry ? /* @__PURE__ */ jsxs(
|
|
27
|
+
Box,
|
|
28
|
+
{
|
|
29
|
+
direction: "column",
|
|
30
|
+
gap: "medium",
|
|
31
|
+
children: [
|
|
32
|
+
/* @__PURE__ */ jsx(Box, { children: t("retry-loading-module-hint") }),
|
|
33
|
+
/* @__PURE__ */ jsx(
|
|
34
|
+
Button,
|
|
35
|
+
{
|
|
36
|
+
label: t("retry-loading-module"),
|
|
37
|
+
onClick: retryLoadingModule
|
|
38
|
+
}
|
|
39
|
+
)
|
|
40
|
+
]
|
|
41
|
+
}
|
|
42
|
+
) : /* @__PURE__ */ jsx(
|
|
43
|
+
Text,
|
|
44
|
+
{
|
|
45
|
+
weight: "bold",
|
|
46
|
+
children: t("module-unknown")
|
|
47
|
+
}
|
|
48
|
+
)
|
|
49
|
+
}
|
|
50
|
+
);
|
|
51
|
+
};
|
|
52
|
+
export {
|
|
53
|
+
NoElementGivenByModule
|
|
54
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ShowLoadingIndicatorFunction, TranslationFunction } from '@vanillabp/bc-shared';
|
|
2
|
+
|
|
3
|
+
declare const NoUserTaskGiven: ({ loading, retry, showLoadingIndicator, t, }: {
|
|
4
|
+
loading?: boolean | undefined;
|
|
5
|
+
retry?: ((callback?: () => void) => void) | undefined;
|
|
6
|
+
showLoadingIndicator: ShowLoadingIndicatorFunction;
|
|
7
|
+
t: TranslationFunction;
|
|
8
|
+
}) => JSX.Element;
|
|
9
|
+
|
|
10
|
+
export { NoUserTaskGiven };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import "../chunk-YH4NJHER.js";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { UserTaskAppLayout } from "@vanillabp/bc-shared";
|
|
4
|
+
import { NoElementGivenByModule } from "./index.js";
|
|
5
|
+
const NoUserTaskGiven = ({
|
|
6
|
+
loading = false,
|
|
7
|
+
retry,
|
|
8
|
+
showLoadingIndicator,
|
|
9
|
+
t
|
|
10
|
+
}) => {
|
|
11
|
+
return /* @__PURE__ */ jsx(UserTaskAppLayout, { children: /* @__PURE__ */ jsx(
|
|
12
|
+
NoElementGivenByModule,
|
|
13
|
+
{
|
|
14
|
+
loading,
|
|
15
|
+
t,
|
|
16
|
+
showLoadingIndicator,
|
|
17
|
+
retry
|
|
18
|
+
}
|
|
19
|
+
) });
|
|
20
|
+
};
|
|
21
|
+
export {
|
|
22
|
+
NoUserTaskGiven
|
|
23
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ShowLoadingIndicatorFunction, TranslationFunction } from '@vanillabp/bc-shared';
|
|
2
|
+
|
|
3
|
+
declare const NoWorkflowGiven: ({ loading, retry, showLoadingIndicator, t, }: {
|
|
4
|
+
loading?: boolean | undefined;
|
|
5
|
+
retry?: ((callback?: () => void) => void) | undefined;
|
|
6
|
+
showLoadingIndicator: ShowLoadingIndicatorFunction;
|
|
7
|
+
t: TranslationFunction;
|
|
8
|
+
}) => JSX.Element;
|
|
9
|
+
|
|
10
|
+
export { NoWorkflowGiven };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import "../chunk-YH4NJHER.js";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { NoElementGivenByModule } from "./index.js";
|
|
4
|
+
const NoWorkflowGiven = ({
|
|
5
|
+
loading = false,
|
|
6
|
+
retry,
|
|
7
|
+
showLoadingIndicator,
|
|
8
|
+
t
|
|
9
|
+
}) => {
|
|
10
|
+
return /* @__PURE__ */ jsx(
|
|
11
|
+
NoElementGivenByModule,
|
|
12
|
+
{
|
|
13
|
+
loading,
|
|
14
|
+
showLoadingIndicator,
|
|
15
|
+
retry,
|
|
16
|
+
t
|
|
17
|
+
}
|
|
18
|
+
);
|
|
19
|
+
};
|
|
20
|
+
export {
|
|
21
|
+
NoWorkflowGiven
|
|
22
|
+
};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import React__default, { MutableRefObject, ReactNode } from 'react';
|
|
2
|
+
import { ColumnConfig } from 'grommet';
|
|
3
|
+
import { ListItemStatus, ShowLoadingIndicatorFunction } from '@vanillabp/bc-shared';
|
|
4
|
+
import { BackgroundType, ColorType } from 'grommet/utils';
|
|
5
|
+
|
|
6
|
+
declare type ListItemData = {
|
|
7
|
+
id: string;
|
|
8
|
+
version?: number;
|
|
9
|
+
createdAt: Date;
|
|
10
|
+
updatedAt: Date;
|
|
11
|
+
endedAt?: Date;
|
|
12
|
+
read?: Date;
|
|
13
|
+
};
|
|
14
|
+
interface ListItem<T extends ListItemData> {
|
|
15
|
+
id: string;
|
|
16
|
+
number: number;
|
|
17
|
+
data: T;
|
|
18
|
+
status: ListItemStatus;
|
|
19
|
+
selected: boolean;
|
|
20
|
+
read?: Date;
|
|
21
|
+
}
|
|
22
|
+
interface ListItems<T extends ListItemData> {
|
|
23
|
+
serverTimestamp: Date;
|
|
24
|
+
items: Array<T>;
|
|
25
|
+
}
|
|
26
|
+
declare type RetrieveItemsFunction = <T extends ListItemData>(pageNumber: number, pageSize: number, initialTimestamp: Date | undefined) => Promise<ListItems<T>>;
|
|
27
|
+
declare type ReloadItemsFunction = <T extends ListItemData>(numberOfItems: number, knownItemsIds: Array<string>, initialTimestamp: Date | undefined) => Promise<ListItems<T>>;
|
|
28
|
+
declare type RefreshNecessaryFunction = () => void;
|
|
29
|
+
declare type ReloadCallbackFunction = (updatedItemsIds: Array<string>) => Promise<void>;
|
|
30
|
+
declare type RefreshItemCallbackFunction = (itemIds: Array<string>) => void;
|
|
31
|
+
declare const SearchableAndSortableUpdatingList: <T extends ListItemData>({ itemsRef, updateListRef, refreshItemRef, retrieveItems, reloadItems, refreshNecessaryCallback, columns, showLoadingIndicator, additionalHeader, minWidthOfAutoColumn, rowSeparator, applyBackgroundColor, showColumnHeaders, columnHeaderBackground, columnHeaderSeparator, }: {
|
|
32
|
+
itemsRef: React__default.MutableRefObject<ListItem<T>[] | undefined>;
|
|
33
|
+
updateListRef: MutableRefObject<ReloadCallbackFunction | undefined>;
|
|
34
|
+
refreshItemRef?: React__default.MutableRefObject<RefreshItemCallbackFunction | undefined> | undefined;
|
|
35
|
+
retrieveItems: RetrieveItemsFunction;
|
|
36
|
+
reloadItems: ReloadItemsFunction;
|
|
37
|
+
refreshNecessaryCallback?: RefreshNecessaryFunction | undefined;
|
|
38
|
+
columns: ColumnConfig<any>[];
|
|
39
|
+
showLoadingIndicator: ShowLoadingIndicatorFunction;
|
|
40
|
+
additionalHeader?: ReactNode;
|
|
41
|
+
minWidthOfAutoColumn?: string | undefined;
|
|
42
|
+
rowSeparator?: string | boolean | undefined;
|
|
43
|
+
applyBackgroundColor?: boolean | undefined;
|
|
44
|
+
showColumnHeaders?: boolean | undefined;
|
|
45
|
+
columnHeaderBackground?: BackgroundType | undefined;
|
|
46
|
+
columnHeaderSeparator?: ColorType | null;
|
|
47
|
+
}) => JSX.Element;
|
|
48
|
+
|
|
49
|
+
export { ListItem, ListItemData, ListItems, RefreshItemCallbackFunction, ReloadCallbackFunction, SearchableAndSortableUpdatingList };
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
import {
|
|
2
|
+
__async,
|
|
3
|
+
__spreadProps,
|
|
4
|
+
__spreadValues
|
|
5
|
+
} from "../chunk-YH4NJHER.js";
|
|
6
|
+
import { jsx } from "react/jsx-runtime";
|
|
7
|
+
import { useCallback, useEffect, useRef, useState } from "react";
|
|
8
|
+
import { Box } from "grommet";
|
|
9
|
+
import { SnapScrollingDataTable } from "./SnapScrollingDataTable.js";
|
|
10
|
+
import { keepOldItemsInArray, ListItemStatus } from "@vanillabp/bc-shared";
|
|
11
|
+
const itemsBatchSize = 30;
|
|
12
|
+
;
|
|
13
|
+
;
|
|
14
|
+
const loadItems = (retrieveItems, setItems, items, initialTimestamp) => __async(void 0, null, function* () {
|
|
15
|
+
const result = yield retrieveItems(
|
|
16
|
+
items === void 0 ? 0 : items.length % itemsBatchSize === 0 ? Math.floor(items.length / itemsBatchSize) : Math.floor(items.length / itemsBatchSize) + 1,
|
|
17
|
+
itemsBatchSize,
|
|
18
|
+
initialTimestamp.current
|
|
19
|
+
);
|
|
20
|
+
const currentNumberOfItems = items === void 0 ? 1 : items.length + 1;
|
|
21
|
+
const newItems = result.items.map((item, index) => ({
|
|
22
|
+
id: item.id,
|
|
23
|
+
data: item,
|
|
24
|
+
number: currentNumberOfItems + index,
|
|
25
|
+
selected: false,
|
|
26
|
+
status: item.endedAt === void 0 ? ListItemStatus.INITIAL : ListItemStatus.ENDED,
|
|
27
|
+
read: item.read
|
|
28
|
+
}));
|
|
29
|
+
setItems(
|
|
30
|
+
items === void 0 ? newItems : items.concat(newItems)
|
|
31
|
+
);
|
|
32
|
+
return result.serverTimestamp;
|
|
33
|
+
});
|
|
34
|
+
const reloadData = (reloadItems, setItems, items, updatedItemsIds, initialTimestamp, refreshNecessaryCallback) => __async(void 0, null, function* () {
|
|
35
|
+
const prefill = 2;
|
|
36
|
+
const size = (items.length === 0 ? prefill : Math.floor(items.length / itemsBatchSize) + prefill) * itemsBatchSize;
|
|
37
|
+
const result = yield reloadItems(
|
|
38
|
+
size,
|
|
39
|
+
items.filter((item) => !updatedItemsIds.includes(item.id)).map((item) => item.id),
|
|
40
|
+
initialTimestamp.current
|
|
41
|
+
);
|
|
42
|
+
const mappedResult = result.items.map((item, index) => ({
|
|
43
|
+
id: item.id,
|
|
44
|
+
data: item,
|
|
45
|
+
number: 1 + index,
|
|
46
|
+
selected: false,
|
|
47
|
+
status: item.version === 0 ? void 0 : Boolean(item.endedAt) && item.endedAt.getTime() > initialTimestamp.current.getTime() ? ListItemStatus.ENDED : item.createdAt.getTime() > initialTimestamp.current.getTime() ? ListItemStatus.NEW : item.updatedAt.getTime() > initialTimestamp.current.getTime() ? ListItemStatus.UPDATED : ListItemStatus.INITIAL,
|
|
48
|
+
read: item.read
|
|
49
|
+
}));
|
|
50
|
+
let anyUpdate = false;
|
|
51
|
+
const mergedItems = keepOldItemsInArray(
|
|
52
|
+
mappedResult,
|
|
53
|
+
items,
|
|
54
|
+
(item) => item.id,
|
|
55
|
+
(newItem, oldItem, index) => {
|
|
56
|
+
const itemInUpdateResponse = (newItem == null ? void 0 : newItem.status) !== void 0;
|
|
57
|
+
const result2 = itemInUpdateResponse ? newItem : oldItem;
|
|
58
|
+
if (newItem === void 0) {
|
|
59
|
+
if (result2 !== void 0) {
|
|
60
|
+
result2.status = ListItemStatus.REMOVED_FROM_LIST;
|
|
61
|
+
result2.number = index + 1;
|
|
62
|
+
}
|
|
63
|
+
anyUpdate = true;
|
|
64
|
+
} else if (itemInUpdateResponse) {
|
|
65
|
+
result2.number = index + 1;
|
|
66
|
+
anyUpdate = true;
|
|
67
|
+
}
|
|
68
|
+
return result2;
|
|
69
|
+
},
|
|
70
|
+
(first, second) => {
|
|
71
|
+
if ((first == null ? void 0 : first.id) === void 0) {
|
|
72
|
+
return (second == null ? void 0 : second.id) === void 0;
|
|
73
|
+
}
|
|
74
|
+
if ((second == null ? void 0 : second.id) === void 0) {
|
|
75
|
+
return true;
|
|
76
|
+
}
|
|
77
|
+
return first.number < second.number;
|
|
78
|
+
}
|
|
79
|
+
);
|
|
80
|
+
setItems(mergedItems);
|
|
81
|
+
if (anyUpdate && refreshNecessaryCallback) {
|
|
82
|
+
refreshNecessaryCallback();
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
const SearchableAndSortableUpdatingList = ({
|
|
86
|
+
itemsRef,
|
|
87
|
+
updateListRef,
|
|
88
|
+
refreshItemRef,
|
|
89
|
+
retrieveItems,
|
|
90
|
+
reloadItems,
|
|
91
|
+
refreshNecessaryCallback,
|
|
92
|
+
columns,
|
|
93
|
+
showLoadingIndicator,
|
|
94
|
+
additionalHeader,
|
|
95
|
+
minWidthOfAutoColumn,
|
|
96
|
+
rowSeparator,
|
|
97
|
+
applyBackgroundColor = true,
|
|
98
|
+
showColumnHeaders = true,
|
|
99
|
+
columnHeaderBackground = "dark-3",
|
|
100
|
+
columnHeaderSeparator
|
|
101
|
+
}) => {
|
|
102
|
+
const [items, _setItems] = useState(void 0);
|
|
103
|
+
const initialTimestamp = useRef(void 0);
|
|
104
|
+
const setItems = useCallback((newItems) => {
|
|
105
|
+
itemsRef.current = newItems;
|
|
106
|
+
_setItems(newItems);
|
|
107
|
+
}, [_setItems, itemsRef]);
|
|
108
|
+
const setSelected = useCallback(
|
|
109
|
+
(itemId, selected) => {
|
|
110
|
+
_setItems(items == null ? void 0 : items.map((item) => {
|
|
111
|
+
if (item.id === itemId) {
|
|
112
|
+
item.selected = selected;
|
|
113
|
+
}
|
|
114
|
+
return item;
|
|
115
|
+
}));
|
|
116
|
+
},
|
|
117
|
+
[_setItems, items]
|
|
118
|
+
);
|
|
119
|
+
useEffect(() => {
|
|
120
|
+
if (refreshItemRef) {
|
|
121
|
+
refreshItemRef.current = (itemIds) => setItems(items.map((item) => itemIds.includes(item.id) ? __spreadValues({}, item) : item));
|
|
122
|
+
}
|
|
123
|
+
updateListRef.current = (updatedItemsIds) => __async(void 0, null, function* () {
|
|
124
|
+
return yield reloadData(
|
|
125
|
+
reloadItems,
|
|
126
|
+
setItems,
|
|
127
|
+
items,
|
|
128
|
+
updatedItemsIds,
|
|
129
|
+
initialTimestamp,
|
|
130
|
+
refreshNecessaryCallback
|
|
131
|
+
);
|
|
132
|
+
});
|
|
133
|
+
if (initialTimestamp.current) {
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
136
|
+
initialTimestamp.current = /* @__PURE__ */ new Date();
|
|
137
|
+
const initList = () => __async(void 0, null, function* () {
|
|
138
|
+
showLoadingIndicator(true);
|
|
139
|
+
const result = yield loadItems(
|
|
140
|
+
retrieveItems,
|
|
141
|
+
setItems,
|
|
142
|
+
items,
|
|
143
|
+
initialTimestamp
|
|
144
|
+
);
|
|
145
|
+
initialTimestamp.current = result;
|
|
146
|
+
showLoadingIndicator(false);
|
|
147
|
+
});
|
|
148
|
+
initList();
|
|
149
|
+
}, [showLoadingIndicator, items, retrieveItems, reloadItems, setItems, initialTimestamp, updateListRef]);
|
|
150
|
+
const headerHeight = "auto";
|
|
151
|
+
const colorRowAccordingToUpdateStatus = items == null ? void 0 : items.reduce((props, item) => {
|
|
152
|
+
if (item === void 0) {
|
|
153
|
+
return props;
|
|
154
|
+
}
|
|
155
|
+
if (item.status === void 0) {
|
|
156
|
+
return __spreadProps(__spreadValues({}, props), {
|
|
157
|
+
[item.id]: {
|
|
158
|
+
background: { color: "light-2", opacity: 0.5 }
|
|
159
|
+
}
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
if (item.status !== ListItemStatus.INITIAL) {
|
|
163
|
+
return __spreadProps(__spreadValues({}, props), {
|
|
164
|
+
[item.id]: {
|
|
165
|
+
background: item.status === ListItemStatus.NEW ? { color: "accent-3", opacity: 0.1 } : item.status === ListItemStatus.UPDATED ? { color: "accent-1", opacity: 0.15 } : item.status === ListItemStatus.ENDED ? { color: "light-2", opacity: 0.5 } : item.status === ListItemStatus.REMOVED_FROM_LIST ? { color: "light-2", opacity: 0.5 } : void 0
|
|
166
|
+
}
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
return props;
|
|
170
|
+
}, {});
|
|
171
|
+
return /* @__PURE__ */ jsx(
|
|
172
|
+
Box,
|
|
173
|
+
{
|
|
174
|
+
fill: true,
|
|
175
|
+
children: /* @__PURE__ */ jsx(
|
|
176
|
+
SnapScrollingDataTable,
|
|
177
|
+
{
|
|
178
|
+
pin: true,
|
|
179
|
+
minWidthOfAutoColumn,
|
|
180
|
+
additionalHeader,
|
|
181
|
+
border: rowSeparator ? { body: { side: "bottom", color: typeof rowSeparator === "string" ? rowSeparator : "light-3" } } : void 0,
|
|
182
|
+
rowProps: applyBackgroundColor ? colorRowAccordingToUpdateStatus : void 0,
|
|
183
|
+
size: "100%",
|
|
184
|
+
columns,
|
|
185
|
+
step: itemsBatchSize,
|
|
186
|
+
headerHeight,
|
|
187
|
+
showColumnHeaders,
|
|
188
|
+
columnHeaderBackground,
|
|
189
|
+
columnHeaderSeparator,
|
|
190
|
+
onMore: () => loadItems(retrieveItems, setItems, items, initialTimestamp),
|
|
191
|
+
data: items,
|
|
192
|
+
replace: true
|
|
193
|
+
}
|
|
194
|
+
)
|
|
195
|
+
}
|
|
196
|
+
);
|
|
197
|
+
};
|
|
198
|
+
export {
|
|
199
|
+
SearchableAndSortableUpdatingList
|
|
200
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as styled_components from 'styled-components';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { GridExtendedProps, BoxExtendedProps } from 'grommet';
|
|
4
|
+
import * as CSS from 'csstype';
|
|
5
|
+
|
|
6
|
+
interface SnapScrollingGridProps extends GridExtendedProps {
|
|
7
|
+
snapDirection: 'horizontal' | 'vertical';
|
|
8
|
+
}
|
|
9
|
+
declare const SnapScrollingGrid: styled_components.StyledComponent<React.FC<GridExtendedProps>, any, SnapScrollingGridProps, never>;
|
|
10
|
+
interface SnapAlignBoxProps extends BoxExtendedProps {
|
|
11
|
+
snapAlign: CSS.Property.ScrollSnapAlign;
|
|
12
|
+
}
|
|
13
|
+
declare const SnapAlignBox: styled_components.StyledComponent<React.FC<BoxExtendedProps>, any, SnapAlignBoxProps, never>;
|
|
14
|
+
|
|
15
|
+
export { SnapAlignBox, SnapScrollingGrid };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import "../chunk-YH4NJHER.js";
|
|
2
|
+
import { Box, Grid } from "grommet";
|
|
3
|
+
import styled from "styled-components";
|
|
4
|
+
;
|
|
5
|
+
const SnapScrollingGrid = styled(Grid)`
|
|
6
|
+
overflow-${(props) => props.snapDirection === "horizontal" ? "x" : "y"}: auto;
|
|
7
|
+
scroll-snap-type: ${(props) => props.snapDirection === "horizontal" ? "x" : "y"} mandatory;
|
|
8
|
+
scroll-behavior: smooth;
|
|
9
|
+
`;
|
|
10
|
+
;
|
|
11
|
+
const SnapAlignBox = styled(Box)`
|
|
12
|
+
scroll-snap-align: ${(props) => props.snapAlign ? props.snapAlign : "start"};
|
|
13
|
+
`;
|
|
14
|
+
export {
|
|
15
|
+
SnapAlignBox,
|
|
16
|
+
SnapScrollingGrid
|
|
17
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { DataTableExtendedProps, ColumnConfig } from 'grommet';
|
|
2
|
+
import React__default, { PropsWithChildren, ReactNode, UIEventHandler } from 'react';
|
|
3
|
+
import { BackgroundType, ColorType } from 'grommet/utils';
|
|
4
|
+
|
|
5
|
+
interface SnapScrollingDataTableProps<TRowType = any> extends PropsWithChildren<Omit<DataTableExtendedProps<TRowType>, 'columns' | 'ref'>> {
|
|
6
|
+
additionalHeader?: ReactNode | undefined;
|
|
7
|
+
headerHeight: string;
|
|
8
|
+
onScroll?: UIEventHandler<any> | undefined;
|
|
9
|
+
columns: ColumnConfig<TRowType>[];
|
|
10
|
+
minWidthOfAutoColumn?: string;
|
|
11
|
+
showColumnHeaders?: boolean;
|
|
12
|
+
columnHeaderBackground?: BackgroundType;
|
|
13
|
+
columnHeaderSeparator?: ColorType | null;
|
|
14
|
+
}
|
|
15
|
+
declare const SnapScrollingDataTable: React__default.ForwardRefExoticComponent<SnapScrollingDataTableProps<any> & React__default.RefAttributes<unknown>>;
|
|
16
|
+
|
|
17
|
+
export { SnapScrollingDataTable };
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import {
|
|
2
|
+
__objRest,
|
|
3
|
+
__spreadProps,
|
|
4
|
+
__spreadValues
|
|
5
|
+
} from "../chunk-YH4NJHER.js";
|
|
6
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
import { Box, DataTable, Grid, Text } from "grommet";
|
|
8
|
+
import { SnapAlignBox, SnapScrollingGrid } from "./SnapScrolling.js";
|
|
9
|
+
import { forwardRef } from "react";
|
|
10
|
+
;
|
|
11
|
+
const calculateColumWidth = (minWidthOfAutoColumn, width, column) => {
|
|
12
|
+
const columnSize = column.size ? column.size : minWidthOfAutoColumn;
|
|
13
|
+
return width !== "" ? width + " + " + columnSize : columnSize;
|
|
14
|
+
};
|
|
15
|
+
const SnapScrollingDataTable = forwardRef((_a, ref) => {
|
|
16
|
+
var _b = _a, {
|
|
17
|
+
headerHeight,
|
|
18
|
+
additionalHeader,
|
|
19
|
+
columns,
|
|
20
|
+
onScroll,
|
|
21
|
+
children,
|
|
22
|
+
minWidthOfAutoColumn,
|
|
23
|
+
showColumnHeaders = true,
|
|
24
|
+
columnHeaderBackground = "dark-3",
|
|
25
|
+
columnHeaderSeparator
|
|
26
|
+
} = _b, props = __objRest(_b, [
|
|
27
|
+
"headerHeight",
|
|
28
|
+
"additionalHeader",
|
|
29
|
+
"columns",
|
|
30
|
+
"onScroll",
|
|
31
|
+
"children",
|
|
32
|
+
"minWidthOfAutoColumn",
|
|
33
|
+
"showColumnHeaders",
|
|
34
|
+
"columnHeaderBackground",
|
|
35
|
+
"columnHeaderSeparator"
|
|
36
|
+
]);
|
|
37
|
+
const columnsWidth = columns.reduce((width, column) => calculateColumWidth(minWidthOfAutoColumn, width, column), "");
|
|
38
|
+
const dataTableColumns = columns.map((column) => __spreadProps(__spreadValues({}, column), { header: void 0 }));
|
|
39
|
+
return columns ? /* @__PURE__ */ jsxs(
|
|
40
|
+
SnapScrollingGrid,
|
|
41
|
+
{
|
|
42
|
+
fill: true,
|
|
43
|
+
rows: ["max-content", "auto"],
|
|
44
|
+
style: { overflow: "auto" },
|
|
45
|
+
snapDirection: "horizontal",
|
|
46
|
+
onScroll,
|
|
47
|
+
children: [
|
|
48
|
+
/* @__PURE__ */ jsxs(
|
|
49
|
+
Box,
|
|
50
|
+
{
|
|
51
|
+
width: "100%",
|
|
52
|
+
style: {
|
|
53
|
+
position: "sticky",
|
|
54
|
+
top: "0",
|
|
55
|
+
zIndex: 2,
|
|
56
|
+
minWidth: "auto"
|
|
57
|
+
},
|
|
58
|
+
background: columnHeaderBackground,
|
|
59
|
+
align: "center",
|
|
60
|
+
children: [
|
|
61
|
+
additionalHeader,
|
|
62
|
+
showColumnHeaders ? /* @__PURE__ */ jsx(
|
|
63
|
+
Grid,
|
|
64
|
+
{
|
|
65
|
+
fill: true,
|
|
66
|
+
columns: columns.map((column) => column.size ? column.size : "auto"),
|
|
67
|
+
style: {
|
|
68
|
+
maxHeight: headerHeight,
|
|
69
|
+
minHeight: headerHeight,
|
|
70
|
+
marginLeft: "auto",
|
|
71
|
+
marginRight: "auto",
|
|
72
|
+
zIndex: "2"
|
|
73
|
+
},
|
|
74
|
+
children: columns.map((column, index) => /* @__PURE__ */ jsx(
|
|
75
|
+
SnapAlignBox,
|
|
76
|
+
{
|
|
77
|
+
style: column.size === void 0 ? { minWidth: columnHeaderSeparator === null ? minWidthOfAutoColumn : `calc(${minWidthOfAutoColumn} - 1px)` } : { width: columnHeaderSeparator === null ? column.size : `calc(${column.size} - 1px)` },
|
|
78
|
+
align: "left",
|
|
79
|
+
justify: "center",
|
|
80
|
+
height: "100%",
|
|
81
|
+
border: index === 0 || columnHeaderSeparator === null ? void 0 : { side: "left", color: columnHeaderSeparator },
|
|
82
|
+
snapAlign: "center",
|
|
83
|
+
children: column.header instanceof String ? /* @__PURE__ */ jsx(
|
|
84
|
+
Text,
|
|
85
|
+
{
|
|
86
|
+
color: "light-2",
|
|
87
|
+
truncate: "tip",
|
|
88
|
+
children: column.header
|
|
89
|
+
}
|
|
90
|
+
) : column.header
|
|
91
|
+
},
|
|
92
|
+
`column${index}`
|
|
93
|
+
))
|
|
94
|
+
}
|
|
95
|
+
) : void 0
|
|
96
|
+
]
|
|
97
|
+
}
|
|
98
|
+
),
|
|
99
|
+
/* @__PURE__ */ jsx(
|
|
100
|
+
DataTable,
|
|
101
|
+
__spreadValues({
|
|
102
|
+
pad: "none",
|
|
103
|
+
width: columnsWidth,
|
|
104
|
+
columns: dataTableColumns
|
|
105
|
+
}, props)
|
|
106
|
+
)
|
|
107
|
+
]
|
|
108
|
+
}
|
|
109
|
+
) : /* @__PURE__ */ jsx(Fragment, {});
|
|
110
|
+
});
|
|
111
|
+
export {
|
|
112
|
+
SnapScrollingDataTable
|
|
113
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { User as User$1 } from '@vanillabp/bc-official-gui-client';
|
|
2
|
+
|
|
3
|
+
declare type CurrentUserProps = {
|
|
4
|
+
user: User$1;
|
|
5
|
+
isUserLoggedIn?: boolean;
|
|
6
|
+
size?: 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge' | string;
|
|
7
|
+
iconSize?: 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge' | string;
|
|
8
|
+
};
|
|
9
|
+
declare const User: ({ user, isUserLoggedIn, size, iconSize, }: CurrentUserProps) => JSX.Element;
|
|
10
|
+
|
|
11
|
+
export { User };
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import "../chunk-YH4NJHER.js";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { Grid, Text } from "grommet";
|
|
4
|
+
import { UserAvatar } from "./UserAvatar.js";
|
|
5
|
+
const User = ({
|
|
6
|
+
user,
|
|
7
|
+
isUserLoggedIn = false,
|
|
8
|
+
size = "medium",
|
|
9
|
+
iconSize
|
|
10
|
+
}) => /* @__PURE__ */ jsxs(
|
|
11
|
+
Grid,
|
|
12
|
+
{
|
|
13
|
+
fill: "horizontal",
|
|
14
|
+
gap: "small",
|
|
15
|
+
columns: ["auto", "auto", "flex"],
|
|
16
|
+
align: "center",
|
|
17
|
+
children: [
|
|
18
|
+
/* @__PURE__ */ jsx(
|
|
19
|
+
UserAvatar,
|
|
20
|
+
{
|
|
21
|
+
user,
|
|
22
|
+
isUserLoggedIn,
|
|
23
|
+
size: iconSize !== void 0 ? iconSize : size
|
|
24
|
+
}
|
|
25
|
+
),
|
|
26
|
+
/* @__PURE__ */ jsx(
|
|
27
|
+
Text,
|
|
28
|
+
{
|
|
29
|
+
size,
|
|
30
|
+
truncate: "tip",
|
|
31
|
+
children: !Boolean(user.lastName) ? !Boolean(user.email) ? user.id : user.email : Boolean(user.firstName) ? `${user.firstName} ${user.lastName}` : user.lastName
|
|
32
|
+
}
|
|
33
|
+
)
|
|
34
|
+
]
|
|
35
|
+
}
|
|
36
|
+
);
|
|
37
|
+
export {
|
|
38
|
+
User
|
|
39
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { User } from '@vanillabp/bc-official-gui-client';
|
|
2
|
+
import { BorderType } from 'grommet/utils';
|
|
3
|
+
|
|
4
|
+
declare type UserAvatarProps = {
|
|
5
|
+
user: User;
|
|
6
|
+
isUserLoggedIn?: boolean;
|
|
7
|
+
border?: BorderType;
|
|
8
|
+
size?: 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge' | string;
|
|
9
|
+
};
|
|
10
|
+
declare const UserAvatar: ({ user, isUserLoggedIn, border, size, }: UserAvatarProps) => JSX.Element;
|
|
11
|
+
|
|
12
|
+
export { UserAvatar };
|