material-react-table 0.8.12 → 0.8.15
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/README.md +1 -0
- package/dist/MaterialReactTable.d.ts +6 -2
- package/dist/buttons/MRT_GrabHandleButton.d.ts +8 -0
- package/dist/material-react-table.cjs.development.js +1893 -1816
- package/dist/material-react-table.cjs.development.js.map +1 -1
- package/dist/material-react-table.cjs.production.min.js +1 -1
- package/dist/material-react-table.cjs.production.min.js.map +1 -1
- package/dist/material-react-table.esm.js +220 -143
- package/dist/material-react-table.esm.js.map +1 -1
- package/dist/menus/MRT_ShowHideColumnsMenuItems.d.ts +1 -0
- package/dist/table/MRT_TableRoot.d.ts +0 -1
- package/dist/utils.d.ts +4 -3
- package/package.json +1 -1
- package/src/MaterialReactTable.tsx +9 -0
- package/src/body/MRT_TableBodyCell.tsx +15 -1
- package/src/buttons/MRT_ColumnPinningButtons.tsx +1 -1
- package/src/{head/MRT_TableHeadCellGrabHandle.tsx → buttons/MRT_GrabHandleButton.tsx} +2 -3
- package/src/footer/MRT_TableFooterCell.tsx +6 -6
- package/src/head/MRT_DraggableTableHeadCell.tsx +8 -17
- package/src/head/MRT_TableHeadCell.tsx +14 -13
- package/src/inputs/MRT_SelectCheckbox.tsx +6 -1
- package/src/menus/MRT_ShowHideColumnsMenu.tsx +19 -5
- package/src/menus/MRT_ShowHideColumnsMenuItems.tsx +68 -24
- package/src/table/MRT_TableRoot.tsx +33 -15
- package/src/utils.ts +24 -2
- package/dist/head/MRT_TableHeadCellGrabHandle.d.ts +0 -9
|
@@ -496,1744 +496,1033 @@ var MRT_FilterOptionMenu = function MRT_FilterOptionMenu(_ref) {
|
|
|
496
496
|
}));
|
|
497
497
|
};
|
|
498
498
|
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
localization = _tableInstance$option.localization;
|
|
499
|
+
/**
|
|
500
|
+
* Create the React Context
|
|
501
|
+
*/ const DndContext = React.createContext({
|
|
502
|
+
dragDropManager: undefined
|
|
503
|
+
});
|
|
505
504
|
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
505
|
+
// Inlined version of the `symbol-observable` polyfill
|
|
506
|
+
var $$observable = (function () {
|
|
507
|
+
return typeof Symbol === 'function' && Symbol.observable || '@@observable';
|
|
508
|
+
})();
|
|
509
509
|
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
onClick: function onClick() {
|
|
519
|
-
return handlePinColumn(false);
|
|
520
|
-
},
|
|
521
|
-
size: "small"
|
|
522
|
-
}, React__default.createElement(PushPinIcon, null))) : React__default.createElement(React__default.Fragment, null, React__default.createElement(material.Tooltip, {
|
|
523
|
-
arrow: true,
|
|
524
|
-
title: localization.pinToLeft
|
|
525
|
-
}, React__default.createElement(material.IconButton, {
|
|
526
|
-
onClick: function onClick() {
|
|
527
|
-
return handlePinColumn('left');
|
|
528
|
-
},
|
|
529
|
-
size: "small"
|
|
530
|
-
}, React__default.createElement(PushPinIcon, {
|
|
531
|
-
style: {
|
|
532
|
-
transform: 'rotate(90deg)'
|
|
533
|
-
}
|
|
534
|
-
}))), React__default.createElement(material.Tooltip, {
|
|
535
|
-
arrow: true,
|
|
536
|
-
title: localization.pinToRight
|
|
537
|
-
}, React__default.createElement(material.IconButton, {
|
|
538
|
-
onClick: function onClick() {
|
|
539
|
-
return handlePinColumn('right');
|
|
540
|
-
},
|
|
541
|
-
size: "small"
|
|
542
|
-
}, React__default.createElement(PushPinIcon, {
|
|
543
|
-
style: {
|
|
544
|
-
transform: 'rotate(-90deg)'
|
|
545
|
-
}
|
|
546
|
-
})))));
|
|
510
|
+
/**
|
|
511
|
+
* These are private action types reserved by Redux.
|
|
512
|
+
* For any unknown actions, you must return the current state.
|
|
513
|
+
* If the current state is undefined, you must return the initial state.
|
|
514
|
+
* Do not reference these action types directly in your code.
|
|
515
|
+
*/
|
|
516
|
+
var randomString = function randomString() {
|
|
517
|
+
return Math.random().toString(36).substring(7).split('').join('.');
|
|
547
518
|
};
|
|
548
519
|
|
|
549
|
-
var
|
|
550
|
-
|
|
520
|
+
var ActionTypes = {
|
|
521
|
+
INIT: "@@redux/INIT" + randomString(),
|
|
522
|
+
REPLACE: "@@redux/REPLACE" + randomString(),
|
|
523
|
+
PROBE_UNKNOWN_ACTION: function PROBE_UNKNOWN_ACTION() {
|
|
524
|
+
return "@@redux/PROBE_UNKNOWN_ACTION" + randomString();
|
|
525
|
+
}
|
|
526
|
+
};
|
|
551
527
|
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
528
|
+
/**
|
|
529
|
+
* @param {any} obj The object to inspect.
|
|
530
|
+
* @returns {boolean} True if the argument appears to be a plain object.
|
|
531
|
+
*/
|
|
532
|
+
function isPlainObject(obj) {
|
|
533
|
+
if (typeof obj !== 'object' || obj === null) return false;
|
|
534
|
+
var proto = obj;
|
|
557
535
|
|
|
558
|
-
|
|
559
|
-
|
|
536
|
+
while (Object.getPrototypeOf(proto) !== null) {
|
|
537
|
+
proto = Object.getPrototypeOf(proto);
|
|
538
|
+
}
|
|
560
539
|
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
var switchChecked = columnDefType !== 'group' && column.getIsVisible() || columnDefType === 'group' && column.getLeafColumns().some(function (col) {
|
|
564
|
-
return col.getIsVisible();
|
|
565
|
-
});
|
|
540
|
+
return Object.getPrototypeOf(obj) === proto;
|
|
541
|
+
}
|
|
566
542
|
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
543
|
+
// Inlined / shortened version of `kindOf` from https://github.com/jonschlinkert/kind-of
|
|
544
|
+
function miniKindOf(val) {
|
|
545
|
+
if (val === void 0) return 'undefined';
|
|
546
|
+
if (val === null) return 'null';
|
|
547
|
+
var type = typeof val;
|
|
570
548
|
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
549
|
+
switch (type) {
|
|
550
|
+
case 'boolean':
|
|
551
|
+
case 'string':
|
|
552
|
+
case 'number':
|
|
553
|
+
case 'symbol':
|
|
554
|
+
case 'function':
|
|
555
|
+
{
|
|
556
|
+
return type;
|
|
557
|
+
}
|
|
558
|
+
}
|
|
577
559
|
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
});
|
|
583
|
-
};
|
|
560
|
+
if (Array.isArray(val)) return 'array';
|
|
561
|
+
if (isDate(val)) return 'date';
|
|
562
|
+
if (isError(val)) return 'error';
|
|
563
|
+
var constructorName = ctorName(val);
|
|
584
564
|
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
}
|
|
594
|
-
column: column,
|
|
595
|
-
tableInstance: tableInstance
|
|
596
|
-
}), React__default.createElement(material.FormControlLabel, {
|
|
597
|
-
componentsProps: {
|
|
598
|
-
typography: {
|
|
599
|
-
sx: {
|
|
600
|
-
marginBottom: 0,
|
|
601
|
-
opacity: columnDefType !== 'display' ? 1 : 0.5
|
|
602
|
-
}
|
|
603
|
-
}
|
|
604
|
-
},
|
|
605
|
-
checked: switchChecked,
|
|
606
|
-
control: React__default.createElement(material.Switch, null),
|
|
607
|
-
disabled: isSubMenu && switchChecked || !column.getCanHide(),
|
|
608
|
-
label: columnDef.header,
|
|
609
|
-
onChange: function onChange() {
|
|
610
|
-
return handleToggleColumnHidden(column);
|
|
611
|
-
}
|
|
612
|
-
})), (_column$columns2 = column.columns) == null ? void 0 : _column$columns2.map(function (c, i) {
|
|
613
|
-
return React__default.createElement(MRT_ShowHideColumnsMenuItems, {
|
|
614
|
-
key: i + "-" + c.id,
|
|
615
|
-
column: c,
|
|
616
|
-
isSubMenu: isSubMenu,
|
|
617
|
-
tableInstance: tableInstance
|
|
618
|
-
});
|
|
619
|
-
}));
|
|
620
|
-
};
|
|
565
|
+
switch (constructorName) {
|
|
566
|
+
case 'Symbol':
|
|
567
|
+
case 'Promise':
|
|
568
|
+
case 'WeakMap':
|
|
569
|
+
case 'WeakSet':
|
|
570
|
+
case 'Map':
|
|
571
|
+
case 'Set':
|
|
572
|
+
return constructorName;
|
|
573
|
+
} // other
|
|
621
574
|
|
|
622
|
-
var MRT_ShowHideColumnsMenu = function MRT_ShowHideColumnsMenu(_ref) {
|
|
623
|
-
var anchorEl = _ref.anchorEl,
|
|
624
|
-
isSubMenu = _ref.isSubMenu,
|
|
625
|
-
setAnchorEl = _ref.setAnchorEl,
|
|
626
|
-
tableInstance = _ref.tableInstance;
|
|
627
|
-
var getAllColumns = tableInstance.getAllColumns,
|
|
628
|
-
getAllLeafColumns = tableInstance.getAllLeafColumns,
|
|
629
|
-
getIsAllColumnsVisible = tableInstance.getIsAllColumnsVisible,
|
|
630
|
-
getIsSomeColumnsPinned = tableInstance.getIsSomeColumnsPinned,
|
|
631
|
-
getIsSomeColumnsVisible = tableInstance.getIsSomeColumnsVisible,
|
|
632
|
-
getState = tableInstance.getState,
|
|
633
|
-
toggleAllColumnsVisible = tableInstance.toggleAllColumnsVisible,
|
|
634
|
-
_tableInstance$option = tableInstance.options,
|
|
635
|
-
localization = _tableInstance$option.localization,
|
|
636
|
-
enablePinning = _tableInstance$option.enablePinning,
|
|
637
|
-
enableColumnOrdering = _tableInstance$option.enableColumnOrdering;
|
|
638
575
|
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
columnOrder = _getState.columnOrder,
|
|
642
|
-
columnPinning = _getState.columnPinning;
|
|
576
|
+
return type.slice(8, -1).toLowerCase().replace(/\s/g, '');
|
|
577
|
+
}
|
|
643
578
|
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
}).forEach(function (col) {
|
|
648
|
-
return col.toggleVisibility(false);
|
|
649
|
-
});
|
|
650
|
-
};
|
|
579
|
+
function ctorName(val) {
|
|
580
|
+
return typeof val.constructor === 'function' ? val.constructor.name : null;
|
|
581
|
+
}
|
|
651
582
|
|
|
652
|
-
|
|
653
|
-
|
|
583
|
+
function isError(val) {
|
|
584
|
+
return val instanceof Error || typeof val.message === 'string' && val.constructor && typeof val.constructor.stackTraceLimit === 'number';
|
|
585
|
+
}
|
|
654
586
|
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
587
|
+
function isDate(val) {
|
|
588
|
+
if (val instanceof Date) return true;
|
|
589
|
+
return typeof val.toDateString === 'function' && typeof val.getDate === 'function' && typeof val.setDate === 'function';
|
|
590
|
+
}
|
|
659
591
|
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
return col.id === colId;
|
|
663
|
-
});
|
|
664
|
-
})) != null ? _columnOrder$map : columns;
|
|
665
|
-
}
|
|
592
|
+
function kindOf(val) {
|
|
593
|
+
var typeOfVal = typeof val;
|
|
666
594
|
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
anchorEl: anchorEl,
|
|
671
|
-
open: !!anchorEl,
|
|
672
|
-
onClose: function onClose() {
|
|
673
|
-
return setAnchorEl(null);
|
|
674
|
-
},
|
|
675
|
-
MenuListProps: {
|
|
676
|
-
dense: isDensePadding
|
|
677
|
-
}
|
|
678
|
-
}, React__default.createElement(material.Box, {
|
|
679
|
-
sx: {
|
|
680
|
-
display: 'flex',
|
|
681
|
-
justifyContent: isSubMenu ? 'center' : 'space-between',
|
|
682
|
-
p: '0.5rem',
|
|
683
|
-
pt: 0
|
|
684
|
-
}
|
|
685
|
-
}, !isSubMenu && React__default.createElement(material.Button, {
|
|
686
|
-
disabled: !getIsSomeColumnsVisible(),
|
|
687
|
-
onClick: hideAllColumns
|
|
688
|
-
}, localization.hideAll), !isSubMenu && enableColumnOrdering && React__default.createElement(material.Button, {
|
|
689
|
-
onClick: function onClick() {
|
|
690
|
-
return tableInstance.resetColumnOrder();
|
|
691
|
-
}
|
|
692
|
-
}, localization.resetOrder), !isSubMenu && enablePinning && React__default.createElement(material.Button, {
|
|
693
|
-
disabled: !getIsSomeColumnsPinned(),
|
|
694
|
-
onClick: function onClick() {
|
|
695
|
-
return tableInstance.resetColumnPinning(true);
|
|
696
|
-
}
|
|
697
|
-
}, localization.unpinAll), React__default.createElement(material.Button, {
|
|
698
|
-
disabled: getIsAllColumnsVisible(),
|
|
699
|
-
onClick: function onClick() {
|
|
700
|
-
return toggleAllColumnsVisible(true);
|
|
701
|
-
}
|
|
702
|
-
}, localization.showAll)), React__default.createElement(material.Divider, null), allColumns.map(function (column, index) {
|
|
703
|
-
return React__default.createElement(MRT_ShowHideColumnsMenuItems, {
|
|
704
|
-
column: column,
|
|
705
|
-
isSubMenu: isSubMenu,
|
|
706
|
-
key: index + "-" + column.id,
|
|
707
|
-
tableInstance: tableInstance
|
|
708
|
-
});
|
|
709
|
-
}));
|
|
710
|
-
};
|
|
595
|
+
{
|
|
596
|
+
typeOfVal = miniKindOf(val);
|
|
597
|
+
}
|
|
711
598
|
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
my: 0,
|
|
715
|
-
justifyContent: 'space-between',
|
|
716
|
-
alignItems: 'center'
|
|
717
|
-
};
|
|
718
|
-
var commonListItemStyles = {
|
|
719
|
-
display: 'flex',
|
|
720
|
-
alignItems: 'center'
|
|
721
|
-
};
|
|
722
|
-
var MRT_ColumnActionMenu = function MRT_ColumnActionMenu(_ref) {
|
|
723
|
-
var _localization$sortByC, _localization$sortByC2, _localization$filterB, _localization, _localization$hideCol, _localization$showAll;
|
|
599
|
+
return typeOfVal;
|
|
600
|
+
}
|
|
724
601
|
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
idPrefix = _tableInstance$option.idPrefix,
|
|
751
|
-
localization = _tableInstance$option.localization,
|
|
752
|
-
setShowFilters = tableInstance.setShowFilters;
|
|
753
|
-
var column = header.column;
|
|
754
|
-
var columnDef = column.columnDef;
|
|
602
|
+
/**
|
|
603
|
+
* @deprecated
|
|
604
|
+
*
|
|
605
|
+
* **We recommend using the `configureStore` method
|
|
606
|
+
* of the `@reduxjs/toolkit` package**, which replaces `createStore`.
|
|
607
|
+
*
|
|
608
|
+
* Redux Toolkit is our recommended approach for writing Redux logic today,
|
|
609
|
+
* including store setup, reducers, data fetching, and more.
|
|
610
|
+
*
|
|
611
|
+
* **For more details, please read this Redux docs page:**
|
|
612
|
+
* **https://redux.js.org/introduction/why-rtk-is-redux-today**
|
|
613
|
+
*
|
|
614
|
+
* `configureStore` from Redux Toolkit is an improved version of `createStore` that
|
|
615
|
+
* simplifies setup and helps avoid common bugs.
|
|
616
|
+
*
|
|
617
|
+
* You should not be using the `redux` core package by itself today, except for learning purposes.
|
|
618
|
+
* The `createStore` method from the core `redux` package will not be removed, but we encourage
|
|
619
|
+
* all users to migrate to using Redux Toolkit for all Redux code.
|
|
620
|
+
*
|
|
621
|
+
* If you want to use `createStore` without this visual deprecation warning, use
|
|
622
|
+
* the `legacy_createStore` import instead:
|
|
623
|
+
*
|
|
624
|
+
* `import { legacy_createStore as createStore} from 'redux'`
|
|
625
|
+
*
|
|
626
|
+
*/
|
|
755
627
|
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
columnVisibility = _getState.columnVisibility,
|
|
759
|
-
isDensePadding = _getState.isDensePadding;
|
|
628
|
+
function createStore(reducer, preloadedState, enhancer) {
|
|
629
|
+
var _ref2;
|
|
760
630
|
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
631
|
+
if (typeof preloadedState === 'function' && typeof enhancer === 'function' || typeof enhancer === 'function' && typeof arguments[3] === 'function') {
|
|
632
|
+
throw new Error( 'It looks like you are passing several store enhancers to ' + 'createStore(). This is not supported. Instead, compose them ' + 'together to a single function. See https://redux.js.org/tutorials/fundamentals/part-4-store#creating-a-store-with-enhancers for an example.');
|
|
633
|
+
}
|
|
764
634
|
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
635
|
+
if (typeof preloadedState === 'function' && typeof enhancer === 'undefined') {
|
|
636
|
+
enhancer = preloadedState;
|
|
637
|
+
preloadedState = undefined;
|
|
638
|
+
}
|
|
768
639
|
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
640
|
+
if (typeof enhancer !== 'undefined') {
|
|
641
|
+
if (typeof enhancer !== 'function') {
|
|
642
|
+
throw new Error( "Expected the enhancer to be a function. Instead, received: '" + kindOf(enhancer) + "'");
|
|
643
|
+
}
|
|
773
644
|
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
setAnchorEl(null);
|
|
777
|
-
};
|
|
645
|
+
return enhancer(createStore)(reducer, preloadedState);
|
|
646
|
+
}
|
|
778
647
|
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
};
|
|
648
|
+
if (typeof reducer !== 'function') {
|
|
649
|
+
throw new Error( "Expected the root reducer to be a function. Instead, received: '" + kindOf(reducer) + "'");
|
|
650
|
+
}
|
|
783
651
|
|
|
784
|
-
var
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
652
|
+
var currentReducer = reducer;
|
|
653
|
+
var currentState = preloadedState;
|
|
654
|
+
var currentListeners = [];
|
|
655
|
+
var nextListeners = currentListeners;
|
|
656
|
+
var isDispatching = false;
|
|
657
|
+
/**
|
|
658
|
+
* This makes a shallow copy of currentListeners so we can use
|
|
659
|
+
* nextListeners as a temporary list while dispatching.
|
|
660
|
+
*
|
|
661
|
+
* This prevents any bugs around consumers calling
|
|
662
|
+
* subscribe/unsubscribe in the middle of a dispatch.
|
|
663
|
+
*/
|
|
788
664
|
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
665
|
+
function ensureCanMutateNextListeners() {
|
|
666
|
+
if (nextListeners === currentListeners) {
|
|
667
|
+
nextListeners = currentListeners.slice();
|
|
668
|
+
}
|
|
669
|
+
}
|
|
670
|
+
/**
|
|
671
|
+
* Reads the state tree managed by the store.
|
|
672
|
+
*
|
|
673
|
+
* @returns {any} The current state tree of your application.
|
|
674
|
+
*/
|
|
793
675
|
|
|
794
|
-
var handlePinColumn = function handlePinColumn(pinDirection) {
|
|
795
|
-
column.pin(pinDirection);
|
|
796
|
-
setAnchorEl(null);
|
|
797
|
-
};
|
|
798
676
|
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
});
|
|
804
|
-
setAnchorEl(null);
|
|
805
|
-
};
|
|
677
|
+
function getState() {
|
|
678
|
+
if (isDispatching) {
|
|
679
|
+
throw new Error( 'You may not call store.getState() while the reducer is executing. ' + 'The reducer has already received the state as an argument. ' + 'Pass it down from the top reducer instead of reading it from the store.');
|
|
680
|
+
}
|
|
806
681
|
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
682
|
+
return currentState;
|
|
683
|
+
}
|
|
684
|
+
/**
|
|
685
|
+
* Adds a change listener. It will be called any time an action is dispatched,
|
|
686
|
+
* and some part of the state tree may potentially have changed. You may then
|
|
687
|
+
* call `getState()` to read the current state tree inside the callback.
|
|
688
|
+
*
|
|
689
|
+
* You may call `dispatch()` from a change listener, with the following
|
|
690
|
+
* caveats:
|
|
691
|
+
*
|
|
692
|
+
* 1. The subscriptions are snapshotted just before every `dispatch()` call.
|
|
693
|
+
* If you subscribe or unsubscribe while the listeners are being invoked, this
|
|
694
|
+
* will not have any effect on the `dispatch()` that is currently in progress.
|
|
695
|
+
* However, the next `dispatch()` call, whether nested or not, will use a more
|
|
696
|
+
* recent snapshot of the subscription list.
|
|
697
|
+
*
|
|
698
|
+
* 2. The listener should not expect to see all state changes, as the state
|
|
699
|
+
* might have been updated multiple times during a nested `dispatch()` before
|
|
700
|
+
* the listener is called. It is, however, guaranteed that all subscribers
|
|
701
|
+
* registered before the `dispatch()` started will be called with the latest
|
|
702
|
+
* state by the time it exits.
|
|
703
|
+
*
|
|
704
|
+
* @param {Function} listener A callback to be invoked on every dispatch.
|
|
705
|
+
* @returns {Function} A function to remove this change listener.
|
|
706
|
+
*/
|
|
811
707
|
|
|
812
|
-
var handleFilterByColumn = function handleFilterByColumn() {
|
|
813
|
-
setShowFilters(true);
|
|
814
|
-
setTimeout(function () {
|
|
815
|
-
var _document$getElementB, _header$muiTableHeadC, _header$muiTableHeadC2;
|
|
816
708
|
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
};
|
|
709
|
+
function subscribe(listener) {
|
|
710
|
+
if (typeof listener !== 'function') {
|
|
711
|
+
throw new Error( "Expected the listener to be a function. Instead, received: '" + kindOf(listener) + "'");
|
|
712
|
+
}
|
|
822
713
|
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
};
|
|
714
|
+
if (isDispatching) {
|
|
715
|
+
throw new Error( 'You may not call store.subscribe() while the reducer is executing. ' + 'If you would like to be notified after the store has been updated, subscribe from a ' + 'component and invoke store.getState() in the callback to access the latest state. ' + 'See https://redux.js.org/api/store#subscribelistener for more details.');
|
|
716
|
+
}
|
|
827
717
|
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
718
|
+
var isSubscribed = true;
|
|
719
|
+
ensureCanMutateNextListeners();
|
|
720
|
+
nextListeners.push(listener);
|
|
721
|
+
return function unsubscribe() {
|
|
722
|
+
if (!isSubscribed) {
|
|
723
|
+
return;
|
|
724
|
+
}
|
|
832
725
|
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
};
|
|
726
|
+
if (isDispatching) {
|
|
727
|
+
throw new Error( 'You may not unsubscribe from a store listener while the reducer is executing. ' + 'See https://redux.js.org/api/store#subscribelistener for more details.');
|
|
728
|
+
}
|
|
837
729
|
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
}
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
key: 0,
|
|
876
|
-
onClick: handleClearFilter,
|
|
877
|
-
sx: commonMenuItemStyles$1
|
|
878
|
-
}, React__default.createElement(material.Box, {
|
|
879
|
-
sx: commonListItemStyles
|
|
880
|
-
}, React__default.createElement(material.ListItemIcon, null, React__default.createElement(FilterListOffIcon, null)), localization.clearFilter)), React__default.createElement(material.MenuItem, {
|
|
881
|
-
divider: enableGrouping || enableHiding,
|
|
882
|
-
key: 1,
|
|
883
|
-
onClick: handleFilterByColumn,
|
|
884
|
-
sx: commonMenuItemStyles$1
|
|
885
|
-
}, React__default.createElement(material.Box, {
|
|
886
|
-
sx: commonListItemStyles
|
|
887
|
-
}, React__default.createElement(material.ListItemIcon, null, React__default.createElement(FilterListIcon, null)), (_localization$filterB = localization.filterByColumn) == null ? void 0 : _localization$filterB.replace('{column}', String(columnDef.header))), !columnDef.filterSelectOptions && React__default.createElement(material.IconButton, {
|
|
888
|
-
onClick: handleOpenFilterModeMenu,
|
|
889
|
-
onMouseEnter: handleOpenFilterModeMenu,
|
|
890
|
-
size: "small",
|
|
891
|
-
sx: {
|
|
892
|
-
p: 0
|
|
893
|
-
}
|
|
894
|
-
}, React__default.createElement(ArrowRightIcon, null))), React__default.createElement(MRT_FilterOptionMenu, {
|
|
895
|
-
anchorEl: filterMenuAnchorEl,
|
|
896
|
-
header: header,
|
|
897
|
-
key: 2,
|
|
898
|
-
onSelect: handleFilterByColumn,
|
|
899
|
-
setAnchorEl: setFilterMenuAnchorEl,
|
|
900
|
-
tableInstance: tableInstance
|
|
901
|
-
})], enableGrouping && column.getCanGroup() && [React__default.createElement(material.MenuItem, {
|
|
902
|
-
divider: enablePinning,
|
|
903
|
-
key: 0,
|
|
904
|
-
onClick: handleGroupByColumn,
|
|
905
|
-
sx: commonMenuItemStyles$1
|
|
906
|
-
}, React__default.createElement(material.Box, {
|
|
907
|
-
sx: commonListItemStyles
|
|
908
|
-
}, React__default.createElement(material.ListItemIcon, null, React__default.createElement(DynamicFeedIcon, null)), (_localization = localization[column.getIsGrouped() ? 'ungroupByColumn' : 'groupByColumn']) == null ? void 0 : _localization.replace('{column}', String(columnDef.header))))], enablePinning && column.getCanPin() && [React__default.createElement(material.MenuItem, {
|
|
909
|
-
disabled: column.getIsPinned() === 'left' || !column.getCanPin(),
|
|
910
|
-
key: 0,
|
|
911
|
-
onClick: function onClick() {
|
|
912
|
-
return handlePinColumn('left');
|
|
913
|
-
},
|
|
914
|
-
sx: commonMenuItemStyles$1
|
|
915
|
-
}, React__default.createElement(material.Box, {
|
|
916
|
-
sx: commonListItemStyles
|
|
917
|
-
}, React__default.createElement(material.ListItemIcon, null, React__default.createElement(PushPinIcon, {
|
|
918
|
-
style: {
|
|
919
|
-
transform: 'rotate(90deg)'
|
|
730
|
+
isSubscribed = false;
|
|
731
|
+
ensureCanMutateNextListeners();
|
|
732
|
+
var index = nextListeners.indexOf(listener);
|
|
733
|
+
nextListeners.splice(index, 1);
|
|
734
|
+
currentListeners = null;
|
|
735
|
+
};
|
|
736
|
+
}
|
|
737
|
+
/**
|
|
738
|
+
* Dispatches an action. It is the only way to trigger a state change.
|
|
739
|
+
*
|
|
740
|
+
* The `reducer` function, used to create the store, will be called with the
|
|
741
|
+
* current state tree and the given `action`. Its return value will
|
|
742
|
+
* be considered the **next** state of the tree, and the change listeners
|
|
743
|
+
* will be notified.
|
|
744
|
+
*
|
|
745
|
+
* The base implementation only supports plain object actions. If you want to
|
|
746
|
+
* dispatch a Promise, an Observable, a thunk, or something else, you need to
|
|
747
|
+
* wrap your store creating function into the corresponding middleware. For
|
|
748
|
+
* example, see the documentation for the `redux-thunk` package. Even the
|
|
749
|
+
* middleware will eventually dispatch plain object actions using this method.
|
|
750
|
+
*
|
|
751
|
+
* @param {Object} action A plain object representing “what changed”. It is
|
|
752
|
+
* a good idea to keep actions serializable so you can record and replay user
|
|
753
|
+
* sessions, or use the time travelling `redux-devtools`. An action must have
|
|
754
|
+
* a `type` property which may not be `undefined`. It is a good idea to use
|
|
755
|
+
* string constants for action types.
|
|
756
|
+
*
|
|
757
|
+
* @returns {Object} For convenience, the same action object you dispatched.
|
|
758
|
+
*
|
|
759
|
+
* Note that, if you use a custom middleware, it may wrap `dispatch()` to
|
|
760
|
+
* return something else (for example, a Promise you can await).
|
|
761
|
+
*/
|
|
762
|
+
|
|
763
|
+
|
|
764
|
+
function dispatch(action) {
|
|
765
|
+
if (!isPlainObject(action)) {
|
|
766
|
+
throw new Error( "Actions must be plain objects. Instead, the actual type was: '" + kindOf(action) + "'. You may need to add middleware to your store setup to handle dispatching other values, such as 'redux-thunk' to handle dispatching functions. See https://redux.js.org/tutorials/fundamentals/part-4-store#middleware and https://redux.js.org/tutorials/fundamentals/part-6-async-logic#using-the-redux-thunk-middleware for examples.");
|
|
920
767
|
}
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
onClick: function onClick() {
|
|
925
|
-
return handlePinColumn('right');
|
|
926
|
-
},
|
|
927
|
-
sx: commonMenuItemStyles$1
|
|
928
|
-
}, React__default.createElement(material.Box, {
|
|
929
|
-
sx: commonListItemStyles
|
|
930
|
-
}, React__default.createElement(material.ListItemIcon, null, React__default.createElement(PushPinIcon, {
|
|
931
|
-
style: {
|
|
932
|
-
transform: 'rotate(-90deg)'
|
|
768
|
+
|
|
769
|
+
if (typeof action.type === 'undefined') {
|
|
770
|
+
throw new Error( 'Actions may not have an undefined "type" property. You may have misspelled an action type string constant.');
|
|
933
771
|
}
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
key: 2,
|
|
938
|
-
onClick: function onClick() {
|
|
939
|
-
return handlePinColumn(false);
|
|
940
|
-
},
|
|
941
|
-
sx: commonMenuItemStyles$1
|
|
942
|
-
}, React__default.createElement(material.Box, {
|
|
943
|
-
sx: commonListItemStyles
|
|
944
|
-
}, React__default.createElement(material.ListItemIcon, null, React__default.createElement(PushPinIcon, null)), localization.unpin))], enableColumnResizing && [React__default.createElement(material.MenuItem, {
|
|
945
|
-
disabled: !column.getCanResize() || !columnSizing[column.id],
|
|
946
|
-
key: 0,
|
|
947
|
-
onClick: handleResetColumnSize,
|
|
948
|
-
sx: commonMenuItemStyles$1
|
|
949
|
-
}, React__default.createElement(material.Box, {
|
|
950
|
-
sx: commonListItemStyles
|
|
951
|
-
}, React__default.createElement(material.ListItemIcon, null, React__default.createElement(RestartAltIcon, null)), localization.resetColumnSize))], enableHiding && [React__default.createElement(material.MenuItem, {
|
|
952
|
-
disabled: columnDef.enableHiding === false,
|
|
953
|
-
key: 0,
|
|
954
|
-
onClick: handleHideColumn,
|
|
955
|
-
sx: commonMenuItemStyles$1
|
|
956
|
-
}, React__default.createElement(material.Box, {
|
|
957
|
-
sx: commonListItemStyles
|
|
958
|
-
}, React__default.createElement(material.ListItemIcon, null, React__default.createElement(VisibilityOffIcon, null)), (_localization$hideCol = localization.hideColumn) == null ? void 0 : _localization$hideCol.replace('{column}', String(columnDef.header)))), React__default.createElement(material.MenuItem, {
|
|
959
|
-
disabled: !Object.values(columnVisibility).filter(function (visible) {
|
|
960
|
-
return !visible;
|
|
961
|
-
}).length,
|
|
962
|
-
key: 1,
|
|
963
|
-
onClick: handleShowAllColumns,
|
|
964
|
-
sx: commonMenuItemStyles$1
|
|
965
|
-
}, React__default.createElement(material.Box, {
|
|
966
|
-
sx: commonListItemStyles
|
|
967
|
-
}, React__default.createElement(material.ListItemIcon, null, React__default.createElement(ViewColumnIcon, null)), (_localization$showAll = localization.showAllColumns) == null ? void 0 : _localization$showAll.replace('{column}', String(columnDef.header))), React__default.createElement(material.IconButton, {
|
|
968
|
-
onClick: handleOpenShowHideColumnsMenu,
|
|
969
|
-
onMouseEnter: handleOpenShowHideColumnsMenu,
|
|
970
|
-
size: "small",
|
|
971
|
-
sx: {
|
|
972
|
-
p: 0
|
|
772
|
+
|
|
773
|
+
if (isDispatching) {
|
|
774
|
+
throw new Error( 'Reducers may not dispatch actions.');
|
|
973
775
|
}
|
|
974
|
-
}, React__default.createElement(ArrowRightIcon, null))), React__default.createElement(MRT_ShowHideColumnsMenu, {
|
|
975
|
-
anchorEl: showHideColumnsMenuAnchorEl,
|
|
976
|
-
isSubMenu: true,
|
|
977
|
-
key: 2,
|
|
978
|
-
setAnchorEl: setShowHideColumnsMenuAnchorEl,
|
|
979
|
-
tableInstance: tableInstance
|
|
980
|
-
})]);
|
|
981
|
-
};
|
|
982
776
|
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
var getState = tableInstance.getState,
|
|
990
|
-
_tableInstance$option = tableInstance.options,
|
|
991
|
-
EditIcon = _tableInstance$option.icons.EditIcon,
|
|
992
|
-
enableEditing = _tableInstance$option.enableEditing,
|
|
993
|
-
localization = _tableInstance$option.localization,
|
|
994
|
-
renderRowActionMenuItems = _tableInstance$option.renderRowActionMenuItems;
|
|
777
|
+
try {
|
|
778
|
+
isDispatching = true;
|
|
779
|
+
currentState = currentReducer(currentState, action);
|
|
780
|
+
} finally {
|
|
781
|
+
isDispatching = false;
|
|
782
|
+
}
|
|
995
783
|
|
|
996
|
-
|
|
997
|
-
isDensePadding = _getState.isDensePadding;
|
|
784
|
+
var listeners = currentListeners = nextListeners;
|
|
998
785
|
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
onClose: function onClose() {
|
|
1003
|
-
return setAnchorEl(null);
|
|
1004
|
-
},
|
|
1005
|
-
MenuListProps: {
|
|
1006
|
-
dense: isDensePadding
|
|
1007
|
-
}
|
|
1008
|
-
}, enableEditing && React__default.createElement(material.MenuItem, {
|
|
1009
|
-
onClick: handleEdit,
|
|
1010
|
-
sx: commonMenuItemStyles$1
|
|
1011
|
-
}, React__default.createElement(material.Box, {
|
|
1012
|
-
sx: commonListItemStyles
|
|
1013
|
-
}, React__default.createElement(material.ListItemIcon, null, React__default.createElement(EditIcon, null)), localization.edit)), renderRowActionMenuItems == null ? void 0 : renderRowActionMenuItems({
|
|
1014
|
-
row: row,
|
|
1015
|
-
tableInstance: tableInstance,
|
|
1016
|
-
closeMenu: function closeMenu() {
|
|
1017
|
-
return setAnchorEl(null);
|
|
786
|
+
for (var i = 0; i < listeners.length; i++) {
|
|
787
|
+
var listener = listeners[i];
|
|
788
|
+
listener();
|
|
1018
789
|
}
|
|
1019
|
-
}));
|
|
1020
|
-
};
|
|
1021
790
|
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
791
|
+
return action;
|
|
792
|
+
}
|
|
793
|
+
/**
|
|
794
|
+
* Replaces the reducer currently used by the store to calculate the state.
|
|
795
|
+
*
|
|
796
|
+
* You might need this if your app implements code splitting and you want to
|
|
797
|
+
* load some of the reducers dynamically. You might also need this if you
|
|
798
|
+
* implement a hot reloading mechanism for Redux.
|
|
799
|
+
*
|
|
800
|
+
* @param {Function} nextReducer The reducer for the store to use instead.
|
|
801
|
+
* @returns {void}
|
|
802
|
+
*/
|
|
1033
803
|
|
|
1034
|
-
var _getState = getState(),
|
|
1035
|
-
currentEditingRow = _getState.currentEditingRow;
|
|
1036
804
|
|
|
1037
|
-
|
|
1038
|
-
|
|
805
|
+
function replaceReducer(nextReducer) {
|
|
806
|
+
if (typeof nextReducer !== 'function') {
|
|
807
|
+
throw new Error( "Expected the nextReducer to be a function. Instead, received: '" + kindOf(nextReducer));
|
|
808
|
+
}
|
|
1039
809
|
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
810
|
+
currentReducer = nextReducer; // This action has a similiar effect to ActionTypes.INIT.
|
|
811
|
+
// Any reducers that existed in both the new and old rootReducer
|
|
812
|
+
// will receive the previous state. This effectively populates
|
|
813
|
+
// the new state tree with any relevant data from the old one.
|
|
1043
814
|
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
row: currentEditingRow != null ? currentEditingRow : row,
|
|
1047
|
-
tableInstance: tableInstance
|
|
815
|
+
dispatch({
|
|
816
|
+
type: ActionTypes.REPLACE
|
|
1048
817
|
});
|
|
1049
|
-
|
|
1050
|
-
|
|
818
|
+
}
|
|
819
|
+
/**
|
|
820
|
+
* Interoperability point for observable/reactive libraries.
|
|
821
|
+
* @returns {observable} A minimal observable of state changes.
|
|
822
|
+
* For more information, see the observable proposal:
|
|
823
|
+
* https://github.com/tc39/proposal-observable
|
|
824
|
+
*/
|
|
1051
825
|
|
|
1052
|
-
return React__default.createElement(material.Box, {
|
|
1053
|
-
sx: {
|
|
1054
|
-
display: 'flex',
|
|
1055
|
-
gap: '0.75rem'
|
|
1056
|
-
}
|
|
1057
|
-
}, React__default.createElement(material.Tooltip, {
|
|
1058
|
-
arrow: true,
|
|
1059
|
-
title: localization.cancel
|
|
1060
|
-
}, React__default.createElement(material.IconButton, {
|
|
1061
|
-
"aria-label": localization.cancel,
|
|
1062
|
-
onClick: handleCancel
|
|
1063
|
-
}, React__default.createElement(CancelIcon, null))), React__default.createElement(material.Tooltip, {
|
|
1064
|
-
arrow: true,
|
|
1065
|
-
title: localization.save
|
|
1066
|
-
}, React__default.createElement(material.IconButton, {
|
|
1067
|
-
"aria-label": localization.save,
|
|
1068
|
-
color: "info",
|
|
1069
|
-
onClick: handleSave
|
|
1070
|
-
}, React__default.createElement(SaveIcon, null))));
|
|
1071
|
-
};
|
|
1072
|
-
|
|
1073
|
-
var commonIconButtonStyles = {
|
|
1074
|
-
height: '2rem',
|
|
1075
|
-
ml: '10px',
|
|
1076
|
-
opacity: 0.5,
|
|
1077
|
-
transition: 'opacity 0.2s',
|
|
1078
|
-
width: '2rem',
|
|
1079
|
-
'&:hover': {
|
|
1080
|
-
opacity: 1
|
|
1081
|
-
}
|
|
1082
|
-
};
|
|
1083
|
-
var MRT_ToggleRowActionMenuButton = function MRT_ToggleRowActionMenuButton(_ref) {
|
|
1084
|
-
var row = _ref.row,
|
|
1085
|
-
tableInstance = _ref.tableInstance;
|
|
1086
|
-
var getState = tableInstance.getState,
|
|
1087
|
-
_tableInstance$option = tableInstance.options,
|
|
1088
|
-
enableEditing = _tableInstance$option.enableEditing,
|
|
1089
|
-
_tableInstance$option2 = _tableInstance$option.icons,
|
|
1090
|
-
EditIcon = _tableInstance$option2.EditIcon,
|
|
1091
|
-
MoreHorizIcon = _tableInstance$option2.MoreHorizIcon,
|
|
1092
|
-
localization = _tableInstance$option.localization,
|
|
1093
|
-
renderRowActionMenuItems = _tableInstance$option.renderRowActionMenuItems,
|
|
1094
|
-
renderRowActions = _tableInstance$option.renderRowActions,
|
|
1095
|
-
setCurrentEditingRow = tableInstance.setCurrentEditingRow;
|
|
1096
|
-
|
|
1097
|
-
var _getState = getState(),
|
|
1098
|
-
currentEditingRow = _getState.currentEditingRow;
|
|
1099
|
-
|
|
1100
|
-
var _useState = React.useState(null),
|
|
1101
|
-
anchorEl = _useState[0],
|
|
1102
|
-
setAnchorEl = _useState[1];
|
|
1103
|
-
|
|
1104
|
-
var handleOpenRowActionMenu = function handleOpenRowActionMenu(event) {
|
|
1105
|
-
event.stopPropagation();
|
|
1106
|
-
event.preventDefault();
|
|
1107
|
-
setAnchorEl(event.currentTarget);
|
|
1108
|
-
};
|
|
1109
826
|
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
setAnchorEl(null);
|
|
1113
|
-
};
|
|
827
|
+
function observable() {
|
|
828
|
+
var _ref;
|
|
1114
829
|
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
arrow: true,
|
|
1130
|
-
enterDelay: 1000,
|
|
1131
|
-
enterNextDelay: 1000,
|
|
1132
|
-
title: localization.rowActions
|
|
1133
|
-
}, React__default.createElement(material.IconButton, {
|
|
1134
|
-
"aria-label": localization.rowActions,
|
|
1135
|
-
onClick: handleOpenRowActionMenu,
|
|
1136
|
-
size: "small",
|
|
1137
|
-
sx: commonIconButtonStyles
|
|
1138
|
-
}, React__default.createElement(MoreHorizIcon, null))), React__default.createElement(MRT_RowActionMenu, {
|
|
1139
|
-
anchorEl: anchorEl,
|
|
1140
|
-
handleEdit: handleStartEditMode,
|
|
1141
|
-
row: row,
|
|
1142
|
-
setAnchorEl: setAnchorEl,
|
|
1143
|
-
tableInstance: tableInstance
|
|
1144
|
-
})) : null);
|
|
1145
|
-
};
|
|
830
|
+
var outerSubscribe = subscribe;
|
|
831
|
+
return _ref = {
|
|
832
|
+
/**
|
|
833
|
+
* The minimal observable subscription method.
|
|
834
|
+
* @param {Object} observer Any object that can be used as an observer.
|
|
835
|
+
* The observer object should have a `next` method.
|
|
836
|
+
* @returns {subscription} An object with an `unsubscribe` method that can
|
|
837
|
+
* be used to unsubscribe the observable from the store, and prevent further
|
|
838
|
+
* emission of values from the observable.
|
|
839
|
+
*/
|
|
840
|
+
subscribe: function subscribe(observer) {
|
|
841
|
+
if (typeof observer !== 'object' || observer === null) {
|
|
842
|
+
throw new Error( "Expected the observer to be an object. Instead, received: '" + kindOf(observer) + "'");
|
|
843
|
+
}
|
|
1146
844
|
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
getSelectedRowModel = tableInstance.getSelectedRowModel,
|
|
1153
|
-
getState = tableInstance.getState,
|
|
1154
|
-
_tableInstance$option = tableInstance.options,
|
|
1155
|
-
localization = _tableInstance$option.localization,
|
|
1156
|
-
muiSelectCheckboxProps = _tableInstance$option.muiSelectCheckboxProps,
|
|
1157
|
-
onSelectChange = _tableInstance$option.onSelectChange,
|
|
1158
|
-
onSelectAllChange = _tableInstance$option.onSelectAllChange;
|
|
845
|
+
function observeState() {
|
|
846
|
+
if (observer.next) {
|
|
847
|
+
observer.next(getState());
|
|
848
|
+
}
|
|
849
|
+
}
|
|
1159
850
|
|
|
1160
|
-
|
|
1161
|
-
|
|
851
|
+
observeState();
|
|
852
|
+
var unsubscribe = outerSubscribe(observeState);
|
|
853
|
+
return {
|
|
854
|
+
unsubscribe: unsubscribe
|
|
855
|
+
};
|
|
856
|
+
}
|
|
857
|
+
}, _ref[$$observable] = function () {
|
|
858
|
+
return this;
|
|
859
|
+
}, _ref;
|
|
860
|
+
} // When a store is created, an "INIT" action is dispatched so that every
|
|
861
|
+
// reducer returns their initial state. This effectively populates
|
|
862
|
+
// the initial state tree.
|
|
1162
863
|
|
|
1163
|
-
var handleSelectChange = function handleSelectChange(event) {
|
|
1164
|
-
if (selectAll) {
|
|
1165
|
-
tableInstance.getToggleAllRowsSelectedHandler()(event);
|
|
1166
|
-
onSelectAllChange == null ? void 0 : onSelectAllChange({
|
|
1167
|
-
event: event,
|
|
1168
|
-
selectedRows: event.target.checked ? getRowModel().flatRows : [],
|
|
1169
|
-
tableInstance: tableInstance
|
|
1170
|
-
});
|
|
1171
|
-
} else if (row) {
|
|
1172
|
-
row == null ? void 0 : row.getToggleSelectedHandler()(event);
|
|
1173
|
-
onSelectChange == null ? void 0 : onSelectChange({
|
|
1174
|
-
event: event,
|
|
1175
|
-
row: row,
|
|
1176
|
-
selectedRows: event.target.checked ? [].concat(getSelectedRowModel().flatRows, [row]) : getSelectedRowModel().flatRows.filter(function (selectedRow) {
|
|
1177
|
-
return selectedRow.id !== row.id;
|
|
1178
|
-
}),
|
|
1179
|
-
tableInstance: tableInstance
|
|
1180
|
-
});
|
|
1181
|
-
}
|
|
1182
|
-
};
|
|
1183
864
|
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
}, React__default.createElement(material.Checkbox, Object.assign({
|
|
1195
|
-
checked: selectAll ? tableInstance.getIsAllRowsSelected() : row == null ? void 0 : row.getIsSelected(),
|
|
1196
|
-
indeterminate: selectAll ? tableInstance.getIsSomeRowsSelected() : row == null ? void 0 : row.getIsSomeSelected(),
|
|
1197
|
-
inputProps: {
|
|
1198
|
-
'aria-label': selectAll ? localization.toggleSelectAll : localization.toggleSelectRow
|
|
1199
|
-
},
|
|
1200
|
-
onChange: handleSelectChange,
|
|
1201
|
-
size: isDensePadding ? 'small' : 'medium'
|
|
1202
|
-
}, checkboxProps, {
|
|
1203
|
-
sx: _extends({
|
|
1204
|
-
height: isDensePadding ? '1.75rem' : '2.25rem',
|
|
1205
|
-
width: isDensePadding ? '1.75rem' : '2.25rem'
|
|
1206
|
-
}, checkboxProps == null ? void 0 : checkboxProps.sx)
|
|
1207
|
-
})));
|
|
1208
|
-
};
|
|
865
|
+
dispatch({
|
|
866
|
+
type: ActionTypes.INIT
|
|
867
|
+
});
|
|
868
|
+
return _ref2 = {
|
|
869
|
+
dispatch: dispatch,
|
|
870
|
+
subscribe: subscribe,
|
|
871
|
+
getState: getState,
|
|
872
|
+
replaceReducer: replaceReducer
|
|
873
|
+
}, _ref2[$$observable] = observable, _ref2;
|
|
874
|
+
}
|
|
1209
875
|
|
|
1210
876
|
/**
|
|
1211
|
-
*
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
}
|
|
877
|
+
* Prints a warning in the console if it exists.
|
|
878
|
+
*
|
|
879
|
+
* @param {String} message The warning message.
|
|
880
|
+
* @returns {void}
|
|
881
|
+
*/
|
|
882
|
+
function warning(message) {
|
|
883
|
+
/* eslint-disable no-console */
|
|
884
|
+
if (typeof console !== 'undefined' && typeof console.error === 'function') {
|
|
885
|
+
console.error(message);
|
|
886
|
+
}
|
|
887
|
+
/* eslint-enable no-console */
|
|
1215
888
|
|
|
1216
|
-
// Inlined version of the `symbol-observable` polyfill
|
|
1217
|
-
var $$observable = (function () {
|
|
1218
|
-
return typeof Symbol === 'function' && Symbol.observable || '@@observable';
|
|
1219
|
-
})();
|
|
1220
889
|
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
var randomString = function randomString() {
|
|
1228
|
-
return Math.random().toString(36).substring(7).split('').join('.');
|
|
1229
|
-
};
|
|
890
|
+
try {
|
|
891
|
+
// This error was thrown as a convenience so that if you enable
|
|
892
|
+
// "break on all exceptions" in your console,
|
|
893
|
+
// it would pause the execution at this line.
|
|
894
|
+
throw new Error(message);
|
|
895
|
+
} catch (e) {} // eslint-disable-line no-empty
|
|
1230
896
|
|
|
1231
|
-
|
|
1232
|
-
INIT: "@@redux/INIT" + randomString(),
|
|
1233
|
-
REPLACE: "@@redux/REPLACE" + randomString(),
|
|
1234
|
-
PROBE_UNKNOWN_ACTION: function PROBE_UNKNOWN_ACTION() {
|
|
1235
|
-
return "@@redux/PROBE_UNKNOWN_ACTION" + randomString();
|
|
1236
|
-
}
|
|
1237
|
-
};
|
|
897
|
+
}
|
|
1238
898
|
|
|
1239
|
-
|
|
1240
|
-
*
|
|
1241
|
-
*
|
|
899
|
+
/*
|
|
900
|
+
* This is a dummy function to check if the function name has been altered by minification.
|
|
901
|
+
* If the function has been minified and NODE_ENV !== 'production', warn the user.
|
|
1242
902
|
*/
|
|
1243
|
-
function isPlainObject(obj) {
|
|
1244
|
-
if (typeof obj !== 'object' || obj === null) return false;
|
|
1245
|
-
var proto = obj;
|
|
1246
903
|
|
|
1247
|
-
|
|
1248
|
-
proto = Object.getPrototypeOf(proto);
|
|
1249
|
-
}
|
|
904
|
+
function isCrushed() {}
|
|
1250
905
|
|
|
1251
|
-
|
|
906
|
+
if ( typeof isCrushed.name === 'string' && isCrushed.name !== 'isCrushed') {
|
|
907
|
+
warning('You are currently using minified code outside of NODE_ENV === "production". ' + 'This means that you are running a slower development build of Redux. ' + 'You can use loose-envify (https://github.com/zertosh/loose-envify) for browserify ' + 'or setting mode to production in webpack (https://webpack.js.org/concepts/mode/) ' + 'to ensure you have the correct code for your production build.');
|
|
1252
908
|
}
|
|
1253
909
|
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
} // other
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
return type.slice(8, -1).toLowerCase().replace(/\s/g, '');
|
|
910
|
+
/**
|
|
911
|
+
* Use invariant() to assert state which your program assumes to be true.
|
|
912
|
+
*
|
|
913
|
+
* Provide sprintf-style format (only %s is supported) and arguments
|
|
914
|
+
* to provide information about what broke and what you were
|
|
915
|
+
* expecting.
|
|
916
|
+
*
|
|
917
|
+
* The invariant message will be stripped in production, but the invariant
|
|
918
|
+
* will remain to ensure logic does not differ in production.
|
|
919
|
+
*/ function invariant(condition, format, ...args) {
|
|
920
|
+
if (isProduction()) {
|
|
921
|
+
if (format === undefined) {
|
|
922
|
+
throw new Error('invariant requires an error message argument');
|
|
923
|
+
}
|
|
924
|
+
}
|
|
925
|
+
if (!condition) {
|
|
926
|
+
let error;
|
|
927
|
+
if (format === undefined) {
|
|
928
|
+
error = new Error('Minified exception occurred; use the non-minified dev environment ' + 'for the full error message and additional helpful warnings.');
|
|
929
|
+
} else {
|
|
930
|
+
let argIndex = 0;
|
|
931
|
+
error = new Error(format.replace(/%s/g, function() {
|
|
932
|
+
return args[argIndex++];
|
|
933
|
+
}));
|
|
934
|
+
error.name = 'Invariant Violation';
|
|
935
|
+
}
|
|
936
|
+
error.framesToPop = 1 // we don't care about invariant's own frame
|
|
937
|
+
;
|
|
938
|
+
throw error;
|
|
939
|
+
}
|
|
1288
940
|
}
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
return typeof val.constructor === 'function' ? val.constructor.name : null;
|
|
941
|
+
function isProduction() {
|
|
942
|
+
return typeof process !== 'undefined' && process.env['NODE_ENV'] === 'production';
|
|
1292
943
|
}
|
|
1293
944
|
|
|
1294
|
-
|
|
1295
|
-
|
|
945
|
+
// cheap lodash replacements
|
|
946
|
+
/**
|
|
947
|
+
* drop-in replacement for _.get
|
|
948
|
+
* @param obj
|
|
949
|
+
* @param path
|
|
950
|
+
* @param defaultValue
|
|
951
|
+
*/ function get(obj, path, defaultValue) {
|
|
952
|
+
return path.split('.').reduce((a, c)=>a && a[c] ? a[c] : defaultValue || null
|
|
953
|
+
, obj);
|
|
1296
954
|
}
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
955
|
+
/**
|
|
956
|
+
* drop-in replacement for _.without
|
|
957
|
+
*/ function without(items, item) {
|
|
958
|
+
return items.filter((i)=>i !== item
|
|
959
|
+
);
|
|
1301
960
|
}
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
typeOfVal = miniKindOf(val);
|
|
1308
|
-
}
|
|
1309
|
-
|
|
1310
|
-
return typeOfVal;
|
|
961
|
+
/**
|
|
962
|
+
* drop-in replacement for _.isString
|
|
963
|
+
* @param input
|
|
964
|
+
*/ function isObject(input) {
|
|
965
|
+
return typeof input === 'object';
|
|
1311
966
|
}
|
|
1312
|
-
|
|
1313
967
|
/**
|
|
1314
|
-
*
|
|
1315
|
-
*
|
|
1316
|
-
*
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
*
|
|
1334
|
-
*
|
|
1335
|
-
*
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
var _ref2;
|
|
968
|
+
* replacement for _.xor
|
|
969
|
+
* @param itemsA
|
|
970
|
+
* @param itemsB
|
|
971
|
+
*/ function xor(itemsA, itemsB) {
|
|
972
|
+
const map = new Map();
|
|
973
|
+
const insertItem = (item)=>{
|
|
974
|
+
map.set(item, map.has(item) ? map.get(item) + 1 : 1);
|
|
975
|
+
};
|
|
976
|
+
itemsA.forEach(insertItem);
|
|
977
|
+
itemsB.forEach(insertItem);
|
|
978
|
+
const result = [];
|
|
979
|
+
map.forEach((count, key)=>{
|
|
980
|
+
if (count === 1) {
|
|
981
|
+
result.push(key);
|
|
982
|
+
}
|
|
983
|
+
});
|
|
984
|
+
return result;
|
|
985
|
+
}
|
|
986
|
+
/**
|
|
987
|
+
* replacement for _.intersection
|
|
988
|
+
* @param itemsA
|
|
989
|
+
* @param itemsB
|
|
990
|
+
*/ function intersection(itemsA, itemsB) {
|
|
991
|
+
return itemsA.filter((t)=>itemsB.indexOf(t) > -1
|
|
992
|
+
);
|
|
993
|
+
}
|
|
1341
994
|
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
995
|
+
const INIT_COORDS = 'dnd-core/INIT_COORDS';
|
|
996
|
+
const BEGIN_DRAG = 'dnd-core/BEGIN_DRAG';
|
|
997
|
+
const PUBLISH_DRAG_SOURCE = 'dnd-core/PUBLISH_DRAG_SOURCE';
|
|
998
|
+
const HOVER = 'dnd-core/HOVER';
|
|
999
|
+
const DROP = 'dnd-core/DROP';
|
|
1000
|
+
const END_DRAG = 'dnd-core/END_DRAG';
|
|
1345
1001
|
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1002
|
+
function setClientOffset(clientOffset, sourceClientOffset) {
|
|
1003
|
+
return {
|
|
1004
|
+
type: INIT_COORDS,
|
|
1005
|
+
payload: {
|
|
1006
|
+
sourceClientOffset: sourceClientOffset || null,
|
|
1007
|
+
clientOffset: clientOffset || null
|
|
1008
|
+
}
|
|
1009
|
+
};
|
|
1010
|
+
}
|
|
1350
1011
|
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1012
|
+
const ResetCoordinatesAction = {
|
|
1013
|
+
type: INIT_COORDS,
|
|
1014
|
+
payload: {
|
|
1015
|
+
clientOffset: null,
|
|
1016
|
+
sourceClientOffset: null
|
|
1354
1017
|
}
|
|
1018
|
+
};
|
|
1019
|
+
function createBeginDrag(manager) {
|
|
1020
|
+
return function beginDrag(sourceIds = [], options = {
|
|
1021
|
+
publishSource: true
|
|
1022
|
+
}) {
|
|
1023
|
+
const { publishSource =true , clientOffset , getSourceClientOffset , } = options;
|
|
1024
|
+
const monitor = manager.getMonitor();
|
|
1025
|
+
const registry = manager.getRegistry();
|
|
1026
|
+
// Initialize the coordinates using the client offset
|
|
1027
|
+
manager.dispatch(setClientOffset(clientOffset));
|
|
1028
|
+
verifyInvariants(sourceIds, monitor, registry);
|
|
1029
|
+
// Get the draggable source
|
|
1030
|
+
const sourceId = getDraggableSource(sourceIds, monitor);
|
|
1031
|
+
if (sourceId == null) {
|
|
1032
|
+
manager.dispatch(ResetCoordinatesAction);
|
|
1033
|
+
return;
|
|
1034
|
+
}
|
|
1035
|
+
// Get the source client offset
|
|
1036
|
+
let sourceClientOffset = null;
|
|
1037
|
+
if (clientOffset) {
|
|
1038
|
+
if (!getSourceClientOffset) {
|
|
1039
|
+
throw new Error('getSourceClientOffset must be defined');
|
|
1040
|
+
}
|
|
1041
|
+
verifyGetSourceClientOffsetIsFunction(getSourceClientOffset);
|
|
1042
|
+
sourceClientOffset = getSourceClientOffset(sourceId);
|
|
1043
|
+
}
|
|
1044
|
+
// Initialize the full coordinates
|
|
1045
|
+
manager.dispatch(setClientOffset(clientOffset, sourceClientOffset));
|
|
1046
|
+
const source = registry.getSource(sourceId);
|
|
1047
|
+
const item = source.beginDrag(monitor, sourceId);
|
|
1048
|
+
// If source.beginDrag returns null, this is an indicator to cancel the drag
|
|
1049
|
+
if (item == null) {
|
|
1050
|
+
return undefined;
|
|
1051
|
+
}
|
|
1052
|
+
verifyItemIsObject(item);
|
|
1053
|
+
registry.pinSource(sourceId);
|
|
1054
|
+
const itemType = registry.getSourceType(sourceId);
|
|
1055
|
+
return {
|
|
1056
|
+
type: BEGIN_DRAG,
|
|
1057
|
+
payload: {
|
|
1058
|
+
itemType,
|
|
1059
|
+
item,
|
|
1060
|
+
sourceId,
|
|
1061
|
+
clientOffset: clientOffset || null,
|
|
1062
|
+
sourceClientOffset: sourceClientOffset || null,
|
|
1063
|
+
isSourcePublic: !!publishSource
|
|
1064
|
+
}
|
|
1065
|
+
};
|
|
1066
|
+
};
|
|
1067
|
+
}
|
|
1068
|
+
function verifyInvariants(sourceIds, monitor, registry) {
|
|
1069
|
+
invariant(!monitor.isDragging(), 'Cannot call beginDrag while dragging.');
|
|
1070
|
+
sourceIds.forEach(function(sourceId) {
|
|
1071
|
+
invariant(registry.getSource(sourceId), 'Expected sourceIds to be registered.');
|
|
1072
|
+
});
|
|
1073
|
+
}
|
|
1074
|
+
function verifyGetSourceClientOffsetIsFunction(getSourceClientOffset) {
|
|
1075
|
+
invariant(typeof getSourceClientOffset === 'function', 'When clientOffset is provided, getSourceClientOffset must be a function.');
|
|
1076
|
+
}
|
|
1077
|
+
function verifyItemIsObject(item) {
|
|
1078
|
+
invariant(isObject(item), 'Item must be an object.');
|
|
1079
|
+
}
|
|
1080
|
+
function getDraggableSource(sourceIds, monitor) {
|
|
1081
|
+
let sourceId = null;
|
|
1082
|
+
for(let i = sourceIds.length - 1; i >= 0; i--){
|
|
1083
|
+
if (monitor.canDragSource(sourceIds[i])) {
|
|
1084
|
+
sourceId = sourceIds[i];
|
|
1085
|
+
break;
|
|
1086
|
+
}
|
|
1087
|
+
}
|
|
1088
|
+
return sourceId;
|
|
1089
|
+
}
|
|
1355
1090
|
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
var nextListeners = currentListeners;
|
|
1367
|
-
var isDispatching = false;
|
|
1368
|
-
/**
|
|
1369
|
-
* This makes a shallow copy of currentListeners so we can use
|
|
1370
|
-
* nextListeners as a temporary list while dispatching.
|
|
1371
|
-
*
|
|
1372
|
-
* This prevents any bugs around consumers calling
|
|
1373
|
-
* subscribe/unsubscribe in the middle of a dispatch.
|
|
1374
|
-
*/
|
|
1375
|
-
|
|
1376
|
-
function ensureCanMutateNextListeners() {
|
|
1377
|
-
if (nextListeners === currentListeners) {
|
|
1378
|
-
nextListeners = currentListeners.slice();
|
|
1379
|
-
}
|
|
1380
|
-
}
|
|
1381
|
-
/**
|
|
1382
|
-
* Reads the state tree managed by the store.
|
|
1383
|
-
*
|
|
1384
|
-
* @returns {any} The current state tree of your application.
|
|
1385
|
-
*/
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
function getState() {
|
|
1389
|
-
if (isDispatching) {
|
|
1390
|
-
throw new Error( 'You may not call store.getState() while the reducer is executing. ' + 'The reducer has already received the state as an argument. ' + 'Pass it down from the top reducer instead of reading it from the store.');
|
|
1091
|
+
function _defineProperty(obj, key, value) {
|
|
1092
|
+
if (key in obj) {
|
|
1093
|
+
Object.defineProperty(obj, key, {
|
|
1094
|
+
value: value,
|
|
1095
|
+
enumerable: true,
|
|
1096
|
+
configurable: true,
|
|
1097
|
+
writable: true
|
|
1098
|
+
});
|
|
1099
|
+
} else {
|
|
1100
|
+
obj[key] = value;
|
|
1391
1101
|
}
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
* However, the next `dispatch()` call, whether nested or not, will use a more
|
|
1407
|
-
* recent snapshot of the subscription list.
|
|
1408
|
-
*
|
|
1409
|
-
* 2. The listener should not expect to see all state changes, as the state
|
|
1410
|
-
* might have been updated multiple times during a nested `dispatch()` before
|
|
1411
|
-
* the listener is called. It is, however, guaranteed that all subscribers
|
|
1412
|
-
* registered before the `dispatch()` started will be called with the latest
|
|
1413
|
-
* state by the time it exits.
|
|
1414
|
-
*
|
|
1415
|
-
* @param {Function} listener A callback to be invoked on every dispatch.
|
|
1416
|
-
* @returns {Function} A function to remove this change listener.
|
|
1417
|
-
*/
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
function subscribe(listener) {
|
|
1421
|
-
if (typeof listener !== 'function') {
|
|
1422
|
-
throw new Error( "Expected the listener to be a function. Instead, received: '" + kindOf(listener) + "'");
|
|
1102
|
+
return obj;
|
|
1103
|
+
}
|
|
1104
|
+
function _objectSpread(target) {
|
|
1105
|
+
for(var i = 1; i < arguments.length; i++){
|
|
1106
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
1107
|
+
var ownKeys = Object.keys(source);
|
|
1108
|
+
if (typeof Object.getOwnPropertySymbols === 'function') {
|
|
1109
|
+
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
1110
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
1111
|
+
}));
|
|
1112
|
+
}
|
|
1113
|
+
ownKeys.forEach(function(key) {
|
|
1114
|
+
_defineProperty(target, key, source[key]);
|
|
1115
|
+
});
|
|
1423
1116
|
}
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1117
|
+
return target;
|
|
1118
|
+
}
|
|
1119
|
+
function createDrop(manager) {
|
|
1120
|
+
return function drop(options = {}) {
|
|
1121
|
+
const monitor = manager.getMonitor();
|
|
1122
|
+
const registry = manager.getRegistry();
|
|
1123
|
+
verifyInvariants$1(monitor);
|
|
1124
|
+
const targetIds = getDroppableTargets(monitor);
|
|
1125
|
+
// Multiple actions are dispatched here, which is why this doesn't return an action
|
|
1126
|
+
targetIds.forEach((targetId, index)=>{
|
|
1127
|
+
const dropResult = determineDropResult(targetId, index, registry, monitor);
|
|
1128
|
+
const action = {
|
|
1129
|
+
type: DROP,
|
|
1130
|
+
payload: {
|
|
1131
|
+
dropResult: _objectSpread({}, options, dropResult)
|
|
1132
|
+
}
|
|
1133
|
+
};
|
|
1134
|
+
manager.dispatch(action);
|
|
1135
|
+
});
|
|
1136
|
+
};
|
|
1137
|
+
}
|
|
1138
|
+
function verifyInvariants$1(monitor) {
|
|
1139
|
+
invariant(monitor.isDragging(), 'Cannot call drop while not dragging.');
|
|
1140
|
+
invariant(!monitor.didDrop(), 'Cannot call drop twice during one drag operation.');
|
|
1141
|
+
}
|
|
1142
|
+
function determineDropResult(targetId, index, registry, monitor) {
|
|
1143
|
+
const target = registry.getTarget(targetId);
|
|
1144
|
+
let dropResult = target ? target.drop(monitor, targetId) : undefined;
|
|
1145
|
+
verifyDropResultType(dropResult);
|
|
1146
|
+
if (typeof dropResult === 'undefined') {
|
|
1147
|
+
dropResult = index === 0 ? {} : monitor.getDropResult();
|
|
1427
1148
|
}
|
|
1149
|
+
return dropResult;
|
|
1150
|
+
}
|
|
1151
|
+
function verifyDropResultType(dropResult) {
|
|
1152
|
+
invariant(typeof dropResult === 'undefined' || isObject(dropResult), 'Drop result must either be an object or undefined.');
|
|
1153
|
+
}
|
|
1154
|
+
function getDroppableTargets(monitor) {
|
|
1155
|
+
const targetIds = monitor.getTargetIds().filter(monitor.canDropOnTarget, monitor);
|
|
1156
|
+
targetIds.reverse();
|
|
1157
|
+
return targetIds;
|
|
1158
|
+
}
|
|
1428
1159
|
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
var index = nextListeners.indexOf(listener);
|
|
1444
|
-
nextListeners.splice(index, 1);
|
|
1445
|
-
currentListeners = null;
|
|
1160
|
+
function createEndDrag(manager) {
|
|
1161
|
+
return function endDrag() {
|
|
1162
|
+
const monitor = manager.getMonitor();
|
|
1163
|
+
const registry = manager.getRegistry();
|
|
1164
|
+
verifyIsDragging(monitor);
|
|
1165
|
+
const sourceId = monitor.getSourceId();
|
|
1166
|
+
if (sourceId != null) {
|
|
1167
|
+
const source = registry.getSource(sourceId, true);
|
|
1168
|
+
source.endDrag(monitor, sourceId);
|
|
1169
|
+
registry.unpinSource();
|
|
1170
|
+
}
|
|
1171
|
+
return {
|
|
1172
|
+
type: END_DRAG
|
|
1173
|
+
};
|
|
1446
1174
|
};
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
* The `reducer` function, used to create the store, will be called with the
|
|
1452
|
-
* current state tree and the given `action`. Its return value will
|
|
1453
|
-
* be considered the **next** state of the tree, and the change listeners
|
|
1454
|
-
* will be notified.
|
|
1455
|
-
*
|
|
1456
|
-
* The base implementation only supports plain object actions. If you want to
|
|
1457
|
-
* dispatch a Promise, an Observable, a thunk, or something else, you need to
|
|
1458
|
-
* wrap your store creating function into the corresponding middleware. For
|
|
1459
|
-
* example, see the documentation for the `redux-thunk` package. Even the
|
|
1460
|
-
* middleware will eventually dispatch plain object actions using this method.
|
|
1461
|
-
*
|
|
1462
|
-
* @param {Object} action A plain object representing “what changed”. It is
|
|
1463
|
-
* a good idea to keep actions serializable so you can record and replay user
|
|
1464
|
-
* sessions, or use the time travelling `redux-devtools`. An action must have
|
|
1465
|
-
* a `type` property which may not be `undefined`. It is a good idea to use
|
|
1466
|
-
* string constants for action types.
|
|
1467
|
-
*
|
|
1468
|
-
* @returns {Object} For convenience, the same action object you dispatched.
|
|
1469
|
-
*
|
|
1470
|
-
* Note that, if you use a custom middleware, it may wrap `dispatch()` to
|
|
1471
|
-
* return something else (for example, a Promise you can await).
|
|
1472
|
-
*/
|
|
1473
|
-
|
|
1175
|
+
}
|
|
1176
|
+
function verifyIsDragging(monitor) {
|
|
1177
|
+
invariant(monitor.isDragging(), 'Cannot call endDrag while not dragging.');
|
|
1178
|
+
}
|
|
1474
1179
|
|
|
1475
|
-
|
|
1476
|
-
if (
|
|
1477
|
-
|
|
1180
|
+
function matchesType(targetType, draggedItemType) {
|
|
1181
|
+
if (draggedItemType === null) {
|
|
1182
|
+
return targetType === null;
|
|
1478
1183
|
}
|
|
1184
|
+
return Array.isArray(targetType) ? targetType.some((t)=>t === draggedItemType
|
|
1185
|
+
) : targetType === draggedItemType;
|
|
1186
|
+
}
|
|
1479
1187
|
|
|
1480
|
-
|
|
1481
|
-
|
|
1188
|
+
function createHover(manager) {
|
|
1189
|
+
return function hover(targetIdsArg, { clientOffset } = {}) {
|
|
1190
|
+
verifyTargetIdsIsArray(targetIdsArg);
|
|
1191
|
+
const targetIds = targetIdsArg.slice(0);
|
|
1192
|
+
const monitor = manager.getMonitor();
|
|
1193
|
+
const registry = manager.getRegistry();
|
|
1194
|
+
const draggedItemType = monitor.getItemType();
|
|
1195
|
+
removeNonMatchingTargetIds(targetIds, registry, draggedItemType);
|
|
1196
|
+
checkInvariants(targetIds, monitor, registry);
|
|
1197
|
+
hoverAllTargets(targetIds, monitor, registry);
|
|
1198
|
+
return {
|
|
1199
|
+
type: HOVER,
|
|
1200
|
+
payload: {
|
|
1201
|
+
targetIds,
|
|
1202
|
+
clientOffset: clientOffset || null
|
|
1203
|
+
}
|
|
1204
|
+
};
|
|
1205
|
+
};
|
|
1206
|
+
}
|
|
1207
|
+
function verifyTargetIdsIsArray(targetIdsArg) {
|
|
1208
|
+
invariant(Array.isArray(targetIdsArg), 'Expected targetIds to be an array.');
|
|
1209
|
+
}
|
|
1210
|
+
function checkInvariants(targetIds, monitor, registry) {
|
|
1211
|
+
invariant(monitor.isDragging(), 'Cannot call hover while not dragging.');
|
|
1212
|
+
invariant(!monitor.didDrop(), 'Cannot call hover after drop.');
|
|
1213
|
+
for(let i = 0; i < targetIds.length; i++){
|
|
1214
|
+
const targetId = targetIds[i];
|
|
1215
|
+
invariant(targetIds.lastIndexOf(targetId) === i, 'Expected targetIds to be unique in the passed array.');
|
|
1216
|
+
const target = registry.getTarget(targetId);
|
|
1217
|
+
invariant(target, 'Expected targetIds to be registered.');
|
|
1482
1218
|
}
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1219
|
+
}
|
|
1220
|
+
function removeNonMatchingTargetIds(targetIds, registry, draggedItemType) {
|
|
1221
|
+
// Remove those targetIds that don't match the targetType. This
|
|
1222
|
+
// fixes shallow isOver which would only be non-shallow because of
|
|
1223
|
+
// non-matching targets.
|
|
1224
|
+
for(let i = targetIds.length - 1; i >= 0; i--){
|
|
1225
|
+
const targetId = targetIds[i];
|
|
1226
|
+
const targetType = registry.getTargetType(targetId);
|
|
1227
|
+
if (!matchesType(targetType, draggedItemType)) {
|
|
1228
|
+
targetIds.splice(i, 1);
|
|
1229
|
+
}
|
|
1486
1230
|
}
|
|
1231
|
+
}
|
|
1232
|
+
function hoverAllTargets(targetIds, monitor, registry) {
|
|
1233
|
+
// Finally call hover on all matching targets.
|
|
1234
|
+
targetIds.forEach(function(targetId) {
|
|
1235
|
+
const target = registry.getTarget(targetId);
|
|
1236
|
+
target.hover(monitor, targetId);
|
|
1237
|
+
});
|
|
1238
|
+
}
|
|
1487
1239
|
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1240
|
+
function createPublishDragSource(manager) {
|
|
1241
|
+
return function publishDragSource() {
|
|
1242
|
+
const monitor = manager.getMonitor();
|
|
1243
|
+
if (monitor.isDragging()) {
|
|
1244
|
+
return {
|
|
1245
|
+
type: PUBLISH_DRAG_SOURCE
|
|
1246
|
+
};
|
|
1247
|
+
}
|
|
1248
|
+
return;
|
|
1249
|
+
};
|
|
1250
|
+
}
|
|
1494
1251
|
|
|
1495
|
-
|
|
1252
|
+
function createDragDropActions(manager) {
|
|
1253
|
+
return {
|
|
1254
|
+
beginDrag: createBeginDrag(manager),
|
|
1255
|
+
publishDragSource: createPublishDragSource(manager),
|
|
1256
|
+
hover: createHover(manager),
|
|
1257
|
+
drop: createDrop(manager),
|
|
1258
|
+
endDrag: createEndDrag(manager)
|
|
1259
|
+
};
|
|
1260
|
+
}
|
|
1496
1261
|
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1262
|
+
class DragDropManagerImpl {
|
|
1263
|
+
receiveBackend(backend) {
|
|
1264
|
+
this.backend = backend;
|
|
1500
1265
|
}
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
}
|
|
1504
|
-
/**
|
|
1505
|
-
* Replaces the reducer currently used by the store to calculate the state.
|
|
1506
|
-
*
|
|
1507
|
-
* You might need this if your app implements code splitting and you want to
|
|
1508
|
-
* load some of the reducers dynamically. You might also need this if you
|
|
1509
|
-
* implement a hot reloading mechanism for Redux.
|
|
1510
|
-
*
|
|
1511
|
-
* @param {Function} nextReducer The reducer for the store to use instead.
|
|
1512
|
-
* @returns {void}
|
|
1513
|
-
*/
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
function replaceReducer(nextReducer) {
|
|
1517
|
-
if (typeof nextReducer !== 'function') {
|
|
1518
|
-
throw new Error( "Expected the nextReducer to be a function. Instead, received: '" + kindOf(nextReducer));
|
|
1266
|
+
getMonitor() {
|
|
1267
|
+
return this.monitor;
|
|
1519
1268
|
}
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
function observable() {
|
|
1539
|
-
var _ref;
|
|
1540
|
-
|
|
1541
|
-
var outerSubscribe = subscribe;
|
|
1542
|
-
return _ref = {
|
|
1543
|
-
/**
|
|
1544
|
-
* The minimal observable subscription method.
|
|
1545
|
-
* @param {Object} observer Any object that can be used as an observer.
|
|
1546
|
-
* The observer object should have a `next` method.
|
|
1547
|
-
* @returns {subscription} An object with an `unsubscribe` method that can
|
|
1548
|
-
* be used to unsubscribe the observable from the store, and prevent further
|
|
1549
|
-
* emission of values from the observable.
|
|
1550
|
-
*/
|
|
1551
|
-
subscribe: function subscribe(observer) {
|
|
1552
|
-
if (typeof observer !== 'object' || observer === null) {
|
|
1553
|
-
throw new Error( "Expected the observer to be an object. Instead, received: '" + kindOf(observer) + "'");
|
|
1554
|
-
}
|
|
1555
|
-
|
|
1556
|
-
function observeState() {
|
|
1557
|
-
if (observer.next) {
|
|
1558
|
-
observer.next(getState());
|
|
1559
|
-
}
|
|
1269
|
+
getBackend() {
|
|
1270
|
+
return this.backend;
|
|
1271
|
+
}
|
|
1272
|
+
getRegistry() {
|
|
1273
|
+
return this.monitor.registry;
|
|
1274
|
+
}
|
|
1275
|
+
getActions() {
|
|
1276
|
+
/* eslint-disable-next-line @typescript-eslint/no-this-alias */ const manager = this;
|
|
1277
|
+
const { dispatch } = this.store;
|
|
1278
|
+
function bindActionCreator(actionCreator) {
|
|
1279
|
+
return (...args)=>{
|
|
1280
|
+
const action = actionCreator.apply(manager, args);
|
|
1281
|
+
if (typeof action !== 'undefined') {
|
|
1282
|
+
dispatch(action);
|
|
1283
|
+
}
|
|
1284
|
+
};
|
|
1560
1285
|
}
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1286
|
+
const actions = createDragDropActions(this);
|
|
1287
|
+
return Object.keys(actions).reduce((boundActions, key)=>{
|
|
1288
|
+
const action = actions[key];
|
|
1289
|
+
boundActions[key] = bindActionCreator(action);
|
|
1290
|
+
return boundActions;
|
|
1291
|
+
}, {});
|
|
1292
|
+
}
|
|
1293
|
+
dispatch(action) {
|
|
1294
|
+
this.store.dispatch(action);
|
|
1295
|
+
}
|
|
1296
|
+
constructor(store, monitor){
|
|
1297
|
+
this.isSetUp = false;
|
|
1298
|
+
this.handleRefCountChange = ()=>{
|
|
1299
|
+
const shouldSetUp = this.store.getState().refCount > 0;
|
|
1300
|
+
if (this.backend) {
|
|
1301
|
+
if (shouldSetUp && !this.isSetUp) {
|
|
1302
|
+
this.backend.setup();
|
|
1303
|
+
this.isSetUp = true;
|
|
1304
|
+
} else if (!shouldSetUp && this.isSetUp) {
|
|
1305
|
+
this.backend.teardown();
|
|
1306
|
+
this.isSetUp = false;
|
|
1307
|
+
}
|
|
1308
|
+
}
|
|
1566
1309
|
};
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
}
|
|
1571
|
-
} // When a store is created, an "INIT" action is dispatched so that every
|
|
1572
|
-
// reducer returns their initial state. This effectively populates
|
|
1573
|
-
// the initial state tree.
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
dispatch({
|
|
1577
|
-
type: ActionTypes.INIT
|
|
1578
|
-
});
|
|
1579
|
-
return _ref2 = {
|
|
1580
|
-
dispatch: dispatch,
|
|
1581
|
-
subscribe: subscribe,
|
|
1582
|
-
getState: getState,
|
|
1583
|
-
replaceReducer: replaceReducer
|
|
1584
|
-
}, _ref2[$$observable] = observable, _ref2;
|
|
1310
|
+
this.store = store;
|
|
1311
|
+
this.monitor = monitor;
|
|
1312
|
+
store.subscribe(this.handleRefCountChange);
|
|
1313
|
+
}
|
|
1585
1314
|
}
|
|
1586
1315
|
|
|
1587
1316
|
/**
|
|
1588
|
-
*
|
|
1589
|
-
*
|
|
1590
|
-
* @param
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
console.error(message);
|
|
1597
|
-
}
|
|
1598
|
-
/* eslint-enable no-console */
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
try {
|
|
1602
|
-
// This error was thrown as a convenience so that if you enable
|
|
1603
|
-
// "break on all exceptions" in your console,
|
|
1604
|
-
// it would pause the execution at this line.
|
|
1605
|
-
throw new Error(message);
|
|
1606
|
-
} catch (e) {} // eslint-disable-line no-empty
|
|
1607
|
-
|
|
1317
|
+
* Coordinate addition
|
|
1318
|
+
* @param a The first coordinate
|
|
1319
|
+
* @param b The second coordinate
|
|
1320
|
+
*/ function add(a, b) {
|
|
1321
|
+
return {
|
|
1322
|
+
x: a.x + b.x,
|
|
1323
|
+
y: a.y + b.y
|
|
1324
|
+
};
|
|
1608
1325
|
}
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
*
|
|
1612
|
-
*
|
|
1613
|
-
*/
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
warning('You are currently using minified code outside of NODE_ENV === "production". ' + 'This means that you are running a slower development build of Redux. ' + 'You can use loose-envify (https://github.com/zertosh/loose-envify) for browserify ' + 'or setting mode to production in webpack (https://webpack.js.org/concepts/mode/) ' + 'to ensure you have the correct code for your production build.');
|
|
1326
|
+
/**
|
|
1327
|
+
* Coordinate subtraction
|
|
1328
|
+
* @param a The first coordinate
|
|
1329
|
+
* @param b The second coordinate
|
|
1330
|
+
*/ function subtract(a, b) {
|
|
1331
|
+
return {
|
|
1332
|
+
x: a.x - b.x,
|
|
1333
|
+
y: a.y - b.y
|
|
1334
|
+
};
|
|
1619
1335
|
}
|
|
1620
|
-
|
|
1621
1336
|
/**
|
|
1622
|
-
*
|
|
1337
|
+
* Returns the cartesian distance of the drag source component's position, based on its position
|
|
1338
|
+
* at the time when the current drag operation has started, and the movement difference.
|
|
1623
1339
|
*
|
|
1624
|
-
*
|
|
1625
|
-
* to provide information about what broke and what you were
|
|
1626
|
-
* expecting.
|
|
1340
|
+
* Returns null if no item is being dragged.
|
|
1627
1341
|
*
|
|
1628
|
-
*
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
if (
|
|
1632
|
-
|
|
1633
|
-
throw new Error('invariant requires an error message argument');
|
|
1634
|
-
}
|
|
1635
|
-
}
|
|
1636
|
-
if (!condition) {
|
|
1637
|
-
let error;
|
|
1638
|
-
if (format === undefined) {
|
|
1639
|
-
error = new Error('Minified exception occurred; use the non-minified dev environment ' + 'for the full error message and additional helpful warnings.');
|
|
1640
|
-
} else {
|
|
1641
|
-
let argIndex = 0;
|
|
1642
|
-
error = new Error(format.replace(/%s/g, function() {
|
|
1643
|
-
return args[argIndex++];
|
|
1644
|
-
}));
|
|
1645
|
-
error.name = 'Invariant Violation';
|
|
1646
|
-
}
|
|
1647
|
-
error.framesToPop = 1 // we don't care about invariant's own frame
|
|
1648
|
-
;
|
|
1649
|
-
throw error;
|
|
1342
|
+
* @param state The offset state to compute from
|
|
1343
|
+
*/ function getSourceClientOffset(state) {
|
|
1344
|
+
const { clientOffset , initialClientOffset , initialSourceClientOffset } = state;
|
|
1345
|
+
if (!clientOffset || !initialClientOffset || !initialSourceClientOffset) {
|
|
1346
|
+
return null;
|
|
1650
1347
|
}
|
|
1348
|
+
return subtract(add(clientOffset, initialSourceClientOffset), initialClientOffset);
|
|
1651
1349
|
}
|
|
1652
|
-
|
|
1653
|
-
|
|
1350
|
+
/**
|
|
1351
|
+
* Determines the x,y offset between the client offset and the initial client offset
|
|
1352
|
+
*
|
|
1353
|
+
* @param state The offset state to compute from
|
|
1354
|
+
*/ function getDifferenceFromInitialOffset(state) {
|
|
1355
|
+
const { clientOffset , initialClientOffset } = state;
|
|
1356
|
+
if (!clientOffset || !initialClientOffset) {
|
|
1357
|
+
return null;
|
|
1358
|
+
}
|
|
1359
|
+
return subtract(clientOffset, initialClientOffset);
|
|
1654
1360
|
}
|
|
1655
1361
|
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
* @param path
|
|
1661
|
-
* @param defaultValue
|
|
1662
|
-
*/ function get(obj, path, defaultValue) {
|
|
1663
|
-
return path.split('.').reduce((a, c)=>a && a[c] ? a[c] : defaultValue || null
|
|
1664
|
-
, obj);
|
|
1665
|
-
}
|
|
1666
|
-
/**
|
|
1667
|
-
* drop-in replacement for _.without
|
|
1668
|
-
*/ function without(items, item) {
|
|
1669
|
-
return items.filter((i)=>i !== item
|
|
1670
|
-
);
|
|
1671
|
-
}
|
|
1672
|
-
/**
|
|
1673
|
-
* drop-in replacement for _.isString
|
|
1674
|
-
* @param input
|
|
1675
|
-
*/ function isObject(input) {
|
|
1676
|
-
return typeof input === 'object';
|
|
1677
|
-
}
|
|
1678
|
-
/**
|
|
1679
|
-
* replacement for _.xor
|
|
1680
|
-
* @param itemsA
|
|
1681
|
-
* @param itemsB
|
|
1682
|
-
*/ function xor(itemsA, itemsB) {
|
|
1683
|
-
const map = new Map();
|
|
1684
|
-
const insertItem = (item)=>{
|
|
1685
|
-
map.set(item, map.has(item) ? map.get(item) + 1 : 1);
|
|
1686
|
-
};
|
|
1687
|
-
itemsA.forEach(insertItem);
|
|
1688
|
-
itemsB.forEach(insertItem);
|
|
1689
|
-
const result = [];
|
|
1690
|
-
map.forEach((count, key)=>{
|
|
1691
|
-
if (count === 1) {
|
|
1692
|
-
result.push(key);
|
|
1693
|
-
}
|
|
1694
|
-
});
|
|
1695
|
-
return result;
|
|
1696
|
-
}
|
|
1362
|
+
const NONE = [];
|
|
1363
|
+
const ALL = [];
|
|
1364
|
+
NONE.__IS_NONE__ = true;
|
|
1365
|
+
ALL.__IS_ALL__ = true;
|
|
1697
1366
|
/**
|
|
1698
|
-
*
|
|
1699
|
-
*
|
|
1700
|
-
* @param
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
)
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
const
|
|
1710
|
-
|
|
1711
|
-
const END_DRAG = 'dnd-core/END_DRAG';
|
|
1712
|
-
|
|
1713
|
-
function setClientOffset(clientOffset, sourceClientOffset) {
|
|
1714
|
-
return {
|
|
1715
|
-
type: INIT_COORDS,
|
|
1716
|
-
payload: {
|
|
1717
|
-
sourceClientOffset: sourceClientOffset || null,
|
|
1718
|
-
clientOffset: clientOffset || null
|
|
1719
|
-
}
|
|
1720
|
-
};
|
|
1367
|
+
* Determines if the given handler IDs are dirty or not.
|
|
1368
|
+
*
|
|
1369
|
+
* @param dirtyIds The set of dirty handler ids
|
|
1370
|
+
* @param handlerIds The set of handler ids to check
|
|
1371
|
+
*/ function areDirty(dirtyIds, handlerIds) {
|
|
1372
|
+
if (dirtyIds === NONE) {
|
|
1373
|
+
return false;
|
|
1374
|
+
}
|
|
1375
|
+
if (dirtyIds === ALL || typeof handlerIds === 'undefined') {
|
|
1376
|
+
return true;
|
|
1377
|
+
}
|
|
1378
|
+
const commonIds = intersection(handlerIds, dirtyIds);
|
|
1379
|
+
return commonIds.length > 0;
|
|
1721
1380
|
}
|
|
1722
1381
|
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1382
|
+
class DragDropMonitorImpl {
|
|
1383
|
+
subscribeToStateChange(listener, options = {}) {
|
|
1384
|
+
const { handlerIds } = options;
|
|
1385
|
+
invariant(typeof listener === 'function', 'listener must be a function.');
|
|
1386
|
+
invariant(typeof handlerIds === 'undefined' || Array.isArray(handlerIds), 'handlerIds, when specified, must be an array of strings.');
|
|
1387
|
+
let prevStateId = this.store.getState().stateId;
|
|
1388
|
+
const handleChange = ()=>{
|
|
1389
|
+
const state = this.store.getState();
|
|
1390
|
+
const currentStateId = state.stateId;
|
|
1391
|
+
try {
|
|
1392
|
+
const canSkipListener = currentStateId === prevStateId || currentStateId === prevStateId + 1 && !areDirty(state.dirtyHandlerIds, handlerIds);
|
|
1393
|
+
if (!canSkipListener) {
|
|
1394
|
+
listener();
|
|
1395
|
+
}
|
|
1396
|
+
} finally{
|
|
1397
|
+
prevStateId = currentStateId;
|
|
1398
|
+
}
|
|
1399
|
+
};
|
|
1400
|
+
return this.store.subscribe(handleChange);
|
|
1728
1401
|
}
|
|
1729
|
-
|
|
1730
|
-
function
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
const registry = manager.getRegistry();
|
|
1737
|
-
// Initialize the coordinates using the client offset
|
|
1738
|
-
manager.dispatch(setClientOffset(clientOffset));
|
|
1739
|
-
verifyInvariants(sourceIds, monitor, registry);
|
|
1740
|
-
// Get the draggable source
|
|
1741
|
-
const sourceId = getDraggableSource(sourceIds, monitor);
|
|
1742
|
-
if (sourceId == null) {
|
|
1743
|
-
manager.dispatch(ResetCoordinatesAction);
|
|
1744
|
-
return;
|
|
1745
|
-
}
|
|
1746
|
-
// Get the source client offset
|
|
1747
|
-
let sourceClientOffset = null;
|
|
1748
|
-
if (clientOffset) {
|
|
1749
|
-
if (!getSourceClientOffset) {
|
|
1750
|
-
throw new Error('getSourceClientOffset must be defined');
|
|
1402
|
+
subscribeToOffsetChange(listener) {
|
|
1403
|
+
invariant(typeof listener === 'function', 'listener must be a function.');
|
|
1404
|
+
let previousState = this.store.getState().dragOffset;
|
|
1405
|
+
const handleChange = ()=>{
|
|
1406
|
+
const nextState = this.store.getState().dragOffset;
|
|
1407
|
+
if (nextState === previousState) {
|
|
1408
|
+
return;
|
|
1751
1409
|
}
|
|
1752
|
-
|
|
1753
|
-
|
|
1410
|
+
previousState = nextState;
|
|
1411
|
+
listener();
|
|
1412
|
+
};
|
|
1413
|
+
return this.store.subscribe(handleChange);
|
|
1414
|
+
}
|
|
1415
|
+
canDragSource(sourceId) {
|
|
1416
|
+
if (!sourceId) {
|
|
1417
|
+
return false;
|
|
1754
1418
|
}
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
// If source.beginDrag returns null, this is an indicator to cancel the drag
|
|
1760
|
-
if (item == null) {
|
|
1761
|
-
return undefined;
|
|
1419
|
+
const source = this.registry.getSource(sourceId);
|
|
1420
|
+
invariant(source, `Expected to find a valid source. sourceId=${sourceId}`);
|
|
1421
|
+
if (this.isDragging()) {
|
|
1422
|
+
return false;
|
|
1762
1423
|
}
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
isSourcePublic: !!publishSource
|
|
1775
|
-
}
|
|
1776
|
-
};
|
|
1777
|
-
};
|
|
1778
|
-
}
|
|
1779
|
-
function verifyInvariants(sourceIds, monitor, registry) {
|
|
1780
|
-
invariant(!monitor.isDragging(), 'Cannot call beginDrag while dragging.');
|
|
1781
|
-
sourceIds.forEach(function(sourceId) {
|
|
1782
|
-
invariant(registry.getSource(sourceId), 'Expected sourceIds to be registered.');
|
|
1783
|
-
});
|
|
1784
|
-
}
|
|
1785
|
-
function verifyGetSourceClientOffsetIsFunction(getSourceClientOffset) {
|
|
1786
|
-
invariant(typeof getSourceClientOffset === 'function', 'When clientOffset is provided, getSourceClientOffset must be a function.');
|
|
1787
|
-
}
|
|
1788
|
-
function verifyItemIsObject(item) {
|
|
1789
|
-
invariant(isObject(item), 'Item must be an object.');
|
|
1790
|
-
}
|
|
1791
|
-
function getDraggableSource(sourceIds, monitor) {
|
|
1792
|
-
let sourceId = null;
|
|
1793
|
-
for(let i = sourceIds.length - 1; i >= 0; i--){
|
|
1794
|
-
if (monitor.canDragSource(sourceIds[i])) {
|
|
1795
|
-
sourceId = sourceIds[i];
|
|
1796
|
-
break;
|
|
1424
|
+
return source.canDrag(this, sourceId);
|
|
1425
|
+
}
|
|
1426
|
+
canDropOnTarget(targetId) {
|
|
1427
|
+
// undefined on initial render
|
|
1428
|
+
if (!targetId) {
|
|
1429
|
+
return false;
|
|
1430
|
+
}
|
|
1431
|
+
const target = this.registry.getTarget(targetId);
|
|
1432
|
+
invariant(target, `Expected to find a valid target. targetId=${targetId}`);
|
|
1433
|
+
if (!this.isDragging() || this.didDrop()) {
|
|
1434
|
+
return false;
|
|
1797
1435
|
}
|
|
1436
|
+
const targetType = this.registry.getTargetType(targetId);
|
|
1437
|
+
const draggedItemType = this.getItemType();
|
|
1438
|
+
return matchesType(targetType, draggedItemType) && target.canDrop(this, targetId);
|
|
1798
1439
|
}
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
function _defineProperty(obj, key, value) {
|
|
1803
|
-
if (key in obj) {
|
|
1804
|
-
Object.defineProperty(obj, key, {
|
|
1805
|
-
value: value,
|
|
1806
|
-
enumerable: true,
|
|
1807
|
-
configurable: true,
|
|
1808
|
-
writable: true
|
|
1809
|
-
});
|
|
1810
|
-
} else {
|
|
1811
|
-
obj[key] = value;
|
|
1440
|
+
isDragging() {
|
|
1441
|
+
return Boolean(this.getItemType());
|
|
1812
1442
|
}
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
var source = arguments[i] != null ? arguments[i] : {};
|
|
1818
|
-
var ownKeys = Object.keys(source);
|
|
1819
|
-
if (typeof Object.getOwnPropertySymbols === 'function') {
|
|
1820
|
-
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
1821
|
-
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
1822
|
-
}));
|
|
1443
|
+
isDraggingSource(sourceId) {
|
|
1444
|
+
// undefined on initial render
|
|
1445
|
+
if (!sourceId) {
|
|
1446
|
+
return false;
|
|
1823
1447
|
}
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1448
|
+
const source = this.registry.getSource(sourceId, true);
|
|
1449
|
+
invariant(source, `Expected to find a valid source. sourceId=${sourceId}`);
|
|
1450
|
+
if (!this.isDragging() || !this.isSourcePublic()) {
|
|
1451
|
+
return false;
|
|
1452
|
+
}
|
|
1453
|
+
const sourceType = this.registry.getSourceType(sourceId);
|
|
1454
|
+
const draggedItemType = this.getItemType();
|
|
1455
|
+
if (sourceType !== draggedItemType) {
|
|
1456
|
+
return false;
|
|
1457
|
+
}
|
|
1458
|
+
return source.isDragging(this, sourceId);
|
|
1827
1459
|
}
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
const
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
function determineDropResult(targetId, index, registry, monitor) {
|
|
1854
|
-
const target = registry.getTarget(targetId);
|
|
1855
|
-
let dropResult = target ? target.drop(monitor, targetId) : undefined;
|
|
1856
|
-
verifyDropResultType(dropResult);
|
|
1857
|
-
if (typeof dropResult === 'undefined') {
|
|
1858
|
-
dropResult = index === 0 ? {} : monitor.getDropResult();
|
|
1859
|
-
}
|
|
1860
|
-
return dropResult;
|
|
1861
|
-
}
|
|
1862
|
-
function verifyDropResultType(dropResult) {
|
|
1863
|
-
invariant(typeof dropResult === 'undefined' || isObject(dropResult), 'Drop result must either be an object or undefined.');
|
|
1864
|
-
}
|
|
1865
|
-
function getDroppableTargets(monitor) {
|
|
1866
|
-
const targetIds = monitor.getTargetIds().filter(monitor.canDropOnTarget, monitor);
|
|
1867
|
-
targetIds.reverse();
|
|
1868
|
-
return targetIds;
|
|
1869
|
-
}
|
|
1870
|
-
|
|
1871
|
-
function createEndDrag(manager) {
|
|
1872
|
-
return function endDrag() {
|
|
1873
|
-
const monitor = manager.getMonitor();
|
|
1874
|
-
const registry = manager.getRegistry();
|
|
1875
|
-
verifyIsDragging(monitor);
|
|
1876
|
-
const sourceId = monitor.getSourceId();
|
|
1877
|
-
if (sourceId != null) {
|
|
1878
|
-
const source = registry.getSource(sourceId, true);
|
|
1879
|
-
source.endDrag(monitor, sourceId);
|
|
1880
|
-
registry.unpinSource();
|
|
1460
|
+
isOverTarget(targetId, options = {
|
|
1461
|
+
shallow: false
|
|
1462
|
+
}) {
|
|
1463
|
+
// undefined on initial render
|
|
1464
|
+
if (!targetId) {
|
|
1465
|
+
return false;
|
|
1466
|
+
}
|
|
1467
|
+
const { shallow } = options;
|
|
1468
|
+
if (!this.isDragging()) {
|
|
1469
|
+
return false;
|
|
1470
|
+
}
|
|
1471
|
+
const targetType = this.registry.getTargetType(targetId);
|
|
1472
|
+
const draggedItemType = this.getItemType();
|
|
1473
|
+
if (draggedItemType && !matchesType(targetType, draggedItemType)) {
|
|
1474
|
+
return false;
|
|
1475
|
+
}
|
|
1476
|
+
const targetIds = this.getTargetIds();
|
|
1477
|
+
if (!targetIds.length) {
|
|
1478
|
+
return false;
|
|
1479
|
+
}
|
|
1480
|
+
const index = targetIds.indexOf(targetId);
|
|
1481
|
+
if (shallow) {
|
|
1482
|
+
return index === targetIds.length - 1;
|
|
1483
|
+
} else {
|
|
1484
|
+
return index > -1;
|
|
1881
1485
|
}
|
|
1882
|
-
return {
|
|
1883
|
-
type: END_DRAG
|
|
1884
|
-
};
|
|
1885
|
-
};
|
|
1886
|
-
}
|
|
1887
|
-
function verifyIsDragging(monitor) {
|
|
1888
|
-
invariant(monitor.isDragging(), 'Cannot call endDrag while not dragging.');
|
|
1889
|
-
}
|
|
1890
|
-
|
|
1891
|
-
function matchesType(targetType, draggedItemType) {
|
|
1892
|
-
if (draggedItemType === null) {
|
|
1893
|
-
return targetType === null;
|
|
1894
1486
|
}
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
}
|
|
1898
|
-
|
|
1899
|
-
function createHover(manager) {
|
|
1900
|
-
return function hover(targetIdsArg, { clientOffset } = {}) {
|
|
1901
|
-
verifyTargetIdsIsArray(targetIdsArg);
|
|
1902
|
-
const targetIds = targetIdsArg.slice(0);
|
|
1903
|
-
const monitor = manager.getMonitor();
|
|
1904
|
-
const registry = manager.getRegistry();
|
|
1905
|
-
const draggedItemType = monitor.getItemType();
|
|
1906
|
-
removeNonMatchingTargetIds(targetIds, registry, draggedItemType);
|
|
1907
|
-
checkInvariants(targetIds, monitor, registry);
|
|
1908
|
-
hoverAllTargets(targetIds, monitor, registry);
|
|
1909
|
-
return {
|
|
1910
|
-
type: HOVER,
|
|
1911
|
-
payload: {
|
|
1912
|
-
targetIds,
|
|
1913
|
-
clientOffset: clientOffset || null
|
|
1914
|
-
}
|
|
1915
|
-
};
|
|
1916
|
-
};
|
|
1917
|
-
}
|
|
1918
|
-
function verifyTargetIdsIsArray(targetIdsArg) {
|
|
1919
|
-
invariant(Array.isArray(targetIdsArg), 'Expected targetIds to be an array.');
|
|
1920
|
-
}
|
|
1921
|
-
function checkInvariants(targetIds, monitor, registry) {
|
|
1922
|
-
invariant(monitor.isDragging(), 'Cannot call hover while not dragging.');
|
|
1923
|
-
invariant(!monitor.didDrop(), 'Cannot call hover after drop.');
|
|
1924
|
-
for(let i = 0; i < targetIds.length; i++){
|
|
1925
|
-
const targetId = targetIds[i];
|
|
1926
|
-
invariant(targetIds.lastIndexOf(targetId) === i, 'Expected targetIds to be unique in the passed array.');
|
|
1927
|
-
const target = registry.getTarget(targetId);
|
|
1928
|
-
invariant(target, 'Expected targetIds to be registered.');
|
|
1487
|
+
getItemType() {
|
|
1488
|
+
return this.store.getState().dragOperation.itemType;
|
|
1929
1489
|
}
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
// Remove those targetIds that don't match the targetType. This
|
|
1933
|
-
// fixes shallow isOver which would only be non-shallow because of
|
|
1934
|
-
// non-matching targets.
|
|
1935
|
-
for(let i = targetIds.length - 1; i >= 0; i--){
|
|
1936
|
-
const targetId = targetIds[i];
|
|
1937
|
-
const targetType = registry.getTargetType(targetId);
|
|
1938
|
-
if (!matchesType(targetType, draggedItemType)) {
|
|
1939
|
-
targetIds.splice(i, 1);
|
|
1940
|
-
}
|
|
1490
|
+
getItem() {
|
|
1491
|
+
return this.store.getState().dragOperation.item;
|
|
1941
1492
|
}
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
// Finally call hover on all matching targets.
|
|
1945
|
-
targetIds.forEach(function(targetId) {
|
|
1946
|
-
const target = registry.getTarget(targetId);
|
|
1947
|
-
target.hover(monitor, targetId);
|
|
1948
|
-
});
|
|
1949
|
-
}
|
|
1950
|
-
|
|
1951
|
-
function createPublishDragSource(manager) {
|
|
1952
|
-
return function publishDragSource() {
|
|
1953
|
-
const monitor = manager.getMonitor();
|
|
1954
|
-
if (monitor.isDragging()) {
|
|
1955
|
-
return {
|
|
1956
|
-
type: PUBLISH_DRAG_SOURCE
|
|
1957
|
-
};
|
|
1958
|
-
}
|
|
1959
|
-
return;
|
|
1960
|
-
};
|
|
1961
|
-
}
|
|
1962
|
-
|
|
1963
|
-
function createDragDropActions(manager) {
|
|
1964
|
-
return {
|
|
1965
|
-
beginDrag: createBeginDrag(manager),
|
|
1966
|
-
publishDragSource: createPublishDragSource(manager),
|
|
1967
|
-
hover: createHover(manager),
|
|
1968
|
-
drop: createDrop(manager),
|
|
1969
|
-
endDrag: createEndDrag(manager)
|
|
1970
|
-
};
|
|
1971
|
-
}
|
|
1972
|
-
|
|
1973
|
-
class DragDropManagerImpl {
|
|
1974
|
-
receiveBackend(backend) {
|
|
1975
|
-
this.backend = backend;
|
|
1493
|
+
getSourceId() {
|
|
1494
|
+
return this.store.getState().dragOperation.sourceId;
|
|
1976
1495
|
}
|
|
1977
|
-
|
|
1978
|
-
return this.
|
|
1496
|
+
getTargetIds() {
|
|
1497
|
+
return this.store.getState().dragOperation.targetIds;
|
|
1979
1498
|
}
|
|
1980
|
-
|
|
1981
|
-
return this.
|
|
1499
|
+
getDropResult() {
|
|
1500
|
+
return this.store.getState().dragOperation.dropResult;
|
|
1982
1501
|
}
|
|
1983
|
-
|
|
1984
|
-
return this.
|
|
1502
|
+
didDrop() {
|
|
1503
|
+
return this.store.getState().dragOperation.didDrop;
|
|
1985
1504
|
}
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
const { dispatch } = this.store;
|
|
1989
|
-
function bindActionCreator(actionCreator) {
|
|
1990
|
-
return (...args)=>{
|
|
1991
|
-
const action = actionCreator.apply(manager, args);
|
|
1992
|
-
if (typeof action !== 'undefined') {
|
|
1993
|
-
dispatch(action);
|
|
1994
|
-
}
|
|
1995
|
-
};
|
|
1996
|
-
}
|
|
1997
|
-
const actions = createDragDropActions(this);
|
|
1998
|
-
return Object.keys(actions).reduce((boundActions, key)=>{
|
|
1999
|
-
const action = actions[key];
|
|
2000
|
-
boundActions[key] = bindActionCreator(action);
|
|
2001
|
-
return boundActions;
|
|
2002
|
-
}, {});
|
|
1505
|
+
isSourcePublic() {
|
|
1506
|
+
return Boolean(this.store.getState().dragOperation.isSourcePublic);
|
|
2003
1507
|
}
|
|
2004
|
-
|
|
2005
|
-
this.store.
|
|
1508
|
+
getInitialClientOffset() {
|
|
1509
|
+
return this.store.getState().dragOffset.initialClientOffset;
|
|
2006
1510
|
}
|
|
2007
|
-
|
|
2008
|
-
this.
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
};
|
|
1511
|
+
getInitialSourceClientOffset() {
|
|
1512
|
+
return this.store.getState().dragOffset.initialSourceClientOffset;
|
|
1513
|
+
}
|
|
1514
|
+
getClientOffset() {
|
|
1515
|
+
return this.store.getState().dragOffset.clientOffset;
|
|
1516
|
+
}
|
|
1517
|
+
getSourceClientOffset() {
|
|
1518
|
+
return getSourceClientOffset(this.store.getState().dragOffset);
|
|
1519
|
+
}
|
|
1520
|
+
getDifferenceFromInitialOffset() {
|
|
1521
|
+
return getDifferenceFromInitialOffset(this.store.getState().dragOffset);
|
|
1522
|
+
}
|
|
1523
|
+
constructor(store, registry){
|
|
2021
1524
|
this.store = store;
|
|
2022
|
-
this.
|
|
2023
|
-
store.subscribe(this.handleRefCountChange);
|
|
2024
|
-
}
|
|
2025
|
-
}
|
|
2026
|
-
|
|
2027
|
-
/**
|
|
2028
|
-
* Coordinate addition
|
|
2029
|
-
* @param a The first coordinate
|
|
2030
|
-
* @param b The second coordinate
|
|
2031
|
-
*/ function add(a, b) {
|
|
2032
|
-
return {
|
|
2033
|
-
x: a.x + b.x,
|
|
2034
|
-
y: a.y + b.y
|
|
2035
|
-
};
|
|
2036
|
-
}
|
|
2037
|
-
/**
|
|
2038
|
-
* Coordinate subtraction
|
|
2039
|
-
* @param a The first coordinate
|
|
2040
|
-
* @param b The second coordinate
|
|
2041
|
-
*/ function subtract(a, b) {
|
|
2042
|
-
return {
|
|
2043
|
-
x: a.x - b.x,
|
|
2044
|
-
y: a.y - b.y
|
|
2045
|
-
};
|
|
2046
|
-
}
|
|
2047
|
-
/**
|
|
2048
|
-
* Returns the cartesian distance of the drag source component's position, based on its position
|
|
2049
|
-
* at the time when the current drag operation has started, and the movement difference.
|
|
2050
|
-
*
|
|
2051
|
-
* Returns null if no item is being dragged.
|
|
2052
|
-
*
|
|
2053
|
-
* @param state The offset state to compute from
|
|
2054
|
-
*/ function getSourceClientOffset(state) {
|
|
2055
|
-
const { clientOffset , initialClientOffset , initialSourceClientOffset } = state;
|
|
2056
|
-
if (!clientOffset || !initialClientOffset || !initialSourceClientOffset) {
|
|
2057
|
-
return null;
|
|
2058
|
-
}
|
|
2059
|
-
return subtract(add(clientOffset, initialSourceClientOffset), initialClientOffset);
|
|
2060
|
-
}
|
|
2061
|
-
/**
|
|
2062
|
-
* Determines the x,y offset between the client offset and the initial client offset
|
|
2063
|
-
*
|
|
2064
|
-
* @param state The offset state to compute from
|
|
2065
|
-
*/ function getDifferenceFromInitialOffset(state) {
|
|
2066
|
-
const { clientOffset , initialClientOffset } = state;
|
|
2067
|
-
if (!clientOffset || !initialClientOffset) {
|
|
2068
|
-
return null;
|
|
2069
|
-
}
|
|
2070
|
-
return subtract(clientOffset, initialClientOffset);
|
|
2071
|
-
}
|
|
2072
|
-
|
|
2073
|
-
const NONE = [];
|
|
2074
|
-
const ALL = [];
|
|
2075
|
-
NONE.__IS_NONE__ = true;
|
|
2076
|
-
ALL.__IS_ALL__ = true;
|
|
2077
|
-
/**
|
|
2078
|
-
* Determines if the given handler IDs are dirty or not.
|
|
2079
|
-
*
|
|
2080
|
-
* @param dirtyIds The set of dirty handler ids
|
|
2081
|
-
* @param handlerIds The set of handler ids to check
|
|
2082
|
-
*/ function areDirty(dirtyIds, handlerIds) {
|
|
2083
|
-
if (dirtyIds === NONE) {
|
|
2084
|
-
return false;
|
|
2085
|
-
}
|
|
2086
|
-
if (dirtyIds === ALL || typeof handlerIds === 'undefined') {
|
|
2087
|
-
return true;
|
|
2088
|
-
}
|
|
2089
|
-
const commonIds = intersection(handlerIds, dirtyIds);
|
|
2090
|
-
return commonIds.length > 0;
|
|
2091
|
-
}
|
|
2092
|
-
|
|
2093
|
-
class DragDropMonitorImpl {
|
|
2094
|
-
subscribeToStateChange(listener, options = {}) {
|
|
2095
|
-
const { handlerIds } = options;
|
|
2096
|
-
invariant(typeof listener === 'function', 'listener must be a function.');
|
|
2097
|
-
invariant(typeof handlerIds === 'undefined' || Array.isArray(handlerIds), 'handlerIds, when specified, must be an array of strings.');
|
|
2098
|
-
let prevStateId = this.store.getState().stateId;
|
|
2099
|
-
const handleChange = ()=>{
|
|
2100
|
-
const state = this.store.getState();
|
|
2101
|
-
const currentStateId = state.stateId;
|
|
2102
|
-
try {
|
|
2103
|
-
const canSkipListener = currentStateId === prevStateId || currentStateId === prevStateId + 1 && !areDirty(state.dirtyHandlerIds, handlerIds);
|
|
2104
|
-
if (!canSkipListener) {
|
|
2105
|
-
listener();
|
|
2106
|
-
}
|
|
2107
|
-
} finally{
|
|
2108
|
-
prevStateId = currentStateId;
|
|
2109
|
-
}
|
|
2110
|
-
};
|
|
2111
|
-
return this.store.subscribe(handleChange);
|
|
2112
|
-
}
|
|
2113
|
-
subscribeToOffsetChange(listener) {
|
|
2114
|
-
invariant(typeof listener === 'function', 'listener must be a function.');
|
|
2115
|
-
let previousState = this.store.getState().dragOffset;
|
|
2116
|
-
const handleChange = ()=>{
|
|
2117
|
-
const nextState = this.store.getState().dragOffset;
|
|
2118
|
-
if (nextState === previousState) {
|
|
2119
|
-
return;
|
|
2120
|
-
}
|
|
2121
|
-
previousState = nextState;
|
|
2122
|
-
listener();
|
|
2123
|
-
};
|
|
2124
|
-
return this.store.subscribe(handleChange);
|
|
2125
|
-
}
|
|
2126
|
-
canDragSource(sourceId) {
|
|
2127
|
-
if (!sourceId) {
|
|
2128
|
-
return false;
|
|
2129
|
-
}
|
|
2130
|
-
const source = this.registry.getSource(sourceId);
|
|
2131
|
-
invariant(source, `Expected to find a valid source. sourceId=${sourceId}`);
|
|
2132
|
-
if (this.isDragging()) {
|
|
2133
|
-
return false;
|
|
2134
|
-
}
|
|
2135
|
-
return source.canDrag(this, sourceId);
|
|
2136
|
-
}
|
|
2137
|
-
canDropOnTarget(targetId) {
|
|
2138
|
-
// undefined on initial render
|
|
2139
|
-
if (!targetId) {
|
|
2140
|
-
return false;
|
|
2141
|
-
}
|
|
2142
|
-
const target = this.registry.getTarget(targetId);
|
|
2143
|
-
invariant(target, `Expected to find a valid target. targetId=${targetId}`);
|
|
2144
|
-
if (!this.isDragging() || this.didDrop()) {
|
|
2145
|
-
return false;
|
|
2146
|
-
}
|
|
2147
|
-
const targetType = this.registry.getTargetType(targetId);
|
|
2148
|
-
const draggedItemType = this.getItemType();
|
|
2149
|
-
return matchesType(targetType, draggedItemType) && target.canDrop(this, targetId);
|
|
2150
|
-
}
|
|
2151
|
-
isDragging() {
|
|
2152
|
-
return Boolean(this.getItemType());
|
|
2153
|
-
}
|
|
2154
|
-
isDraggingSource(sourceId) {
|
|
2155
|
-
// undefined on initial render
|
|
2156
|
-
if (!sourceId) {
|
|
2157
|
-
return false;
|
|
2158
|
-
}
|
|
2159
|
-
const source = this.registry.getSource(sourceId, true);
|
|
2160
|
-
invariant(source, `Expected to find a valid source. sourceId=${sourceId}`);
|
|
2161
|
-
if (!this.isDragging() || !this.isSourcePublic()) {
|
|
2162
|
-
return false;
|
|
2163
|
-
}
|
|
2164
|
-
const sourceType = this.registry.getSourceType(sourceId);
|
|
2165
|
-
const draggedItemType = this.getItemType();
|
|
2166
|
-
if (sourceType !== draggedItemType) {
|
|
2167
|
-
return false;
|
|
2168
|
-
}
|
|
2169
|
-
return source.isDragging(this, sourceId);
|
|
2170
|
-
}
|
|
2171
|
-
isOverTarget(targetId, options = {
|
|
2172
|
-
shallow: false
|
|
2173
|
-
}) {
|
|
2174
|
-
// undefined on initial render
|
|
2175
|
-
if (!targetId) {
|
|
2176
|
-
return false;
|
|
2177
|
-
}
|
|
2178
|
-
const { shallow } = options;
|
|
2179
|
-
if (!this.isDragging()) {
|
|
2180
|
-
return false;
|
|
2181
|
-
}
|
|
2182
|
-
const targetType = this.registry.getTargetType(targetId);
|
|
2183
|
-
const draggedItemType = this.getItemType();
|
|
2184
|
-
if (draggedItemType && !matchesType(targetType, draggedItemType)) {
|
|
2185
|
-
return false;
|
|
2186
|
-
}
|
|
2187
|
-
const targetIds = this.getTargetIds();
|
|
2188
|
-
if (!targetIds.length) {
|
|
2189
|
-
return false;
|
|
2190
|
-
}
|
|
2191
|
-
const index = targetIds.indexOf(targetId);
|
|
2192
|
-
if (shallow) {
|
|
2193
|
-
return index === targetIds.length - 1;
|
|
2194
|
-
} else {
|
|
2195
|
-
return index > -1;
|
|
2196
|
-
}
|
|
2197
|
-
}
|
|
2198
|
-
getItemType() {
|
|
2199
|
-
return this.store.getState().dragOperation.itemType;
|
|
2200
|
-
}
|
|
2201
|
-
getItem() {
|
|
2202
|
-
return this.store.getState().dragOperation.item;
|
|
2203
|
-
}
|
|
2204
|
-
getSourceId() {
|
|
2205
|
-
return this.store.getState().dragOperation.sourceId;
|
|
2206
|
-
}
|
|
2207
|
-
getTargetIds() {
|
|
2208
|
-
return this.store.getState().dragOperation.targetIds;
|
|
2209
|
-
}
|
|
2210
|
-
getDropResult() {
|
|
2211
|
-
return this.store.getState().dragOperation.dropResult;
|
|
2212
|
-
}
|
|
2213
|
-
didDrop() {
|
|
2214
|
-
return this.store.getState().dragOperation.didDrop;
|
|
2215
|
-
}
|
|
2216
|
-
isSourcePublic() {
|
|
2217
|
-
return Boolean(this.store.getState().dragOperation.isSourcePublic);
|
|
2218
|
-
}
|
|
2219
|
-
getInitialClientOffset() {
|
|
2220
|
-
return this.store.getState().dragOffset.initialClientOffset;
|
|
2221
|
-
}
|
|
2222
|
-
getInitialSourceClientOffset() {
|
|
2223
|
-
return this.store.getState().dragOffset.initialSourceClientOffset;
|
|
2224
|
-
}
|
|
2225
|
-
getClientOffset() {
|
|
2226
|
-
return this.store.getState().dragOffset.clientOffset;
|
|
2227
|
-
}
|
|
2228
|
-
getSourceClientOffset() {
|
|
2229
|
-
return getSourceClientOffset(this.store.getState().dragOffset);
|
|
2230
|
-
}
|
|
2231
|
-
getDifferenceFromInitialOffset() {
|
|
2232
|
-
return getDifferenceFromInitialOffset(this.store.getState().dragOffset);
|
|
2233
|
-
}
|
|
2234
|
-
constructor(store, registry){
|
|
2235
|
-
this.store = store;
|
|
2236
|
-
this.registry = registry;
|
|
1525
|
+
this.registry = registry;
|
|
2237
1526
|
}
|
|
2238
1527
|
}
|
|
2239
1528
|
|
|
@@ -3893,95 +3182,945 @@ function useDropTargetMonitor() {
|
|
|
3893
3182
|
]);
|
|
3894
3183
|
}
|
|
3895
3184
|
|
|
3896
|
-
/**
|
|
3897
|
-
* Internal utility hook to get an array-version of spec.accept.
|
|
3898
|
-
* The main utility here is that we aren't creating a new array on every render if a non-array spec.accept is passed in.
|
|
3899
|
-
* @param spec
|
|
3900
|
-
*/ function useAccept(spec) {
|
|
3901
|
-
const { accept } = spec;
|
|
3902
|
-
return React.useMemo(()=>{
|
|
3903
|
-
invariant(spec.accept != null, 'accept must be defined');
|
|
3904
|
-
return Array.isArray(accept) ? accept : [
|
|
3905
|
-
accept
|
|
3906
|
-
];
|
|
3907
|
-
}, [
|
|
3908
|
-
accept
|
|
3909
|
-
]);
|
|
3910
|
-
}
|
|
3185
|
+
/**
|
|
3186
|
+
* Internal utility hook to get an array-version of spec.accept.
|
|
3187
|
+
* The main utility here is that we aren't creating a new array on every render if a non-array spec.accept is passed in.
|
|
3188
|
+
* @param spec
|
|
3189
|
+
*/ function useAccept(spec) {
|
|
3190
|
+
const { accept } = spec;
|
|
3191
|
+
return React.useMemo(()=>{
|
|
3192
|
+
invariant(spec.accept != null, 'accept must be defined');
|
|
3193
|
+
return Array.isArray(accept) ? accept : [
|
|
3194
|
+
accept
|
|
3195
|
+
];
|
|
3196
|
+
}, [
|
|
3197
|
+
accept
|
|
3198
|
+
]);
|
|
3199
|
+
}
|
|
3200
|
+
|
|
3201
|
+
class DropTargetImpl {
|
|
3202
|
+
canDrop() {
|
|
3203
|
+
const spec = this.spec;
|
|
3204
|
+
const monitor = this.monitor;
|
|
3205
|
+
return spec.canDrop ? spec.canDrop(monitor.getItem(), monitor) : true;
|
|
3206
|
+
}
|
|
3207
|
+
hover() {
|
|
3208
|
+
const spec = this.spec;
|
|
3209
|
+
const monitor = this.monitor;
|
|
3210
|
+
if (spec.hover) {
|
|
3211
|
+
spec.hover(monitor.getItem(), monitor);
|
|
3212
|
+
}
|
|
3213
|
+
}
|
|
3214
|
+
drop() {
|
|
3215
|
+
const spec = this.spec;
|
|
3216
|
+
const monitor = this.monitor;
|
|
3217
|
+
if (spec.drop) {
|
|
3218
|
+
return spec.drop(monitor.getItem(), monitor);
|
|
3219
|
+
}
|
|
3220
|
+
return;
|
|
3221
|
+
}
|
|
3222
|
+
constructor(spec, monitor){
|
|
3223
|
+
this.spec = spec;
|
|
3224
|
+
this.monitor = monitor;
|
|
3225
|
+
}
|
|
3226
|
+
}
|
|
3227
|
+
|
|
3228
|
+
function useDropTarget(spec, monitor) {
|
|
3229
|
+
const dropTarget = React.useMemo(()=>new DropTargetImpl(spec, monitor)
|
|
3230
|
+
, [
|
|
3231
|
+
monitor
|
|
3232
|
+
]);
|
|
3233
|
+
React.useEffect(()=>{
|
|
3234
|
+
dropTarget.spec = spec;
|
|
3235
|
+
}, [
|
|
3236
|
+
spec
|
|
3237
|
+
]);
|
|
3238
|
+
return dropTarget;
|
|
3239
|
+
}
|
|
3240
|
+
|
|
3241
|
+
function useRegisteredDropTarget(spec, monitor, connector) {
|
|
3242
|
+
const manager = useDragDropManager();
|
|
3243
|
+
const dropTarget = useDropTarget(spec, monitor);
|
|
3244
|
+
const accept = useAccept(spec);
|
|
3245
|
+
useIsomorphicLayoutEffect(function registerDropTarget() {
|
|
3246
|
+
const [handlerId, unregister] = registerTarget(accept, dropTarget, manager);
|
|
3247
|
+
monitor.receiveHandlerId(handlerId);
|
|
3248
|
+
connector.receiveHandlerId(handlerId);
|
|
3249
|
+
return unregister;
|
|
3250
|
+
}, [
|
|
3251
|
+
manager,
|
|
3252
|
+
monitor,
|
|
3253
|
+
dropTarget,
|
|
3254
|
+
connector,
|
|
3255
|
+
accept.map((a)=>a.toString()
|
|
3256
|
+
).join('|'),
|
|
3257
|
+
]);
|
|
3258
|
+
}
|
|
3259
|
+
|
|
3260
|
+
/**
|
|
3261
|
+
* useDropTarget Hook
|
|
3262
|
+
* @param spec The drop target specification (object or function, function preferred)
|
|
3263
|
+
* @param deps The memoization deps array to use when evaluating spec changes
|
|
3264
|
+
*/ function useDrop(specArg, deps) {
|
|
3265
|
+
const spec = useOptionalFactory(specArg, deps);
|
|
3266
|
+
const monitor = useDropTargetMonitor();
|
|
3267
|
+
const connector = useDropTargetConnector(spec.options);
|
|
3268
|
+
useRegisteredDropTarget(spec, monitor, connector);
|
|
3269
|
+
return [
|
|
3270
|
+
useCollectedProps(spec.collect, monitor, connector),
|
|
3271
|
+
useConnectDropTarget(connector),
|
|
3272
|
+
];
|
|
3273
|
+
}
|
|
3274
|
+
|
|
3275
|
+
var MRT_ColumnPinningButtons = function MRT_ColumnPinningButtons(_ref) {
|
|
3276
|
+
var column = _ref.column,
|
|
3277
|
+
tableInstance = _ref.tableInstance;
|
|
3278
|
+
var _tableInstance$option = tableInstance.options,
|
|
3279
|
+
PushPinIcon = _tableInstance$option.icons.PushPinIcon,
|
|
3280
|
+
localization = _tableInstance$option.localization;
|
|
3281
|
+
|
|
3282
|
+
var handlePinColumn = function handlePinColumn(pinDirection) {
|
|
3283
|
+
column.pin(pinDirection);
|
|
3284
|
+
};
|
|
3285
|
+
|
|
3286
|
+
return React__default.createElement(material.Box, {
|
|
3287
|
+
sx: {
|
|
3288
|
+
minWidth: '70px',
|
|
3289
|
+
textAlign: 'center'
|
|
3290
|
+
}
|
|
3291
|
+
}, column.getIsPinned() ? React__default.createElement(material.Tooltip, {
|
|
3292
|
+
arrow: true,
|
|
3293
|
+
title: localization.unpin
|
|
3294
|
+
}, React__default.createElement(material.IconButton, {
|
|
3295
|
+
onClick: function onClick() {
|
|
3296
|
+
return handlePinColumn(false);
|
|
3297
|
+
},
|
|
3298
|
+
size: "small"
|
|
3299
|
+
}, React__default.createElement(PushPinIcon, null))) : React__default.createElement(React__default.Fragment, null, React__default.createElement(material.Tooltip, {
|
|
3300
|
+
arrow: true,
|
|
3301
|
+
title: localization.pinToLeft
|
|
3302
|
+
}, React__default.createElement(material.IconButton, {
|
|
3303
|
+
onClick: function onClick() {
|
|
3304
|
+
return handlePinColumn('left');
|
|
3305
|
+
},
|
|
3306
|
+
size: "small"
|
|
3307
|
+
}, React__default.createElement(PushPinIcon, {
|
|
3308
|
+
style: {
|
|
3309
|
+
transform: 'rotate(90deg)'
|
|
3310
|
+
}
|
|
3311
|
+
}))), React__default.createElement(material.Tooltip, {
|
|
3312
|
+
arrow: true,
|
|
3313
|
+
title: localization.pinToRight
|
|
3314
|
+
}, React__default.createElement(material.IconButton, {
|
|
3315
|
+
onClick: function onClick() {
|
|
3316
|
+
return handlePinColumn('right');
|
|
3317
|
+
},
|
|
3318
|
+
size: "small"
|
|
3319
|
+
}, React__default.createElement(PushPinIcon, {
|
|
3320
|
+
style: {
|
|
3321
|
+
transform: 'rotate(-90deg)'
|
|
3322
|
+
}
|
|
3323
|
+
})))));
|
|
3324
|
+
};
|
|
3325
|
+
|
|
3326
|
+
var MRT_GrabHandleButton = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
3327
|
+
var tableInstance = _ref.tableInstance;
|
|
3328
|
+
var _tableInstance$option = tableInstance.options,
|
|
3329
|
+
DragHandleIcon = _tableInstance$option.icons.DragHandleIcon,
|
|
3330
|
+
localization = _tableInstance$option.localization;
|
|
3331
|
+
return React__default.createElement(material.Tooltip, {
|
|
3332
|
+
arrow: true,
|
|
3333
|
+
enterDelay: 1000,
|
|
3334
|
+
enterNextDelay: 1000,
|
|
3335
|
+
placement: "top",
|
|
3336
|
+
title: localization.grab
|
|
3337
|
+
}, React__default.createElement(material.IconButton, {
|
|
3338
|
+
disableRipple: true,
|
|
3339
|
+
ref: ref,
|
|
3340
|
+
size: "small",
|
|
3341
|
+
sx: {
|
|
3342
|
+
cursor: 'grab',
|
|
3343
|
+
m: 0,
|
|
3344
|
+
opacity: 0.5,
|
|
3345
|
+
p: '2px',
|
|
3346
|
+
transition: 'all 0.2s ease-in-out',
|
|
3347
|
+
'&:hover': {
|
|
3348
|
+
backgroundColor: 'transparent',
|
|
3349
|
+
opacity: 1
|
|
3350
|
+
},
|
|
3351
|
+
'&:active': {
|
|
3352
|
+
cursor: 'grabbing'
|
|
3353
|
+
}
|
|
3354
|
+
}
|
|
3355
|
+
}, React__default.createElement(DragHandleIcon, null)));
|
|
3356
|
+
});
|
|
3357
|
+
|
|
3358
|
+
var getAllLeafColumnDefs = function getAllLeafColumnDefs(columns) {
|
|
3359
|
+
var lowestLevelColumns = columns;
|
|
3360
|
+
var currentCols = columns;
|
|
3361
|
+
|
|
3362
|
+
while (!!((_currentCols = currentCols) != null && _currentCols.length) && currentCols.some(function (col) {
|
|
3363
|
+
return col.columns;
|
|
3364
|
+
})) {
|
|
3365
|
+
var _currentCols;
|
|
3366
|
+
|
|
3367
|
+
var nextCols = currentCols.filter(function (col) {
|
|
3368
|
+
return !!col.columns;
|
|
3369
|
+
}).map(function (col) {
|
|
3370
|
+
return col.columns;
|
|
3371
|
+
}).flat();
|
|
3372
|
+
|
|
3373
|
+
if (nextCols.every(function (col) {
|
|
3374
|
+
return !(col != null && col.columns);
|
|
3375
|
+
})) {
|
|
3376
|
+
lowestLevelColumns = [].concat(lowestLevelColumns, nextCols);
|
|
3377
|
+
}
|
|
3378
|
+
|
|
3379
|
+
currentCols = nextCols;
|
|
3380
|
+
}
|
|
3381
|
+
|
|
3382
|
+
return lowestLevelColumns.filter(function (col) {
|
|
3383
|
+
return !col.columns;
|
|
3384
|
+
});
|
|
3385
|
+
};
|
|
3386
|
+
var createGroup = function createGroup(table, column, currentFilterFns) {
|
|
3387
|
+
var _column$columns;
|
|
3388
|
+
|
|
3389
|
+
return table.createGroup(_extends({}, column, {
|
|
3390
|
+
columns: column == null ? void 0 : (_column$columns = column.columns) == null ? void 0 : _column$columns.map == null ? void 0 : _column$columns.map(function (col) {
|
|
3391
|
+
return col.columns ? createGroup(table, col, currentFilterFns) : createDataColumn(table, col, currentFilterFns);
|
|
3392
|
+
})
|
|
3393
|
+
}));
|
|
3394
|
+
};
|
|
3395
|
+
var createDataColumn = function createDataColumn(table, column, currentFilterFns) {
|
|
3396
|
+
return (// @ts-ignore
|
|
3397
|
+
table.createDataColumn(column.id, _extends({
|
|
3398
|
+
filterFn: currentFilterFns[column.id] instanceof Function ? currentFilterFns[column.id] : defaultFilterFNs[currentFilterFns[column.id]]
|
|
3399
|
+
}, column))
|
|
3400
|
+
);
|
|
3401
|
+
};
|
|
3402
|
+
var createDisplayColumn = function createDisplayColumn(table, column) {
|
|
3403
|
+
return table.createDisplayColumn(column);
|
|
3404
|
+
};
|
|
3405
|
+
var reorderColumn = function reorderColumn(movingColumn, receivingColumn, columnOrder, setColumnOrder) {
|
|
3406
|
+
if (movingColumn.getCanPin()) {
|
|
3407
|
+
movingColumn.pin(receivingColumn.getIsPinned());
|
|
3408
|
+
}
|
|
3409
|
+
|
|
3410
|
+
columnOrder.splice(columnOrder.indexOf(receivingColumn.id), 0, columnOrder.splice(columnOrder.indexOf(movingColumn.id), 1)[0]);
|
|
3411
|
+
setColumnOrder([].concat(columnOrder));
|
|
3412
|
+
};
|
|
3413
|
+
|
|
3414
|
+
var MRT_ShowHideColumnsMenuItems = function MRT_ShowHideColumnsMenuItems(_ref) {
|
|
3415
|
+
var _column$columns2;
|
|
3416
|
+
|
|
3417
|
+
var allColumns = _ref.allColumns,
|
|
3418
|
+
column = _ref.column,
|
|
3419
|
+
isSubMenu = _ref.isSubMenu,
|
|
3420
|
+
tableInstance = _ref.tableInstance;
|
|
3421
|
+
var getState = tableInstance.getState,
|
|
3422
|
+
_tableInstance$option = tableInstance.options,
|
|
3423
|
+
enableColumnOrdering = _tableInstance$option.enableColumnOrdering,
|
|
3424
|
+
onToggleColumnVisibility = _tableInstance$option.onToggleColumnVisibility,
|
|
3425
|
+
setColumnOrder = tableInstance.setColumnOrder;
|
|
3426
|
+
|
|
3427
|
+
var _getState = getState(),
|
|
3428
|
+
columnOrder = _getState.columnOrder,
|
|
3429
|
+
columnVisibility = _getState.columnVisibility;
|
|
3430
|
+
|
|
3431
|
+
var columnDef = column.columnDef,
|
|
3432
|
+
columnDefType = column.columnDefType;
|
|
3433
|
+
|
|
3434
|
+
var _useDrop = useDrop({
|
|
3435
|
+
accept: 'column',
|
|
3436
|
+
drop: function drop(movingColumn) {
|
|
3437
|
+
return reorderColumn(movingColumn, column, columnOrder, setColumnOrder);
|
|
3438
|
+
}
|
|
3439
|
+
}),
|
|
3440
|
+
dropRef = _useDrop[1];
|
|
3441
|
+
|
|
3442
|
+
var _useDrag = useDrag({
|
|
3443
|
+
collect: function collect(monitor) {
|
|
3444
|
+
return {
|
|
3445
|
+
isDragging: monitor.isDragging()
|
|
3446
|
+
};
|
|
3447
|
+
},
|
|
3448
|
+
item: function item() {
|
|
3449
|
+
return column;
|
|
3450
|
+
},
|
|
3451
|
+
type: 'column'
|
|
3452
|
+
}),
|
|
3453
|
+
dragRef = _useDrag[1],
|
|
3454
|
+
previewRef = _useDrag[2];
|
|
3455
|
+
|
|
3456
|
+
var switchChecked = columnDefType !== 'group' && column.getIsVisible() || columnDefType === 'group' && column.getLeafColumns().some(function (col) {
|
|
3457
|
+
return col.getIsVisible();
|
|
3458
|
+
});
|
|
3459
|
+
|
|
3460
|
+
var handleToggleColumnHidden = function handleToggleColumnHidden(column) {
|
|
3461
|
+
if (columnDefType === 'group') {
|
|
3462
|
+
var _column$columns;
|
|
3463
|
+
|
|
3464
|
+
column == null ? void 0 : (_column$columns = column.columns) == null ? void 0 : _column$columns.forEach == null ? void 0 : _column$columns.forEach(function (childColumn) {
|
|
3465
|
+
childColumn.toggleVisibility(!switchChecked);
|
|
3466
|
+
});
|
|
3467
|
+
} else {
|
|
3468
|
+
column.toggleVisibility();
|
|
3469
|
+
}
|
|
3470
|
+
|
|
3471
|
+
onToggleColumnVisibility == null ? void 0 : onToggleColumnVisibility({
|
|
3472
|
+
column: column,
|
|
3473
|
+
columnVisibility: columnVisibility,
|
|
3474
|
+
tableInstance: tableInstance
|
|
3475
|
+
});
|
|
3476
|
+
};
|
|
3477
|
+
|
|
3478
|
+
return React__default.createElement(React__default.Fragment, null, React__default.createElement(material.MenuItem, {
|
|
3479
|
+
ref: columnDefType === 'data' ? dropRef : undefined,
|
|
3480
|
+
sx: {
|
|
3481
|
+
alignItems: 'center',
|
|
3482
|
+
justifyContent: 'flex-start',
|
|
3483
|
+
my: 0,
|
|
3484
|
+
pl: (column.depth + 0.5) * 2 + "rem",
|
|
3485
|
+
py: '6px'
|
|
3486
|
+
}
|
|
3487
|
+
}, React__default.createElement(material.Box, {
|
|
3488
|
+
ref: previewRef,
|
|
3489
|
+
sx: {
|
|
3490
|
+
display: 'flex',
|
|
3491
|
+
flexWrap: 'nowrap',
|
|
3492
|
+
gap: '8px'
|
|
3493
|
+
}
|
|
3494
|
+
}, columnDefType !== 'group' && enableColumnOrdering && columnDef.enableColumnOrdering !== false && !allColumns.some(function (col) {
|
|
3495
|
+
return col.columnDefType === 'group';
|
|
3496
|
+
}) && React__default.createElement(MRT_GrabHandleButton, {
|
|
3497
|
+
ref: dragRef,
|
|
3498
|
+
tableInstance: tableInstance
|
|
3499
|
+
}), !isSubMenu && column.getCanPin() && React__default.createElement(MRT_ColumnPinningButtons, {
|
|
3500
|
+
column: column,
|
|
3501
|
+
tableInstance: tableInstance
|
|
3502
|
+
}), React__default.createElement(material.FormControlLabel, {
|
|
3503
|
+
componentsProps: {
|
|
3504
|
+
typography: {
|
|
3505
|
+
sx: {
|
|
3506
|
+
mb: 0,
|
|
3507
|
+
opacity: columnDefType !== 'display' ? 1 : 0.5
|
|
3508
|
+
}
|
|
3509
|
+
}
|
|
3510
|
+
},
|
|
3511
|
+
checked: switchChecked,
|
|
3512
|
+
control: React__default.createElement(material.Switch, null),
|
|
3513
|
+
disabled: isSubMenu && switchChecked || !column.getCanHide() || column.getIsGrouped(),
|
|
3514
|
+
label: columnDef.header,
|
|
3515
|
+
onChange: function onChange() {
|
|
3516
|
+
return handleToggleColumnHidden(column);
|
|
3517
|
+
}
|
|
3518
|
+
}))), (_column$columns2 = column.columns) == null ? void 0 : _column$columns2.map(function (c, i) {
|
|
3519
|
+
return React__default.createElement(MRT_ShowHideColumnsMenuItems, {
|
|
3520
|
+
allColumns: allColumns,
|
|
3521
|
+
key: i + "-" + c.id,
|
|
3522
|
+
column: c,
|
|
3523
|
+
isSubMenu: isSubMenu,
|
|
3524
|
+
tableInstance: tableInstance
|
|
3525
|
+
});
|
|
3526
|
+
}));
|
|
3527
|
+
};
|
|
3528
|
+
|
|
3529
|
+
var MRT_ShowHideColumnsMenu = function MRT_ShowHideColumnsMenu(_ref) {
|
|
3530
|
+
var anchorEl = _ref.anchorEl,
|
|
3531
|
+
isSubMenu = _ref.isSubMenu,
|
|
3532
|
+
setAnchorEl = _ref.setAnchorEl,
|
|
3533
|
+
tableInstance = _ref.tableInstance;
|
|
3534
|
+
var getAllColumns = tableInstance.getAllColumns,
|
|
3535
|
+
getAllLeafColumns = tableInstance.getAllLeafColumns,
|
|
3536
|
+
getCenterLeafColumns = tableInstance.getCenterLeafColumns,
|
|
3537
|
+
getIsAllColumnsVisible = tableInstance.getIsAllColumnsVisible,
|
|
3538
|
+
getIsSomeColumnsPinned = tableInstance.getIsSomeColumnsPinned,
|
|
3539
|
+
getIsSomeColumnsVisible = tableInstance.getIsSomeColumnsVisible,
|
|
3540
|
+
getLeftLeafColumns = tableInstance.getLeftLeafColumns,
|
|
3541
|
+
getRightLeafColumns = tableInstance.getRightLeafColumns,
|
|
3542
|
+
getState = tableInstance.getState,
|
|
3543
|
+
toggleAllColumnsVisible = tableInstance.toggleAllColumnsVisible,
|
|
3544
|
+
_tableInstance$option = tableInstance.options,
|
|
3545
|
+
localization = _tableInstance$option.localization,
|
|
3546
|
+
enablePinning = _tableInstance$option.enablePinning,
|
|
3547
|
+
enableColumnOrdering = _tableInstance$option.enableColumnOrdering;
|
|
3548
|
+
|
|
3549
|
+
var _getState = getState(),
|
|
3550
|
+
isDensePadding = _getState.isDensePadding,
|
|
3551
|
+
columnOrder = _getState.columnOrder,
|
|
3552
|
+
columnPinning = _getState.columnPinning;
|
|
3553
|
+
|
|
3554
|
+
var hideAllColumns = function hideAllColumns() {
|
|
3555
|
+
getAllLeafColumns().filter(function (col) {
|
|
3556
|
+
return col.columnDef.enableHiding !== false;
|
|
3557
|
+
}).forEach(function (col) {
|
|
3558
|
+
return col.toggleVisibility(false);
|
|
3559
|
+
});
|
|
3560
|
+
};
|
|
3561
|
+
|
|
3562
|
+
var allColumns = React.useMemo(function () {
|
|
3563
|
+
var columns = getAllColumns();
|
|
3564
|
+
|
|
3565
|
+
if (columnOrder.length > 0 && !columns.some(function (col) {
|
|
3566
|
+
return col.columnDefType === 'group';
|
|
3567
|
+
})) {
|
|
3568
|
+
return [].concat(getLeftLeafColumns(), [].concat(new Set(columnOrder)).map(function (colId) {
|
|
3569
|
+
return getCenterLeafColumns().find(function (col) {
|
|
3570
|
+
return (col == null ? void 0 : col.id) === colId;
|
|
3571
|
+
});
|
|
3572
|
+
}), getRightLeafColumns()).filter(Boolean);
|
|
3573
|
+
}
|
|
3574
|
+
|
|
3575
|
+
return columns;
|
|
3576
|
+
}, [columnOrder, columnPinning, getAllColumns(), getCenterLeafColumns(), getLeftLeafColumns(), getRightLeafColumns()]);
|
|
3577
|
+
return React__default.createElement(material.Menu, {
|
|
3578
|
+
anchorEl: anchorEl,
|
|
3579
|
+
open: !!anchorEl,
|
|
3580
|
+
onClose: function onClose() {
|
|
3581
|
+
return setAnchorEl(null);
|
|
3582
|
+
},
|
|
3583
|
+
MenuListProps: {
|
|
3584
|
+
dense: isDensePadding
|
|
3585
|
+
}
|
|
3586
|
+
}, React__default.createElement(material.Box, {
|
|
3587
|
+
sx: {
|
|
3588
|
+
display: 'flex',
|
|
3589
|
+
justifyContent: isSubMenu ? 'center' : 'space-between',
|
|
3590
|
+
p: '0.5rem',
|
|
3591
|
+
pt: 0
|
|
3592
|
+
}
|
|
3593
|
+
}, !isSubMenu && React__default.createElement(material.Button, {
|
|
3594
|
+
disabled: !getIsSomeColumnsVisible(),
|
|
3595
|
+
onClick: hideAllColumns
|
|
3596
|
+
}, localization.hideAll), !isSubMenu && enableColumnOrdering && React__default.createElement(material.Button, {
|
|
3597
|
+
onClick: function onClick() {
|
|
3598
|
+
return tableInstance.resetColumnOrder();
|
|
3599
|
+
}
|
|
3600
|
+
}, localization.resetOrder), !isSubMenu && enablePinning && React__default.createElement(material.Button, {
|
|
3601
|
+
disabled: !getIsSomeColumnsPinned(),
|
|
3602
|
+
onClick: function onClick() {
|
|
3603
|
+
return tableInstance.resetColumnPinning(true);
|
|
3604
|
+
}
|
|
3605
|
+
}, localization.unpinAll), React__default.createElement(material.Button, {
|
|
3606
|
+
disabled: getIsAllColumnsVisible(),
|
|
3607
|
+
onClick: function onClick() {
|
|
3608
|
+
return toggleAllColumnsVisible(true);
|
|
3609
|
+
}
|
|
3610
|
+
}, localization.showAll)), React__default.createElement(material.Divider, null), allColumns.map(function (column, index) {
|
|
3611
|
+
return React__default.createElement(MRT_ShowHideColumnsMenuItems, {
|
|
3612
|
+
allColumns: allColumns,
|
|
3613
|
+
column: column,
|
|
3614
|
+
isSubMenu: isSubMenu,
|
|
3615
|
+
key: index + "-" + column.id,
|
|
3616
|
+
tableInstance: tableInstance
|
|
3617
|
+
});
|
|
3618
|
+
}));
|
|
3619
|
+
};
|
|
3620
|
+
|
|
3621
|
+
var commonMenuItemStyles$1 = {
|
|
3622
|
+
py: '6px',
|
|
3623
|
+
my: 0,
|
|
3624
|
+
justifyContent: 'space-between',
|
|
3625
|
+
alignItems: 'center'
|
|
3626
|
+
};
|
|
3627
|
+
var commonListItemStyles = {
|
|
3628
|
+
display: 'flex',
|
|
3629
|
+
alignItems: 'center'
|
|
3630
|
+
};
|
|
3631
|
+
var MRT_ColumnActionMenu = function MRT_ColumnActionMenu(_ref) {
|
|
3632
|
+
var _localization$sortByC, _localization$sortByC2, _localization$filterB, _localization, _localization$hideCol, _localization$showAll;
|
|
3633
|
+
|
|
3634
|
+
var anchorEl = _ref.anchorEl,
|
|
3635
|
+
header = _ref.header,
|
|
3636
|
+
setAnchorEl = _ref.setAnchorEl,
|
|
3637
|
+
tableInstance = _ref.tableInstance;
|
|
3638
|
+
var getState = tableInstance.getState,
|
|
3639
|
+
toggleAllColumnsVisible = tableInstance.toggleAllColumnsVisible,
|
|
3640
|
+
setColumnOrder = tableInstance.setColumnOrder,
|
|
3641
|
+
_tableInstance$option = tableInstance.options,
|
|
3642
|
+
enableColumnFilters = _tableInstance$option.enableColumnFilters,
|
|
3643
|
+
enableColumnResizing = _tableInstance$option.enableColumnResizing,
|
|
3644
|
+
enableGrouping = _tableInstance$option.enableGrouping,
|
|
3645
|
+
enableHiding = _tableInstance$option.enableHiding,
|
|
3646
|
+
enablePinning = _tableInstance$option.enablePinning,
|
|
3647
|
+
enableSorting = _tableInstance$option.enableSorting,
|
|
3648
|
+
_tableInstance$option2 = _tableInstance$option.icons,
|
|
3649
|
+
ArrowRightIcon = _tableInstance$option2.ArrowRightIcon,
|
|
3650
|
+
ClearAllIcon = _tableInstance$option2.ClearAllIcon,
|
|
3651
|
+
ViewColumnIcon = _tableInstance$option2.ViewColumnIcon,
|
|
3652
|
+
DynamicFeedIcon = _tableInstance$option2.DynamicFeedIcon,
|
|
3653
|
+
FilterListIcon = _tableInstance$option2.FilterListIcon,
|
|
3654
|
+
FilterListOffIcon = _tableInstance$option2.FilterListOffIcon,
|
|
3655
|
+
PushPinIcon = _tableInstance$option2.PushPinIcon,
|
|
3656
|
+
SortIcon = _tableInstance$option2.SortIcon,
|
|
3657
|
+
RestartAltIcon = _tableInstance$option2.RestartAltIcon,
|
|
3658
|
+
VisibilityOffIcon = _tableInstance$option2.VisibilityOffIcon,
|
|
3659
|
+
idPrefix = _tableInstance$option.idPrefix,
|
|
3660
|
+
localization = _tableInstance$option.localization,
|
|
3661
|
+
setShowFilters = tableInstance.setShowFilters;
|
|
3662
|
+
var column = header.column;
|
|
3663
|
+
var columnDef = column.columnDef;
|
|
3664
|
+
|
|
3665
|
+
var _getState = getState(),
|
|
3666
|
+
columnSizing = _getState.columnSizing,
|
|
3667
|
+
columnVisibility = _getState.columnVisibility,
|
|
3668
|
+
isDensePadding = _getState.isDensePadding;
|
|
3669
|
+
|
|
3670
|
+
var _useState = React.useState(null),
|
|
3671
|
+
filterMenuAnchorEl = _useState[0],
|
|
3672
|
+
setFilterMenuAnchorEl = _useState[1];
|
|
3673
|
+
|
|
3674
|
+
var _useState2 = React.useState(null),
|
|
3675
|
+
showHideColumnsMenuAnchorEl = _useState2[0],
|
|
3676
|
+
setShowHideColumnsMenuAnchorEl = _useState2[1];
|
|
3677
|
+
|
|
3678
|
+
var handleClearSort = function handleClearSort() {
|
|
3679
|
+
column.clearSorting();
|
|
3680
|
+
setAnchorEl(null);
|
|
3681
|
+
};
|
|
3682
|
+
|
|
3683
|
+
var handleSortAsc = function handleSortAsc() {
|
|
3684
|
+
column.toggleSorting(false);
|
|
3685
|
+
setAnchorEl(null);
|
|
3686
|
+
};
|
|
3687
|
+
|
|
3688
|
+
var handleSortDesc = function handleSortDesc() {
|
|
3689
|
+
column.toggleSorting(true);
|
|
3690
|
+
setAnchorEl(null);
|
|
3691
|
+
};
|
|
3692
|
+
|
|
3693
|
+
var handleResetColumnSize = function handleResetColumnSize() {
|
|
3694
|
+
column.resetSize();
|
|
3695
|
+
setAnchorEl(null);
|
|
3696
|
+
};
|
|
3697
|
+
|
|
3698
|
+
var handleHideColumn = function handleHideColumn() {
|
|
3699
|
+
column.toggleVisibility(false);
|
|
3700
|
+
setAnchorEl(null);
|
|
3701
|
+
};
|
|
3702
|
+
|
|
3703
|
+
var handlePinColumn = function handlePinColumn(pinDirection) {
|
|
3704
|
+
column.pin(pinDirection);
|
|
3705
|
+
setAnchorEl(null);
|
|
3706
|
+
};
|
|
3707
|
+
|
|
3708
|
+
var handleGroupByColumn = function handleGroupByColumn() {
|
|
3709
|
+
column.toggleGrouping();
|
|
3710
|
+
setColumnOrder(function (old) {
|
|
3711
|
+
return ['mrt-expand'].concat(old);
|
|
3712
|
+
});
|
|
3713
|
+
setAnchorEl(null);
|
|
3714
|
+
};
|
|
3715
|
+
|
|
3716
|
+
var handleClearFilter = function handleClearFilter() {
|
|
3717
|
+
column.setFilterValue('');
|
|
3718
|
+
setAnchorEl(null);
|
|
3719
|
+
};
|
|
3720
|
+
|
|
3721
|
+
var handleFilterByColumn = function handleFilterByColumn() {
|
|
3722
|
+
setShowFilters(true);
|
|
3723
|
+
setTimeout(function () {
|
|
3724
|
+
var _document$getElementB, _header$muiTableHeadC, _header$muiTableHeadC2;
|
|
3725
|
+
|
|
3726
|
+
return (_document$getElementB = document.getElementById( // @ts-ignore
|
|
3727
|
+
(_header$muiTableHeadC = (_header$muiTableHeadC2 = header.muiTableHeadCellFilterTextFieldProps) == null ? void 0 : _header$muiTableHeadC2.id) != null ? _header$muiTableHeadC : "mrt-" + idPrefix + "-" + header.id + "-filter-text-field")) == null ? void 0 : _document$getElementB.focus();
|
|
3728
|
+
}, 200);
|
|
3729
|
+
setAnchorEl(null);
|
|
3730
|
+
};
|
|
3731
|
+
|
|
3732
|
+
var handleShowAllColumns = function handleShowAllColumns() {
|
|
3733
|
+
toggleAllColumnsVisible(true);
|
|
3734
|
+
setAnchorEl(null);
|
|
3735
|
+
};
|
|
3736
|
+
|
|
3737
|
+
var handleOpenFilterModeMenu = function handleOpenFilterModeMenu(event) {
|
|
3738
|
+
event.stopPropagation();
|
|
3739
|
+
setFilterMenuAnchorEl(event.currentTarget);
|
|
3740
|
+
};
|
|
3741
|
+
|
|
3742
|
+
var handleOpenShowHideColumnsMenu = function handleOpenShowHideColumnsMenu(event) {
|
|
3743
|
+
event.stopPropagation();
|
|
3744
|
+
setShowHideColumnsMenuAnchorEl(event.currentTarget);
|
|
3745
|
+
};
|
|
3746
|
+
|
|
3747
|
+
return React__default.createElement(material.Menu, {
|
|
3748
|
+
anchorEl: anchorEl,
|
|
3749
|
+
open: !!anchorEl,
|
|
3750
|
+
onClose: function onClose() {
|
|
3751
|
+
return setAnchorEl(null);
|
|
3752
|
+
},
|
|
3753
|
+
MenuListProps: {
|
|
3754
|
+
dense: isDensePadding
|
|
3755
|
+
}
|
|
3756
|
+
}, enableSorting && column.getCanSort() && [React__default.createElement(material.MenuItem, {
|
|
3757
|
+
disabled: !column.getIsSorted(),
|
|
3758
|
+
key: 0,
|
|
3759
|
+
onClick: handleClearSort,
|
|
3760
|
+
sx: commonMenuItemStyles$1
|
|
3761
|
+
}, React__default.createElement(material.Box, {
|
|
3762
|
+
sx: commonListItemStyles
|
|
3763
|
+
}, React__default.createElement(material.ListItemIcon, null, React__default.createElement(ClearAllIcon, null)), localization.clearSort)), React__default.createElement(material.MenuItem, {
|
|
3764
|
+
disabled: column.getIsSorted() === 'asc',
|
|
3765
|
+
key: 1,
|
|
3766
|
+
onClick: handleSortAsc,
|
|
3767
|
+
sx: commonMenuItemStyles$1
|
|
3768
|
+
}, React__default.createElement(material.Box, {
|
|
3769
|
+
sx: commonListItemStyles
|
|
3770
|
+
}, React__default.createElement(material.ListItemIcon, null, React__default.createElement(SortIcon, null)), (_localization$sortByC = localization.sortByColumnAsc) == null ? void 0 : _localization$sortByC.replace('{column}', String(columnDef.header)))), React__default.createElement(material.MenuItem, {
|
|
3771
|
+
divider: enableColumnFilters || enableGrouping || enableHiding,
|
|
3772
|
+
key: 2,
|
|
3773
|
+
disabled: column.getIsSorted() === 'desc',
|
|
3774
|
+
onClick: handleSortDesc,
|
|
3775
|
+
sx: commonMenuItemStyles$1
|
|
3776
|
+
}, React__default.createElement(material.Box, {
|
|
3777
|
+
sx: commonListItemStyles
|
|
3778
|
+
}, React__default.createElement(material.ListItemIcon, null, React__default.createElement(SortIcon, {
|
|
3779
|
+
style: {
|
|
3780
|
+
transform: 'rotate(180deg) scaleX(-1)'
|
|
3781
|
+
}
|
|
3782
|
+
})), (_localization$sortByC2 = localization.sortByColumnDesc) == null ? void 0 : _localization$sortByC2.replace('{column}', String(columnDef.header))))], enableColumnFilters && column.getCanFilter() && [React__default.createElement(material.MenuItem, {
|
|
3783
|
+
disabled: !column.getFilterValue(),
|
|
3784
|
+
key: 0,
|
|
3785
|
+
onClick: handleClearFilter,
|
|
3786
|
+
sx: commonMenuItemStyles$1
|
|
3787
|
+
}, React__default.createElement(material.Box, {
|
|
3788
|
+
sx: commonListItemStyles
|
|
3789
|
+
}, React__default.createElement(material.ListItemIcon, null, React__default.createElement(FilterListOffIcon, null)), localization.clearFilter)), React__default.createElement(material.MenuItem, {
|
|
3790
|
+
divider: enableGrouping || enableHiding,
|
|
3791
|
+
key: 1,
|
|
3792
|
+
onClick: handleFilterByColumn,
|
|
3793
|
+
sx: commonMenuItemStyles$1
|
|
3794
|
+
}, React__default.createElement(material.Box, {
|
|
3795
|
+
sx: commonListItemStyles
|
|
3796
|
+
}, React__default.createElement(material.ListItemIcon, null, React__default.createElement(FilterListIcon, null)), (_localization$filterB = localization.filterByColumn) == null ? void 0 : _localization$filterB.replace('{column}', String(columnDef.header))), !columnDef.filterSelectOptions && React__default.createElement(material.IconButton, {
|
|
3797
|
+
onClick: handleOpenFilterModeMenu,
|
|
3798
|
+
onMouseEnter: handleOpenFilterModeMenu,
|
|
3799
|
+
size: "small",
|
|
3800
|
+
sx: {
|
|
3801
|
+
p: 0
|
|
3802
|
+
}
|
|
3803
|
+
}, React__default.createElement(ArrowRightIcon, null))), React__default.createElement(MRT_FilterOptionMenu, {
|
|
3804
|
+
anchorEl: filterMenuAnchorEl,
|
|
3805
|
+
header: header,
|
|
3806
|
+
key: 2,
|
|
3807
|
+
onSelect: handleFilterByColumn,
|
|
3808
|
+
setAnchorEl: setFilterMenuAnchorEl,
|
|
3809
|
+
tableInstance: tableInstance
|
|
3810
|
+
})], enableGrouping && column.getCanGroup() && [React__default.createElement(material.MenuItem, {
|
|
3811
|
+
divider: enablePinning,
|
|
3812
|
+
key: 0,
|
|
3813
|
+
onClick: handleGroupByColumn,
|
|
3814
|
+
sx: commonMenuItemStyles$1
|
|
3815
|
+
}, React__default.createElement(material.Box, {
|
|
3816
|
+
sx: commonListItemStyles
|
|
3817
|
+
}, React__default.createElement(material.ListItemIcon, null, React__default.createElement(DynamicFeedIcon, null)), (_localization = localization[column.getIsGrouped() ? 'ungroupByColumn' : 'groupByColumn']) == null ? void 0 : _localization.replace('{column}', String(columnDef.header))))], enablePinning && column.getCanPin() && [React__default.createElement(material.MenuItem, {
|
|
3818
|
+
disabled: column.getIsPinned() === 'left' || !column.getCanPin(),
|
|
3819
|
+
key: 0,
|
|
3820
|
+
onClick: function onClick() {
|
|
3821
|
+
return handlePinColumn('left');
|
|
3822
|
+
},
|
|
3823
|
+
sx: commonMenuItemStyles$1
|
|
3824
|
+
}, React__default.createElement(material.Box, {
|
|
3825
|
+
sx: commonListItemStyles
|
|
3826
|
+
}, React__default.createElement(material.ListItemIcon, null, React__default.createElement(PushPinIcon, {
|
|
3827
|
+
style: {
|
|
3828
|
+
transform: 'rotate(90deg)'
|
|
3829
|
+
}
|
|
3830
|
+
})), localization.pinToLeft)), React__default.createElement(material.MenuItem, {
|
|
3831
|
+
disabled: column.getIsPinned() === 'right' || !column.getCanPin(),
|
|
3832
|
+
key: 1,
|
|
3833
|
+
onClick: function onClick() {
|
|
3834
|
+
return handlePinColumn('right');
|
|
3835
|
+
},
|
|
3836
|
+
sx: commonMenuItemStyles$1
|
|
3837
|
+
}, React__default.createElement(material.Box, {
|
|
3838
|
+
sx: commonListItemStyles
|
|
3839
|
+
}, React__default.createElement(material.ListItemIcon, null, React__default.createElement(PushPinIcon, {
|
|
3840
|
+
style: {
|
|
3841
|
+
transform: 'rotate(-90deg)'
|
|
3842
|
+
}
|
|
3843
|
+
})), localization.pinToRight)), React__default.createElement(material.MenuItem, {
|
|
3844
|
+
disabled: !column.getIsPinned(),
|
|
3845
|
+
divider: enableHiding,
|
|
3846
|
+
key: 2,
|
|
3847
|
+
onClick: function onClick() {
|
|
3848
|
+
return handlePinColumn(false);
|
|
3849
|
+
},
|
|
3850
|
+
sx: commonMenuItemStyles$1
|
|
3851
|
+
}, React__default.createElement(material.Box, {
|
|
3852
|
+
sx: commonListItemStyles
|
|
3853
|
+
}, React__default.createElement(material.ListItemIcon, null, React__default.createElement(PushPinIcon, null)), localization.unpin))], enableColumnResizing && [React__default.createElement(material.MenuItem, {
|
|
3854
|
+
disabled: !column.getCanResize() || !columnSizing[column.id],
|
|
3855
|
+
key: 0,
|
|
3856
|
+
onClick: handleResetColumnSize,
|
|
3857
|
+
sx: commonMenuItemStyles$1
|
|
3858
|
+
}, React__default.createElement(material.Box, {
|
|
3859
|
+
sx: commonListItemStyles
|
|
3860
|
+
}, React__default.createElement(material.ListItemIcon, null, React__default.createElement(RestartAltIcon, null)), localization.resetColumnSize))], enableHiding && [React__default.createElement(material.MenuItem, {
|
|
3861
|
+
disabled: columnDef.enableHiding === false,
|
|
3862
|
+
key: 0,
|
|
3863
|
+
onClick: handleHideColumn,
|
|
3864
|
+
sx: commonMenuItemStyles$1
|
|
3865
|
+
}, React__default.createElement(material.Box, {
|
|
3866
|
+
sx: commonListItemStyles
|
|
3867
|
+
}, React__default.createElement(material.ListItemIcon, null, React__default.createElement(VisibilityOffIcon, null)), (_localization$hideCol = localization.hideColumn) == null ? void 0 : _localization$hideCol.replace('{column}', String(columnDef.header)))), React__default.createElement(material.MenuItem, {
|
|
3868
|
+
disabled: !Object.values(columnVisibility).filter(function (visible) {
|
|
3869
|
+
return !visible;
|
|
3870
|
+
}).length,
|
|
3871
|
+
key: 1,
|
|
3872
|
+
onClick: handleShowAllColumns,
|
|
3873
|
+
sx: commonMenuItemStyles$1
|
|
3874
|
+
}, React__default.createElement(material.Box, {
|
|
3875
|
+
sx: commonListItemStyles
|
|
3876
|
+
}, React__default.createElement(material.ListItemIcon, null, React__default.createElement(ViewColumnIcon, null)), (_localization$showAll = localization.showAllColumns) == null ? void 0 : _localization$showAll.replace('{column}', String(columnDef.header))), React__default.createElement(material.IconButton, {
|
|
3877
|
+
onClick: handleOpenShowHideColumnsMenu,
|
|
3878
|
+
onMouseEnter: handleOpenShowHideColumnsMenu,
|
|
3879
|
+
size: "small",
|
|
3880
|
+
sx: {
|
|
3881
|
+
p: 0
|
|
3882
|
+
}
|
|
3883
|
+
}, React__default.createElement(ArrowRightIcon, null))), React__default.createElement(MRT_ShowHideColumnsMenu, {
|
|
3884
|
+
anchorEl: showHideColumnsMenuAnchorEl,
|
|
3885
|
+
isSubMenu: true,
|
|
3886
|
+
key: 2,
|
|
3887
|
+
setAnchorEl: setShowHideColumnsMenuAnchorEl,
|
|
3888
|
+
tableInstance: tableInstance
|
|
3889
|
+
})]);
|
|
3890
|
+
};
|
|
3891
|
+
|
|
3892
|
+
var MRT_RowActionMenu = function MRT_RowActionMenu(_ref) {
|
|
3893
|
+
var anchorEl = _ref.anchorEl,
|
|
3894
|
+
handleEdit = _ref.handleEdit,
|
|
3895
|
+
row = _ref.row,
|
|
3896
|
+
setAnchorEl = _ref.setAnchorEl,
|
|
3897
|
+
tableInstance = _ref.tableInstance;
|
|
3898
|
+
var getState = tableInstance.getState,
|
|
3899
|
+
_tableInstance$option = tableInstance.options,
|
|
3900
|
+
EditIcon = _tableInstance$option.icons.EditIcon,
|
|
3901
|
+
enableEditing = _tableInstance$option.enableEditing,
|
|
3902
|
+
localization = _tableInstance$option.localization,
|
|
3903
|
+
renderRowActionMenuItems = _tableInstance$option.renderRowActionMenuItems;
|
|
3904
|
+
|
|
3905
|
+
var _getState = getState(),
|
|
3906
|
+
isDensePadding = _getState.isDensePadding;
|
|
3907
|
+
|
|
3908
|
+
return React__default.createElement(material.Menu, {
|
|
3909
|
+
anchorEl: anchorEl,
|
|
3910
|
+
open: !!anchorEl,
|
|
3911
|
+
onClose: function onClose() {
|
|
3912
|
+
return setAnchorEl(null);
|
|
3913
|
+
},
|
|
3914
|
+
MenuListProps: {
|
|
3915
|
+
dense: isDensePadding
|
|
3916
|
+
}
|
|
3917
|
+
}, enableEditing && React__default.createElement(material.MenuItem, {
|
|
3918
|
+
onClick: handleEdit,
|
|
3919
|
+
sx: commonMenuItemStyles$1
|
|
3920
|
+
}, React__default.createElement(material.Box, {
|
|
3921
|
+
sx: commonListItemStyles
|
|
3922
|
+
}, React__default.createElement(material.ListItemIcon, null, React__default.createElement(EditIcon, null)), localization.edit)), renderRowActionMenuItems == null ? void 0 : renderRowActionMenuItems({
|
|
3923
|
+
row: row,
|
|
3924
|
+
tableInstance: tableInstance,
|
|
3925
|
+
closeMenu: function closeMenu() {
|
|
3926
|
+
return setAnchorEl(null);
|
|
3927
|
+
}
|
|
3928
|
+
}));
|
|
3929
|
+
};
|
|
3930
|
+
|
|
3931
|
+
var MRT_EditActionButtons = function MRT_EditActionButtons(_ref) {
|
|
3932
|
+
var row = _ref.row,
|
|
3933
|
+
tableInstance = _ref.tableInstance;
|
|
3934
|
+
var getState = tableInstance.getState,
|
|
3935
|
+
_tableInstance$option = tableInstance.options,
|
|
3936
|
+
_tableInstance$option2 = _tableInstance$option.icons,
|
|
3937
|
+
CancelIcon = _tableInstance$option2.CancelIcon,
|
|
3938
|
+
SaveIcon = _tableInstance$option2.SaveIcon,
|
|
3939
|
+
localization = _tableInstance$option.localization,
|
|
3940
|
+
onEditSubmit = _tableInstance$option.onEditSubmit,
|
|
3941
|
+
setCurrentEditingRow = tableInstance.setCurrentEditingRow;
|
|
3942
|
+
|
|
3943
|
+
var _getState = getState(),
|
|
3944
|
+
currentEditingRow = _getState.currentEditingRow;
|
|
3945
|
+
|
|
3946
|
+
var handleCancel = function handleCancel() {
|
|
3947
|
+
var _row$original;
|
|
3948
|
+
|
|
3949
|
+
row._valuesCache = (_row$original = row.original) != null ? _row$original : {};
|
|
3950
|
+
setCurrentEditingRow(null);
|
|
3951
|
+
};
|
|
3952
|
+
|
|
3953
|
+
var handleSave = function handleSave() {
|
|
3954
|
+
onEditSubmit == null ? void 0 : onEditSubmit({
|
|
3955
|
+
row: currentEditingRow != null ? currentEditingRow : row,
|
|
3956
|
+
tableInstance: tableInstance
|
|
3957
|
+
});
|
|
3958
|
+
setCurrentEditingRow(null);
|
|
3959
|
+
};
|
|
3960
|
+
|
|
3961
|
+
return React__default.createElement(material.Box, {
|
|
3962
|
+
sx: {
|
|
3963
|
+
display: 'flex',
|
|
3964
|
+
gap: '0.75rem'
|
|
3965
|
+
}
|
|
3966
|
+
}, React__default.createElement(material.Tooltip, {
|
|
3967
|
+
arrow: true,
|
|
3968
|
+
title: localization.cancel
|
|
3969
|
+
}, React__default.createElement(material.IconButton, {
|
|
3970
|
+
"aria-label": localization.cancel,
|
|
3971
|
+
onClick: handleCancel
|
|
3972
|
+
}, React__default.createElement(CancelIcon, null))), React__default.createElement(material.Tooltip, {
|
|
3973
|
+
arrow: true,
|
|
3974
|
+
title: localization.save
|
|
3975
|
+
}, React__default.createElement(material.IconButton, {
|
|
3976
|
+
"aria-label": localization.save,
|
|
3977
|
+
color: "info",
|
|
3978
|
+
onClick: handleSave
|
|
3979
|
+
}, React__default.createElement(SaveIcon, null))));
|
|
3980
|
+
};
|
|
3981
|
+
|
|
3982
|
+
var commonIconButtonStyles = {
|
|
3983
|
+
height: '2rem',
|
|
3984
|
+
ml: '10px',
|
|
3985
|
+
opacity: 0.5,
|
|
3986
|
+
transition: 'opacity 0.2s',
|
|
3987
|
+
width: '2rem',
|
|
3988
|
+
'&:hover': {
|
|
3989
|
+
opacity: 1
|
|
3990
|
+
}
|
|
3991
|
+
};
|
|
3992
|
+
var MRT_ToggleRowActionMenuButton = function MRT_ToggleRowActionMenuButton(_ref) {
|
|
3993
|
+
var row = _ref.row,
|
|
3994
|
+
tableInstance = _ref.tableInstance;
|
|
3995
|
+
var getState = tableInstance.getState,
|
|
3996
|
+
_tableInstance$option = tableInstance.options,
|
|
3997
|
+
enableEditing = _tableInstance$option.enableEditing,
|
|
3998
|
+
_tableInstance$option2 = _tableInstance$option.icons,
|
|
3999
|
+
EditIcon = _tableInstance$option2.EditIcon,
|
|
4000
|
+
MoreHorizIcon = _tableInstance$option2.MoreHorizIcon,
|
|
4001
|
+
localization = _tableInstance$option.localization,
|
|
4002
|
+
renderRowActionMenuItems = _tableInstance$option.renderRowActionMenuItems,
|
|
4003
|
+
renderRowActions = _tableInstance$option.renderRowActions,
|
|
4004
|
+
setCurrentEditingRow = tableInstance.setCurrentEditingRow;
|
|
4005
|
+
|
|
4006
|
+
var _getState = getState(),
|
|
4007
|
+
currentEditingRow = _getState.currentEditingRow;
|
|
4008
|
+
|
|
4009
|
+
var _useState = React.useState(null),
|
|
4010
|
+
anchorEl = _useState[0],
|
|
4011
|
+
setAnchorEl = _useState[1];
|
|
4012
|
+
|
|
4013
|
+
var handleOpenRowActionMenu = function handleOpenRowActionMenu(event) {
|
|
4014
|
+
event.stopPropagation();
|
|
4015
|
+
event.preventDefault();
|
|
4016
|
+
setAnchorEl(event.currentTarget);
|
|
4017
|
+
};
|
|
4018
|
+
|
|
4019
|
+
var handleStartEditMode = function handleStartEditMode() {
|
|
4020
|
+
setCurrentEditingRow(_extends({}, row));
|
|
4021
|
+
setAnchorEl(null);
|
|
4022
|
+
};
|
|
4023
|
+
|
|
4024
|
+
return React__default.createElement(React__default.Fragment, null, renderRowActions ? React__default.createElement(React__default.Fragment, null, renderRowActions({
|
|
4025
|
+
row: row,
|
|
4026
|
+
tableInstance: tableInstance
|
|
4027
|
+
})) : row.id === (currentEditingRow == null ? void 0 : currentEditingRow.id) ? React__default.createElement(MRT_EditActionButtons, {
|
|
4028
|
+
row: row,
|
|
4029
|
+
tableInstance: tableInstance
|
|
4030
|
+
}) : !renderRowActionMenuItems && enableEditing ? React__default.createElement(material.Tooltip, {
|
|
4031
|
+
placement: "right",
|
|
4032
|
+
arrow: true,
|
|
4033
|
+
title: localization.edit
|
|
4034
|
+
}, React__default.createElement(material.IconButton, {
|
|
4035
|
+
sx: commonIconButtonStyles,
|
|
4036
|
+
onClick: handleStartEditMode
|
|
4037
|
+
}, React__default.createElement(EditIcon, null))) : renderRowActionMenuItems ? React__default.createElement(React__default.Fragment, null, React__default.createElement(material.Tooltip, {
|
|
4038
|
+
arrow: true,
|
|
4039
|
+
enterDelay: 1000,
|
|
4040
|
+
enterNextDelay: 1000,
|
|
4041
|
+
title: localization.rowActions
|
|
4042
|
+
}, React__default.createElement(material.IconButton, {
|
|
4043
|
+
"aria-label": localization.rowActions,
|
|
4044
|
+
onClick: handleOpenRowActionMenu,
|
|
4045
|
+
size: "small",
|
|
4046
|
+
sx: commonIconButtonStyles
|
|
4047
|
+
}, React__default.createElement(MoreHorizIcon, null))), React__default.createElement(MRT_RowActionMenu, {
|
|
4048
|
+
anchorEl: anchorEl,
|
|
4049
|
+
handleEdit: handleStartEditMode,
|
|
4050
|
+
row: row,
|
|
4051
|
+
setAnchorEl: setAnchorEl,
|
|
4052
|
+
tableInstance: tableInstance
|
|
4053
|
+
})) : null);
|
|
4054
|
+
};
|
|
4055
|
+
|
|
4056
|
+
var MRT_SelectCheckbox = function MRT_SelectCheckbox(_ref) {
|
|
4057
|
+
var row = _ref.row,
|
|
4058
|
+
selectAll = _ref.selectAll,
|
|
4059
|
+
tableInstance = _ref.tableInstance;
|
|
4060
|
+
var getRowModel = tableInstance.getRowModel,
|
|
4061
|
+
getSelectedRowModel = tableInstance.getSelectedRowModel,
|
|
4062
|
+
getState = tableInstance.getState,
|
|
4063
|
+
_tableInstance$option = tableInstance.options,
|
|
4064
|
+
localization = _tableInstance$option.localization,
|
|
4065
|
+
muiSelectCheckboxProps = _tableInstance$option.muiSelectCheckboxProps,
|
|
4066
|
+
onSelectChange = _tableInstance$option.onSelectChange,
|
|
4067
|
+
onSelectAllChange = _tableInstance$option.onSelectAllChange,
|
|
4068
|
+
selectAllMode = _tableInstance$option.selectAllMode;
|
|
3911
4069
|
|
|
3912
|
-
|
|
3913
|
-
|
|
3914
|
-
const spec = this.spec;
|
|
3915
|
-
const monitor = this.monitor;
|
|
3916
|
-
return spec.canDrop ? spec.canDrop(monitor.getItem(), monitor) : true;
|
|
3917
|
-
}
|
|
3918
|
-
hover() {
|
|
3919
|
-
const spec = this.spec;
|
|
3920
|
-
const monitor = this.monitor;
|
|
3921
|
-
if (spec.hover) {
|
|
3922
|
-
spec.hover(monitor.getItem(), monitor);
|
|
3923
|
-
}
|
|
3924
|
-
}
|
|
3925
|
-
drop() {
|
|
3926
|
-
const spec = this.spec;
|
|
3927
|
-
const monitor = this.monitor;
|
|
3928
|
-
if (spec.drop) {
|
|
3929
|
-
return spec.drop(monitor.getItem(), monitor);
|
|
3930
|
-
}
|
|
3931
|
-
return;
|
|
3932
|
-
}
|
|
3933
|
-
constructor(spec, monitor){
|
|
3934
|
-
this.spec = spec;
|
|
3935
|
-
this.monitor = monitor;
|
|
3936
|
-
}
|
|
3937
|
-
}
|
|
4070
|
+
var _getState = getState(),
|
|
4071
|
+
isDensePadding = _getState.isDensePadding;
|
|
3938
4072
|
|
|
3939
|
-
function
|
|
3940
|
-
|
|
3941
|
-
|
|
3942
|
-
|
|
3943
|
-
|
|
3944
|
-
|
|
3945
|
-
|
|
3946
|
-
}, [
|
|
3947
|
-
spec
|
|
3948
|
-
]);
|
|
3949
|
-
return dropTarget;
|
|
3950
|
-
}
|
|
4073
|
+
var handleSelectChange = function handleSelectChange(event) {
|
|
4074
|
+
if (selectAll) {
|
|
4075
|
+
if (selectAllMode === 'all') {
|
|
4076
|
+
tableInstance.getToggleAllRowsSelectedHandler()(event);
|
|
4077
|
+
} else if (selectAllMode === 'page') {
|
|
4078
|
+
tableInstance.getToggleAllPageRowsSelectedHandler()(event);
|
|
4079
|
+
}
|
|
3951
4080
|
|
|
3952
|
-
|
|
3953
|
-
|
|
3954
|
-
|
|
3955
|
-
|
|
3956
|
-
|
|
3957
|
-
|
|
3958
|
-
|
|
3959
|
-
|
|
3960
|
-
|
|
3961
|
-
|
|
3962
|
-
|
|
3963
|
-
|
|
3964
|
-
|
|
3965
|
-
|
|
3966
|
-
|
|
3967
|
-
|
|
3968
|
-
|
|
3969
|
-
}
|
|
4081
|
+
onSelectAllChange == null ? void 0 : onSelectAllChange({
|
|
4082
|
+
event: event,
|
|
4083
|
+
selectedRows: event.target.checked ? getRowModel().flatRows : [],
|
|
4084
|
+
tableInstance: tableInstance
|
|
4085
|
+
});
|
|
4086
|
+
} else if (row) {
|
|
4087
|
+
row == null ? void 0 : row.getToggleSelectedHandler()(event);
|
|
4088
|
+
onSelectChange == null ? void 0 : onSelectChange({
|
|
4089
|
+
event: event,
|
|
4090
|
+
row: row,
|
|
4091
|
+
selectedRows: event.target.checked ? [].concat(getSelectedRowModel().flatRows, [row]) : getSelectedRowModel().flatRows.filter(function (selectedRow) {
|
|
4092
|
+
return selectedRow.id !== row.id;
|
|
4093
|
+
}),
|
|
4094
|
+
tableInstance: tableInstance
|
|
4095
|
+
});
|
|
4096
|
+
}
|
|
4097
|
+
};
|
|
3970
4098
|
|
|
3971
|
-
|
|
3972
|
-
|
|
3973
|
-
|
|
3974
|
-
|
|
3975
|
-
|
|
3976
|
-
|
|
3977
|
-
|
|
3978
|
-
|
|
3979
|
-
|
|
3980
|
-
|
|
3981
|
-
|
|
3982
|
-
|
|
3983
|
-
|
|
3984
|
-
|
|
4099
|
+
var checkboxProps = muiSelectCheckboxProps instanceof Function ? muiSelectCheckboxProps({
|
|
4100
|
+
isSelectAll: !!selectAll,
|
|
4101
|
+
row: row,
|
|
4102
|
+
tableInstance: tableInstance
|
|
4103
|
+
}) : muiSelectCheckboxProps;
|
|
4104
|
+
return React__default.createElement(material.Tooltip, {
|
|
4105
|
+
arrow: true,
|
|
4106
|
+
enterDelay: 1000,
|
|
4107
|
+
enterNextDelay: 1000,
|
|
4108
|
+
title: selectAll ? localization.toggleSelectAll : localization.toggleSelectRow
|
|
4109
|
+
}, React__default.createElement(material.Checkbox, Object.assign({
|
|
4110
|
+
checked: selectAll ? tableInstance.getIsAllRowsSelected() : row == null ? void 0 : row.getIsSelected(),
|
|
4111
|
+
indeterminate: selectAll ? tableInstance.getIsSomeRowsSelected() : row == null ? void 0 : row.getIsSomeSelected(),
|
|
4112
|
+
inputProps: {
|
|
4113
|
+
'aria-label': selectAll ? localization.toggleSelectAll : localization.toggleSelectRow
|
|
4114
|
+
},
|
|
4115
|
+
onChange: handleSelectChange,
|
|
4116
|
+
size: isDensePadding ? 'small' : 'medium'
|
|
4117
|
+
}, checkboxProps, {
|
|
4118
|
+
sx: _extends({
|
|
4119
|
+
height: isDensePadding ? '1.75rem' : '2.25rem',
|
|
4120
|
+
width: isDensePadding ? '1.75rem' : '2.25rem'
|
|
4121
|
+
}, checkboxProps == null ? void 0 : checkboxProps.sx)
|
|
4122
|
+
})));
|
|
4123
|
+
};
|
|
3985
4124
|
|
|
3986
4125
|
// cheap lodash replacements
|
|
3987
4126
|
function memoize(fn) {
|
|
@@ -5827,38 +5966,6 @@ var MRT_TableHeadCellFilterLabel = function MRT_TableHeadCellFilterLabel(_ref) {
|
|
|
5827
5966
|
}, showFilters && !column.getFilterValue() ? React__default.createElement(FilterAltOffIcon, null) : React__default.createElement(FilterAltIcon, null)));
|
|
5828
5967
|
};
|
|
5829
5968
|
|
|
5830
|
-
var MRT_TableHeadCellGrabHandle = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
5831
|
-
var tableInstance = _ref.tableInstance;
|
|
5832
|
-
var _tableInstance$option = tableInstance.options,
|
|
5833
|
-
DragHandleIcon = _tableInstance$option.icons.DragHandleIcon,
|
|
5834
|
-
localization = _tableInstance$option.localization;
|
|
5835
|
-
return React__default.createElement(material.Tooltip, {
|
|
5836
|
-
arrow: true,
|
|
5837
|
-
enterDelay: 1000,
|
|
5838
|
-
enterNextDelay: 1000,
|
|
5839
|
-
placement: "top",
|
|
5840
|
-
title: localization.grab
|
|
5841
|
-
}, React__default.createElement(material.IconButton, {
|
|
5842
|
-
disableRipple: true,
|
|
5843
|
-
ref: ref,
|
|
5844
|
-
size: "small",
|
|
5845
|
-
sx: {
|
|
5846
|
-
cursor: 'grab',
|
|
5847
|
-
m: 0,
|
|
5848
|
-
opacity: 0.5,
|
|
5849
|
-
p: '2px',
|
|
5850
|
-
transition: 'all 0.2s ease-in-out',
|
|
5851
|
-
'&:hover': {
|
|
5852
|
-
backgroundColor: 'transparent',
|
|
5853
|
-
opacity: 1
|
|
5854
|
-
},
|
|
5855
|
-
'&:active': {
|
|
5856
|
-
cursor: 'grabbing'
|
|
5857
|
-
}
|
|
5858
|
-
}
|
|
5859
|
-
}, React__default.createElement(DragHandleIcon, null)));
|
|
5860
|
-
});
|
|
5861
|
-
|
|
5862
5969
|
var MRT_TableHeadCellResizeHandle = function MRT_TableHeadCellResizeHandle(_ref) {
|
|
5863
5970
|
var header = _ref.header,
|
|
5864
5971
|
tableInstance = _ref.tableInstance;
|
|
@@ -5982,7 +6089,7 @@ var MRT_ToggleColumnActionMenuButton = function MRT_ToggleColumnActionMenuButton
|
|
|
5982
6089
|
};
|
|
5983
6090
|
|
|
5984
6091
|
var MRT_TableHeadCell = function MRT_TableHeadCell(_ref) {
|
|
5985
|
-
var
|
|
6092
|
+
var _ref2, _ref3, _columnDef$minSize, _columnDef$header$len, _columnDef$header;
|
|
5986
6093
|
|
|
5987
6094
|
var dragRef = _ref.dragRef,
|
|
5988
6095
|
dropRef = _ref.dropRef,
|
|
@@ -6016,10 +6123,10 @@ var MRT_TableHeadCell = function MRT_TableHeadCell(_ref) {
|
|
|
6016
6123
|
|
|
6017
6124
|
var tableCellProps = _extends({}, mTableHeadCellProps, mcTableHeadCellProps);
|
|
6018
6125
|
|
|
6019
|
-
var headerElement = (columnDef == null ? void 0 : columnDef.Header) instanceof Function ? columnDef == null ? void 0 : columnDef.Header == null ? void 0 : columnDef.Header({
|
|
6126
|
+
var headerElement = (_ref2 = (_ref3 = (columnDef == null ? void 0 : columnDef.Header) instanceof Function ? columnDef == null ? void 0 : columnDef.Header == null ? void 0 : columnDef.Header({
|
|
6020
6127
|
header: header,
|
|
6021
6128
|
tableInstance: tableInstance
|
|
6022
|
-
}) :
|
|
6129
|
+
}) : columnDef == null ? void 0 : columnDef.Header) != null ? _ref3 : header.renderHeader()) != null ? _ref2 : columnDef.header;
|
|
6023
6130
|
|
|
6024
6131
|
var getIsLastLeftPinnedColumn = function getIsLastLeftPinnedColumn() {
|
|
6025
6132
|
return column.getIsPinned() === 'left' && tableInstance.getLeftLeafHeaders().length - 1 === column.getPinnedIndex();
|
|
@@ -6037,7 +6144,7 @@ var MRT_TableHeadCell = function MRT_TableHeadCell(_ref) {
|
|
|
6037
6144
|
align: columnDefType === 'group' ? 'center' : 'left',
|
|
6038
6145
|
colSpan: header.colSpan
|
|
6039
6146
|
}, tableCellProps, {
|
|
6040
|
-
ref: columnDefType === 'data' ? dropRef : undefined,
|
|
6147
|
+
ref: columnDefType === 'data' && enableColumnOrdering ? dropRef : undefined,
|
|
6041
6148
|
sx: function sx(theme) {
|
|
6042
6149
|
return _extends({
|
|
6043
6150
|
backgroundColor: column.getIsPinned() && columnDefType !== 'group' ? material.alpha(material.lighten(theme.palette.background["default"], 0.04), 0.95) : 'inherit',
|
|
@@ -6050,7 +6157,7 @@ var MRT_TableHeadCell = function MRT_TableHeadCell(_ref) {
|
|
|
6050
6157
|
p: isDensePadding ? columnDefType === 'display' ? '0 0.5rem' : '0.5rem' : columnDefType === 'display' ? '0.5rem 0.75rem' : '1rem',
|
|
6051
6158
|
pb: columnDefType === 'display' ? 0 : undefined,
|
|
6052
6159
|
position: column.getIsPinned() && columnDefType !== 'group' ? 'sticky' : undefined,
|
|
6053
|
-
pt: columnDefType !== 'data' ? 0 : isDensePadding ? '0.25' : '.
|
|
6160
|
+
pt: columnDefType !== 'data' ? 0 : isDensePadding ? '0.25' : '.75rem',
|
|
6054
6161
|
right: column.getIsPinned() === 'right' ? getTotalRight() + "px" : undefined,
|
|
6055
6162
|
transition: "all " + (enableColumnResizing ? 0 : '0.2s') + " ease-in-out",
|
|
6056
6163
|
verticalAlign: 'text-top',
|
|
@@ -6092,8 +6199,7 @@ var MRT_TableHeadCell = function MRT_TableHeadCell(_ref) {
|
|
|
6092
6199
|
sx: {
|
|
6093
6200
|
whiteSpace: 'nowrap'
|
|
6094
6201
|
}
|
|
6095
|
-
}, columnDefType === 'data' && (enableColumnOrdering && columnDef.enableColumnOrdering !== false || enableGrouping && columnDef.enableGrouping !== false) && React__default.createElement(
|
|
6096
|
-
header: header,
|
|
6202
|
+
}, columnDefType === 'data' && (enableColumnOrdering && columnDef.enableColumnOrdering !== false || enableGrouping && columnDef.enableGrouping !== false) && React__default.createElement(MRT_GrabHandleButton, {
|
|
6097
6203
|
ref: dragRef,
|
|
6098
6204
|
tableInstance: tableInstance
|
|
6099
6205
|
}), (enableColumnActions || columnDef.enableColumnActions) && columnDef.enableColumnActions !== false && columnDefType !== 'group' && React__default.createElement(MRT_ToggleColumnActionMenuButton, {
|
|
@@ -6120,20 +6226,12 @@ var MRT_DraggableTableHeadCell = function MRT_DraggableTableHeadCell(_ref) {
|
|
|
6120
6226
|
var _getState = getState(),
|
|
6121
6227
|
columnOrder = _getState.columnOrder;
|
|
6122
6228
|
|
|
6123
|
-
var
|
|
6124
|
-
if (movingHeader.column.getCanPin()) {
|
|
6125
|
-
movingHeader.column.pin(receivingHeader.column.getIsPinned());
|
|
6126
|
-
}
|
|
6127
|
-
|
|
6128
|
-
var currentIndex = movingHeader.index;
|
|
6129
|
-
columnOrder.splice(receivingHeader.index, 0, columnOrder.splice(currentIndex, 1)[0]);
|
|
6130
|
-
setColumnOrder([].concat(columnOrder));
|
|
6131
|
-
};
|
|
6229
|
+
var column = header.column;
|
|
6132
6230
|
|
|
6133
6231
|
var _useDrop = useDrop({
|
|
6134
|
-
accept: '
|
|
6135
|
-
drop: function drop(
|
|
6136
|
-
return
|
|
6232
|
+
accept: 'column',
|
|
6233
|
+
drop: function drop(movingColumn) {
|
|
6234
|
+
return reorderColumn(movingColumn, column, columnOrder, setColumnOrder);
|
|
6137
6235
|
}
|
|
6138
6236
|
}),
|
|
6139
6237
|
dropRef = _useDrop[1];
|
|
@@ -6145,9 +6243,9 @@ var MRT_DraggableTableHeadCell = function MRT_DraggableTableHeadCell(_ref) {
|
|
|
6145
6243
|
};
|
|
6146
6244
|
},
|
|
6147
6245
|
item: function item() {
|
|
6148
|
-
return
|
|
6246
|
+
return column;
|
|
6149
6247
|
},
|
|
6150
|
-
type: '
|
|
6248
|
+
type: 'column'
|
|
6151
6249
|
}),
|
|
6152
6250
|
isDragging = _useDrag[0].isDragging,
|
|
6153
6251
|
dragRef = _useDrag[1],
|
|
@@ -6371,14 +6469,17 @@ var MRT_TableBodyCell = function MRT_TableBodyCell(_ref) {
|
|
|
6371
6469
|
_tableInstance$option = tableInstance.options,
|
|
6372
6470
|
editingMode = _tableInstance$option.editingMode,
|
|
6373
6471
|
enableClickToCopy = _tableInstance$option.enableClickToCopy,
|
|
6472
|
+
enableColumnOrdering = _tableInstance$option.enableColumnOrdering,
|
|
6374
6473
|
enableEditing = _tableInstance$option.enableEditing,
|
|
6375
6474
|
idPrefix = _tableInstance$option.idPrefix,
|
|
6376
6475
|
muiTableBodyCellProps = _tableInstance$option.muiTableBodyCellProps,
|
|
6377
6476
|
muiTableBodyCellSkeletonProps = _tableInstance$option.muiTableBodyCellSkeletonProps,
|
|
6378
6477
|
onCellClick = _tableInstance$option.onCellClick,
|
|
6478
|
+
setColumnOrder = tableInstance.setColumnOrder,
|
|
6379
6479
|
setCurrentEditingCell = tableInstance.setCurrentEditingCell;
|
|
6380
6480
|
|
|
6381
6481
|
var _getState = getState(),
|
|
6482
|
+
columnOrder = _getState.columnOrder,
|
|
6382
6483
|
currentEditingCell = _getState.currentEditingCell,
|
|
6383
6484
|
currentEditingRow = _getState.currentEditingRow,
|
|
6384
6485
|
isDensePadding = _getState.isDensePadding,
|
|
@@ -6389,6 +6490,15 @@ var MRT_TableBodyCell = function MRT_TableBodyCell(_ref) {
|
|
|
6389
6490
|
row = cell.row;
|
|
6390
6491
|
var columnDef = column.columnDef,
|
|
6391
6492
|
columnDefType = column.columnDefType;
|
|
6493
|
+
|
|
6494
|
+
var _useDrop = useDrop({
|
|
6495
|
+
accept: 'column',
|
|
6496
|
+
drop: function drop(movingColumn) {
|
|
6497
|
+
return reorderColumn(movingColumn, column, columnOrder, setColumnOrder);
|
|
6498
|
+
}
|
|
6499
|
+
}),
|
|
6500
|
+
dropRef = _useDrop[1];
|
|
6501
|
+
|
|
6392
6502
|
var mTableCellBodyProps = muiTableBodyCellProps instanceof Function ? muiTableBodyCellProps({
|
|
6393
6503
|
cell: cell,
|
|
6394
6504
|
tableInstance: tableInstance
|
|
@@ -6442,6 +6552,7 @@ var MRT_TableBodyCell = function MRT_TableBodyCell(_ref) {
|
|
|
6442
6552
|
},
|
|
6443
6553
|
onDoubleClick: handleDoubleClick
|
|
6444
6554
|
}, tableCellProps, {
|
|
6555
|
+
ref: columnDefType === 'data' && enableColumnOrdering ? dropRef : undefined,
|
|
6445
6556
|
sx: function sx(theme) {
|
|
6446
6557
|
return _extends({
|
|
6447
6558
|
backgroundColor: column.getIsPinned() ? material.alpha(material.lighten(theme.palette.background["default"], 0.04), 0.95) : undefined,
|
|
@@ -6593,7 +6704,7 @@ var MRT_TableBody = function MRT_TableBody(_ref) {
|
|
|
6593
6704
|
};
|
|
6594
6705
|
|
|
6595
6706
|
var MRT_TableFooterCell = function MRT_TableFooterCell(_ref) {
|
|
6596
|
-
var _ref2, _ref3,
|
|
6707
|
+
var _ref2, _ref3, _ref4;
|
|
6597
6708
|
|
|
6598
6709
|
var footer = _ref.footer,
|
|
6599
6710
|
tableInstance = _ref.tableInstance;
|
|
@@ -6637,10 +6748,10 @@ var MRT_TableFooterCell = function MRT_TableFooterCell(_ref) {
|
|
|
6637
6748
|
verticalAlign: 'text-top'
|
|
6638
6749
|
}, tableCellProps == null ? void 0 : tableCellProps.sx);
|
|
6639
6750
|
}
|
|
6640
|
-
}), React__default.createElement(React__default.Fragment, null, footer.isPlaceholder ? null : columnDef.Footer instanceof Function ? columnDef.Footer == null ? void 0 : columnDef.Footer({
|
|
6751
|
+
}), React__default.createElement(React__default.Fragment, null, footer.isPlaceholder ? null : (_ref2 = (_ref3 = (_ref4 = columnDef.Footer instanceof Function ? columnDef.Footer == null ? void 0 : columnDef.Footer({
|
|
6641
6752
|
footer: footer,
|
|
6642
6753
|
tableInstance: tableInstance
|
|
6643
|
-
}) :
|
|
6754
|
+
}) : columnDef.Footer) != null ? _ref4 : columnDef.footer) != null ? _ref3 : footer.renderFooter()) != null ? _ref2 : null));
|
|
6644
6755
|
};
|
|
6645
6756
|
|
|
6646
6757
|
var MRT_TableFooterRow = function MRT_TableFooterRow(_ref) {
|
|
@@ -6793,54 +6904,6 @@ var MRT_TablePaper = function MRT_TablePaper(_ref) {
|
|
|
6793
6904
|
})));
|
|
6794
6905
|
};
|
|
6795
6906
|
|
|
6796
|
-
var getAllLeafColumnDefs = function getAllLeafColumnDefs(columns) {
|
|
6797
|
-
var lowestLevelColumns = columns;
|
|
6798
|
-
var currentCols = columns;
|
|
6799
|
-
|
|
6800
|
-
while (!!((_currentCols = currentCols) != null && _currentCols.length) && currentCols.some(function (col) {
|
|
6801
|
-
return col.columns;
|
|
6802
|
-
})) {
|
|
6803
|
-
var _currentCols;
|
|
6804
|
-
|
|
6805
|
-
var nextCols = currentCols.filter(function (col) {
|
|
6806
|
-
return !!col.columns;
|
|
6807
|
-
}).map(function (col) {
|
|
6808
|
-
return col.columns;
|
|
6809
|
-
}).flat();
|
|
6810
|
-
|
|
6811
|
-
if (nextCols.every(function (col) {
|
|
6812
|
-
return !(col != null && col.columns);
|
|
6813
|
-
})) {
|
|
6814
|
-
lowestLevelColumns = [].concat(lowestLevelColumns, nextCols);
|
|
6815
|
-
}
|
|
6816
|
-
|
|
6817
|
-
currentCols = nextCols;
|
|
6818
|
-
}
|
|
6819
|
-
|
|
6820
|
-
return lowestLevelColumns.filter(function (col) {
|
|
6821
|
-
return !col.columns;
|
|
6822
|
-
});
|
|
6823
|
-
};
|
|
6824
|
-
var createGroup = function createGroup(table, column, currentFilterFns) {
|
|
6825
|
-
var _column$columns;
|
|
6826
|
-
|
|
6827
|
-
return table.createGroup(_extends({}, column, {
|
|
6828
|
-
columns: column == null ? void 0 : (_column$columns = column.columns) == null ? void 0 : _column$columns.map == null ? void 0 : _column$columns.map(function (col) {
|
|
6829
|
-
return col.columns ? createGroup(table, col, currentFilterFns) : createDataColumn(table, col, currentFilterFns);
|
|
6830
|
-
})
|
|
6831
|
-
}));
|
|
6832
|
-
};
|
|
6833
|
-
var createDataColumn = function createDataColumn(table, column, currentFilterFns) {
|
|
6834
|
-
return (// @ts-ignore
|
|
6835
|
-
table.createDataColumn(column.id, _extends({
|
|
6836
|
-
filterFn: currentFilterFns[column.id] instanceof Function ? currentFilterFns[column.id] : defaultFilterFNs[currentFilterFns[column.id]]
|
|
6837
|
-
}, column))
|
|
6838
|
-
);
|
|
6839
|
-
};
|
|
6840
|
-
var createDisplayColumn = function createDisplayColumn(table, column) {
|
|
6841
|
-
return table.createDisplayColumn(column);
|
|
6842
|
-
};
|
|
6843
|
-
|
|
6844
6907
|
var MRT_TableRoot = function MRT_TableRoot(props) {
|
|
6845
6908
|
var _initialState$current, _initialState$current2, _initialState$isDense, _initialState$isFullS, _initialState$showFil, _initialState$showGlo, _props$globalFilterFn, _props$state3, _props$state4;
|
|
6846
6909
|
|
|
@@ -6859,7 +6922,7 @@ var MRT_TableRoot = function MRT_TableRoot(props) {
|
|
|
6859
6922
|
var _props$initialState, _initState$columnOrde;
|
|
6860
6923
|
|
|
6861
6924
|
var initState = (_props$initialState = props.initialState) != null ? _props$initialState : {};
|
|
6862
|
-
initState.columnOrder = ((_initState$columnOrde = initState == null ? void 0 : initState.columnOrder) != null ? _initState$columnOrde : props.enableColumnOrdering) ? [showActionColumn && 'mrt-row-actions', showExpandColumn && 'mrt-expand', props.enableRowSelection && 'mrt-select', props.enableRowNumbers && 'mrt-row-numbers'].concat(getAllLeafColumnDefs(props.columns).map(function (c) {
|
|
6925
|
+
initState.columnOrder = ((_initState$columnOrde = initState == null ? void 0 : initState.columnOrder) != null ? _initState$columnOrde : props.enableColumnOrdering || props.enableGrouping) ? [showActionColumn && 'mrt-row-actions', showExpandColumn && 'mrt-expand', props.enableRowSelection && 'mrt-select', props.enableRowNumbers && 'mrt-row-numbers'].concat(getAllLeafColumnDefs(props.columns).map(function (c) {
|
|
6863
6926
|
return c.id;
|
|
6864
6927
|
})).filter(Boolean) : [];
|
|
6865
6928
|
|
|
@@ -6927,7 +6990,24 @@ var MRT_TableRoot = function MRT_TableRoot(props) {
|
|
|
6927
6990
|
setCurrentGlobalFilterFn = _useState9[1];
|
|
6928
6991
|
|
|
6929
6992
|
var table = React.useMemo(function () {
|
|
6930
|
-
return
|
|
6993
|
+
return (// @ts-ignore
|
|
6994
|
+
reactTable.createTable().setOptions({
|
|
6995
|
+
//@ts-ignore
|
|
6996
|
+
filterFns: defaultFilterFNs,
|
|
6997
|
+
getCoreRowModel: reactTable.getCoreRowModel(),
|
|
6998
|
+
getExpandedRowModel: reactTable.getExpandedRowModel(),
|
|
6999
|
+
getFacetedRowModel: reactTable.getFacetedRowModel(),
|
|
7000
|
+
getFilteredRowModel: reactTable.getFilteredRowModel(),
|
|
7001
|
+
getGroupedRowModel: reactTable.getGroupedRowModel(),
|
|
7002
|
+
getPaginationRowModel: reactTable.getPaginationRowModel(),
|
|
7003
|
+
getSortedRowModel: reactTable.getSortedRowModel(),
|
|
7004
|
+
getSubRows: function getSubRows(row) {
|
|
7005
|
+
return row == null ? void 0 : row.subRows;
|
|
7006
|
+
},
|
|
7007
|
+
idPrefix: idPrefix,
|
|
7008
|
+
initialState: initialState
|
|
7009
|
+
})
|
|
7010
|
+
);
|
|
6931
7011
|
}, []);
|
|
6932
7012
|
var displayColumns = React.useMemo(function () {
|
|
6933
7013
|
var _props$localization, _props$localization2, _props$localization3, _props$localization5;
|
|
@@ -6942,6 +7022,8 @@ var MRT_TableRoot = function MRT_TableRoot(props) {
|
|
|
6942
7022
|
},
|
|
6943
7023
|
header: (_props$localization = props.localization) == null ? void 0 : _props$localization.actions,
|
|
6944
7024
|
id: 'mrt-row-actions',
|
|
7025
|
+
muiTableBodyCellProps: props.muiTableBodyCellProps,
|
|
7026
|
+
muiTableHeadCellProps: props.muiTableHeadCellProps,
|
|
6945
7027
|
size: 60
|
|
6946
7028
|
}), showExpandColumn && createDisplayColumn(table, {
|
|
6947
7029
|
Cell: function Cell(_ref4) {
|
|
@@ -6958,6 +7040,8 @@ var MRT_TableRoot = function MRT_TableRoot(props) {
|
|
|
6958
7040
|
},
|
|
6959
7041
|
header: (_props$localization2 = props.localization) == null ? void 0 : _props$localization2.expand,
|
|
6960
7042
|
id: 'mrt-expand',
|
|
7043
|
+
muiTableBodyCellProps: props.muiTableBodyCellProps,
|
|
7044
|
+
muiTableHeadCellProps: props.muiTableHeadCellProps,
|
|
6961
7045
|
size: 50
|
|
6962
7046
|
}), props.enableRowSelection && createDisplayColumn(table, {
|
|
6963
7047
|
Cell: function Cell(_ref5) {
|
|
@@ -6975,6 +7059,8 @@ var MRT_TableRoot = function MRT_TableRoot(props) {
|
|
|
6975
7059
|
},
|
|
6976
7060
|
header: (_props$localization3 = props.localization) == null ? void 0 : _props$localization3.select,
|
|
6977
7061
|
id: 'mrt-select',
|
|
7062
|
+
muiTableBodyCellProps: props.muiTableBodyCellProps,
|
|
7063
|
+
muiTableHeadCellProps: props.muiTableHeadCellProps,
|
|
6978
7064
|
size: 50
|
|
6979
7065
|
}), props.enableRowNumbers && createDisplayColumn(table, {
|
|
6980
7066
|
Cell: function Cell(_ref6) {
|
|
@@ -6988,6 +7074,8 @@ var MRT_TableRoot = function MRT_TableRoot(props) {
|
|
|
6988
7074
|
},
|
|
6989
7075
|
header: (_props$localization5 = props.localization) == null ? void 0 : _props$localization5.rowNumbers,
|
|
6990
7076
|
id: 'mrt-row-numbers',
|
|
7077
|
+
muiTableBodyCellProps: props.muiTableBodyCellProps,
|
|
7078
|
+
muiTableHeadCellProps: props.muiTableHeadCellProps,
|
|
6991
7079
|
size: 50
|
|
6992
7080
|
})].filter(Boolean);
|
|
6993
7081
|
}, [props.editingMode, props.enableEditing, props.enableExpandAll, props.enableExpanding, props.enableGrouping, props.enableRowActions, props.enableRowNumbers, props.enableRowSelection, props.enableSelectAll, props.localization, table]);
|
|
@@ -7008,26 +7096,12 @@ var MRT_TableRoot = function MRT_TableRoot(props) {
|
|
|
7008
7096
|
}) : props.data;
|
|
7009
7097
|
}, [props.data, (_props$state3 = props.state) == null ? void 0 : _props$state3.isLoading, (_props$state4 = props.state) == null ? void 0 : _props$state4.showSkeletons]); //@ts-ignore
|
|
7010
7098
|
|
|
7011
|
-
var tableInstance = _extends({}, reactTable.useTableInstance(table, _extends({
|
|
7012
|
-
filterFns: defaultFilterFNs,
|
|
7013
|
-
getCoreRowModel: reactTable.getCoreRowModel(),
|
|
7014
|
-
getExpandedRowModel: reactTable.getExpandedRowModel(),
|
|
7015
|
-
getFacetedRowModel: reactTable.getFacetedRowModel(),
|
|
7016
|
-
getFilteredRowModel: reactTable.getFilteredRowModel(),
|
|
7017
|
-
getGroupedRowModel: reactTable.getGroupedRowModel(),
|
|
7018
|
-
getPaginationRowModel: reactTable.getPaginationRowModel(),
|
|
7019
|
-
getSortedRowModel: reactTable.getSortedRowModel(),
|
|
7020
|
-
getSubRows: function getSubRows(row) {
|
|
7021
|
-
return row == null ? void 0 : row.subRows;
|
|
7022
|
-
},
|
|
7023
|
-
//@ts-ignore
|
|
7024
|
-
globalFilterFn: currentGlobalFilterFn
|
|
7025
|
-
}, props, {
|
|
7099
|
+
var tableInstance = _extends({}, reactTable.useTableInstance(table, _extends({}, props, {
|
|
7026
7100
|
//@ts-ignore
|
|
7027
7101
|
columns: columns,
|
|
7028
7102
|
data: data,
|
|
7029
|
-
|
|
7030
|
-
|
|
7103
|
+
//@ts-ignore
|
|
7104
|
+
globalFilterFn: currentGlobalFilterFn,
|
|
7031
7105
|
state: _extends({
|
|
7032
7106
|
currentEditingCell: currentEditingCell,
|
|
7033
7107
|
currentEditingRow: currentEditingRow,
|
|
@@ -7089,7 +7163,7 @@ var MRT_TableRoot = function MRT_TableRoot(props) {
|
|
|
7089
7163
|
}));
|
|
7090
7164
|
};
|
|
7091
7165
|
|
|
7092
|
-
var _excluded$5 = ["autoResetExpanded", "columnResizeMode", "defaultColumn", "editingMode", "enableColumnActions", "enableColumnFilters", "enableColumnOrdering", "enableColumnResizing", "enableDensePaddingToggle", "enableExpandAll", "enableFilters", "enableFullScreenToggle", "enableGlobalFilter", "enableGrouping", "enableHiding", "enableMultiRowSelection", "enablePagination", "enablePinning", "enableSelectAll", "enableSorting", "enableStickyHeader", "enableTableFooter", "enableTableHead", "enableToolbarBottom", "enableToolbarInternalActions", "enableToolbarTop", "icons", "localization", "persistentStateMode", "positionActionsColumn", "positionPagination", "positionToolbarActions", "positionToolbarAlertBanner"];
|
|
7166
|
+
var _excluded$5 = ["autoResetExpanded", "columnResizeMode", "defaultColumn", "editingMode", "enableColumnActions", "enableColumnFilters", "enableColumnOrdering", "enableColumnResizing", "enableDensePaddingToggle", "enableExpandAll", "enableFilters", "enableFullScreenToggle", "enableGlobalFilter", "enableGrouping", "enableHiding", "enableMultiRowSelection", "enablePagination", "enablePinning", "enableSelectAll", "enableSorting", "enableStickyHeader", "enableTableFooter", "enableTableHead", "enableToolbarBottom", "enableToolbarInternalActions", "enableToolbarTop", "icons", "localization", "persistentStateMode", "positionActionsColumn", "positionPagination", "positionToolbarActions", "positionToolbarAlertBanner", "selectAllMode"];
|
|
7093
7167
|
var MaterialReactTable = (function (_ref) {
|
|
7094
7168
|
var _ref$autoResetExpande = _ref.autoResetExpanded,
|
|
7095
7169
|
autoResetExpanded = _ref$autoResetExpande === void 0 ? false : _ref$autoResetExpande,
|
|
@@ -7159,6 +7233,8 @@ var MaterialReactTable = (function (_ref) {
|
|
|
7159
7233
|
positionToolbarActions = _ref$positionToolbarA === void 0 ? 'top' : _ref$positionToolbarA,
|
|
7160
7234
|
_ref$positionToolbarA2 = _ref.positionToolbarAlertBanner,
|
|
7161
7235
|
positionToolbarAlertBanner = _ref$positionToolbarA2 === void 0 ? 'top' : _ref$positionToolbarA2,
|
|
7236
|
+
_ref$selectAllMode = _ref.selectAllMode,
|
|
7237
|
+
selectAllMode = _ref$selectAllMode === void 0 ? 'all' : _ref$selectAllMode,
|
|
7162
7238
|
rest = _objectWithoutPropertiesLoose(_ref, _excluded$5);
|
|
7163
7239
|
|
|
7164
7240
|
return React__default.createElement(MRT_TableRoot, Object.assign({
|
|
@@ -7194,7 +7270,8 @@ var MaterialReactTable = (function (_ref) {
|
|
|
7194
7270
|
positionActionsColumn: positionActionsColumn,
|
|
7195
7271
|
positionPagination: positionPagination,
|
|
7196
7272
|
positionToolbarActions: positionToolbarActions,
|
|
7197
|
-
positionToolbarAlertBanner: positionToolbarAlertBanner
|
|
7273
|
+
positionToolbarAlertBanner: positionToolbarAlertBanner,
|
|
7274
|
+
selectAllMode: selectAllMode
|
|
7198
7275
|
}, rest));
|
|
7199
7276
|
});
|
|
7200
7277
|
|