@vanillabp/bc-shared 0.0.5 → 0.0.7
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.
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import { BoxExtendedProps, TextExtendedProps } from 'grommet';
|
|
2
2
|
import { ColorType, BackgroundType } from 'grommet/utils/index.js';
|
|
3
3
|
import React, { PropsWithChildren, FC } from 'react';
|
|
4
|
-
import { ListItem, Column } from '../types/ListCell.js';
|
|
4
|
+
import { ListItem, Column, Person } from '../types/ListCell.js';
|
|
5
5
|
import { TranslationFunction } from '../types/translate.js';
|
|
6
6
|
|
|
7
7
|
declare const ENDED_FONT_COLOR_ODD = "#b4b4b4";
|
|
8
8
|
declare type Alignment = 'left' | 'center' | 'right';
|
|
9
9
|
declare const textColorAccordingToStatus: (item: ListItem<any>) => ColorType | undefined;
|
|
10
10
|
interface ListCellProps extends BoxExtendedProps {
|
|
11
|
-
background?: BackgroundType;
|
|
12
11
|
align?: Alignment;
|
|
13
12
|
}
|
|
14
13
|
declare const ListCell: React.FC<PropsWithChildren<ListCellProps>>;
|
|
@@ -18,7 +17,6 @@ interface TextListCellProps extends TextExtendedProps {
|
|
|
18
17
|
column: string;
|
|
19
18
|
tip?: string;
|
|
20
19
|
showUnreadAsBold?: boolean;
|
|
21
|
-
background?: BackgroundType;
|
|
22
20
|
align?: Alignment;
|
|
23
21
|
}
|
|
24
22
|
declare const TextListCell: React.FC<TextListCellProps>;
|
|
@@ -28,6 +26,7 @@ interface DefaultListCellProps<D> {
|
|
|
28
26
|
column: Column;
|
|
29
27
|
showUnreadAsBold?: boolean;
|
|
30
28
|
currentLanguage: string;
|
|
29
|
+
currentUser?: Person;
|
|
31
30
|
nameOfList?: string;
|
|
32
31
|
selectItem: (select: boolean) => void;
|
|
33
32
|
isPhone: boolean;
|
|
@@ -17,15 +17,13 @@ import { UserDetailsBox } from "./index.js";
|
|
|
17
17
|
const DATE_REGEXP = /^(\d{4})-(\d{2})-(\d{2})/;
|
|
18
18
|
const ENDED_FONT_COLOR_ODD = "#b4b4b4";
|
|
19
19
|
const textColorAccordingToStatus = (item) => {
|
|
20
|
-
return item.status === ListItemStatus.NEW ? "list-text-new" : item.status === ListItemStatus.UPDATED ? "list-text-updated" : item.status === ListItemStatus.ENDED ? "list-text-ended" : item.status === ListItemStatus.REMOVED_FROM_LIST ? "list-text-removed_from_list" :
|
|
20
|
+
return item.status === ListItemStatus.NEW ? "list-text-new" : item.status === ListItemStatus.UPDATED ? "list-text-updated" : item.status === ListItemStatus.ENDED ? "list-text-ended" : item.status === ListItemStatus.REMOVED_FROM_LIST ? "list-text-removed_from_list" : "list-text-default";
|
|
21
21
|
};
|
|
22
22
|
const ListCell = (_a) => {
|
|
23
23
|
var _b = _a, {
|
|
24
|
-
background,
|
|
25
24
|
align,
|
|
26
25
|
children
|
|
27
26
|
} = _b, props = __objRest(_b, [
|
|
28
|
-
"background",
|
|
29
27
|
"align",
|
|
30
28
|
"children"
|
|
31
29
|
]);
|
|
@@ -36,7 +34,6 @@ const ListCell = (_a) => {
|
|
|
36
34
|
align: "center",
|
|
37
35
|
direction: "row",
|
|
38
36
|
justify: align === "left" ? "start" : align === "right" ? "end" : "center",
|
|
39
|
-
background,
|
|
40
37
|
pad: "xsmall",
|
|
41
38
|
gap: "xsmall"
|
|
42
39
|
}, props), {
|
|
@@ -50,21 +47,18 @@ const TextListCell = memo((_c) => {
|
|
|
50
47
|
value = "",
|
|
51
48
|
align = "left",
|
|
52
49
|
tip,
|
|
53
|
-
showUnreadAsBold = false
|
|
54
|
-
background
|
|
50
|
+
showUnreadAsBold = false
|
|
55
51
|
} = _d, props = __objRest(_d, [
|
|
56
52
|
"item",
|
|
57
53
|
"value",
|
|
58
54
|
"align",
|
|
59
55
|
"tip",
|
|
60
|
-
"showUnreadAsBold"
|
|
61
|
-
"background"
|
|
56
|
+
"showUnreadAsBold"
|
|
62
57
|
]);
|
|
63
58
|
const color = textColorAccordingToStatus(item);
|
|
64
59
|
return /* @__PURE__ */ jsx(
|
|
65
60
|
ListCell,
|
|
66
61
|
{
|
|
67
|
-
background,
|
|
68
62
|
align,
|
|
69
63
|
children: tip === void 0 ? /* @__PURE__ */ jsx(
|
|
70
64
|
Text,
|
|
@@ -101,22 +95,19 @@ const PersonListCell = memo((_e) => {
|
|
|
101
95
|
item,
|
|
102
96
|
column,
|
|
103
97
|
value,
|
|
104
|
-
showUnreadAsBold = false
|
|
105
|
-
background
|
|
98
|
+
showUnreadAsBold = false
|
|
106
99
|
} = _f, props = __objRest(_f, [
|
|
107
100
|
"t",
|
|
108
101
|
"item",
|
|
109
102
|
"column",
|
|
110
103
|
"value",
|
|
111
|
-
"showUnreadAsBold"
|
|
112
|
-
"background"
|
|
104
|
+
"showUnreadAsBold"
|
|
113
105
|
]);
|
|
114
106
|
var _a, _b;
|
|
115
107
|
const color = textColorAccordingToStatus(item);
|
|
116
108
|
return /* @__PURE__ */ jsx(
|
|
117
109
|
ListCell,
|
|
118
110
|
{
|
|
119
|
-
background,
|
|
120
111
|
align: "left",
|
|
121
112
|
children: /* @__PURE__ */ jsx(
|
|
122
113
|
Text,
|
|
@@ -172,7 +163,7 @@ const render = (t, propertyValue, currentLanguage) => {
|
|
|
172
163
|
}
|
|
173
164
|
return { value, align };
|
|
174
165
|
};
|
|
175
|
-
const backgroundColorAccordingToStatus = (item) => item.status === ListItemStatus.NEW ? "list-new" : item.status === ListItemStatus.UPDATED ? "list-updated" : item.status === ListItemStatus.ENDED ? "list-ended" : item.status === ListItemStatus.REMOVED_FROM_LIST ? "list-removed_from_list" :
|
|
166
|
+
const backgroundColorAccordingToStatus = (item) => item.status === ListItemStatus.NEW ? "list-new" : item.status === ListItemStatus.UPDATED ? "list-updated" : item.status === ListItemStatus.ENDED ? "list-ended" : item.status === ListItemStatus.REMOVED_FROM_LIST ? "list-removed_from_list" : "list-default";
|
|
176
167
|
const DefaultListCell = ({
|
|
177
168
|
item,
|
|
178
169
|
column,
|
|
@@ -188,7 +179,6 @@ const DefaultListCell = ({
|
|
|
188
179
|
if (column.type === "i18n") {
|
|
189
180
|
path = `${path}.${currentLanguage}`;
|
|
190
181
|
}
|
|
191
|
-
const background = backgroundColorAccordingToStatus(item);
|
|
192
182
|
let propertyValue = getObjectProperty(item.data, path);
|
|
193
183
|
if (column.type === "date" && Boolean(propertyValue)) {
|
|
194
184
|
const date = Object.prototype.toString.call(propertyValue) === "[object Date]" ? propertyValue : new Date(propertyValue.toString());
|
|
@@ -212,8 +202,7 @@ const DefaultListCell = ({
|
|
|
212
202
|
item,
|
|
213
203
|
value: propertyValue,
|
|
214
204
|
column: column.path,
|
|
215
|
-
showUnreadAsBold
|
|
216
|
-
background
|
|
205
|
+
showUnreadAsBold
|
|
217
206
|
}
|
|
218
207
|
);
|
|
219
208
|
} else {
|
|
@@ -229,7 +218,6 @@ const DefaultListCell = ({
|
|
|
229
218
|
column: column.path,
|
|
230
219
|
tip,
|
|
231
220
|
showUnreadAsBold,
|
|
232
|
-
background,
|
|
233
221
|
align
|
|
234
222
|
}
|
|
235
223
|
);
|
package/dist/theme/index.js
CHANGED
|
@@ -12,6 +12,8 @@ const theme = {
|
|
|
12
12
|
"light-5": "#c7c7c7",
|
|
13
13
|
"light-6": "#b4b4b4",
|
|
14
14
|
"link": "#663300",
|
|
15
|
+
"list-default": "#ffffff",
|
|
16
|
+
"list-text-default": "#444444",
|
|
15
17
|
"list-new": "rgba(102, 51, 0, 0.1)",
|
|
16
18
|
"list-text-new": "dark-1",
|
|
17
19
|
"list-updated": "rgba(255, 230, 153, 0.15)",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vanillabp/bc-shared",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.7",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/vanillabp/business-cockpit.git"
|
|
@@ -17,14 +17,14 @@
|
|
|
17
17
|
],
|
|
18
18
|
"dependencies": {
|
|
19
19
|
"@microsoft/fetch-event-source": "2.0.1",
|
|
20
|
-
"@vanillabp/bc-official-gui-client": "0.0.
|
|
20
|
+
"@vanillabp/bc-official-gui-client": "0.0.7",
|
|
21
21
|
"react-cookie": "4.1.1",
|
|
22
22
|
"usehooks-ts": "2.7.1"
|
|
23
23
|
},
|
|
24
24
|
"peerDependencies": {
|
|
25
25
|
"@fontsource/roboto": "4.5.8",
|
|
26
26
|
"grommet": "2.33.2",
|
|
27
|
-
"grommet-icons": "4.
|
|
27
|
+
"grommet-icons": "4.12.1",
|
|
28
28
|
"react": "18.2.0",
|
|
29
29
|
"react-dom": "18.2.0",
|
|
30
30
|
"react-jsx": "1.0.0",
|