@hortiview/shared-components 0.0.5189 → 0.0.5404

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.
Files changed (29) hide show
  1. package/README.md +127 -27
  2. package/dist/BigLoadingSpinner-Df2k3xOD.js +18 -0
  3. package/dist/assets/BigLoadingSpinner.css +1 -0
  4. package/dist/assets/GenericTable.css +1 -0
  5. package/dist/assets/LoadingSpinner.css +1 -0
  6. package/dist/components/ContextMenu/ContextMenu.d.ts +6 -1
  7. package/dist/components/ContextMenu/ContextMenu.js +21 -17
  8. package/dist/components/GenericTable/GenericTable.d.ts +53 -0
  9. package/dist/components/GenericTable/GenericTable.js +89 -0
  10. package/dist/components/GenericTable/GenericTable.test.d.ts +1 -0
  11. package/dist/components/GenericTable/GenericTable.test.js +40 -0
  12. package/dist/components/Iconify/Iconify.d.ts +16 -0
  13. package/dist/components/Iconify/Iconify.js +105 -20
  14. package/dist/components/Iconify/Iconify.test.js +24 -21
  15. package/dist/components/LoadingSpinner/Big/BigLoadingSpinner.d.ts +5 -0
  16. package/dist/components/LoadingSpinner/Big/BigLoadingSpinner.js +7 -0
  17. package/dist/components/LoadingSpinner/Big/BigLoadingSpinner.test.d.ts +1 -0
  18. package/dist/components/LoadingSpinner/Big/BigLoadingSpinner.test.js +15 -0
  19. package/dist/components/LoadingSpinner/Default/LoadingSpinner.d.ts +42 -0
  20. package/dist/components/LoadingSpinner/Default/LoadingSpinner.js +37 -0
  21. package/dist/components/LoadingSpinner/Default/LoadingSpinner.test.d.ts +1 -0
  22. package/dist/components/LoadingSpinner/Default/LoadingSpinner.test.js +13 -0
  23. package/dist/enums/AvailableCustomIcons.d.ts +18 -12
  24. package/dist/enums/AvailableCustomIcons.js +2 -2
  25. package/dist/main.d.ts +3 -0
  26. package/dist/main.js +43 -39
  27. package/dist/types/GenericTable.d.ts +100 -0
  28. package/dist/types/GenericTable.js +1 -0
  29. package/package.json +2 -2
@@ -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.5189",
4
+ "version": "0.0.5404",
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
- "dev": "vite",
21
+ "start": "vite",
22
22
  "build": "tsc --p ./tsconfig-build.json && vite build",
23
23
  "test": "vitest",
24
24
  "test:ci": "vitest run --coverage",