@mouseless/baked 1.5.2 → 1.6.0
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 +1 -1
- package/dist/module.mjs +2 -1
- package/dist/runtime/components/AwaitLoading.d.ts +7 -4
- package/dist/runtime/components/AwaitLoading.js +39 -11
- package/dist/runtime/components/Bake.d.vue.ts +1 -3
- package/dist/runtime/components/Bake.vue +100 -59
- package/dist/runtime/components/Bake.vue.d.ts +1 -3
- package/dist/runtime/components/DataContainer.vue +4 -7
- package/dist/runtime/components/DataPanel.vue +5 -7
- package/dist/runtime/components/DataTable.vue +12 -3
- package/dist/runtime/components/ErrorPage.vue +7 -6
- package/dist/runtime/components/ErrorPopover.d.vue.ts +15 -0
- package/dist/runtime/components/ErrorPopover.vue +22 -0
- package/dist/runtime/components/ErrorPopover.vue.d.ts +15 -0
- package/dist/runtime/components/FormPage.vue +36 -9
- package/dist/runtime/components/InlineError.d.vue.ts +15 -0
- package/dist/runtime/components/InlineError.vue +27 -0
- package/dist/runtime/components/InlineError.vue.d.ts +15 -0
- package/dist/runtime/components/Input.vue +8 -1
- package/dist/runtime/components/InputNumber.vue +16 -16
- package/dist/runtime/components/InputText.vue +15 -15
- package/dist/runtime/components/Inputs.vue +17 -1
- package/dist/runtime/components/Labeler.d.vue.ts +9 -25
- package/dist/runtime/components/Labeler.vue +31 -21
- package/dist/runtime/components/Labeler.vue.d.ts +9 -25
- package/dist/runtime/components/Layout.vue +5 -1
- package/dist/runtime/components/LoadingError.d.vue.ts +13 -0
- package/dist/runtime/components/LoadingError.vue +27 -0
- package/dist/runtime/components/LoadingError.vue.d.ts +13 -0
- package/dist/runtime/components/Message.d.vue.ts +8 -1
- package/dist/runtime/components/Message.vue +48 -17
- package/dist/runtime/components/Message.vue.d.ts +8 -1
- package/dist/runtime/components/NavLink.vue +1 -1
- package/dist/runtime/components/Paginator.vue +1 -3
- package/dist/runtime/components/Select.vue +32 -31
- package/dist/runtime/components/SelectButton.vue +38 -32
- package/dist/runtime/components/SimpleForm.vue +45 -11
- package/dist/runtime/components/TabbedPage.vue +5 -7
- package/dist/runtime/components/Text.vue +1 -1
- package/dist/runtime/components/Validation.d.vue.ts +16 -0
- package/dist/runtime/components/Validation.vue +33 -0
- package/dist/runtime/components/Validation.vue.d.ts +16 -0
- package/dist/runtime/composables/useBakeError.d.ts +13 -0
- package/dist/runtime/composables/useBakeError.js +51 -0
- package/dist/runtime/composables/useContext.d.ts +8 -0
- package/dist/runtime/composables/useContext.js +47 -2
- package/dist/runtime/composables/useDataMounter.d.ts +4 -2
- package/dist/runtime/composables/useDataMounter.js +15 -6
- package/dist/runtime/composables/useDefaultValidation.d.ts +4 -0
- package/dist/runtime/composables/useDefaultValidation.js +37 -0
- package/dist/runtime/composables/useValidation.d.ts +11 -0
- package/dist/runtime/composables/useValidation.js +48 -0
- package/dist/runtime/plugins/errorHandling.js +2 -2
- package/package.json +14 -14
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export default function _default(): {
|
|
2
|
+
validate: ({ model, inputs, composables }: {
|
|
3
|
+
model: any;
|
|
4
|
+
inputs: any;
|
|
5
|
+
composables?: never[] | undefined;
|
|
6
|
+
}) => {
|
|
7
|
+
isValid: import("vue").ComputedRef<boolean>;
|
|
8
|
+
messages: import("vue").ComputedRef<string>;
|
|
9
|
+
validations: import("vue").ComputedRef<any>;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { computed } from "vue";
|
|
2
|
+
import { useContext, useComposableResolver } from "#imports";
|
|
3
|
+
|
|
4
|
+
export default function() {
|
|
5
|
+
const context = useContext();
|
|
6
|
+
const composableResolver = useComposableResolver();
|
|
7
|
+
|
|
8
|
+
function validate({ model, inputs, composables = [] }) {
|
|
9
|
+
const validationComposables = ["useDefaultValidation", ...composables.map(c => c.name)].map(vc => {
|
|
10
|
+
try {
|
|
11
|
+
return composableResolver.resolve(vc).default;
|
|
12
|
+
} catch {
|
|
13
|
+
console.error(`${vc} not loaded`);
|
|
14
|
+
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
}).filter(v => v);
|
|
18
|
+
|
|
19
|
+
const validations = computed(() =>
|
|
20
|
+
validationComposables.reduce((acc, useComposable) => ({
|
|
21
|
+
...acc,
|
|
22
|
+
...useComposable({
|
|
23
|
+
inputs,
|
|
24
|
+
model: model.value
|
|
25
|
+
})
|
|
26
|
+
}), {})
|
|
27
|
+
);
|
|
28
|
+
|
|
29
|
+
context.provideValidations(validations);
|
|
30
|
+
|
|
31
|
+
const isValid = computed(() =>
|
|
32
|
+
Object.values(validations.value).every(v => v.valid)
|
|
33
|
+
);
|
|
34
|
+
|
|
35
|
+
const messages = computed(() =>
|
|
36
|
+
Object.values(validations.value)
|
|
37
|
+
.filter(v => v.message)
|
|
38
|
+
.map((v, i) => `${i > 0 ? "\n" : ""} - ${v.message}`)
|
|
39
|
+
.join("")
|
|
40
|
+
);
|
|
41
|
+
|
|
42
|
+
return { isValid, messages, validations };
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
return {
|
|
46
|
+
validate
|
|
47
|
+
};
|
|
48
|
+
}
|
|
@@ -83,7 +83,7 @@ function getMessage(error) {
|
|
|
83
83
|
severity: "error",
|
|
84
84
|
summary: error.data?.title ?? error.statusCode ?? l($defaultAlert.title),
|
|
85
85
|
detail: error.data?.detail ?? error.message ?? error.cause ?? l($defaultAlert.message),
|
|
86
|
-
|
|
86
|
+
wide: true
|
|
87
87
|
};
|
|
88
88
|
}
|
|
89
89
|
|
|
@@ -91,6 +91,6 @@ function getMessage(error) {
|
|
|
91
91
|
severity: "error",
|
|
92
92
|
summary: error.statusCode ?? error.status ?? l($defaultAlert.title),
|
|
93
93
|
detail: error.message ?? error.cause ?? l($defaultAlert.message),
|
|
94
|
-
|
|
94
|
+
wide: true
|
|
95
95
|
};
|
|
96
96
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mouseless/baked",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.0",
|
|
4
4
|
"description": "Baked is an opinionated framework for .NET and Vue. This is the UI package of Baked project.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"baked",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"lint": "eslint ."
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@nuxtjs/i18n": "10.
|
|
46
|
+
"@nuxtjs/i18n": "10.4.0",
|
|
47
47
|
"@nuxtjs/tailwindcss": "6.14.0",
|
|
48
48
|
"@primeuix/themes": "2.0.3",
|
|
49
49
|
"async-mutex": "0.5.0",
|
|
@@ -54,21 +54,21 @@
|
|
|
54
54
|
"@nuxt/eslint": "1.15.2",
|
|
55
55
|
"@nuxt/module-builder": "1.0.2",
|
|
56
56
|
"@nuxt/test-utils": "4.0.3",
|
|
57
|
-
"@playwright/test": "1.
|
|
58
|
-
"@types/node": "25.
|
|
57
|
+
"@playwright/test": "1.60.0",
|
|
58
|
+
"@types/node": "25.9.1",
|
|
59
59
|
"changelogen": "0.6.2",
|
|
60
|
-
"nuxt": "4.4.
|
|
61
|
-
"sass": "1.
|
|
60
|
+
"nuxt": "4.4.6",
|
|
61
|
+
"sass": "1.100.0",
|
|
62
62
|
"typescript": "6.0.3",
|
|
63
|
-
"vitest": "4.1.
|
|
64
|
-
"vue-tsc": "3.2
|
|
63
|
+
"vitest": "4.1.7",
|
|
64
|
+
"vue-tsc": "3.3.2"
|
|
65
65
|
},
|
|
66
66
|
"optionalDependencies": {
|
|
67
|
-
"@oxc-parser/binding-darwin-arm64": "0.
|
|
68
|
-
"@oxc-parser/binding-linux-arm64-gnu": "0.
|
|
69
|
-
"@oxc-parser/binding-linux-arm64-musl": "0.
|
|
70
|
-
"@oxc-parser/binding-linux-x64-gnu": "0.
|
|
71
|
-
"@oxc-parser/binding-linux-x64-musl": "0.
|
|
72
|
-
"@oxc-parser/binding-win32-x64-msvc": "0.
|
|
67
|
+
"@oxc-parser/binding-darwin-arm64": "0.133.0",
|
|
68
|
+
"@oxc-parser/binding-linux-arm64-gnu": "0.133.0",
|
|
69
|
+
"@oxc-parser/binding-linux-arm64-musl": "0.133.0",
|
|
70
|
+
"@oxc-parser/binding-linux-x64-gnu": "0.133.0",
|
|
71
|
+
"@oxc-parser/binding-linux-x64-musl": "0.133.0",
|
|
72
|
+
"@oxc-parser/binding-win32-x64-msvc": "0.133.0"
|
|
73
73
|
}
|
|
74
74
|
}
|