synapse-react-client
Version:
[](https://badge.fury.io/js/synapse-react-client) [](https://github.com/prettier/prettie
94 lines (93 loc) • 1.97 kB
JavaScript
import { jsxs as D, Fragment as M, jsx as i } from "react/jsx-runtime";
import { useMemo as d } from "react";
import { buttonId as l } from "@rjsf/utils";
function g(u) {
const {
disabled: n,
hasCopy: k,
hasMoveDown: m,
hasMoveUp: c,
hasRemove: v,
idSchema: r,
index: o,
onCopyIndexClick: p,
onDropIndexClick: C,
onReorderClick: s,
onAddIndexClick: y,
readonly: t,
registry: e,
uiSchema: a
} = u, { CopyButton: f, MoveDownButton: b, MoveUpButton: h, RemoveButton: w, AddButton: x } = e.templates.ButtonTemplates, B = d(
() => p(o),
[o, p]
), j = d(
() => C(o),
[o, C]
), A = d(
() => s(o, o - 1),
[o, s]
), I = d(
() => s(o, o + 1),
[o, s]
);
return /* @__PURE__ */ D(M, { children: [
(c || m) && /* @__PURE__ */ i(
h,
{
id: l(r, "moveUp"),
className: "rjsf-array-item-move-up",
disabled: n || t || !c,
onClick: A,
uiSchema: a,
registry: e
}
),
(c || m) && /* @__PURE__ */ i(
b,
{
id: l(r, "moveDown"),
className: "rjsf-array-item-move-down",
disabled: n || t || !m,
onClick: I,
uiSchema: a,
registry: e
}
),
k && /* @__PURE__ */ i(
f,
{
id: l(r, "copy"),
className: "rjsf-array-item-copy",
disabled: n || t,
onClick: B,
uiSchema: a,
registry: e
}
),
v && /* @__PURE__ */ i(
w,
{
id: l(r, "remove"),
className: "rjsf-array-item-remove",
disabled: n || t,
onClick: j,
uiSchema: a,
registry: e
}
),
/* @__PURE__ */ i(
x,
{
disabled: n || t,
uiSchema: a,
registry: e,
"aria-label": "Add Item",
onClick: y(o + 1)
}
)
] });
}
export {
g as default
};
//# sourceMappingURL=ArrayFieldItemButtonTemplate.js.map