@coveord/plasma-mantine 49.3.4 → 49.3.6
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/.turbo/turbo-build.log +3 -3
- package/.turbo/turbo-test.log +29 -29
- package/dist/.tsbuildinfo +1 -1
- package/dist/cjs/components/collection/CollectionItem.js +6 -0
- package/dist/cjs/components/collection/CollectionItem.js.map +1 -1
- package/dist/cjs/components/table/Table.js +10 -53
- package/dist/cjs/components/table/Table.js.map +1 -1
- package/dist/cjs/components/table/Table.styles.js +56 -0
- package/dist/cjs/components/table/Table.styles.js.map +1 -0
- package/dist/cjs/components/table/Table.types.js +6 -0
- package/dist/cjs/components/table/Table.types.js.map +1 -0
- package/dist/cjs/components/table/TableActions.js +3 -3
- package/dist/cjs/components/table/TableActions.js.map +1 -1
- package/dist/cjs/components/table/TableContext.js +18 -3
- package/dist/cjs/components/table/TableContext.js.map +1 -1
- package/dist/cjs/components/table/TableDateRangePicker.js +2 -2
- package/dist/cjs/components/table/TableDateRangePicker.js.map +1 -1
- package/dist/cjs/components/table/TableFilter.js +2 -2
- package/dist/cjs/components/table/TableFilter.js.map +1 -1
- package/dist/cjs/components/table/TableHeader.js +2 -2
- package/dist/cjs/components/table/TableHeader.js.map +1 -1
- package/dist/cjs/components/table/TablePagination.js +2 -2
- package/dist/cjs/components/table/TablePagination.js.map +1 -1
- package/dist/cjs/components/table/TablePerPage.js +2 -2
- package/dist/cjs/components/table/TablePerPage.js.map +1 -1
- package/dist/cjs/components/table/TablePredicate.js +2 -2
- package/dist/cjs/components/table/TablePredicate.js.map +1 -1
- package/dist/cjs/components/table/index.js +7 -1
- package/dist/cjs/components/table/index.js.map +1 -1
- package/dist/cjs/components/table/useRowSelection.js +27 -17
- package/dist/cjs/components/table/useRowSelection.js.map +1 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/definitions/components/table/Table.d.ts +1 -98
- package/dist/definitions/components/table/Table.d.ts.map +1 -1
- package/dist/definitions/components/table/Table.styles.d.ts +11 -0
- package/dist/definitions/components/table/Table.styles.d.ts.map +1 -0
- package/dist/definitions/components/table/Table.types.d.ts +177 -0
- package/dist/definitions/components/table/Table.types.d.ts.map +1 -0
- package/dist/definitions/components/table/TableActions.d.ts.map +1 -1
- package/dist/definitions/components/table/TableContext.d.ts +4 -71
- package/dist/definitions/components/table/TableContext.d.ts.map +1 -1
- package/dist/definitions/components/table/TableFilter.d.ts.map +1 -1
- package/dist/definitions/components/table/TablePagination.d.ts.map +1 -1
- package/dist/definitions/components/table/TablePerPage.d.ts.map +1 -1
- package/dist/definitions/components/table/TablePredicate.d.ts.map +1 -1
- package/dist/definitions/components/table/index.d.ts +2 -2
- package/dist/definitions/components/table/index.d.ts.map +1 -1
- package/dist/definitions/components/table/useRowSelection.d.ts +4 -1
- package/dist/definitions/components/table/useRowSelection.d.ts.map +1 -1
- package/dist/definitions/index.d.ts +1 -1
- package/dist/definitions/index.d.ts.map +1 -1
- package/dist/esm/components/collection/CollectionItem.js +6 -0
- package/dist/esm/components/collection/CollectionItem.js.map +1 -1
- package/dist/esm/components/table/Table.js +11 -54
- package/dist/esm/components/table/Table.js.map +1 -1
- package/dist/esm/components/table/Table.styles.js +46 -0
- package/dist/esm/components/table/Table.styles.js.map +1 -0
- package/dist/esm/components/table/Table.types.js +3 -0
- package/dist/esm/components/table/Table.types.js.map +1 -0
- package/dist/esm/components/table/TableActions.js +2 -2
- package/dist/esm/components/table/TableActions.js.map +1 -1
- package/dist/esm/components/table/TableContext.js +8 -1
- package/dist/esm/components/table/TableContext.js.map +1 -1
- package/dist/esm/components/table/TableDateRangePicker.js +1 -1
- package/dist/esm/components/table/TableDateRangePicker.js.map +1 -1
- package/dist/esm/components/table/TableFilter.js +1 -1
- package/dist/esm/components/table/TableFilter.js.map +1 -1
- package/dist/esm/components/table/TableHeader.js +1 -1
- package/dist/esm/components/table/TableHeader.js.map +1 -1
- package/dist/esm/components/table/TablePagination.js +1 -1
- package/dist/esm/components/table/TablePagination.js.map +1 -1
- package/dist/esm/components/table/TablePerPage.js +1 -1
- package/dist/esm/components/table/TablePerPage.js.map +1 -1
- package/dist/esm/components/table/TablePredicate.js +2 -2
- package/dist/esm/components/table/TablePredicate.js.map +1 -1
- package/dist/esm/components/table/index.js +1 -1
- package/dist/esm/components/table/index.js.map +1 -1
- package/dist/esm/components/table/useRowSelection.js +26 -17
- package/dist/esm/components/table/useRowSelection.js.map +1 -1
- package/dist/esm/index.js.map +1 -1
- package/package.json +6 -5
- package/src/components/collection/CollectionItem.tsx +2 -2
- package/src/components/table/Table.styles.ts +58 -0
- package/src/components/table/Table.tsx +18 -173
- package/src/components/table/Table.types.ts +203 -0
- package/src/components/table/TableActions.tsx +10 -3
- package/src/components/table/TableContext.tsx +9 -70
- package/src/components/table/TableDateRangePicker.tsx +1 -1
- package/src/components/table/TableFilter.tsx +2 -3
- package/src/components/table/TableHeader.tsx +1 -1
- package/src/components/table/TablePagination.tsx +3 -3
- package/src/components/table/TablePerPage.tsx +2 -3
- package/src/components/table/TablePredicate.tsx +3 -2
- package/src/components/table/__tests__/Table.spec.tsx +59 -22
- package/src/components/table/index.ts +2 -2
- package/src/components/table/useRowSelection.ts +36 -21
- package/src/index.ts +2 -0
- package/dist/cjs/components/table/useTable.js +0 -21
- package/dist/cjs/components/table/useTable.js.map +0 -1
- package/dist/definitions/components/table/useTable.d.ts +0 -16
- package/dist/definitions/components/table/useTable.d.ts.map +0 -1
- package/dist/esm/components/table/useTable.js +0 -11
- package/dist/esm/components/table/useTable.js.map +0 -1
- package/src/components/table/useTable.tsx +0 -11
|
@@ -12,14 +12,14 @@ var _objectSpread = require("@swc/helpers/lib/_object_spread.js").default;
|
|
|
12
12
|
var _objectSpreadProps = require("@swc/helpers/lib/_object_spread_props.js").default;
|
|
13
13
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
14
14
|
var _core = require("@mantine/core");
|
|
15
|
-
var
|
|
15
|
+
var _tableContext = require("./TableContext");
|
|
16
16
|
var TablePerPage = function(param) {
|
|
17
17
|
var _param_label = param.label, label = _param_label === void 0 ? "Results per page" : _param_label, _param_values = param.values, values = _param_values === void 0 ? [
|
|
18
18
|
25,
|
|
19
19
|
50,
|
|
20
20
|
100
|
|
21
21
|
] : _param_values;
|
|
22
|
-
var
|
|
22
|
+
var _useTable = (0, _tableContext.useTable)(), state = _useTable.state, setState = _useTable.setState;
|
|
23
23
|
var updatePerPage = function(newPerPage) {
|
|
24
24
|
setState(function(prevState) {
|
|
25
25
|
return _objectSpreadProps(_objectSpread({}, prevState), {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/table/TablePerPage.tsx"],"sourcesContent":["import {Group, SegmentedControl, Text} from '@mantine/core';\nimport {
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/table/TablePerPage.tsx"],"sourcesContent":["import {Group, SegmentedControl, Text} from '@mantine/core';\nimport {FunctionComponent} from 'react';\n\nimport {useTable} from './TableContext';\n\ninterface TablePerPageProps {\n /**\n * The label displayed before the control\n *\n * @default Results per page\n */\n label?: string;\n /**\n * The per page choices to display\n *\n * @default [25, 50, 100]\n */\n values?: number[];\n}\n\nexport const TablePerPage: FunctionComponent<TablePerPageProps> & {DEFAULT_SIZE: number} = ({\n label = 'Results per page',\n values = [25, 50, 100],\n}) => {\n const {state, setState} = useTable();\n\n const updatePerPage = (newPerPage: string) => {\n setState((prevState) => ({\n ...prevState,\n pagination: {pageIndex: 0, pageSize: parseInt(newPerPage, 10)},\n }));\n };\n\n return (\n <Group>\n <Text>{label}</Text>\n <SegmentedControl\n value={state.pagination.pageSize.toString() ?? values?.[1].toString()}\n onChange={updatePerPage}\n data={values.map((value) => value.toString())}\n color=\"action\"\n size=\"md\"\n />\n </Group>\n );\n};\n\nTablePerPage.DEFAULT_SIZE = 50;\n"],"names":["TablePerPage","label","values","useTable","state","setState","updatePerPage","newPerPage","prevState","pagination","pageIndex","pageSize","parseInt","Group","Text","SegmentedControl","value","toString","onChange","data","map","color","size","DEFAULT_SIZE"],"mappings":";;;;+BAoBaA;;;eAAAA;;;;;;oBApB+B;4BAGrB;AAiBhB,IAAMA,eAA8E,gBAGrF;6BAFFC,OAAAA,kCAAQ,yDACRC,QAAAA,oCAAS;QAAC;QAAI;QAAI;KAAI;IAEtB,IAA0BC,YAAAA,IAAAA,sBAAQ,KAA3BC,QAAmBD,UAAnBC,OAAOC,WAAYF,UAAZE;IAEd,IAAMC,gBAAgB,SAACC,YAAuB;QAC1CF,SAAS,SAACG;mBAAe,qCAClBA;gBACHC,YAAY;oBAACC,WAAW;oBAAGC,UAAUC,SAASL,YAAY;gBAAG;;;IAErE;QAMmBH;IAJnB,qBACI,sBAACS,WAAK;;0BACF,qBAACC,UAAI;0BAAEb;;0BACP,qBAACc,sBAAgB;gBACbC,OAAOZ,CAAAA,sCAAAA,MAAMK,UAAU,CAACE,QAAQ,CAACM,QAAQ,gBAAlCb,iDAAAA,sCAAwCF,mBAAAA,oBAAAA,KAAAA,IAAAA,MAAQ,CAAC,EAAE,CAACe,QAAQ,EAAE;gBACrEC,UAAUZ;gBACVa,MAAMjB,OAAOkB,GAAG,CAAC,SAACJ;2BAAUA,MAAMC,QAAQ;;gBAC1CI,OAAM;gBACNC,MAAK;;;;AAIrB;AAEAtB,aAAauB,YAAY,GAAG"}
|
|
@@ -13,10 +13,10 @@ var _objectSpread = require("@swc/helpers/lib/_object_spread.js").default;
|
|
|
13
13
|
var _objectSpreadProps = require("@swc/helpers/lib/_object_spread_props.js").default;
|
|
14
14
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
15
15
|
var _core = require("@mantine/core");
|
|
16
|
-
var
|
|
16
|
+
var _tableContext = require("./TableContext");
|
|
17
17
|
var TablePredicate = function(param) {
|
|
18
18
|
var id = param.id, data = param.data, label = param.label;
|
|
19
|
-
var
|
|
19
|
+
var _useTable = (0, _tableContext.useTable)(), onChange = _useTable.onChange, form = _useTable.form;
|
|
20
20
|
var onUpdate = function(newValue) {
|
|
21
21
|
form.setFieldValue("predicates", _objectSpreadProps(_objectSpread({}, form.values.predicates), _defineProperty({}, id, newValue)));
|
|
22
22
|
onChange === null || onChange === void 0 ? void 0 : onChange();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/table/TablePredicate.tsx"],"sourcesContent":["import {Select, SelectItem,
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/table/TablePredicate.tsx"],"sourcesContent":["import {Group, Select, SelectItem, Text} from '@mantine/core';\nimport {FunctionComponent} from 'react';\n\nimport {useTable} from './TableContext';\n\ninterface TablePredicateProps {\n /**\n * Unique identifier for this predicate. Will be used to access the selected value in the table state\n */\n id: string;\n /**\n * The values to display in the predicate\n */\n data: SelectItem[];\n /**\n * Input label (not displayed for now)\n *\n * @default default to the predicate id\n */\n label?: string;\n}\n\nexport const TablePredicate: FunctionComponent<TablePredicateProps> = ({id, data, label}) => {\n const {onChange, form} = useTable();\n\n const onUpdate = (newValue: string) => {\n form.setFieldValue('predicates', {...form.values.predicates, [id]: newValue});\n onChange?.();\n };\n\n return (\n <Group spacing=\"xs\">\n {label ? <Text>{label}:</Text> : null}\n <Select\n withinPortal\n value={form.values.predicates[id]}\n onChange={onUpdate}\n data={data}\n aria-label={label ?? id}\n searchable={data.length > 7}\n />\n </Group>\n );\n};\n"],"names":["TablePredicate","id","data","label","useTable","onChange","form","onUpdate","newValue","setFieldValue","values","predicates","Group","spacing","Text","Select","withinPortal","value","aria-label","searchable","length"],"mappings":";;;;+BAsBaA;;;eAAAA;;;;;;;oBAtBiC;4BAGvB;AAmBhB,IAAMA,iBAAyD,gBAAuB;QAArBC,WAAAA,IAAIC,aAAAA,MAAMC,cAAAA;IAC9E,IAAyBC,YAAAA,IAAAA,sBAAQ,KAA1BC,WAAkBD,UAAlBC,UAAUC,OAAQF,UAARE;IAEjB,IAAMC,WAAW,SAACC,UAAqB;QACnCF,KAAKG,aAAa,CAAC,cAAc,qCAAIH,KAAKI,MAAM,CAACC,UAAU,GAAE,oBAACV,IAAKO;QACnEH,qBAAAA,sBAAAA,KAAAA,IAAAA;IACJ;IAEA,qBACI,sBAACO,WAAK;QAACC,SAAQ;;YACVV,sBAAQ,sBAACW,UAAI;;oBAAEX;oBAAM;;iBAAW,IAAI;0BACrC,qBAACY,YAAM;gBACHC,YAAY;gBACZC,OAAOX,KAAKI,MAAM,CAACC,UAAU,CAACV,GAAG;gBACjCI,UAAUE;gBACVL,MAAMA;gBACNgB,cAAYf,kBAAAA,mBAAAA,QAASF,EAAE;gBACvBkB,YAAYjB,KAAKkB,MAAM,GAAG;;;;AAI1C"}
|
|
@@ -2,8 +2,14 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
|
+
Object.defineProperty(exports, "useTable", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return _tableContext.useTable;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
5
11
|
var _exportStar = require("@swc/helpers/lib/_export_star.js").default;
|
|
6
12
|
_exportStar(require("./Table"), exports);
|
|
7
|
-
|
|
13
|
+
var _tableContext = require("./TableContext");
|
|
8
14
|
|
|
9
15
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/table/index.ts"],"sourcesContent":["export * from './Table';\nexport {
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/table/index.ts"],"sourcesContent":["export * from './Table';\nexport {useTable} from './TableContext';\nexport {type onTableChangeEvent, type InitialTableState, type TableState, type TableProps} from './Table.types';\n"],"names":["useTable"],"mappings":";;;;+BACQA;;;eAAAA,sBAAQ;;;;oBADF;4BACS"}
|
|
@@ -8,31 +8,40 @@ Object.defineProperty(exports, "useRowSelection", {
|
|
|
8
8
|
return useRowSelection;
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
|
+
var _interopRequireDefault = require("@swc/helpers/lib/_interop_require_default.js").default;
|
|
11
12
|
var _objectSpread = require("@swc/helpers/lib/_object_spread.js").default;
|
|
12
13
|
var _objectSpreadProps = require("@swc/helpers/lib/_object_spread_props.js").default;
|
|
13
|
-
var
|
|
14
|
+
var _hooks = require("@mantine/hooks");
|
|
14
15
|
var _tableCore = require("@tanstack/table-core");
|
|
15
|
-
var
|
|
16
|
-
var useRowSelection = function(table) {
|
|
17
|
-
var
|
|
16
|
+
var _fastDeepEqual = /*#__PURE__*/ _interopRequireDefault(require("fast-deep-equal"));
|
|
17
|
+
var useRowSelection = function(table, param) {
|
|
18
|
+
var multiRowSelectionEnabled = param.multiRowSelectionEnabled;
|
|
19
|
+
var outsideClickRef = (0, _hooks.useClickOutside)(function() {
|
|
20
|
+
if (!multiRowSelectionEnabled) {
|
|
21
|
+
clearSelection();
|
|
22
|
+
}
|
|
23
|
+
});
|
|
18
24
|
table.setOptions(function(prev) {
|
|
19
25
|
return _objectSpreadProps(_objectSpread({}, prev), {
|
|
20
26
|
onRowSelectionChange: function(rowSelectionUpdater) {
|
|
21
27
|
table.setState(function(old) {
|
|
22
|
-
var
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
var newRowSelection = (0, _tableCore.functionalUpdate)(rowSelectionUpdater, old["rowSelection"]);
|
|
29
|
+
if ((0, _fastDeepEqual.default)(old["rowSelection"], newRowSelection)) {
|
|
30
|
+
return old;
|
|
31
|
+
}
|
|
32
|
+
var rows = table.getRowModel().rowsById;
|
|
33
|
+
Object.keys(newRowSelection).forEach(function(rowId) {
|
|
34
|
+
if (newRowSelection[rowId] === true) {
|
|
35
|
+
var _rows_rowId;
|
|
36
|
+
if (!rows[rowId]) {
|
|
37
|
+
console.error("The table was not initialized properly, the rowSelection state should contain an object of type Record<string, TData>.");
|
|
30
38
|
}
|
|
31
|
-
|
|
32
|
-
|
|
39
|
+
var _rows_rowId_original;
|
|
40
|
+
newRowSelection[rowId] = (_rows_rowId_original = (_rows_rowId = rows[rowId]) === null || _rows_rowId === void 0 ? void 0 : _rows_rowId.original) !== null && _rows_rowId_original !== void 0 ? _rows_rowId_original : true;
|
|
41
|
+
}
|
|
33
42
|
});
|
|
34
43
|
return _objectSpreadProps(_objectSpread({}, old), {
|
|
35
|
-
rowSelection:
|
|
44
|
+
rowSelection: newRowSelection
|
|
36
45
|
});
|
|
37
46
|
});
|
|
38
47
|
}
|
|
@@ -42,7 +51,7 @@ var useRowSelection = function(table) {
|
|
|
42
51
|
table.resetRowSelection(true);
|
|
43
52
|
};
|
|
44
53
|
var getSelectedRows = function() {
|
|
45
|
-
return Object.values(rowSelection);
|
|
54
|
+
return Object.values(table.getState().rowSelection);
|
|
46
55
|
};
|
|
47
56
|
var _getSelectedRows_;
|
|
48
57
|
var getSelectedRow = function() {
|
|
@@ -51,7 +60,8 @@ var useRowSelection = function(table) {
|
|
|
51
60
|
return {
|
|
52
61
|
clearSelection: clearSelection,
|
|
53
62
|
getSelectedRow: getSelectedRow,
|
|
54
|
-
getSelectedRows: getSelectedRows
|
|
63
|
+
getSelectedRows: getSelectedRows,
|
|
64
|
+
outsideClickRef: outsideClickRef
|
|
55
65
|
};
|
|
56
66
|
};
|
|
57
67
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/table/useRowSelection.ts"],"sourcesContent":["import {functionalUpdate, Table} from '@tanstack/table-core';\nimport {
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/table/useRowSelection.ts"],"sourcesContent":["import {useClickOutside} from '@mantine/hooks';\nimport {functionalUpdate, RowSelectionState, Table} from '@tanstack/table-core';\nimport isEqual from 'fast-deep-equal';\n\nimport {RowSelectionWithData, TableProps, TableState} from './Table.types';\n\nexport const useRowSelection = <T>(\n table: Table<T>,\n {multiRowSelectionEnabled}: Pick<TableProps<T>, 'multiRowSelectionEnabled'>\n) => {\n const outsideClickRef = useClickOutside(() => {\n if (!multiRowSelectionEnabled) {\n clearSelection();\n }\n });\n\n table.setOptions((prev) => ({\n ...prev,\n onRowSelectionChange: (rowSelectionUpdater) => {\n table.setState((old) => {\n const newRowSelection = functionalUpdate(\n rowSelectionUpdater,\n old['rowSelection']\n ) as RowSelectionWithData<T>;\n\n if (isEqual(old['rowSelection'], newRowSelection)) {\n return old;\n }\n\n const rows = table.getRowModel().rowsById;\n\n Object.keys(newRowSelection).forEach((rowId) => {\n if (newRowSelection[rowId] === true) {\n if (!rows[rowId]) {\n console.error(\n 'The table was not initialized properly, the rowSelection state should contain an object of type Record<string, TData>.'\n );\n }\n newRowSelection[rowId] = rows[rowId]?.original ?? (true as T);\n }\n });\n\n return {\n ...old,\n rowSelection: newRowSelection as RowSelectionState,\n };\n });\n },\n }));\n\n const clearSelection = () => {\n table.resetRowSelection(true);\n };\n\n const getSelectedRows = () => Object.values((table.getState() as TableState<T>).rowSelection);\n\n const getSelectedRow = () => getSelectedRows()[0] ?? null;\n\n return {clearSelection, getSelectedRow, getSelectedRows, outsideClickRef};\n};\n"],"names":["useRowSelection","table","multiRowSelectionEnabled","outsideClickRef","useClickOutside","clearSelection","setOptions","prev","onRowSelectionChange","rowSelectionUpdater","setState","old","newRowSelection","functionalUpdate","isEqual","rows","getRowModel","rowsById","Object","keys","forEach","rowId","console","error","original","rowSelection","resetRowSelection","getSelectedRows","values","getState","getSelectedRow"],"mappings":";;;;+BAMaA;;;eAAAA;;;;;;qBANiB;yBAC2B;kEACrC;AAIb,IAAMA,kBAAkB,SAC3BC,cAEC;QADAC,iCAAAA;IAED,IAAMC,kBAAkBC,IAAAA,sBAAe,EAAC,WAAM;QAC1C,IAAI,CAACF,0BAA0B;YAC3BG;QACJ,CAAC;IACL;IAEAJ,MAAMK,UAAU,CAAC,SAACC;QAAU,OAAA,qCACrBA;YACHC,sBAAsB,SAACC,qBAAwB;gBAC3CR,MAAMS,QAAQ,CAAC,SAACC,KAAQ;oBACpB,IAAMC,kBAAkBC,IAAAA,2BAAgB,EACpCJ,qBACAE,GAAG,CAAC,eAAe;oBAGvB,IAAIG,IAAAA,sBAAO,EAACH,GAAG,CAAC,eAAe,EAAEC,kBAAkB;wBAC/C,OAAOD;oBACX,CAAC;oBAED,IAAMI,OAAOd,MAAMe,WAAW,GAAGC,QAAQ;oBAEzCC,OAAOC,IAAI,CAACP,iBAAiBQ,OAAO,CAAC,SAACC,OAAU;wBAC5C,IAAIT,eAAe,CAACS,MAAM,KAAK,IAAI,EAAE;gCAMRN;4BALzB,IAAI,CAACA,IAAI,CAACM,MAAM,EAAE;gCACdC,QAAQC,KAAK,CACT;4BAER,CAAC;gCACwBR;4BAAzBH,eAAe,CAACS,MAAM,GAAGN,CAAAA,uBAAAA,CAAAA,cAAAA,IAAI,CAACM,MAAM,cAAXN,yBAAAA,KAAAA,IAAAA,YAAaS,QAAQ,cAArBT,kCAAAA,uBAA0B,IAAI,AAAM;wBACjE,CAAC;oBACL;oBAEA,OAAO,qCACAJ;wBACHc,cAAcb;;gBAEtB;YACJ;;;IAGJ,IAAMP,iBAAiB,WAAM;QACzBJ,MAAMyB,iBAAiB,CAAC,IAAI;IAChC;IAEA,IAAMC,kBAAkB;eAAMT,OAAOU,MAAM,CAAC,AAAC3B,MAAM4B,QAAQ,GAAqBJ,YAAY;;QAE/DE;IAA7B,IAAMG,iBAAiB;eAAMH,CAAAA,oBAAAA,iBAAiB,CAAC,EAAE,cAApBA,+BAAAA,oBAAwB,IAAI;;IAEzD,OAAO;QAACtB,gBAAAA;QAAgByB,gBAAAA;QAAgBH,iBAAAA;QAAiBxB,iBAAAA;IAAe;AAC5E"}
|
package/dist/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/index.ts"],"sourcesContent":["import {Tuple} from '@mantine/core';\n\nimport {PlasmaColors} from './theme/PlasmaColors';\n\nexport * from '@mantine/carousel';\nexport * from '@mantine/core';\nexport type {FormValidateInput} from '@mantine/form/lib/types';\nexport * from '@mantine/hooks';\nexport * from '@tanstack/table-core';\nexport * from './components';\nexport * from '@mantine/form';\nexport {Pagination} from '@mantine/core';\n// explicitly overriding mantine components\nexport {\n Header,\n Table,\n type TableProps,\n type HeaderProps,\n Modal,\n Button,\n type ButtonProps,\n Menu,\n type MenuItemProps,\n} from './components';\nexport {useForm, createFormContext} from './form';\n\nexport * from './theme';\n\ndeclare module '@mantine/core' {\n export interface MantineThemeColorsOverride {\n // eslint-disable-next-line @typescript-eslint/ban-types\n colors: Record<keyof typeof PlasmaColors | (string & {}), Tuple<string, 10>>;\n }\n}\n"],"names":["Pagination","Header","Table","Modal","Button","Menu","useForm","createFormContext"],"mappings":";;;;;;;;;;;IAWQA,UAAU;eAAVA,gBAAU;;IAGdC,MAAM;eAANA,kBAAM;;IACNC,KAAK;eAALA,iBAAK;;
|
|
1
|
+
{"version":3,"sources":["../../src/index.ts"],"sourcesContent":["import {Tuple} from '@mantine/core';\n\nimport {PlasmaColors} from './theme/PlasmaColors';\n\nexport * from '@mantine/carousel';\nexport * from '@mantine/core';\nexport type {FormValidateInput} from '@mantine/form/lib/types';\nexport * from '@mantine/hooks';\nexport * from '@tanstack/table-core';\nexport * from './components';\nexport * from '@mantine/form';\nexport {Pagination} from '@mantine/core';\n// explicitly overriding mantine components\nexport {\n Header,\n Table,\n type TableProps,\n type TableState,\n type InitialTableState,\n type HeaderProps,\n Modal,\n Button,\n type ButtonProps,\n Menu,\n type MenuItemProps,\n} from './components';\nexport {useForm, createFormContext} from './form';\n\nexport * from './theme';\n\ndeclare module '@mantine/core' {\n export interface MantineThemeColorsOverride {\n // eslint-disable-next-line @typescript-eslint/ban-types\n colors: Record<keyof typeof PlasmaColors | (string & {}), Tuple<string, 10>>;\n }\n}\n"],"names":["Pagination","Header","Table","Modal","Button","Menu","useForm","createFormContext"],"mappings":";;;;;;;;;;;IAWQA,UAAU;eAAVA,gBAAU;;IAGdC,MAAM;eAANA,kBAAM;;IACNC,KAAK;eAALA,iBAAK;;IAKLC,KAAK;eAALA,iBAAK;;IACLC,MAAM;eAANA,kBAAM;;IAENC,IAAI;eAAJA,gBAAI;;IAGAC,OAAO;eAAPA,aAAO;;IAAEC,iBAAiB;eAAjBA,uBAAiB;;;;oBAtBpB;gCACA;oBAEA;oBACA;sCACA;oBACA;oBAgB2B;oBAE3B"}
|
|
@@ -1,100 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { CoreOptions, InitialTableState, TableOptions } from '@tanstack/table-core';
|
|
3
|
-
import { ReactElement, ReactNode } from 'react';
|
|
4
|
-
import { TableActions } from './TableActions';
|
|
5
|
-
import { TableAccordionColumn, TableCollapsibleColumn } from './TableCollapsibleColumn';
|
|
6
|
-
import { onTableChangeEvent, TableFormType } from './TableContext';
|
|
7
|
-
import { TableDateRangePicker } from './TableDateRangePicker';
|
|
8
|
-
import { TableFilter } from './TableFilter';
|
|
9
|
-
import { TableFooter } from './TableFooter';
|
|
10
|
-
import { TableHeader } from './TableHeader';
|
|
11
|
-
import { TablePagination } from './TablePagination';
|
|
12
|
-
import { TablePerPage } from './TablePerPage';
|
|
13
|
-
import { TablePredicate } from './TablePredicate';
|
|
14
|
-
export interface TableProps<T> {
|
|
15
|
-
/**
|
|
16
|
-
* Data to display in the table
|
|
17
|
-
*/
|
|
18
|
-
data: T[];
|
|
19
|
-
/**
|
|
20
|
-
* Defines how each row is uniquely identified. It is highly recommended that you specify this prop to an ID that makes sense.
|
|
21
|
-
*/
|
|
22
|
-
getRowId?: CoreOptions<T>['getRowId'];
|
|
23
|
-
/**
|
|
24
|
-
* Columns to display in the table.
|
|
25
|
-
*
|
|
26
|
-
* @see https://tanstack.com/table/v8/docs/guide/column-defs
|
|
27
|
-
*/
|
|
28
|
-
columns: Array<ColumnDef<T>>;
|
|
29
|
-
/**
|
|
30
|
-
* Function called when the table mounts
|
|
31
|
-
*
|
|
32
|
-
* @param state the state of the table
|
|
33
|
-
*/
|
|
34
|
-
onMount?: onTableChangeEvent;
|
|
35
|
-
/**
|
|
36
|
-
* Function called when the table should update
|
|
37
|
-
*
|
|
38
|
-
* @param state the state of the table
|
|
39
|
-
*/
|
|
40
|
-
onChange?: onTableChangeEvent;
|
|
41
|
-
/**
|
|
42
|
-
* Function that generates the expandable content of a row
|
|
43
|
-
* Return null for rows that don't need to be expandable
|
|
44
|
-
*
|
|
45
|
-
* @param datum the row for which the children should be generated.
|
|
46
|
-
*/
|
|
47
|
-
getExpandChildren?: (datum: T) => ReactNode;
|
|
48
|
-
/**
|
|
49
|
-
* React children to show when the table has no rows to show. You can leverage useTable to get the state of the table
|
|
50
|
-
*/
|
|
51
|
-
noDataChildren?: ReactNode;
|
|
52
|
-
/**
|
|
53
|
-
* Whether the table is loading or not
|
|
54
|
-
*
|
|
55
|
-
* @default false
|
|
56
|
-
*/
|
|
57
|
-
loading?: boolean;
|
|
58
|
-
/**
|
|
59
|
-
* Childrens to display in the table. They need to be wrap in either `Table.Header` or `Table.Footer`
|
|
60
|
-
*
|
|
61
|
-
* @example
|
|
62
|
-
* <Table ...>
|
|
63
|
-
* <Table.Header>
|
|
64
|
-
* <div>Hello</div>
|
|
65
|
-
* </Table.Header>
|
|
66
|
-
* </Table>
|
|
67
|
-
*/
|
|
68
|
-
children?: ReactNode;
|
|
69
|
-
/**
|
|
70
|
-
* Initial state of the table
|
|
71
|
-
*/
|
|
72
|
-
initialState?: InitialTableState & Partial<TableFormType>;
|
|
73
|
-
/**
|
|
74
|
-
* Action passed when user double clicks on a row
|
|
75
|
-
*/
|
|
76
|
-
doubleClickAction?: (datum: T) => void;
|
|
77
|
-
/**
|
|
78
|
-
* Whether the user can select multiple rows in order to perform actions in bulk
|
|
79
|
-
*
|
|
80
|
-
* @default false
|
|
81
|
-
*/
|
|
82
|
-
multiRowSelectionEnabled?: boolean;
|
|
83
|
-
options?: Omit<Partial<TableOptions<T>>, 'initialState' | 'data' | 'columns' | 'manualPagination' | 'enableMultiRowSelection' | 'getRowId' | 'getRowCanExpand' | 'enableRowSelection'>;
|
|
84
|
-
}
|
|
85
|
-
interface TableType {
|
|
86
|
-
<T>(props: TableProps<T>): ReactElement;
|
|
87
|
-
Actions: typeof TableActions;
|
|
88
|
-
Filter: typeof TableFilter;
|
|
89
|
-
Footer: typeof TableFooter;
|
|
90
|
-
Header: typeof TableHeader;
|
|
91
|
-
Pagination: typeof TablePagination;
|
|
92
|
-
PerPage: typeof TablePerPage;
|
|
93
|
-
Predicate: typeof TablePredicate;
|
|
94
|
-
DateRangePicker: typeof TableDateRangePicker;
|
|
95
|
-
CollapsibleColumn: typeof TableCollapsibleColumn;
|
|
96
|
-
AccordionColumn: typeof TableAccordionColumn;
|
|
97
|
-
}
|
|
1
|
+
import { TableType } from './Table.types';
|
|
98
2
|
export declare const Table: TableType;
|
|
99
|
-
export {};
|
|
100
3
|
//# sourceMappingURL=Table.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Table.d.ts","sourceRoot":"","sources":["../../../../src/components/table/Table.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Table.d.ts","sourceRoot":"","sources":["../../../../src/components/table/Table.tsx"],"names":[],"mappings":"AAiBA,OAAO,EAAwC,SAAS,EAAC,MAAM,eAAe,CAAC;AAe/E,eAAO,MAAM,KAAK,EAAE,SAsLnB,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
interface TableStylesParams {
|
|
2
|
+
hasHeader: boolean;
|
|
3
|
+
multiRowSelectionEnabled: boolean;
|
|
4
|
+
}
|
|
5
|
+
declare const useStyles: (params: TableStylesParams, options?: import("@mantine/core").UseStylesOptions<string>) => {
|
|
6
|
+
classes: Record<string, string>;
|
|
7
|
+
cx: (...args: any) => string;
|
|
8
|
+
theme: import("@mantine/core").MantineTheme;
|
|
9
|
+
};
|
|
10
|
+
export default useStyles;
|
|
11
|
+
//# sourceMappingURL=Table.styles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Table.styles.d.ts","sourceRoot":"","sources":["../../../../src/components/table/Table.styles.ts"],"names":[],"mappings":"AAEA,UAAU,iBAAiB;IACvB,SAAS,EAAE,OAAO,CAAC;IACnB,wBAAwB,EAAE,OAAO,CAAC;CACrC;AAED,QAAA,MAAM,SAAS;;;;CAgDb,CAAC;AAEH,eAAe,SAAS,CAAC"}
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
import { DateRangePickerValue } from '@mantine/dates';
|
|
2
|
+
import { UseFormReturnType } from '@mantine/form';
|
|
3
|
+
import { ColumnDef, CoreOptions, InitialTableState as TanstackInitialTableState, TableOptions, TableState as TanstackTableState } from '@tanstack/table-core';
|
|
4
|
+
import { Dispatch, ReactElement, ReactNode, RefObject } from 'react';
|
|
5
|
+
import { TableActions } from './TableActions';
|
|
6
|
+
import { TableAccordionColumn, TableCollapsibleColumn } from './TableCollapsibleColumn';
|
|
7
|
+
import { TableDateRangePicker } from './TableDateRangePicker';
|
|
8
|
+
import { TableFilter } from './TableFilter';
|
|
9
|
+
import { TableFooter } from './TableFooter';
|
|
10
|
+
import { TableHeader } from './TableHeader';
|
|
11
|
+
import { TablePagination } from './TablePagination';
|
|
12
|
+
import { TablePerPage } from './TablePerPage';
|
|
13
|
+
import { TablePredicate } from './TablePredicate';
|
|
14
|
+
export type RowSelectionWithData<TData> = Record<string, TData>;
|
|
15
|
+
export interface RowSelectionState<TData> {
|
|
16
|
+
rowSelection: RowSelectionWithData<TData>;
|
|
17
|
+
}
|
|
18
|
+
export interface TableState<TData> extends Omit<TanstackTableState, 'rowSelection'>, RowSelectionState<TData> {
|
|
19
|
+
}
|
|
20
|
+
export interface InitialTableState<TData> extends Omit<TanstackInitialTableState, 'rowSelection'>, Partial<RowSelectionState<TData>>, Partial<TableFormType> {
|
|
21
|
+
}
|
|
22
|
+
export type onTableChangeEvent<TData> = (params: TableState<TData> & TableFormType) => void;
|
|
23
|
+
export type TableFormType = {
|
|
24
|
+
/**
|
|
25
|
+
* Object containing the table predicates and their selected values
|
|
26
|
+
*
|
|
27
|
+
* @example {type: "LONG", origin: "system"}
|
|
28
|
+
*/
|
|
29
|
+
predicates: Record<string, string>;
|
|
30
|
+
/**
|
|
31
|
+
* Selected date range in the table
|
|
32
|
+
*
|
|
33
|
+
* @example [new Date(2022, 0, 1), new Date(2022, 0, 31)]
|
|
34
|
+
*/
|
|
35
|
+
dateRange: DateRangePickerValue;
|
|
36
|
+
};
|
|
37
|
+
export type TableContextType<TData> = {
|
|
38
|
+
/**
|
|
39
|
+
* Function to call when the table needs an update
|
|
40
|
+
*/
|
|
41
|
+
onChange: () => void;
|
|
42
|
+
/**
|
|
43
|
+
* Internal state of the table
|
|
44
|
+
*
|
|
45
|
+
* @see https://tanstack.com/table/v8/docs/api/core/table#state
|
|
46
|
+
*/
|
|
47
|
+
state: TableState<TData>;
|
|
48
|
+
/**
|
|
49
|
+
* Function to update the table state
|
|
50
|
+
*/
|
|
51
|
+
setState: Dispatch<(prevState: TableState<TData>) => TableState<TData>>;
|
|
52
|
+
/**
|
|
53
|
+
* Whether the table currently as any kind of filter applied.
|
|
54
|
+
* Useful to determine if the noDataChildren is an empty state or just the result of a filter
|
|
55
|
+
*/
|
|
56
|
+
isFiltered: boolean;
|
|
57
|
+
/**
|
|
58
|
+
* Function that clears the filter and predicates
|
|
59
|
+
*/
|
|
60
|
+
clearFilters: () => void;
|
|
61
|
+
/**
|
|
62
|
+
* Function that returns the selected row if any.
|
|
63
|
+
*/
|
|
64
|
+
getSelectedRow: () => TData | null;
|
|
65
|
+
/**
|
|
66
|
+
* Function that returns an array of the selected rows. Most useful when multi row selection is enabled.
|
|
67
|
+
*/
|
|
68
|
+
getSelectedRows: () => TData[];
|
|
69
|
+
/**
|
|
70
|
+
* Function that clear the selected row
|
|
71
|
+
*/
|
|
72
|
+
clearSelection: () => void;
|
|
73
|
+
/**
|
|
74
|
+
* Form used to handle predicates and dateRange
|
|
75
|
+
*/
|
|
76
|
+
form: UseFormReturnType<TableFormType>;
|
|
77
|
+
/**
|
|
78
|
+
* Table container ref
|
|
79
|
+
*/
|
|
80
|
+
containerRef: RefObject<HTMLDivElement>;
|
|
81
|
+
/**
|
|
82
|
+
* Whether multi row selection is activated
|
|
83
|
+
*/
|
|
84
|
+
multiRowSelectionEnabled: boolean;
|
|
85
|
+
/**
|
|
86
|
+
* Function that returns the number of pages
|
|
87
|
+
*/
|
|
88
|
+
getPageCount: () => number;
|
|
89
|
+
};
|
|
90
|
+
export interface TableProps<T> {
|
|
91
|
+
/**
|
|
92
|
+
* Data to display in the table
|
|
93
|
+
*/
|
|
94
|
+
data: T[];
|
|
95
|
+
/**
|
|
96
|
+
* Defines how each row is uniquely identified. It is highly recommended that you specify this prop to an ID that makes sense.
|
|
97
|
+
*/
|
|
98
|
+
getRowId?: CoreOptions<T>['getRowId'];
|
|
99
|
+
/**
|
|
100
|
+
* Columns to display in the table.
|
|
101
|
+
*
|
|
102
|
+
* @see https://tanstack.com/table/v8/docs/guide/column-defs
|
|
103
|
+
*/
|
|
104
|
+
columns: Array<ColumnDef<T>>;
|
|
105
|
+
/**
|
|
106
|
+
* Function called when the table mounts
|
|
107
|
+
*
|
|
108
|
+
* @param state the state of the table
|
|
109
|
+
*/
|
|
110
|
+
onMount?: onTableChangeEvent<T>;
|
|
111
|
+
/**
|
|
112
|
+
* Function called when the table should update
|
|
113
|
+
*
|
|
114
|
+
* @param state the state of the table
|
|
115
|
+
*/
|
|
116
|
+
onChange?: onTableChangeEvent<T>;
|
|
117
|
+
/**
|
|
118
|
+
* Function that generates the expandable content of a row
|
|
119
|
+
* Return null for rows that don't need to be expandable
|
|
120
|
+
*
|
|
121
|
+
* @param datum the row for which the children should be generated.
|
|
122
|
+
*/
|
|
123
|
+
getExpandChildren?: (datum: T) => ReactNode;
|
|
124
|
+
/**
|
|
125
|
+
* React children to show when the table has no rows to show. You can leverage useTable to get the state of the table
|
|
126
|
+
*/
|
|
127
|
+
noDataChildren?: ReactNode;
|
|
128
|
+
/**
|
|
129
|
+
* Whether the table is loading or not
|
|
130
|
+
*
|
|
131
|
+
* @default false
|
|
132
|
+
*/
|
|
133
|
+
loading?: boolean;
|
|
134
|
+
/**
|
|
135
|
+
* Childrens to display in the table. They need to be wrap in either `Table.Header` or `Table.Footer`
|
|
136
|
+
*
|
|
137
|
+
* @example
|
|
138
|
+
* <Table ...>
|
|
139
|
+
* <Table.Header>
|
|
140
|
+
* <div>Hello</div>
|
|
141
|
+
* </Table.Header>
|
|
142
|
+
* </Table>
|
|
143
|
+
*/
|
|
144
|
+
children?: ReactNode;
|
|
145
|
+
/**
|
|
146
|
+
* Initial state of the table
|
|
147
|
+
*/
|
|
148
|
+
initialState?: InitialTableState<T>;
|
|
149
|
+
/**
|
|
150
|
+
* Action passed when user double clicks on a row
|
|
151
|
+
*/
|
|
152
|
+
doubleClickAction?: (datum: T) => void;
|
|
153
|
+
/**
|
|
154
|
+
* Whether the user can select multiple rows in order to perform actions in bulk
|
|
155
|
+
*
|
|
156
|
+
* @default false
|
|
157
|
+
*/
|
|
158
|
+
multiRowSelectionEnabled?: boolean;
|
|
159
|
+
/**
|
|
160
|
+
* Additional options that can be passed to the table
|
|
161
|
+
*/
|
|
162
|
+
options?: Omit<Partial<TableOptions<T>>, 'initialState' | 'data' | 'columns' | 'manualPagination' | 'enableMultiRowSelection' | 'getRowId' | 'getRowCanExpand' | 'enableRowSelection' | 'onRowSelectionChange'>;
|
|
163
|
+
}
|
|
164
|
+
export interface TableType {
|
|
165
|
+
<T>(props: TableProps<T>): ReactElement;
|
|
166
|
+
Actions: typeof TableActions;
|
|
167
|
+
Filter: typeof TableFilter;
|
|
168
|
+
Footer: typeof TableFooter;
|
|
169
|
+
Header: typeof TableHeader;
|
|
170
|
+
Pagination: typeof TablePagination;
|
|
171
|
+
PerPage: typeof TablePerPage;
|
|
172
|
+
Predicate: typeof TablePredicate;
|
|
173
|
+
DateRangePicker: typeof TableDateRangePicker;
|
|
174
|
+
CollapsibleColumn: typeof TableCollapsibleColumn;
|
|
175
|
+
AccordionColumn: typeof TableAccordionColumn;
|
|
176
|
+
}
|
|
177
|
+
//# sourceMappingURL=Table.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Table.types.d.ts","sourceRoot":"","sources":["../../../../src/components/table/Table.types.ts"],"names":[],"mappings":"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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TableActions.d.ts","sourceRoot":"","sources":["../../../../src/components/table/TableActions.tsx"],"names":[],"mappings":"AACA,OAAO,EAAC,YAAY,EAAE,SAAS,EAAC,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"TableActions.d.ts","sourceRoot":"","sources":["../../../../src/components/table/TableActions.tsx"],"names":[],"mappings":"AACA,OAAO,EAAC,YAAY,EAAE,SAAS,EAAC,MAAM,OAAO,CAAC;AAI9C,UAAU,iBAAiB,CAAC,CAAC;IACzB;;;;;;;;;;;;;;;;;;OAkBG;IACH,QAAQ,EAAE,CAAC,CAAC,KAAK,EAAE,CAAC,KAAK,SAAS,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,EAAE,KAAK,SAAS,CAAC,CAAC;CACpE;AAED,eAAO,MAAM,YAAY,6CAA2C,YAenE,CAAC"}
|
|
@@ -1,72 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
export type onTableChangeEvent = (params: TableState & TableFormType) => void;
|
|
6
|
-
export type TableFormType = {
|
|
7
|
-
/**
|
|
8
|
-
* Object containing the table predicates and their selected values
|
|
9
|
-
*
|
|
10
|
-
* @example {type: "LONG", origin: "system"}
|
|
11
|
-
*/
|
|
12
|
-
predicates: Record<string, string>;
|
|
13
|
-
/**
|
|
14
|
-
* Selected date range in the table
|
|
15
|
-
*
|
|
16
|
-
* @example [new Date(2022, 0, 1), new Date(2022, 0, 31)]
|
|
17
|
-
*/
|
|
18
|
-
dateRange: DateRangePickerValue;
|
|
19
|
-
};
|
|
20
|
-
type TableContextType = {
|
|
21
|
-
/**
|
|
22
|
-
* Function to call when the table needs an update
|
|
23
|
-
*/
|
|
24
|
-
onChange: () => void;
|
|
25
|
-
/**
|
|
26
|
-
* Internal state of the table
|
|
27
|
-
*
|
|
28
|
-
* @see https://tanstack.com/table/v8/docs/api/core/table#state
|
|
29
|
-
*/
|
|
30
|
-
state: TableState;
|
|
31
|
-
/**
|
|
32
|
-
* Function to update the table state
|
|
33
|
-
*/
|
|
34
|
-
setState: Dispatch<(prevState: TableState) => TableState>;
|
|
35
|
-
/**
|
|
36
|
-
* Whether the table currently as any kind of filter applied.
|
|
37
|
-
* Useful to determine if the noDataChildren is an empty state or just the result of a filter
|
|
38
|
-
*/
|
|
39
|
-
isFiltered: boolean;
|
|
40
|
-
/**
|
|
41
|
-
* Function that clears the filter and predicates
|
|
42
|
-
*/
|
|
43
|
-
clearFilters: () => void;
|
|
44
|
-
/**
|
|
45
|
-
* Function that returns the selected row if any.
|
|
46
|
-
*/
|
|
47
|
-
getSelectedRow: () => any | null;
|
|
48
|
-
/**
|
|
49
|
-
* Function that returns an array of the selected rows. Most useful when multi row selection is enabled.
|
|
50
|
-
*/
|
|
51
|
-
getSelectedRows: () => any[];
|
|
52
|
-
/**
|
|
53
|
-
* Function that clear the selected row
|
|
54
|
-
*/
|
|
55
|
-
clearSelection: () => void;
|
|
56
|
-
/**
|
|
57
|
-
* Form used to handle predicates and dateRange
|
|
58
|
-
*/
|
|
59
|
-
form: UseFormReturnType<TableFormType>;
|
|
60
|
-
/**
|
|
61
|
-
* Table container ref
|
|
62
|
-
*/
|
|
63
|
-
containerRef: RefObject<HTMLDivElement>;
|
|
64
|
-
multiRowSelectionEnabled: boolean;
|
|
65
|
-
/**
|
|
66
|
-
* Function that returns the number of pages
|
|
67
|
-
*/
|
|
68
|
-
getPageCount: () => number;
|
|
69
|
-
};
|
|
70
|
-
export declare const TableContext: import("react").Context<TableContextType>;
|
|
71
|
-
export {};
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { TableContextType } from './Table.types';
|
|
3
|
+
export declare const TableContext: import("react").Context<TableContextType<any>>;
|
|
4
|
+
export declare const useTable: <T>() => TableContextType<T>;
|
|
72
5
|
//# sourceMappingURL=TableContext.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TableContext.d.ts","sourceRoot":"","sources":["../../../../src/components/table/TableContext.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"TableContext.d.ts","sourceRoot":"","sources":["../../../../src/components/table/TableContext.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAC,gBAAgB,EAAC,MAAM,eAAe,CAAC;AAE/C,eAAO,MAAM,YAAY,gDAAoD,CAAC;AAE9E,eAAO,MAAM,QAAQ,8BAOpB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TableFilter.d.ts","sourceRoot":"","sources":["../../../../src/components/table/TableFilter.tsx"],"names":[],"mappings":"AACA,OAAO,EAA2B,YAAY,EAAE,SAAS,EAAY,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"TableFilter.d.ts","sourceRoot":"","sources":["../../../../src/components/table/TableFilter.tsx"],"names":[],"mappings":"AACA,OAAO,EAA2B,YAAY,EAAE,SAAS,EAAY,MAAM,eAAe,CAAC;AAC3F,OAAO,EAAqB,iBAAiB,EAAoB,MAAM,OAAO,CAAC;AAI/E,QAAA,MAAM,SAAS;;;;CAOZ,CAAC;AAEJ,KAAK,sBAAsB,GAAG,SAAS,CAAC,OAAO,SAAS,CAAC,CAAC;AAC1D,UAAU,gBAAiB,SAAQ,YAAY,CAAC,sBAAsB,CAAC;IACnE;;;;OAIG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,eAAO,MAAM,WAAW,EAAE,iBAAiB,CAAC,gBAAgB,CAgD3D,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TablePagination.d.ts","sourceRoot":"","sources":["../../../../src/components/table/TablePagination.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"TablePagination.d.ts","sourceRoot":"","sources":["../../../../src/components/table/TablePagination.tsx"],"names":[],"mappings":"AACA,OAAO,EAAC,iBAAiB,EAAC,MAAM,OAAO,CAAC;AAIxC,UAAU,oBAAoB;IAC1B;;OAEG;IACH,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;CAC7B;AAED,eAAO,MAAM,eAAe,EAAE,iBAAiB,CAAC,oBAAoB,CA+BnE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TablePerPage.d.ts","sourceRoot":"","sources":["../../../../src/components/table/TablePerPage.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"TablePerPage.d.ts","sourceRoot":"","sources":["../../../../src/components/table/TablePerPage.tsx"],"names":[],"mappings":"AACA,OAAO,EAAC,iBAAiB,EAAC,MAAM,OAAO,CAAC;AAIxC,UAAU,iBAAiB;IACvB;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;CACrB;AAED,eAAO,MAAM,YAAY,EAAE,iBAAiB,CAAC,iBAAiB,CAAC,GAAG;IAAC,YAAY,EAAE,MAAM,CAAA;CAyBtF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TablePredicate.d.ts","sourceRoot":"","sources":["../../../../src/components/table/TablePredicate.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"TablePredicate.d.ts","sourceRoot":"","sources":["../../../../src/components/table/TablePredicate.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAgB,UAAU,EAAO,MAAM,eAAe,CAAC;AAC9D,OAAO,EAAC,iBAAiB,EAAC,MAAM,OAAO,CAAC;AAIxC,UAAU,mBAAmB;IACzB;;OAEG;IACH,EAAE,EAAE,MAAM,CAAC;IACX;;OAEG;IACH,IAAI,EAAE,UAAU,EAAE,CAAC;IACnB;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,eAAO,MAAM,cAAc,EAAE,iBAAiB,CAAC,mBAAmB,CAqBjE,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export * from './Table';
|
|
2
|
-
export {
|
|
3
|
-
export
|
|
2
|
+
export { useTable } from './TableContext';
|
|
3
|
+
export { type onTableChangeEvent, type InitialTableState, type TableState, type TableProps } from './Table.types';
|
|
4
4
|
//# sourceMappingURL=index.d.ts.map
|