Description
Describe the bug
I use the same code base locally and switch NODE_ENV between 'development' and 'production' to test different environments.
When I use the vue-vanilla renderers, my form looks the same in both environments. When I use my custom ArrayListRenderer, it is only rendered when NODE_ENV is not "production" (it can be "development" or be unset).
HTML rendered in "development" mode:
<div class="layout-class">
<fieldset class="array-class">...</fieldset>
</div>
HTML rendered in "production" mode:
<div class="layout-class">
<!-- -->
</div>
There's no JS error, rendering in "production" mode.
Custom ArrayListRenderer:
<template>
<fieldset v-if="control.visible" :class="styles.arrayList.root">
<legend :class="styles.arrayList.legend">
<label :class="styles.arrayList.label">
{{ control.label }}
<i
:class="styles.arrayList.addButton"
@click="addButtonClick"
uk-icon="plus-circle"
>
</i>
</label>
</legend>
<ul
v-if="!noData"
:class="styles.arrayList.list"
uk-accordion="multiple: true"
>
<array-list-element
v-for="(element, index) in control.data"
:moveUp="moveUp(control.path, index)"
:moveUpEnabled="index > 0"
:moveDown="moveDown(control.path, index)"
:moveDownEnabled="index < control.data.length - 1"
:delete="removeItems(control.path, [index])"
:label="childLabelForIndex(index)"
:styles="styles"
:key="`${control.path}-${index}`"
:initiallyExpanded="uischema.options.detail.initiallyExpanded"
>
<dispatch-renderer
:schema="control.schema"
:uischema="childUiSchema"
:path="composePaths(control.path, `${index}`)"
:enabled="control.enabled"
:renderers="control.renderers"
:cells="control.cells"
/>
</array-list-element>
</ul>
<div v-else :class="styles.arrayList.noData">No Items</div>
</fieldset>
</template>
<script lang="ts">
import {
composePaths,
createDefaultValue,
JsonFormsRendererRegistryEntry,
rankWith,
ControlElement,
schemaTypeIs,
} from "@jsonforms/core";
import { defineComponent } from "vue";
import {
DispatchRenderer,
rendererProps,
useJsonFormsArrayControl,
RendererProps,
} from "@jsonforms/vue";
import { useVanillaArrayControl } from "@jsonforms/vue-vanilla";
import ArrayListElement from "./ArrayListElement.vue";
const controlRenderer = defineComponent({
name: "array-list-renderer",
components: {
ArrayListElement,
DispatchRenderer,
},
props: {
...rendererProps<ControlElement>(),
},
setup(props: RendererProps<ControlElement>) {
return useVanillaArrayControl(useJsonFormsArrayControl(props));
},
computed: {
noData(): boolean {
return !this.control.data || this.control.data.length === 0;
},
},
methods: {
composePaths,
createDefaultValue,
addButtonClick() {
this.addItem(
this.control.path,
createDefaultValue(this.control.schema)
)();
},
},
});
export default controlRenderer;
const entry: JsonFormsRendererRegistryEntry = {
renderer: controlRenderer,
tester: rankWith(3, schemaTypeIs("array")),
};
export { entry };
</script>
Expected behavior
I would expect the control to render with NODE_ENV = "production"
Steps to reproduce the issue
to reproduce, use the vue-vanilla example project and recreate my custom renderer.
register it as follows:
import { vanillaRenderers } from "@jsonforms/vue-vanilla";
import { entry as ArrayListRenderer } from "@/components/jsonforms/ArrayListRenderer.vue";
const myRenderers = Object.freeze([...vanillaRenderers, ArrayListRenderer]);
use the following schema:
const settingsProperties = {
adminMail: {
type: "string",
},
locale: {
type: "string",
},
hscodes: {
type: "array",
title: "HSCODES",
items: {
type: "object",
properties: {
code: {
type: "string",
},
label: {
type: "string",
},
},
},
},
};
and this UiSchema:
{
type: "VerticalLayout",
elements: [
{
type: "Control",
scope: "#/properties/adminMail",
},
{
type: "Control",
scope: "#/properties/locale",
},
{
type: "Control",
scope: "#/properties/hscodes",
options: {
childLabelProp: "label",
detail: {
type: "HorizontalLayout",
initiallyExpanded: false,
elements: [
{
type: "Control",
scope: "#/properties/label",
},
{
type: "Control",
scope: "#/properties/code",
},
],
},
},
},
],
}
and this example data:
{
adminMail: "[email protected]",
locale: "de-CH",
hscodes: [
{ label: "Sculpture", code: "2345-90.1" },
{ label: "Painting", code: "454.343-1" },
],
}
Screenshots
In which browser are you experiencing the issue?
Version 108.0.5359.124 (Offizieller Build) (arm64)
Which Version of JSON Forms are you using?
v3.0.0
Framework
Vue 3
RendererSet
Vanilla
Additional context
No response