@uxf/data-grid 11.87.0 → 11.88.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/_story-utils/data.js
CHANGED
|
@@ -226,4 +226,26 @@ exports.data = [
|
|
|
226
226
|
{ id: 2, label: "ToMany 2" },
|
|
227
227
|
],
|
|
228
228
|
},
|
|
229
|
+
{
|
|
230
|
+
id: 12,
|
|
231
|
+
text: "Awful",
|
|
232
|
+
bool: false,
|
|
233
|
+
tel: "777888999",
|
|
234
|
+
mail: null,
|
|
235
|
+
link: "https://google.com",
|
|
236
|
+
day: null,
|
|
237
|
+
dayAndTime: "2000-12-31T01:00:00.000-07:30",
|
|
238
|
+
uuid: "08ee844c-c27d-4ae3-8f04-9ff449649058",
|
|
239
|
+
chip: { id: 1, label: "Chip 1", color: "red" },
|
|
240
|
+
chips: [
|
|
241
|
+
{ id: 1, label: "Chip 1", color: "red" },
|
|
242
|
+
{ id: 2, label: "Chip 2", color: "blue" },
|
|
243
|
+
],
|
|
244
|
+
money: { amount: "123456", currency: "CZK" },
|
|
245
|
+
toOne: { id: 1, label: "ToOne 1" },
|
|
246
|
+
toMany: [
|
|
247
|
+
{ id: 1, label: "ToMany 1" },
|
|
248
|
+
{ id: 2, label: "ToMany 2" },
|
|
249
|
+
],
|
|
250
|
+
},
|
|
229
251
|
];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uxf/data-grid",
|
|
3
|
-
"version": "11.
|
|
3
|
+
"version": "11.88.0",
|
|
4
4
|
"description": "UXF DataGrid",
|
|
5
5
|
"homepage": "https://gitlab.com/uxf-npm/data-grid#readme",
|
|
6
6
|
"main": "index.js",
|
|
@@ -31,10 +31,10 @@
|
|
|
31
31
|
"typecheck": "tsc --noEmit --skipLibCheck"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@uxf/core": "11.
|
|
35
|
-
"@uxf/core-react": "11.
|
|
36
|
-
"@uxf/ui": "11.
|
|
37
|
-
"dayjs": "1.11.
|
|
34
|
+
"@uxf/core": "11.88.0",
|
|
35
|
+
"@uxf/core-react": "11.88.0",
|
|
36
|
+
"@uxf/ui": "11.88.0",
|
|
37
|
+
"dayjs": "1.11.19",
|
|
38
38
|
"deepmerge": "4.3.1",
|
|
39
39
|
"fast-glob": "3.3.3",
|
|
40
40
|
"qs": "6.14.0",
|
|
@@ -6,7 +6,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.HeaderSelectAllRowsCheckbox = HeaderSelectAllRowsCheckbox;
|
|
7
7
|
const translations_1 = require("@uxf/core-react/translations");
|
|
8
8
|
const empty_array_1 = require("@uxf/core/constants/empty-array");
|
|
9
|
-
const is_nil_1 = require("@uxf/core/utils/is-nil");
|
|
10
9
|
const is_not_empty_1 = require("@uxf/core/utils/is-not-empty");
|
|
11
10
|
const checkbox_input_1 = require("@uxf/ui/checkbox-input");
|
|
12
11
|
const react_1 = __importDefault(require("react"));
|
|
@@ -14,14 +13,22 @@ function HeaderSelectAllRowsCheckbox(props) {
|
|
|
14
13
|
var _a;
|
|
15
14
|
const t = (0, translations_1.useUxfTranslation)();
|
|
16
15
|
const selectedRows = (_a = props.state.selectedRows) !== null && _a !== void 0 ? _a : empty_array_1.EMPTY_ARRAY;
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
const
|
|
16
|
+
const selectedKeys = new Set(selectedRows.map(props.keyExtractor));
|
|
17
|
+
const isAllRowsInCurrentPageSelected = (0, is_not_empty_1.isNotEmpty)(props.data) && props.data.every((row) => selectedKeys.has(props.keyExtractor(row)));
|
|
18
|
+
const selectedRowsInCurrentPage = props.data.filter((row) => selectedKeys.has(props.keyExtractor(row)));
|
|
19
|
+
const isIndeterminate = (0, is_not_empty_1.isNotEmpty)(selectedRowsInCurrentPage) && !isAllRowsInCurrentPageSelected;
|
|
20
20
|
const selectAllRowsHandler = () => {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
if (isAllRowsInCurrentPageSelected || isIndeterminate) {
|
|
22
|
+
// Deselect current page rows
|
|
23
|
+
const currentPageKeys = new Set(props.data.map(props.keyExtractor));
|
|
24
|
+
props.actions.setSelectedRows(selectedRows.filter((row) => !currentPageKeys.has(props.keyExtractor(row))));
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
// Select current page rows (excluding disabled)
|
|
28
|
+
const selectableRows = props.data.filter((row) => { var _a; return !((_a = props.isRowSelectDisabled) === null || _a === void 0 ? void 0 : _a.call(props, row)); });
|
|
29
|
+
props.actions.setSelectedRows([...selectedRows, ...selectableRows]);
|
|
30
|
+
}
|
|
24
31
|
};
|
|
25
32
|
return (react_1.default.createElement("div", { className: "uxf-dg-table__cell uxf-dg-table__cell--header uxf-dg-table__select-all-rows-cell" },
|
|
26
|
-
react_1.default.createElement(checkbox_input_1.CheckboxInput, { hiddenLabel: true, indeterminate: isIndeterminate, label: t("uxf-data-grid-checkboxes:select-all"), name: "select-all-rows", onChange: selectAllRowsHandler, value:
|
|
33
|
+
react_1.default.createElement(checkbox_input_1.CheckboxInput, { hiddenLabel: true, indeterminate: isIndeterminate, label: t("uxf-data-grid-checkboxes:select-all"), name: "select-all-rows", onChange: selectAllRowsHandler, value: isAllRowsInCurrentPageSelected || isIndeterminate })));
|
|
27
34
|
}
|
|
@@ -10,5 +10,5 @@ const react_1 = __importDefault(require("react"));
|
|
|
10
10
|
function SelectRowCheckbox(props) {
|
|
11
11
|
const t = (0, translations_1.useUxfTranslation)();
|
|
12
12
|
return (react_1.default.createElement("div", { className: "uxf-dg-table__cell uxf-dg-table__select-row-cell" },
|
|
13
|
-
react_1.default.createElement(checkbox_input_1.CheckboxInput, { className: "*:mt-0", hiddenLabel: true, isDisabled: props.isRowSelectDisabled, label: t("uxf-data-grid-checkboxes:select"), name: "select-row", onChange: props.onSelectRowChange, value: props.isRowSelected })));
|
|
13
|
+
react_1.default.createElement(checkbox_input_1.CheckboxInput, { className: "*:mt-0", hiddenLabel: true, isDisabled: props.isRowSelectDisabled, label: t("uxf-data-grid-checkboxes:select"), name: "select-row", onChange: props.onSelectRowChange, value: Boolean(props.isRowSelected) })));
|
|
14
14
|
}
|
package/types/core.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { Nullish } from "@uxf/core/types";
|
|
2
2
|
import { Request, Response, ResultItem } from "./api";
|
|
3
3
|
import { BaseGridType } from "./schema";
|
|
4
|
-
export type
|
|
4
|
+
export type RowKey = number | string;
|
|
5
|
+
export type KeyExtractor = (row: ResultItem) => RowKey;
|
|
5
6
|
export type CsvDownloadGetUrl = (request: Request) => string;
|
|
6
7
|
export type Loader = (gridName: string | undefined, request: Request, encodedRequest: string) => Promise<Response>;
|
|
7
8
|
export type CallbackRef = {
|