@coreui/react-pro 4.1.0 → 4.1.4

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.
@@ -8,10 +8,10 @@ import { CTableRowProps } from '../table/CTableRow'
8
8
  import { CTableHeadProps } from '../table/CTableHead'
9
9
 
10
10
  export interface Column {
11
- sorter?: boolean
12
- key: string
13
- label?: string
14
11
  filter?: boolean
12
+ label?: string
13
+ key: string
14
+ sorter?: boolean
15
15
  _style?: any
16
16
  _props?: CTableHeaderCellProps
17
17
  }
@@ -27,9 +27,12 @@ export interface ColumnFilterValue {
27
27
 
28
28
  export interface Item {
29
29
  [key: string]: number | string | any
30
+ _props?: CTableRowProps
31
+ _selected?: boolean
32
+ }
33
+
34
+ export interface ItemInternal extends Item {
30
35
  _id: number
31
- _props: CTableRowProps
32
- _selected: boolean
33
36
  }
34
37
 
35
38
  export interface ItemsPerPageSelect {
@@ -44,6 +47,7 @@ export interface Sorter {
44
47
  }
45
48
 
46
49
  export interface ScopedColumns {
50
+ [key: string]: any
47
51
  details?: (a: Item, b: number) => ReactNode
48
52
  }
49
53
 
@@ -55,8 +59,6 @@ export interface SorterValue {
55
59
  export interface TableFilter {
56
60
  lazy?: boolean
57
61
  external?: boolean
58
- label?: string
59
- placeholder?: string
60
62
  }
61
63
 
62
64
  export interface NoItemsView {
@@ -71,14 +73,9 @@ export interface CSmartTableProps extends HTMLAttributes<HTMLDivElement> {
71
73
  * @default 1
72
74
  */
73
75
  activePage?: number
74
- /**
75
- * A string of all className you want applied to the base component.
76
- */
77
- className?: string
78
76
  /**
79
77
  * When set, displays table cleaner above table, next to the table filter (or in place of table filter if `tableFilter` prop is not set)
80
78
  * Cleaner resets `tableFilterValue`, `columnFilterValue`, `sorterValue`. If clean is possible it is clickable (`tabIndex="0"` `role="button"`, `color="danger"`), otherwise it is not clickable and transparent. Cleaner can be customized through the `cleaner` slot.
81
- *
82
79
  */
83
80
  cleaner?: boolean
84
81
  /**
@@ -115,7 +112,7 @@ export interface CSmartTableProps extends HTMLAttributes<HTMLDivElement> {
115
112
  * - sorter (Boolean) - disables sorting of the column when set to false
116
113
  * - filter (Boolean) - removes filter from column when set to false.
117
114
  */
118
- columns?: Column[] | string[]
115
+ columns?: (string | Column)[]
119
116
  /**
120
117
  * Enables table sorting by column value. Sorting will be performed corectly only if values in column are of one type: string (case insensitive) or number.
121
118
  *
@@ -272,8 +269,6 @@ export interface CSmartTableProps extends HTMLAttributes<HTMLDivElement> {
272
269
  * When set, displays table filter above table, allowing filtering by specific column.
273
270
  *
274
271
  * Column filter can be customized, by passing prop as object with additional options as keys. Available options:
275
- * - placeholder (String) - Sets custom table filter placeholder.
276
- * - label (String) - Sets custom table filter label.
277
272
  * - external (Boolean) - Disables automatic filtering inside component.
278
273
  * - lazy (Boolean) - Set to true to trigger filter updates only on change event.
279
274
  */
@@ -13,7 +13,7 @@ export interface CTooltipProps {
13
13
  /**
14
14
  * Content node for your component.
15
15
  */
16
- content: ReactNode
16
+ content: ReactNode | string
17
17
  /**
18
18
  * Callback fired when the component requests to be hidden.
19
19
  */
@@ -126,7 +126,7 @@ export const CTooltip: FC<CTooltipProps> = ({
126
126
 
127
127
  CTooltip.propTypes = {
128
128
  children: PropTypes.any,
129
- content: PropTypes.node,
129
+ content: PropTypes.oneOfType([PropTypes.string, PropTypes.node]),
130
130
  placement: PropTypes.oneOf(['auto', 'top', 'right', 'bottom', 'left']),
131
131
  onHide: PropTypes.func,
132
132
  onShow: PropTypes.func,
package/src/index.ts CHANGED
@@ -39,6 +39,7 @@ import { CDropdownItem } from './components/dropdown/CDropdownItem'
39
39
  import { CDropdownItemPlain } from './components/dropdown/CDropdownItemPlain'
40
40
  import { CDropdownMenu } from './components/dropdown/CDropdownMenu'
41
41
  import { CDropdownToggle } from './components/dropdown/CDropdownToggle'
42
+ import { CDropdownToggleCustom } from './components/dropdown/CDropdownToggleCustom'
42
43
  import { CCol } from './components/grid/CCol'
43
44
  import { CContainer } from './components/grid/CContainer'
44
45
  import { CRow } from './components/grid/CRow'
@@ -163,6 +164,7 @@ export {
163
164
  CDropdownItemPlain,
164
165
  CDropdownMenu,
165
166
  CDropdownToggle,
167
+ CDropdownToggleCustom,
166
168
  CCol,
167
169
  CContainer,
168
170
  CRow,
@@ -9,6 +9,7 @@ export type AssignableRef<ValueType> =
9
9
  }['bivarianceHack']
10
10
  | React.MutableRefObject<ValueType | null>
11
11
 
12
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
12
13
  export function useForkedRef<RefValueType = any>(
13
14
  ...refs: (AssignableRef<RefValueType> | null | undefined)[]
14
15
  ) {
@@ -16,6 +17,7 @@ export function useForkedRef<RefValueType = any>(
16
17
  if (refs.every((ref) => ref == null)) {
17
18
  return null
18
19
  }
20
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
19
21
  return (node: any) => {
20
22
  refs.forEach((ref) => {
21
23
  assignRef(ref, node)
@@ -24,8 +26,10 @@ export function useForkedRef<RefValueType = any>(
24
26
  }, refs)
25
27
  }
26
28
 
29
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
27
30
  export function assignRef<RefValueType = any>(
28
31
  ref: AssignableRef<RefValueType> | null | undefined,
32
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
29
33
  value: any,
30
34
  ) {
31
35
  if (ref == null) return
@@ -40,6 +44,7 @@ export function assignRef<RefValueType = any>(
40
44
  }
41
45
  }
42
46
 
47
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/ban-types
43
48
  export function isFunction(value: any): value is Function {
44
49
  return !!(value && {}.toString.call(value) == '[object Function]')
45
50
  }