espri-vue-select-float 1.0.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/README.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# Select Float - Vue component
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { DefineComponent } from 'vue';
|
|
2
|
+
import type { SelectFloatEmitsForDoc } from './interfaces/select-float-emits.interface';
|
|
3
|
+
import type SelectFloatProps from './interfaces/select-float-props.interface';
|
|
4
|
+
/**
|
|
5
|
+
* **ESPRI Digital - Select Float (Vue component)**
|
|
6
|
+
* --- ---
|
|
7
|
+
* 
|
|
8
|
+
*
|
|
9
|
+
*/
|
|
10
|
+
declare const SelectFloat: DefineComponent<SelectFloatProps, {}, // For slots if any
|
|
11
|
+
{}, // For methods or data if any
|
|
12
|
+
{}, // Computed
|
|
13
|
+
{}, // Methods
|
|
14
|
+
{}, // Mixin
|
|
15
|
+
{}, // Extends
|
|
16
|
+
SelectFloatEmitsForDoc>;
|
|
17
|
+
export default SelectFloat;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ObjectEmitsOptions } from 'vue';
|
|
2
|
+
export default interface SelectFloatEmits {
|
|
3
|
+
(e: 'update:modelValue', value: any): void;
|
|
4
|
+
}
|
|
5
|
+
export interface SelectFloatEmitsForDoc extends ObjectEmitsOptions {
|
|
6
|
+
/**
|
|
7
|
+
* Called when modelValue is updated.
|
|
8
|
+
*/
|
|
9
|
+
'update:modelValue': (value: any) => void;
|
|
10
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
export default interface SelectFloatProps {
|
|
2
|
+
/**
|
|
3
|
+
* Label displayed above the input.
|
|
4
|
+
*/
|
|
5
|
+
label: string;
|
|
6
|
+
/**
|
|
7
|
+
* Array of options available for selection.
|
|
8
|
+
*/
|
|
9
|
+
options: Array<{
|
|
10
|
+
/** Display text for the option */
|
|
11
|
+
label: string;
|
|
12
|
+
/** Value associated with the option */
|
|
13
|
+
value: any;
|
|
14
|
+
}>;
|
|
15
|
+
/**
|
|
16
|
+
* Optional CSS class applied to the input element.
|
|
17
|
+
*/
|
|
18
|
+
classInput?: string;
|
|
19
|
+
/**
|
|
20
|
+
* Disables the input when true.
|
|
21
|
+
*/
|
|
22
|
+
disabled?: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Marks the input as required when true.
|
|
25
|
+
*/
|
|
26
|
+
required?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Shows error messages when true.
|
|
29
|
+
*/
|
|
30
|
+
showError?: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Validation rules for the input.
|
|
33
|
+
* Each rule can be undefined or an object containing:
|
|
34
|
+
* - $invalid: whether the rule is violated
|
|
35
|
+
* - $message: the error message associated with the rule
|
|
36
|
+
*/
|
|
37
|
+
rules?: Array<{
|
|
38
|
+
$invalid: boolean;
|
|
39
|
+
$message: string;
|
|
40
|
+
} | undefined>;
|
|
41
|
+
/**
|
|
42
|
+
* Maximum number of characters allowed in the input.
|
|
43
|
+
*/
|
|
44
|
+
maxlength?: number;
|
|
45
|
+
/**
|
|
46
|
+
* Placeholder text displayed inside the input.
|
|
47
|
+
*/
|
|
48
|
+
placeholder?: string;
|
|
49
|
+
/**
|
|
50
|
+
* CSS style of the component.
|
|
51
|
+
*/
|
|
52
|
+
style?: any;
|
|
53
|
+
/**
|
|
54
|
+
* Class of the component.
|
|
55
|
+
*/
|
|
56
|
+
class?: any;
|
|
57
|
+
/**
|
|
58
|
+
* Indicates if the input is in a loading state.
|
|
59
|
+
*/
|
|
60
|
+
loading: boolean;
|
|
61
|
+
/**
|
|
62
|
+
* Model value representing the current state of the input.
|
|
63
|
+
*/
|
|
64
|
+
modelValue: any;
|
|
65
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { defineComponent as b, computed as c, createElementBlock as m, openBlock as s, normalizeClass as p, createBlock as f, createElementVNode as h, unref as a, withCtx as y, createVNode as k, createTextVNode as x, createCommentVNode as B, toDisplayString as V } from "vue";
|
|
2
|
+
import { Skeleton as C, FloatLabel as w, Select as E } from "primevue";
|
|
3
|
+
const N = ["for"], S = {
|
|
4
|
+
key: 0,
|
|
5
|
+
class: "text-danger"
|
|
6
|
+
}, $ = { class: "text-danger" }, z = /* @__PURE__ */ b({
|
|
7
|
+
__name: "select-float",
|
|
8
|
+
props: {
|
|
9
|
+
label: {},
|
|
10
|
+
options: {},
|
|
11
|
+
classInput: {},
|
|
12
|
+
disabled: { type: Boolean },
|
|
13
|
+
required: { type: Boolean },
|
|
14
|
+
showError: { type: Boolean },
|
|
15
|
+
rules: {},
|
|
16
|
+
maxlength: {},
|
|
17
|
+
placeholder: {},
|
|
18
|
+
style: {},
|
|
19
|
+
class: {},
|
|
20
|
+
loading: { type: Boolean },
|
|
21
|
+
modelValue: {}
|
|
22
|
+
},
|
|
23
|
+
emits: ["update:modelValue"],
|
|
24
|
+
setup(e, { emit: g }) {
|
|
25
|
+
const n = e, d = g, i = Math.random().toString(16).slice(2), r = c({
|
|
26
|
+
get() {
|
|
27
|
+
return n.modelValue;
|
|
28
|
+
},
|
|
29
|
+
set(t) {
|
|
30
|
+
d("update:modelValue", t);
|
|
31
|
+
}
|
|
32
|
+
}), u = c(() => {
|
|
33
|
+
if (n.showError) {
|
|
34
|
+
const t = n.rules || [];
|
|
35
|
+
for (let l = 0; l < t.length; l++) {
|
|
36
|
+
const o = t[l];
|
|
37
|
+
if (o && o.$invalid && o.$message)
|
|
38
|
+
return o.$message;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
return "";
|
|
42
|
+
});
|
|
43
|
+
function v(t) {
|
|
44
|
+
const { value: l = "" } = t;
|
|
45
|
+
d("update:modelValue", l);
|
|
46
|
+
}
|
|
47
|
+
return (t, l) => (s(), m("div", {
|
|
48
|
+
class: p(`field ${n.class || ""}`)
|
|
49
|
+
}, [
|
|
50
|
+
e.loading ? (s(), f(a(C), {
|
|
51
|
+
key: 0,
|
|
52
|
+
class: "skeleton-input mt-3"
|
|
53
|
+
})) : (s(), f(a(w), {
|
|
54
|
+
key: 1,
|
|
55
|
+
class: "mt-3"
|
|
56
|
+
}, {
|
|
57
|
+
default: y(() => [
|
|
58
|
+
k(a(E), {
|
|
59
|
+
modelValue: r.value,
|
|
60
|
+
"onUpdate:modelValue": l[0] || (l[0] = (o) => r.value = o),
|
|
61
|
+
options: e.options,
|
|
62
|
+
"option-label": "label",
|
|
63
|
+
"option-value": "value",
|
|
64
|
+
class: p(["w-full", e.classInput]),
|
|
65
|
+
invalid: !!u.value,
|
|
66
|
+
disabled: e.disabled,
|
|
67
|
+
placeholder: e.placeholder,
|
|
68
|
+
"input-id": a(i),
|
|
69
|
+
onChange: v
|
|
70
|
+
}, null, 8, ["modelValue", "options", "class", "invalid", "disabled", "placeholder", "input-id"]),
|
|
71
|
+
h("label", { for: a(i) }, [
|
|
72
|
+
x(V(e.label), 1),
|
|
73
|
+
e.required ? (s(), m("span", S, " *")) : B("", !0)
|
|
74
|
+
], 8, N)
|
|
75
|
+
]),
|
|
76
|
+
_: 1
|
|
77
|
+
})),
|
|
78
|
+
h("small", $, V(u.value), 1)
|
|
79
|
+
], 2));
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
export {
|
|
83
|
+
z as default
|
|
84
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(function(e,o){typeof exports=="object"&&typeof module<"u"?module.exports=o(require("vue"),require("primevue")):typeof define=="function"&&define.amd?define(["vue","primevue"],o):(e=typeof globalThis<"u"?globalThis:e||self,e.SelectFloat=o(e.Vue,e.PrimeVue))})(this,(function(e,o){"use strict";const u=["for"],m={key:0,class:"text-danger"},p={class:"text-danger"};return e.defineComponent({__name:"select-float",props:{label:{},options:{},classInput:{},disabled:{type:Boolean},required:{type:Boolean},showError:{type:Boolean},rules:{},maxlength:{},placeholder:{},style:{},class:{},loading:{type:Boolean},modelValue:{}},emits:["update:modelValue"],setup(l,{emit:f}){const s=l,i=f,d=Math.random().toString(16).slice(2),r=e.computed({get(){return s.modelValue},set(n){i("update:modelValue",n)}}),c=e.computed(()=>{if(s.showError){const n=s.rules||[];for(let t=0;t<n.length;t++){const a=n[t];if(a&&a.$invalid&&a.$message)return a.$message}}return""});function h(n){const{value:t=""}=n;i("update:modelValue",t)}return(n,t)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(`field ${s.class||""}`)},[l.loading?(e.openBlock(),e.createBlock(e.unref(o.Skeleton),{key:0,class:"skeleton-input mt-3"})):(e.openBlock(),e.createBlock(e.unref(o.FloatLabel),{key:1,class:"mt-3"},{default:e.withCtx(()=>[e.createVNode(e.unref(o.Select),{modelValue:r.value,"onUpdate:modelValue":t[0]||(t[0]=a=>r.value=a),options:l.options,"option-label":"label","option-value":"value",class:e.normalizeClass(["w-full",l.classInput]),invalid:!!c.value,disabled:l.disabled,placeholder:l.placeholder,"input-id":e.unref(d),onChange:h},null,8,["modelValue","options","class","invalid","disabled","placeholder","input-id"]),e.createElementVNode("label",{for:e.unref(d)},[e.createTextVNode(e.toDisplayString(l.label),1),l.required?(e.openBlock(),e.createElementBlock("span",m," *")):e.createCommentVNode("",!0)],8,u)]),_:1})),e.createElementVNode("small",p,e.toDisplayString(c.value),1)],2))}})}));
|
package/package.json
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "espri-vue-select-float",
|
|
3
|
+
"type": "module",
|
|
4
|
+
"version": "1.0.0",
|
|
5
|
+
"description": "Select Float - Vue component",
|
|
6
|
+
"author": "ESPRI Digital",
|
|
7
|
+
"homepage": "https://github.com/ESPRI-Digital/vue-select-float#readme",
|
|
8
|
+
"main": "dist/select-float.umd.js",
|
|
9
|
+
"module": "dist/select-float.es.js",
|
|
10
|
+
"types": "dist/index.d.ts",
|
|
11
|
+
"files": [
|
|
12
|
+
"dist"
|
|
13
|
+
],
|
|
14
|
+
"scripts": {
|
|
15
|
+
"build": "vite build && tsc --emitDeclarationOnly",
|
|
16
|
+
"lint": "eslint .",
|
|
17
|
+
"ts-check": "vue-tsc --noEmit"
|
|
18
|
+
},
|
|
19
|
+
"peerDependencies": {
|
|
20
|
+
"primevue": ">=4.0.0 <5.0.0",
|
|
21
|
+
"vue": ">=3.0.0 <4.0.0"
|
|
22
|
+
},
|
|
23
|
+
"devDependencies": {
|
|
24
|
+
"@vitejs/plugin-vue": "^6.0.2",
|
|
25
|
+
"eslint": "^9.39.1",
|
|
26
|
+
"eslint-config-espri-front": "^3.0.0",
|
|
27
|
+
"typescript": "^5.9.3",
|
|
28
|
+
"vite": "^7.2.6",
|
|
29
|
+
"vue-tsc": "^3.1.5"
|
|
30
|
+
}
|
|
31
|
+
}
|