@verdnatura/vn-front-lib 0.0.9 → 0.0.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.
Files changed (51) hide show
  1. package/dist/components-BrEjZWQj.js +3278 -0
  2. package/dist/components-Dty6kM2e.cjs +2 -0
  3. package/dist/components.cjs +1 -1
  4. package/dist/components.js +2 -2
  5. package/dist/composables-DUOUI4DI.js +3558 -0
  6. package/dist/composables-ZxHJjJGN.cjs +4 -0
  7. package/dist/composables.cjs +1 -1
  8. package/dist/composables.js +2 -2
  9. package/dist/filters.cjs +1 -0
  10. package/dist/filters.js +62 -0
  11. package/dist/rolldown-runtime-DF3sbh8G.cjs +1 -0
  12. package/dist/stores.cjs +1 -1
  13. package/dist/stores.js +144 -2
  14. package/dist/utils.cjs +1 -0
  15. package/dist/utils.js +131 -0
  16. package/dist/vn-front-lib.cjs +1 -1
  17. package/dist/vn-front-lib.css +1 -1
  18. package/dist/vn-front-lib.js +6 -7
  19. package/lib/components/dialogs/VnConfirm.vue +142 -0
  20. package/lib/components/feedback/VnSkeletonForm.vue +14 -0
  21. package/lib/components/feedback/VnSpinner.vue +63 -0
  22. package/lib/components/index.js +5 -0
  23. package/lib/components/models/VnFetch.vue +65 -0
  24. package/lib/components/models/VnForm.vue +492 -0
  25. package/lib/composables/index.js +7 -0
  26. package/lib/composables/tMobile.js +8 -0
  27. package/lib/composables/useArrayData.js +451 -0
  28. package/lib/composables/useForm.js +12 -0
  29. package/lib/composables/useNotify.js +24 -0
  30. package/lib/composables/useObjectComparison.js +67 -0
  31. package/lib/composables/useQueryResolver.js +306 -0
  32. package/lib/composables/useState.js +81 -0
  33. package/lib/filters/filterPanel.js +95 -0
  34. package/lib/filters/getDifferences.js +18 -0
  35. package/lib/filters/getUpdatedValues.js +6 -0
  36. package/lib/filters/index.js +5 -0
  37. package/lib/filters/isDialogOpened.js +3 -0
  38. package/lib/filters/onBeforeSave.js +9 -0
  39. package/lib/stores/index.js +2 -0
  40. package/lib/stores/useArrayDataStore.js +82 -0
  41. package/lib/stores/useStateStore.js +84 -0
  42. package/lib/utils/advancedFilters.js +125 -0
  43. package/lib/utils/index.js +2 -0
  44. package/lib/utils/trackAnalytics.js +18 -0
  45. package/package.json +9 -2
  46. package/dist/components-BLui5eyq.cjs +0 -1
  47. package/dist/components-Dl-Ieazh.js +0 -2466
  48. package/dist/useRequired-BqsSq8Mw.cjs +0 -1
  49. package/dist/useRequired-CTxBp3qy.js +0 -58
  50. package/dist/useValidationsStore-8JX1-oLO.cjs +0 -1
  51. package/dist/useValidationsStore-9Fxtj_pd.js +0 -12
@@ -1,10 +1,9 @@
1
- import { n as e, t } from "./components-Dl-Ieazh.js";
2
- import { n, t as r } from "./useRequired-CTxBp3qy.js";
3
- import "./composables.js";
1
+ import { a as e, c as t, d as n, f as r, i, l as a, n as o, o as s, p as c, r as l, s as u, t as d, u as f, v as p, y as m } from "./composables-DUOUI4DI.js";
2
+ import { a as h, i as g, n as _, o as v, r as y, s as b, t as x } from "./components-BrEjZWQj.js";
4
3
  //#region lib/main.js
5
- function i(e) {
6
- for (let n in t) e.component(n, t[n]);
4
+ function S(e) {
5
+ for (let t in x) e.component(t, x[t]);
7
6
  }
8
- var a = { install: i };
7
+ var C = { install: S };
9
8
  //#endregion
10
- export { e as VnInput, a as default, r as useRequired, n as useValidator };
9
+ export { b as VnConfirm, y as VnFetch, _ as VnForm, g as VnInput, v as VnSkeletonForm, h as VnSpinner, C as default, o as fetchLocalData, n as focusFirstInput, e as getObjectByKeys, s as getObjectDifferences, l as getRemoteAndLocalParams, u as isComparableObject, t as isSameValue, i as requestData, c as tMobile, r as useArrayData, f as useNotify, a as useObjectComparison, p as useRequired, d as useState, m as useValidator };
@@ -0,0 +1,142 @@
1
+ <script setup>
2
+ import { ref } from 'vue';
3
+ import { useDialogPluginComponent } from 'quasar';
4
+ import { useI18n } from 'vue-i18n';
5
+
6
+ const { t } = useI18n();
7
+
8
+ const props = defineProps({
9
+ icon: {
10
+ type: String,
11
+ default: null,
12
+ },
13
+ title: {
14
+ type: String,
15
+ default: null,
16
+ },
17
+ message: {
18
+ type: [String, Boolean],
19
+ default: null,
20
+ },
21
+ data: {
22
+ type: Object,
23
+ required: false,
24
+ default: null,
25
+ },
26
+ promise: {
27
+ type: Function,
28
+ required: false,
29
+ default: null,
30
+ },
31
+ persistent: {
32
+ type: Boolean,
33
+ default: false,
34
+ },
35
+ closable: {
36
+ type: Boolean,
37
+ default: true,
38
+ },
39
+ cardClass: {
40
+ type: String,
41
+ default: null,
42
+ },
43
+ });
44
+
45
+ const emit = defineEmits(['confirm', 'cancel', ...useDialogPluginComponent.emits]);
46
+ defineExpose({ show: () => dialogRef.value.show(), hide: () => dialogRef.value.hide() });
47
+
48
+ const { dialogRef, onDialogHide, onDialogOK, onDialogCancel } =
49
+ useDialogPluginComponent();
50
+
51
+ const title = props.title || t('Confirm');
52
+ const message =
53
+ props.message ||
54
+ (props.message !== false ? t('Are you sure you want to continue?') : false);
55
+
56
+ const isLoading = ref(false);
57
+
58
+ async function confirm() {
59
+ isLoading.value = true;
60
+ if (props.promise) {
61
+ try {
62
+ await props.promise(props.data);
63
+ } finally {
64
+ isLoading.value = false;
65
+ }
66
+ }
67
+ onDialogOK(props.data);
68
+ }
69
+
70
+ function cancel() {
71
+ emit('cancel');
72
+ onDialogCancel();
73
+ }
74
+ </script>
75
+ <template>
76
+ <QDialog ref="dialogRef" :persistent="persistent" @hide="onDialogHide">
77
+ <QCard class="q-pa-sm" :class="cardClass">
78
+ <QCardSection class="row items-center q-pb-none">
79
+ <QAvatar
80
+ :icon="icon"
81
+ color="primary"
82
+ text-color="white"
83
+ size="xl"
84
+ v-if="icon"
85
+ />
86
+ <span class="text-h6">{{ title }}</span>
87
+ <QSpace />
88
+ <QBtn
89
+ v-if="closable"
90
+ icon="close"
91
+ :disable="isLoading"
92
+ flat
93
+ round
94
+ dense
95
+ @click="cancel()"
96
+ />
97
+ </QCardSection>
98
+ <QCardSection class="q-pb-none" data-cy="VnConfirm_message">
99
+ <span v-if="message !== false" v-html="message" />
100
+ </QCardSection>
101
+ <QCardSection class="row items-center q-pt-none">
102
+ <slot name="custom-html"></slot>
103
+ </QCardSection>
104
+ <QCardActions v-if="$slots.actions" align="right">
105
+ <slot name="actions" :actions="{ confirm, cancel }"></slot>
106
+ </QCardActions>
107
+ <QCardActions v-else align="right">
108
+ <QBtn
109
+ :label="t('globals.cancel')"
110
+ color="primary"
111
+ :disable="isLoading"
112
+ flat
113
+ @click="cancel()"
114
+ data-cy="VnConfirm_cancel"
115
+ />
116
+ <QBtn
117
+ :label="t('globals.confirm')"
118
+ :title="t('globals.confirm')"
119
+ color="primary"
120
+ :loading="isLoading"
121
+ @click="confirm()"
122
+ unelevated
123
+ autofocus
124
+ data-cy="VnConfirm_confirm"
125
+ />
126
+ </QCardActions>
127
+ </QCard>
128
+ </QDialog>
129
+ </template>
130
+
131
+ <style lang="scss" scoped>
132
+ .q-card {
133
+ min-width: 350px;
134
+ white-space: pre-line;
135
+ }
136
+ </style>
137
+
138
+ <i18n>
139
+ es:
140
+ Confirm: Confirmar
141
+ Are you sure you want to continue?: ¿Seguro que quieres continuar?
142
+ </i18n>
@@ -0,0 +1,14 @@
1
+ <template>
2
+ <div class="row q-gutter-md q-mb-md">
3
+ <QSkeleton type="QInput" class="col" square />
4
+ <QSkeleton type="QInput" class="col" square />
5
+ </div>
6
+ <div class="row q-gutter-md q-mb-md">
7
+ <QSkeleton type="QInput" class="col" square />
8
+ <QSkeleton type="QInput" class="col" square />
9
+ </div>
10
+ <div class="row q-gutter-md q-mb-md">
11
+ <QSkeleton type="QInput" class="col" square />
12
+ <QSkeleton type="QInput" class="col" square />
13
+ </div>
14
+ </template>
@@ -0,0 +1,63 @@
1
+ <script setup>
2
+ defineProps({
3
+ size: {
4
+ type: String,
5
+ default: '40px',
6
+ },
7
+ noTransition: {
8
+ type: Boolean,
9
+ default: false,
10
+ },
11
+ });
12
+
13
+ const sizeMap = {
14
+ xs: '16px',
15
+ sm: '24px',
16
+ md: '40px',
17
+ lg: '56px',
18
+ xl: '72px',
19
+ };
20
+ </script>
21
+ <template>
22
+ <Transition v-if="!noTransition" name="vn-spinner-fade" appear>
23
+ <div
24
+ class="vn-spinner"
25
+ :style="{ width: sizeMap[size] || size, height: sizeMap[size] || size }"
26
+ ></div>
27
+ </Transition>
28
+ <div
29
+ v-else
30
+ class="vn-spinner"
31
+ :style="{ width: sizeMap[size] || size, height: sizeMap[size] || size }"
32
+ ></div>
33
+ </template>
34
+ <style scoped>
35
+ .vn-spinner {
36
+ min-width: 16px;
37
+ min-height: 16px;
38
+ border: 3px solid color-mix(in srgb, var(--vn-label-color) 15%, transparent);
39
+ border-top-color: var(--q-primary);
40
+ border-radius: 50%;
41
+ animation: vn-spin 0.7s cubic-bezier(0.4, 0.15, 0.6, 0.85) infinite;
42
+ box-sizing: border-box;
43
+ }
44
+
45
+ @keyframes vn-spin {
46
+ to {
47
+ transform: rotate(360deg);
48
+ }
49
+ }
50
+
51
+ .vn-spinner-fade-enter-active,
52
+ .vn-spinner-fade-leave-active {
53
+ transition:
54
+ opacity 0.3s ease,
55
+ transform 0.3s ease;
56
+ }
57
+
58
+ .vn-spinner-fade-enter-from,
59
+ .vn-spinner-fade-leave-to {
60
+ opacity: 0;
61
+ transform: scale(0.6);
62
+ }
63
+ </style>
@@ -1 +1,6 @@
1
+ export { default as VnConfirm } from './dialogs/VnConfirm.vue';
2
+ export { default as VnSkeletonForm } from './feedback/VnSkeletonForm.vue';
3
+ export { default as VnSpinner } from './feedback/VnSpinner.vue';
1
4
  export { default as VnInput } from './inputs/VnInput.vue';
5
+ export { default as VnFetch } from './models/VnFetch.vue';
6
+ export { default as VnForm } from './models/VnForm.vue';
@@ -0,0 +1,65 @@
1
+ <script setup>
2
+ import {onMounted} from "vue";
3
+ import axios from "axios";
4
+
5
+ const $props = defineProps({
6
+ autoLoad: {
7
+ type: Boolean,
8
+ default: false,
9
+ },
10
+ url: {
11
+ type: String,
12
+ default: "",
13
+ },
14
+ filter: {
15
+ type: Object,
16
+ default: null,
17
+ },
18
+ where: {
19
+ type: Object,
20
+ default: null,
21
+ },
22
+ sortBy: {
23
+ type: String,
24
+ default: "",
25
+ },
26
+ limit: {
27
+ type: [String, Number],
28
+ default: "",
29
+ },
30
+ params: {
31
+ type: Object,
32
+ default: null,
33
+ },
34
+ });
35
+
36
+ const emit = defineEmits(["onFetch"]);
37
+ defineExpose({fetch});
38
+
39
+ onMounted(async () => {
40
+ if ($props.autoLoad) {
41
+ await fetch();
42
+ }
43
+ });
44
+
45
+ async function fetch(fetchFilter = {}) {
46
+ try {
47
+ const filter = {...fetchFilter, ...$props.filter}; // eslint-disable-line vue/no-dupe-keys
48
+ if ($props.where && !fetchFilter.where) filter.where = $props.where;
49
+ if ($props.sortBy) filter.order = $props.sortBy;
50
+ if ($props.limit) filter.limit = $props.limit;
51
+
52
+ const {data} = await axios.get($props.url, {
53
+ params: {filter: JSON.stringify(filter), ...$props.params},
54
+ });
55
+
56
+ emit("onFetch", data);
57
+ return data;
58
+ } catch (e) {
59
+ //
60
+ }
61
+ }
62
+ </script>
63
+ <template>
64
+ <template></template>
65
+ </template>