@teselagen/ui 0.10.9 → 0.10.11
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/AdvancedOptions.d.ts +2 -1
- package/DataTable/Columns.d.ts +3 -1
- package/DataTable/utils/rowClick.d.ts +2 -1
- package/index.cjs.js +106 -21
- package/index.es.js +106 -21
- package/package.json +1 -1
- package/src/AdvancedOptions.js +27 -8
- package/src/DataTable/Columns.js +19 -5
- package/src/DataTable/index.js +25 -5
- package/src/DataTable/style.css +44 -0
- package/src/DataTable/utils/rowClick.js +40 -1
- package/src/ResizableDraggableDialog/index.js +8 -1
- package/src/style.css +2 -0
- package/ui.css +46 -0
package/AdvancedOptions.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
export default function AdvancedOptions({ children, content, label, style, isOpenByDefault }: {
|
|
1
|
+
export default function AdvancedOptions({ children, content, label, style, isOpenByDefault, localStorageKey }: {
|
|
2
2
|
children: any;
|
|
3
3
|
content: any;
|
|
4
4
|
label: any;
|
|
5
5
|
style: any;
|
|
6
6
|
isOpenByDefault: any;
|
|
7
|
+
localStorageKey: any;
|
|
7
8
|
}): import("react/jsx-runtime").JSX.Element | null;
|
package/DataTable/Columns.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
export function useColumns({ addFilters, cellRenderer, columns, resetDefaultVisibility, currentParams, compact, editingCell, editingCellSelectAll, entities, expandedEntityIdMap, extraCompact, filters, formName, getCellHoverText, isCellEditable, isEntityDisabled, isLocalCall, isSimple, isSingleSelect, isSelectionARectangle, noDeselectAll, noSelect, noUserSelect, onDeselect, onMultiRowSelect, onRowClick, onRowSelect, onSingleRowSelect, order, primarySelectedCellId, reduxFormCellValidation, reduxFormSelectedEntityIdMap, refocusTable, removeSingleFilter, schema, selectedCells, setExpandedEntityIdMap, setNewParams, updateColumnVisibility, setOrder, setSelectedCells, shouldShowSubComponent, startCellEdit, SubComponent, tableRef, updateEntitiesHelper, updateValidation, withCheckboxes, withExpandAndCollapseAllButton, withFilter: _withFilter, withSort, recordIdToIsVisibleMap, setRecordIdToIsVisibleMap, withDisplayOptions }: {
|
|
1
|
+
export function useColumns({ addFilters, cellRenderer, columns, resetDefaultVisibility, currentParams, compact, hideExpandSubCompColumn, editingCell, editingCellSelectAll, entities, expandedEntityIdMap, extraCompact, filters, formName, getCellHoverText, isCellEditable, isEntityDisabled, isLocalCall, isSimple, isSingleSelect, isSelectionARectangle, noDeselectAll, noSelect, noUserSelect, onDeselect, onMultiRowSelect, onRowClick, onRowSelect, onSingleRowSelect, order, primarySelectedCellId, reduxFormCellValidation, reduxFormSelectedEntityIdMap, refocusTable, removeSingleFilter, schema, selectedCells, setExpandedEntityIdMap, setNewParams, updateColumnVisibility, setOrder, setSelectedCells, shouldShowSubComponent, startCellEdit, SubComponent, tableRef, updateEntitiesHelper, updateValidation, withCheckboxes, withExpandAndCollapseAllButton, withFilter: _withFilter, withSort, recordIdToIsVisibleMap, setRecordIdToIsVisibleMap, withDisplayOptions, getCheckboxGroupId }: {
|
|
2
2
|
addFilters: any;
|
|
3
3
|
cellRenderer: any;
|
|
4
4
|
columns: any;
|
|
5
5
|
resetDefaultVisibility: any;
|
|
6
6
|
currentParams: any;
|
|
7
7
|
compact: any;
|
|
8
|
+
hideExpandSubCompColumn: any;
|
|
8
9
|
editingCell: any;
|
|
9
10
|
editingCellSelectAll: any;
|
|
10
11
|
entities: any;
|
|
@@ -53,4 +54,5 @@ export function useColumns({ addFilters, cellRenderer, columns, resetDefaultVisi
|
|
|
53
54
|
recordIdToIsVisibleMap: any;
|
|
54
55
|
setRecordIdToIsVisibleMap: any;
|
|
55
56
|
withDisplayOptions: any;
|
|
57
|
+
getCheckboxGroupId: any;
|
|
56
58
|
}): any;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export default function rowClick(e: any, rowInfo: any, entities: any, { reduxFormSelectedEntityIdMap, isSingleSelect, noSelect, onRowClick, isEntityDisabled, withCheckboxes, onDeselect, onSingleRowSelect, onMultiRowSelect, noDeselectAll, onRowSelect, change }: {
|
|
1
|
+
export default function rowClick(e: any, rowInfo: any, entities: any, { reduxFormSelectedEntityIdMap, isSingleSelect, noSelect, onRowClick, isEntityDisabled, withCheckboxes, onDeselect, onSingleRowSelect, onMultiRowSelect, noDeselectAll, onRowSelect, change, getCheckboxGroupId }: {
|
|
2
2
|
reduxFormSelectedEntityIdMap: any;
|
|
3
3
|
isSingleSelect: any;
|
|
4
4
|
noSelect: any;
|
|
@@ -11,6 +11,7 @@ export default function rowClick(e: any, rowInfo: any, entities: any, { reduxFor
|
|
|
11
11
|
noDeselectAll: any;
|
|
12
12
|
onRowSelect: any;
|
|
13
13
|
change: any;
|
|
14
|
+
getCheckboxGroupId: any;
|
|
14
15
|
}): void;
|
|
15
16
|
export function changeSelectedEntities({ idMap, entities, change }: {
|
|
16
17
|
idMap: any;
|
package/index.cjs.js
CHANGED
|
@@ -17158,7 +17158,8 @@ function rowClick(e, rowInfo, entities, {
|
|
|
17158
17158
|
onMultiRowSelect,
|
|
17159
17159
|
noDeselectAll,
|
|
17160
17160
|
onRowSelect,
|
|
17161
|
-
change
|
|
17161
|
+
change,
|
|
17162
|
+
getCheckboxGroupId
|
|
17162
17163
|
}) {
|
|
17163
17164
|
const entity = rowInfo.original;
|
|
17164
17165
|
onRowClick(e, entity, rowInfo);
|
|
@@ -17230,6 +17231,38 @@ function rowClick(e, rowInfo, entities, {
|
|
|
17230
17231
|
}
|
|
17231
17232
|
}
|
|
17232
17233
|
}
|
|
17234
|
+
if (getCheckboxGroupId) {
|
|
17235
|
+
const clickedRowId = rowId;
|
|
17236
|
+
const clickedEntity = entity;
|
|
17237
|
+
const clickedGroupId = getCheckboxGroupId(clickedEntity, rowInfo.index);
|
|
17238
|
+
if (!newIdMap[clickedRowId] && clickedGroupId) {
|
|
17239
|
+
entities.forEach((e2, i2) => {
|
|
17240
|
+
if (getCheckboxGroupId(e2, i2) === clickedGroupId) {
|
|
17241
|
+
const id = getIdOrCodeOrIndex(e2, i2);
|
|
17242
|
+
delete newIdMap[id];
|
|
17243
|
+
}
|
|
17244
|
+
});
|
|
17245
|
+
}
|
|
17246
|
+
const selectedGroupIds = /* @__PURE__ */ new Set();
|
|
17247
|
+
entities.forEach((e2, i2) => {
|
|
17248
|
+
const id = getIdOrCodeOrIndex(e2, i2);
|
|
17249
|
+
if (newIdMap[id]) {
|
|
17250
|
+
const gid = getCheckboxGroupId(e2, i2);
|
|
17251
|
+
if (gid) selectedGroupIds.add(gid);
|
|
17252
|
+
}
|
|
17253
|
+
});
|
|
17254
|
+
if (selectedGroupIds.size > 0) {
|
|
17255
|
+
entities.forEach((e2, i2) => {
|
|
17256
|
+
const gid = getCheckboxGroupId(e2, i2);
|
|
17257
|
+
if (gid && selectedGroupIds.has(gid)) {
|
|
17258
|
+
const id = getIdOrCodeOrIndex(e2, i2);
|
|
17259
|
+
if (!newIdMap[id]) {
|
|
17260
|
+
newIdMap[id] = { entity: e2, time: Date.now() };
|
|
17261
|
+
}
|
|
17262
|
+
}
|
|
17263
|
+
});
|
|
17264
|
+
}
|
|
17265
|
+
}
|
|
17233
17266
|
finalizeSelection({
|
|
17234
17267
|
idMap: newIdMap,
|
|
17235
17268
|
entities,
|
|
@@ -52189,6 +52222,7 @@ const useColumns = /* @__PURE__ */ __name(({
|
|
|
52189
52222
|
resetDefaultVisibility,
|
|
52190
52223
|
currentParams,
|
|
52191
52224
|
compact,
|
|
52225
|
+
hideExpandSubCompColumn,
|
|
52192
52226
|
editingCell,
|
|
52193
52227
|
editingCellSelectAll,
|
|
52194
52228
|
entities,
|
|
@@ -52236,7 +52270,8 @@ const useColumns = /* @__PURE__ */ __name(({
|
|
|
52236
52270
|
withSort = true,
|
|
52237
52271
|
recordIdToIsVisibleMap,
|
|
52238
52272
|
setRecordIdToIsVisibleMap,
|
|
52239
|
-
withDisplayOptions
|
|
52273
|
+
withDisplayOptions,
|
|
52274
|
+
getCheckboxGroupId
|
|
52240
52275
|
}) => {
|
|
52241
52276
|
const dispatch = reactRedux.useDispatch();
|
|
52242
52277
|
const change = React.useCallback(
|
|
@@ -52484,6 +52519,14 @@ const useColumns = /* @__PURE__ */ __name(({
|
|
|
52484
52519
|
return /* @__PURE__ */ React.createElement("div", null);
|
|
52485
52520
|
}
|
|
52486
52521
|
const entity = entities[rowIndex];
|
|
52522
|
+
if (getCheckboxGroupId) {
|
|
52523
|
+
const currentGroupId = getCheckboxGroupId(entity, rowIndex);
|
|
52524
|
+
const previousEntity = entities[rowIndex - 1];
|
|
52525
|
+
const previousGroupId = previousEntity ? getCheckboxGroupId(previousEntity, rowIndex - 1) : void 0;
|
|
52526
|
+
if (currentGroupId && currentGroupId === previousGroupId) {
|
|
52527
|
+
return /* @__PURE__ */ React.createElement("div", null);
|
|
52528
|
+
}
|
|
52529
|
+
}
|
|
52487
52530
|
return /* @__PURE__ */ React.createElement(
|
|
52488
52531
|
core.Checkbox,
|
|
52489
52532
|
{
|
|
@@ -52502,7 +52545,8 @@ const useColumns = /* @__PURE__ */ __name(({
|
|
|
52502
52545
|
onMultiRowSelect,
|
|
52503
52546
|
noDeselectAll,
|
|
52504
52547
|
onRowSelect,
|
|
52505
|
-
change
|
|
52548
|
+
change,
|
|
52549
|
+
getCheckboxGroupId
|
|
52506
52550
|
});
|
|
52507
52551
|
}, "onClick"),
|
|
52508
52552
|
checked: isSelected
|
|
@@ -52523,7 +52567,8 @@ const useColumns = /* @__PURE__ */ __name(({
|
|
|
52523
52567
|
onRowSelect,
|
|
52524
52568
|
onSingleRowSelect,
|
|
52525
52569
|
reduxFormSelectedEntityIdMap,
|
|
52526
|
-
withCheckboxes
|
|
52570
|
+
withCheckboxes,
|
|
52571
|
+
getCheckboxGroupId
|
|
52527
52572
|
]
|
|
52528
52573
|
);
|
|
52529
52574
|
const finishCellEdit = React.useCallback(
|
|
@@ -52598,13 +52643,14 @@ const useColumns = /* @__PURE__ */ __name(({
|
|
|
52598
52643
|
);
|
|
52599
52644
|
}, "Header")
|
|
52600
52645
|
}), {
|
|
52646
|
+
show: !hideExpandSubCompColumn,
|
|
52601
52647
|
expander: true,
|
|
52602
52648
|
Expander: /* @__PURE__ */ __name(({ isExpanded, original: record }) => {
|
|
52603
52649
|
let shouldShow = true;
|
|
52604
52650
|
if (shouldShowSubComponent) {
|
|
52605
52651
|
shouldShow = shouldShowSubComponent(record);
|
|
52606
52652
|
}
|
|
52607
|
-
if (!shouldShow) return null;
|
|
52653
|
+
if (!shouldShow || hideExpandSubCompColumn) return null;
|
|
52608
52654
|
return /* @__PURE__ */ React.createElement(
|
|
52609
52655
|
core.Button,
|
|
52610
52656
|
{
|
|
@@ -56955,7 +57001,8 @@ const DataTable = /* @__PURE__ */ __name((_M) => {
|
|
|
56955
57001
|
entities: normalizedEntities
|
|
56956
57002
|
});
|
|
56957
57003
|
}
|
|
56958
|
-
const
|
|
57004
|
+
const __schema = useDeepEqualMemo(_schema);
|
|
57005
|
+
const convertedSchema = React.useMemo(() => convertSchema(__schema), [__schema]);
|
|
56959
57006
|
if (isLocalCall) {
|
|
56960
57007
|
if (!noForm && (!formName || formName === "tgDataTable")) {
|
|
56961
57008
|
throw new Error(
|
|
@@ -57145,6 +57192,7 @@ const DataTable = /* @__PURE__ */ __name((_M) => {
|
|
|
57145
57192
|
minimalStyle,
|
|
57146
57193
|
mustClickCheckboxToSelect,
|
|
57147
57194
|
noDeselectAll,
|
|
57195
|
+
hideExpandSubCompColumn,
|
|
57148
57196
|
noFooter = isSimple ? !withPaging : false,
|
|
57149
57197
|
noFullscreenButton = isSimple,
|
|
57150
57198
|
noHeader = false,
|
|
@@ -57192,7 +57240,8 @@ const DataTable = /* @__PURE__ */ __name((_M) => {
|
|
|
57192
57240
|
withSort,
|
|
57193
57241
|
withTitle = !isSimple,
|
|
57194
57242
|
noExcessiveCheck,
|
|
57195
|
-
isEntityCountLoading
|
|
57243
|
+
isEntityCountLoading,
|
|
57244
|
+
getCheckboxGroupId
|
|
57196
57245
|
} = props;
|
|
57197
57246
|
const _entities = React.useMemo(
|
|
57198
57247
|
() => ((reduxFormEntities == null ? void 0 : reduxFormEntities.length) ? reduxFormEntities : _origEntities) || [],
|
|
@@ -58729,6 +58778,15 @@ const DataTable = /* @__PURE__ */ __name((_M) => {
|
|
|
58729
58778
|
const isExpanded = expandedEntityIdMap[rowId];
|
|
58730
58779
|
const rowDisabled = isEntityDisabled(entity);
|
|
58731
58780
|
const dataId = entity.id || entity.code;
|
|
58781
|
+
let noGroupBorder = false;
|
|
58782
|
+
if (getCheckboxGroupId) {
|
|
58783
|
+
const currentGroupId = getCheckboxGroupId(entity, rowInfo.index);
|
|
58784
|
+
const nextEntity = entities[rowInfo.index + 1];
|
|
58785
|
+
const nextGroupId = nextEntity ? getCheckboxGroupId(nextEntity, rowInfo.index + 1) : void 0;
|
|
58786
|
+
if (currentGroupId && currentGroupId === nextGroupId) {
|
|
58787
|
+
noGroupBorder = true;
|
|
58788
|
+
}
|
|
58789
|
+
}
|
|
58732
58790
|
return {
|
|
58733
58791
|
onClick: /* @__PURE__ */ __name((e) => {
|
|
58734
58792
|
if (isCellEditable) return;
|
|
@@ -58755,7 +58813,8 @@ const DataTable = /* @__PURE__ */ __name((_M) => {
|
|
|
58755
58813
|
onMultiRowSelect,
|
|
58756
58814
|
noDeselectAll,
|
|
58757
58815
|
onRowSelect,
|
|
58758
|
-
change
|
|
58816
|
+
change,
|
|
58817
|
+
getCheckboxGroupId
|
|
58759
58818
|
});
|
|
58760
58819
|
}, "onClick"),
|
|
58761
58820
|
//row right click
|
|
@@ -58797,9 +58856,11 @@ const DataTable = /* @__PURE__ */ __name((_M) => {
|
|
|
58797
58856
|
{
|
|
58798
58857
|
disabled: rowDisabled,
|
|
58799
58858
|
selected: rowSelected && !withCheckboxes,
|
|
58800
|
-
"rt-tr-last-row": rowInfo.index === entities.length - 1
|
|
58859
|
+
"rt-tr-last-row": rowInfo.index === entities.length - 1,
|
|
58860
|
+
"no-group-border": noGroupBorder
|
|
58801
58861
|
}
|
|
58802
58862
|
),
|
|
58863
|
+
"data-test-selected": !!rowSelected,
|
|
58803
58864
|
"data-test-id": dataId === void 0 ? rowInfo.index : dataId,
|
|
58804
58865
|
"data-index": rowInfo.index,
|
|
58805
58866
|
"data-tip": typeof rowDisabled === "string" ? rowDisabled : void 0,
|
|
@@ -58830,7 +58891,8 @@ const DataTable = /* @__PURE__ */ __name((_M) => {
|
|
|
58830
58891
|
reduxFormSelectedEntityIdMap,
|
|
58831
58892
|
selectedCells,
|
|
58832
58893
|
showContextMenu2,
|
|
58833
|
-
withCheckboxes
|
|
58894
|
+
withCheckboxes,
|
|
58895
|
+
getCheckboxGroupId
|
|
58834
58896
|
]
|
|
58835
58897
|
);
|
|
58836
58898
|
const getTableCellProps = React.useCallback(
|
|
@@ -59143,6 +59205,7 @@ const DataTable = /* @__PURE__ */ __name((_M) => {
|
|
|
59143
59205
|
isSingleSelect,
|
|
59144
59206
|
isSelectionARectangle,
|
|
59145
59207
|
noDeselectAll,
|
|
59208
|
+
hideExpandSubCompColumn,
|
|
59146
59209
|
noSelect,
|
|
59147
59210
|
noUserSelect,
|
|
59148
59211
|
onDeselect,
|
|
@@ -59174,6 +59237,7 @@ const DataTable = /* @__PURE__ */ __name((_M) => {
|
|
|
59174
59237
|
withFilter,
|
|
59175
59238
|
withSort,
|
|
59176
59239
|
recordIdToIsVisibleMap,
|
|
59240
|
+
getCheckboxGroupId,
|
|
59177
59241
|
setRecordIdToIsVisibleMap
|
|
59178
59242
|
});
|
|
59179
59243
|
const scrollToTop = React.useCallback(
|
|
@@ -67313,9 +67377,19 @@ function AdvancedOptions({
|
|
|
67313
67377
|
content: content2,
|
|
67314
67378
|
label,
|
|
67315
67379
|
style,
|
|
67316
|
-
isOpenByDefault
|
|
67380
|
+
isOpenByDefault,
|
|
67381
|
+
localStorageKey
|
|
67317
67382
|
}) {
|
|
67318
|
-
const [isOpen, setOpen] = React.useState(
|
|
67383
|
+
const [isOpen, setOpen] = React.useState(() => {
|
|
67384
|
+
if (localStorageKey) {
|
|
67385
|
+
if (window.localStorage.getItem(localStorageKey) === "true") {
|
|
67386
|
+
return true;
|
|
67387
|
+
} else if (window.localStorage.getItem(localStorageKey) === "false") {
|
|
67388
|
+
return false;
|
|
67389
|
+
}
|
|
67390
|
+
}
|
|
67391
|
+
return isOpenByDefault;
|
|
67392
|
+
});
|
|
67319
67393
|
if (!(content2 || children)) {
|
|
67320
67394
|
return null;
|
|
67321
67395
|
}
|
|
@@ -67323,20 +67397,28 @@ function AdvancedOptions({
|
|
|
67323
67397
|
"div",
|
|
67324
67398
|
{
|
|
67325
67399
|
onClick: /* @__PURE__ */ __name(() => {
|
|
67326
|
-
|
|
67400
|
+
const newIsOpen = !isOpen;
|
|
67401
|
+
setOpen(newIsOpen);
|
|
67402
|
+
if (localStorageKey) {
|
|
67403
|
+
window.localStorage.setItem(localStorageKey, newIsOpen);
|
|
67404
|
+
}
|
|
67327
67405
|
}, "onClick"),
|
|
67328
|
-
style: {
|
|
67329
|
-
|
|
67406
|
+
style: {
|
|
67407
|
+
cursor: "pointer",
|
|
67408
|
+
display: "flex",
|
|
67409
|
+
alignItems: "center",
|
|
67410
|
+
userSelect: "none"
|
|
67411
|
+
},
|
|
67412
|
+
className: `tg-toggle-advanced-options`
|
|
67330
67413
|
},
|
|
67331
|
-
label || "Advanced",
|
|
67332
|
-
" ",
|
|
67333
67414
|
/* @__PURE__ */ React.createElement(
|
|
67334
67415
|
core.Icon,
|
|
67335
67416
|
{
|
|
67336
67417
|
icon: isOpen ? "caret-down" : "caret-right",
|
|
67337
|
-
style: {
|
|
67418
|
+
style: { marginRight: 5 }
|
|
67338
67419
|
}
|
|
67339
|
-
)
|
|
67420
|
+
),
|
|
67421
|
+
/* @__PURE__ */ React.createElement("strong", null, label || "Advanced")
|
|
67340
67422
|
), isOpen && /* @__PURE__ */ React.createElement("div", { style: { marginTop: 10 } }, content2 || children));
|
|
67341
67423
|
}
|
|
67342
67424
|
__name(AdvancedOptions, "AdvancedOptions");
|
|
@@ -70971,6 +71053,7 @@ const _ResizableDraggableDialog = class _ResizableDraggableDialog extends React.
|
|
|
70971
71053
|
topLeft: true,
|
|
70972
71054
|
topRight: true
|
|
70973
71055
|
},
|
|
71056
|
+
resizeHandleWrapperClass: "tg-dialog-resize-handle",
|
|
70974
71057
|
maxHeight: windowHeight,
|
|
70975
71058
|
maxWidth: windowWidth,
|
|
70976
71059
|
bounds: "window",
|
|
@@ -70989,12 +71072,14 @@ const _ResizableDraggableDialog = class _ResizableDraggableDialog extends React.
|
|
|
70989
71072
|
}, RndProps),
|
|
70990
71073
|
/* @__PURE__ */ React.createElement(
|
|
70991
71074
|
core.Dialog,
|
|
70992
|
-
__spreadValues({
|
|
71075
|
+
__spreadProps(__spreadValues({
|
|
70993
71076
|
enforceFocus: false,
|
|
70994
71077
|
hasBackdrop: false,
|
|
70995
71078
|
usePortal: false,
|
|
70996
71079
|
canEscapeKeyClose: true
|
|
70997
|
-
}, rest)
|
|
71080
|
+
}, rest), {
|
|
71081
|
+
title: /* @__PURE__ */ React.createElement("div", { style: { display: "flex", alignItems: "center", gap: 8 } }, /* @__PURE__ */ React.createElement(core.Icon, { size: "14", "data-tip": "I'm a resizable draggable dialog!", icon: "move" }), rest.title)
|
|
71082
|
+
})
|
|
70998
71083
|
)
|
|
70999
71084
|
)
|
|
71000
71085
|
);
|
package/index.es.js
CHANGED
|
@@ -17140,7 +17140,8 @@ function rowClick(e, rowInfo, entities, {
|
|
|
17140
17140
|
onMultiRowSelect,
|
|
17141
17141
|
noDeselectAll,
|
|
17142
17142
|
onRowSelect,
|
|
17143
|
-
change: change2
|
|
17143
|
+
change: change2,
|
|
17144
|
+
getCheckboxGroupId
|
|
17144
17145
|
}) {
|
|
17145
17146
|
const entity = rowInfo.original;
|
|
17146
17147
|
onRowClick(e, entity, rowInfo);
|
|
@@ -17212,6 +17213,38 @@ function rowClick(e, rowInfo, entities, {
|
|
|
17212
17213
|
}
|
|
17213
17214
|
}
|
|
17214
17215
|
}
|
|
17216
|
+
if (getCheckboxGroupId) {
|
|
17217
|
+
const clickedRowId = rowId;
|
|
17218
|
+
const clickedEntity = entity;
|
|
17219
|
+
const clickedGroupId = getCheckboxGroupId(clickedEntity, rowInfo.index);
|
|
17220
|
+
if (!newIdMap[clickedRowId] && clickedGroupId) {
|
|
17221
|
+
entities.forEach((e2, i2) => {
|
|
17222
|
+
if (getCheckboxGroupId(e2, i2) === clickedGroupId) {
|
|
17223
|
+
const id = getIdOrCodeOrIndex(e2, i2);
|
|
17224
|
+
delete newIdMap[id];
|
|
17225
|
+
}
|
|
17226
|
+
});
|
|
17227
|
+
}
|
|
17228
|
+
const selectedGroupIds = /* @__PURE__ */ new Set();
|
|
17229
|
+
entities.forEach((e2, i2) => {
|
|
17230
|
+
const id = getIdOrCodeOrIndex(e2, i2);
|
|
17231
|
+
if (newIdMap[id]) {
|
|
17232
|
+
const gid = getCheckboxGroupId(e2, i2);
|
|
17233
|
+
if (gid) selectedGroupIds.add(gid);
|
|
17234
|
+
}
|
|
17235
|
+
});
|
|
17236
|
+
if (selectedGroupIds.size > 0) {
|
|
17237
|
+
entities.forEach((e2, i2) => {
|
|
17238
|
+
const gid = getCheckboxGroupId(e2, i2);
|
|
17239
|
+
if (gid && selectedGroupIds.has(gid)) {
|
|
17240
|
+
const id = getIdOrCodeOrIndex(e2, i2);
|
|
17241
|
+
if (!newIdMap[id]) {
|
|
17242
|
+
newIdMap[id] = { entity: e2, time: Date.now() };
|
|
17243
|
+
}
|
|
17244
|
+
}
|
|
17245
|
+
});
|
|
17246
|
+
}
|
|
17247
|
+
}
|
|
17215
17248
|
finalizeSelection({
|
|
17216
17249
|
idMap: newIdMap,
|
|
17217
17250
|
entities,
|
|
@@ -52171,6 +52204,7 @@ const useColumns = /* @__PURE__ */ __name(({
|
|
|
52171
52204
|
resetDefaultVisibility,
|
|
52172
52205
|
currentParams,
|
|
52173
52206
|
compact,
|
|
52207
|
+
hideExpandSubCompColumn,
|
|
52174
52208
|
editingCell,
|
|
52175
52209
|
editingCellSelectAll,
|
|
52176
52210
|
entities,
|
|
@@ -52218,7 +52252,8 @@ const useColumns = /* @__PURE__ */ __name(({
|
|
|
52218
52252
|
withSort = true,
|
|
52219
52253
|
recordIdToIsVisibleMap,
|
|
52220
52254
|
setRecordIdToIsVisibleMap,
|
|
52221
|
-
withDisplayOptions
|
|
52255
|
+
withDisplayOptions,
|
|
52256
|
+
getCheckboxGroupId
|
|
52222
52257
|
}) => {
|
|
52223
52258
|
const dispatch = useDispatch();
|
|
52224
52259
|
const change$1 = useCallback(
|
|
@@ -52466,6 +52501,14 @@ const useColumns = /* @__PURE__ */ __name(({
|
|
|
52466
52501
|
return /* @__PURE__ */ React__default.createElement("div", null);
|
|
52467
52502
|
}
|
|
52468
52503
|
const entity = entities[rowIndex];
|
|
52504
|
+
if (getCheckboxGroupId) {
|
|
52505
|
+
const currentGroupId = getCheckboxGroupId(entity, rowIndex);
|
|
52506
|
+
const previousEntity = entities[rowIndex - 1];
|
|
52507
|
+
const previousGroupId = previousEntity ? getCheckboxGroupId(previousEntity, rowIndex - 1) : void 0;
|
|
52508
|
+
if (currentGroupId && currentGroupId === previousGroupId) {
|
|
52509
|
+
return /* @__PURE__ */ React__default.createElement("div", null);
|
|
52510
|
+
}
|
|
52511
|
+
}
|
|
52469
52512
|
return /* @__PURE__ */ React__default.createElement(
|
|
52470
52513
|
Checkbox,
|
|
52471
52514
|
{
|
|
@@ -52484,7 +52527,8 @@ const useColumns = /* @__PURE__ */ __name(({
|
|
|
52484
52527
|
onMultiRowSelect,
|
|
52485
52528
|
noDeselectAll,
|
|
52486
52529
|
onRowSelect,
|
|
52487
|
-
change: change$1
|
|
52530
|
+
change: change$1,
|
|
52531
|
+
getCheckboxGroupId
|
|
52488
52532
|
});
|
|
52489
52533
|
}, "onClick"),
|
|
52490
52534
|
checked: isSelected
|
|
@@ -52505,7 +52549,8 @@ const useColumns = /* @__PURE__ */ __name(({
|
|
|
52505
52549
|
onRowSelect,
|
|
52506
52550
|
onSingleRowSelect,
|
|
52507
52551
|
reduxFormSelectedEntityIdMap,
|
|
52508
|
-
withCheckboxes
|
|
52552
|
+
withCheckboxes,
|
|
52553
|
+
getCheckboxGroupId
|
|
52509
52554
|
]
|
|
52510
52555
|
);
|
|
52511
52556
|
const finishCellEdit = useCallback(
|
|
@@ -52580,13 +52625,14 @@ const useColumns = /* @__PURE__ */ __name(({
|
|
|
52580
52625
|
);
|
|
52581
52626
|
}, "Header")
|
|
52582
52627
|
}), {
|
|
52628
|
+
show: !hideExpandSubCompColumn,
|
|
52583
52629
|
expander: true,
|
|
52584
52630
|
Expander: /* @__PURE__ */ __name(({ isExpanded, original: record }) => {
|
|
52585
52631
|
let shouldShow = true;
|
|
52586
52632
|
if (shouldShowSubComponent) {
|
|
52587
52633
|
shouldShow = shouldShowSubComponent(record);
|
|
52588
52634
|
}
|
|
52589
|
-
if (!shouldShow) return null;
|
|
52635
|
+
if (!shouldShow || hideExpandSubCompColumn) return null;
|
|
52590
52636
|
return /* @__PURE__ */ React__default.createElement(
|
|
52591
52637
|
Button,
|
|
52592
52638
|
{
|
|
@@ -56937,7 +56983,8 @@ const DataTable = /* @__PURE__ */ __name((_M) => {
|
|
|
56937
56983
|
entities: normalizedEntities
|
|
56938
56984
|
});
|
|
56939
56985
|
}
|
|
56940
|
-
const
|
|
56986
|
+
const __schema = useDeepEqualMemo(_schema);
|
|
56987
|
+
const convertedSchema = useMemo(() => convertSchema(__schema), [__schema]);
|
|
56941
56988
|
if (isLocalCall) {
|
|
56942
56989
|
if (!noForm && (!formName || formName === "tgDataTable")) {
|
|
56943
56990
|
throw new Error(
|
|
@@ -57127,6 +57174,7 @@ const DataTable = /* @__PURE__ */ __name((_M) => {
|
|
|
57127
57174
|
minimalStyle,
|
|
57128
57175
|
mustClickCheckboxToSelect,
|
|
57129
57176
|
noDeselectAll,
|
|
57177
|
+
hideExpandSubCompColumn,
|
|
57130
57178
|
noFooter = isSimple ? !withPaging : false,
|
|
57131
57179
|
noFullscreenButton = isSimple,
|
|
57132
57180
|
noHeader = false,
|
|
@@ -57174,7 +57222,8 @@ const DataTable = /* @__PURE__ */ __name((_M) => {
|
|
|
57174
57222
|
withSort,
|
|
57175
57223
|
withTitle = !isSimple,
|
|
57176
57224
|
noExcessiveCheck,
|
|
57177
|
-
isEntityCountLoading
|
|
57225
|
+
isEntityCountLoading,
|
|
57226
|
+
getCheckboxGroupId
|
|
57178
57227
|
} = props;
|
|
57179
57228
|
const _entities = useMemo(
|
|
57180
57229
|
() => ((reduxFormEntities == null ? void 0 : reduxFormEntities.length) ? reduxFormEntities : _origEntities) || [],
|
|
@@ -58711,6 +58760,15 @@ const DataTable = /* @__PURE__ */ __name((_M) => {
|
|
|
58711
58760
|
const isExpanded = expandedEntityIdMap[rowId];
|
|
58712
58761
|
const rowDisabled = isEntityDisabled(entity);
|
|
58713
58762
|
const dataId = entity.id || entity.code;
|
|
58763
|
+
let noGroupBorder = false;
|
|
58764
|
+
if (getCheckboxGroupId) {
|
|
58765
|
+
const currentGroupId = getCheckboxGroupId(entity, rowInfo.index);
|
|
58766
|
+
const nextEntity = entities[rowInfo.index + 1];
|
|
58767
|
+
const nextGroupId = nextEntity ? getCheckboxGroupId(nextEntity, rowInfo.index + 1) : void 0;
|
|
58768
|
+
if (currentGroupId && currentGroupId === nextGroupId) {
|
|
58769
|
+
noGroupBorder = true;
|
|
58770
|
+
}
|
|
58771
|
+
}
|
|
58714
58772
|
return {
|
|
58715
58773
|
onClick: /* @__PURE__ */ __name((e) => {
|
|
58716
58774
|
if (isCellEditable) return;
|
|
@@ -58737,7 +58795,8 @@ const DataTable = /* @__PURE__ */ __name((_M) => {
|
|
|
58737
58795
|
onMultiRowSelect,
|
|
58738
58796
|
noDeselectAll,
|
|
58739
58797
|
onRowSelect,
|
|
58740
|
-
change: change$1
|
|
58798
|
+
change: change$1,
|
|
58799
|
+
getCheckboxGroupId
|
|
58741
58800
|
});
|
|
58742
58801
|
}, "onClick"),
|
|
58743
58802
|
//row right click
|
|
@@ -58779,9 +58838,11 @@ const DataTable = /* @__PURE__ */ __name((_M) => {
|
|
|
58779
58838
|
{
|
|
58780
58839
|
disabled: rowDisabled,
|
|
58781
58840
|
selected: rowSelected && !withCheckboxes,
|
|
58782
|
-
"rt-tr-last-row": rowInfo.index === entities.length - 1
|
|
58841
|
+
"rt-tr-last-row": rowInfo.index === entities.length - 1,
|
|
58842
|
+
"no-group-border": noGroupBorder
|
|
58783
58843
|
}
|
|
58784
58844
|
),
|
|
58845
|
+
"data-test-selected": !!rowSelected,
|
|
58785
58846
|
"data-test-id": dataId === void 0 ? rowInfo.index : dataId,
|
|
58786
58847
|
"data-index": rowInfo.index,
|
|
58787
58848
|
"data-tip": typeof rowDisabled === "string" ? rowDisabled : void 0,
|
|
@@ -58812,7 +58873,8 @@ const DataTable = /* @__PURE__ */ __name((_M) => {
|
|
|
58812
58873
|
reduxFormSelectedEntityIdMap,
|
|
58813
58874
|
selectedCells,
|
|
58814
58875
|
showContextMenu2,
|
|
58815
|
-
withCheckboxes
|
|
58876
|
+
withCheckboxes,
|
|
58877
|
+
getCheckboxGroupId
|
|
58816
58878
|
]
|
|
58817
58879
|
);
|
|
58818
58880
|
const getTableCellProps = useCallback(
|
|
@@ -59125,6 +59187,7 @@ const DataTable = /* @__PURE__ */ __name((_M) => {
|
|
|
59125
59187
|
isSingleSelect,
|
|
59126
59188
|
isSelectionARectangle,
|
|
59127
59189
|
noDeselectAll,
|
|
59190
|
+
hideExpandSubCompColumn,
|
|
59128
59191
|
noSelect,
|
|
59129
59192
|
noUserSelect,
|
|
59130
59193
|
onDeselect,
|
|
@@ -59156,6 +59219,7 @@ const DataTable = /* @__PURE__ */ __name((_M) => {
|
|
|
59156
59219
|
withFilter,
|
|
59157
59220
|
withSort,
|
|
59158
59221
|
recordIdToIsVisibleMap,
|
|
59222
|
+
getCheckboxGroupId,
|
|
59159
59223
|
setRecordIdToIsVisibleMap
|
|
59160
59224
|
});
|
|
59161
59225
|
const scrollToTop = useCallback(
|
|
@@ -67295,9 +67359,19 @@ function AdvancedOptions({
|
|
|
67295
67359
|
content: content2,
|
|
67296
67360
|
label,
|
|
67297
67361
|
style,
|
|
67298
|
-
isOpenByDefault
|
|
67362
|
+
isOpenByDefault,
|
|
67363
|
+
localStorageKey
|
|
67299
67364
|
}) {
|
|
67300
|
-
const [isOpen, setOpen] = useState(
|
|
67365
|
+
const [isOpen, setOpen] = useState(() => {
|
|
67366
|
+
if (localStorageKey) {
|
|
67367
|
+
if (window.localStorage.getItem(localStorageKey) === "true") {
|
|
67368
|
+
return true;
|
|
67369
|
+
} else if (window.localStorage.getItem(localStorageKey) === "false") {
|
|
67370
|
+
return false;
|
|
67371
|
+
}
|
|
67372
|
+
}
|
|
67373
|
+
return isOpenByDefault;
|
|
67374
|
+
});
|
|
67301
67375
|
if (!(content2 || children)) {
|
|
67302
67376
|
return null;
|
|
67303
67377
|
}
|
|
@@ -67305,20 +67379,28 @@ function AdvancedOptions({
|
|
|
67305
67379
|
"div",
|
|
67306
67380
|
{
|
|
67307
67381
|
onClick: /* @__PURE__ */ __name(() => {
|
|
67308
|
-
|
|
67382
|
+
const newIsOpen = !isOpen;
|
|
67383
|
+
setOpen(newIsOpen);
|
|
67384
|
+
if (localStorageKey) {
|
|
67385
|
+
window.localStorage.setItem(localStorageKey, newIsOpen);
|
|
67386
|
+
}
|
|
67309
67387
|
}, "onClick"),
|
|
67310
|
-
style: {
|
|
67311
|
-
|
|
67388
|
+
style: {
|
|
67389
|
+
cursor: "pointer",
|
|
67390
|
+
display: "flex",
|
|
67391
|
+
alignItems: "center",
|
|
67392
|
+
userSelect: "none"
|
|
67393
|
+
},
|
|
67394
|
+
className: `tg-toggle-advanced-options`
|
|
67312
67395
|
},
|
|
67313
|
-
label || "Advanced",
|
|
67314
|
-
" ",
|
|
67315
67396
|
/* @__PURE__ */ React__default.createElement(
|
|
67316
67397
|
Icon,
|
|
67317
67398
|
{
|
|
67318
67399
|
icon: isOpen ? "caret-down" : "caret-right",
|
|
67319
|
-
style: {
|
|
67400
|
+
style: { marginRight: 5 }
|
|
67320
67401
|
}
|
|
67321
|
-
)
|
|
67402
|
+
),
|
|
67403
|
+
/* @__PURE__ */ React__default.createElement("strong", null, label || "Advanced")
|
|
67322
67404
|
), isOpen && /* @__PURE__ */ React__default.createElement("div", { style: { marginTop: 10 } }, content2 || children));
|
|
67323
67405
|
}
|
|
67324
67406
|
__name(AdvancedOptions, "AdvancedOptions");
|
|
@@ -70953,6 +71035,7 @@ const _ResizableDraggableDialog = class _ResizableDraggableDialog extends React_
|
|
|
70953
71035
|
topLeft: true,
|
|
70954
71036
|
topRight: true
|
|
70955
71037
|
},
|
|
71038
|
+
resizeHandleWrapperClass: "tg-dialog-resize-handle",
|
|
70956
71039
|
maxHeight: windowHeight,
|
|
70957
71040
|
maxWidth: windowWidth,
|
|
70958
71041
|
bounds: "window",
|
|
@@ -70971,12 +71054,14 @@ const _ResizableDraggableDialog = class _ResizableDraggableDialog extends React_
|
|
|
70971
71054
|
}, RndProps),
|
|
70972
71055
|
/* @__PURE__ */ React__default.createElement(
|
|
70973
71056
|
Dialog,
|
|
70974
|
-
__spreadValues({
|
|
71057
|
+
__spreadProps(__spreadValues({
|
|
70975
71058
|
enforceFocus: false,
|
|
70976
71059
|
hasBackdrop: false,
|
|
70977
71060
|
usePortal: false,
|
|
70978
71061
|
canEscapeKeyClose: true
|
|
70979
|
-
}, rest)
|
|
71062
|
+
}, rest), {
|
|
71063
|
+
title: /* @__PURE__ */ React__default.createElement("div", { style: { display: "flex", alignItems: "center", gap: 8 } }, /* @__PURE__ */ React__default.createElement(Icon, { size: "14", "data-tip": "I'm a resizable draggable dialog!", icon: "move" }), rest.title)
|
|
71064
|
+
})
|
|
70980
71065
|
)
|
|
70981
71066
|
)
|
|
70982
71067
|
);
|
package/package.json
CHANGED
package/src/AdvancedOptions.js
CHANGED
|
@@ -6,9 +6,19 @@ export default function AdvancedOptions({
|
|
|
6
6
|
content,
|
|
7
7
|
label,
|
|
8
8
|
style,
|
|
9
|
-
isOpenByDefault
|
|
9
|
+
isOpenByDefault,
|
|
10
|
+
localStorageKey
|
|
10
11
|
}) {
|
|
11
|
-
const [isOpen, setOpen] = useState(
|
|
12
|
+
const [isOpen, setOpen] = useState(() => {
|
|
13
|
+
if (localStorageKey) {
|
|
14
|
+
if (window.localStorage.getItem(localStorageKey) === "true") {
|
|
15
|
+
return true;
|
|
16
|
+
} else if (window.localStorage.getItem(localStorageKey) === "false") {
|
|
17
|
+
return false;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
return isOpenByDefault;
|
|
21
|
+
});
|
|
12
22
|
if (!(content || children)) {
|
|
13
23
|
return null;
|
|
14
24
|
}
|
|
@@ -16,16 +26,25 @@ export default function AdvancedOptions({
|
|
|
16
26
|
<div style={{ marginTop: 5, ...style }}>
|
|
17
27
|
<div
|
|
18
28
|
onClick={() => {
|
|
19
|
-
|
|
29
|
+
const newIsOpen = !isOpen;
|
|
30
|
+
setOpen(newIsOpen);
|
|
31
|
+
if (localStorageKey) {
|
|
32
|
+
window.localStorage.setItem(localStorageKey, newIsOpen);
|
|
33
|
+
}
|
|
20
34
|
}}
|
|
21
|
-
style={{
|
|
22
|
-
|
|
35
|
+
style={{
|
|
36
|
+
cursor: "pointer",
|
|
37
|
+
display: "flex",
|
|
38
|
+
alignItems: "center",
|
|
39
|
+
userSelect: "none"
|
|
40
|
+
}}
|
|
41
|
+
className={`tg-toggle-advanced-options`}
|
|
23
42
|
>
|
|
24
|
-
{label || "Advanced"}{" "}
|
|
25
43
|
<Icon
|
|
26
44
|
icon={isOpen ? "caret-down" : "caret-right"}
|
|
27
|
-
style={{
|
|
28
|
-
|
|
45
|
+
style={{ marginRight: 5 }}
|
|
46
|
+
/>
|
|
47
|
+
<strong>{label || "Advanced"}</strong>
|
|
29
48
|
</div>
|
|
30
49
|
{isOpen && <div style={{ marginTop: 10 }}>{content || children}</div>}
|
|
31
50
|
</div>
|
package/src/DataTable/Columns.js
CHANGED
|
@@ -406,6 +406,7 @@ export const useColumns = ({
|
|
|
406
406
|
resetDefaultVisibility,
|
|
407
407
|
currentParams,
|
|
408
408
|
compact,
|
|
409
|
+
hideExpandSubCompColumn,
|
|
409
410
|
editingCell,
|
|
410
411
|
editingCellSelectAll,
|
|
411
412
|
entities,
|
|
@@ -453,7 +454,8 @@ export const useColumns = ({
|
|
|
453
454
|
withSort = true,
|
|
454
455
|
recordIdToIsVisibleMap,
|
|
455
456
|
setRecordIdToIsVisibleMap,
|
|
456
|
-
withDisplayOptions
|
|
457
|
+
withDisplayOptions,
|
|
458
|
+
getCheckboxGroupId
|
|
457
459
|
}) => {
|
|
458
460
|
const dispatch = useDispatch();
|
|
459
461
|
const change = useCallback(
|
|
@@ -743,6 +745,16 @@ export const useColumns = ({
|
|
|
743
745
|
return <div />;
|
|
744
746
|
}
|
|
745
747
|
const entity = entities[rowIndex];
|
|
748
|
+
if (getCheckboxGroupId) {
|
|
749
|
+
const currentGroupId = getCheckboxGroupId(entity, rowIndex);
|
|
750
|
+
const previousEntity = entities[rowIndex - 1];
|
|
751
|
+
const previousGroupId = previousEntity
|
|
752
|
+
? getCheckboxGroupId(previousEntity, rowIndex - 1)
|
|
753
|
+
: undefined;
|
|
754
|
+
if (currentGroupId && currentGroupId === previousGroupId) {
|
|
755
|
+
return <div />;
|
|
756
|
+
}
|
|
757
|
+
}
|
|
746
758
|
return (
|
|
747
759
|
<Checkbox
|
|
748
760
|
name={`${getIdOrCodeOrIndex(entity, rowIndex)}-checkbox`}
|
|
@@ -760,7 +772,8 @@ export const useColumns = ({
|
|
|
760
772
|
onMultiRowSelect,
|
|
761
773
|
noDeselectAll,
|
|
762
774
|
onRowSelect,
|
|
763
|
-
change
|
|
775
|
+
change,
|
|
776
|
+
getCheckboxGroupId
|
|
764
777
|
});
|
|
765
778
|
}}
|
|
766
779
|
checked={isSelected}
|
|
@@ -781,7 +794,8 @@ export const useColumns = ({
|
|
|
781
794
|
onRowSelect,
|
|
782
795
|
onSingleRowSelect,
|
|
783
796
|
reduxFormSelectedEntityIdMap,
|
|
784
|
-
withCheckboxes
|
|
797
|
+
withCheckboxes,
|
|
798
|
+
getCheckboxGroupId
|
|
785
799
|
]
|
|
786
800
|
);
|
|
787
801
|
|
|
@@ -866,13 +880,14 @@ export const useColumns = ({
|
|
|
866
880
|
);
|
|
867
881
|
}
|
|
868
882
|
}),
|
|
883
|
+
show: !hideExpandSubCompColumn,
|
|
869
884
|
expander: true,
|
|
870
885
|
Expander: ({ isExpanded, original: record }) => {
|
|
871
886
|
let shouldShow = true;
|
|
872
887
|
if (shouldShowSubComponent) {
|
|
873
888
|
shouldShow = shouldShowSubComponent(record);
|
|
874
889
|
}
|
|
875
|
-
if (!shouldShow) return null;
|
|
890
|
+
if (!shouldShow || hideExpandSubCompColumn) return null;
|
|
876
891
|
return (
|
|
877
892
|
<Button
|
|
878
893
|
className={classNames(
|
|
@@ -1050,6 +1065,5 @@ export const useColumns = ({
|
|
|
1050
1065
|
);
|
|
1051
1066
|
return tableColumn;
|
|
1052
1067
|
});
|
|
1053
|
-
|
|
1054
1068
|
return columnsToRender.concat(tableColumns);
|
|
1055
1069
|
};
|
package/src/DataTable/index.js
CHANGED
|
@@ -205,8 +205,9 @@ const DataTable = ({
|
|
|
205
205
|
entities: normalizedEntities
|
|
206
206
|
};
|
|
207
207
|
}
|
|
208
|
+
const __schema = useDeepEqualMemo(_schema);
|
|
208
209
|
|
|
209
|
-
const convertedSchema = useMemo(() => convertSchema(
|
|
210
|
+
const convertedSchema = useMemo(() => convertSchema(__schema), [__schema]);
|
|
210
211
|
|
|
211
212
|
if (isLocalCall) {
|
|
212
213
|
if (!noForm && (!formName || formName === "tgDataTable")) {
|
|
@@ -430,6 +431,7 @@ const DataTable = ({
|
|
|
430
431
|
minimalStyle,
|
|
431
432
|
mustClickCheckboxToSelect,
|
|
432
433
|
noDeselectAll,
|
|
434
|
+
hideExpandSubCompColumn,
|
|
433
435
|
noFooter = isSimple ? !withPaging : false,
|
|
434
436
|
noFullscreenButton = isSimple,
|
|
435
437
|
noHeader = false,
|
|
@@ -477,7 +479,8 @@ const DataTable = ({
|
|
|
477
479
|
withSort,
|
|
478
480
|
withTitle = !isSimple,
|
|
479
481
|
noExcessiveCheck,
|
|
480
|
-
isEntityCountLoading
|
|
482
|
+
isEntityCountLoading,
|
|
483
|
+
getCheckboxGroupId
|
|
481
484
|
} = props;
|
|
482
485
|
|
|
483
486
|
const _entities = useMemo(
|
|
@@ -2235,6 +2238,17 @@ const DataTable = ({
|
|
|
2235
2238
|
const isExpanded = expandedEntityIdMap[rowId];
|
|
2236
2239
|
const rowDisabled = isEntityDisabled(entity);
|
|
2237
2240
|
const dataId = entity.id || entity.code;
|
|
2241
|
+
let noGroupBorder = false;
|
|
2242
|
+
if (getCheckboxGroupId) {
|
|
2243
|
+
const currentGroupId = getCheckboxGroupId(entity, rowInfo.index);
|
|
2244
|
+
const nextEntity = entities[rowInfo.index + 1];
|
|
2245
|
+
const nextGroupId = nextEntity
|
|
2246
|
+
? getCheckboxGroupId(nextEntity, rowInfo.index + 1)
|
|
2247
|
+
: undefined;
|
|
2248
|
+
if (currentGroupId && currentGroupId === nextGroupId) {
|
|
2249
|
+
noGroupBorder = true;
|
|
2250
|
+
}
|
|
2251
|
+
}
|
|
2238
2252
|
return {
|
|
2239
2253
|
onClick: e => {
|
|
2240
2254
|
if (isCellEditable) return;
|
|
@@ -2264,7 +2278,8 @@ const DataTable = ({
|
|
|
2264
2278
|
onMultiRowSelect,
|
|
2265
2279
|
noDeselectAll,
|
|
2266
2280
|
onRowSelect,
|
|
2267
|
-
change
|
|
2281
|
+
change,
|
|
2282
|
+
getCheckboxGroupId
|
|
2268
2283
|
});
|
|
2269
2284
|
},
|
|
2270
2285
|
//row right click
|
|
@@ -2310,9 +2325,11 @@ const DataTable = ({
|
|
|
2310
2325
|
{
|
|
2311
2326
|
disabled: rowDisabled,
|
|
2312
2327
|
selected: rowSelected && !withCheckboxes,
|
|
2313
|
-
"rt-tr-last-row": rowInfo.index === entities.length - 1
|
|
2328
|
+
"rt-tr-last-row": rowInfo.index === entities.length - 1,
|
|
2329
|
+
"no-group-border": noGroupBorder
|
|
2314
2330
|
}
|
|
2315
2331
|
),
|
|
2332
|
+
"data-test-selected": !!rowSelected,
|
|
2316
2333
|
"data-test-id": dataId === undefined ? rowInfo.index : dataId,
|
|
2317
2334
|
"data-index": rowInfo.index,
|
|
2318
2335
|
"data-tip": typeof rowDisabled === "string" ? rowDisabled : undefined,
|
|
@@ -2344,7 +2361,8 @@ const DataTable = ({
|
|
|
2344
2361
|
reduxFormSelectedEntityIdMap,
|
|
2345
2362
|
selectedCells,
|
|
2346
2363
|
showContextMenu,
|
|
2347
|
-
withCheckboxes
|
|
2364
|
+
withCheckboxes,
|
|
2365
|
+
getCheckboxGroupId
|
|
2348
2366
|
]
|
|
2349
2367
|
);
|
|
2350
2368
|
|
|
@@ -2712,6 +2730,7 @@ const DataTable = ({
|
|
|
2712
2730
|
isSingleSelect,
|
|
2713
2731
|
isSelectionARectangle,
|
|
2714
2732
|
noDeselectAll,
|
|
2733
|
+
hideExpandSubCompColumn,
|
|
2715
2734
|
noSelect,
|
|
2716
2735
|
noUserSelect,
|
|
2717
2736
|
onDeselect,
|
|
@@ -2743,6 +2762,7 @@ const DataTable = ({
|
|
|
2743
2762
|
withFilter,
|
|
2744
2763
|
withSort,
|
|
2745
2764
|
recordIdToIsVisibleMap,
|
|
2765
|
+
getCheckboxGroupId,
|
|
2746
2766
|
setRecordIdToIsVisibleMap
|
|
2747
2767
|
});
|
|
2748
2768
|
|
package/src/DataTable/style.css
CHANGED
|
@@ -141,6 +141,50 @@
|
|
|
141
141
|
border: none;
|
|
142
142
|
}
|
|
143
143
|
|
|
144
|
+
.ReactTable.ReactTable .rt-tbody .rt-tr-group.no-group-border {
|
|
145
|
+
border-bottom: none;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
.react-draggable .bp3-dialog {
|
|
149
|
+
/* add little chevrons in the bottom corners of the dialog to show its draggable */
|
|
150
|
+
position: relative;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
.react-draggable .bp3-dialog::before,
|
|
154
|
+
.react-draggable .bp3-dialog::after {
|
|
155
|
+
content: "";
|
|
156
|
+
position: absolute;
|
|
157
|
+
bottom: 3px;
|
|
158
|
+
width: 10px;
|
|
159
|
+
height: 10px;
|
|
160
|
+
border-style: double;
|
|
161
|
+
border-color: var(--base3);
|
|
162
|
+
border-width: 0;
|
|
163
|
+
border-bottom-width: 6px;
|
|
164
|
+
pointer-events: none;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
.react-draggable .bp3-dialog::before {
|
|
168
|
+
left: 3px;
|
|
169
|
+
border-left-width: 6px;
|
|
170
|
+
border-bottom-left-radius: 2px;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
.react-draggable .bp3-dialog::after {
|
|
174
|
+
right: 3px;
|
|
175
|
+
border-right-width: 6px;
|
|
176
|
+
border-bottom-right-radius: 2px;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
.react-draggable .tg-dialog-resize-handle div:first-child {
|
|
180
|
+
bottom: 0px !important;
|
|
181
|
+
left: 0px !important;
|
|
182
|
+
}
|
|
183
|
+
.react-draggable .tg-dialog-resize-handle div:nth-child(2) {
|
|
184
|
+
bottom: 0px !important;
|
|
185
|
+
right: 0px !important;
|
|
186
|
+
}
|
|
187
|
+
|
|
144
188
|
.bp3-dark .ReactTable.ReactTable .rt-tbody .rt-tr-group {
|
|
145
189
|
border-bottom-color: rgba(16, 22, 26, 0.15);
|
|
146
190
|
}
|
|
@@ -19,7 +19,8 @@ export default function rowClick(
|
|
|
19
19
|
onMultiRowSelect,
|
|
20
20
|
noDeselectAll,
|
|
21
21
|
onRowSelect,
|
|
22
|
-
change
|
|
22
|
+
change,
|
|
23
|
+
getCheckboxGroupId
|
|
23
24
|
}
|
|
24
25
|
) {
|
|
25
26
|
const entity = rowInfo.original;
|
|
@@ -111,6 +112,44 @@ export default function rowClick(
|
|
|
111
112
|
}
|
|
112
113
|
}
|
|
113
114
|
|
|
115
|
+
if (getCheckboxGroupId) {
|
|
116
|
+
const clickedRowId = rowId;
|
|
117
|
+
const clickedEntity = entity;
|
|
118
|
+
const clickedGroupId = getCheckboxGroupId(clickedEntity, rowInfo.index);
|
|
119
|
+
|
|
120
|
+
// 1. Handle Deselection of the clicked group
|
|
121
|
+
if (!newIdMap[clickedRowId] && clickedGroupId) {
|
|
122
|
+
entities.forEach((e, i) => {
|
|
123
|
+
if (getCheckboxGroupId(e, i) === clickedGroupId) {
|
|
124
|
+
const id = getIdOrCodeOrIndex(e, i);
|
|
125
|
+
delete newIdMap[id];
|
|
126
|
+
}
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
// 2. Expand selection to include full groups for all selected items
|
|
131
|
+
const selectedGroupIds = new Set();
|
|
132
|
+
entities.forEach((e, i) => {
|
|
133
|
+
const id = getIdOrCodeOrIndex(e, i);
|
|
134
|
+
if (newIdMap[id]) {
|
|
135
|
+
const gid = getCheckboxGroupId(e, i);
|
|
136
|
+
if (gid) selectedGroupIds.add(gid);
|
|
137
|
+
}
|
|
138
|
+
});
|
|
139
|
+
|
|
140
|
+
if (selectedGroupIds.size > 0) {
|
|
141
|
+
entities.forEach((e, i) => {
|
|
142
|
+
const gid = getCheckboxGroupId(e, i);
|
|
143
|
+
if (gid && selectedGroupIds.has(gid)) {
|
|
144
|
+
const id = getIdOrCodeOrIndex(e, i);
|
|
145
|
+
if (!newIdMap[id]) {
|
|
146
|
+
newIdMap[id] = { entity: e, time: Date.now() };
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
|
|
114
153
|
finalizeSelection({
|
|
115
154
|
idMap: newIdMap,
|
|
116
155
|
entities,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { Dialog, Classes } from "@blueprintjs/core";
|
|
2
|
+
import { Dialog, Classes, Icon } from "@blueprintjs/core";
|
|
3
3
|
import { Rnd } from "react-rnd";
|
|
4
4
|
import { debounce } from "lodash-es";
|
|
5
5
|
import "./style.css";
|
|
@@ -109,6 +109,7 @@ export default class ResizableDraggableDialog extends React.Component {
|
|
|
109
109
|
topLeft: true,
|
|
110
110
|
topRight: true
|
|
111
111
|
}}
|
|
112
|
+
resizeHandleWrapperClass="tg-dialog-resize-handle"
|
|
112
113
|
maxHeight={windowHeight}
|
|
113
114
|
maxWidth={windowWidth}
|
|
114
115
|
bounds="window"
|
|
@@ -133,6 +134,12 @@ export default class ResizableDraggableDialog extends React.Component {
|
|
|
133
134
|
usePortal={false}
|
|
134
135
|
canEscapeKeyClose={true}
|
|
135
136
|
{...rest}
|
|
137
|
+
title={
|
|
138
|
+
<div style={{ display: "flex", alignItems: "center", gap: 8 }}>
|
|
139
|
+
<Icon size="14" data-tip="I'm a resizable draggable dialog!" icon="move"></Icon>
|
|
140
|
+
{rest.title}
|
|
141
|
+
</div>
|
|
142
|
+
}
|
|
136
143
|
/>
|
|
137
144
|
</Rnd>
|
|
138
145
|
</div>
|
package/src/style.css
CHANGED
package/ui.css
CHANGED
|
@@ -8819,12 +8819,14 @@ span.bp3-popover-target{
|
|
|
8819
8819
|
/*# sourceMappingURL=blueprint-icons.css.map */:root {
|
|
8820
8820
|
--base1: #ffffff;
|
|
8821
8821
|
--base2: #cdcdcd;
|
|
8822
|
+
--base3: #a1a3a5;
|
|
8822
8823
|
--reversed: #293742;
|
|
8823
8824
|
}
|
|
8824
8825
|
|
|
8825
8826
|
body.bp3-dark {
|
|
8826
8827
|
--base1: #393a3a;
|
|
8827
8828
|
--base2: #293742;
|
|
8829
|
+
--base3: #959697;
|
|
8828
8830
|
--reversed: #cdcdcd;
|
|
8829
8831
|
}
|
|
8830
8832
|
|
|
@@ -9611,6 +9613,50 @@ button:not(:disabled):active {
|
|
|
9611
9613
|
border: none;
|
|
9612
9614
|
}
|
|
9613
9615
|
|
|
9616
|
+
.ReactTable.ReactTable .rt-tbody .rt-tr-group.no-group-border {
|
|
9617
|
+
border-bottom: none;
|
|
9618
|
+
}
|
|
9619
|
+
|
|
9620
|
+
.react-draggable .bp3-dialog {
|
|
9621
|
+
/* add little chevrons in the bottom corners of the dialog to show its draggable */
|
|
9622
|
+
position: relative;
|
|
9623
|
+
}
|
|
9624
|
+
|
|
9625
|
+
.react-draggable .bp3-dialog::before,
|
|
9626
|
+
.react-draggable .bp3-dialog::after {
|
|
9627
|
+
content: "";
|
|
9628
|
+
position: absolute;
|
|
9629
|
+
bottom: 3px;
|
|
9630
|
+
width: 10px;
|
|
9631
|
+
height: 10px;
|
|
9632
|
+
border-style: double;
|
|
9633
|
+
border-color: var(--base3);
|
|
9634
|
+
border-width: 0;
|
|
9635
|
+
border-bottom-width: 6px;
|
|
9636
|
+
pointer-events: none;
|
|
9637
|
+
}
|
|
9638
|
+
|
|
9639
|
+
.react-draggable .bp3-dialog::before {
|
|
9640
|
+
left: 3px;
|
|
9641
|
+
border-left-width: 6px;
|
|
9642
|
+
border-bottom-left-radius: 2px;
|
|
9643
|
+
}
|
|
9644
|
+
|
|
9645
|
+
.react-draggable .bp3-dialog::after {
|
|
9646
|
+
right: 3px;
|
|
9647
|
+
border-right-width: 6px;
|
|
9648
|
+
border-bottom-right-radius: 2px;
|
|
9649
|
+
}
|
|
9650
|
+
|
|
9651
|
+
.react-draggable .tg-dialog-resize-handle div:first-child {
|
|
9652
|
+
bottom: 0px !important;
|
|
9653
|
+
left: 0px !important;
|
|
9654
|
+
}
|
|
9655
|
+
.react-draggable .tg-dialog-resize-handle div:nth-child(2) {
|
|
9656
|
+
bottom: 0px !important;
|
|
9657
|
+
right: 0px !important;
|
|
9658
|
+
}
|
|
9659
|
+
|
|
9614
9660
|
.bp3-dark .ReactTable.ReactTable .rt-tbody .rt-tr-group {
|
|
9615
9661
|
border-bottom-color: rgba(16, 22, 26, 0.15);
|
|
9616
9662
|
}
|