@mouseless/baked 1.4.2 → 1.4.3
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/dist/module.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
<div class="flex flex-col gap-8">
|
|
3
3
|
<PageTitle :schema="title">
|
|
4
4
|
<template
|
|
5
|
-
v-if="
|
|
5
|
+
v-if="sections.length > 0"
|
|
6
6
|
#actions
|
|
7
7
|
>
|
|
8
8
|
<Button
|
|
@@ -15,12 +15,12 @@
|
|
|
15
15
|
<div class="flex justify-center">
|
|
16
16
|
<Contents class="gap-6">
|
|
17
17
|
<div
|
|
18
|
-
v-for="section in
|
|
18
|
+
v-for="section in sections"
|
|
19
19
|
:key="section.key"
|
|
20
20
|
class="w-full col-span-2 grid gap-4"
|
|
21
21
|
>
|
|
22
22
|
<div
|
|
23
|
-
v-if="
|
|
23
|
+
v-if="sections.length > 1"
|
|
24
24
|
class="
|
|
25
25
|
pb-2 border-b-2
|
|
26
26
|
border-zinc-100 dark:border-zinc-900
|
|
@@ -35,34 +35,37 @@
|
|
|
35
35
|
{{ l(section.label) }}
|
|
36
36
|
</span>
|
|
37
37
|
</div>
|
|
38
|
-
<
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
gap-4 items-start
|
|
42
|
-
max-md:flex max-md:flex-col
|
|
43
|
-
"
|
|
44
|
-
:class="{ 'grid-cols-2': !singleColumn }"
|
|
45
|
-
:style="{ 'grid-template-rows': `repeat(${section.rowCount}, auto)` }"
|
|
38
|
+
<template
|
|
39
|
+
v-for="(inputGroups, i) in splitByWide(section.inputGroups)"
|
|
40
|
+
:key="`${section.key}_${i}`"
|
|
46
41
|
>
|
|
47
42
|
<div
|
|
48
|
-
v-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
43
|
+
v-if="inputGroups.length > 0"
|
|
44
|
+
class="
|
|
45
|
+
grid grid-cols-2 grid-flow-col
|
|
46
|
+
gap-4 items-start
|
|
47
|
+
max-md:flex max-md:flex-col
|
|
48
|
+
"
|
|
49
|
+
:style="{ 'grid-template-rows': `repeat(${Math.ceil(inputGroups.length / 2)}, auto)` }"
|
|
52
50
|
>
|
|
53
51
|
<div
|
|
54
|
-
|
|
55
|
-
:
|
|
52
|
+
v-for="inputGroup in inputGroups"
|
|
53
|
+
:key="inputGroup.key"
|
|
54
|
+
class="w-full flex gap-4 max-md:flex-col"
|
|
55
|
+
:class="{
|
|
56
|
+
'col-span-2': inputGroup.wide,
|
|
57
|
+
'reset-min-w': inputGroup.inputs.length > 1
|
|
58
|
+
}"
|
|
56
59
|
>
|
|
57
60
|
<Inputs
|
|
58
|
-
:inputs="
|
|
61
|
+
:inputs="inputGroup.inputs"
|
|
59
62
|
input-class="w-full"
|
|
60
|
-
@ready="(value) => onReady(`${section.key}_${
|
|
63
|
+
@ready="(value) => onReady(`${section.key}_${inputGroup.key}`, value)"
|
|
61
64
|
@changed="onChanged"
|
|
62
65
|
/>
|
|
63
66
|
</div>
|
|
64
67
|
</div>
|
|
65
|
-
</
|
|
68
|
+
</template>
|
|
66
69
|
</div>
|
|
67
70
|
</Contents>
|
|
68
71
|
</div>
|
|
@@ -78,48 +81,24 @@ const { schema } = defineProps({
|
|
|
78
81
|
schema: { type: null, required: true }
|
|
79
82
|
});
|
|
80
83
|
const emit = defineEmits(["submit"]);
|
|
81
|
-
const { title, submit,
|
|
84
|
+
const { title, submit, sections } = schema;
|
|
82
85
|
const formData = ref({});
|
|
83
86
|
const readyData = ref({});
|
|
84
87
|
const ready = computed(() => Object.values(readyData.value).every((v) => v));
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
for (let i = 0; i < inputs.length; i++) {
|
|
93
|
-
const input = inputs[i];
|
|
94
|
-
inputsByName[input.name] = { input, i };
|
|
95
|
-
}
|
|
96
|
-
const sectionsWithGroups = [];
|
|
97
|
-
for (const section of sections) {
|
|
98
|
-
const sectionWithGroups = {
|
|
99
|
-
key: section.key,
|
|
100
|
-
label: section.label,
|
|
101
|
-
groups: [],
|
|
102
|
-
groupsByName: {}
|
|
103
|
-
};
|
|
104
|
-
const sortedInputNames = [...section.inputs].sort((l2, r) => inputsByName[l2].i - inputsByName[r].i);
|
|
105
|
-
for (const name of sortedInputNames) {
|
|
106
|
-
const input = inputsByName[name].input;
|
|
107
|
-
const inputGroupName = group[name] || name;
|
|
108
|
-
let inputGroup = sectionWithGroups.groupsByName[inputGroupName];
|
|
109
|
-
if (!inputGroup) {
|
|
110
|
-
inputGroup = {
|
|
111
|
-
name: inputGroupName,
|
|
112
|
-
inputs: [],
|
|
113
|
-
wide: wide.includes(inputGroupName)
|
|
114
|
-
};
|
|
115
|
-
sectionWithGroups.groups.push(inputGroup);
|
|
116
|
-
sectionWithGroups.groupsByName[inputGroupName] = inputGroup;
|
|
88
|
+
function splitByWide(inputGroups) {
|
|
89
|
+
const result = [];
|
|
90
|
+
let cur = [];
|
|
91
|
+
for (const inputGroup of inputGroups) {
|
|
92
|
+
if (!inputGroup.wide) {
|
|
93
|
+
cur.push(inputGroup);
|
|
94
|
+
continue;
|
|
117
95
|
}
|
|
118
|
-
|
|
96
|
+
result.push(cur);
|
|
97
|
+
result.push([inputGroup]);
|
|
98
|
+
cur = [];
|
|
119
99
|
}
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
sectionsWithGroups.push(sectionWithGroups);
|
|
100
|
+
result.push(cur);
|
|
101
|
+
return result;
|
|
123
102
|
}
|
|
124
103
|
function onReady(key, value) {
|
|
125
104
|
Object.assign(readyData.value, { [key]: value });
|
|
@@ -136,5 +115,5 @@ function onSubmit() {
|
|
|
136
115
|
</script>
|
|
137
116
|
|
|
138
117
|
<style>
|
|
139
|
-
.b-component--FormPage .
|
|
118
|
+
.b-component--FormPage .reset-min-w *{@apply min-w-0}
|
|
140
119
|
</style>
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
<InputNumber
|
|
10
10
|
v-model="model"
|
|
11
11
|
v-bind="$attrs"
|
|
12
|
+
:use-grouping="!noGrouping"
|
|
12
13
|
class="min-w-60"
|
|
13
14
|
@input="onInput"
|
|
14
15
|
/>
|
|
@@ -27,7 +28,7 @@ const { schema } = defineProps({
|
|
|
27
28
|
schema: { type: null, required: true }
|
|
28
29
|
});
|
|
29
30
|
const model = defineModel({ type: null, required: true });
|
|
30
|
-
const { label } = schema;
|
|
31
|
+
const { label, noGrouping } = schema;
|
|
31
32
|
const path = context.injectPath();
|
|
32
33
|
function onInput(event) {
|
|
33
34
|
model.value = event.value;
|