@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,15 @@
|
|
|
1
|
+
declare const _default: typeof __VLS_export;
|
|
2
|
+
export default _default;
|
|
3
|
+
declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
4
|
+
error: {
|
|
5
|
+
type: null;
|
|
6
|
+
default: undefined;
|
|
7
|
+
};
|
|
8
|
+
}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
9
|
+
error: {
|
|
10
|
+
type: null;
|
|
11
|
+
default: undefined;
|
|
12
|
+
};
|
|
13
|
+
}>> & Readonly<{}>, {
|
|
14
|
+
error: any;
|
|
15
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
@@ -9,8 +9,9 @@
|
|
|
9
9
|
<script setup>
|
|
10
10
|
import { computed, watch } from "vue";
|
|
11
11
|
import { useRoute, useRouter } from "#app";
|
|
12
|
-
import { useDataMounter } from "#imports";
|
|
12
|
+
import { useDataMounter, useContext } from "#imports";
|
|
13
13
|
import { Bake } from "#components";
|
|
14
|
+
const context = useContext();
|
|
14
15
|
const { mount: mountData, onAfterMount: onAfterMountData } = useDataMounter();
|
|
15
16
|
const route = useRoute();
|
|
16
17
|
const router = useRouter();
|
|
@@ -18,8 +19,11 @@ const { schema } = defineProps({
|
|
|
18
19
|
schema: { type: Object, required: true }
|
|
19
20
|
});
|
|
20
21
|
const model = defineModel({ type: null, required: true });
|
|
22
|
+
const validations = context.injectValidations();
|
|
21
23
|
const defaultValue = mountData(schema.default);
|
|
22
24
|
const query = schema.queryBound ? computed(() => route.query[schema.name]) : void 0;
|
|
25
|
+
const validation = computed(() => validations.value[schema.name] || {});
|
|
26
|
+
context.provideValidation(validation);
|
|
23
27
|
onAfterMountData(async () => {
|
|
24
28
|
if (!checkValue(model.value)) {
|
|
25
29
|
if (schema.queryBound && checkValue(query.value)) {
|
|
@@ -73,6 +77,9 @@ function checkValue(value) {
|
|
|
73
77
|
return value !== void 0 && value !== null;
|
|
74
78
|
}
|
|
75
79
|
function setModel(value) {
|
|
80
|
+
if (value === model.value) {
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
76
83
|
if (!schema.numeric) {
|
|
77
84
|
model.value = value;
|
|
78
85
|
} else {
|
|
@@ -5,33 +5,33 @@
|
|
|
5
5
|
<Skeleton class="min-h-10" />
|
|
6
6
|
</div>
|
|
7
7
|
</template>
|
|
8
|
-
<
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
</
|
|
8
|
+
<Validation>
|
|
9
|
+
<Labeler
|
|
10
|
+
:label
|
|
11
|
+
:path
|
|
12
|
+
>
|
|
13
|
+
<InputNumber
|
|
14
|
+
v-model="model"
|
|
15
|
+
v-bind="$attrs"
|
|
16
|
+
:use-grouping="!noGrouping"
|
|
17
|
+
class="min-w-60"
|
|
18
|
+
@input="onInput"
|
|
19
|
+
/>
|
|
20
|
+
</Labeler>
|
|
21
|
+
</Validation>
|
|
22
22
|
</AwaitLoading>
|
|
23
23
|
</template>
|
|
24
24
|
|
|
25
25
|
<script setup>
|
|
26
26
|
import { InputNumber, Skeleton } from "primevue";
|
|
27
27
|
import { useContext } from "#imports";
|
|
28
|
-
import { AwaitLoading, Labeler } from "#components";
|
|
28
|
+
import { AwaitLoading, Labeler, Validation } from "#components";
|
|
29
29
|
const context = useContext();
|
|
30
30
|
const { schema } = defineProps({
|
|
31
31
|
schema: { type: null, required: true }
|
|
32
32
|
});
|
|
33
33
|
const model = defineModel({ type: null, required: true });
|
|
34
|
-
const { label,
|
|
34
|
+
const { label, noGrouping } = schema;
|
|
35
35
|
const path = context.injectPath();
|
|
36
36
|
function onInput(event) {
|
|
37
37
|
model.value = event.value;
|
|
@@ -5,19 +5,19 @@
|
|
|
5
5
|
<Skeleton class="min-h-10" />
|
|
6
6
|
</div>
|
|
7
7
|
</template>
|
|
8
|
-
<
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
</
|
|
8
|
+
<Validation>
|
|
9
|
+
<Labeler
|
|
10
|
+
:label
|
|
11
|
+
:path
|
|
12
|
+
>
|
|
13
|
+
<InputText
|
|
14
|
+
v-model="input"
|
|
15
|
+
v-bind="$attrs"
|
|
16
|
+
class="min-w-60"
|
|
17
|
+
@update:model-value="onUpdate"
|
|
18
|
+
/>
|
|
19
|
+
</Labeler>
|
|
20
|
+
</Validation>
|
|
21
21
|
</AwaitLoading>
|
|
22
22
|
</template>
|
|
23
23
|
|
|
@@ -25,13 +25,13 @@
|
|
|
25
25
|
import { ref, watch } from "vue";
|
|
26
26
|
import { InputText, Skeleton } from "primevue";
|
|
27
27
|
import { useContext } from "#imports";
|
|
28
|
-
import { AwaitLoading, Labeler } from "#components";
|
|
28
|
+
import { AwaitLoading, Labeler, Validation } from "#components";
|
|
29
29
|
const context = useContext();
|
|
30
30
|
const { schema } = defineProps({
|
|
31
31
|
schema: { type: null, required: true }
|
|
32
32
|
});
|
|
33
33
|
const model = defineModel({ type: null, required: true });
|
|
34
|
-
const { label,
|
|
34
|
+
const { label, targetProp } = schema;
|
|
35
35
|
const path = context.injectPath();
|
|
36
36
|
const input = ref("");
|
|
37
37
|
watch(model, (newValue) => {
|
|
@@ -5,11 +5,13 @@
|
|
|
5
5
|
v-model="models[input.name]"
|
|
6
6
|
:schema="input"
|
|
7
7
|
:class="inputClass"
|
|
8
|
+
:invalid="invalid(input.name)"
|
|
9
|
+
@blur="() => touched(input.name)"
|
|
8
10
|
/>
|
|
9
11
|
</template>
|
|
10
12
|
|
|
11
13
|
<script setup>
|
|
12
|
-
import { computed, reactive, watch } from "vue";
|
|
14
|
+
import { computed, reactive, ref, watch } from "vue";
|
|
13
15
|
import { useContext, useRoute } from "#imports";
|
|
14
16
|
import { Input } from "#components";
|
|
15
17
|
const context = useContext();
|
|
@@ -20,6 +22,8 @@ const { inputs } = defineProps({
|
|
|
20
22
|
});
|
|
21
23
|
const emit = defineEmits(["ready", "changed"]);
|
|
22
24
|
const parentPath = context.injectPath();
|
|
25
|
+
const validations = context.injectValidations();
|
|
26
|
+
const inputEvents = ref({});
|
|
23
27
|
const models = reactive({});
|
|
24
28
|
const values = computed(
|
|
25
29
|
() => inputs.reduce((result, input) => {
|
|
@@ -60,4 +64,16 @@ function getValue(input) {
|
|
|
60
64
|
return models[input.name];
|
|
61
65
|
}
|
|
62
66
|
}
|
|
67
|
+
function touched(key) {
|
|
68
|
+
inputEvents.value[key] = { touched: true };
|
|
69
|
+
}
|
|
70
|
+
function invalid(input) {
|
|
71
|
+
if (!Object.values(validations.value).length) {
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
if (!validations.value[input]?.valid && validations.value[input]?.persist) {
|
|
75
|
+
return true;
|
|
76
|
+
}
|
|
77
|
+
return !validations.value[input]?.valid && inputEvents.value[input]?.touched || false;
|
|
78
|
+
}
|
|
63
79
|
</script>
|
|
@@ -6,61 +6,45 @@ type __VLS_WithSlots<T, S> = T & (new () => {
|
|
|
6
6
|
});
|
|
7
7
|
declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
8
8
|
label: {
|
|
9
|
-
type:
|
|
9
|
+
type: ObjectConstructor;
|
|
10
10
|
default: null;
|
|
11
11
|
};
|
|
12
12
|
path: {
|
|
13
13
|
type: StringConstructor;
|
|
14
14
|
required: true;
|
|
15
15
|
};
|
|
16
|
-
mode: {
|
|
17
|
-
type: StringConstructor;
|
|
18
|
-
default: null;
|
|
19
|
-
};
|
|
20
|
-
variant: {
|
|
21
|
-
type: StringConstructor;
|
|
22
|
-
default: string;
|
|
23
|
-
};
|
|
24
16
|
pt: {
|
|
25
17
|
type: ObjectConstructor;
|
|
26
|
-
default: () =>
|
|
18
|
+
default: () => {};
|
|
27
19
|
};
|
|
28
20
|
dt: {
|
|
29
21
|
type: ObjectConstructor;
|
|
30
|
-
default: () =>
|
|
22
|
+
default: () => {};
|
|
31
23
|
};
|
|
32
24
|
}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
33
25
|
label: {
|
|
34
|
-
type:
|
|
26
|
+
type: ObjectConstructor;
|
|
35
27
|
default: null;
|
|
36
28
|
};
|
|
37
29
|
path: {
|
|
38
30
|
type: StringConstructor;
|
|
39
31
|
required: true;
|
|
40
32
|
};
|
|
41
|
-
mode: {
|
|
42
|
-
type: StringConstructor;
|
|
43
|
-
default: null;
|
|
44
|
-
};
|
|
45
|
-
variant: {
|
|
46
|
-
type: StringConstructor;
|
|
47
|
-
default: string;
|
|
48
|
-
};
|
|
49
33
|
pt: {
|
|
50
34
|
type: ObjectConstructor;
|
|
51
|
-
default: () =>
|
|
35
|
+
default: () => {};
|
|
52
36
|
};
|
|
53
37
|
dt: {
|
|
54
38
|
type: ObjectConstructor;
|
|
55
|
-
default: () =>
|
|
39
|
+
default: () => {};
|
|
56
40
|
};
|
|
57
41
|
}>> & Readonly<{}>, {
|
|
58
|
-
label: string
|
|
59
|
-
variant: string;
|
|
42
|
+
label: Record<string, any>;
|
|
60
43
|
dt: Record<string, any>;
|
|
61
44
|
pt: Record<string, any>;
|
|
62
|
-
mode: string;
|
|
63
45
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
64
46
|
type __VLS_Slots = {
|
|
65
47
|
default?: ((props: {}) => any) | undefined;
|
|
48
|
+
} & {
|
|
49
|
+
default?: ((props: {}) => any) | undefined;
|
|
66
50
|
};
|
|
@@ -1,18 +1,22 @@
|
|
|
1
1
|
<template>
|
|
2
|
+
<template v-if="!text">
|
|
3
|
+
<slot />
|
|
4
|
+
</template>
|
|
2
5
|
<component
|
|
3
6
|
:is="labelComponent"
|
|
7
|
+
v-else
|
|
4
8
|
:dt
|
|
5
9
|
:pt
|
|
6
10
|
:variant
|
|
11
|
+
:required
|
|
7
12
|
>
|
|
8
13
|
<template #default>
|
|
9
14
|
<slot />
|
|
10
15
|
<label
|
|
11
|
-
v-if="labelComponent !== 'div'"
|
|
12
16
|
class="max-sm:truncate max-sm:w-5/6"
|
|
13
17
|
:for="path"
|
|
14
18
|
>
|
|
15
|
-
{{
|
|
19
|
+
{{ localizedText }}
|
|
16
20
|
</label>
|
|
17
21
|
</template>
|
|
18
22
|
</component>
|
|
@@ -21,29 +25,35 @@
|
|
|
21
25
|
<script setup>
|
|
22
26
|
import { computed } from "vue";
|
|
23
27
|
import { FloatLabel, IftaLabel } from "primevue";
|
|
24
|
-
import { useLocalization } from "#imports";
|
|
25
|
-
const
|
|
26
|
-
const {
|
|
27
|
-
|
|
28
|
+
import { useContext, useLocalization } from "#imports";
|
|
29
|
+
const context = useContext();
|
|
30
|
+
const { localize: l } = useLocalization({});
|
|
31
|
+
const { localize: lc } = useLocalization({ group: "Labeler" });
|
|
32
|
+
const { label } = defineProps({
|
|
33
|
+
label: { type: Object, default: null },
|
|
28
34
|
path: { type: String, required: true },
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
+
pt: { type: Object, default: () => ({}) },
|
|
36
|
+
dt: { type: Object, default: () => ({}) }
|
|
37
|
+
});
|
|
38
|
+
const { text, mode, variant = "on", showOptionality } = label ?? {};
|
|
39
|
+
const validation = context.injectValidation();
|
|
40
|
+
const required = computed(() => validation?.value?.required);
|
|
41
|
+
const localizedText = computed(() => {
|
|
42
|
+
if (!showOptionality) {
|
|
43
|
+
return l(text);
|
|
44
|
+
}
|
|
45
|
+
if (required.value) {
|
|
46
|
+
return lc("{label} (Required)", { label: l(text) });
|
|
47
|
+
}
|
|
48
|
+
return lc("{label} (Optional)", { label: l(text) });
|
|
35
49
|
});
|
|
36
50
|
const labelComponent = computed(() => {
|
|
37
|
-
if (
|
|
38
|
-
return
|
|
51
|
+
if (mode === "ifta") {
|
|
52
|
+
return IftaLabel;
|
|
39
53
|
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
return IftaLabel;
|
|
43
|
-
case "float":
|
|
44
|
-
return FloatLabel;
|
|
45
|
-
default:
|
|
46
|
-
return "div";
|
|
54
|
+
if (mode === "float") {
|
|
55
|
+
return FloatLabel;
|
|
47
56
|
}
|
|
57
|
+
throw new Error("`mode` must be set when `text` is set");
|
|
48
58
|
});
|
|
49
59
|
</script>
|
|
@@ -6,61 +6,45 @@ type __VLS_WithSlots<T, S> = T & (new () => {
|
|
|
6
6
|
});
|
|
7
7
|
declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
8
8
|
label: {
|
|
9
|
-
type:
|
|
9
|
+
type: ObjectConstructor;
|
|
10
10
|
default: null;
|
|
11
11
|
};
|
|
12
12
|
path: {
|
|
13
13
|
type: StringConstructor;
|
|
14
14
|
required: true;
|
|
15
15
|
};
|
|
16
|
-
mode: {
|
|
17
|
-
type: StringConstructor;
|
|
18
|
-
default: null;
|
|
19
|
-
};
|
|
20
|
-
variant: {
|
|
21
|
-
type: StringConstructor;
|
|
22
|
-
default: string;
|
|
23
|
-
};
|
|
24
16
|
pt: {
|
|
25
17
|
type: ObjectConstructor;
|
|
26
|
-
default: () =>
|
|
18
|
+
default: () => {};
|
|
27
19
|
};
|
|
28
20
|
dt: {
|
|
29
21
|
type: ObjectConstructor;
|
|
30
|
-
default: () =>
|
|
22
|
+
default: () => {};
|
|
31
23
|
};
|
|
32
24
|
}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
33
25
|
label: {
|
|
34
|
-
type:
|
|
26
|
+
type: ObjectConstructor;
|
|
35
27
|
default: null;
|
|
36
28
|
};
|
|
37
29
|
path: {
|
|
38
30
|
type: StringConstructor;
|
|
39
31
|
required: true;
|
|
40
32
|
};
|
|
41
|
-
mode: {
|
|
42
|
-
type: StringConstructor;
|
|
43
|
-
default: null;
|
|
44
|
-
};
|
|
45
|
-
variant: {
|
|
46
|
-
type: StringConstructor;
|
|
47
|
-
default: string;
|
|
48
|
-
};
|
|
49
33
|
pt: {
|
|
50
34
|
type: ObjectConstructor;
|
|
51
|
-
default: () =>
|
|
35
|
+
default: () => {};
|
|
52
36
|
};
|
|
53
37
|
dt: {
|
|
54
38
|
type: ObjectConstructor;
|
|
55
|
-
default: () =>
|
|
39
|
+
default: () => {};
|
|
56
40
|
};
|
|
57
41
|
}>> & Readonly<{}>, {
|
|
58
|
-
label: string
|
|
59
|
-
variant: string;
|
|
42
|
+
label: Record<string, any>;
|
|
60
43
|
dt: Record<string, any>;
|
|
61
44
|
pt: Record<string, any>;
|
|
62
|
-
mode: string;
|
|
63
45
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
64
46
|
type __VLS_Slots = {
|
|
65
47
|
default?: ((props: {}) => any) | undefined;
|
|
48
|
+
} & {
|
|
49
|
+
default?: ((props: {}) => any) | undefined;
|
|
66
50
|
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
declare const _default: typeof __VLS_export;
|
|
2
|
+
export default _default;
|
|
3
|
+
declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
4
|
+
error: {
|
|
5
|
+
type: ObjectConstructor;
|
|
6
|
+
required: true;
|
|
7
|
+
};
|
|
8
|
+
}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
9
|
+
error: {
|
|
10
|
+
type: ObjectConstructor;
|
|
11
|
+
required: true;
|
|
12
|
+
};
|
|
13
|
+
}>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
class="
|
|
4
|
+
rounded-md pl-1
|
|
5
|
+
bg-red-500/10 text-red-500
|
|
6
|
+
"
|
|
7
|
+
>
|
|
8
|
+
<span
|
|
9
|
+
v-tooltip.bottom="{
|
|
10
|
+
value: `${title} - ${detail}`,
|
|
11
|
+
autoHide: false,
|
|
12
|
+
pt: {
|
|
13
|
+
text: { class: 'bg-red-500' },
|
|
14
|
+
arrow: { class: 'border-y-red-500' },
|
|
15
|
+
}
|
|
16
|
+
}"
|
|
17
|
+
class="text-sm"
|
|
18
|
+
>{{ title }}</span>
|
|
19
|
+
</div>
|
|
20
|
+
</template>
|
|
21
|
+
|
|
22
|
+
<script setup>
|
|
23
|
+
const { error } = defineProps({
|
|
24
|
+
error: { type: Object, required: true }
|
|
25
|
+
});
|
|
26
|
+
const { title, detail } = error;
|
|
27
|
+
</script>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
declare const _default: typeof __VLS_export;
|
|
2
|
+
export default _default;
|
|
3
|
+
declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
4
|
+
error: {
|
|
5
|
+
type: ObjectConstructor;
|
|
6
|
+
required: true;
|
|
7
|
+
};
|
|
8
|
+
}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
9
|
+
error: {
|
|
10
|
+
type: ObjectConstructor;
|
|
11
|
+
required: true;
|
|
12
|
+
};
|
|
13
|
+
}>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
declare const _default: typeof __VLS_export;
|
|
2
2
|
export default _default;
|
|
3
|
-
declare const __VLS_export:
|
|
3
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
4
|
+
type __VLS_WithSlots<T, S> = T & (new () => {
|
|
5
|
+
$slots: S;
|
|
6
|
+
});
|
|
7
|
+
declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
4
8
|
schema: {
|
|
5
9
|
type: null;
|
|
6
10
|
required: true;
|
|
@@ -19,3 +23,6 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
19
23
|
required: true;
|
|
20
24
|
};
|
|
21
25
|
}>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
26
|
+
type __VLS_Slots = {
|
|
27
|
+
content?: ((props: {}) => any) | undefined;
|
|
28
|
+
};
|
|
@@ -1,29 +1,60 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
3
|
-
|
|
4
|
-
:
|
|
2
|
+
<div
|
|
3
|
+
class="b-message grid"
|
|
4
|
+
:class="[`message-${severity}`, `message-${variant}`]"
|
|
5
5
|
>
|
|
6
|
-
<
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
6
|
+
<div class="min-h-0">
|
|
7
|
+
<div
|
|
8
|
+
:class="sizeClass"
|
|
9
|
+
class="
|
|
10
|
+
b-message-body
|
|
11
|
+
flex flex-col gap-3
|
|
12
|
+
"
|
|
13
|
+
>
|
|
14
|
+
<div class="flex flex-row items-center gap-2">
|
|
15
|
+
<i
|
|
16
|
+
v-if="icon"
|
|
17
|
+
class="b-message-icon"
|
|
18
|
+
:class="icon"
|
|
19
|
+
/>
|
|
20
|
+
<AwaitLoading :skeleton="{ height: '1.5rem', width: '100%' }">
|
|
21
|
+
<span v-if="data">{{ localizeMessage ? l(data) : data }}</span>
|
|
22
|
+
<span v-else>-</span>
|
|
23
|
+
</AwaitLoading>
|
|
24
|
+
</div>
|
|
25
|
+
<slot name="content" />
|
|
26
|
+
</div>
|
|
27
|
+
</div>
|
|
28
|
+
</div>
|
|
17
29
|
</template>
|
|
18
30
|
|
|
19
31
|
<script setup>
|
|
20
|
-
import {
|
|
21
|
-
import { useLocalization } from "#imports";
|
|
32
|
+
import { computed, useLocalization } from "#imports";
|
|
22
33
|
import { AwaitLoading } from "#components";
|
|
23
34
|
const { localize: l } = useLocalization();
|
|
24
35
|
const { schema, data } = defineProps({
|
|
25
36
|
schema: { type: null, required: true },
|
|
26
37
|
data: { type: null, required: true }
|
|
27
38
|
});
|
|
28
|
-
const { icon, severity = "info",
|
|
39
|
+
const { icon, localizeMessage, severity = "info", size, variant = "outlined" } = schema;
|
|
40
|
+
const sizeClass = computed(() => {
|
|
41
|
+
switch (size) {
|
|
42
|
+
case "small":
|
|
43
|
+
return "text-sm font-normal";
|
|
44
|
+
case "large":
|
|
45
|
+
return "text-lg font-semibold";
|
|
46
|
+
default:
|
|
47
|
+
return "text-base font-medium";
|
|
48
|
+
}
|
|
49
|
+
});
|
|
29
50
|
</script>
|
|
51
|
+
|
|
52
|
+
<style scoped>
|
|
53
|
+
.message-outlined{@apply border rounded-md}.message-outlined .b-message-body{@apply py-[0.50rem] px-[0.75rem] min-w-[10rem] min-h-[1.5rem]}.message-simple{@apply !bg-transparent}.message-simple .b-message-body{@apply px-0}.message-info{@apply bg-blue-50/95 text-blue-600 border-blue-200
|
|
54
|
+
dark:bg-blue-950/95 dark:text-blue-500 dark:border-blue-700/65}.message-error{@apply bg-red-50/95 text-red-600 border-red-200
|
|
55
|
+
dark:bg-red-950/95 dark:text-red-500 dark:border-red-700/65}.message-warn{@apply bg-yellow-50/95 text-yellow-600 border-yellow-200
|
|
56
|
+
dark:bg-yellow-950/95 dark:text-yellow-500 dark:border-yellow-700/65}.message-success{@apply bg-green-50/95 text-green-600 border-green-200
|
|
57
|
+
dark:bg-green-950/95 dark:text-green-500 dark:border-green-700/65}.message-secondary{@apply bg-transparent text-slate-500 border-slate-500
|
|
58
|
+
dark:text-slate-400 dark:border-slate-400}.message-contrast{@apply bg-transparent text-slate-950 border-slate-950
|
|
59
|
+
dark:text-white dark:border-white}
|
|
60
|
+
</style>
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
declare const _default: typeof __VLS_export;
|
|
2
2
|
export default _default;
|
|
3
|
-
declare const __VLS_export:
|
|
3
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
4
|
+
type __VLS_WithSlots<T, S> = T & (new () => {
|
|
5
|
+
$slots: S;
|
|
6
|
+
});
|
|
7
|
+
declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
4
8
|
schema: {
|
|
5
9
|
type: null;
|
|
6
10
|
required: true;
|
|
@@ -19,3 +23,6 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
19
23
|
required: true;
|
|
20
24
|
};
|
|
21
25
|
}>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
26
|
+
type __VLS_Slots = {
|
|
27
|
+
content?: ((props: {}) => any) | undefined;
|
|
28
|
+
};
|
|
@@ -16,7 +16,7 @@ import { computed } from "vue";
|
|
|
16
16
|
import { Button } from "primevue";
|
|
17
17
|
import { useDataMounter, usePathBuilder } from "#imports";
|
|
18
18
|
import { AwaitLoading } from "#components";
|
|
19
|
-
const { mount: mountData } = useDataMounter();
|
|
19
|
+
const { mount: mountData } = useDataMounter({ defaultInlineError: true });
|
|
20
20
|
const pathBuilder = usePathBuilder();
|
|
21
21
|
const { schema, data } = defineProps({
|
|
22
22
|
schema: { type: null, required: true },
|
|
@@ -40,9 +40,7 @@ const allowPrevious = computed(() => !Number.isNaN(page.value) && page.value > 1
|
|
|
40
40
|
const allowNext = computed(() => !Number.isNaN(page.value) && data.length >= data.take);
|
|
41
41
|
const page = computed({
|
|
42
42
|
get: () => Number(model.value) / Number(data.take) + 1,
|
|
43
|
-
set: (value) =>
|
|
44
|
-
model.value = (value - 1) * Number(data.take);
|
|
45
|
-
}
|
|
43
|
+
set: (value) => model.value = (value - 1) * Number(data.take)
|
|
46
44
|
});
|
|
47
45
|
const path = context.injectPath();
|
|
48
46
|
const previousTake = paginatorStates[`${path}.previousTake`];
|