@m4l/components 9.37.0 → 9.37.1-beta-pkg-754-nuevos-hooks-compartidos-para-shared-export-datagrid.0
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/formatters/ColumnDateFormatter/ColumnDateGroupFormatter.js +1 -1
- package/components/datagrids/formatters/ColumnDateFormatter/formatter.js +1 -1
- package/components/datagrids/formatters/ColumnDateFormatter/types.d.ts +2 -1
- package/components/datagrids/formatters/ColumnDateFormatter/types.d.ts.map +1 -1
- package/components/datagrids/formatters/ColumnDateFormatter/useColumnDate.d.ts +4 -1
- package/components/datagrids/formatters/ColumnDateFormatter/useColumnDate.d.ts.map +1 -1
- package/components/datagrids/formatters/ColumnDateFormatter/useColumnDate.js +25 -18
- package/hooks/index.d.ts +1 -0
- package/hooks/index.d.ts.map +1 -1
- package/hooks/useExportDatagridColumns/index.d.ts +4 -0
- package/hooks/useExportDatagridColumns/index.d.ts.map +1 -0
- package/hooks/useExportDatagridColumns/types.d.ts +47 -0
- package/hooks/useExportDatagridColumns/types.d.ts.map +1 -0
- package/hooks/useExportDatagridColumns/useExportColumns.d.ts +16 -0
- package/hooks/useExportDatagridColumns/useExportColumns.d.ts.map +1 -0
- package/hooks/useExportDatagridColumns/useExportColumns.js +23 -0
- package/hooks/useExportDatagridColumns/useVisibleColumnNames.d.ts +9 -0
- package/hooks/useExportDatagridColumns/useVisibleColumnNames.d.ts.map +1 -0
- package/hooks/useExportDatagridColumns/useVisibleColumnNames.js +7 -0
- package/index.js +39 -35
- package/package.json +6 -6
|
@@ -3,7 +3,7 @@ import { getPropertyByString as l } from "@m4l/core";
|
|
|
3
3
|
import s from "react";
|
|
4
4
|
import { DateFormatter as c } from "../../../formatters/DateFormatter/DateFormatter.js";
|
|
5
5
|
function F(n) {
|
|
6
|
-
const { fieldValue: a, presentationType: i, Component: m = s.Fragment } = n;
|
|
6
|
+
const { fieldValue: a, presentationType: i = "datetime", Component: m = s.Fragment } = n;
|
|
7
7
|
return (p) => {
|
|
8
8
|
const { childRows: r } = p;
|
|
9
9
|
if (r.length === 0)
|
|
@@ -3,7 +3,7 @@ import { getPropertyByString as f } from "@m4l/core";
|
|
|
3
3
|
import p from "react";
|
|
4
4
|
import { DateFormatter as u } from "../../../formatters/DateFormatter/DateFormatter.js";
|
|
5
5
|
function g(r) {
|
|
6
|
-
const { fieldValue: o, presentationType: n, Component: a = p.Fragment } = r;
|
|
6
|
+
const { fieldValue: o, presentationType: n = "datetime", Component: a = p.Fragment } = r;
|
|
7
7
|
return (m) => {
|
|
8
8
|
const e = f(
|
|
9
9
|
m.row,
|
|
@@ -2,7 +2,8 @@ import { PresentationType } from '../../../formatters/DateFormatter/types';
|
|
|
2
2
|
import { DeepKeyOf } from '../../../../utils/types';
|
|
3
3
|
export interface ColumnDateFormatterProps<TRow> {
|
|
4
4
|
Component?: React.ElementType;
|
|
5
|
-
|
|
5
|
+
/** Optional; defaults to 'datetime' (renders as datetime and exports as date_time). */
|
|
6
|
+
presentationType?: PresentationType;
|
|
6
7
|
format?: string;
|
|
7
8
|
fieldValue: DeepKeyOf<TRow>;
|
|
8
9
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/components/src/components/datagrids/formatters/ColumnDateFormatter/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,yCAAyC,CAAC;AAC3E,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,MAAM,WAAW,wBAAwB,CAAC,IAAI;IAC5C,SAAS,CAAC,EAAE,KAAK,CAAC,WAAW,CAAC;IAC9B,gBAAgB,EAAE,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/components/src/components/datagrids/formatters/ColumnDateFormatter/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,yCAAyC,CAAC;AAC3E,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,MAAM,WAAW,wBAAwB,CAAC,IAAI;IAC5C,SAAS,CAAC,EAAE,KAAK,CAAC,WAAW,CAAC;IAC9B,uFAAuF;IACvF,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;IACpC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,SAAS,CAAC,IAAI,CAAC,CAAC;CAC7B"}
|
|
@@ -7,10 +7,13 @@ export declare const useCustomDateFilter: <TRow>(props: ColumnDateFormatterProps
|
|
|
7
7
|
* Function helper that returns the formatter,
|
|
8
8
|
* customFilter and customSort of a date column
|
|
9
9
|
*/
|
|
10
|
-
export declare const useColumnDate: <TRow>(props: ColumnDateFormatterProps<TRow>) => {
|
|
10
|
+
export declare const useColumnDate: <TRow>(props: ColumnDateFormatterProps<TRow>) => Omit<{
|
|
11
11
|
formatter: (formatterProps: import('react-data-grid').RenderCellProps<TRow, unknown>) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
12
12
|
renderGroupCell: (groupProps: import('react-data-grid').RenderGroupCellProps<TRow, unknown>) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
13
13
|
customFilter: (row: TRow, value: string) => boolean;
|
|
14
14
|
customSort: (a: TRow, b: TRow) => 0 | 1 | -1;
|
|
15
|
+
exportDataType: string;
|
|
16
|
+
}, "exportDataType"> & {
|
|
17
|
+
exportDataType?: string;
|
|
15
18
|
};
|
|
16
19
|
//# sourceMappingURL=useColumnDate.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useColumnDate.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/components/src/components/datagrids/formatters/ColumnDateFormatter/useColumnDate.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,wBAAwB,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"useColumnDate.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/components/src/components/datagrids/formatters/ColumnDateFormatter/useColumnDate.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,wBAAwB,EAAE,MAAM,SAAS,CAAC;AAYnD;;GAEG;AACH,eAAO,MAAM,mBAAmB,GAAI,IAAI,EAAE,OAAO,wBAAwB,CAAC,IAAI,CAAC,WAG9C,IAAI,SAAS,MAAM,YAqBnD,CAAC;AAmCF;;;GAGG;AACH,eAAO,MAAM,aAAa,GAAI,IAAI,EAAE,OAAO,wBAAwB,CAAC,IAAI,CAAC;;;qCA5D3B,MAAM;;;;qBAsF4B,MAAM;CAErF,CAAC"}
|
|
@@ -1,36 +1,43 @@
|
|
|
1
1
|
import { useUserPreferences as l, getPropertyByString as i } from "@m4l/core";
|
|
2
2
|
import { ColumnDateFormatter as c } from "./formatter.js";
|
|
3
|
-
import { ColumnDateGroupFormatter as
|
|
3
|
+
import { ColumnDateGroupFormatter as d } from "./ColumnDateGroupFormatter.js";
|
|
4
4
|
import { getValidDate as s } from "../../../../utils/getValidDate.js";
|
|
5
|
-
import { useState as
|
|
6
|
-
import { deepEqual as
|
|
5
|
+
import { useState as T, useRef as D, useEffect as g, useMemo as y, useCallback as p } from "react";
|
|
6
|
+
import { deepEqual as C } from "fast-equals";
|
|
7
7
|
import { getColumnKey as f } from "../../helpers/shared/getColumnKey/getColumnKey.js";
|
|
8
|
-
const
|
|
8
|
+
const P = (e) => {
|
|
9
9
|
const { formatDate: t } = l();
|
|
10
|
-
return
|
|
11
|
-
const
|
|
10
|
+
return p((a, n) => {
|
|
11
|
+
const u = f(e.fieldValue), o = i(a, u);
|
|
12
12
|
let r = null;
|
|
13
13
|
return typeof o == "string" ? r = new Date(o) : o instanceof Date && (r = o), !r || isNaN(r.getTime()) ? !1 : t({
|
|
14
|
-
presentationType: e.presentationType,
|
|
14
|
+
presentationType: e.presentationType ?? "datetime",
|
|
15
15
|
value: r,
|
|
16
16
|
format: e.format
|
|
17
17
|
}).includes(n);
|
|
18
18
|
}, [e.presentationType, e.format, t]);
|
|
19
|
-
},
|
|
20
|
-
const a = f(e.fieldValue), n = i(t, a),
|
|
19
|
+
}, S = (e) => (t, m) => {
|
|
20
|
+
const a = f(e.fieldValue), n = i(t, a), u = i(m, a), o = s(n), r = s(u);
|
|
21
21
|
return !o || !r ? 0 : o.getTime() > r.getTime() ? 1 : o.getTime() < r.getTime() ? -1 : 0;
|
|
22
|
-
},
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
22
|
+
}, V = {
|
|
23
|
+
date: "date",
|
|
24
|
+
datetime: "date_time",
|
|
25
|
+
time: "time"
|
|
26
|
+
}, B = (e) => {
|
|
27
|
+
const [t, m] = T(e), a = P(t), n = D({ ...e });
|
|
28
|
+
return g(() => {
|
|
29
|
+
C(n.current, e) || (n.current = e, m(e));
|
|
30
|
+
}, [e]), y(() => ({
|
|
27
31
|
formatter: c(t),
|
|
28
|
-
renderGroupCell:
|
|
32
|
+
renderGroupCell: d(t),
|
|
29
33
|
customFilter: a,
|
|
30
|
-
customSort:
|
|
34
|
+
customSort: S(t),
|
|
35
|
+
// Export dataType derived from the presentation mode (date / datetime / time),
|
|
36
|
+
// since the DataGrid ColumnType cannot carry it. useExportColumns reads it.
|
|
37
|
+
exportDataType: V[t.presentationType ?? "datetime"]
|
|
31
38
|
}), [t, a]);
|
|
32
39
|
};
|
|
33
40
|
export {
|
|
34
|
-
|
|
35
|
-
|
|
41
|
+
B as useColumnDate,
|
|
42
|
+
P as useCustomDateFilter
|
|
36
43
|
};
|
package/hooks/index.d.ts
CHANGED
package/hooks/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../packages/components/src/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,wBAAwB,EAAE,MAAM,6BAA6B,CAAC;AACvE,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,cAAc,eAAe,CAAC;AAC9B,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,0BAA0B,CAAC;AACzC,cAAc,uBAAuB,CAAC;AACtC,cAAc,wBAAwB,CAAC;AACvC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../packages/components/src/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,wBAAwB,EAAE,MAAM,6BAA6B,CAAC;AACvE,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,cAAc,eAAe,CAAC;AAC9B,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,0BAA0B,CAAC;AACzC,cAAc,uBAAuB,CAAC;AACtC,cAAc,wBAAwB,CAAC;AACvC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,4BAA4B,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { useExportColumns } from './useExportColumns';
|
|
2
|
+
export { useVisibleColumnNames } from './useVisibleColumnNames';
|
|
3
|
+
export type { DataGridColumn, ColumnVisibilityConfig, ExportableColumnConfig, ExportableColumnsMap, ExportColumn, } from './types';
|
|
4
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../packages/components/src/hooks/useExportDatagridColumns/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,YAAY,EACV,cAAc,EACd,sBAAsB,EACtB,sBAAsB,EACtB,oBAAoB,EACpB,YAAY,GACb,MAAM,SAAS,CAAC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared type contracts for the Shared Export DataGrid column hooks.
|
|
3
|
+
*
|
|
4
|
+
* Consumed by list modules to build the params passed to the export
|
|
5
|
+
* microfrontend. Modules inject only what varies (their `EXPORTABLE_COLUMNS`
|
|
6
|
+
* map); the hooks and these contracts live once in `@m4l/components`.
|
|
7
|
+
*/
|
|
8
|
+
/** Minimal DataGrid column shape the export hooks read. */
|
|
9
|
+
export interface DataGridColumn {
|
|
10
|
+
key: string;
|
|
11
|
+
name: string | unknown;
|
|
12
|
+
type: string;
|
|
13
|
+
visible?: boolean;
|
|
14
|
+
exportable?: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Optional export dataType resolved from the column's presentation mode
|
|
17
|
+
* (e.g. a date column's `datetime` → `date_time`). When present it overrides
|
|
18
|
+
* `type` for export, because the DataGrid ColumnType is always `date`.
|
|
19
|
+
*/
|
|
20
|
+
exportDataType?: string;
|
|
21
|
+
}
|
|
22
|
+
/** Persisted per-user column visibility entry (from the saved cookie config). */
|
|
23
|
+
export interface ColumnVisibilityConfig {
|
|
24
|
+
key: string;
|
|
25
|
+
visible: boolean;
|
|
26
|
+
}
|
|
27
|
+
/** Per-module mapping value: backend field name plus optional formatter props. */
|
|
28
|
+
export interface ExportableColumnConfig {
|
|
29
|
+
/** Backend API field name (snake_case). */
|
|
30
|
+
name: string;
|
|
31
|
+
/** Optional formatter options forwarded to the export worker. */
|
|
32
|
+
formatterProps?: Record<string, unknown>;
|
|
33
|
+
}
|
|
34
|
+
/** Per-module map of DataGrid column key (camelCase) to backend export config. */
|
|
35
|
+
export type ExportableColumnsMap = Record<string, ExportableColumnConfig>;
|
|
36
|
+
/** Export column metadata entry expected by the shared export microfrontend. */
|
|
37
|
+
export interface ExportColumn {
|
|
38
|
+
/** Backend API field name sent to the export worker. */
|
|
39
|
+
name: string;
|
|
40
|
+
/** Optional formatter options forwarded to the export worker. */
|
|
41
|
+
formatterProps?: Record<string, unknown>;
|
|
42
|
+
/** Translated DataGrid label rendered as the column title in the export form. */
|
|
43
|
+
title: string;
|
|
44
|
+
/** DataGrid column data type (string, number, date, ...). */
|
|
45
|
+
dataType: string;
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../../packages/components/src/hooks/useExportDatagridColumns/types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,2DAA2D;AAC3D,MAAM,WAAW,cAAc;IAC7B,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;;OAIG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,iFAAiF;AACjF,MAAM,WAAW,sBAAsB;IACrC,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,kFAAkF;AAClF,MAAM,WAAW,sBAAsB;IACrC,2CAA2C;IAC3C,IAAI,EAAE,MAAM,CAAC;IACb,iEAAiE;IACjE,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAC1C;AAED,kFAAkF;AAClF,MAAM,MAAM,oBAAoB,GAAG,MAAM,CAAC,MAAM,EAAE,sBAAsB,CAAC,CAAC;AAE1E,gFAAgF;AAChF,MAAM,WAAW,YAAY;IAC3B,wDAAwD;IACxD,IAAI,EAAE,MAAM,CAAC;IACb,iEAAiE;IACjE,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACzC,iFAAiF;IACjF,KAAK,EAAE,MAAM,CAAC;IACd,6DAA6D;IAC7D,QAAQ,EAAE,MAAM,CAAC;CAClB"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { DataGridColumn, ExportColumn, ExportableColumnsMap } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Builds the exportable column metadata passed to the shared export datagrid MF.
|
|
4
|
+
*
|
|
5
|
+
* Filters columns flagged with `exportable: true` and maps each one to the shape the
|
|
6
|
+
* export microfrontend expects:
|
|
7
|
+
* - name: backend API field (from the injected `exportableColumns` map, falls back to the grid key)
|
|
8
|
+
* - formatterProps: optional format options forwarded to the export worker
|
|
9
|
+
* - title: the translated column label rendered in the export form's column list
|
|
10
|
+
* - dataType: the column's `exportDataType` when present (e.g. a date column's
|
|
11
|
+
* date_time / time), otherwise the grid `type` (string, number, date, ...)
|
|
12
|
+
* @param columns DataGrid columns; only those with `exportable: true` are emitted.
|
|
13
|
+
* @param exportableColumns Per-module map of grid key to backend field (+ optional formatter props).
|
|
14
|
+
*/
|
|
15
|
+
export declare function useExportColumns(columns?: DataGridColumn[], exportableColumns?: ExportableColumnsMap): ExportColumn[];
|
|
16
|
+
//# sourceMappingURL=useExportColumns.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useExportColumns.d.ts","sourceRoot":"","sources":["../../../../../../packages/components/src/hooks/useExportDatagridColumns/useExportColumns.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAElF;;;;;;;;;;;;GAYG;AACH,wBAAgB,gBAAgB,CAC9B,OAAO,GAAE,cAAc,EAAO,EAC9B,iBAAiB,GAAE,oBAAyB,GAC3C,YAAY,EAAE,CAwBhB"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { useMemo as a } from "react";
|
|
2
|
+
function f(r = [], p = {}) {
|
|
3
|
+
return a(
|
|
4
|
+
() => r.filter((e) => e.exportable === !0).map((e) => {
|
|
5
|
+
const t = p[e.key];
|
|
6
|
+
return {
|
|
7
|
+
// Backend API field name: use the mapped value if present, otherwise the grid key
|
|
8
|
+
name: t?.name ?? e.key,
|
|
9
|
+
// Additional format options (when they apply)
|
|
10
|
+
...t?.formatterProps ? { formatterProps: t.formatterProps } : {},
|
|
11
|
+
// Translated DataGrid label used as the column title in the export form
|
|
12
|
+
title: e.name,
|
|
13
|
+
// Prefer the resolved export dataType (date columns carry date_time/time
|
|
14
|
+
// here since the grid `type` is always 'date'); fall back to the grid type.
|
|
15
|
+
dataType: e.exportDataType ?? e.type
|
|
16
|
+
};
|
|
17
|
+
}),
|
|
18
|
+
[r, p]
|
|
19
|
+
);
|
|
20
|
+
}
|
|
21
|
+
export {
|
|
22
|
+
f as useExportColumns
|
|
23
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ColumnVisibilityConfig, DataGridColumn, ExportableColumnsMap } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Resolves the API field names that should be pre-selected in the export form.
|
|
4
|
+
* @param columns DataGrid columns.
|
|
5
|
+
* @param exportableColumns Per-module map of grid key to backend field name.
|
|
6
|
+
* @param defaultConfigColumns Persisted per-user visibility config (may be an empty array).
|
|
7
|
+
*/
|
|
8
|
+
export declare function useVisibleColumnNames(columns?: DataGridColumn[], exportableColumns?: ExportableColumnsMap, defaultConfigColumns?: ColumnVisibilityConfig[]): string[];
|
|
9
|
+
//# sourceMappingURL=useVisibleColumnNames.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useVisibleColumnNames.d.ts","sourceRoot":"","sources":["../../../../../../packages/components/src/hooks/useExportDatagridColumns/useVisibleColumnNames.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,sBAAsB,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAE5F;;;;;GAKG;AACH,wBAAgB,qBAAqB,CACnC,OAAO,GAAE,cAAc,EAAO,EAC9B,iBAAiB,GAAE,oBAAyB,EAC5C,oBAAoB,CAAC,EAAE,sBAAsB,EAAE,GAC9C,MAAM,EAAE,CAiBV"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { useMemo as a } from "react";
|
|
2
|
+
function y(r = [], s = {}, i) {
|
|
3
|
+
return a(() => (i !== void 0 && i.length > 0 ? i.filter((e) => e.visible).map((e) => e.key) : r.filter((e) => e.visible !== !1).map((e) => e.key)).filter((e) => r.find((t) => t.key === e)?.exportable === !0).map((e) => s[e]?.name ?? e), [r, s, i]);
|
|
4
|
+
}
|
|
5
|
+
export {
|
|
6
|
+
y as useVisibleColumnNames
|
|
7
|
+
};
|
package/index.js
CHANGED
|
@@ -318,22 +318,24 @@ import { resolvePopoverPaperProps as gl, usePopoverPaperProps as Tl } from "./ho
|
|
|
318
318
|
import { useIsVisible as Dl } from "./hooks/useIsVisible/useIsVisible.js";
|
|
319
319
|
import { useSizeContainer as Sl } from "./hooks/useSizeContainer/index.js";
|
|
320
320
|
import { useWatchTyped as yl } from "./hooks/useWatchTyped/useTypedWatch.js";
|
|
321
|
-
import {
|
|
322
|
-
import {
|
|
323
|
-
import {
|
|
324
|
-
import {
|
|
325
|
-
import {
|
|
326
|
-
import {
|
|
327
|
-
import {
|
|
328
|
-
import {
|
|
329
|
-
import {
|
|
330
|
-
import {
|
|
331
|
-
import {
|
|
332
|
-
import {
|
|
333
|
-
import {
|
|
334
|
-
import {
|
|
335
|
-
import {
|
|
336
|
-
import {
|
|
321
|
+
import { useExportColumns as _l } from "./hooks/useExportDatagridColumns/useExportColumns.js";
|
|
322
|
+
import { useVisibleColumnNames as Nl } from "./hooks/useExportDatagridColumns/useVisibleColumnNames.js";
|
|
323
|
+
import { withToggle as Ll } from "./hocs/withToggle/index.js";
|
|
324
|
+
import { withRHFController as vl } from "./hocs/withRHFController/index.js";
|
|
325
|
+
import { capitalizeFirstLetter as bl } from "./utils/capitalizeFirstLetter.js";
|
|
326
|
+
import { isValidDate as kl } from "./utils/isValidDate.js";
|
|
327
|
+
import { getComponentUtilityClass as Vl } from "./utils/getComponentUtilityClass.js";
|
|
328
|
+
import { getPaletteColor as Yl } from "./utils/getPaletteColor.js";
|
|
329
|
+
import { getTypographyStyles as Ul } from "./utils/getTypographyStyles.js";
|
|
330
|
+
import { getIconColor as Kl } from "./utils/getIconColor.js";
|
|
331
|
+
import { getHeightSizeStyles as Jl, getSizeStyles as ql } from "./utils/getSizeStyles/getSizeStyles.js";
|
|
332
|
+
import { getInputAlignmentIconButtonOverrides as Xl } from "./utils/getInputAlignmentIconButtonOverrides/getInputAlignmentIconButtonOverrides.js";
|
|
333
|
+
import { ObjectQueue as $l } from "./utils/ObjectQueue.js";
|
|
334
|
+
import { getComponentClasses as ru, getComponentSlotRoot as eu } from "./utils/getComponentSlotRoot.js";
|
|
335
|
+
import { formatDistanceToNow as mu } from "./utils/formatDistanceToNow/formatDistanteToNow.js";
|
|
336
|
+
import { getValidDate as au } from "./utils/getValidDate.js";
|
|
337
|
+
import { getNullGuard as iu } from "./utils/getNullGuard.js";
|
|
338
|
+
import { createCustomDeepShallow as fu, deepShallow as su } from "./utils/deepShallow.js";
|
|
337
339
|
export {
|
|
338
340
|
U as AREAS_DICCTIONARY,
|
|
339
341
|
W as AREAS_DICTIONARY_ID,
|
|
@@ -490,7 +492,7 @@ export {
|
|
|
490
492
|
Ko as NumberEditor,
|
|
491
493
|
$n as NumberInputStyled,
|
|
492
494
|
Ex as ObjectLogs,
|
|
493
|
-
|
|
495
|
+
$l as ObjectQueue,
|
|
494
496
|
Ox as PDFViewer,
|
|
495
497
|
Cl as POPOVER_CONTAINER_ID,
|
|
496
498
|
cl as POPOVER_OVERLAY_ROOT_ATTRIBUTE,
|
|
@@ -609,25 +611,25 @@ export {
|
|
|
609
611
|
Pf as WindowToolsMFProvider,
|
|
610
612
|
Ba as addLayoutItemToBreakPointIfNoExists,
|
|
611
613
|
ba as addLayoutItemToBreakPoints,
|
|
612
|
-
|
|
614
|
+
bl as capitalizeFirstLetter,
|
|
613
615
|
Ga as cloneLayouts,
|
|
614
616
|
qt as createCodeEditorLezerSyntaxValidator,
|
|
615
617
|
px as createComponentsMFIsolationAppStorybookProps,
|
|
616
|
-
|
|
618
|
+
fu as createCustomDeepShallow,
|
|
617
619
|
Tf as createDynamicMFStore,
|
|
618
620
|
di as createEmptyValidationSchema,
|
|
619
621
|
e as createToaster,
|
|
620
622
|
Fi as createValidationFullObject,
|
|
621
623
|
Pi as createValidationPartialObject,
|
|
622
624
|
gi as createValidationSchema,
|
|
623
|
-
|
|
625
|
+
su as deepShallow,
|
|
624
626
|
Bo as defaultCommonActionsDictionary,
|
|
625
627
|
Ye as defaultDateRangeCalendarPickerDictionary,
|
|
626
628
|
ot as defaultDateTimeRangePickerDictionary,
|
|
627
629
|
He as dragResizeWindowRNDClasses,
|
|
628
630
|
Qt as ensureCodeEditorRuntimeDependencies,
|
|
629
631
|
Fs as evaluateVisibilityStepCondition,
|
|
630
|
-
|
|
632
|
+
mu as formatDistanceToNow,
|
|
631
633
|
a as getAccountPopoverDictionary,
|
|
632
634
|
L as getAppBarDictionary,
|
|
633
635
|
j as getAreasComponentsDictionary,
|
|
@@ -635,9 +637,9 @@ export {
|
|
|
635
637
|
Fa as getBooleanFormatterComponentsDictionary,
|
|
636
638
|
eo as getCheckableListComponentsDictionary,
|
|
637
639
|
bo as getCommonActionsDictionary,
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
640
|
+
ru as getComponentClasses,
|
|
641
|
+
eu as getComponentSlotRoot,
|
|
642
|
+
Vl as getComponentUtilityClass,
|
|
641
643
|
Uo as getDataGridComponentsDictionary,
|
|
642
644
|
qo as getDataGridRowsFromSet,
|
|
643
645
|
ze as getDateRangeCalendarPickerComponentsDictionary,
|
|
@@ -654,10 +656,10 @@ export {
|
|
|
654
656
|
Qp as getFormatPoints,
|
|
655
657
|
pa as getFormatPrice,
|
|
656
658
|
Ia as getFormattersComponentsDictionary,
|
|
657
|
-
|
|
658
|
-
|
|
659
|
+
Jl as getHeightSizeStyles,
|
|
660
|
+
Kl as getIconColor,
|
|
659
661
|
Oi as getImageSelectorComponentsDictionary,
|
|
660
|
-
|
|
662
|
+
Xl as getInputAlignmentIconButtonOverrides,
|
|
661
663
|
at as getIsIfInDynamicFilter,
|
|
662
664
|
zi as getLoadingErrorComponentsDictionary,
|
|
663
665
|
xx as getMFLoaderComponentsDictionary,
|
|
@@ -666,26 +668,26 @@ export {
|
|
|
666
668
|
wf as getModalDictionary,
|
|
667
669
|
Rx as getNoItemPrivilegesComponentsDictionary,
|
|
668
670
|
Fx as getNoItemSelectedComponentsDictionary,
|
|
669
|
-
|
|
671
|
+
iu as getNullGuard,
|
|
670
672
|
Ax as getObjectLogsComponentsDictionary,
|
|
671
673
|
gm as getPagerComponentsDictionary,
|
|
672
|
-
|
|
674
|
+
Yl as getPaletteColor,
|
|
673
675
|
zn as getPeriodComponetsDictionary,
|
|
674
676
|
on as getRHFAutocompleteAsyncComponentsDictionary,
|
|
675
677
|
Qa as getRHFAutocompleteComponentsDictionary,
|
|
676
678
|
it as getRawFiltersForNetwork,
|
|
677
679
|
_t as getRawSortsForNetwork,
|
|
678
|
-
|
|
680
|
+
ql as getSizeStyles,
|
|
679
681
|
Rs as getStepperComponentsDictionary,
|
|
680
682
|
gs as getStepsAndValidationSchema,
|
|
681
683
|
Zx as getTabsNavigatorComponentsDictionary,
|
|
682
|
-
|
|
684
|
+
Ul as getTypographyStyles,
|
|
683
685
|
jp as getUncertaintyFormat,
|
|
684
|
-
|
|
686
|
+
au as getValidDate,
|
|
685
687
|
Ws as getformAddEditDictionary,
|
|
686
688
|
ha as isEqualLayout,
|
|
687
689
|
Va as isEqualLayouts,
|
|
688
|
-
|
|
690
|
+
kl as isValidDate,
|
|
689
691
|
sx as projectMFHostRuntimeTools,
|
|
690
692
|
Xt as registerCodeEditorLanguage,
|
|
691
693
|
Zt as registerCodeEditorLanguageTemplate,
|
|
@@ -727,6 +729,7 @@ export {
|
|
|
727
729
|
Pt as useDynamicFormData,
|
|
728
730
|
af as useDynamicMFParameters,
|
|
729
731
|
nf as useDynamicMFParametersStore,
|
|
732
|
+
_l as useExportColumns,
|
|
730
733
|
hs as useFormAddEdit,
|
|
731
734
|
js as useFormFocus,
|
|
732
735
|
$s as useFormReadyForUpdate,
|
|
@@ -747,6 +750,7 @@ export {
|
|
|
747
750
|
qf as useStepper,
|
|
748
751
|
pl as useSvgColor,
|
|
749
752
|
zs as useTab,
|
|
753
|
+
Nl as useVisibleColumnNames,
|
|
750
754
|
yl as useWatchTyped,
|
|
751
755
|
Lo as useWindowCloseGuard,
|
|
752
756
|
mf as useWindowToolsMF,
|
|
@@ -756,7 +760,7 @@ export {
|
|
|
756
760
|
y as varTranEnter,
|
|
757
761
|
I as varTranExit,
|
|
758
762
|
_ as varTranHover,
|
|
759
|
-
|
|
763
|
+
vl as withRHFController,
|
|
760
764
|
Ya as withSizeProvider,
|
|
761
|
-
|
|
765
|
+
Ll as withToggle
|
|
762
766
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@m4l/components",
|
|
3
|
-
"version": "9.37.0",
|
|
3
|
+
"version": "9.37.1-beta-pkg-754-nuevos-hooks-compartidos-para-shared-export-datagrid.0",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -52,21 +52,21 @@
|
|
|
52
52
|
"@hookform/resolvers": "2.9.11",
|
|
53
53
|
"nprogress": "0.2.0",
|
|
54
54
|
"react-transition-group": "4.4.5",
|
|
55
|
+
"react-color": "2.19.3",
|
|
55
56
|
"@mui/x-date-pickers": "6.20.2",
|
|
57
|
+
"react-spinners": "0.13.8",
|
|
56
58
|
"react-rnd": "10.5.2",
|
|
57
|
-
"react-color": "2.19.3",
|
|
58
|
-
"react-dropzone": "14.4.1",
|
|
59
59
|
"react-draggable": "4.5.0",
|
|
60
|
-
"react-
|
|
60
|
+
"react-dropzone": "14.4.1",
|
|
61
61
|
"chart.js": "4.5.1",
|
|
62
62
|
"chartjs-chart-error-bars": "4.4.5",
|
|
63
63
|
"qrcode.react": "3.2.0",
|
|
64
64
|
"simplebar-react": "3.2.6",
|
|
65
|
-
"react-resizable-panels": "2.1.9",
|
|
66
|
-
"react-simple-code-editor": "0.14.1",
|
|
67
65
|
"react-data-grid": "7.0.0-beta.47",
|
|
68
66
|
"react-dnd": "16.0.1",
|
|
69
67
|
"react-dnd-html5-backend": "16.0.1",
|
|
68
|
+
"react-resizable-panels": "2.1.9",
|
|
69
|
+
"react-simple-code-editor": "0.14.1",
|
|
70
70
|
"date-fns": "2.30.0",
|
|
71
71
|
"react-resizable": "3.1.3",
|
|
72
72
|
"react-window": "1.8.11",
|