@merkaly/nuxt 0.6.0 → 0.6.4
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.d.mts +11 -1
- package/dist/module.json +1 -1
- package/dist/module.mjs +86 -28
- package/dist/runtime/components/app.d.vue.ts +3 -3
- package/dist/runtime/components/app.vue +7 -0
- package/dist/runtime/components/app.vue.d.ts +3 -3
- package/dist/runtime/components/format/FormatDate.d.vue.ts +2 -2
- package/dist/runtime/components/format/FormatDate.vue.d.ts +2 -2
- package/dist/runtime/components/format/FormatIcon.d.vue.ts +32 -5
- package/dist/runtime/components/format/FormatIcon.vue +20 -5
- package/dist/runtime/components/format/FormatIcon.vue.d.ts +32 -5
- package/dist/runtime/components/format/FormatMoney.d.vue.ts +2 -2
- package/dist/runtime/components/format/FormatMoney.vue +7 -7
- package/dist/runtime/components/format/FormatMoney.vue.d.ts +2 -2
- package/dist/runtime/components/format/FormatNumber.d.vue.ts +52 -0
- package/dist/runtime/components/format/FormatNumber.vue +38 -0
- package/dist/runtime/components/format/FormatNumber.vue.d.ts +52 -0
- package/dist/runtime/components/format/FormatText.d.vue.ts +9 -3
- package/dist/runtime/components/format/FormatText.vue +2 -2
- package/dist/runtime/components/format/FormatText.vue.d.ts +9 -3
- package/dist/runtime/components/input/InputAddress.d.vue.ts +1 -1
- package/dist/runtime/components/input/InputAddress.vue.d.ts +1 -1
- package/dist/runtime/components/input/InputDateRange.vue +6 -6
- package/dist/runtime/components/input/InputDropzone.vue +1 -1
- package/dist/runtime/components/input/InputMoney.d.vue.ts +1 -1
- package/dist/runtime/components/input/InputMoney.vue +1 -1
- package/dist/runtime/components/input/InputMoney.vue.d.ts +1 -1
- package/dist/runtime/components/input/InputSelect.d.vue.ts +10 -11
- package/dist/runtime/components/input/InputSelect.vue +19 -11
- package/dist/runtime/components/input/InputSelect.vue.d.ts +10 -11
- package/dist/runtime/components/table/TableDatagrid.d.vue.ts +1 -1
- package/dist/runtime/components/table/TableDatagrid.vue +7 -5
- package/dist/runtime/components/table/TableDatagrid.vue.d.ts +1 -1
- package/dist/runtime/composables/useCounterUp.d.ts +8 -0
- package/dist/runtime/composables/useCounterUp.js +30 -0
- package/dist/runtime/composables/useDatagrid.d.ts +7 -2
- package/dist/runtime/composables/useDatagrid.js +7 -2
- package/dist/runtime/composables/useNotify.d.ts +19 -0
- package/dist/runtime/composables/useNotify.js +40 -0
- package/dist/runtime/middleware/auth.d.ts +1 -1
- package/dist/runtime/plugins/api.global.d.ts +1 -1
- package/dist/runtime/plugins/auth0.client.d.ts +2 -2
- package/dist/runtime/plugins/sentry.global.d.ts +1 -1
- package/dist/runtime/types/nuxt.d.ts +1 -1
- package/dist/types.d.mts +1 -1
- package/package.json +20 -20
- package/dist/runtime/composables/useMoney.d.ts +0 -7
- package/dist/runtime/composables/useMoney.js +0 -10
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { computed, toRef } from "vue";
|
|
3
|
+
import { useCounterUp } from "../../composables/useCounterUp";
|
|
4
|
+
const props = defineProps({
|
|
5
|
+
currency: { type: String, default: () => "USD" },
|
|
6
|
+
tag: { type: String, default: "span" },
|
|
7
|
+
value: { type: Number, default: 0 },
|
|
8
|
+
type: { type: String, default: void 0 },
|
|
9
|
+
maxFractionDigits: {
|
|
10
|
+
type: Number,
|
|
11
|
+
default: void 0
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
const counter = useCounterUp(toRef(props, "value"), {
|
|
15
|
+
decimals: props.maxFractionDigits ?? 0
|
|
16
|
+
});
|
|
17
|
+
const number = computed(
|
|
18
|
+
() => Intl.NumberFormat("en-US", {
|
|
19
|
+
currency: props.currency,
|
|
20
|
+
maximumFractionDigits: props.maxFractionDigits,
|
|
21
|
+
notation: "compact",
|
|
22
|
+
style: props.type
|
|
23
|
+
}).format(counter.value)
|
|
24
|
+
);
|
|
25
|
+
</script>
|
|
26
|
+
|
|
27
|
+
<template>
|
|
28
|
+
<component :is="tag" class="format-number">
|
|
29
|
+
<span v-text="number" />
|
|
30
|
+
</component>
|
|
31
|
+
</template>
|
|
32
|
+
|
|
33
|
+
<style scoped>
|
|
34
|
+
.format-number {
|
|
35
|
+
font-variant-numeric: tabular-nums;
|
|
36
|
+
font-feature-settings: "tnum";
|
|
37
|
+
}
|
|
38
|
+
</style>
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { PropType } from 'vue';
|
|
2
|
+
declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
3
|
+
currency: {
|
|
4
|
+
type: StringConstructor;
|
|
5
|
+
default: () => string;
|
|
6
|
+
};
|
|
7
|
+
tag: {
|
|
8
|
+
type: StringConstructor;
|
|
9
|
+
default: string;
|
|
10
|
+
};
|
|
11
|
+
value: {
|
|
12
|
+
type: NumberConstructor;
|
|
13
|
+
default: number;
|
|
14
|
+
};
|
|
15
|
+
type: {
|
|
16
|
+
type: PropType<Intl.NumberFormatOptions["style"]>;
|
|
17
|
+
default: undefined;
|
|
18
|
+
};
|
|
19
|
+
maxFractionDigits: {
|
|
20
|
+
type: PropType<Intl.NumberFormatOptions["maximumFractionDigits"]>;
|
|
21
|
+
default: undefined;
|
|
22
|
+
};
|
|
23
|
+
}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
24
|
+
currency: {
|
|
25
|
+
type: StringConstructor;
|
|
26
|
+
default: () => string;
|
|
27
|
+
};
|
|
28
|
+
tag: {
|
|
29
|
+
type: StringConstructor;
|
|
30
|
+
default: string;
|
|
31
|
+
};
|
|
32
|
+
value: {
|
|
33
|
+
type: NumberConstructor;
|
|
34
|
+
default: number;
|
|
35
|
+
};
|
|
36
|
+
type: {
|
|
37
|
+
type: PropType<Intl.NumberFormatOptions["style"]>;
|
|
38
|
+
default: undefined;
|
|
39
|
+
};
|
|
40
|
+
maxFractionDigits: {
|
|
41
|
+
type: PropType<Intl.NumberFormatOptions["maximumFractionDigits"]>;
|
|
42
|
+
default: undefined;
|
|
43
|
+
};
|
|
44
|
+
}>> & Readonly<{}>, {
|
|
45
|
+
type: keyof Intl.NumberFormatOptionsStyleRegistry | undefined;
|
|
46
|
+
value: number;
|
|
47
|
+
currency: string;
|
|
48
|
+
tag: string;
|
|
49
|
+
maxFractionDigits: number | undefined;
|
|
50
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
51
|
+
declare const _default: typeof __VLS_export;
|
|
52
|
+
export default _default;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { PropType } from 'vue';
|
|
1
2
|
declare var __VLS_9: string, __VLS_10: {};
|
|
2
3
|
type __VLS_Slots = {} & {
|
|
3
4
|
[K in NonNullable<typeof __VLS_9>]?: (props: typeof __VLS_10) => any;
|
|
@@ -6,6 +7,7 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
|
|
|
6
7
|
fallback: {
|
|
7
8
|
type: StringConstructor;
|
|
8
9
|
required: false;
|
|
10
|
+
default: () => undefined;
|
|
9
11
|
};
|
|
10
12
|
tag: {
|
|
11
13
|
type: StringConstructor;
|
|
@@ -16,13 +18,15 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
|
|
|
16
18
|
required: true;
|
|
17
19
|
};
|
|
18
20
|
values: {
|
|
19
|
-
type: PropType<
|
|
21
|
+
type: PropType<object>;
|
|
20
22
|
required: false;
|
|
23
|
+
default: () => {};
|
|
21
24
|
};
|
|
22
25
|
}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
23
26
|
fallback: {
|
|
24
27
|
type: StringConstructor;
|
|
25
28
|
required: false;
|
|
29
|
+
default: () => undefined;
|
|
26
30
|
};
|
|
27
31
|
tag: {
|
|
28
32
|
type: StringConstructor;
|
|
@@ -33,12 +37,14 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
|
|
|
33
37
|
required: true;
|
|
34
38
|
};
|
|
35
39
|
values: {
|
|
36
|
-
type: PropType<
|
|
40
|
+
type: PropType<object>;
|
|
37
41
|
required: false;
|
|
42
|
+
default: () => {};
|
|
38
43
|
};
|
|
39
44
|
}>> & Readonly<{}>, {
|
|
40
|
-
values:
|
|
45
|
+
values: object;
|
|
41
46
|
tag: string;
|
|
47
|
+
fallback: string;
|
|
42
48
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
43
49
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
44
50
|
declare const _default: typeof __VLS_export;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
<script setup>
|
|
2
2
|
import { computed, useSlots } from "vue";
|
|
3
3
|
const props = defineProps({
|
|
4
|
-
fallback: { type: String, required: false },
|
|
4
|
+
fallback: { type: String, required: false, default: () => void 0 },
|
|
5
5
|
tag: { type: String, default: () => "span" },
|
|
6
6
|
template: { type: String, required: true },
|
|
7
|
-
values: { type: Object, required: false }
|
|
7
|
+
values: { type: Object, required: false, default: () => ({}) }
|
|
8
8
|
});
|
|
9
9
|
const slots = useSlots();
|
|
10
10
|
const contentParts = computed(() => {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { PropType } from 'vue';
|
|
1
2
|
declare var __VLS_9: string, __VLS_10: {};
|
|
2
3
|
type __VLS_Slots = {} & {
|
|
3
4
|
[K in NonNullable<typeof __VLS_9>]?: (props: typeof __VLS_10) => any;
|
|
@@ -6,6 +7,7 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
|
|
|
6
7
|
fallback: {
|
|
7
8
|
type: StringConstructor;
|
|
8
9
|
required: false;
|
|
10
|
+
default: () => undefined;
|
|
9
11
|
};
|
|
10
12
|
tag: {
|
|
11
13
|
type: StringConstructor;
|
|
@@ -16,13 +18,15 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
|
|
|
16
18
|
required: true;
|
|
17
19
|
};
|
|
18
20
|
values: {
|
|
19
|
-
type: PropType<
|
|
21
|
+
type: PropType<object>;
|
|
20
22
|
required: false;
|
|
23
|
+
default: () => {};
|
|
21
24
|
};
|
|
22
25
|
}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
23
26
|
fallback: {
|
|
24
27
|
type: StringConstructor;
|
|
25
28
|
required: false;
|
|
29
|
+
default: () => undefined;
|
|
26
30
|
};
|
|
27
31
|
tag: {
|
|
28
32
|
type: StringConstructor;
|
|
@@ -33,12 +37,14 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
|
|
|
33
37
|
required: true;
|
|
34
38
|
};
|
|
35
39
|
values: {
|
|
36
|
-
type: PropType<
|
|
40
|
+
type: PropType<object>;
|
|
37
41
|
required: false;
|
|
42
|
+
default: () => {};
|
|
38
43
|
};
|
|
39
44
|
}>> & Readonly<{}>, {
|
|
40
|
-
values:
|
|
45
|
+
values: object;
|
|
41
46
|
tag: string;
|
|
47
|
+
fallback: string;
|
|
42
48
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
43
49
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
44
50
|
declare const _default: typeof __VLS_export;
|
|
@@ -81,8 +81,8 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
81
81
|
}>, {
|
|
82
82
|
mode: PlaceTypes;
|
|
83
83
|
disabled: boolean;
|
|
84
|
-
placeholder: string;
|
|
85
84
|
countries: string[];
|
|
85
|
+
placeholder: string;
|
|
86
86
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
87
87
|
declare const _default: typeof __VLS_export;
|
|
88
88
|
export default _default;
|
|
@@ -81,8 +81,8 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
81
81
|
}>, {
|
|
82
82
|
mode: PlaceTypes;
|
|
83
83
|
disabled: boolean;
|
|
84
|
-
placeholder: string;
|
|
85
84
|
countries: string[];
|
|
85
|
+
placeholder: string;
|
|
86
86
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
87
87
|
declare const _default: typeof __VLS_export;
|
|
88
88
|
export default _default;
|
|
@@ -15,10 +15,10 @@ const presets = [
|
|
|
15
15
|
{ key: "lastMonth", label: "Last month", icon: "calendar-xmark" }
|
|
16
16
|
];
|
|
17
17
|
const selectedPreset = ref(model.value?.preset || props.preset);
|
|
18
|
-
const getDateRange = (
|
|
18
|
+
const getDateRange = (key) => {
|
|
19
19
|
const now = /* @__PURE__ */ new Date();
|
|
20
20
|
const today = new Date(now.getFullYear(), now.getMonth(), now.getDate());
|
|
21
|
-
switch (
|
|
21
|
+
switch (key) {
|
|
22
22
|
case "today":
|
|
23
23
|
return { start: today, end: today };
|
|
24
24
|
case "yesterday": {
|
|
@@ -81,11 +81,11 @@ onBeforeMount(() => selectPreset(props.preset));
|
|
|
81
81
|
<span class="fs-7 fw-bold text-gray-800">Date Range</span>
|
|
82
82
|
</div>
|
|
83
83
|
|
|
84
|
-
<template v-for="
|
|
85
|
-
<BDropdownItem :active="selectedPreset ===
|
|
84
|
+
<template v-for="item in presets" :key="item.key">
|
|
85
|
+
<BDropdownItem :active="selectedPreset === item.key" @click="selectPreset(item.key)">
|
|
86
86
|
<div class="d-flex align-items-center gap-2">
|
|
87
|
-
<FormatIcon :name="
|
|
88
|
-
<span v-text="
|
|
87
|
+
<FormatIcon :name="item.icon" class="text-gray-500" />
|
|
88
|
+
<span v-text="item.label" />
|
|
89
89
|
</div>
|
|
90
90
|
</BDropdownItem>
|
|
91
91
|
</template>
|
|
@@ -74,9 +74,9 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
74
74
|
}>> & Readonly<{
|
|
75
75
|
"onUpdate:modelValue"?: ((value: Numberish) => any) | undefined;
|
|
76
76
|
}>, {
|
|
77
|
-
decimal: string;
|
|
78
77
|
min: number;
|
|
79
78
|
max: number;
|
|
79
|
+
decimal: string;
|
|
80
80
|
placeholder: string;
|
|
81
81
|
precision: number;
|
|
82
82
|
prefix: string;
|
|
@@ -74,9 +74,9 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
74
74
|
}>> & Readonly<{
|
|
75
75
|
"onUpdate:modelValue"?: ((value: Numberish) => any) | undefined;
|
|
76
76
|
}>, {
|
|
77
|
-
decimal: string;
|
|
78
77
|
min: number;
|
|
79
78
|
max: number;
|
|
79
|
+
decimal: string;
|
|
80
80
|
placeholder: string;
|
|
81
81
|
precision: number;
|
|
82
82
|
prefix: string;
|
|
@@ -14,18 +14,19 @@ declare const __VLS_export: <T extends Record<string, any>>(__VLS_props: NonNull
|
|
|
14
14
|
};
|
|
15
15
|
fieldDisabled: {
|
|
16
16
|
type: PropType<(item: T) => boolean>;
|
|
17
|
+
default: undefined;
|
|
17
18
|
};
|
|
18
19
|
fieldSort: {
|
|
19
20
|
type: PropType<(item: T) => string>;
|
|
20
|
-
default: (it:
|
|
21
|
+
default: (it: Record<string, unknown>) => unknown;
|
|
21
22
|
};
|
|
22
23
|
fieldText: {
|
|
23
24
|
type: PropType<(item: T) => string>;
|
|
24
|
-
default: (it:
|
|
25
|
+
default: (it: Record<string, unknown>) => unknown;
|
|
25
26
|
};
|
|
26
27
|
fieldValue: {
|
|
27
28
|
type: PropType<(item: T) => unknown>;
|
|
28
|
-
default: (it:
|
|
29
|
+
default: (it: Record<string, unknown>) => unknown;
|
|
29
30
|
};
|
|
30
31
|
filterable: {
|
|
31
32
|
type: BooleanConstructor;
|
|
@@ -53,15 +54,16 @@ declare const __VLS_export: <T extends Record<string, any>>(__VLS_props: NonNull
|
|
|
53
54
|
};
|
|
54
55
|
placeholder: {
|
|
55
56
|
type: StringConstructor;
|
|
56
|
-
|
|
57
|
-
selectedItem: {
|
|
58
|
-
type: PropType<T>;
|
|
59
|
-
default: undefined;
|
|
57
|
+
default: () => undefined;
|
|
60
58
|
};
|
|
61
59
|
required: {
|
|
62
60
|
type: BooleanConstructor;
|
|
63
61
|
default: () => boolean;
|
|
64
62
|
};
|
|
63
|
+
selectedItem: {
|
|
64
|
+
type: PropType<T>;
|
|
65
|
+
default: undefined;
|
|
66
|
+
};
|
|
65
67
|
size: {
|
|
66
68
|
type: PropType<Size>;
|
|
67
69
|
default: () => undefined;
|
|
@@ -82,10 +84,7 @@ declare const __VLS_export: <T extends Record<string, any>>(__VLS_props: NonNull
|
|
|
82
84
|
selectedOption: boolean;
|
|
83
85
|
}) => any;
|
|
84
86
|
};
|
|
85
|
-
emit:
|
|
86
|
-
(e: "search", v: string): any;
|
|
87
|
-
(e: "request:selected", v: string): any;
|
|
88
|
-
} & ((evt: "update:modelValue", value: any) => void);
|
|
87
|
+
emit: ((e: "request:selected" | "search", v: string) => unknown) & ((event: "update:modelValue", value: any) => void);
|
|
89
88
|
}>) => import("vue").VNode & {
|
|
90
89
|
__ctx?: Awaited<typeof __VLS_setup>;
|
|
91
90
|
};
|
|
@@ -3,11 +3,11 @@ import { computed, onBeforeMount } from "vue";
|
|
|
3
3
|
import { useDebounceFn } from "@vueuse/core";
|
|
4
4
|
import VSelect from "vue-select";
|
|
5
5
|
import FormatIcon from "../format/FormatIcon.vue";
|
|
6
|
-
const emit = defineEmits(["
|
|
6
|
+
const emit = defineEmits(["request:selected", "search"]);
|
|
7
7
|
const props = defineProps({
|
|
8
8
|
debounce: { type: Number, default: () => 250 },
|
|
9
9
|
disabled: { type: Boolean, default: () => false },
|
|
10
|
-
fieldDisabled: { type: Function },
|
|
10
|
+
fieldDisabled: { type: Function, default: void 0 },
|
|
11
11
|
fieldSort: { type: Function, default: (it) => it.fieldText },
|
|
12
12
|
fieldText: { type: Function, default: ((it) => it.name) },
|
|
13
13
|
fieldValue: { type: Function, default: ((it) => it._id) },
|
|
@@ -17,12 +17,12 @@ const props = defineProps({
|
|
|
17
17
|
noClear: { type: Boolean, default: () => false },
|
|
18
18
|
noCloseOnSelect: { type: Boolean, default: () => false },
|
|
19
19
|
options: { type: Array, default: () => [] },
|
|
20
|
-
placeholder: { type: String },
|
|
21
|
-
selectedItem: { type: Object, default: void 0 },
|
|
20
|
+
placeholder: { type: String, default: () => void 0 },
|
|
22
21
|
required: { type: Boolean, default: () => false },
|
|
22
|
+
selectedItem: { type: Object, default: void 0 },
|
|
23
23
|
size: { type: String, default: () => void 0 }
|
|
24
24
|
});
|
|
25
|
-
const model = defineModel({ type:
|
|
25
|
+
const model = defineModel({ type: [String, Object, Number, Boolean, Array], default: null });
|
|
26
26
|
onBeforeMount(() => {
|
|
27
27
|
if (props.selectedItem) return;
|
|
28
28
|
if (model.value) {
|
|
@@ -79,17 +79,25 @@ const bindAttrs = computed(() => ({
|
|
|
79
79
|
}));
|
|
80
80
|
const bindOn = {
|
|
81
81
|
search: (value) => {
|
|
82
|
-
value
|
|
82
|
+
if (value) debouncedFn(value);
|
|
83
83
|
return value;
|
|
84
84
|
}
|
|
85
85
|
};
|
|
86
86
|
const debouncedFn = useDebounceFn((value) => emit("search", value), props.debounce);
|
|
87
|
+
const isRequired = computed(() => {
|
|
88
|
+
const isEmpty = props.multiple ? !model.value?.length : !model.value;
|
|
89
|
+
return props.required && isEmpty ? true : void 0;
|
|
90
|
+
});
|
|
87
91
|
</script>
|
|
88
92
|
|
|
89
93
|
<template>
|
|
90
94
|
<VSelect v-model="model" v-bind="bindAttrs" v-on="bindOn">
|
|
91
95
|
<template #search="scope">
|
|
92
|
-
<input
|
|
96
|
+
<input
|
|
97
|
+
:required="isRequired"
|
|
98
|
+
class="vs__search"
|
|
99
|
+
v-bind="scope.attributes"
|
|
100
|
+
v-on="scope.events">
|
|
93
101
|
</template>
|
|
94
102
|
|
|
95
103
|
<template #option="scope">
|
|
@@ -108,12 +116,12 @@ const debouncedFn = useDebounceFn((value) => emit("search", value), props.deboun
|
|
|
108
116
|
<span :required="props.required || void 0" />
|
|
109
117
|
</template>
|
|
110
118
|
|
|
111
|
-
<template #spinner="{ loading }">
|
|
112
|
-
<BSpinner v-if="
|
|
119
|
+
<template #spinner="{ loading: isLoading }">
|
|
120
|
+
<BSpinner v-if="isLoading" class="spinner" variant="primary" />
|
|
113
121
|
</template>
|
|
114
122
|
|
|
115
|
-
<template #no-options="{ search, searching, loading }">
|
|
116
|
-
<span v-if="
|
|
123
|
+
<template #no-options="{ search, searching, loading: isLoading }">
|
|
124
|
+
<span v-if="isLoading">Searching for "{{ search }}"</span>
|
|
117
125
|
<span v-else-if="searching">No results for "{{ search }}"</span>
|
|
118
126
|
<span v-else>Type to search</span>
|
|
119
127
|
</template>
|
|
@@ -14,18 +14,19 @@ declare const __VLS_export: <T extends Record<string, any>>(__VLS_props: NonNull
|
|
|
14
14
|
};
|
|
15
15
|
fieldDisabled: {
|
|
16
16
|
type: PropType<(item: T) => boolean>;
|
|
17
|
+
default: undefined;
|
|
17
18
|
};
|
|
18
19
|
fieldSort: {
|
|
19
20
|
type: PropType<(item: T) => string>;
|
|
20
|
-
default: (it:
|
|
21
|
+
default: (it: Record<string, unknown>) => unknown;
|
|
21
22
|
};
|
|
22
23
|
fieldText: {
|
|
23
24
|
type: PropType<(item: T) => string>;
|
|
24
|
-
default: (it:
|
|
25
|
+
default: (it: Record<string, unknown>) => unknown;
|
|
25
26
|
};
|
|
26
27
|
fieldValue: {
|
|
27
28
|
type: PropType<(item: T) => unknown>;
|
|
28
|
-
default: (it:
|
|
29
|
+
default: (it: Record<string, unknown>) => unknown;
|
|
29
30
|
};
|
|
30
31
|
filterable: {
|
|
31
32
|
type: BooleanConstructor;
|
|
@@ -53,15 +54,16 @@ declare const __VLS_export: <T extends Record<string, any>>(__VLS_props: NonNull
|
|
|
53
54
|
};
|
|
54
55
|
placeholder: {
|
|
55
56
|
type: StringConstructor;
|
|
56
|
-
|
|
57
|
-
selectedItem: {
|
|
58
|
-
type: PropType<T>;
|
|
59
|
-
default: undefined;
|
|
57
|
+
default: () => undefined;
|
|
60
58
|
};
|
|
61
59
|
required: {
|
|
62
60
|
type: BooleanConstructor;
|
|
63
61
|
default: () => boolean;
|
|
64
62
|
};
|
|
63
|
+
selectedItem: {
|
|
64
|
+
type: PropType<T>;
|
|
65
|
+
default: undefined;
|
|
66
|
+
};
|
|
65
67
|
size: {
|
|
66
68
|
type: PropType<Size>;
|
|
67
69
|
default: () => undefined;
|
|
@@ -82,10 +84,7 @@ declare const __VLS_export: <T extends Record<string, any>>(__VLS_props: NonNull
|
|
|
82
84
|
selectedOption: boolean;
|
|
83
85
|
}) => any;
|
|
84
86
|
};
|
|
85
|
-
emit:
|
|
86
|
-
(e: "search", v: string): any;
|
|
87
|
-
(e: "request:selected", v: string): any;
|
|
88
|
-
} & ((evt: "update:modelValue", value: any) => void);
|
|
87
|
+
emit: ((e: "request:selected" | "search", v: string) => unknown) & ((event: "update:modelValue", value: any) => void);
|
|
89
88
|
}>) => import("vue").VNode & {
|
|
90
89
|
__ctx?: Awaited<typeof __VLS_setup>;
|
|
91
90
|
};
|
|
@@ -76,7 +76,7 @@ declare const __VLS_export: <G>(__VLS_props: NonNullable<Awaited<typeof __VLS_se
|
|
|
76
76
|
emit: {
|
|
77
77
|
(e: "fetch", reason: "sort" | "filter" | "search" | "paginate" | "refresh"): void;
|
|
78
78
|
(e: "toggle:item", item: G, expanded: boolean): void;
|
|
79
|
-
} & ((
|
|
79
|
+
} & ((event: "update:modelValue", value: DataGrid<G>) => void);
|
|
80
80
|
}>) => import("vue").VNode & {
|
|
81
81
|
__ctx?: Awaited<typeof __VLS_setup>;
|
|
82
82
|
};
|
|
@@ -21,7 +21,9 @@ const canFilter = Boolean(slots.filters);
|
|
|
21
21
|
const hasDetailsSlot = computed(() => Boolean(slots["details"]));
|
|
22
22
|
const hasActionsSlot = computed(() => Boolean(slots["actions"]));
|
|
23
23
|
const hasBulkSlot = computed(() => Boolean(slots["bulk"]));
|
|
24
|
-
const visibleColumns = computed(() => Object.entries($datagrid.value.columns))
|
|
24
|
+
const visibleColumns = computed(() => Object.entries($datagrid.value.columns).filter(({ 1: column }) => {
|
|
25
|
+
return column.visible !== false;
|
|
26
|
+
}));
|
|
25
27
|
const tableColspan = computed(() => {
|
|
26
28
|
const baseColumns = 2;
|
|
27
29
|
const selectColumn = props.hideSelect ? 0 : 1;
|
|
@@ -172,8 +174,8 @@ function getRowAttrs(item, idx) {
|
|
|
172
174
|
v-if="$datagrid.loading"
|
|
173
175
|
:value="100"
|
|
174
176
|
animated
|
|
175
|
-
height="5px"
|
|
176
177
|
class="rounded-0 position-absolute w-100 start-0"
|
|
178
|
+
height="5px"
|
|
177
179
|
style="bottom: -6px; z-index: 10" />
|
|
178
180
|
</BCardHeader>
|
|
179
181
|
|
|
@@ -200,7 +202,7 @@ function getRowAttrs(item, idx) {
|
|
|
200
202
|
</BTh>
|
|
201
203
|
|
|
202
204
|
<template v-for="[key, column] in visibleColumns" :key="key">
|
|
203
|
-
<BTh :class="[column.class, column.thClass]">
|
|
205
|
+
<BTh :class="[column.class, column.thClass, 'text-nowrap']">
|
|
204
206
|
<slot :name="`head[${key}]`" v-bind="{ column, key }">
|
|
205
207
|
<span v-text="column.title ?? sentenceCase(key)" />
|
|
206
208
|
</slot>
|
|
@@ -219,7 +221,7 @@ function getRowAttrs(item, idx) {
|
|
|
219
221
|
</BTd>
|
|
220
222
|
</BTbody>
|
|
221
223
|
|
|
222
|
-
<BTbody v-else class="fw-semibold text-
|
|
224
|
+
<BTbody v-else class="fw-semibold text-nowrap">
|
|
223
225
|
<template v-for="(item, idx) in visibleItems" :key="getRowKey(item, idx)">
|
|
224
226
|
<BTr v-bind="getRowAttrs(item, idx)">
|
|
225
227
|
<BTd v-if="hasDetailsSlot" class="p-0 w-25px">
|
|
@@ -247,7 +249,7 @@ function getRowAttrs(item, idx) {
|
|
|
247
249
|
</template>
|
|
248
250
|
|
|
249
251
|
<BTd v-if="hasActionsSlot" class="text-end px-3">
|
|
250
|
-
<DropdownIcon
|
|
252
|
+
<DropdownIcon icon="caret-down" text="Actions" toggle-class="py-1 px-3" variant="light-dark">
|
|
251
253
|
<slot :index="idx" :item="item" name="actions" />
|
|
252
254
|
</DropdownIcon>
|
|
253
255
|
</BTd>
|
|
@@ -76,7 +76,7 @@ declare const __VLS_export: <G>(__VLS_props: NonNullable<Awaited<typeof __VLS_se
|
|
|
76
76
|
emit: {
|
|
77
77
|
(e: "fetch", reason: "sort" | "filter" | "search" | "paginate" | "refresh"): void;
|
|
78
78
|
(e: "toggle:item", item: G, expanded: boolean): void;
|
|
79
|
-
} & ((
|
|
79
|
+
} & ((event: "update:modelValue", value: DataGrid<G>) => void);
|
|
80
80
|
}>) => import("vue").VNode & {
|
|
81
81
|
__ctx?: Awaited<typeof __VLS_setup>;
|
|
82
82
|
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { MaybeRefOrGetter } from 'vue';
|
|
2
|
+
type UseCounterUpOptions = {
|
|
3
|
+
duration?: number;
|
|
4
|
+
decimals?: number;
|
|
5
|
+
ease?: string;
|
|
6
|
+
};
|
|
7
|
+
export declare function useCounterUp(target: MaybeRefOrGetter<number>, options?: UseCounterUpOptions): import("vue").ComputedRef<number>;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { watchImmediate } from "@vueuse/core";
|
|
2
|
+
import gsap from "gsap";
|
|
3
|
+
import { computed, onBeforeUnmount, reactive, toValue } from "vue";
|
|
4
|
+
export function useCounterUp(target, options = {}) {
|
|
5
|
+
const { duration = 0.8, decimals = 0, ease = "power2.out" } = options;
|
|
6
|
+
const counter = reactive({
|
|
7
|
+
value: toValue(target) || 0
|
|
8
|
+
});
|
|
9
|
+
let tween;
|
|
10
|
+
let initialized = false;
|
|
11
|
+
watchImmediate(
|
|
12
|
+
() => toValue(target),
|
|
13
|
+
(value) => {
|
|
14
|
+
const nextValue = Number(value) || 0;
|
|
15
|
+
if (!initialized) {
|
|
16
|
+
counter.value = nextValue;
|
|
17
|
+
initialized = true;
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
tween?.kill();
|
|
21
|
+
tween = gsap.to(counter, {
|
|
22
|
+
value: nextValue,
|
|
23
|
+
duration,
|
|
24
|
+
ease
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
);
|
|
28
|
+
onBeforeUnmount(() => tween?.kill());
|
|
29
|
+
return computed(() => Number(counter.value.toFixed(decimals)));
|
|
30
|
+
}
|
|
@@ -5,20 +5,25 @@ export interface ColumnDefinition<C = unknown> {
|
|
|
5
5
|
thClass?: string;
|
|
6
6
|
title?: string;
|
|
7
7
|
type?: unknown;
|
|
8
|
+
visible?: boolean;
|
|
8
9
|
}
|
|
9
10
|
export type DataGridItem<C> = C;
|
|
11
|
+
export type DataGridAddItemMode = 'append' | 'prepend';
|
|
12
|
+
export interface DataGridAddItemOptions {
|
|
13
|
+
mode?: DataGridAddItemMode;
|
|
14
|
+
}
|
|
10
15
|
export type DataGridRowAttrs = Record<string, unknown>;
|
|
11
16
|
export type DataGridRowKey = string | number;
|
|
12
17
|
export interface DataGridRowDefinition {
|
|
13
18
|
attrs?: DataGridRowAttrs;
|
|
14
|
-
class?: string
|
|
19
|
+
class?: string | Record<string, unknown>;
|
|
15
20
|
key?: DataGridRowKey;
|
|
16
21
|
}
|
|
17
22
|
export interface DataGrid<C = unknown> {
|
|
18
23
|
columns: Record<string, ColumnDefinition<C>>;
|
|
19
24
|
error: unknown;
|
|
20
25
|
fn: {
|
|
21
|
-
addItem: (item: C) => DataGridItem<C>[];
|
|
26
|
+
addItem: (item: C, options?: DataGridAddItemOptions) => DataGridItem<C>[];
|
|
22
27
|
removeItem: (predicate: (item: DataGridItem<C>, index: number) => boolean) => number;
|
|
23
28
|
};
|
|
24
29
|
items: DataGridItem<C>[];
|
|
@@ -4,8 +4,13 @@ export function useDatagrid(params) {
|
|
|
4
4
|
columns: params.columns,
|
|
5
5
|
error: params.error ?? null,
|
|
6
6
|
fn: {
|
|
7
|
-
addItem(item) {
|
|
8
|
-
|
|
7
|
+
addItem(item, options = {}) {
|
|
8
|
+
const mode = options.mode ?? "append";
|
|
9
|
+
if (mode === "prepend") {
|
|
10
|
+
state.items.unshift(item);
|
|
11
|
+
} else if (mode === "append") {
|
|
12
|
+
state.items.push(item);
|
|
13
|
+
}
|
|
9
14
|
return state.items;
|
|
10
15
|
},
|
|
11
16
|
removeItem(predicate) {
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export interface NotifyOptions {
|
|
2
|
+
title?: string;
|
|
3
|
+
message?: string;
|
|
4
|
+
variant: 'success' | 'danger' | 'warning' | 'info';
|
|
5
|
+
}
|
|
6
|
+
export interface NotifyConfirmOptions extends NotifyOptions {
|
|
7
|
+
cancelText?: string;
|
|
8
|
+
confirmText?: string;
|
|
9
|
+
onConfirm?: () => void;
|
|
10
|
+
}
|
|
11
|
+
export interface NotifyAlertOptions extends NotifyOptions {
|
|
12
|
+
okText?: string;
|
|
13
|
+
}
|
|
14
|
+
export interface NotifyApi {
|
|
15
|
+
alert(options: NotifyAlertOptions): void;
|
|
16
|
+
confirm(options: NotifyConfirmOptions): void;
|
|
17
|
+
toast(options: NotifyOptions): unknown;
|
|
18
|
+
}
|
|
19
|
+
export declare function useNotify(): NotifyApi;
|