@stonecrop/nuxt 0.8.9 → 0.8.11
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
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
<script setup>
|
|
14
14
|
import { useRoute, useRouter } from "nuxt/app";
|
|
15
15
|
import { onMounted, ref, computed, watch, markRaw } from "vue";
|
|
16
|
+
import { getDefaultComponent } from "@stonecrop/schema";
|
|
16
17
|
const route = useRoute();
|
|
17
18
|
const router = useRouter();
|
|
18
19
|
const loading = ref(true);
|
|
@@ -21,7 +22,7 @@ const doctype = computed(() => route.meta.doctype);
|
|
|
21
22
|
const schemaFields = computed(() => route.meta.schema);
|
|
22
23
|
const rootComponent = computed(() => {
|
|
23
24
|
const fields = schemaFields.value || [];
|
|
24
|
-
const rootField = fields.find((f) => f.component);
|
|
25
|
+
const rootField = fields.find((f) => f.fieldtype === "Doctype" && f.component === "ATable");
|
|
25
26
|
if (rootField?.component) {
|
|
26
27
|
return rootField.component;
|
|
27
28
|
}
|
|
@@ -29,7 +30,7 @@ const rootComponent = computed(() => {
|
|
|
29
30
|
});
|
|
30
31
|
const componentProps = computed(() => {
|
|
31
32
|
const fields = schemaFields.value || [];
|
|
32
|
-
const rootField = fields.find((f) => f.component);
|
|
33
|
+
const rootField = fields.find((f) => f.fieldtype === "Doctype" && f.component === "ATable");
|
|
33
34
|
if (rootField?.component === "ATable") {
|
|
34
35
|
return {
|
|
35
36
|
columns: rootField.columns || buildColumnsFromFields(fields),
|
|
@@ -43,34 +44,19 @@ const componentProps = computed(() => {
|
|
|
43
44
|
};
|
|
44
45
|
});
|
|
45
46
|
function buildColumnsFromFields(fields) {
|
|
46
|
-
const excludeTypes = ["Text", "Attach", "JSON", "Table"];
|
|
47
|
-
return fields.filter((f) => !excludeTypes.includes(f.fieldtype)
|
|
47
|
+
const excludeTypes = ["Text", "Attach", "JSON", "Table", "Doctype", "Link"];
|
|
48
|
+
return fields.filter((f) => !excludeTypes.includes(f.fieldtype)).slice(0, 8).map((f) => ({
|
|
48
49
|
name: f.fieldname,
|
|
49
50
|
label: f.label || f.fieldname,
|
|
50
51
|
fieldtype: f.fieldtype,
|
|
51
52
|
width: f.width || "15ch"
|
|
52
53
|
}));
|
|
53
54
|
}
|
|
54
|
-
function fieldtypeToComponent(fieldtype) {
|
|
55
|
-
const mapping = {
|
|
56
|
-
Data: "ATextInput",
|
|
57
|
-
Text: "ATextInput",
|
|
58
|
-
Check: "ACheckbox",
|
|
59
|
-
Int: "ANumericInput",
|
|
60
|
-
Float: "ANumericInput",
|
|
61
|
-
Date: "ADate",
|
|
62
|
-
Datetime: "ADate",
|
|
63
|
-
Select: "ADropdown",
|
|
64
|
-
Link: "AComboBox",
|
|
65
|
-
Attach: "ATextInput"
|
|
66
|
-
};
|
|
67
|
-
return mapping[fieldtype] || "ATextInput";
|
|
68
|
-
}
|
|
69
55
|
function buildFormSchema(fields) {
|
|
70
|
-
return fields.filter((f) =>
|
|
56
|
+
return fields.filter((f) => f.fieldtype !== "Doctype").map((f) => ({
|
|
71
57
|
fieldname: f.fieldname,
|
|
72
58
|
label: f.label || f.fieldname,
|
|
73
|
-
component:
|
|
59
|
+
component: f.component || getDefaultComponent(f.fieldtype),
|
|
74
60
|
fieldtype: f.fieldtype,
|
|
75
61
|
required: f.required,
|
|
76
62
|
readOnly: f.readOnly,
|
|
@@ -80,7 +66,7 @@ function buildFormSchema(fields) {
|
|
|
80
66
|
}
|
|
81
67
|
const isListView = computed(() => {
|
|
82
68
|
const fields = schemaFields.value || [];
|
|
83
|
-
const rootField = fields.find((f) => f.component);
|
|
69
|
+
const rootField = fields.find((f) => f.fieldtype === "Doctype" && f.component === "ATable");
|
|
84
70
|
return rootField?.component === "ATable";
|
|
85
71
|
});
|
|
86
72
|
async function fetchData() {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stonecrop/nuxt",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.11",
|
|
4
4
|
"description": "Nuxt module for Stonecrop",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -44,14 +44,14 @@
|
|
|
44
44
|
"jiti": "^2.4.2",
|
|
45
45
|
"pathe": "^2.0.3",
|
|
46
46
|
"prompts": "^2.4.2",
|
|
47
|
-
"@stonecrop/aform": "0.8.
|
|
48
|
-
"@stonecrop/
|
|
49
|
-
"@stonecrop/
|
|
50
|
-
"@stonecrop/
|
|
51
|
-
"@stonecrop/
|
|
52
|
-
"@stonecrop/
|
|
53
|
-
"@stonecrop/
|
|
54
|
-
"@stonecrop/stonecrop": "0.8.
|
|
47
|
+
"@stonecrop/aform": "0.8.11",
|
|
48
|
+
"@stonecrop/graphql-middleware": "0.8.11",
|
|
49
|
+
"@stonecrop/node-editor": "0.8.11",
|
|
50
|
+
"@stonecrop/atable": "0.8.11",
|
|
51
|
+
"@stonecrop/nuxt-grafserv": "0.8.11",
|
|
52
|
+
"@stonecrop/schema": "0.8.11",
|
|
53
|
+
"@stonecrop/casl-middleware": "0.8.11",
|
|
54
|
+
"@stonecrop/stonecrop": "0.8.11"
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
57
|
"@eslint/js": "^9.39.2",
|