@open-kingdom/shared-frontend-ui-datagrid 0.0.2-0
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/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +140 -0
- package/dist/lib/datagrid.config.d.ts +28 -0
- package/dist/lib/datagrid.config.d.ts.map +1 -0
- package/dist/lib/datagrid.constants.d.ts +11 -0
- package/dist/lib/datagrid.constants.d.ts.map +1 -0
- package/dist/lib/datagrid.d.ts +3 -0
- package/dist/lib/datagrid.d.ts.map +1 -0
- package/dist/lib/datagrid.types.d.ts +12 -0
- package/dist/lib/datagrid.types.d.ts.map +1 -0
- package/dist/lib/theme/index.d.ts +3 -0
- package/dist/lib/theme/index.d.ts.map +1 -0
- package/dist/lib/theme/theme.adapter.d.ts +19 -0
- package/dist/lib/theme/theme.adapter.d.ts.map +1 -0
- package/dist/lib/theme/theme.types.d.ts +23 -0
- package/dist/lib/theme/theme.types.d.ts.map +1 -0
- package/package.json +40 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,0BAA0B,CAAC;AACzC,cAAc,sBAAsB,CAAC;AACrC,cAAc,aAAa,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import { jsx as u } from "react/jsx-runtime";
|
|
2
|
+
import { AgGridReact as d } from "ag-grid-react";
|
|
3
|
+
import { themeQuartz as a, colorSchemeLight as m, colorSchemeDark as p, ModuleRegistry as f, AllCommunityModule as S } from "ag-grid-community";
|
|
4
|
+
export * from "ag-grid-community";
|
|
5
|
+
const h = 20, g = [10, 20, 50, 100], T = 100, D = 500, C = "autoHeight", _ = "singleRow", b = "multiRow", E = {
|
|
6
|
+
// Column defaults
|
|
7
|
+
defaultColDef: {
|
|
8
|
+
sortable: !0,
|
|
9
|
+
filter: !0,
|
|
10
|
+
resizable: !0,
|
|
11
|
+
floatingFilter: !0,
|
|
12
|
+
minWidth: T
|
|
13
|
+
},
|
|
14
|
+
// Pagination
|
|
15
|
+
pagination: !0,
|
|
16
|
+
paginationPageSize: h,
|
|
17
|
+
paginationPageSizeSelector: g,
|
|
18
|
+
// UX
|
|
19
|
+
animateRows: !0,
|
|
20
|
+
enableCellTextSelection: !0,
|
|
21
|
+
ensureDomOrder: !0,
|
|
22
|
+
tooltipShowDelay: D,
|
|
23
|
+
suppressDragLeaveHidesColumns: !0,
|
|
24
|
+
domLayout: C,
|
|
25
|
+
// Auto-size
|
|
26
|
+
onFirstDataRendered: (s) => s.api.sizeColumnsToFit(),
|
|
27
|
+
// Loading states
|
|
28
|
+
overlayLoadingTemplate: `
|
|
29
|
+
<div class="ag-custom-loading">
|
|
30
|
+
<div class="ag-spinner"></div>
|
|
31
|
+
<span>Loading data...</span>
|
|
32
|
+
</div>
|
|
33
|
+
`,
|
|
34
|
+
overlayNoRowsTemplate: `
|
|
35
|
+
<div class="ag-custom-no-rows">
|
|
36
|
+
<span>No data to display</span>
|
|
37
|
+
</div>
|
|
38
|
+
`
|
|
39
|
+
}, L = {
|
|
40
|
+
mode: b,
|
|
41
|
+
checkboxes: !0,
|
|
42
|
+
headerCheckbox: !0,
|
|
43
|
+
selectAll: "currentPage",
|
|
44
|
+
enableClickSelection: !1
|
|
45
|
+
}, O = {
|
|
46
|
+
mode: _,
|
|
47
|
+
checkboxes: !1,
|
|
48
|
+
enableSelectionWithoutKeys: !0,
|
|
49
|
+
hideDisabledCheckboxes: !0
|
|
50
|
+
}, w = {
|
|
51
|
+
height: "auto"
|
|
52
|
+
};
|
|
53
|
+
class y {
|
|
54
|
+
/**
|
|
55
|
+
* Adapts a UI-Theme to AG Grid theme format
|
|
56
|
+
* @param theme - UI-Theme object or undefined (uses AG Grid default)
|
|
57
|
+
* @param mode - Light or dark mode
|
|
58
|
+
* @returns AG Grid theme
|
|
59
|
+
*/
|
|
60
|
+
static adapt(e, t) {
|
|
61
|
+
if (!e)
|
|
62
|
+
return a;
|
|
63
|
+
const o = this.applyColorScheme(e, t), r = {
|
|
64
|
+
...this.extractColors(e.colors),
|
|
65
|
+
...this.extractTypography(e.typography)
|
|
66
|
+
};
|
|
67
|
+
return Object.keys(r).length > 0 ? o.withParams(r) : o;
|
|
68
|
+
}
|
|
69
|
+
// Apply light/dark color scheme
|
|
70
|
+
static applyColorScheme(e, t) {
|
|
71
|
+
if (!(e.colors || t))
|
|
72
|
+
return a;
|
|
73
|
+
const o = t === "dark" ? m : p;
|
|
74
|
+
return a.withPart(o);
|
|
75
|
+
}
|
|
76
|
+
// Extract color parameters from theme
|
|
77
|
+
static extractColors(e) {
|
|
78
|
+
if (!e) return {};
|
|
79
|
+
const t = {
|
|
80
|
+
accentColor: e.primary?.["500"],
|
|
81
|
+
successColor: e.success?.["500"],
|
|
82
|
+
warningColor: e.warning?.["500"],
|
|
83
|
+
errorColor: e.error?.["500"]
|
|
84
|
+
};
|
|
85
|
+
return Object.fromEntries(
|
|
86
|
+
Object.entries(t).filter(([o, r]) => r !== void 0)
|
|
87
|
+
);
|
|
88
|
+
}
|
|
89
|
+
// Extract typography parameters from theme
|
|
90
|
+
static extractTypography(e) {
|
|
91
|
+
if (!e) return {};
|
|
92
|
+
const t = {};
|
|
93
|
+
if (e.fontFamily?.sans && (t.fontFamily = e.fontFamily.sans.join(", ")), e.fontSize?.base) {
|
|
94
|
+
const o = e.fontSize.base, r = typeof o == "string" ? o : o[0], i = this.parseSize(r);
|
|
95
|
+
i !== void 0 && (t.fontSize = i);
|
|
96
|
+
}
|
|
97
|
+
return t;
|
|
98
|
+
}
|
|
99
|
+
// Helper to parse size values
|
|
100
|
+
static parseSize(e) {
|
|
101
|
+
if (!e) return;
|
|
102
|
+
const t = parseFloat(e);
|
|
103
|
+
if (!isNaN(t))
|
|
104
|
+
return e.endsWith("rem") || e.endsWith("em") ? t * 16 : t;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
f.registerModules([S]);
|
|
108
|
+
const F = ({
|
|
109
|
+
className: s,
|
|
110
|
+
rowSelection: e,
|
|
111
|
+
containerStyle: t = w,
|
|
112
|
+
enableRowSelection: o = !1,
|
|
113
|
+
mode: r,
|
|
114
|
+
theme: i,
|
|
115
|
+
...n
|
|
116
|
+
}) => {
|
|
117
|
+
const c = e || (o ? L : O), l = y.adapt(i, r);
|
|
118
|
+
return /* @__PURE__ */ u(
|
|
119
|
+
d,
|
|
120
|
+
{
|
|
121
|
+
...E,
|
|
122
|
+
...n,
|
|
123
|
+
theme: l,
|
|
124
|
+
className: s,
|
|
125
|
+
containerStyle: t,
|
|
126
|
+
rowSelection: c
|
|
127
|
+
}
|
|
128
|
+
);
|
|
129
|
+
};
|
|
130
|
+
export {
|
|
131
|
+
T as DEFAULT_MIN_WIDTH,
|
|
132
|
+
h as DEFAULT_PAGE_SIZE,
|
|
133
|
+
g as DEFAULT_PAGE_SIZE_OPTIONS,
|
|
134
|
+
D as DEFAULT_TOOLTIP_DELAY,
|
|
135
|
+
C as DOM_LAYOUT_AUTO_HEIGHT,
|
|
136
|
+
F as DataGrid,
|
|
137
|
+
y as DataGridThemeAdapter,
|
|
138
|
+
b as ROW_SELECTION_MULTI,
|
|
139
|
+
_ as ROW_SELECTION_SINGLE
|
|
140
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { RowSelectionOptions, FirstDataRenderedEvent } from './datagrid.types';
|
|
2
|
+
export declare const gridDefaults: {
|
|
3
|
+
defaultColDef: {
|
|
4
|
+
sortable: boolean;
|
|
5
|
+
filter: boolean;
|
|
6
|
+
resizable: boolean;
|
|
7
|
+
floatingFilter: boolean;
|
|
8
|
+
minWidth: number;
|
|
9
|
+
};
|
|
10
|
+
pagination: boolean;
|
|
11
|
+
paginationPageSize: number;
|
|
12
|
+
paginationPageSizeSelector: number[];
|
|
13
|
+
animateRows: boolean;
|
|
14
|
+
enableCellTextSelection: boolean;
|
|
15
|
+
ensureDomOrder: boolean;
|
|
16
|
+
tooltipShowDelay: number;
|
|
17
|
+
suppressDragLeaveHidesColumns: boolean;
|
|
18
|
+
domLayout: "autoHeight";
|
|
19
|
+
onFirstDataRendered: (params: FirstDataRenderedEvent) => void;
|
|
20
|
+
overlayLoadingTemplate: string;
|
|
21
|
+
overlayNoRowsTemplate: string;
|
|
22
|
+
};
|
|
23
|
+
export declare const multiRowSelectionDefaults: RowSelectionOptions;
|
|
24
|
+
export declare const singleRowSelectionDefaults: RowSelectionOptions;
|
|
25
|
+
export declare const containerDefaults: {
|
|
26
|
+
height: string;
|
|
27
|
+
};
|
|
28
|
+
//# sourceMappingURL=datagrid.config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"datagrid.config.d.ts","sourceRoot":"","sources":["../../src/lib/datagrid.config.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EACnB,KAAK,sBAAsB,EAC5B,MAAM,kBAAkB,CAAC;AAW1B,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;kCAwBO,sBAAsB;;;CAgBrD,CAAC;AAEF,eAAO,MAAM,yBAAyB,EAAE,mBAMvC,CAAC;AAEF,eAAO,MAAM,0BAA0B,EAAE,mBAKxC,CAAC;AAEF,eAAO,MAAM,iBAAiB;;CAE7B,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Grid Configuration Constants
|
|
3
|
+
*/
|
|
4
|
+
export declare const DEFAULT_PAGE_SIZE = 20;
|
|
5
|
+
export declare const DEFAULT_PAGE_SIZE_OPTIONS: number[];
|
|
6
|
+
export declare const DEFAULT_MIN_WIDTH = 100;
|
|
7
|
+
export declare const DEFAULT_TOOLTIP_DELAY = 500;
|
|
8
|
+
export declare const DOM_LAYOUT_AUTO_HEIGHT: "autoHeight";
|
|
9
|
+
export declare const ROW_SELECTION_SINGLE: "singleRow";
|
|
10
|
+
export declare const ROW_SELECTION_MULTI: "multiRow";
|
|
11
|
+
//# sourceMappingURL=datagrid.constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"datagrid.constants.d.ts","sourceRoot":"","sources":["../../src/lib/datagrid.constants.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,eAAO,MAAM,iBAAiB,KAAK,CAAC;AACpC,eAAO,MAAM,yBAAyB,UAAoB,CAAC;AAG3D,eAAO,MAAM,iBAAiB,MAAM,CAAC;AACrC,eAAO,MAAM,qBAAqB,MAAM,CAAC;AAGzC,eAAO,MAAM,sBAAsB,EAAG,YAAqB,CAAC;AAG5D,eAAO,MAAM,oBAAoB,EAAG,WAAoB,CAAC;AACzD,eAAO,MAAM,mBAAmB,EAAG,UAAmB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"datagrid.d.ts","sourceRoot":"","sources":["../../src/lib/datagrid.tsx"],"names":[],"mappings":"AAOA,OAAO,EAGL,aAAa,EACd,MAAM,kBAAkB,CAAC;AAK1B,eAAO,MAAM,QAAQ,GAAI,wFAQtB,aAAa,4CAmBf,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { AgGridReactProps } from 'ag-grid-react';
|
|
2
|
+
import { CSSProperties } from 'react';
|
|
3
|
+
import { DataGridTheme, ThemeMode } from './theme';
|
|
4
|
+
export interface DataGridProps extends Omit<AgGridReactProps, 'theme'> {
|
|
5
|
+
className?: string;
|
|
6
|
+
containerStyle?: CSSProperties;
|
|
7
|
+
enableRowSelection?: boolean;
|
|
8
|
+
mode?: ThemeMode;
|
|
9
|
+
theme?: DataGridTheme;
|
|
10
|
+
}
|
|
11
|
+
export * from 'ag-grid-community';
|
|
12
|
+
//# sourceMappingURL=datagrid.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"datagrid.types.d.ts","sourceRoot":"","sources":["../../src/lib/datagrid.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACtD,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,OAAO,CAAC;AAC3C,OAAO,EAAE,KAAK,aAAa,EAAE,KAAK,SAAS,EAAE,MAAM,SAAS,CAAC;AAE7D,MAAM,WAAW,aAAc,SAAQ,IAAI,CAAC,gBAAgB,EAAE,OAAO,CAAC;IACpE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,cAAc,CAAC,EAAE,aAAa,CAAC;IAC/B,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,KAAK,CAAC,EAAE,aAAa,CAAC;CACvB;AAED,cAAc,mBAAmB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/theme/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Theme as AgTheme } from '../datagrid.types';
|
|
2
|
+
import { DataGridTheme, ThemeMode } from './theme.types';
|
|
3
|
+
/**
|
|
4
|
+
* Theme adapter that converts UI-Theme format to AG Grid themes
|
|
5
|
+
*/
|
|
6
|
+
export declare class DataGridThemeAdapter {
|
|
7
|
+
/**
|
|
8
|
+
* Adapts a UI-Theme to AG Grid theme format
|
|
9
|
+
* @param theme - UI-Theme object or undefined (uses AG Grid default)
|
|
10
|
+
* @param mode - Light or dark mode
|
|
11
|
+
* @returns AG Grid theme
|
|
12
|
+
*/
|
|
13
|
+
static adapt(theme: DataGridTheme, mode?: ThemeMode): AgTheme;
|
|
14
|
+
private static applyColorScheme;
|
|
15
|
+
private static extractColors;
|
|
16
|
+
private static extractTypography;
|
|
17
|
+
private static parseSize;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=theme.adapter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"theme.adapter.d.ts","sourceRoot":"","sources":["../../../src/lib/theme/theme.adapter.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,KAAK,IAAI,OAAO,EACtB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAW,MAAM,eAAe,CAAC;AAEvE;;GAEG;AACH,qBAAa,oBAAoB;IAC/B;;;;;OAKG;IACH,MAAM,CAAC,KAAK,CAAC,KAAK,EAAE,aAAa,EAAE,IAAI,CAAC,EAAE,SAAS,GAAG,OAAO;IAsB7D,OAAO,CAAC,MAAM,CAAC,gBAAgB;IAa/B,OAAO,CAAC,MAAM,CAAC,aAAa;IAmB5B,OAAO,CAAC,MAAM,CAAC,iBAAiB;IA2BhC,OAAO,CAAC,MAAM,CAAC,SAAS;CAczB"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export type ThemeMode = 'light' | 'dark';
|
|
2
|
+
/**
|
|
3
|
+
* Theme structure for DataGrid - subset of UI-Theme library
|
|
4
|
+
* Only includes properties that can be mapped to AG Grid theme parameters
|
|
5
|
+
*/
|
|
6
|
+
export interface UITheme {
|
|
7
|
+
colors?: {
|
|
8
|
+
primary?: Record<string, string>;
|
|
9
|
+
success?: Record<string, string>;
|
|
10
|
+
warning?: Record<string, string>;
|
|
11
|
+
error?: Record<string, string>;
|
|
12
|
+
};
|
|
13
|
+
typography?: {
|
|
14
|
+
fontFamily?: {
|
|
15
|
+
sans?: string[];
|
|
16
|
+
};
|
|
17
|
+
fontSize?: Record<string, string | [string, {
|
|
18
|
+
lineHeight: string;
|
|
19
|
+
}]>;
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
export type DataGridTheme = UITheme | undefined;
|
|
23
|
+
//# sourceMappingURL=theme.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"theme.types.d.ts","sourceRoot":"","sources":["../../../src/lib/theme/theme.types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,SAAS,GAAG,OAAO,GAAG,MAAM,CAAC;AAEzC;;;GAGG;AACH,MAAM,WAAW,OAAO;IACtB,MAAM,CAAC,EAAE;QACP,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QACjC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QACjC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QACjC,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;KAChC,CAAC;IACF,UAAU,CAAC,EAAE;QACX,UAAU,CAAC,EAAE;YACX,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;SACjB,CAAC;QACF,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,CAAC,MAAM,EAAE;YAAE,UAAU,EAAE,MAAM,CAAA;SAAE,CAAC,CAAC,CAAC;KACtE,CAAC;CACH;AAGD,MAAM,MAAM,aAAa,GAAG,OAAO,GAAG,SAAS,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@open-kingdom/shared-frontend-ui-datagrid",
|
|
3
|
+
"version": "0.0.2-0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"main": "./dist/index.js",
|
|
6
|
+
"module": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"import": "./dist/index.js",
|
|
12
|
+
"development": "./src/index.ts",
|
|
13
|
+
"default": "./dist/index.js"
|
|
14
|
+
},
|
|
15
|
+
"./package.json": "./package.json"
|
|
16
|
+
},
|
|
17
|
+
"files": [
|
|
18
|
+
"dist",
|
|
19
|
+
"!**/*.tsbuildinfo"
|
|
20
|
+
],
|
|
21
|
+
"publishConfig": {
|
|
22
|
+
"access": "public"
|
|
23
|
+
},
|
|
24
|
+
"nx": {
|
|
25
|
+
"name": "@open-kingdom/shared-frontend-ui-datagrid",
|
|
26
|
+
"tags": [
|
|
27
|
+
"scope:shared",
|
|
28
|
+
"type:ui",
|
|
29
|
+
"environment:frontend"
|
|
30
|
+
]
|
|
31
|
+
},
|
|
32
|
+
"dependencies": {
|
|
33
|
+
"ag-grid-react": "^34.3.1",
|
|
34
|
+
"ag-grid-community": "^34.3.1"
|
|
35
|
+
},
|
|
36
|
+
"peerDependencies": {
|
|
37
|
+
"react": "^19.0.0",
|
|
38
|
+
"react-dom": "^19.0.0"
|
|
39
|
+
}
|
|
40
|
+
}
|