glib-web 4.13.1 → 4.14.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/actions/logics/set.js
CHANGED
|
@@ -40,12 +40,12 @@ const sum = function (...args) {
|
|
|
40
40
|
jsonLogic.add_operation("sum", sum);
|
|
41
41
|
|
|
42
42
|
const count = function (args) {
|
|
43
|
-
return args.length;
|
|
43
|
+
return [args].flat().length;
|
|
44
44
|
};
|
|
45
45
|
jsonLogic.add_operation("count", count);
|
|
46
46
|
|
|
47
47
|
const countNonNull = function (args) {
|
|
48
|
-
return args.reduce((accumulator, currentValue) => {
|
|
48
|
+
return [args].flat().reduce((accumulator, currentValue) => {
|
|
49
49
|
if (isPresent(currentValue)) {
|
|
50
50
|
accumulator++;
|
|
51
51
|
}
|
|
@@ -97,6 +97,7 @@ function useGlibInput({ props }) {
|
|
|
97
97
|
// save fieldModel to spec so data still intact even if component unmounted
|
|
98
98
|
const instance = getCurrentInstance();
|
|
99
99
|
onBeforeUpdate(() => {
|
|
100
|
+
if (!instance.ctx.spec) return;
|
|
100
101
|
instance.ctx.spec.value = instance.ctx.fieldModel;
|
|
101
102
|
});
|
|
102
103
|
|
|
@@ -58,11 +58,7 @@ export default defineComponent({
|
|
|
58
58
|
},
|
|
59
59
|
computed: {
|
|
60
60
|
values() {
|
|
61
|
-
|
|
62
|
-
return opts.reduce((prev, curr) => {
|
|
63
|
-
if (this.fieldModel.includes(curr)) prev.push(curr);
|
|
64
|
-
return prev;
|
|
65
|
-
}, []);
|
|
61
|
+
return this.fieldModel || [];
|
|
66
62
|
}
|
|
67
63
|
}
|
|
68
64
|
});
|
|
@@ -70,6 +70,14 @@
|
|
|
70
70
|
<v-list-item-title>Load More</v-list-item-title>
|
|
71
71
|
</v-list-item-content>
|
|
72
72
|
</v-list-item> -->
|
|
73
|
+
|
|
74
|
+
<template v-slot:prepend-item>
|
|
75
|
+
<common-responsive v-if="spec.header" :spec="spec.header" />
|
|
76
|
+
</template>
|
|
77
|
+
|
|
78
|
+
<template v-slot:append-item>
|
|
79
|
+
<common-responsive v-if="spec.footer" :spec="spec.footer" />
|
|
80
|
+
</template>
|
|
73
81
|
</v-autocomplete>
|
|
74
82
|
|
|
75
83
|
<input v-for="(item, index) in values" :key="index" type="hidden" :name="spec.name" :value="item.value" />
|
|
@@ -5,6 +5,7 @@ import Action from "../../action";
|
|
|
5
5
|
import { triggerOnChange } from "../composable/form";
|
|
6
6
|
import { realComponent } from "../helper";
|
|
7
7
|
import set from "lodash.set";
|
|
8
|
+
import merge from "lodash.merge";
|
|
8
9
|
const NUMBER_PRECISION = 2;
|
|
9
10
|
const isNeedToBeFixed = (val, component) => {
|
|
10
11
|
return component.type == 'number' && !Number.isInteger(val) && Number.isFinite(val);
|
|
@@ -20,9 +21,9 @@ const jsonLogicData = (data) => {
|
|
|
20
21
|
if (path.includes('.')) {
|
|
21
22
|
const obj = {};
|
|
22
23
|
set(obj, path, value);
|
|
23
|
-
return
|
|
24
|
+
return merge(prev, obj);
|
|
24
25
|
} else {
|
|
25
|
-
return
|
|
26
|
+
return merge(prev, { [path]: value });
|
|
26
27
|
}
|
|
27
28
|
}, {});
|
|
28
29
|
};
|
|
@@ -306,6 +307,7 @@ export default {
|
|
|
306
307
|
vm._submitWhenNotDisplayed = data.submitWhenNotDisplayed;
|
|
307
308
|
|
|
308
309
|
if (!vm.spec.tooltip && data.tooltip) {
|
|
310
|
+
console.log(data);
|
|
309
311
|
this.initTooltip();
|
|
310
312
|
}
|
|
311
313
|
|
|
@@ -18,8 +18,8 @@ Form Data:
|
|
|
18
18
|
"chip_group": "option2",
|
|
19
19
|
"radio_group": "option3",
|
|
20
20
|
"check_group": [
|
|
21
|
-
"
|
|
22
|
-
"
|
|
21
|
+
"option3",
|
|
22
|
+
"option1"
|
|
23
23
|
],
|
|
24
24
|
"text": "John Doe",
|
|
25
25
|
"textarea": "Lorem ipsum et dumet bla bla bla..."
|
|
@@ -52,8 +52,8 @@ Form Data:
|
|
|
52
52
|
"chip_group": "option2",
|
|
53
53
|
"radio_group": "option3",
|
|
54
54
|
"check_group": [
|
|
55
|
-
"
|
|
56
|
-
"
|
|
55
|
+
"option3",
|
|
56
|
+
"option1"
|
|
57
57
|
],
|
|
58
58
|
"text": "Jack Doe",
|
|
59
59
|
"textarea": "Lorem ipsum et dumet bla bla bla..."
|