@narrative.io/jsonforms-provider-protocols
Version:
Dynamic data provider capabilities for JSONForms with Vue 3 integration
23 lines (21 loc) • 591 B
text/typescript
import {
and,
isNumberControl,
isStringControl,
or,
rankWith,
isControl,
} from "@jsonforms/core";
// Tester that checks if provider option exists (as object or boolean)
export const providerTester = rankWith(
5,
and(
or(isStringControl, isNumberControl, and(isControl, (uischema: unknown, schema: unknown) => {
const s = schema as { type?: string };
return s && s.type === "integer";
})),
(uischema: import("@jsonforms/core").UISchemaElement) =>
uischema?.options?.provider !== undefined &&
uischema?.options?.provider !== null,
),
);