@opendash/plugin-parse
Version:
Parse Server Plugin for open.DASH
47 lines • 1.78 kB
JavaScript
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
import React from "react";
import { Divider, Checkbox } from "antd";
import { useTranslation } from "opendash";
import AdminTableRelation from "./AdminTableRelation";
import { format } from "date-fns";
export function AdminTableColumnBody(_a) {
var type = _a.type, row = _a.row, field = _a.field;
var t = useTranslation(["parse", "opendash"])[0];
var value = row.get(field);
if (value === undefined || value === null) {
return "-";
}
if (type === "String") {
return value;
}
if (type === "Boolean") {
return React.createElement(Checkbox, { checked: value, disabled: true });
}
if (type === "Number") {
return value;
}
if (type === "Date") {
return format(value, t("opendash:format.datetime"));
}
if (type === "GeoPoint") {
return (React.createElement("a", { href: "http://www.google.com/maps/place/" + value.latitude + "," + value.longitude, target: "_blank", rel: "noopener noreferrer" },
value.latitude,
React.createElement(Divider, { type: "vertical" }),
value.longitude));
}
if (type === "Relation") {
return React.createElement(AdminTableRelation, __assign({}, { type: type, row: row, field: field, value: value }));
}
return "???";
}
//# sourceMappingURL=AdminTableColumn.js.map