@mtes-mct/monitor-ui 24.2.1 → 24.3.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/CHANGELOG.md +37 -0
- package/index.js +16 -7
- package/package.json +2 -2
- package/tables/DataTable/index.d.ts +6 -4
- package/tables/DataTable/index.d.ts.map +1 -1
- package/tables/SimpleTable/Td.d.ts.map +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,40 @@
|
|
|
1
|
+
## [24.3.0](https://github.com/MTES-MCT/monitor-ui/compare/v24.2.1...v24.3.0) (2024-10-24)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* **tables:** add isTableHeadHidden prop to DataTable ([fb723b0](https://github.com/MTES-MCT/monitor-ui/commit/fb723b078bf132806806ef7305d79b5d8e0ad926))
|
|
7
|
+
* **tables:** add tableOptions prop to DataTable ([1a28bae](https://github.com/MTES-MCT/monitor-ui/commit/1a28bae13c859b074c404673bd1cfc62d16c5518))
|
|
8
|
+
* **tables:** allow any object as collection item in DataTable data ([06ab17c](https://github.com/MTES-MCT/monitor-ui/commit/06ab17cc724021c40cb31b8dfdb212ea14d1e4c7))
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* **tables:** remove wrong 0 max-width from SimpleTable.Td ([e75b525](https://github.com/MTES-MCT/monitor-ui/commit/e75b525501fb6b84603d3484b332a898dbbdd9ac))
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
### Buid System & Dependencies
|
|
17
|
+
|
|
18
|
+
* **deps:** bump tslib in the non-major-dependencies group ([c686c05](https://github.com/MTES-MCT/monitor-ui/commit/c686c056e3db44295ee5effebb94c39b0c32ab60))
|
|
19
|
+
* **dev-deps:** bump eslint-plugin-cypress from 3.5.0 to 4.0.0 ([6411931](https://github.com/MTES-MCT/monitor-ui/commit/641193149549795a2be2cef4b7a4b773d6eedbad))
|
|
20
|
+
* **dev-deps:** bump glob from 10.4.3 to 11.0.0 ([9fbf7af](https://github.com/MTES-MCT/monitor-ui/commit/9fbf7af3b7c22ff296e6013f9cd48ef973685ba4))
|
|
21
|
+
* **dev-deps:** bump the all-non-major-dependencies group ([7030e2c](https://github.com/MTES-MCT/monitor-ui/commit/7030e2ceceadd5525c0557ca954dcae120819d32))
|
|
22
|
+
* **dev-deps:** bump the non-major-dev-dependencies group with 13 updates ([1e1f0d2](https://github.com/MTES-MCT/monitor-ui/commit/1e1f0d272674250a2f0cea4c209f1d0ec824d6a3))
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
### Documentation
|
|
26
|
+
|
|
27
|
+
* **tables:** add comment to DataTable ([139ed72](https://github.com/MTES-MCT/monitor-ui/commit/139ed72e68600744ae3406d94a14172d54e178a6))
|
|
28
|
+
* **tables:** remove useless generated doc exports from DataTable story ([e8ff655](https://github.com/MTES-MCT/monitor-ui/commit/e8ff6550401d56e0ce34c81be4bd28182d350b13))
|
|
29
|
+
|
|
30
|
+
## [24.2.1](https://github.com/MTES-MCT/monitor-ui/compare/v24.2.0...v24.2.1) (2024-10-18)
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
### Code Refactoring
|
|
34
|
+
|
|
35
|
+
* **fields:** move eslint disable ([1c1533a](https://github.com/MTES-MCT/monitor-ui/commit/1c1533af36f8180c6921d71a137f537256a70e1f))
|
|
36
|
+
* **fields:** rename props ([e6ef3de](https://github.com/MTES-MCT/monitor-ui/commit/e6ef3de40c22f596abe24c99cea8f5d4db481569))
|
|
37
|
+
|
|
1
38
|
## [24.2.0](https://github.com/MTES-MCT/monitor-ui/compare/v24.1.1...v24.2.0) (2024-10-18)
|
|
2
39
|
|
|
3
40
|
|
package/index.js
CHANGED
|
@@ -73834,7 +73834,6 @@ const Td$2 = styled.td.attrs((props)=>({
|
|
|
73834
73834
|
font-size: 13px;
|
|
73835
73835
|
font-weight: 500;
|
|
73836
73836
|
line-height: 22px;
|
|
73837
|
-
max-width: 0;
|
|
73838
73837
|
overflow: hidden;
|
|
73839
73838
|
padding: 9px 10px;
|
|
73840
73839
|
text-align: ${(p)=>p.$isCenter ? 'center' : 'left'};
|
|
@@ -73967,7 +73966,7 @@ function Th$1({ children, header }) {
|
|
|
73967
73966
|
}, header.id);
|
|
73968
73967
|
}
|
|
73969
73968
|
|
|
73970
|
-
function DataTable({ columns, data, initialSorting }) {
|
|
73969
|
+
function DataTable({ columns, data, initialSorting, tableOptions, withoutHead = false }) {
|
|
73971
73970
|
const [sorting, setSorting] = useState(initialSorting);
|
|
73972
73971
|
const table = useReactTable({
|
|
73973
73972
|
columns,
|
|
@@ -73979,7 +73978,8 @@ function DataTable({ columns, data, initialSorting }) {
|
|
|
73979
73978
|
onSortingChange: setSorting,
|
|
73980
73979
|
state: {
|
|
73981
73980
|
sorting
|
|
73982
|
-
}
|
|
73981
|
+
},
|
|
73982
|
+
...tableOptions
|
|
73983
73983
|
});
|
|
73984
73984
|
const { rows } = table.getRowModel();
|
|
73985
73985
|
return /*#__PURE__*/ jsxs(Fragment, {
|
|
@@ -73994,16 +73994,18 @@ function DataTable({ columns, data, initialSorting }) {
|
|
|
73994
73994
|
}),
|
|
73995
73995
|
data.length > 0 && /*#__PURE__*/ jsxs(SimpleTable.Table, {
|
|
73996
73996
|
children: [
|
|
73997
|
-
/*#__PURE__*/ jsx(SimpleTable.Head, {
|
|
73997
|
+
!withoutHead && /*#__PURE__*/ jsx(SimpleTable.Head, {
|
|
73998
73998
|
children: table.getHeaderGroups().map((headerGroup)=>/*#__PURE__*/ jsx("tr", {
|
|
73999
73999
|
children: headerGroup.headers.map((header)=>/*#__PURE__*/ jsx(Th$1, {
|
|
74000
74000
|
header: header
|
|
74001
74001
|
}, header.id))
|
|
74002
74002
|
}, headerGroup.id))
|
|
74003
74003
|
}),
|
|
74004
|
-
/*#__PURE__*/ jsx(
|
|
74005
|
-
|
|
74006
|
-
|
|
74004
|
+
/*#__PURE__*/ jsx(TBody, {
|
|
74005
|
+
$withTopBorder: withoutHead,
|
|
74006
|
+
children: rows.map((row)=>// `data-id` is expected by `cy.getTableRowById()` custom command
|
|
74007
|
+
/*#__PURE__*/ jsx(SimpleTable.BodyTr, {
|
|
74008
|
+
"data-id": 'id' in row.original ? row.original.id : row.id,
|
|
74007
74009
|
children: row.getVisibleCells().map((cell)=>/*#__PURE__*/ jsx(Td$1, {
|
|
74008
74010
|
cell: cell
|
|
74009
74011
|
}, cell.id))
|
|
@@ -74016,6 +74018,13 @@ function DataTable({ columns, data, initialSorting }) {
|
|
|
74016
74018
|
]
|
|
74017
74019
|
});
|
|
74018
74020
|
}
|
|
74021
|
+
const TBody = styled.tbody`
|
|
74022
|
+
> tr {
|
|
74023
|
+
> td {
|
|
74024
|
+
border-top: ${(p)=>p.$withTopBorder ? `1px solid ${p.theme.color.lightGray}` : 0};
|
|
74025
|
+
}
|
|
74026
|
+
}
|
|
74027
|
+
`;
|
|
74019
74028
|
|
|
74020
74029
|
function RowCheckbox({ onChange, ...nativeProps }) {
|
|
74021
74030
|
const handleOnChange = useCallback((_value, _checked, event)=>{
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mtes-mct/monitor-ui",
|
|
3
3
|
"description": "Common React components, hooks, utilities and CSS stylesheets for MonitorFish, MonitorEnv and RapportNav.",
|
|
4
|
-
"version": "24.
|
|
4
|
+
"version": "24.3.1",
|
|
5
5
|
"license": "AGPL-3.0",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"engines": {
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"@tanstack/react-table": "8.20.5",
|
|
13
13
|
"@tanstack/react-virtual": "beta",
|
|
14
14
|
"prop-types": "15.8.1",
|
|
15
|
-
"tslib": "2.
|
|
15
|
+
"tslib": "2.8.0"
|
|
16
16
|
},
|
|
17
17
|
"peerDependencies": {
|
|
18
18
|
"@sentry/react": "^7.0.0 || ^8.0.0",
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import { type ColumnDef, type SortingState } from '@tanstack/react-table';
|
|
2
|
-
import type {
|
|
3
|
-
export type DataTableProps<T extends
|
|
1
|
+
import { type ColumnDef, type SortingState, type TableOptions } from '@tanstack/react-table';
|
|
2
|
+
import type { AnyObject } from '../../types/definitions';
|
|
3
|
+
export type DataTableProps<T extends AnyObject> = {
|
|
4
4
|
columns: Array<ColumnDef<T>>;
|
|
5
5
|
data: T[] | undefined;
|
|
6
6
|
initialSorting: SortingState;
|
|
7
|
+
tableOptions?: Partial<TableOptions<T>> | undefined;
|
|
8
|
+
withoutHead?: boolean | undefined;
|
|
7
9
|
};
|
|
8
|
-
export declare function DataTable<T extends
|
|
10
|
+
export declare function DataTable<T extends AnyObject>({ columns, data, initialSorting, tableOptions, withoutHead }: DataTableProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
9
11
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/tables/DataTable/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,SAAS,EACd,KAAK,YAAY,EAIlB,MAAM,uBAAuB,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/tables/DataTable/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,SAAS,EACd,KAAK,YAAY,EACjB,KAAK,YAAY,EAIlB,MAAM,uBAAuB,CAAA;AAQ9B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAA;AAExD,MAAM,MAAM,cAAc,CAAC,CAAC,SAAS,SAAS,IAAI;IAChD,OAAO,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAA;IAC5B,IAAI,EAAE,CAAC,EAAE,GAAG,SAAS,CAAA;IACrB,cAAc,EAAE,YAAY,CAAA;IAC5B,YAAY,CAAC,EAAE,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,GAAG,SAAS,CAAA;IACnD,WAAW,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;CAClC,CAAA;AACD,wBAAgB,SAAS,CAAC,CAAC,SAAS,SAAS,EAAE,EAC7C,OAAO,EACP,IAAI,EACJ,cAAc,EACd,YAAY,EACZ,WAAmB,EACpB,EAAE,cAAc,CAAC,CAAC,CAAC,2CAyDnB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Td.d.ts","sourceRoot":"","sources":["../../../src/tables/SimpleTable/Td.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,OAAO,CAAA;AAM7C,eAAO,MAAM,EAAE;gBAHD,OAAO,GAAG,SAAS;iBAClB,OAAO,GAAG,SAAS;
|
|
1
|
+
{"version":3,"file":"Td.d.ts","sourceRoot":"","sources":["../../../src/tables/SimpleTable/Td.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,OAAO,CAAA;AAM7C,eAAO,MAAM,EAAE;gBAHD,OAAO,GAAG,SAAS;iBAClB,OAAO,GAAG,SAAS;6EAyBjC,CAAA"}
|