react-json-schema-ui-editor
Advanced tools
Comparing version
@@ -128,3 +128,3 @@ import * as react_jsx_runtime from 'react/jsx-runtime'; | ||
declare const jsonSchemaAvailableTypes: readonly ["string", "number", "integer", "boolean", "object", "array"]; | ||
declare const jsonSchemaPossibleFields: readonly ["type", "description", "title", "property", "minimum", "maximum", "enum"]; | ||
declare const jsonSchemaPossibleFields: readonly ["type", "description", "title", "property", "minimum", "maximum", "enum", "format"]; | ||
declare const jsonSchemaPossibleFieldType: readonly ["select", "integer", "float", "string", "bigString", "enum"]; | ||
@@ -131,0 +131,0 @@ |
@@ -145,3 +145,3 @@ // src/components/JsonSchemaContext.tsx | ||
var jsonSchemaAvailableTypes = ["string", "number", "integer", "boolean", "object", "array"]; | ||
var jsonSchemaPossibleFields = ["type", "description", "title", "property", "minimum", "maximum", "enum"]; | ||
var jsonSchemaPossibleFields = ["type", "description", "title", "property", "minimum", "maximum", "enum", "format"]; | ||
var jsonSchemaPossibleFieldType = ["select", "integer", "float", "string", "bigString", "enum"]; | ||
@@ -228,4 +228,30 @@ | ||
// src/components/JsonSchemaRowStringProperties.tsx | ||
import { Fragment as Fragment3, jsx as jsx2 } from "react/jsx-runtime"; | ||
var JsonSchemaRowStringProperties = ({ | ||
renderInput, | ||
path | ||
}) => { | ||
const { | ||
derived: { getPropertyPath, getPathState }, | ||
actions: { setSchemaProperty, removeSchemaProperty } | ||
} = useJsonSchemaContext(); | ||
const currentRowState = getPathState(path); | ||
return /* @__PURE__ */ jsx2(Fragment3, { children: renderInput({ | ||
onChange: (value) => { | ||
if (typeof value === "string" && value.length === 0 || !value) { | ||
removeSchemaProperty(`${getPropertyPath(path)}format`); | ||
return; | ||
} | ||
setSchemaProperty(`${getPropertyPath(path)}format`, value); | ||
}, | ||
value: currentRowState.format, | ||
type: "select", | ||
field: "format", | ||
options: ["date", "time", "date-time"] | ||
}) }); | ||
}; | ||
// src/components/JsonSchemaPropertyRow.tsx | ||
import { jsx as jsx2, jsxs as jsxs3 } from "react/jsx-runtime"; | ||
import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime"; | ||
var JsonSchemaPropertyRow = ({ | ||
@@ -286,3 +312,3 @@ path, | ||
}), | ||
(currentRowState.type === "number" || currentRowState.type === "integer") && /* @__PURE__ */ jsx2( | ||
(currentRowState.type === "number" || currentRowState.type === "integer") && /* @__PURE__ */ jsx3( | ||
JsonSchemaRowNumberProperties, | ||
@@ -297,2 +323,12 @@ { | ||
), | ||
currentRowState.type === "string" && /* @__PURE__ */ jsx3( | ||
JsonSchemaRowStringProperties, | ||
{ | ||
renderAddPropertyButton, | ||
renderInput, | ||
path, | ||
renderRemovePropertyButton, | ||
name | ||
} | ||
), | ||
currentRowState.type && !["object", "array", "boolean"].includes(currentRowState.type) && renderInput({ | ||
@@ -316,3 +352,3 @@ onChange: (value) => { | ||
}), | ||
currentRowIsObject && /* @__PURE__ */ jsx2( | ||
currentRowIsObject && /* @__PURE__ */ jsx3( | ||
JsonSchemaAddProperty, | ||
@@ -333,3 +369,3 @@ { | ||
/* @__PURE__ */ jsxs3("div", { style: { display: "flex", flexDirection: "row" }, children: [ | ||
/* @__PURE__ */ jsx2( | ||
/* @__PURE__ */ jsx3( | ||
"div", | ||
@@ -346,3 +382,3 @@ { | ||
/* @__PURE__ */ jsxs3("div", { children: [ | ||
currentRowIsObject && !isRowCollapsed && Object.keys(currentRowState.properties || {}).map((prop) => /* @__PURE__ */ jsx2( | ||
currentRowIsObject && !isRowCollapsed && Object.keys(currentRowState.properties || {}).map((prop) => /* @__PURE__ */ jsx3( | ||
JsonSchemaPropertyRow, | ||
@@ -360,3 +396,3 @@ { | ||
)), | ||
currentRowIsArray && /* @__PURE__ */ jsx2( | ||
currentRowIsArray && /* @__PURE__ */ jsx3( | ||
JsonSchemaPropertyRow, | ||
@@ -382,3 +418,3 @@ { | ||
// src/components/JsonSchemaEditor.tsx | ||
import { jsx as jsx3 } from "react/jsx-runtime"; | ||
import { jsx as jsx4 } from "react/jsx-runtime"; | ||
var JsonSchemaEditor = ({ | ||
@@ -393,3 +429,3 @@ initialSchema, | ||
}) => { | ||
return /* @__PURE__ */ jsx3(JsonSchemaContextProvider, { init: initialSchema, onChange, children: /* @__PURE__ */ jsx3( | ||
return /* @__PURE__ */ jsx4(JsonSchemaContextProvider, { init: initialSchema, onChange, children: /* @__PURE__ */ jsx4( | ||
JsonSchemaPropertyRow, | ||
@@ -396,0 +432,0 @@ { |
{ | ||
"name": "react-json-schema-ui-editor", | ||
"version": "0.4.2", | ||
"version": "0.4.3", | ||
"description": "React component to edit json schema in a UI.", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
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
97841
7.33%1046
7.17%