@bit.rhplus/ag-grid 0.0.112 → 0.0.113
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,6 +1,7 @@
|
|
|
1
1
|
/* eslint-disable */
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { createMemoComparison } from '@bit.rhplus/react-memo';
|
|
4
|
+
import Avatar from '@bit.rhplus/ui.avatar';
|
|
4
5
|
|
|
5
6
|
// Style constants
|
|
6
7
|
const CONTAINER_STYLE = {
|
|
@@ -13,6 +14,14 @@ const CONTAINER_STYLE = {
|
|
|
13
14
|
|
|
14
15
|
const CONTENT_STYLE = {
|
|
15
16
|
flexGrow: 1,
|
|
17
|
+
overflow: 'hidden',
|
|
18
|
+
textOverflow: 'ellipsis',
|
|
19
|
+
whiteSpace: 'nowrap',
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
const AVATAR_STYLE = {
|
|
23
|
+
marginRight: 6,
|
|
24
|
+
flexShrink: 0,
|
|
16
25
|
};
|
|
17
26
|
|
|
18
27
|
const BUTTON_STYLE = {
|
|
@@ -54,6 +63,11 @@ function ObjectRenderer(props) {
|
|
|
54
63
|
showOnGroup = false,
|
|
55
64
|
visibleGetter,
|
|
56
65
|
displayField,
|
|
66
|
+
currentUserLabel,
|
|
67
|
+
currentUserField,
|
|
68
|
+
currentUserKey,
|
|
69
|
+
showAvatar = false,
|
|
70
|
+
avatarKeyField,
|
|
57
71
|
} = props;
|
|
58
72
|
|
|
59
73
|
const [isHovered, setIsHovered] = React.useState(false);
|
|
@@ -105,6 +119,17 @@ function ObjectRenderer(props) {
|
|
|
105
119
|
return value;
|
|
106
120
|
}, [value, displayField, data, props]);
|
|
107
121
|
|
|
122
|
+
// Zjistit userKey z dat pro "Já" logiku a avatar
|
|
123
|
+
const userKey = currentUserField && data ? data[currentUserField] : null;
|
|
124
|
+
const avatarKey = avatarKeyField && data ? data[avatarKeyField] : (userKey || null);
|
|
125
|
+
const isCurrentUser = currentUserKey && userKey && currentUserKey === userKey;
|
|
126
|
+
const finalDisplayValue = isCurrentUser && currentUserLabel ? currentUserLabel : displayValue;
|
|
127
|
+
|
|
128
|
+
const avatarUrl = React.useMemo(() => {
|
|
129
|
+
if (!showAvatar || !avatarKey) return null;
|
|
130
|
+
return `/user_service_api/Users/Avatar?userKey=${avatarKey}`;
|
|
131
|
+
}, [showAvatar, avatarKey]);
|
|
132
|
+
|
|
108
133
|
if (!showCondition) return null;
|
|
109
134
|
|
|
110
135
|
return (
|
|
@@ -114,7 +139,12 @@ function ObjectRenderer(props) {
|
|
|
114
139
|
onMouseEnter={handleMouseEnter}
|
|
115
140
|
onMouseLeave={handleMouseLeave}
|
|
116
141
|
>
|
|
117
|
-
|
|
142
|
+
{showAvatar && avatarKey && (
|
|
143
|
+
<div style={AVATAR_STYLE}>
|
|
144
|
+
<Avatar src={avatarUrl} name={String(finalDisplayValue || '')} size={22} round />
|
|
145
|
+
</div>
|
|
146
|
+
)}
|
|
147
|
+
<div style={CONTENT_STYLE}>{finalDisplayValue}</div>
|
|
118
148
|
{isHovered && editable && (
|
|
119
149
|
<EditButton onClick={handleEditClick} />
|
|
120
150
|
)}
|
|
@@ -2,6 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import { createMemoComparison } from '@bit.rhplus/react-memo';
|
|
5
|
+
import Avatar from '@bit.rhplus/ui.avatar';
|
|
5
6
|
// Style constants
|
|
6
7
|
const CONTAINER_STYLE = {
|
|
7
8
|
position: 'relative',
|
|
@@ -12,6 +13,13 @@ const CONTAINER_STYLE = {
|
|
|
12
13
|
};
|
|
13
14
|
const CONTENT_STYLE = {
|
|
14
15
|
flexGrow: 1,
|
|
16
|
+
overflow: 'hidden',
|
|
17
|
+
textOverflow: 'ellipsis',
|
|
18
|
+
whiteSpace: 'nowrap',
|
|
19
|
+
};
|
|
20
|
+
const AVATAR_STYLE = {
|
|
21
|
+
marginRight: 6,
|
|
22
|
+
flexShrink: 0,
|
|
15
23
|
};
|
|
16
24
|
const BUTTON_STYLE = {
|
|
17
25
|
position: 'absolute',
|
|
@@ -31,7 +39,7 @@ const BUTTON_ICON_STYLE = {
|
|
|
31
39
|
const EditButton = React.memo(({ onClick, title = 'Upravit' }) => (_jsx("button", { className: "edit-object-button", style: BUTTON_STYLE, onClick: onClick, title: title, children: _jsx("span", { style: BUTTON_ICON_STYLE, children: "\u22EE" }) })));
|
|
32
40
|
EditButton.displayName = 'EditButton';
|
|
33
41
|
function ObjectRenderer(props) {
|
|
34
|
-
const { value, data, editable = false, onEditClick, showOnGroup = false, visibleGetter, displayField, } = props;
|
|
42
|
+
const { value, data, editable = false, onEditClick, showOnGroup = false, visibleGetter, displayField, currentUserLabel, currentUserField, currentUserKey, showAvatar = false, avatarKeyField, } = props;
|
|
35
43
|
const [isHovered, setIsHovered] = React.useState(false);
|
|
36
44
|
const handleMouseEnter = React.useCallback(() => {
|
|
37
45
|
setIsHovered(true);
|
|
@@ -66,9 +74,19 @@ function ObjectRenderer(props) {
|
|
|
66
74
|
}
|
|
67
75
|
return value;
|
|
68
76
|
}, [value, displayField, data, props]);
|
|
77
|
+
// Zjistit userKey z dat pro "Já" logiku a avatar
|
|
78
|
+
const userKey = currentUserField && data ? data[currentUserField] : null;
|
|
79
|
+
const avatarKey = avatarKeyField && data ? data[avatarKeyField] : (userKey || null);
|
|
80
|
+
const isCurrentUser = currentUserKey && userKey && currentUserKey === userKey;
|
|
81
|
+
const finalDisplayValue = isCurrentUser && currentUserLabel ? currentUserLabel : displayValue;
|
|
82
|
+
const avatarUrl = React.useMemo(() => {
|
|
83
|
+
if (!showAvatar || !avatarKey)
|
|
84
|
+
return null;
|
|
85
|
+
return `/user_service_api/Users/Avatar?userKey=${avatarKey}`;
|
|
86
|
+
}, [showAvatar, avatarKey]);
|
|
69
87
|
if (!showCondition)
|
|
70
88
|
return null;
|
|
71
|
-
return (_jsxs("div", { className: "object-cell-container", style: CONTAINER_STYLE, onMouseEnter: handleMouseEnter, onMouseLeave: handleMouseLeave, children: [_jsx("div", { style: CONTENT_STYLE, children:
|
|
89
|
+
return (_jsxs("div", { className: "object-cell-container", style: CONTAINER_STYLE, onMouseEnter: handleMouseEnter, onMouseLeave: handleMouseLeave, children: [showAvatar && avatarKey && (_jsx("div", { style: AVATAR_STYLE, children: _jsx(Avatar, { src: avatarUrl, name: String(finalDisplayValue || ''), size: 22, round: true }) })), _jsx("div", { style: CONTENT_STYLE, children: finalDisplayValue }), isHovered && editable && (_jsx(EditButton, { onClick: handleEditClick }))] }));
|
|
72
90
|
}
|
|
73
91
|
ObjectRenderer.displayName = 'ObjectRenderer';
|
|
74
92
|
// React.memo optimalizace pro AG-Grid renderer
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ObjectRenderer.js","sourceRoot":"","sources":["../../Renderers/ObjectRenderer.jsx"],"names":[],"mappings":";AAAA,oBAAoB;AACpB,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"ObjectRenderer.js","sourceRoot":"","sources":["../../Renderers/ObjectRenderer.jsx"],"names":[],"mappings":";AAAA,oBAAoB;AACpB,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,MAAM,MAAM,uBAAuB,CAAC;AAE3C,kBAAkB;AAClB,MAAM,eAAe,GAAG;IACtB,QAAQ,EAAE,UAAU;IACpB,KAAK,EAAE,MAAM;IACb,MAAM,EAAE,MAAM;IACd,OAAO,EAAE,MAAM;IACf,UAAU,EAAE,QAAQ;CACrB,CAAC;AAEF,MAAM,aAAa,GAAG;IACpB,QAAQ,EAAE,CAAC;IACX,QAAQ,EAAE,QAAQ;IAClB,YAAY,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AAY,EAAE,gBAAgB,aAE7B,UAAU,IAAI,SAAS,IAAI,CAC1B,cAAK,KAAK,EAAE,YAAY,YACtB,KAAC,MAAM,IAAC,GAAG,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,CAAC,iBAAiB,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,KAAK,SAAG,GAC7E,CACP,EACD,cAAK,KAAK,EAAE,aAAa,YAAG,iBAAiB,GAAO,EACnD,SAAS,IAAI,QAAQ,IAAI,CACxB,KAAC,UAAU,IAAC,OAAO,EAAE,eAAe,GAAI,CACzC,IACG,CACP,CAAC;AACJ,CAAC;AAED,cAAc,CAAC,WAAW,GAAG,gBAAgB,CAAC;AAE9C,+CAA+C;AAC/C,0DAA0D;AAC1D,MAAM,aAAa,GAAG,oBAAoB,CACxC,CAAC,OAAO,EAAE,MAAM,CAAC,EACjB,CAAC,QAAQ,CAAC,EACV,KAAK,EACL,gBAAgB,CACjB,CAAC;AAEF,eAAe,KAAK,CAAC,IAAI,CAAC,cAAc,EAAE,aAAa,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bit.rhplus/ag-grid",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.113",
|
|
4
4
|
"homepage": "https://bit.cloud/remote-scope/ag-grid",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"componentId": {
|
|
7
7
|
"scope": "remote-scope",
|
|
8
8
|
"name": "ag-grid",
|
|
9
|
-
"version": "0.0.
|
|
9
|
+
"version": "0.0.113"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"moment": "^2.30.1",
|
|
@@ -16,16 +16,17 @@
|
|
|
16
16
|
"ag-grid-community": "^35.0.0",
|
|
17
17
|
"ag-grid-enterprise": "^35.0.0",
|
|
18
18
|
"ag-grid-react": "^35.0.0",
|
|
19
|
-
"dayjs": "^1.11.13",
|
|
20
19
|
"date-holidays": "^3.26.1",
|
|
20
|
+
"dayjs": "^1.11.13",
|
|
21
21
|
"styled-components": "^6.1.19",
|
|
22
22
|
"lucide-react": "^0.503.0",
|
|
23
23
|
"linq": "^4.0.3",
|
|
24
24
|
"@bit.rhplus/react-memo": "0.0.6",
|
|
25
25
|
"@bit.rhplus/linq": "0.0.9",
|
|
26
26
|
"@bit.rhplus/data": "0.0.85",
|
|
27
|
-
"@bit.rhplus/ui.
|
|
28
|
-
"@bit.rhplus/
|
|
27
|
+
"@bit.rhplus/ui.avatar": "0.0.17",
|
|
28
|
+
"@bit.rhplus/ui.grid": "0.0.131",
|
|
29
|
+
"@bit.rhplus/ui2.module-dropdown-list": "0.1.107"
|
|
29
30
|
},
|
|
30
31
|
"devDependencies": {
|
|
31
32
|
"@teambit/react.react-env": "1.3.1"
|
|
File without changes
|