/** * `eox-jsonform` is a flexible and extensible web component for rendering dynamic forms based on JSON schema definitions. * It is based on [JSON Editor](https://github.com/json-editor/json-editor) and extends its functionality to support various advanced features. * Also check out the [JSON Editor Documentation](https://raw.githubusercontent.com/json-editor/json-editor/refs/heads/master/README.md) for full details on schema syntax, options, and built-in editors. * * Core JSON-Editor Features & Options Reference: * - **Branching (`anyOf` / `oneOf`)**: * - Use `"keep_oneof_values": false` in `options` when variants define different defaults, types (e.g., string vs array), or numeric ranges/steps. By default, JSON-Editor carries over values (`keep_oneof_values: true`), corrupting branch defaults and slider ranges. * - Example: `"options": { "no_additional_properties": true, "keep_oneof_values": false }` * - **Dynamic Field Dependencies & Templates**: * - `watch`: Watch other form fields (e.g. `"watch": { "vminmax": "vminmax" }`). * - `template`: Interpolate watched values into string templates (e.g. `"template": "{{vminmax.vmin}},{{vminmax.vmax}}"`). * - **Custom & Advanced Inputs**: * - `format: "minmax"`: Dual-handle range slider (via `tc-range-slider`) for selecting min/max bounds with automatic precision detection based on `step`. * - `format: "range"`: Single range slider with `minimum`, `maximum`, and `step`. * - `format: "markdown"` / `format: "ace"`: Markdown and Ace code editor integration. Supports `options.markdownToolbar` with optional file upload (`options.markdownToolbar.upload` / `options.uploadEndpoint`) and custom buttons. * - `format: "spatial"`: Bounding box, polygon, point, and line drawing integrated with `eox-map` / `eox-drawtools`. * - **URL Parameter Filtering (`removeProperties`)**: * - Use `options.removeProperties: ["vminmax"]` to drop intermediate form/slider properties from consumers and tile URL updates. * - **Configuration Options**: * - `no_additional_properties: true`: Restrict output strictly to defined schema properties. * - `disable_collapse`, `disable_edit_json`, `disable_properties`: Standard JSON-Editor UI toggles. * * Features: * - Renders forms from JSON schema, supporting complex nested structures, branching (`anyOf`/`oneOf`), and custom validation. * - All properties and event handlers are passed via args, enabling dynamic configuration and integration. Properties can also be passed as stringified JSON attributes (e.g. `schema`, `value`, `options`). * - Supports custom editor interfaces for advanced input types and external editor integration (e.g., Ace, Markdown, spatial drawtools). * - Handles spatial inputs (bounding box, polygons, points, lines) and outputs in various formats (GeoJSON, WKT). * - Allows toggling and opt-in/optional properties, with dynamic visibility and value updates. * - Can load schema and values from external URLs, supporting async loading and ready events. * - Integrates with `eox-map` for spatial feature selection when required. * - Supports unstyled rendering for custom design integration. * * See the stories for usage examples covering validation, custom editors, branching variants, spatial inputs, opt-in/optional properties, external loading, and more. * * @typedef {JSON & {properties: object}} JsonSchema * @element eox-jsonform */ export class EOxJSONForm extends LitElement { static properties: { schema: { type: ObjectConstructor; }; value: { type: ObjectConstructor; }; defaults: { type: ObjectConstructor; }; options: { type: ObjectConstructor; }; customEditorInterfaces: { type: ArrayConstructor; }; noShadow: { attribute: string; type: BooleanConstructor; }; propertiesToggle: { attribute: string; type: BooleanConstructor; }; unstyled: { type: BooleanConstructor; }; }; /** * Setter for the JSON schema used to render the form * * @param {JsonSchema} newSchema */ set schema(newSchema: JsonSchema); /** * Getter for the JSON schema used to render the form * * @return {JsonSchema | String} */ get schema(): JsonSchema | string; /** * Setter for the JSON value of the form * * @param {JsonSchema} newVal */ set value(newVal: JsonSchema); /** * Getter for the JSON value of the form */ get value(): JsonSchema; /** * Default values for the JSONEditor instance * * @type {object} */ defaults: object; /** * Configuration options for the JSONEditor instance (e.g., `keep_oneof_values: false`, `no_additional_properties: true`, `removeProperties: [...]`). * See JSON-Editor options: https://raw.githubusercontent.com/json-editor/json-editor/refs/heads/master/README.md * * @type {object} */ options: object; /** * Renders the element without a shadow root * * @type {Boolean} */ noShadow: boolean; /** * Shows a toggle for showing/hiding object properties editing buttons * To be used in combination with `options.disable_properties = false` * * @type {Boolean} */ propertiesToggle: boolean; /** * Render the element without additional styles * * @type {Boolean} */ unstyled: boolean; /** * List of custom editor interface * Read more about the implementation of custom editor interfaces here: * https://github.com/json-editor/json-editor/blob/master/docs/custom-editor.html * * @type {Array} */ customEditorInterfaces: any[]; /** * Getter for the JSONEditor instance */ get editor(): { [key: string]: any; }; _schema: string | import("./helpers/editor").JsonSchema | JsonSchema; _value: any; /** * Lifecycle method called when the element is updated * * @param {import("lit").PropertyValues} changedProperties */ updated(changedProperties: import("lit").PropertyValues): Promise; /** * Renders the component's HTML and CSS */ render(): import("lit-html").TemplateResult<1>; #private; } /** * `eox-jsonform` is a flexible and extensible web component for rendering dynamic forms based on JSON schema definitions. * It is based on [JSON Editor](https://github.com/json-editor/json-editor) and extends its functionality to support various advanced features. * Also check out the [JSON Editor Documentation](https://raw.githubusercontent.com/json-editor/json-editor/refs/heads/master/README.md) for full details on schema syntax, options, and built-in editors. * * Core JSON-Editor Features & Options Reference: * - **Branching (`anyOf` / `oneOf`)**: * - Use `"keep_oneof_values": false` in `options` when variants define different defaults, types (e.g., string vs array), or numeric ranges/steps. By default, JSON-Editor carries over values (`keep_oneof_values: true`), corrupting branch defaults and slider ranges. * - Example: `"options": { "no_additional_properties": true, "keep_oneof_values": false }` * - **Dynamic Field Dependencies & Templates**: * - `watch`: Watch other form fields (e.g. `"watch": { "vminmax": "vminmax" }`). * - `template`: Interpolate watched values into string templates (e.g. `"template": "{{vminmax.vmin}},{{vminmax.vmax}}"`). * - **Custom & Advanced Inputs**: * - `format: "minmax"`: Dual-handle range slider (via `tc-range-slider`) for selecting min/max bounds with automatic precision detection based on `step`. * - `format: "range"`: Single range slider with `minimum`, `maximum`, and `step`. * - `format: "markdown"` / `format: "ace"`: Markdown and Ace code editor integration. Supports `options.markdownToolbar` with optional file upload (`options.markdownToolbar.upload` / `options.uploadEndpoint`) and custom buttons. * - `format: "spatial"`: Bounding box, polygon, point, and line drawing integrated with `eox-map` / `eox-drawtools`. * - **URL Parameter Filtering (`removeProperties`)**: * - Use `options.removeProperties: ["vminmax"]` to drop intermediate form/slider properties from consumers and tile URL updates. * - **Configuration Options**: * - `no_additional_properties: true`: Restrict output strictly to defined schema properties. * - `disable_collapse`, `disable_edit_json`, `disable_properties`: Standard JSON-Editor UI toggles. * * Features: * - Renders forms from JSON schema, supporting complex nested structures, branching (`anyOf`/`oneOf`), and custom validation. * - All properties and event handlers are passed via args, enabling dynamic configuration and integration. Properties can also be passed as stringified JSON attributes (e.g. `schema`, `value`, `options`). * - Supports custom editor interfaces for advanced input types and external editor integration (e.g., Ace, Markdown, spatial drawtools). * - Handles spatial inputs (bounding box, polygons, points, lines) and outputs in various formats (GeoJSON, WKT). * - Allows toggling and opt-in/optional properties, with dynamic visibility and value updates. * - Can load schema and values from external URLs, supporting async loading and ready events. * - Integrates with `eox-map` for spatial feature selection when required. * - Supports unstyled rendering for custom design integration. * * See the stories for usage examples covering validation, custom editors, branching variants, spatial inputs, opt-in/optional properties, external loading, and more. */ export type JsonSchema = JSON & { properties: object; }; import { LitElement } from "lit"; //# sourceMappingURL=main.d.ts.map