@coreui/react-pro 4.11.0-next.1 → 4.11.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/components/accordion/index.d.ts +1 -2
- package/dist/components/calendar/CCalendar.d.ts +2 -2
- package/dist/components/dropdown/CDropdown.d.ts +7 -0
- package/dist/components/multi-select/CMultiSelect.d.ts +3 -3
- package/dist/components/smart-table/CSmartTableHead.d.ts +1 -0
- package/dist/components/smart-table/types.d.ts +12 -0
- package/dist/components/smart-table/utils.d.ts +12 -1
- package/dist/index.es.js +165 -69
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +164 -69
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/src/components/accordion/index.ts +0 -2
- package/src/components/calendar/CCalendar.tsx +2 -2
- package/src/components/dropdown/CDropdown.tsx +13 -8
- package/src/components/dropdown/CDropdownMenu.tsx +45 -41
- package/src/components/multi-select/CMultiSelect.tsx +3 -3
- package/src/components/offcanvas/COffcanvas.tsx +3 -5
- package/src/components/smart-table/CSmartTable.tsx +3 -4
- package/src/components/smart-table/CSmartTableBody.tsx +5 -3
- package/src/components/smart-table/CSmartTableHead.tsx +42 -10
- package/src/components/smart-table/types.ts +13 -0
- package/src/components/smart-table/utils.ts +124 -5
package/README.md
CHANGED
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
|
|
43
43
|
Several quick start options are available:
|
|
44
44
|
|
|
45
|
-
- [Download the latest release](https://github.com/coreui/coreui-react-pro/archive/v4.11.
|
|
45
|
+
- [Download the latest release](https://github.com/coreui/coreui-react-pro/archive/v4.11.1.zip)
|
|
46
46
|
- Clone the repo: `git clone https://github.com/coreui/coreui-react.git`
|
|
47
47
|
- Install with [npm](https://www.npmjs.com/): `npm install @coreui/react`
|
|
48
48
|
- Install with [yarn](https://yarnpkg.com/): `yarn add @coreui/react`
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { CAccordion } from './CAccordion';
|
|
2
2
|
import { CAccordionBody } from './CAccordionBody';
|
|
3
3
|
import { CAccordionButton } from './CAccordionButton';
|
|
4
|
-
import { CAccordionCollapse } from './CAccordionCollapse';
|
|
5
4
|
import { CAccordionHeader } from './CAccordionHeader';
|
|
6
5
|
import { CAccordionItem } from './CAccordionItem';
|
|
7
|
-
export { CAccordion, CAccordionBody, CAccordionButton,
|
|
6
|
+
export { CAccordion, CAccordionBody, CAccordionButton, CAccordionHeader, CAccordionItem, };
|
|
@@ -83,13 +83,13 @@ export interface CCalendarProps {
|
|
|
83
83
|
/**
|
|
84
84
|
* Set whether days in adjacent months shown before or after the current month are selectable. This only applies if the `showAdjacementDays` option is set to true.
|
|
85
85
|
*
|
|
86
|
-
* @since 4.11.0
|
|
86
|
+
* @since 4.11.0
|
|
87
87
|
*/
|
|
88
88
|
selectAdjacementDays?: boolean;
|
|
89
89
|
/**
|
|
90
90
|
* Set whether to display dates in adjacent months (non-selectable) at the start and end of the current month.
|
|
91
91
|
*
|
|
92
|
-
* @since 4.11.0
|
|
92
|
+
* @since 4.11.0
|
|
93
93
|
*/
|
|
94
94
|
showAdjacementDays?: boolean;
|
|
95
95
|
/**
|
|
@@ -64,6 +64,12 @@ export interface CDropdownProps extends HTMLAttributes<HTMLDivElement | HTMLLIEl
|
|
|
64
64
|
* If you want to disable dynamic positioning set this property to `true`.
|
|
65
65
|
*/
|
|
66
66
|
popper?: boolean;
|
|
67
|
+
/**
|
|
68
|
+
* Generates dropdown menu using createPortal.
|
|
69
|
+
*
|
|
70
|
+
* @since 4.8.0
|
|
71
|
+
*/
|
|
72
|
+
portal?: boolean;
|
|
67
73
|
/**
|
|
68
74
|
* Set the dropdown variant to an btn-group, dropdown, input-group, and nav-item.
|
|
69
75
|
*/
|
|
@@ -76,6 +82,7 @@ export interface CDropdownProps extends HTMLAttributes<HTMLDivElement | HTMLLIEl
|
|
|
76
82
|
interface ContextProps extends CDropdownProps {
|
|
77
83
|
dropdownToggleRef: RefObject<any> | undefined;
|
|
78
84
|
setVisible: React.Dispatch<React.SetStateAction<boolean | undefined>>;
|
|
85
|
+
portal: boolean;
|
|
79
86
|
}
|
|
80
87
|
export declare const CDropdownContext: React.Context<ContextProps>;
|
|
81
88
|
export declare const CDropdown: React.ForwardRefExoticComponent<CDropdownProps & React.RefAttributes<HTMLDivElement | HTMLLIElement>>;
|
|
@@ -5,7 +5,7 @@ export interface CMultiSelectProps extends Omit<CFormControlWrapperProps, 'float
|
|
|
5
5
|
/**
|
|
6
6
|
* Allow users to create options if they are not in the list of options.
|
|
7
7
|
*
|
|
8
|
-
* @since 4.11.0
|
|
8
|
+
* @since 4.11.0
|
|
9
9
|
*/
|
|
10
10
|
allowCreateOptions?: boolean;
|
|
11
11
|
/**
|
|
@@ -19,7 +19,7 @@ export interface CMultiSelectProps extends Omit<CFormControlWrapperProps, 'float
|
|
|
19
19
|
/**
|
|
20
20
|
* Clear current search on selecting an item.
|
|
21
21
|
*
|
|
22
|
-
* @since 4.11.0
|
|
22
|
+
* @since 4.11.0
|
|
23
23
|
*/
|
|
24
24
|
clearSearchOnSelect?: boolean;
|
|
25
25
|
/**
|
|
@@ -29,7 +29,7 @@ export interface CMultiSelectProps extends Omit<CFormControlWrapperProps, 'float
|
|
|
29
29
|
/**
|
|
30
30
|
* When set, the options list will have a loading style: loading spinner and reduced opacity.
|
|
31
31
|
*
|
|
32
|
-
* @since 4.11.0
|
|
32
|
+
* @since 4.11.0
|
|
33
33
|
*/
|
|
34
34
|
loading?: boolean;
|
|
35
35
|
/**
|
|
@@ -3,7 +3,9 @@ import { CTableDataCellProps } from '../table/CTableDataCell';
|
|
|
3
3
|
import { CTableHeaderCellProps } from '../table/CTableHeaderCell';
|
|
4
4
|
import { CTableRowProps } from '../table/CTableRow';
|
|
5
5
|
export type Column = {
|
|
6
|
+
children?: Column[];
|
|
6
7
|
filter?: boolean | ((values: any[], onChange: (value: any) => void) => ReactNode);
|
|
8
|
+
group?: string;
|
|
7
9
|
key: string;
|
|
8
10
|
label?: string;
|
|
9
11
|
sorter?: boolean;
|
|
@@ -21,6 +23,16 @@ export type FooterItem = {
|
|
|
21
23
|
label?: string;
|
|
22
24
|
_props?: CTableDataCellProps;
|
|
23
25
|
};
|
|
26
|
+
export type Group = {
|
|
27
|
+
children?: Group[] | Column[];
|
|
28
|
+
colspan?: number;
|
|
29
|
+
deep?: number;
|
|
30
|
+
group?: string;
|
|
31
|
+
key: string;
|
|
32
|
+
label?: string;
|
|
33
|
+
_style?: any;
|
|
34
|
+
_props?: CTableHeaderCellProps;
|
|
35
|
+
};
|
|
24
36
|
export type Item = {
|
|
25
37
|
[key: string]: number | string | any;
|
|
26
38
|
_cellProps?: any;
|
|
@@ -1,10 +1,21 @@
|
|
|
1
|
-
import type { Column, ColumnFilter, ColumnFilterValue, Item, Sorter, SorterValue, TableFilter } from './types';
|
|
1
|
+
import type { Column, ColumnFilter, ColumnFilterValue, Group, Item, Sorter, SorterValue, TableFilter } from './types';
|
|
2
2
|
export declare const filterColumns: (items: Item[], columnFilter: boolean | ColumnFilter | undefined, columnFilterState: ColumnFilterValue, itemsDataColumns: string[]) => Item[];
|
|
3
3
|
export declare const filterTable: (items: Item[], tableFilter: boolean | TableFilter | undefined, tableFilterState: string, itemsDataColumns: string[]) => Item[];
|
|
4
4
|
export declare const getClickedColumnName: (target: HTMLTextAreaElement, columnNames: string[]) => string;
|
|
5
5
|
export declare const getColumnKey: (column: Column | string) => string;
|
|
6
6
|
export declare const getColumnLabel: (column: Column | string) => string;
|
|
7
7
|
export declare const getColumnNames: (columns: (string | Column)[] | undefined, items: Item[]) => string[];
|
|
8
|
+
export declare const getColumns: (_columns: (Column | Group | string)[]) => (Column | string)[];
|
|
9
|
+
export declare const countColumns: (columns: Column[], counter?: number) => number;
|
|
10
|
+
export declare const getColumnGroups: (columns: (string | Column)[] | undefined) => {
|
|
11
|
+
children?: Column[] | Group[] | undefined;
|
|
12
|
+
colspan?: number | undefined;
|
|
13
|
+
group?: string | undefined;
|
|
14
|
+
key: string;
|
|
15
|
+
label?: string | undefined;
|
|
16
|
+
_style?: any;
|
|
17
|
+
_props?: import("../table/CTableHeaderCell").CTableHeaderCellProps | undefined;
|
|
18
|
+
}[][];
|
|
8
19
|
export declare const getColumnNamesFromItems: (items: Item[]) => string[];
|
|
9
20
|
export declare const getColumnSorterState: (key: string, sorterState: SorterValue | undefined) => string | number;
|
|
10
21
|
export declare const getColumnValues: (items: Item[], key: string) => any[];
|
package/dist/index.es.js
CHANGED
|
@@ -2616,15 +2616,6 @@ CAccordionButton.propTypes = {
|
|
|
2616
2616
|
};
|
|
2617
2617
|
CAccordionButton.displayName = 'CAccordionButton';
|
|
2618
2618
|
|
|
2619
|
-
var CAccordionCollapse = forwardRef(function (_a, ref) {
|
|
2620
|
-
var children = _a.children, props = __rest$1(_a, ["children"]);
|
|
2621
|
-
return (React__default$1.createElement(CCollapse, __assign$1({ className: "accordion-collapse" }, props, { ref: ref }), children));
|
|
2622
|
-
});
|
|
2623
|
-
CAccordionCollapse.propTypes = {
|
|
2624
|
-
children: propTypesExports.node,
|
|
2625
|
-
};
|
|
2626
|
-
CAccordionCollapse.displayName = 'CAccordionCollapse';
|
|
2627
|
-
|
|
2628
2619
|
var CAccordionHeader = forwardRef(function (_a, ref) {
|
|
2629
2620
|
var children = _a.children, className = _a.className, rest = __rest$1(_a, ["children", "className"]);
|
|
2630
2621
|
return (React__default$1.createElement("div", __assign$1({ className: classNames$1('accordion-header', className) }, rest, { ref: ref }),
|
|
@@ -9947,11 +9938,12 @@ var PopperManagerWrapper = function (_a) {
|
|
|
9947
9938
|
};
|
|
9948
9939
|
var CDropdownContext = createContext({});
|
|
9949
9940
|
var CDropdown = forwardRef(function (_a, ref) {
|
|
9950
|
-
var
|
|
9941
|
+
var _b;
|
|
9942
|
+
var children = _a.children, alignment = _a.alignment, _c = _a.autoClose, autoClose = _c === void 0 ? true : _c, className = _a.className, dark = _a.dark, direction = _a.direction, onHide = _a.onHide, onShow = _a.onShow, _d = _a.placement, placement = _d === void 0 ? 'bottom-start' : _d, _e = _a.popper, popper = _e === void 0 ? true : _e, _f = _a.portal, portal = _f === void 0 ? false : _f, _g = _a.variant, variant = _g === void 0 ? 'btn-group' : _g, _h = _a.component, component = _h === void 0 ? 'div' : _h, _j = _a.visible, visible = _j === void 0 ? false : _j, rest = __rest$1(_a, ["children", "alignment", "autoClose", "className", "dark", "direction", "onHide", "onShow", "placement", "popper", "portal", "variant", "component", "visible"]);
|
|
9951
9943
|
var dropdownRef = useRef(null);
|
|
9952
9944
|
var dropdownToggleRef = useRef(null);
|
|
9953
9945
|
var forkedRef = useForkedRef(ref, dropdownRef);
|
|
9954
|
-
var
|
|
9946
|
+
var _k = useState(visible), _visible = _k[0], setVisible = _k[1];
|
|
9955
9947
|
var Component = variant === 'nav-item' ? 'li' : component;
|
|
9956
9948
|
// Disable popper if responsive aligment is set.
|
|
9957
9949
|
if (typeof alignment === 'object') {
|
|
@@ -9965,6 +9957,7 @@ var CDropdown = forwardRef(function (_a, ref) {
|
|
|
9965
9957
|
dropdownToggleRef: dropdownToggleRef,
|
|
9966
9958
|
placement: placement,
|
|
9967
9959
|
popper: popper,
|
|
9960
|
+
portal: portal,
|
|
9968
9961
|
variant: variant,
|
|
9969
9962
|
visible: _visible,
|
|
9970
9963
|
setVisible: setVisible,
|
|
@@ -9977,12 +9970,13 @@ var CDropdown = forwardRef(function (_a, ref) {
|
|
|
9977
9970
|
!_visible && onHide && onHide();
|
|
9978
9971
|
}, [_visible]);
|
|
9979
9972
|
return (React__default$1.createElement(CDropdownContext.Provider, { value: contextValues },
|
|
9980
|
-
React__default$1.createElement(PopperManagerWrapper, { popper: popper }, variant === 'input-group' ? (React__default$1.createElement(React__default$1.Fragment, null, children)) : (React__default$1.createElement(Component, __assign$1({ className: classNames$1(variant === 'nav-item' ? 'nav-item dropdown' : variant, {
|
|
9981
|
-
|
|
9982
|
-
|
|
9983
|
-
|
|
9984
|
-
|
|
9985
|
-
|
|
9973
|
+
React__default$1.createElement(PopperManagerWrapper, { popper: popper }, variant === 'input-group' ? (React__default$1.createElement(React__default$1.Fragment, null, children)) : (React__default$1.createElement(Component, __assign$1({ className: classNames$1(variant === 'nav-item' ? 'nav-item dropdown' : variant, (_b = {
|
|
9974
|
+
'dropdown-center': direction === 'center',
|
|
9975
|
+
'dropup dropup-center': direction === 'dropup-center'
|
|
9976
|
+
},
|
|
9977
|
+
_b["".concat(direction)] = direction && direction !== 'center' && direction !== 'dropup-center',
|
|
9978
|
+
_b.show = _visible,
|
|
9979
|
+
_b), className) }, rest, { ref: forkedRef }), children)))));
|
|
9986
9980
|
});
|
|
9987
9981
|
var alignmentDirection = propTypesExports.oneOf(['start', 'end']);
|
|
9988
9982
|
CDropdown.propTypes = {
|
|
@@ -10009,14 +10003,27 @@ CDropdown.propTypes = {
|
|
|
10009
10003
|
onShow: propTypesExports.func,
|
|
10010
10004
|
placement: placementPropType,
|
|
10011
10005
|
popper: propTypesExports.bool,
|
|
10006
|
+
portal: propTypesExports.bool,
|
|
10012
10007
|
variant: propTypesExports.oneOf(['btn-group', 'dropdown', 'input-group', 'nav-item']),
|
|
10013
10008
|
visible: propTypesExports.bool,
|
|
10014
10009
|
};
|
|
10015
10010
|
CDropdown.displayName = 'CDropdown';
|
|
10016
10011
|
|
|
10012
|
+
var alignmentClassNames = function (alignment) {
|
|
10013
|
+
var classNames = [];
|
|
10014
|
+
if (typeof alignment === 'object') {
|
|
10015
|
+
Object.keys(alignment).map(function (key) {
|
|
10016
|
+
classNames.push("dropdown-menu".concat(key === 'xs' ? '' : "-".concat(key), "-").concat(alignment[key]));
|
|
10017
|
+
});
|
|
10018
|
+
}
|
|
10019
|
+
if (typeof alignment === 'string') {
|
|
10020
|
+
classNames.push("dropdown-menu-".concat(alignment));
|
|
10021
|
+
}
|
|
10022
|
+
return classNames;
|
|
10023
|
+
};
|
|
10017
10024
|
var CDropdownMenu = function (_a) {
|
|
10018
10025
|
var children = _a.children, className = _a.className, _b = _a.component, Component = _b === void 0 ? 'ul' : _b, rest = __rest$1(_a, ["children", "className", "component"]);
|
|
10019
|
-
var _c = useContext(CDropdownContext), alignment = _c.alignment, autoClose = _c.autoClose, dark = _c.dark, direction = _c.direction, dropdownToggleRef = _c.dropdownToggleRef, placement = _c.placement, popper = _c.popper, visible = _c.visible, setVisible = _c.setVisible;
|
|
10026
|
+
var _c = useContext(CDropdownContext), alignment = _c.alignment, autoClose = _c.autoClose, dark = _c.dark, direction = _c.direction, dropdownToggleRef = _c.dropdownToggleRef, placement = _c.placement, popper = _c.popper, portal = _c.portal, visible = _c.visible, setVisible = _c.setVisible;
|
|
10020
10027
|
var dropdownMenuRef = useRef(null);
|
|
10021
10028
|
useEffect(function () {
|
|
10022
10029
|
visible && window.addEventListener('mouseup', handleMouseUp);
|
|
@@ -10065,29 +10072,18 @@ var CDropdownMenu = function (_a) {
|
|
|
10065
10072
|
if (alignment === 'end') {
|
|
10066
10073
|
_placement = 'bottom-end';
|
|
10067
10074
|
}
|
|
10068
|
-
var
|
|
10069
|
-
|
|
10070
|
-
|
|
10071
|
-
|
|
10072
|
-
|
|
10073
|
-
|
|
10074
|
-
|
|
10075
|
-
|
|
10076
|
-
|
|
10077
|
-
|
|
10078
|
-
|
|
10079
|
-
|
|
10080
|
-
var dropdownMenuComponent = function (style, ref) { return (React__default$1.createElement(Component, __assign$1({ className: classNames$1('dropdown-menu', {
|
|
10081
|
-
'dropdown-menu-dark': dark,
|
|
10082
|
-
show: visible,
|
|
10083
|
-
}, alignment && alignmentClassNames(alignment), className), ref: ref, style: style, role: "menu", "aria-hidden": !visible }, (!popper && { 'data-coreui-popper': 'static' }), rest), Component === 'ul'
|
|
10084
|
-
? React__default$1.Children.map(children, function (child, index) {
|
|
10085
|
-
if (React__default$1.isValidElement(child)) {
|
|
10086
|
-
return React__default$1.createElement("li", { key: index }, React__default$1.cloneElement(child));
|
|
10087
|
-
}
|
|
10088
|
-
return;
|
|
10089
|
-
})
|
|
10090
|
-
: children)); };
|
|
10075
|
+
var dropdownMenuComponent = function (style, ref) { return (React__default$1.createElement(CConditionalPortal, { portal: portal !== null && portal !== void 0 ? portal : false },
|
|
10076
|
+
React__default$1.createElement(Component, __assign$1({ className: classNames$1('dropdown-menu', {
|
|
10077
|
+
'dropdown-menu-dark': dark,
|
|
10078
|
+
show: visible,
|
|
10079
|
+
}, alignment && alignmentClassNames(alignment), className), ref: ref, style: style, role: "menu", "aria-hidden": !visible }, (!popper && { 'data-coreui-popper': 'static' }), rest), Component === 'ul'
|
|
10080
|
+
? React__default$1.Children.map(children, function (child, index) {
|
|
10081
|
+
if (React__default$1.isValidElement(child)) {
|
|
10082
|
+
return React__default$1.createElement("li", { key: index }, React__default$1.cloneElement(child));
|
|
10083
|
+
}
|
|
10084
|
+
return;
|
|
10085
|
+
})
|
|
10086
|
+
: children))); };
|
|
10091
10087
|
return popper && visible ? (React__default$1.createElement(Popper, { innerRef: dropdownMenuRef, placement: _placement }, function (_a) {
|
|
10092
10088
|
var ref = _a.ref, style = _a.style;
|
|
10093
10089
|
return dropdownMenuComponent(style, ref);
|
|
@@ -11914,11 +11910,9 @@ var COffcanvas = forwardRef(function (_a, ref) {
|
|
|
11914
11910
|
setVisible(visible);
|
|
11915
11911
|
}, [visible]);
|
|
11916
11912
|
useEffect(function () {
|
|
11917
|
-
if (_visible) {
|
|
11918
|
-
|
|
11919
|
-
|
|
11920
|
-
document.body.style.paddingRight = '0px';
|
|
11921
|
-
}
|
|
11913
|
+
if (_visible && !scroll) {
|
|
11914
|
+
document.body.style.overflow = 'hidden';
|
|
11915
|
+
document.body.style.paddingRight = '0px';
|
|
11922
11916
|
return;
|
|
11923
11917
|
}
|
|
11924
11918
|
if (!scroll) {
|
|
@@ -13850,12 +13844,104 @@ var getColumnLabel = function (column) {
|
|
|
13850
13844
|
: pretifyName(column.key)
|
|
13851
13845
|
: pretifyName(column);
|
|
13852
13846
|
};
|
|
13847
|
+
// export const getColumnNames = (columns: (string | Column)[] | undefined, items: Item[]) =>
|
|
13848
|
+
// columns
|
|
13849
|
+
// ? columns.map((column: Column | string) => {
|
|
13850
|
+
// return typeof column === 'object' ? column.key : column
|
|
13851
|
+
// })
|
|
13852
|
+
// : getColumnNamesFromItems(items)
|
|
13853
13853
|
var getColumnNames = function (columns, items) {
|
|
13854
|
-
|
|
13855
|
-
|
|
13856
|
-
|
|
13857
|
-
|
|
13858
|
-
|
|
13854
|
+
if (columns) {
|
|
13855
|
+
var _columns = [];
|
|
13856
|
+
for (var _i = 0, columns_1 = columns; _i < columns_1.length; _i++) {
|
|
13857
|
+
var column = columns_1[_i];
|
|
13858
|
+
if (typeof column === 'object' && column.children) {
|
|
13859
|
+
_columns.push.apply(_columns, getColumnNames(column.children, []));
|
|
13860
|
+
continue;
|
|
13861
|
+
}
|
|
13862
|
+
typeof column === 'object' ? _columns.push(column.key) : _columns.push(column);
|
|
13863
|
+
}
|
|
13864
|
+
return _columns;
|
|
13865
|
+
}
|
|
13866
|
+
return getColumnNamesFromItems(items);
|
|
13867
|
+
};
|
|
13868
|
+
var getColumns = function (_columns) {
|
|
13869
|
+
var columns = [];
|
|
13870
|
+
for (var _i = 0, _columns_1 = _columns; _i < _columns_1.length; _i++) {
|
|
13871
|
+
var column = _columns_1[_i];
|
|
13872
|
+
if (typeof column === 'object' && column.group && column.children) {
|
|
13873
|
+
columns.push.apply(columns, getColumns(column.children));
|
|
13874
|
+
continue;
|
|
13875
|
+
}
|
|
13876
|
+
if (typeof column === 'object' && column.children) {
|
|
13877
|
+
columns.push.apply(columns, getColumns(column.children));
|
|
13878
|
+
}
|
|
13879
|
+
columns.push(column);
|
|
13880
|
+
}
|
|
13881
|
+
return columns;
|
|
13882
|
+
};
|
|
13883
|
+
var countColumns = function (columns, counter) {
|
|
13884
|
+
if (counter === void 0) { counter = 0; }
|
|
13885
|
+
var _counter = counter;
|
|
13886
|
+
for (var _i = 0, columns_2 = columns; _i < columns_2.length; _i++) {
|
|
13887
|
+
var column = columns_2[_i];
|
|
13888
|
+
if (!column.children) {
|
|
13889
|
+
_counter++;
|
|
13890
|
+
}
|
|
13891
|
+
if (column.children) {
|
|
13892
|
+
_counter = countColumns(column.children, _counter);
|
|
13893
|
+
}
|
|
13894
|
+
}
|
|
13895
|
+
return _counter;
|
|
13896
|
+
};
|
|
13897
|
+
var getColumnGroups = function (columns) {
|
|
13898
|
+
var groups = [];
|
|
13899
|
+
var traverseColumns = function (column, deep, colSpan) {
|
|
13900
|
+
if (deep === void 0) { deep = 0; }
|
|
13901
|
+
var groups = [];
|
|
13902
|
+
if (column.children) {
|
|
13903
|
+
for (var _i = 0, _a = column.children; _i < _a.length; _i++) {
|
|
13904
|
+
var _column = _a[_i];
|
|
13905
|
+
if (!_column.group) ;
|
|
13906
|
+
groups.push.apply(groups, traverseColumns(_column, deep + 1));
|
|
13907
|
+
}
|
|
13908
|
+
}
|
|
13909
|
+
if (typeof column === 'object' && column.group) {
|
|
13910
|
+
var children = column.children, group = column.group, rest = __rest$1(column, ["children", "group"]);
|
|
13911
|
+
groups.push(__assign$1(__assign$1({ deep: deep, label: group }, (children && { colspan: countColumns(children) })), rest));
|
|
13912
|
+
}
|
|
13913
|
+
return groups;
|
|
13914
|
+
};
|
|
13915
|
+
if (columns) {
|
|
13916
|
+
for (var _i = 0, columns_3 = columns; _i < columns_3.length; _i++) {
|
|
13917
|
+
var column = columns_3[_i];
|
|
13918
|
+
if (typeof column === 'object' && column.group) {
|
|
13919
|
+
var objects = traverseColumns(column);
|
|
13920
|
+
if (objects) {
|
|
13921
|
+
for (var _a = 0, objects_1 = objects; _a < objects_1.length; _a++) {
|
|
13922
|
+
var object = objects_1[_a];
|
|
13923
|
+
var deep = object.deep, rest = __rest$1(object, ["deep"]);
|
|
13924
|
+
if (deep === undefined) {
|
|
13925
|
+
continue;
|
|
13926
|
+
}
|
|
13927
|
+
for (var i = 0; i < deep; i++) {
|
|
13928
|
+
if (groups[i]) {
|
|
13929
|
+
continue;
|
|
13930
|
+
}
|
|
13931
|
+
groups.push([]);
|
|
13932
|
+
}
|
|
13933
|
+
if (groups[deep]) {
|
|
13934
|
+
groups[deep].push(rest);
|
|
13935
|
+
}
|
|
13936
|
+
else {
|
|
13937
|
+
groups.push([rest]);
|
|
13938
|
+
}
|
|
13939
|
+
}
|
|
13940
|
+
}
|
|
13941
|
+
}
|
|
13942
|
+
}
|
|
13943
|
+
}
|
|
13944
|
+
return groups;
|
|
13859
13945
|
};
|
|
13860
13946
|
var getColumnNamesFromItems = function (items) {
|
|
13861
13947
|
return Object.keys(items[0] || {}).filter(function (el) { return el.charAt(0) !== '_'; });
|
|
@@ -13937,7 +14023,7 @@ var CSmartTableBody = forwardRef(function (_a, ref) {
|
|
|
13937
14023
|
var colspan = selectable ? columnNames.length + 1 : columnNames.length;
|
|
13938
14024
|
return (React__default$1.createElement(CTableBody, __assign$1({}, (clickableRows && {
|
|
13939
14025
|
style: { cursor: 'pointer' },
|
|
13940
|
-
}), rest, { ref: ref }), currentItems.length ? (currentItems.map(function (item, trIndex) {
|
|
14026
|
+
}), rest, { ref: ref }), currentItems.length > 0 ? (currentItems.map(function (item, trIndex) {
|
|
13941
14027
|
return (React__default$1.createElement(React__default$1.Fragment, { key: trIndex },
|
|
13942
14028
|
React__default$1.createElement(CTableRow, __assign$1({}, (item._props && __assign$1({}, item._props)), (clickableRows && { tabIndex: 0 }), { onClick: function (event) {
|
|
13943
14029
|
return onRowClick &&
|
|
@@ -13957,7 +14043,9 @@ var CSmartTableBody = forwardRef(function (_a, ref) {
|
|
|
13957
14043
|
scopedColumns[colName] &&
|
|
13958
14044
|
React__default$1.cloneElement(scopedColumns[colName](item, trIndex + firstItemOnActivePageIndex), {
|
|
13959
14045
|
key: index,
|
|
13960
|
-
})) ||
|
|
14046
|
+
})) ||
|
|
14047
|
+
// eslint-disable-next-line unicorn/no-typeof-undefined
|
|
14048
|
+
(typeof item[colName] !== 'undefined' && (React__default$1.createElement(CTableDataCell, __assign$1({}, getTableDataCellProps(item, colName), { key: index }), String(item[colName])))));
|
|
13961
14049
|
})),
|
|
13962
14050
|
scopedColumns && scopedColumns.details && (React__default$1.createElement(React__default$1.Fragment, null,
|
|
13963
14051
|
React__default$1.createElement(CTableRow, null,
|
|
@@ -13998,9 +14086,11 @@ CSmartTableCleaner.propTypes = {
|
|
|
13998
14086
|
CSmartTableCleaner.displayName = 'CSmartTableCleaner';
|
|
13999
14087
|
|
|
14000
14088
|
var CSmartTableHead = forwardRef(function (_a, ref) {
|
|
14001
|
-
var columnFilter = _a.columnFilter, columnFilterState = _a.columnFilterState, columnSorter = _a.columnSorter, _b = _a.component, Component = _b === void 0 ? CTableHead : _b, columns = _a.columns, handleOnCustomFilterChange = _a.handleOnCustomFilterChange, handleFilterOnChange = _a.handleFilterOnChange, handleFilterOnInput = _a.handleFilterOnInput, handleSelectAllChecked = _a.handleSelectAllChecked, handleSort = _a.handleSort, items = _a.items, selectable = _a.selectable, selectAll = _a.selectAll, selectedAll = _a.selectedAll, sorterState = _a.sorterState, sortingIcon = _a.sortingIcon, sortingIconAscending = _a.sortingIconAscending, sortingIconDescending = _a.sortingIconDescending, rest = __rest$1(_a, ["columnFilter", "columnFilterState", "columnSorter", "component", "columns", "handleOnCustomFilterChange", "handleFilterOnChange", "handleFilterOnInput", "handleSelectAllChecked", "handleSort", "items", "selectable", "selectAll", "selectedAll", "sorterState", "sortingIcon", "sortingIconAscending", "sortingIconDescending"]);
|
|
14089
|
+
var columnFilter = _a.columnFilter, columnFilterState = _a.columnFilterState, columnSorter = _a.columnSorter, _b = _a.component, Component = _b === void 0 ? CTableHead : _b, columns = _a.columns, handleOnCustomFilterChange = _a.handleOnCustomFilterChange, handleFilterOnChange = _a.handleFilterOnChange, handleFilterOnInput = _a.handleFilterOnInput, handleSelectAllChecked = _a.handleSelectAllChecked, handleSort = _a.handleSort, items = _a.items, selectable = _a.selectable, selectAll = _a.selectAll, selectedAll = _a.selectedAll, _c = _a.showGroups, showGroups = _c === void 0 ? true : _c, sorterState = _a.sorterState, sortingIcon = _a.sortingIcon, sortingIconAscending = _a.sortingIconAscending, sortingIconDescending = _a.sortingIconDescending, rest = __rest$1(_a, ["columnFilter", "columnFilterState", "columnSorter", "component", "columns", "handleOnCustomFilterChange", "handleFilterOnChange", "handleFilterOnInput", "handleSelectAllChecked", "handleSort", "items", "selectable", "selectAll", "selectedAll", "showGroups", "sorterState", "sortingIcon", "sortingIconAscending", "sortingIconDescending"]);
|
|
14002
14090
|
var selectAllcheckboxRef = useRef(null);
|
|
14003
|
-
var
|
|
14091
|
+
var _d = useState(false), refresh = _d[0], setRefresh = _d[1];
|
|
14092
|
+
var _columns = useMemo(function () { return getColumns(columns); }, [columns]);
|
|
14093
|
+
var groups = useMemo(function () { return getColumnGroups(columns); }, [columns]);
|
|
14004
14094
|
useEffect(function () {
|
|
14005
14095
|
if (selectedAll === 'indeterminate') {
|
|
14006
14096
|
if (selectAllcheckboxRef.current)
|
|
@@ -14037,27 +14127,33 @@ var CSmartTableHead = forwardRef(function (_a, ref) {
|
|
|
14037
14127
|
return;
|
|
14038
14128
|
};
|
|
14039
14129
|
return (React__default$1.createElement(Component, __assign$1({}, rest, { ref: ref }),
|
|
14130
|
+
showGroups &&
|
|
14131
|
+
groups &&
|
|
14132
|
+
groups.length > 0 &&
|
|
14133
|
+
groups.map(function (row, index) { return (React__default$1.createElement(CTableRow, { key: index },
|
|
14134
|
+
selectable && React__default$1.createElement(CTableHeaderCell, null),
|
|
14135
|
+
row.map(function (cell, index) { return (React__default$1.createElement(CTableHeaderCell, __assign$1({ colSpan: cell.colspan }, getTableHeaderCellProps(cell), { key: index }), cell.label)); }))); }),
|
|
14040
14136
|
React__default$1.createElement(CTableRow, null,
|
|
14041
14137
|
selectable && (React__default$1.createElement(CTableHeaderCell, null, selectAll && (React__default$1.createElement(CFormCheck, { checked: typeof selectedAll === 'boolean' ? selectedAll : false, onChange: function () { return handleSelectAllChecked && handleSelectAllChecked(); }, ref: selectAllcheckboxRef })))),
|
|
14042
|
-
|
|
14138
|
+
_columns.map(function (column, index) {
|
|
14043
14139
|
return (React__default$1.createElement(CTableHeaderCell, __assign$1({}, getTableHeaderCellProps(column), { onClick: function () { return handleSort && handleSort(getColumnKey(column), index); }, style: getTableHeaderCellStyles(column, columnSorter), key: index }),
|
|
14044
14140
|
React__default$1.createElement("div", { className: "d-inline" }, getColumnLabel(column)),
|
|
14045
14141
|
columnSorter &&
|
|
14046
|
-
(typeof column
|
|
14047
|
-
?
|
|
14048
|
-
: typeof column.sorter === 'undefined'
|
|
14142
|
+
(typeof column === 'object'
|
|
14143
|
+
? typeof column.sorter === 'undefined'
|
|
14049
14144
|
? true
|
|
14050
|
-
: column.sorter
|
|
14145
|
+
: column.sorter
|
|
14146
|
+
: true) &&
|
|
14051
14147
|
columnSorterIcon(column)));
|
|
14052
14148
|
})),
|
|
14053
14149
|
columnFilter && (React__default$1.createElement(CTableRow, null,
|
|
14054
14150
|
selectable && React__default$1.createElement(CTableHeaderCell, null),
|
|
14055
|
-
|
|
14056
|
-
return (React__default$1.createElement(CTableHeaderCell, __assign$1({}, getTableHeaderCellProps(column), { key: index }), (typeof column
|
|
14057
|
-
?
|
|
14058
|
-
: typeof column.filter === 'undefined'
|
|
14151
|
+
_columns.map(function (column, index) {
|
|
14152
|
+
return (React__default$1.createElement(CTableHeaderCell, __assign$1({}, getTableHeaderCellProps(column), { key: index }), (typeof column === 'object'
|
|
14153
|
+
? column.filter === undefined
|
|
14059
14154
|
? true
|
|
14060
|
-
: column.filter
|
|
14155
|
+
: column.filter
|
|
14156
|
+
: true) ? (typeof column !== 'string' && typeof column.filter === 'function' ? (!refresh &&
|
|
14061
14157
|
column.filter(getColumnValues(items, getColumnKey(column)), function (value) {
|
|
14062
14158
|
return handleOnCustomFilterChange &&
|
|
14063
14159
|
handleOnCustomFilterChange(getColumnKey(column), value);
|
|
@@ -14106,7 +14202,7 @@ var CSmartTable = forwardRef(function (_a, ref) {
|
|
|
14106
14202
|
var _u = useState({}), columnFilterState = _u[0], setColumnFilterState = _u[1];
|
|
14107
14203
|
var _v = useState(), selectedAll = _v[0], setSelectedAll = _v[1];
|
|
14108
14204
|
var _w = useState({}), sorterState = _w[0], setSorterState = _w[1];
|
|
14109
|
-
var _x = useState(tableFilterValue ? tableFilterValue : ''), tableFilterState = _x[0], setTableFilterState = _x[1];
|
|
14205
|
+
var _x = useState(tableFilterValue !== null && tableFilterValue !== void 0 ? tableFilterValue : ''), tableFilterState = _x[0], setTableFilterState = _x[1];
|
|
14110
14206
|
useEffect(function () {
|
|
14111
14207
|
setActivePage(activePage);
|
|
14112
14208
|
}, [activePage]);
|
|
@@ -14169,7 +14265,7 @@ var CSmartTable = forwardRef(function (_a, ref) {
|
|
|
14169
14265
|
setSelectedAll(false);
|
|
14170
14266
|
return;
|
|
14171
14267
|
}
|
|
14172
|
-
if (_selected.length
|
|
14268
|
+
if (_selected.length > 0 && _selected.length !== _itemsNumber) {
|
|
14173
14269
|
setSelectedAll('indeterminate');
|
|
14174
14270
|
}
|
|
14175
14271
|
}
|
|
@@ -14295,7 +14391,7 @@ var CSmartTable = forwardRef(function (_a, ref) {
|
|
|
14295
14391
|
React__default$1.createElement(CSmartTableBody, __assign$1({ clickableRows: clickableRows, currentItems: currentItems, firstItemOnActivePageIndex: firstItemOnActivePageIndex, noItemsLabel: noItemsLabel, onRowClick: function (item, index, columnName, event) {
|
|
14296
14392
|
return clickableRows && onRowClick && onRowClick(item, index, columnName, event);
|
|
14297
14393
|
}, onRowChecked: function (item, value) { return handleRowChecked(item, value); }, columnNames: columnNames, scopedColumns: scopedColumns, selectable: selectable, selected: _selected }, tableBodyProps)),
|
|
14298
|
-
typeof footer === 'boolean' && footer && (React__default$1.createElement(CSmartTableHead, __assign$1({ component: CTableFoot }, tableFootProps, { columnFilter: false, columnSorter: false, columns: columns !== null && columns !== void 0 ? columns : columnNames, items: _items, handleSelectAllChecked: function () { return handleSelectAllChecked(); }, selectable: selectable, selectAll: selectAll, selectedAll: selectedAll }))),
|
|
14394
|
+
typeof footer === 'boolean' && footer && (React__default$1.createElement(CSmartTableHead, __assign$1({ component: CTableFoot }, tableFootProps, { columnFilter: false, columnSorter: false, columns: columns !== null && columns !== void 0 ? columns : columnNames, items: _items, handleSelectAllChecked: function () { return handleSelectAllChecked(); }, selectable: selectable, selectAll: selectAll, selectedAll: selectedAll, showGroups: false }))),
|
|
14299
14395
|
Array.isArray(footer) && (React__default$1.createElement(CTableFoot, __assign$1({}, tableFootProps),
|
|
14300
14396
|
React__default$1.createElement(CTableRow, null, footer.map(function (item, index) { return (React__default$1.createElement(CTableDataCell, __assign$1({}, (typeof item === 'object' && item._props && __assign$1({}, item._props)), { key: index }), typeof item === 'object' ? item.label : item)); }))))),
|
|
14301
14397
|
loading && (React__default$1.createElement(CElementCover, { boundaries: [
|
|
@@ -14860,5 +14956,5 @@ CWidgetStatsF.propTypes = {
|
|
|
14860
14956
|
};
|
|
14861
14957
|
CWidgetStatsF.displayName = 'CWidgetStatsF';
|
|
14862
14958
|
|
|
14863
|
-
export { CAccordion, CAccordionBody, CAccordionButton,
|
|
14959
|
+
export { CAccordion, CAccordionBody, CAccordionButton, CAccordionHeader, CAccordionItem, CAlert, CAlertHeading, CAlertLink, CAvatar, CBackdrop, CBadge, CBreadcrumb, CBreadcrumbItem, CButton, CButtonGroup, CButtonToolbar, CCallout, CCard, CCardBody, CCardFooter, CCardGroup, CCardHeader, CCardImage, CCardImageOverlay, CCardLink, CCardSubtitle, CCardText, CCardTitle, CCarousel, CCarouselCaption, CCarouselItem, CCloseButton, CCol, CCollapse, CConditionalPortal, CContainer, CDatePicker, CDateRangePicker, CDropdown, CDropdownDivider, CDropdownHeader, CDropdownItem, CDropdownItemPlain, CDropdownMenu, CDropdownToggle, CElementCover, CFooter, CForm, CFormCheck, CFormControlValidation, CFormControlWrapper, CFormFeedback, CFormFloating, CFormInput, CFormLabel, CFormRange, CFormSelect, CFormSwitch, CFormText, CFormTextarea, CHeader, CHeaderBrand, CHeaderDivider, CHeaderNav, CHeaderText, CHeaderToggler, CImage, CInputGroup, CInputGroupText, CLink, CListGroup, CListGroupItem, CLoadingButton, CModal, CModalBody, CModalContent, CModalDialog, CModalFooter, CModalHeader, CModalTitle, CMultiSelect, CNav, CNavGroup, CNavGroupItems, CNavItem, CNavLink, CNavTitle, CNavbar, CNavbarBrand, CNavbarNav, CNavbarText, CNavbarToggler, COffcanvas, COffcanvasBody, COffcanvasHeader, COffcanvasTitle, CPagination, CPaginationItem, CPlaceholder, CPopover, CProgress, CProgressBar, CRow, CSidebar, CSidebarBrand, CSidebarFooter, CSidebarHeader, CSidebarNav, CSidebarToggler, CSmartPagination, CSmartTable, CSpinner, CTabContent, CTabPane, CTable, CTableBody, CTableCaption, CTableDataCell, CTableFoot, CTableHead, CTableHeaderCell, CTableRow, CTimePicker, CToast, CToastBody, CToastClose, CToastHeader, CToaster, CTooltip, CVirtualScroller, CWidgetStatsA, CWidgetStatsB, CWidgetStatsC, CWidgetStatsD, CWidgetStatsE, CWidgetStatsF };
|
|
14864
14960
|
//# sourceMappingURL=index.es.js.map
|