@ekz/blueprintjs 0.2.0 → 0.2.1
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/lib/cjs/common/classes.d.ts +28 -0
- package/lib/cjs/common/classes.js +34 -0
- package/lib/cjs/common/classes.js.map +1 -0
- package/lib/cjs/common/index.d.ts +3 -0
- package/lib/cjs/common/index.js +9 -0
- package/lib/cjs/common/index.js.map +1 -0
- package/lib/cjs/components/pagination/index.d.ts +1 -0
- package/lib/cjs/components/pagination/index.js +5 -0
- package/lib/cjs/components/pagination/index.js.map +1 -0
- package/lib/cjs/components/pagination/pagination.d.ts +46 -0
- package/lib/cjs/components/pagination/pagination.js +46 -0
- package/lib/cjs/components/pagination/pagination.js.map +1 -0
- package/lib/cjs/components/table/columnFilter.d.ts +7 -0
- package/lib/cjs/components/table/columnFilter.js +23 -0
- package/lib/cjs/components/table/columnFilter.js.map +1 -0
- package/lib/cjs/components/table/columnHelpers.d.ts +340 -0
- package/lib/cjs/components/table/columnHelpers.js +39 -0
- package/lib/cjs/components/table/columnHelpers.js.map +1 -0
- package/lib/cjs/components/table/headerGroup.d.ts +8 -0
- package/lib/cjs/components/table/headerGroup.js +42 -0
- package/lib/cjs/components/table/headerGroup.js.map +1 -0
- package/lib/cjs/components/table/index.d.ts +9 -0
- package/lib/cjs/components/table/index.js +20 -0
- package/lib/cjs/components/table/index.js.map +1 -0
- package/lib/cjs/components/table/reactTableBase.d.ts +2 -0
- package/lib/cjs/components/table/reactTableBase.js +8 -0
- package/lib/cjs/components/table/reactTableBase.js.map +1 -0
- package/lib/cjs/components/table/table.d.ts +123 -0
- package/lib/cjs/components/table/table.js +229 -0
- package/lib/cjs/components/table/table.js.map +1 -0
- package/lib/cjs/components/table/tableMessages.d.ts +6 -0
- package/lib/cjs/components/table/tableMessages.js +11 -0
- package/lib/cjs/components/table/tableMessages.js.map +1 -0
- package/lib/cjs/components/table/theme.d.ts +4 -0
- package/lib/cjs/components/table/theme.js +9 -0
- package/lib/cjs/components/table/theme.js.map +1 -0
- package/lib/cjs/components/table/useAutoColumnSizer.d.ts +7 -0
- package/lib/cjs/components/table/useAutoColumnSizer.js +51 -0
- package/lib/cjs/components/table/useAutoColumnSizer.js.map +1 -0
- package/lib/cjs/components/table/useAutoHeight.d.ts +4 -0
- package/lib/cjs/components/table/useAutoHeight.js +69 -0
- package/lib/cjs/components/table/useAutoHeight.js.map +1 -0
- package/lib/cjs/components/table/useGroupedHeaderColumnSizer.d.ts +2 -0
- package/lib/cjs/components/table/useGroupedHeaderColumnSizer.js +57 -0
- package/lib/cjs/components/table/useGroupedHeaderColumnSizer.js.map +1 -0
- package/lib/cjs/components/table/useTable.d.ts +122 -0
- package/lib/cjs/components/table/useTable.js +31 -0
- package/lib/cjs/components/table/useTable.js.map +1 -0
- package/lib/cjs/components/table/useTableExport.d.ts +6 -0
- package/lib/cjs/components/table/useTableExport.js +41 -0
- package/lib/cjs/components/table/useTableExport.js.map +1 -0
- package/lib/cjs/components/table/useTableState.d.ts +3 -0
- package/lib/cjs/components/table/useTableState.js +14 -0
- package/lib/cjs/components/table/useTableState.js.map +1 -0
- package/lib/cjs/components/table/utils.d.ts +1 -0
- package/lib/cjs/components/table/utils.js +8 -0
- package/lib/cjs/components/table/utils.js.map +1 -0
- package/lib/cjs/index.d.ts +7 -0
- package/lib/cjs/index.js +16 -0
- package/lib/cjs/index.js.map +1 -0
- package/lib/cjs/theme/baseTheme.d.ts +39 -0
- package/lib/cjs/theme/baseTheme.js +47 -0
- package/lib/cjs/theme/baseTheme.js.map +1 -0
- package/lib/cjs/theme/blueprintTheme.d.ts +26 -0
- package/lib/cjs/theme/blueprintTheme.js +99 -0
- package/lib/cjs/theme/blueprintTheme.js.map +1 -0
- package/lib/cjs/theme/index.d.ts +6 -0
- package/lib/cjs/theme/index.js +13 -0
- package/lib/cjs/theme/index.js.map +1 -0
- package/lib/cjs/theme/spacing.d.ts +2 -0
- package/lib/cjs/theme/spacing.js +13 -0
- package/lib/cjs/theme/spacing.js.map +1 -0
- package/lib/cjs/theme/useBlueprintTheme.d.ts +2 -0
- package/lib/cjs/theme/useBlueprintTheme.js +12 -0
- package/lib/cjs/theme/useBlueprintTheme.js.map +1 -0
- package/lib/css/blueprintjs.css +402 -0
- package/lib/css/blueprintjs.css.map +1 -0
- package/lib/esm/common/classes.d.ts +28 -0
- package/lib/esm/common/classes.js +31 -0
- package/lib/esm/common/classes.js.map +1 -0
- package/lib/esm/common/index.d.ts +3 -0
- package/lib/esm/common/index.js +4 -0
- package/lib/esm/common/index.js.map +1 -0
- package/lib/esm/components/pagination/index.d.ts +1 -0
- package/lib/esm/components/pagination/index.js +2 -0
- package/lib/esm/components/pagination/index.js.map +1 -0
- package/lib/esm/components/pagination/pagination.d.ts +46 -0
- package/lib/esm/components/pagination/pagination.js +42 -0
- package/lib/esm/components/pagination/pagination.js.map +1 -0
- package/lib/esm/components/table/columnFilter.d.ts +7 -0
- package/lib/esm/components/table/columnFilter.js +18 -0
- package/lib/esm/components/table/columnFilter.js.map +1 -0
- package/lib/esm/components/table/columnHelpers.d.ts +340 -0
- package/lib/esm/components/table/columnHelpers.js +36 -0
- package/lib/esm/components/table/columnHelpers.js.map +1 -0
- package/lib/esm/components/table/headerGroup.d.ts +8 -0
- package/lib/esm/components/table/headerGroup.js +39 -0
- package/lib/esm/components/table/headerGroup.js.map +1 -0
- package/lib/esm/components/table/index.d.ts +9 -0
- package/lib/esm/components/table/index.js +10 -0
- package/lib/esm/components/table/index.js.map +1 -0
- package/lib/esm/components/table/reactTableBase.d.ts +2 -0
- package/lib/esm/components/table/reactTableBase.js +3 -0
- package/lib/esm/components/table/reactTableBase.js.map +1 -0
- package/lib/esm/components/table/table.d.ts +123 -0
- package/lib/esm/components/table/table.js +225 -0
- package/lib/esm/components/table/table.js.map +1 -0
- package/lib/esm/components/table/tableMessages.d.ts +6 -0
- package/lib/esm/components/table/tableMessages.js +6 -0
- package/lib/esm/components/table/tableMessages.js.map +1 -0
- package/lib/esm/components/table/theme.d.ts +4 -0
- package/lib/esm/components/table/theme.js +6 -0
- package/lib/esm/components/table/theme.js.map +1 -0
- package/lib/esm/components/table/useAutoColumnSizer.d.ts +7 -0
- package/lib/esm/components/table/useAutoColumnSizer.js +46 -0
- package/lib/esm/components/table/useAutoColumnSizer.js.map +1 -0
- package/lib/esm/components/table/useAutoHeight.d.ts +4 -0
- package/lib/esm/components/table/useAutoHeight.js +65 -0
- package/lib/esm/components/table/useAutoHeight.js.map +1 -0
- package/lib/esm/components/table/useGroupedHeaderColumnSizer.d.ts +2 -0
- package/lib/esm/components/table/useGroupedHeaderColumnSizer.js +53 -0
- package/lib/esm/components/table/useGroupedHeaderColumnSizer.js.map +1 -0
- package/lib/esm/components/table/useTable.d.ts +122 -0
- package/lib/esm/components/table/useTable.js +28 -0
- package/lib/esm/components/table/useTable.js.map +1 -0
- package/lib/esm/components/table/useTableExport.d.ts +6 -0
- package/lib/esm/components/table/useTableExport.js +37 -0
- package/lib/esm/components/table/useTableExport.js.map +1 -0
- package/lib/esm/components/table/useTableState.d.ts +3 -0
- package/lib/esm/components/table/useTableState.js +11 -0
- package/lib/esm/components/table/useTableState.js.map +1 -0
- package/lib/esm/components/table/utils.d.ts +1 -0
- package/lib/esm/components/table/utils.js +5 -0
- package/lib/esm/components/table/utils.js.map +1 -0
- package/lib/esm/index.d.ts +7 -0
- package/lib/esm/index.js +11 -0
- package/lib/esm/index.js.map +1 -0
- package/lib/esm/theme/baseTheme.d.ts +39 -0
- package/lib/esm/theme/baseTheme.js +44 -0
- package/lib/esm/theme/baseTheme.js.map +1 -0
- package/lib/esm/theme/blueprintTheme.d.ts +26 -0
- package/lib/esm/theme/blueprintTheme.js +96 -0
- package/lib/esm/theme/blueprintTheme.js.map +1 -0
- package/lib/esm/theme/index.d.ts +6 -0
- package/lib/esm/theme/index.js +5 -0
- package/lib/esm/theme/index.js.map +1 -0
- package/lib/esm/theme/spacing.d.ts +2 -0
- package/lib/esm/theme/spacing.js +9 -0
- package/lib/esm/theme/spacing.js.map +1 -0
- package/lib/esm/theme/useBlueprintTheme.d.ts +2 -0
- package/lib/esm/theme/useBlueprintTheme.js +9 -0
- package/lib/esm/theme/useBlueprintTheme.js.map +1 -0
- package/lib/esnext/common/classes.d.ts +28 -0
- package/lib/esnext/common/classes.js +31 -0
- package/lib/esnext/common/classes.js.map +1 -0
- package/lib/esnext/common/index.d.ts +3 -0
- package/lib/esnext/common/index.js +4 -0
- package/lib/esnext/common/index.js.map +1 -0
- package/lib/esnext/components/pagination/index.d.ts +1 -0
- package/lib/esnext/components/pagination/index.js +2 -0
- package/lib/esnext/components/pagination/index.js.map +1 -0
- package/lib/esnext/components/pagination/pagination.d.ts +46 -0
- package/lib/esnext/components/pagination/pagination.js +42 -0
- package/lib/esnext/components/pagination/pagination.js.map +1 -0
- package/lib/esnext/components/table/columnFilter.d.ts +7 -0
- package/lib/esnext/components/table/columnFilter.js +18 -0
- package/lib/esnext/components/table/columnFilter.js.map +1 -0
- package/lib/esnext/components/table/columnHelpers.d.ts +340 -0
- package/lib/esnext/components/table/columnHelpers.js +36 -0
- package/lib/esnext/components/table/columnHelpers.js.map +1 -0
- package/lib/esnext/components/table/headerGroup.d.ts +8 -0
- package/lib/esnext/components/table/headerGroup.js +39 -0
- package/lib/esnext/components/table/headerGroup.js.map +1 -0
- package/lib/esnext/components/table/index.d.ts +9 -0
- package/lib/esnext/components/table/index.js +10 -0
- package/lib/esnext/components/table/index.js.map +1 -0
- package/lib/esnext/components/table/reactTableBase.d.ts +2 -0
- package/lib/esnext/components/table/reactTableBase.js +3 -0
- package/lib/esnext/components/table/reactTableBase.js.map +1 -0
- package/lib/esnext/components/table/table.d.ts +123 -0
- package/lib/esnext/components/table/table.js +225 -0
- package/lib/esnext/components/table/table.js.map +1 -0
- package/lib/esnext/components/table/tableMessages.d.ts +6 -0
- package/lib/esnext/components/table/tableMessages.js +6 -0
- package/lib/esnext/components/table/tableMessages.js.map +1 -0
- package/lib/esnext/components/table/theme.d.ts +4 -0
- package/lib/esnext/components/table/theme.js +6 -0
- package/lib/esnext/components/table/theme.js.map +1 -0
- package/lib/esnext/components/table/useAutoColumnSizer.d.ts +7 -0
- package/lib/esnext/components/table/useAutoColumnSizer.js +46 -0
- package/lib/esnext/components/table/useAutoColumnSizer.js.map +1 -0
- package/lib/esnext/components/table/useAutoHeight.d.ts +4 -0
- package/lib/esnext/components/table/useAutoHeight.js +65 -0
- package/lib/esnext/components/table/useAutoHeight.js.map +1 -0
- package/lib/esnext/components/table/useGroupedHeaderColumnSizer.d.ts +2 -0
- package/lib/esnext/components/table/useGroupedHeaderColumnSizer.js +53 -0
- package/lib/esnext/components/table/useGroupedHeaderColumnSizer.js.map +1 -0
- package/lib/esnext/components/table/useTable.d.ts +122 -0
- package/lib/esnext/components/table/useTable.js +28 -0
- package/lib/esnext/components/table/useTable.js.map +1 -0
- package/lib/esnext/components/table/useTableExport.d.ts +6 -0
- package/lib/esnext/components/table/useTableExport.js +37 -0
- package/lib/esnext/components/table/useTableExport.js.map +1 -0
- package/lib/esnext/components/table/useTableState.d.ts +3 -0
- package/lib/esnext/components/table/useTableState.js +11 -0
- package/lib/esnext/components/table/useTableState.js.map +1 -0
- package/lib/esnext/components/table/utils.d.ts +1 -0
- package/lib/esnext/components/table/utils.js +5 -0
- package/lib/esnext/components/table/utils.js.map +1 -0
- package/lib/esnext/index.d.ts +7 -0
- package/lib/esnext/index.js +11 -0
- package/lib/esnext/index.js.map +1 -0
- package/lib/esnext/theme/baseTheme.d.ts +39 -0
- package/lib/esnext/theme/baseTheme.js +44 -0
- package/lib/esnext/theme/baseTheme.js.map +1 -0
- package/lib/esnext/theme/blueprintTheme.d.ts +26 -0
- package/lib/esnext/theme/blueprintTheme.js +96 -0
- package/lib/esnext/theme/blueprintTheme.js.map +1 -0
- package/lib/esnext/theme/index.d.ts +6 -0
- package/lib/esnext/theme/index.js +5 -0
- package/lib/esnext/theme/index.js.map +1 -0
- package/lib/esnext/theme/spacing.d.ts +2 -0
- package/lib/esnext/theme/spacing.js +9 -0
- package/lib/esnext/theme/spacing.js.map +1 -0
- package/lib/esnext/theme/useBlueprintTheme.d.ts +2 -0
- package/lib/esnext/theme/useBlueprintTheme.js +9 -0
- package/lib/esnext/theme/useBlueprintTheme.js.map +1 -0
- package/package.json +5 -5
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useAutoHeight = useAutoHeight;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const invariant_1 = tslib_1.__importDefault(require("invariant"));
|
|
6
|
+
const React = tslib_1.__importStar(require("react"));
|
|
7
|
+
function useAutoHeight(autoHeight, autoHeightParentHeight, autoHeightMaxHeight, autoHeightAverageRowHeight, autoHeightObserveRows, theme, table, ref, bodyRef, nonIdealStateRef) {
|
|
8
|
+
const visibleRowCount = table.getRowModel().rows.length ?? 0;
|
|
9
|
+
const [minPageSize, maxPageSize] = autoHeight ?? [0, 0];
|
|
10
|
+
(0, invariant_1.default)(autoHeight == null || maxPageSize > minPageSize, 'maxPageSize must be greater than minPageSize');
|
|
11
|
+
(0, invariant_1.default)(autoHeight == null || minPageSize > 0, 'minPageSize must be greater than 0');
|
|
12
|
+
(0, invariant_1.default)(autoHeight == null || maxPageSize > 1, 'maxPageSize must be greater than 0');
|
|
13
|
+
const calculatePageSize = React.useCallback(() => {
|
|
14
|
+
if (minPageSize > 0 && maxPageSize > 0) {
|
|
15
|
+
const parentHeight = Math.min(autoHeightParentHeight ?? ref?.parentElement?.clientHeight ?? 0, autoHeightMaxHeight ?? Number.MAX_VALUE);
|
|
16
|
+
const tableHeight = ref?.clientHeight ?? 0;
|
|
17
|
+
const bodyHeight = bodyRef.current?.clientHeight ?? nonIdealStateRef.current?.clientHeight ?? 0;
|
|
18
|
+
const hasPagination = table.getPageCount() > 1;
|
|
19
|
+
const averageRowHeight = autoHeightAverageRowHeight ??
|
|
20
|
+
(visibleRowCount > 0 ? bodyHeight / visibleRowCount : 40);
|
|
21
|
+
const nonBodyTotalSize = tableHeight - bodyHeight + (hasPagination ? 0 : 54); // fixed footer height (pagination)
|
|
22
|
+
const pageSize = Math.min(Math.max((parentHeight - nonBodyTotalSize) / averageRowHeight, minPageSize), maxPageSize);
|
|
23
|
+
if (table.options.debugTable) {
|
|
24
|
+
console.log('Calculating page size', {
|
|
25
|
+
averageRowHeight,
|
|
26
|
+
bodyHeight,
|
|
27
|
+
maxPageSize,
|
|
28
|
+
minPageSize,
|
|
29
|
+
pageSize,
|
|
30
|
+
parentHeight,
|
|
31
|
+
tableHeight,
|
|
32
|
+
visibleRowCount
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
table.setPageSize(Math.floor(pageSize));
|
|
36
|
+
}
|
|
37
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
38
|
+
}, [
|
|
39
|
+
ref,
|
|
40
|
+
minPageSize,
|
|
41
|
+
maxPageSize,
|
|
42
|
+
autoHeightParentHeight,
|
|
43
|
+
autoHeightMaxHeight,
|
|
44
|
+
autoHeightAverageRowHeight,
|
|
45
|
+
visibleRowCount,
|
|
46
|
+
theme,
|
|
47
|
+
table
|
|
48
|
+
]);
|
|
49
|
+
React.useEffect(() => calculatePageSize(), [calculatePageSize]);
|
|
50
|
+
const handleResize = React.useCallback((entries) => {
|
|
51
|
+
if (entries.length > 0) {
|
|
52
|
+
if (entries[0].target !== ref) {
|
|
53
|
+
calculatePageSize();
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}, [ref, calculatePageSize]);
|
|
57
|
+
const bodyRefCurrent = bodyRef.current;
|
|
58
|
+
React.useEffect(() => {
|
|
59
|
+
if (autoHeightObserveRows && autoHeight != null && bodyRefCurrent != null) {
|
|
60
|
+
const observer = new ResizeObserver(() => {
|
|
61
|
+
calculatePageSize();
|
|
62
|
+
});
|
|
63
|
+
observer.observe(bodyRefCurrent);
|
|
64
|
+
return () => observer.disconnect();
|
|
65
|
+
}
|
|
66
|
+
}, [autoHeightObserveRows, autoHeight, bodyRefCurrent, calculatePageSize]);
|
|
67
|
+
return handleResize;
|
|
68
|
+
}
|
|
69
|
+
//# sourceMappingURL=useAutoHeight.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useAutoHeight.js","sourceRoot":"","sources":["../../../../src/main/web/components/table/useAutoHeight.ts"],"names":[],"mappings":";;AAMA,sCAgGC;;AAtGD,kEAAkC;AAClC,qDAA+B;AAK/B,SAAgB,aAAa,CACzB,UAAkE,EAClE,sBAA0C,EAC1C,mBAAuC,EACvC,0BAA8C,EAC9C,qBAA0C,EAC1C,KAA6B,EAC7B,KAAqB,EACrB,GAA0B,EAC1B,OAA+C,EAC/C,gBAAwD;IAExD,MAAM,eAAe,GAAG,KAAK,CAAC,WAAW,EAAE,CAAC,IAAI,CAAC,MAAM,IAAI,CAAC,CAAC;IAE7D,MAAM,CAAC,WAAW,EAAE,WAAW,CAAC,GAAG,UAAU,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAExD,IAAA,mBAAS,EACL,UAAU,IAAI,IAAI,IAAI,WAAW,GAAG,WAAW,EAC/C,8CAA8C,CACjD,CAAC;IACF,IAAA,mBAAS,EAAC,UAAU,IAAI,IAAI,IAAI,WAAW,GAAG,CAAC,EAAE,oCAAoC,CAAC,CAAC;IACvF,IAAA,mBAAS,EAAC,UAAU,IAAI,IAAI,IAAI,WAAW,GAAG,CAAC,EAAE,oCAAoC,CAAC,CAAC;IAEvF,MAAM,iBAAiB,GAAG,KAAK,CAAC,WAAW,CAAC,GAAG,EAAE;QAC7C,IAAI,WAAW,GAAG,CAAC,IAAI,WAAW,GAAG,CAAC,EAAE,CAAC;YACrC,MAAM,YAAY,GAAG,IAAI,CAAC,GAAG,CACzB,sBAAsB,IAAI,GAAG,EAAE,aAAa,EAAE,YAAY,IAAI,CAAC,EAC/D,mBAAmB,IAAI,MAAM,CAAC,S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AAiB,EAAE,EAAE,CAAC,iBAAiB,CAAC,CAAC,CAAC;IAEhE,MAAM,YAAY,GAAG,KAAK,CAAC,WAAW,CAClC,CAAC,OAA8B,EAAE,EAAE;QAC/B,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACrB,IAAI,OAAO,CAAC,CAAC,CAAC,CAAC,MAAM,KAAK,GAAG,EAAE,CAAC;gBAC5B,iBAAiB,EAAE,CAAC;YACxB,CAAC;QACL,CAAC;IACL,CAAC,EACD,CAAC,GAAG,EAAE,iBAAiB,CAAC,CAC3B,CAAC;IAEF,MAAM,cAAc,GAAG,OAAO,CAAC,OAAO,CAAC;IACvC,KAAK,CAAC,SAAS,CAAC,GAAwB,EAAE;QACtC,IAAI,qBAAqB,IAAI,UAAU,IAAI,IAAI,IAAI,cAAc,IAAI,IAAI,EAAE,CAAC;YACxE,MAAM,QAAQ,GAAG,IAAI,cAAc,CAAC,GAAG,EAAE;gBACrC,iBAAiB,EAAE,CAAC;YACxB,CAAC,CAAC,CAAC;YACH,QAAQ,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC;YACjC,OAAO,GAAG,EAAE,CAAC,QAAQ,CAAC,UAAU,EAAE,CAAC;QACvC,CAAC;IACL,CAAC,EAAE,CAAC,qBAAqB,EAAE,UAAU,EAAE,cAAc,EAAE,iBAAiB,CAAC,CAAC,CAAC;IAE3E,OAAO,YAAY,CAAC;AACxB,CAAC"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useGroupedHeaderColumnSizer = useGroupedHeaderColumnSizer;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const react_1 = tslib_1.__importDefault(require("react"));
|
|
6
|
+
const useAutoColumnSizer_1 = require("./useAutoColumnSizer");
|
|
7
|
+
function useGroupedHeaderColumnSizer(table, tableState) {
|
|
8
|
+
const columnSize = table.getVisibleFlatColumns().length;
|
|
9
|
+
const tableColumnOrder = table.getState().columnOrder;
|
|
10
|
+
const tableColumnVisibility = table.getState().columnVisibility;
|
|
11
|
+
const { columnSizing, columnSizingInfo } = tableState;
|
|
12
|
+
return react_1.default.useMemo(() => {
|
|
13
|
+
return table.getHeaderGroups().reduce((vars, group) => group.headers.reduce((result, header) => {
|
|
14
|
+
const isGroupHeader = !header.isPlaceholder && header.subHeaders?.length > 0;
|
|
15
|
+
if (!isGroupHeader)
|
|
16
|
+
return result;
|
|
17
|
+
result[`--header-${header.id}-size`] = getSpanSizeFromSizing(header, tableState.columnSizing, useAutoColumnSizer_1.CELL_PADDING + useAutoColumnSizer_1.CELL_BORDER);
|
|
18
|
+
return result;
|
|
19
|
+
}, vars), {});
|
|
20
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
21
|
+
}, [
|
|
22
|
+
table,
|
|
23
|
+
columnSize,
|
|
24
|
+
columnSizing,
|
|
25
|
+
columnSizingInfo,
|
|
26
|
+
tableColumnOrder,
|
|
27
|
+
tableColumnVisibility
|
|
28
|
+
]);
|
|
29
|
+
}
|
|
30
|
+
function getSpanMetricsFromSizing(
|
|
31
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
32
|
+
header, sizing) {
|
|
33
|
+
if (!header.subHeaders?.length) {
|
|
34
|
+
const id = header.column.id;
|
|
35
|
+
return {
|
|
36
|
+
leafCount: 1,
|
|
37
|
+
leafSum: sizing[id] ?? header.getSize()
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
return header.subHeaders.reduce((acc, sub) => {
|
|
41
|
+
const m = getSpanMetricsFromSizing(sub, sizing);
|
|
42
|
+
return {
|
|
43
|
+
leafCount: acc.leafCount + m.leafCount,
|
|
44
|
+
leafSum: acc.leafSum + m.leafSum
|
|
45
|
+
};
|
|
46
|
+
}, { leafSum: 0, leafCount: 0 });
|
|
47
|
+
}
|
|
48
|
+
function getSpanSizeFromSizing(
|
|
49
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
50
|
+
header, sizing, betweenLeavesPx) {
|
|
51
|
+
if (header.isPlaceholder)
|
|
52
|
+
return header.getSize();
|
|
53
|
+
const { leafSum, leafCount } = getSpanMetricsFromSizing(header, sizing);
|
|
54
|
+
const between = Math.max(0, leafCount - 1) * betweenLeavesPx;
|
|
55
|
+
return leafSum + between;
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=useGroupedHeaderColumnSizer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useGroupedHeaderColumnSizer.js","sourceRoot":"","sources":["../../../../src/main/web/components/table/useGroupedHeaderColumnSizer.tsx"],"names":[],"mappings":";;AAKA,kEAmCC;;AAxCD,0DAA0B;AAG1B,6DAAiE;AAEjE,SAAgB,2BAA2B,CACvC,KAAqB,EACrB,UAAsB;IAEtB,MAAM,UAAU,GAAG,KAAK,CAAC,qBAAqB,EAAE,CAAC,MAAM,CAAC;IACxD,MAAM,gBAAgB,GAAG,KAAK,CAAC,QAAQ,EAAE,CAAC,WAAW,CAAC;IACtD,MAAM,qBAAqB,GAAG,KAAK,CAAC,QAAQ,EAAE,CAAC,gBAAgB,CAAC;IAChE,MAAM,EAAE,YAAY,EAAE,gBAAgB,EAAE,GAAG,UAAU,CAAC;IACtD,OAAO,eAAK,CAAC,OAAO,CAAC,GAAG,EAAE;QACtB,OAAO,KAAK,CAAC,eAAe,EAAE,CAAC,MAAM,CACjC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CACZ,KAAK,CAAC,OAAO,CAAC,MAAM,CAAyB,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE;YAC5D,MAAM,aAAa,GAAG,CAAC,MAAM,CAAC,aAAa,IAAI,MAAM,CAAC,UAAU,EAAE,MAAM,GAAG,CAAC,CAAC;YAE7E,IAAI,CAAC,aAAa;gBAAE,OAAO,MAAM,CAAC;YAElC,MAAM,CAAC,YAAY,MAAM,CAAC,EAAE,OAAO,CAAC,GA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MAAM,CAAC,CAAC;IACxE,MAAM,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,SAAS,GAAG,CAAC,CAAC,GAAG,eAAe,CAAC;IAC7D,OAAO,OAAO,GAAG,OAAO,CAAC;AAC7B,CAAC"}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { type InitialTableState, type Row, type Table as TableAPI, type TableOptions } from './reactTableBase';
|
|
2
|
+
/**
|
|
3
|
+
* `UseTableOptions` is a reexport of `TableOptions` with more options and relevant documentation.
|
|
4
|
+
* Not all properties supported by `@tanstack/react-table` have been documented here.
|
|
5
|
+
*/
|
|
6
|
+
export interface UseTableOptions<T = unknown> extends Omit<TableOptions<T>, 'getCoreRowModel' | 'state' | 'onStateChange'> {
|
|
7
|
+
/**
|
|
8
|
+
* The typed column definitions. Every column in the table must have its own definition.
|
|
9
|
+
*/
|
|
10
|
+
columns: TableOptions<T>['columns'];
|
|
11
|
+
/**
|
|
12
|
+
* The table data. Each row will receive an instance of this element.
|
|
13
|
+
*/
|
|
14
|
+
data: TableOptions<T>['data'];
|
|
15
|
+
/**
|
|
16
|
+
* The table state can be provided to make the it controlled. See the documentation regarding recommended usage
|
|
17
|
+
* of this property.
|
|
18
|
+
*/
|
|
19
|
+
state?: TableOptions<T>['state'];
|
|
20
|
+
/**
|
|
21
|
+
* Use this option to optionally pass initial state to the table. This state will be used
|
|
22
|
+
* when resetting various table states either automatically by the table (eg. `options.autoResetPageIndex`)
|
|
23
|
+
* or via functions like `table.resetRowSelection()`.
|
|
24
|
+
* */
|
|
25
|
+
initialState?: InitialTableState;
|
|
26
|
+
/**
|
|
27
|
+
* Allows row selection. An optional function can be provided to conditionally allow row selection.
|
|
28
|
+
*
|
|
29
|
+
* @default true
|
|
30
|
+
*/
|
|
31
|
+
enableRowSelection?: TableOptions<T>['enableRowSelection'];
|
|
32
|
+
/**
|
|
33
|
+
* Allows row expansion.
|
|
34
|
+
*
|
|
35
|
+
* @default true
|
|
36
|
+
*/
|
|
37
|
+
enableExpanding?: TableOptions<T>['enableExpanding'];
|
|
38
|
+
/**
|
|
39
|
+
* Allows column sorting.
|
|
40
|
+
*
|
|
41
|
+
* @default true
|
|
42
|
+
*/
|
|
43
|
+
enableSorting?: TableOptions<T>['enableSorting'];
|
|
44
|
+
/**
|
|
45
|
+
* Allows general filtering.
|
|
46
|
+
*
|
|
47
|
+
* @default true
|
|
48
|
+
*/
|
|
49
|
+
enableFilters?: TableOptions<T>['enableFilters'];
|
|
50
|
+
/**
|
|
51
|
+
* Allows global filter in top toolbar.
|
|
52
|
+
*
|
|
53
|
+
* @default true
|
|
54
|
+
*/
|
|
55
|
+
enableGlobalFilter?: boolean;
|
|
56
|
+
/**
|
|
57
|
+
* Set true to display table loading indicator.
|
|
58
|
+
*
|
|
59
|
+
* @default false
|
|
60
|
+
*/
|
|
61
|
+
isLoading?: boolean;
|
|
62
|
+
/**
|
|
63
|
+
* When set, the provided component will be used instead of the original `<Spinner />`.
|
|
64
|
+
*/
|
|
65
|
+
loadingIndicator?: React.ReactNode;
|
|
66
|
+
/**
|
|
67
|
+
* When defined, the callback can return an optional class name that will be added to the specific row.
|
|
68
|
+
* Depending on the CSS properties in the class, it might be needed to use `!important` to take higher
|
|
69
|
+
* precedence.
|
|
70
|
+
*/
|
|
71
|
+
getRowClassName?: (originalRow: T, index: number) => string | null | undefined;
|
|
72
|
+
/**
|
|
73
|
+
* When defined, callback is called to determine if the row is clickable. Return `false` to disable clicking.
|
|
74
|
+
*/
|
|
75
|
+
getRowClickable?: (originalRow: T, index: number) => boolean;
|
|
76
|
+
/**
|
|
77
|
+
* Callback is called when row is clicked.
|
|
78
|
+
*/
|
|
79
|
+
onRowClick?: (originalRow: T, row: Row<T>, event: React.MouseEvent<HTMLDivElement>) => void;
|
|
80
|
+
/**
|
|
81
|
+
* Callback is called when there are changes to the `pagination` property of the table `state`.
|
|
82
|
+
*/
|
|
83
|
+
onPaginationChange?: TableOptions<T>['onPaginationChange'];
|
|
84
|
+
/**
|
|
85
|
+
* Callback is called when there are changes to the `rowSelection` property of the table `state`.
|
|
86
|
+
*/
|
|
87
|
+
onRowSelectionChange?: TableOptions<T>['onRowSelectionChange'];
|
|
88
|
+
/**
|
|
89
|
+
* Callback is called when there are changes to the `expanded` property of the table `state`.
|
|
90
|
+
*/
|
|
91
|
+
onExpandedChange?: TableOptions<T>['onExpandedChange'];
|
|
92
|
+
/**
|
|
93
|
+
* Callback is called when there are changes to the `globalFilter` property of the table `state`.
|
|
94
|
+
*/
|
|
95
|
+
onGlobalFilterChange?: TableOptions<T>['onGlobalFilterChange'];
|
|
96
|
+
/**
|
|
97
|
+
* The callback might return an optional list of sub-rows to be rendered when the parent row
|
|
98
|
+
* is expanded.
|
|
99
|
+
*/
|
|
100
|
+
getSubRows?: (originalRow: T, index: number) => undefined | T[];
|
|
101
|
+
/**
|
|
102
|
+
* The callback might return an optional `React.ReactNode` to be rendered below the expanded row.
|
|
103
|
+
*/
|
|
104
|
+
getSubComponent?: (originalRow: T, index: number) => undefined | React.ReactNode;
|
|
105
|
+
/**
|
|
106
|
+
* Normally, the sub-components can be controlled using the standard `state.expanded` and its related
|
|
107
|
+
* event handlers. When that is not desirable, provide this callback which will override the `expanded`
|
|
108
|
+
* state. When using this callback, the column helper `expansion` only controls sub-rows.
|
|
109
|
+
*/
|
|
110
|
+
getSubComponentExpanded?: (originalRow: T, index: number) => boolean;
|
|
111
|
+
}
|
|
112
|
+
export interface TableMetadata {
|
|
113
|
+
enableGlobalFilter: UseTableOptions['enableGlobalFilter'];
|
|
114
|
+
getRowClickable: UseTableOptions['getRowClickable'];
|
|
115
|
+
getSubComponent: UseTableOptions['getSubComponent'];
|
|
116
|
+
getSubComponentExpanded: UseTableOptions['getSubComponentExpanded'];
|
|
117
|
+
getRowClassName: UseTableOptions['getRowClassName'];
|
|
118
|
+
isLoading: UseTableOptions['isLoading'];
|
|
119
|
+
loadingIndicator: UseTableOptions['loadingIndicator'];
|
|
120
|
+
onRowClick: UseTableOptions['onRowClick'];
|
|
121
|
+
}
|
|
122
|
+
export declare function useTable<T>(options: UseTableOptions<T>): TableAPI<T>;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useTable = useTable;
|
|
4
|
+
const react_table_1 = require("@tanstack/react-table");
|
|
5
|
+
const reactTableBase_1 = require("./reactTableBase");
|
|
6
|
+
function useTable(options) {
|
|
7
|
+
return (0, react_table_1.useReactTable)({
|
|
8
|
+
columnResizeMode: 'onChange',
|
|
9
|
+
getCoreRowModel: (0, reactTableBase_1.getCoreRowModel)(),
|
|
10
|
+
getExpandedRowModel: (0, reactTableBase_1.getExpandedRowModel)(),
|
|
11
|
+
getFacetedMinMaxValues: (0, reactTableBase_1.getFacetedMinMaxValues)(),
|
|
12
|
+
getFacetedRowModel: (0, reactTableBase_1.getFacetedRowModel)(),
|
|
13
|
+
getFacetedUniqueValues: (0, reactTableBase_1.getFacetedUniqueValues)(),
|
|
14
|
+
getFilteredRowModel: (0, reactTableBase_1.getFilteredRowModel)(),
|
|
15
|
+
getPaginationRowModel: (0, reactTableBase_1.getPaginationRowModel)(),
|
|
16
|
+
getSortedRowModel: (0, reactTableBase_1.getSortedRowModel)(),
|
|
17
|
+
...options,
|
|
18
|
+
meta: {
|
|
19
|
+
...options.meta,
|
|
20
|
+
enableGlobalFilter: options.enableGlobalFilter ?? true,
|
|
21
|
+
getRowClickable: options.getRowClickable,
|
|
22
|
+
getSubComponent: options.getSubComponent,
|
|
23
|
+
getSubComponentExpanded: options.getSubComponentExpanded,
|
|
24
|
+
getRowClassName: options.getRowClassName,
|
|
25
|
+
isLoading: options.isLoading,
|
|
26
|
+
loadingIndicator: options.loadingIndicator,
|
|
27
|
+
onRowClick: options.onRowClick
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=useTable.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useTable.js","sourceRoot":"","sources":["../../../../src/main/web/components/table/useTable.ts"],"names":[],"mappings":";;AAkKA,4BAwBC;AA1LD,uDAAsD;AAEtD,qDAa0B;AAmJ1B,SAAgB,QAAQ,CAAI,OAA2B;IACnD,OAAO,IAAA,2BAAa,EAAC;QACjB,gBAAgB,EAAE,UAAU;QAC5B,eAAe,EAAE,IAAA,gCAAe,GAAE;QAClC,mBAAmB,EAAE,IAAA,oCAAmB,GAAE;QAC1C,sBAAsB,EAAE,IAAA,uCAAsB,GAAE;QAChD,kBAAkB,EAAE,IAAA,mCAAkB,GAAE;QACxC,sBAAsB,EAAE,IAAA,uCAAsB,GAAE;QAChD,mBAAmB,EAAE,IAAA,oCAAmB,GAAE;QAC1C,qBAAqB,EAAE,IAAA,sCAAqB,GAAE;QAC9C,iBAAiB,EAAE,IAAA,kCAAiB,GAAE;QACtC,GAAG,OAAO;QACV,IAAI,EAAE;YACF,GAAG,OAAO,CAAC,IAAI;YACf,kBAAkB,EAAE,OAAO,CAAC,kBAAkB,IAAI,IAAI;YACtD,eAAe,EAAE,OAAO,CAAC,eAAe;YACxC,eAAe,EAAE,OAAO,CAAC,eAAe;YACxC,uBAAuB,EAAE,OAAO,CAAC,uBAAuB;YACxD,eAAe,EAAE,OAAO,CAAC,eAAe;YACxC,SAAS,EAAE,OAAO,CAAC,SAAS;YAC5B,gBAAgB,EAAE,OAAO,CAAC,gBAAgB;YAC1C,UAAU,EAAE,OAAO,CAAC,UAAU;SACjC;KACJ,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useTableExport = useTableExport;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const React = tslib_1.__importStar(require("react"));
|
|
6
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
7
|
+
function useTableExport(table) {
|
|
8
|
+
const createCsv = React.useCallback(() => {
|
|
9
|
+
return [
|
|
10
|
+
table
|
|
11
|
+
.getVisibleFlatColumns()
|
|
12
|
+
.filter((column) => column.accessorFn != null)
|
|
13
|
+
.map((column) => column.id)
|
|
14
|
+
.map((value) => `"${value.toString().replace(/"/g, '""')}"`)
|
|
15
|
+
.join(',')
|
|
16
|
+
]
|
|
17
|
+
.concat(table.getPrePaginationRowModel().flatRows.map((row) => row
|
|
18
|
+
.getVisibleCells()
|
|
19
|
+
.filter((cell) => cell.column.accessorFn != null)
|
|
20
|
+
.map((cell) => cell.getValue())
|
|
21
|
+
.map((value) => typeof value === 'string' ? `"${value.replace(/"/g, '""')}"` : value)
|
|
22
|
+
.join(',')))
|
|
23
|
+
.join('\n');
|
|
24
|
+
}, [table]);
|
|
25
|
+
const downloadCsvAsBlob = React.useCallback((fileName) => {
|
|
26
|
+
const blob = new Blob([createCsv()], { type: 'text/csv' });
|
|
27
|
+
const blobUrl = URL.createObjectURL(blob);
|
|
28
|
+
const element = document.createElement('a', {});
|
|
29
|
+
element.href = blobUrl;
|
|
30
|
+
element.target = '_blank';
|
|
31
|
+
element.download = `${fileName}.csv`;
|
|
32
|
+
document.body.append(element);
|
|
33
|
+
element.click();
|
|
34
|
+
element.remove();
|
|
35
|
+
}, [createCsv]);
|
|
36
|
+
return React.useMemo(() => ({
|
|
37
|
+
createCsv,
|
|
38
|
+
downloadCsvAsBlob
|
|
39
|
+
}), [createCsv, downloadCsvAsBlob]);
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=useTableExport.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useTableExport.js","sourceRoot":"","sources":["../../../../src/main/web/components/table/useTableExport.tsx"],"names":[],"mappings":";;AAUA,wCA+CC;;AAzDD,qDAA+B;AAS/B,8DAA8D;AAC9D,SAAgB,cAAc,CAAC,KAAoB;IAC/C,MAAM,SAAS,GAAG,KAAK,CAAC,WAAW,CAAC,GAAG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,IAAI,CAAC,CAAC;QAC1C,MAAM,OAAO,GAAG,QAAQ,CAAC,aAAa,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;QAChD,OAAO,CAAC,IAAI,GAAG,OAAO,CAAC;QACvB,OAAO,CAAC,MAAM,GAAG,QAAQ,CAAC;QAC1B,OAAO,CAAC,QAAQ,GAAG,GAAG,QAAQ,MAAM,CAAC;QACrC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QAC9B,OAAO,CAAC,KAAK,EAAE,CAAC;QAChB,OAAO,CAAC,MAAM,EAAE,CAAC;IACrB,CAAC,EACD,CAAC,SAAS,CAAC,CACd,CAAC;IAEF,OAAO,KAAK,CAAC,OAAO,CAChB,GAAG,EAAE,CAAC,CAAC;QACH,SAAS;QACT,iBAAiB;KACpB,CAAC,EACF,CAAC,SAAS,EAAE,iBAAiB,CAAC,CACjC,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useTableState = useTableState;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
function useTableState(table) {
|
|
6
|
+
const state = (0, react_1.useState)(table.initialState);
|
|
7
|
+
table.setOptions((previous) => ({
|
|
8
|
+
...previous,
|
|
9
|
+
onStateChange: state[1],
|
|
10
|
+
state: state[0]
|
|
11
|
+
}));
|
|
12
|
+
return state;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=useTableState.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useTableState.js","sourceRoot":"","sources":["../../../../src/main/web/components/table/useTableState.ts"],"names":[],"mappings":";;AAIA,sCAUC;AAdD,iCAAqE;AAIrE,SAAgB,aAAa,CACzB,KAAe;IAEf,MAAM,KAAK,GAAG,IAAA,gBAAQ,EAAC,KAAK,CAAC,YAAY,CAAC,CAAC;IAC3C,KAAK,CAAC,UAAU,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;QAC5B,GAAG,QAAQ;QACX,aAAa,EAAE,KAAK,CAAC,CAAC,CAAC;QACvB,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC;KAClB,CAAC,CAAC,CAAC;IACJ,OAAO,KAAK,CAAC;AACjB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function stopPropagation(event: React.SyntheticEvent): void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../src/main/web/components/table/utils.ts"],"names":[],"mappings":";;AAAA,0CAGC;AAHD,SAAgB,eAAe,CAAC,KAA2B;IACvD,KAAK,CAAC,eAAe,EAAE,CAAC;IACxB,KAAK,CAAC,cAAc,EAAE,CAAC;AAC3B,CAAC"}
|
package/lib/cjs/index.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Classes = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
tslib_1.__exportStar(require("./common"), exports);
|
|
6
|
+
tslib_1.__exportStar(require("./components/pagination"), exports);
|
|
7
|
+
tslib_1.__exportStar(require("./components/table"), exports);
|
|
8
|
+
tslib_1.__exportStar(require("./theme"), exports);
|
|
9
|
+
// @blueprintjs/core and @blueprintjs/select both export their own `Classes`
|
|
10
|
+
// namespace, ambiguous with ours from ./common — pin ours explicitly so the
|
|
11
|
+
// star exports below don't collide.
|
|
12
|
+
var common_1 = require("./common");
|
|
13
|
+
Object.defineProperty(exports, "Classes", { enumerable: true, get: function () { return common_1.Classes; } });
|
|
14
|
+
tslib_1.__exportStar(require("@blueprintjs/core"), exports);
|
|
15
|
+
tslib_1.__exportStar(require("@blueprintjs/select"), exports);
|
|
16
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/main/web/index.ts"],"names":[],"mappings":";;;;AAAA,mDAAyB;AACzB,kEAAwC;AACxC,6DAAmC;AACnC,kDAAwB;AAExB,4EAA4E;AAC5E,4EAA4E;AAC5E,oCAAoC;AACpC,mCAAmC;AAA1B,iGAAA,OAAO,OAAA;AAChB,4DAAkC;AAClC,8DAAoC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
export declare const blueprintBaseTheme: {
|
|
2
|
+
white: string;
|
|
3
|
+
gray1: string;
|
|
4
|
+
gray2: string;
|
|
5
|
+
gray3: string;
|
|
6
|
+
gray4: string;
|
|
7
|
+
gray5: string;
|
|
8
|
+
lightGray1: string;
|
|
9
|
+
lightGray2: string;
|
|
10
|
+
lightGray3: string;
|
|
11
|
+
lightGray4: string;
|
|
12
|
+
lightGray5: string;
|
|
13
|
+
darkGray1: string;
|
|
14
|
+
darkGray2: string;
|
|
15
|
+
darkGray3: string;
|
|
16
|
+
darkGray4: string;
|
|
17
|
+
darkGray5: string;
|
|
18
|
+
blue1: string;
|
|
19
|
+
blue2: string;
|
|
20
|
+
blue3: string;
|
|
21
|
+
blue4: string;
|
|
22
|
+
blue5: string;
|
|
23
|
+
green1: string;
|
|
24
|
+
green2: string;
|
|
25
|
+
green3: string;
|
|
26
|
+
green4: string;
|
|
27
|
+
green5: string;
|
|
28
|
+
orange1: string;
|
|
29
|
+
orange2: string;
|
|
30
|
+
orange3: string;
|
|
31
|
+
orange4: string;
|
|
32
|
+
orange5: string;
|
|
33
|
+
red1: string;
|
|
34
|
+
red2: string;
|
|
35
|
+
red3: string;
|
|
36
|
+
red4: string;
|
|
37
|
+
red5: string;
|
|
38
|
+
};
|
|
39
|
+
export type BlueprintBaseTheme = typeof blueprintBaseTheme;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.blueprintBaseTheme = void 0;
|
|
4
|
+
const core_1 = require("@blueprintjs/core");
|
|
5
|
+
// Blueprint's own neutral/semantic color scale, reshaped for spreading into a
|
|
6
|
+
// styled-components theme. Apps add their own brand-specific tokens (primary,
|
|
7
|
+
// accent, ...) on top — this only covers colors Blueprint already defines, so
|
|
8
|
+
// there's nothing here for an app to get "wrong" or drift on.
|
|
9
|
+
exports.blueprintBaseTheme = {
|
|
10
|
+
white: core_1.Colors.WHITE,
|
|
11
|
+
gray1: core_1.Colors.GRAY1,
|
|
12
|
+
gray2: core_1.Colors.GRAY2,
|
|
13
|
+
gray3: core_1.Colors.GRAY3,
|
|
14
|
+
gray4: core_1.Colors.GRAY4,
|
|
15
|
+
gray5: core_1.Colors.GRAY5,
|
|
16
|
+
lightGray1: core_1.Colors.LIGHT_GRAY1,
|
|
17
|
+
lightGray2: core_1.Colors.LIGHT_GRAY2,
|
|
18
|
+
lightGray3: core_1.Colors.LIGHT_GRAY3,
|
|
19
|
+
lightGray4: core_1.Colors.LIGHT_GRAY4,
|
|
20
|
+
lightGray5: core_1.Colors.LIGHT_GRAY5,
|
|
21
|
+
darkGray1: core_1.Colors.DARK_GRAY1,
|
|
22
|
+
darkGray2: core_1.Colors.DARK_GRAY2,
|
|
23
|
+
darkGray3: core_1.Colors.DARK_GRAY3,
|
|
24
|
+
darkGray4: core_1.Colors.DARK_GRAY4,
|
|
25
|
+
darkGray5: core_1.Colors.DARK_GRAY5,
|
|
26
|
+
blue1: core_1.Colors.BLUE1,
|
|
27
|
+
blue2: core_1.Colors.BLUE2,
|
|
28
|
+
blue3: core_1.Colors.BLUE3,
|
|
29
|
+
blue4: core_1.Colors.BLUE4,
|
|
30
|
+
blue5: core_1.Colors.BLUE5,
|
|
31
|
+
green1: core_1.Colors.GREEN1,
|
|
32
|
+
green2: core_1.Colors.GREEN2,
|
|
33
|
+
green3: core_1.Colors.GREEN3,
|
|
34
|
+
green4: core_1.Colors.GREEN4,
|
|
35
|
+
green5: core_1.Colors.GREEN5,
|
|
36
|
+
orange1: core_1.Colors.ORANGE1,
|
|
37
|
+
orange2: core_1.Colors.ORANGE2,
|
|
38
|
+
orange3: core_1.Colors.ORANGE3,
|
|
39
|
+
orange4: core_1.Colors.ORANGE4,
|
|
40
|
+
orange5: core_1.Colors.ORANGE5,
|
|
41
|
+
red1: core_1.Colors.RED1,
|
|
42
|
+
red2: core_1.Colors.RED2,
|
|
43
|
+
red3: core_1.Colors.RED3,
|
|
44
|
+
red4: core_1.Colors.RED4,
|
|
45
|
+
red5: core_1.Colors.RED5
|
|
46
|
+
};
|
|
47
|
+
//# sourceMappingURL=baseTheme.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"baseTheme.js","sourceRoot":"","sources":["../../../src/main/web/theme/baseTheme.ts"],"names":[],"mappings":";;;AAAA,4CAA2C;AAE3C,8EAA8E;AAC9E,8EAA8E;AAC9E,8EAA8E;AAC9E,8DAA8D;AACjD,QAAA,kBAAkB,GAAG;IAC9B,KAAK,EAAE,aAAM,CAAC,KAAK;IACnB,KAAK,EAAE,aAAM,CAAC,KAAK;IACnB,KAAK,EAAE,aAAM,CAAC,KAAK;IACnB,KAAK,EAAE,aAAM,CAAC,KAAK;IACnB,KAAK,EAAE,aAAM,CAAC,KAAK;IACnB,KAAK,EAAE,aAAM,CAAC,KAAK;IACnB,UAAU,EAAE,aAAM,CAAC,WAAW;IAC9B,UAAU,EAAE,aAAM,CAAC,WAAW;IAC9B,UAAU,EAAE,aAAM,CAAC,WAAW;IAC9B,UAAU,EAAE,aAAM,CAAC,WAAW;IAC9B,UAAU,EAAE,aAAM,CAAC,WAAW;IAC9B,SAAS,EAAE,aAAM,CAAC,UAAU;IAC5B,SAAS,EAAE,aAAM,CAAC,UAAU;IAC5B,SAAS,EAAE,aAAM,CAAC,UAAU;IAC5B,SAAS,EAAE,aAAM,CAAC,UAAU;IAC5B,SAAS,EAAE,aAAM,CAAC,UAAU;IAC5B,KAAK,EAAE,aAAM,CAAC,KAAK;IACnB,KAAK,EAAE,aAAM,CAAC,KAAK;IACnB,KAAK,EAAE,aAAM,CAAC,KAAK;IACnB,KAAK,EAAE,aAAM,CAAC,KAAK;IACnB,KAAK,EAAE,aAAM,CAAC,KAAK;IACnB,MAAM,EAAE,aAAM,CAAC,MAAM;IACrB,MAAM,EAAE,aAAM,CAAC,MAAM;IACrB,MAAM,EAAE,aAAM,CAAC,MAAM;IACrB,MAAM,EAAE,aAAM,CAAC,MAAM;IACrB,MAAM,EAAE,aAAM,CAAC,MAAM;IACrB,OAAO,EAAE,aAAM,CAAC,OAAO;IACvB,OAAO,EAAE,aAAM,CAAC,OAAO;IACvB,OAAO,EAAE,aAAM,CAAC,OAAO;IACvB,OAAO,EAAE,aAAM,CAAC,OAAO;IACvB,OAAO,EAAE,aAAM,CAAC,OAAO;IACvB,IAAI,EAAE,aAAM,CAAC,IAAI;IACjB,IAAI,EAAE,aAAM,CAAC,IAAI;IACjB,IAAI,EAAE,aAAM,CAAC,IAAI;IACjB,IAAI,EAAE,aAAM,CAAC,IAAI;IACjB,IAAI,EAAE,aAAM,CAAC,IAAI;CACpB,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export type IntentName = 'primary' | 'success' | 'warning' | 'danger' | 'default';
|
|
2
|
+
export type IntentShades = {
|
|
3
|
+
rest: string;
|
|
4
|
+
hover?: string;
|
|
5
|
+
active?: string;
|
|
6
|
+
disabled?: string;
|
|
7
|
+
foreground?: string;
|
|
8
|
+
};
|
|
9
|
+
export type SurfaceShadows = Partial<Record<0 | 1 | 2 | 3 | 4, string>>;
|
|
10
|
+
export type SurfaceText = {
|
|
11
|
+
default?: string;
|
|
12
|
+
hover?: string;
|
|
13
|
+
disabled?: string;
|
|
14
|
+
muted?: string;
|
|
15
|
+
};
|
|
16
|
+
export type BlueprintTheme = Partial<Record<IntentName, IntentShades>> & {
|
|
17
|
+
spacing?: string;
|
|
18
|
+
borderRadius?: string;
|
|
19
|
+
borderWidth?: string;
|
|
20
|
+
borderColorDefault?: string;
|
|
21
|
+
borderColorStrong?: string;
|
|
22
|
+
layerOpacity?: string;
|
|
23
|
+
shadows?: SurfaceShadows;
|
|
24
|
+
text?: SurfaceText;
|
|
25
|
+
};
|
|
26
|
+
export declare function applyBlueprintTheme(theme: BlueprintTheme, target?: HTMLElement): void;
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Blueprint 6 themes its compiled CSS via custom properties on :root (see
|
|
3
|
+
// @blueprintjs/core/lib/css/blueprint.css: --bp-intent-<name>-rest/hover/active/disabled/foreground).
|
|
4
|
+
// This lets an app drive those variables straight from its own design tokens (e.g. a
|
|
5
|
+
// styled-components theme), instead of hand-overriding compiled component selectors
|
|
6
|
+
// (which only covers the components you remembered to patch, and breaks on Blueprint
|
|
7
|
+
// upgrades) or hardcoding the same brand hex a second time in Sass.
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.applyBlueprintTheme = applyBlueprintTheme;
|
|
10
|
+
function clampByte(value) {
|
|
11
|
+
return Math.min(255, Math.max(0, Math.round(value)));
|
|
12
|
+
}
|
|
13
|
+
function hexToRgb(hex) {
|
|
14
|
+
const value = hex.replace('#', '');
|
|
15
|
+
const parts = value.length === 3
|
|
16
|
+
? value.split('').map((c) => c + c)
|
|
17
|
+
: [value.slice(0, 2), value.slice(2, 4), value.slice(4, 6)];
|
|
18
|
+
const [r, g, b] = parts.map((part) => parseInt(part, 16));
|
|
19
|
+
return [r, g, b];
|
|
20
|
+
}
|
|
21
|
+
function byteToHex(c) {
|
|
22
|
+
const hex = clampByte(c).toString(16);
|
|
23
|
+
return hex.length === 1 ? '0' + hex : hex;
|
|
24
|
+
}
|
|
25
|
+
function rgbToHex([r, g, b]) {
|
|
26
|
+
return '#' + byteToHex(r) + byteToHex(g) + byteToHex(b);
|
|
27
|
+
}
|
|
28
|
+
// Mixes `hex` toward black (target 0) or white (target 255) by `weight` (0-1),
|
|
29
|
+
// approximating what a design tool's "darken/lighten" slider would produce.
|
|
30
|
+
function mix(hex, target, weight) {
|
|
31
|
+
const rgb = hexToRgb(hex);
|
|
32
|
+
return rgbToHex(rgb.map((c) => c + (target - c) * weight));
|
|
33
|
+
}
|
|
34
|
+
function cssPropsForIntent(intent, shades) {
|
|
35
|
+
return {
|
|
36
|
+
[`--bp-intent-${intent}-rest`]: shades.rest,
|
|
37
|
+
[`--bp-intent-${intent}-hover`]: shades.hover ?? mix(shades.rest, 0, 0.15),
|
|
38
|
+
[`--bp-intent-${intent}-active`]: shades.active ?? mix(shades.rest, 0, 0.3),
|
|
39
|
+
[`--bp-intent-${intent}-disabled`]: shades.disabled ?? mix(shades.rest, 255, 0.45),
|
|
40
|
+
[`--bp-intent-${intent}-foreground`]: shades.foreground ?? '#ffffff'
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
const intentNames = ['primary', 'success', 'warning', 'danger', 'default'];
|
|
44
|
+
function applyBlueprintTheme(theme, target = document.documentElement) {
|
|
45
|
+
for (const intent of intentNames) {
|
|
46
|
+
const shades = theme[intent];
|
|
47
|
+
if (!shades) {
|
|
48
|
+
continue;
|
|
49
|
+
}
|
|
50
|
+
const cssProps = cssPropsForIntent(intent, shades);
|
|
51
|
+
for (const prop of Object.keys(cssProps)) {
|
|
52
|
+
target.style.setProperty(prop, cssProps[prop]);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
if (theme.primary) {
|
|
56
|
+
target.style.setProperty('--bp-emphasis-focus-color', theme.primary.rest);
|
|
57
|
+
}
|
|
58
|
+
if (theme.spacing != null) {
|
|
59
|
+
target.style.setProperty('--bp-surface-spacing', theme.spacing);
|
|
60
|
+
}
|
|
61
|
+
if (theme.borderRadius != null) {
|
|
62
|
+
target.style.setProperty('--bp-surface-border-radius', theme.borderRadius);
|
|
63
|
+
}
|
|
64
|
+
if (theme.borderWidth != null) {
|
|
65
|
+
target.style.setProperty('--bp-surface-border-width', theme.borderWidth);
|
|
66
|
+
}
|
|
67
|
+
if (theme.borderColorDefault != null) {
|
|
68
|
+
target.style.setProperty('--bp-surface-border-color-default', theme.borderColorDefault);
|
|
69
|
+
}
|
|
70
|
+
if (theme.borderColorStrong != null) {
|
|
71
|
+
target.style.setProperty('--bp-surface-border-color-strong', theme.borderColorStrong);
|
|
72
|
+
}
|
|
73
|
+
if (theme.layerOpacity != null) {
|
|
74
|
+
target.style.setProperty('--bp-surface-layer-opacity', theme.layerOpacity);
|
|
75
|
+
}
|
|
76
|
+
if (theme.shadows) {
|
|
77
|
+
for (const level of Object.keys(theme.shadows)) {
|
|
78
|
+
const value = theme.shadows[level];
|
|
79
|
+
if (value != null) {
|
|
80
|
+
target.style.setProperty(`--bp-surface-shadow-${level}`, value);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
if (theme.text) {
|
|
85
|
+
if (theme.text.default != null) {
|
|
86
|
+
target.style.setProperty('--bp-typography-color-default-rest', theme.text.default);
|
|
87
|
+
}
|
|
88
|
+
if (theme.text.hover != null) {
|
|
89
|
+
target.style.setProperty('--bp-typography-color-default-hover', theme.text.hover);
|
|
90
|
+
}
|
|
91
|
+
if (theme.text.disabled != null) {
|
|
92
|
+
target.style.setProperty('--bp-typography-color-default-disabled', theme.text.disabled);
|
|
93
|
+
}
|
|
94
|
+
if (theme.text.muted != null) {
|
|
95
|
+
target.style.setProperty('--bp-typography-color-muted', theme.text.muted);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
//# sourceMappingURL=blueprintTheme.js.map
|