energy-components 2.6.0 → 2.7.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/components/dragAndDrop.es.js +93 -75
- package/dist/components/dropdown.es.js +413 -272
- package/dist/components/style/dragAndDrop.css +1 -1
- package/dist/components/style/dropdown.css +1 -1
- package/dist/components/style/pagination.css +1 -1
- package/dist/components/style/table.css +1 -1
- package/dist/components/style/tableRenderer.css +1 -1
- package/dist/components/table.es.js +59 -55
- package/dist/components/tableRenderer.es.js +131 -126
- package/dist/energy-components.css +1 -1
- package/dist/energy-components.es.js +4940 -4772
- package/dist/energy-components.umd.js +2 -2
- package/dist/style.css +1 -1
- package/dist/types/src/components/content/table/table-renderer.vue.d.ts +2 -0
- package/dist/types/src/components/content/table/table.vue.d.ts +9 -0
- package/dist/types/src/components/input/drag-and-drop/drag-and-drop.vue.d.ts +15 -0
- package/dist/types/src/components/input/dropdown/dropdown.vue.d.ts +25 -0
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/llms/rdsdrag-and-drop.md +1 -0
- package/llms/rdsdropdown.md +2 -0
- package/llms/rdstable.md +2 -0
- package/package.json +1 -1
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { g as
|
|
3
|
-
import { R as
|
|
4
|
-
import { _ as
|
|
5
|
-
import './style/dragAndDrop.css';const
|
|
1
|
+
import { defineComponent as q, ref as x, computed as i, openBlock as y, createElementBlock as D, withModifiers as c, withKeys as w, normalizeClass as M, createElementVNode as o, renderSlot as z, createVNode as U, toDisplayString as g, createCommentVNode as V } from "vue";
|
|
2
|
+
import { g as K } from "./getInstance-GhoEcxLF.js";
|
|
3
|
+
import { R as O } from "./icon-svg-CW3eQRcp.js";
|
|
4
|
+
import { _ as P } from "./_plugin-vue_export-helper-CHgC5LLL.js";
|
|
5
|
+
import './style/dragAndDrop.css';const j = ["tabindex", "aria-disabled", "aria-label"], G = ["id", "accept", "multiple", "disabled"], H = ["for"], J = { class: "rds-e-drag-and-drop__icon-wrapper" }, Q = { class: "rds-e-drag-and-drop__icon-wrapper-text" }, X = { class: "rds-e-drag-and-drop__text-container" }, Y = { class: "rds-e-drag-and-drop__text" }, Z = {
|
|
6
6
|
key: 0,
|
|
7
7
|
class: "rds-e-drag-and-drop__detail"
|
|
8
|
-
},
|
|
8
|
+
}, ee = /* @__PURE__ */ q({
|
|
9
9
|
__name: "drag-and-drop",
|
|
10
10
|
props: {
|
|
11
11
|
/**
|
|
@@ -22,6 +22,13 @@ import './style/dragAndDrop.css';const V = ["id", "accept", "multiple", "disable
|
|
|
22
22
|
type: String,
|
|
23
23
|
default: ""
|
|
24
24
|
},
|
|
25
|
+
/**
|
|
26
|
+
* Texto que se muestra en el botón para dispositivos móviles.
|
|
27
|
+
*/
|
|
28
|
+
mobileButtonText: {
|
|
29
|
+
type: String,
|
|
30
|
+
default: "Añade tu archivo"
|
|
31
|
+
},
|
|
25
32
|
/**
|
|
26
33
|
* Indica si el componente está deshabilitado.
|
|
27
34
|
*/
|
|
@@ -95,78 +102,88 @@ import './style/dragAndDrop.css';const V = ["id", "accept", "multiple", "disable
|
|
|
95
102
|
}
|
|
96
103
|
},
|
|
97
104
|
emits: ["filesSelected", "validationError", "fileReady"],
|
|
98
|
-
setup(r, { emit:
|
|
99
|
-
const
|
|
100
|
-
let
|
|
101
|
-
const C = () => `rds-dd-file-${
|
|
105
|
+
setup(r, { emit: S }) {
|
|
106
|
+
const e = r, p = S;
|
|
107
|
+
let T = 0;
|
|
108
|
+
const C = () => `rds-dd-file-${T++}`, n = x(null), u = x(!1), F = K(), m = i(() => e.id || `rds-drag-drop-${F}`), B = i(() => [
|
|
102
109
|
"rds-e-drag-and-drop",
|
|
103
110
|
{
|
|
104
|
-
"rds-e-drag-and-drop--dragging":
|
|
105
|
-
"rds-e-drag-and-drop--disabled":
|
|
106
|
-
"rds-e-drag-and-drop--full-width":
|
|
107
|
-
"rds-e-drag-and-drop--error":
|
|
111
|
+
"rds-e-drag-and-drop--dragging": u.value && !e.disabled,
|
|
112
|
+
"rds-e-drag-and-drop--disabled": e.disabled,
|
|
113
|
+
"rds-e-drag-and-drop--full-width": e.fullWidth,
|
|
114
|
+
"rds-e-drag-and-drop--error": e.error && !e.disabled
|
|
108
115
|
}
|
|
109
|
-
]),
|
|
110
|
-
if (!
|
|
116
|
+
]), I = i(() => e.disabled ? -1 : 0), E = i(() => e.label || e.mobileButtonText || "Añade tu archivo"), v = i(() => e.error && e.errorMessage ? e.errorMessage : e.detailText), $ = i(() => e.showDetailText && (v.value || !e.error)), A = (a) => {
|
|
117
|
+
if (!a || a.length === 0)
|
|
111
118
|
return { valid: !1, message: "No se seleccionaron archivos." };
|
|
112
|
-
if (!
|
|
119
|
+
if (!e.multiple && a.length > 1)
|
|
113
120
|
return { valid: !1, message: "Solo se permite seleccionar un archivo." };
|
|
114
|
-
if (
|
|
115
|
-
return { valid: !1, message: `Se permite un máximo de ${
|
|
116
|
-
if (
|
|
117
|
-
const
|
|
118
|
-
for (let l = 0; l <
|
|
119
|
-
const
|
|
120
|
-
if (!
|
|
121
|
-
return { valid: !1, message: `El tipo de archivo '${
|
|
121
|
+
if (e.maxFiles !== null && e.maxFiles > 0 && a.length > e.maxFiles)
|
|
122
|
+
return { valid: !1, message: `Se permite un máximo de ${e.maxFiles} archivos por selección.` };
|
|
123
|
+
if (e.accept) {
|
|
124
|
+
const t = e.accept.split(",").map((l) => l.trim().toLowerCase());
|
|
125
|
+
for (let l = 0; l < a.length; l++) {
|
|
126
|
+
const d = a[l], f = `.${d.name.split(".").pop()?.toLowerCase()}`, _ = d.type.toLowerCase();
|
|
127
|
+
if (!t.some((s) => s.startsWith(".") ? f === s : s.includes("/") ? s.endsWith("/*") ? _.startsWith(s.replace("/*", "")) : _ === s : !1))
|
|
128
|
+
return { valid: !1, message: `El tipo de archivo '${d.name}' no es válido. Permitidos: ${e.accept}` };
|
|
122
129
|
}
|
|
123
130
|
}
|
|
124
131
|
return { valid: !0 };
|
|
125
|
-
},
|
|
126
|
-
if (
|
|
127
|
-
if (!
|
|
132
|
+
}, h = (a) => {
|
|
133
|
+
if (e.disabled) return;
|
|
134
|
+
if (!a || a.length === 0) {
|
|
128
135
|
n.value && (n.value.value = "");
|
|
129
136
|
return;
|
|
130
137
|
}
|
|
131
|
-
|
|
132
|
-
const
|
|
133
|
-
if (
|
|
134
|
-
for (let l = 0; l <
|
|
135
|
-
const
|
|
136
|
-
|
|
137
|
-
id:
|
|
138
|
-
file:
|
|
139
|
-
name:
|
|
140
|
-
size:
|
|
138
|
+
p("filesSelected", a);
|
|
139
|
+
const t = A(a);
|
|
140
|
+
if (t.valid) {
|
|
141
|
+
for (let l = 0; l < a.length; l++) {
|
|
142
|
+
const d = a[l], f = C();
|
|
143
|
+
p("fileReady", {
|
|
144
|
+
id: f,
|
|
145
|
+
file: d,
|
|
146
|
+
name: d.name,
|
|
147
|
+
size: d.size
|
|
141
148
|
});
|
|
142
149
|
}
|
|
143
150
|
n.value && (n.value.value = "");
|
|
144
|
-
} else
|
|
145
|
-
},
|
|
146
|
-
const
|
|
147
|
-
|
|
148
|
-
},
|
|
149
|
-
|
|
150
|
-
},
|
|
151
|
-
|
|
152
|
-
},
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
151
|
+
} else t.message && (p("validationError", t.message), n.value && (n.value.value = ""));
|
|
152
|
+
}, R = (a) => {
|
|
153
|
+
const t = a.target;
|
|
154
|
+
h(t.files);
|
|
155
|
+
}, b = (a) => {
|
|
156
|
+
a.preventDefault(), e.disabled || n.value?.click();
|
|
157
|
+
}, k = () => {
|
|
158
|
+
e.disabled || (u.value = !0);
|
|
159
|
+
}, L = (a) => {
|
|
160
|
+
e.disabled || (a.preventDefault(), u.value = !0);
|
|
161
|
+
}, N = (a) => {
|
|
162
|
+
const t = a.relatedTarget;
|
|
163
|
+
(!a.currentTarget || !a.currentTarget.contains(t)) && (u.value = !1);
|
|
164
|
+
}, W = (a) => {
|
|
165
|
+
if (e.disabled) return;
|
|
166
|
+
u.value = !1;
|
|
167
|
+
const t = a.dataTransfer?.files;
|
|
168
|
+
h(t || null);
|
|
160
169
|
};
|
|
161
|
-
return (
|
|
162
|
-
class:
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
170
|
+
return (a, t) => (y(), D("div", {
|
|
171
|
+
class: M(B.value),
|
|
172
|
+
tabindex: I.value,
|
|
173
|
+
role: "button",
|
|
174
|
+
"aria-disabled": r.disabled ? "true" : "false",
|
|
175
|
+
"aria-label": E.value,
|
|
176
|
+
onKeydown: [
|
|
177
|
+
w(b, ["enter"]),
|
|
178
|
+
w(b, ["space"])
|
|
179
|
+
],
|
|
180
|
+
onDragenter: c(k, ["prevent"]),
|
|
181
|
+
onDragover: c(L, ["prevent"]),
|
|
182
|
+
onDragleave: c(N, ["prevent"]),
|
|
183
|
+
onDrop: c(W, ["prevent"])
|
|
167
184
|
}, [
|
|
168
185
|
o("input", {
|
|
169
|
-
id:
|
|
186
|
+
id: m.value,
|
|
170
187
|
ref_key: "fileInputRef",
|
|
171
188
|
ref: n,
|
|
172
189
|
type: "file",
|
|
@@ -174,29 +191,30 @@ import './style/dragAndDrop.css';const V = ["id", "accept", "multiple", "disable
|
|
|
174
191
|
accept: r.accept,
|
|
175
192
|
multiple: r.multiple,
|
|
176
193
|
disabled: r.disabled,
|
|
177
|
-
onChange:
|
|
178
|
-
}, null, 40,
|
|
194
|
+
onChange: R
|
|
195
|
+
}, null, 40, G),
|
|
179
196
|
o("label", {
|
|
180
|
-
for:
|
|
197
|
+
for: m.value,
|
|
181
198
|
class: "rds-e-drag-and-drop__label"
|
|
182
199
|
}, [
|
|
183
|
-
|
|
184
|
-
o("span",
|
|
185
|
-
|
|
200
|
+
z(a.$slots, "content", {}, () => [
|
|
201
|
+
o("span", J, [
|
|
202
|
+
U(O, {
|
|
186
203
|
name: r.icon,
|
|
187
204
|
class: "rds-e-drag-and-drop__icon",
|
|
188
205
|
"aria-hidden": "true"
|
|
189
|
-
}, null, 8, ["name"])
|
|
206
|
+
}, null, 8, ["name"]),
|
|
207
|
+
o("p", Q, g(r.mobileButtonText), 1)
|
|
190
208
|
]),
|
|
191
|
-
o("div",
|
|
192
|
-
o("span",
|
|
193
|
-
|
|
209
|
+
o("div", X, [
|
|
210
|
+
o("span", Y, g(r.label), 1),
|
|
211
|
+
$.value ? (y(), D("span", Z, g(v.value), 1)) : V("", !0)
|
|
194
212
|
])
|
|
195
213
|
], !0)
|
|
196
|
-
], 8,
|
|
197
|
-
],
|
|
214
|
+
], 8, H)
|
|
215
|
+
], 42, j));
|
|
198
216
|
}
|
|
199
|
-
}),
|
|
217
|
+
}), de = /* @__PURE__ */ P(ee, [["__scopeId", "data-v-9dade050"]]);
|
|
200
218
|
export {
|
|
201
|
-
|
|
219
|
+
de as default
|
|
202
220
|
};
|