@oliasoft-open-source/react-ui-library 4.19.1 → 4.19.2-beta-2
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/dist/global.css +13 -10
- package/dist/index.d.ts +4 -0
- package/dist/index.js +110 -71
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/global.css
CHANGED
|
@@ -9375,14 +9375,14 @@ tbody:after {
|
|
|
9375
9375
|
justify-content: space-between;
|
|
9376
9376
|
border-top: 1px solid var(--color-border);
|
|
9377
9377
|
}
|
|
9378
|
-
.
|
|
9378
|
+
._clickableRow_kqvtd_1 {
|
|
9379
9379
|
cursor: pointer;
|
|
9380
9380
|
}
|
|
9381
|
-
.
|
|
9382
|
-
.
|
|
9381
|
+
._hoverableRow_kqvtd_4:not(._rowActive_kqvtd_4):hover,
|
|
9382
|
+
._clickableRow_kqvtd_1:not(._rowActive_kqvtd_4):hover {
|
|
9383
9383
|
background-color: var(--color-background-listitem-hover) !important;
|
|
9384
9384
|
}
|
|
9385
|
-
.
|
|
9385
|
+
._expandableRow_kqvtd_8._flush_kqvtd_8 {
|
|
9386
9386
|
padding: 0 !important;
|
|
9387
9387
|
height: auto !important;
|
|
9388
9388
|
}
|
|
@@ -9392,11 +9392,11 @@ tr[data-warning] {
|
|
|
9392
9392
|
tr[data-error] {
|
|
9393
9393
|
background-color: var(--color-background-error-muted) !important;
|
|
9394
9394
|
}
|
|
9395
|
-
.
|
|
9395
|
+
._rowActive_kqvtd_4 {
|
|
9396
9396
|
position: relative;
|
|
9397
9397
|
background-color: var(--color-background-listitem-active) !important;
|
|
9398
9398
|
}
|
|
9399
|
-
.
|
|
9399
|
+
._rowActive_kqvtd_4:after {
|
|
9400
9400
|
content: '';
|
|
9401
9401
|
position: absolute;
|
|
9402
9402
|
left: 0;
|
|
@@ -9408,12 +9408,12 @@ tr[data-error] {
|
|
|
9408
9408
|
transition: background 0.3s;
|
|
9409
9409
|
background: var(--color-background-primary);
|
|
9410
9410
|
}
|
|
9411
|
-
.
|
|
9411
|
+
._dragIconCell_kqvtd_34 {
|
|
9412
9412
|
width: var(--size);
|
|
9413
9413
|
min-width: var(--size);
|
|
9414
9414
|
position: relative;
|
|
9415
9415
|
}
|
|
9416
|
-
.
|
|
9416
|
+
._dragIcon_kqvtd_34 {
|
|
9417
9417
|
display: flex;
|
|
9418
9418
|
align-items: center;
|
|
9419
9419
|
justify-content: center;
|
|
@@ -9422,13 +9422,16 @@ tr[data-error] {
|
|
|
9422
9422
|
color: var(--color-text-faint);
|
|
9423
9423
|
cursor: grab;
|
|
9424
9424
|
}
|
|
9425
|
-
.
|
|
9425
|
+
._dragIcon_kqvtd_34:hover {
|
|
9426
9426
|
color: var(--color-text-primary-hover);
|
|
9427
9427
|
}
|
|
9428
|
-
.
|
|
9428
|
+
._dragIcon_kqvtd_34:active {
|
|
9429
9429
|
cursor: grabbing;
|
|
9430
9430
|
color: var(--color-text-primary-active);
|
|
9431
9431
|
}
|
|
9432
|
+
._dragIcon_kqvtd_34._dragIconDisabled_kqvtd_55 {
|
|
9433
|
+
cursor: not-allowed;
|
|
9434
|
+
}
|
|
9432
9435
|
._inputInTable_ie6ng_1 {
|
|
9433
9436
|
background-color: transparent;
|
|
9434
9437
|
border-radius: inherit !important;
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -51263,13 +51263,14 @@ const hasActions = (rows) => rows.reduce(
|
|
|
51263
51263
|
const hasRowActions = (rows, headers) => {
|
|
51264
51264
|
return hasActions(headers) > 0 || hasActions(rows) > 0;
|
|
51265
51265
|
};
|
|
51266
|
-
const clickableRow = "
|
|
51267
|
-
const hoverableRow = "
|
|
51268
|
-
const rowActive = "
|
|
51269
|
-
const expandableRow = "
|
|
51270
|
-
const flush = "
|
|
51271
|
-
const dragIconCell = "
|
|
51272
|
-
const dragIcon = "
|
|
51266
|
+
const clickableRow = "_clickableRow_kqvtd_1";
|
|
51267
|
+
const hoverableRow = "_hoverableRow_kqvtd_4";
|
|
51268
|
+
const rowActive = "_rowActive_kqvtd_4";
|
|
51269
|
+
const expandableRow = "_expandableRow_kqvtd_8";
|
|
51270
|
+
const flush = "_flush_kqvtd_8";
|
|
51271
|
+
const dragIconCell = "_dragIconCell_kqvtd_34";
|
|
51272
|
+
const dragIcon = "_dragIcon_kqvtd_34";
|
|
51273
|
+
const dragIconDisabled = "_dragIconDisabled_kqvtd_55";
|
|
51273
51274
|
const styles$9 = {
|
|
51274
51275
|
clickableRow,
|
|
51275
51276
|
hoverableRow,
|
|
@@ -51277,7 +51278,8 @@ const styles$9 = {
|
|
|
51277
51278
|
expandableRow,
|
|
51278
51279
|
flush,
|
|
51279
51280
|
dragIconCell,
|
|
51280
|
-
dragIcon
|
|
51281
|
+
dragIcon,
|
|
51282
|
+
dragIconDisabled
|
|
51281
51283
|
};
|
|
51282
51284
|
const ExpandedContentRow = ({
|
|
51283
51285
|
colSpan,
|
|
@@ -51974,6 +51976,7 @@ const Row = ({
|
|
|
51974
51976
|
hasRowActions: hasRowActions2,
|
|
51975
51977
|
draggableTable = false,
|
|
51976
51978
|
columnWidths,
|
|
51979
|
+
dropDisabled = false,
|
|
51977
51980
|
height: height2,
|
|
51978
51981
|
testId
|
|
51979
51982
|
//TODO: add testId
|
|
@@ -52031,8 +52034,8 @@ const Row = ({
|
|
|
52031
52034
|
animateLayoutChanges: () => false
|
|
52032
52035
|
});
|
|
52033
52036
|
const style = {
|
|
52037
|
+
transform: !dropDisabled ? CSS.Translate.toString(transform) : void 0,
|
|
52034
52038
|
height: height2,
|
|
52035
|
-
transform: CSS.Transform.toString(transform),
|
|
52036
52039
|
transition,
|
|
52037
52040
|
opacity: isDragging ? 0 : void 0
|
|
52038
52041
|
};
|
|
@@ -52040,7 +52043,18 @@ const Row = ({
|
|
|
52040
52043
|
if (row2.noDrag) {
|
|
52041
52044
|
return /* @__PURE__ */ jsx("td", { "aria-labelledby": "unique-label-id" });
|
|
52042
52045
|
}
|
|
52043
|
-
return /* @__PURE__ */ jsx("td", { className: styles$9.dragIconCell, children: /* @__PURE__ */ jsx(
|
|
52046
|
+
return /* @__PURE__ */ jsx("td", { className: styles$9.dragIconCell, children: /* @__PURE__ */ jsx(
|
|
52047
|
+
"div",
|
|
52048
|
+
{
|
|
52049
|
+
className: cx$2(
|
|
52050
|
+
styles$9.dragIcon,
|
|
52051
|
+
dropDisabled ? styles$9.dragIconDisabled : ""
|
|
52052
|
+
),
|
|
52053
|
+
...attributes,
|
|
52054
|
+
...listeners,
|
|
52055
|
+
children: /* @__PURE__ */ jsx(Icon, { icon: IconType.DRAG })
|
|
52056
|
+
}
|
|
52057
|
+
) });
|
|
52044
52058
|
};
|
|
52045
52059
|
return isHeader ? /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
52046
52060
|
/* @__PURE__ */ jsxs(
|
|
@@ -52121,28 +52135,44 @@ const TableDragWrapper = (props) => {
|
|
|
52121
52135
|
draggable,
|
|
52122
52136
|
onListReorder = () => {
|
|
52123
52137
|
},
|
|
52138
|
+
canListReorder = () => true,
|
|
52124
52139
|
rowActions,
|
|
52125
52140
|
rows = [],
|
|
52126
52141
|
tbodyRef
|
|
52127
52142
|
} = props;
|
|
52128
52143
|
const [dragIndex, setDragIndex] = useState(null);
|
|
52144
|
+
const [canDragToIndexes, setCanDragToIndexes] = useState([]);
|
|
52145
|
+
const [dropDisabled, setDropDisabled] = useState(false);
|
|
52129
52146
|
const itemIds = useMemo(
|
|
52130
52147
|
() => rows.map((_2, index2) => index2.toString()),
|
|
52131
52148
|
[rows]
|
|
52132
52149
|
);
|
|
52133
52150
|
const handleDragStart2 = (event) => {
|
|
52134
52151
|
setDragIndex(event.active.id);
|
|
52152
|
+
const enabledIndexes = rows.map((_2, index2) => index2).filter((index2) => {
|
|
52153
|
+
if (rows[index2].noDrag) return false;
|
|
52154
|
+
if (canListReorder({ from: Number(event.active.id), to: index2 }))
|
|
52155
|
+
return true;
|
|
52156
|
+
return false;
|
|
52157
|
+
});
|
|
52158
|
+
setCanDragToIndexes(enabledIndexes);
|
|
52135
52159
|
};
|
|
52136
52160
|
const handleDragEnd = (event) => {
|
|
52137
52161
|
setDragIndex(null);
|
|
52162
|
+
setDropDisabled(false);
|
|
52163
|
+
setCanDragToIndexes([]);
|
|
52138
52164
|
const { active: active2, over } = event;
|
|
52139
|
-
if (!active2 || !over) return;
|
|
52140
|
-
if (
|
|
52141
|
-
|
|
52142
|
-
|
|
52143
|
-
|
|
52144
|
-
|
|
52145
|
-
|
|
52165
|
+
if (!active2 || !over || active2.id === over.id) return;
|
|
52166
|
+
if (!canDragToIndexes.includes(Number(over.id))) return;
|
|
52167
|
+
onListReorder({
|
|
52168
|
+
from: Number(active2.id),
|
|
52169
|
+
to: Number(over.id)
|
|
52170
|
+
});
|
|
52171
|
+
};
|
|
52172
|
+
const handleDragOver = (event) => {
|
|
52173
|
+
const { active: active2, over } = event;
|
|
52174
|
+
const disabled2 = (active2 == null ? void 0 : active2.id) !== (over == null ? void 0 : over.id) && !canDragToIndexes.includes(Number(over == null ? void 0 : over.id));
|
|
52175
|
+
setDropDisabled(disabled2);
|
|
52146
52176
|
};
|
|
52147
52177
|
const getCalculatedWidths = () => {
|
|
52148
52178
|
if (!(tbodyRef == null ? void 0 : tbodyRef.current)) return [];
|
|
@@ -52150,19 +52180,22 @@ const TableDragWrapper = (props) => {
|
|
|
52150
52180
|
const activeRow = rows2[Number(dragIndex)];
|
|
52151
52181
|
const cells = activeRow == null ? void 0 : activeRow.querySelectorAll("td");
|
|
52152
52182
|
if (!cells) return [];
|
|
52153
|
-
const widths = Array.from(cells).map(
|
|
52183
|
+
const widths = Array.from(cells).map(
|
|
52184
|
+
(cell2) => `${Math.ceil(cell2.offsetWidth)}px`
|
|
52185
|
+
);
|
|
52154
52186
|
widths.shift();
|
|
52155
52187
|
return widths;
|
|
52156
52188
|
};
|
|
52157
|
-
if (!draggable) return children;
|
|
52189
|
+
if (!draggable) return children({});
|
|
52158
52190
|
return /* @__PURE__ */ jsxs(
|
|
52159
52191
|
DndContext$1,
|
|
52160
52192
|
{
|
|
52161
52193
|
collisionDetection: closestCenter,
|
|
52162
52194
|
onDragStart: handleDragStart2,
|
|
52163
52195
|
onDragEnd: handleDragEnd,
|
|
52196
|
+
onDragOver: handleDragOver,
|
|
52164
52197
|
children: [
|
|
52165
|
-
/* @__PURE__ */ jsx(SortableContext, { items: itemIds, strategy: verticalListSortingStrategy, children }),
|
|
52198
|
+
/* @__PURE__ */ jsx(SortableContext, { items: itemIds, strategy: verticalListSortingStrategy, children: children({ dropDisabled }) }),
|
|
52166
52199
|
!!dragIndex && createPortal(
|
|
52167
52200
|
/* @__PURE__ */ jsx(DragOverlay, { dropAnimation: null, children: /* @__PURE__ */ jsx("table", { className: cx$2(styles$c.table, styles$c.dragOverlay), children: /* @__PURE__ */ jsx("tbody", { children: /* @__PURE__ */ jsx(
|
|
52168
52201
|
Row,
|
|
@@ -52174,7 +52207,8 @@ const TableDragWrapper = (props) => {
|
|
|
52174
52207
|
colSpan,
|
|
52175
52208
|
hasRowActions: rowActions,
|
|
52176
52209
|
columnAlignment,
|
|
52177
|
-
draggableTable: draggable
|
|
52210
|
+
draggableTable: draggable,
|
|
52211
|
+
dropDisabled
|
|
52178
52212
|
}
|
|
52179
52213
|
) }) }) }),
|
|
52180
52214
|
document.body
|
|
@@ -52223,8 +52257,12 @@ const TableScrollWrapper = ({
|
|
|
52223
52257
|
};
|
|
52224
52258
|
const Table = (props) => {
|
|
52225
52259
|
var _a2, _b, _c, _d, _e2, _f, _g;
|
|
52226
|
-
const {
|
|
52227
|
-
|
|
52260
|
+
const {
|
|
52261
|
+
onListReorder = () => {
|
|
52262
|
+
},
|
|
52263
|
+
canListReorder = () => true,
|
|
52264
|
+
table: propTable
|
|
52265
|
+
} = props;
|
|
52228
52266
|
const {
|
|
52229
52267
|
columnWidths,
|
|
52230
52268
|
footer: footer2,
|
|
@@ -52316,64 +52354,65 @@ const Table = (props) => {
|
|
|
52316
52354
|
rowActions,
|
|
52317
52355
|
rows,
|
|
52318
52356
|
tbodyRef,
|
|
52319
|
-
|
|
52320
|
-
|
|
52321
|
-
|
|
52322
|
-
|
|
52323
|
-
|
|
52324
|
-
|
|
52325
|
-
|
|
52326
|
-
|
|
52327
|
-
|
|
52328
|
-
|
|
52329
|
-
Row,
|
|
52330
|
-
{
|
|
52331
|
-
rowIndex,
|
|
52332
|
-
isHeader: true,
|
|
52333
|
-
row: row2,
|
|
52334
|
-
columnCount,
|
|
52335
|
-
columnWidths,
|
|
52336
|
-
colSpan,
|
|
52337
|
-
hasRowActions: rowActions,
|
|
52338
|
-
columnAlignment,
|
|
52339
|
-
columnHeaderAlignments,
|
|
52340
|
-
draggableTable: draggable
|
|
52341
|
-
},
|
|
52342
|
-
`0_${rowIndex}`
|
|
52343
|
-
);
|
|
52344
|
-
}) }),
|
|
52345
|
-
/* @__PURE__ */ jsx("tbody", { ref: tbodyRef, children: virtualizer ? virtualizer.getVirtualItems().map((virtualRow2) => /* @__PURE__ */ jsx(
|
|
52346
|
-
Row,
|
|
52347
|
-
{
|
|
52348
|
-
rowIndex: virtualRow2.index,
|
|
52349
|
-
row: rows[virtualRow2.index],
|
|
52350
|
-
columnCount,
|
|
52351
|
-
columnWidths,
|
|
52352
|
-
colSpan,
|
|
52353
|
-
hasRowActions: rowActions,
|
|
52354
|
-
columnAlignment,
|
|
52355
|
-
draggableTable: draggable,
|
|
52356
|
-
height: virtualRow2.size
|
|
52357
|
-
},
|
|
52358
|
-
`1_${virtualRow2.index}`
|
|
52359
|
-
)) : rows.map((row2, index2) => /* @__PURE__ */ jsx(
|
|
52357
|
+
canListReorder,
|
|
52358
|
+
children: ({ dropDisabled }) => /* @__PURE__ */ jsx(TableScrollWrapper, { table: table2, theadRef, children: ({ virtualizer, tableStyle }) => /* @__PURE__ */ jsxs(
|
|
52359
|
+
"table",
|
|
52360
|
+
{
|
|
52361
|
+
className: cx$2(styles$c.table, striped2 ? styles$c.striped : ""),
|
|
52362
|
+
"data-testid": testId,
|
|
52363
|
+
style: tableStyle,
|
|
52364
|
+
children: [
|
|
52365
|
+
/* @__PURE__ */ jsx("thead", { ref: theadRef, children: headers.map((row2, rowIndex) => {
|
|
52366
|
+
return /* @__PURE__ */ jsx(
|
|
52360
52367
|
Row,
|
|
52361
52368
|
{
|
|
52362
|
-
rowIndex
|
|
52369
|
+
rowIndex,
|
|
52370
|
+
isHeader: true,
|
|
52363
52371
|
row: row2,
|
|
52364
52372
|
columnCount,
|
|
52365
52373
|
columnWidths,
|
|
52366
52374
|
colSpan,
|
|
52367
52375
|
hasRowActions: rowActions,
|
|
52368
52376
|
columnAlignment,
|
|
52377
|
+
columnHeaderAlignments,
|
|
52369
52378
|
draggableTable: draggable
|
|
52370
52379
|
},
|
|
52371
|
-
`
|
|
52372
|
-
)
|
|
52373
|
-
|
|
52374
|
-
|
|
52375
|
-
|
|
52376
|
-
|
|
52380
|
+
`0_${rowIndex}`
|
|
52381
|
+
);
|
|
52382
|
+
}) }),
|
|
52383
|
+
/* @__PURE__ */ jsx("tbody", { ref: tbodyRef, children: virtualizer ? virtualizer.getVirtualItems().map((virtualRow2) => /* @__PURE__ */ jsx(
|
|
52384
|
+
Row,
|
|
52385
|
+
{
|
|
52386
|
+
rowIndex: virtualRow2.index,
|
|
52387
|
+
row: rows[virtualRow2.index],
|
|
52388
|
+
columnCount,
|
|
52389
|
+
columnWidths,
|
|
52390
|
+
colSpan,
|
|
52391
|
+
hasRowActions: rowActions,
|
|
52392
|
+
columnAlignment,
|
|
52393
|
+
draggableTable: draggable,
|
|
52394
|
+
height: virtualRow2.size,
|
|
52395
|
+
dropDisabled
|
|
52396
|
+
},
|
|
52397
|
+
`1_${virtualRow2.index}`
|
|
52398
|
+
)) : rows.map((row2, index2) => /* @__PURE__ */ jsx(
|
|
52399
|
+
Row,
|
|
52400
|
+
{
|
|
52401
|
+
rowIndex: index2,
|
|
52402
|
+
row: row2,
|
|
52403
|
+
columnCount,
|
|
52404
|
+
columnWidths,
|
|
52405
|
+
colSpan,
|
|
52406
|
+
hasRowActions: rowActions,
|
|
52407
|
+
columnAlignment,
|
|
52408
|
+
draggableTable: draggable,
|
|
52409
|
+
dropDisabled
|
|
52410
|
+
},
|
|
52411
|
+
`1_${index2}`
|
|
52412
|
+
)) })
|
|
52413
|
+
]
|
|
52414
|
+
}
|
|
52415
|
+
) })
|
|
52377
52416
|
}
|
|
52378
52417
|
),
|
|
52379
52418
|
footer2 && /* @__PURE__ */ jsx(
|