Socket
Socket
Sign inDemoInstall

@jsonforms/core

Package Overview
Dependencies
Maintainers
6
Versions
131
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@jsonforms/core - npm Package Compare versions

Comparing version 3.0.0-beta.4 to 3.0.0-beta.5

docs/interfaces/labeled.html

60

lib/models/uischema.d.ts
import { JsonSchema } from './jsonSchema';
/**
* Interface for describing an UI schema element that is referencing
* a subschema. The value of the scope must be a JSON Pointer.
* a subschema. The value of the scope may be a JSON Pointer.
*/

@@ -10,9 +10,29 @@ export interface Scopable {

*/
scope?: string;
}
/**
* Interface for describing an UI schema element that is referencing
* a subschema. The value of the scope must be a JSON Pointer.
*/
export interface Scoped extends Scopable {
/**
* The scope that determines to which part this element should be bound to.
*/
scope: string;
}
/**
* Interface for describing an UI schema element that can provide an internationalization base key.
* If defined, this key is suffixed to derive applicable message keys for the UI schema element.
* For example, such suffixes are `.label` or `.description` to derive the corresponding message keys for a control element.
* Interface for describing an UI schema element that may be labeled.
*/
export interface Lableable<T = string> {
/**
* Label for UI schema element.
*/
label?: string | T;
}
/**
* Interface for describing an UI schema element that is labeled.
*/
export interface Labeled<T = string> extends Lableable<T> {
label: string | T;
}
export interface Internationalizable {

@@ -68,3 +88,3 @@ i18n?: string;

*/
export interface LeafCondition extends Condition, Scopable {
export interface LeafCondition extends Condition, Scoped {
type: 'LEAF';

@@ -76,3 +96,3 @@ /**

}
export interface SchemaBasedCondition extends Condition, Scopable {
export interface SchemaBasedCondition extends Condition, Scoped {
schema: JsonSchema;

@@ -143,8 +163,4 @@ }

*/
export interface GroupLayout extends Layout {
export interface GroupLayout extends Layout, Lableable {
type: 'Group';
/**
* The label of this group layout.
*/
label?: string;
}

@@ -178,8 +194,4 @@ /**

*/
export interface ControlElement extends UISchemaElement, Scopable, Internationalizable {
export interface ControlElement extends UISchemaElement, Scoped, Lableable<string | boolean | LabelDescription>, Internationalizable {
type: 'Control';
/**
* An optional label that will be associated with the control
*/
label?: string | boolean | LabelDescription;
}

@@ -189,8 +201,4 @@ /**

*/
export interface Category extends Layout {
export interface Category extends Layout, Labeled {
type: 'Category';
/**
* The label associated with this category layout.
*/
label: string;
}

@@ -202,9 +210,5 @@ /**

*/
export interface Categorization extends UISchemaElement {
export interface Categorization extends UISchemaElement, Labeled {
type: 'Categorization';
/**
* The label of this categorization.
*/
label: string;
/**
* The child elements of this categorization which are either of type

@@ -218,1 +222,5 @@ * {@link Category} or {@link Categorization}.

export declare const isLayout: (uischema: UISchemaElement) => uischema is Layout;
export declare const isScopable: (obj: unknown) => obj is Scopable;
export declare const isScoped: (obj: unknown) => obj is Scoped;
export declare const isLabelable: (obj: unknown) => obj is Lableable<string>;
export declare const isLabeled: (obj: unknown) => obj is Labeled<string>;

@@ -1,5 +0,4 @@

import { UISchemaElement } from '../models';
import { JsonSchema, UISchemaElement } from '../models';
import Ajv from 'ajv';
import { JsonFormsState } from '../store';
import { JsonSchema } from '../models/jsonSchema';
export declare const evalVisibility: (uischema: UISchemaElement, data: any, path: string, ajv: Ajv) => boolean;

@@ -6,0 +5,0 @@ export declare const evalEnablement: (uischema: UISchemaElement, data: any, path: string, ajv: Ajv) => boolean;

@@ -1,2 +0,2 @@

import { JsonSchema, Scopable, UISchemaElement } from '..';
import { JsonSchema, Scoped, UISchemaElement } from '..';
import Ajv from 'ajv';

@@ -14,8 +14,8 @@ /**

/**
* Derives the type of the jsonSchema element
*/
* Derives the type of the jsonSchema element
*/
export declare const deriveTypes: (jsonSchema: JsonSchema) => string[];
/**
* Convenience wrapper around resolveData and resolveSchema.
*/
* Convenience wrapper around resolveData and resolveSchema.
*/
export declare const Resolve: {

@@ -27,3 +27,3 @@ schema(schema: JsonSchema, schemaPath: string, rootSchema: JsonSchema): JsonSchema;

compose: (path1: string, path2: string) => string;
fromScopable: (scopable: Scopable) => string;
fromScoped: (scopable: Scoped) => string;
};

@@ -30,0 +30,0 @@ export declare const Runtime: {

{
"name": "@jsonforms/core",
"version": "3.0.0-beta.4",
"version": "3.0.0-beta.5",
"description": "Core module of JSON Forms",

@@ -91,3 +91,3 @@ "repository": "https://github.com/eclipsesource/jsonforms",

},
"gitHead": "413b9767ea8e2c0b6adb3919f5e6b76263d4be31"
"gitHead": "b66023cf081e56baa3194ac3d6658e23fd267bf9"
}

@@ -30,3 +30,3 @@ /*

* Interface for describing an UI schema element that is referencing
* a subschema. The value of the scope must be a JSON Pointer.
* a subschema. The value of the scope may be a JSON Pointer.
*/

@@ -37,2 +37,13 @@ export interface Scopable {

*/
scope?: string;
}
/**
* Interface for describing an UI schema element that is referencing
* a subschema. The value of the scope must be a JSON Pointer.
*/
export interface Scoped extends Scopable {
/**
* The scope that determines to which part this element should be bound to.
*/
scope: string;

@@ -42,2 +53,19 @@ }

/**
* Interface for describing an UI schema element that may be labeled.
*/
export interface Lableable<T = string> {
/**
* Label for UI schema element.
*/
label?: string|T;
}
/**
* Interface for describing an UI schema element that is labeled.
*/
export interface Labeled<T = string> extends Lableable<T> {
label: string | T;
}
/*
* Interface for describing an UI schema element that can provide an internationalization base key.

@@ -102,3 +130,3 @@ * If defined, this key is suffixed to derive applicable message keys for the UI schema element.

*/
export interface LeafCondition extends Condition, Scopable {
export interface LeafCondition extends Condition, Scoped {
type: 'LEAF';

@@ -112,3 +140,3 @@

export interface SchemaBasedCondition extends Condition, Scopable {
export interface SchemaBasedCondition extends Condition, Scoped {
schema: JsonSchema;

@@ -187,8 +215,4 @@ }

*/
export interface GroupLayout extends Layout {
export interface GroupLayout extends Layout, Lableable {
type: 'Group';
/**
* The label of this group layout.
*/
label?: string;
}

@@ -225,8 +249,4 @@

*/
export interface ControlElement extends UISchemaElement, Scopable, Internationalizable {
export interface ControlElement extends UISchemaElement, Scoped, Lableable<string | boolean | LabelDescription>, Internationalizable {
type: 'Control';
/**
* An optional label that will be associated with the control
*/
label?: string | boolean | LabelDescription;
}

@@ -237,8 +257,4 @@

*/
export interface Category extends Layout {
export interface Category extends Layout, Labeled {
type: 'Category';
/**
* The label associated with this category layout.
*/
label: string;
}

@@ -251,9 +267,5 @@

*/
export interface Categorization extends UISchemaElement {
export interface Categorization extends UISchemaElement, Labeled {
type: 'Categorization';
/**
* The label of this categorization.
*/
label: string;
/**
* The child elements of this categorization which are either of type

@@ -265,5 +277,4 @@ * {@link Category} or {@link Categorization}.

export const isInternationalized = (element: unknown): element is Required<Internationalizable> => {
return typeof element === 'object' && element !== null && typeof (element as Internationalizable).i18n === 'string';
}
export const isInternationalized = (element: unknown): element is Required<Internationalizable> =>
typeof element === 'object' && element !== null && typeof (element as Internationalizable).i18n === 'string';

@@ -275,1 +286,13 @@ export const isGroup = (layout: Layout): layout is GroupLayout =>

(uischema as Layout).elements !== undefined;
export const isScopable = (obj: unknown): obj is Scopable =>
obj && typeof obj === 'object';
export const isScoped = (obj: unknown): obj is Scoped =>
isScopable(obj) && typeof obj.scope === 'string';
export const isLabelable = (obj: unknown): obj is Lableable =>
obj && typeof obj === 'object';
export const isLabeled = (obj: unknown): obj is Labeled =>
isLabelable(obj) && ['string', 'object'].includes(typeof obj.label);

@@ -448,6 +448,3 @@ /*

const resolvedSchema = resolveSchema(schema, schemaPath, rootSchema ?? schema);
const wantedNestingByType: { [key: string]: number } = {
object: 2,
array: 1
};
let objectDepth = 0;
if (resolvedSchema !== undefined && resolvedSchema.items !== undefined) {

@@ -463,12 +460,12 @@ // check if nested arrays

}
// we don't support multiple types
if (typeof val.type !== 'string') {
if (hasType(val, 'object')) {
objectDepth++;
if (objectDepth === 2) {
return true;
}
}
if (hasType(val, 'array')) {
return true;
}
const typeCount = wantedNestingByType[val.type];
if (typeCount === undefined) {
return false;
}
wantedNestingByType[val.type] = typeCount - 1;
return wantedNestingByType[val.type] === 0;
return false;
}, rootSchema)

@@ -475,0 +472,0 @@ ) {

@@ -28,3 +28,3 @@ /*

import range from 'lodash/range';
import { Scopable } from '../models';
import { isScoped, Scopable } from '../models';

@@ -85,9 +85,13 @@ export const compose = (path1: string, path2: string) => {

export const composeWithUi = (scopableUi: Scopable, path: string): string => {
if (!isScoped(scopableUi)) {
return path ?? '';
}
const segments = toDataPathSegments(scopableUi.scope);
if (isEmpty(segments) && path === undefined) {
return '';
if (isEmpty(segments)) {
return path ?? '';
}
return isEmpty(segments) ? path : compose(path, segments.join('.'));
return compose(path, segments.join('.'));
};

@@ -104,2 +108,2 @@

*/
export const decode = (pointerSegment: string) => pointerSegment?.replace(/~1/g, '/').replace(/~0/, '~');
export const decode = (pointerSegment: string) => pointerSegment?.replace(/~1/g, '/').replace(/~0/, '~');

@@ -30,2 +30,3 @@ /*

Condition,
JsonSchema,
LeafCondition,

@@ -43,3 +44,2 @@ OrCondition,

import { JsonFormsState } from '../store';
import { JsonSchema } from '../models/jsonSchema';

@@ -46,0 +46,0 @@ const isOrCondition = (condition: Condition): condition is OrCondition =>

@@ -30,3 +30,3 @@ /*

import find from 'lodash/find';
import { JsonSchema, Scopable, UISchemaElement } from '..';
import { JsonSchema, Scoped, UISchemaElement } from '..';
import { resolveData, resolveSchema } from './resolvers';

@@ -60,4 +60,4 @@ import { composePaths, toDataPathSegments } from './path';

/**
* Derives the type of the jsonSchema element
*/
* Derives the type of the jsonSchema element
*/
export const deriveTypes = (jsonSchema: JsonSchema): string[] => {

@@ -98,4 +98,4 @@ if (isEmpty(jsonSchema)) {

/**
* Convenience wrapper around resolveData and resolveSchema.
*/
* Convenience wrapper around resolveData and resolveSchema.
*/
export const Resolve: {

@@ -114,3 +114,3 @@ schema(

// Paths --
const fromScopable = (scopable: Scopable) =>
const fromScoped = (scopable: Scoped): string =>
toDataPathSegments(scopable.scope).join('.');

@@ -120,3 +120,3 @@

compose: composePaths,
fromScopable
fromScoped
};

@@ -127,3 +127,3 @@

isEnabled(uischema: UISchemaElement, data: any, ajv: Ajv): boolean {
return isEnabled(uischema, data,undefined, ajv);
return isEnabled(uischema, data, undefined, ajv);
},

@@ -130,0 +130,0 @@ isVisible(uischema: UISchemaElement, data: any, ajv: Ajv): boolean {

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc