UNPKG

synapse-react-client

Version:

[![npm version](https://badge.fury.io/js/synapse-react-client.svg)](https://badge.fury.io/js/synapse-react-client) [![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettie

43 lines (42 loc) 1.26 kB
import { jsxs as p, Fragment as d, jsx as i } from "react/jsx-runtime"; import { formatDate as c } from "../../../utils/functions/DateFormatter.js"; import { TextField as T } from "@mui/material"; import { ColumnTypeEnum as x } from "@sage-bionetworks/synapse-types"; import y from "dayjs"; import { useState as F, useMemo as n } from "react"; import C from "../../JSONArrayEditor/JSONArrayEditorModal.js"; import { getJsonSchemaItemDefinitionForColumnType as S } from "../TableColumnSchemaEditorUtils.js"; function w(m) { const { columnType: e, onChange: l, value: o = [], TextFieldProps: a } = m, [s, r] = F(!1), u = n( () => S(e), [e] ), f = n(() => o == null ? "" : e === x.DATE_LIST ? o.map((t) => c(y(t))).join(", ") : o.join(", "), [o, e]); return /* @__PURE__ */ p(d, { children: [ /* @__PURE__ */ i( C, { arrayItemDefinition: u, value: o ?? void 0, isShowingModal: s, onConfirm: (t) => { l(t), r(!1); }, onCancel: () => r(!1) } ), /* @__PURE__ */ i( T, { ...a, value: f, onClick: () => { r(!0); } } ) ] }); } export { w as default }; //# sourceMappingURL=MultiValueField.js.map