@volverjs/ui-vue 0.0.14 → 0.0.15
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/Volver.d.ts +5 -5
- package/dist/components/VvAction/VvAction.es.js +26 -26
- package/dist/components/VvAction/VvAction.umd.js +1 -1
- package/dist/components/VvAction/index.d.ts +1 -44
- package/dist/components/VvAlert/VvAlert.es.js +43 -44
- package/dist/components/VvAlert/VvAlert.umd.js +1 -1
- package/dist/components/VvAlert/VvAlert.vue.d.ts +1 -1
- package/dist/components/VvAlertGroup/VvAlertGroup.es.js +54 -55
- package/dist/components/VvAlertGroup/VvAlertGroup.umd.js +1 -1
- package/dist/components/VvBreadcrumb/VvBreadcrumb.es.js +34 -34
- package/dist/components/VvBreadcrumb/VvBreadcrumb.umd.js +1 -1
- package/dist/components/VvBreadcrumb/VvBreadcrumb.vue.d.ts +1 -1
- package/dist/components/VvButton/VvButton.es.js +186 -187
- package/dist/components/VvButton/VvButton.umd.js +1 -1
- package/dist/components/VvCheckbox/VvCheckbox.es.js +215 -217
- package/dist/components/VvCheckbox/VvCheckbox.umd.js +1 -1
- package/dist/components/VvCheckboxGroup/VvCheckboxGroup.es.js +235 -237
- package/dist/components/VvCheckboxGroup/VvCheckboxGroup.umd.js +1 -1
- package/dist/components/VvCheckboxGroup/VvCheckboxGroup.vue.d.ts +2 -2
- package/dist/components/VvCheckboxGroup/index.d.ts +1 -78
- package/dist/components/VvCombobox/VvCombobox.es.js +810 -813
- package/dist/components/VvCombobox/VvCombobox.umd.js +1 -1
- package/dist/components/VvCombobox/VvCombobox.vue.d.ts +1 -1
- package/dist/components/VvCombobox/index.d.ts +2 -2
- package/dist/components/VvDropdown/VvDropdown.es.js +4 -4
- package/dist/components/VvDropdown/VvDropdown.umd.js +1 -1
- package/dist/components/VvDropdownAction/VvDropdownAction.es.js +50 -50
- package/dist/components/VvDropdownAction/VvDropdownAction.umd.js +1 -1
- package/dist/components/VvIcon/VvIcon.es.js +30 -31
- package/dist/components/VvIcon/VvIcon.umd.js +1 -1
- package/dist/components/VvInputFile/VvInputFile.es.js +415 -418
- package/dist/components/VvInputFile/VvInputFile.umd.js +1 -1
- package/dist/components/VvInputText/VvInputText.es.js +595 -588
- package/dist/components/VvInputText/VvInputText.umd.js +1 -1
- package/dist/components/VvInputText/VvInputText.vue.d.ts +6 -6
- package/dist/components/VvInputText/index.d.ts +3 -3
- package/dist/components/VvNav/VvNav.es.js +63 -63
- package/dist/components/VvNav/VvNav.umd.js +1 -1
- package/dist/components/VvNavItem/VvNavItem.es.js +41 -41
- package/dist/components/VvNavItem/VvNavItem.umd.js +1 -1
- package/dist/components/VvRadio/VvRadio.es.js +222 -224
- package/dist/components/VvRadio/VvRadio.umd.js +1 -1
- package/dist/components/VvRadioGroup/VvRadioGroup.es.js +234 -236
- package/dist/components/VvRadioGroup/VvRadioGroup.umd.js +1 -1
- package/dist/components/VvRadioGroup/VvRadioGroup.vue.d.ts +2 -2
- package/dist/components/VvRadioGroup/index.d.ts +1 -78
- package/dist/components/VvSelect/VvSelect.es.js +200 -203
- package/dist/components/VvSelect/VvSelect.umd.js +1 -1
- package/dist/components/VvSelect/VvSelect.vue.d.ts +1 -1
- package/dist/components/VvSelect/index.d.ts +2 -2
- package/dist/components/VvTab/VvTab.es.js +35 -35
- package/dist/components/VvTab/VvTab.umd.js +1 -1
- package/dist/components/VvTextarea/VvTextarea.es.js +341 -344
- package/dist/components/VvTextarea/VvTextarea.umd.js +1 -1
- package/dist/components/index.es.js +1965 -1958
- package/dist/components/index.umd.js +1 -1
- package/dist/composables/index.es.js +34 -34
- package/dist/composables/index.umd.js +2 -2
- package/dist/composables/useModifiers.d.ts +1 -1
- package/dist/constants.d.ts +2 -2
- package/dist/directives/index.es.js +22 -22
- package/dist/directives/index.umd.js +1 -1
- package/dist/directives/v-contextmenu.es.js +13 -13
- package/dist/directives/v-contextmenu.umd.js +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.es.js +19 -19
- package/dist/index.umd.js +1 -1
- package/dist/json-render/index.es.js +1877 -1870
- package/dist/json-render/index.umd.js +1 -1
- package/dist/props/index.d.ts +1 -1
- package/dist/resolvers/unplugin.es.js +28 -28
- package/dist/resolvers/unplugin.umd.js +1 -1
- package/dist/types/alert.d.ts +1 -1
- package/dist/types/nav.d.ts +1 -1
- package/dist/utils/ObjectUtilities.d.ts +0 -6
- package/package.json +1 -1
- package/src/Volver.ts +8 -6
- package/src/components/VvAction/index.ts +1 -3
- package/src/components/VvButton/VvButton.vue +1 -1
- package/src/components/VvCheckboxGroup/index.ts +1 -3
- package/src/components/VvCombobox/VvCombobox.vue +3 -3
- package/src/components/VvDropdown/VvDropdown.vue +8 -8
- package/src/components/VvIcon/VvIcon.vue +3 -6
- package/src/components/VvInputFile/VvInputFile.vue +6 -6
- package/src/components/VvInputText/VvInputText.vue +95 -78
- package/src/components/VvRadioGroup/index.ts +1 -3
- package/src/composables/useBlurhash.ts +1 -1
- package/src/composables/useDebouncedInput.ts +1 -1
- package/src/composables/useDefaults.ts +55 -44
- package/src/composables/useModifiers.ts +1 -1
- package/src/index.ts +2 -2
- package/src/resolvers/unplugin.ts +6 -6
- package/src/types/alert.ts +1 -1
- package/src/types/nav.ts +1 -1
- package/src/utils/DateUtilities.ts +3 -3
- package/src/utils/DomUtilities.ts +7 -1
- package/src/utils/ObjectUtilities.ts +60 -59
package/dist/props/index.d.ts
CHANGED
|
@@ -728,7 +728,7 @@ export declare const CheckboxRadioGroupProps: {
|
|
|
728
728
|
* Input value
|
|
729
729
|
*/
|
|
730
730
|
modelValue: {
|
|
731
|
-
type: (SymbolConstructor |
|
|
731
|
+
type: (SymbolConstructor | NumberConstructor | ArrayConstructor | BooleanConstructor | StringConstructor)[];
|
|
732
732
|
default: undefined;
|
|
733
733
|
};
|
|
734
734
|
/**
|
|
@@ -1,27 +1,27 @@
|
|
|
1
1
|
var E = new RegExp("([\\p{Ll}\\d])(\\p{Lu})", "gu"), h = new RegExp("(\\p{Lu})([\\p{Lu}][\\p{Ll}])", "gu"), L = new RegExp("(\\d)\\p{Ll}|(\\p{L})\\d", "u"), w = /[^\p{L}\d]+/giu, u = "$1\0$2", f = "";
|
|
2
|
-
function
|
|
2
|
+
function d(e) {
|
|
3
3
|
let r = e.trim();
|
|
4
4
|
r = r.replace(E, u).replace(h, u), r = r.replace(w, "\0");
|
|
5
|
-
let
|
|
6
|
-
for (; r.charAt(
|
|
7
|
-
if (
|
|
8
|
-
for (; r.charAt(
|
|
9
|
-
return r.slice(
|
|
5
|
+
let t = 0, o = r.length;
|
|
6
|
+
for (; r.charAt(t) === "\0"; ) t++;
|
|
7
|
+
if (t === o) return [];
|
|
8
|
+
for (; r.charAt(o - 1) === "\0"; ) o--;
|
|
9
|
+
return r.slice(t, o).split(/\0/g);
|
|
10
10
|
}
|
|
11
11
|
function g(e) {
|
|
12
|
-
const r =
|
|
13
|
-
for (let
|
|
14
|
-
const
|
|
12
|
+
const r = d(e);
|
|
13
|
+
for (let t = 0; t < r.length; t++) {
|
|
14
|
+
const o = r[t], s = L.exec(o);
|
|
15
15
|
if (s) {
|
|
16
16
|
const n = s.index + (s[1] ?? s[2]).length;
|
|
17
|
-
r.splice(
|
|
17
|
+
r.splice(t, 1, o.slice(0, n), o.slice(n));
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
20
|
return r;
|
|
21
21
|
}
|
|
22
22
|
function x(e, r) {
|
|
23
|
-
const [
|
|
24
|
-
return
|
|
23
|
+
const [t, o, s] = _(e, r);
|
|
24
|
+
return t + o.map(R(r?.locale)).join(r?.delimiter ?? " ") + s;
|
|
25
25
|
}
|
|
26
26
|
function l(e, r) {
|
|
27
27
|
return x(e, {
|
|
@@ -33,11 +33,11 @@ function R(e) {
|
|
|
33
33
|
return e === !1 ? (r) => r.toLowerCase() : (r) => r.toLocaleLowerCase(e);
|
|
34
34
|
}
|
|
35
35
|
function _(e, r = {}) {
|
|
36
|
-
const
|
|
36
|
+
const t = r.split ?? (r.separateNumbers ? g : d), o = r.prefixCharacters ?? f, s = r.suffixCharacters ?? f;
|
|
37
37
|
let n = 0, v = e.length;
|
|
38
38
|
for (; n < e.length; ) {
|
|
39
39
|
const c = e.charAt(n);
|
|
40
|
-
if (!
|
|
40
|
+
if (!o.includes(c)) break;
|
|
41
41
|
n++;
|
|
42
42
|
}
|
|
43
43
|
for (; v > n; ) {
|
|
@@ -47,13 +47,13 @@ function _(e, r = {}) {
|
|
|
47
47
|
}
|
|
48
48
|
return [
|
|
49
49
|
e.slice(0, n),
|
|
50
|
-
|
|
50
|
+
t(e.slice(n, v)),
|
|
51
51
|
e.slice(v)
|
|
52
52
|
];
|
|
53
53
|
}
|
|
54
|
-
var P = ["vv-icon", "vv-action"],
|
|
54
|
+
var P = /* @__PURE__ */ new Set(["vv-icon", "vv-action"]), a = "vv", C = /* @__PURE__ */ new Set(["v-tooltip", "v-contextmenu"]);
|
|
55
55
|
function A(e) {
|
|
56
|
-
if (!P.
|
|
56
|
+
if (!P.has(e))
|
|
57
57
|
return e === "vv-dropdown" ? [
|
|
58
58
|
"vv-dropdown",
|
|
59
59
|
"vv-dropdown-option",
|
|
@@ -67,20 +67,20 @@ function A(e) {
|
|
|
67
67
|
] : e === "vv-button-group" ? ["vv-button", "vv-button-group"] : e === "vv-accordion-group" ? ["vv-accordion", "vv-accordion-group"] : e === "vv-checkbox-group" ? ["vv-checkbox", "vv-checkbox-group"] : e === "vv-radio-group" ? ["vv-radio", "vv-radio-group"] : e === "vv-alert-group" ? ["vv-alert", "vv-alert-group"] : e === "v-tooltip" ? ["vv-tooltip"] : [e];
|
|
68
68
|
}
|
|
69
69
|
function i(e, r) {
|
|
70
|
-
const
|
|
71
|
-
if (!r) return
|
|
72
|
-
const
|
|
73
|
-
return
|
|
74
|
-
|
|
75
|
-
}),
|
|
70
|
+
const t = [];
|
|
71
|
+
if (!r) return t;
|
|
72
|
+
const o = A(e);
|
|
73
|
+
return o && o.forEach((s) => {
|
|
74
|
+
t.push(`@volverjs/style/${r === "scss" ? "scss/" : ""}components/${s}`);
|
|
75
|
+
}), t;
|
|
76
76
|
}
|
|
77
|
-
function I({ prefix: e =
|
|
77
|
+
function I({ prefix: e = a, importStyle: r, directives: t, ignore: o, cherryPick: s } = {}) {
|
|
78
78
|
return [{
|
|
79
79
|
type: "component",
|
|
80
80
|
resolve: (n) => {
|
|
81
81
|
if (!e || !n.toLowerCase().startsWith(e.toLowerCase())) return;
|
|
82
|
-
const v = l(n).replace(`${e}-`, `${
|
|
83
|
-
if (!
|
|
82
|
+
const v = l(n).replace(`${e}-`, `${a}-`);
|
|
83
|
+
if (!o?.includes(v))
|
|
84
84
|
return s ? {
|
|
85
85
|
from: `@volverjs/ui-vue/${v}`,
|
|
86
86
|
sideEffects: i(v, r)
|
|
@@ -93,9 +93,9 @@ function I({ prefix: e = d, importStyle: r, directives: o, ignore: t, cherryPick
|
|
|
93
93
|
}, {
|
|
94
94
|
type: "directive",
|
|
95
95
|
resolve: (n) => {
|
|
96
|
-
if (!
|
|
96
|
+
if (!t) return;
|
|
97
97
|
const v = `v-${l(n)}`;
|
|
98
|
-
if (C.
|
|
98
|
+
if (C.has(v) && !o?.includes(v))
|
|
99
99
|
return s ? {
|
|
100
100
|
from: `@volverjs/ui-vue/${v}`,
|
|
101
101
|
sideEffects: i(v, r)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(v,c){typeof exports=="object"&&typeof module<"u"?c(exports):typeof define=="function"&&define.amd?define(["exports"],c):(v=typeof globalThis<"u"?globalThis:v||self,c(v.components={}))})(this,function(v){Object.defineProperty(v,Symbol.toStringTag,{value:"Module"});var c=new RegExp("([\\p{Ll}\\d])(\\p{Lu})","gu"),L=new RegExp("(\\p{Lu})([\\p{Lu}][\\p{Ll}])","gu"),g=new RegExp("(\\d)\\p{Ll}|(\\p{L})\\d","u"),w=/[^\p{L}\d]+/giu,l="$1\0$2",d="";function a(r){let e=r.trim();e=e.replace(c,l).replace(L,l),e=e.replace(w,"\0");let
|
|
1
|
+
(function(v,c){typeof exports=="object"&&typeof module<"u"?c(exports):typeof define=="function"&&define.amd?define(["exports"],c):(v=typeof globalThis<"u"?globalThis:v||self,c(v.components={}))})(this,function(v){Object.defineProperty(v,Symbol.toStringTag,{value:"Module"});var c=new RegExp("([\\p{Ll}\\d])(\\p{Lu})","gu"),L=new RegExp("(\\p{Lu})([\\p{Lu}][\\p{Ll}])","gu"),g=new RegExp("(\\d)\\p{Ll}|(\\p{L})\\d","u"),w=/[^\p{L}\d]+/giu,l="$1\0$2",d="";function a(r){let e=r.trim();e=e.replace(c,l).replace(L,l),e=e.replace(w,"\0");let t=0,o=e.length;for(;e.charAt(t)==="\0";)t++;if(t===o)return[];for(;e.charAt(o-1)==="\0";)o--;return e.slice(t,o).split(/\0/g)}function R(r){const e=a(r);for(let t=0;t<e.length;t++){const o=e[t],s=g.exec(o);if(s){const n=s.index+(s[1]??s[2]).length;e.splice(t,1,o.slice(0,n),o.slice(n))}}return e}function x(r,e){const[t,o,s]=P(r,e);return t+o.map(_(e?.locale)).join(e?.delimiter??" ")+s}function p(r,e){return x(r,{delimiter:"-",...e})}function _(r){return r===!1?e=>e.toLowerCase():e=>e.toLocaleLowerCase(r)}function P(r,e={}){const t=e.split??(e.separateNumbers?R:a),o=e.prefixCharacters??d,s=e.suffixCharacters??d;let n=0,i=r.length;for(;n<r.length;){const f=r.charAt(n);if(!o.includes(f))break;n++}for(;i>n;){const f=i-1,A=r.charAt(f);if(!s.includes(A))break;i=f}return[r.slice(0,n),t(r.slice(n,i)),r.slice(i)]}var C=new Set(["vv-icon","vv-action"]),E="vv",S=new Set(["v-tooltip","v-contextmenu"]);function h(r){if(!C.has(r))return r==="vv-dropdown"?["vv-dropdown","vv-dropdown-option","vv-dropdown-action"]:r==="vv-combobox"?["vv-select","vv-dropdown-option","vv-dropdown-optgroup","vv-dropdown","vv-dropdown-action"]:r==="vv-button-group"?["vv-button","vv-button-group"]:r==="vv-accordion-group"?["vv-accordion","vv-accordion-group"]:r==="vv-checkbox-group"?["vv-checkbox","vv-checkbox-group"]:r==="vv-radio-group"?["vv-radio","vv-radio-group"]:r==="vv-alert-group"?["vv-alert","vv-alert-group"]:r==="v-tooltip"?["vv-tooltip"]:[r]}function u(r,e){const t=[];if(!e)return t;const o=h(r);return o&&o.forEach(s=>{t.push(`@volverjs/style/${e==="scss"?"scss/":""}components/${s}`)}),t}function T({prefix:r=E,importStyle:e,directives:t,ignore:o,cherryPick:s}={}){return[{type:"component",resolve:n=>{if(!r||!n.toLowerCase().startsWith(r.toLowerCase()))return;const i=p(n).replace(`${r}-`,`${E}-`);if(!o?.includes(i))return s?{from:`@volverjs/ui-vue/${i}`,sideEffects:u(i,e)}:{from:"@volverjs/ui-vue/components",sideEffects:u(i,e),name:n}}},{type:"directive",resolve:n=>{if(!t)return;const i=`v-${p(n)}`;if(S.has(i)&&!o?.includes(i))return s?{from:`@volverjs/ui-vue/${i}`,sideEffects:u(i,e)}:{from:"@volverjs/ui-vue/directives",sideEffects:u(i,e),name:`v${n}`}}}]}v.VolverResolver=T,v.getStyleNames=h});
|
package/dist/types/alert.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { VvIconProps } from '@/components/VvIcon';
|
|
2
2
|
import type { AlertRole } from '@/constants';
|
|
3
|
-
export type AlertModifier = 'success' | 'info' | 'warning' | 'danger' | 'brand' | 'accent' | string;
|
|
3
|
+
export type AlertModifier = 'success' | 'info' | 'warning' | 'danger' | 'brand' | 'accent' | (string & {});
|
|
4
4
|
export type Alert = {
|
|
5
5
|
id: string | number;
|
|
6
6
|
title?: string;
|
package/dist/types/nav.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ export type NavItem = {
|
|
|
9
9
|
disabled?: boolean;
|
|
10
10
|
current?: boolean;
|
|
11
11
|
class?: string | string[];
|
|
12
|
-
on?: Record<'click' | string, () => void>;
|
|
12
|
+
on?: Record<'click' | (string & {}), () => void>;
|
|
13
13
|
data?: Record<string, unknown>;
|
|
14
14
|
};
|
|
15
15
|
export type NavItemTab = NavItem & {
|
|
@@ -7,12 +7,6 @@ import type { Ref } from 'vue';
|
|
|
7
7
|
* @returns {boolean}
|
|
8
8
|
*/
|
|
9
9
|
export declare function equals(obj1: any, obj2: any, field?: string): boolean;
|
|
10
|
-
/**
|
|
11
|
-
* Compare objects, primitives, array, dates, regexp
|
|
12
|
-
* @param {any} a first literal
|
|
13
|
-
* @param {any} b second literal
|
|
14
|
-
* @returns {boolean}
|
|
15
|
-
*/
|
|
16
10
|
export declare function deepEquals(a: any, b: any): boolean;
|
|
17
11
|
/**
|
|
18
12
|
* Find and return field or nested field from object (also nested dotted field)
|
package/package.json
CHANGED
package/src/Volver.ts
CHANGED
|
@@ -9,6 +9,8 @@ import {
|
|
|
9
9
|
import { kebabCase } from 'change-case'
|
|
10
10
|
import { DEFAULT_ICONIFY_PROVIDER, INJECTION_KEY_VOLVER } from './constants'
|
|
11
11
|
|
|
12
|
+
const DEFAULT_FETCH_ICON_OPTIONS: RequestInit = { cache: 'force-cache' }
|
|
13
|
+
|
|
12
14
|
export function useDefaultProps(
|
|
13
15
|
component: Component,
|
|
14
16
|
defaults?: Record<string, unknown>,
|
|
@@ -171,11 +173,11 @@ export interface VolverInterface {
|
|
|
171
173
|
}
|
|
172
174
|
|
|
173
175
|
export class Volver implements VolverInterface {
|
|
174
|
-
private _fetchOptions: RequestInit = {}
|
|
175
|
-
private _iconsCollections: IconifyJSON[] = []
|
|
176
|
-
private _iconsProvider = DEFAULT_ICONIFY_PROVIDER
|
|
177
|
-
private _nuxt = false
|
|
178
|
-
private _experimentalFeatures: VolverExperimentalFeatures = {}
|
|
176
|
+
private readonly _fetchOptions: RequestInit = {}
|
|
177
|
+
private readonly _iconsCollections: IconifyJSON[] = []
|
|
178
|
+
private readonly _iconsProvider: string = DEFAULT_ICONIFY_PROVIDER
|
|
179
|
+
private readonly _nuxt: boolean = false
|
|
180
|
+
private readonly _experimentalFeatures: VolverExperimentalFeatures = {}
|
|
179
181
|
|
|
180
182
|
defaults: Ref<DefaultOptions> = ref({})
|
|
181
183
|
|
|
@@ -260,7 +262,7 @@ export class Volver implements VolverInterface {
|
|
|
260
262
|
|
|
261
263
|
async fetchIcon(
|
|
262
264
|
src: string,
|
|
263
|
-
options: RequestInit =
|
|
265
|
+
options: RequestInit = DEFAULT_FETCH_ICON_OPTIONS,
|
|
264
266
|
): Promise<string | undefined> {
|
|
265
267
|
const response = await fetch(src, {
|
|
266
268
|
...this._fetchOptions,
|
|
@@ -78,7 +78,7 @@ const { hasIcon } = useComponentIcon(icon)
|
|
|
78
78
|
* @description Catch click event
|
|
79
79
|
*/
|
|
80
80
|
const toggleValue = computed(() => {
|
|
81
|
-
return props.value
|
|
81
|
+
return props.value === undefined ? name.value : props.value
|
|
82
82
|
})
|
|
83
83
|
const hasListeners = computed(() => {
|
|
84
84
|
if (!toggle.value) {
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export const VvCheckboxGroupProps = CheckboxRadioGroupProps
|
|
1
|
+
export { CheckboxRadioGroupProps as VvCheckboxGroupProps } from '../../props'
|
|
4
2
|
|
|
5
3
|
export const VvCheckboxGroupEvents = ['update:modelValue', 'change']
|
|
@@ -398,10 +398,10 @@ function onInput(option: string | Option) {
|
|
|
398
398
|
return item !== optionValue
|
|
399
399
|
})
|
|
400
400
|
} else if (!isSelected && isSelectable.value) {
|
|
401
|
-
if (
|
|
402
|
-
localModelValue.value = [optionValue]
|
|
403
|
-
} else {
|
|
401
|
+
if (props.multiple) {
|
|
404
402
|
localModelValue.value = [...localModelValue.value, optionValue]
|
|
403
|
+
} else {
|
|
404
|
+
localModelValue.value = [optionValue]
|
|
405
405
|
}
|
|
406
406
|
}
|
|
407
407
|
if (!props.multiple && !props.keepOpen) {
|
|
@@ -69,14 +69,14 @@ onMounted(() => {
|
|
|
69
69
|
floatingEl.value,
|
|
70
70
|
() => {
|
|
71
71
|
hasCustomPosition.value
|
|
72
|
-
=
|
|
72
|
+
= globalThis
|
|
73
73
|
.getComputedStyle(floatingEl.value)
|
|
74
74
|
.getPropertyValue('--dropdown-custom-position')
|
|
75
75
|
?.trim() === 'true'
|
|
76
76
|
},
|
|
77
77
|
{
|
|
78
78
|
attributeFilter: ['style'],
|
|
79
|
-
window,
|
|
79
|
+
window: globalThis.window,
|
|
80
80
|
},
|
|
81
81
|
)
|
|
82
82
|
})
|
|
@@ -216,13 +216,13 @@ const arrowPlacement = computed(() => {
|
|
|
216
216
|
}[side.value]
|
|
217
217
|
return {
|
|
218
218
|
left:
|
|
219
|
-
middlewareData.value.arrow?.x
|
|
220
|
-
?
|
|
221
|
-
:
|
|
219
|
+
middlewareData.value.arrow?.x === undefined
|
|
220
|
+
? undefined
|
|
221
|
+
: `${middlewareData.value.arrow?.x}px`,
|
|
222
222
|
top:
|
|
223
|
-
middlewareData.value.arrow?.y
|
|
224
|
-
?
|
|
225
|
-
:
|
|
223
|
+
middlewareData.value.arrow?.y === undefined
|
|
224
|
+
? undefined
|
|
225
|
+
: `${middlewareData.value.arrow?.y}px`,
|
|
226
226
|
[staticSide]: `${-(arrowEl.value?.offsetWidth ?? 0) / 2}px`,
|
|
227
227
|
}
|
|
228
228
|
})
|
|
@@ -59,15 +59,12 @@ const icon = computed(() => {
|
|
|
59
59
|
* @return {SVGSVGElement | null} https://developer.mozilla.org/en-US/docs/Web/API/SVGSVGElement
|
|
60
60
|
*/
|
|
61
61
|
function getSvgContent(svg: string): SVGSVGElement | null {
|
|
62
|
-
|
|
63
|
-
? new window.DOMParser()
|
|
64
|
-
: null
|
|
65
|
-
if (!domParser) {
|
|
62
|
+
if (globalThis.window === undefined) {
|
|
66
63
|
return null
|
|
67
64
|
}
|
|
65
|
+
const domParser = new globalThis.DOMParser()
|
|
68
66
|
const svgDomString = domParser.parseFromString(svg, 'text/html')
|
|
69
|
-
|
|
70
|
-
return svgEl
|
|
67
|
+
return svgDomString.querySelector('svg')
|
|
71
68
|
}
|
|
72
69
|
|
|
73
70
|
/**
|
|
@@ -176,7 +176,7 @@ function onClickDropArea() {
|
|
|
176
176
|
}
|
|
177
177
|
|
|
178
178
|
function onRemoveIndex(index: number) {
|
|
179
|
-
const toRemove =
|
|
179
|
+
const toRemove = Array.isArray(localModelValue.value) ? localModelValue.value[index] : localModelValue.value
|
|
180
180
|
if (!toRemove) {
|
|
181
181
|
return
|
|
182
182
|
}
|
|
@@ -194,7 +194,7 @@ function onRemoveIndex(index: number) {
|
|
|
194
194
|
}
|
|
195
195
|
|
|
196
196
|
const selectedFileIndex = ref(0)
|
|
197
|
-
const PREVIEW_MIME_TYPES = ['image/jpeg', 'image/png']
|
|
197
|
+
const PREVIEW_MIME_TYPES = new Set(['image/jpeg', 'image/png'])
|
|
198
198
|
const previewSrc = computed(() => {
|
|
199
199
|
if (props.hidePreview) {
|
|
200
200
|
return undefined
|
|
@@ -207,7 +207,7 @@ const previewSrc = computed(() => {
|
|
|
207
207
|
}
|
|
208
208
|
if (files.value[selectedFileIndex.value] instanceof File) {
|
|
209
209
|
const currentFile = files.value[selectedFileIndex.value] as File
|
|
210
|
-
if (!PREVIEW_MIME_TYPES.
|
|
210
|
+
if (!PREVIEW_MIME_TYPES.has(currentFile.type)) {
|
|
211
211
|
return undefined
|
|
212
212
|
}
|
|
213
213
|
return URL.createObjectURL(currentFile)
|
|
@@ -216,7 +216,7 @@ const previewSrc = computed(() => {
|
|
|
216
216
|
if (currentFile.thumbnailUrl) {
|
|
217
217
|
return currentFile.thumbnailUrl
|
|
218
218
|
}
|
|
219
|
-
if (!PREVIEW_MIME_TYPES.
|
|
219
|
+
if (!PREVIEW_MIME_TYPES.has(currentFile.type)) {
|
|
220
220
|
return undefined
|
|
221
221
|
}
|
|
222
222
|
return currentFile.url
|
|
@@ -241,7 +241,7 @@ function formatBytes(bytes?: number, decimals?: number) {
|
|
|
241
241
|
if (bytes === 0)
|
|
242
242
|
return '0 Bytes'
|
|
243
243
|
const k = 1024
|
|
244
|
-
const dm =
|
|
244
|
+
const dm = Math.max(0, decimals ?? 2)
|
|
245
245
|
const sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB']
|
|
246
246
|
const i = Math.floor(Math.log(bytes) / Math.log(k))
|
|
247
247
|
return `${Number.parseFloat((bytes / (k ** i)).toFixed(dm))} ${sizes[i]}`
|
|
@@ -258,7 +258,7 @@ function onDownloadFile(file: File | UploadedFile) {
|
|
|
258
258
|
link.setAttribute('download', file.name)
|
|
259
259
|
document.body.appendChild(link)
|
|
260
260
|
link.click()
|
|
261
|
-
|
|
261
|
+
link.remove()
|
|
262
262
|
URL.revokeObjectURL(link.href)
|
|
263
263
|
}
|
|
264
264
|
|
|
@@ -20,6 +20,8 @@ import {
|
|
|
20
20
|
} from '../VvInputText'
|
|
21
21
|
import VvInputTextActionsFactory from '../VvInputText/VvInputTextActions'
|
|
22
22
|
|
|
23
|
+
type SuggestionValue = string | number | Date
|
|
24
|
+
|
|
23
25
|
// props, emit, slots and attrs
|
|
24
26
|
const props = defineProps(VvInputTextProps)
|
|
25
27
|
|
|
@@ -117,80 +119,14 @@ const { el, mask, typed, masked, unmasked } = useIMask(
|
|
|
117
119
|
}
|
|
118
120
|
emit('update:masked', masked.value)
|
|
119
121
|
if (type.value === INPUT_TYPES.NUMBER) {
|
|
120
|
-
|
|
121
|
-
if (
|
|
122
|
-
localModelValue.value === null
|
|
123
|
-
|| localModelValue.value === undefined
|
|
124
|
-
) {
|
|
125
|
-
return
|
|
126
|
-
}
|
|
127
|
-
localModelValue.value = undefined
|
|
128
|
-
return
|
|
129
|
-
}
|
|
130
|
-
if (NEGATIVE_ZERO_REGEX.test(unmasked.value)) {
|
|
131
|
-
localModelValue.value = 0
|
|
132
|
-
return
|
|
133
|
-
}
|
|
134
|
-
if (typeof typed.value !== 'number') {
|
|
135
|
-
localModelValue.value = Number(typed.value)
|
|
136
|
-
return
|
|
137
|
-
}
|
|
138
|
-
localModelValue.value = typed.value
|
|
122
|
+
handleNumberAccept()
|
|
139
123
|
return
|
|
140
124
|
}
|
|
141
125
|
if (type.value === INPUT_TYPES.DATETIME_LOCAL
|
|
142
126
|
|| type.value === INPUT_TYPES.DATE
|
|
143
127
|
|| type.value === INPUT_TYPES.TIME
|
|
144
128
|
|| type.value === INPUT_TYPES.MONTH) {
|
|
145
|
-
|
|
146
|
-
if (!localModelValue.value) {
|
|
147
|
-
return
|
|
148
|
-
}
|
|
149
|
-
if (modelValueDate.value) {
|
|
150
|
-
localModelValue.value = undefined
|
|
151
|
-
return
|
|
152
|
-
}
|
|
153
|
-
localModelValue.value = ''
|
|
154
|
-
return
|
|
155
|
-
}
|
|
156
|
-
if (!(typed.value instanceof Date) && !modelValueDate.value && !modelValueDateIsoString.value) {
|
|
157
|
-
localModelValue.value = typed.value
|
|
158
|
-
return
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
let date = typed.value
|
|
162
|
-
if (!(date instanceof Date)) {
|
|
163
|
-
date = getDateFromInputValue(typed.value, type.value)
|
|
164
|
-
}
|
|
165
|
-
if (modelValueDate.value || modelValueDateIsoString.value) {
|
|
166
|
-
const toReturn = new Date(modelValueDate.value || modelValueDateIsoString.value as string)
|
|
167
|
-
if (type.value === INPUT_TYPES.DATETIME_LOCAL
|
|
168
|
-
|| type.value === INPUT_TYPES.DATE
|
|
169
|
-
|| type.value === INPUT_TYPES.MONTH) {
|
|
170
|
-
toReturn.setFullYear(date.getFullYear())
|
|
171
|
-
toReturn.setMonth(date.getMonth())
|
|
172
|
-
}
|
|
173
|
-
if (type.value === INPUT_TYPES.DATETIME_LOCAL
|
|
174
|
-
|| type.value === INPUT_TYPES.DATE) {
|
|
175
|
-
toReturn.setDate(date.getDate())
|
|
176
|
-
}
|
|
177
|
-
if (type.value === INPUT_TYPES.DATETIME_LOCAL
|
|
178
|
-
|| type.value === INPUT_TYPES.TIME) {
|
|
179
|
-
toReturn.setHours(date.getHours())
|
|
180
|
-
toReturn.setMinutes(date.getMinutes())
|
|
181
|
-
toReturn.setSeconds(date.getSeconds())
|
|
182
|
-
}
|
|
183
|
-
if (modelValueDate.value instanceof Date) {
|
|
184
|
-
if (localModelValue.value?.getTime() === toReturn.getTime()) {
|
|
185
|
-
return
|
|
186
|
-
}
|
|
187
|
-
localModelValue.value = toReturn
|
|
188
|
-
return
|
|
189
|
-
}
|
|
190
|
-
localModelValue.value = toReturn.toISOString()
|
|
191
|
-
return
|
|
192
|
-
}
|
|
193
|
-
localModelValue.value = getInputValueFromDate(date, type.value, hasSeconds.value)
|
|
129
|
+
handleDateAccept()
|
|
194
130
|
return
|
|
195
131
|
}
|
|
196
132
|
if (!localModelValue.value && !unmasked.value) {
|
|
@@ -200,7 +136,88 @@ const { el, mask, typed, masked, unmasked } = useIMask(
|
|
|
200
136
|
},
|
|
201
137
|
},
|
|
202
138
|
)
|
|
203
|
-
|
|
139
|
+
|
|
140
|
+
function handleNumberAccept() {
|
|
141
|
+
if (MASK_NUMBER_REGEX.test(unmasked.value)) {
|
|
142
|
+
if (
|
|
143
|
+
localModelValue.value === null
|
|
144
|
+
|| localModelValue.value === undefined
|
|
145
|
+
) {
|
|
146
|
+
return
|
|
147
|
+
}
|
|
148
|
+
localModelValue.value = undefined
|
|
149
|
+
return
|
|
150
|
+
}
|
|
151
|
+
if (NEGATIVE_ZERO_REGEX.test(unmasked.value)) {
|
|
152
|
+
localModelValue.value = 0
|
|
153
|
+
return
|
|
154
|
+
}
|
|
155
|
+
if (typeof typed.value !== 'number') {
|
|
156
|
+
localModelValue.value = Number(typed.value)
|
|
157
|
+
return
|
|
158
|
+
}
|
|
159
|
+
localModelValue.value = typed.value
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
function mergeDateIntoModelValue(date: Date) {
|
|
163
|
+
const toReturn = new Date(modelValueDate.value || modelValueDateIsoString.value as string)
|
|
164
|
+
if (type.value === INPUT_TYPES.DATETIME_LOCAL
|
|
165
|
+
|| type.value === INPUT_TYPES.DATE
|
|
166
|
+
|| type.value === INPUT_TYPES.MONTH) {
|
|
167
|
+
toReturn.setFullYear(date.getFullYear())
|
|
168
|
+
toReturn.setMonth(date.getMonth())
|
|
169
|
+
}
|
|
170
|
+
if (type.value === INPUT_TYPES.DATETIME_LOCAL
|
|
171
|
+
|| type.value === INPUT_TYPES.DATE) {
|
|
172
|
+
toReturn.setDate(date.getDate())
|
|
173
|
+
}
|
|
174
|
+
if (type.value === INPUT_TYPES.DATETIME_LOCAL
|
|
175
|
+
|| type.value === INPUT_TYPES.TIME) {
|
|
176
|
+
toReturn.setHours(date.getHours())
|
|
177
|
+
toReturn.setMinutes(date.getMinutes())
|
|
178
|
+
toReturn.setSeconds(date.getSeconds())
|
|
179
|
+
}
|
|
180
|
+
if (modelValueDate.value instanceof Date) {
|
|
181
|
+
if (localModelValue.value?.getTime() === toReturn.getTime()) {
|
|
182
|
+
return
|
|
183
|
+
}
|
|
184
|
+
localModelValue.value = toReturn
|
|
185
|
+
return
|
|
186
|
+
}
|
|
187
|
+
localModelValue.value = toReturn.toISOString()
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
function handleDateAccept() {
|
|
191
|
+
// onAccept only calls this for date-like input types
|
|
192
|
+
const dateType = type.value as 'date' | 'time' | 'month' | 'datetime-local'
|
|
193
|
+
if (!typed.value) {
|
|
194
|
+
if (!localModelValue.value) {
|
|
195
|
+
return
|
|
196
|
+
}
|
|
197
|
+
if (modelValueDate.value) {
|
|
198
|
+
localModelValue.value = undefined
|
|
199
|
+
return
|
|
200
|
+
}
|
|
201
|
+
localModelValue.value = ''
|
|
202
|
+
return
|
|
203
|
+
}
|
|
204
|
+
if (!(typed.value instanceof Date) && !modelValueDate.value && !modelValueDateIsoString.value) {
|
|
205
|
+
localModelValue.value = typed.value
|
|
206
|
+
return
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
let date = typed.value
|
|
210
|
+
if (!(date instanceof Date)) {
|
|
211
|
+
date = getDateFromInputValue(typed.value, dateType)
|
|
212
|
+
}
|
|
213
|
+
if (modelValueDate.value || modelValueDateIsoString.value) {
|
|
214
|
+
mergeDateIntoModelValue(date)
|
|
215
|
+
return
|
|
216
|
+
}
|
|
217
|
+
localModelValue.value = getInputValueFromDate(date, dateType, hasSeconds.value)
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
function updateMaskValue(newValue: SuggestionValue | undefined | null) {
|
|
204
221
|
// Handle empty values
|
|
205
222
|
if (newValue === undefined || newValue === null) {
|
|
206
223
|
typed.value = ''
|
|
@@ -439,13 +456,13 @@ const isInvalid = computed(() => {
|
|
|
439
456
|
|
|
440
457
|
// suggestions
|
|
441
458
|
const storageKey = computed(() => props.storageKey ?? (volver?.experimentalFeatures.forceInputSuggestions ? props.name : undefined))
|
|
442
|
-
const storageSuggestions = usePersistence<Set<
|
|
459
|
+
const storageSuggestions = usePersistence<Set<SuggestionValue>>(
|
|
443
460
|
storageKey,
|
|
444
461
|
storageType,
|
|
445
462
|
new Set(),
|
|
446
463
|
)
|
|
447
464
|
const allSuggestions = computed(() => {
|
|
448
|
-
const merged = new Map<
|
|
465
|
+
const merged = new Map<SuggestionValue, { isFromStorage: boolean }>()
|
|
449
466
|
|
|
450
467
|
// Add storage suggestions
|
|
451
468
|
if (storageSuggestions.value) {
|
|
@@ -483,12 +500,12 @@ const hasSuggestions = computed(
|
|
|
483
500
|
() =>
|
|
484
501
|
allSuggestions.value.size > 0,
|
|
485
502
|
)
|
|
486
|
-
function onSuggestionSelect(suggestion:
|
|
503
|
+
function onSuggestionSelect(suggestion: SuggestionValue) {
|
|
487
504
|
localModelValue.value = suggestion
|
|
488
505
|
suggestionsDropdownEl.value?.hide()
|
|
489
506
|
emit('suggestion:selected', suggestion)
|
|
490
507
|
}
|
|
491
|
-
function onSuggestionRemove(suggestion:
|
|
508
|
+
function onSuggestionRemove(suggestion: SuggestionValue) {
|
|
492
509
|
// Only remove from storage if it came from storage
|
|
493
510
|
if (allSuggestions.value.get(suggestion)?.isFromStorage) {
|
|
494
511
|
storageSuggestions.value?.delete(suggestion)
|
|
@@ -588,8 +605,8 @@ const hasAttrs = computed(() => {
|
|
|
588
605
|
max = '9999-12-31'
|
|
589
606
|
}
|
|
590
607
|
toReturn.step = props.step
|
|
591
|
-
toReturn.max = max
|
|
592
|
-
toReturn.min = props.min
|
|
608
|
+
toReturn.max = max === undefined ? undefined : String(max)
|
|
609
|
+
toReturn.min = props.min === undefined ? undefined : String(props.min)
|
|
593
610
|
}
|
|
594
611
|
|
|
595
612
|
// Text-like types with placeholder
|
|
@@ -657,9 +674,9 @@ const hasStyle = computed(() => {
|
|
|
657
674
|
return undefined
|
|
658
675
|
}
|
|
659
676
|
return {
|
|
660
|
-
width: localModelValue.value
|
|
661
|
-
?
|
|
662
|
-
:
|
|
677
|
+
width: localModelValue.value === undefined
|
|
678
|
+
? undefined
|
|
679
|
+
: `${String(localModelValue.value).length + 1}ch`,
|
|
663
680
|
}
|
|
664
681
|
})
|
|
665
682
|
|
|
@@ -16,7 +16,7 @@ function loadImage(src: string): Promise<CanvasImageSource> {
|
|
|
16
16
|
return new Promise((resolve, reject) => {
|
|
17
17
|
const img = new Image()
|
|
18
18
|
img.onload = () => resolve(img)
|
|
19
|
-
img.onerror = (
|
|
19
|
+
img.onerror = () => reject(new Error(`Failed to load image: ${src}`))
|
|
20
20
|
img.src = src
|
|
21
21
|
})
|
|
22
22
|
}
|