@bit.rhplus/ui.grid 0.0.2

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.
@@ -0,0 +1,55 @@
1
+ import * as React from 'react';
2
+ import ColumnBuilder from './ColumnBuilder';
3
+ import * as Tooltip from './tooltips';
4
+
5
+ export const tooltipEnums = {
6
+ User: 'User'
7
+ }
8
+
9
+ /* eslint-disable no-param-reassign */
10
+ export const AgGridColumn = (column) => {
11
+ const [tooltipComponent, setTooltipComponent] = React.useState(null);
12
+
13
+ const InvokeTooltip = (contentTooltip) => {
14
+ switch (contentTooltip) {
15
+ case tooltipEnums.User:
16
+ return Tooltip.User;
17
+ default:
18
+ throw Error("Cannot find tooltip component");
19
+ }
20
+ }
21
+
22
+ React.useEffect(() => {
23
+ const loadComponent = async () => {
24
+ if (column.contentTooltip) {
25
+ try {
26
+ const module = InvokeTooltip(column.contentTooltip);
27
+ setTooltipComponent(() => module); // Nastavení komponenty
28
+ } catch (error) {
29
+ console.error('Chyba při načítání tooltip komponenty2:', error);
30
+ }
31
+ }
32
+ };
33
+
34
+ loadComponent();
35
+ }, [column.contentTooltip]);
36
+
37
+ React.useEffect(() => {
38
+ if (tooltipComponent) {
39
+ column.tooltipComponent = tooltipComponent; // Přiřazení komponenty
40
+ }
41
+ }, [tooltipComponent, column]);
42
+
43
+ return column;
44
+ };
45
+
46
+ export const AgGridColumns = (columnDefs, options) => {
47
+ if (!columnDefs) return [];
48
+
49
+ const resolvedColumnDefs = columnDefs instanceof ColumnBuilder && typeof columnDefs.build === 'function'
50
+ ? columnDefs.build()
51
+ : columnDefs;
52
+
53
+ const cols = resolvedColumnDefs && resolvedColumnDefs.map((column) => AgGridColumn(column, options));
54
+ return cols;
55
+ };
@@ -0,0 +1,57 @@
1
+ class ColumnBuilder {
2
+ constructor() {
3
+ this.columns = [];
4
+ }
5
+
6
+ addTextColumnWithObject({headerName, field, width}) {
7
+ return this.addTextColumn(headerName, field, width);
8
+ }
9
+
10
+ addTextColumn(headerName, field, width = 150) {
11
+ this.columns.push({ headerName, field, width });
12
+ return this;
13
+ }
14
+
15
+ addValueGetterColumn(headerName, valueGetter, width) {
16
+ this.columns.push({headerName, valueGetter, width});
17
+ return this;
18
+ }
19
+
20
+ addNumberColumnWithObject({headerName, field, width}) {
21
+ return this.addNumberColumn(headerName, field, width);
22
+ }
23
+
24
+ addNumberColumn(headerName, field, width = 150) {
25
+ this.columns.push({ headerName, field, width });
26
+ return this;
27
+ }
28
+
29
+ addDateColumnWithObject({headerName, field, width}) {
30
+ return this.addDateColumn(headerName, field, width);
31
+ }
32
+
33
+ addDateColumn(headerName, field, width = 150) {
34
+ this.columns.push({ headerName, field, width });
35
+ return this;
36
+ }
37
+
38
+ addObjectColumnWithObject({headerName, field, width, contentTooltip, tooltipField, tooltipInteraction, tooltipShowDelay}) {
39
+ return this.addObjectColumn(headerName, field, width, contentTooltip, tooltipField, tooltipInteraction, tooltipShowDelay)
40
+ }
41
+
42
+ addObjectColumn(headerName, field, width = 150, contentTooltip, tooltipField, tooltipInteraction = true, tooltipShowDelay = 100) {
43
+ this.columns.push({ headerName, field, width, contentTooltip, tooltipField, tooltipInteraction, tooltipShowDelay})
44
+ return this;
45
+ }
46
+
47
+ addColumn(params) {
48
+ this.columns.push(params);
49
+ return this;
50
+ }
51
+
52
+ build() {
53
+ return this.columns;
54
+ }
55
+ }
56
+
57
+ export default ColumnBuilder;
@@ -0,0 +1,5 @@
1
+ export namespace tooltipEnums {
2
+ let User: string;
3
+ }
4
+ export function AgGridColumn(column: any): any;
5
+ export function AgGridColumns(columnDefs: any, options: any): any;
@@ -0,0 +1,48 @@
1
+ import * as React from 'react';
2
+ import ColumnBuilder from './ColumnBuilder';
3
+ import * as Tooltip from './tooltips';
4
+ export const tooltipEnums = {
5
+ User: 'User'
6
+ };
7
+ /* eslint-disable no-param-reassign */
8
+ export const AgGridColumn = (column) => {
9
+ const [tooltipComponent, setTooltipComponent] = React.useState(null);
10
+ const InvokeTooltip = (contentTooltip) => {
11
+ switch (contentTooltip) {
12
+ case tooltipEnums.User:
13
+ return Tooltip.User;
14
+ default:
15
+ throw Error("Cannot find tooltip component");
16
+ }
17
+ };
18
+ React.useEffect(() => {
19
+ const loadComponent = async () => {
20
+ if (column.contentTooltip) {
21
+ try {
22
+ const module = InvokeTooltip(column.contentTooltip);
23
+ setTooltipComponent(() => module); // Nastavení komponenty
24
+ }
25
+ catch (error) {
26
+ console.error('Chyba při načítání tooltip komponenty2:', error);
27
+ }
28
+ }
29
+ };
30
+ loadComponent();
31
+ }, [column.contentTooltip]);
32
+ React.useEffect(() => {
33
+ if (tooltipComponent) {
34
+ column.tooltipComponent = tooltipComponent; // Přiřazení komponenty
35
+ }
36
+ }, [tooltipComponent, column]);
37
+ return column;
38
+ };
39
+ export const AgGridColumns = (columnDefs, options) => {
40
+ if (!columnDefs)
41
+ return [];
42
+ const resolvedColumnDefs = columnDefs instanceof ColumnBuilder && typeof columnDefs.build === 'function'
43
+ ? columnDefs.build()
44
+ : columnDefs;
45
+ const cols = resolvedColumnDefs && resolvedColumnDefs.map((column) => AgGridColumn(column, options));
46
+ return cols;
47
+ };
48
+ //# sourceMappingURL=AgGridColumns.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AgGridColumns.js","sourceRoot":"","sources":["../AgGridColumns.js"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,aAAa,MAAM,iBAAiB,CAAC;AAC5C,OAAO,KAAK,OAAO,MAAM,YAAY,CAAC;AAEtC,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,IAAI,EAAE,MAAM;CACb,CAAA;AAED,sCAAsC;AACtC,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,MAAM,EAAE,EAAE;IACrC,MAAM,CAAC,gBAAgB,EAAE,mBAAmB,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;IAErE,MAAM,aAAa,G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pB,CAAC,CAAC,UAAU,CAAC;IAEf,MAAM,IAAI,GAAG,kBAAkB,IAAI,kBAAkB,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,YAAY,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IACrG,OAAO,IAAI,CAAC;AACd,CAAC,CAAC"}
@@ -0,0 +1,35 @@
1
+ export default ColumnBuilder;
2
+ declare class ColumnBuilder {
3
+ columns: any[];
4
+ addTextColumnWithObject({ headerName, field, width }: {
5
+ headerName: any;
6
+ field: any;
7
+ width: any;
8
+ }): this;
9
+ addTextColumn(headerName: any, field: any, width?: number): this;
10
+ addValueGetterColumn(headerName: any, valueGetter: any, width: any): this;
11
+ addNumberColumnWithObject({ headerName, field, width }: {
12
+ headerName: any;
13
+ field: any;
14
+ width: any;
15
+ }): this;
16
+ addNumberColumn(headerName: any, field: any, width?: number): this;
17
+ addDateColumnWithObject({ headerName, field, width }: {
18
+ headerName: any;
19
+ field: any;
20
+ width: any;
21
+ }): this;
22
+ addDateColumn(headerName: any, field: any, width?: number): this;
23
+ addObjectColumnWithObject({ headerName, field, width, contentTooltip, tooltipField, tooltipInteraction, tooltipShowDelay }: {
24
+ headerName: any;
25
+ field: any;
26
+ width: any;
27
+ contentTooltip: any;
28
+ tooltipField: any;
29
+ tooltipInteraction: any;
30
+ tooltipShowDelay: any;
31
+ }): this;
32
+ addObjectColumn(headerName: any, field: any, width: number | undefined, contentTooltip: any, tooltipField: any, tooltipInteraction?: boolean, tooltipShowDelay?: number): this;
33
+ addColumn(params: any): this;
34
+ build(): any[];
35
+ }
@@ -0,0 +1,46 @@
1
+ class ColumnBuilder {
2
+ constructor() {
3
+ this.columns = [];
4
+ }
5
+ addTextColumnWithObject({ headerName, field, width }) {
6
+ return this.addTextColumn(headerName, field, width);
7
+ }
8
+ addTextColumn(headerName, field, width = 150) {
9
+ this.columns.push({ headerName, field, width });
10
+ return this;
11
+ }
12
+ addValueGetterColumn(headerName, valueGetter, width) {
13
+ this.columns.push({ headerName, valueGetter, width });
14
+ return this;
15
+ }
16
+ addNumberColumnWithObject({ headerName, field, width }) {
17
+ return this.addNumberColumn(headerName, field, width);
18
+ }
19
+ addNumberColumn(headerName, field, width = 150) {
20
+ this.columns.push({ headerName, field, width });
21
+ return this;
22
+ }
23
+ addDateColumnWithObject({ headerName, field, width }) {
24
+ return this.addDateColumn(headerName, field, width);
25
+ }
26
+ addDateColumn(headerName, field, width = 150) {
27
+ this.columns.push({ headerName, field, width });
28
+ return this;
29
+ }
30
+ addObjectColumnWithObject({ headerName, field, width, contentTooltip, tooltipField, tooltipInteraction, tooltipShowDelay }) {
31
+ return this.addObjectColumn(headerName, field, width, contentTooltip, tooltipField, tooltipInteraction, tooltipShowDelay);
32
+ }
33
+ addObjectColumn(headerName, field, width = 150, contentTooltip, tooltipField, tooltipInteraction = true, tooltipShowDelay = 100) {
34
+ this.columns.push({ headerName, field, width, contentTooltip, tooltipField, tooltipInteraction, tooltipShowDelay });
35
+ return this;
36
+ }
37
+ addColumn(params) {
38
+ this.columns.push(params);
39
+ return this;
40
+ }
41
+ build() {
42
+ return this.columns;
43
+ }
44
+ }
45
+ export default ColumnBuilder;
46
+ //# sourceMappingURL=ColumnBuilder.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ColumnBuilder.js","sourceRoot":"","sources":["../ColumnBuilder.jsx"],"names":[],"mappings":"AAAA,MAAM,aAAa;IACjB;QACE,IAAI,CAAC,OAAO,GAAG,EAAE,CAAC;IACpB,CAAC;IAED,uBAAuB,CAAC,EAAC,UAAU,EAAE,KAAK,EAAE,KAAK,EAAC;QAChD,OAAO,IAAI,CAAC,aAAa,CAAC,UAAU,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;IACtD,CAAC;IAED,aAAa,CAAC,UAAU,EAAE,KAAK,EAAE,KAAK,GAAG,GAAG;QAC1C,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,UAAU,EAAE,KAAK,EAAE,KAAK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GAAG,EAAE,cAAc,EAAE,YAAY,EAAE,kBAAkB,GAAG,IAAI,EAAE,gBAAgB,GAAG,GAAG;QAC7H,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,UAAU,EAAE,KAAK,EAAE,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,kBAAkB,EAAE,gBAAgB,EAAC,CAAC,CAAA;QAClH,OAAO,IAAI,CAAC;IACd,CAAC;IAED,SAAS,CAAC,MAAM;QACd,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAC1B,OAAO,IAAI,CAAC;IACd,CAAC;IAED,KAAK;QACH,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;CACF;AAED,eAAe,aAAa,CAAC"}
@@ -0,0 +1,3 @@
1
+ export namespace contentTooltipsEnum {
2
+ let User: string;
3
+ }
package/dist/enums.js ADDED
@@ -0,0 +1,4 @@
1
+ export const contentTooltipsEnum = {
2
+ User: 'User'
3
+ };
4
+ //# sourceMappingURL=enums.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"enums.js","sourceRoot":"","sources":["../enums.js"],"names":[],"mappings":"AACA,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,IAAI,EAAE,MAAM;CACb,CAAA"}
@@ -0,0 +1,4 @@
1
+ export default Grid;
2
+ export * from "./enums";
3
+ export { default as ColumnBuilder } from "./ColumnBuilder";
4
+ declare function Grid(props: any): import("react/jsx-runtime").JSX.Element;
package/dist/index.js ADDED
@@ -0,0 +1,18 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import * as React from 'react';
3
+ import AgGrid from '@rhplus/wieldy.ag-grid';
4
+ import classnames from 'classnames';
5
+ import { AgGridColumns } from './AgGridColumns';
6
+ const Grid = props => {
7
+ const gridRef = React.useRef(null);
8
+ const { appearance = 'ag-theme-alpine', columnDefs, height = '100%' } = props;
9
+ return (_jsx("div", { className: classnames(appearance), style: { height }, children: _jsx(AgGrid, { context: {
10
+ componentParent: this
11
+ }, getRowId: params => params.data.id, defaultColDef: {
12
+ enableCellChangeFlash: true
13
+ }, ...props, ref: gridRef, columnDefs: AgGridColumns(columnDefs, props) }) }));
14
+ };
15
+ export default Grid;
16
+ export * from './enums';
17
+ export { default as ColumnBuilder } from './ColumnBuilder';
18
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../index.jsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,MAAM,MAAM,wBAAwB,CAAC;AAC5C,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD,MAAM,IAAI,GAAG,KAAK,CAAC,EAAE;IACnB,MAAM,OAAO,GAAG,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IACnC,MAAM,EACJ,UAAU,GAAG,iBAAiB,EAC9B,UAAU,EACV,MAAM,GAAG,MAAM,EAChB,GAAG,KAAK,CAAC;IAEV,OAAO,CACL,cAAK,SAAS,EAAE,UAAU,CAAC,UAAU,CAAC,EACpC,KAAK,EAAE,EAAE,MAAM,EAAE,YAEjB,KAAC,MAAM,IACL,OAAO,EAAE;gBACP,eAAe,EAAE,IAAI;aACtB,EACD,QAAQ,EAAE,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,EAClC,aAAa,EAAE;gBACb,qBAAqB,EAAE,IAAI;aAC5B,KACG,KAAK,EACT,GAAG,EAAE,OAAO,EACZ,UAAU,EAAE,aAAa,CAAC,UAAU,EAAE,KAAK,CAAC,GAC5C,GACE,CACP,CAAC;AACJ,CAAC,CAAA;AAGD,eAAe,IAAI,CAAC;AACpB,cAAc,SAAS,CAAC;AACxB,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,iBAAiB,CAAC"}
@@ -0,0 +1,7 @@
1
+ ;
2
+ ;
3
+
4
+ export const compositions = [];
5
+ export const overview = [];
6
+
7
+ export const compositions_metadata = {"compositions":[]};
@@ -0,0 +1,5 @@
1
+ export default ContentTooltip;
2
+ declare function ContentTooltip({ value, map }: {
3
+ value: any;
4
+ map: any;
5
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,20 @@
1
+ import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
2
+ import * as React from 'react';
3
+ import './style.css';
4
+ const ContentTooltip = ({ value, map }) => {
5
+ const createMappedArray = (val, mp) => {
6
+ return Object.keys(val)
7
+ .filter((key) => Object.prototype.hasOwnProperty.call(mp, key)) // Filtruje klíče, které nejsou v map
8
+ .map((key) => {
9
+ return {
10
+ mapValue: mp[key], // hodnota z objektu map
11
+ value: val[key] || 'N/A' // hodnota z objektu value, nebo N/A pokud není dostupná
12
+ };
13
+ });
14
+ };
15
+ // Volání funkce a uložení výsledku do proměnné
16
+ const mappedArray = createMappedArray(value, map);
17
+ return (_jsx("div", { className: "content-tooltip", children: _jsx("div", { children: _jsx("table", { children: _jsx("tbody", { children: mappedArray.map((item, index) => (_jsxs("tr", { children: [_jsx("td", { children: _jsxs("b", { children: [item.mapValue, ":"] }) }), " ", _jsx("td", { children: item.value }), " "] }, index))) }) }) }) }));
18
+ };
19
+ export default ContentTooltip;
20
+ //# sourceMappingURL=ContentTooltip.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ContentTooltip.js","sourceRoot":"","sources":["../../tooltips/ContentTooltip.jsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,aAAa,CAAC;AAErB,MAAM,cAAc,GAAG,CAAC,EAAE,KAAK,EAAE,GAAG,EAAE,EAAE,EAAE;IAExC,MAAM,iBAAiB,GAAG,CAAC,GAAG,EAAE,EAAE,EAAE,EAAE;QACpC,OAAO,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC;aACpB,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,EAAE,EAAE,GAAG,CAAC,CAAC,CAAC,qCAAqC;aACpG,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE;YACX,OAAO;gBACL,QAAQ,EAAE,EAAE,CAAC,GAAG,CAAC,EAAG,wBAAwB;gBAC5C,KAAK,EAAE,GAAG,CAAC,GAAG,CAAC,IAAI,KAAK,CAAK,wDAAwD;aACtF,CAAC;QACJ,CAAC,CAAC,CAAC;IACP,CAAC,CAAC;IAEF,+CAA+C;IAC/C,MAAM,WAAW,GAAG,iBAAiB,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;IAElD,OAAO,CACL,cAAK,SAAS,EAAC,iBAAiB,YAC9B,wBACE,0BACE,0BACC,WAAW,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,CAC9B,yBACE,uBAAI,wBAAI,IAAI,CAAC,QAAQ,SAAM,GAAK,OAChC,uBAAK,IAAI,CAAC,KAAK,GAAM,aAFd,KAAK,CAGT,CACN,CAAC,GACI,GACF,GACJ,GACF,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,cAAc,CAAC"}
@@ -0,0 +1,2 @@
1
+ export default User;
2
+ declare function User(props: any): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,17 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import * as React from 'react';
3
+ import ContentTooltip from './ContentTooltip';
4
+ import './style.css';
5
+ const map = {
6
+ userName: 'Uživatel',
7
+ firstName: 'Jméno',
8
+ surName: 'Příjmení',
9
+ email: 'Email',
10
+ key: 'Klíč',
11
+ };
12
+ const User = props => {
13
+ const { value } = props;
14
+ return (_jsx(ContentTooltip, { value: value, map: map }));
15
+ };
16
+ export default User;
17
+ //# sourceMappingURL=User.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"User.js","sourceRoot":"","sources":["../../tooltips/User.jsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,cAAc,MAAM,kBAAkB,CAAC;AAC9C,OAAO,aAAa,CAAC;AAErB,MAAM,GAAG,GAAG;IACV,QAAQ,EAAE,UAAU;IACpB,SAAS,EAAE,OAAO;IAClB,OAAO,EAAE,UAAU;IACnB,KAAK,EAAE,OAAO;IACd,GAAG,EAAE,MAAM;CACZ,CAAA;AAED,MAAM,IAAI,GAAG,KAAK,CAAC,EAAE;IACnB,MAAM,EAAC,KAAK,EAAC,GAAG,KAAK,CAAC;IACtB,OAAO,CACL,KAAC,cAAc,IAAC,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,GAAG,GAAI,CAC3C,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,IAAI,CAAC"}
@@ -0,0 +1 @@
1
+ export { default as User } from "./User";
@@ -0,0 +1,2 @@
1
+ export { default as User } from './User';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../tooltips/index.jsx"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,IAAI,IAAI,EAAC,MAAM,QAAQ,CAAC"}
@@ -0,0 +1,9 @@
1
+
2
+ .content-tooltip {
3
+ background-color: white;
4
+ padding: 20px;
5
+ }
6
+
7
+ .content-tooltip td {
8
+ white-space: nowrap;
9
+ }
package/enums.js ADDED
@@ -0,0 +1,4 @@
1
+
2
+ export const contentTooltipsEnum = {
3
+ User: 'User'
4
+ }
package/index.jsx ADDED
@@ -0,0 +1,37 @@
1
+ import * as React from 'react';
2
+ import AgGrid from '@rhplus/wieldy.ag-grid';
3
+ import classnames from 'classnames';
4
+ import { AgGridColumns } from './AgGridColumns';
5
+
6
+ const Grid = props => {
7
+ const gridRef = React.useRef(null);
8
+ const {
9
+ appearance = 'ag-theme-alpine',
10
+ columnDefs,
11
+ height = '100%'
12
+ } = props;
13
+
14
+ return (
15
+ <div className={classnames(appearance)}
16
+ style={{ height }}
17
+ >
18
+ <AgGrid
19
+ context={{
20
+ componentParent: this
21
+ }}
22
+ getRowId={params => params.data.id}
23
+ defaultColDef={{
24
+ enableCellChangeFlash: true
25
+ }}
26
+ {...props}
27
+ ref={gridRef}
28
+ columnDefs={AgGridColumns(columnDefs, props)}
29
+ />
30
+ </div>
31
+ );
32
+ }
33
+
34
+
35
+ export default Grid;
36
+ export * from './enums';
37
+ export { default as ColumnBuilder } from './ColumnBuilder';
package/package.json ADDED
@@ -0,0 +1,29 @@
1
+ {
2
+ "name": "@bit.rhplus/ui.grid",
3
+ "version": "0.0.2",
4
+ "homepage": "https://bit.cloud/remote-scope/ui/grid",
5
+ "main": "dist/index.js",
6
+ "componentId": {
7
+ "scope": "remote-scope",
8
+ "name": "ui/grid",
9
+ "version": "0.0.2"
10
+ },
11
+ "dependencies": {
12
+ "classnames": "^2.5.1",
13
+ "@rhplus/wieldy.ag-grid": "0.0.18"
14
+ },
15
+ "devDependencies": {
16
+ "@teambit/react.react-env": "1.0.98"
17
+ },
18
+ "peerDependencies": {
19
+ "react": "^17.0.0 || ^18.0.0"
20
+ },
21
+ "license": "SEE LICENSE IN UNLICENSED",
22
+ "optionalDependencies": {},
23
+ "peerDependenciesMeta": {},
24
+ "private": false,
25
+ "publishConfig": {
26
+ "scope": "@bit.rhplus",
27
+ "registry": "https://registry.npmjs.org/"
28
+ }
29
+ }
@@ -0,0 +1,38 @@
1
+ import * as React from 'react';
2
+ import './style.css';
3
+
4
+ const ContentTooltip = ({ value, map }) => {
5
+
6
+ const createMappedArray = (val, mp) => {
7
+ return Object.keys(val)
8
+ .filter((key) => Object.prototype.hasOwnProperty.call(mp, key)) // Filtruje klíče, které nejsou v map
9
+ .map((key) => {
10
+ return {
11
+ mapValue: mp[key], // hodnota z objektu map
12
+ value: val[key] || 'N/A' // hodnota z objektu value, nebo N/A pokud není dostupná
13
+ };
14
+ });
15
+ };
16
+
17
+ // Volání funkce a uložení výsledku do proměnné
18
+ const mappedArray = createMappedArray(value, map);
19
+
20
+ return (
21
+ <div className="content-tooltip">
22
+ <div>
23
+ <table>
24
+ <tbody>
25
+ {mappedArray.map((item, index) => (
26
+ <tr key={index}>
27
+ <td><b>{item.mapValue}:</b></td> {/* hodnota z map */}
28
+ <td>{item.value}</td> {/* hodnota z value */}
29
+ </tr>
30
+ ))}
31
+ </tbody>
32
+ </table>
33
+ </div>
34
+ </div>
35
+ );
36
+ };
37
+
38
+ export default ContentTooltip;
@@ -0,0 +1,20 @@
1
+ import * as React from 'react';
2
+ import ContentTooltip from './ContentTooltip';
3
+ import './style.css';
4
+
5
+ const map = {
6
+ userName: 'Uživatel',
7
+ firstName: 'Jméno',
8
+ surName: 'Příjmení',
9
+ email: 'Email',
10
+ key: 'Klíč',
11
+ }
12
+
13
+ const User = props => {
14
+ const {value} = props;
15
+ return (
16
+ <ContentTooltip value={value} map={map} />
17
+ );
18
+ };
19
+
20
+ export default User;
@@ -0,0 +1 @@
1
+ export {default as User} from './User';
@@ -0,0 +1,9 @@
1
+
2
+ .content-tooltip {
3
+ background-color: white;
4
+ padding: 20px;
5
+ }
6
+
7
+ .content-tooltip td {
8
+ white-space: nowrap;
9
+ }
@@ -0,0 +1,43 @@
1
+ declare module '*.png' {
2
+ const value: any;
3
+ export = value;
4
+ }
5
+ declare module '*.svg' {
6
+ import type { FunctionComponent, SVGProps } from 'react';
7
+
8
+ export const ReactComponent: FunctionComponent<
9
+ SVGProps<SVGSVGElement> & { title?: string }
10
+ >;
11
+ const src: string;
12
+ export default src;
13
+ }
14
+
15
+ // @TODO Gilad
16
+ declare module '*.jpg' {
17
+ const value: any;
18
+ export = value;
19
+ }
20
+ declare module '*.jpeg' {
21
+ const value: any;
22
+ export = value;
23
+ }
24
+ declare module '*.gif' {
25
+ const value: any;
26
+ export = value;
27
+ }
28
+ declare module '*.bmp' {
29
+ const value: any;
30
+ export = value;
31
+ }
32
+ declare module '*.otf' {
33
+ const value: any;
34
+ export = value;
35
+ }
36
+ declare module '*.woff' {
37
+ const value: any;
38
+ export = value;
39
+ }
40
+ declare module '*.woff2' {
41
+ const value: any;
42
+ export = value;
43
+ }
@@ -0,0 +1,42 @@
1
+ declare module '*.module.css' {
2
+ const classes: { readonly [key: string]: string };
3
+ export default classes;
4
+ }
5
+ declare module '*.module.scss' {
6
+ const classes: { readonly [key: string]: string };
7
+ export default classes;
8
+ }
9
+ declare module '*.module.sass' {
10
+ const classes: { readonly [key: string]: string };
11
+ export default classes;
12
+ }
13
+
14
+ declare module '*.module.less' {
15
+ const classes: { readonly [key: string]: string };
16
+ export default classes;
17
+ }
18
+
19
+ declare module '*.less' {
20
+ const classes: { readonly [key: string]: string };
21
+ export default classes;
22
+ }
23
+
24
+ declare module '*.css' {
25
+ const classes: { readonly [key: string]: string };
26
+ export default classes;
27
+ }
28
+
29
+ declare module '*.sass' {
30
+ const classes: { readonly [key: string]: string };
31
+ export default classes;
32
+ }
33
+
34
+ declare module '*.scss' {
35
+ const classes: { readonly [key: string]: string };
36
+ export default classes;
37
+ }
38
+
39
+ declare module '*.mdx' {
40
+ const component: any;
41
+ export default component;
42
+ }