@m4l/layouts 9.6.1-beta-fix-use-refresh-data.2 → 9.6.1-beta-fix-use-refresh-data.4
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/hooks/useRefreshData/dictionary.d.ts +2 -2
- package/hooks/useRefreshData/dictionary.js +2 -2
- package/hooks/useRefreshData/types.d.ts +0 -4
- package/hooks/useRefreshData/types.d.ts.map +1 -1
- package/hooks/useRefreshData/useRefreshData.d.ts.map +1 -1
- package/hooks/useRefreshData/useRefreshData.js +23 -20
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export declare const USE_REFRESH_DATA_DICTIONARY: {
|
|
2
|
-
readonly TOAST_NEW_ROW_BUT_NOT_VISIBLE_TITLE: "
|
|
3
|
-
readonly TOAST_NEW_ROW_BUT_NOT_VISIBLE_DESCRIPTION: "
|
|
2
|
+
readonly TOAST_NEW_ROW_BUT_NOT_VISIBLE_TITLE: "refresh_data.toast_new_row_but_not_visible_title";
|
|
3
|
+
readonly TOAST_NEW_ROW_BUT_NOT_VISIBLE_DESCRIPTION: "refresh_data.toast_new_row_but_not_visible_description";
|
|
4
4
|
};
|
|
5
5
|
//# sourceMappingURL=dictionary.d.ts.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const _ = {
|
|
2
|
-
TOAST_NEW_ROW_BUT_NOT_VISIBLE_TITLE: "
|
|
3
|
-
TOAST_NEW_ROW_BUT_NOT_VISIBLE_DESCRIPTION: "
|
|
2
|
+
TOAST_NEW_ROW_BUT_NOT_VISIBLE_TITLE: "refresh_data.toast_new_row_but_not_visible_title",
|
|
3
|
+
TOAST_NEW_ROW_BUT_NOT_VISIBLE_DESCRIPTION: "refresh_data.toast_new_row_but_not_visible_description"
|
|
4
4
|
};
|
|
5
5
|
export {
|
|
6
6
|
_ as USE_REFRESH_DATA_DICTIONARY
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { RowKey } from '@m4l/components';
|
|
2
1
|
/**
|
|
3
2
|
* Interface to use the useRefreshData hook
|
|
4
3
|
* @param TRow - Type of the rows
|
|
@@ -17,7 +16,4 @@ export interface UseRefreshData<TRow> {
|
|
|
17
16
|
*/
|
|
18
17
|
rowKeyGetter: (row: TRow) => number | string;
|
|
19
18
|
}
|
|
20
|
-
export interface ValidateShowRowCreate {
|
|
21
|
-
idRow: RowKey | undefined;
|
|
22
|
-
}
|
|
23
19
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../../packages/layouts/src/hooks/useRefreshData/types.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../../packages/layouts/src/hooks/useRefreshData/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,WAAW,cAAc,CAAC,IAAI;IAClC;;OAEG;IACH,eAAe,EAAE,MAAM,IAAI,CAAC;IAC5B;;OAEG;IACH,IAAI,EAAE,IAAI,EAAE,CAAC;IACb;;OAEG;IACH,YAAY,EAAE,CAAC,GAAG,EAAE,IAAI,KAAK,MAAM,GAAG,MAAM,CAAC;CAC9C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useRefreshData.d.ts","sourceRoot":"","sources":["../../../../../../packages/layouts/src/hooks/useRefreshData/useRefreshData.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAA0B,MAAM,iBAAiB,CAAC;AAIjE,OAAO,EAAE,cAAc,
|
|
1
|
+
{"version":3,"file":"useRefreshData.d.ts","sourceRoot":"","sources":["../../../../../../packages/layouts/src/hooks/useRefreshData/useRefreshData.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAA0B,MAAM,iBAAiB,CAAC;AAIjE,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAGzC;;;GAGG;AACH,eAAO,MAAM,cAAc,GAAI,IAAI,EAAG,OAAO,cAAc,CAAC,IAAI,CAAC;yBAuDvB,IAAI,GAAG,MAAM;6CA3CL,WAAW,CAAC,MAAM,CAAC;;;CAwDpE,CAAC"}
|
|
@@ -1,26 +1,29 @@
|
|
|
1
|
-
import { useState as
|
|
2
|
-
import { getDataGridRowsFromSet as
|
|
3
|
-
import { useHostTools as
|
|
4
|
-
import { useMasterDetail as
|
|
5
|
-
import { USE_REFRESH_DATA_DICTIONARY as
|
|
6
|
-
const A = (
|
|
7
|
-
const { rows:
|
|
8
|
-
|
|
1
|
+
import { useRef as O, useState as R, useEffect as u, useCallback as m } from "react";
|
|
2
|
+
import { getDataGridRowsFromSet as _ } from "@m4l/components";
|
|
3
|
+
import { useHostTools as w, useModuleDictionary as g } from "@m4l/core";
|
|
4
|
+
import { useMasterDetail as y } from "../useMasterDetail/index.js";
|
|
5
|
+
import { USE_REFRESH_DATA_DICTIONARY as T } from "./dictionary.js";
|
|
6
|
+
const A = (a) => {
|
|
7
|
+
const { rows: t, refreshPaginate: i, rowKeyGetter: o } = a, { toast: l } = w(), { getLabel: c } = g(), { onChangeMasterSelection: f } = y(), n = O(void 0), [r, d] = R(/* @__PURE__ */ new Set()), [p, S] = R(void 0), I = (e) => {
|
|
8
|
+
d(e), f(_(e, t, o));
|
|
9
9
|
};
|
|
10
|
-
return
|
|
11
|
-
|
|
12
|
-
}, [
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
10
|
+
return u(() => {
|
|
11
|
+
r.size > 0 && f(_(r, t, o));
|
|
12
|
+
}, [t]), u(() => {
|
|
13
|
+
const e = n.current;
|
|
14
|
+
if (e === void 0)
|
|
15
|
+
return;
|
|
16
|
+
n.current = void 0, !t.some((E) => o(E) === e) && e && l({
|
|
17
|
+
title: c(T.TOAST_NEW_ROW_BUT_NOT_VISIBLE_TITLE),
|
|
18
|
+
description: c(T.TOAST_NEW_ROW_BUT_NOT_VISIBLE_DESCRIPTION, e)
|
|
19
|
+
}, { type: "info" });
|
|
20
|
+
}, [t]), { refresh: m((e) => {
|
|
18
21
|
if (e !== void 0) {
|
|
19
|
-
const s = typeof e == "string" || typeof e == "number" ? e :
|
|
20
|
-
|
|
22
|
+
const s = typeof e == "string" || typeof e == "number" ? e : o(e);
|
|
23
|
+
n.current = s, S(s), d(/* @__PURE__ */ new Set([s]));
|
|
21
24
|
}
|
|
22
|
-
|
|
23
|
-
}, [
|
|
25
|
+
i();
|
|
26
|
+
}, [i, o]), onSelectedRowsChange: I, selectedRows: r, focusOnRowKey: p };
|
|
24
27
|
};
|
|
25
28
|
export {
|
|
26
29
|
A as useRefreshData
|