@inseefr/lunatic 3.2.1 → 3.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { LunaticComponents } from '../LunaticComponents';
|
|
3
3
|
import { getComponentErrors } from '../shared/ComponentErrors/ComponentErrors';
|
|
4
|
-
import { Label } from '../shared/Label/Label';
|
|
5
4
|
import { Td, Tbody, Tr, TableHeader, Table as BaseTable, } from '../shared/Table';
|
|
6
|
-
import { Declarations } from '../shared/Declarations/Declarations';
|
|
7
5
|
export function Table(props) {
|
|
8
|
-
const { id, body, header, errors,
|
|
9
|
-
|
|
10
|
-
return (_jsxs(_Fragment, { children: [_jsx(Label, { htmlFor: id, id: labelId, children: label }), _jsx(Declarations, { type: "AFTER_QUESTION_TEXT", declarations: declarations, id: id }), _jsxs(BaseTable, { id: id, errors: getComponentErrors(errors, id), children: [_jsx(TableHeader, { header: header }), _jsx(Tbody, { children: body.map((row, rowIndex) => (_jsx(Tr, { row: rowIndex, children: _jsx(LunaticComponents, { components: row, wrapper: ({ colspan, rowspan, ...props }) => (_jsx(Td, { row: rowIndex, colSpan: colspan, rowSpan: rowspan, ...props })) }) }, rowIndex))) })] })] }));
|
|
6
|
+
const { id, body, header, errors, declarations, label } = props;
|
|
7
|
+
return (_jsxs(BaseTable, { id: id, errors: getComponentErrors(errors, id), declarations: declarations, label: label, children: [_jsx(TableHeader, { header: header }), _jsx(Tbody, { children: body.map((row, rowIndex) => (_jsx(Tr, { row: rowIndex, children: _jsx(LunaticComponents, { components: row, wrapper: ({ colspan, rowspan, ...props }) => (_jsx(Td, { row: rowIndex, colSpan: colspan, rowSpan: rowspan, ...props })) }) }, rowIndex))) })] }));
|
|
11
8
|
}
|
|
12
9
|
//# sourceMappingURL=Table.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Table.js","sourceRoot":"","sources":["../../../src/components/Table/Table.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,kBAAkB,EAAE,MAAM,2CAA2C,CAAC;AAC/E,OAAO,
|
|
1
|
+
{"version":3,"file":"Table.js","sourceRoot":"","sources":["../../../src/components/Table/Table.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,kBAAkB,EAAE,MAAM,2CAA2C,CAAC;AAC/E,OAAO,EACN,EAAE,EACF,KAAK,EACL,EAAE,EACF,WAAW,EACX,KAAK,IAAI,SAAS,GAClB,MAAM,iBAAiB,CAAC;AAGzB,MAAM,UAAU,KAAK,CAAC,KAAqC;IAC1D,MAAM,EAAE,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,GAAG,KAAK,CAAC;IAEhE,OAAO,CACN,MAAC,SAAS,IACT,EAAE,EAAE,EAAE,EACN,MAAM,EAAE,kBAAkB,CAAC,MAAM,EAAE,EAAE,CAAC,EACtC,YAAY,EAAE,YAAY,EAC1B,KAAK,EAAE,KAAK,aAEZ,KAAC,WAAW,IAAC,MAAM,EAAE,MAAM,GAAI,EAC/B,KAAC,KAAK,cACJ,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,QAAQ,EAAE,EAAE,CAAC,CAC5B,KAAC,EAAE,IAAC,GAAG,EAAE,QAAQ,YAChB,KAAC,iBAAiB,IAMjB,UAAU,EAAE,GAAG,EACf,OAAO,EAAE,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,KAAK,EAAE,EAAE,EAAE,CAAC,CAC5C,KAAC,EAAE,IACF,GAAG,EAAE,QAAQ,EACb,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,OAAO,KACZ,KAAK,GACR,CACF,GACA,IAhBqB,QAAQ,CAiB3B,CACL,CAAC,GACK,IACG,CACZ,CAAC;AACH,CAAC"}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import React, { type PropsWithChildren } from 'react';
|
|
2
2
|
import type { LunaticError } from '../../../use-lunatic/type';
|
|
3
|
-
type
|
|
4
|
-
|
|
5
|
-
id?: string;
|
|
3
|
+
import type { LunaticComponentProps } from '../../type';
|
|
4
|
+
type Props = PropsWithChildren<Pick<LunaticComponentProps<'Table'>, 'className' | 'id' | 'label' | 'declarations'> & {
|
|
6
5
|
errors?: LunaticError[];
|
|
7
6
|
}>;
|
|
8
7
|
export declare const Table: React.ComponentType<Props>;
|
|
@@ -3,8 +3,12 @@ import React, {} from 'react';
|
|
|
3
3
|
import classnames from 'classnames';
|
|
4
4
|
import { slottableComponent } from '../HOC/slottableComponent';
|
|
5
5
|
import { ComponentErrors } from '../ComponentErrors/ComponentErrors';
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
import { Label } from '../Label/Label';
|
|
7
|
+
import { Declarations } from '../Declarations/Declarations';
|
|
8
|
+
function LunaticTable({ id, className, children, errors, declarations, label, }) {
|
|
9
|
+
const tableId = `table-${id}`;
|
|
10
|
+
const labelId = `label-${id}`;
|
|
11
|
+
return (_jsxs(_Fragment, { children: [_jsx(Label, { htmlFor: tableId, id: labelId, children: label }), _jsx(Declarations, { type: "AFTER_QUESTION_TEXT", declarations: declarations, id: id }), _jsx("table", { id: tableId, className: classnames('lunatic-table', className), children: children }), _jsx(ComponentErrors, { errors: errors })] }));
|
|
8
12
|
}
|
|
9
13
|
export const Table = slottableComponent('Table', LunaticTable);
|
|
10
14
|
//# sourceMappingURL=Table.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Table.js","sourceRoot":"","sources":["../../../../src/components/shared/Table/Table.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,EAA0B,MAAM,OAAO,CAAC;AACtD,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAE/D,OAAO,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;
|
|
1
|
+
{"version":3,"file":"Table.js","sourceRoot":"","sources":["../../../../src/components/shared/Table/Table.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,EAA0B,MAAM,OAAO,CAAC;AACtD,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAE/D,OAAO,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AAErE,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACvC,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAW5D,SAAS,YAAY,CAAC,EACrB,EAAE,EACF,SAAS,EACT,QAAQ,EACR,MAAM,EACN,YAAY,EACZ,KAAK,GACE;IACP,MAAM,OAAO,GAAG,SAAS,EAAE,EAAE,CAAC;IAC9B,MAAM,OAAO,GAAG,SAAS,EAAE,EAAE,CAAC;IAE9B,OAAO,CACN,8BACC,KAAC,KAAK,IAAC,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,OAAO,YAClC,KAAK,GACC,EACR,KAAC,YAAY,IACZ,IAAI,EAAC,qBAAqB,EAC1B,YAAY,EAAE,YAAY,EAC1B,EAAE,EAAE,EAAE,GACL,EACF,gBAAO,EAAE,EAAE,OAAO,EAAE,SAAS,EAAE,UAAU,CAAC,eAAe,EAAE,SAAS,CAAC,YACnE,QAAQ,GACF,EACR,KAAC,eAAe,IAAC,MAAM,EAAE,MAAM,GAAI,IACjC,CACH,CAAC;AACH,CAAC;AAED,MAAM,CAAC,MAAM,KAAK,GAAG,kBAAkB,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC"}
|