Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
154 changes: 154 additions & 0 deletions web_widget_json_editor/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@
======================
Web Widget JSON Editor
======================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:d7592cb1f0b6837ae1eee1eadb9d4bdd0005ac28bd48b21f88bc55f8a2e9847e
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
:target: https://odoo-community.org/page/development-status
:alt: Beta
.. |badge2| image:: https://img.shields.io/badge/licence-LGPL--3-blue.png
:target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html
:alt: License: LGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fweb-lightgray.png?logo=github
:target: https://github.com/OCA/web/tree/18.0/web_widget_json_editor
:alt: OCA/web
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/web-18-0/web-18-0-web_widget_json_editor
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/builds?repo=OCA/web&target_branch=18.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|

This module provides a JSON Editor widget for Odoo form views.

It wraps the popular
`JSONEditor <https://github.com/josdejong/jsoneditor>`__ library and
provides:

- Syntax highlighting for JSON
- Schema-based validation and autocomplete
- Multiple view modes (code, view)
- Search functionality
- Undo/redo history

The module includes both a field widget (for use in form views) and a
reusable OWL component (for custom integrations).

**Code Mode:**

|Code Mode|

**View Mode:**

|View Mode|

.. |Code Mode| image:: https://raw.githubusercontent.com/OCA/web/18.0/web_widget_json_editor/static/description/screenshot_code_mode.png
.. |View Mode| image:: https://raw.githubusercontent.com/OCA/web/18.0/web_widget_json_editor/static/description/screenshot_view_mode.png

**Table of contents**

.. contents::
:local:

Usage
=====

Field Widget
------------

To use the JSON editor widget in your form views, add the
``widget="json_editor"`` attribute to your field:

.. code:: xml

<field name="json_data" widget="json_editor"/>

The widget supports ``text``, ``char``, and ``json`` field types.

With Schema Validation
----------------------

You can provide a JSON Schema for validation and autocomplete:

.. code:: xml

<field name="json_data" widget="json_editor"
options="{'schema': {'type': 'object', 'properties': {'name': {'type': 'string'}}}}"/>

OWL Component
-------------

You can also use the JSON editor as a standalone OWL component in your
custom code:

.. code:: javascript

import { JsonEditorComponent } from "@web_widget_json_editor/components/json_editor/json_editor";

// In your component
static components = { JsonEditorComponent };

The component accepts the following props:

- ``value``: Initial JSON value (object or string)
- ``onChange``: Callback when value changes
- ``schema``: JSON Schema for validation
- ``mode``: Editor mode ('code' or 'view')
- ``height``: Editor height (default: '400px')

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/OCA/web/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
`feedback <https://github.com/OCA/web/issues/new?body=module:%20web_widget_json_editor%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

Do not contact contributors directly about support or help with technical issues.

Credits
=======

Authors
-------

* Apexive Solutions LLC

Contributors
------------

- `Apexive Solutions LLC <https://apexive.com>`__

Maintainers
-----------

This module is maintained by the OCA.

.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org

OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.

.. |maintainer-adar2378| image:: https://github.com/adar2378.png?size=40px
:target: https://github.com/adar2378
:alt: adar2378

Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:

|maintainer-adar2378|

This module is part of the `OCA/web <https://github.com/OCA/web/tree/18.0/web_widget_json_editor>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
Empty file.
36 changes: 36 additions & 0 deletions web_widget_json_editor/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"name": "Web Widget JSON Editor",
"version": "18.0.1.0.0",
"category": "Web",
"summary": "JSON Editor widget for Odoo with schema-based autocomplete",
"depends": [
"web",
],
"images": [
"static/description/screenshot_code_mode.png",
"static/description/screenshot_view_mode.png",
],
"assets": {
"web.assets_backend": [
# JSONEditor library
"web_widget_json_editor/static/lib/jsoneditor/jsoneditor.min.js",
"web_widget_json_editor/static/lib/jsoneditor/jsoneditor.min.css",
"web_widget_json_editor/static/lib/jsoneditor/img/jsoneditor-icons.svg",
# Field widget
"web_widget_json_editor/static/src/fields/json_field.esm.js",
"web_widget_json_editor/static/src/fields/json_field.xml",
"web_widget_json_editor/static/src/fields/json_field.scss",
# OWL Component
"web_widget_json_editor/static/src/components/json_editor/json_editor.esm.js",
"web_widget_json_editor/static/src/components/json_editor/json_editor.xml",
],
},
"author": "Apexive Solutions LLC, Odoo Community Association (OCA)",
"maintainers": ["adar2378"],
"website": "https://github.com/OCA/web",
"installable": True,
"application": False,
"auto_install": False,
"license": "LGPL-3",
"development_status": "Beta",
}
3 changes: 3 additions & 0 deletions web_widget_json_editor/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["whool"]
build-backend = "whool.buildapi"
1 change: 1 addition & 0 deletions web_widget_json_editor/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- [Apexive Solutions LLC](https://apexive.com)
22 changes: 22 additions & 0 deletions web_widget_json_editor/readme/DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
This module provides a JSON Editor widget for Odoo form views.

It wraps the popular
[JSONEditor](https://github.com/josdejong/jsoneditor) library and
provides:

- Syntax highlighting for JSON
- Schema-based validation and autocomplete
- Multiple view modes (code, view)
- Search functionality
- Undo/redo history

The module includes both a field widget (for use in form views) and a
reusable OWL component (for custom integrations).

**Code Mode:**

![Code Mode](../static/description/screenshot_code_mode.png)

**View Mode:**

![View Mode](../static/description/screenshot_view_mode.png)
39 changes: 39 additions & 0 deletions web_widget_json_editor/readme/USAGE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
## Field Widget

To use the JSON editor widget in your form views, add the
`widget="json_editor"` attribute to your field:

``` xml
<field name="json_data" widget="json_editor"/>
```

The widget supports `text`, `char`, and `json` field types.

## With Schema Validation

You can provide a JSON Schema for validation and autocomplete:

``` xml
<field name="json_data" widget="json_editor"
options="{'schema': {'type': 'object', 'properties': {'name': {'type': 'string'}}}}"/>
```

## OWL Component

You can also use the JSON editor as a standalone OWL component in your
custom code:

``` javascript
import { JsonEditorComponent } from "@web_widget_json_editor/components/json_editor/json_editor";

// In your component
static components = { JsonEditorComponent };
```

The component accepts the following props:

- `value`: Initial JSON value (object or string)
- `onChange`: Callback when value changes
- `schema`: JSON Schema for validation
- `mode`: Editor mode ('code' or 'view')
- `height`: Editor height (default: '400px')
Loading