@m4l/components 9.4.45 → 9.4.46
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/components/datagrids/Datagrid.styles.d.ts.map +1 -1
- package/components/datagrids/Datagrid.styles.js +358 -272
- package/components/datagrids/components/BaseDataGrid/BaseDataGrid.d.ts.map +1 -1
- package/components/datagrids/components/BaseDataGrid/BaseDataGrid.js +47 -45
- package/components/datagrids/contexts/DataGridContext/DataGridContext.d.ts.map +1 -1
- package/components/datagrids/contexts/DataGridContext/DataGridContext.js +237 -178
- package/components/datagrids/contexts/DataGridContext/types.d.ts +13 -4
- package/components/datagrids/contexts/DataGridContext/types.d.ts.map +1 -1
- package/components/datagrids/dictionary.d.ts +1 -0
- package/components/datagrids/dictionary.d.ts.map +1 -1
- package/components/datagrids/dictionary.js +1 -0
- package/components/datagrids/formatters/ColumnImageFormatter/ImageFormatterCell.d.ts.map +1 -1
- package/components/datagrids/formatters/ColumnImageFormatter/ImageFormatterCell.js +14 -14
- package/components/datagrids/helpers/persistence/getViewMode/getViewMode.d.ts.map +1 -1
- package/components/datagrids/helpers/persistence/getViewMode/getViewMode.js +8 -8
- package/components/datagrids/helpers/shared/getAllViewModes/getAllViewModes.d.ts +2 -1
- package/components/datagrids/helpers/shared/getAllViewModes/getAllViewModes.d.ts.map +1 -1
- package/components/datagrids/helpers/shared/getAllViewModes/getAllViewModes.js +1 -1
- package/components/datagrids/helpers/shared/getViewSpecificConfig/getViewSpecificConfig.d.ts +2 -1
- package/components/datagrids/helpers/shared/getViewSpecificConfig/getViewSpecificConfig.d.ts.map +1 -1
- package/components/datagrids/helpers/shared/getViewSpecificConfig/getViewSpecificConfig.js +11 -4
- package/components/datagrids/helpers/shared/getViewSuffix/getViewSuffix.d.ts +3 -2
- package/components/datagrids/helpers/shared/getViewSuffix/getViewSuffix.d.ts.map +1 -1
- package/components/datagrids/helpers/shared/getViewSuffix/getViewSuffix.js +1 -1
- package/components/datagrids/helpers/shared/scrollToRowElement/index.d.ts +2 -0
- package/components/datagrids/helpers/shared/scrollToRowElement/index.d.ts.map +1 -0
- package/components/datagrids/helpers/shared/scrollToRowElement/scrollToRowElement.d.ts +10 -0
- package/components/datagrids/helpers/shared/scrollToRowElement/scrollToRowElement.d.ts.map +1 -0
- package/components/datagrids/helpers/shared/scrollToRowElement/scrollToRowElement.js +24 -0
- package/components/datagrids/hooks/useViewConfig/useViewConfig.d.ts.map +1 -1
- package/components/datagrids/hooks/useViewConfig/useViewConfig.js +11 -10
- package/components/datagrids/shared/LazyLoadItem/LazyLoadItem.d.ts +7 -0
- package/components/datagrids/shared/LazyLoadItem/LazyLoadItem.d.ts.map +1 -0
- package/components/datagrids/shared/LazyLoadItem/index.d.ts +3 -0
- package/components/datagrids/shared/LazyLoadItem/index.d.ts.map +1 -0
- package/components/datagrids/shared/LazyLoadItem/subcomponents/IntersectItem/IntersectItem.d.ts +7 -0
- package/components/datagrids/shared/LazyLoadItem/subcomponents/IntersectItem/IntersectItem.d.ts.map +1 -0
- package/components/datagrids/shared/LazyLoadItem/subcomponents/IntersectItem/index.d.ts +3 -0
- package/components/datagrids/shared/LazyLoadItem/subcomponents/IntersectItem/index.d.ts.map +1 -0
- package/components/datagrids/shared/LazyLoadItem/subcomponents/IntersectItem/types.d.ts +13 -0
- package/components/datagrids/shared/LazyLoadItem/subcomponents/IntersectItem/types.d.ts.map +1 -0
- package/components/datagrids/shared/LazyLoadItem/types.d.ts +12 -0
- package/components/datagrids/shared/LazyLoadItem/types.d.ts.map +1 -0
- package/components/datagrids/slots/DataGridEnum.d.ts +5 -1
- package/components/datagrids/slots/DataGridEnum.d.ts.map +1 -1
- package/components/datagrids/slots/DataGridEnum.js +3 -3
- package/components/datagrids/slots/DataGridSlot.d.ts +12 -0
- package/components/datagrids/slots/DataGridSlot.d.ts.map +1 -1
- package/components/datagrids/slots/DataGridSlot.js +105 -89
- package/components/datagrids/subcomponents/HeaderActions/HeaderActions.d.ts +3 -10
- package/components/datagrids/subcomponents/HeaderActions/HeaderActions.d.ts.map +1 -1
- package/components/datagrids/subcomponents/HeaderActions/HeaderActions.js +34 -33
- package/components/datagrids/subcomponents/HeaderActions/subcomponents/MobileMenuActions/MobileMenuActions.d.ts +1 -13
- package/components/datagrids/subcomponents/HeaderActions/subcomponents/MobileMenuActions/MobileMenuActions.d.ts.map +1 -1
- package/components/datagrids/subcomponents/HeaderActions/subcomponents/MobileMenuActions/MobileMenuActions.js +27 -26
- package/components/datagrids/subcomponents/HeaderActions/subcomponents/ViewMode/ViewMode.d.ts +3 -4
- package/components/datagrids/subcomponents/HeaderActions/subcomponents/ViewMode/ViewMode.d.ts.map +1 -1
- package/components/datagrids/subcomponents/HeaderActions/subcomponents/ViewMode/ViewMode.js +77 -47
- package/components/datagrids/tests/helpers/useListViewConfig.d.ts +12 -0
- package/components/datagrids/tests/helpers/useListViewConfig.d.ts.map +1 -0
- package/components/datagrids/types.d.ts +58 -0
- package/components/datagrids/types.d.ts.map +1 -1
- package/components/datagrids/views/CardsView/CardsView.js +14 -14
- package/components/datagrids/views/ListView/ListView.d.ts +8 -0
- package/components/datagrids/views/ListView/ListView.d.ts.map +1 -0
- package/components/datagrids/views/ListView/ListView.js +98 -0
- package/components/datagrids/views/ListView/hooks/useListContent/index.d.ts +2 -0
- package/components/datagrids/views/{CardsView/helpers/scrollToCardElement → ListView/hooks/useListContent}/index.d.ts.map +1 -1
- package/components/datagrids/views/ListView/hooks/useListContent/useListContent.d.ts +10 -0
- package/components/datagrids/views/ListView/hooks/useListContent/useListContent.d.ts.map +1 -0
- package/components/datagrids/views/ListView/hooks/useListContent/useListContent.js +112 -0
- package/components/datagrids/views/ListView/hooks/useListVirtualizer/index.d.ts +3 -0
- package/components/datagrids/views/ListView/hooks/useListVirtualizer/index.d.ts.map +1 -0
- package/components/datagrids/views/ListView/hooks/useListVirtualizer/types.d.ts +27 -0
- package/components/datagrids/views/ListView/hooks/useListVirtualizer/types.d.ts.map +1 -0
- package/components/datagrids/views/ListView/hooks/useListVirtualizer/useListVirtualizer.d.ts +19 -0
- package/components/datagrids/views/ListView/hooks/useListVirtualizer/useListVirtualizer.d.ts.map +1 -0
- package/components/datagrids/views/ListView/hooks/useListVirtualizer/useListVirtualizer.js +23 -0
- package/components/datagrids/views/ListView/hooks/useModalDetail/index.d.ts +3 -0
- package/components/datagrids/views/ListView/hooks/useModalDetail/index.d.ts.map +1 -0
- package/components/datagrids/views/ListView/hooks/useModalDetail/types.d.ts +20 -0
- package/components/datagrids/views/ListView/hooks/useModalDetail/types.d.ts.map +1 -0
- package/components/datagrids/views/ListView/hooks/useModalDetail/useModalDetail.d.ts +7 -0
- package/components/datagrids/views/ListView/hooks/useModalDetail/useModalDetail.d.ts.map +1 -0
- package/components/datagrids/views/ListView/hooks/useModalDetail/useModalDetail.js +72 -0
- package/components/datagrids/views/ListView/hooks/useProcessedColumns/index.d.ts +3 -0
- package/components/datagrids/views/ListView/hooks/useProcessedColumns/index.d.ts.map +1 -0
- package/components/datagrids/views/ListView/hooks/useProcessedColumns/types.d.ts +13 -0
- package/components/datagrids/views/ListView/hooks/useProcessedColumns/types.d.ts.map +1 -0
- package/components/datagrids/views/ListView/hooks/useProcessedColumns/useProcessedColumns.d.ts +49 -0
- package/components/datagrids/views/ListView/hooks/useProcessedColumns/useProcessedColumns.d.ts.map +1 -0
- package/components/datagrids/views/ListView/hooks/useProcessedColumns/useProcessedColumns.js +30 -0
- package/components/datagrids/views/ListView/index.d.ts +3 -0
- package/components/datagrids/views/ListView/index.d.ts.map +1 -0
- package/components/datagrids/views/ListView/subcomponents/ListDetail/ListDetail.d.ts +9 -0
- package/components/datagrids/views/ListView/subcomponents/ListDetail/ListDetail.d.ts.map +1 -0
- package/components/datagrids/views/ListView/subcomponents/ListDetail/ListDetail.js +113 -0
- package/components/datagrids/views/ListView/subcomponents/ListDetail/index.d.ts +3 -0
- package/components/datagrids/views/ListView/subcomponents/ListDetail/index.d.ts.map +1 -0
- package/components/datagrids/views/ListView/subcomponents/ListDetail/types.d.ts +39 -0
- package/components/datagrids/views/ListView/subcomponents/ListDetail/types.d.ts.map +1 -0
- package/components/datagrids/views/ListView/subcomponents/ListRow/ListRow.d.ts +12 -0
- package/components/datagrids/views/ListView/subcomponents/ListRow/ListRow.d.ts.map +1 -0
- package/components/datagrids/views/ListView/subcomponents/ListRow/ListRow.js +96 -0
- package/components/datagrids/views/ListView/subcomponents/ListRow/index.d.ts +3 -0
- package/components/datagrids/views/ListView/subcomponents/ListRow/index.d.ts.map +1 -0
- package/components/datagrids/views/ListView/subcomponents/ListRow/subcomponents/ListHeader/ListHeader.d.ts +8 -0
- package/components/datagrids/views/ListView/subcomponents/ListRow/subcomponents/ListHeader/ListHeader.d.ts.map +1 -0
- package/components/datagrids/views/ListView/subcomponents/ListRow/subcomponents/ListHeader/ListHeader.js +83 -0
- package/components/datagrids/views/ListView/subcomponents/ListRow/subcomponents/ListHeader/index.d.ts +3 -0
- package/components/datagrids/views/ListView/subcomponents/ListRow/subcomponents/ListHeader/index.d.ts.map +1 -0
- package/components/datagrids/views/ListView/subcomponents/ListRow/subcomponents/ListHeader/types.d.ts +14 -0
- package/components/datagrids/views/ListView/subcomponents/ListRow/subcomponents/ListHeader/types.d.ts.map +1 -0
- package/components/datagrids/views/ListView/subcomponents/ListRow/types.d.ts +81 -0
- package/components/datagrids/views/ListView/subcomponents/ListRow/types.d.ts.map +1 -0
- package/components/datagrids/views/ListView/subcomponents/Settings/Settings.d.ts +7 -0
- package/components/datagrids/views/ListView/subcomponents/Settings/Settings.d.ts.map +1 -0
- package/components/datagrids/views/ListView/subcomponents/Settings/Settings.js +24 -0
- package/components/datagrids/views/ListView/subcomponents/Settings/hooks/useModalSettings/index.d.ts +3 -0
- package/components/datagrids/views/ListView/subcomponents/Settings/hooks/useModalSettings/index.d.ts.map +1 -0
- package/components/datagrids/views/ListView/subcomponents/Settings/hooks/useModalSettings/types.d.ts +5 -0
- package/components/datagrids/views/ListView/subcomponents/Settings/hooks/useModalSettings/types.d.ts.map +1 -0
- package/components/datagrids/views/ListView/subcomponents/Settings/hooks/useModalSettings/useModalSettings.d.ts +7 -0
- package/components/datagrids/views/ListView/subcomponents/Settings/hooks/useModalSettings/useModalSettings.d.ts.map +1 -0
- package/components/datagrids/views/ListView/subcomponents/Settings/hooks/useModalSettings/useModalSettings.js +62 -0
- package/components/datagrids/views/ListView/subcomponents/Settings/index.d.ts +3 -0
- package/components/datagrids/views/ListView/subcomponents/Settings/index.d.ts.map +1 -0
- package/components/datagrids/views/ListView/subcomponents/Settings/subcomponents/ColumnsConfig/ColumnsConfig.d.ts +3 -0
- package/components/datagrids/views/ListView/subcomponents/Settings/subcomponents/ColumnsConfig/ColumnsConfig.d.ts.map +1 -0
- package/components/datagrids/views/ListView/subcomponents/Settings/subcomponents/ColumnsConfig/ColumnsConfig.js +253 -0
- package/components/datagrids/views/ListView/subcomponents/Settings/subcomponents/ColumnsConfig/index.d.ts +3 -0
- package/components/datagrids/views/ListView/subcomponents/Settings/subcomponents/ColumnsConfig/index.d.ts.map +1 -0
- package/components/datagrids/views/ListView/subcomponents/Settings/subcomponents/ColumnsConfig/types.d.ts +32 -0
- package/components/datagrids/views/ListView/subcomponents/Settings/subcomponents/ColumnsConfig/types.d.ts.map +1 -0
- package/components/datagrids/views/ListView/subcomponents/Settings/types.d.ts +5 -0
- package/components/datagrids/views/ListView/subcomponents/Settings/types.d.ts.map +1 -0
- package/components/datagrids/views/ListView/types.d.ts +7 -0
- package/components/datagrids/views/ListView/types.d.ts.map +1 -0
- package/components/datagrids/views/adapters/RenderContent/RenderContent.d.ts +2 -1
- package/components/datagrids/views/adapters/RenderContent/RenderContent.d.ts.map +1 -1
- package/components/datagrids/views/adapters/RenderContent/RenderContent.js +7 -6
- package/package.json +7 -6
- package/components/datagrids/views/CardsView/helpers/scrollToCardElement/index.d.ts +0 -2
- package/components/datagrids/views/CardsView/helpers/scrollToCardElement/scrollToCardElement.d.ts +0 -10
- package/components/datagrids/views/CardsView/helpers/scrollToCardElement/scrollToCardElement.d.ts.map +0 -1
- package/components/datagrids/views/CardsView/helpers/scrollToCardElement/scrollToCardElement.js +0 -24
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { jsx as t, jsxs as b } from "@emotion/react/jsx-runtime";
|
|
2
|
+
import { useState as D } from "react";
|
|
3
|
+
import { ContainerLabelValueColumnStyled as L, ContentWrapperColumnStyled as R, LabelHeaderColumnStyled as z, EditorCellWrapperStyled as I, ValueColumnStyled as y, EditablePlaceholderStyled as T, IconButtonEditStyled as A } from "../../../../slots/DataGridSlot.js";
|
|
4
|
+
import { DICTIONARY as O } from "../../../../dictionary.js";
|
|
5
|
+
import { useModuleDictionary as V } from "@m4l/core";
|
|
6
|
+
import { ActionsEditOutlined as j } from "@m4l/icons";
|
|
7
|
+
import { useComponentSize as H } from "../../../../../../hooks/useComponentSize/useComponentSize.js";
|
|
8
|
+
import { useDataGrid as K } from "../../../../hooks/shared/useDataGrid/useDataGrid.js";
|
|
9
|
+
function Q({
|
|
10
|
+
row: r,
|
|
11
|
+
rows: c,
|
|
12
|
+
rowIndex: n,
|
|
13
|
+
columns: p,
|
|
14
|
+
onRowsChange: o
|
|
15
|
+
}) {
|
|
16
|
+
const { getConfigColumns: h, size: f } = K(), { getLabel: k } = V(), { currentSize: x } = H(f), [S, l] = D(null), g = h("list");
|
|
17
|
+
return {
|
|
18
|
+
listContent: p.map((e, u) => {
|
|
19
|
+
const w = g.find(
|
|
20
|
+
(m) => m.key === e.key
|
|
21
|
+
)?.showTitle !== !1;
|
|
22
|
+
return /* @__PURE__ */ t(L, { ownerState: {}, children: /* @__PURE__ */ b(
|
|
23
|
+
R,
|
|
24
|
+
{
|
|
25
|
+
ownerState: {},
|
|
26
|
+
onDoubleClick: e.renderEditCell && S !== e.key ? () => {
|
|
27
|
+
l(e.key);
|
|
28
|
+
} : void 0,
|
|
29
|
+
children: [
|
|
30
|
+
w && /* @__PURE__ */ t(z, { ownerState: {}, variant: "body", color: "text.secondary", children: e.name }),
|
|
31
|
+
(() => {
|
|
32
|
+
if (e.renderEditCell && S === e.key)
|
|
33
|
+
return /* @__PURE__ */ t(I, { ownerState: { size: f }, children: e.renderEditCell({
|
|
34
|
+
column: e,
|
|
35
|
+
row: r,
|
|
36
|
+
rowIdx: u,
|
|
37
|
+
/**
|
|
38
|
+
* onRowChange es una función que se ejecuta cuando el usuario edita una celda.
|
|
39
|
+
*/
|
|
40
|
+
onRowChange: (d) => {
|
|
41
|
+
if (o) {
|
|
42
|
+
const a = c.map(
|
|
43
|
+
(s, C) => C === n ? d : s
|
|
44
|
+
);
|
|
45
|
+
o(a, {
|
|
46
|
+
indexes: [n],
|
|
47
|
+
column: e
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
onClose: () => l(null)
|
|
52
|
+
}) });
|
|
53
|
+
if (e.renderCell) {
|
|
54
|
+
const d = e.renderCell({
|
|
55
|
+
column: e,
|
|
56
|
+
row: r,
|
|
57
|
+
rowIdx: u,
|
|
58
|
+
isCellSelected: !1,
|
|
59
|
+
tabIndex: -1,
|
|
60
|
+
/**
|
|
61
|
+
* onRowChange es una función que se ejecuta cuando el usuario edita una celda.
|
|
62
|
+
*/
|
|
63
|
+
onRowChange: (a) => {
|
|
64
|
+
if (o) {
|
|
65
|
+
const s = c.map(
|
|
66
|
+
(C, v) => v === n ? a : C
|
|
67
|
+
);
|
|
68
|
+
o(s, {
|
|
69
|
+
indexes: [n],
|
|
70
|
+
column: e
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
return /* @__PURE__ */ t(y, { ownerState: {}, variant: "body", color: "text.primary", children: d });
|
|
76
|
+
}
|
|
77
|
+
const i = r[e.key], E = i == null || i === "";
|
|
78
|
+
return e.renderEditCell ? /* @__PURE__ */ b(T, { ownerState: {}, children: [
|
|
79
|
+
/* @__PURE__ */ t(
|
|
80
|
+
y,
|
|
81
|
+
{
|
|
82
|
+
ownerState: {},
|
|
83
|
+
variant: "body",
|
|
84
|
+
color: E ? "text.secondary" : "text.primary",
|
|
85
|
+
children: E ? k(O.EDIT_PLACEHOLDER) : i
|
|
86
|
+
}
|
|
87
|
+
),
|
|
88
|
+
/* @__PURE__ */ t(
|
|
89
|
+
A,
|
|
90
|
+
{
|
|
91
|
+
ownerState: {},
|
|
92
|
+
src: /* @__PURE__ */ t(j, {}),
|
|
93
|
+
onClick: () => {
|
|
94
|
+
l(e.key);
|
|
95
|
+
},
|
|
96
|
+
size: x,
|
|
97
|
+
role: "button",
|
|
98
|
+
"aria-label": "Editar texto"
|
|
99
|
+
}
|
|
100
|
+
)
|
|
101
|
+
] }) : /* @__PURE__ */ t(y, { ownerState: {}, variant: "body", color: "text.primary", children: r[e.key] ?? "-" });
|
|
102
|
+
})()
|
|
103
|
+
]
|
|
104
|
+
}
|
|
105
|
+
) }, e.key);
|
|
106
|
+
}),
|
|
107
|
+
columnsCount: p.length
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
export {
|
|
111
|
+
Q as useListContent
|
|
112
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../../../../packages/components/src/components/datagrids/views/ListView/hooks/useListVirtualizer/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,YAAY,EAAE,uBAAuB,EAAE,MAAM,SAAS,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { RefObject } from 'react';
|
|
2
|
+
export interface UseListVirtualizerProps {
|
|
3
|
+
/**
|
|
4
|
+
* Total number of rows to virtualize.
|
|
5
|
+
* Used to calculate the total scrollable height and determine which rows to render.
|
|
6
|
+
*/
|
|
7
|
+
count: number;
|
|
8
|
+
/**
|
|
9
|
+
* Ref to the scrollable container element (the element with `overflow: auto`).
|
|
10
|
+
* The virtualizer listens to scroll events on this element to determine visible rows.
|
|
11
|
+
*/
|
|
12
|
+
scrollElementRef: RefObject<HTMLDivElement | null>;
|
|
13
|
+
/**
|
|
14
|
+
* Number of extra rows to render outside the visible viewport (above and below).
|
|
15
|
+
* Prevents blank flashes during fast scrolling by pre-rendering nearby rows.
|
|
16
|
+
* @default 5
|
|
17
|
+
*/
|
|
18
|
+
overscan?: number;
|
|
19
|
+
/**
|
|
20
|
+
* Estimated row height in pixels.
|
|
21
|
+
* Used as initial approximation before `measureElement` measures the real DOM size.
|
|
22
|
+
* A close estimate prevents scroll jumps and layout shifts.
|
|
23
|
+
* @default 120
|
|
24
|
+
*/
|
|
25
|
+
estimateSize?: number;
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../../../../../../packages/components/src/components/datagrids/views/ListView/hooks/useListVirtualizer/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAElC,MAAM,WAAW,uBAAuB;IACtC;;;OAGG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,gBAAgB,EAAE,SAAS,CAAC,cAAc,GAAG,IAAI,CAAC,CAAC;IACnD;;;;OAIG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;;;OAKG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { UseListVirtualizerProps } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Hook that wraps TanStack Virtual's `useVirtualizer` for the ListView.
|
|
4
|
+
*
|
|
5
|
+
* Only rows visible in the viewport (plus `overscan`) are mounted in the DOM.
|
|
6
|
+
* Row heights are measured dynamically via `measureElement` + `ResizeObserver`,
|
|
7
|
+
* so cards can have any height without manual calculation.
|
|
8
|
+
* @returns
|
|
9
|
+
* - `virtualizer` — the virtualizer instance (use `virtualizer.measureElement` as ref on each row,
|
|
10
|
+
* and `virtualizer.scrollToIndex` to programmatically scroll to a row)
|
|
11
|
+
* - `virtualItems` — array of items to render (each has `index`, `start` offset, and `size`)
|
|
12
|
+
* - `totalSize` — total scrollable height in pixels (set on the virtual container)
|
|
13
|
+
*/
|
|
14
|
+
export declare function useListVirtualizer({ count, scrollElementRef, overscan, estimateSize, }: UseListVirtualizerProps): {
|
|
15
|
+
virtualizer: import('@tanstack/virtual-core').Virtualizer<HTMLDivElement, Element>;
|
|
16
|
+
virtualItems: import('@tanstack/virtual-core').VirtualItem[];
|
|
17
|
+
totalSize: number;
|
|
18
|
+
};
|
|
19
|
+
//# sourceMappingURL=useListVirtualizer.d.ts.map
|
package/components/datagrids/views/ListView/hooks/useListVirtualizer/useListVirtualizer.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useListVirtualizer.d.ts","sourceRoot":"","sources":["../../../../../../../../../../packages/components/src/components/datagrids/views/ListView/hooks/useListVirtualizer/useListVirtualizer.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,uBAAuB,EAAE,MAAM,SAAS,CAAC;AASlD;;;;;;;;;;;GAWG;AACH,wBAAgB,kBAAkB,CAAC,EACjC,KAAK,EACL,gBAAgB,EAChB,QAAY,EACZ,YAAoC,GACrC,EAAE,uBAAuB;;;;EAazB"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { useVirtualizer as u } from "@tanstack/react-virtual";
|
|
2
|
+
const o = 50;
|
|
3
|
+
function s({
|
|
4
|
+
count: e,
|
|
5
|
+
scrollElementRef: r,
|
|
6
|
+
overscan: i = 5,
|
|
7
|
+
estimateSize: l = o
|
|
8
|
+
}) {
|
|
9
|
+
const t = u({
|
|
10
|
+
count: e,
|
|
11
|
+
getScrollElement: () => r.current,
|
|
12
|
+
estimateSize: () => l,
|
|
13
|
+
overscan: i
|
|
14
|
+
});
|
|
15
|
+
return {
|
|
16
|
+
virtualizer: t,
|
|
17
|
+
virtualItems: t.getVirtualItems(),
|
|
18
|
+
totalSize: t.getTotalSize()
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
export {
|
|
22
|
+
s as useListVirtualizer
|
|
23
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../../../../packages/components/src/components/datagrids/views/ListView/hooks/useModalDetail/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,YAAY,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Column, RowsChangeData } from 'react-data-grid';
|
|
2
|
+
import { Maybe } from '@m4l/core';
|
|
3
|
+
/**
|
|
4
|
+
* Props para el hook useModalDetail
|
|
5
|
+
*/
|
|
6
|
+
export interface UseModalDetailProps<TRow> {
|
|
7
|
+
/**
|
|
8
|
+
* Columnas a mostrar en el modal de detalle
|
|
9
|
+
*/
|
|
10
|
+
columns: readonly Column<TRow, any>[];
|
|
11
|
+
/**
|
|
12
|
+
* Función para manejar cambios en las filas (para editores)
|
|
13
|
+
*/
|
|
14
|
+
onRowsChange?: Maybe<(rows: TRow[], data: RowsChangeData<TRow, any>) => void>;
|
|
15
|
+
/**
|
|
16
|
+
* Array completo de todas las filas (necesario para reconstruir el array al editar en el modal)
|
|
17
|
+
*/
|
|
18
|
+
rows: readonly TRow[];
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../../../../../../packages/components/src/components/datagrids/views/ListView/hooks/useModalDetail/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAElC;;GAEG;AACH,MAAM,WAAW,mBAAmB,CAAC,IAAI;IACvC;;OAEG;IACH,OAAO,EAAE,SAAS,MAAM,CAAC,IAAI,EAAE,GAAG,CAAC,EAAE,CAAC;IACtC;;OAEG;IACH,YAAY,CAAC,EAAE,KAAK,CAAC,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,cAAc,CAAC,IAAI,EAAE,GAAG,CAAC,KAAK,IAAI,CAAC,CAAC;IAC9E;;OAEG;IACH,IAAI,EAAE,SAAS,IAAI,EAAE,CAAC;CACvB"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { UseModalDetailProps } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Hook que renderiza el modal de detalle para la vista de ListView
|
|
4
|
+
* mostrando TODAS las columnas sin excepción
|
|
5
|
+
*/
|
|
6
|
+
export declare const useModalDetail: <TRow>({ columns, onRowsChange, rows, }: UseModalDetailProps<TRow>) => (row: TRow) => void;
|
|
7
|
+
//# sourceMappingURL=useModalDetail.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useModalDetail.d.ts","sourceRoot":"","sources":["../../../../../../../../../../packages/components/src/components/datagrids/views/ListView/hooks/useModalDetail/useModalDetail.tsx"],"names":[],"mappings":"AAYA,OAAO,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAI9C;;;GAGG;AACH,eAAO,MAAM,cAAc,GAAI,IAAI,EAAG,kCAInC,mBAAmB,CAAC,IAAI,CAAC,WAQlB,IAAI,SAsDb,CAAC"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { jsx as o, jsxs as h } from "@emotion/react/jsx-runtime";
|
|
2
|
+
import { useModuleDictionary as D, useEnvironment as M } from "@m4l/core";
|
|
3
|
+
import { useIsMobile as I } from "@m4l/graphics";
|
|
4
|
+
import { useCallback as S } from "react";
|
|
5
|
+
import { useModal as g } from "../../../../../../hooks/useModal/index.js";
|
|
6
|
+
import { ContentModalSettingStyled as x, DataGridRootStyled as b } from "../../../../slots/DataGridSlot.js";
|
|
7
|
+
import { pathIcons as v } from "../../../../icons.js";
|
|
8
|
+
import { DICTIONARY as y } from "../../../../dictionary.js";
|
|
9
|
+
import { ListDetail as A } from "../../subcomponents/ListDetail/ListDetail.js";
|
|
10
|
+
import { ActionsContainer as w } from "../../../../../CommonActions/components/ActionsContainer/ActionsContainer.js";
|
|
11
|
+
import { useDataGrid as L } from "../../../../hooks/shared/useDataGrid/useDataGrid.js";
|
|
12
|
+
import { WindowBase as O } from "../../../../../WindowBase/WindowBase.js";
|
|
13
|
+
import { ActionCancel as T } from "../../../../../CommonActions/components/ActionCancel/ActionCancel.js";
|
|
14
|
+
const q = ({
|
|
15
|
+
columns: i,
|
|
16
|
+
onRowsChange: n,
|
|
17
|
+
rows: t
|
|
18
|
+
}) => {
|
|
19
|
+
const { getConfigColumns: r, size: l } = L(), { openModal: s, closeModal: e } = g(), { getLabel: a } = D(), { host_static_assets: m, environment_assets: d } = M(), c = I();
|
|
20
|
+
return S(
|
|
21
|
+
(p) => {
|
|
22
|
+
const f = r("list"), u = t.findIndex((C) => C === p);
|
|
23
|
+
s({
|
|
24
|
+
initialWidth: 500,
|
|
25
|
+
initialHeight: 680,
|
|
26
|
+
fullScreen: c,
|
|
27
|
+
window: /* @__PURE__ */ o(
|
|
28
|
+
O,
|
|
29
|
+
{
|
|
30
|
+
title: a(y.DETAILS),
|
|
31
|
+
iconUrl: `${m}/${d}/${v.info}`,
|
|
32
|
+
onClose: e,
|
|
33
|
+
className: "detail-modal",
|
|
34
|
+
variant: "outlined",
|
|
35
|
+
emergeType: "modal",
|
|
36
|
+
children: /* @__PURE__ */ h(x, { ownerState: {}, children: [
|
|
37
|
+
/* @__PURE__ */ o(b, { ownerState: {}, children: /* @__PURE__ */ o(
|
|
38
|
+
A,
|
|
39
|
+
{
|
|
40
|
+
row: p,
|
|
41
|
+
rows: t,
|
|
42
|
+
rowIndex: u,
|
|
43
|
+
columns: i,
|
|
44
|
+
viewColumnsConfig: f,
|
|
45
|
+
onRowsChange: n,
|
|
46
|
+
size: l ?? "medium"
|
|
47
|
+
}
|
|
48
|
+
) }),
|
|
49
|
+
/* @__PURE__ */ o(w, { children: /* @__PURE__ */ o(T, { onClick: e }) })
|
|
50
|
+
] })
|
|
51
|
+
}
|
|
52
|
+
)
|
|
53
|
+
});
|
|
54
|
+
},
|
|
55
|
+
[
|
|
56
|
+
i,
|
|
57
|
+
t,
|
|
58
|
+
n,
|
|
59
|
+
l,
|
|
60
|
+
r,
|
|
61
|
+
s,
|
|
62
|
+
e,
|
|
63
|
+
a,
|
|
64
|
+
m,
|
|
65
|
+
d,
|
|
66
|
+
c
|
|
67
|
+
]
|
|
68
|
+
);
|
|
69
|
+
};
|
|
70
|
+
export {
|
|
71
|
+
q as useModalDetail
|
|
72
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../../../../packages/components/src/components/datagrids/views/ListView/hooks/useProcessedColumns/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,cAAc,SAAS,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Options for useProcessedColumns (list view).
|
|
3
|
+
* Same shape as cards; defined here so list does not depend on CardsView.
|
|
4
|
+
*/
|
|
5
|
+
export interface ProcessedColumnsOptions {
|
|
6
|
+
/**
|
|
7
|
+
* If true, applies visibility filter from list column config.
|
|
8
|
+
* If false, shows all columns (e.g. for detail).
|
|
9
|
+
* @default true
|
|
10
|
+
*/
|
|
11
|
+
applyVisibilityFilter?: boolean;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../../../../../../packages/components/src/components/datagrids/views/ListView/hooks/useProcessedColumns/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,WAAW,uBAAuB;IACtC;;;;OAIG;IACH,qBAAqB,CAAC,EAAE,OAAO,CAAC;CACjC"}
|
package/components/datagrids/views/ListView/hooks/useProcessedColumns/useProcessedColumns.d.ts
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { Column } from 'react-data-grid';
|
|
2
|
+
import { ProcessedColumnsOptions } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Processes columns for list view (visibility, order, formatter→renderCell).
|
|
5
|
+
* Same behaviour as CardsView useProcessedColumns; kept separate so list view does not depend on cards.
|
|
6
|
+
* Always uses getConfigColumns('list') for list column config.
|
|
7
|
+
*/
|
|
8
|
+
export declare function useProcessedColumns<TRow, TSummaryRow>(columns: readonly Column<TRow, TSummaryRow>[], options?: ProcessedColumnsOptions): {
|
|
9
|
+
name: string | import('react').ReactElement;
|
|
10
|
+
key: string;
|
|
11
|
+
width?: string | number | null | undefined;
|
|
12
|
+
minWidth?: number | null | undefined;
|
|
13
|
+
maxWidth?: number | null | undefined;
|
|
14
|
+
cellClass?: string | ((row: TRow) => string | null | undefined) | null | undefined;
|
|
15
|
+
headerCellClass?: string | null | undefined;
|
|
16
|
+
summaryCellClass?: string | ((row: TSummaryRow) => string | null | undefined) | null | undefined;
|
|
17
|
+
renderHeaderCell?: ((props: import('react-data-grid').RenderHeaderCellProps<TRow, TSummaryRow>) => import('react').ReactNode) | null | undefined;
|
|
18
|
+
renderCell?: ((props: import('react-data-grid').RenderCellProps<TRow, TSummaryRow>) => import('react').ReactNode) | null | undefined;
|
|
19
|
+
renderSummaryCell?: ((props: import('react-data-grid').RenderSummaryCellProps<TSummaryRow, TRow>) => import('react').ReactNode) | null | undefined;
|
|
20
|
+
renderGroupCell?: ((props: import('react-data-grid').RenderGroupCellProps<TRow, TSummaryRow>) => import('react').ReactNode) | null | undefined;
|
|
21
|
+
renderEditCell?: ((props: import('react-data-grid').RenderEditCellProps<TRow, TSummaryRow>) => import('react').ReactNode) | null | undefined;
|
|
22
|
+
editable?: boolean | ((row: TRow) => boolean) | null | undefined;
|
|
23
|
+
colSpan?: ((args: import('react-data-grid').ColSpanArgs<TRow, TSummaryRow>) => number | null | undefined) | null | undefined;
|
|
24
|
+
frozen?: boolean | null | undefined;
|
|
25
|
+
resizable?: boolean | null | undefined;
|
|
26
|
+
sortable?: boolean | null | undefined;
|
|
27
|
+
draggable?: boolean | null | undefined;
|
|
28
|
+
sortDescendingFirst?: boolean | null | undefined;
|
|
29
|
+
editorOptions?: {
|
|
30
|
+
readonly displayCellContent?: boolean | null | undefined;
|
|
31
|
+
readonly commitOnOutsideClick?: boolean | null | undefined;
|
|
32
|
+
} | null | undefined;
|
|
33
|
+
visible?: boolean;
|
|
34
|
+
hidden?: boolean;
|
|
35
|
+
fixed?: boolean;
|
|
36
|
+
type: import('../../../..').ColumnType;
|
|
37
|
+
exportable?: boolean;
|
|
38
|
+
align?: import('../../../../types').ColumnAlign;
|
|
39
|
+
isDraggable?: boolean;
|
|
40
|
+
withFilter?: boolean;
|
|
41
|
+
withinHeaderRenderer?: import('react').FunctionComponent<import('react-data-grid').RenderHeaderCellProps<TRow, TSummaryRow>> | undefined;
|
|
42
|
+
customFilter?: ((row: TRow, value: string) => boolean) | undefined;
|
|
43
|
+
customSort?: ((a: TRow, b: TRow) => number) | undefined;
|
|
44
|
+
formatter?: ((props: any) => JSX.Element) | undefined;
|
|
45
|
+
editor?: import('@m4l/core').Maybe<(props: import('react-data-grid').RenderEditCellProps<TRow, TSummaryRow>) => import('react').ReactNode>;
|
|
46
|
+
groupable?: boolean;
|
|
47
|
+
grouped?: boolean;
|
|
48
|
+
}[];
|
|
49
|
+
//# sourceMappingURL=useProcessedColumns.d.ts.map
|
package/components/datagrids/views/ListView/hooks/useProcessedColumns/useProcessedColumns.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useProcessedColumns.d.ts","sourceRoot":"","sources":["../../../../../../../../../../packages/components/src/components/datagrids/views/ListView/hooks/useProcessedColumns/useProcessedColumns.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAqB,MAAM,iBAAiB,CAAC;AAG5D,OAAO,EAAE,uBAAuB,EAAE,MAAM,SAAS,CAAC;AAElD;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,WAAW,EACnD,OAAO,EAAE,SAAS,MAAM,CAAC,IAAI,EAAE,WAAW,CAAC,EAAE,EAC7C,OAAO,GAAE,uBAA4B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAsDtC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { useMemo as C } from "react";
|
|
2
|
+
import { SELECT_COLUMN_KEY as y } from "react-data-grid";
|
|
3
|
+
import { DATAGRID_ACTIONS_COLUMN_KEY as p } from "../../../../constants.js";
|
|
4
|
+
import { useDataGrid as k } from "../../../../hooks/shared/useDataGrid/useDataGrid.js";
|
|
5
|
+
function A(s, u = {}) {
|
|
6
|
+
const { applyVisibilityFilter: d = !0 } = u, { getConfigColumns: f } = k(), t = C(
|
|
7
|
+
() => f("list"),
|
|
8
|
+
[f]
|
|
9
|
+
);
|
|
10
|
+
return C(() => {
|
|
11
|
+
const l = s.filter((r) => {
|
|
12
|
+
if (r.key === y || r.key === p)
|
|
13
|
+
return !1;
|
|
14
|
+
if (!d)
|
|
15
|
+
return !r.hidden;
|
|
16
|
+
const e = t.find((i) => i.key === r.key), n = e ? e.visible : !0;
|
|
17
|
+
return !r.hidden && n;
|
|
18
|
+
}).map((r) => {
|
|
19
|
+
const e = { ...r };
|
|
20
|
+
return e.formatter && !e.renderCell && (e.renderCell = e.formatter), e.editor && !e.renderEditCell && (e.renderEditCell = e.editor), e;
|
|
21
|
+
});
|
|
22
|
+
return l.sort((r, e) => {
|
|
23
|
+
const n = t.findIndex((o) => o.key === r.key), i = t.findIndex((o) => o.key === e.key), m = n === -1 ? t.length : n, c = i === -1 ? t.length : i;
|
|
24
|
+
return m - c;
|
|
25
|
+
}), l;
|
|
26
|
+
}, [s, t, d]);
|
|
27
|
+
}
|
|
28
|
+
export {
|
|
29
|
+
A as useProcessedColumns
|
|
30
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/components/src/components/datagrids/views/ListView/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ListDetailProps } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Componente genérico que renderiza TODAS las columnas de una fila
|
|
4
|
+
* en formato detalle dentro del modal.
|
|
5
|
+
*
|
|
6
|
+
* A diferencia del componente Cards, este muestra TODAS las columnas
|
|
7
|
+
*/
|
|
8
|
+
export declare function ListDetail<TRow>({ row, columns, onRowsChange, size, rows, rowIndex, }: ListDetailProps<TRow>): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
9
|
+
//# sourceMappingURL=ListDetail.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ListDetail.d.ts","sourceRoot":"","sources":["../../../../../../../../../../packages/components/src/components/datagrids/views/ListView/subcomponents/ListDetail/ListDetail.tsx"],"names":[],"mappings":"AAWA,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAM1C;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,EAC/B,GAAG,EACH,OAAO,EACP,YAAY,EACZ,IAAe,EACf,IAAI,EACJ,QAAQ,GACT,EAAE,eAAe,CAAC,IAAI,CAAC,oDAyKvB"}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { jsx as t, jsxs as S } from "@emotion/react/jsx-runtime";
|
|
2
|
+
import { useState as k, useCallback as I } from "react";
|
|
3
|
+
import { CardDetailContainerStyled as $, ContainerLabelValueColumnStyled as F, ContentWrapperColumnStyled as K, LabelHeaderColumnStyled as O, EditorCellWrapperStyled as V, ValueColumnStyled as h, EditablePlaceholderStyled as W, IconButtonEditStyled as j } from "../../../../slots/DataGridSlot.js";
|
|
4
|
+
import { DICTIONARY as z } from "../../../../dictionary.js";
|
|
5
|
+
import { useModuleDictionary as H } from "@m4l/core";
|
|
6
|
+
import { ActionsEditOutlined as P } from "@m4l/icons";
|
|
7
|
+
import { useComponentSize as T } from "../../../../../../hooks/useComponentSize/useComponentSize.js";
|
|
8
|
+
function U({
|
|
9
|
+
row: w,
|
|
10
|
+
columns: C,
|
|
11
|
+
onRowsChange: a,
|
|
12
|
+
size: E = "medium",
|
|
13
|
+
rows: o,
|
|
14
|
+
rowIndex: n
|
|
15
|
+
}) {
|
|
16
|
+
const [b, c] = k(null), [f, v] = k(0), { getLabel: x } = H(), { currentSize: D } = T(E), i = o[n] ?? w, R = I(() => {
|
|
17
|
+
v((e) => e + 1);
|
|
18
|
+
}, []), L = C.map((e) => e.renderCell ? {
|
|
19
|
+
...e,
|
|
20
|
+
// Agregar onAfterChange al objeto de la columna
|
|
21
|
+
onAfterChange: R
|
|
22
|
+
} : e);
|
|
23
|
+
return /* @__PURE__ */ t($, { ownerState: {}, children: L.map((e, s) => {
|
|
24
|
+
const r = C[s], g = !!e.onAfterChange ? `${r.key}-${f}` : `${r.key}`;
|
|
25
|
+
return /* @__PURE__ */ t(F, { ownerState: {}, children: /* @__PURE__ */ S(
|
|
26
|
+
K,
|
|
27
|
+
{
|
|
28
|
+
ownerState: {},
|
|
29
|
+
"data-testid": `list-detail-column-${r.key}`,
|
|
30
|
+
onDoubleClick: e.renderEditCell && b !== e.key ? () => c(e.key) : void 0,
|
|
31
|
+
children: [
|
|
32
|
+
/* @__PURE__ */ S(O, { ownerState: {}, variant: "body", color: "text.secondary", children: [
|
|
33
|
+
e.name,
|
|
34
|
+
":"
|
|
35
|
+
] }),
|
|
36
|
+
(() => {
|
|
37
|
+
if (e.renderEditCell && b === e.key)
|
|
38
|
+
return /* @__PURE__ */ t(V, { ownerState: { size: E }, children: e.renderEditCell({
|
|
39
|
+
column: r,
|
|
40
|
+
row: i,
|
|
41
|
+
rowIdx: s,
|
|
42
|
+
/**
|
|
43
|
+
* onRowChange es una función que se ejecuta cuando el usuario edita una celda.
|
|
44
|
+
*/
|
|
45
|
+
onRowChange: (d) => {
|
|
46
|
+
if (a) {
|
|
47
|
+
const y = o.map(
|
|
48
|
+
(u, p) => p === n ? d : u
|
|
49
|
+
);
|
|
50
|
+
a(y, {
|
|
51
|
+
indexes: [n],
|
|
52
|
+
column: r
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
onClose: () => c(null)
|
|
57
|
+
}) });
|
|
58
|
+
if (e.renderCell) {
|
|
59
|
+
const d = e.renderCell({
|
|
60
|
+
column: e,
|
|
61
|
+
row: i,
|
|
62
|
+
rowIdx: s,
|
|
63
|
+
isCellSelected: !1,
|
|
64
|
+
tabIndex: -1,
|
|
65
|
+
/**
|
|
66
|
+
* onRowChange es una función que se ejecuta cuando el usuario edita una celda.
|
|
67
|
+
*/
|
|
68
|
+
onRowChange: (y) => {
|
|
69
|
+
if (a) {
|
|
70
|
+
const u = o.map(
|
|
71
|
+
(p, A) => A === n ? y : p
|
|
72
|
+
);
|
|
73
|
+
a(u, {
|
|
74
|
+
indexes: [n],
|
|
75
|
+
column: r
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
return /* @__PURE__ */ t(h, { ownerState: {}, variant: "body", color: "text.primary", children: d });
|
|
81
|
+
}
|
|
82
|
+
const l = i[e.key], m = l == null || l === "";
|
|
83
|
+
return e.renderEditCell ? /* @__PURE__ */ S(W, { ownerState: {}, children: [
|
|
84
|
+
/* @__PURE__ */ t(
|
|
85
|
+
h,
|
|
86
|
+
{
|
|
87
|
+
ownerState: {},
|
|
88
|
+
variant: "body",
|
|
89
|
+
color: m ? "text.secondary" : "text.primary",
|
|
90
|
+
children: m ? x(z.EDIT_PLACEHOLDER) : l
|
|
91
|
+
}
|
|
92
|
+
),
|
|
93
|
+
/* @__PURE__ */ t(
|
|
94
|
+
j,
|
|
95
|
+
{
|
|
96
|
+
ownerState: {},
|
|
97
|
+
src: /* @__PURE__ */ t(P, {}),
|
|
98
|
+
onClick: () => c(e.key),
|
|
99
|
+
size: D,
|
|
100
|
+
role: "button",
|
|
101
|
+
"aria-label": "Edit text"
|
|
102
|
+
}
|
|
103
|
+
)
|
|
104
|
+
] }) : /* @__PURE__ */ t(h, { ownerState: {}, variant: "body", color: "text.primary", children: l ?? "-" });
|
|
105
|
+
})()
|
|
106
|
+
]
|
|
107
|
+
}
|
|
108
|
+
) }, g);
|
|
109
|
+
}) });
|
|
110
|
+
}
|
|
111
|
+
export {
|
|
112
|
+
U as ListDetail
|
|
113
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../../../../packages/components/src/components/datagrids/views/ListView/subcomponents/ListDetail/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,YAAY,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { Column, RowsChangeData } from 'react-data-grid';
|
|
2
|
+
import { Maybe } from '@m4l/core';
|
|
3
|
+
import { IViewConfig } from '../../../../contexts/DataGridContext/types';
|
|
4
|
+
import { Sizes } from '@m4l/styles';
|
|
5
|
+
/**
|
|
6
|
+
* Props para el componente ListDetail
|
|
7
|
+
*/
|
|
8
|
+
export interface ListDetailProps<TRow> {
|
|
9
|
+
/**
|
|
10
|
+
* Fila que se mostrará en el detalle
|
|
11
|
+
*/
|
|
12
|
+
row: TRow;
|
|
13
|
+
/**
|
|
14
|
+
* Array completo de todas las filas (necesario para reconstruir el array al editar)
|
|
15
|
+
*/
|
|
16
|
+
rows: readonly TRow[];
|
|
17
|
+
/**
|
|
18
|
+
* Índice de la fila actual en el array de filas
|
|
19
|
+
*/
|
|
20
|
+
rowIndex: number;
|
|
21
|
+
/**
|
|
22
|
+
* Columnas que se mostrarán en el detalle
|
|
23
|
+
*/
|
|
24
|
+
columns: readonly Column<TRow, any>[];
|
|
25
|
+
/**
|
|
26
|
+
* Configuración de las columnas de la vista
|
|
27
|
+
*/
|
|
28
|
+
viewColumnsConfig: IViewConfig<any, any>[];
|
|
29
|
+
/**
|
|
30
|
+
* Función para manejar cambios en las filas (para editores)
|
|
31
|
+
*/
|
|
32
|
+
onRowsChange?: Maybe<(rows: TRow[], data: RowsChangeData<TRow, any>) => void>;
|
|
33
|
+
/**
|
|
34
|
+
* Tamaño del componente
|
|
35
|
+
* @default 'medium'
|
|
36
|
+
*/
|
|
37
|
+
size?: Extract<Sizes, 'small' | 'medium'>;
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../../../../../../packages/components/src/components/datagrids/views/ListView/subcomponents/ListDetail/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,WAAW,EAAE,MAAM,4CAA4C,CAAC;AACzE,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAEpC;;GAEG;AACH,MAAM,WAAW,eAAe,CAAC,IAAI;IACnC;;OAEG;IACH,GAAG,EAAE,IAAI,CAAC;IACV;;OAEG;IACH,IAAI,EAAE,SAAS,IAAI,EAAE,CAAC;IACtB;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IAEjB;;OAEG;IACH,OAAO,EAAE,SAAS,MAAM,CAAC,IAAI,EAAE,GAAG,CAAC,EAAE,CAAC;IACtC;;OAEG;IACH,iBAAiB,EAAE,WAAW,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,CAAC;IAC3C;;OAEG;IACH,YAAY,CAAC,EAAE,KAAK,CAAC,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,cAAc,CAAC,IAAI,EAAE,GAAG,CAAC,KAAK,IAAI,CAAC,CAAC;IAC9E;;;OAGG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC,KAAK,EAAE,OAAO,GAAG,QAAQ,CAAC,CAAC;CAC3C"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { RowKey } from '../../../../types';
|
|
2
|
+
import { ListRowProps } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Component that renders a single list row.
|
|
5
|
+
*/
|
|
6
|
+
declare function ListRowComponent<TRow, TKey extends RowKey = RowKey>({ row, rows, rowIndex, columns, originalColumns, rowKeyGetter, selectedRows, onSelectedRowsChange, onRowsChange, customRender, isChecked, showCheckbox, checkedRows, onCheckedRowsChange, onOpenDetail, showExpandButton, onExpandClick, }: ListRowProps<TRow, TKey>): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
7
|
+
/**
|
|
8
|
+
* Componente que muestra una fila de lista.
|
|
9
|
+
*/
|
|
10
|
+
export declare const ListRow: typeof ListRowComponent;
|
|
11
|
+
export {};
|
|
12
|
+
//# sourceMappingURL=ListRow.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ListRow.d.ts","sourceRoot":"","sources":["../../../../../../../../../../packages/components/src/components/datagrids/views/ListView/subcomponents/ListRow/ListRow.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAI3C,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAIvC;;GAEG;AACH,iBAAS,gBAAgB,CAAC,IAAI,EAAE,IAAI,SAAS,MAAM,GAAG,MAAM,EAAE,EAC5D,GAAG,EACH,IAAI,EACJ,QAAQ,EACR,OAAO,EACP,eAAe,EACf,YAAY,EACZ,YAAY,EACZ,oBAAoB,EACpB,YAAY,EACZ,YAAY,EACZ,SAAS,EACT,YAAY,EACZ,WAAW,EACX,mBAAmB,EACnB,YAAY,EACZ,gBAAuB,EACvB,aAAa,GACd,EAAE,YAAY,CAAC,IAAI,EAAE,IAAI,CAAC,oDA2H1B;AAED;;GAEG;AACH,eAAO,MAAM,OAAO,EAEd,OAAO,gBAAgB,CAAC"}
|