@hortiview/shared-components 0.0.5201 → 0.0.5409
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 +127 -27
- package/dist/BigLoadingSpinner-Df2k3xOD.js +18 -0
- package/dist/assets/BigLoadingSpinner.css +1 -0
- package/dist/assets/GenericTable.css +1 -0
- package/dist/assets/InfoGroup.css +1 -1
- package/dist/assets/LoadingSpinner.css +1 -0
- package/dist/components/GenericTable/GenericTable.d.ts +53 -0
- package/dist/components/GenericTable/GenericTable.js +89 -0
- package/dist/components/GenericTable/GenericTable.test.d.ts +1 -0
- package/dist/components/GenericTable/GenericTable.test.js +40 -0
- package/dist/components/Iconify/Iconify.d.ts +16 -0
- package/dist/components/Iconify/Iconify.js +105 -20
- package/dist/components/Iconify/Iconify.test.js +24 -21
- package/dist/components/InfoGroup/InfoGroup.js +57 -45
- package/dist/components/LoadingSpinner/Big/BigLoadingSpinner.d.ts +5 -0
- package/dist/components/LoadingSpinner/Big/BigLoadingSpinner.js +7 -0
- package/dist/components/LoadingSpinner/Big/BigLoadingSpinner.test.d.ts +1 -0
- package/dist/components/LoadingSpinner/Big/BigLoadingSpinner.test.js +15 -0
- package/dist/components/LoadingSpinner/Default/LoadingSpinner.d.ts +42 -0
- package/dist/components/LoadingSpinner/Default/LoadingSpinner.js +37 -0
- package/dist/components/LoadingSpinner/Default/LoadingSpinner.test.d.ts +1 -0
- package/dist/components/LoadingSpinner/Default/LoadingSpinner.test.js +13 -0
- package/dist/enums/AvailableCustomIcons.d.ts +18 -12
- package/dist/enums/AvailableCustomIcons.js +2 -2
- package/dist/main.d.ts +3 -0
- package/dist/main.js +43 -39
- package/dist/types/GenericTable.d.ts +100 -0
- package/dist/types/GenericTable.js +1 -0
- package/package.json +2 -2
package/dist/main.d.ts
CHANGED
|
@@ -7,11 +7,13 @@ export { ContextMenu } from './components/ContextMenu/ContextMenu';
|
|
|
7
7
|
export { DeleteModal } from './components/DeleteModal/DeleteModal';
|
|
8
8
|
export { Disclaimer } from './components/Disclaimer/Disclaimer';
|
|
9
9
|
export { EmptyView } from './components/EmptyView/EmptyView';
|
|
10
|
+
export { GenericTable } from './components/GenericTable/GenericTable';
|
|
10
11
|
export { HashTabView } from './components/HashTabView/HashTabView';
|
|
11
12
|
export { HeaderFilter } from './components/HeaderFilter/HeaderFilter';
|
|
12
13
|
export { Iconify } from './components/Iconify/Iconify';
|
|
13
14
|
export { InfoGroup } from './components/InfoGroup/InfoGroup';
|
|
14
15
|
export { ListArea } from './components/ListArea/ListArea';
|
|
16
|
+
export { LoadingSpinner } from './components/LoadingSpinner/Default/LoadingSpinner';
|
|
15
17
|
export { ScrollbarX, ScrollbarY } from './components/Scrollbar/Scrollbar';
|
|
16
18
|
export { SearchBar } from './components/SearchBar/SearchBar';
|
|
17
19
|
export { VerticalDivider } from './components/VerticalDivider/VerticalDivider';
|
|
@@ -27,3 +29,4 @@ export { capitalizeFirstLetters } from './services/UtilService';
|
|
|
27
29
|
export type { FieldItem } from './components/InfoGroup/InfoGroup';
|
|
28
30
|
export type { HashTab } from './types/HashTab';
|
|
29
31
|
export type { ListElement, BaseListElement } from './types/ListElement';
|
|
32
|
+
export type { CellTemplate, CellTemplateProps, TableLayoutProps } from './types/GenericTable';
|
package/dist/main.js
CHANGED
|
@@ -4,51 +4,55 @@ import { BaseView as p } from "./components/BaseView/BaseView.js";
|
|
|
4
4
|
import { BasicHeading as f } from "./components/BasicHeading/BasicHeading.js";
|
|
5
5
|
import { BlockView as i } from "./components/BlockView/BlockView.js";
|
|
6
6
|
import { ContextMenu as c } from "./components/ContextMenu/ContextMenu.js";
|
|
7
|
-
import { DeleteModal as
|
|
8
|
-
import { Disclaimer as
|
|
7
|
+
import { DeleteModal as s } from "./components/DeleteModal/DeleteModal.js";
|
|
8
|
+
import { Disclaimer as d } from "./components/Disclaimer/Disclaimer.js";
|
|
9
9
|
import { EmptyView as S } from "./components/EmptyView/EmptyView.js";
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
10
|
+
import { GenericTable as V } from "./components/GenericTable/GenericTable.js";
|
|
11
|
+
import { HashTabView as u } from "./components/HashTabView/HashTabView.js";
|
|
12
|
+
import { HeaderFilter as D } from "./components/HeaderFilter/HeaderFilter.js";
|
|
13
|
+
import { Iconify as A } from "./components/Iconify/Iconify.js";
|
|
14
|
+
import { InfoGroup as H } from "./components/InfoGroup/InfoGroup.js";
|
|
15
|
+
import { ListArea as L } from "./components/ListArea/ListArea.js";
|
|
16
|
+
import { LoadingSpinner as g } from "./components/LoadingSpinner/Default/LoadingSpinner.js";
|
|
17
|
+
import { ScrollbarX as y, ScrollbarY as G } from "./components/Scrollbar/Scrollbar.js";
|
|
18
|
+
import { SearchBar as z } from "./components/SearchBar/SearchBar.js";
|
|
19
|
+
import { VerticalDivider as P } from "./components/VerticalDivider/VerticalDivider.js";
|
|
20
|
+
import { FormCheckBox as X } from "./components/FormComponents/FormCheckBox/FormCheckBox.js";
|
|
21
|
+
import { FormDatePicker as j } from "./components/FormComponents/FormDatePicker/FormDatePicker.js";
|
|
22
|
+
import { FormRadio as J } from "./components/FormComponents/FormRadio/FormRadio.js";
|
|
23
|
+
import { FormSelect as N } from "./components/FormComponents/FormSelect/FormSelect.js";
|
|
24
|
+
import { FormSlider as Q } from "./components/FormComponents/FormSlider/FormSlider.js";
|
|
25
|
+
import { FormText as W } from "./components/FormComponents/FormText/FormText.js";
|
|
26
|
+
import { AvailableCustomIcons as _ } from "./enums/AvailableCustomIcons.js";
|
|
27
|
+
import { a as rr } from "./useBreakpoint-DROHPVxO.js";
|
|
28
|
+
import { capitalizeFirstLetters as er } from "./services/UtilService.js";
|
|
27
29
|
export {
|
|
28
30
|
t as AlertBanner,
|
|
29
|
-
|
|
31
|
+
_ as AvailableCustomIcons,
|
|
30
32
|
p as BaseView,
|
|
31
33
|
f as BasicHeading,
|
|
32
34
|
i as BlockView,
|
|
33
35
|
c as ContextMenu,
|
|
34
|
-
|
|
35
|
-
|
|
36
|
+
s as DeleteModal,
|
|
37
|
+
d as Disclaimer,
|
|
36
38
|
S as EmptyView,
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
u as
|
|
45
|
-
D as
|
|
46
|
-
A as
|
|
47
|
-
H as
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
39
|
+
X as FormCheckBox,
|
|
40
|
+
j as FormDatePicker,
|
|
41
|
+
J as FormRadio,
|
|
42
|
+
N as FormSelect,
|
|
43
|
+
Q as FormSlider,
|
|
44
|
+
W as FormText,
|
|
45
|
+
V as GenericTable,
|
|
46
|
+
u as HashTabView,
|
|
47
|
+
D as HeaderFilter,
|
|
48
|
+
A as Iconify,
|
|
49
|
+
H as InfoGroup,
|
|
50
|
+
L as ListArea,
|
|
51
|
+
g as LoadingSpinner,
|
|
52
|
+
y as ScrollbarX,
|
|
53
|
+
G as ScrollbarY,
|
|
54
|
+
z as SearchBar,
|
|
55
|
+
P as VerticalDivider,
|
|
56
|
+
er as capitalizeFirstLetters,
|
|
57
|
+
rr as useBreakpoints
|
|
54
58
|
};
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { ListItemProps } from '@element/react-components';
|
|
3
|
+
/**
|
|
4
|
+
* Props for the GenericTable component {@link GenericTable}
|
|
5
|
+
* @template T the type of the data that will be displayed in the table
|
|
6
|
+
*/
|
|
7
|
+
export type TableLayoutProps<T> = {
|
|
8
|
+
/**
|
|
9
|
+
* data to be displayed in the table, will be used to create the header if dataType is not provided
|
|
10
|
+
*/
|
|
11
|
+
data: T[];
|
|
12
|
+
/**
|
|
13
|
+
* columns to be hidden n the table, passed as an array of column ids (keys)
|
|
14
|
+
*/
|
|
15
|
+
hiddenColumns?: (keyof T)[];
|
|
16
|
+
/**
|
|
17
|
+
* order of the columns in the table, passed as an array of column ids (keys)
|
|
18
|
+
*/
|
|
19
|
+
order?: (keyof T)[];
|
|
20
|
+
/**
|
|
21
|
+
* cell templates to be applied to the cells as {key: function}-Object,
|
|
22
|
+
* @example
|
|
23
|
+
* ```jsx
|
|
24
|
+
* {
|
|
25
|
+
* Status: (props: CellTemplateProps<GenericElement>) => {
|
|
26
|
+
* const {status} = props.row.original;
|
|
27
|
+
* return <LabelBadge label={'Status'} themeColor={getColorForStatus(status)} />
|
|
28
|
+
* }
|
|
29
|
+
* }
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
cellTemplates?: CellTemplate<T>;
|
|
33
|
+
/**
|
|
34
|
+
* top bar elements to be displayed above the table (e.g. filters)
|
|
35
|
+
* @example
|
|
36
|
+
* ```jsx
|
|
37
|
+
* [
|
|
38
|
+
* <Button key='add' label='Add' onClick={somethingAwesome} />,
|
|
39
|
+
* <Select onChange={somethingEvenCooler} />
|
|
40
|
+
* ]
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
43
|
+
tableActions?: JSX.Element[];
|
|
44
|
+
/**
|
|
45
|
+
* text to be displayed when no data is available
|
|
46
|
+
*/
|
|
47
|
+
noContentText?: string;
|
|
48
|
+
/**
|
|
49
|
+
* whether to show pagination or not
|
|
50
|
+
*/
|
|
51
|
+
pagination?: boolean;
|
|
52
|
+
/**
|
|
53
|
+
* function that will be called to translate the headers by its key
|
|
54
|
+
* @param key the key of the header to get the translation for
|
|
55
|
+
* @returns a (hopefully) translated string for the header
|
|
56
|
+
*/
|
|
57
|
+
headerTranslation?: (key: string) => string;
|
|
58
|
+
/**
|
|
59
|
+
* function that will be called to get the actions for a row to be displayed as actions in a context menu
|
|
60
|
+
* @param row the row (element) that will be used in each action
|
|
61
|
+
* @returns an array of ListItemProps that will be shown as actions for the row
|
|
62
|
+
*/
|
|
63
|
+
getRowActions?: (row: T) => ListItemProps[];
|
|
64
|
+
};
|
|
65
|
+
/**
|
|
66
|
+
* Props for the CellTemplate component {@link CellTemplate}
|
|
67
|
+
* @template T the type of the data that will be displayed in the table
|
|
68
|
+
* @example
|
|
69
|
+
* ```jsx
|
|
70
|
+
* {
|
|
71
|
+
* Status: (props: CellTemplateProps<GenericElement>) => {
|
|
72
|
+
* const {status} = props.row.original;
|
|
73
|
+
* return <LabelBadge label={'Status'} themeColor={getColorForStatus(status)} />
|
|
74
|
+
* }
|
|
75
|
+
* }
|
|
76
|
+
* ```
|
|
77
|
+
*/
|
|
78
|
+
export type CellTemplateProps<T> = {
|
|
79
|
+
row: {
|
|
80
|
+
original: T;
|
|
81
|
+
};
|
|
82
|
+
};
|
|
83
|
+
/**
|
|
84
|
+
* CellTemplate type to be used in the GenericTable component {@link GenericTable}
|
|
85
|
+
* @template T the type of the data that will be displayed in the table aka the type of the row
|
|
86
|
+
* by default the table will display all keys of the row, if you want to change the way a cell is displayed you can use this type
|
|
87
|
+
* to define a function that will be called for each cell of the given key in the row
|
|
88
|
+
* @example
|
|
89
|
+
* ```jsx
|
|
90
|
+
* {
|
|
91
|
+
* Status: (props: CellTemplateProps<GenericElement>) => {
|
|
92
|
+
* const {status} = props.row.original;
|
|
93
|
+
* return <LabelBadge label={'Status'} themeColor={getColorForStatus(status)} />
|
|
94
|
+
* }
|
|
95
|
+
* }
|
|
96
|
+
* ```
|
|
97
|
+
*/
|
|
98
|
+
export type CellTemplate<T> = {
|
|
99
|
+
[key in keyof T]?: (props: CellTemplateProps<T>) => JSX.Element;
|
|
100
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hortiview/shared-components",
|
|
3
3
|
"description": "This is a shared component library. It should used in the HortiView platform and its modules.",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.5409",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": "https://dev.azure.com/sdundc/HV%20Platform/_git/HortiView-Frontend-Shared",
|
|
7
7
|
"author": "Falk Menge <falk.menge.ext@bayer.com>",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"registry": "https://registry.npmjs.org/"
|
|
19
19
|
},
|
|
20
20
|
"scripts": {
|
|
21
|
-
"
|
|
21
|
+
"start": "vite",
|
|
22
22
|
"build": "tsc --p ./tsconfig-build.json && vite build",
|
|
23
23
|
"test": "vitest",
|
|
24
24
|
"test:ci": "vitest run --coverage",
|