@scheels-softdev/kendoreact-generics 2.2.11 → 2.4.0
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/FilterCellDropdown.d.ts +3 -0
- package/GenericDropdown.d.ts +10 -21
- package/GenericDropdown.js +0 -11
- package/MultiSelectDropdown.d.ts +7 -0
- package/Toolbar.d.ts +4 -1
- package/Toolbar.js +1 -1
- package/commandCell/CommandCellCheckbox.d.ts +4 -1
- package/commandCell/CommandCellCheckbox.js +1 -1
- package/commandCell/CommandCellDDWithoutId.d.ts +8 -0
- package/commandCell/CommandCellDDWithoutId.js +1 -0
- package/commandCell/CommandCellDate.d.ts +5 -2
- package/commandCell/CommandCellDate.js +2 -2
- package/commandCell/CommandCellDropdown.d.ts +9 -0
- package/commandCell/CommandCellSwitch.d.ts +3 -1
- package/commandCell/CommandCellSwitch.js +1 -1
- package/package.json +1 -1
package/FilterCellDropdown.d.ts
CHANGED
@@ -1,7 +1,10 @@
|
|
1
1
|
import { GridFilterCellProps } from "@progress/kendo-react-grid";
|
2
2
|
interface DropdownFilterCellProps<T> extends GridFilterCellProps {
|
3
|
+
/** The data to populate the dropdown options */
|
3
4
|
data: T[];
|
5
|
+
/** The field names used to extract text values for display */
|
4
6
|
textFields: (keyof T)[];
|
7
|
+
/** The separator to use when concatenating multiple text values */
|
5
8
|
separator?: string;
|
6
9
|
}
|
7
10
|
export declare function FilterCellDropdown<T>(props: DropdownFilterCellProps<T>): import("react/jsx-runtime").JSX.Element;
|
package/GenericDropdown.d.ts
CHANGED
@@ -3,40 +3,29 @@ import { CSSProperties } from "react";
|
|
3
3
|
* JSX Component for displaying items in a virtualized combobox
|
4
4
|
* @template T - The type of the data objects in the dropdown.
|
5
5
|
* @param {object} props - The component props.
|
6
|
-
* @prop {T[]} data - Array of data objects. (Tooltip: .)
|
7
|
-
* @prop {number} [selectedId] - ID of the selected data object. (Tooltip:)
|
8
|
-
* @prop {T} [selectedData] - The selected data object. Use this instead of selectedId if there is no identity key in the object. (Tooltip: )
|
9
|
-
* @prop {Function} onChange - Function to call when the selected value changes. (Tooltip: .)
|
10
|
-
* @prop {(keyof T)[]} textFields - Array of field names to use for text values. (Tooltip: The field names used to extract text values for display.)
|
11
|
-
* @prop {string} [separator] - Optional separator to use for concatenating text values. (Tooltip: The separator to use when concatenating multiple text values.)
|
12
|
-
* @prop {boolean} [disabled] - Boolean to disable the dropdown. (Tooltip: Determines whether the dropdown is disabled.)
|
13
|
-
* @prop {keyof T} [idField] - The field name to use as the identity key. If the id field to look at isn't 'id', what is it? (Tooltip: The field name used as the identity key.)
|
14
|
-
* @prop {string} [title] - The label of the dropdown. (Tooltip: The label displayed for the dropdown.)
|
15
|
-
* @prop {boolean} [hideClearButton] - Set to true if you want to hide the clear button. (Tooltip: Determines whether the clear button is hidden from the dropdown.)
|
16
|
-
* @prop {CSSProperties} [style] - The CSS properties you want to use. It is generally recommended to do styling in your App.css file, but if necessary, this prop is available to you. (Tooltip: Custom CSS properties for the component.)
|
17
6
|
* @returns {JSX.Element}
|
18
7
|
*/
|
19
8
|
export declare function GenericDropdown<T>({ data, selectedId, selectedData, onChange, textFields, separator, disabled, idField, title, hideClearButton, style, }: {
|
20
|
-
/** The data to populate the dropdown options*/
|
9
|
+
/** The data to populate the dropdown options */
|
21
10
|
data: T[];
|
22
|
-
/** The ID of the currently selected item
|
11
|
+
/** The ID of the currently selected item. (optional)*/
|
23
12
|
selectedId?: number;
|
24
|
-
/** The currently selected data object. */
|
13
|
+
/** The currently selected data object. (optional)*/
|
25
14
|
selectedData?: T;
|
26
15
|
/** Callback function triggered when the selected value changes*/
|
27
16
|
onChange: Function;
|
28
|
-
/**
|
17
|
+
/** The field names used to extract text values for display */
|
29
18
|
textFields: (keyof T)[];
|
30
|
-
/**
|
19
|
+
/** The separator to use when concatenating multiple text values. (optional)*/
|
31
20
|
separator?: string;
|
32
|
-
/**
|
21
|
+
/** Determines whether the dropdown is disabled. (optional)*/
|
33
22
|
idField?: keyof T;
|
34
|
-
/**
|
23
|
+
/** The field name used as the identity key (optional)*/
|
35
24
|
disabled?: boolean;
|
36
|
-
/** The
|
25
|
+
/** The label displayed for the dropdown (optional)*/
|
37
26
|
title?: string;
|
38
|
-
/** The
|
27
|
+
/** The Determines whether the clear button is hidden from the dropdown. (optional)*/
|
39
28
|
hideClearButton?: boolean;
|
40
|
-
/**
|
29
|
+
/** Custom CSS properties for the component. (optional)*/
|
41
30
|
style?: CSSProperties;
|
42
31
|
}): import("react/jsx-runtime").JSX.Element;
|
package/GenericDropdown.js
CHANGED
@@ -10,17 +10,6 @@ import { getTextValue } from "./Utility";
|
|
10
10
|
* JSX Component for displaying items in a virtualized combobox
|
11
11
|
* @template T - The type of the data objects in the dropdown.
|
12
12
|
* @param {object} props - The component props.
|
13
|
-
* @prop {T[]} data - Array of data objects. (Tooltip: .)
|
14
|
-
* @prop {number} [selectedId] - ID of the selected data object. (Tooltip:)
|
15
|
-
* @prop {T} [selectedData] - The selected data object. Use this instead of selectedId if there is no identity key in the object. (Tooltip: )
|
16
|
-
* @prop {Function} onChange - Function to call when the selected value changes. (Tooltip: .)
|
17
|
-
* @prop {(keyof T)[]} textFields - Array of field names to use for text values. (Tooltip: The field names used to extract text values for display.)
|
18
|
-
* @prop {string} [separator] - Optional separator to use for concatenating text values. (Tooltip: The separator to use when concatenating multiple text values.)
|
19
|
-
* @prop {boolean} [disabled] - Boolean to disable the dropdown. (Tooltip: Determines whether the dropdown is disabled.)
|
20
|
-
* @prop {keyof T} [idField] - The field name to use as the identity key. If the id field to look at isn't 'id', what is it? (Tooltip: The field name used as the identity key.)
|
21
|
-
* @prop {string} [title] - The label of the dropdown. (Tooltip: The label displayed for the dropdown.)
|
22
|
-
* @prop {boolean} [hideClearButton] - Set to true if you want to hide the clear button. (Tooltip: Determines whether the clear button is hidden from the dropdown.)
|
23
|
-
* @prop {CSSProperties} [style] - The CSS properties you want to use. It is generally recommended to do styling in your App.css file, but if necessary, this prop is available to you. (Tooltip: Custom CSS properties for the component.)
|
24
13
|
* @returns {JSX.Element}
|
25
14
|
*/
|
26
15
|
export function GenericDropdown({ data, selectedId, selectedData, onChange, textFields, separator, disabled, idField, title, hideClearButton, style, }) {
|
package/MultiSelectDropdown.d.ts
CHANGED
@@ -1,9 +1,16 @@
|
|
1
1
|
export declare function MultiSelectDropdown<T>({ data, selectedData, textFields, selectEvent, title, separator, limit, }: {
|
2
|
+
/** The data array for the dropdown options. */
|
2
3
|
data: T[];
|
4
|
+
/** The array of selected data items. */
|
3
5
|
selectedData: T[];
|
6
|
+
/** The field names to use for text values in the dropdown. */
|
4
7
|
textFields: (keyof T)[];
|
8
|
+
/** The function to call when an item is selected or deselected. */
|
5
9
|
selectEvent: Function;
|
10
|
+
/** The optional title of the dropdown. */
|
6
11
|
title?: string;
|
12
|
+
/** The optional separator to use for concatenating text values. */
|
7
13
|
separator?: string;
|
14
|
+
/** The optional limit of the maximum number of selected items. */
|
8
15
|
limit?: number;
|
9
16
|
}): import("react/jsx-runtime").JSX.Element;
|
package/Toolbar.d.ts
CHANGED
@@ -2,9 +2,12 @@ type CommonProps = {
|
|
2
2
|
id: number;
|
3
3
|
isEditing?: boolean;
|
4
4
|
};
|
5
|
-
export declare function ToolbarButton<T extends CommonProps>({ item, data, setData }: {
|
5
|
+
export declare function ToolbarButton<T extends CommonProps>({ item, data, setData, }: {
|
6
|
+
/** The item object to add. */
|
6
7
|
item: T;
|
8
|
+
/** The data array. */
|
7
9
|
data: T[];
|
10
|
+
/** The function to set the updated data. */
|
8
11
|
setData: Function;
|
9
12
|
}): import("react/jsx-runtime").JSX.Element;
|
10
13
|
export {};
|
package/Toolbar.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
2
|
-
export function ToolbarButton({ item, data, setData }) {
|
2
|
+
export function ToolbarButton({ item, data, setData, }) {
|
3
3
|
return (_jsx("button", Object.assign({ title: "Add new", className: "k-button k-button-md k-rounded-md k-button-solid k-button-solid-primary", onClick: () => setData([Object.assign(Object.assign({}, item), { isEditing: true, id: 0 }), ...data]), disabled: data.find((x) => x.isEditing) ? true : false }, { children: "Add Another" })));
|
4
4
|
}
|
@@ -1,5 +1,8 @@
|
|
1
|
-
export declare function CommandCellCheckBox({ checked, onCheck, onUncheck }: {
|
1
|
+
export declare function CommandCellCheckBox({ checked, onCheck, onUncheck, }: {
|
2
|
+
/** Boolean value indicating whether the checkbox is checked (`true`) or unchecked (`false`). */
|
2
3
|
checked: boolean;
|
4
|
+
/** Callback function to be called when the checkbox is checked. */
|
3
5
|
onCheck: Function;
|
6
|
+
/** Callback function to be called when the checkbox is unchecked. */
|
4
7
|
onUncheck: Function;
|
5
8
|
}): import("react/jsx-runtime").JSX.Element;
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
2
2
|
import { Checkbox } from "@progress/kendo-react-inputs";
|
3
|
-
export function CommandCellCheckBox({ checked, onCheck, onUncheck }) {
|
3
|
+
export function CommandCellCheckBox({ checked, onCheck, onUncheck, }) {
|
4
4
|
const functionToRun = () => {
|
5
5
|
if (checked) {
|
6
6
|
onUncheck();
|
@@ -1,11 +1,19 @@
|
|
1
1
|
import { ComboBoxChangeEvent } from "@progress/kendo-react-dropdowns";
|
2
2
|
export declare function CommandCellDDWithoutId<T>(props: {
|
3
|
+
/** The data array for the dropdown options. */
|
3
4
|
data: T[];
|
5
|
+
/** The currently selected data item. */
|
4
6
|
selectedData: T;
|
7
|
+
/** The field names to use for text values in the dropdown. */
|
5
8
|
textFields: (keyof T)[];
|
9
|
+
/** Callback function to be called when the selected value changes. */
|
6
10
|
onChange: (e: ComboBoxChangeEvent) => void;
|
11
|
+
/** Optional separator to use for concatenating text values. */
|
7
12
|
separator?: string;
|
13
|
+
/** Determines if the edit field should be checked. */
|
8
14
|
checkEditField?: boolean;
|
15
|
+
/** Determines if the cell is in an editing state. */
|
9
16
|
isEditing?: boolean;
|
17
|
+
/** Determines if the clear button should be displayed in the dropdown. */
|
10
18
|
showClearButton?: boolean;
|
11
19
|
}): import("react/jsx-runtime").JSX.Element;
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
2
2
|
import { GenericDropdown } from "../GenericDropdown";
|
3
3
|
export function CommandCellDDWithoutId(props) {
|
4
|
+
// Function implementation...
|
4
5
|
return (_jsx("td", { children: props.checkEditField && !props.isEditing ? (props.textFields.map((x) => props.data.find((y) => y === props.selectedData)[x]).join(props.separator || " ")) : (
|
5
6
|
// If "props.checkEditField" is false or "props.isEditing" is true, render the GenericDropdownWithSearch component with the "props" passed to it
|
6
7
|
_jsx(GenericDropdown, Object.assign({}, props))) }));
|
@@ -1,6 +1,9 @@
|
|
1
1
|
import { CommonProps, GridChangeEvent } from "../PropTypes";
|
2
|
-
export declare function CommandCellDate<T extends CommonProps>({ dataItem,
|
2
|
+
export declare function CommandCellDate<T extends CommonProps>({ dataItem, onChange, field, }: {
|
3
|
+
/** The data item for the cell. */
|
3
4
|
dataItem: T;
|
4
|
-
|
5
|
+
/** Callback function to be called when the value changes. */
|
6
|
+
onChange: (e: GridChangeEvent) => void;
|
7
|
+
/** The field of the data item to display in the cell. this field must be formattable into a date. */
|
5
8
|
field: keyof T;
|
6
9
|
}): import("react/jsx-runtime").JSX.Element;
|
@@ -1,10 +1,10 @@
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
2
2
|
import { DatePicker } from "@progress/kendo-react-dateinputs";
|
3
3
|
import moment from "moment";
|
4
|
-
export function CommandCellDate({ dataItem,
|
4
|
+
export function CommandCellDate({ dataItem, onChange, field, }) {
|
5
5
|
let valString = "" + dataItem[field];
|
6
6
|
let date = moment(valString).format("MM/DD/YY");
|
7
|
-
return (_jsx("td", Object.assign({ "data-testid": "date" }, { children: valString === undefined || dataItem.isEditing ? (_jsx(DatePicker, { value: new Date(moment(valString).format("MMMM, DD YYYY")), onChange: (e) =>
|
7
|
+
return (_jsx("td", Object.assign({ "data-testid": "date" }, { children: valString === undefined || dataItem.isEditing ? (_jsx(DatePicker, { value: new Date(moment(valString).format("MMMM, DD YYYY")), onChange: (e) => onChange({
|
8
8
|
field: field.toString(),
|
9
9
|
value: moment(e.value),
|
10
10
|
dataItem: dataItem,
|
@@ -1,12 +1,21 @@
|
|
1
1
|
import { ComboBoxChangeEvent } from "@progress/kendo-react-dropdowns";
|
2
2
|
export declare function CommandCellDropdown<T>(props: {
|
3
|
+
/** The data array for the dropdown options. */
|
3
4
|
data: T[];
|
5
|
+
/** The ID of the currently selected item. */
|
4
6
|
selectedId: number;
|
7
|
+
/** The field names to use for text values in the dropdown. */
|
5
8
|
textFields: (keyof T)[];
|
9
|
+
/** Callback function to be called when the selected value changes. */
|
6
10
|
onChange: (e: ComboBoxChangeEvent) => void;
|
11
|
+
/** Optional separator to use for concatenating text values. */
|
7
12
|
separator?: string;
|
13
|
+
/** Determines if the edit field should be checked. */
|
8
14
|
checkEditField?: boolean;
|
15
|
+
/** Determines if the cell is in an editing state. */
|
9
16
|
isEditing?: boolean;
|
17
|
+
/** The field to use as the identity key. */
|
10
18
|
idField?: keyof T;
|
19
|
+
/** Determines if the clear button should be displayed in the dropdown. */
|
11
20
|
showClearButton?: boolean;
|
12
21
|
}): import("react/jsx-runtime").JSX.Element;
|
@@ -1,5 +1,7 @@
|
|
1
1
|
import { GridCellProps } from "@progress/kendo-react-grid";
|
2
|
-
export declare function CommandCellSwitch({ props, changeFunction }: {
|
2
|
+
export declare function CommandCellSwitch({ props, changeFunction, }: {
|
3
|
+
/** The GridCellProps object containing cell-related properties. */
|
3
4
|
props: GridCellProps;
|
5
|
+
/** The function to call when the switch value changes. */
|
4
6
|
changeFunction: Function;
|
5
7
|
}): import("react/jsx-runtime").JSX.Element;
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
2
2
|
import { Switch } from "@progress/kendo-react-inputs";
|
3
|
-
export function CommandCellSwitch({ props, changeFunction }) {
|
3
|
+
export function CommandCellSwitch({ props, changeFunction, }) {
|
4
4
|
return (_jsx("td", Object.assign({ "data-testid": "switch" }, { children: props.dataItem.isEditing ? (_jsx(Switch, { onChange: () => changeFunction(), checked: props.dataItem[props.field] })) : (props.dataItem[props.field].toString()) })));
|
5
5
|
}
|