@progress/kendo-react-taskboard
Version:
KendoReact TaskBoard package
35 lines (34 loc) • 1.16 kB
JavaScript
/**
* @license
*-------------------------------------------------------------------------------------------
* Copyright © 2025 Progress Software Corporation. All rights reserved.
* Licensed under commercial license. See LICENSE.md in the package root for more information
*-------------------------------------------------------------------------------------------
*/
import * as t from "react";
const b = ({ onSave: c, task: e, priorities: r }) => {
const [o, a] = t.useState(e ? e.title : ""), [n, l] = t.useState(e ? e.description : ""), [s, u] = t.useState(e ? e.priority : r[0]), p = t.useCallback((i) => {
a(i.value);
}, []), v = t.useCallback((i) => {
l(i.value);
}, []), C = t.useCallback((i) => {
u(i.target.value);
}, []), d = t.useCallback(
(i) => {
const g = {
id: void 0,
status: "",
...e || {},
title: o,
description: n,
priority: s
};
c.call(void 0, g, e);
},
[c, e, o, n, s]
);
return { onTitleChange: p, title: o, onDescriptionChange: v, description: n, onPriorityChange: C, priority: s, onSave: d };
};
export {
b as useTaskEditing
};