@progress/kendo-vue-inputs 9.0.1-develop.1 → 9.1.0-develop.1
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/cdn/js/kendo-vue-inputs.js +1 -1
- package/index.d.mts +7 -0
- package/index.d.ts +7 -0
- package/index.js +1 -1
- package/index.mjs +17 -15
- package/messages/main.d.ts +10 -0
- package/messages/main.js +2 -2
- package/messages/main.mjs +27 -23
- package/otpinput/OTPInput.d.ts +256 -0
- package/otpinput/OTPInput.js +8 -0
- package/otpinput/OTPInput.mjs +424 -0
- package/otpinput/OTPInputCell.d.ts +168 -0
- package/otpinput/OTPInputCell.js +8 -0
- package/otpinput/OTPInputCell.mjs +173 -0
- package/otpinput/OTPInputHandle.d.ts +33 -0
- package/otpinput/OTPInputSeparator.d.ts +25 -0
- package/otpinput/OTPInputSeparator.js +8 -0
- package/otpinput/OTPInputSeparator.mjs +33 -0
- package/otpinput/interfaces/OTPInputBlurEvent.d.ts +25 -0
- package/otpinput/interfaces/OTPInputChangeEvent.d.ts +34 -0
- package/otpinput/interfaces/OTPInputFocusEvent.d.ts +29 -0
- package/otpinput/interfaces/OTPInputProps.d.ts +316 -0
- package/otpinput/interfaces/OTPSeparatorIcon.d.ts +27 -0
- package/package-metadata.js +1 -1
- package/package-metadata.mjs +2 -2
- package/package.json +9 -9
|
@@ -0,0 +1,424 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*-------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright © 2026 Progress Software Corporation. All rights reserved.
|
|
5
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
|
+
*-------------------------------------------------------------------------------------------
|
|
7
|
+
*/
|
|
8
|
+
import { defineComponent as v, createVNode as c } from "vue";
|
|
9
|
+
import { classNames as $, kendoThemeMaps as V, getRef as m, validatePackage as T, setRef as k } from "@progress/kendo-vue-common";
|
|
10
|
+
import { provideLocalizationService as S } from "@progress/kendo-vue-intl";
|
|
11
|
+
import { packageMetadata as B } from "../package-metadata.mjs";
|
|
12
|
+
import { otpInputAriaLabel as b, messages as D } from "../messages/main.mjs";
|
|
13
|
+
import { OTPInputCell as O } from "./OTPInputCell.mjs";
|
|
14
|
+
import { OTPInputSeparator as w } from "./OTPInputSeparator.mjs";
|
|
15
|
+
const h = 4;
|
|
16
|
+
function _(e, t) {
|
|
17
|
+
if (Array.isArray(t)) {
|
|
18
|
+
const i = t.reduce((n, a) => n + a, 0);
|
|
19
|
+
return i !== e && console.warn(`[OTPInput] The sum of groupLength values (${i}) must equal length (${e}).`), t;
|
|
20
|
+
}
|
|
21
|
+
const s = [];
|
|
22
|
+
let l = e;
|
|
23
|
+
for (; l > 0; )
|
|
24
|
+
s.push(Math.min(t, l)), l -= t;
|
|
25
|
+
return s;
|
|
26
|
+
}
|
|
27
|
+
const z = /* @__PURE__ */ v({
|
|
28
|
+
name: "KendoOTPInput",
|
|
29
|
+
model: {
|
|
30
|
+
event: "changemodel"
|
|
31
|
+
},
|
|
32
|
+
emits: {
|
|
33
|
+
change: (e) => !0,
|
|
34
|
+
changemodel: (e) => !0,
|
|
35
|
+
"update:modelValue": (e) => !0,
|
|
36
|
+
focus: (e) => !0,
|
|
37
|
+
blur: (e) => !0
|
|
38
|
+
},
|
|
39
|
+
props: {
|
|
40
|
+
value: {
|
|
41
|
+
type: String
|
|
42
|
+
},
|
|
43
|
+
modelValue: {
|
|
44
|
+
type: String
|
|
45
|
+
},
|
|
46
|
+
defaultValue: {
|
|
47
|
+
type: String
|
|
48
|
+
},
|
|
49
|
+
length: {
|
|
50
|
+
type: Number,
|
|
51
|
+
default: h
|
|
52
|
+
},
|
|
53
|
+
groupLength: {
|
|
54
|
+
type: [Number, Array]
|
|
55
|
+
},
|
|
56
|
+
separator: {
|
|
57
|
+
type: [String, Object]
|
|
58
|
+
},
|
|
59
|
+
type: {
|
|
60
|
+
type: String,
|
|
61
|
+
default: "text"
|
|
62
|
+
},
|
|
63
|
+
placeholder: {
|
|
64
|
+
type: String
|
|
65
|
+
},
|
|
66
|
+
spacing: {
|
|
67
|
+
type: Boolean,
|
|
68
|
+
default: !0
|
|
69
|
+
},
|
|
70
|
+
disabled: {
|
|
71
|
+
type: Boolean,
|
|
72
|
+
default: !1
|
|
73
|
+
},
|
|
74
|
+
readOnly: {
|
|
75
|
+
type: Boolean,
|
|
76
|
+
default: !1
|
|
77
|
+
},
|
|
78
|
+
inputAttributes: {
|
|
79
|
+
type: Object
|
|
80
|
+
},
|
|
81
|
+
name: {
|
|
82
|
+
type: String
|
|
83
|
+
},
|
|
84
|
+
required: {
|
|
85
|
+
type: Boolean,
|
|
86
|
+
default: !1
|
|
87
|
+
},
|
|
88
|
+
valid: {
|
|
89
|
+
type: Boolean,
|
|
90
|
+
default: void 0
|
|
91
|
+
},
|
|
92
|
+
size: {
|
|
93
|
+
type: String
|
|
94
|
+
},
|
|
95
|
+
fillMode: {
|
|
96
|
+
type: String
|
|
97
|
+
},
|
|
98
|
+
rounded: {
|
|
99
|
+
type: String
|
|
100
|
+
},
|
|
101
|
+
onChange: {
|
|
102
|
+
type: Function
|
|
103
|
+
},
|
|
104
|
+
onFocus: {
|
|
105
|
+
type: Function
|
|
106
|
+
},
|
|
107
|
+
onBlur: {
|
|
108
|
+
type: Function
|
|
109
|
+
},
|
|
110
|
+
ariaLabel: {
|
|
111
|
+
type: String
|
|
112
|
+
},
|
|
113
|
+
ariaLabelledBy: {
|
|
114
|
+
type: String
|
|
115
|
+
},
|
|
116
|
+
ariaDescribedBy: {
|
|
117
|
+
type: String
|
|
118
|
+
},
|
|
119
|
+
id: {
|
|
120
|
+
type: String
|
|
121
|
+
},
|
|
122
|
+
dir: {
|
|
123
|
+
type: String
|
|
124
|
+
},
|
|
125
|
+
touched: {
|
|
126
|
+
type: Boolean
|
|
127
|
+
},
|
|
128
|
+
visited: {
|
|
129
|
+
type: Boolean
|
|
130
|
+
},
|
|
131
|
+
modified: {
|
|
132
|
+
type: Boolean
|
|
133
|
+
},
|
|
134
|
+
validationMessage: {
|
|
135
|
+
type: String
|
|
136
|
+
}
|
|
137
|
+
},
|
|
138
|
+
inject: {
|
|
139
|
+
kendoLocalizationService: {
|
|
140
|
+
default: null
|
|
141
|
+
}
|
|
142
|
+
},
|
|
143
|
+
data() {
|
|
144
|
+
var l, i, n, a;
|
|
145
|
+
const e = (l = this.$props.defaultValue) != null ? l : "", t = (i = this.$props.length) != null ? i : h, s = ((a = (n = this.$props.value) != null ? n : this.$props.modelValue) != null ? a : e).padEnd(t, " ").slice(0, t);
|
|
146
|
+
return {
|
|
147
|
+
stateValue: e.padEnd(t, " ").slice(0, t),
|
|
148
|
+
lastCommittedValue: s,
|
|
149
|
+
invalidCellIndex: null,
|
|
150
|
+
invalidTimer: null
|
|
151
|
+
};
|
|
152
|
+
},
|
|
153
|
+
created() {
|
|
154
|
+
T(B);
|
|
155
|
+
},
|
|
156
|
+
beforeUnmount() {
|
|
157
|
+
this.invalidTimer !== null && clearTimeout(this.invalidTimer);
|
|
158
|
+
},
|
|
159
|
+
computed: {
|
|
160
|
+
currentValue() {
|
|
161
|
+
var s, l, i;
|
|
162
|
+
const e = (s = this.$props.length) != null ? s : h;
|
|
163
|
+
return ((i = (l = this.$props.value) != null ? l : this.$props.modelValue) != null ? i : this.stateValue).padEnd(e, " ").slice(0, e);
|
|
164
|
+
},
|
|
165
|
+
isControlled() {
|
|
166
|
+
return this.$props.value !== void 0 || this.$props.modelValue !== void 0;
|
|
167
|
+
}
|
|
168
|
+
},
|
|
169
|
+
watch: {
|
|
170
|
+
currentValue(e) {
|
|
171
|
+
this.lastCommittedValue = e;
|
|
172
|
+
}
|
|
173
|
+
},
|
|
174
|
+
methods: {
|
|
175
|
+
focus(e) {
|
|
176
|
+
var s;
|
|
177
|
+
const t = (s = this.$props.length) != null ? s : h;
|
|
178
|
+
if (e !== void 0)
|
|
179
|
+
this.focusCell(e);
|
|
180
|
+
else {
|
|
181
|
+
const l = this.lastCommittedValue.indexOf(" ");
|
|
182
|
+
this.focusCell(l >= 0 ? l : t - 1);
|
|
183
|
+
}
|
|
184
|
+
},
|
|
185
|
+
blur() {
|
|
186
|
+
var t;
|
|
187
|
+
const e = (t = this.$props.length) != null ? t : h;
|
|
188
|
+
for (let s = 0; s < e; s++) {
|
|
189
|
+
const l = m(this, `cell_${s}`);
|
|
190
|
+
l && typeof l.blur == "function" && l.blur();
|
|
191
|
+
}
|
|
192
|
+
},
|
|
193
|
+
_eventTarget() {
|
|
194
|
+
var e;
|
|
195
|
+
return {
|
|
196
|
+
element: (e = this.$el) != null ? e : null,
|
|
197
|
+
value: this.currentValue,
|
|
198
|
+
focus: (t) => this.focus(t),
|
|
199
|
+
blur: () => this.blur()
|
|
200
|
+
};
|
|
201
|
+
},
|
|
202
|
+
focusCell(e) {
|
|
203
|
+
var i;
|
|
204
|
+
const t = (i = this.$props.length) != null ? i : h, s = Math.max(0, Math.min(e, t - 1)), l = m(this, `cell_${s}`);
|
|
205
|
+
l && typeof l.focus == "function" && l.focus();
|
|
206
|
+
},
|
|
207
|
+
flashInvalid(e) {
|
|
208
|
+
this.invalidTimer !== null && clearTimeout(this.invalidTimer), this.invalidCellIndex = e, this.invalidTimer = setTimeout(() => {
|
|
209
|
+
this.invalidCellIndex = null, this.invalidTimer = null;
|
|
210
|
+
}, 300);
|
|
211
|
+
},
|
|
212
|
+
updateValue(e, t) {
|
|
213
|
+
var a;
|
|
214
|
+
const s = (a = this.$props.length) != null ? a : h, l = e.padEnd(s, " ").slice(0, s);
|
|
215
|
+
if (l === this.currentValue)
|
|
216
|
+
return;
|
|
217
|
+
this.isControlled || (this.stateValue = l), this.lastCommittedValue = l;
|
|
218
|
+
const i = this._eventTarget(), n = {
|
|
219
|
+
syntheticEvent: t,
|
|
220
|
+
nativeEvent: t,
|
|
221
|
+
target: i,
|
|
222
|
+
value: l,
|
|
223
|
+
component: this
|
|
224
|
+
};
|
|
225
|
+
this.$emit("change", n), this.$emit("changemodel", l), this.$emit("update:modelValue", l);
|
|
226
|
+
},
|
|
227
|
+
handleCellChange(e, t, s) {
|
|
228
|
+
const l = s.target, n = l.value.slice(-1);
|
|
229
|
+
if (!n)
|
|
230
|
+
return;
|
|
231
|
+
if (this.$props.type === "number" && !/^\d$/.test(n)) {
|
|
232
|
+
this.flashInvalid(e);
|
|
233
|
+
const r = this.currentValue[e] === " " ? "" : this.currentValue[e];
|
|
234
|
+
l.value = r, l.select();
|
|
235
|
+
return;
|
|
236
|
+
}
|
|
237
|
+
const a = this.lastCommittedValue.split("");
|
|
238
|
+
a[e] = n, this.updateValue(a.join(""), s), this.focusCell(e + 1);
|
|
239
|
+
},
|
|
240
|
+
handlePrintableOnFilledCell(e, t, s) {
|
|
241
|
+
if (s.preventDefault(), this.$props.type === "number" && !/^\d$/.test(t)) {
|
|
242
|
+
this.flashInvalid(e), s.target.select();
|
|
243
|
+
return;
|
|
244
|
+
}
|
|
245
|
+
const l = this.currentValue.split("");
|
|
246
|
+
l[e] = t, this.updateValue(l.join(""), s), this.focusCell(e + 1);
|
|
247
|
+
},
|
|
248
|
+
handleCellKeyDown(e, t) {
|
|
249
|
+
var l, i;
|
|
250
|
+
if (this.$props.readOnly)
|
|
251
|
+
return;
|
|
252
|
+
const s = ((l = this.$el) == null ? void 0 : l.getAttribute("dir")) === "rtl";
|
|
253
|
+
switch (t.key) {
|
|
254
|
+
case "ArrowLeft": {
|
|
255
|
+
t.preventDefault(), this.focusCell(s ? e + 1 : e - 1);
|
|
256
|
+
break;
|
|
257
|
+
}
|
|
258
|
+
case "ArrowRight": {
|
|
259
|
+
t.preventDefault(), this.focusCell(s ? e - 1 : e + 1);
|
|
260
|
+
break;
|
|
261
|
+
}
|
|
262
|
+
case "ArrowUp":
|
|
263
|
+
case "ArrowDown": {
|
|
264
|
+
t.preventDefault();
|
|
265
|
+
break;
|
|
266
|
+
}
|
|
267
|
+
case "Backspace": {
|
|
268
|
+
t.preventDefault();
|
|
269
|
+
const n = this.currentValue.split("");
|
|
270
|
+
n[e] = " ", this.updateValue(n.join(""), t), this.focusCell(e - 1);
|
|
271
|
+
break;
|
|
272
|
+
}
|
|
273
|
+
case "Delete": {
|
|
274
|
+
t.preventDefault();
|
|
275
|
+
const n = this.currentValue.split("");
|
|
276
|
+
n[e] = " ", this.updateValue(n.join(""), t);
|
|
277
|
+
break;
|
|
278
|
+
}
|
|
279
|
+
default: {
|
|
280
|
+
const {
|
|
281
|
+
key: n,
|
|
282
|
+
ctrlKey: a,
|
|
283
|
+
altKey: r,
|
|
284
|
+
metaKey: o
|
|
285
|
+
} = t, p = (i = this.currentValue[e]) != null ? i : " ";
|
|
286
|
+
n.length === 1 && !a && !r && !o && p !== " " && this.handlePrintableOnFilledCell(e, n, t);
|
|
287
|
+
break;
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
},
|
|
291
|
+
handleCellFocus(e, t) {
|
|
292
|
+
const s = this._eventTarget(), l = {
|
|
293
|
+
syntheticEvent: t,
|
|
294
|
+
nativeEvent: t,
|
|
295
|
+
target: s,
|
|
296
|
+
cellIndex: e
|
|
297
|
+
};
|
|
298
|
+
this.$emit("focus", l);
|
|
299
|
+
},
|
|
300
|
+
handleCellBlur(e, t) {
|
|
301
|
+
},
|
|
302
|
+
handleWrapperFocusOut(e) {
|
|
303
|
+
var i;
|
|
304
|
+
const t = e.relatedTarget;
|
|
305
|
+
if (t && ((i = this.$el) != null && i.contains(t)))
|
|
306
|
+
return;
|
|
307
|
+
const s = this._eventTarget(), l = {
|
|
308
|
+
syntheticEvent: e,
|
|
309
|
+
nativeEvent: e,
|
|
310
|
+
target: s
|
|
311
|
+
};
|
|
312
|
+
this.$emit("blur", l);
|
|
313
|
+
},
|
|
314
|
+
handlePaste(e) {
|
|
315
|
+
var r, o, p, f, g, y;
|
|
316
|
+
if (e.preventDefault(), this.$props.readOnly)
|
|
317
|
+
return;
|
|
318
|
+
const t = (o = (r = e.clipboardData) == null ? void 0 : r.getData("text")) != null ? o : "";
|
|
319
|
+
if (!t)
|
|
320
|
+
return;
|
|
321
|
+
const s = (p = this.$props.length) != null ? p : h;
|
|
322
|
+
let l = -1;
|
|
323
|
+
for (let u = 0; u < s; u++) {
|
|
324
|
+
const d = m(this, `cell_${u}`), C = (y = d == null ? void 0 : d._input) != null ? y : (g = (f = d == null ? void 0 : d.$refs) == null ? void 0 : f.textBoxRef) == null ? void 0 : g._input;
|
|
325
|
+
if (C && C === document.activeElement) {
|
|
326
|
+
l = u;
|
|
327
|
+
break;
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
const i = l >= 0 ? l : 0;
|
|
331
|
+
if (this.$props.type === "number" && !/^\d+$/.test(t.trim())) {
|
|
332
|
+
this.flashInvalid(i);
|
|
333
|
+
return;
|
|
334
|
+
}
|
|
335
|
+
const n = this.currentValue.split("");
|
|
336
|
+
for (let u = 0; u < t.length && i + u < s; u++)
|
|
337
|
+
n[i + u] = t[u];
|
|
338
|
+
this.updateValue(n.join(""), e);
|
|
339
|
+
const a = Math.min(i + t.length, s - 1);
|
|
340
|
+
this.focusCell(a);
|
|
341
|
+
},
|
|
342
|
+
buildContent() {
|
|
343
|
+
var n;
|
|
344
|
+
const e = (n = this.length) != null ? n : h, t = (a) => {
|
|
345
|
+
var r, o;
|
|
346
|
+
return c(O, {
|
|
347
|
+
ref: k(this, `cell_${a}`),
|
|
348
|
+
index: a,
|
|
349
|
+
totalLength: e,
|
|
350
|
+
char: (r = this.currentValue[a]) != null ? r : " ",
|
|
351
|
+
type: this.type,
|
|
352
|
+
placeholder: this.placeholder,
|
|
353
|
+
disabled: this.disabled,
|
|
354
|
+
readOnly: this.readOnly,
|
|
355
|
+
required: this.required,
|
|
356
|
+
size: this.size,
|
|
357
|
+
fillMode: this.fillMode,
|
|
358
|
+
rounded: this.rounded,
|
|
359
|
+
inputAttributes: this.inputAttributes,
|
|
360
|
+
valid: this.valid === !1 || this.invalidCellIndex === a ? !1 : (o = this.valid) != null ? o : !0,
|
|
361
|
+
id: this.id ? `${this.id}-cell-${a}` : `otp-cell-${a}`,
|
|
362
|
+
name: this.name ? `${this.name}-cell-${a}` : `otp-cell-${a}`,
|
|
363
|
+
onCellChange: this.handleCellChange,
|
|
364
|
+
onCellKeyDown: this.handleCellKeyDown,
|
|
365
|
+
onCellFocus: this.handleCellFocus,
|
|
366
|
+
onCellBlur: this.handleCellBlur
|
|
367
|
+
}, null);
|
|
368
|
+
};
|
|
369
|
+
if (!this.groupLength) {
|
|
370
|
+
const a = Array.from({
|
|
371
|
+
length: e
|
|
372
|
+
}, (r, o) => t(o));
|
|
373
|
+
return this.spacing === !1 ? [c("div", {
|
|
374
|
+
key: "group",
|
|
375
|
+
class: "k-input-group"
|
|
376
|
+
}, [a])] : a;
|
|
377
|
+
}
|
|
378
|
+
const s = _(e, this.groupLength);
|
|
379
|
+
let l = 0;
|
|
380
|
+
const i = [];
|
|
381
|
+
return s.forEach((a, r) => {
|
|
382
|
+
const o = l;
|
|
383
|
+
r > 0 && this.separator !== void 0 && i.push(c(w, {
|
|
384
|
+
key: `sep-${o}`,
|
|
385
|
+
separator: this.separator
|
|
386
|
+
}, null));
|
|
387
|
+
const p = [];
|
|
388
|
+
for (let f = 0; f < a; f++)
|
|
389
|
+
p.push(t(l++));
|
|
390
|
+
this.spacing === !1 ? i.push(c("div", {
|
|
391
|
+
key: `group-${o}`,
|
|
392
|
+
class: "k-input-group"
|
|
393
|
+
}, [p])) : i.push(...p);
|
|
394
|
+
}), i;
|
|
395
|
+
}
|
|
396
|
+
},
|
|
397
|
+
render() {
|
|
398
|
+
const t = S(this).toLanguageString(b, D[b]), s = $("k-otp", {
|
|
399
|
+
"k-disabled": this.disabled,
|
|
400
|
+
"k-invalid": this.valid === !1,
|
|
401
|
+
[`k-otp-${V.sizeMap[this.size] || this.size}`]: this.size
|
|
402
|
+
}, this.$props.className);
|
|
403
|
+
return c("div", {
|
|
404
|
+
class: s,
|
|
405
|
+
role: "group",
|
|
406
|
+
"aria-label": this.ariaLabel || t,
|
|
407
|
+
"aria-labelledby": this.ariaLabelledBy,
|
|
408
|
+
"aria-describedby": this.ariaDescribedBy,
|
|
409
|
+
id: this.id,
|
|
410
|
+
style: this.$props.style,
|
|
411
|
+
dir: this.dir,
|
|
412
|
+
onFocusout: this.handleWrapperFocusOut,
|
|
413
|
+
onPaste: this.handlePaste
|
|
414
|
+
}, [this.name && c("input", {
|
|
415
|
+
"aria-hidden": !0,
|
|
416
|
+
type: "hidden",
|
|
417
|
+
name: this.name,
|
|
418
|
+
value: this.currentValue.replace(/ /g, "")
|
|
419
|
+
}, null), this.buildContent()]);
|
|
420
|
+
}
|
|
421
|
+
});
|
|
422
|
+
export {
|
|
423
|
+
z as OTPInput
|
|
424
|
+
};
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*-------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright © 2026 Progress Software Corporation. All rights reserved.
|
|
5
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
|
+
*-------------------------------------------------------------------------------------------
|
|
7
|
+
*/
|
|
8
|
+
import { PropType } from 'vue';
|
|
9
|
+
/** @hidden */
|
|
10
|
+
export interface OTPInputCellProps {
|
|
11
|
+
index: number;
|
|
12
|
+
totalLength: number;
|
|
13
|
+
char: string;
|
|
14
|
+
type?: 'text' | 'password' | 'number';
|
|
15
|
+
placeholder?: string;
|
|
16
|
+
disabled?: boolean;
|
|
17
|
+
readOnly?: boolean;
|
|
18
|
+
required?: boolean;
|
|
19
|
+
size?: 'small' | 'medium' | 'large';
|
|
20
|
+
fillMode?: 'solid' | 'flat' | 'outline';
|
|
21
|
+
rounded?: 'small' | 'medium' | 'large' | 'full' | 'none';
|
|
22
|
+
id?: string;
|
|
23
|
+
name?: string;
|
|
24
|
+
inputAttributes?: Object;
|
|
25
|
+
valid?: boolean;
|
|
26
|
+
onCellChange?: (index: number, char: string, event: Event) => void;
|
|
27
|
+
onCellKeyDown?: (index: number, event: KeyboardEvent) => void;
|
|
28
|
+
onCellFocus?: (index: number, event: FocusEvent) => void;
|
|
29
|
+
onCellBlur?: (index: number, event: FocusEvent) => void;
|
|
30
|
+
}
|
|
31
|
+
/** @hidden */
|
|
32
|
+
export declare const OTPInputCell: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
|
|
33
|
+
index: {
|
|
34
|
+
type: PropType<number>;
|
|
35
|
+
required: true;
|
|
36
|
+
};
|
|
37
|
+
totalLength: {
|
|
38
|
+
type: PropType<number>;
|
|
39
|
+
required: true;
|
|
40
|
+
};
|
|
41
|
+
char: {
|
|
42
|
+
type: PropType<string>;
|
|
43
|
+
required: true;
|
|
44
|
+
};
|
|
45
|
+
type: {
|
|
46
|
+
type: PropType<"number" | "text" | "password">;
|
|
47
|
+
};
|
|
48
|
+
placeholder: {
|
|
49
|
+
type: PropType<string>;
|
|
50
|
+
};
|
|
51
|
+
disabled: {
|
|
52
|
+
type: PropType<boolean>;
|
|
53
|
+
};
|
|
54
|
+
readOnly: {
|
|
55
|
+
type: PropType<boolean>;
|
|
56
|
+
};
|
|
57
|
+
required: {
|
|
58
|
+
type: PropType<boolean>;
|
|
59
|
+
};
|
|
60
|
+
size: {
|
|
61
|
+
type: PropType<"small" | "medium" | "large">;
|
|
62
|
+
};
|
|
63
|
+
fillMode: {
|
|
64
|
+
type: PropType<"flat" | "solid" | "outline">;
|
|
65
|
+
};
|
|
66
|
+
rounded: {
|
|
67
|
+
type: PropType<"small" | "medium" | "large" | "full" | "none">;
|
|
68
|
+
};
|
|
69
|
+
id: {
|
|
70
|
+
type: PropType<string>;
|
|
71
|
+
};
|
|
72
|
+
name: {
|
|
73
|
+
type: PropType<string>;
|
|
74
|
+
};
|
|
75
|
+
inputAttributes: {
|
|
76
|
+
type: PropType<Object>;
|
|
77
|
+
};
|
|
78
|
+
valid: {
|
|
79
|
+
type: PropType<boolean>;
|
|
80
|
+
default: any;
|
|
81
|
+
};
|
|
82
|
+
onCellChange: {
|
|
83
|
+
type: PropType<(index: number, char: string, event: Event) => void>;
|
|
84
|
+
};
|
|
85
|
+
onCellKeyDown: {
|
|
86
|
+
type: PropType<(index: number, event: KeyboardEvent) => void>;
|
|
87
|
+
};
|
|
88
|
+
onCellFocus: {
|
|
89
|
+
type: PropType<(index: number, event: FocusEvent) => void>;
|
|
90
|
+
};
|
|
91
|
+
onCellBlur: {
|
|
92
|
+
type: PropType<(index: number, event: FocusEvent) => void>;
|
|
93
|
+
};
|
|
94
|
+
}>, {}, {
|
|
95
|
+
_input: HTMLInputElement;
|
|
96
|
+
}, {}, {
|
|
97
|
+
focus(): void;
|
|
98
|
+
blur(): void;
|
|
99
|
+
select(): void;
|
|
100
|
+
handleChange(e: any): void;
|
|
101
|
+
handleFocus(e: any): void;
|
|
102
|
+
handleBlur(e: any): void;
|
|
103
|
+
handleKeyDown(e: KeyboardEvent): void;
|
|
104
|
+
}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
|
|
105
|
+
index: {
|
|
106
|
+
type: PropType<number>;
|
|
107
|
+
required: true;
|
|
108
|
+
};
|
|
109
|
+
totalLength: {
|
|
110
|
+
type: PropType<number>;
|
|
111
|
+
required: true;
|
|
112
|
+
};
|
|
113
|
+
char: {
|
|
114
|
+
type: PropType<string>;
|
|
115
|
+
required: true;
|
|
116
|
+
};
|
|
117
|
+
type: {
|
|
118
|
+
type: PropType<"number" | "text" | "password">;
|
|
119
|
+
};
|
|
120
|
+
placeholder: {
|
|
121
|
+
type: PropType<string>;
|
|
122
|
+
};
|
|
123
|
+
disabled: {
|
|
124
|
+
type: PropType<boolean>;
|
|
125
|
+
};
|
|
126
|
+
readOnly: {
|
|
127
|
+
type: PropType<boolean>;
|
|
128
|
+
};
|
|
129
|
+
required: {
|
|
130
|
+
type: PropType<boolean>;
|
|
131
|
+
};
|
|
132
|
+
size: {
|
|
133
|
+
type: PropType<"small" | "medium" | "large">;
|
|
134
|
+
};
|
|
135
|
+
fillMode: {
|
|
136
|
+
type: PropType<"flat" | "solid" | "outline">;
|
|
137
|
+
};
|
|
138
|
+
rounded: {
|
|
139
|
+
type: PropType<"small" | "medium" | "large" | "full" | "none">;
|
|
140
|
+
};
|
|
141
|
+
id: {
|
|
142
|
+
type: PropType<string>;
|
|
143
|
+
};
|
|
144
|
+
name: {
|
|
145
|
+
type: PropType<string>;
|
|
146
|
+
};
|
|
147
|
+
inputAttributes: {
|
|
148
|
+
type: PropType<Object>;
|
|
149
|
+
};
|
|
150
|
+
valid: {
|
|
151
|
+
type: PropType<boolean>;
|
|
152
|
+
default: any;
|
|
153
|
+
};
|
|
154
|
+
onCellChange: {
|
|
155
|
+
type: PropType<(index: number, char: string, event: Event) => void>;
|
|
156
|
+
};
|
|
157
|
+
onCellKeyDown: {
|
|
158
|
+
type: PropType<(index: number, event: KeyboardEvent) => void>;
|
|
159
|
+
};
|
|
160
|
+
onCellFocus: {
|
|
161
|
+
type: PropType<(index: number, event: FocusEvent) => void>;
|
|
162
|
+
};
|
|
163
|
+
onCellBlur: {
|
|
164
|
+
type: PropType<(index: number, event: FocusEvent) => void>;
|
|
165
|
+
};
|
|
166
|
+
}>> & Readonly<{}>, {
|
|
167
|
+
valid: boolean;
|
|
168
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*-------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright © 2026 Progress Software Corporation. All rights reserved.
|
|
5
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
|
+
*-------------------------------------------------------------------------------------------
|
|
7
|
+
*/
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("vue"),a=require("@progress/kendo-vue-common"),u=require("@progress/kendo-vue-intl"),d=require("../textbox/TextBox.js"),s=require("../messages/main.js"),h=r.defineComponent({name:"OTPInputCell",props:{index:{type:Number,required:!0},totalLength:{type:Number,required:!0},char:{type:String,required:!0},type:{type:String},placeholder:{type:String},disabled:{type:Boolean},readOnly:{type:Boolean},required:{type:Boolean},size:{type:String},fillMode:{type:String},rounded:{type:String},id:{type:String},name:{type:String},inputAttributes:{type:Object},valid:{type:Boolean,default:void 0},onCellChange:{type:Function},onCellKeyDown:{type:Function},onCellFocus:{type:Function},onCellBlur:{type:Function}},inject:{kendoLocalizationService:{default:null}},data(){return{_input:null}},mounted(){var e,t;this._input=(t=(e=this.$refs.textBoxRef)==null?void 0:e._input)!=null?t:null},methods:{focus(){var t;const e=(t=this.$refs.textBoxRef)==null?void 0:t._input;e&&e.focus()},blur(){var t;const e=(t=this.$refs.textBoxRef)==null?void 0:t._input;e&&e.blur()},select(){var t;const e=(t=this.$refs.textBoxRef)==null?void 0:t._input;e&&e.select()},handleChange(e){var t,n,i,l;if(this.onCellChange){const o=(n=(t=e.event)!=null?t:e.syntheticEvent)!=null?n:e;this.onCellChange(this.index,(l=(i=o==null?void 0:o.target)==null?void 0:i.value)!=null?l:"",o)}},handleFocus(e){var i,l;const t=(i=e.event)!=null?i:e,n=(l=this.$refs.textBoxRef)==null?void 0:l._input;n&&n.select(),this.onCellFocus&&this.onCellFocus(this.index,t)},handleBlur(e){var n;const t=(n=e.event)!=null?n:e;this.onCellBlur&&this.onCellBlur(this.index,t)},handleKeyDown(e){this.onCellKeyDown&&this.onCellKeyDown(this.index,e)}},render(){const t=u.provideLocalizationService(this).toLanguageString(s.otpInputCellAriaLabel,s.messages[s.otpInputCellAriaLabel]).replace("{index}",String(this.index+1)).replace("{total}",String(this.totalLength)),n={autoComplete:"off",type:this.type==="number"?"text":this.type,...this.inputAttributes,maxLength:1,...this.name&&{name:this.name},...this.readOnly&&{readOnly:!0},...this.valid===!1&&{"aria-invalid":!0}};return r.createVNode(d.TextBox,{ref:"textBoxRef",wrapperClass:a.classNames("k-otp-input",{"k-readonly":this.readOnly,"k-invalid":this.valid===!1}),value:this.char===" "?"":this.char,size:this.size,fillMode:this.fillMode,rounded:this.rounded,disabled:this.disabled,required:this.required,valid:this.valid,validityStyles:!1,id:this.id,placeholder:this.placeholder,ariaLabel:t,onInput:this.onCellChange?this.handleChange:void 0,onFocus:this.handleFocus,onBlur:this.handleBlur,onKeydown:this.handleKeyDown,inputAttributes:n},null)}});exports.OTPInputCell=h;
|