@wavemaker-ai/react-runtime 1.0.0-rc.324 → 1.0.0-rc.328
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/basic/anchor/index.js +3 -0
- package/components/basic/icon/index.js +36 -5
- package/components/basic/iframe/index.js +18 -8
- package/components/basic/label/index.js +4 -3
- package/components/basic/search/index.d.ts +72 -3
- package/components/basic/search/index.js +75 -21
- package/components/basic/search/props.d.ts +4 -0
- package/components/common/WmAppIcon/index.js +11 -8
- package/components/common/WmAppIcon/props.d.ts +2 -0
- package/components/container/accordion/accordion-pane/index.d.ts +1 -0
- package/components/container/accordion/accordion-pane/index.js +7 -3
- package/components/container/accordion/accordion-pane/props.d.ts +1 -0
- package/components/container/index.js +18 -5
- package/components/container/layout-grid/grid-row/index.js +1 -1
- package/components/container/panel/components/panel-header/index.js +1 -3
- package/components/container/tabs/tab-pane/index.d.ts +1 -0
- package/components/container/tabs/tab-pane/index.js +2 -2
- package/components/container/tabs/tab-pane/props.d.ts +1 -0
- package/components/container/wizard/index.js +11 -10
- package/components/container/wizard/utils.js +1 -0
- package/components/data/form/base-form/hooks/useFormSubmission.d.ts +1 -1
- package/components/data/form/base-form/hooks/useFormSubmission.js +3 -1
- package/components/data/form/base-form/index.js +11 -14
- package/components/data/form/base-form/props.d.ts +3 -0
- package/components/data/form/dynamic-fields/WmxDynamicFormField.d.ts +11 -0
- package/components/data/form/dynamic-fields/WmxDynamicFormField.js +77 -0
- package/components/data/form/dynamic-fields/index.js +12 -1
- package/components/data/form/form-controller/withFormController.js +19 -16
- package/components/data/form/form-field/base-field.js +8 -5
- package/components/data/form/form-field/index.js +15 -8
- package/components/data/form/form-field/props.d.ts +1 -0
- package/components/data/list/components/ListItemWithTemplate.js +5 -2
- package/components/data/list/hooks/useListEffects.js +1 -1
- package/components/data/list/index.js +14 -5
- package/components/data/list/utils/constants.d.ts +0 -1
- package/components/data/list/utils/constants.js +0 -2
- package/components/data/table/components/RowCells.js +20 -4
- package/components/data/table/components/TableBody.js +5 -3
- package/components/data/table/components/TableHeader.js +14 -8
- package/components/data/table/components/TablePanelHeading.js +1 -1
- package/components/data/table/hooks/useDynamicColumns.js +1 -1
- package/components/data/table/hooks/useRowExpansion.js +41 -31
- package/components/data/table/hooks/useRowHandlers.d.ts +4 -2
- package/components/data/table/hooks/useRowHandlers.js +23 -12
- package/components/data/table/hooks/useRowSelection.d.ts +1 -1
- package/components/data/table/hooks/useRowSelection.js +80 -66
- package/components/data/table/hooks/useServerSideSorting.js +0 -1
- package/components/data/table/hooks/useTableColumns.js +16 -8
- package/components/data/table/hooks/useTableData.js +0 -1
- package/components/data/table/hooks/useTableEdit.js +0 -1
- package/components/data/table/hooks/useTableState.js +14 -2
- package/components/data/table/index.js +94 -61
- package/components/data/table/live-table/index.js +0 -1
- package/components/data/table/props.d.ts +8 -0
- package/components/data/table/utils/buildSelectionColumns.js +2 -4
- package/components/data/table/utils/columnBuilder.d.ts +16 -2
- package/components/data/table/utils/columnBuilder.js +14 -9
- package/components/data/table/utils/columnWidthDistribution.js +10 -0
- package/components/data/table/utils/constants.d.ts +0 -4
- package/components/data/table/utils/constants.js +0 -7
- package/components/data/table/utils/dynamic-columns.d.ts +1 -1
- package/components/data/table/utils/dynamic-columns.js +3 -8
- package/components/data/table/utils/expansionColumn.d.ts +23 -0
- package/components/data/table/utils/expansionColumn.js +56 -0
- package/components/data/table/utils/index.d.ts +23 -3
- package/components/data/table/utils/index.js +60 -20
- package/components/data/table/utils/selectionUtils.d.ts +5 -0
- package/components/data/table/utils/selectionUtils.js +5 -0
- package/components/dialogs/dialog/index.js +3 -2
- package/components/dialogs/dialog-header/index.js +1 -1
- package/components/dialogs/index.js +14 -2
- package/components/input/chips/index.js +29 -5
- package/components/input/color-picker/index.js +4 -6
- package/components/input/default/radioset/index.js +2 -1
- package/components/input/epoch/date/index.js +1 -1
- package/components/input/select/index.js +3 -5
- package/components/input/text/index.js +2 -2
- package/components/input/textarea/index.js +42 -17
- package/components/navbar/nav/index.js +10 -5
- package/components/navigation/breadcrumb/index.js +2 -1
- package/components/navigation/popover/index.js +24 -8
- package/components/page/index.js +1 -1
- package/components/page/page-content/index.js +30 -6
- package/components/page/page-content/props.d.ts +1 -0
- package/components/page/partial-container/index.js +2 -1
- package/components/prefab/index.js +3 -2
- package/components/prefab/props.d.ts +1 -0
- package/components/wmx/WmxRenderer.d.ts +8 -0
- package/components/wmx/WmxRenderer.js +57 -0
- package/context/WidgetProvider.js +2 -1
- package/core/appstore.js +1 -1
- package/core/proxy-service.d.ts +1 -0
- package/core/proxy-service.js +53 -2
- package/core/util/index.d.ts +0 -2
- package/core/util/index.js +3 -30
- package/higherOrder/BasePage.js +36 -54
- package/higherOrder/DataNav.js +4 -1
- package/higherOrder/withBaseWrapper.js +9 -7
- package/hooks/useHttp.js +4 -2
- package/hooks/useLayoutSize.js +1 -1
- package/package-lock.json +240 -607
- package/package.json +3 -3
- package/runtime-dynamic/app-initializer.js +2 -1
- package/runtime-dynamic/components/partial-content.js +4 -1
- package/runtime-dynamic/components/wmx-placeholder.d.ts +18 -0
- package/runtime-dynamic/components/wmx-placeholder.js +48 -0
- package/runtime-dynamic/factories/dynamic-component.js +26 -3
- package/runtime-dynamic/main.js +6 -0
- package/runtime-dynamic/services/compile-render.js +75 -12
- package/runtime-dynamic/services/css-scoping.d.ts +2 -0
- package/runtime-dynamic/services/css-scoping.js +39 -20
- package/store/slices/i18nSlice.d.ts +0 -1
- package/store/slices/i18nSlice.js +0 -2
- package/utils/custom-expression/parser.js +11 -8
- package/utils/layoutsize-util.js +12 -7
- package/utils/style-utils.d.ts +6 -0
- package/utils/style-utils.js +10 -0
- package/utils/transformedDataset-utils.d.ts +3 -3
- package/utils/transformedDataset-utils.js +1 -2
- package/utils/wmx.utils.d.ts +6 -0
- package/utils/wmx.utils.js +41 -0
- package/variables/crud-variable.js +1 -1
- package/variables/live-variable.js +1 -1
- package/variables/service-variable.js +6 -3
|
@@ -56,8 +56,7 @@ import {
|
|
|
56
56
|
LIST_DEFAULTS,
|
|
57
57
|
LIST_MESSAGES,
|
|
58
58
|
LIST_ALIGN,
|
|
59
|
-
LIST_DIRECTION
|
|
60
|
-
INSETION_POSITION
|
|
59
|
+
LIST_DIRECTION
|
|
61
60
|
} from "./utils/constants";
|
|
62
61
|
import {
|
|
63
62
|
getItemsPerRowClass,
|
|
@@ -469,7 +468,16 @@ const WmList = (props) => {
|
|
|
469
468
|
}, [datasource]);
|
|
470
469
|
useLayoutSize(ListWrapperRef, props.layoutWidth, props.layoutHeight);
|
|
471
470
|
const showHorizontalScrollSentinel = showNavigation && navigation === LIST_NAVIGATION_TYPES.SCROLL && (direction === LIST_DIRECTION.HORIZONTAL || direction === "row");
|
|
472
|
-
const hostAutoLayoutPrefixes = [
|
|
471
|
+
const hostAutoLayoutPrefixes = [
|
|
472
|
+
"wm-pos-",
|
|
473
|
+
"wm-top",
|
|
474
|
+
"wm-bottom",
|
|
475
|
+
"wm-left",
|
|
476
|
+
"wm-right",
|
|
477
|
+
"wm-zi-",
|
|
478
|
+
"wm-w-",
|
|
479
|
+
"wm-h-"
|
|
480
|
+
];
|
|
473
481
|
const wrapper_autoLayout_Classes = useMemo(
|
|
474
482
|
() => filterAutoLayoutClasses(layoutClassName, hostAutoLayoutPrefixes),
|
|
475
483
|
[layoutClassName]
|
|
@@ -503,7 +511,7 @@ const WmList = (props) => {
|
|
|
503
511
|
);
|
|
504
512
|
return /* @__PURE__ */ jsxs(
|
|
505
513
|
Box,
|
|
506
|
-
__spreadProps(__spreadValues({
|
|
514
|
+
__spreadProps(__spreadValues(__spreadProps(__spreadValues({
|
|
507
515
|
className: clsx(
|
|
508
516
|
DEFAULT_CLS,
|
|
509
517
|
"wm-position-relative",
|
|
@@ -515,7 +523,8 @@ const WmList = (props) => {
|
|
|
515
523
|
"data-name": name
|
|
516
524
|
}, { name }), {
|
|
517
525
|
"data-navigation": navigation,
|
|
518
|
-
ref: ListWrapperRef
|
|
526
|
+
ref: ListWrapperRef
|
|
527
|
+
}), direction ? { direction } : {}), {
|
|
519
528
|
children: [
|
|
520
529
|
/* @__PURE__ */ jsx(
|
|
521
530
|
ListHeader,
|
|
@@ -56,12 +56,10 @@ const DEFAULT_PAGINATION_META = {
|
|
|
56
56
|
number: 0,
|
|
57
57
|
empty: true
|
|
58
58
|
};
|
|
59
|
-
const INSETION_POSITION = ["top", "bottom", "left", "right"];
|
|
60
59
|
export {
|
|
61
60
|
APP_LOCALE,
|
|
62
61
|
DEFAULT_CLS,
|
|
63
62
|
DEFAULT_PAGINATION_META,
|
|
64
|
-
INSETION_POSITION,
|
|
65
63
|
LIST_ALIGN,
|
|
66
64
|
LIST_DEFAULTS,
|
|
67
65
|
LIST_DIRECTION,
|
|
@@ -33,7 +33,7 @@ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
|
33
33
|
import { memo, Fragment as Fragment2 } from "react";
|
|
34
34
|
import { TableCell } from "@mui/material";
|
|
35
35
|
import { flexRender } from "@tanstack/react-table";
|
|
36
|
-
import { getColClass, TABLE_CSS_CLASSES } from "../utils";
|
|
36
|
+
import { getColClass, TABLE_CSS_CLASSES, getDomHiddenCellStyle } from "../utils";
|
|
37
37
|
const CustomExpressionRenderBody = memo(
|
|
38
38
|
function CustomExpressionRenderBody2({ rowData, render }) {
|
|
39
39
|
return /* @__PURE__ */ jsx(Fragment, { children: render(rowData) });
|
|
@@ -71,16 +71,32 @@ const RowCells = memo(
|
|
|
71
71
|
tabIndex: 0,
|
|
72
72
|
"data-col-id": cellIndex,
|
|
73
73
|
className: `${TABLE_CSS_CLASSES.tableCell} ${colClass || ""} ${((_e = cell.column.columnDef.meta) == null ? void 0 : _e.className) || ""}`.trim(),
|
|
74
|
-
style: __spreadProps(__spreadValues({
|
|
74
|
+
style: __spreadValues(__spreadProps(__spreadValues(__spreadValues({
|
|
75
75
|
width: cell.column.getSize(),
|
|
76
76
|
textAlign: (_f = cell.column.columnDef.meta) == null ? void 0 : _f.textAlign,
|
|
77
77
|
backgroundColor: (_g = cell.column.columnDef.meta) == null ? void 0 : _g.backgroundColor
|
|
78
78
|
}, (() => {
|
|
79
|
-
const _a2 = cell.column.columnDef.meta || {}, {
|
|
79
|
+
const _a2 = cell.column.columnDef.meta || {}, {
|
|
80
|
+
className,
|
|
81
|
+
textAlign,
|
|
82
|
+
backgroundColor,
|
|
83
|
+
_cell,
|
|
84
|
+
_actions,
|
|
85
|
+
domHidden
|
|
86
|
+
} = _a2, otherMeta = __objRest(_a2, [
|
|
87
|
+
"className",
|
|
88
|
+
"textAlign",
|
|
89
|
+
"backgroundColor",
|
|
90
|
+
"_cell",
|
|
91
|
+
"_actions",
|
|
92
|
+
"domHidden"
|
|
93
|
+
]);
|
|
80
94
|
return otherMeta;
|
|
81
|
-
})()), {
|
|
95
|
+
})()), getDomHiddenCellStyle(cell.column.columnDef.meta)), {
|
|
82
96
|
fontSize: "inherit",
|
|
83
97
|
color: "inherit"
|
|
98
|
+
}), hasCustomCellContent && {
|
|
99
|
+
textOverflow: "clip"
|
|
84
100
|
}),
|
|
85
101
|
children: customRender ? /* @__PURE__ */ jsx(CustomExpressionRenderBody, { rowData, render: customRender }) : ((_h = cell.column.columnDef.meta) == null ? void 0 : _h.renderCellContent) && !isEditingRow ? (_i = cell.column.columnDef.meta) == null ? void 0 : _i.renderCellContent(rowData, cell.column.columnDef) : flexRender(cell.column.columnDef.cell, cell.getContext())
|
|
86
102
|
},
|
|
@@ -29,7 +29,7 @@ var __objRest = (source, exclude) => {
|
|
|
29
29
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
30
30
|
import { memo, useMemo, useCallback } from "react";
|
|
31
31
|
import { TableBody, TableRow, TableCell, Box } from "@mui/material";
|
|
32
|
-
import { TABLE_CSS_CLASSES, TABLE_MESSAGES } from "../utils";
|
|
32
|
+
import { TABLE_CSS_CLASSES, TABLE_MESSAGES, getRowExpansionConfig } from "../utils";
|
|
33
33
|
import { RowExpansionButton } from "./RowExpansionButton";
|
|
34
34
|
import isEqual from "lodash-es/isEqual";
|
|
35
35
|
import { TableDataRow } from "./TableDataRow";
|
|
@@ -180,7 +180,7 @@ const TableBodyComponentBase = ({
|
|
|
180
180
|
customColumnsRevision = 0,
|
|
181
181
|
columnsVersion = 0
|
|
182
182
|
}) => {
|
|
183
|
-
const hasExpansion =
|
|
183
|
+
const hasExpansion = rowExpansionConfig ? true : false;
|
|
184
184
|
const expansionInsertIndex = useExpansionPosition(
|
|
185
185
|
hasExpansion,
|
|
186
186
|
rowExpansionConfig || null,
|
|
@@ -190,6 +190,8 @@ const TableBodyComponentBase = ({
|
|
|
190
190
|
const renderExpansionCell = useCallback(
|
|
191
191
|
(rowId, rowData) => {
|
|
192
192
|
if (!hasExpansion || !rowExpansionConfig) return null;
|
|
193
|
+
const rowConfig = getRowExpansionConfig(rowExpansionConfig, rowId, rowData);
|
|
194
|
+
if (!rowConfig) return null;
|
|
193
195
|
return /* @__PURE__ */ jsx(
|
|
194
196
|
ExpansionCell,
|
|
195
197
|
{
|
|
@@ -197,7 +199,7 @@ const TableBodyComponentBase = ({
|
|
|
197
199
|
rowData,
|
|
198
200
|
isExpanded: isRowExpanded(rowId),
|
|
199
201
|
onToggle: toggleRowExpansion,
|
|
200
|
-
config:
|
|
202
|
+
config: rowConfig
|
|
201
203
|
},
|
|
202
204
|
`expansion-${rowId}`
|
|
203
205
|
);
|
|
@@ -33,7 +33,7 @@ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
|
33
33
|
import React, { memo, useMemo } from "react";
|
|
34
34
|
import { TableHead, TableRow, TableCell, Box } from "@mui/material";
|
|
35
35
|
import { flexRender } from "@tanstack/react-table";
|
|
36
|
-
import { TABLE_CSS_CLASSES } from "../utils";
|
|
36
|
+
import { TABLE_CSS_CLASSES, getDomHiddenCellStyle } from "../utils";
|
|
37
37
|
import { TableFilterRow } from "./TableFilters";
|
|
38
38
|
import { calculateMaxDepth, generateHeaderRows, hasTableGroups } from "../utils/groupHeaderUtils";
|
|
39
39
|
const StandardHeaderCell = memo(
|
|
@@ -57,18 +57,19 @@ const StandardHeaderCell = memo(
|
|
|
57
57
|
"title",
|
|
58
58
|
"onClick"
|
|
59
59
|
]);
|
|
60
|
-
var _a2, _b2;
|
|
60
|
+
var _a2, _b2, _c;
|
|
61
61
|
const canSort = enablesort && header.column.getCanSort();
|
|
62
62
|
const isSorted = header.column.getIsSorted();
|
|
63
63
|
const metaClassName = ((_b2 = (_a2 = header.column.columnDef) == null ? void 0 : _a2.meta) == null ? void 0 : _b2.className) || "";
|
|
64
64
|
const resizableClass = header.column.getCanResize() ? " ui-resizable" : "";
|
|
65
65
|
const mergedClassName = `${TABLE_CSS_CLASSES.headerCell} ${metaClassName} ${className || ""} ${resizableClass}`.trim();
|
|
66
|
-
const
|
|
66
|
+
const headerMeta = (_c = header.column.columnDef) == null ? void 0 : _c.meta;
|
|
67
|
+
const mergedStyle = __spreadValues(__spreadValues({
|
|
67
68
|
cursor: canSort ? "pointer" : "default",
|
|
68
69
|
userSelect: "none",
|
|
69
70
|
width: header.getSize(),
|
|
70
71
|
position: "relative"
|
|
71
|
-
}, style);
|
|
72
|
+
}, getDomHiddenCellStyle(headerMeta)), style);
|
|
72
73
|
const headerTitle = header.column.columnDef.header && typeof header.column.columnDef.header !== "function" ? header.column.columnDef.header.toString() : "";
|
|
73
74
|
return /* @__PURE__ */ jsx(
|
|
74
75
|
TableCell,
|
|
@@ -172,7 +173,7 @@ const TableHeaderComponent = memo(
|
|
|
172
173
|
onHeaderclick,
|
|
173
174
|
tableName
|
|
174
175
|
}) => {
|
|
175
|
-
const hasExpansion = rowExpansionConfig
|
|
176
|
+
const hasExpansion = rowExpansionConfig ? true : false;
|
|
176
177
|
const hasGroups = useMemo(() => {
|
|
177
178
|
return tableStructure && hasTableGroups(tableStructure);
|
|
178
179
|
}, [tableStructure]);
|
|
@@ -378,12 +379,14 @@ const TableHeaderComponent = memo(
|
|
|
378
379
|
};
|
|
379
380
|
const isClickable = enablecolumnselection && !isSystemColumn || enablesort && header.column.getCanSort();
|
|
380
381
|
const headerCellResizableClass = header.column.getCanResize() ? " ui-resizable" : "";
|
|
382
|
+
const headerMeta = header.column.columnDef.meta;
|
|
383
|
+
const isMultiSelectHeader = columnId === "multiSelect";
|
|
381
384
|
cells.push(
|
|
382
385
|
/* @__PURE__ */ jsxs(
|
|
383
386
|
TableCell,
|
|
384
387
|
{
|
|
385
388
|
className: `${TABLE_CSS_CLASSES.headerCell} ${((_b = (_a = header.column.columnDef) == null ? void 0 : _a.meta) == null ? void 0 : _b.className) || ""} ${headerCellResizableClass}`.trim(),
|
|
386
|
-
style: {
|
|
389
|
+
style: __spreadValues({
|
|
387
390
|
cursor: isClickable ? "pointer" : "default",
|
|
388
391
|
userSelect: "none",
|
|
389
392
|
width: header.getSize(),
|
|
@@ -392,7 +395,7 @@ const TableHeaderComponent = memo(
|
|
|
392
395
|
color: "inherit",
|
|
393
396
|
fontWeight: "bold",
|
|
394
397
|
lineHeight: "inherit"
|
|
395
|
-
},
|
|
398
|
+
}, getDomHiddenCellStyle(headerMeta)),
|
|
396
399
|
title: header.column.columnDef.header && typeof header.column.columnDef.header !== "function" ? header.column.columnDef.header.toString() : "",
|
|
397
400
|
onClick: handleHeaderClick,
|
|
398
401
|
role: "columnheader",
|
|
@@ -400,7 +403,10 @@ const TableHeaderComponent = memo(
|
|
|
400
403
|
tabIndex: 0,
|
|
401
404
|
"data-col-field": header.column.id,
|
|
402
405
|
children: [
|
|
403
|
-
/* @__PURE__ */
|
|
406
|
+
isMultiSelectHeader && !header.isPlaceholder ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
407
|
+
flexRender(header.column.columnDef.header, header.getContext()),
|
|
408
|
+
/* @__PURE__ */ jsx("span", { className: "header-data", children: "\xA0" })
|
|
409
|
+
] }) : /* @__PURE__ */ jsx("span", { className: "header-data", children: header.isPlaceholder ? null : flexRender(header.column.columnDef.header, header.getContext()) }),
|
|
404
410
|
enablesort && !enablecolumnselection && header.column.getCanSort() && /* @__PURE__ */ jsx(
|
|
405
411
|
Box,
|
|
406
412
|
{
|
|
@@ -121,7 +121,7 @@ const TablePanelHeadingComponent = ({
|
|
|
121
121
|
}
|
|
122
122
|
}
|
|
123
123
|
},
|
|
124
|
-
[datasource, columns, sortInfo, filterInfo, exportdatasize, onBeforeExport
|
|
124
|
+
[datasource, columns, sortInfo, filterInfo, exportdatasize, onBeforeExport]
|
|
125
125
|
);
|
|
126
126
|
return /* @__PURE__ */ jsx(Box, { className: "panel-heading", children: /* @__PURE__ */ jsxs(Box, { component: "h3", className: "panel-title", children: [
|
|
127
127
|
/* @__PURE__ */ jsx(Box, { className: "pull-left", children: /* @__PURE__ */ jsx(
|
|
@@ -64,7 +64,7 @@ const useDynamicColumns = ({
|
|
|
64
64
|
dynamicColumns: columnsWithListener,
|
|
65
65
|
isDynamicTable: true
|
|
66
66
|
};
|
|
67
|
-
}, [dataset, children
|
|
67
|
+
}, [dataset, children]);
|
|
68
68
|
return { dynamicColumns, isDynamicTable };
|
|
69
69
|
};
|
|
70
70
|
var useDynamicColumns_default = useDynamicColumns;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useCallback, useEffect, useRef, useState } from "react";
|
|
2
|
-
import { cleanRowData } from "../utils";
|
|
2
|
+
import { cleanRowData, getRowExpansionConfig } from "../utils";
|
|
3
3
|
const useRowExpansion = ({
|
|
4
4
|
rowExpansionConfig,
|
|
5
5
|
internalDataset
|
|
@@ -8,36 +8,48 @@ const useRowExpansion = ({
|
|
|
8
8
|
const expandedRowsRef = useRef(expandedRows);
|
|
9
9
|
const rowDefInstancesRef = useRef({});
|
|
10
10
|
const pendingRowExpandRef = useRef(/* @__PURE__ */ new Set());
|
|
11
|
+
const indexExpandedInstances = useCallback(() => {
|
|
12
|
+
const instances = rowDefInstancesRef.current;
|
|
13
|
+
Object.keys(instances).forEach((key) => {
|
|
14
|
+
if (/^\d+$/.test(key)) delete instances[key];
|
|
15
|
+
});
|
|
16
|
+
Array.from(expandedRowsRef.current).forEach((rowId, index) => {
|
|
17
|
+
if (instances[rowId]) instances[index] = instances[rowId];
|
|
18
|
+
});
|
|
19
|
+
}, []);
|
|
11
20
|
useEffect(() => {
|
|
12
21
|
expandedRowsRef.current = expandedRows;
|
|
13
|
-
|
|
22
|
+
indexExpandedInstances();
|
|
23
|
+
}, [expandedRows, indexExpandedInstances]);
|
|
14
24
|
useEffect(() => {
|
|
15
|
-
|
|
16
|
-
Object.keys(instances).forEach((k) => delete instances[k]);
|
|
25
|
+
rowDefInstancesRef.current = {};
|
|
17
26
|
pendingRowExpandRef.current = /* @__PURE__ */ new Set();
|
|
18
27
|
}, [internalDataset]);
|
|
19
28
|
const registerRowDefInstance = useCallback(
|
|
20
29
|
(rowId, instance, rowData) => {
|
|
21
30
|
rowDefInstancesRef.current[rowId] = instance;
|
|
22
|
-
|
|
31
|
+
indexExpandedInstances();
|
|
32
|
+
if ((rowExpansionConfig == null ? void 0 : rowExpansionConfig.closeothers) || pendingRowExpandRef.current.has(rowId) && expandedRowsRef.current.has(rowId)) {
|
|
23
33
|
pendingRowExpandRef.current.delete(rowId);
|
|
24
34
|
if (rowExpansionConfig == null ? void 0 : rowExpansionConfig.onRowexpand) {
|
|
25
35
|
setTimeout(() => {
|
|
26
36
|
var _a;
|
|
27
37
|
(_a = rowExpansionConfig.onRowexpand) == null ? void 0 : _a.call(rowExpansionConfig, {}, {}, cleanRowData(rowData), instance);
|
|
28
|
-
},
|
|
38
|
+
}, 0);
|
|
29
39
|
}
|
|
30
40
|
}
|
|
31
41
|
},
|
|
32
|
-
[rowExpansionConfig]
|
|
42
|
+
[rowExpansionConfig, indexExpandedInstances]
|
|
33
43
|
);
|
|
34
44
|
const toggleRowExpansion = useCallback(
|
|
35
45
|
(rowId, rowData) => {
|
|
36
46
|
var _a, _b;
|
|
37
|
-
if (!rowExpansionConfig
|
|
47
|
+
if (!rowExpansionConfig) return;
|
|
48
|
+
const rowConfig = getRowExpansionConfig(rowExpansionConfig, rowId, rowData);
|
|
49
|
+
if (!(rowConfig == null ? void 0 : rowConfig.show)) return;
|
|
38
50
|
const isCurrentlyExpanded = expandedRowsRef.current.has(rowId);
|
|
39
51
|
if (!isCurrentlyExpanded) {
|
|
40
|
-
if (
|
|
52
|
+
if (rowConfig.onBeforerowexpand) {
|
|
41
53
|
let defaultPrevented = false;
|
|
42
54
|
const event = {
|
|
43
55
|
preventDefault: () => {
|
|
@@ -47,8 +59,8 @@ const useRowExpansion = ({
|
|
|
47
59
|
return defaultPrevented;
|
|
48
60
|
}
|
|
49
61
|
};
|
|
50
|
-
(_a =
|
|
51
|
-
|
|
62
|
+
(_a = rowConfig.onBeforerowexpand) == null ? void 0 : _a.call(
|
|
63
|
+
rowConfig,
|
|
52
64
|
event,
|
|
53
65
|
{},
|
|
54
66
|
cleanRowData(rowData),
|
|
@@ -58,33 +70,31 @@ const useRowExpansion = ({
|
|
|
58
70
|
}
|
|
59
71
|
setExpandedRows((prev) => {
|
|
60
72
|
const newExpandedRows = new Set(prev);
|
|
61
|
-
if (
|
|
73
|
+
if (rowConfig.closeothers) {
|
|
62
74
|
newExpandedRows.forEach((otherId) => {
|
|
63
75
|
pendingRowExpandRef.current.delete(otherId);
|
|
64
76
|
});
|
|
65
77
|
newExpandedRows.clear();
|
|
66
78
|
}
|
|
67
79
|
newExpandedRows.add(rowId);
|
|
68
|
-
if (
|
|
80
|
+
if (rowConfig.renderPartial) {
|
|
69
81
|
pendingRowExpandRef.current.add(rowId);
|
|
70
|
-
} else {
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
}, 0);
|
|
82
|
-
}
|
|
82
|
+
} else if (rowConfig.onRowexpand) {
|
|
83
|
+
setTimeout(() => {
|
|
84
|
+
var _a2;
|
|
85
|
+
(_a2 = rowConfig.onRowexpand) == null ? void 0 : _a2.call(
|
|
86
|
+
rowConfig,
|
|
87
|
+
{},
|
|
88
|
+
{},
|
|
89
|
+
cleanRowData(rowData),
|
|
90
|
+
rowDefInstancesRef.current[rowId] || {}
|
|
91
|
+
);
|
|
92
|
+
}, 0);
|
|
83
93
|
}
|
|
84
94
|
return newExpandedRows;
|
|
85
95
|
});
|
|
86
96
|
} else {
|
|
87
|
-
if (
|
|
97
|
+
if (rowConfig.onBeforerowcollapse) {
|
|
88
98
|
let defaultPrevented = false;
|
|
89
99
|
const event = {
|
|
90
100
|
preventDefault: () => {
|
|
@@ -94,8 +104,8 @@ const useRowExpansion = ({
|
|
|
94
104
|
return defaultPrevented;
|
|
95
105
|
}
|
|
96
106
|
};
|
|
97
|
-
(_b =
|
|
98
|
-
|
|
107
|
+
(_b = rowConfig.onBeforerowcollapse) == null ? void 0 : _b.call(
|
|
108
|
+
rowConfig,
|
|
99
109
|
event,
|
|
100
110
|
{},
|
|
101
111
|
cleanRowData(rowData),
|
|
@@ -107,10 +117,10 @@ const useRowExpansion = ({
|
|
|
107
117
|
const newExpandedRows = new Set(prev);
|
|
108
118
|
newExpandedRows.delete(rowId);
|
|
109
119
|
pendingRowExpandRef.current.delete(rowId);
|
|
110
|
-
if (
|
|
120
|
+
if (rowConfig.onRowcollapse) {
|
|
111
121
|
setTimeout(() => {
|
|
112
122
|
var _a2;
|
|
113
|
-
(_a2 =
|
|
123
|
+
(_a2 = rowConfig.onRowcollapse) == null ? void 0 : _a2.call(rowConfig, {}, {}, cleanRowData(rowData));
|
|
114
124
|
}, 0);
|
|
115
125
|
}
|
|
116
126
|
return newExpandedRows;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { UseRowHandlersProps, UseRowHandlersReturn } from "../props";
|
|
2
2
|
/**
|
|
3
|
-
* Hook to consolidate all row click handlers
|
|
3
|
+
* Hook to consolidate all row click handlers.
|
|
4
|
+
* Angular rowSelectionHandler: callOnRowClickEvent first, then toggle + onRowSelect.
|
|
5
|
+
* Checkbox/radio clicks bubble to the row (rowclick), then onChange fires rowselect.
|
|
4
6
|
*/
|
|
5
|
-
export declare const useRowHandlers: ({ editingRowId, isAddingNewRow, handleRowSelectionClick, handleTableEditRowClick, handleRowActiveClick, onRowclick, useRadioSelect, useMultiSelect, isrowselectable, listener, name, }: UseRowHandlersProps) => UseRowHandlersReturn;
|
|
7
|
+
export declare const useRowHandlers: ({ editingRowId, isAddingNewRow, handleRowSelectionClick, handleTableEditRowClick, handleRowActiveClick, onRowclick, useRadioSelect, useMultiSelect, isrowselectable, listener, viewParent, name, widgetRegistrationKey, }: UseRowHandlersProps) => UseRowHandlersReturn;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { useCallback } from "react";
|
|
2
2
|
import { cleanRowData } from "../utils";
|
|
3
|
+
import { getWidgetForCallback } from "../utils/selectionUtils";
|
|
3
4
|
const useRowHandlers = ({
|
|
4
5
|
editingRowId,
|
|
5
6
|
isAddingNewRow,
|
|
@@ -11,18 +12,29 @@ const useRowHandlers = ({
|
|
|
11
12
|
useMultiSelect = false,
|
|
12
13
|
isrowselectable = false,
|
|
13
14
|
listener,
|
|
14
|
-
|
|
15
|
+
viewParent,
|
|
16
|
+
name,
|
|
17
|
+
widgetRegistrationKey
|
|
15
18
|
}) => {
|
|
19
|
+
const widgetKey = widgetRegistrationKey != null ? widgetRegistrationKey : name;
|
|
20
|
+
const getWidgetRef = useCallback(
|
|
21
|
+
() => getWidgetForCallback(listener, viewParent, widgetKey),
|
|
22
|
+
[viewParent, widgetKey]
|
|
23
|
+
);
|
|
24
|
+
const invokeRowClick = useCallback(
|
|
25
|
+
(event, rowData) => {
|
|
26
|
+
if (!onRowclick) return;
|
|
27
|
+
const widget = getWidgetRef();
|
|
28
|
+
if (widget) {
|
|
29
|
+
widget.nativeElement = event.target;
|
|
30
|
+
}
|
|
31
|
+
onRowclick(event, widget, cleanRowData(rowData));
|
|
32
|
+
},
|
|
33
|
+
[onRowclick, getWidgetRef]
|
|
34
|
+
);
|
|
16
35
|
const handleRowClick = useCallback(
|
|
17
36
|
(event, rowData, rowId) => {
|
|
18
|
-
var _a, _b;
|
|
19
37
|
const hasSelectionMode = useRadioSelect || useMultiSelect;
|
|
20
|
-
if (onRowclick) {
|
|
21
|
-
if ((_a = listener == null ? void 0 : listener.Widgets) == null ? void 0 : _a[name]) {
|
|
22
|
-
listener.Widgets[name].nativeElement = event.target;
|
|
23
|
-
}
|
|
24
|
-
onRowclick(event, (_b = listener == null ? void 0 : listener.Widgets) == null ? void 0 : _b[name], cleanRowData(rowData));
|
|
25
|
-
}
|
|
26
38
|
let isSelectionHandled = false;
|
|
27
39
|
if (hasSelectionMode && isrowselectable) {
|
|
28
40
|
isSelectionHandled = handleRowSelectionClick(event, rowId, rowData);
|
|
@@ -35,6 +47,7 @@ const useRowHandlers = ({
|
|
|
35
47
|
return;
|
|
36
48
|
}
|
|
37
49
|
handleRowActiveClick(rowId, isSelectionHandled, isEditingOrAdding);
|
|
50
|
+
invokeRowClick(event, rowData);
|
|
38
51
|
},
|
|
39
52
|
[
|
|
40
53
|
editingRowId,
|
|
@@ -42,12 +55,10 @@ const useRowHandlers = ({
|
|
|
42
55
|
handleRowSelectionClick,
|
|
43
56
|
handleTableEditRowClick,
|
|
44
57
|
handleRowActiveClick,
|
|
45
|
-
|
|
58
|
+
invokeRowClick,
|
|
46
59
|
useRadioSelect,
|
|
47
60
|
useMultiSelect,
|
|
48
|
-
isrowselectable
|
|
49
|
-
listener,
|
|
50
|
-
name
|
|
61
|
+
isrowselectable
|
|
51
62
|
]
|
|
52
63
|
);
|
|
53
64
|
return {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { UseRowSelectionProps, UseRowSelectionReturn } from "../props";
|
|
2
|
-
export declare const useRowSelection: ({ radioselect, multiselect, gridfirstrowselect, internalDataset, cellState, name, statehandler, initialActualPageSize, getTableState: getTableCurrentState, onRowselect, onRowdeselect, listener, navigation, onSyncSelectedItems, }: UseRowSelectionProps) => UseRowSelectionReturn;
|
|
2
|
+
export declare const useRowSelection: ({ radioselect, multiselect, gridfirstrowselect, internalDataset, cellState, name, statehandler, initialActualPageSize, getTableState: getTableCurrentState, onRowselect, onRowdeselect, listener, navigation, viewParent, widgetRegistrationKey, onSyncSelectedItems, }: UseRowSelectionProps) => UseRowSelectionReturn;
|