alinea
Version:
[](https://npmjs.org/package/alinea) [](https://packagephobia.com/result?p=alinea)
38 lines (36 loc) • 1.04 kB
JavaScript
import "../../chunks/chunk-U5RRZUYZ.js";
// src/picker/url/UrlPicker.ts
import { Hint } from "alinea/core/Hint";
import { Type } from "alinea/core/Type";
import { RecordShape } from "alinea/core/shape/RecordShape";
import { ScalarShape } from "alinea/core/shape/ScalarShape";
var UrlReference;
((UrlReference2) => {
function isUrl(value) {
return value && (value.type === "url" || value.ref === "url");
}
UrlReference2.isUrl = isUrl;
})(UrlReference || (UrlReference = {}));
function urlPicker(options) {
const extra = options.fields && Type.shape(options.fields);
return {
shape: new RecordShape("Url", {
url: new ScalarShape("Url"),
title: new ScalarShape("Title"),
target: new ScalarShape("Target")
}).concat(extra),
hint: Hint.Extern({ name: "UrlReference", package: "alinea/picker/url" }),
label: "External website",
handlesMultiple: false,
fields: options.fields,
options
/*,
select(row) {
return row.fields
}*/
};
}
export {
UrlReference,
urlPicker
};