@ghentcdh/json-forms-vue 0.8.6 → 1.0.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/form.store.d.ts +1 -1
- package/forms/Dispatch.vue.d.ts +10 -0
- package/forms/FormComponent.properties.d.ts +48 -0
- package/{form.component.vue.d.ts → forms/FormComponent.vue.d.ts} +19 -17
- package/forms/FormWithActions.properties.d.ts +52 -0
- package/forms/FormWithActions.vue.d.ts +258 -0
- package/forms/FormWithTable.properties.d.ts +65 -0
- package/{form-with-table.component.vue.d.ts → forms/FormWithTable.vue.d.ts} +24 -15
- package/forms/errorMessages.d.ts +10 -0
- package/forms/errorMode.d.ts +4 -0
- package/forms/modal/FormModal.properties.d.ts +64 -0
- package/forms/modal/FormModal.vue.d.ts +275 -0
- package/{modal/form-modal.service.d.ts → forms/modal/FormModalService.d.ts} +4 -5
- package/forms/renderer-registry.d.ts +7 -0
- package/forms/renderers/array/ArrayRenderer.vue.d.ts +7 -0
- package/forms/renderers/array/ArrayRenderers.d.ts +10 -0
- package/forms/renderers/controls/AutocompleteControlRenderer.vue.d.ts +7 -0
- package/forms/renderers/controls/BooleanControlRenderer.vue.d.ts +7 -0
- package/forms/renderers/controls/MarkdownControlRenderer.vue.d.ts +7 -0
- package/forms/renderers/controls/MultiSelectControlRenderer.vue.d.ts +7 -0
- package/forms/renderers/controls/NumberControlRenderer.vue.d.ts +7 -0
- package/forms/renderers/controls/SelectControlRenderer.vue.d.ts +7 -0
- package/forms/renderers/controls/StringControlRenderer.vue.d.ts +7 -0
- package/forms/renderers/controls/TextAreaControlRenderer.vue.d.ts +7 -0
- package/forms/renderers/controls/composable/UseControlBinding.d.ts +29 -0
- package/forms/renderers/controls/composable/UseFetchOption.d.ts +16 -0
- package/forms/renderers/controls/composable/UseInput.d.ts +24 -0
- package/forms/renderers/controls/composable/UseSelectBinding.d.ts +23 -0
- package/forms/renderers/controls/composable/resource.d.ts +187 -0
- package/forms/renderers/controls/index.d.ts +10 -0
- package/forms/renderers/index.d.ts +3 -0
- package/forms/renderers/layout/CollapseLayoutRenderer.vue.d.ts +7 -0
- package/forms/renderers/layout/LayoutRenderer.vue.d.ts +7 -0
- package/forms/renderers/layout/LayoutRenders.d.ts +10 -0
- package/forms/renderers/layout/colspan.d.ts +1 -0
- package/forms/renderes.d.ts +19 -0
- package/forms/scope.d.ts +4 -0
- package/forms/types.d.ts +36 -0
- package/index.d.ts +9 -12
- package/index.js +1826 -1503
- package/index.mjs +1877 -1554
- package/package.json +4 -5
- package/renderes/tester.d.ts +2 -0
- package/form-with-actions.component.properties.d.ts +0 -40
- package/form-with-actions.component.vue.d.ts +0 -88
- package/form-with-table.component.properties.d.ts +0 -58
- package/form.component.properties.d.ts +0 -49
- package/modal/form-modal.props.d.ts +0 -30
- package/modal/form-modal.vue.d.ts +0 -35
- package/modal/index.d.ts +0 -3
- package/renderes/array/ArrayRenderer.vue.d.ts +0 -74
- package/renderes/array/index.d.ts +0 -76
- package/renderes/controls/AutocompleteControlRenderer.vue.d.ts +0 -74
- package/renderes/controls/BooleanControlRenderer.vue.d.ts +0 -74
- package/renderes/controls/IntegerControlRenderer.vue.d.ts +0 -74
- package/renderes/controls/MarkdownControlRenderer.vue.d.ts +0 -74
- package/renderes/controls/MultiSelectControlRender.vue.d.ts +0 -74
- package/renderes/controls/NumberControlRenderer.vue.d.ts +0 -74
- package/renderes/controls/SelectControlRender.vue.d.ts +0 -74
- package/renderes/controls/StringControlRenderer.vue.d.ts +0 -74
- package/renderes/controls/TextAreaControlRenderer.vue.d.ts +0 -74
- package/renderes/controls/index.d.ts +0 -675
- package/renderes/index.d.ts +0 -817
- package/renderes/layouts/CollapseLayout.vue.d.ts +0 -73
- package/renderes/layouts/GridLayout.vue.d.ts +0 -73
- package/renderes/layouts/HorizontalLayout.vue.d.ts +0 -73
- package/renderes/layouts/VerticalLayout.vue.d.ts +0 -73
- package/renderes/layouts/index.d.ts +0 -75
- package/standalone/emits.d.ts +0 -5
- package/standalone/properties.d.ts +0 -2
- package/utils/style.d.ts +0 -6
- package/utils/vanillaControl.d.ts +0 -15
package/index.js
CHANGED
|
@@ -1,1130 +1,398 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const toolsVue = require("@ghentcdh/tools-vue");
|
|
4
|
-
const ui = require("@ghentcdh/ui");
|
|
5
|
-
const core = require("@jsonforms/core");
|
|
6
3
|
const vue = require("vue");
|
|
7
|
-
const vue$1 = require("@jsonforms/vue");
|
|
8
|
-
const axios = require("axios");
|
|
9
|
-
const vueVanilla = require("@jsonforms/vue-vanilla");
|
|
10
4
|
const lodashEs = require("lodash-es");
|
|
11
|
-
const testers = require("@jsonforms/core/src/testers/testers");
|
|
12
5
|
const jsonFormsCore = require("@ghentcdh/json-forms-core");
|
|
13
|
-
const
|
|
6
|
+
const ui = require("@ghentcdh/ui");
|
|
7
|
+
const core = require("@vueuse/core");
|
|
14
8
|
const vueRouter = require("vue-router");
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
}
|
|
27
|
-
async save(id, data) {
|
|
28
|
-
if (!this.uri) return;
|
|
29
|
-
const promise2 = id ? toolsVue.useApi().patch(`${this.uri}/${id}`, data) : toolsVue.useApi().post(this.uri, data);
|
|
30
|
-
return promise2.then(() => {
|
|
31
|
-
ui.NotificationService.success("Data saved");
|
|
32
|
-
}).catch((error2) => {
|
|
33
|
-
console.error(error2);
|
|
34
|
-
ui.NotificationService.error("Error saving data");
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
const FormComponentProperties = {
|
|
39
|
-
/** Unique id applied to the `<form>` element and used as `<json-forms>` key. */
|
|
40
|
-
id: { type: String, required: true },
|
|
41
|
-
name: { type: String, default: "form" },
|
|
9
|
+
const toolsVue = require("@ghentcdh/tools-vue");
|
|
10
|
+
const veeValidate = require("vee-validate");
|
|
11
|
+
const core$1 = require("@jsonforms/core");
|
|
12
|
+
const testers = require("@jsonforms/core/src/testers/testers");
|
|
13
|
+
const axios = require("axios");
|
|
14
|
+
const FormModalProperties = {
|
|
15
|
+
/** Title displayed in the modal header. */
|
|
16
|
+
modalTitle: { type: String, required: true },
|
|
17
|
+
/** Label for the save button. */
|
|
18
|
+
saveLabel: { type: String, default: "save" },
|
|
19
|
+
/** Label for the cancel button. */
|
|
20
|
+
cancelLabel: { type: String, default: "cancel" },
|
|
42
21
|
/** JSON schema describing the shape of the form data. */
|
|
43
22
|
schema: { type: Object, required: true },
|
|
44
23
|
/** UI schema describing the layout and controls. */
|
|
45
24
|
uiSchema: { type: Object, required: true },
|
|
46
|
-
/**
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
25
|
+
/** Modal width (`'xs'`, `'sm'`, `'md'`, `'lg'`, `'xl'`). */
|
|
26
|
+
modalSize: { type: String, default: "md" },
|
|
27
|
+
/** Callback invoked when the modal closes (with result or `null` on cancel). */
|
|
28
|
+
onClose: {
|
|
29
|
+
type: Function,
|
|
30
|
+
required: true
|
|
50
31
|
},
|
|
51
|
-
/**
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
/** Emitted with the raw Ajv validation errors array. */
|
|
63
|
-
"errors",
|
|
64
|
-
/** Generic event channel for custom renderer dispatches (`FormEventPayload`). */
|
|
65
|
-
"events"
|
|
66
|
-
];
|
|
67
|
-
const FormWithActionsProperties = {
|
|
68
|
-
/** Unique identifier; the inner form receives `form_${id}` as its id. */
|
|
69
|
-
id: { type: String, required: true },
|
|
70
|
-
/** Title shown when creating a new record (`formData.id` is falsy). */
|
|
71
|
-
createTitle: { type: String, required: true },
|
|
72
|
-
/** Title shown when editing an existing record. Falls back to `createTitle`. */
|
|
73
|
-
updateTitle: { type: String },
|
|
74
|
-
/** JSON schema describing the shape of the form data. */
|
|
75
|
-
schema: { type: Object },
|
|
76
|
-
/** UI schema describing the layout and controls. */
|
|
77
|
-
uiSchema: { type: Object },
|
|
78
|
-
/** When provided, the component submits the form to this URI via `FormStore`. */
|
|
79
|
-
uri: { type: String },
|
|
80
|
-
/** When true, the form content scrolls and the action bar stays pinned. */
|
|
81
|
-
scrollable: { type: Boolean, default: false },
|
|
82
|
-
/** When true, the component takes the full height of its parent. */
|
|
83
|
-
fullHeight: { type: Boolean, default: false }
|
|
32
|
+
/** Callback for form events dispatched by custom renderers. */
|
|
33
|
+
onEvents: {
|
|
34
|
+
type: Function
|
|
35
|
+
},
|
|
36
|
+
/** Initial form data to populate the form with. */
|
|
37
|
+
data: { type: Object, required: true },
|
|
38
|
+
/** When validation errors are shown. */
|
|
39
|
+
errorMode: {
|
|
40
|
+
type: String,
|
|
41
|
+
default: "onBlur"
|
|
42
|
+
}
|
|
84
43
|
};
|
|
85
|
-
const
|
|
86
|
-
/**
|
|
87
|
-
"
|
|
88
|
-
/** Emitted
|
|
89
|
-
"success",
|
|
90
|
-
/** Emitted with form data when saving without a `uri`. */
|
|
91
|
-
"submit",
|
|
92
|
-
/** Emitted whenever the form validity changes. */
|
|
93
|
-
"valid",
|
|
94
|
-
/** Forwards custom renderer events (`FormEventPayload`). */
|
|
44
|
+
const FormModalEmits = [
|
|
45
|
+
/** Emitted when the modal is closed (submit or cancel). */
|
|
46
|
+
"closeModal",
|
|
47
|
+
/** Emitted when a custom renderer dispatches a form event. */
|
|
95
48
|
"events",
|
|
49
|
+
/** Emitted when validation errors change. */
|
|
96
50
|
"errors",
|
|
97
|
-
/** Emitted when
|
|
98
|
-
"
|
|
99
|
-
];
|
|
100
|
-
const FormWithTableProperties = {
|
|
101
|
-
/** Unique identifier used to generate the table form id (`form_table_${id}`). */
|
|
102
|
-
id: { type: String, required: true },
|
|
103
|
-
/** Heading displayed above the table. */
|
|
104
|
-
tableTitle: { type: String, required: true },
|
|
105
|
-
/** Title shown in the create modal. */
|
|
106
|
-
createTitle: { type: String, required: true },
|
|
107
|
-
/** Title shown in the edit modal. Falls back to `createTitle`. */
|
|
108
|
-
updateTitle: { type: String },
|
|
109
|
-
/** Overrides `uri` as the data source for the table. */
|
|
110
|
-
dataUri: { type: String },
|
|
111
|
-
/** Custom action buttons rendered in each table row. */
|
|
112
|
-
tableActions: { type: Array },
|
|
113
|
-
/** Layout for the create/edit modal form. */
|
|
114
|
-
form: { type: Object },
|
|
115
|
-
/** Layout for the table columns. */
|
|
116
|
-
table: { type: Object },
|
|
117
|
-
/** Layout for the table filter controls. */
|
|
118
|
-
filter: { type: Object },
|
|
119
|
-
/** Base URI used by `FormStore` for CRUD operations and as the default table data source. */
|
|
120
|
-
uri: { type: String },
|
|
121
|
-
/** Default data used when opening the create modal. */
|
|
122
|
-
initialData: { type: Object, default: () => ({}) }
|
|
123
|
-
};
|
|
124
|
-
const FormWithTableEmits = [
|
|
125
|
-
/** Emitted when a table row is edited and a custom listener is bound. */
|
|
126
|
-
"editData",
|
|
127
|
-
/** Emitted after a record is successfully saved (created or updated). Payload: `{ id?: string, data: Data }`. */
|
|
128
|
-
"save",
|
|
129
|
-
/** Emitted after a record is successfully deleted. Payload: the deleted record. */
|
|
130
|
-
"delete",
|
|
131
|
-
/** Forwarded form events dispatched by custom renderers inside the modal (e.g. "create"). Payload: `FormEventPayload`. */
|
|
132
|
-
"events",
|
|
133
|
-
"custom:edit",
|
|
134
|
-
"custom:create"
|
|
51
|
+
/** Emitted when form validity changes. */
|
|
52
|
+
"valid"
|
|
135
53
|
];
|
|
136
|
-
const
|
|
137
|
-
|
|
138
|
-
}
|
|
139
|
-
const
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
};
|
|
163
|
-
const controlWrapper = vue.computed(() => {
|
|
164
|
-
return {
|
|
165
|
-
...vanillaControl.controlWrapper.value,
|
|
166
|
-
...lodashEs.omit(vanillaControl.appliedOptions.value, "styles"),
|
|
167
|
-
...lodashEs.pick(vanillaControl.appliedOptions.value.styles, ["width"]),
|
|
168
|
-
isFocused: isFocused.value,
|
|
169
|
-
isTouched: isTouched.value
|
|
170
|
-
};
|
|
171
|
-
});
|
|
172
|
-
return {
|
|
173
|
-
...vanillaControl,
|
|
174
|
-
appliedOptions: vanillaControl.appliedOptions,
|
|
175
|
-
controlWrapper,
|
|
176
|
-
isFocused,
|
|
177
|
-
isTouched,
|
|
178
|
-
onFocus,
|
|
179
|
-
onBlur
|
|
180
|
-
// handleChange,
|
|
181
|
-
};
|
|
182
|
-
};
|
|
183
|
-
const _sfc_main$j = /* @__PURE__ */ vue.defineComponent({
|
|
184
|
-
__name: "AutocompleteControlRenderer",
|
|
185
|
-
props: { ...vue$1.rendererProps() },
|
|
186
|
-
setup(__props) {
|
|
187
|
-
const props = __props;
|
|
188
|
-
const {
|
|
189
|
-
control,
|
|
190
|
-
handleChange: _handleChange,
|
|
191
|
-
appliedOptions,
|
|
192
|
-
onFocus,
|
|
193
|
-
onBlur,
|
|
194
|
-
controlWrapper
|
|
195
|
-
} = useVanillaControlCustom(vue$1.useJsonFormsControl(props));
|
|
196
|
-
const bindProperties = vue.computed(() => ({
|
|
197
|
-
...controlWrapper.value,
|
|
198
|
-
...appliedOptions.value,
|
|
199
|
-
enableCreate: !!appliedOptions.value.enableCreate
|
|
200
|
-
}));
|
|
201
|
-
const fetchOptions = vue.computed(() => {
|
|
202
|
-
const options = appliedOptions.value;
|
|
203
|
-
if (!options.uri) return null;
|
|
204
|
-
return (searchTerm, signal) => {
|
|
205
|
-
const fetch = options.skipAuth ? axios : toolsVue.useApi();
|
|
206
|
-
return fetch.get(`${options.uri}${searchTerm}`, { signal }).then((data) => data.data[options.dataField ?? "data"]);
|
|
207
|
-
};
|
|
208
|
-
});
|
|
209
|
-
const handleChange = (result) => {
|
|
210
|
-
const { path } = control.value;
|
|
211
|
-
_handleChange(path, result);
|
|
54
|
+
const _hoisted_1$8 = { class: "" };
|
|
55
|
+
const _hoisted_2$2 = { class: "flex gap-2 items-center mb-2" };
|
|
56
|
+
const _hoisted_3$1 = { class: "flex gap-2" };
|
|
57
|
+
const _sfc_main$h = /* @__PURE__ */ vue.defineComponent({
|
|
58
|
+
__name: "table-filter",
|
|
59
|
+
props: {
|
|
60
|
+
layout: {},
|
|
61
|
+
filters: {}
|
|
62
|
+
},
|
|
63
|
+
emits: ["changeFilters", "removeFilter"],
|
|
64
|
+
setup(__props, { emit: __emit }) {
|
|
65
|
+
const formData = vue.ref();
|
|
66
|
+
const properties = __props;
|
|
67
|
+
const emits = __emit;
|
|
68
|
+
vue.watch(
|
|
69
|
+
() => properties.filters,
|
|
70
|
+
() => {
|
|
71
|
+
formData.value = {};
|
|
72
|
+
properties.filters.forEach((filter) => {
|
|
73
|
+
formData.value[filter.key] = filter.value;
|
|
74
|
+
});
|
|
75
|
+
},
|
|
76
|
+
{ immediate: true }
|
|
77
|
+
);
|
|
78
|
+
const onResetFilters = () => {
|
|
79
|
+
emits("changeFilters", {});
|
|
212
80
|
};
|
|
213
|
-
const
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
event: "create",
|
|
217
|
-
type: control.value.path,
|
|
218
|
-
data: control.value.data,
|
|
219
|
-
onSuccess: (result) => {
|
|
220
|
-
handleChange(result);
|
|
221
|
-
}
|
|
222
|
-
});
|
|
81
|
+
const removeFilter = (filter) => {
|
|
82
|
+
formData.value[filter.key] = void 0;
|
|
83
|
+
emits("changeFilters", formData.value);
|
|
223
84
|
};
|
|
224
85
|
return (_ctx, _cache) => {
|
|
225
|
-
return vue.openBlock(), vue.
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
86
|
+
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$8, [
|
|
87
|
+
vue.createElementVNode("div", _hoisted_2$2, [
|
|
88
|
+
__props.filters.length ? (vue.openBlock(), vue.createBlock(vue.unref(ui.Btn), {
|
|
89
|
+
key: 0,
|
|
90
|
+
size: "xs",
|
|
91
|
+
outline: true,
|
|
92
|
+
onClick: onResetFilters
|
|
93
|
+
}, {
|
|
94
|
+
default: vue.withCtx(() => [..._cache[0] || (_cache[0] = [
|
|
95
|
+
vue.createTextVNode(" Reset all filters ", -1)
|
|
96
|
+
])]),
|
|
97
|
+
_: 1
|
|
98
|
+
})) : vue.createCommentVNode("", true)
|
|
99
|
+
]),
|
|
100
|
+
vue.createElementVNode("div", _hoisted_3$1, [
|
|
101
|
+
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(__props.filters, (filter) => {
|
|
102
|
+
return vue.openBlock(), vue.createBlock(vue.unref(ui.BtnBadge), {
|
|
103
|
+
key: filter.key,
|
|
104
|
+
icon: vue.unref(ui.IconEnum).Close,
|
|
105
|
+
onClick: ($event) => removeFilter(filter)
|
|
106
|
+
}, {
|
|
107
|
+
default: vue.withCtx(() => [
|
|
108
|
+
vue.createTextVNode(vue.toDisplayString(filter.label) + ": " + vue.toDisplayString(filter.value), 1)
|
|
109
|
+
]),
|
|
110
|
+
_: 2
|
|
111
|
+
}, 1032, ["icon", "onClick"]);
|
|
112
|
+
}), 128))
|
|
113
|
+
])
|
|
114
|
+
]);
|
|
234
115
|
};
|
|
235
116
|
}
|
|
236
117
|
});
|
|
237
|
-
const
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
118
|
+
const TableComponentProperties = {
|
|
119
|
+
id: { type: String, required: true },
|
|
120
|
+
uiSchema: { type: Object, required: true },
|
|
121
|
+
schema: { type: Object, required: true },
|
|
122
|
+
filterUiSchema: { type: Object },
|
|
123
|
+
filterSchema: { type: Object },
|
|
124
|
+
uri: { type: String, required: true },
|
|
125
|
+
reload: { type: Number },
|
|
126
|
+
actions: { type: Array }
|
|
127
|
+
};
|
|
128
|
+
const TableComponentEmits = ["delete", "edit"];
|
|
129
|
+
class TableStore {
|
|
130
|
+
constructor() {
|
|
131
|
+
this.route = vueRouter.useRoute();
|
|
132
|
+
this.router = vueRouter.useRouter();
|
|
133
|
+
this.requestData = vue.ref(jsonFormsCore.RequestSchema.parse(this.route.query));
|
|
134
|
+
this._reload = vue.ref(Date.now());
|
|
135
|
+
this.loading = vue.ref(true);
|
|
136
|
+
this.uri = vue.ref("");
|
|
137
|
+
this.data = core.computedAsync(async () => {
|
|
138
|
+
this._reload.value;
|
|
139
|
+
if (!this.uri.value) return null;
|
|
140
|
+
this.loading.value = true;
|
|
141
|
+
if (this.requestData.value.page < 1) {
|
|
142
|
+
this.requestData.value.page = 1;
|
|
143
|
+
}
|
|
144
|
+
const response = await toolsVue.useApi().get(this.uri.value, {
|
|
145
|
+
params: this.requestData.value
|
|
146
|
+
}).catch((error2) => {
|
|
147
|
+
console.error(error2);
|
|
148
|
+
return { data: [], request: { totalPages: 1, page: 1 } };
|
|
149
|
+
}).finally(() => this.loading.value = false);
|
|
150
|
+
const data = response.data;
|
|
151
|
+
if (data.request.totalPages < data.request.page) {
|
|
152
|
+
this.updateRequest({ page: data.request.totalPages });
|
|
252
153
|
}
|
|
253
|
-
return
|
|
154
|
+
return data;
|
|
155
|
+
});
|
|
156
|
+
this.pageData = vue.computed(() => {
|
|
157
|
+
const request = this.data.value?.request ?? {
|
|
158
|
+
count: 0,
|
|
159
|
+
pageSize: 1,
|
|
160
|
+
page: 1
|
|
161
|
+
};
|
|
162
|
+
return {
|
|
163
|
+
count: request.count,
|
|
164
|
+
pageSize: request.pageSize,
|
|
165
|
+
page: request.page
|
|
166
|
+
};
|
|
167
|
+
});
|
|
168
|
+
this.tableData = vue.computed(() => {
|
|
169
|
+
const d = this.data.value;
|
|
170
|
+
if (!d) return [];
|
|
171
|
+
if (this.loading.value) return [];
|
|
172
|
+
return d.data ?? [];
|
|
254
173
|
});
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
_handleChange(path, result);
|
|
174
|
+
this.init = (url2) => {
|
|
175
|
+
this.uri.value = url2;
|
|
258
176
|
};
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
}), null, 16, ["model-value", "enabled", "config", "onFocus", "onBlur"]);
|
|
177
|
+
this.updateRequest = (data) => {
|
|
178
|
+
this.requestData.value = { ...this.requestData.value, ...data };
|
|
179
|
+
this.router.replace({
|
|
180
|
+
query: {
|
|
181
|
+
...this.route.query,
|
|
182
|
+
...this.requestData.value
|
|
183
|
+
}
|
|
184
|
+
});
|
|
268
185
|
};
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
__name: "IntegerControlRenderer",
|
|
273
|
-
props: { ...vue$1.rendererProps() },
|
|
274
|
-
setup(__props) {
|
|
275
|
-
const props = __props;
|
|
276
|
-
const { control, onChange, appliedOptions, onFocus, onBlur, controlWrapper } = useVanillaControlCustom(
|
|
277
|
-
vue$1.useJsonFormsControl(props),
|
|
278
|
-
(target) => target.value === "" ? void 0 : Number(target.value)
|
|
279
|
-
);
|
|
280
|
-
const steps = vue.computed(() => appliedOptions.value.steps ?? 1);
|
|
281
|
-
return (_ctx, _cache) => {
|
|
282
|
-
return vue.openBlock(), vue.createBlock(vue.unref(ui.InputNumber), vue.mergeProps(vue.unref(controlWrapper), {
|
|
283
|
-
"model-value": vue.unref(control).data,
|
|
284
|
-
enabled: vue.unref(control).enabled,
|
|
285
|
-
config: vue.unref(appliedOptions),
|
|
286
|
-
steps: steps.value,
|
|
287
|
-
onChange: vue.unref(onChange),
|
|
288
|
-
onFocus: vue.unref(onFocus),
|
|
289
|
-
onBlur: vue.unref(onBlur)
|
|
290
|
-
}), null, 16, ["model-value", "enabled", "config", "steps", "onChange", "onFocus", "onBlur"]);
|
|
186
|
+
this.sort = (id) => {
|
|
187
|
+
const sortDir = this.requestData.value.sort === id && this.requestData.value.sortDir === "asc" ? "desc" : "asc";
|
|
188
|
+
this.updateRequest({ sort: id, sortDir });
|
|
291
189
|
};
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
control,
|
|
301
|
-
handleChange,
|
|
302
|
-
appliedOptions,
|
|
303
|
-
onFocus,
|
|
304
|
-
onBlur,
|
|
305
|
-
controlWrapper
|
|
306
|
-
} = useVanillaControlCustom(vue$1.useJsonFormsControl(props));
|
|
307
|
-
const changeValue = (value) => {
|
|
308
|
-
handleChange(control.value.path, value);
|
|
309
|
-
};
|
|
310
|
-
return (_ctx, _cache) => {
|
|
311
|
-
return vue.openBlock(), vue.createBlock(vue.unref(ui.Markdown), vue.mergeProps(vue.unref(controlWrapper), {
|
|
312
|
-
"model-value": vue.unref(control).data,
|
|
313
|
-
enabled: vue.unref(control).enabled,
|
|
314
|
-
config: vue.unref(appliedOptions),
|
|
315
|
-
onChange: changeValue,
|
|
316
|
-
onFocus: vue.unref(onFocus),
|
|
317
|
-
onBlur: vue.unref(onBlur)
|
|
318
|
-
}), null, 16, ["model-value", "enabled", "config", "onFocus", "onBlur"]);
|
|
319
|
-
};
|
|
320
|
-
}
|
|
321
|
-
});
|
|
322
|
-
const _sfc_main$f = /* @__PURE__ */ vue.defineComponent({
|
|
323
|
-
__name: "MultiSelectControlRender",
|
|
324
|
-
props: { ...vue$1.rendererProps() },
|
|
325
|
-
setup(__props) {
|
|
326
|
-
const props = __props;
|
|
327
|
-
const {
|
|
328
|
-
control,
|
|
329
|
-
handleChange: _handleChange,
|
|
330
|
-
onFocus,
|
|
331
|
-
onBlur,
|
|
332
|
-
controlWrapper
|
|
333
|
-
} = useVanillaControlCustom(vue$1.useJsonFormsControl(props));
|
|
334
|
-
const handleChange = (result) => {
|
|
335
|
-
const { path } = control.value;
|
|
336
|
-
_handleChange(path, result);
|
|
337
|
-
};
|
|
338
|
-
return (_ctx, _cache) => {
|
|
339
|
-
return vue.openBlock(), vue.createBlock(vue.unref(ui.MultiSelect), vue.mergeProps(vue.unref(controlWrapper), {
|
|
340
|
-
"model-value": vue.unref(control).data,
|
|
341
|
-
enabled: vue.unref(control).enabled,
|
|
342
|
-
onChange: handleChange,
|
|
343
|
-
onFocus: vue.unref(onFocus),
|
|
344
|
-
onBlur: vue.unref(onBlur)
|
|
345
|
-
}), null, 16, ["model-value", "enabled", "onFocus", "onBlur"]);
|
|
190
|
+
this.updateFilters = (filters) => {
|
|
191
|
+
const filter = [];
|
|
192
|
+
Object.entries(filters).forEach(([key, value]) => {
|
|
193
|
+
if (!value) return;
|
|
194
|
+
const operator = value?.operator || "contains";
|
|
195
|
+
filter.push(`${key}:${value}:${operator}`);
|
|
196
|
+
});
|
|
197
|
+
this.updateRequest({ filter });
|
|
346
198
|
};
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
(target) => target.value === "" ? void 0 : Number(target.value)
|
|
199
|
+
this.sorting = vue.computed(() => {
|
|
200
|
+
const requestData = this.requestData.value;
|
|
201
|
+
return {
|
|
202
|
+
sortColumn: requestData.sort,
|
|
203
|
+
sortDirection: requestData.sortDir ?? "asc"
|
|
204
|
+
};
|
|
205
|
+
});
|
|
206
|
+
this.filters = vue.computed(
|
|
207
|
+
() => jsonFormsCore.extractFilters(this.requestData.value.filter)
|
|
357
208
|
);
|
|
358
|
-
const steps = vue.computed(() => appliedOptions.value.steps ?? 0.01);
|
|
359
|
-
return (_ctx, _cache) => {
|
|
360
|
-
return vue.openBlock(), vue.createBlock(vue.unref(ui.InputNumber), vue.mergeProps(vue.unref(controlWrapper), {
|
|
361
|
-
"model-value": vue.unref(control).data,
|
|
362
|
-
enabled: vue.unref(control).enabled,
|
|
363
|
-
config: vue.unref(appliedOptions),
|
|
364
|
-
steps: steps.value,
|
|
365
|
-
onChange: vue.unref(onChange),
|
|
366
|
-
onFocus: vue.unref(onFocus),
|
|
367
|
-
onBlur: vue.unref(onBlur)
|
|
368
|
-
}), null, 16, ["model-value", "enabled", "config", "steps", "onChange", "onFocus", "onBlur"]);
|
|
369
|
-
};
|
|
370
209
|
}
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
__name: "SelectControlRender",
|
|
374
|
-
props: { ...vue$1.rendererProps() },
|
|
375
|
-
setup(__props) {
|
|
376
|
-
const props = __props;
|
|
377
|
-
const {
|
|
378
|
-
control,
|
|
379
|
-
handleChange: _handleChange,
|
|
380
|
-
appliedOptions,
|
|
381
|
-
onFocus,
|
|
382
|
-
onBlur,
|
|
383
|
-
controlWrapper
|
|
384
|
-
} = useVanillaControlCustom(vue$1.useJsonFormsControl(props));
|
|
385
|
-
const handleChange = (result) => {
|
|
386
|
-
const { path } = control.value;
|
|
387
|
-
_handleChange(path, result);
|
|
388
|
-
};
|
|
389
|
-
return (_ctx, _cache) => {
|
|
390
|
-
return vue.openBlock(), vue.createBlock(vue.unref(ui.SelectComponent), vue.mergeProps(vue.unref(controlWrapper), {
|
|
391
|
-
"model-value": vue.unref(control).data,
|
|
392
|
-
enabled: vue.unref(control).enabled,
|
|
393
|
-
options: vue.unref(appliedOptions)?.options,
|
|
394
|
-
onChange: handleChange,
|
|
395
|
-
onFocus: vue.unref(onFocus),
|
|
396
|
-
onBlur: vue.unref(onBlur)
|
|
397
|
-
}), null, 16, ["model-value", "enabled", "options", "onFocus", "onBlur"]);
|
|
398
|
-
};
|
|
210
|
+
get httpRequest() {
|
|
211
|
+
return toolsVue.useApi();
|
|
399
212
|
}
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
__name: "StringControlRenderer",
|
|
403
|
-
props: { ...vue$1.rendererProps() },
|
|
404
|
-
setup(__props) {
|
|
405
|
-
const props = __props;
|
|
406
|
-
const {
|
|
407
|
-
control,
|
|
408
|
-
onChange,
|
|
409
|
-
appliedOptions,
|
|
410
|
-
onFocus,
|
|
411
|
-
onBlur,
|
|
412
|
-
controlWrapper,
|
|
413
|
-
styles
|
|
414
|
-
} = useVanillaControlCustom(vue$1.useJsonFormsControl(props));
|
|
415
|
-
return (_ctx, _cache) => {
|
|
416
|
-
return vue.openBlock(), vue.createBlock(vue.unref(ui.Input), vue.mergeProps(vue.unref(controlWrapper), {
|
|
417
|
-
"model-value": vue.unref(control).data,
|
|
418
|
-
enabled: vue.unref(control).enabled,
|
|
419
|
-
config: vue.unref(appliedOptions),
|
|
420
|
-
styles: vue.unref(styles),
|
|
421
|
-
onChange: vue.unref(onChange),
|
|
422
|
-
onFocus: vue.unref(onFocus),
|
|
423
|
-
onBlur: vue.unref(onBlur)
|
|
424
|
-
}), null, 16, ["model-value", "enabled", "config", "styles", "onChange", "onFocus", "onBlur"]);
|
|
425
|
-
};
|
|
213
|
+
reload() {
|
|
214
|
+
this._reload.value = Date.now();
|
|
426
215
|
}
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
__name: "TextAreaControlRenderer",
|
|
430
|
-
props: { ...vue$1.rendererProps() },
|
|
431
|
-
setup(__props) {
|
|
432
|
-
const props = __props;
|
|
433
|
-
const { control, onChange, appliedOptions, onFocus, onBlur, controlWrapper } = useVanillaControlCustom(vue$1.useJsonFormsControl(props));
|
|
434
|
-
return (_ctx, _cache) => {
|
|
435
|
-
return vue.openBlock(), vue.createBlock(vue.unref(ui.Textarea), vue.mergeProps(vue.unref(controlWrapper), {
|
|
436
|
-
"model-value": vue.unref(control).data,
|
|
437
|
-
enabled: vue.unref(control).enabled,
|
|
438
|
-
config: vue.unref(appliedOptions),
|
|
439
|
-
onChange: vue.unref(onChange),
|
|
440
|
-
onFocus: vue.unref(onFocus),
|
|
441
|
-
onBlur: vue.unref(onBlur)
|
|
442
|
-
}), null, 16, ["model-value", "enabled", "config", "onChange", "onFocus", "onBlur"]);
|
|
443
|
-
};
|
|
216
|
+
updatePage(page) {
|
|
217
|
+
this.updateRequest({ page });
|
|
444
218
|
}
|
|
445
|
-
}
|
|
446
|
-
const
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
)
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
);
|
|
454
|
-
|
|
455
|
-
core.uiTypeIs("Control"),
|
|
456
|
-
testers.or(testers.optionIs("format", jsonFormsCore.ControlType.string), testers.schemaTypeIs("string"))
|
|
457
|
-
);
|
|
458
|
-
const isMarkdownControl = testers.and(
|
|
459
|
-
core.uiTypeIs("Control"),
|
|
460
|
-
testers.optionIs("format", jsonFormsCore.ControlType.markdown)
|
|
461
|
-
);
|
|
462
|
-
const isArrayRenderer = testers.and(
|
|
463
|
-
testers.schemaTypeIs("array")
|
|
464
|
-
// optionIs('format', ControlType.array),
|
|
465
|
-
);
|
|
466
|
-
const isCustomControl = (customType) => {
|
|
467
|
-
return testers.and(
|
|
468
|
-
testers.optionIs("format", jsonFormsCore.ControlType.custom),
|
|
469
|
-
testers.optionIs("type", customType)
|
|
470
|
-
);
|
|
219
|
+
}
|
|
220
|
+
const tableCache = /* @__PURE__ */ new Map();
|
|
221
|
+
const useTableStore = (name) => {
|
|
222
|
+
const tableStore = tableCache.get(name);
|
|
223
|
+
if (tableStore) {
|
|
224
|
+
return tableStore;
|
|
225
|
+
}
|
|
226
|
+
const newTableStore = new TableStore();
|
|
227
|
+
tableCache.set(name, newTableStore);
|
|
228
|
+
return newTableStore;
|
|
471
229
|
};
|
|
472
|
-
const
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
);
|
|
476
|
-
const isSelectControl = testers.and(
|
|
477
|
-
core.uiTypeIs("Control"),
|
|
478
|
-
testers.optionIs("format", jsonFormsCore.ControlType.select)
|
|
479
|
-
);
|
|
480
|
-
const isBooleanControl = testers.or(
|
|
481
|
-
testers.isBooleanControl,
|
|
482
|
-
testers.and(core.uiTypeIs("Control"), testers.optionIs("format", jsonFormsCore.ControlType.boolean))
|
|
483
|
-
);
|
|
484
|
-
const controlRenderers = [
|
|
485
|
-
// First custom renderers on format
|
|
486
|
-
{
|
|
487
|
-
tester: core.rankWith(10, isMarkdownControl),
|
|
488
|
-
renderer: _sfc_main$g
|
|
489
|
-
},
|
|
490
|
-
{
|
|
491
|
-
tester: core.rankWith(10, isAutoCompleteControl),
|
|
492
|
-
renderer: _sfc_main$j
|
|
493
|
-
},
|
|
494
|
-
{
|
|
495
|
-
tester: core.rankWith(10, isTextAreaControl),
|
|
496
|
-
renderer: _sfc_main$b
|
|
497
|
-
},
|
|
498
|
-
// Renderers based on type if no format is provided
|
|
499
|
-
{ tester: core.rankWith(10, isStringFormat), renderer: _sfc_main$c },
|
|
500
|
-
{ tester: core.rankWith(10, isSelectControl), renderer: _sfc_main$d },
|
|
501
|
-
{
|
|
502
|
-
tester: core.rankWith(10, isMultiselectControl),
|
|
503
|
-
renderer: _sfc_main$f
|
|
504
|
-
},
|
|
505
|
-
{ tester: core.rankWith(10, core.isNumberControl), renderer: _sfc_main$e },
|
|
506
|
-
{
|
|
507
|
-
tester: core.rankWith(10, core.isIntegerControl),
|
|
508
|
-
renderer: _sfc_main$h
|
|
509
|
-
},
|
|
510
|
-
{ tester: core.rankWith(10, isBooleanControl), renderer: _sfc_main$i }
|
|
511
|
-
];
|
|
512
|
-
const _hoisted_1$9 = ["title"];
|
|
513
|
-
const _hoisted_2$2 = { key: 0 };
|
|
514
|
-
const _hoisted_3$1 = {
|
|
515
|
-
key: 1,
|
|
516
|
-
class: "list-row"
|
|
230
|
+
const _hoisted_1$7 = {
|
|
231
|
+
key: 0,
|
|
232
|
+
class: "mb-2"
|
|
517
233
|
};
|
|
518
|
-
const _sfc_main$
|
|
519
|
-
__name: "
|
|
520
|
-
props:
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
const
|
|
524
|
-
|
|
234
|
+
const _sfc_main$g = /* @__PURE__ */ vue.defineComponent({
|
|
235
|
+
__name: "table.component",
|
|
236
|
+
props: TableComponentProperties,
|
|
237
|
+
emits: TableComponentEmits,
|
|
238
|
+
setup(__props, { emit: __emit }) {
|
|
239
|
+
const properties = __props;
|
|
240
|
+
const emit = __emit;
|
|
241
|
+
vue.watch(
|
|
242
|
+
() => properties.reload,
|
|
243
|
+
() => {
|
|
244
|
+
store.reload();
|
|
245
|
+
}
|
|
525
246
|
);
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
const noData = vue.computed(
|
|
534
|
-
() => !control.value.data || control.value.data.length === 0
|
|
247
|
+
let store = useTableStore(properties.id);
|
|
248
|
+
vue.watch(
|
|
249
|
+
() => properties.uri,
|
|
250
|
+
() => {
|
|
251
|
+
store.init(properties.uri);
|
|
252
|
+
},
|
|
253
|
+
{ immediate: true }
|
|
535
254
|
);
|
|
536
|
-
const
|
|
537
|
-
|
|
538
|
-
|
|
255
|
+
const edit = (data) => {
|
|
256
|
+
emit("edit", data);
|
|
257
|
+
};
|
|
258
|
+
const deleteFn = (data) => {
|
|
259
|
+
emit("delete", data);
|
|
260
|
+
};
|
|
261
|
+
const components = {
|
|
262
|
+
TextCell: ui.TextCell,
|
|
263
|
+
BooleanCell: ui.BooleanCell
|
|
264
|
+
};
|
|
265
|
+
const displayColumns = vue.computed(() => {
|
|
266
|
+
return properties.uiSchema.elements.map((e) => {
|
|
267
|
+
const element = e;
|
|
268
|
+
const def = jsonFormsCore.findColumnDef(element, properties.schema);
|
|
269
|
+
const type = lodashEs.isArray(def.type) ? def.type[0] : def.type;
|
|
270
|
+
let component;
|
|
271
|
+
if (element.options?.format && element.options.format in components) {
|
|
272
|
+
component = components[element.options.format];
|
|
273
|
+
} else {
|
|
274
|
+
component = components[element.type];
|
|
275
|
+
}
|
|
276
|
+
if (!component) console.warn("No component found for type", element.type);
|
|
277
|
+
return {
|
|
278
|
+
...def,
|
|
279
|
+
type,
|
|
280
|
+
component
|
|
281
|
+
};
|
|
282
|
+
});
|
|
283
|
+
});
|
|
284
|
+
const onChangeFilters = (filters) => {
|
|
285
|
+
store.updateFilters(filters);
|
|
286
|
+
};
|
|
287
|
+
const onUpdatePage = (page) => {
|
|
288
|
+
store.updatePage(page);
|
|
539
289
|
};
|
|
540
|
-
const
|
|
541
|
-
|
|
542
|
-
control.value.path,
|
|
543
|
-
core.createDefaultValue(control.value.schema, control.value.rootSchema)
|
|
544
|
-
)();
|
|
290
|
+
const onSort = (id) => {
|
|
291
|
+
store.sort(id);
|
|
545
292
|
};
|
|
546
|
-
const
|
|
547
|
-
return
|
|
293
|
+
const sort = vue.computed(() => {
|
|
294
|
+
return store.sorting.value ?? { orderBy: "", ascending: 1 };
|
|
548
295
|
});
|
|
549
296
|
return (_ctx, _cache) => {
|
|
550
|
-
return vue.openBlock(), vue.createElementBlock("div",
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
uischema: vue.unref(childUiSchema),
|
|
574
|
-
path: vue.unref(core.composePaths)(vue.unref(control).path, `${index}`),
|
|
575
|
-
enabled: vue.unref(control).enabled,
|
|
576
|
-
renderers: vue.unref(control).renderers,
|
|
577
|
-
cells: vue.unref(control).cells
|
|
578
|
-
}, null, 8, ["schema", "uischema", "path", "enabled", "renderers", "cells"])
|
|
579
|
-
]),
|
|
580
|
-
showActions.value ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_2$2, [
|
|
581
|
-
showDelete.value ? (vue.openBlock(), vue.createBlock(vue.unref(ui.Btn), {
|
|
582
|
-
key: 0,
|
|
583
|
-
icon: vue.unref(ui.IconEnum).Delete,
|
|
584
|
-
outline: true,
|
|
585
|
-
onClick: ($event) => deleteButtonClick(index)
|
|
586
|
-
}, null, 8, ["icon", "onClick"])) : vue.createCommentVNode("", true)
|
|
587
|
-
])) : vue.createCommentVNode("", true)
|
|
588
|
-
], 2)
|
|
589
|
-
]);
|
|
590
|
-
}), 128)),
|
|
591
|
-
noData.value ? (vue.openBlock(), vue.createElementBlock("div", {
|
|
592
|
-
key: 0,
|
|
593
|
-
class: vue.normalizeClass(["list-row", vue.unref(styles).arrayList.noData])
|
|
594
|
-
}, " No data ", 2)) : vue.createCommentVNode("", true),
|
|
595
|
-
showActions.value ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_3$1, [
|
|
596
|
-
vue.createVNode(vue.unref(ui.Btn), {
|
|
597
|
-
icon: vue.unref(ui.IconEnum).Plus,
|
|
598
|
-
outline: true,
|
|
599
|
-
onClick: addButtonClick
|
|
600
|
-
}, {
|
|
601
|
-
default: vue.withCtx(() => [..._cache[0] || (_cache[0] = [
|
|
602
|
-
vue.createTextVNode(" Add ", -1)
|
|
603
|
-
])]),
|
|
604
|
-
_: 1
|
|
605
|
-
}, 8, ["icon"])
|
|
606
|
-
])) : vue.createCommentVNode("", true)
|
|
607
|
-
], 2)
|
|
608
|
-
], 8, _hoisted_1$9);
|
|
297
|
+
return vue.openBlock(), vue.createElementBlock("div", null, [
|
|
298
|
+
_ctx.filterUiSchema && _ctx.filterSchema ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$7, [
|
|
299
|
+
vue.createVNode(_sfc_main$h, {
|
|
300
|
+
layout: { uiSchema: _ctx.filterUiSchema, schema: _ctx.filterSchema },
|
|
301
|
+
filters: vue.unref(store).filters.value,
|
|
302
|
+
onChangeFilters
|
|
303
|
+
}, null, 8, ["layout", "filters"])
|
|
304
|
+
])) : vue.createCommentVNode("", true),
|
|
305
|
+
vue.createElementVNode("div", null, [
|
|
306
|
+
vue.createVNode(vue.unref(ui.Table), {
|
|
307
|
+
"display-columns": displayColumns.value,
|
|
308
|
+
sort: sort.value,
|
|
309
|
+
page: vue.unref(store).pageData.value,
|
|
310
|
+
loading: vue.unref(store).loading.value,
|
|
311
|
+
data: vue.unref(store).tableData.value,
|
|
312
|
+
actions: _ctx.actions,
|
|
313
|
+
onUpdatePage,
|
|
314
|
+
onDelete: deleteFn,
|
|
315
|
+
onEdit: edit,
|
|
316
|
+
onSort
|
|
317
|
+
}, null, 8, ["display-columns", "sort", "page", "loading", "data", "actions"])
|
|
318
|
+
])
|
|
319
|
+
]);
|
|
609
320
|
};
|
|
610
321
|
}
|
|
611
322
|
});
|
|
612
|
-
const
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
const
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
return (_ctx, _cache) => {
|
|
633
|
-
return vue.openBlock(), vue.createBlock(vue.unref(ui.Collapse), { title: title.value }, {
|
|
634
|
-
default: vue.withCtx(() => [
|
|
635
|
-
vue.createElementVNode("div", _hoisted_1$8, [
|
|
636
|
-
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(layout).uischema.elements, (element, index) => {
|
|
637
|
-
return vue.openBlock(), vue.createBlock(vue.unref(vue$1.DispatchRenderer), {
|
|
638
|
-
key: index,
|
|
639
|
-
schema: vue.unref(layout).schema,
|
|
640
|
-
uischema: element,
|
|
641
|
-
path: vue.unref(layout).path,
|
|
642
|
-
renderers: vue.unref(renderers),
|
|
643
|
-
cells: vue.unref(cells)
|
|
644
|
-
}, null, 8, ["schema", "uischema", "path", "renderers", "cells"]);
|
|
645
|
-
}), 128))
|
|
646
|
-
])
|
|
647
|
-
]),
|
|
648
|
-
_: 1
|
|
649
|
-
}, 8, ["title"]);
|
|
650
|
-
};
|
|
651
|
-
}
|
|
652
|
-
});
|
|
653
|
-
const _hoisted_1$7 = {
|
|
654
|
-
class: "grid gap-4 items-center",
|
|
655
|
-
style: { "grid-template-columns": "repeat(12, 1fr)" }
|
|
656
|
-
};
|
|
657
|
-
const _sfc_main$8 = /* @__PURE__ */ vue.defineComponent({
|
|
658
|
-
__name: "GridLayout",
|
|
659
|
-
props: { ...vue$1.rendererProps() },
|
|
660
|
-
setup(__props) {
|
|
661
|
-
const props = __props;
|
|
662
|
-
const { layout, renderers, cells } = vue$1.useJsonFormsLayout(props);
|
|
663
|
-
return (_ctx, _cache) => {
|
|
664
|
-
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$7, [
|
|
665
|
-
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(layout).uischema.elements, (element, index) => {
|
|
666
|
-
return vue.openBlock(), vue.createElementBlock("div", {
|
|
667
|
-
key: index,
|
|
668
|
-
style: vue.normalizeStyle({
|
|
669
|
-
"grid-column": `span ${element.options?.colspan ?? 12}`
|
|
670
|
-
})
|
|
671
|
-
}, [
|
|
672
|
-
vue.createVNode(vue.unref(vue$1.DispatchRenderer), {
|
|
673
|
-
schema: vue.unref(layout).schema,
|
|
674
|
-
uischema: element,
|
|
675
|
-
path: vue.unref(layout).path,
|
|
676
|
-
renderers: vue.unref(renderers),
|
|
677
|
-
cells: vue.unref(cells)
|
|
678
|
-
}, null, 8, ["schema", "uischema", "path", "renderers", "cells"])
|
|
679
|
-
], 4);
|
|
680
|
-
}), 128))
|
|
681
|
-
]);
|
|
682
|
-
};
|
|
683
|
-
}
|
|
684
|
-
});
|
|
685
|
-
const _hoisted_1$6 = { class: "flex flex-row gap-4 items-center" };
|
|
686
|
-
const _sfc_main$7 = /* @__PURE__ */ vue.defineComponent({
|
|
687
|
-
__name: "HorizontalLayout",
|
|
688
|
-
props: { ...vue$1.rendererProps() },
|
|
689
|
-
setup(__props) {
|
|
690
|
-
const props = __props;
|
|
691
|
-
const { layout, renderers, cells } = vue$1.useJsonFormsLayout(props);
|
|
692
|
-
return (_ctx, _cache) => {
|
|
693
|
-
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$6, [
|
|
694
|
-
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(layout).uischema.elements, (element, index) => {
|
|
695
|
-
return vue.openBlock(), vue.createBlock(vue.unref(vue$1.DispatchRenderer), {
|
|
696
|
-
key: index,
|
|
697
|
-
schema: vue.unref(layout).schema,
|
|
698
|
-
uischema: element,
|
|
699
|
-
path: vue.unref(layout).path,
|
|
700
|
-
renderers: vue.unref(renderers),
|
|
701
|
-
cells: vue.unref(cells)
|
|
702
|
-
}, null, 8, ["schema", "uischema", "path", "renderers", "cells"]);
|
|
703
|
-
}), 128))
|
|
704
|
-
]);
|
|
705
|
-
};
|
|
706
|
-
}
|
|
707
|
-
});
|
|
708
|
-
const _hoisted_1$5 = { class: "flex flex-col gap-4" };
|
|
709
|
-
const _sfc_main$6 = /* @__PURE__ */ vue.defineComponent({
|
|
710
|
-
__name: "VerticalLayout",
|
|
711
|
-
props: { ...vue$1.rendererProps() },
|
|
712
|
-
setup(__props) {
|
|
713
|
-
const props = __props;
|
|
714
|
-
const { layout, renderers, cells } = vue$1.useJsonFormsLayout(props);
|
|
715
|
-
return (_ctx, _cache) => {
|
|
716
|
-
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$5, [
|
|
717
|
-
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(layout).uischema.elements, (element, index) => {
|
|
718
|
-
return vue.openBlock(), vue.createBlock(vue.unref(vue$1.DispatchRenderer), {
|
|
719
|
-
key: index,
|
|
720
|
-
schema: vue.unref(layout).schema,
|
|
721
|
-
uischema: element,
|
|
722
|
-
path: vue.unref(layout).path,
|
|
723
|
-
renderers: vue.unref(renderers),
|
|
724
|
-
cells: vue.unref(cells)
|
|
725
|
-
}, null, 8, ["schema", "uischema", "path", "renderers", "cells"]);
|
|
726
|
-
}), 128))
|
|
727
|
-
]);
|
|
728
|
-
};
|
|
729
|
-
}
|
|
730
|
-
});
|
|
731
|
-
const layoutRenderers = [
|
|
732
|
-
{
|
|
733
|
-
tester: core.rankWith(10, core.uiTypeIs(jsonFormsCore.LayoutTypes.VerticalLayout)),
|
|
734
|
-
renderer: _sfc_main$6
|
|
735
|
-
},
|
|
736
|
-
{
|
|
737
|
-
tester: core.rankWith(10, core.uiTypeIs(jsonFormsCore.LayoutTypes.HorizontalLayout)),
|
|
738
|
-
renderer: _sfc_main$7
|
|
739
|
-
},
|
|
740
|
-
{
|
|
741
|
-
tester: core.rankWith(10, core.uiTypeIs(jsonFormsCore.LayoutTypes.CollapseLayout)),
|
|
742
|
-
renderer: _sfc_main$9
|
|
743
|
-
},
|
|
744
|
-
{
|
|
745
|
-
tester: core.rankWith(10, core.uiTypeIs(jsonFormsCore.LayoutTypes.GridLayout)),
|
|
746
|
-
renderer: _sfc_main$8
|
|
747
|
-
}
|
|
748
|
-
];
|
|
749
|
-
const _hoisted_1$4 = { class: "" };
|
|
750
|
-
const _hoisted_2$1 = { class: "flex gap-2 items-center mb-2" };
|
|
751
|
-
const _hoisted_3 = { class: "flex gap-2" };
|
|
752
|
-
const _sfc_main$5 = /* @__PURE__ */ vue.defineComponent({
|
|
753
|
-
__name: "table-filter",
|
|
754
|
-
props: {
|
|
755
|
-
layout: {},
|
|
756
|
-
filters: {}
|
|
757
|
-
},
|
|
758
|
-
emits: ["changeFilters", "removeFilter"],
|
|
759
|
-
setup(__props, { emit: __emit }) {
|
|
760
|
-
const formData = vue.ref();
|
|
761
|
-
const properties = __props;
|
|
762
|
-
const emits = __emit;
|
|
763
|
-
vue.watch(
|
|
764
|
-
() => properties.filters,
|
|
765
|
-
() => {
|
|
766
|
-
formData.value = {};
|
|
767
|
-
properties.filters.forEach((filter) => {
|
|
768
|
-
formData.value[filter.key] = filter.value;
|
|
769
|
-
});
|
|
770
|
-
},
|
|
771
|
-
{ immediate: true }
|
|
772
|
-
);
|
|
773
|
-
const onResetFilters = () => {
|
|
774
|
-
emits("changeFilters", {});
|
|
775
|
-
};
|
|
776
|
-
const removeFilter = (filter) => {
|
|
777
|
-
formData.value[filter.key] = void 0;
|
|
778
|
-
emits("changeFilters", formData.value);
|
|
779
|
-
};
|
|
780
|
-
return (_ctx, _cache) => {
|
|
781
|
-
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$4, [
|
|
782
|
-
vue.createElementVNode("div", _hoisted_2$1, [
|
|
783
|
-
__props.filters.length ? (vue.openBlock(), vue.createBlock(vue.unref(ui.Btn), {
|
|
784
|
-
key: 0,
|
|
785
|
-
size: "xs",
|
|
786
|
-
outline: true,
|
|
787
|
-
onClick: onResetFilters
|
|
788
|
-
}, {
|
|
789
|
-
default: vue.withCtx(() => [..._cache[0] || (_cache[0] = [
|
|
790
|
-
vue.createTextVNode(" Reset all filters ", -1)
|
|
791
|
-
])]),
|
|
792
|
-
_: 1
|
|
793
|
-
})) : vue.createCommentVNode("", true)
|
|
794
|
-
]),
|
|
795
|
-
vue.createElementVNode("div", _hoisted_3, [
|
|
796
|
-
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(__props.filters, (filter) => {
|
|
797
|
-
return vue.openBlock(), vue.createBlock(vue.unref(ui.BtnBadge), {
|
|
798
|
-
key: filter.key,
|
|
799
|
-
icon: vue.unref(ui.IconEnum).Close,
|
|
800
|
-
onClick: ($event) => removeFilter(filter)
|
|
801
|
-
}, {
|
|
802
|
-
default: vue.withCtx(() => [
|
|
803
|
-
vue.createTextVNode(vue.toDisplayString(filter.label) + ": " + vue.toDisplayString(filter.value), 1)
|
|
804
|
-
]),
|
|
805
|
-
_: 2
|
|
806
|
-
}, 1032, ["icon", "onClick"]);
|
|
807
|
-
}), 128))
|
|
808
|
-
])
|
|
809
|
-
]);
|
|
810
|
-
};
|
|
811
|
-
}
|
|
812
|
-
});
|
|
813
|
-
const TableComponentProperties = {
|
|
814
|
-
id: { type: String, required: true },
|
|
815
|
-
uiSchema: { type: Object, required: true },
|
|
816
|
-
schema: { type: Object, required: true },
|
|
817
|
-
filterUiSchema: { type: Object },
|
|
818
|
-
filterSchema: { type: Object },
|
|
819
|
-
uri: { type: String, required: true },
|
|
820
|
-
reload: { type: Number },
|
|
821
|
-
actions: { type: Array }
|
|
822
|
-
};
|
|
823
|
-
const TableComponentEmits = ["delete", "edit"];
|
|
824
|
-
class TableStore {
|
|
825
|
-
constructor() {
|
|
826
|
-
this.route = vueRouter.useRoute();
|
|
827
|
-
this.router = vueRouter.useRouter();
|
|
828
|
-
this.requestData = vue.ref(jsonFormsCore.RequestSchema.parse(this.route.query));
|
|
829
|
-
this._reload = vue.ref(Date.now());
|
|
830
|
-
this.loading = vue.ref(true);
|
|
831
|
-
this.uri = vue.ref("");
|
|
832
|
-
this.data = core$1.computedAsync(async () => {
|
|
833
|
-
this._reload.value;
|
|
834
|
-
if (!this.uri.value) return null;
|
|
835
|
-
this.loading.value = true;
|
|
836
|
-
if (this.requestData.value.page < 1) {
|
|
837
|
-
this.requestData.value.page = 1;
|
|
838
|
-
}
|
|
839
|
-
const response = await toolsVue.useApi().get(this.uri.value, {
|
|
840
|
-
params: this.requestData.value
|
|
841
|
-
}).catch((error2) => {
|
|
842
|
-
console.error(error2);
|
|
843
|
-
return { data: [], request: { totalPages: 1, page: 1 } };
|
|
844
|
-
}).finally(() => this.loading.value = false);
|
|
845
|
-
const data = response.data;
|
|
846
|
-
if (data.request.totalPages < data.request.page) {
|
|
847
|
-
this.updateRequest({ page: data.request.totalPages });
|
|
848
|
-
}
|
|
849
|
-
return data;
|
|
850
|
-
});
|
|
851
|
-
this.pageData = vue.computed(() => {
|
|
852
|
-
const request = this.data.value?.request ?? {
|
|
853
|
-
count: 0,
|
|
854
|
-
pageSize: 1,
|
|
855
|
-
page: 1
|
|
856
|
-
};
|
|
857
|
-
return {
|
|
858
|
-
count: request.count,
|
|
859
|
-
pageSize: request.pageSize,
|
|
860
|
-
page: request.page
|
|
861
|
-
};
|
|
862
|
-
});
|
|
863
|
-
this.tableData = vue.computed(() => {
|
|
864
|
-
const d = this.data.value;
|
|
865
|
-
if (!d) return [];
|
|
866
|
-
if (this.loading.value) return [];
|
|
867
|
-
return d.data ?? [];
|
|
323
|
+
const createRepository = (formSchemaModel, httpRequest, options = {}) => {
|
|
324
|
+
const notificationEntity = options.notification?.entityType || "entity";
|
|
325
|
+
const notificationStore = options.notification?.notification ?? null;
|
|
326
|
+
const getDataUri = (...suffix) => {
|
|
327
|
+
return [formSchemaModel.uri, ...suffix].join("/");
|
|
328
|
+
};
|
|
329
|
+
const handleSuccess = (message) => {
|
|
330
|
+
notificationStore?.success(message);
|
|
331
|
+
};
|
|
332
|
+
const handleError = (error2, message) => {
|
|
333
|
+
console.error(error2);
|
|
334
|
+
notificationStore?.error(message);
|
|
335
|
+
throw new Error(error2);
|
|
336
|
+
};
|
|
337
|
+
const create = (object2, options2) => {
|
|
338
|
+
return httpRequest.post(getDataUri(), object2, options2).then((response) => {
|
|
339
|
+
handleSuccess(`Created ${notificationEntity}`);
|
|
340
|
+
return response.data;
|
|
341
|
+
}).catch((response) => {
|
|
342
|
+
handleError(response, `Failed to create ${notificationEntity}`);
|
|
868
343
|
});
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
...this.route.query,
|
|
877
|
-
...this.requestData.value
|
|
878
|
-
}
|
|
879
|
-
});
|
|
880
|
-
};
|
|
881
|
-
this.sort = (id) => {
|
|
882
|
-
const sortDir = this.requestData.value.sort === id && this.requestData.value.sortDir === "asc" ? "desc" : "asc";
|
|
883
|
-
this.updateRequest({ sort: id, sortDir });
|
|
884
|
-
};
|
|
885
|
-
this.updateFilters = (filters) => {
|
|
886
|
-
const filter = [];
|
|
887
|
-
Object.entries(filters).forEach(([key, value]) => {
|
|
888
|
-
if (!value) return;
|
|
889
|
-
const operator = value?.operator || "contains";
|
|
890
|
-
filter.push(`${key}:${value}:${operator}`);
|
|
891
|
-
});
|
|
892
|
-
this.updateRequest({ filter });
|
|
893
|
-
};
|
|
894
|
-
this.sorting = vue.computed(() => {
|
|
895
|
-
const requestData = this.requestData.value;
|
|
896
|
-
return {
|
|
897
|
-
sortColumn: requestData.sort,
|
|
898
|
-
sortDirection: requestData.sortDir ?? "asc"
|
|
899
|
-
};
|
|
344
|
+
};
|
|
345
|
+
const patch = (id, object2, options2) => {
|
|
346
|
+
return httpRequest.patch(getDataUri(id), object2, options2).then((response) => {
|
|
347
|
+
handleSuccess(`Saved ${notificationEntity}`);
|
|
348
|
+
return response.data;
|
|
349
|
+
}).catch((response) => {
|
|
350
|
+
handleError(response, `Failed to save ${notificationEntity}`);
|
|
900
351
|
});
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
)
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
}
|
|
908
|
-
reload() {
|
|
909
|
-
this._reload.value = Date.now();
|
|
910
|
-
}
|
|
911
|
-
updatePage(page) {
|
|
912
|
-
this.updateRequest({ page });
|
|
913
|
-
}
|
|
914
|
-
}
|
|
915
|
-
const tableCache = /* @__PURE__ */ new Map();
|
|
916
|
-
const useTableStore = (name) => {
|
|
917
|
-
const tableStore = tableCache.get(name);
|
|
918
|
-
if (tableStore) {
|
|
919
|
-
return tableStore;
|
|
920
|
-
}
|
|
921
|
-
const newTableStore = new TableStore();
|
|
922
|
-
tableCache.set(name, newTableStore);
|
|
923
|
-
return newTableStore;
|
|
924
|
-
};
|
|
925
|
-
const _hoisted_1$3 = {
|
|
926
|
-
key: 0,
|
|
927
|
-
class: "mb-2"
|
|
928
|
-
};
|
|
929
|
-
const _sfc_main$4 = /* @__PURE__ */ vue.defineComponent({
|
|
930
|
-
__name: "table.component",
|
|
931
|
-
props: TableComponentProperties,
|
|
932
|
-
emits: TableComponentEmits,
|
|
933
|
-
setup(__props, { emit: __emit }) {
|
|
934
|
-
const properties = __props;
|
|
935
|
-
const emit = __emit;
|
|
936
|
-
vue.watch(
|
|
937
|
-
() => properties.reload,
|
|
938
|
-
() => {
|
|
939
|
-
store.reload();
|
|
940
|
-
}
|
|
941
|
-
);
|
|
942
|
-
let store = useTableStore(properties.id);
|
|
943
|
-
vue.watch(
|
|
944
|
-
() => properties.uri,
|
|
945
|
-
() => {
|
|
946
|
-
store.init(properties.uri);
|
|
947
|
-
},
|
|
948
|
-
{ immediate: true }
|
|
949
|
-
);
|
|
950
|
-
const edit = (data) => {
|
|
951
|
-
emit("edit", data);
|
|
952
|
-
};
|
|
953
|
-
const deleteFn = (data) => {
|
|
954
|
-
emit("delete", data);
|
|
955
|
-
};
|
|
956
|
-
const components = {
|
|
957
|
-
TextCell: ui.TextCell
|
|
958
|
-
};
|
|
959
|
-
const displayColumns = vue.computed(() => {
|
|
960
|
-
return properties.uiSchema.elements.map((e) => {
|
|
961
|
-
const element = e;
|
|
962
|
-
const def = jsonFormsCore.findColumnDef(element, properties.schema);
|
|
963
|
-
const type = lodashEs.isArray(def.type) ? def.type[0] : def.type;
|
|
964
|
-
let component;
|
|
965
|
-
if (element.options?.format && element.options.format in components) {
|
|
966
|
-
component = components[element.options.format];
|
|
967
|
-
} else {
|
|
968
|
-
component = components[element.type];
|
|
969
|
-
}
|
|
970
|
-
if (!component) console.warn("No component found for type", element.type);
|
|
971
|
-
return {
|
|
972
|
-
...def,
|
|
973
|
-
type,
|
|
974
|
-
component
|
|
975
|
-
};
|
|
976
|
-
});
|
|
352
|
+
};
|
|
353
|
+
const get = (id, options2) => {
|
|
354
|
+
return httpRequest.get(getDataUri(id), options2).then((response) => {
|
|
355
|
+
return response.data;
|
|
356
|
+
}).catch((response) => {
|
|
357
|
+
handleError(response, `Failed to load data`);
|
|
977
358
|
});
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
}
|
|
984
|
-
|
|
985
|
-
store.sort(id);
|
|
986
|
-
};
|
|
987
|
-
const sort = vue.computed(() => {
|
|
988
|
-
return store.sorting.value ?? { orderBy: "", ascending: 1 };
|
|
359
|
+
};
|
|
360
|
+
const _delete = (id, options2) => {
|
|
361
|
+
return httpRequest.delete(getDataUri(id), options2).then((response) => {
|
|
362
|
+
handleSuccess(`${notificationEntity} deleted`);
|
|
363
|
+
return response;
|
|
364
|
+
}).catch((response) => {
|
|
365
|
+
handleError(response, `Failed to delete ${notificationEntity}`);
|
|
989
366
|
});
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
vue.createElementVNode("div", null, [
|
|
1000
|
-
vue.createVNode(vue.unref(ui.Table), {
|
|
1001
|
-
"display-columns": displayColumns.value,
|
|
1002
|
-
sort: sort.value,
|
|
1003
|
-
page: vue.unref(store).pageData.value,
|
|
1004
|
-
loading: vue.unref(store).loading.value,
|
|
1005
|
-
data: vue.unref(store).tableData.value,
|
|
1006
|
-
actions: _ctx.actions,
|
|
1007
|
-
onUpdatePage,
|
|
1008
|
-
onDelete: deleteFn,
|
|
1009
|
-
onEdit: edit,
|
|
1010
|
-
onSort
|
|
1011
|
-
}, null, 8, ["display-columns", "sort", "page", "loading", "data", "actions"])
|
|
1012
|
-
])
|
|
1013
|
-
]);
|
|
1014
|
-
};
|
|
1015
|
-
}
|
|
1016
|
-
});
|
|
1017
|
-
const _hoisted_1$2 = { class: "flex justify-between items-center mb-2" };
|
|
1018
|
-
const _sfc_main$3 = /* @__PURE__ */ vue.defineComponent({
|
|
1019
|
-
__name: "form-with-table.component",
|
|
1020
|
-
props: FormWithTableProperties,
|
|
1021
|
-
emits: FormWithTableEmits,
|
|
1022
|
-
setup(__props, { emit: __emit }) {
|
|
1023
|
-
const properties = __props;
|
|
1024
|
-
const emit = __emit;
|
|
1025
|
-
const reload = vue.ref(0);
|
|
1026
|
-
const resolvedForm = vue.computed(() => properties.form);
|
|
1027
|
-
const resolvedTable = vue.computed(() => properties.table);
|
|
1028
|
-
const resolvedFilter = vue.computed(() => properties.filter);
|
|
1029
|
-
const resolvedUri = vue.computed(() => properties.uri);
|
|
1030
|
-
let store = new FormStore(resolvedUri.value ?? "");
|
|
1031
|
-
vue.watch(resolvedUri, (uri) => {
|
|
1032
|
-
store = new FormStore(uri ?? "");
|
|
367
|
+
};
|
|
368
|
+
const createMulti = (objects, options2) => {
|
|
369
|
+
return Promise.all(
|
|
370
|
+
objects.map((object2) => httpRequest.post(getDataUri(), object2, options2))
|
|
371
|
+
).then((response) => {
|
|
372
|
+
handleSuccess(`Created ${notificationEntity}`);
|
|
373
|
+
return response.data;
|
|
374
|
+
}).catch((response) => {
|
|
375
|
+
handleError(response, `Failed to save ${notificationEntity}`);
|
|
1033
376
|
});
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
emit("custom:edit", data);
|
|
1040
|
-
return;
|
|
1041
|
-
}
|
|
1042
|
-
if (hasEdit) {
|
|
1043
|
-
emit("editData", data);
|
|
1044
|
-
return;
|
|
1045
|
-
}
|
|
1046
|
-
openModal(data);
|
|
1047
|
-
};
|
|
1048
|
-
const create = () => {
|
|
1049
|
-
if (customCreate) {
|
|
1050
|
-
emit("custom:create");
|
|
1051
|
-
return;
|
|
1052
|
-
}
|
|
1053
|
-
openModal();
|
|
1054
|
-
};
|
|
1055
|
-
const deleteFn = (data) => {
|
|
1056
|
-
ui.ModalService.showConfirm({
|
|
1057
|
-
title: "Delete record",
|
|
1058
|
-
message: "Are you sure to delete, the data will be lost?",
|
|
1059
|
-
onClose: (result) => {
|
|
1060
|
-
if (result.confirmed) {
|
|
1061
|
-
store.delete(data).then(() => {
|
|
1062
|
-
reload.value = Date.now();
|
|
1063
|
-
emit("delete", data);
|
|
1064
|
-
});
|
|
1065
|
-
}
|
|
1066
|
-
}
|
|
1067
|
-
});
|
|
1068
|
-
};
|
|
1069
|
-
const openModal = (formData) => {
|
|
1070
|
-
if (!resolvedForm.value) return;
|
|
1071
|
-
const isUpdate = !!formData?.id;
|
|
1072
|
-
FormModalService.openModal({
|
|
1073
|
-
schema: resolvedForm.value.schema,
|
|
1074
|
-
uiSchema: resolvedForm.value.uiSchema,
|
|
1075
|
-
modalSize: resolvedForm.value.modalSize,
|
|
1076
|
-
initialData: formData ?? properties.initialData,
|
|
1077
|
-
modalTitle: (isUpdate ? properties.updateTitle ?? properties.createTitle : properties.createTitle) ?? "",
|
|
1078
|
-
onClose: (result) => {
|
|
1079
|
-
if (result && result.valid) {
|
|
1080
|
-
store.save(formData?.id, result.data).then(() => {
|
|
1081
|
-
reload.value = Date.now();
|
|
1082
|
-
emit("save", { id: formData?.id, data: result.data });
|
|
1083
|
-
});
|
|
1084
|
-
}
|
|
1085
|
-
},
|
|
1086
|
-
onEvents: (payload) => emit("events", payload)
|
|
1087
|
-
});
|
|
1088
|
-
};
|
|
1089
|
-
return (_ctx, _cache) => {
|
|
1090
|
-
return vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [
|
|
1091
|
-
vue.createElementVNode("div", _hoisted_1$2, [
|
|
1092
|
-
vue.createElementVNode("h1", null, vue.toDisplayString(_ctx.tableTitle), 1),
|
|
1093
|
-
vue.createElementVNode("div", null, [
|
|
1094
|
-
vue.createVNode(vue.unref(ui.Btn), {
|
|
1095
|
-
icon: vue.unref(ui.IconEnum).Plus,
|
|
1096
|
-
outline: true,
|
|
1097
|
-
onClick: create
|
|
1098
|
-
}, {
|
|
1099
|
-
default: vue.withCtx(() => [..._cache[0] || (_cache[0] = [
|
|
1100
|
-
vue.createTextVNode(" Add new record ", -1)
|
|
1101
|
-
])]),
|
|
1102
|
-
_: 1
|
|
1103
|
-
}, 8, ["icon"])
|
|
1104
|
-
])
|
|
1105
|
-
]),
|
|
1106
|
-
resolvedTable.value ? (vue.openBlock(), vue.createBlock(vue.unref(ui.Card), { key: 0 }, {
|
|
1107
|
-
default: vue.withCtx(() => [
|
|
1108
|
-
resolvedUri.value ? (vue.openBlock(), vue.createBlock(vue.unref(_sfc_main$4), {
|
|
1109
|
-
key: 0,
|
|
1110
|
-
id: `form_table_${_ctx.id}`,
|
|
1111
|
-
"ui-schema": resolvedTable.value.uiSchema,
|
|
1112
|
-
schema: resolvedTable.value.schema,
|
|
1113
|
-
"filter-ui-schema": resolvedFilter.value?.uiSchema,
|
|
1114
|
-
"filter-schema": resolvedFilter.value?.schema,
|
|
1115
|
-
uri: _ctx.dataUri ?? resolvedUri.value,
|
|
1116
|
-
reload: reload.value,
|
|
1117
|
-
actions: _ctx.tableActions,
|
|
1118
|
-
onEdit: edit,
|
|
1119
|
-
onDelete: deleteFn
|
|
1120
|
-
}, null, 8, ["id", "ui-schema", "schema", "filter-ui-schema", "filter-schema", "uri", "reload", "actions"])) : vue.createCommentVNode("", true)
|
|
1121
|
-
]),
|
|
1122
|
-
_: 1
|
|
1123
|
-
})) : vue.createCommentVNode("", true)
|
|
1124
|
-
], 64);
|
|
1125
|
-
};
|
|
1126
|
-
}
|
|
377
|
+
};
|
|
378
|
+
return { create, patch, createMulti, delete: _delete, get };
|
|
379
|
+
};
|
|
380
|
+
const createFormEvents = (dispatch) => ({
|
|
381
|
+
dispatch
|
|
1127
382
|
});
|
|
383
|
+
const FORM_EVENTS_KEY = /* @__PURE__ */ Symbol("json-forms:events");
|
|
384
|
+
const provideFormEvents = (dispatch) => {
|
|
385
|
+
const events = createFormEvents(dispatch);
|
|
386
|
+
vue.provide(FORM_EVENTS_KEY, events);
|
|
387
|
+
return events;
|
|
388
|
+
};
|
|
389
|
+
const useFormEvents = () => {
|
|
390
|
+
return vue.inject(
|
|
391
|
+
FORM_EVENTS_KEY,
|
|
392
|
+
createFormEvents(() => {
|
|
393
|
+
})
|
|
394
|
+
);
|
|
395
|
+
};
|
|
1128
396
|
function $constructor(name, initializer2, params) {
|
|
1129
397
|
function init(inst, def) {
|
|
1130
398
|
if (!inst._zod) {
|
|
@@ -1659,7 +927,7 @@ function flattenError(error2, mapper = (issue2) => issue2.message) {
|
|
|
1659
927
|
}
|
|
1660
928
|
return { formErrors, fieldErrors };
|
|
1661
929
|
}
|
|
1662
|
-
function formatError(error2, mapper = (issue2) => issue2.message) {
|
|
930
|
+
function formatError$1(error2, mapper = (issue2) => issue2.message) {
|
|
1663
931
|
const fieldErrors = { _errors: [] };
|
|
1664
932
|
const processError = (error3) => {
|
|
1665
933
|
for (const issue2 of error3.issues) {
|
|
@@ -3112,11 +2380,11 @@ const $ZodDate = /* @__PURE__ */ $constructor("$ZodDate", (inst, def) => {
|
|
|
3112
2380
|
return payload;
|
|
3113
2381
|
};
|
|
3114
2382
|
});
|
|
3115
|
-
function handleArrayResult(result, final,
|
|
2383
|
+
function handleArrayResult(result, final, index2) {
|
|
3116
2384
|
if (result.issues.length) {
|
|
3117
|
-
final.issues.push(...prefixIssues(
|
|
2385
|
+
final.issues.push(...prefixIssues(index2, result.issues));
|
|
3118
2386
|
}
|
|
3119
|
-
final.value[
|
|
2387
|
+
final.value[index2] = result.value;
|
|
3120
2388
|
}
|
|
3121
2389
|
const $ZodArray = /* @__PURE__ */ $constructor("$ZodArray", (inst, def) => {
|
|
3122
2390
|
$ZodType.init(inst, def);
|
|
@@ -3607,14 +2875,14 @@ function mergeValues(a, b) {
|
|
|
3607
2875
|
return { valid: false, mergeErrorPath: [] };
|
|
3608
2876
|
}
|
|
3609
2877
|
const newArray = [];
|
|
3610
|
-
for (let
|
|
3611
|
-
const itemA = a[
|
|
3612
|
-
const itemB = b[
|
|
2878
|
+
for (let index2 = 0; index2 < a.length; index2++) {
|
|
2879
|
+
const itemA = a[index2];
|
|
2880
|
+
const itemB = b[index2];
|
|
3613
2881
|
const sharedValue = mergeValues(itemA, itemB);
|
|
3614
2882
|
if (!sharedValue.valid) {
|
|
3615
2883
|
return {
|
|
3616
2884
|
valid: false,
|
|
3617
|
-
mergeErrorPath: [
|
|
2885
|
+
mergeErrorPath: [index2, ...sharedValue.mergeErrorPath]
|
|
3618
2886
|
};
|
|
3619
2887
|
}
|
|
3620
2888
|
newArray.push(sharedValue.data);
|
|
@@ -3730,11 +2998,11 @@ const $ZodTuple = /* @__PURE__ */ $constructor("$ZodTuple", (inst, def) => {
|
|
|
3730
2998
|
return payload;
|
|
3731
2999
|
};
|
|
3732
3000
|
});
|
|
3733
|
-
function handleTupleResult(result, final,
|
|
3001
|
+
function handleTupleResult(result, final, index2) {
|
|
3734
3002
|
if (result.issues.length) {
|
|
3735
|
-
final.issues.push(...prefixIssues(
|
|
3003
|
+
final.issues.push(...prefixIssues(index2, result.issues));
|
|
3736
3004
|
}
|
|
3737
|
-
final.value[
|
|
3005
|
+
final.value[index2] = result.value;
|
|
3738
3006
|
}
|
|
3739
3007
|
const $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
|
|
3740
3008
|
$ZodType.init(inst, def);
|
|
@@ -6332,7 +5600,7 @@ const initializer = (inst, issues) => {
|
|
|
6332
5600
|
inst.name = "ZodError";
|
|
6333
5601
|
Object.defineProperties(inst, {
|
|
6334
5602
|
format: {
|
|
6335
|
-
value: (mapper) => formatError(inst, mapper)
|
|
5603
|
+
value: (mapper) => formatError$1(inst, mapper)
|
|
6336
5604
|
// enumerable: false,
|
|
6337
5605
|
},
|
|
6338
5606
|
flatten: {
|
|
@@ -7952,244 +7220,1344 @@ function convertBaseSchema(schema, ctx) {
|
|
|
7952
7220
|
}
|
|
7953
7221
|
break;
|
|
7954
7222
|
}
|
|
7955
|
-
const objectSchema = z.object(shape);
|
|
7956
|
-
if (schema.additionalProperties === false) {
|
|
7957
|
-
zodSchema = objectSchema.strict();
|
|
7958
|
-
} else if (typeof schema.additionalProperties === "object") {
|
|
7959
|
-
zodSchema = objectSchema.catchall(convertSchema(schema.additionalProperties, ctx));
|
|
7960
|
-
} else {
|
|
7961
|
-
zodSchema = objectSchema.passthrough();
|
|
7223
|
+
const objectSchema = z.object(shape);
|
|
7224
|
+
if (schema.additionalProperties === false) {
|
|
7225
|
+
zodSchema = objectSchema.strict();
|
|
7226
|
+
} else if (typeof schema.additionalProperties === "object") {
|
|
7227
|
+
zodSchema = objectSchema.catchall(convertSchema(schema.additionalProperties, ctx));
|
|
7228
|
+
} else {
|
|
7229
|
+
zodSchema = objectSchema.passthrough();
|
|
7230
|
+
}
|
|
7231
|
+
break;
|
|
7232
|
+
}
|
|
7233
|
+
case "array": {
|
|
7234
|
+
const prefixItems = schema.prefixItems;
|
|
7235
|
+
const items = schema.items;
|
|
7236
|
+
if (prefixItems && Array.isArray(prefixItems)) {
|
|
7237
|
+
const tupleItems = prefixItems.map((item) => convertSchema(item, ctx));
|
|
7238
|
+
const rest = items && typeof items === "object" && !Array.isArray(items) ? convertSchema(items, ctx) : void 0;
|
|
7239
|
+
if (rest) {
|
|
7240
|
+
zodSchema = z.tuple(tupleItems).rest(rest);
|
|
7241
|
+
} else {
|
|
7242
|
+
zodSchema = z.tuple(tupleItems);
|
|
7243
|
+
}
|
|
7244
|
+
if (typeof schema.minItems === "number") {
|
|
7245
|
+
zodSchema = zodSchema.check(z.minLength(schema.minItems));
|
|
7246
|
+
}
|
|
7247
|
+
if (typeof schema.maxItems === "number") {
|
|
7248
|
+
zodSchema = zodSchema.check(z.maxLength(schema.maxItems));
|
|
7249
|
+
}
|
|
7250
|
+
} else if (Array.isArray(items)) {
|
|
7251
|
+
const tupleItems = items.map((item) => convertSchema(item, ctx));
|
|
7252
|
+
const rest = schema.additionalItems && typeof schema.additionalItems === "object" ? convertSchema(schema.additionalItems, ctx) : void 0;
|
|
7253
|
+
if (rest) {
|
|
7254
|
+
zodSchema = z.tuple(tupleItems).rest(rest);
|
|
7255
|
+
} else {
|
|
7256
|
+
zodSchema = z.tuple(tupleItems);
|
|
7257
|
+
}
|
|
7258
|
+
if (typeof schema.minItems === "number") {
|
|
7259
|
+
zodSchema = zodSchema.check(z.minLength(schema.minItems));
|
|
7260
|
+
}
|
|
7261
|
+
if (typeof schema.maxItems === "number") {
|
|
7262
|
+
zodSchema = zodSchema.check(z.maxLength(schema.maxItems));
|
|
7263
|
+
}
|
|
7264
|
+
} else if (items !== void 0) {
|
|
7265
|
+
const element = convertSchema(items, ctx);
|
|
7266
|
+
let arraySchema = z.array(element);
|
|
7267
|
+
if (typeof schema.minItems === "number") {
|
|
7268
|
+
arraySchema = arraySchema.min(schema.minItems);
|
|
7269
|
+
}
|
|
7270
|
+
if (typeof schema.maxItems === "number") {
|
|
7271
|
+
arraySchema = arraySchema.max(schema.maxItems);
|
|
7272
|
+
}
|
|
7273
|
+
zodSchema = arraySchema;
|
|
7274
|
+
} else {
|
|
7275
|
+
zodSchema = z.array(z.any());
|
|
7276
|
+
}
|
|
7277
|
+
break;
|
|
7278
|
+
}
|
|
7279
|
+
default:
|
|
7280
|
+
throw new Error(`Unsupported type: ${type}`);
|
|
7281
|
+
}
|
|
7282
|
+
if (schema.description) {
|
|
7283
|
+
zodSchema = zodSchema.describe(schema.description);
|
|
7284
|
+
}
|
|
7285
|
+
if (schema.default !== void 0) {
|
|
7286
|
+
zodSchema = zodSchema.default(schema.default);
|
|
7287
|
+
}
|
|
7288
|
+
return zodSchema;
|
|
7289
|
+
}
|
|
7290
|
+
function convertSchema(schema, ctx) {
|
|
7291
|
+
if (typeof schema === "boolean") {
|
|
7292
|
+
return schema ? z.any() : z.never();
|
|
7293
|
+
}
|
|
7294
|
+
let baseSchema = convertBaseSchema(schema, ctx);
|
|
7295
|
+
const hasExplicitType = schema.type || schema.enum !== void 0 || schema.const !== void 0;
|
|
7296
|
+
if (schema.anyOf && Array.isArray(schema.anyOf)) {
|
|
7297
|
+
const options = schema.anyOf.map((s) => convertSchema(s, ctx));
|
|
7298
|
+
const anyOfUnion = z.union(options);
|
|
7299
|
+
baseSchema = hasExplicitType ? z.intersection(baseSchema, anyOfUnion) : anyOfUnion;
|
|
7300
|
+
}
|
|
7301
|
+
if (schema.oneOf && Array.isArray(schema.oneOf)) {
|
|
7302
|
+
const options = schema.oneOf.map((s) => convertSchema(s, ctx));
|
|
7303
|
+
const oneOfUnion = z.xor(options);
|
|
7304
|
+
baseSchema = hasExplicitType ? z.intersection(baseSchema, oneOfUnion) : oneOfUnion;
|
|
7305
|
+
}
|
|
7306
|
+
if (schema.allOf && Array.isArray(schema.allOf)) {
|
|
7307
|
+
if (schema.allOf.length === 0) {
|
|
7308
|
+
baseSchema = hasExplicitType ? baseSchema : z.any();
|
|
7309
|
+
} else {
|
|
7310
|
+
let result = hasExplicitType ? baseSchema : convertSchema(schema.allOf[0], ctx);
|
|
7311
|
+
const startIdx = hasExplicitType ? 0 : 1;
|
|
7312
|
+
for (let i = startIdx; i < schema.allOf.length; i++) {
|
|
7313
|
+
result = z.intersection(result, convertSchema(schema.allOf[i], ctx));
|
|
7314
|
+
}
|
|
7315
|
+
baseSchema = result;
|
|
7316
|
+
}
|
|
7317
|
+
}
|
|
7318
|
+
if (schema.nullable === true && ctx.version === "openapi-3.0") {
|
|
7319
|
+
baseSchema = z.nullable(baseSchema);
|
|
7320
|
+
}
|
|
7321
|
+
if (schema.readOnly === true) {
|
|
7322
|
+
baseSchema = z.readonly(baseSchema);
|
|
7323
|
+
}
|
|
7324
|
+
const extraMeta = {};
|
|
7325
|
+
const coreMetadataKeys = ["$id", "id", "$comment", "$anchor", "$vocabulary", "$dynamicRef", "$dynamicAnchor"];
|
|
7326
|
+
for (const key of coreMetadataKeys) {
|
|
7327
|
+
if (key in schema) {
|
|
7328
|
+
extraMeta[key] = schema[key];
|
|
7329
|
+
}
|
|
7330
|
+
}
|
|
7331
|
+
const contentMetadataKeys = ["contentEncoding", "contentMediaType", "contentSchema"];
|
|
7332
|
+
for (const key of contentMetadataKeys) {
|
|
7333
|
+
if (key in schema) {
|
|
7334
|
+
extraMeta[key] = schema[key];
|
|
7335
|
+
}
|
|
7336
|
+
}
|
|
7337
|
+
for (const key of Object.keys(schema)) {
|
|
7338
|
+
if (!RECOGNIZED_KEYS.has(key)) {
|
|
7339
|
+
extraMeta[key] = schema[key];
|
|
7340
|
+
}
|
|
7341
|
+
}
|
|
7342
|
+
if (Object.keys(extraMeta).length > 0) {
|
|
7343
|
+
ctx.registry.add(baseSchema, extraMeta);
|
|
7344
|
+
}
|
|
7345
|
+
return baseSchema;
|
|
7346
|
+
}
|
|
7347
|
+
function fromJSONSchema(schema, params) {
|
|
7348
|
+
if (typeof schema === "boolean") {
|
|
7349
|
+
return schema ? z.any() : z.never();
|
|
7350
|
+
}
|
|
7351
|
+
const version2 = detectVersion(schema);
|
|
7352
|
+
const defs = schema.$defs || schema.definitions || {};
|
|
7353
|
+
const ctx = {
|
|
7354
|
+
version: version2,
|
|
7355
|
+
defs,
|
|
7356
|
+
refs: /* @__PURE__ */ new Map(),
|
|
7357
|
+
processing: /* @__PURE__ */ new Set(),
|
|
7358
|
+
rootSchema: schema,
|
|
7359
|
+
registry: globalRegistry
|
|
7360
|
+
};
|
|
7361
|
+
return convertSchema(schema, ctx);
|
|
7362
|
+
}
|
|
7363
|
+
config(en());
|
|
7364
|
+
const errorPatterns = [
|
|
7365
|
+
[/^Invalid input: expected \w+, received undefined$/, "This field is required"],
|
|
7366
|
+
[/^Invalid input: expected \w+, received null$/, "This field is required"],
|
|
7367
|
+
[/^Expected string, received/, "Invalid value"],
|
|
7368
|
+
[/^String must contain at least (\d+)/, "Must be at least $1 characters"],
|
|
7369
|
+
[/^Number must be greater than or equal to (\d+)/, "Minimum value is $1"],
|
|
7370
|
+
[/^Number must be less than or equal to (\d+)/, "Maximum value is $1"]
|
|
7371
|
+
];
|
|
7372
|
+
const formatError = (message) => {
|
|
7373
|
+
if (!message) return void 0;
|
|
7374
|
+
for (const [pattern, replacement] of errorPatterns) {
|
|
7375
|
+
if (pattern.test(message)) {
|
|
7376
|
+
return message.replace(pattern, replacement);
|
|
7377
|
+
}
|
|
7378
|
+
}
|
|
7379
|
+
return message;
|
|
7380
|
+
};
|
|
7381
|
+
const registerZodErrorMap = () => {
|
|
7382
|
+
config({
|
|
7383
|
+
customError: (issue2) => {
|
|
7384
|
+
if (issue2.code === "invalid_type" && issue2.received === "undefined") {
|
|
7385
|
+
return { message: "This field is required" };
|
|
7386
|
+
}
|
|
7387
|
+
if (issue2.code === "invalid_type" && issue2.received === "null") {
|
|
7388
|
+
return { message: "This field is required" };
|
|
7389
|
+
}
|
|
7390
|
+
if (issue2.code === "too_small") {
|
|
7391
|
+
const i = issue2;
|
|
7392
|
+
if (i.type === "string" && i.minimum === 1) {
|
|
7393
|
+
return { message: "This field is required" };
|
|
7394
|
+
}
|
|
7395
|
+
if (i.type === "string") {
|
|
7396
|
+
return { message: `Must be at least ${i.minimum} characters` };
|
|
7397
|
+
}
|
|
7398
|
+
}
|
|
7399
|
+
if (issue2.code === "too_big") {
|
|
7400
|
+
const i = issue2;
|
|
7401
|
+
if (i.type === "string") {
|
|
7402
|
+
return { message: `Must be at most ${i.maximum} characters` };
|
|
7403
|
+
}
|
|
7404
|
+
}
|
|
7405
|
+
return { message: issue2.message };
|
|
7406
|
+
}
|
|
7407
|
+
});
|
|
7408
|
+
};
|
|
7409
|
+
function findRenderer(registry2, uischema, schema) {
|
|
7410
|
+
let best = null;
|
|
7411
|
+
for (const entry of registry2) {
|
|
7412
|
+
const rank = entry.tester(uischema, schema);
|
|
7413
|
+
if (rank > -1 && (!best || rank > best.rank)) {
|
|
7414
|
+
best = { rank, renderer: entry.renderer };
|
|
7415
|
+
}
|
|
7416
|
+
}
|
|
7417
|
+
return best?.renderer ?? null;
|
|
7418
|
+
}
|
|
7419
|
+
const scopeToPath = (scope) => {
|
|
7420
|
+
if (!scope) return "";
|
|
7421
|
+
return scope.replace(/^#\//, "").split("/").filter((s) => s !== "properties").join(".");
|
|
7422
|
+
};
|
|
7423
|
+
const resolveSchema = (root, scope) => {
|
|
7424
|
+
const segments = scope.replace(/^#\//, "").split("/").filter(Boolean);
|
|
7425
|
+
return segments.reduce((acc, key) => acc?.[key], root);
|
|
7426
|
+
};
|
|
7427
|
+
const _hoisted_1$6 = {
|
|
7428
|
+
key: 1,
|
|
7429
|
+
class: "text-error text-xs"
|
|
7430
|
+
};
|
|
7431
|
+
const _sfc_main$f = /* @__PURE__ */ vue.defineComponent({
|
|
7432
|
+
__name: "Dispatch",
|
|
7433
|
+
props: {
|
|
7434
|
+
uischema: {},
|
|
7435
|
+
schema: {},
|
|
7436
|
+
pathPrefix: { default: void 0 }
|
|
7437
|
+
},
|
|
7438
|
+
setup(__props) {
|
|
7439
|
+
const props = __props;
|
|
7440
|
+
const registry2 = vue.inject("renderers");
|
|
7441
|
+
const rootSchema = vue.inject("rootSchema");
|
|
7442
|
+
const parentPrefix = vue.inject("pathPrefix", "");
|
|
7443
|
+
const effectivePrefix = props.pathPrefix ?? parentPrefix;
|
|
7444
|
+
if (props.pathPrefix !== void 0) {
|
|
7445
|
+
vue.provide("pathPrefix", effectivePrefix);
|
|
7446
|
+
}
|
|
7447
|
+
const resolved = vue.computed(() => {
|
|
7448
|
+
const u = props.uischema;
|
|
7449
|
+
if (!u.scope) return props.schema;
|
|
7450
|
+
const fromRoot = resolveSchema(rootSchema, u.scope);
|
|
7451
|
+
if (fromRoot) return fromRoot;
|
|
7452
|
+
return resolveSchema(props.schema, u.scope) ?? props.schema;
|
|
7453
|
+
});
|
|
7454
|
+
const renderer = vue.computed(
|
|
7455
|
+
() => findRenderer(registry2, props.uischema, resolved.value)
|
|
7456
|
+
);
|
|
7457
|
+
return (_ctx, _cache) => {
|
|
7458
|
+
return renderer.value ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(renderer.value), {
|
|
7459
|
+
key: 0,
|
|
7460
|
+
uischema: __props.uischema,
|
|
7461
|
+
schema: resolved.value
|
|
7462
|
+
}, null, 8, ["uischema", "schema"])) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$6, " No renderer for " + vue.toDisplayString(__props.uischema.scope ?? __props.uischema.type), 1));
|
|
7463
|
+
};
|
|
7464
|
+
}
|
|
7465
|
+
});
|
|
7466
|
+
const JsonFormComponentProperties = {
|
|
7467
|
+
/** Unique identifier used to namespace the form element. */
|
|
7468
|
+
id: { type: String, required: true },
|
|
7469
|
+
/** HTML name attribute for the form. */
|
|
7470
|
+
name: { type: String, default: "form" },
|
|
7471
|
+
/** JSON schema describing the shape of the form data. */
|
|
7472
|
+
schema: { type: Object, required: true },
|
|
7473
|
+
/** UI schema describing the layout and controls. */
|
|
7474
|
+
uiSchema: { type: Object, required: true },
|
|
7475
|
+
/** Disable all form controls. */
|
|
7476
|
+
disabled: { type: Boolean, default: false },
|
|
7477
|
+
/** Current form data object. */
|
|
7478
|
+
formData: { type: Object, default: () => ({}) },
|
|
7479
|
+
/** When validation errors are shown (`'onBlur'`, `'onChange'`, `'onSubmit'`, `'always'`). */
|
|
7480
|
+
errorMode: {
|
|
7481
|
+
type: String,
|
|
7482
|
+
default: "onChanges"
|
|
7483
|
+
}
|
|
7484
|
+
};
|
|
7485
|
+
const JsonFormComponentEmits = [
|
|
7486
|
+
/** Emitted when form data changes. */
|
|
7487
|
+
"change",
|
|
7488
|
+
/** Emitted on form submission. */
|
|
7489
|
+
"submit",
|
|
7490
|
+
/** Emitted when validation errors change. */
|
|
7491
|
+
"errors",
|
|
7492
|
+
/** Emitted when form validity changes. */
|
|
7493
|
+
"valid",
|
|
7494
|
+
/** Emitted when a custom renderer dispatches a form event. */
|
|
7495
|
+
"events"
|
|
7496
|
+
];
|
|
7497
|
+
const ERROR_MODE_KEY = /* @__PURE__ */ Symbol("errorMode");
|
|
7498
|
+
const FORM_SUBMITTED_KEY = /* @__PURE__ */ Symbol("formSubmitted");
|
|
7499
|
+
const _hoisted_1$5 = { class: "flex-1" };
|
|
7500
|
+
const _hoisted_2$1 = { key: 0 };
|
|
7501
|
+
const _hoisted_3 = {
|
|
7502
|
+
key: 0,
|
|
7503
|
+
class: "text-sm text-base-content/50"
|
|
7504
|
+
};
|
|
7505
|
+
const _hoisted_4 = { key: 1 };
|
|
7506
|
+
const _sfc_main$e = /* @__PURE__ */ vue.defineComponent({
|
|
7507
|
+
__name: "ArrayRenderer",
|
|
7508
|
+
props: {
|
|
7509
|
+
uischema: {},
|
|
7510
|
+
schema: {}
|
|
7511
|
+
},
|
|
7512
|
+
setup(__props) {
|
|
7513
|
+
const props = __props;
|
|
7514
|
+
const parentPrefix = vue.inject("pathPrefix", "");
|
|
7515
|
+
const scope = props.uischema.scope;
|
|
7516
|
+
const scopePath = scopeToPath(scope);
|
|
7517
|
+
const path = parentPrefix ? `${parentPrefix}.${scopePath}` : scopePath;
|
|
7518
|
+
const rootSchema = vue.inject("rootSchema");
|
|
7519
|
+
const arraySchema = resolveSchema(rootSchema, scope);
|
|
7520
|
+
const itemSchema = arraySchema?.items ?? {};
|
|
7521
|
+
const { fields, push, remove } = veeValidate.useFieldArray(path);
|
|
7522
|
+
if (fields.value.length === 0) {
|
|
7523
|
+
push({});
|
|
7524
|
+
}
|
|
7525
|
+
const opts = props.uischema.options ?? {};
|
|
7526
|
+
const layout = opts.layout ?? "column";
|
|
7527
|
+
const showActions = vue.computed(() => !opts.hideActions);
|
|
7528
|
+
const detail = vue.computed(
|
|
7529
|
+
() => props.uischema._detail ?? opts.detail
|
|
7530
|
+
);
|
|
7531
|
+
const childElements = vue.computed(() => {
|
|
7532
|
+
if (!detail.value) {
|
|
7533
|
+
return props.uischema.elements ?? [];
|
|
7534
|
+
}
|
|
7535
|
+
const type = detail.value.type;
|
|
7536
|
+
if (type && type !== "Control") {
|
|
7537
|
+
return [detail.value];
|
|
7538
|
+
}
|
|
7539
|
+
return detail.value.elements ?? [detail.value];
|
|
7540
|
+
});
|
|
7541
|
+
return (_ctx, _cache) => {
|
|
7542
|
+
return vue.openBlock(), vue.createElementBlock("div", null, [
|
|
7543
|
+
vue.createElementVNode("div", {
|
|
7544
|
+
class: vue.normalizeClass([
|
|
7545
|
+
"flex gap-2",
|
|
7546
|
+
vue.unref(layout) === "row" ? "flex-row items-center" : "flex-col"
|
|
7547
|
+
])
|
|
7548
|
+
}, [
|
|
7549
|
+
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(fields), (entry, index2) => {
|
|
7550
|
+
return vue.openBlock(), vue.createElementBlock("div", {
|
|
7551
|
+
key: entry.key,
|
|
7552
|
+
class: "flex-1"
|
|
7553
|
+
}, [
|
|
7554
|
+
vue.createElementVNode("div", {
|
|
7555
|
+
class: vue.normalizeClass([
|
|
7556
|
+
"flex gap-2",
|
|
7557
|
+
vue.unref(layout) === "row" ? "flex-col" : "flex-row items-center"
|
|
7558
|
+
])
|
|
7559
|
+
}, [
|
|
7560
|
+
vue.createElementVNode("div", _hoisted_1$5, [
|
|
7561
|
+
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(childElements.value, (child, ci) => {
|
|
7562
|
+
return vue.openBlock(), vue.createBlock(_sfc_main$f, {
|
|
7563
|
+
key: ci,
|
|
7564
|
+
uischema: child,
|
|
7565
|
+
schema: vue.unref(itemSchema),
|
|
7566
|
+
"path-prefix": `${vue.unref(path)}[${index2}]`
|
|
7567
|
+
}, null, 8, ["uischema", "schema", "path-prefix"]);
|
|
7568
|
+
}), 128))
|
|
7569
|
+
]),
|
|
7570
|
+
showActions.value ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_2$1, [
|
|
7571
|
+
vue.unref(fields).length > 1 ? (vue.openBlock(), vue.createBlock(vue.unref(ui.Btn), {
|
|
7572
|
+
key: 0,
|
|
7573
|
+
icon: vue.unref(ui.IconEnum).Delete,
|
|
7574
|
+
outline: true,
|
|
7575
|
+
onClick: ($event) => vue.unref(remove)(index2)
|
|
7576
|
+
}, null, 8, ["icon", "onClick"])) : vue.createCommentVNode("", true)
|
|
7577
|
+
])) : vue.createCommentVNode("", true)
|
|
7578
|
+
], 2)
|
|
7579
|
+
]);
|
|
7580
|
+
}), 128)),
|
|
7581
|
+
vue.unref(fields).length === 0 ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_3, " No data ")) : vue.createCommentVNode("", true),
|
|
7582
|
+
showActions.value ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_4, [
|
|
7583
|
+
vue.createVNode(vue.unref(ui.Btn), {
|
|
7584
|
+
icon: vue.unref(ui.IconEnum).Plus,
|
|
7585
|
+
outline: true,
|
|
7586
|
+
onClick: _cache[0] || (_cache[0] = ($event) => vue.unref(push)({}))
|
|
7587
|
+
}, {
|
|
7588
|
+
default: vue.withCtx(() => [..._cache[1] || (_cache[1] = [
|
|
7589
|
+
vue.createTextVNode(" Add ", -1)
|
|
7590
|
+
])]),
|
|
7591
|
+
_: 1
|
|
7592
|
+
}, 8, ["icon"])
|
|
7593
|
+
])) : vue.createCommentVNode("", true)
|
|
7594
|
+
], 2)
|
|
7595
|
+
]);
|
|
7596
|
+
};
|
|
7597
|
+
}
|
|
7598
|
+
});
|
|
7599
|
+
const isAutoCompleteControl = testers.and(
|
|
7600
|
+
// uiTypeIs('Control'),
|
|
7601
|
+
testers.optionIs("format", jsonFormsCore.ControlType.autocomplete)
|
|
7602
|
+
);
|
|
7603
|
+
const isTextAreaControl = testers.and(
|
|
7604
|
+
core$1.uiTypeIs("Control"),
|
|
7605
|
+
testers.optionIs("format", jsonFormsCore.ControlType.textArea)
|
|
7606
|
+
);
|
|
7607
|
+
const isStringFormat = testers.and(
|
|
7608
|
+
core$1.uiTypeIs("Control"),
|
|
7609
|
+
testers.or(testers.optionIs("format", jsonFormsCore.ControlType.string), testers.schemaTypeIs("string"))
|
|
7610
|
+
);
|
|
7611
|
+
const isMarkdownControl = testers.and(
|
|
7612
|
+
core$1.uiTypeIs("Control"),
|
|
7613
|
+
testers.optionIs("format", jsonFormsCore.ControlType.markdown)
|
|
7614
|
+
);
|
|
7615
|
+
const isArrayRenderer = testers.and(
|
|
7616
|
+
testers.schemaTypeIs("array")
|
|
7617
|
+
// optionIs('format', ControlType.array),
|
|
7618
|
+
);
|
|
7619
|
+
const isMultiselectControl = testers.and(
|
|
7620
|
+
core$1.uiTypeIs("Control"),
|
|
7621
|
+
testers.optionIs("format", jsonFormsCore.ControlType.mutliSelect)
|
|
7622
|
+
);
|
|
7623
|
+
const isSelectControl = testers.and(
|
|
7624
|
+
core$1.uiTypeIs("Control"),
|
|
7625
|
+
testers.optionIs("format", jsonFormsCore.ControlType.select)
|
|
7626
|
+
);
|
|
7627
|
+
const isBooleanControl = testers.or(
|
|
7628
|
+
testers.isBooleanControl,
|
|
7629
|
+
testers.and(core$1.uiTypeIs("Control"), testers.optionIs("format", jsonFormsCore.ControlType.boolean))
|
|
7630
|
+
);
|
|
7631
|
+
const isNumberFormat = testers.and(
|
|
7632
|
+
core$1.uiTypeIs("Control"),
|
|
7633
|
+
testers.or(testers.optionIs("format", jsonFormsCore.ControlType.number), testers.schemaTypeIs("number"))
|
|
7634
|
+
);
|
|
7635
|
+
const isIntegerFormat = testers.and(
|
|
7636
|
+
core$1.uiTypeIs("Control"),
|
|
7637
|
+
testers.or(testers.optionIs("format", jsonFormsCore.ControlType.integer), testers.schemaTypeIs("integer"))
|
|
7638
|
+
);
|
|
7639
|
+
const arrayRenderers = [
|
|
7640
|
+
{ tester: core$1.rankWith(12, isArrayRenderer), renderer: _sfc_main$e }
|
|
7641
|
+
];
|
|
7642
|
+
const MethodSchema = _enum(["get", "post", "delete", "put", "patch"]);
|
|
7643
|
+
const OperationSchema = object({
|
|
7644
|
+
uri: string(),
|
|
7645
|
+
method: MethodSchema
|
|
7646
|
+
});
|
|
7647
|
+
const OperationsSchema = string().or(OperationSchema);
|
|
7648
|
+
const BooleanOperationSchema = boolean().or(OperationSchema).optional().default(false);
|
|
7649
|
+
const Operations = object({
|
|
7650
|
+
findAll: BooleanOperationSchema,
|
|
7651
|
+
findOne: BooleanOperationSchema,
|
|
7652
|
+
create: BooleanOperationSchema,
|
|
7653
|
+
update: BooleanOperationSchema,
|
|
7654
|
+
delete: BooleanOperationSchema,
|
|
7655
|
+
lookup: OperationsSchema.optional()
|
|
7656
|
+
});
|
|
7657
|
+
const OperationMap = {
|
|
7658
|
+
create: "post",
|
|
7659
|
+
delete: "delete",
|
|
7660
|
+
findAll: "get",
|
|
7661
|
+
findOne: "get",
|
|
7662
|
+
lookup: "get",
|
|
7663
|
+
update: "get"
|
|
7664
|
+
};
|
|
7665
|
+
const ResourceSchema = object({
|
|
7666
|
+
id: string(),
|
|
7667
|
+
uri: string(),
|
|
7668
|
+
operations: Operations,
|
|
7669
|
+
schema: object({
|
|
7670
|
+
ui: any().optional(),
|
|
7671
|
+
data: any()
|
|
7672
|
+
}).optional()
|
|
7673
|
+
}).transform((data) => {
|
|
7674
|
+
const schema = data.schema;
|
|
7675
|
+
if (schema) {
|
|
7676
|
+
if (!schema.ui) {
|
|
7677
|
+
schema.ui = jsonFormsCore.uiFromJsonSchema(schema.data);
|
|
7678
|
+
}
|
|
7679
|
+
}
|
|
7680
|
+
const operations = {};
|
|
7681
|
+
for (const k in OperationMap) {
|
|
7682
|
+
const key = k;
|
|
7683
|
+
const defaultOperation = OperationMap[key];
|
|
7684
|
+
const operation = data.operations[key];
|
|
7685
|
+
const mapResourceSchema = () => {
|
|
7686
|
+
if (lodashEs.isUndefined(operation) || operation === false) return null;
|
|
7687
|
+
if (operation === true)
|
|
7688
|
+
return { uri: data.uri, method: defaultOperation };
|
|
7689
|
+
if (typeof operation === "string")
|
|
7690
|
+
return { uri: operation, method: "get" };
|
|
7691
|
+
return {
|
|
7692
|
+
uri: operation.uri,
|
|
7693
|
+
method: operation.method ?? defaultOperation
|
|
7694
|
+
};
|
|
7695
|
+
};
|
|
7696
|
+
operations[key] = mapResourceSchema();
|
|
7697
|
+
}
|
|
7698
|
+
return {
|
|
7699
|
+
...data,
|
|
7700
|
+
schema,
|
|
7701
|
+
operations
|
|
7702
|
+
};
|
|
7703
|
+
});
|
|
7704
|
+
const getResourceSchema = async (resourceUri, skipAuth) => {
|
|
7705
|
+
const fetch = skipAuth ? axios : toolsVue.useApi();
|
|
7706
|
+
return fetch.get(resourceUri).then((response) => {
|
|
7707
|
+
const resource = ResourceSchema.safeParse(response.data);
|
|
7708
|
+
if (!resource.success)
|
|
7709
|
+
throw new Error(`Invalid resource schema: ${resource.error}`);
|
|
7710
|
+
return resource.data;
|
|
7711
|
+
});
|
|
7712
|
+
};
|
|
7713
|
+
const useRemoteOption = (options) => {
|
|
7714
|
+
return {
|
|
7715
|
+
fetchOptions: (searchTerm, signal) => {
|
|
7716
|
+
const fetch = options.skipAuth ? axios : toolsVue.useApi();
|
|
7717
|
+
return fetch.get(`${options.uri}${searchTerm}`, { signal }).then((data) => data.data[options.dataField ?? "data"]);
|
|
7718
|
+
}
|
|
7719
|
+
};
|
|
7720
|
+
};
|
|
7721
|
+
const useResourceOptions = async (options) => {
|
|
7722
|
+
const resource = await getResourceSchema(
|
|
7723
|
+
options.resource,
|
|
7724
|
+
options.skipAuth ?? false
|
|
7725
|
+
);
|
|
7726
|
+
const fetch = options.skipAuth ? axios : toolsVue.useApi();
|
|
7727
|
+
const lookup = resource.operations.lookup;
|
|
7728
|
+
return {
|
|
7729
|
+
fetchOptions: (searchTerm, signal) => {
|
|
7730
|
+
const uri = lookup.uri.replace("{text}", searchTerm);
|
|
7731
|
+
const method = lookup.method;
|
|
7732
|
+
return fetch[method](uri, { signal }).then(
|
|
7733
|
+
(data) => data.data[options.dataField ?? "data"]
|
|
7734
|
+
);
|
|
7735
|
+
},
|
|
7736
|
+
enableCreate: !!resource.operations.create,
|
|
7737
|
+
form: resource.operations.create ? {
|
|
7738
|
+
ui_schema: resource.schema.ui,
|
|
7739
|
+
json_schema: resource.schema.data,
|
|
7740
|
+
title: `Create new ${resource.id}`,
|
|
7741
|
+
create: async (data) => {
|
|
7742
|
+
const create = resource.operations.create;
|
|
7743
|
+
return fetch[create.method](create.uri, data).then(
|
|
7744
|
+
(result) => result.data
|
|
7745
|
+
);
|
|
7746
|
+
}
|
|
7747
|
+
} : null
|
|
7748
|
+
};
|
|
7749
|
+
};
|
|
7750
|
+
const useFetchOptions = async (options) => {
|
|
7751
|
+
let config2 = {};
|
|
7752
|
+
if (options.uri)
|
|
7753
|
+
config2 = useRemoteOption(options);
|
|
7754
|
+
if (options.resource)
|
|
7755
|
+
config2 = await useResourceOptions(options);
|
|
7756
|
+
return {
|
|
7757
|
+
fetchOptions: null,
|
|
7758
|
+
labelKey: options.labelKey,
|
|
7759
|
+
valueKey: options.valueKey,
|
|
7760
|
+
enableCreate: options.enableCreate ?? false,
|
|
7761
|
+
form: null,
|
|
7762
|
+
...config2
|
|
7763
|
+
};
|
|
7764
|
+
};
|
|
7765
|
+
const checkRequired = (rootSchema, scope, fieldName) => {
|
|
7766
|
+
const segments = scope.replace(/^#\//, "").split("/");
|
|
7767
|
+
const parentSegments = segments.slice(0, -2);
|
|
7768
|
+
if (parentSegments.length === 0) {
|
|
7769
|
+
const req2 = rootSchema?.required;
|
|
7770
|
+
return Array.isArray(req2) && req2.includes(fieldName);
|
|
7771
|
+
}
|
|
7772
|
+
const parentScope = `#/${parentSegments.join("/")}`;
|
|
7773
|
+
const parentSchema = resolveSchema(rootSchema, parentScope);
|
|
7774
|
+
const req = parentSchema?.required;
|
|
7775
|
+
return Array.isArray(req) && req.includes(fieldName);
|
|
7776
|
+
};
|
|
7777
|
+
const useInputProps = (uischema, schema, field, options = {}) => {
|
|
7778
|
+
const rootSchema = vue.inject("rootSchema");
|
|
7779
|
+
const path = scopeToPath(uischema.scope);
|
|
7780
|
+
const { errorMessage, meta: meta2 } = field;
|
|
7781
|
+
const opts = uischema.options ?? {};
|
|
7782
|
+
const labelFromScope = path.split(".").pop() ?? "";
|
|
7783
|
+
const isRequired = rootSchema ? checkRequired(rootSchema, uischema.scope, labelFromScope) : false;
|
|
7784
|
+
const s = schema ?? {};
|
|
7785
|
+
const inferredType = (() => {
|
|
7786
|
+
if (opts.format === "text") return "text";
|
|
7787
|
+
if (s.format === "email") return "email";
|
|
7788
|
+
if (s.format === "uri") return "url";
|
|
7789
|
+
if (s.type === "number" || s.type === "integer") return "number";
|
|
7790
|
+
return options.defaultType ?? "text";
|
|
7791
|
+
})();
|
|
7792
|
+
const styles = ui.mergeStyles(opts.styles);
|
|
7793
|
+
const errorMode = vue.inject(ERROR_MODE_KEY, vue.ref("onBlur"));
|
|
7794
|
+
const submitted = vue.inject(FORM_SUBMITTED_KEY, vue.ref(false));
|
|
7795
|
+
const shouldShowError = vue.computed(() => {
|
|
7796
|
+
if (!errorMessage.value) return false;
|
|
7797
|
+
switch (errorMode.value) {
|
|
7798
|
+
case "always":
|
|
7799
|
+
return true;
|
|
7800
|
+
case "onChange":
|
|
7801
|
+
return meta2.dirty;
|
|
7802
|
+
case "onSubmit":
|
|
7803
|
+
return submitted.value;
|
|
7804
|
+
case "onBlur":
|
|
7805
|
+
default:
|
|
7806
|
+
return meta2.touched;
|
|
7807
|
+
}
|
|
7808
|
+
});
|
|
7809
|
+
const width = opts.colspan || styles?.width === "full" ? "w-full" : opts.width ?? "min-w-input";
|
|
7810
|
+
return vue.computed(() => ({
|
|
7811
|
+
id: path,
|
|
7812
|
+
placeholder: opts.placeholder,
|
|
7813
|
+
description: s.description,
|
|
7814
|
+
errors: shouldShowError.value ? opts.errorMessage ?? formatError(errorMessage.value) : void 0,
|
|
7815
|
+
label: opts.label ?? labelFromScope.charAt(0).toUpperCase() + labelFromScope.slice(1),
|
|
7816
|
+
visible: opts.visible ?? true,
|
|
7817
|
+
required: isRequired,
|
|
7818
|
+
enabled: opts.readonly !== true,
|
|
7819
|
+
isFocused: false,
|
|
7820
|
+
isTouched: shouldShowError.value,
|
|
7821
|
+
hideLabel: opts.hideLabel ?? false,
|
|
7822
|
+
styles,
|
|
7823
|
+
width,
|
|
7824
|
+
type: inferredType,
|
|
7825
|
+
...options.overrides
|
|
7826
|
+
}));
|
|
7827
|
+
};
|
|
7828
|
+
const useCustomControlBinding = ({
|
|
7829
|
+
useProps,
|
|
7830
|
+
setDefaultValue
|
|
7831
|
+
} = {}) => {
|
|
7832
|
+
return (uischema, schema, options = {}) => {
|
|
7833
|
+
const pathPrefix = vue.inject("pathPrefix", "");
|
|
7834
|
+
const scopePath = scopeToPath(uischema.scope);
|
|
7835
|
+
const path = pathPrefix ? `${pathPrefix}.${scopePath}` : scopePath;
|
|
7836
|
+
const field = veeValidate.useField(() => path);
|
|
7837
|
+
setDefaultValue?.(field);
|
|
7838
|
+
const wrapper = useInputProps(uischema, schema, field, options);
|
|
7839
|
+
const customWrapper = useProps?.(uischema, schema, field, options) ?? {
|
|
7840
|
+
value: {}
|
|
7841
|
+
};
|
|
7842
|
+
const onBlur = () => field.handleBlur(new Event("blur"));
|
|
7843
|
+
const onChange = () => field.handleChange(field.value.value);
|
|
7844
|
+
let initialized = false;
|
|
7845
|
+
vue.watch(field.value, (val) => {
|
|
7846
|
+
if (!initialized) {
|
|
7847
|
+
initialized = true;
|
|
7848
|
+
return;
|
|
7962
7849
|
}
|
|
7963
|
-
|
|
7850
|
+
field.handleChange(val);
|
|
7851
|
+
});
|
|
7852
|
+
return {
|
|
7853
|
+
wrapper: vue.computed(() => ({ ...wrapper.value, ...customWrapper.value })),
|
|
7854
|
+
value: field.value,
|
|
7855
|
+
field,
|
|
7856
|
+
onBlur,
|
|
7857
|
+
onChange,
|
|
7858
|
+
appliedOptions: vue.computed(
|
|
7859
|
+
() => uischema.options ?? {}
|
|
7860
|
+
)
|
|
7861
|
+
};
|
|
7862
|
+
};
|
|
7863
|
+
};
|
|
7864
|
+
const useControlBinding = (uischema, schema, options = {}) => {
|
|
7865
|
+
return useCustomControlBinding()(uischema, schema, options);
|
|
7866
|
+
};
|
|
7867
|
+
const useSelectInput = (...fields) => (uischema, schema, field) => {
|
|
7868
|
+
const opts = uischema.options ?? {};
|
|
7869
|
+
return vue.computed(() => {
|
|
7870
|
+
return lodashEs.pick(opts, fields);
|
|
7871
|
+
});
|
|
7872
|
+
};
|
|
7873
|
+
const useSelectBinding = useCustomControlBinding({
|
|
7874
|
+
useProps: useSelectInput("options", "labelKey", "valueKey")
|
|
7875
|
+
});
|
|
7876
|
+
const useAutocompleteBinding = useCustomControlBinding({
|
|
7877
|
+
useProps: useSelectInput(
|
|
7878
|
+
"options",
|
|
7879
|
+
"labelKey",
|
|
7880
|
+
"valueKey",
|
|
7881
|
+
"uri",
|
|
7882
|
+
"freeText",
|
|
7883
|
+
"enableCreate",
|
|
7884
|
+
"dataField",
|
|
7885
|
+
"skipAuth"
|
|
7886
|
+
)
|
|
7887
|
+
});
|
|
7888
|
+
const _sfc_main$d = /* @__PURE__ */ vue.defineComponent({
|
|
7889
|
+
__name: "FormModal",
|
|
7890
|
+
props: /* @__PURE__ */ vue.mergeModels(FormModalProperties, {
|
|
7891
|
+
"modelValue": {},
|
|
7892
|
+
"modelModifiers": {}
|
|
7893
|
+
}),
|
|
7894
|
+
emits: /* @__PURE__ */ vue.mergeModels(FormModalEmits, ["update:modelValue"]),
|
|
7895
|
+
setup(__props, { emit: __emit }) {
|
|
7896
|
+
const properties = __props;
|
|
7897
|
+
const id = `modal_${Math.floor(Math.random() * 1e3)}`;
|
|
7898
|
+
const formRef = vue.ref();
|
|
7899
|
+
const valid = vue.ref(false);
|
|
7900
|
+
const formData = vue.useModel(__props, "modelValue");
|
|
7901
|
+
const emits = __emit;
|
|
7902
|
+
if (properties.data) {
|
|
7903
|
+
formData.value = properties.data;
|
|
7964
7904
|
}
|
|
7965
|
-
|
|
7966
|
-
|
|
7967
|
-
|
|
7968
|
-
|
|
7969
|
-
|
|
7970
|
-
|
|
7971
|
-
|
|
7972
|
-
|
|
7973
|
-
|
|
7974
|
-
|
|
7975
|
-
|
|
7976
|
-
|
|
7977
|
-
|
|
7978
|
-
|
|
7979
|
-
|
|
7980
|
-
|
|
7981
|
-
|
|
7982
|
-
|
|
7983
|
-
|
|
7984
|
-
const rest = schema.additionalItems && typeof schema.additionalItems === "object" ? convertSchema(schema.additionalItems, ctx) : void 0;
|
|
7985
|
-
if (rest) {
|
|
7986
|
-
zodSchema = z.tuple(tupleItems).rest(rest);
|
|
7987
|
-
} else {
|
|
7988
|
-
zodSchema = z.tuple(tupleItems);
|
|
7989
|
-
}
|
|
7990
|
-
if (typeof schema.minItems === "number") {
|
|
7991
|
-
zodSchema = zodSchema.check(z.minLength(schema.minItems));
|
|
7992
|
-
}
|
|
7993
|
-
if (typeof schema.maxItems === "number") {
|
|
7994
|
-
zodSchema = zodSchema.check(z.maxLength(schema.maxItems));
|
|
7995
|
-
}
|
|
7996
|
-
} else if (items !== void 0) {
|
|
7997
|
-
const element = convertSchema(items, ctx);
|
|
7998
|
-
let arraySchema = z.array(element);
|
|
7999
|
-
if (typeof schema.minItems === "number") {
|
|
8000
|
-
arraySchema = arraySchema.min(schema.minItems);
|
|
8001
|
-
}
|
|
8002
|
-
if (typeof schema.maxItems === "number") {
|
|
8003
|
-
arraySchema = arraySchema.max(schema.maxItems);
|
|
8004
|
-
}
|
|
8005
|
-
zodSchema = arraySchema;
|
|
8006
|
-
} else {
|
|
8007
|
-
zodSchema = z.array(z.any());
|
|
7905
|
+
const onCancel = () => {
|
|
7906
|
+
formData.value = {};
|
|
7907
|
+
emits("closeModal", null);
|
|
7908
|
+
};
|
|
7909
|
+
const onChange = (data) => {
|
|
7910
|
+
formData.value = data;
|
|
7911
|
+
};
|
|
7912
|
+
const onSubmit = () => {
|
|
7913
|
+
formRef.value?.markSubmitted();
|
|
7914
|
+
if (!valid.value) return;
|
|
7915
|
+
emits("closeModal", { data: formData.value, valid: valid.value });
|
|
7916
|
+
};
|
|
7917
|
+
const onErrors = (errors) => {
|
|
7918
|
+
emits("errors", errors);
|
|
7919
|
+
valid.value = lodashEs.isEmpty(errors);
|
|
7920
|
+
};
|
|
7921
|
+
vue.watch(valid, (newValid, oldValid) => {
|
|
7922
|
+
if (newValid !== oldValid) {
|
|
7923
|
+
emits("valid", newValid);
|
|
8008
7924
|
}
|
|
8009
|
-
|
|
8010
|
-
|
|
8011
|
-
|
|
8012
|
-
|
|
8013
|
-
|
|
8014
|
-
|
|
8015
|
-
|
|
7925
|
+
});
|
|
7926
|
+
return (_ctx, _cache) => {
|
|
7927
|
+
return vue.openBlock(), vue.createBlock(vue.unref(ui.Modal), vue.mergeProps(properties, {
|
|
7928
|
+
open: true,
|
|
7929
|
+
"disable-close": false,
|
|
7930
|
+
width: _ctx.modalSize,
|
|
7931
|
+
onCloseModal: onCancel
|
|
7932
|
+
}), {
|
|
7933
|
+
content: vue.withCtx(() => [
|
|
7934
|
+
vue.renderSlot(_ctx.$slots, "content-before"),
|
|
7935
|
+
vue.createVNode(_sfc_main$2, {
|
|
7936
|
+
id: `modal-${id}`,
|
|
7937
|
+
ref_key: "formRef",
|
|
7938
|
+
ref: formRef,
|
|
7939
|
+
"form-data": formData.value,
|
|
7940
|
+
schema: _ctx.schema,
|
|
7941
|
+
"ui-schema": _ctx.uiSchema,
|
|
7942
|
+
"error-mode": _ctx.errorMode,
|
|
7943
|
+
onErrors,
|
|
7944
|
+
onChange,
|
|
7945
|
+
onEvents: _cache[0] || (_cache[0] = ($event) => emits("events", $event))
|
|
7946
|
+
}, null, 8, ["id", "form-data", "schema", "ui-schema", "error-mode"]),
|
|
7947
|
+
vue.renderSlot(_ctx.$slots, "content-after")
|
|
7948
|
+
]),
|
|
7949
|
+
actions: vue.withCtx(() => [
|
|
7950
|
+
vue.createVNode(vue.unref(ui.Btn), {
|
|
7951
|
+
color: vue.unref(ui.Color).secondary,
|
|
7952
|
+
outline: true,
|
|
7953
|
+
"aria-label": "Cancel",
|
|
7954
|
+
onClick: onCancel
|
|
7955
|
+
}, {
|
|
7956
|
+
default: vue.withCtx(() => [..._cache[1] || (_cache[1] = [
|
|
7957
|
+
vue.createTextVNode(" Cancel ", -1)
|
|
7958
|
+
])]),
|
|
7959
|
+
_: 1
|
|
7960
|
+
}, 8, ["color"]),
|
|
7961
|
+
vue.createVNode(vue.unref(ui.Btn), {
|
|
7962
|
+
disabled: !valid.value,
|
|
7963
|
+
"aria-label": "Save",
|
|
7964
|
+
onClick: onSubmit
|
|
7965
|
+
}, {
|
|
7966
|
+
default: vue.withCtx(() => [..._cache[2] || (_cache[2] = [
|
|
7967
|
+
vue.createTextVNode(" Save ", -1)
|
|
7968
|
+
])]),
|
|
7969
|
+
_: 1
|
|
7970
|
+
}, 8, ["disabled"])
|
|
7971
|
+
]),
|
|
7972
|
+
_: 3
|
|
7973
|
+
}, 16, ["width"]);
|
|
7974
|
+
};
|
|
8016
7975
|
}
|
|
8017
|
-
|
|
8018
|
-
|
|
7976
|
+
});
|
|
7977
|
+
class JsonFormModalService {
|
|
7978
|
+
static openModal({
|
|
7979
|
+
initialData,
|
|
7980
|
+
modalTitle,
|
|
7981
|
+
schema,
|
|
7982
|
+
uiSchema,
|
|
7983
|
+
modalSize,
|
|
7984
|
+
onClose,
|
|
7985
|
+
onEvents
|
|
7986
|
+
}) {
|
|
7987
|
+
ui.ModalService.openModal({
|
|
7988
|
+
component: _sfc_main$d,
|
|
7989
|
+
props: {
|
|
7990
|
+
schema,
|
|
7991
|
+
uiSchema,
|
|
7992
|
+
modalSize,
|
|
7993
|
+
data: initialData ?? {},
|
|
7994
|
+
modalTitle,
|
|
7995
|
+
onClose,
|
|
7996
|
+
onEvents
|
|
7997
|
+
}
|
|
7998
|
+
});
|
|
8019
7999
|
}
|
|
8020
|
-
return zodSchema;
|
|
8021
8000
|
}
|
|
8022
|
-
|
|
8023
|
-
|
|
8024
|
-
|
|
8001
|
+
const _sfc_main$c = /* @__PURE__ */ vue.defineComponent({
|
|
8002
|
+
__name: "AutocompleteControlRenderer",
|
|
8003
|
+
props: {
|
|
8004
|
+
uischema: {},
|
|
8005
|
+
schema: {}
|
|
8006
|
+
},
|
|
8007
|
+
setup(__props) {
|
|
8008
|
+
const props = __props;
|
|
8009
|
+
const {
|
|
8010
|
+
wrapper,
|
|
8011
|
+
value,
|
|
8012
|
+
field,
|
|
8013
|
+
onBlur,
|
|
8014
|
+
onChange: onFieldChange,
|
|
8015
|
+
appliedOptions
|
|
8016
|
+
} = useAutocompleteBinding(props.uischema, props.schema);
|
|
8017
|
+
const fetchOptions = core.computedAsync(async () => {
|
|
8018
|
+
const config2 = await useFetchOptions(
|
|
8019
|
+
appliedOptions.value
|
|
8020
|
+
);
|
|
8021
|
+
return config2;
|
|
8022
|
+
});
|
|
8023
|
+
const onChange = (val) => {
|
|
8024
|
+
field.setValue(val);
|
|
8025
|
+
onFieldChange();
|
|
8026
|
+
};
|
|
8027
|
+
const formEvents = useFormEvents();
|
|
8028
|
+
const path = scopeToPath(props.uischema.scope);
|
|
8029
|
+
const onCreate = () => {
|
|
8030
|
+
if (fetchOptions.value?.enableCreate === false) return;
|
|
8031
|
+
const form = fetchOptions.value.form;
|
|
8032
|
+
if (form) {
|
|
8033
|
+
JsonFormModalService.openModal({
|
|
8034
|
+
schema: form.json_schema,
|
|
8035
|
+
uiSchema: form.ui_schema,
|
|
8036
|
+
modalTitle: `Create new ${wrapper.value.label}`,
|
|
8037
|
+
onClose: (result) => {
|
|
8038
|
+
if (!result || !result.valid) return;
|
|
8039
|
+
form.create(result.data).then((res) => {
|
|
8040
|
+
field.setValue(res);
|
|
8041
|
+
});
|
|
8042
|
+
}
|
|
8043
|
+
});
|
|
8044
|
+
return;
|
|
8045
|
+
}
|
|
8046
|
+
formEvents.dispatch({
|
|
8047
|
+
event: "create",
|
|
8048
|
+
type: path,
|
|
8049
|
+
data: value.value,
|
|
8050
|
+
onSuccess: (result) => {
|
|
8051
|
+
field.setValue(result);
|
|
8052
|
+
}
|
|
8053
|
+
});
|
|
8054
|
+
};
|
|
8055
|
+
return (_ctx, _cache) => {
|
|
8056
|
+
return vue.unref(fetchOptions) ? (vue.openBlock(), vue.createBlock(vue.unref(ui.Autocomplete), vue.mergeProps({ key: 0 }, vue.unref(wrapper), {
|
|
8057
|
+
"model-value": vue.unref(value),
|
|
8058
|
+
"fetch-options": vue.unref(fetchOptions).fetchOptions,
|
|
8059
|
+
"label-key": vue.unref(fetchOptions).labelKey,
|
|
8060
|
+
"value-key": vue.unref(fetchOptions).valueKey,
|
|
8061
|
+
"enable-create": vue.unref(fetchOptions).enableCreate,
|
|
8062
|
+
onChange,
|
|
8063
|
+
onBlur: vue.unref(onBlur),
|
|
8064
|
+
onCreate
|
|
8065
|
+
}), null, 16, ["model-value", "fetch-options", "label-key", "value-key", "enable-create", "onBlur"])) : vue.createCommentVNode("", true);
|
|
8066
|
+
};
|
|
8025
8067
|
}
|
|
8026
|
-
|
|
8027
|
-
|
|
8028
|
-
|
|
8029
|
-
|
|
8030
|
-
|
|
8031
|
-
|
|
8068
|
+
});
|
|
8069
|
+
const _sfc_main$b = /* @__PURE__ */ vue.defineComponent({
|
|
8070
|
+
__name: "BooleanControlRenderer",
|
|
8071
|
+
props: {
|
|
8072
|
+
uischema: {},
|
|
8073
|
+
schema: {}
|
|
8074
|
+
},
|
|
8075
|
+
setup(__props) {
|
|
8076
|
+
const props = __props;
|
|
8077
|
+
const useBooleanBinding = useCustomControlBinding({
|
|
8078
|
+
setDefaultValue: (field2) => {
|
|
8079
|
+
if (field2.value.value === void 0) field2.setValue(false);
|
|
8080
|
+
}
|
|
8081
|
+
});
|
|
8082
|
+
const { wrapper, value, field, onBlur, onChange: onFieldChange } = useBooleanBinding(props.uischema, props.schema);
|
|
8083
|
+
const onChange = (val) => {
|
|
8084
|
+
field.setValue(Boolean(val) ?? false);
|
|
8085
|
+
onFieldChange();
|
|
8086
|
+
};
|
|
8087
|
+
return (_ctx, _cache) => {
|
|
8088
|
+
return vue.openBlock(), vue.createBlock(vue.unref(ui.Checkbox), vue.mergeProps(vue.unref(wrapper), {
|
|
8089
|
+
"model-value": vue.unref(value),
|
|
8090
|
+
onChange,
|
|
8091
|
+
onBlur: vue.unref(onBlur)
|
|
8092
|
+
}), null, 16, ["model-value", "onBlur"]);
|
|
8093
|
+
};
|
|
8094
|
+
}
|
|
8095
|
+
});
|
|
8096
|
+
const _sfc_main$a = /* @__PURE__ */ vue.defineComponent({
|
|
8097
|
+
__name: "MarkdownControlRenderer",
|
|
8098
|
+
props: {
|
|
8099
|
+
uischema: {},
|
|
8100
|
+
schema: {}
|
|
8101
|
+
},
|
|
8102
|
+
setup(__props) {
|
|
8103
|
+
const props = __props;
|
|
8104
|
+
const {
|
|
8105
|
+
wrapper,
|
|
8106
|
+
value,
|
|
8107
|
+
field,
|
|
8108
|
+
onBlur,
|
|
8109
|
+
onChange: onFieldChange
|
|
8110
|
+
} = useControlBinding(props.uischema, props.schema);
|
|
8111
|
+
const onChange = (val) => {
|
|
8112
|
+
field.setValue(val);
|
|
8113
|
+
onFieldChange();
|
|
8114
|
+
};
|
|
8115
|
+
return (_ctx, _cache) => {
|
|
8116
|
+
return vue.openBlock(), vue.createBlock(vue.unref(ui.Markdown), vue.mergeProps(vue.unref(wrapper), {
|
|
8117
|
+
"model-value": vue.unref(value),
|
|
8118
|
+
onChange,
|
|
8119
|
+
onBlur: vue.unref(onBlur)
|
|
8120
|
+
}), null, 16, ["model-value", "onBlur"]);
|
|
8121
|
+
};
|
|
8032
8122
|
}
|
|
8033
|
-
|
|
8034
|
-
|
|
8035
|
-
|
|
8036
|
-
|
|
8123
|
+
});
|
|
8124
|
+
const _sfc_main$9 = /* @__PURE__ */ vue.defineComponent({
|
|
8125
|
+
__name: "MultiSelectControlRenderer",
|
|
8126
|
+
props: {
|
|
8127
|
+
uischema: {},
|
|
8128
|
+
schema: {}
|
|
8129
|
+
},
|
|
8130
|
+
setup(__props) {
|
|
8131
|
+
const props = __props;
|
|
8132
|
+
const {
|
|
8133
|
+
wrapper,
|
|
8134
|
+
value,
|
|
8135
|
+
field,
|
|
8136
|
+
onBlur,
|
|
8137
|
+
onChange: onFieldChange
|
|
8138
|
+
} = useSelectBinding(props.uischema, props.schema);
|
|
8139
|
+
const onChange = (val) => {
|
|
8140
|
+
field.setValue(val);
|
|
8141
|
+
onFieldChange();
|
|
8142
|
+
};
|
|
8143
|
+
return (_ctx, _cache) => {
|
|
8144
|
+
return vue.openBlock(), vue.createBlock(vue.unref(ui.MultiSelect), vue.mergeProps(vue.unref(wrapper), {
|
|
8145
|
+
"model-value": vue.unref(value),
|
|
8146
|
+
onChange,
|
|
8147
|
+
onBlur: vue.unref(onBlur)
|
|
8148
|
+
}), null, 16, ["model-value", "onBlur"]);
|
|
8149
|
+
};
|
|
8037
8150
|
}
|
|
8038
|
-
|
|
8039
|
-
|
|
8040
|
-
|
|
8041
|
-
|
|
8042
|
-
|
|
8043
|
-
|
|
8044
|
-
|
|
8045
|
-
|
|
8046
|
-
|
|
8047
|
-
|
|
8048
|
-
|
|
8151
|
+
});
|
|
8152
|
+
const _sfc_main$8 = /* @__PURE__ */ vue.defineComponent({
|
|
8153
|
+
__name: "NumberControlRenderer",
|
|
8154
|
+
props: {
|
|
8155
|
+
uischema: {},
|
|
8156
|
+
schema: {}
|
|
8157
|
+
},
|
|
8158
|
+
setup(__props) {
|
|
8159
|
+
const props = __props;
|
|
8160
|
+
const { wrapper, value, onBlur, onChange } = useControlBinding(
|
|
8161
|
+
props.uischema,
|
|
8162
|
+
props.schema,
|
|
8163
|
+
{ defaultType: "number" }
|
|
8164
|
+
);
|
|
8165
|
+
return (_ctx, _cache) => {
|
|
8166
|
+
return vue.openBlock(), vue.createBlock(vue.unref(ui.InputNumber), vue.mergeProps(vue.unref(wrapper), {
|
|
8167
|
+
modelValue: vue.unref(value),
|
|
8168
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => vue.isRef(value) ? value.value = $event : null),
|
|
8169
|
+
steps: 0.01,
|
|
8170
|
+
onBlur: vue.unref(onBlur),
|
|
8171
|
+
onChange: vue.unref(onChange)
|
|
8172
|
+
}), null, 16, ["modelValue", "onBlur", "onChange"]);
|
|
8173
|
+
};
|
|
8049
8174
|
}
|
|
8050
|
-
|
|
8051
|
-
|
|
8175
|
+
});
|
|
8176
|
+
const _sfc_main$7 = /* @__PURE__ */ vue.defineComponent({
|
|
8177
|
+
__name: "SelectControlRenderer",
|
|
8178
|
+
props: {
|
|
8179
|
+
uischema: {},
|
|
8180
|
+
schema: {}
|
|
8181
|
+
},
|
|
8182
|
+
setup(__props) {
|
|
8183
|
+
const props = __props;
|
|
8184
|
+
const {
|
|
8185
|
+
wrapper,
|
|
8186
|
+
value,
|
|
8187
|
+
field,
|
|
8188
|
+
onBlur,
|
|
8189
|
+
onChange: onFieldChange,
|
|
8190
|
+
appliedOptions
|
|
8191
|
+
} = useSelectBinding(props.uischema, props.schema);
|
|
8192
|
+
const selectOptions = vue.computed(() => {
|
|
8193
|
+
return appliedOptions.options ?? [];
|
|
8194
|
+
});
|
|
8195
|
+
const onChange = (val) => {
|
|
8196
|
+
field.setValue(val);
|
|
8197
|
+
onFieldChange();
|
|
8198
|
+
};
|
|
8199
|
+
return (_ctx, _cache) => {
|
|
8200
|
+
return vue.openBlock(), vue.createBlock(vue.unref(ui.SelectComponent), vue.mergeProps(vue.unref(wrapper), {
|
|
8201
|
+
"model-value": vue.unref(value),
|
|
8202
|
+
options: selectOptions.value,
|
|
8203
|
+
onChange,
|
|
8204
|
+
onBlur: vue.unref(onBlur)
|
|
8205
|
+
}), null, 16, ["model-value", "options", "onBlur"]);
|
|
8206
|
+
};
|
|
8052
8207
|
}
|
|
8053
|
-
|
|
8054
|
-
|
|
8208
|
+
});
|
|
8209
|
+
const _sfc_main$6 = /* @__PURE__ */ vue.defineComponent({
|
|
8210
|
+
__name: "StringControlRenderer",
|
|
8211
|
+
props: {
|
|
8212
|
+
uischema: {},
|
|
8213
|
+
schema: {}
|
|
8214
|
+
},
|
|
8215
|
+
setup(__props) {
|
|
8216
|
+
const props = __props;
|
|
8217
|
+
const { wrapper, value, onBlur, onChange } = useControlBinding(
|
|
8218
|
+
props.uischema,
|
|
8219
|
+
props.schema
|
|
8220
|
+
);
|
|
8221
|
+
return (_ctx, _cache) => {
|
|
8222
|
+
return vue.openBlock(), vue.createBlock(vue.unref(ui.Input), vue.mergeProps(vue.unref(wrapper), {
|
|
8223
|
+
modelValue: vue.unref(value),
|
|
8224
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => vue.isRef(value) ? value.value = $event : null),
|
|
8225
|
+
onBlur: vue.unref(onBlur),
|
|
8226
|
+
onChange: vue.unref(onChange)
|
|
8227
|
+
}), null, 16, ["modelValue", "onBlur", "onChange"]);
|
|
8228
|
+
};
|
|
8055
8229
|
}
|
|
8056
|
-
|
|
8057
|
-
|
|
8058
|
-
|
|
8059
|
-
|
|
8060
|
-
|
|
8061
|
-
}
|
|
8230
|
+
});
|
|
8231
|
+
const _sfc_main$5 = /* @__PURE__ */ vue.defineComponent({
|
|
8232
|
+
__name: "TextAreaControlRenderer",
|
|
8233
|
+
props: {
|
|
8234
|
+
uischema: {},
|
|
8235
|
+
schema: {}
|
|
8236
|
+
},
|
|
8237
|
+
setup(__props) {
|
|
8238
|
+
const props = __props;
|
|
8239
|
+
const { wrapper, value, onBlur, onChange } = useControlBinding(
|
|
8240
|
+
props.uischema,
|
|
8241
|
+
props.schema
|
|
8242
|
+
);
|
|
8243
|
+
return (_ctx, _cache) => {
|
|
8244
|
+
return vue.openBlock(), vue.createBlock(vue.unref(ui.Textarea), vue.mergeProps(vue.unref(wrapper), {
|
|
8245
|
+
modelValue: vue.unref(value),
|
|
8246
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => vue.isRef(value) ? value.value = $event : null),
|
|
8247
|
+
onBlur: vue.unref(onBlur),
|
|
8248
|
+
onChange: vue.unref(onChange)
|
|
8249
|
+
}), null, 16, ["modelValue", "onBlur", "onChange"]);
|
|
8250
|
+
};
|
|
8062
8251
|
}
|
|
8063
|
-
|
|
8064
|
-
|
|
8065
|
-
|
|
8066
|
-
|
|
8067
|
-
|
|
8252
|
+
});
|
|
8253
|
+
const index = [
|
|
8254
|
+
{ tester: core$1.rankWith(10, isStringFormat), renderer: _sfc_main$6 },
|
|
8255
|
+
{
|
|
8256
|
+
tester: core$1.rankWith(11, isTextAreaControl),
|
|
8257
|
+
renderer: _sfc_main$5
|
|
8258
|
+
},
|
|
8259
|
+
{
|
|
8260
|
+
tester: core$1.rankWith(11, isMarkdownControl),
|
|
8261
|
+
renderer: _sfc_main$a
|
|
8262
|
+
},
|
|
8263
|
+
{ tester: core$1.rankWith(11, isBooleanControl), renderer: _sfc_main$b },
|
|
8264
|
+
{ tester: core$1.rankWith(11, isSelectControl), renderer: _sfc_main$7 },
|
|
8265
|
+
{
|
|
8266
|
+
tester: core$1.rankWith(11, isMultiselectControl),
|
|
8267
|
+
renderer: _sfc_main$9
|
|
8268
|
+
},
|
|
8269
|
+
{
|
|
8270
|
+
tester: core$1.rankWith(12, isAutoCompleteControl),
|
|
8271
|
+
renderer: _sfc_main$c
|
|
8272
|
+
},
|
|
8273
|
+
{
|
|
8274
|
+
tester: core$1.rankWith(12, isNumberFormat),
|
|
8275
|
+
renderer: _sfc_main$8
|
|
8276
|
+
},
|
|
8277
|
+
{
|
|
8278
|
+
tester: core$1.rankWith(12, isIntegerFormat),
|
|
8279
|
+
renderer: _sfc_main$8
|
|
8068
8280
|
}
|
|
8069
|
-
|
|
8070
|
-
|
|
8071
|
-
|
|
8072
|
-
|
|
8281
|
+
];
|
|
8282
|
+
const COLSPAN = {
|
|
8283
|
+
1: "col-span-1",
|
|
8284
|
+
2: "col-span-2",
|
|
8285
|
+
3: "col-span-3",
|
|
8286
|
+
4: "col-span-4",
|
|
8287
|
+
5: "col-span-5",
|
|
8288
|
+
6: "col-span-6",
|
|
8289
|
+
7: "col-span-7",
|
|
8290
|
+
8: "col-span-8",
|
|
8291
|
+
9: "col-span-9",
|
|
8292
|
+
10: "col-span-10",
|
|
8293
|
+
11: "col-span-11",
|
|
8294
|
+
12: "col-span-12"
|
|
8295
|
+
};
|
|
8296
|
+
const _hoisted_1$4 = { class: "flex flex-col gap-4" };
|
|
8297
|
+
const _sfc_main$4 = /* @__PURE__ */ vue.defineComponent({
|
|
8298
|
+
__name: "CollapseLayoutRenderer",
|
|
8299
|
+
props: {
|
|
8300
|
+
uischema: {},
|
|
8301
|
+
schema: {}
|
|
8302
|
+
},
|
|
8303
|
+
setup(__props) {
|
|
8304
|
+
const props = __props;
|
|
8305
|
+
const pathPrefix = vue.inject("pathPrefix", "");
|
|
8306
|
+
const opts = props.uischema.options ?? {};
|
|
8307
|
+
const titleKeyField = opts.titleKey ? veeValidate.useFieldValue(
|
|
8308
|
+
() => pathPrefix ? `${pathPrefix}.${opts.titleKey}` : opts.titleKey
|
|
8309
|
+
) : void 0;
|
|
8310
|
+
const title = vue.computed(() => {
|
|
8311
|
+
if (titleKeyField?.value) return titleKeyField.value;
|
|
8312
|
+
return props.uischema.label ?? opts.title ?? "Details";
|
|
8313
|
+
});
|
|
8314
|
+
return (_ctx, _cache) => {
|
|
8315
|
+
return vue.openBlock(), vue.createBlock(vue.unref(ui.Collapse), { title: title.value }, {
|
|
8316
|
+
default: vue.withCtx(() => [
|
|
8317
|
+
vue.createElementVNode("div", _hoisted_1$4, [
|
|
8318
|
+
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(__props.uischema.elements, (child, i) => {
|
|
8319
|
+
return vue.openBlock(), vue.createElementBlock("div", {
|
|
8320
|
+
key: i,
|
|
8321
|
+
class: vue.normalizeClass(vue.unref(COLSPAN)[child.options?.colspan ?? 12])
|
|
8322
|
+
}, [
|
|
8323
|
+
vue.createVNode(_sfc_main$f, {
|
|
8324
|
+
uischema: child,
|
|
8325
|
+
schema: __props.schema
|
|
8326
|
+
}, null, 8, ["uischema", "schema"])
|
|
8327
|
+
], 2);
|
|
8328
|
+
}), 128))
|
|
8329
|
+
])
|
|
8330
|
+
]),
|
|
8331
|
+
_: 1
|
|
8332
|
+
}, 8, ["title"]);
|
|
8333
|
+
};
|
|
8073
8334
|
}
|
|
8074
|
-
|
|
8075
|
-
|
|
8335
|
+
});
|
|
8336
|
+
const _hoisted_1$3 = {
|
|
8337
|
+
key: 1,
|
|
8338
|
+
class: "flex flex-col gap-3"
|
|
8339
|
+
};
|
|
8340
|
+
const _sfc_main$3 = /* @__PURE__ */ vue.defineComponent({
|
|
8341
|
+
__name: "LayoutRenderer",
|
|
8342
|
+
props: {
|
|
8343
|
+
uischema: {},
|
|
8344
|
+
schema: {}
|
|
8345
|
+
},
|
|
8346
|
+
setup(__props) {
|
|
8347
|
+
const props = __props;
|
|
8348
|
+
const LAYOUT = {
|
|
8349
|
+
GridLayout: "grid grid-cols-12 gap-3",
|
|
8350
|
+
HorizontalLayout: "flex flex-row gap-3",
|
|
8351
|
+
VerticalLayout: "flex flex-col gap-3"
|
|
8352
|
+
};
|
|
8353
|
+
const getLayout = vue.computed(() => LAYOUT[props.uischema.type]);
|
|
8354
|
+
const isLayout = vue.computed(() => props.uischema.type in LAYOUT);
|
|
8355
|
+
return (_ctx, _cache) => {
|
|
8356
|
+
return isLayout.value ? (vue.openBlock(), vue.createElementBlock("div", {
|
|
8357
|
+
key: 0,
|
|
8358
|
+
class: vue.normalizeClass(getLayout.value)
|
|
8359
|
+
}, [
|
|
8360
|
+
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(__props.uischema.elements, (child, i) => {
|
|
8361
|
+
return vue.openBlock(), vue.createElementBlock("div", {
|
|
8362
|
+
key: i,
|
|
8363
|
+
class: vue.normalizeClass(vue.unref(COLSPAN)[child.options?.colspan ?? 12])
|
|
8364
|
+
}, [
|
|
8365
|
+
vue.createVNode(_sfc_main$f, {
|
|
8366
|
+
uischema: child,
|
|
8367
|
+
schema: __props.schema
|
|
8368
|
+
}, null, 8, ["uischema", "schema"])
|
|
8369
|
+
], 2);
|
|
8370
|
+
}), 128))
|
|
8371
|
+
], 2)) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$3, " No Applicable Layout found "));
|
|
8372
|
+
};
|
|
8076
8373
|
}
|
|
8077
|
-
|
|
8078
|
-
|
|
8079
|
-
|
|
8080
|
-
|
|
8081
|
-
|
|
8374
|
+
});
|
|
8375
|
+
const isLayoutType = core$1.or(
|
|
8376
|
+
core$1.uiTypeIs("GridLayout"),
|
|
8377
|
+
core$1.uiTypeIs("HorizontalLayout"),
|
|
8378
|
+
core$1.uiTypeIs("VerticalLayout")
|
|
8379
|
+
);
|
|
8380
|
+
const layoutRenderes = [
|
|
8381
|
+
{ tester: core$1.rankWith(10, isLayoutType), renderer: _sfc_main$3 },
|
|
8382
|
+
{
|
|
8383
|
+
tester: core$1.rankWith(10, core$1.uiTypeIs("CollapseLayout")),
|
|
8384
|
+
renderer: _sfc_main$4
|
|
8082
8385
|
}
|
|
8083
|
-
const version2 = detectVersion(schema);
|
|
8084
|
-
const defs = schema.$defs || schema.definitions || {};
|
|
8085
|
-
const ctx = {
|
|
8086
|
-
version: version2,
|
|
8087
|
-
defs,
|
|
8088
|
-
refs: /* @__PURE__ */ new Map(),
|
|
8089
|
-
processing: /* @__PURE__ */ new Set(),
|
|
8090
|
-
rootSchema: schema,
|
|
8091
|
-
registry: globalRegistry
|
|
8092
|
-
};
|
|
8093
|
-
return convertSchema(schema, ctx);
|
|
8094
|
-
}
|
|
8095
|
-
config(en());
|
|
8096
|
-
const customRenderers = [
|
|
8097
|
-
controlRenderers,
|
|
8098
|
-
layoutRenderers,
|
|
8099
|
-
// ...complexRenderers,
|
|
8100
|
-
arrayRenderers
|
|
8101
|
-
// ...labelRenderers,
|
|
8102
|
-
].flat();
|
|
8103
|
-
const tailwindRenderers = [
|
|
8104
|
-
...vueVanilla.vanillaRenderers,
|
|
8105
|
-
...customRenderers
|
|
8106
8386
|
];
|
|
8107
|
-
const
|
|
8387
|
+
const customRenderes = [layoutRenderes, index, arrayRenderers].flat();
|
|
8388
|
+
const _hoisted_1$2 = ["id"];
|
|
8108
8389
|
const _sfc_main$2 = /* @__PURE__ */ vue.defineComponent({
|
|
8109
|
-
__name: "
|
|
8110
|
-
props:
|
|
8111
|
-
emits:
|
|
8112
|
-
setup(__props, { emit: __emit }) {
|
|
8390
|
+
__name: "FormComponent",
|
|
8391
|
+
props: JsonFormComponentProperties,
|
|
8392
|
+
emits: JsonFormComponentEmits,
|
|
8393
|
+
setup(__props, { expose: __expose, emit: __emit }) {
|
|
8394
|
+
registerZodErrorMap();
|
|
8113
8395
|
const properties = __props;
|
|
8114
8396
|
const emits = __emit;
|
|
8115
|
-
const
|
|
8116
|
-
|
|
8117
|
-
|
|
8118
|
-
|
|
8119
|
-
|
|
8120
|
-
|
|
8121
|
-
|
|
8397
|
+
const zodSchema = vue.computed(() => {
|
|
8398
|
+
if (!properties.schema) return void 0;
|
|
8399
|
+
try {
|
|
8400
|
+
const patched = jsonFormsCore.enforceRequiredStringMinLength(properties.schema);
|
|
8401
|
+
return fromJSONSchema(patched);
|
|
8402
|
+
} catch {
|
|
8403
|
+
return void 0;
|
|
8404
|
+
}
|
|
8405
|
+
});
|
|
8406
|
+
const { values, errors, meta: meta2, setValues, validate } = veeValidate.useForm({
|
|
8407
|
+
validationSchema: zodSchema,
|
|
8408
|
+
initialValues: properties.formData
|
|
8409
|
+
});
|
|
8410
|
+
vue.provide("renderers", customRenderes);
|
|
8411
|
+
vue.provide("rootSchema", properties.schema);
|
|
8412
|
+
vue.provide("styles", ui.myStyles);
|
|
8413
|
+
const submitted = vue.ref(false);
|
|
8414
|
+
vue.provide(ERROR_MODE_KEY, vue.toRef(properties, "errorMode"));
|
|
8415
|
+
vue.provide(FORM_SUBMITTED_KEY, submitted);
|
|
8416
|
+
vue.onMounted(async () => {
|
|
8417
|
+
const result = await validate();
|
|
8418
|
+
emits("valid", result.valid);
|
|
8419
|
+
});
|
|
8420
|
+
provideFormEvents((payload) => {
|
|
8421
|
+
emits("events", payload);
|
|
8422
|
+
});
|
|
8423
|
+
let syncing = false;
|
|
8122
8424
|
vue.watch(
|
|
8123
8425
|
() => properties.formData,
|
|
8124
|
-
(
|
|
8125
|
-
if (
|
|
8126
|
-
|
|
8127
|
-
|
|
8426
|
+
(newData) => {
|
|
8427
|
+
if (!newData) return;
|
|
8428
|
+
if (JSON.stringify(newData) === JSON.stringify(vue.toRaw(values))) return;
|
|
8429
|
+
syncing = true;
|
|
8430
|
+
setValues(newData);
|
|
8431
|
+
vue.nextTick(() => {
|
|
8432
|
+
syncing = false;
|
|
8433
|
+
});
|
|
8128
8434
|
},
|
|
8129
|
-
{ deep: true
|
|
8435
|
+
{ deep: true }
|
|
8130
8436
|
);
|
|
8131
|
-
|
|
8132
|
-
|
|
8133
|
-
|
|
8134
|
-
|
|
8135
|
-
|
|
8136
|
-
|
|
8137
|
-
|
|
8138
|
-
|
|
8139
|
-
|
|
8140
|
-
|
|
8141
|
-
|
|
8142
|
-
|
|
8143
|
-
|
|
8437
|
+
vue.watch(
|
|
8438
|
+
values,
|
|
8439
|
+
(newValues) => {
|
|
8440
|
+
if (syncing) return;
|
|
8441
|
+
const isValid = meta2.value.valid;
|
|
8442
|
+
emits("valid", isValid);
|
|
8443
|
+
emits("change", vue.toRaw(newValues));
|
|
8444
|
+
},
|
|
8445
|
+
{ deep: true }
|
|
8446
|
+
);
|
|
8447
|
+
vue.watch(
|
|
8448
|
+
errors,
|
|
8449
|
+
(newErrors) => {
|
|
8450
|
+
const errorList = Object.entries(newErrors).filter(([, msg]) => !!msg).map(([path, message]) => ({ path, message }));
|
|
8451
|
+
emits("errors", errorList);
|
|
8452
|
+
},
|
|
8453
|
+
{ deep: true }
|
|
8454
|
+
);
|
|
8455
|
+
const onSubmit = () => {
|
|
8456
|
+
submitted.value = true;
|
|
8144
8457
|
emits("submit", {
|
|
8145
|
-
data:
|
|
8146
|
-
valid:
|
|
8458
|
+
data: vue.toRaw(values),
|
|
8459
|
+
valid: meta2.value.valid
|
|
8147
8460
|
});
|
|
8148
8461
|
};
|
|
8149
|
-
|
|
8150
|
-
|
|
8151
|
-
|
|
8152
|
-
|
|
8153
|
-
]);
|
|
8462
|
+
const markSubmitted = () => {
|
|
8463
|
+
submitted.value = true;
|
|
8464
|
+
};
|
|
8465
|
+
__expose({ markSubmitted });
|
|
8154
8466
|
return (_ctx, _cache) => {
|
|
8155
8467
|
return vue.openBlock(), vue.createElementBlock("form", {
|
|
8156
8468
|
id: _ctx.id,
|
|
8157
8469
|
onSubmit: vue.withModifiers(onSubmit, ["prevent"])
|
|
8158
8470
|
}, [
|
|
8159
|
-
|
|
8160
|
-
key: _ctx.id,
|
|
8161
|
-
data: internalFormData.value,
|
|
8162
|
-
schema: _ctx.schema,
|
|
8471
|
+
vue.createVNode(_sfc_main$f, {
|
|
8163
8472
|
uischema: _ctx.uiSchema,
|
|
8164
|
-
|
|
8165
|
-
|
|
8166
|
-
|
|
8167
|
-
onSubmit
|
|
8168
|
-
}, null, 8, ["data", "schema", "uischema", "renderers", "enabled"]))
|
|
8169
|
-
], 40, _hoisted_1$1);
|
|
8473
|
+
schema: _ctx.schema
|
|
8474
|
+
}, null, 8, ["uischema", "schema"])
|
|
8475
|
+
], 40, _hoisted_1$2);
|
|
8170
8476
|
};
|
|
8171
8477
|
}
|
|
8172
8478
|
});
|
|
8173
|
-
const
|
|
8479
|
+
const FormWithActionsProperties = {
|
|
8480
|
+
/** Unique identifier used to namespace the inner form element. */
|
|
8481
|
+
id: { type: String, required: true },
|
|
8482
|
+
/** Title shown when creating a new record. */
|
|
8483
|
+
createTitle: { type: String, required: true },
|
|
8484
|
+
/** Title shown when editing an existing record. Falls back to `createTitle` when omitted. */
|
|
8485
|
+
updateTitle: { type: String },
|
|
8486
|
+
/** JSON schema describing the shape of the form data. */
|
|
8487
|
+
schema: { type: Object },
|
|
8488
|
+
/** UI schema describing the layout and controls. */
|
|
8489
|
+
uiSchema: { type: Object },
|
|
8490
|
+
/** REST endpoint used by `FormStore` to persist data. When omitted the form emits `submit` instead. */
|
|
8491
|
+
uri: { type: String },
|
|
8492
|
+
/** Enable vertical scrolling inside the form area. */
|
|
8493
|
+
scrollable: { type: Boolean, default: false },
|
|
8494
|
+
/** Stretch the collapse wrapper to full height. */
|
|
8495
|
+
fullHeight: { type: Boolean, default: false },
|
|
8496
|
+
/** Two-way bound form data object. */
|
|
8497
|
+
modelValue: { type: Object, default: () => ({}) },
|
|
8498
|
+
/** When validation errors are shown (`'onBlur'`, `'onChange'`, `'onSubmit'`, `'always'`). */
|
|
8499
|
+
errorMode: {
|
|
8500
|
+
type: String,
|
|
8501
|
+
default: "onBlur"
|
|
8502
|
+
}
|
|
8503
|
+
};
|
|
8504
|
+
const FormWithActionsEmits = [
|
|
8505
|
+
/** Emitted when `modelValue` changes. */
|
|
8506
|
+
"update:modelValue",
|
|
8507
|
+
/** Emitted after a successful `FormStore.save()`. */
|
|
8508
|
+
"success",
|
|
8509
|
+
/** Emitted on submit when no `uri` is provided. */
|
|
8510
|
+
"submit",
|
|
8511
|
+
/** Emitted whenever form validity changes. */
|
|
8512
|
+
"valid",
|
|
8513
|
+
/** Emitted when a custom renderer dispatches a form event. */
|
|
8514
|
+
"events",
|
|
8515
|
+
/** Emitted when validation errors change. */
|
|
8516
|
+
"errors",
|
|
8517
|
+
/** Emitted when the user cancels editing an existing record. */
|
|
8518
|
+
"cancel"
|
|
8519
|
+
];
|
|
8520
|
+
class FormStore {
|
|
8521
|
+
constructor(uri) {
|
|
8522
|
+
this.uri = uri;
|
|
8523
|
+
}
|
|
8524
|
+
async delete(data) {
|
|
8525
|
+
return toolsVue.useApi().delete(`${this.uri}/${data.id}`).then(() => {
|
|
8526
|
+
ui.NotificationService.success("Data deleted");
|
|
8527
|
+
}).catch((error2) => {
|
|
8528
|
+
console.error(error2);
|
|
8529
|
+
ui.NotificationService.error("Error deleting data");
|
|
8530
|
+
});
|
|
8531
|
+
}
|
|
8532
|
+
async save(id, data) {
|
|
8533
|
+
if (!this.uri) return;
|
|
8534
|
+
const promise2 = id ? toolsVue.useApi().patch(`${this.uri}/${id}`, data) : toolsVue.useApi().post(this.uri, data);
|
|
8535
|
+
return promise2.then((response) => {
|
|
8536
|
+
ui.NotificationService.success("Data saved");
|
|
8537
|
+
return response.data;
|
|
8538
|
+
}).catch((error2) => {
|
|
8539
|
+
console.error(error2);
|
|
8540
|
+
ui.NotificationService.error("Error saving data");
|
|
8541
|
+
});
|
|
8542
|
+
}
|
|
8543
|
+
}
|
|
8544
|
+
const _hoisted_1$1 = { class: "flex justify-end gap-2 p-2 mt-2 border-t border-gray-300 z-[30] shrink-0" };
|
|
8174
8545
|
const _hoisted_2 = { class: "flex justify-end gap-2" };
|
|
8175
8546
|
const _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
|
|
8176
|
-
__name: "
|
|
8177
|
-
props:
|
|
8178
|
-
...FormWithActionsProperties,
|
|
8179
|
-
modelValue: { type: Object, default: () => ({}) }
|
|
8180
|
-
},
|
|
8547
|
+
__name: "FormWithActions",
|
|
8548
|
+
props: FormWithActionsProperties,
|
|
8181
8549
|
emits: FormWithActionsEmits,
|
|
8182
8550
|
setup(__props, { emit: __emit }) {
|
|
8183
8551
|
const properties = __props;
|
|
8184
8552
|
const emits = __emit;
|
|
8553
|
+
const formRef = vue.ref();
|
|
8185
8554
|
const formData = vue.ref(properties.modelValue);
|
|
8186
8555
|
const initialFormData = vue.ref(structuredClone(vue.toRaw(properties.modelValue)));
|
|
8187
8556
|
const recordId = vue.ref(properties.modelValue?.id ?? null);
|
|
8188
8557
|
const valid = vue.ref(false);
|
|
8189
|
-
const submitted = vue.ref(false);
|
|
8190
8558
|
vue.watch(
|
|
8191
8559
|
() => properties.modelValue,
|
|
8192
|
-
(newValue
|
|
8560
|
+
(newValue) => {
|
|
8193
8561
|
if (newValue === formData.value) return;
|
|
8194
8562
|
recordId.value = newValue?.id ?? null;
|
|
8195
8563
|
initialFormData.value = structuredClone(vue.toRaw(newValue));
|
|
@@ -8204,13 +8572,11 @@ const _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
|
|
|
8204
8572
|
emits("update:modelValue", data);
|
|
8205
8573
|
};
|
|
8206
8574
|
const save = () => {
|
|
8207
|
-
|
|
8208
|
-
if (!valid.value)
|
|
8209
|
-
return;
|
|
8210
|
-
}
|
|
8575
|
+
formRef.value?.markSubmitted();
|
|
8576
|
+
if (!valid.value) return;
|
|
8211
8577
|
if (store.value) {
|
|
8212
|
-
store.value.save(recordId.value, formData.value).then(() => {
|
|
8213
|
-
emits("success");
|
|
8578
|
+
store.value.save(recordId.value, formData.value).then((response) => {
|
|
8579
|
+
emits("success", response);
|
|
8214
8580
|
});
|
|
8215
8581
|
} else {
|
|
8216
8582
|
emits("submit", formData.value);
|
|
@@ -8218,28 +8584,31 @@ const _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
|
|
|
8218
8584
|
};
|
|
8219
8585
|
const clear = () => {
|
|
8220
8586
|
formData.value = { id: null };
|
|
8221
|
-
submitted.value = false;
|
|
8222
8587
|
emits("update:modelValue", formData.value);
|
|
8223
8588
|
};
|
|
8224
8589
|
const cancel = () => {
|
|
8225
8590
|
formData.value = structuredClone(vue.toRaw(initialFormData.value));
|
|
8226
|
-
submitted.value = false;
|
|
8227
8591
|
emits("update:modelValue", formData.value);
|
|
8228
8592
|
emits("cancel");
|
|
8229
8593
|
};
|
|
8230
|
-
const onValid = (v) => {
|
|
8231
|
-
submitted.value = false;
|
|
8232
|
-
valid.value = v;
|
|
8233
|
-
emits("valid", v);
|
|
8234
|
-
};
|
|
8235
8594
|
const title = vue.computed(() => {
|
|
8236
8595
|
if (!properties.updateTitle) return properties.createTitle;
|
|
8237
8596
|
return recordId.value ? properties.updateTitle : properties.createTitle;
|
|
8238
8597
|
});
|
|
8598
|
+
const onErrors = (errors) => {
|
|
8599
|
+
emits("errors", errors);
|
|
8600
|
+
valid.value = lodashEs.isEmpty(errors);
|
|
8601
|
+
};
|
|
8602
|
+
vue.watch(valid, (newValid, oldValid) => {
|
|
8603
|
+
if (newValid !== oldValid) {
|
|
8604
|
+
emits("valid", newValid);
|
|
8605
|
+
}
|
|
8606
|
+
});
|
|
8239
8607
|
return (_ctx, _cache) => {
|
|
8240
8608
|
return vue.openBlock(), vue.createBlock(vue.unref(ui.Collapse), {
|
|
8241
8609
|
title: title.value,
|
|
8242
|
-
"height-full": _ctx.fullHeight
|
|
8610
|
+
"height-full": _ctx.fullHeight,
|
|
8611
|
+
scrollable: true
|
|
8243
8612
|
}, {
|
|
8244
8613
|
default: vue.withCtx(() => [
|
|
8245
8614
|
vue.createElementVNode("div", {
|
|
@@ -8250,24 +8619,19 @@ const _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
|
|
|
8250
8619
|
}, [
|
|
8251
8620
|
vue.createVNode(_sfc_main$2, {
|
|
8252
8621
|
id: `form_${_ctx.id}`,
|
|
8622
|
+
ref_key: "formRef",
|
|
8623
|
+
ref: formRef,
|
|
8253
8624
|
"form-data": formData.value,
|
|
8254
8625
|
schema: _ctx.schema,
|
|
8255
8626
|
"ui-schema": _ctx.uiSchema,
|
|
8627
|
+
"error-mode": _ctx.errorMode,
|
|
8256
8628
|
onChange: updateValue,
|
|
8257
|
-
onValid: _cache[0] || (_cache[0] = ($event) => onValid($event)),
|
|
8258
8629
|
onSubmit: save,
|
|
8259
|
-
onErrors
|
|
8260
|
-
onEvents: _cache[
|
|
8261
|
-
}, null, 8, ["id", "form-data", "schema", "ui-schema"])
|
|
8630
|
+
onErrors,
|
|
8631
|
+
onEvents: _cache[0] || (_cache[0] = ($event) => emits("events", $event))
|
|
8632
|
+
}, null, 8, ["id", "form-data", "schema", "ui-schema", "error-mode"])
|
|
8262
8633
|
], 2),
|
|
8263
|
-
vue.createElementVNode("div", _hoisted_1, [
|
|
8264
|
-
vue.createElementVNode("div", null, [
|
|
8265
|
-
!valid.value && submitted.value ? (vue.openBlock(), vue.createBlock(vue.unref(ui.Alert), {
|
|
8266
|
-
key: 0,
|
|
8267
|
-
message: "The form is not valid",
|
|
8268
|
-
type: "error"
|
|
8269
|
-
})) : vue.createCommentVNode("", true)
|
|
8270
|
-
]),
|
|
8634
|
+
vue.createElementVNode("div", _hoisted_1$1, [
|
|
8271
8635
|
vue.createElementVNode("div", _hoisted_2, [
|
|
8272
8636
|
vue.renderSlot(_ctx.$slots, "actions"),
|
|
8273
8637
|
recordId.value ? (vue.openBlock(), vue.createBlock(vue.unref(ui.Btn), {
|
|
@@ -8276,7 +8640,7 @@ const _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
|
|
|
8276
8640
|
outline: true,
|
|
8277
8641
|
onClick: cancel
|
|
8278
8642
|
}, {
|
|
8279
|
-
default: vue.withCtx(() => [..._cache[
|
|
8643
|
+
default: vue.withCtx(() => [..._cache[1] || (_cache[1] = [
|
|
8280
8644
|
vue.createTextVNode(" Cancel ", -1)
|
|
8281
8645
|
])]),
|
|
8282
8646
|
_: 1
|
|
@@ -8286,7 +8650,7 @@ const _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
|
|
|
8286
8650
|
outline: true,
|
|
8287
8651
|
onClick: clear
|
|
8288
8652
|
}, {
|
|
8289
|
-
default: vue.withCtx(() => [..._cache[
|
|
8653
|
+
default: vue.withCtx(() => [..._cache[2] || (_cache[2] = [
|
|
8290
8654
|
vue.createTextVNode(" Clear ", -1)
|
|
8291
8655
|
])]),
|
|
8292
8656
|
_: 1
|
|
@@ -8294,10 +8658,10 @@ const _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
|
|
|
8294
8658
|
vue.createVNode(vue.unref(ui.Btn), {
|
|
8295
8659
|
"aria-label": "Save",
|
|
8296
8660
|
color: vue.unref(ui.Color).primary,
|
|
8297
|
-
disabled:
|
|
8661
|
+
disabled: !valid.value,
|
|
8298
8662
|
onClick: save
|
|
8299
8663
|
}, {
|
|
8300
|
-
default: vue.withCtx(() => [..._cache[
|
|
8664
|
+
default: vue.withCtx(() => [..._cache[3] || (_cache[3] = [
|
|
8301
8665
|
vue.createTextVNode(" Save ", -1)
|
|
8302
8666
|
])]),
|
|
8303
8667
|
_: 1
|
|
@@ -8311,214 +8675,173 @@ const _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
|
|
|
8311
8675
|
};
|
|
8312
8676
|
}
|
|
8313
8677
|
});
|
|
8678
|
+
const FormWithTableProperties = {
|
|
8679
|
+
/** Unique identifier used to namespace the inner table element. */
|
|
8680
|
+
id: { type: String, required: true },
|
|
8681
|
+
/** Heading displayed above the table. */
|
|
8682
|
+
tableTitle: { type: String, required: true },
|
|
8683
|
+
/** Title shown in the modal when creating a new record. */
|
|
8684
|
+
createTitle: { type: String, required: true },
|
|
8685
|
+
/** Title shown in the modal when editing a record. Falls back to `createTitle` when omitted. */
|
|
8686
|
+
updateTitle: { type: String },
|
|
8687
|
+
/** Override URI used to fetch table data. Defaults to `uri` when omitted. */
|
|
8688
|
+
dataUri: { type: String },
|
|
8689
|
+
/** Custom row actions rendered in the table. */
|
|
8690
|
+
tableActions: { type: Array },
|
|
8691
|
+
/** JSON Forms layout for the create/edit modal form. */
|
|
8692
|
+
form: { type: Object },
|
|
8693
|
+
/** JSON Forms layout for the table. */
|
|
8694
|
+
table: { type: Object },
|
|
8695
|
+
/** JSON Forms layout for the table filter. */
|
|
8696
|
+
filter: { type: Object },
|
|
8697
|
+
/** REST endpoint used by `FormStore` for CRUD operations. */
|
|
8698
|
+
uri: { type: String },
|
|
8699
|
+
/** Default data pre-filled when creating a new record. */
|
|
8700
|
+
initialData: { type: Object, default: () => ({}) },
|
|
8701
|
+
/** When validation errors are shown in the modal form. */
|
|
8702
|
+
errorMode: {
|
|
8703
|
+
type: String,
|
|
8704
|
+
default: "onBlur"
|
|
8705
|
+
}
|
|
8706
|
+
};
|
|
8707
|
+
const FormWithTableEmits = [
|
|
8708
|
+
/** Emitted when a row is selected for editing (listener-based routing). */
|
|
8709
|
+
"editData",
|
|
8710
|
+
/** Emitted after a record is saved through the modal. */
|
|
8711
|
+
"save",
|
|
8712
|
+
/** Emitted after a record is deleted. */
|
|
8713
|
+
"delete",
|
|
8714
|
+
/** Emitted when a custom renderer dispatches a form event. */
|
|
8715
|
+
"events",
|
|
8716
|
+
/** Emitted when a custom edit handler is registered. */
|
|
8717
|
+
"custom:edit",
|
|
8718
|
+
/** Emitted when a custom create handler is registered. */
|
|
8719
|
+
"custom:create"
|
|
8720
|
+
];
|
|
8721
|
+
const _hoisted_1 = { class: "flex justify-between items-center mb-2" };
|
|
8314
8722
|
const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
8315
|
-
__name: "
|
|
8316
|
-
props:
|
|
8317
|
-
|
|
8318
|
-
saveLabel: { default: "save" },
|
|
8319
|
-
cancelLabel: { default: "cancel" },
|
|
8320
|
-
schema: {},
|
|
8321
|
-
uiSchema: {},
|
|
8322
|
-
modalSize: { default: "md" },
|
|
8323
|
-
onClose: {},
|
|
8324
|
-
onEvents: {},
|
|
8325
|
-
data: {}
|
|
8326
|
-
}, {
|
|
8327
|
-
"modelValue": {},
|
|
8328
|
-
"modelModifiers": {}
|
|
8329
|
-
}),
|
|
8330
|
-
emits: /* @__PURE__ */ vue.mergeModels(["closeModal", "events"], ["update:modelValue"]),
|
|
8723
|
+
__name: "FormWithTable",
|
|
8724
|
+
props: FormWithTableProperties,
|
|
8725
|
+
emits: FormWithTableEmits,
|
|
8331
8726
|
setup(__props, { emit: __emit }) {
|
|
8332
8727
|
const properties = __props;
|
|
8333
|
-
const
|
|
8334
|
-
const
|
|
8335
|
-
const
|
|
8336
|
-
const
|
|
8337
|
-
const
|
|
8338
|
-
|
|
8339
|
-
|
|
8340
|
-
|
|
8341
|
-
|
|
8342
|
-
|
|
8343
|
-
|
|
8728
|
+
const emit = __emit;
|
|
8729
|
+
const reload = vue.ref(0);
|
|
8730
|
+
const resolvedForm = vue.computed(() => properties.form);
|
|
8731
|
+
const resolvedTable = vue.computed(() => properties.table);
|
|
8732
|
+
const resolvedFilter = vue.computed(() => properties.filter);
|
|
8733
|
+
const resolvedUri = vue.computed(() => properties.uri);
|
|
8734
|
+
let store = new FormStore(resolvedUri.value ?? "");
|
|
8735
|
+
vue.watch(resolvedUri, (uri) => {
|
|
8736
|
+
store = new FormStore(uri ?? "");
|
|
8737
|
+
});
|
|
8738
|
+
const hasEdit = ui.hasCustomEventListener("editData");
|
|
8739
|
+
const customEdit = ui.hasCustomEventListener("custom:edit");
|
|
8740
|
+
const customCreate = ui.hasCustomEventListener("custom:create");
|
|
8741
|
+
const edit = (data) => {
|
|
8742
|
+
if (customEdit) {
|
|
8743
|
+
emit("custom:edit", data);
|
|
8744
|
+
return;
|
|
8745
|
+
}
|
|
8746
|
+
if (hasEdit) {
|
|
8747
|
+
emit("editData", data);
|
|
8748
|
+
return;
|
|
8749
|
+
}
|
|
8750
|
+
openModal(data);
|
|
8344
8751
|
};
|
|
8345
|
-
const
|
|
8346
|
-
|
|
8347
|
-
|
|
8752
|
+
const create = () => {
|
|
8753
|
+
if (customCreate) {
|
|
8754
|
+
emit("custom:create");
|
|
8755
|
+
return;
|
|
8756
|
+
}
|
|
8757
|
+
openModal();
|
|
8348
8758
|
};
|
|
8349
|
-
const
|
|
8350
|
-
|
|
8759
|
+
const deleteFn = (data) => {
|
|
8760
|
+
ui.ModalService.showConfirm({
|
|
8761
|
+
title: "Delete record",
|
|
8762
|
+
message: "Are you sure to delete, the data will be lost?",
|
|
8763
|
+
onClose: (result) => {
|
|
8764
|
+
if (result.confirmed) {
|
|
8765
|
+
store.delete(data).then(() => {
|
|
8766
|
+
reload.value = Date.now();
|
|
8767
|
+
emit("delete", data);
|
|
8768
|
+
});
|
|
8769
|
+
}
|
|
8770
|
+
}
|
|
8771
|
+
});
|
|
8351
8772
|
};
|
|
8352
|
-
const
|
|
8353
|
-
if (!
|
|
8354
|
-
|
|
8773
|
+
const openModal = (formData) => {
|
|
8774
|
+
if (!resolvedForm.value) return;
|
|
8775
|
+
const isUpdate = !!formData?.id;
|
|
8776
|
+
JsonFormModalService.openModal({
|
|
8777
|
+
schema: resolvedForm.value.schema,
|
|
8778
|
+
uiSchema: resolvedForm.value.uiSchema,
|
|
8779
|
+
modalSize: resolvedForm.value.modalSize,
|
|
8780
|
+
initialData: formData ?? properties.initialData,
|
|
8781
|
+
modalTitle: (isUpdate ? properties.updateTitle ?? properties.createTitle : properties.createTitle) ?? "",
|
|
8782
|
+
onClose: (result) => {
|
|
8783
|
+
if (result && result.valid) {
|
|
8784
|
+
store.save(formData?.id, result.data).then(() => {
|
|
8785
|
+
reload.value = Date.now();
|
|
8786
|
+
emit("save", { id: formData?.id, data: result.data });
|
|
8787
|
+
});
|
|
8788
|
+
}
|
|
8789
|
+
},
|
|
8790
|
+
onEvents: (payload) => emit("events", payload)
|
|
8791
|
+
});
|
|
8355
8792
|
};
|
|
8356
8793
|
return (_ctx, _cache) => {
|
|
8357
|
-
return vue.openBlock(), vue.
|
|
8358
|
-
|
|
8359
|
-
|
|
8360
|
-
|
|
8361
|
-
|
|
8362
|
-
|
|
8363
|
-
|
|
8364
|
-
|
|
8365
|
-
|
|
8366
|
-
|
|
8367
|
-
|
|
8368
|
-
|
|
8369
|
-
|
|
8370
|
-
"
|
|
8371
|
-
|
|
8372
|
-
onChange,
|
|
8373
|
-
onEvents: _cache[2] || (_cache[2] = ($event) => emits("events", $event))
|
|
8374
|
-
}, null, 8, ["id", "modelValue", "schema", "ui-schema"]),
|
|
8375
|
-
vue.renderSlot(_ctx.$slots, "content-after")
|
|
8376
|
-
]),
|
|
8377
|
-
actions: vue.withCtx(() => [
|
|
8378
|
-
vue.createVNode(vue.unref(ui.Btn), {
|
|
8379
|
-
color: vue.unref(ui.Color).secondary,
|
|
8380
|
-
outline: true,
|
|
8381
|
-
"aria-label": "Cancel",
|
|
8382
|
-
onClick: onCancel
|
|
8383
|
-
}, {
|
|
8384
|
-
default: vue.withCtx(() => [..._cache[3] || (_cache[3] = [
|
|
8385
|
-
vue.createTextVNode(" Cancel ", -1)
|
|
8386
|
-
])]),
|
|
8387
|
-
_: 1
|
|
8388
|
-
}, 8, ["color"]),
|
|
8389
|
-
vue.createVNode(vue.unref(ui.Btn), {
|
|
8390
|
-
disabled: !hasBeenValid.value,
|
|
8391
|
-
"aria-label": "Save",
|
|
8392
|
-
onClick: onSubmit
|
|
8393
|
-
}, {
|
|
8394
|
-
default: vue.withCtx(() => [..._cache[4] || (_cache[4] = [
|
|
8395
|
-
vue.createTextVNode(" Save ", -1)
|
|
8396
|
-
])]),
|
|
8397
|
-
_: 1
|
|
8398
|
-
}, 8, ["disabled"])
|
|
8794
|
+
return vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [
|
|
8795
|
+
vue.createElementVNode("div", _hoisted_1, [
|
|
8796
|
+
vue.createElementVNode("h1", null, vue.toDisplayString(_ctx.tableTitle), 1),
|
|
8797
|
+
vue.createElementVNode("div", null, [
|
|
8798
|
+
vue.createVNode(vue.unref(ui.Btn), {
|
|
8799
|
+
icon: vue.unref(ui.IconEnum).Plus,
|
|
8800
|
+
outline: true,
|
|
8801
|
+
onClick: create
|
|
8802
|
+
}, {
|
|
8803
|
+
default: vue.withCtx(() => [..._cache[0] || (_cache[0] = [
|
|
8804
|
+
vue.createTextVNode(" Add new record ", -1)
|
|
8805
|
+
])]),
|
|
8806
|
+
_: 1
|
|
8807
|
+
}, 8, ["icon"])
|
|
8808
|
+
])
|
|
8399
8809
|
]),
|
|
8400
|
-
|
|
8401
|
-
|
|
8810
|
+
resolvedTable.value ? (vue.openBlock(), vue.createBlock(vue.unref(ui.Card), { key: 0 }, {
|
|
8811
|
+
default: vue.withCtx(() => [
|
|
8812
|
+
resolvedUri.value ? (vue.openBlock(), vue.createBlock(vue.unref(_sfc_main$g), {
|
|
8813
|
+
key: 0,
|
|
8814
|
+
id: `form_table_${_ctx.id}`,
|
|
8815
|
+
"ui-schema": resolvedTable.value.uiSchema,
|
|
8816
|
+
schema: resolvedTable.value.schema,
|
|
8817
|
+
"filter-ui-schema": resolvedFilter.value?.uiSchema,
|
|
8818
|
+
"filter-schema": resolvedFilter.value?.schema,
|
|
8819
|
+
uri: _ctx.dataUri ?? resolvedUri.value,
|
|
8820
|
+
reload: reload.value,
|
|
8821
|
+
actions: _ctx.tableActions,
|
|
8822
|
+
onEdit: edit,
|
|
8823
|
+
onDelete: deleteFn
|
|
8824
|
+
}, null, 8, ["id", "ui-schema", "schema", "filter-ui-schema", "filter-schema", "uri", "reload", "actions"])) : vue.createCommentVNode("", true)
|
|
8825
|
+
]),
|
|
8826
|
+
_: 1
|
|
8827
|
+
})) : vue.createCommentVNode("", true)
|
|
8828
|
+
], 64);
|
|
8402
8829
|
};
|
|
8403
8830
|
}
|
|
8404
8831
|
});
|
|
8405
|
-
|
|
8406
|
-
|
|
8407
|
-
|
|
8408
|
-
|
|
8409
|
-
|
|
8410
|
-
|
|
8411
|
-
|
|
8412
|
-
|
|
8413
|
-
onEvents
|
|
8414
|
-
}) {
|
|
8415
|
-
ui.ModalService.openModal({
|
|
8416
|
-
component: _sfc_main,
|
|
8417
|
-
props: {
|
|
8418
|
-
schema,
|
|
8419
|
-
uiSchema,
|
|
8420
|
-
modalSize,
|
|
8421
|
-
data: initialData ?? {},
|
|
8422
|
-
modalTitle,
|
|
8423
|
-
onClose,
|
|
8424
|
-
onEvents
|
|
8425
|
-
}
|
|
8426
|
-
});
|
|
8427
|
-
}
|
|
8428
|
-
}
|
|
8429
|
-
const createRepository = (formSchemaModel, httpRequest, options = {}) => {
|
|
8430
|
-
const notificationEntity = options.notification?.entityType || "entity";
|
|
8431
|
-
const notificationStore = options.notification?.notification ?? null;
|
|
8432
|
-
const getDataUri = (...suffix) => {
|
|
8433
|
-
return [formSchemaModel.uri, ...suffix].join("/");
|
|
8434
|
-
};
|
|
8435
|
-
const handleSuccess = (message) => {
|
|
8436
|
-
notificationStore?.success(message);
|
|
8437
|
-
};
|
|
8438
|
-
const handleError = (error2, message) => {
|
|
8439
|
-
console.error(error2);
|
|
8440
|
-
notificationStore?.error(message);
|
|
8441
|
-
throw new Error(error2);
|
|
8442
|
-
};
|
|
8443
|
-
const create = (object2, options2) => {
|
|
8444
|
-
return httpRequest.post(getDataUri(), object2, options2).then((response) => {
|
|
8445
|
-
handleSuccess(`Created ${notificationEntity}`);
|
|
8446
|
-
return response.data;
|
|
8447
|
-
}).catch((response) => {
|
|
8448
|
-
handleError(response, `Failed to create ${notificationEntity}`);
|
|
8449
|
-
});
|
|
8450
|
-
};
|
|
8451
|
-
const patch = (id, object2, options2) => {
|
|
8452
|
-
return httpRequest.patch(getDataUri(id), object2, options2).then((response) => {
|
|
8453
|
-
handleSuccess(`Saved ${notificationEntity}`);
|
|
8454
|
-
return response.data;
|
|
8455
|
-
}).catch((response) => {
|
|
8456
|
-
handleError(response, `Failed to save ${notificationEntity}`);
|
|
8457
|
-
});
|
|
8458
|
-
};
|
|
8459
|
-
const get = (id, options2) => {
|
|
8460
|
-
return httpRequest.get(getDataUri(id), options2).then((response) => {
|
|
8461
|
-
return response.data;
|
|
8462
|
-
}).catch((response) => {
|
|
8463
|
-
handleError(response, `Failed to load data`);
|
|
8464
|
-
});
|
|
8465
|
-
};
|
|
8466
|
-
const _delete = (id, options2) => {
|
|
8467
|
-
return httpRequest.delete(getDataUri(id), options2).then((response) => {
|
|
8468
|
-
handleSuccess(`${notificationEntity} deleted`);
|
|
8469
|
-
return response;
|
|
8470
|
-
}).catch((response) => {
|
|
8471
|
-
handleError(response, `Failed to delete ${notificationEntity}`);
|
|
8472
|
-
});
|
|
8473
|
-
};
|
|
8474
|
-
const createMulti = (objects, options2) => {
|
|
8475
|
-
return Promise.all(
|
|
8476
|
-
objects.map((object2) => httpRequest.post(getDataUri(), object2, options2))
|
|
8477
|
-
).then((response) => {
|
|
8478
|
-
handleSuccess(`Created ${notificationEntity}`);
|
|
8479
|
-
return response.data;
|
|
8480
|
-
}).catch((response) => {
|
|
8481
|
-
handleError(response, `Failed to save ${notificationEntity}`);
|
|
8482
|
-
});
|
|
8483
|
-
};
|
|
8484
|
-
return { create, patch, createMulti, delete: _delete, get };
|
|
8485
|
-
};
|
|
8486
|
-
exports.ArrayRenderer = _sfc_main$a;
|
|
8487
|
-
exports.AutocompleteControlRenderer = _sfc_main$j;
|
|
8488
|
-
exports.BooleanControlRenderer = _sfc_main$i;
|
|
8489
|
-
exports.FormComponent = _sfc_main$2;
|
|
8490
|
-
exports.FormComponentEmits = FormComponentEmits;
|
|
8491
|
-
exports.FormComponentProperties = FormComponentProperties;
|
|
8492
|
-
exports.FormModal = _sfc_main;
|
|
8493
|
-
exports.FormModalService = FormModalService;
|
|
8494
|
-
exports.FormStore = FormStore;
|
|
8495
|
-
exports.FormWithActions = _sfc_main$1;
|
|
8496
|
-
exports.FormWithActionsEmits = FormWithActionsEmits;
|
|
8497
|
-
exports.FormWithActionsProperties = FormWithActionsProperties;
|
|
8498
|
-
exports.FormWithTableComponent = _sfc_main$3;
|
|
8499
|
-
exports.FormWithTableEmits = FormWithTableEmits;
|
|
8500
|
-
exports.FormWithTableProperties = FormWithTableProperties;
|
|
8501
|
-
exports.IntegerControlRenderer = _sfc_main$h;
|
|
8502
|
-
exports.MultiSelectControlRender = _sfc_main$f;
|
|
8503
|
-
exports.NumberControlRenderer = _sfc_main$e;
|
|
8504
|
-
exports.SelectControlRender = _sfc_main$d;
|
|
8505
|
-
exports.StringControlRenderer = _sfc_main$c;
|
|
8506
|
-
exports.TableComponent = _sfc_main$4;
|
|
8832
|
+
exports.FormModalEmits = FormModalEmits;
|
|
8833
|
+
exports.FormModalProperties = FormModalProperties;
|
|
8834
|
+
exports.JsonForm = _sfc_main$2;
|
|
8835
|
+
exports.JsonFormModal = _sfc_main$d;
|
|
8836
|
+
exports.JsonFormModalService = JsonFormModalService;
|
|
8837
|
+
exports.JsonFormWithActions = _sfc_main$1;
|
|
8838
|
+
exports.JsonFormWithTable = _sfc_main;
|
|
8839
|
+
exports.TableComponent = _sfc_main$g;
|
|
8507
8840
|
exports.TableComponentEmits = TableComponentEmits;
|
|
8508
8841
|
exports.TableComponentProperties = TableComponentProperties;
|
|
8509
|
-
exports.arrayRenderers = arrayRenderers;
|
|
8510
|
-
exports.controlRenderers = controlRenderers;
|
|
8511
8842
|
exports.createRepository = createRepository;
|
|
8512
|
-
exports.
|
|
8513
|
-
exports.isAutoCompleteControl = isAutoCompleteControl;
|
|
8514
|
-
exports.isBooleanControl = isBooleanControl;
|
|
8515
|
-
exports.isCustomControl = isCustomControl;
|
|
8516
|
-
exports.isMarkdownControl = isMarkdownControl;
|
|
8517
|
-
exports.isMultiselectControl = isMultiselectControl;
|
|
8518
|
-
exports.isSelectControl = isSelectControl;
|
|
8519
|
-
exports.isStringFormat = isStringFormat;
|
|
8520
|
-
exports.isTextAreaControl = isTextAreaControl;
|
|
8521
|
-
exports.layoutRenderers = layoutRenderers;
|
|
8522
|
-
exports.markdownControlRenderer = _sfc_main$g;
|
|
8843
|
+
exports.formatError = formatError;
|
|
8523
8844
|
exports.provideFormEvents = provideFormEvents;
|
|
8845
|
+
exports.registerZodErrorMap = registerZodErrorMap;
|
|
8524
8846
|
exports.useFormEvents = useFormEvents;
|
|
8847
|
+
exports.veeRenderers = customRenderes;
|