@majoo-ui/react 1.58.6 → 1.58.7
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/index.esm.js +45 -7
- package/index.umd.js +56 -12
- package/package.json +1 -1
package/index.esm.js
CHANGED
|
@@ -6040,7 +6040,7 @@ InputCheckbox.propTypes = {
|
|
|
6040
6040
|
onCheckedChange: PropTypes.func,
|
|
6041
6041
|
label: PropTypes.oneOfType([PropTypes.string, PropTypes.node]),
|
|
6042
6042
|
index: PropTypes.number,
|
|
6043
|
-
value: PropTypes.oneOfType(PropTypes.string, PropTypes.number, PropTypes.object)
|
|
6043
|
+
value: PropTypes.oneOfType([PropTypes.string, PropTypes.number, PropTypes.object])
|
|
6044
6044
|
};
|
|
6045
6045
|
InputCheckbox.displayName = 'InputCheckbox';
|
|
6046
6046
|
|
|
@@ -22007,6 +22007,7 @@ function Table({
|
|
|
22007
22007
|
const [dataRow, setDataRow] = useState({});
|
|
22008
22008
|
const [tableScrollPosition, setTableScrollPosition] = useState('start');
|
|
22009
22009
|
const [scrollAreaWidth, setScrollAreaWidth] = useState(0);
|
|
22010
|
+
const [stateSelectedRowIds, setStateSelectedRowIds] = useState([]);
|
|
22010
22011
|
const {
|
|
22011
22012
|
t
|
|
22012
22013
|
} = useTranslation('MajooUI/table');
|
|
@@ -22277,8 +22278,28 @@ function Table({
|
|
|
22277
22278
|
if (rawData && rawData.length > 0) doFetchData(0, isInfiniteScroll ? rowLimit : pageSize);
|
|
22278
22279
|
}, [sortBy]);
|
|
22279
22280
|
useMountedLayoutEffect(() => {
|
|
22280
|
-
if (rawData && rawData.length > 0 && selectedRowIds && onSelectedChange)
|
|
22281
|
+
if (rawData && rawData.length > 0 && selectedRowIds && onSelectedChange) {
|
|
22282
|
+
const selectIds = Object.keys(selectedRowIds);
|
|
22283
|
+
if (stateSelectedRowIds.length > 0) {
|
|
22284
|
+
if (selectIds.length < stateSelectedRowIds.length) {
|
|
22285
|
+
const filteredSelectedRowIds = stateSelectedRowIds.filter(item => selectIds.includes(item));
|
|
22286
|
+
setStateSelectedRowIds(filteredSelectedRowIds);
|
|
22287
|
+
!filteredSelectedRowIds.length && (onSelectedChange === null || onSelectedChange === void 0 ? void 0 : onSelectedChange([]));
|
|
22288
|
+
} else {
|
|
22289
|
+
selectIds.forEach(item => {
|
|
22290
|
+
if (!stateSelectedRowIds.includes(item)) {
|
|
22291
|
+
setStateSelectedRowIds(prev => [...prev, item]);
|
|
22292
|
+
}
|
|
22293
|
+
});
|
|
22294
|
+
}
|
|
22295
|
+
} else {
|
|
22296
|
+
setStateSelectedRowIds(selectIds.length ? selectIds : []);
|
|
22297
|
+
}
|
|
22298
|
+
}
|
|
22281
22299
|
}, [selectedRowIds]);
|
|
22300
|
+
useMountedLayoutEffect(() => {
|
|
22301
|
+
stateSelectedRowIds.length && (onSelectedChange === null || onSelectedChange === void 0 ? void 0 : onSelectedChange(stateSelectedRowIds));
|
|
22302
|
+
}, [onSelectedChange, stateSelectedRowIds]);
|
|
22282
22303
|
useEffect(() => {
|
|
22283
22304
|
var _a;
|
|
22284
22305
|
if (isInfiniteScroll && rawData.length <= rowLimit) {
|
|
@@ -23956,6 +23977,11 @@ const itemStyles = {
|
|
|
23956
23977
|
}
|
|
23957
23978
|
};
|
|
23958
23979
|
const StyledItem = styled(DropdownMenuPrimitive.Item, Object.assign({}, itemStyles));
|
|
23980
|
+
StyledItem.propTypes = {
|
|
23981
|
+
asChild: PropTypes.bool,
|
|
23982
|
+
disabled: PropTypes.bool,
|
|
23983
|
+
onSelect: PropTypes.func
|
|
23984
|
+
};
|
|
23959
23985
|
const StyledCheckboxItem = styled(DropdownMenuPrimitive.CheckboxItem, Object.assign({}, itemStyles));
|
|
23960
23986
|
const StyledRadioItem = styled(DropdownMenuPrimitive.RadioItem, Object.assign({}, itemStyles));
|
|
23961
23987
|
// const StyledTriggerItem = styled(DropdownMenuPrimitive.TriggerItem, {
|
|
@@ -23998,7 +24024,7 @@ const DropdownMenuContext = _ref => {
|
|
|
23998
24024
|
__self: undefined,
|
|
23999
24025
|
__source: {
|
|
24000
24026
|
fileName: _jsxFileName$a,
|
|
24001
|
-
lineNumber:
|
|
24027
|
+
lineNumber: 127,
|
|
24002
24028
|
columnNumber: 5
|
|
24003
24029
|
}
|
|
24004
24030
|
}), /*#__PURE__*/React__default.createElement(Context.Provider, {
|
|
@@ -24009,11 +24035,15 @@ const DropdownMenuContext = _ref => {
|
|
|
24009
24035
|
__self: undefined,
|
|
24010
24036
|
__source: {
|
|
24011
24037
|
fileName: _jsxFileName$a,
|
|
24012
|
-
lineNumber:
|
|
24038
|
+
lineNumber: 128,
|
|
24013
24039
|
columnNumber: 7
|
|
24014
24040
|
}
|
|
24015
24041
|
}, children));
|
|
24016
24042
|
};
|
|
24043
|
+
DropdownMenuContext.propTypes = {
|
|
24044
|
+
side: PropTypes.oneOf(['top', 'right', 'bottom', 'left']),
|
|
24045
|
+
align: PropTypes.oneOfType(['start', 'center', 'end'])
|
|
24046
|
+
};
|
|
24017
24047
|
const DropdownMenuContentContext = props => {
|
|
24018
24048
|
const {
|
|
24019
24049
|
side,
|
|
@@ -24038,11 +24068,16 @@ const DropdownMenuContentContext = props => {
|
|
|
24038
24068
|
__self: undefined,
|
|
24039
24069
|
__source: {
|
|
24040
24070
|
fileName: _jsxFileName$a,
|
|
24041
|
-
lineNumber:
|
|
24071
|
+
lineNumber: 151,
|
|
24042
24072
|
columnNumber: 5
|
|
24043
24073
|
}
|
|
24044
24074
|
}), props.children);
|
|
24045
24075
|
};
|
|
24076
|
+
DropdownMenuContentContext.propTypes = {
|
|
24077
|
+
sideOffset: PropTypes.number,
|
|
24078
|
+
alignOffset: PropTypes.number,
|
|
24079
|
+
asChild: PropTypes.bool
|
|
24080
|
+
};
|
|
24046
24081
|
const DropdownTrigger = /*#__PURE__*/React__default.forwardRef((_ref2, ref) => {
|
|
24047
24082
|
let {
|
|
24048
24083
|
children
|
|
@@ -24059,11 +24094,14 @@ const DropdownTrigger = /*#__PURE__*/React__default.forwardRef((_ref2, ref) => {
|
|
|
24059
24094
|
__self: undefined,
|
|
24060
24095
|
__source: {
|
|
24061
24096
|
fileName: _jsxFileName$a,
|
|
24062
|
-
lineNumber:
|
|
24097
|
+
lineNumber: 166,
|
|
24063
24098
|
columnNumber: 5
|
|
24064
24099
|
}
|
|
24065
24100
|
}));
|
|
24066
24101
|
});
|
|
24102
|
+
DropdownTrigger.propTypes = {
|
|
24103
|
+
asChild: PropTypes.bool
|
|
24104
|
+
};
|
|
24067
24105
|
const RightSlot = styled('div', {
|
|
24068
24106
|
marginLeft: 'auto',
|
|
24069
24107
|
':focus > &': {
|
|
@@ -24090,7 +24128,7 @@ const ButtonDropdown = /*#__PURE__*/React__default.forwardRef((props, ref) => {
|
|
|
24090
24128
|
__self: undefined,
|
|
24091
24129
|
__source: {
|
|
24092
24130
|
fileName: _jsxFileName$a,
|
|
24093
|
-
lineNumber:
|
|
24131
|
+
lineNumber: 197,
|
|
24094
24132
|
columnNumber: 5
|
|
24095
24133
|
}
|
|
24096
24134
|
}), rest.children);
|
package/index.umd.js
CHANGED
|
@@ -6121,7 +6121,7 @@
|
|
|
6121
6121
|
onCheckedChange: PropTypes__default["default"].func,
|
|
6122
6122
|
label: PropTypes__default["default"].oneOfType([PropTypes__default["default"].string, PropTypes__default["default"].node]),
|
|
6123
6123
|
index: PropTypes__default["default"].number,
|
|
6124
|
-
value: PropTypes__default["default"].oneOfType(PropTypes__default["default"].string, PropTypes__default["default"].number, PropTypes__default["default"].object)
|
|
6124
|
+
value: PropTypes__default["default"].oneOfType([PropTypes__default["default"].string, PropTypes__default["default"].number, PropTypes__default["default"].object])
|
|
6125
6125
|
};
|
|
6126
6126
|
InputCheckbox.displayName = 'InputCheckbox';
|
|
6127
6127
|
|
|
@@ -22348,6 +22348,9 @@
|
|
|
22348
22348
|
var _v = React.useState(0),
|
|
22349
22349
|
scrollAreaWidth = _v[0],
|
|
22350
22350
|
setScrollAreaWidth = _v[1];
|
|
22351
|
+
var _w = React.useState([]),
|
|
22352
|
+
stateSelectedRowIds = _w[0],
|
|
22353
|
+
setStateSelectedRowIds = _w[1];
|
|
22351
22354
|
var t = reactI18next.useTranslation('MajooUI/table').t;
|
|
22352
22355
|
var isMobile = useMediaQuery(isMobileLayout === undefined ? '(max-width: 1024px)' : isMobileLayout ? '(max-width: 8000px)' : '(max-width: 0px)');
|
|
22353
22356
|
var customEmptyDataProps = searchQuery ? defaultEmptySearchProps(t, isMobile, searchQuery) : emptyDataProps || defaultEmptyDataProps(t, isMobile);
|
|
@@ -22394,11 +22397,11 @@
|
|
|
22394
22397
|
setPageSize = instance.setPageSize,
|
|
22395
22398
|
toggleRowSelected = instance.toggleRowSelected,
|
|
22396
22399
|
toggleAllRowsSelected = instance.toggleAllRowsSelected,
|
|
22397
|
-
|
|
22398
|
-
pageIndex =
|
|
22399
|
-
pageSize =
|
|
22400
|
-
sortBy =
|
|
22401
|
-
selectedRowIds =
|
|
22400
|
+
_x = instance.state,
|
|
22401
|
+
pageIndex = _x.pageIndex,
|
|
22402
|
+
pageSize = _x.pageSize,
|
|
22403
|
+
sortBy = _x.sortBy,
|
|
22404
|
+
selectedRowIds = _x.selectedRowIds,
|
|
22402
22405
|
setHiddenColumns = instance.setHiddenColumns,
|
|
22403
22406
|
setColumnOrder = instance.setColumnOrder;
|
|
22404
22407
|
var doFetchData = function doFetchData(pageIndex, pageSize, sortAccessor, sortDirection) {
|
|
@@ -22641,8 +22644,32 @@
|
|
|
22641
22644
|
if (rawData && rawData.length > 0) doFetchData(0, isInfiniteScroll ? rowLimit : pageSize);
|
|
22642
22645
|
}, [sortBy]);
|
|
22643
22646
|
reactTable.useMountedLayoutEffect(function () {
|
|
22644
|
-
if (rawData && rawData.length > 0 && selectedRowIds && onSelectedChange)
|
|
22647
|
+
if (rawData && rawData.length > 0 && selectedRowIds && onSelectedChange) {
|
|
22648
|
+
var selectIds_1 = Object.keys(selectedRowIds);
|
|
22649
|
+
if (stateSelectedRowIds.length > 0) {
|
|
22650
|
+
if (selectIds_1.length < stateSelectedRowIds.length) {
|
|
22651
|
+
var filteredSelectedRowIds = stateSelectedRowIds.filter(function (item) {
|
|
22652
|
+
return selectIds_1.includes(item);
|
|
22653
|
+
});
|
|
22654
|
+
setStateSelectedRowIds(filteredSelectedRowIds);
|
|
22655
|
+
!filteredSelectedRowIds.length && (onSelectedChange === null || onSelectedChange === void 0 ? void 0 : onSelectedChange([]));
|
|
22656
|
+
} else {
|
|
22657
|
+
selectIds_1.forEach(function (item) {
|
|
22658
|
+
if (!stateSelectedRowIds.includes(item)) {
|
|
22659
|
+
setStateSelectedRowIds(function (prev) {
|
|
22660
|
+
return __spreadArray(__spreadArray([], prev, true), [item], false);
|
|
22661
|
+
});
|
|
22662
|
+
}
|
|
22663
|
+
});
|
|
22664
|
+
}
|
|
22665
|
+
} else {
|
|
22666
|
+
setStateSelectedRowIds(selectIds_1.length ? selectIds_1 : []);
|
|
22667
|
+
}
|
|
22668
|
+
}
|
|
22645
22669
|
}, [selectedRowIds]);
|
|
22670
|
+
reactTable.useMountedLayoutEffect(function () {
|
|
22671
|
+
stateSelectedRowIds.length && (onSelectedChange === null || onSelectedChange === void 0 ? void 0 : onSelectedChange(stateSelectedRowIds));
|
|
22672
|
+
}, [onSelectedChange, stateSelectedRowIds]);
|
|
22646
22673
|
React.useEffect(function () {
|
|
22647
22674
|
var _a;
|
|
22648
22675
|
if (isInfiniteScroll && rawData.length <= rowLimit) {
|
|
@@ -24362,6 +24389,11 @@
|
|
|
24362
24389
|
}
|
|
24363
24390
|
};
|
|
24364
24391
|
const StyledItem = styled(DropdownMenuPrimitive__namespace.Item, Object.assign({}, itemStyles));
|
|
24392
|
+
StyledItem.propTypes = {
|
|
24393
|
+
asChild: PropTypes__default["default"].bool,
|
|
24394
|
+
disabled: PropTypes__default["default"].bool,
|
|
24395
|
+
onSelect: PropTypes__default["default"].func
|
|
24396
|
+
};
|
|
24365
24397
|
const StyledCheckboxItem = styled(DropdownMenuPrimitive__namespace.CheckboxItem, Object.assign({}, itemStyles));
|
|
24366
24398
|
const StyledRadioItem = styled(DropdownMenuPrimitive__namespace.RadioItem, Object.assign({}, itemStyles));
|
|
24367
24399
|
// const StyledTriggerItem = styled(DropdownMenuPrimitive.TriggerItem, {
|
|
@@ -24404,7 +24436,7 @@
|
|
|
24404
24436
|
__self: undefined,
|
|
24405
24437
|
__source: {
|
|
24406
24438
|
fileName: _jsxFileName$a,
|
|
24407
|
-
lineNumber:
|
|
24439
|
+
lineNumber: 127,
|
|
24408
24440
|
columnNumber: 5
|
|
24409
24441
|
}
|
|
24410
24442
|
}), /*#__PURE__*/React__default["default"].createElement(Context.Provider, {
|
|
@@ -24415,11 +24447,15 @@
|
|
|
24415
24447
|
__self: undefined,
|
|
24416
24448
|
__source: {
|
|
24417
24449
|
fileName: _jsxFileName$a,
|
|
24418
|
-
lineNumber:
|
|
24450
|
+
lineNumber: 128,
|
|
24419
24451
|
columnNumber: 7
|
|
24420
24452
|
}
|
|
24421
24453
|
}, children));
|
|
24422
24454
|
};
|
|
24455
|
+
DropdownMenuContext.propTypes = {
|
|
24456
|
+
side: PropTypes__default["default"].oneOf(['top', 'right', 'bottom', 'left']),
|
|
24457
|
+
align: PropTypes__default["default"].oneOfType(['start', 'center', 'end'])
|
|
24458
|
+
};
|
|
24423
24459
|
const DropdownMenuContentContext = props => {
|
|
24424
24460
|
const {
|
|
24425
24461
|
side,
|
|
@@ -24444,11 +24480,16 @@
|
|
|
24444
24480
|
__self: undefined,
|
|
24445
24481
|
__source: {
|
|
24446
24482
|
fileName: _jsxFileName$a,
|
|
24447
|
-
lineNumber:
|
|
24483
|
+
lineNumber: 151,
|
|
24448
24484
|
columnNumber: 5
|
|
24449
24485
|
}
|
|
24450
24486
|
}), props.children);
|
|
24451
24487
|
};
|
|
24488
|
+
DropdownMenuContentContext.propTypes = {
|
|
24489
|
+
sideOffset: PropTypes__default["default"].number,
|
|
24490
|
+
alignOffset: PropTypes__default["default"].number,
|
|
24491
|
+
asChild: PropTypes__default["default"].bool
|
|
24492
|
+
};
|
|
24452
24493
|
const DropdownTrigger = /*#__PURE__*/React__default["default"].forwardRef((_ref2, ref) => {
|
|
24453
24494
|
let {
|
|
24454
24495
|
children
|
|
@@ -24465,11 +24506,14 @@
|
|
|
24465
24506
|
__self: undefined,
|
|
24466
24507
|
__source: {
|
|
24467
24508
|
fileName: _jsxFileName$a,
|
|
24468
|
-
lineNumber:
|
|
24509
|
+
lineNumber: 166,
|
|
24469
24510
|
columnNumber: 5
|
|
24470
24511
|
}
|
|
24471
24512
|
}));
|
|
24472
24513
|
});
|
|
24514
|
+
DropdownTrigger.propTypes = {
|
|
24515
|
+
asChild: PropTypes__default["default"].bool
|
|
24516
|
+
};
|
|
24473
24517
|
const RightSlot = styled('div', {
|
|
24474
24518
|
marginLeft: 'auto',
|
|
24475
24519
|
':focus > &': {
|
|
@@ -24496,7 +24540,7 @@
|
|
|
24496
24540
|
__self: undefined,
|
|
24497
24541
|
__source: {
|
|
24498
24542
|
fileName: _jsxFileName$a,
|
|
24499
|
-
lineNumber:
|
|
24543
|
+
lineNumber: 197,
|
|
24500
24544
|
columnNumber: 5
|
|
24501
24545
|
}
|
|
24502
24546
|
}), rest.children);
|