wix-style-react
Version:
wix-style-react
147 lines • 8.51 kB
TypeScript
export const BulkSelectionContext: React.Context<any>;
export const BulkSelectionState: Readonly<{
ALL: "ALL";
NONE: "NONE";
SOME: "SOME";
}>;
export const ChangeType: Readonly<{
ALL: "ALL";
NONE: "NONE";
SINGLE_TOGGLE: "SINGLE_TOGGLE";
}>;
export namespace BulkSelectionContextPropTypes {
let isSelected: PropTypes.Requireable<(...args: any[]) => any>;
let selectedCount: PropTypes.Requireable<number>;
let getSelectedIds: PropTypes.Requireable<(...args: any[]) => any>;
let getNotSelectedIds: PropTypes.Requireable<(...args: any[]) => any>;
let infiniteBulkSelected: PropTypes.Requireable<boolean>;
let bulkSelectionState: PropTypes.Requireable<string>;
let toggleSelectionById: PropTypes.Requireable<(...args: any[]) => any>;
let deselectRowsByDefault: PropTypes.Requireable<boolean>;
let toggleAll: PropTypes.Requireable<(...args: any[]) => any>;
let selectAll: PropTypes.Requireable<(...args: any[]) => any>;
let deselectAll: PropTypes.Requireable<(...args: any[]) => any>;
let setSelectedIds: PropTypes.Requireable<(...args: any[]) => any>;
let selectionDisabled: PropTypes.Requireable<NonNullable<boolean | ((...args: any[]) => any) | null | undefined>>;
}
/**
* BulkSelection manages the state and logic of bulk selection.
* Given an array of selectable items, it manages a bulk selection state (ALL, SOME, NONE),
* and provides helper methods for modifying the state.
*
* toggleBulkSelection(): changes the bulk state according to these state changes: ALL->NONE, SOME->ALL, NONE->ALL
*/
export class BulkSelection extends React.Component<any, any, any> {
constructor(props: any);
state: {
selectedIds: any;
notSelectedIds: null;
helpers: {
/** Is the item with the given id selected. (id comes from the rowData.id if exists, if not then it is the rowIndex)
* Note: `selectedIds` and `notSelectedIds` are mutually exclusive and only one of them is defined.
* `notSelectedIds` is defined when `hasMoreInBulkSelection` is selected and user did bulk selection. Otherwise, selectedIds is defined. */
isSelected: (id: any) => any;
/** Number of selected items */
selectedCount: any;
/** Get a copy (array) of selected ids when `infiniteBulkSelected` is `false`.
* If `infiniteBulkSelected` is true, returns `null` */
getSelectedIds: () => any;
/** Get a copy (array) of ids that were deselected after bulk selection was done, when `infiniteBulkSelected` is `true`.
* If `infiniteBulkSelected` is `false`, returns `null`. */
getNotSelectedIds: () => any;
/** Indicates whether bulk selection was done by the user and `hasMoreInBulkSelection` is `true` */
infiniteBulkSelected: boolean;
/** A string representing the BulkSelection state (not a React state).
* Possible values: ALL, SOME, NONE
*/
bulkSelectionState: "NONE" | "ALL" | "SOME";
/** Indicates the `toggleAll` behaviour when some rows are selected. `true` means SOME -> NONE, `false` means SOME -> ALL */
deselectRowsByDefault: any;
/** Can be either a boolean or a function.
* A boolean affects selection of all table rows.
* A function will be called for every row in `data` to specify if its checkbox should be disabled. */
selectionDisabled: any;
/** Toggle the selection state (selected/not-selected) of an item by id */
toggleSelectionById: (id: any, origin: any) => void;
/** Toggles the bulk selection state: NONE -> ALL, SOME -> ALL, ALL -> NONE */
toggleAll: (deselectRowsByDefault: any, origin: any) => void;
/** Select all items */
selectAll: (origin: any) => void;
/** Deselect all items (clear selection) */
deselectAll: (origin: any) => void;
/** Set the selection.
* An optional `change` argument will be passed "as is" to the Table's onSelectionChanged callback.
*/
setSelectedIds: (selectedIds: any, change: any, props: any) => void;
};
};
UNSAFE_componentWillReceiveProps(nextProps: any): void;
toggleAll: (enable: any, origin: any) => void;
toggleBulkSelection: (deselectRowsByDefault: any, origin: any) => void;
toggleSelectionById: (id: any, origin: any) => void;
setSelectedIds: (selectedIds: any, change: any, props: any) => void;
setNotSelectedIds: (notSelectedIds: any, change: any, props: any) => void;
areSelectedIdsEqual: (selectedIds1: any, selectedIds2: any) => boolean;
createHelpers({ selectedIds, notSelectedIds, allIds, selectionDisabled, deselectRowsByDefault, totalCount, }: {
selectedIds: any;
notSelectedIds: any;
allIds: any;
selectionDisabled: any;
deselectRowsByDefault: any;
totalCount?: number | undefined;
}): {
/** Is the item with the given id selected. (id comes from the rowData.id if exists, if not then it is the rowIndex)
* Note: `selectedIds` and `notSelectedIds` are mutually exclusive and only one of them is defined.
* `notSelectedIds` is defined when `hasMoreInBulkSelection` is selected and user did bulk selection. Otherwise, selectedIds is defined. */
isSelected: (id: any) => any;
/** Number of selected items */
selectedCount: any;
/** Get a copy (array) of selected ids when `infiniteBulkSelected` is `false`.
* If `infiniteBulkSelected` is true, returns `null` */
getSelectedIds: () => any;
/** Get a copy (array) of ids that were deselected after bulk selection was done, when `infiniteBulkSelected` is `true`.
* If `infiniteBulkSelected` is `false`, returns `null`. */
getNotSelectedIds: () => any;
/** Indicates whether bulk selection was done by the user and `hasMoreInBulkSelection` is `true` */
infiniteBulkSelected: boolean;
/** A string representing the BulkSelection state (not a React state).
* Possible values: ALL, SOME, NONE
*/
bulkSelectionState: "NONE" | "ALL" | "SOME";
/** Indicates the `toggleAll` behaviour when some rows are selected. `true` means SOME -> NONE, `false` means SOME -> ALL */
deselectRowsByDefault: any;
/** Can be either a boolean or a function.
* A boolean affects selection of all table rows.
* A function will be called for every row in `data` to specify if its checkbox should be disabled. */
selectionDisabled: any;
/** Toggle the selection state (selected/not-selected) of an item by id */
toggleSelectionById: (id: any, origin: any) => void;
/** Toggles the bulk selection state: NONE -> ALL, SOME -> ALL, ALL -> NONE */
toggleAll: (deselectRowsByDefault: any, origin: any) => void;
/** Select all items */
selectAll: (origin: any) => void;
/** Deselect all items (clear selection) */
deselectAll: (origin: any) => void;
/** Set the selection.
* An optional `change` argument will be passed "as is" to the Table's onSelectionChanged callback.
*/
setSelectedIds: (selectedIds: any, change: any, props: any) => void;
};
render(): React.JSX.Element;
}
export namespace BulkSelection {
namespace propTypes {
export let selectedIds: PropTypes.Requireable<NonNullable<(string | null | undefined)[] | (number | null | undefined)[] | null | undefined>>;
export let allIds: PropTypes.Validator<NonNullable<NonNullable<(string | null | undefined)[] | (number | null | undefined)[] | null | undefined>>>;
export let onSelectionChanged: PropTypes.Requireable<(...args: any[]) => any>;
export let onSelectionStarted: PropTypes.Requireable<(...args: any[]) => any>;
let selectionDisabled_1: PropTypes.Requireable<NonNullable<boolean | ((...args: any[]) => any) | null | undefined>>;
export { selectionDisabled_1 as selectionDisabled };
export let hasMoreInBulkSelection: PropTypes.Requireable<boolean>;
export let totalCount: PropTypes.Requireable<number>;
export let children: PropTypes.Requireable<any>;
}
}
import React from 'react';
import PropTypes from 'prop-types';
//# sourceMappingURL=BulkSelection.d.ts.map