Skip to content

Commit add63e7

Browse files
committed
Polish Vue 3 renderer set
- replaces date, time and datetime renderers with browser native alternatives - fixes tooltip handling on all renderers switching to Vuetify 3 pattern - let array control and array layout grab full width - fix popup dialog in array layout renderer - fix all checkbox bindings (boolean, toggle and enum array renderers) - fix slider control - fixes watch script in vue-vuetify package Also partially fixes example app, however Monaco Editor still only works when triggering hot reloading.
1 parent e28891c commit add63e7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+814
-3637
lines changed

packages/example/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"version": "3.1.0-alpha.0",
44
"private": true,
55
"scripts": {
6-
"build": "vue-cli-service build --mode development",
6+
"build": "vue-cli-service build",
77
"serve": "vue-cli-service serve",
88
"clean": "rimraf dist"
99
},
@@ -14,7 +14,7 @@
1414
"ajv-keywords": "^5.1.0",
1515
"core-js": "^3.9.1",
1616
"json-refs": "^3.0.15",
17-
"monaco-editor": "^0.26.0",
17+
"monaco-editor": "^0.38.0",
1818
"vue": "^3.2.47",
1919
"vue-router": "^4.1.6",
2020
"vuetify": "^3.1.12",
@@ -32,7 +32,7 @@
3232
"eslint": "^8.37.0",
3333
"eslint-plugin-prettier": "^4.0.0",
3434
"eslint-plugin-vue": "^9.10.0",
35-
"monaco-editor-webpack-plugin": "^4.1.1",
35+
"monaco-editor-webpack-plugin": "^7.0.1",
3636
"prettier": "^2.8.7",
3737
"rimraf": "^4.4.1",
3838
"sass": "~1.32.0",

packages/example/src/components/DemoForm.vue

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
:schema="resolvedSchema.schema"
77
:uischema="example.input.uischema"
88
:renderers="renderers"
9-
:cells="cells"
109
:config="config"
1110
:uischemas="uischemas"
1211
:validationMode="validationMode"
@@ -52,12 +51,11 @@
5251
<script lang="ts">
5352
import { PropType } from 'vue';
5453
import { Example, ResolvedSchema } from '@/core/types';
55-
import { Ajv } from 'ajv';
54+
import type Ajv from 'ajv';
5655
import {
5756
ValidationMode,
5857
JsonFormsUISchemaRegistryEntry,
5958
JsonFormsRendererRegistryEntry,
60-
JsonFormsCellRendererRegistryEntry,
6159
JsonSchema,
6260
JsonFormsI18nState,
6361
} from '@jsonforms/core';
@@ -75,11 +73,6 @@ export default {
7573
required: true,
7674
type: Array as PropType<JsonFormsRendererRegistryEntry[]>,
7775
},
78-
cells: {
79-
required: false,
80-
type: Array as PropType<JsonFormsCellRendererRegistryEntry[]>,
81-
default: () => [],
82-
},
8376
config: {
8477
required: false,
8578
type: Object as PropType<any>,
@@ -149,7 +142,8 @@ export default {
149142
},
150143
methods: {
151144
onChange(event: JsonFormsChangeEvent): void {
152-
this.$emit('change', event);
145+
console.log(event);
146+
this.$emit('jsfchange', event);
153147
},
154148
resolveSchema(schema?: JsonSchema): void {
155149
const resolvedSchema = this.resolvedSchema;

packages/example/src/components/MonacoEditor.vue

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
<script lang="ts">
1010
import * as monaco from 'monaco-editor/esm/vs/editor/editor.api';
11-
import { PropType } from 'vue';
11+
import { PropType, toRaw } from 'vue';
1212
1313
export type MonacoApi = typeof monaco;
1414
@@ -19,16 +19,14 @@ function processSize(size: number | string) {
1919
}
2020
2121
interface BaseComponentData {
22-
editor?: monaco.editor.IStandaloneCodeEditor;
23-
subscription?: monaco.IDisposable;
2422
prevent_trigger_change_event?: boolean;
2523
}
2624
2725
export default {
2826
props: {
2927
width: { type: [String, Number], default: '100%' },
3028
height: { type: [String, Number], default: '100%' },
31-
value: { type: Object as PropType<monaco.editor.ITextModel> },
29+
modelValue: { type: Object as PropType<monaco.editor.ITextModel> },
3230
language: { type: String, default: 'javascript' },
3331
theme: { type: String, default: 'vs' },
3432
options: {
@@ -59,10 +57,11 @@ export default {
5957
className: { type: String, required: false },
6058
},
6159
data(): BaseComponentData {
60+
this.editor = null;
61+
this.subscription = null;
62+
this.foo = null;
6263
return {
63-
editor: undefined,
64-
subscription: undefined,
65-
prevent_trigger_change_event: undefined,
64+
prevent_trigger_change_event: true,
6665
};
6766
},
6867
mounted() {
@@ -83,12 +82,13 @@ export default {
8382
}
8483
},
8584
},
86-
value(newModel: monaco.editor.ITextModel) {
85+
modelValue(newModel: monaco.editor.ITextModel) {
8786
if (this.editor) {
8887
const { editor } = this;
8988
9089
if (!newModel.isDisposed()) {
91-
editor.setModel(newModel);
90+
console.log('Update Monaco with', toRaw(newModel));
91+
editor.setModel(toRaw(newModel));
9292
}
9393
}
9494
},
@@ -146,10 +146,11 @@ export default {
146146
// Before initializing monaco editor
147147
const options = { ...this.options, ...this.editorWillMount() };
148148
149+
console.log('initialize monaco with', toRaw(this.modelValue));
149150
this.editor = monaco.editor.create(
150151
this.$refs.containerElement as HTMLElement,
151152
{
152-
model: this.value,
153+
model: toRaw(this.modelValue),
153154
language,
154155
...(className ? { extraEditorClassName: className } : {}),
155156
...options,

0 commit comments

Comments
 (0)