@knime/jsonforms 0.1.4
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/CHANGELOG.md +37 -0
- package/LICENSE +710 -0
- package/README.md +125 -0
- package/dist/AnyOfTwinlist-GJ6LGkM1.js +17 -0
- package/dist/ArrayLayout-CbpSgf0X.js +487 -0
- package/dist/ButtonControl-CVu36jz8.js +127 -0
- package/dist/CheckboxControl-DYFLb-qW.js +50 -0
- package/dist/Checkboxes-DlhdiWWA.js +103 -0
- package/dist/CheckboxesControl-DYV72Aua.js +39 -0
- package/dist/ColumnFilter-BbweAsmq.js +17 -0
- package/dist/ColumnSelect-aw7cYcWC.js +60 -0
- package/dist/ComboBoxControl-BqVUWz4q.js +600 -0
- package/dist/CredentialsControl-Ci6ZEuKM.js +20 -0
- package/dist/CredentialsControlBase-CxYOD3ne.js +110 -0
- package/dist/DateControl-ZyQ_vmOW.js +30 -0
- package/dist/DateTimeControl-anye7xvC.js +4 -0
- package/dist/DropdownControl-JX1LF5Tk.js +4 -0
- package/dist/DropdownControl.vue_vue_type_script_setup_true_lang-B5dPfH3x.js +171 -0
- package/dist/DynamicValuesControl-CFubOaRb.js +127 -0
- package/dist/FileChooserControl-Cf_UaWqV.js +605 -0
- package/dist/FileExplorerTab-Ba76jD3y.js +3951 -0
- package/dist/HorizontalLayout-5irQmhXp.js +39 -0
- package/dist/IntegerControl-CqHJWRgn.js +13 -0
- package/dist/IntervalControl-BUhs5_lc.js +549 -0
- package/dist/LayoutComponentWrapper-CDw9BDq5.js +36 -0
- package/dist/LegacyCredentialsControl-DxRZcRVo.js +62 -0
- package/dist/LocalFileChooserControl-DxSeiKxg.js +57 -0
- package/dist/MenuItems.vue_vue_type_style_index_0_lang-qMVpH9oC.js +464 -0
- package/dist/MultiselectListBox-C4ZnJvJJ.js +579 -0
- package/dist/NameFilter-D6EI_V08.js +17 -0
- package/dist/NodeDialog.vue.d.ts +8 -0
- package/dist/NumberControl-DLo0LCsi.js +13 -0
- package/dist/NumberControlBase.vue_vue_type_script_setup_true_lang-B69hrnY1.js +43 -0
- package/dist/NumberInput-BdL-jZ-i.js +219 -0
- package/dist/OneOfDropdown-BmbbuaZk.js +15 -0
- package/dist/RadioControl-GbwpOdAy.js +13 -0
- package/dist/RadioControlBase.vue_vue_type_script_setup_true_lang-BlImm9is.js +128 -0
- package/dist/RichTextControl-CGY3rdM7.js +16895 -0
- package/dist/SectionLayout-CqSFyj1K.js +54 -0
- package/dist/SimpleButtonControl-BgOrTGEP.js +59 -0
- package/dist/SimpleTwinlistControl-ByOlLGIN.js +68 -0
- package/dist/SortListControl-Dege54Dj.js +316 -0
- package/dist/TextAreaControl-CKviHabr.js +111 -0
- package/dist/TextControl-CPL48j4B.js +49 -0
- package/dist/TimeControl-CGsLRgR3.js +842 -0
- package/dist/TwinlistControl-C4XaH_Xc.js +587 -0
- package/dist/TwinlistLoadingInfo-CFlSBQXn.js +1057 -0
- package/dist/ValueSwitch-B9oWSkM_.js +138 -0
- package/dist/ValueSwitchControl-4ODpL58f.js +13 -0
- package/dist/VennDiagramLayout-CabCs-fX.js +104 -0
- package/dist/VerticalLayout-D5HeZyKY.js +39 -0
- package/dist/VerticalLayoutBase-C0PZ-y5d.js +20 -0
- package/dist/arrow-next-CvdR0-WC.js +17 -0
- package/dist/arrow-up-Dsq3EgtE.js +30 -0
- package/dist/createMissingItem-B00Kg95q.js +4 -0
- package/dist/floating-ui.vue.esm-CIFBDytk.js +94 -0
- package/dist/getFlattenedSettings-D64OwqpI.js +7 -0
- package/dist/index-ZDm2GXeD.js +32714 -0
- package/dist/index.d.ts +3 -0
- package/dist/knime-jsonforms.js +5 -0
- package/dist/layoutComponents/Form.vue.d.ts +2 -0
- package/dist/link-BA69Hfx6.js +17 -0
- package/dist/loading/LoadingDialog.vue.d.ts +2 -0
- package/dist/navigator-BYUFe-z3.js +8 -0
- package/dist/style.css +1 -0
- package/dist/useHideOnNull-CCfNP3O7.js +42 -0
- package/package.json +74 -0
package/README.md
ADDED
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
#  KNIME JSONForms integration
|
|
2
|
+
|
|
3
|
+
# TODO: this is a copy from core-ui, needs to be adjusted yet 🚨🚨
|
|
4
|
+
|
|
5
|
+
This repository contains the frontend components of the KNIME JSONForms integration that is based on [Vue].
|
|
6
|
+
It are built as a [Vue library] and used in KNIME Analytics Platform and/or KNIME Hub.
|
|
7
|
+
|
|
8
|
+
## Development
|
|
9
|
+
|
|
10
|
+
### Prerequisites
|
|
11
|
+
|
|
12
|
+
- Install [Node.js][node], see version in [package.json](package.json).
|
|
13
|
+
|
|
14
|
+
Newer versions may also work, but have not been tested.
|
|
15
|
+
|
|
16
|
+
### Install dependencies
|
|
17
|
+
|
|
18
|
+
```sh
|
|
19
|
+
npm install
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
and then use the following commands. For detailed explanations see [Vue CLI docs]:
|
|
23
|
+
|
|
24
|
+
### Git hooks
|
|
25
|
+
|
|
26
|
+
When committing your changes, a couple of commit hooks will run via [husky].
|
|
27
|
+
|
|
28
|
+
- `pre-commit` hook to lint and format the changes in your stage zone (via [lintstaged])
|
|
29
|
+
- `prepare-commit-msg` hook to format your commit message to conform with the required format by KNIME. In order for this to work you must set environment variables with your Atlassian email and API token. Refer to `@knime/eslint-config/scripts/README.md` for more information.
|
|
30
|
+
|
|
31
|
+
### Testing
|
|
32
|
+
|
|
33
|
+
#### Running unit tests
|
|
34
|
+
|
|
35
|
+
This project contains unit tests written with [vitest]. They are run with
|
|
36
|
+
|
|
37
|
+
```sh
|
|
38
|
+
npm run test
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
or one can run unit- and integration-tests individually by
|
|
42
|
+
|
|
43
|
+
```sh
|
|
44
|
+
npm run test:unit
|
|
45
|
+
npm run test:integration
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
You can generate a coverage report with
|
|
49
|
+
|
|
50
|
+
```sh
|
|
51
|
+
npm run coverage
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
The output can be found in the `coverage` folder. It contains a browseable html report as well as raw coverage data in
|
|
55
|
+
[LCOV] and [Clover] format, which can be used in analysis software (SonarQube, Jenkins, …).
|
|
56
|
+
|
|
57
|
+
### Running security audit
|
|
58
|
+
|
|
59
|
+
npm provides a check against known security issues of used dependencies. Run it by calling
|
|
60
|
+
|
|
61
|
+
```sh
|
|
62
|
+
npm run audit
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### Logging
|
|
66
|
+
|
|
67
|
+
You can log using the global `consola` variable (which the embedding application needs to provide).
|
|
68
|
+
|
|
69
|
+
See https://github.com/nuxt/consola for details.
|
|
70
|
+
|
|
71
|
+
## Building
|
|
72
|
+
|
|
73
|
+
To build all views and dialogs, use the following command:
|
|
74
|
+
|
|
75
|
+
```sh
|
|
76
|
+
npm run build
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
To build a single item, use e.g. the following command:
|
|
80
|
+
|
|
81
|
+
```sh
|
|
82
|
+
npm run build:TableView
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
Results are saved to `/dist`.
|
|
86
|
+
|
|
87
|
+
This project can also be built via a maven build wrapper
|
|
88
|
+
|
|
89
|
+
```sh
|
|
90
|
+
mvn clean install
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
## Embedding the views in apps
|
|
94
|
+
|
|
95
|
+
The views can be used in Vue/Nuxt apps like a regular Vue component, e.g. loaded asynchronously.
|
|
96
|
+
|
|
97
|
+
### Requirements
|
|
98
|
+
|
|
99
|
+
The views expect that the embedding app provides the following:
|
|
100
|
+
|
|
101
|
+
- Vue and Consola compatible to the versions defined in [`package.json`](package.json)
|
|
102
|
+
- global `window.consola` instance for logging
|
|
103
|
+
- CSS variables as defined in the `@knime/styles` project.
|
|
104
|
+
They are not included in the build in order to avoid duplication.
|
|
105
|
+
|
|
106
|
+
### Usage example
|
|
107
|
+
|
|
108
|
+
```
|
|
109
|
+
<TableView>
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
# Join the Community!
|
|
113
|
+
|
|
114
|
+
- [KNIME Forum](https://forum.knime.com/)
|
|
115
|
+
|
|
116
|
+
[Vue]: https://vuejs.org/
|
|
117
|
+
[node]: https://knime-com.atlassian.net/wiki/spaces/SPECS/pages/905281540/Node.js+Installation
|
|
118
|
+
[Java]: https://www.oracle.com/technetwork/java/javase/downloads/index.html
|
|
119
|
+
[Vue CLI docs]: https://cli.vuejs.org/guide/
|
|
120
|
+
[Vue libraries]: https://cli.vuejs.org/guide/build-targets.html#library
|
|
121
|
+
[vitest]: https://vitest.dev/
|
|
122
|
+
[LCOV]: https://github.com/linux-test-project/lcov
|
|
123
|
+
[Clover]: http://openclover.org/
|
|
124
|
+
[husky]: https://www.npmjs.com/package/husky
|
|
125
|
+
[lintstaged]: https://github.com/okonet/lint-staged
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { defineComponent as n, openBlock as s, createBlock as t, mergeProps as a } from "vue";
|
|
2
|
+
import { r as i, o as m } from "./index-ZDm2GXeD.js";
|
|
3
|
+
import f from "./SimpleTwinlistControl-ByOlLGIN.js";
|
|
4
|
+
const d = /* @__PURE__ */ n({
|
|
5
|
+
__name: "AnyOfTwinlist",
|
|
6
|
+
props: i(),
|
|
7
|
+
setup(_) {
|
|
8
|
+
const p = (e) => {
|
|
9
|
+
var r, o;
|
|
10
|
+
return (o = (r = e == null ? void 0 : e.schema) == null ? void 0 : r.anyOf) == null ? void 0 : o.map(m);
|
|
11
|
+
};
|
|
12
|
+
return (e, r) => (s(), t(f, a(e.$props, { "options-generator": p }), null, 16));
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
export {
|
|
16
|
+
d as default
|
|
17
|
+
};
|
|
@@ -0,0 +1,487 @@
|
|
|
1
|
+
import { openBlock as c, createElementBlock as h, createElementVNode as p, defineComponent as N, computed as b, createVNode as f, unref as E, toDisplayString as W, createCommentVNode as A, provide as L, onMounted as j, onUnmounted as q, Fragment as R, normalizeStyle as Q, renderSlot as T, renderList as K, resolveComponent as m, createBlock as $, withCtx as w, ref as F, watch as U, nextTick as z, normalizeClass as X, mergeProps as V, createTextVNode as Y } from "vue";
|
|
2
|
+
import { p as M, g as Z, _ as k, q as I, t as ee, v as te, w as oe, x, y as ne, z as re, A as se, F as ae, G as ie, s as le, B as de, l as ce, r as ue, H as me, J as pe, K as he, M as ve, N as ye, O as fe, P as ge, Q as we } from "./index-ZDm2GXeD.js";
|
|
3
|
+
import { A as _e, a as Ae } from "./arrow-up-Dsq3EgtE.js";
|
|
4
|
+
const Ie = {
|
|
5
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
6
|
+
fill: "none",
|
|
7
|
+
stroke: "#000",
|
|
8
|
+
"stroke-linejoin": "round",
|
|
9
|
+
viewBox: "0 0 32 32"
|
|
10
|
+
}, Ce = /* @__PURE__ */ p("path", { d: "m26 7-3 22.5H9L6 7M4 7h24M12 7V2.5h8V7" }, null, -1), Te = [
|
|
11
|
+
Ce
|
|
12
|
+
];
|
|
13
|
+
function $e(e, t) {
|
|
14
|
+
return c(), h("svg", Ie, [...Te]);
|
|
15
|
+
}
|
|
16
|
+
const De = { render: $e }, Ee = {
|
|
17
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
18
|
+
fill: "none",
|
|
19
|
+
stroke: "#000",
|
|
20
|
+
viewBox: "0 0 32 32"
|
|
21
|
+
}, be = /* @__PURE__ */ p("circle", {
|
|
22
|
+
cx: "16",
|
|
23
|
+
cy: "16",
|
|
24
|
+
r: "12.92"
|
|
25
|
+
}, null, -1), Be = /* @__PURE__ */ p("line", {
|
|
26
|
+
x1: "8.499",
|
|
27
|
+
x2: "24.48",
|
|
28
|
+
y1: "15.934",
|
|
29
|
+
y2: "15.934"
|
|
30
|
+
}, null, -1), Le = /* @__PURE__ */ p("line", {
|
|
31
|
+
x1: "15.99",
|
|
32
|
+
x2: "15.99",
|
|
33
|
+
y1: "23.991",
|
|
34
|
+
y2: "8.009"
|
|
35
|
+
}, null, -1), ke = [
|
|
36
|
+
be,
|
|
37
|
+
Be,
|
|
38
|
+
Le
|
|
39
|
+
];
|
|
40
|
+
function Se(e, t) {
|
|
41
|
+
return c(), h("svg", Ee, [...ke]);
|
|
42
|
+
}
|
|
43
|
+
const Pe = { render: Se }, Re = { class: "vertical" }, Fe = { key: 0 }, Ue = /* @__PURE__ */ N({
|
|
44
|
+
__name: "ArrayLayoutItemLabel",
|
|
45
|
+
props: {
|
|
46
|
+
titleConfig: {},
|
|
47
|
+
subTitleProvider: {},
|
|
48
|
+
index: {}
|
|
49
|
+
},
|
|
50
|
+
setup(e) {
|
|
51
|
+
const t = e, o = t.titleConfig, r = o.type === "provided" ? M(o.provider, "") : b(() => `${o.title} ${t.index + 1}`), d = M(t.subTitleProvider, "");
|
|
52
|
+
return (n, l) => (c(), h("div", Re, [
|
|
53
|
+
f(E(Z), {
|
|
54
|
+
text: E(r),
|
|
55
|
+
compact: ""
|
|
56
|
+
}, null, 8, ["text"]),
|
|
57
|
+
E(d) ? (c(), h("span", Fe, W(E(d)), 1)) : A("", !0)
|
|
58
|
+
]));
|
|
59
|
+
}
|
|
60
|
+
}), Me = /* @__PURE__ */ k(Ue, [["__scopeId", "data-v-288d00d0"]]), Ne = (e, t) => {
|
|
61
|
+
const o = "addStateProviderListener", r = I(o);
|
|
62
|
+
L(o, ({ id: n, indexIds: l = [], indices: s = [] }, i) => r(
|
|
63
|
+
{
|
|
64
|
+
id: n,
|
|
65
|
+
indexIds: [e, ...l],
|
|
66
|
+
indices: [t, ...s]
|
|
67
|
+
},
|
|
68
|
+
i
|
|
69
|
+
));
|
|
70
|
+
}, Oe = (e) => {
|
|
71
|
+
const t = "trigger", o = I(t);
|
|
72
|
+
L(t, ({
|
|
73
|
+
id: s,
|
|
74
|
+
indexIds: i = []
|
|
75
|
+
}) => o({
|
|
76
|
+
id: s,
|
|
77
|
+
indexIds: [e, ...i]
|
|
78
|
+
}));
|
|
79
|
+
const d = "isTriggerActive", n = I(d);
|
|
80
|
+
L(d, ({ id: s, indexIds: i = [] }) => n({
|
|
81
|
+
id: s,
|
|
82
|
+
indexIds: [e, ...i]
|
|
83
|
+
}));
|
|
84
|
+
}, Ve = { class: "item-header" }, We = { class: "elements" }, Ke = {
|
|
85
|
+
key: 1,
|
|
86
|
+
class: "element"
|
|
87
|
+
}, ze = { class: "form-component" }, xe = { class: "compensate-label" }, Je = /* @__PURE__ */ N({
|
|
88
|
+
__name: "ArrayLayoutItem",
|
|
89
|
+
props: {
|
|
90
|
+
elements: {},
|
|
91
|
+
elementCheckboxScope: {},
|
|
92
|
+
arrayElementTitle: { type: [Boolean, Object] },
|
|
93
|
+
subTitleProvider: {},
|
|
94
|
+
index: {},
|
|
95
|
+
path: {},
|
|
96
|
+
hasBeenAdded: { type: Boolean },
|
|
97
|
+
id: {},
|
|
98
|
+
idsRecord: {}
|
|
99
|
+
},
|
|
100
|
+
setup(e) {
|
|
101
|
+
const t = e;
|
|
102
|
+
t.hasBeenAdded && ee(), Ne(t.id, t.index), Oe(t.id);
|
|
103
|
+
const o = te(t.idsRecord, t.id);
|
|
104
|
+
L(
|
|
105
|
+
"createArrayAtPath",
|
|
106
|
+
(n) => oe(o, n)
|
|
107
|
+
);
|
|
108
|
+
const r = b(() => x(t.path, `${t.index}`)), d = I("sendAlert");
|
|
109
|
+
return j(() => {
|
|
110
|
+
!t.arrayElementTitle && t.elements.length > 1 && d({
|
|
111
|
+
message: "For displaying more than one row of widgets within an array layout element, the configuration must provide a title for an element.",
|
|
112
|
+
type: ne.ERROR
|
|
113
|
+
});
|
|
114
|
+
}), q(() => {
|
|
115
|
+
re(t.idsRecord, t.id);
|
|
116
|
+
}), (n, l) => n.arrayElementTitle ? (c(), h(R, { key: 0 }, [
|
|
117
|
+
p("div", Ve, [
|
|
118
|
+
p("div", {
|
|
119
|
+
class: "left",
|
|
120
|
+
style: Q({ alignItems: n.subTitleProvider ? "normal" : "baseline" })
|
|
121
|
+
}, [
|
|
122
|
+
n.elementCheckboxScope ? T(n.$slots, "renderer", {
|
|
123
|
+
key: 0,
|
|
124
|
+
path: r.value,
|
|
125
|
+
element: {
|
|
126
|
+
type: "Control",
|
|
127
|
+
scope: n.elementCheckboxScope,
|
|
128
|
+
options: {
|
|
129
|
+
format: E(se)
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}, void 0, !0) : A("", !0),
|
|
133
|
+
f(Me, {
|
|
134
|
+
"title-config": n.arrayElementTitle,
|
|
135
|
+
"sub-title-provider": n.subTitleProvider,
|
|
136
|
+
index: n.index
|
|
137
|
+
}, null, 8, ["title-config", "sub-title-provider", "index"])
|
|
138
|
+
], 4),
|
|
139
|
+
T(n.$slots, "controls", {}, void 0, !0)
|
|
140
|
+
]),
|
|
141
|
+
p("div", We, [
|
|
142
|
+
(c(!0), h(R, null, K(n.elements, ([s, i]) => T(n.$slots, "renderer", {
|
|
143
|
+
key: `${r.value}-${s}`,
|
|
144
|
+
path: r.value,
|
|
145
|
+
element: i
|
|
146
|
+
}, void 0, !0)), 128))
|
|
147
|
+
])
|
|
148
|
+
], 64)) : (c(), h("div", Ke, [
|
|
149
|
+
p("div", ze, [
|
|
150
|
+
T(n.$slots, "renderer", {
|
|
151
|
+
element: n.elements[0][1],
|
|
152
|
+
path: r.value
|
|
153
|
+
}, void 0, !0)
|
|
154
|
+
]),
|
|
155
|
+
p("div", xe, [
|
|
156
|
+
T(n.$slots, "controls", {}, void 0, !0)
|
|
157
|
+
])
|
|
158
|
+
]));
|
|
159
|
+
}
|
|
160
|
+
}), Ge = /* @__PURE__ */ k(Je, [["__scopeId", "data-v-37591509"]]), He = {
|
|
161
|
+
name: "ArrayLayoutItemControls",
|
|
162
|
+
components: {
|
|
163
|
+
TrashIcon: De,
|
|
164
|
+
FunctionButton: ae,
|
|
165
|
+
ArrowUpIcon: _e,
|
|
166
|
+
ArrowDownIcon: Ae
|
|
167
|
+
},
|
|
168
|
+
props: {
|
|
169
|
+
isFirst: {
|
|
170
|
+
type: Boolean,
|
|
171
|
+
default: !1
|
|
172
|
+
},
|
|
173
|
+
isLast: {
|
|
174
|
+
type: Boolean,
|
|
175
|
+
default: !1
|
|
176
|
+
},
|
|
177
|
+
showSortControls: {
|
|
178
|
+
type: Boolean,
|
|
179
|
+
default: !1
|
|
180
|
+
},
|
|
181
|
+
showDeleteButton: {
|
|
182
|
+
type: Boolean,
|
|
183
|
+
default: !1
|
|
184
|
+
}
|
|
185
|
+
},
|
|
186
|
+
emits: ["moveUp", "moveDown", "delete"]
|
|
187
|
+
}, je = { class: "item-controls" };
|
|
188
|
+
function qe(e, t, o, r, d, n) {
|
|
189
|
+
const l = m("ArrowUpIcon"), s = m("FunctionButton"), i = m("ArrowDownIcon"), v = m("TrashIcon");
|
|
190
|
+
return c(), h("div", je, [
|
|
191
|
+
T(e.$slots, "before", {}, void 0, !0),
|
|
192
|
+
o.showSortControls ? (c(), $(s, {
|
|
193
|
+
key: 0,
|
|
194
|
+
disabled: o.isFirst,
|
|
195
|
+
title: "Move up",
|
|
196
|
+
onClick: t[0] || (t[0] = (g) => e.$emit("moveUp"))
|
|
197
|
+
}, {
|
|
198
|
+
default: w(() => [
|
|
199
|
+
f(l)
|
|
200
|
+
]),
|
|
201
|
+
_: 1
|
|
202
|
+
}, 8, ["disabled"])) : A("", !0),
|
|
203
|
+
o.showSortControls ? (c(), $(s, {
|
|
204
|
+
key: 1,
|
|
205
|
+
disabled: o.isLast,
|
|
206
|
+
title: "Move down",
|
|
207
|
+
onClick: t[1] || (t[1] = (g) => e.$emit("moveDown"))
|
|
208
|
+
}, {
|
|
209
|
+
default: w(() => [
|
|
210
|
+
f(i)
|
|
211
|
+
]),
|
|
212
|
+
_: 1
|
|
213
|
+
}, 8, ["disabled"])) : A("", !0),
|
|
214
|
+
o.showDeleteButton ? (c(), $(s, {
|
|
215
|
+
key: 2,
|
|
216
|
+
class: "trashButton",
|
|
217
|
+
title: "Remove",
|
|
218
|
+
onClick: t[2] || (t[2] = (g) => e.$emit("delete"))
|
|
219
|
+
}, {
|
|
220
|
+
default: w(() => [
|
|
221
|
+
f(v, { class: "trash" })
|
|
222
|
+
]),
|
|
223
|
+
_: 1
|
|
224
|
+
})) : A("", !0)
|
|
225
|
+
]);
|
|
226
|
+
}
|
|
227
|
+
const Qe = /* @__PURE__ */ k(He, [["render", qe], ["__scopeId", "data-v-f4f565bd"]]), Xe = 200, Ye = (e) => e.reduce((t, o) => t + o, ""), Ze = (e, t) => {
|
|
228
|
+
const o = F(/* @__PURE__ */ new Map()), r = F(!1), d = I("isTriggerActive"), n = () => {
|
|
229
|
+
let l = !1;
|
|
230
|
+
d({ id: ie }).then((s) => {
|
|
231
|
+
l = !0, s.state === "SUCCESS" && (o.value = s.result.reduce((i, { indices: v, isActive: g }) => (i.set(v[0], g), i), /* @__PURE__ */ new Map()), r.value = !1);
|
|
232
|
+
}), setTimeout(() => {
|
|
233
|
+
l || (r.value = !0);
|
|
234
|
+
}, Xe), r.value = !1;
|
|
235
|
+
};
|
|
236
|
+
return U(
|
|
237
|
+
() => Ye(t.value),
|
|
238
|
+
() => {
|
|
239
|
+
e && (t.value.every((s) => o.value.has(s)) && o.value.size === t.value.length || z(n));
|
|
240
|
+
},
|
|
241
|
+
{ immediate: !0 }
|
|
242
|
+
), { isEdited: o, isEditedIsLoading: r };
|
|
243
|
+
}, et = N({
|
|
244
|
+
name: "ArrayLayout",
|
|
245
|
+
components: {
|
|
246
|
+
DispatchRenderer: le,
|
|
247
|
+
Button: de,
|
|
248
|
+
PlusIcon: Pe,
|
|
249
|
+
DialogComponentWrapper: ce,
|
|
250
|
+
ArrayLayoutItemControls: Qe,
|
|
251
|
+
ArrayLayoutItem: Ge
|
|
252
|
+
},
|
|
253
|
+
props: {
|
|
254
|
+
...ue()
|
|
255
|
+
},
|
|
256
|
+
setup(e) {
|
|
257
|
+
var O;
|
|
258
|
+
const { handleChange: t, control: o } = me(
|
|
259
|
+
e
|
|
260
|
+
), r = b(() => {
|
|
261
|
+
var a;
|
|
262
|
+
return ((a = o.value.data) == null ? void 0 : a.length) ?? 0;
|
|
263
|
+
}), d = F(r.value), n = M(
|
|
264
|
+
(O = o.value.uischema.options) == null ? void 0 : O.elementDefaultValueProvider,
|
|
265
|
+
null
|
|
266
|
+
);
|
|
267
|
+
pe({
|
|
268
|
+
dataPath: o.value.path,
|
|
269
|
+
value: r,
|
|
270
|
+
valueComparator: {
|
|
271
|
+
setSettings: (a) => {
|
|
272
|
+
d.value = a;
|
|
273
|
+
},
|
|
274
|
+
isModified: (a) => d.value !== a
|
|
275
|
+
}
|
|
276
|
+
});
|
|
277
|
+
const l = b(
|
|
278
|
+
() => o.value.data.map(
|
|
279
|
+
(a) => a._id ? a : {
|
|
280
|
+
...a,
|
|
281
|
+
_id: he()
|
|
282
|
+
}
|
|
283
|
+
)
|
|
284
|
+
), s = I("createArrayAtPath")(
|
|
285
|
+
ve(o.value.uischema.scope)
|
|
286
|
+
), i = b(() => l.value.map(({ _id: a }) => a)), v = (a) => a.reduce((y, _) => y + _, "");
|
|
287
|
+
U(
|
|
288
|
+
() => i.value,
|
|
289
|
+
(a, y) => {
|
|
290
|
+
y && v(a) === v(y) || (a.forEach((_, H) => ye(_, H)), y == null || y.filter((_) => !a.includes(_)).forEach((_) => fe(_)));
|
|
291
|
+
},
|
|
292
|
+
{ immediate: !0 }
|
|
293
|
+
);
|
|
294
|
+
const { isEdited: g, isEditedIsLoading: S } = Ze(
|
|
295
|
+
o.value.uischema.options.withEditAndReset,
|
|
296
|
+
i
|
|
297
|
+
);
|
|
298
|
+
U(
|
|
299
|
+
() => v(i.value),
|
|
300
|
+
() => t(o.value.path, l.value),
|
|
301
|
+
{ immediate: !0 }
|
|
302
|
+
);
|
|
303
|
+
const {
|
|
304
|
+
addItem: D,
|
|
305
|
+
moveDown: u,
|
|
306
|
+
moveUp: C,
|
|
307
|
+
removeItems: P,
|
|
308
|
+
control: J
|
|
309
|
+
} = ge(e), G = I("updateData"), B = (a) => async (...y) => {
|
|
310
|
+
a(...y)(), await z(), G(o.value.path);
|
|
311
|
+
};
|
|
312
|
+
return {
|
|
313
|
+
addItem: B(D),
|
|
314
|
+
moveDown: B(u),
|
|
315
|
+
moveUp: B(C),
|
|
316
|
+
removeItems: B(P),
|
|
317
|
+
control: J,
|
|
318
|
+
numElements: r,
|
|
319
|
+
cleanArrayLength: d,
|
|
320
|
+
signedData: l,
|
|
321
|
+
idsRecord: s,
|
|
322
|
+
providedElementDefaultValue: n,
|
|
323
|
+
isEdited: g,
|
|
324
|
+
isEditedIsLoading: S
|
|
325
|
+
};
|
|
326
|
+
},
|
|
327
|
+
data() {
|
|
328
|
+
return {
|
|
329
|
+
arrayElementTitleKey: "arrayElementTitle",
|
|
330
|
+
editResetButtonFormat: we,
|
|
331
|
+
elementCountBeforeAddingOne: -1
|
|
332
|
+
};
|
|
333
|
+
},
|
|
334
|
+
computed: {
|
|
335
|
+
showSortControls() {
|
|
336
|
+
return this.control.uischema.options.showSortButtons;
|
|
337
|
+
},
|
|
338
|
+
showEditAndResetControls() {
|
|
339
|
+
return this.control.uischema.options.withEditAndReset;
|
|
340
|
+
},
|
|
341
|
+
elementCheckboxScope() {
|
|
342
|
+
return this.control.uischema.options.elementCheckboxScope;
|
|
343
|
+
},
|
|
344
|
+
showAddAndDeleteButtons() {
|
|
345
|
+
return !this.control.uischema.options.hasFixedSize;
|
|
346
|
+
},
|
|
347
|
+
elements() {
|
|
348
|
+
return this.control.uischema.options.detail ? Object.entries(this.control.uischema.options.detail) : [];
|
|
349
|
+
},
|
|
350
|
+
arrayElementTitle() {
|
|
351
|
+
var o, r;
|
|
352
|
+
const e = (o = this.control.uischema.options) == null ? void 0 : o.elementTitleProvider;
|
|
353
|
+
if (e)
|
|
354
|
+
return {
|
|
355
|
+
type: "provided",
|
|
356
|
+
provider: e
|
|
357
|
+
};
|
|
358
|
+
const t = (r = this.control.uischema.options) == null ? void 0 : r[this.arrayElementTitleKey];
|
|
359
|
+
return t ? {
|
|
360
|
+
type: "enumerated",
|
|
361
|
+
title: t
|
|
362
|
+
} : !1;
|
|
363
|
+
},
|
|
364
|
+
subTitleProvider() {
|
|
365
|
+
var e;
|
|
366
|
+
return (e = this.control.uischema.options) == null ? void 0 : e.elementSubTitleProvider;
|
|
367
|
+
},
|
|
368
|
+
useCardLayout() {
|
|
369
|
+
return this.arrayElementTitle !== !1;
|
|
370
|
+
}
|
|
371
|
+
},
|
|
372
|
+
methods: {
|
|
373
|
+
createDefaultValue(e) {
|
|
374
|
+
if (this.providedElementDefaultValue !== null)
|
|
375
|
+
return this.providedElementDefaultValue;
|
|
376
|
+
const t = {};
|
|
377
|
+
return Object.keys(e.properties).forEach((o) => {
|
|
378
|
+
t[o] = e.properties[o].default;
|
|
379
|
+
}), t;
|
|
380
|
+
},
|
|
381
|
+
addDefaultItem() {
|
|
382
|
+
this.elementCountBeforeAddingOne = this.numElements, this.addItem(
|
|
383
|
+
this.control.path,
|
|
384
|
+
this.createDefaultValue(
|
|
385
|
+
this.control.schema
|
|
386
|
+
)
|
|
387
|
+
);
|
|
388
|
+
},
|
|
389
|
+
moveItemUp(e) {
|
|
390
|
+
this.moveUp(this.control.path, e);
|
|
391
|
+
},
|
|
392
|
+
moveItemDown(e) {
|
|
393
|
+
this.moveDown(this.control.path, e);
|
|
394
|
+
},
|
|
395
|
+
deleteItem(e) {
|
|
396
|
+
this.removeItems(x(this.control.path, ""), [e]);
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
}), tt = { class: "array" };
|
|
400
|
+
function ot(e, t, o, r, d, n) {
|
|
401
|
+
const l = m("DispatchRenderer"), s = m("ArrayLayoutItemControls"), i = m("ArrayLayoutItem"), v = m("PlusIcon"), g = m("Button"), S = m("DialogComponentWrapper");
|
|
402
|
+
return c(), $(S, { control: e.control }, {
|
|
403
|
+
default: w(() => [
|
|
404
|
+
p("div", tt, [
|
|
405
|
+
(c(!0), h(R, null, K(e.signedData, (D, u) => (c(), h("div", {
|
|
406
|
+
key: `${e.control.path}-${D._id}`,
|
|
407
|
+
class: X(["item", { card: e.useCardLayout }])
|
|
408
|
+
}, [
|
|
409
|
+
f(i, {
|
|
410
|
+
id: D._id,
|
|
411
|
+
"ids-record": e.idsRecord,
|
|
412
|
+
elements: e.elements,
|
|
413
|
+
"array-element-title": e.arrayElementTitle,
|
|
414
|
+
"sub-title-provider": e.subTitleProvider,
|
|
415
|
+
path: e.control.path,
|
|
416
|
+
index: u,
|
|
417
|
+
"has-been-added": u === e.elementCountBeforeAddingOne,
|
|
418
|
+
"element-checkbox-scope": e.elementCheckboxScope
|
|
419
|
+
}, {
|
|
420
|
+
renderer: w(({ element: C, path: P }) => [
|
|
421
|
+
f(l, V({ ref_for: !0 }, e.control, {
|
|
422
|
+
uischema: C,
|
|
423
|
+
path: P
|
|
424
|
+
}), null, 16, ["uischema", "path"])
|
|
425
|
+
]),
|
|
426
|
+
controls: w(() => [
|
|
427
|
+
f(s, {
|
|
428
|
+
"is-first": u === 0,
|
|
429
|
+
"is-last": u === e.control.data.length - 1,
|
|
430
|
+
"show-sort-controls": e.showSortControls,
|
|
431
|
+
"show-delete-button": e.showAddAndDeleteButtons,
|
|
432
|
+
onMoveUp: (C) => e.moveItemUp(u),
|
|
433
|
+
onMoveDown: (C) => e.moveItemDown(u),
|
|
434
|
+
onDelete: (C) => e.deleteItem(u)
|
|
435
|
+
}, {
|
|
436
|
+
before: w(() => [
|
|
437
|
+
e.showEditAndResetControls ? (c(), $(l, V({
|
|
438
|
+
key: 0,
|
|
439
|
+
ref_for: !0
|
|
440
|
+
}, e.control, {
|
|
441
|
+
schema: {
|
|
442
|
+
type: "object",
|
|
443
|
+
properties: {
|
|
444
|
+
_edit: {
|
|
445
|
+
type: "boolean"
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
},
|
|
449
|
+
uischema: {
|
|
450
|
+
scope: "#/properties/_edit",
|
|
451
|
+
options: {
|
|
452
|
+
format: e.editResetButtonFormat
|
|
453
|
+
}
|
|
454
|
+
},
|
|
455
|
+
path: `${e.control.path}.${u}`,
|
|
456
|
+
"initial-is-edited": e.isEdited.get(D._id) ? "" : void 0,
|
|
457
|
+
"is-loading": e.isEditedIsLoading ? "" : void 0
|
|
458
|
+
}), null, 16, ["uischema", "path", "initial-is-edited", "is-loading"])) : A("", !0)
|
|
459
|
+
]),
|
|
460
|
+
_: 2
|
|
461
|
+
}, 1032, ["is-first", "is-last", "show-sort-controls", "show-delete-button", "onMoveUp", "onMoveDown", "onDelete"])
|
|
462
|
+
]),
|
|
463
|
+
_: 2
|
|
464
|
+
}, 1032, ["id", "ids-record", "elements", "array-element-title", "sub-title-provider", "path", "index", "has-been-added", "element-checkbox-scope"])
|
|
465
|
+
], 2))), 128)),
|
|
466
|
+
e.showAddAndDeleteButtons ? (c(), $(g, {
|
|
467
|
+
key: 0,
|
|
468
|
+
class: "add-item-button",
|
|
469
|
+
"with-border": "",
|
|
470
|
+
compact: "",
|
|
471
|
+
onClick: e.addDefaultItem
|
|
472
|
+
}, {
|
|
473
|
+
default: w(() => [
|
|
474
|
+
f(v),
|
|
475
|
+
Y(" " + W(e.control.uischema.options.addButtonText || "New"), 1)
|
|
476
|
+
]),
|
|
477
|
+
_: 1
|
|
478
|
+
}, 8, ["onClick"])) : A("", !0)
|
|
479
|
+
])
|
|
480
|
+
]),
|
|
481
|
+
_: 1
|
|
482
|
+
}, 8, ["control"]);
|
|
483
|
+
}
|
|
484
|
+
const at = /* @__PURE__ */ k(et, [["render", ot], ["__scopeId", "data-v-cbb885fd"]]);
|
|
485
|
+
export {
|
|
486
|
+
at as default
|
|
487
|
+
};
|