@ghentcdh/json-forms-vue 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.d.ts +2 -0
- package/index.js +304 -173
- package/index.mjs +306 -175
- package/package.json +1 -1
- package/renderes/array/index.d.ts +3 -1
package/index.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
export * from './form.store';
|
|
2
2
|
export * from './renderes/controls';
|
|
3
|
+
export * from './renderes/array';
|
|
4
|
+
export * from './renderes/layouts';
|
|
3
5
|
export * from './renderes/tester';
|
|
4
6
|
export * from './state/form.state';
|
|
5
7
|
export { default as FormWithTableComponent } from './form-with-table.component.vue';
|
package/index.js
CHANGED
|
@@ -8,8 +8,8 @@ const vue = require("vue");
|
|
|
8
8
|
const vueVanilla = require("@jsonforms/vue-vanilla");
|
|
9
9
|
const MdEditor = require("@toast-ui/editor");
|
|
10
10
|
const testers = require("@jsonforms/core/src/testers/testers");
|
|
11
|
-
const core$1 = require("@vueuse/core");
|
|
12
11
|
const vueRouter = require("vue-router");
|
|
12
|
+
const core$1 = require("@vueuse/core");
|
|
13
13
|
class FormStore {
|
|
14
14
|
constructor(schema) {
|
|
15
15
|
this.schema = schema;
|
|
@@ -101,19 +101,19 @@ const _export_sfc = (sfc, props) => {
|
|
|
101
101
|
}
|
|
102
102
|
return target;
|
|
103
103
|
};
|
|
104
|
-
const _hoisted_1$
|
|
105
|
-
const _hoisted_2$
|
|
106
|
-
const _hoisted_3$
|
|
107
|
-
const _hoisted_4$
|
|
108
|
-
function _sfc_render$
|
|
104
|
+
const _hoisted_1$b = { class: "flex justify-around flex-col h-full" };
|
|
105
|
+
const _hoisted_2$3 = { class: "fieldset-label" };
|
|
106
|
+
const _hoisted_3$3 = ["id", "checked", "disabled", "autofocus", "placeholder"];
|
|
107
|
+
const _hoisted_4$2 = { class: "font-bold text-gray-500 text-sm" };
|
|
108
|
+
function _sfc_render$7(_ctx, _cache, $props, $setup, $data, $options) {
|
|
109
109
|
const _component_control_wrapper = vue.resolveComponent("control-wrapper");
|
|
110
|
-
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$
|
|
110
|
+
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$b, [
|
|
111
111
|
vue.createVNode(_component_control_wrapper, vue.mergeProps(_ctx.controlWrapper, {
|
|
112
112
|
styles: _ctx.styles,
|
|
113
113
|
"hide-label": true
|
|
114
114
|
}), {
|
|
115
115
|
default: vue.withCtx(() => [
|
|
116
|
-
vue.createElementVNode("label", _hoisted_2$
|
|
116
|
+
vue.createElementVNode("label", _hoisted_2$3, [
|
|
117
117
|
vue.createElementVNode("input", {
|
|
118
118
|
id: _ctx.control.id + "-input",
|
|
119
119
|
type: "checkbox",
|
|
@@ -125,15 +125,15 @@ function _sfc_render$5(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
125
125
|
onChange: _cache[0] || (_cache[0] = (...args) => _ctx.onChange && _ctx.onChange(...args)),
|
|
126
126
|
onFocus: _cache[1] || (_cache[1] = (...args) => _ctx.onFocus && _ctx.onFocus(...args)),
|
|
127
127
|
onBlur: _cache[2] || (_cache[2] = (...args) => _ctx.onBlur && _ctx.onBlur(...args))
|
|
128
|
-
}, null, 40, _hoisted_3$
|
|
129
|
-
vue.createElementVNode("span", _hoisted_4$
|
|
128
|
+
}, null, 40, _hoisted_3$3),
|
|
129
|
+
vue.createElementVNode("span", _hoisted_4$2, vue.toDisplayString(_ctx.control.label), 1)
|
|
130
130
|
])
|
|
131
131
|
]),
|
|
132
132
|
_: 1
|
|
133
133
|
}, 16, ["styles"])
|
|
134
134
|
]);
|
|
135
135
|
}
|
|
136
|
-
const BooleanControlRenderer = /* @__PURE__ */ _export_sfc(controlRenderer$8, [["render", _sfc_render$
|
|
136
|
+
const BooleanControlRenderer = /* @__PURE__ */ _export_sfc(controlRenderer$8, [["render", _sfc_render$7]]);
|
|
137
137
|
const showErrors = (isTouched, isFocused, errors2) => {
|
|
138
138
|
return !!(isTouched && errors2);
|
|
139
139
|
};
|
|
@@ -177,8 +177,8 @@ const entry$7 = {
|
|
|
177
177
|
renderer: controlRenderer$7,
|
|
178
178
|
tester: core.rankWith(1, core.isIntegerControl)
|
|
179
179
|
};
|
|
180
|
-
const _hoisted_1$
|
|
181
|
-
function _sfc_render$
|
|
180
|
+
const _hoisted_1$a = ["id", "step", "value", "disabled", "autofocus", "placeholder"];
|
|
181
|
+
function _sfc_render$6(_ctx, _cache, $props, $setup, $data, $options) {
|
|
182
182
|
const _component_control_wrapper = vue.resolveComponent("control-wrapper");
|
|
183
183
|
return vue.openBlock(), vue.createBlock(_component_control_wrapper, vue.mergeProps(_ctx.controlWrapper, { styles: _ctx.styles }), {
|
|
184
184
|
default: vue.withCtx(() => [
|
|
@@ -195,12 +195,12 @@ function _sfc_render$4(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
195
195
|
onChange: _cache[0] || (_cache[0] = (...args) => _ctx.onChange && _ctx.onChange(...args)),
|
|
196
196
|
onFocus: _cache[1] || (_cache[1] = (...args) => _ctx.onFocus && _ctx.onFocus(...args)),
|
|
197
197
|
onBlur: _cache[2] || (_cache[2] = (...args) => _ctx.onBlur && _ctx.onBlur(...args))
|
|
198
|
-
}, null, 42, _hoisted_1$
|
|
198
|
+
}, null, 42, _hoisted_1$a)
|
|
199
199
|
]),
|
|
200
200
|
_: 1
|
|
201
201
|
}, 16, ["styles"]);
|
|
202
202
|
}
|
|
203
|
-
const IntegerControlRenderer = /* @__PURE__ */ _export_sfc(controlRenderer$7, [["render", _sfc_render$
|
|
203
|
+
const IntegerControlRenderer = /* @__PURE__ */ _export_sfc(controlRenderer$7, [["render", _sfc_render$6]]);
|
|
204
204
|
var src = {};
|
|
205
205
|
var zodOpenapi = {};
|
|
206
206
|
var cjs = {};
|
|
@@ -4829,7 +4829,6 @@ const ControlType = {
|
|
|
4829
4829
|
textArea: "textArea",
|
|
4830
4830
|
markdown: "markdown",
|
|
4831
4831
|
fixedArray: "fixedArray",
|
|
4832
|
-
array: "array",
|
|
4833
4832
|
custom: "custom"
|
|
4834
4833
|
};
|
|
4835
4834
|
var util;
|
|
@@ -8487,8 +8486,8 @@ const isFixedArray = testers.and(
|
|
|
8487
8486
|
testers.optionIs("format", ControlType.fixedArray)
|
|
8488
8487
|
);
|
|
8489
8488
|
const isArrayRenderer = testers.and(
|
|
8490
|
-
testers.schemaTypeIs("array")
|
|
8491
|
-
|
|
8489
|
+
testers.schemaTypeIs("array")
|
|
8490
|
+
// optionIs('format', ControlType.array),
|
|
8492
8491
|
);
|
|
8493
8492
|
const isCustomControl = (customType) => {
|
|
8494
8493
|
return testers.and(
|
|
@@ -8535,17 +8534,17 @@ const entry$6 = {
|
|
|
8535
8534
|
renderer: controlRenderer$6,
|
|
8536
8535
|
tester: core.rankWith(1, isMarkdownControl)
|
|
8537
8536
|
};
|
|
8538
|
-
const _hoisted_1$
|
|
8539
|
-
function _sfc_render$
|
|
8537
|
+
const _hoisted_1$9 = ["id"];
|
|
8538
|
+
function _sfc_render$5(_ctx, _cache, $props, $setup, $data, $options) {
|
|
8540
8539
|
const _component_control_wrapper = vue.resolveComponent("control-wrapper");
|
|
8541
8540
|
return vue.openBlock(), vue.createBlock(_component_control_wrapper, vue.mergeProps(_ctx.controlWrapper, { styles: _ctx.styles }), {
|
|
8542
8541
|
default: vue.withCtx(() => [
|
|
8543
|
-
vue.createElementVNode("div", { id: _ctx.mdId }, null, 8, _hoisted_1$
|
|
8542
|
+
vue.createElementVNode("div", { id: _ctx.mdId }, null, 8, _hoisted_1$9)
|
|
8544
8543
|
]),
|
|
8545
8544
|
_: 1
|
|
8546
8545
|
}, 16, ["styles"]);
|
|
8547
8546
|
}
|
|
8548
|
-
const MarkdownControlRenderer = /* @__PURE__ */ _export_sfc(controlRenderer$6, [["render", _sfc_render$
|
|
8547
|
+
const MarkdownControlRenderer = /* @__PURE__ */ _export_sfc(controlRenderer$6, [["render", _sfc_render$5]]);
|
|
8549
8548
|
const controlRenderer$5 = vue.defineComponent({
|
|
8550
8549
|
name: "NumberControlRenderer",
|
|
8551
8550
|
components: {
|
|
@@ -8580,8 +8579,8 @@ const entry$5 = {
|
|
|
8580
8579
|
renderer: controlRenderer$5,
|
|
8581
8580
|
tester: core.rankWith(1, core.isNumberControl)
|
|
8582
8581
|
};
|
|
8583
|
-
const _hoisted_1$
|
|
8584
|
-
function _sfc_render$
|
|
8582
|
+
const _hoisted_1$8 = ["id", "step", "value", "disabled", "autofocus", "placeholder"];
|
|
8583
|
+
function _sfc_render$4(_ctx, _cache, $props, $setup, $data, $options) {
|
|
8585
8584
|
const _component_control_wrapper = vue.resolveComponent("control-wrapper");
|
|
8586
8585
|
return vue.openBlock(), vue.createBlock(_component_control_wrapper, vue.mergeProps(_ctx.controlWrapper, { styles: _ctx.styles }), {
|
|
8587
8586
|
default: vue.withCtx(() => [
|
|
@@ -8598,12 +8597,12 @@ function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
8598
8597
|
onChange: _cache[0] || (_cache[0] = (...args) => _ctx.onChange && _ctx.onChange(...args)),
|
|
8599
8598
|
onFocus: _cache[1] || (_cache[1] = (...args) => _ctx.onFocus && _ctx.onFocus(...args)),
|
|
8600
8599
|
onBlur: _cache[2] || (_cache[2] = (...args) => _ctx.onBlur && _ctx.onBlur(...args))
|
|
8601
|
-
}, null, 42, _hoisted_1$
|
|
8600
|
+
}, null, 42, _hoisted_1$8)
|
|
8602
8601
|
]),
|
|
8603
8602
|
_: 1
|
|
8604
8603
|
}, 16, ["styles"]);
|
|
8605
8604
|
}
|
|
8606
|
-
const NumberControlRenderer = /* @__PURE__ */ _export_sfc(controlRenderer$5, [["render", _sfc_render$
|
|
8605
|
+
const NumberControlRenderer = /* @__PURE__ */ _export_sfc(controlRenderer$5, [["render", _sfc_render$4]]);
|
|
8607
8606
|
const controlRenderer$4 = vue.defineComponent({
|
|
8608
8607
|
name: "StringControlRenderer",
|
|
8609
8608
|
components: {
|
|
@@ -8634,8 +8633,8 @@ const entry$4 = {
|
|
|
8634
8633
|
renderer: controlRenderer$4,
|
|
8635
8634
|
tester: core.rankWith(1, isStringFormat)
|
|
8636
8635
|
};
|
|
8637
|
-
const _hoisted_1$
|
|
8638
|
-
function _sfc_render$
|
|
8636
|
+
const _hoisted_1$7 = ["id", "value", "disabled", "autofocus", "placeholder"];
|
|
8637
|
+
function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) {
|
|
8639
8638
|
const _component_ControlWrapper = vue.resolveComponent("ControlWrapper");
|
|
8640
8639
|
return vue.openBlock(), vue.createBlock(_component_ControlWrapper, vue.mergeProps(_ctx.controlWrapper, { styles: _ctx.styles }), {
|
|
8641
8640
|
default: vue.withCtx(() => [
|
|
@@ -8651,12 +8650,12 @@ function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
8651
8650
|
onChange: _cache[0] || (_cache[0] = (...args) => _ctx.onChange && _ctx.onChange(...args)),
|
|
8652
8651
|
onFocus: _cache[1] || (_cache[1] = (...args) => _ctx.onFocus && _ctx.onFocus(...args)),
|
|
8653
8652
|
onBlur: _cache[2] || (_cache[2] = (...args) => _ctx.onBlur && _ctx.onBlur(...args))
|
|
8654
|
-
}, null, 42, _hoisted_1$
|
|
8653
|
+
}, null, 42, _hoisted_1$7)
|
|
8655
8654
|
]),
|
|
8656
8655
|
_: 1
|
|
8657
8656
|
}, 16, ["styles"]);
|
|
8658
8657
|
}
|
|
8659
|
-
const StringControlRenderer = /* @__PURE__ */ _export_sfc(controlRenderer$4, [["render", _sfc_render$
|
|
8658
|
+
const StringControlRenderer = /* @__PURE__ */ _export_sfc(controlRenderer$4, [["render", _sfc_render$3]]);
|
|
8660
8659
|
const controlRenderer$3 = vue.defineComponent({
|
|
8661
8660
|
name: "TextAreaControlRenderer",
|
|
8662
8661
|
components: {
|
|
@@ -8701,7 +8700,7 @@ const entry$2 = {
|
|
|
8701
8700
|
renderer: controlRenderer$2,
|
|
8702
8701
|
tester: core.rankWith(1, isAutoCompleteControl)
|
|
8703
8702
|
};
|
|
8704
|
-
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
8703
|
+
function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
|
|
8705
8704
|
var _a, _b;
|
|
8706
8705
|
const _component_Autocomplete = vue.resolveComponent("Autocomplete");
|
|
8707
8706
|
return vue.openBlock(), vue.createBlock(_component_Autocomplete, vue.mergeProps(_ctx.controlWrapper, {
|
|
@@ -8716,7 +8715,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
8716
8715
|
onBlur: _ctx.onBlur
|
|
8717
8716
|
}), null, 16, ["modelValue", "enabled", "config", "label-key", "value-key", "onChange", "onFocus", "onBlur"]);
|
|
8718
8717
|
}
|
|
8719
|
-
const AutocompleteControlRenderer = /* @__PURE__ */ _export_sfc(controlRenderer$2, [["render", _sfc_render]]);
|
|
8718
|
+
const AutocompleteControlRenderer = /* @__PURE__ */ _export_sfc(controlRenderer$2, [["render", _sfc_render$2]]);
|
|
8720
8719
|
const controlRenderers = [
|
|
8721
8720
|
// First custom renderers on format
|
|
8722
8721
|
entry$6,
|
|
@@ -8734,6 +8733,16 @@ const controlRenderers = [
|
|
|
8734
8733
|
entry$5,
|
|
8735
8734
|
entry$7
|
|
8736
8735
|
];
|
|
8736
|
+
const actionMap = {
|
|
8737
|
+
edit: (router, action) => ({
|
|
8738
|
+
label: "edit",
|
|
8739
|
+
icon: ui.IconEnum.Edit,
|
|
8740
|
+
show: (element) => !!element[action.idField]
|
|
8741
|
+
})
|
|
8742
|
+
};
|
|
8743
|
+
const mapArrayActions = (router, actions) => {
|
|
8744
|
+
return actions.map((a) => actionMap[a.type](router, a)).filter((a) => !!a);
|
|
8745
|
+
};
|
|
8737
8746
|
class FormState {
|
|
8738
8747
|
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
8739
8748
|
constructor() {
|
|
@@ -8757,6 +8766,261 @@ class FormState {
|
|
|
8757
8766
|
const useFormState = (form) => {
|
|
8758
8767
|
return FormState.getInstance();
|
|
8759
8768
|
};
|
|
8769
|
+
const controlRenderer$1 = vue.defineComponent({
|
|
8770
|
+
name: "ArrayListRenderer",
|
|
8771
|
+
components: {
|
|
8772
|
+
DispatchRenderer: vue$1.DispatchRenderer,
|
|
8773
|
+
Btn: ui.Btn
|
|
8774
|
+
},
|
|
8775
|
+
props: {
|
|
8776
|
+
...vue$1.rendererProps()
|
|
8777
|
+
},
|
|
8778
|
+
setup(props) {
|
|
8779
|
+
const vanillaArrayControl = vueVanilla.useVanillaArrayControl(
|
|
8780
|
+
vue$1.useJsonFormsArrayControl(props)
|
|
8781
|
+
);
|
|
8782
|
+
const control = vanillaArrayControl.control.value;
|
|
8783
|
+
if (!control.data || control.data.length < 1) {
|
|
8784
|
+
vanillaArrayControl.addItem(
|
|
8785
|
+
control.path,
|
|
8786
|
+
core.createDefaultValue(control.schema, control.rootSchema)
|
|
8787
|
+
)();
|
|
8788
|
+
}
|
|
8789
|
+
return vanillaArrayControl;
|
|
8790
|
+
},
|
|
8791
|
+
computed: {
|
|
8792
|
+
IconEnum() {
|
|
8793
|
+
return ui.IconEnum;
|
|
8794
|
+
},
|
|
8795
|
+
noData() {
|
|
8796
|
+
return !this.control.data || this.control.data.length === 0;
|
|
8797
|
+
},
|
|
8798
|
+
actions() {
|
|
8799
|
+
var _a;
|
|
8800
|
+
const actions = ((_a = this.uischema.options) == null ? void 0 : _a.actions) ?? [];
|
|
8801
|
+
return mapArrayActions(vueRouter.useRouter(), actions);
|
|
8802
|
+
},
|
|
8803
|
+
showDelete() {
|
|
8804
|
+
var _a;
|
|
8805
|
+
return ((_a = this.control.data) == null ? void 0 : _a.length) > 1;
|
|
8806
|
+
},
|
|
8807
|
+
translations() {
|
|
8808
|
+
var _a;
|
|
8809
|
+
const jsonforms = vue.inject("jsonforms");
|
|
8810
|
+
return core.getArrayTranslations(
|
|
8811
|
+
((_a = jsonforms == null ? void 0 : jsonforms.i18n) == null ? void 0 : _a.translate) ?? core.defaultJsonFormsI18nState.translate,
|
|
8812
|
+
core.arrayDefaultTranslations,
|
|
8813
|
+
this.control.i18nKeyPrefix,
|
|
8814
|
+
this.control.label
|
|
8815
|
+
);
|
|
8816
|
+
},
|
|
8817
|
+
labelKey() {
|
|
8818
|
+
var _a, _b;
|
|
8819
|
+
const key = (_b = (_a = this.uischema) == null ? void 0 : _a.options) == null ? void 0 : _b.labelKey;
|
|
8820
|
+
if (!key) return null;
|
|
8821
|
+
return key;
|
|
8822
|
+
}
|
|
8823
|
+
},
|
|
8824
|
+
methods: {
|
|
8825
|
+
composePaths: core.composePaths,
|
|
8826
|
+
createDefaultValue: core.createDefaultValue,
|
|
8827
|
+
deleteButtonClick(index) {
|
|
8828
|
+
this.removeItems(this.control.path, [index])();
|
|
8829
|
+
},
|
|
8830
|
+
dispatchEvent: (event, data) => {
|
|
8831
|
+
const form_id = "";
|
|
8832
|
+
useFormState().dispatchEvent(form_id, event, data);
|
|
8833
|
+
},
|
|
8834
|
+
addButtonClick() {
|
|
8835
|
+
this.addItem(
|
|
8836
|
+
this.control.path,
|
|
8837
|
+
core.createDefaultValue(this.control.schema, this.control.rootSchema)
|
|
8838
|
+
)();
|
|
8839
|
+
}
|
|
8840
|
+
}
|
|
8841
|
+
});
|
|
8842
|
+
const entry$1 = {
|
|
8843
|
+
renderer: controlRenderer$1,
|
|
8844
|
+
tester: core.rankWith(2, isArrayRenderer)
|
|
8845
|
+
};
|
|
8846
|
+
const _hoisted_1$6 = { class: "fieldset" };
|
|
8847
|
+
const _hoisted_2$2 = { class: "flex gap-2 items-center" };
|
|
8848
|
+
const _hoisted_3$2 = { class: "mt-3 flex gap-2" };
|
|
8849
|
+
const _hoisted_4$1 = { class: "py-2" };
|
|
8850
|
+
function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
|
|
8851
|
+
const _component_dispatch_renderer = vue.resolveComponent("dispatch-renderer");
|
|
8852
|
+
const _component_Btn = vue.resolveComponent("Btn");
|
|
8853
|
+
return _ctx.control.visible ? (vue.openBlock(), vue.createElementBlock("fieldset", {
|
|
8854
|
+
key: 0,
|
|
8855
|
+
class: vue.normalizeClass(_ctx.styles.arrayList.root)
|
|
8856
|
+
}, [
|
|
8857
|
+
!_ctx.labelKey ? (vue.openBlock(), vue.createElementBlock("legend", {
|
|
8858
|
+
key: 0,
|
|
8859
|
+
class: vue.normalizeClass(_ctx.styles.arrayList.legend)
|
|
8860
|
+
}, [
|
|
8861
|
+
vue.createElementVNode("label", {
|
|
8862
|
+
class: vue.normalizeClass(_ctx.styles.arrayList.label)
|
|
8863
|
+
}, vue.toDisplayString(_ctx.control.label), 3)
|
|
8864
|
+
], 2)) : vue.createCommentVNode("", true),
|
|
8865
|
+
vue.createElementVNode("div", null, [
|
|
8866
|
+
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.control.data, (element, index) => {
|
|
8867
|
+
var _a;
|
|
8868
|
+
return vue.openBlock(), vue.createElementBlock("div", {
|
|
8869
|
+
key: `${_ctx.control.path}-${index}`
|
|
8870
|
+
}, [
|
|
8871
|
+
vue.createElementVNode("fieldset", _hoisted_1$6, [
|
|
8872
|
+
_ctx.labelKey ? (vue.openBlock(), vue.createElementBlock("legend", {
|
|
8873
|
+
key: 0,
|
|
8874
|
+
class: vue.normalizeClass(_ctx.styles.arrayList.legend)
|
|
8875
|
+
}, vue.toDisplayString((_a = element[_ctx.labelKey]) == null ? void 0 : _a.toLowerCase()), 3)) : vue.createCommentVNode("", true),
|
|
8876
|
+
vue.createElementVNode("div", _hoisted_2$2, [
|
|
8877
|
+
vue.createVNode(_component_dispatch_renderer, {
|
|
8878
|
+
schema: _ctx.control.schema,
|
|
8879
|
+
uischema: _ctx.childUiSchema,
|
|
8880
|
+
path: _ctx.composePaths(_ctx.control.path, `${index}`),
|
|
8881
|
+
enabled: _ctx.control.enabled,
|
|
8882
|
+
renderers: _ctx.control.renderers,
|
|
8883
|
+
cells: _ctx.control.cells
|
|
8884
|
+
}, null, 8, ["schema", "uischema", "path", "enabled", "renderers", "cells"]),
|
|
8885
|
+
vue.createElementVNode("div", _hoisted_3$2, [
|
|
8886
|
+
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.actions, (action) => {
|
|
8887
|
+
return vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [
|
|
8888
|
+
action.show(element) ? (vue.openBlock(), vue.createBlock(_component_Btn, {
|
|
8889
|
+
key: action.label,
|
|
8890
|
+
icon: action.icon,
|
|
8891
|
+
outline: true,
|
|
8892
|
+
onClick: ($event) => _ctx.dispatchEvent(action.label, element)
|
|
8893
|
+
}, null, 8, ["icon", "onClick"])) : vue.createCommentVNode("", true)
|
|
8894
|
+
], 64);
|
|
8895
|
+
}), 256)),
|
|
8896
|
+
_ctx.showDelete ? (vue.openBlock(), vue.createBlock(_component_Btn, {
|
|
8897
|
+
key: 0,
|
|
8898
|
+
icon: _ctx.IconEnum.Delete,
|
|
8899
|
+
outline: true,
|
|
8900
|
+
onClick: ($event) => _ctx.deleteButtonClick(index)
|
|
8901
|
+
}, null, 8, ["icon", "onClick"])) : vue.createCommentVNode("", true)
|
|
8902
|
+
])
|
|
8903
|
+
])
|
|
8904
|
+
])
|
|
8905
|
+
]);
|
|
8906
|
+
}), 128))
|
|
8907
|
+
]),
|
|
8908
|
+
vue.createElementVNode("div", _hoisted_4$1, [
|
|
8909
|
+
vue.createVNode(_component_Btn, {
|
|
8910
|
+
icon: _ctx.IconEnum.Plus,
|
|
8911
|
+
outline: true,
|
|
8912
|
+
onClick: _ctx.addButtonClick
|
|
8913
|
+
}, {
|
|
8914
|
+
default: vue.withCtx(() => _cache[0] || (_cache[0] = [
|
|
8915
|
+
vue.createTextVNode(" Add ", -1)
|
|
8916
|
+
])),
|
|
8917
|
+
_: 1,
|
|
8918
|
+
__: [0]
|
|
8919
|
+
}, 8, ["icon", "onClick"])
|
|
8920
|
+
]),
|
|
8921
|
+
_ctx.noData ? (vue.openBlock(), vue.createElementBlock("div", {
|
|
8922
|
+
key: 1,
|
|
8923
|
+
class: vue.normalizeClass(_ctx.styles.arrayList.noData)
|
|
8924
|
+
}, vue.toDisplayString(_ctx.translations.noDataMessage), 3)) : vue.createCommentVNode("", true)
|
|
8925
|
+
], 2)) : vue.createCommentVNode("", true);
|
|
8926
|
+
}
|
|
8927
|
+
const ArrayRenderer = /* @__PURE__ */ _export_sfc(controlRenderer$1, [["render", _sfc_render$1]]);
|
|
8928
|
+
const controlRenderer = vue.defineComponent({
|
|
8929
|
+
name: "FixedArrayListRenderer",
|
|
8930
|
+
components: {
|
|
8931
|
+
DispatchRenderer: vue$1.DispatchRenderer
|
|
8932
|
+
},
|
|
8933
|
+
props: {
|
|
8934
|
+
...vue$1.rendererProps()
|
|
8935
|
+
},
|
|
8936
|
+
setup(props) {
|
|
8937
|
+
return vueVanilla.useVanillaArrayControl(vue$1.useJsonFormsArrayControl(props));
|
|
8938
|
+
},
|
|
8939
|
+
computed: {
|
|
8940
|
+
noData() {
|
|
8941
|
+
return !this.control.data || this.control.data.length === 0;
|
|
8942
|
+
},
|
|
8943
|
+
translations() {
|
|
8944
|
+
var _a;
|
|
8945
|
+
const jsonforms = vue.inject("jsonforms");
|
|
8946
|
+
return core.getArrayTranslations(
|
|
8947
|
+
((_a = jsonforms == null ? void 0 : jsonforms.i18n) == null ? void 0 : _a.translate) ?? core.defaultJsonFormsI18nState.translate,
|
|
8948
|
+
core.arrayDefaultTranslations,
|
|
8949
|
+
this.control.i18nKeyPrefix,
|
|
8950
|
+
this.control.label
|
|
8951
|
+
);
|
|
8952
|
+
},
|
|
8953
|
+
labelKey() {
|
|
8954
|
+
var _a, _b;
|
|
8955
|
+
const key = (_b = (_a = this.uischema) == null ? void 0 : _a.options) == null ? void 0 : _b.labelKey;
|
|
8956
|
+
if (!key) return null;
|
|
8957
|
+
return key;
|
|
8958
|
+
}
|
|
8959
|
+
},
|
|
8960
|
+
methods: {
|
|
8961
|
+
composePaths: core.composePaths,
|
|
8962
|
+
createDefaultValue: core.createDefaultValue
|
|
8963
|
+
}
|
|
8964
|
+
});
|
|
8965
|
+
const entry = {
|
|
8966
|
+
renderer: controlRenderer,
|
|
8967
|
+
tester: core.rankWith(2, isFixedArray)
|
|
8968
|
+
};
|
|
8969
|
+
const _hoisted_1$5 = { class: "fieldset" };
|
|
8970
|
+
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
8971
|
+
const _component_dispatch_renderer = vue.resolveComponent("dispatch-renderer");
|
|
8972
|
+
return _ctx.control.visible ? (vue.openBlock(), vue.createElementBlock("fieldset", {
|
|
8973
|
+
key: 0,
|
|
8974
|
+
class: vue.normalizeClass(_ctx.styles.arrayList.root)
|
|
8975
|
+
}, [
|
|
8976
|
+
!_ctx.labelKey ? (vue.openBlock(), vue.createElementBlock("legend", {
|
|
8977
|
+
key: 0,
|
|
8978
|
+
class: vue.normalizeClass(_ctx.styles.arrayList.legend)
|
|
8979
|
+
}, [
|
|
8980
|
+
vue.createElementVNode("label", {
|
|
8981
|
+
class: vue.normalizeClass(_ctx.styles.arrayList.label)
|
|
8982
|
+
}, vue.toDisplayString(_ctx.control.label), 3)
|
|
8983
|
+
], 2)) : vue.createCommentVNode("", true),
|
|
8984
|
+
vue.createElementVNode("div", {
|
|
8985
|
+
class: vue.normalizeClass(_ctx.styles.fixedArrayList.root)
|
|
8986
|
+
}, [
|
|
8987
|
+
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.control.data, (element, index) => {
|
|
8988
|
+
var _a;
|
|
8989
|
+
return vue.openBlock(), vue.createElementBlock("div", {
|
|
8990
|
+
key: `${_ctx.control.path}-${index}`,
|
|
8991
|
+
class: vue.normalizeClass(_ctx.styles.fixedArrayList.item)
|
|
8992
|
+
}, [
|
|
8993
|
+
vue.createElementVNode("fieldset", _hoisted_1$5, [
|
|
8994
|
+
_ctx.labelKey ? (vue.openBlock(), vue.createElementBlock("legend", {
|
|
8995
|
+
key: 0,
|
|
8996
|
+
class: vue.normalizeClass(_ctx.styles.arrayList.legend)
|
|
8997
|
+
}, vue.toDisplayString((_a = element[_ctx.labelKey]) == null ? void 0 : _a.toLowerCase()), 3)) : vue.createCommentVNode("", true),
|
|
8998
|
+
vue.createVNode(_component_dispatch_renderer, {
|
|
8999
|
+
schema: _ctx.control.schema,
|
|
9000
|
+
uischema: _ctx.childUiSchema,
|
|
9001
|
+
path: _ctx.composePaths(_ctx.control.path, `${index}`),
|
|
9002
|
+
enabled: _ctx.control.enabled,
|
|
9003
|
+
renderers: _ctx.control.renderers,
|
|
9004
|
+
cells: _ctx.control.cells
|
|
9005
|
+
}, null, 8, ["schema", "uischema", "path", "enabled", "renderers", "cells"])
|
|
9006
|
+
])
|
|
9007
|
+
], 2);
|
|
9008
|
+
}), 128))
|
|
9009
|
+
], 2),
|
|
9010
|
+
_ctx.noData ? (vue.openBlock(), vue.createElementBlock("div", {
|
|
9011
|
+
key: 1,
|
|
9012
|
+
class: vue.normalizeClass(_ctx.styles.arrayList.noData)
|
|
9013
|
+
}, vue.toDisplayString(_ctx.translations.noDataMessage), 3)) : vue.createCommentVNode("", true)
|
|
9014
|
+
], 2)) : vue.createCommentVNode("", true);
|
|
9015
|
+
}
|
|
9016
|
+
const FixedArrayRenderer = /* @__PURE__ */ _export_sfc(controlRenderer, [["render", _sfc_render]]);
|
|
9017
|
+
const arrayRenderers = [
|
|
9018
|
+
entry,
|
|
9019
|
+
entry$1
|
|
9020
|
+
];
|
|
9021
|
+
const layoutRenderers = [
|
|
9022
|
+
// LayoutRenderer
|
|
9023
|
+
];
|
|
8760
9024
|
const _hoisted_1$4 = { class: "" };
|
|
8761
9025
|
const _hoisted_2$1 = { class: "flex gap-2 items-center mb-2" };
|
|
8762
9026
|
const _hoisted_3$1 = { class: "flex gap-2" };
|
|
@@ -8893,7 +9157,6 @@ class TableStore {
|
|
|
8893
9157
|
);
|
|
8894
9158
|
}
|
|
8895
9159
|
get httpRequest() {
|
|
8896
|
-
console.log("get the request");
|
|
8897
9160
|
return authenticationVue.useHttpRequest();
|
|
8898
9161
|
}
|
|
8899
9162
|
updatePage(page) {
|
|
@@ -8965,11 +9228,6 @@ const _sfc_main$4 = /* @__PURE__ */ vue.defineComponent({
|
|
|
8965
9228
|
component = components[element.type];
|
|
8966
9229
|
}
|
|
8967
9230
|
if (!component) console.warn("No component found for type", element.type);
|
|
8968
|
-
console.log({
|
|
8969
|
-
...def,
|
|
8970
|
-
component,
|
|
8971
|
-
type
|
|
8972
|
-
});
|
|
8973
9231
|
return {
|
|
8974
9232
|
...def,
|
|
8975
9233
|
type,
|
|
@@ -9062,7 +9320,6 @@ const _sfc_main$3 = /* @__PURE__ */ vue.defineComponent({
|
|
|
9062
9320
|
const emit = __emit;
|
|
9063
9321
|
const hasEdit = ui.hasCustomEventListener("editData");
|
|
9064
9322
|
const edit = (data) => {
|
|
9065
|
-
console.log("edit me", data, hasEdit);
|
|
9066
9323
|
if (hasEdit) {
|
|
9067
9324
|
emit("editData", data);
|
|
9068
9325
|
return;
|
|
@@ -9070,7 +9327,6 @@ const _sfc_main$3 = /* @__PURE__ */ vue.defineComponent({
|
|
|
9070
9327
|
openModal(data);
|
|
9071
9328
|
};
|
|
9072
9329
|
const deleteFn = (data) => {
|
|
9073
|
-
console.log("delete me 1", data, hasEdit);
|
|
9074
9330
|
ui.ModalService.showConfirm({
|
|
9075
9331
|
title: "Delete annotation",
|
|
9076
9332
|
message: "Are you sure to delete, the data will be lost?",
|
|
@@ -9137,145 +9393,16 @@ const _sfc_main$3 = /* @__PURE__ */ vue.defineComponent({
|
|
|
9137
9393
|
};
|
|
9138
9394
|
}
|
|
9139
9395
|
});
|
|
9140
|
-
const actionMap = {
|
|
9141
|
-
edit: (router, action) => ({
|
|
9142
|
-
label: "edit",
|
|
9143
|
-
icon: ui.IconEnum.Edit,
|
|
9144
|
-
show: (element) => !!element[action.idField]
|
|
9145
|
-
})
|
|
9146
|
-
};
|
|
9147
|
-
const mapArrayActions = (router, actions) => {
|
|
9148
|
-
return actions.map((a) => actionMap[a.type](router, a)).filter((a) => !!a);
|
|
9149
|
-
};
|
|
9150
|
-
const controlRenderer$1 = vue.defineComponent({
|
|
9151
|
-
name: "ArrayListRenderer",
|
|
9152
|
-
components: {
|
|
9153
|
-
DispatchRenderer: vue$1.DispatchRenderer,
|
|
9154
|
-
Btn: ui.Btn
|
|
9155
|
-
},
|
|
9156
|
-
props: {
|
|
9157
|
-
...vue$1.rendererProps()
|
|
9158
|
-
},
|
|
9159
|
-
setup(props) {
|
|
9160
|
-
const vanillaArrayControl = vueVanilla.useVanillaArrayControl(
|
|
9161
|
-
vue$1.useJsonFormsArrayControl(props)
|
|
9162
|
-
);
|
|
9163
|
-
const control = vanillaArrayControl.control.value;
|
|
9164
|
-
if (!control.data || control.data.length < 1) {
|
|
9165
|
-
vanillaArrayControl.addItem(
|
|
9166
|
-
control.path,
|
|
9167
|
-
core.createDefaultValue(control.schema, control.rootSchema)
|
|
9168
|
-
)();
|
|
9169
|
-
}
|
|
9170
|
-
return vanillaArrayControl;
|
|
9171
|
-
},
|
|
9172
|
-
computed: {
|
|
9173
|
-
IconEnum() {
|
|
9174
|
-
return ui.IconEnum;
|
|
9175
|
-
},
|
|
9176
|
-
noData() {
|
|
9177
|
-
return !this.control.data || this.control.data.length === 0;
|
|
9178
|
-
},
|
|
9179
|
-
actions() {
|
|
9180
|
-
var _a;
|
|
9181
|
-
const actions = ((_a = this.uischema.options) == null ? void 0 : _a.actions) ?? [];
|
|
9182
|
-
return mapArrayActions(vueRouter.useRouter(), actions);
|
|
9183
|
-
},
|
|
9184
|
-
showDelete() {
|
|
9185
|
-
var _a;
|
|
9186
|
-
return ((_a = this.control.data) == null ? void 0 : _a.length) > 1;
|
|
9187
|
-
},
|
|
9188
|
-
translations() {
|
|
9189
|
-
var _a;
|
|
9190
|
-
const jsonforms = vue.inject("jsonforms");
|
|
9191
|
-
return core.getArrayTranslations(
|
|
9192
|
-
((_a = jsonforms == null ? void 0 : jsonforms.i18n) == null ? void 0 : _a.translate) ?? core.defaultJsonFormsI18nState.translate,
|
|
9193
|
-
core.arrayDefaultTranslations,
|
|
9194
|
-
this.control.i18nKeyPrefix,
|
|
9195
|
-
this.control.label
|
|
9196
|
-
);
|
|
9197
|
-
},
|
|
9198
|
-
labelKey() {
|
|
9199
|
-
var _a, _b;
|
|
9200
|
-
const key = (_b = (_a = this.uischema) == null ? void 0 : _a.options) == null ? void 0 : _b.labelKey;
|
|
9201
|
-
if (!key) return null;
|
|
9202
|
-
return key;
|
|
9203
|
-
}
|
|
9204
|
-
},
|
|
9205
|
-
methods: {
|
|
9206
|
-
composePaths: core.composePaths,
|
|
9207
|
-
createDefaultValue: core.createDefaultValue,
|
|
9208
|
-
deleteButtonClick(index) {
|
|
9209
|
-
this.removeItems(this.control.path, [index])();
|
|
9210
|
-
},
|
|
9211
|
-
dispatchEvent: (event, data) => {
|
|
9212
|
-
const form_id = "";
|
|
9213
|
-
useFormState().dispatchEvent(form_id, event, data);
|
|
9214
|
-
},
|
|
9215
|
-
addButtonClick() {
|
|
9216
|
-
this.addItem(
|
|
9217
|
-
this.control.path,
|
|
9218
|
-
core.createDefaultValue(this.control.schema, this.control.rootSchema)
|
|
9219
|
-
)();
|
|
9220
|
-
}
|
|
9221
|
-
}
|
|
9222
|
-
});
|
|
9223
|
-
const entry$1 = {
|
|
9224
|
-
renderer: controlRenderer$1,
|
|
9225
|
-
tester: core.rankWith(2, isArrayRenderer)
|
|
9226
|
-
};
|
|
9227
|
-
const controlRenderer = vue.defineComponent({
|
|
9228
|
-
name: "FixedArrayListRenderer",
|
|
9229
|
-
components: {
|
|
9230
|
-
DispatchRenderer: vue$1.DispatchRenderer
|
|
9231
|
-
},
|
|
9232
|
-
props: {
|
|
9233
|
-
...vue$1.rendererProps()
|
|
9234
|
-
},
|
|
9235
|
-
setup(props) {
|
|
9236
|
-
return vueVanilla.useVanillaArrayControl(vue$1.useJsonFormsArrayControl(props));
|
|
9237
|
-
},
|
|
9238
|
-
computed: {
|
|
9239
|
-
noData() {
|
|
9240
|
-
return !this.control.data || this.control.data.length === 0;
|
|
9241
|
-
},
|
|
9242
|
-
translations() {
|
|
9243
|
-
var _a;
|
|
9244
|
-
const jsonforms = vue.inject("jsonforms");
|
|
9245
|
-
return core.getArrayTranslations(
|
|
9246
|
-
((_a = jsonforms == null ? void 0 : jsonforms.i18n) == null ? void 0 : _a.translate) ?? core.defaultJsonFormsI18nState.translate,
|
|
9247
|
-
core.arrayDefaultTranslations,
|
|
9248
|
-
this.control.i18nKeyPrefix,
|
|
9249
|
-
this.control.label
|
|
9250
|
-
);
|
|
9251
|
-
},
|
|
9252
|
-
labelKey() {
|
|
9253
|
-
var _a, _b;
|
|
9254
|
-
const key = (_b = (_a = this.uischema) == null ? void 0 : _a.options) == null ? void 0 : _b.labelKey;
|
|
9255
|
-
if (!key) return null;
|
|
9256
|
-
return key;
|
|
9257
|
-
}
|
|
9258
|
-
},
|
|
9259
|
-
methods: {
|
|
9260
|
-
composePaths: core.composePaths,
|
|
9261
|
-
createDefaultValue: core.createDefaultValue
|
|
9262
|
-
}
|
|
9263
|
-
});
|
|
9264
|
-
const entry = {
|
|
9265
|
-
renderer: controlRenderer,
|
|
9266
|
-
tester: core.rankWith(2, isFixedArray)
|
|
9267
|
-
};
|
|
9268
|
-
const arrayRenderers = [entry, entry$1];
|
|
9269
|
-
const layoutRenderers = [];
|
|
9270
9396
|
const customRenderers = [
|
|
9271
9397
|
controlRenderers,
|
|
9272
9398
|
layoutRenderers,
|
|
9273
9399
|
// ...complexRenderers,
|
|
9274
|
-
|
|
9400
|
+
arrayRenderers
|
|
9275
9401
|
// ...labelRenderers,
|
|
9276
9402
|
].flat();
|
|
9277
|
-
const customRenderesName = customRenderers.map((c) =>
|
|
9278
|
-
|
|
9403
|
+
const customRenderesName = customRenderers.map((c) => {
|
|
9404
|
+
return c.renderer.name;
|
|
9405
|
+
});
|
|
9279
9406
|
const useVanillaRenderers = vueVanilla.vanillaRenderers.filter(
|
|
9280
9407
|
(v) => !customRenderesName.includes(v.renderer.name)
|
|
9281
9408
|
);
|
|
@@ -9585,8 +9712,10 @@ const createRepository = (formSchemaModel, httpRequest, options = {}) => {
|
|
|
9585
9712
|
};
|
|
9586
9713
|
return { create, patch, createMulti, delete: _delete, get };
|
|
9587
9714
|
};
|
|
9715
|
+
exports.ArrayRenderer = ArrayRenderer;
|
|
9588
9716
|
exports.AutocompleteControlRenderer = AutocompleteControlRenderer;
|
|
9589
9717
|
exports.BooleanControlRenderer = BooleanControlRenderer;
|
|
9718
|
+
exports.FixedArrayRenderer = FixedArrayRenderer;
|
|
9590
9719
|
exports.FormComponent = _sfc_main$2;
|
|
9591
9720
|
exports.FormModal = _sfc_main;
|
|
9592
9721
|
exports.FormModalService = FormModalService;
|
|
@@ -9597,6 +9726,7 @@ exports.IntegerControlRenderer = IntegerControlRenderer;
|
|
|
9597
9726
|
exports.NumberControlRenderer = NumberControlRenderer;
|
|
9598
9727
|
exports.StringControlRenderer = StringControlRenderer;
|
|
9599
9728
|
exports.TableComponent = _sfc_main$4;
|
|
9729
|
+
exports.arrayRenderers = arrayRenderers;
|
|
9600
9730
|
exports.controlRenderers = controlRenderers;
|
|
9601
9731
|
exports.createRepository = createRepository;
|
|
9602
9732
|
exports.isArrayRenderer = isArrayRenderer;
|
|
@@ -9606,5 +9736,6 @@ exports.isFixedArray = isFixedArray;
|
|
|
9606
9736
|
exports.isMarkdownControl = isMarkdownControl;
|
|
9607
9737
|
exports.isStringFormat = isStringFormat;
|
|
9608
9738
|
exports.isTextAreaControl = isTextAreaControl;
|
|
9739
|
+
exports.layoutRenderers = layoutRenderers;
|
|
9609
9740
|
exports.markdownControlRenderer = MarkdownControlRenderer;
|
|
9610
9741
|
exports.useFormState = useFormState;
|