mediacube-ui-v2 0.0.333 → 0.0.334
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.
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { IMask as
|
|
3
|
-
import { Spaces as
|
|
4
|
-
import { Directions as
|
|
5
|
-
import { useFieldErrors as
|
|
6
|
-
import { Autocomplete as
|
|
7
|
-
import { useTextareaAutosize as
|
|
8
|
-
import { ButtonSize as
|
|
9
|
-
import { HorizontalAlignment as
|
|
1
|
+
import { defineComponent as ze, useAttrs as De, ref as q, reactive as Oe, computed as n, watch as Ie, openBlock as u, createElementBlock as p, withModifiers as V, normalizeStyle as ne, normalizeClass as se, createElementVNode as x, renderSlot as $, createBlock as g, unref as m, withCtx as k, createTextVNode as Z, toDisplayString as F, createCommentVNode as d, mergeProps as M, Fragment as He, createVNode as j } from "vue";
|
|
2
|
+
import { IMask as U, IMaskComponent as Ke } from "vue-imask";
|
|
3
|
+
import { Spaces as Re } from "../../../types/styles/Spaces.js";
|
|
4
|
+
import { Directions as ie } from "../../../enums/ui/Directions2.js";
|
|
5
|
+
import { useFieldErrors as qe } from "../../../composables/useFieldErrors2.js";
|
|
6
|
+
import { Autocomplete as Ze, InputTypes as s } from "../../../enums/Input2.js";
|
|
7
|
+
import { useTextareaAutosize as je } from "@vueuse/core";
|
|
8
|
+
import { ButtonSize as ue, ButtonType as Ue } from "../../../enums/ui/Button2.js";
|
|
9
|
+
import { HorizontalAlignment as We } from "../../../enums/ui/Alignment2.js";
|
|
10
10
|
import { TitleVariations as W } from "../../../enums/Title2.js";
|
|
11
|
-
import { Weights as
|
|
12
|
-
import { useTheme as
|
|
11
|
+
import { Weights as Ye } from "../../../enums/ui/Weights2.js";
|
|
12
|
+
import { useTheme as Ge } from "../../../composables/useTheme2.js";
|
|
13
13
|
import P from "../McTitle/McTitle.vue2.js";
|
|
14
14
|
import '../../../assets/components/elements/McTooltip/index.css';import '../../../assets/components/elements/McSvgIcon/index.css';import '../../../assets/components/elements/McButton/index.css';import '../../../assets/components/elements/McTitle/index.css';/* empty css */
|
|
15
|
-
import
|
|
15
|
+
import ce from "../McButton/McButton.vue2.js";
|
|
16
16
|
/* empty css */
|
|
17
|
-
import
|
|
17
|
+
import me from "../McSvgIcon/McSvgIcon.vue2.js";
|
|
18
18
|
/* empty css */
|
|
19
|
-
import
|
|
19
|
+
import Je from "../McTooltip/McTooltip.vue2.js";
|
|
20
20
|
/* empty css */
|
|
21
|
-
const
|
|
21
|
+
const Qe = ["dir"], Xe = ["for"], et = ["for"], tt = { class: "mc-field-text__main" }, at = { class: "mc-field-text__input-wrapper" }, rt = ["value", "maxlength"], ot = ["value"], lt = ["value", "type", "readonly", "maxlength"], nt = {
|
|
22
22
|
key: 0,
|
|
23
23
|
class: "mc-field-text__right"
|
|
24
|
-
},
|
|
24
|
+
}, st = {
|
|
25
25
|
key: 0,
|
|
26
26
|
class: "mc-field-text__footer"
|
|
27
|
-
},
|
|
27
|
+
}, it = { key: 1 }, Mt = /* @__PURE__ */ ze({
|
|
28
28
|
__name: "McFieldText",
|
|
29
29
|
props: {
|
|
30
30
|
/**
|
|
@@ -49,7 +49,7 @@ const We = ["dir"], Ye = ["for"], Ge = ["for"], Je = { class: "mc-field-text__ma
|
|
|
49
49
|
*/
|
|
50
50
|
type: {
|
|
51
51
|
type: String,
|
|
52
|
-
default:
|
|
52
|
+
default: s.Text
|
|
53
53
|
},
|
|
54
54
|
/**
|
|
55
55
|
* Заголовок поля:
|
|
@@ -160,7 +160,7 @@ const We = ["dir"], Ye = ["for"], Ge = ["for"], Je = { class: "mc-field-text__ma
|
|
|
160
160
|
*/
|
|
161
161
|
autocomplete: {
|
|
162
162
|
type: String,
|
|
163
|
-
default:
|
|
163
|
+
default: Ze.On
|
|
164
164
|
},
|
|
165
165
|
/**
|
|
166
166
|
* только чтение текста
|
|
@@ -246,7 +246,7 @@ const We = ["dir"], Ye = ["for"], Ge = ["for"], Je = { class: "mc-field-text__ma
|
|
|
246
246
|
},
|
|
247
247
|
dir: {
|
|
248
248
|
type: String,
|
|
249
|
-
default:
|
|
249
|
+
default: ie.Ltr
|
|
250
250
|
},
|
|
251
251
|
width: {
|
|
252
252
|
type: String,
|
|
@@ -272,341 +272,368 @@ const We = ["dir"], Ye = ["for"], Ge = ["for"], Je = { class: "mc-field-text__ma
|
|
|
272
272
|
}
|
|
273
273
|
},
|
|
274
274
|
emits: ["update:modelValue", "keydown", "copy"],
|
|
275
|
-
setup(f, { emit:
|
|
276
|
-
const { textarea:
|
|
275
|
+
setup(f, { emit: de }) {
|
|
276
|
+
const { textarea: ut } = je(), E = de, L = De(), a = f, Y = Ge("fieldText"), A = q(a.type), h = Oe({
|
|
277
277
|
name: "copy",
|
|
278
278
|
color: "black"
|
|
279
|
-
}),
|
|
279
|
+
}), v = qe(a.errors), pe = q(!1), _ = q(null), z = n(() => a.dir === ie.Rtl), fe = n(() => ({
|
|
280
280
|
"mc-field-text": !0,
|
|
281
|
-
"mc-field-text--error": !!
|
|
281
|
+
"mc-field-text--error": !!v.errorText.value,
|
|
282
282
|
"mc-field-text--textarea": b.value,
|
|
283
283
|
"mc-field-text--textarea-autosize": w.value,
|
|
284
|
-
"mc-field-text--disabled":
|
|
285
|
-
"mc-field-text--copy":
|
|
286
|
-
"mc-field-text--rtl":
|
|
287
|
-
})),
|
|
284
|
+
"mc-field-text--disabled": a.disabled,
|
|
285
|
+
"mc-field-text--copy": a.copy,
|
|
286
|
+
"mc-field-text--rtl": z.value
|
|
287
|
+
})), ye = n(() => ({
|
|
288
288
|
"--mc-field-text-color": Y.colors[Y.component.color],
|
|
289
|
-
"--mc-field-text-width":
|
|
290
|
-
})),
|
|
291
|
-
const e = Math.max(
|
|
289
|
+
"--mc-field-text-width": a.width
|
|
290
|
+
})), ve = n(() => `${a.title}${a.required ? " *" : ""}`), D = n(() => A.value === s.Date), ge = n(() => !!a.mask || !!a.maskOptions || D.value), b = n(() => a.type === s.Textarea), w = n(() => a.type === s.TextareaAutosize), he = n(() => {
|
|
291
|
+
const e = Math.max(a.minHeight, 40), t = Math.max(a.maxHeight, e);
|
|
292
292
|
return {
|
|
293
293
|
"--textarea-autosize-min-height": `${e}px`,
|
|
294
|
-
"--textarea-autosize-max-height":
|
|
294
|
+
"--textarea-autosize-max-height": a.maxHeight ? `${t}px` : "auto"
|
|
295
295
|
};
|
|
296
|
-
}), G =
|
|
296
|
+
}), G = n(() => a.type === s.Password), xe = n(() => a.type === s.AmountFormat), O = n(() => !!a.maxLength && (b.value || w.value)), I = n(() => A.value === s.Password), ke = n(() => I.value ? "visibility_off" : "visibility"), J = n(() => a.modelValue ? String(a.modelValue).length : 0), _e = n(() => `${J.value}/${a.maxLength}`), be = n(() => a.maxLength < +J.value ? "red" : "dark-gray"), we = n(() => ({
|
|
297
297
|
mask: Date,
|
|
298
298
|
autofix: !0,
|
|
299
299
|
blocks: {
|
|
300
300
|
d: {
|
|
301
|
-
mask:
|
|
302
|
-
placeholderChar:
|
|
301
|
+
mask: U.MaskedRange,
|
|
302
|
+
placeholderChar: a.dateMaskPlaceholder.date || "d",
|
|
303
303
|
from: 1,
|
|
304
304
|
to: 31,
|
|
305
305
|
maxLength: 2
|
|
306
306
|
},
|
|
307
307
|
m: {
|
|
308
|
-
mask:
|
|
309
|
-
placeholderChar:
|
|
308
|
+
mask: U.MaskedRange,
|
|
309
|
+
placeholderChar: a.dateMaskPlaceholder.month || "m",
|
|
310
310
|
from: 1,
|
|
311
311
|
to: 12,
|
|
312
312
|
maxLength: 2
|
|
313
313
|
},
|
|
314
314
|
Y: {
|
|
315
|
-
mask:
|
|
316
|
-
placeholderChar:
|
|
315
|
+
mask: U.MaskedRange,
|
|
316
|
+
placeholderChar: a.dateMaskPlaceholder.year || "y",
|
|
317
317
|
from: 1900,
|
|
318
318
|
to: 2999,
|
|
319
319
|
maxLength: 4
|
|
320
320
|
}
|
|
321
321
|
}
|
|
322
|
-
})),
|
|
322
|
+
})), Se = n(() => ({
|
|
323
323
|
...T.value,
|
|
324
|
-
mask:
|
|
324
|
+
mask: a.mask,
|
|
325
325
|
lazy: !1,
|
|
326
326
|
overwrite: !1,
|
|
327
|
-
unmask:
|
|
327
|
+
unmask: a.clearOutput,
|
|
328
328
|
definitions: {
|
|
329
329
|
"#": /./
|
|
330
330
|
},
|
|
331
|
-
readonly:
|
|
332
|
-
maxlength:
|
|
331
|
+
readonly: a.readOnly,
|
|
332
|
+
maxlength: a.maxLength,
|
|
333
333
|
type: "tel",
|
|
334
|
-
...
|
|
335
|
-
...
|
|
336
|
-
...D.value ?
|
|
337
|
-
})),
|
|
334
|
+
...L,
|
|
335
|
+
...a.maskOptions ?? {},
|
|
336
|
+
...D.value ? we.value : {}
|
|
337
|
+
})), y = n({
|
|
338
338
|
get() {
|
|
339
|
-
return
|
|
339
|
+
return xe.value && !z.value ? le(String(a.modelValue)) : a.modelValue;
|
|
340
340
|
},
|
|
341
341
|
set(e) {
|
|
342
|
-
|
|
342
|
+
v.toggleErrorVisible(), E("update:modelValue", e);
|
|
343
343
|
}
|
|
344
344
|
}), B = (e) => {
|
|
345
|
-
|
|
346
|
-
}, S =
|
|
347
|
-
style:
|
|
348
|
-
placeholder:
|
|
349
|
-
disabled:
|
|
350
|
-
name:
|
|
351
|
-
"field-id":
|
|
352
|
-
autocomplete:
|
|
353
|
-
tabindex:
|
|
354
|
-
...
|
|
355
|
-
class: ["mc-field-text__input",
|
|
356
|
-
})),
|
|
345
|
+
y.value = Ce(e);
|
|
346
|
+
}, S = n(() => a.type === s.AmountFormat || a.type === s.Num), T = n(() => ({
|
|
347
|
+
style: Te.value,
|
|
348
|
+
placeholder: a.placeholder,
|
|
349
|
+
disabled: a.disabled,
|
|
350
|
+
name: a.name,
|
|
351
|
+
"field-id": a.name,
|
|
352
|
+
autocomplete: a.autocomplete,
|
|
353
|
+
tabindex: a.tabindex,
|
|
354
|
+
...L,
|
|
355
|
+
class: ["mc-field-text__input", L.class || ""].join(" ")
|
|
356
|
+
})), Te = n(() => {
|
|
357
357
|
let e = {};
|
|
358
358
|
if (b.value || w.value) {
|
|
359
|
-
const
|
|
359
|
+
const t = O.value ? "400" : "150", r = Re[t];
|
|
360
360
|
e = { paddingBottom: `${parseInt(r) - 1}px` };
|
|
361
361
|
}
|
|
362
362
|
return {
|
|
363
363
|
...!b.value && !w.value ? { boxSizing: "border-box" } : {},
|
|
364
364
|
...e
|
|
365
365
|
};
|
|
366
|
-
}),
|
|
367
|
-
if (e &&
|
|
368
|
-
const [
|
|
369
|
-
if (r?.length >
|
|
370
|
-
return `${
|
|
366
|
+
}), H = (e) => {
|
|
367
|
+
if (e && a.maxDecimals) {
|
|
368
|
+
const [t, r] = e.split(".");
|
|
369
|
+
if (r?.length > a.maxDecimals)
|
|
370
|
+
return `${t}.${r.slice(0, a.maxDecimals)}`;
|
|
371
371
|
}
|
|
372
372
|
return e;
|
|
373
|
-
},
|
|
374
|
-
if (!
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
373
|
+
}, Q = (e) => {
|
|
374
|
+
if (!a.removeLeadingZero) return e;
|
|
375
|
+
const t = e.startsWith("-"), r = t ? e.slice(1) : e, [o] = r || [];
|
|
376
|
+
return r.length > 1 && +o == 0 && r.indexOf(".") === -1 ? (t ? "-" : "") + r.slice(1) : e;
|
|
377
|
+
}, Ne = (e) => {
|
|
378
|
+
if (!e || e.length <= 1) return e;
|
|
379
|
+
const t = e.startsWith("-"), r = t ? e.slice(1) : e;
|
|
380
|
+
if (r.indexOf(".") !== -1) {
|
|
381
|
+
const [l, i] = r.split("."), c = l.replace(/^0+/, "") || "0";
|
|
382
|
+
return `${t ? "-" : ""}${c}.${i}`;
|
|
383
|
+
}
|
|
384
|
+
const o = r.replace(/^0+/, "") || "0";
|
|
385
|
+
return t ? `-${o}` : o;
|
|
386
|
+
}, X = (e) => {
|
|
387
|
+
const t = e.inputType;
|
|
388
|
+
return typeof t == "string" && t.startsWith("delete");
|
|
389
|
+
}, ee = (e, t, r, o) => {
|
|
390
|
+
const l = X(t) ? e : Q(e);
|
|
391
|
+
if (r.value !== l && (r.value = l, Number.isFinite(o))) {
|
|
392
|
+
const i = e.length - l.length, c = Math.max(0, o - Math.max(0, i));
|
|
393
|
+
N(r, c, c);
|
|
394
|
+
}
|
|
395
|
+
return l;
|
|
396
|
+
}, Ce = (e) => {
|
|
397
|
+
if (!e) return a.modelValue;
|
|
398
|
+
const t = e.target;
|
|
399
|
+
let r = D.value && t && t.value ? t.value?.substring(0, 10) : t.value;
|
|
400
|
+
const { start: o } = Ae(t);
|
|
401
|
+
let l = K(r);
|
|
402
|
+
switch (a.type) {
|
|
403
|
+
case s.Num: {
|
|
404
|
+
const i = r?.replace(/,/g, ".")?.replace(/ /g, "");
|
|
405
|
+
let [c] = /-?\d*[\.]?\d*/.exec(String(i)) || [];
|
|
406
|
+
c = H(c), r = ee(String(H(c ?? "") ?? ""), e, t, o);
|
|
389
407
|
break;
|
|
390
408
|
}
|
|
391
|
-
case
|
|
392
|
-
let [
|
|
393
|
-
|
|
409
|
+
case s.Int: {
|
|
410
|
+
let [i] = /-?\d*/.exec(String(t.value)) || [];
|
|
411
|
+
r = ee(String(i ?? ""), e, t, o);
|
|
394
412
|
break;
|
|
395
413
|
}
|
|
396
|
-
case
|
|
397
|
-
r = r?.replace(/,/g, ".")?.replace(/ /g, ""), r =
|
|
398
|
-
const
|
|
399
|
-
r =
|
|
400
|
-
const
|
|
401
|
-
|
|
402
|
-
const
|
|
403
|
-
Number.isFinite(o) && Number.isFinite(R) &&
|
|
414
|
+
case s.AmountFormat: {
|
|
415
|
+
r = r?.replace(/,/g, ".")?.replace(/ /g, ""), r = H(r), X(e) || (r = Q(r)), l = K(r);
|
|
416
|
+
const i = parseFloat(l), c = l.replace(/ /gm, "");
|
|
417
|
+
r = l ? String(i) === c ? i : c || i || l : null;
|
|
418
|
+
const C = le(l);
|
|
419
|
+
t.value = z.value ? C.replace(/ /gm, "") : C;
|
|
420
|
+
const Le = t.value?.slice(0, o).replace(/[^ ]/gm, "")?.length || 0, R = o + Le;
|
|
421
|
+
Number.isFinite(o) && Number.isFinite(R) && N(t, R, R);
|
|
404
422
|
break;
|
|
405
423
|
}
|
|
406
|
-
case
|
|
407
|
-
r = r?.toUpperCase(),
|
|
424
|
+
case s.Uppercase: {
|
|
425
|
+
r = r?.toUpperCase(), t.value = r, Number.isFinite(o) && N(t, o, o);
|
|
408
426
|
break;
|
|
409
427
|
}
|
|
410
|
-
case
|
|
411
|
-
r = r?.toLowerCase(),
|
|
428
|
+
case s.Lowercase: {
|
|
429
|
+
r = r?.toLowerCase(), t.value = r, Number.isFinite(o) && N(t, o, o);
|
|
412
430
|
break;
|
|
413
431
|
}
|
|
414
|
-
case
|
|
415
|
-
r = r?.replace(/ /gm, ""),
|
|
432
|
+
case s.Password:
|
|
433
|
+
r = r?.replace(/ /gm, ""), t.value = r, Number.isFinite(o) && N(t, o, o);
|
|
416
434
|
break;
|
|
417
|
-
case
|
|
418
|
-
r.length === 0 && (r = "+"), r.charAt(0) !== "+" && (r = "+" + r), r = r.replace(/(?!^)\D/g, ""),
|
|
435
|
+
case s.PhoneNumber:
|
|
436
|
+
r.length === 0 && (r = "+"), r.charAt(0) !== "+" && (r = "+" + r), r = r.replace(/(?!^)\D/g, ""), t.value = r;
|
|
419
437
|
break;
|
|
420
438
|
}
|
|
421
439
|
return r;
|
|
422
|
-
},
|
|
423
|
-
const
|
|
424
|
-
!e || !
|
|
425
|
-
},
|
|
426
|
-
const
|
|
427
|
-
if (!e || !
|
|
428
|
-
const r = e.type === "paste", o =
|
|
429
|
-
((
|
|
430
|
-
},
|
|
440
|
+
}, Ve = (e) => "key" in e, te = (e) => {
|
|
441
|
+
const t = _.value;
|
|
442
|
+
!e || !t || a.allowEmpty || !S.value || (e.preventDefault(), t.value = "0", y.value = "0", oe(t, 1, 1));
|
|
443
|
+
}, ae = (e) => {
|
|
444
|
+
const t = _.value;
|
|
445
|
+
if (!e || !t || a.allowEmpty || !S.value) return;
|
|
446
|
+
const r = e.type === "paste", o = Ve(e), l = o && (e.metaKey || e.ctrlKey), i = o && (e.key === "Delete" || e.key === "Backspace");
|
|
447
|
+
((i || r) && t.value.length <= 1 || i && l) && te(e);
|
|
448
|
+
}, $e = (e) => {
|
|
431
449
|
if (!e || !_.value) return;
|
|
432
|
-
const
|
|
433
|
-
!
|
|
434
|
-
},
|
|
435
|
-
!e || !_.value || !
|
|
436
|
-
},
|
|
437
|
-
switch (
|
|
438
|
-
case
|
|
439
|
-
case
|
|
440
|
-
|
|
441
|
-
const
|
|
442
|
-
|
|
443
|
-
const o = r.includes(e.key),
|
|
444
|
-
!
|
|
445
|
-
const c = typeof
|
|
446
|
-
o &&
|
|
450
|
+
const t = e.target;
|
|
451
|
+
!a.allowEmpty && t.value.length < 1 && S.value && te(e);
|
|
452
|
+
}, Me = (e) => {
|
|
453
|
+
!e || !_.value || !a.allowEmpty && S.value && ae(e);
|
|
454
|
+
}, re = (e) => {
|
|
455
|
+
switch (a.type) {
|
|
456
|
+
case s.AmountFormat:
|
|
457
|
+
case s.Num: {
|
|
458
|
+
pe.value = !!e.key?.match(/Backspace/);
|
|
459
|
+
const t = e.code?.match(/Space/), r = [".", ","];
|
|
460
|
+
a.allowNegative && r.push("-");
|
|
461
|
+
const o = r.includes(e.key), l = e.metaKey || e.ctrlKey, i = e.key?.match(/Arrow|Backspace|\.,/);
|
|
462
|
+
!a.allowEmpty && S.value && ae(e), (isNaN(+e.key) && !i && !o && !l || t) && e.preventDefault();
|
|
463
|
+
const c = e.key === "-" ? /-/ : /[.,]/, C = typeof a.modelValue == "string" && c.test(a.modelValue);
|
|
464
|
+
o && C && e.preventDefault();
|
|
447
465
|
break;
|
|
448
466
|
}
|
|
449
467
|
}
|
|
450
468
|
E("keydown", e);
|
|
451
469
|
}, K = (e) => {
|
|
452
470
|
if (!e) return e;
|
|
453
|
-
const [
|
|
454
|
-
return
|
|
455
|
-
},
|
|
471
|
+
const [t] = /-?\d*[\.]?\d*/.exec(String(e)?.replace(/ /gm, "")?.trim()) || [];
|
|
472
|
+
return t;
|
|
473
|
+
}, oe = (e, t, r) => {
|
|
456
474
|
if (!e.setSelectionRange) return;
|
|
457
|
-
let o = Number(
|
|
458
|
-
if (!Number.isFinite(o) || !Number.isFinite(
|
|
459
|
-
const
|
|
460
|
-
if (o = Math.max(0, Math.min(o,
|
|
475
|
+
let o = Number(t), l = Number(r);
|
|
476
|
+
if (!Number.isFinite(o) || !Number.isFinite(l)) return;
|
|
477
|
+
const i = e.value.length;
|
|
478
|
+
if (o = Math.max(0, Math.min(o, i)), l = Math.max(0, Math.min(l, i)), !(e.selectionStart === o && e.selectionEnd === l))
|
|
461
479
|
try {
|
|
462
|
-
typeof document < "u" && document.activeElement !== e && e.focus(), e.setSelectionRange(o,
|
|
480
|
+
typeof document < "u" && document.activeElement !== e && e.focus(), e.setSelectionRange(o, l);
|
|
463
481
|
} catch {
|
|
464
482
|
}
|
|
465
|
-
},
|
|
466
|
-
const o = () =>
|
|
483
|
+
}, N = (e, t, r) => {
|
|
484
|
+
const o = () => oe(e, t, r);
|
|
467
485
|
typeof requestAnimationFrame == "function" ? requestAnimationFrame(o) : o();
|
|
468
|
-
},
|
|
469
|
-
const
|
|
470
|
-
return r ?
|
|
471
|
-
},
|
|
486
|
+
}, Ae = (e) => typeof e.selectionStart == "number" && typeof e.selectionEnd == "number" ? { start: e.selectionStart, end: e.selectionEnd } : { start: 0, end: 0 }, le = (e) => {
|
|
487
|
+
const t = K(e), r = !!String(t)?.match(/\./), [o, l] = String(t).replace(/[^\d\.-]/g, "").replace(/\B(?=(?:\d{3})+(?!\d))/g, " ").split("."), i = [o, l?.replace(/ /gm, "") || ""];
|
|
488
|
+
return r ? i.join(".") : i.filter((c) => !!c).join(".");
|
|
489
|
+
}, Be = () => {
|
|
472
490
|
try {
|
|
473
|
-
navigator.clipboard.writeText(
|
|
491
|
+
navigator.clipboard.writeText(a.modelValue), h.name = "check", h.color = "green", setTimeout(() => {
|
|
474
492
|
h.name = "copy", h.color = "black";
|
|
475
493
|
}, 2e3);
|
|
476
494
|
} catch (e) {
|
|
477
495
|
console.error("error while copy with navigator", e);
|
|
478
496
|
}
|
|
479
|
-
E("copy",
|
|
480
|
-
},
|
|
481
|
-
A.value = I.value ?
|
|
497
|
+
E("copy", a.modelValue);
|
|
498
|
+
}, Fe = () => {
|
|
499
|
+
A.value = I.value ? s.Text : s.Password;
|
|
482
500
|
};
|
|
483
|
-
|
|
484
|
-
() =>
|
|
501
|
+
Ie(
|
|
502
|
+
() => a.errors,
|
|
485
503
|
(e) => {
|
|
486
|
-
|
|
504
|
+
v.setError(e);
|
|
487
505
|
}
|
|
488
506
|
);
|
|
489
|
-
const
|
|
507
|
+
const Pe = (e) => {
|
|
490
508
|
if (!e) return;
|
|
491
|
-
const
|
|
492
|
-
if (!
|
|
493
|
-
if (!["input", "textarea"].includes(
|
|
494
|
-
const o =
|
|
509
|
+
const t = e.target;
|
|
510
|
+
if (!t) return;
|
|
511
|
+
if (!["input", "textarea"].includes(t.tagName?.toLowerCase())) {
|
|
512
|
+
const o = t.closest(".mc-field-text");
|
|
495
513
|
if (!o) return;
|
|
496
|
-
const
|
|
497
|
-
if (!
|
|
498
|
-
|
|
514
|
+
const l = o.querySelector(".mc-field-text__input");
|
|
515
|
+
if (!l) return;
|
|
516
|
+
l.focus();
|
|
517
|
+
}
|
|
518
|
+
}, Ee = () => {
|
|
519
|
+
if (a.removeLeadingZero) {
|
|
520
|
+
const e = [s.Int, s.Num, s.AmountFormat].includes(a.type), t = String(a.modelValue ?? "");
|
|
521
|
+
if (e && t) {
|
|
522
|
+
const r = Ne(t);
|
|
523
|
+
r !== t && (y.value = r);
|
|
524
|
+
}
|
|
499
525
|
}
|
|
500
526
|
};
|
|
501
|
-
return (e,
|
|
502
|
-
dir:
|
|
503
|
-
class:
|
|
504
|
-
style:
|
|
505
|
-
onClick:
|
|
527
|
+
return (e, t) => (u(), p("div", {
|
|
528
|
+
dir: a.dir,
|
|
529
|
+
class: se(fe.value),
|
|
530
|
+
style: ne(ye.value),
|
|
531
|
+
onClick: V(Pe, ["stop"])
|
|
506
532
|
}, [
|
|
507
533
|
x("label", {
|
|
508
534
|
for: f.name,
|
|
509
535
|
class: "mc-field-text__header"
|
|
510
536
|
}, [
|
|
511
|
-
|
|
537
|
+
$(e.$slots, "header", {}, () => [
|
|
512
538
|
f.title ? (u(), g(P, {
|
|
513
539
|
key: 0,
|
|
514
540
|
"max-width": "100%",
|
|
515
|
-
weight: m(
|
|
541
|
+
weight: m(Ye).Medium
|
|
516
542
|
}, {
|
|
517
543
|
default: k(() => [
|
|
518
|
-
|
|
544
|
+
Z(F(ve.value), 1)
|
|
519
545
|
]),
|
|
520
546
|
_: 1
|
|
521
547
|
}, 8, ["weight"])) : d("", !0)
|
|
522
548
|
])
|
|
523
|
-
], 8,
|
|
549
|
+
], 8, Xe),
|
|
524
550
|
x("label", {
|
|
525
551
|
for: f.name,
|
|
526
552
|
class: "mc-field-text__inner"
|
|
527
553
|
}, [
|
|
528
|
-
x("div",
|
|
554
|
+
x("div", tt, [
|
|
529
555
|
e.$slots.prepend ? (u(), p("div", {
|
|
530
556
|
key: 0,
|
|
531
557
|
class: "mc-field-text__prepend",
|
|
532
|
-
onClick:
|
|
558
|
+
onClick: t[0] || (t[0] = V(() => {
|
|
533
559
|
}, ["stop"]))
|
|
534
560
|
}, [
|
|
535
|
-
|
|
561
|
+
$(e.$slots, "prepend")
|
|
536
562
|
])) : d("", !0),
|
|
537
|
-
x("div",
|
|
563
|
+
x("div", at, [
|
|
538
564
|
b.value ? (u(), p("textarea", M({
|
|
539
565
|
key: 0,
|
|
540
|
-
value:
|
|
566
|
+
value: y.value
|
|
541
567
|
}, T.value, {
|
|
542
568
|
maxlength: f.maxLength,
|
|
543
569
|
rows: "1",
|
|
544
570
|
onInput: B
|
|
545
|
-
}), null, 16,
|
|
571
|
+
}), null, 16, rt)) : w.value ? (u(), p("div", {
|
|
546
572
|
key: 1,
|
|
547
573
|
class: "mc-field-text--textarea-autosize_wrapper",
|
|
548
|
-
style:
|
|
574
|
+
style: ne(he.value)
|
|
549
575
|
}, [
|
|
550
|
-
x("span", M({ class: "mc-field-text--textarea-autosize_backdrop-cover" }, T.value), F(
|
|
551
|
-
x("textarea", M({ value:
|
|
552
|
-
], 4)) : (u(), p(
|
|
553
|
-
|
|
576
|
+
x("span", M({ class: "mc-field-text--textarea-autosize_backdrop-cover" }, T.value), F(y.value), 17),
|
|
577
|
+
x("textarea", M({ value: y.value }, T.value, { onInput: B }), null, 16, ot)
|
|
578
|
+
], 4)) : (u(), p(He, { key: 2 }, [
|
|
579
|
+
ge.value ? (u(), g(m(Ke), M({
|
|
554
580
|
key: 0,
|
|
555
|
-
value:
|
|
556
|
-
},
|
|
557
|
-
onKeydown:
|
|
558
|
-
"onUpdate:modelValue":
|
|
581
|
+
value: y.value
|
|
582
|
+
}, Se.value, {
|
|
583
|
+
onKeydown: re,
|
|
584
|
+
"onUpdate:modelValue": t[1] || (t[1] = (r, o) => B(o))
|
|
559
585
|
}), null, 16, ["value"])) : (u(), p("input", M({
|
|
560
586
|
key: 1,
|
|
561
587
|
ref_key: "input",
|
|
562
588
|
ref: _,
|
|
563
|
-
value:
|
|
589
|
+
value: y.value
|
|
564
590
|
}, T.value, {
|
|
565
591
|
type: A.value,
|
|
566
|
-
readonly:
|
|
592
|
+
readonly: a.readOnly,
|
|
567
593
|
maxlength: f.maxLength,
|
|
568
|
-
onKeydown:
|
|
569
|
-
onKeyup:
|
|
594
|
+
onKeydown: re,
|
|
595
|
+
onKeyup: $e,
|
|
570
596
|
onInput: B,
|
|
571
|
-
onPaste:
|
|
572
|
-
|
|
597
|
+
onPaste: Me,
|
|
598
|
+
onBlur: Ee
|
|
599
|
+
}), null, 16, lt))
|
|
573
600
|
], 64))
|
|
574
601
|
]),
|
|
575
602
|
e.$slots.append || f.copy || G.value ? (u(), p("div", {
|
|
576
603
|
key: 1,
|
|
577
|
-
class:
|
|
578
|
-
onClick:
|
|
604
|
+
class: se(["mc-field-text__append", { "mc-field-text__append--indent-bottom": O.value }]),
|
|
605
|
+
onClick: t[2] || (t[2] = V(() => {
|
|
579
606
|
}, ["stop"]))
|
|
580
607
|
}, [
|
|
581
|
-
|
|
582
|
-
f.copy ? (u(), g(
|
|
608
|
+
$(e.$slots, "append"),
|
|
609
|
+
f.copy ? (u(), g(ce, {
|
|
583
610
|
key: 0,
|
|
584
611
|
variation: "black-link",
|
|
585
|
-
size: m(
|
|
586
|
-
onClick:
|
|
612
|
+
size: m(ue).MCompact,
|
|
613
|
+
onClick: V(Be, ["stop", "prevent"])
|
|
587
614
|
}, {
|
|
588
615
|
"icon-append": k(() => [
|
|
589
|
-
|
|
616
|
+
j(me, {
|
|
590
617
|
name: h.name,
|
|
591
618
|
color: h.color
|
|
592
619
|
}, null, 8, ["name", "color"])
|
|
593
620
|
]),
|
|
594
621
|
_: 1
|
|
595
622
|
}, 8, ["size"])) : d("", !0),
|
|
596
|
-
G.value ? (u(), g(
|
|
623
|
+
G.value ? (u(), g(Je, {
|
|
597
624
|
key: 1,
|
|
598
|
-
content: I.value ?
|
|
625
|
+
content: I.value ? a.passwordTooltip : a.passwordHideTooltip || a.passwordTooltip
|
|
599
626
|
}, {
|
|
600
627
|
default: k(() => [
|
|
601
|
-
|
|
628
|
+
j(ce, {
|
|
602
629
|
variation: "black-link",
|
|
603
|
-
size: m(
|
|
630
|
+
size: m(ue).MCompact,
|
|
604
631
|
tabindex: "-1",
|
|
605
|
-
type: m(
|
|
606
|
-
onClick:
|
|
632
|
+
type: m(Ue).Button,
|
|
633
|
+
onClick: V(Fe, ["stop", "prevent"])
|
|
607
634
|
}, {
|
|
608
635
|
"icon-append": k(() => [
|
|
609
|
-
|
|
636
|
+
j(me, { name: ke.value }, null, 8, ["name"])
|
|
610
637
|
]),
|
|
611
638
|
_: 1
|
|
612
639
|
}, 8, ["size", "type"])
|
|
@@ -618,31 +645,31 @@ const We = ["dir"], Ye = ["for"], Ge = ["for"], Je = { class: "mc-field-text__ma
|
|
|
618
645
|
key: 2,
|
|
619
646
|
class: "mc-field-text__char-counter",
|
|
620
647
|
variation: m(W).Overline,
|
|
621
|
-
"text-align": m(
|
|
622
|
-
color:
|
|
648
|
+
"text-align": m(We).Right,
|
|
649
|
+
color: be.value
|
|
623
650
|
}, {
|
|
624
651
|
default: k(() => [
|
|
625
|
-
|
|
652
|
+
Z(F(_e.value), 1)
|
|
626
653
|
]),
|
|
627
654
|
_: 1
|
|
628
655
|
}, 8, ["variation", "text-align", "color"])) : d("", !0)
|
|
629
656
|
]),
|
|
630
|
-
e.$slots.right ? (u(), p("div",
|
|
631
|
-
|
|
657
|
+
e.$slots.right ? (u(), p("div", nt, [
|
|
658
|
+
$(e.$slots, "right")
|
|
632
659
|
])) : d("", !0)
|
|
633
|
-
], 8,
|
|
634
|
-
m(
|
|
635
|
-
m(
|
|
660
|
+
], 8, et),
|
|
661
|
+
m(v).errorText.value || a.helpText || e.$slots.footer ? (u(), p("div", st, [
|
|
662
|
+
m(v).errorText.value ? (u(), g(P, {
|
|
636
663
|
key: 0,
|
|
637
664
|
"tag-name": "div",
|
|
638
665
|
color: "red",
|
|
639
666
|
variation: m(W).Overline,
|
|
640
667
|
class: "mc-field-text__error-text",
|
|
641
|
-
"html-data": m(
|
|
668
|
+
"html-data": m(v).errorText.value
|
|
642
669
|
}, null, 8, ["variation", "html-data"])) : d("", !0),
|
|
643
|
-
m(
|
|
644
|
-
|
|
645
|
-
|
|
670
|
+
m(v).errorText.value ? (u(), p("br", it)) : d("", !0),
|
|
671
|
+
$(e.$slots, "footer", {}, () => [
|
|
672
|
+
a.helpText ? (u(), g(P, {
|
|
646
673
|
key: 0,
|
|
647
674
|
"tag-name": "div",
|
|
648
675
|
variation: m(W).Overline,
|
|
@@ -650,15 +677,15 @@ const We = ["dir"], Ye = ["for"], Ge = ["for"], Je = { class: "mc-field-text__ma
|
|
|
650
677
|
"max-width": "100%"
|
|
651
678
|
}, {
|
|
652
679
|
default: k(() => [
|
|
653
|
-
|
|
680
|
+
Z(F(a.helpText), 1)
|
|
654
681
|
]),
|
|
655
682
|
_: 1
|
|
656
683
|
}, 8, ["variation"])) : d("", !0)
|
|
657
684
|
])
|
|
658
685
|
])) : d("", !0)
|
|
659
|
-
], 14,
|
|
686
|
+
], 14, Qe));
|
|
660
687
|
}
|
|
661
688
|
});
|
|
662
689
|
export {
|
|
663
|
-
|
|
690
|
+
Mt as default
|
|
664
691
|
};
|