@oliasoft-open-source/react-ui-library 4.19.0 → 4.19.2-beta-1
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 +109 -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 [];
|
|
@@ -52154,15 +52184,16 @@ const TableDragWrapper = (props) => {
|
|
|
52154
52184
|
widths.shift();
|
|
52155
52185
|
return widths;
|
|
52156
52186
|
};
|
|
52157
|
-
if (!draggable) return children;
|
|
52187
|
+
if (!draggable) return children({});
|
|
52158
52188
|
return /* @__PURE__ */ jsxs(
|
|
52159
52189
|
DndContext$1,
|
|
52160
52190
|
{
|
|
52161
52191
|
collisionDetection: closestCenter,
|
|
52162
52192
|
onDragStart: handleDragStart2,
|
|
52163
52193
|
onDragEnd: handleDragEnd,
|
|
52194
|
+
onDragOver: handleDragOver,
|
|
52164
52195
|
children: [
|
|
52165
|
-
/* @__PURE__ */ jsx(SortableContext, { items: itemIds, strategy: verticalListSortingStrategy, children }),
|
|
52196
|
+
/* @__PURE__ */ jsx(SortableContext, { items: itemIds, strategy: verticalListSortingStrategy, children: children({ dropDisabled }) }),
|
|
52166
52197
|
!!dragIndex && createPortal(
|
|
52167
52198
|
/* @__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
52199
|
Row,
|
|
@@ -52174,7 +52205,8 @@ const TableDragWrapper = (props) => {
|
|
|
52174
52205
|
colSpan,
|
|
52175
52206
|
hasRowActions: rowActions,
|
|
52176
52207
|
columnAlignment,
|
|
52177
|
-
draggableTable: draggable
|
|
52208
|
+
draggableTable: draggable,
|
|
52209
|
+
dropDisabled
|
|
52178
52210
|
}
|
|
52179
52211
|
) }) }) }),
|
|
52180
52212
|
document.body
|
|
@@ -52223,8 +52255,12 @@ const TableScrollWrapper = ({
|
|
|
52223
52255
|
};
|
|
52224
52256
|
const Table = (props) => {
|
|
52225
52257
|
var _a2, _b, _c, _d, _e2, _f, _g;
|
|
52226
|
-
const {
|
|
52227
|
-
|
|
52258
|
+
const {
|
|
52259
|
+
onListReorder = () => {
|
|
52260
|
+
},
|
|
52261
|
+
canListReorder = () => true,
|
|
52262
|
+
table: propTable
|
|
52263
|
+
} = props;
|
|
52228
52264
|
const {
|
|
52229
52265
|
columnWidths,
|
|
52230
52266
|
footer: footer2,
|
|
@@ -52316,64 +52352,65 @@ const Table = (props) => {
|
|
|
52316
52352
|
rowActions,
|
|
52317
52353
|
rows,
|
|
52318
52354
|
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(
|
|
52355
|
+
canListReorder,
|
|
52356
|
+
children: ({ dropDisabled }) => /* @__PURE__ */ jsx(TableScrollWrapper, { table: table2, theadRef, children: ({ virtualizer, tableStyle }) => /* @__PURE__ */ jsxs(
|
|
52357
|
+
"table",
|
|
52358
|
+
{
|
|
52359
|
+
className: cx$2(styles$c.table, striped2 ? styles$c.striped : ""),
|
|
52360
|
+
"data-testid": testId,
|
|
52361
|
+
style: tableStyle,
|
|
52362
|
+
children: [
|
|
52363
|
+
/* @__PURE__ */ jsx("thead", { ref: theadRef, children: headers.map((row2, rowIndex) => {
|
|
52364
|
+
return /* @__PURE__ */ jsx(
|
|
52360
52365
|
Row,
|
|
52361
52366
|
{
|
|
52362
|
-
rowIndex
|
|
52367
|
+
rowIndex,
|
|
52368
|
+
isHeader: true,
|
|
52363
52369
|
row: row2,
|
|
52364
52370
|
columnCount,
|
|
52365
52371
|
columnWidths,
|
|
52366
52372
|
colSpan,
|
|
52367
52373
|
hasRowActions: rowActions,
|
|
52368
52374
|
columnAlignment,
|
|
52375
|
+
columnHeaderAlignments,
|
|
52369
52376
|
draggableTable: draggable
|
|
52370
52377
|
},
|
|
52371
|
-
`
|
|
52372
|
-
)
|
|
52373
|
-
|
|
52374
|
-
|
|
52375
|
-
|
|
52376
|
-
|
|
52378
|
+
`0_${rowIndex}`
|
|
52379
|
+
);
|
|
52380
|
+
}) }),
|
|
52381
|
+
/* @__PURE__ */ jsx("tbody", { ref: tbodyRef, children: virtualizer ? virtualizer.getVirtualItems().map((virtualRow2) => /* @__PURE__ */ jsx(
|
|
52382
|
+
Row,
|
|
52383
|
+
{
|
|
52384
|
+
rowIndex: virtualRow2.index,
|
|
52385
|
+
row: rows[virtualRow2.index],
|
|
52386
|
+
columnCount,
|
|
52387
|
+
columnWidths,
|
|
52388
|
+
colSpan,
|
|
52389
|
+
hasRowActions: rowActions,
|
|
52390
|
+
columnAlignment,
|
|
52391
|
+
draggableTable: draggable,
|
|
52392
|
+
height: virtualRow2.size,
|
|
52393
|
+
dropDisabled
|
|
52394
|
+
},
|
|
52395
|
+
`1_${virtualRow2.index}`
|
|
52396
|
+
)) : rows.map((row2, index2) => /* @__PURE__ */ jsx(
|
|
52397
|
+
Row,
|
|
52398
|
+
{
|
|
52399
|
+
rowIndex: index2,
|
|
52400
|
+
row: row2,
|
|
52401
|
+
columnCount,
|
|
52402
|
+
columnWidths,
|
|
52403
|
+
colSpan,
|
|
52404
|
+
hasRowActions: rowActions,
|
|
52405
|
+
columnAlignment,
|
|
52406
|
+
draggableTable: draggable,
|
|
52407
|
+
dropDisabled
|
|
52408
|
+
},
|
|
52409
|
+
`1_${index2}`
|
|
52410
|
+
)) })
|
|
52411
|
+
]
|
|
52412
|
+
}
|
|
52413
|
+
) })
|
|
52377
52414
|
}
|
|
52378
52415
|
),
|
|
52379
52416
|
footer2 && /* @__PURE__ */ jsx(
|
|
@@ -66722,10 +66759,11 @@ const convertVisibleRows = ({
|
|
|
66722
66759
|
cells: headerRow.cells.map((headerCell) => {
|
|
66723
66760
|
var _a2;
|
|
66724
66761
|
if (headerCell.type === CellType.AUTO_UNIT) {
|
|
66725
|
-
const { testId, unitKey } = headerCell;
|
|
66762
|
+
const { testId, unitKey, disabled: disabled2 = false } = headerCell;
|
|
66726
66763
|
return {
|
|
66727
66764
|
value: selectedUnits[unitKey],
|
|
66728
66765
|
type: CellType.SELECT,
|
|
66766
|
+
disabled: disabled2,
|
|
66729
66767
|
searchable: false,
|
|
66730
66768
|
options: (_a2 = getUnitsForQuantity(unitKey)) == null ? void 0 : _a2.map((unit2) => ({
|
|
66731
66769
|
label: label$b(unit2),
|