@progress/kendo-react-inputs 9.1.1-develop.3 → 9.2.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-react-inputs.js +1 -1
- package/index.d.mts +21 -0
- package/index.d.ts +21 -0
- package/maskedtextbox/MaskedTextBox.js +1 -1
- package/maskedtextbox/MaskedTextBox.mjs +53 -51
- package/numerictextbox/NumericTextBox.js +1 -1
- package/numerictextbox/NumericTextBox.mjs +83 -80
- package/package-metadata.mjs +1 -1
- package/package.json +8 -8
- package/textarea/TextArea.js +1 -1
- package/textarea/TextArea.mjs +49 -48
- package/textbox/Textbox.js +1 -1
- package/textbox/Textbox.mjs +37 -35
package/index.d.mts
CHANGED
|
@@ -1783,6 +1783,11 @@ export declare interface MaskedTextBoxProps extends FormComponentProps {
|
|
|
1783
1783
|
* @hidden
|
|
1784
1784
|
*/
|
|
1785
1785
|
unstyled?: InputsClassStructure;
|
|
1786
|
+
/**
|
|
1787
|
+
* Sets the HTML attributes of the inner focusable input element.
|
|
1788
|
+
* Attributes which are essential for certain component functionalities cannot be changed.
|
|
1789
|
+
*/
|
|
1790
|
+
inputAttributes?: React.InputHTMLAttributes<HTMLInputElement>;
|
|
1786
1791
|
}
|
|
1787
1792
|
|
|
1788
1793
|
/**
|
|
@@ -1846,6 +1851,7 @@ export declare class MaskedTextBoxWithoutContext extends React_2.Component<Maske
|
|
|
1846
1851
|
rounded: PropTypes.Requireable<"small" | "large" | "medium" | "full" | null | undefined>;
|
|
1847
1852
|
fillMode: PropTypes.Requireable<"flat" | "solid" | "outline" | null | undefined>;
|
|
1848
1853
|
autoFocus: PropTypes.Requireable<boolean>;
|
|
1854
|
+
inputAttributes: PropTypes.Requireable<object>;
|
|
1849
1855
|
};
|
|
1850
1856
|
/**
|
|
1851
1857
|
* @hidden
|
|
@@ -2221,6 +2227,11 @@ export declare interface NumericTextBoxProps extends FormComponentProps, Omit<Re
|
|
|
2221
2227
|
* Represents the `autoFocus` HTML attribute that will be applied to the input element of the NumericTextBox. (Defaults to `false`)
|
|
2222
2228
|
*/
|
|
2223
2229
|
autoFocus?: boolean;
|
|
2230
|
+
/**
|
|
2231
|
+
* Sets the HTML attributes of the inner focusable input element.
|
|
2232
|
+
* Attributes which are essential for certain component functionalities cannot be changed.
|
|
2233
|
+
*/
|
|
2234
|
+
inputAttributes?: React.InputHTMLAttributes<HTMLInputElement>;
|
|
2224
2235
|
}
|
|
2225
2236
|
|
|
2226
2237
|
/**
|
|
@@ -4192,6 +4203,11 @@ export declare interface TextAreaProps extends FormComponentProps, Omit_5<React.
|
|
|
4192
4203
|
* Represents the `autoFocus` HTML attribute that will be applied to the input element of the TextArea. (Defaults to `false`)
|
|
4193
4204
|
*/
|
|
4194
4205
|
autoFocus?: boolean;
|
|
4206
|
+
/**
|
|
4207
|
+
* Sets the HTML attributes of the inner focusable input element.
|
|
4208
|
+
* Attributes which are essential for certain component functionalities cannot be changed.
|
|
4209
|
+
*/
|
|
4210
|
+
inputAttributes?: React.InputHTMLAttributes<HTMLInputElement>;
|
|
4195
4211
|
}
|
|
4196
4212
|
|
|
4197
4213
|
/**
|
|
@@ -4286,6 +4302,11 @@ export declare interface TextBoxProps extends Omit<React_2.InputHTMLAttributes<H
|
|
|
4286
4302
|
* @hidden
|
|
4287
4303
|
*/
|
|
4288
4304
|
unstyled?: InputsClassStructure;
|
|
4305
|
+
/**
|
|
4306
|
+
* Sets the HTML attributes of the inner focusable input element.
|
|
4307
|
+
* Attributes which are essential for certain component functionalities cannot be changed.
|
|
4308
|
+
*/
|
|
4309
|
+
inputAttributes?: React_2.InputHTMLAttributes<HTMLInputElement>;
|
|
4289
4310
|
}
|
|
4290
4311
|
|
|
4291
4312
|
/**
|
package/index.d.ts
CHANGED
|
@@ -1783,6 +1783,11 @@ export declare interface MaskedTextBoxProps extends FormComponentProps {
|
|
|
1783
1783
|
* @hidden
|
|
1784
1784
|
*/
|
|
1785
1785
|
unstyled?: InputsClassStructure;
|
|
1786
|
+
/**
|
|
1787
|
+
* Sets the HTML attributes of the inner focusable input element.
|
|
1788
|
+
* Attributes which are essential for certain component functionalities cannot be changed.
|
|
1789
|
+
*/
|
|
1790
|
+
inputAttributes?: React.InputHTMLAttributes<HTMLInputElement>;
|
|
1786
1791
|
}
|
|
1787
1792
|
|
|
1788
1793
|
/**
|
|
@@ -1846,6 +1851,7 @@ export declare class MaskedTextBoxWithoutContext extends React_2.Component<Maske
|
|
|
1846
1851
|
rounded: PropTypes.Requireable<"small" | "large" | "medium" | "full" | null | undefined>;
|
|
1847
1852
|
fillMode: PropTypes.Requireable<"flat" | "solid" | "outline" | null | undefined>;
|
|
1848
1853
|
autoFocus: PropTypes.Requireable<boolean>;
|
|
1854
|
+
inputAttributes: PropTypes.Requireable<object>;
|
|
1849
1855
|
};
|
|
1850
1856
|
/**
|
|
1851
1857
|
* @hidden
|
|
@@ -2221,6 +2227,11 @@ export declare interface NumericTextBoxProps extends FormComponentProps, Omit<Re
|
|
|
2221
2227
|
* Represents the `autoFocus` HTML attribute that will be applied to the input element of the NumericTextBox. (Defaults to `false`)
|
|
2222
2228
|
*/
|
|
2223
2229
|
autoFocus?: boolean;
|
|
2230
|
+
/**
|
|
2231
|
+
* Sets the HTML attributes of the inner focusable input element.
|
|
2232
|
+
* Attributes which are essential for certain component functionalities cannot be changed.
|
|
2233
|
+
*/
|
|
2234
|
+
inputAttributes?: React.InputHTMLAttributes<HTMLInputElement>;
|
|
2224
2235
|
}
|
|
2225
2236
|
|
|
2226
2237
|
/**
|
|
@@ -4192,6 +4203,11 @@ export declare interface TextAreaProps extends FormComponentProps, Omit_5<React.
|
|
|
4192
4203
|
* Represents the `autoFocus` HTML attribute that will be applied to the input element of the TextArea. (Defaults to `false`)
|
|
4193
4204
|
*/
|
|
4194
4205
|
autoFocus?: boolean;
|
|
4206
|
+
/**
|
|
4207
|
+
* Sets the HTML attributes of the inner focusable input element.
|
|
4208
|
+
* Attributes which are essential for certain component functionalities cannot be changed.
|
|
4209
|
+
*/
|
|
4210
|
+
inputAttributes?: React.InputHTMLAttributes<HTMLInputElement>;
|
|
4195
4211
|
}
|
|
4196
4212
|
|
|
4197
4213
|
/**
|
|
@@ -4286,6 +4302,11 @@ export declare interface TextBoxProps extends Omit<React_2.InputHTMLAttributes<H
|
|
|
4286
4302
|
* @hidden
|
|
4287
4303
|
*/
|
|
4288
4304
|
unstyled?: InputsClassStructure;
|
|
4305
|
+
/**
|
|
4306
|
+
* Sets the HTML attributes of the inner focusable input element.
|
|
4307
|
+
* Attributes which are essential for certain component functionalities cannot be changed.
|
|
4308
|
+
*/
|
|
4309
|
+
inputAttributes?: React_2.InputHTMLAttributes<HTMLInputElement>;
|
|
4289
4310
|
}
|
|
4290
4311
|
|
|
4291
4312
|
/**
|
|
@@ -5,4 +5,4 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
8
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const O=require("react"),e=require("prop-types"),M=require("./masking.service.js"),h=require("./utils.js"),n=require("@progress/kendo-react-common"),E=require("@progress/kendo-react-labels"),V=require("../package-metadata.js");function q(p){const s=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(p){for(const t in p)if(t!=="default"){const i=Object.getOwnPropertyDescriptor(p,t);Object.defineProperty(s,t,i.get?i:{enumerable:!0,get:()=>p[t]})}}return s.default=p,Object.freeze(s)}const u=q(O),l=class l extends u.Component{constructor(s){super(s),this.state={},this._inputId=`k_${this.props.id}`,this._service=new M.MaskingService,this._isPasted=!1,this._selection=[null,null],this._input=null,this.focus=()=>{this._input&&this._input.focus()},this.pasteHandler=t=>{const{selectionStart:i,selectionEnd:a}=t.target;a!==i&&(this._isPasted=!0,this._selection=[i||0,a||0])},this.onChangeHandler=t=>{const i=t.currentTarget,a=i.value,o=this._selection[0]||0,r=this._selection[1]||0;if(!this.props.mask){this._isPasted=!1,this._selection=[null,null],this.triggerOnChange(a,t);return}const c=this.value;let d;if(this._isPasted){this._isPasted=!1;const g=c.length-r,f=a.length-g;d=this._service.maskInRange(a.slice(o,f),c,o,r)}else d=this._service.maskInput(a,c,i.selectionStart||0);this._selection=[d.selection,d.selection],this.triggerOnChange(d.value,t)},this.focusHandler=t=>{this.state.focused||(this.setState({focused:!0}),this.props.onFocus&&this.props.onFocus.call(void 0,{target:this,syntheticEvent:t,nativeEvent:t.nativeEvent}))},this.blurHandler=t=>{this.state.focused&&(this.setState({focused:!1}),this.props.onBlur&&this.props.onBlur.call(void 0,{target:this,syntheticEvent:t,nativeEvent:t.nativeEvent}))},this.setValidity=()=>{this.element&&this.element.setCustomValidity(this.validity.valid?"":this.props.validationMessage||"")},n.validatePackage(V.packageMetadata)}get element(){return this._input}get value(){return this._valueDuringOnChange!==void 0?this._valueDuringOnChange:this.props.value!==void 0?this.props.value:this.state.value!==void 0?this.state.value:this.props.defaultValue!==void 0?this.props.defaultValue:""}get rawValue(){return this._service.rawValue(this.value)}get validity(){const s=this.value,t=this._service.validationValue(s),i=this.props.validationMessage!==void 0,a=this.props.valid!==void 0?this.props.valid:(!this.required||!!t)&&(!this.props.maskValidation||!this.props.prompt||s.indexOf(this.props.prompt)===-1);return{customError:i,valid:a,valueMissing:!t}}get validityStyles(){return this.props.validityStyles!==void 0?this.props.validityStyles:l.defaultProps.validityStyles}get required(){return this.props.required!==void 0?this.props.required:!1}get name(){return this.props.name}componentDidUpdate(s,t){if(this.element&&this.state.focused&&t.focused){let[i,a]=this._selection;const o=s.selection,r=this.props.selection;(!o&&r||o&&r&&(o.start!==r.start||o.end!==r.end))&&(i=r.start,a=r.end),i!==null&&a!==null&&this.element.setSelectionRange(i,a)}h.maskingChanged(s,this.props)&&this.updateService(),this.setValidity()}componentDidMount(){this.updateService(),this.setValidity()}render(){const{size:s=l.defaultProps.size,fillMode:t=l.defaultProps.fillMode,rounded:i=l.defaultProps.rounded,autoFocus:a=l.defaultProps.autoFocus,prefix:o=l.defaultProps.prefix,suffix:r=l.defaultProps.suffix,inputAttributes:c,unstyled:d,className:g}=this.props,f=this.props.id||this._inputId,m=!this.validityStyles||this.validity.valid,b=this.props.style||{},y=d&&d.uMaskedTextBox,[_]=n.useCustomComponent(o),[k]=n.useCustomComponent(r),x=u.createElement("span",{dir:this.props.dir,className:n.classNames(n.uMaskedTextBox.wrapper({c:y,invalid:!m,disabled:this.props.disabled,size:s,fillMode:t,rounded:i}),g),style:this.props.label?b:{width:this.props.width,...b}},u.createElement(_,null),u.createElement("input",{type:"text",autoComplete:"off",autoCorrect:"off",autoCapitalize:"off",autoFocus:a,spellCheck:!1,className:n.classNames(n.uMaskedTextBox.inputInner({c:y})),value:this.value,id:f,"aria-labelledby":this.props.ariaLabelledBy,"aria-describedby":this.props.ariaDescribedBy,"aria-placeholder":this.props.mask,"aria-required":this.props.required,name:this.props.name,tabIndex:n.getTabIndex(this.props.tabIndex,this.props.disabled,!0),accessKey:this.props.accessKey,title:this.props.title,disabled:this.props.disabled||void 0,readOnly:this.props.readonly||void 0,placeholder:this.props.placeholder,ref:S=>this._input=S,onChange:this.onChangeHandler,onPaste:this.pasteHandler,onFocus:this.focusHandler,onBlur:this.blurHandler,onDragStart:h.returnFalse,onDrop:h.returnFalse,...c}),u.createElement(k,null));return this.props.label?u.createElement(E.FloatingLabel,{label:this.props.label,editorId:f,editorValue:this.value,editorValid:m,editorDisabled:this.props.disabled,editorPlaceholder:this.props.placeholder,children:x,style:{width:this.props.width},dir:this.props.dir}):x}triggerOnChange(s,t){if(this.setState({value:s}),this.props.onChange){this._valueDuringOnChange=s;const i={syntheticEvent:t,nativeEvent:t.nativeEvent,selectionStart:this._selection[0],selectionEnd:this._selection[1],target:this,value:this.value};this.props.onChange.call(void 0,i),this._valueDuringOnChange=void 0}}updateService(s){const t=Object.assign({includeLiterals:this.props.includeLiterals,mask:this.props.mask,prompt:this.props.prompt,promptPlaceholder:this.props.promptPlaceholder,rules:this.rules},s);this._service.update(t)}get rules(){return Object.assign({},h.defaultRules,this.props.rules)}};l.displayName="MaskedTextBox",l.propTypes={value:e.string,defaultValue:e.string,placeholder:e.string,title:e.string,dir:e.string,id:e.string,style:e.object,className:e.string,prefix:e.any,suffix:e.any,ariaLabelledBy:e.string,ariaDescribedBy:e.string,width:e.oneOfType([e.string,e.number]),tabIndex:e.number,accessKey:e.string,disabled:e.bool,readonly:e.bool,prompt:e.string,promptPlaceholder:e.string,includeLiterals:e.bool,maskValidation:e.bool,mask:e.string,rules:function(s,t,i){const a=s.rules;return a!==void 0&&!Object.entries(a).some(r=>typeof r!="string"||!(a[r]instanceof RegExp))?new Error("Invalid prop `"+t+"` supplied to `"+i+"`. Validation failed."):null},selection:e.shape({start:e.number.isRequired,end:e.number.isRequired}),name:e.string,label:e.string,validationMessage:e.string,required:e.bool,valid:e.bool,validityStyles:e.bool,onChange:e.func,size:e.oneOf([null,"small","medium","large"]),rounded:e.oneOf([null,"small","medium","large","full"]),fillMode:e.oneOf([null,"solid","flat","outline"]),autoFocus:e.bool,inputAttributes:e.object},l.defaultProps={prompt:"_",promptPlaceholder:" ",includeLiterals:!1,maskValidation:!0,rules:h.defaultRules,validityStyles:!0,prefix:s=>null,suffix:s=>null,size:"medium",rounded:"medium",fillMode:"solid",autoFocus:!1};let v=l;const C=n.createPropsContext(),P=n.withIdHOC(n.withPropsContext(C,n.withUnstyledHOC(v)));P.displayName="KendoReactMaskedTextBox";exports.MaskedTextBox=P;exports.MaskedTextBoxPropsContext=C;exports.MaskedTextBoxWithoutContext=v;
|
|
@@ -6,16 +6,16 @@
|
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
8
|
"use client";
|
|
9
|
-
import * as
|
|
9
|
+
import * as p from "react";
|
|
10
10
|
import e from "prop-types";
|
|
11
|
-
import { MaskingService as
|
|
12
|
-
import { defaultRules as
|
|
13
|
-
import { validatePackage as
|
|
14
|
-
import { FloatingLabel as
|
|
15
|
-
import { packageMetadata as
|
|
16
|
-
const l = class l extends
|
|
11
|
+
import { MaskingService as E } from "./masking.service.mjs";
|
|
12
|
+
import { defaultRules as y, maskingChanged as O, returnFalse as b } from "./utils.mjs";
|
|
13
|
+
import { validatePackage as V, useCustomComponent as P, classNames as _, uMaskedTextBox as C, getTabIndex as w, createPropsContext as I, withIdHOC as M, withPropsContext as D, withUnstyledHOC as H } from "@progress/kendo-react-common";
|
|
14
|
+
import { FloatingLabel as q } from "@progress/kendo-react-labels";
|
|
15
|
+
import { packageMetadata as B } from "../package-metadata.mjs";
|
|
16
|
+
const l = class l extends p.Component {
|
|
17
17
|
constructor(i) {
|
|
18
|
-
super(i), this.state = {}, this._inputId = `k_${this.props.id}`, this._service = new
|
|
18
|
+
super(i), this.state = {}, this._inputId = `k_${this.props.id}`, this._service = new E(), this._isPasted = !1, this._selection = [null, null], this._input = null, this.focus = () => {
|
|
19
19
|
this._input && this._input.focus();
|
|
20
20
|
}, this.pasteHandler = (t) => {
|
|
21
21
|
const { selectionStart: r, selectionEnd: s } = t.target;
|
|
@@ -26,14 +26,14 @@ const l = class l extends d.Component {
|
|
|
26
26
|
this._isPasted = !1, this._selection = [null, null], this.triggerOnChange(s, t);
|
|
27
27
|
return;
|
|
28
28
|
}
|
|
29
|
-
const
|
|
29
|
+
const d = this.value;
|
|
30
30
|
let n;
|
|
31
31
|
if (this._isPasted) {
|
|
32
32
|
this._isPasted = !1;
|
|
33
|
-
const
|
|
34
|
-
n = this._service.maskInRange(s.slice(o,
|
|
33
|
+
const h = d.length - a, u = s.length - h;
|
|
34
|
+
n = this._service.maskInRange(s.slice(o, u), d, o, a);
|
|
35
35
|
} else
|
|
36
|
-
n = this._service.maskInput(s,
|
|
36
|
+
n = this._service.maskInput(s, d, r.selectionStart || 0);
|
|
37
37
|
this._selection = [n.selection, n.selection], this.triggerOnChange(n.value, t);
|
|
38
38
|
}, this.focusHandler = (t) => {
|
|
39
39
|
this.state.focused || (this.setState({ focused: !0 }), this.props.onFocus && this.props.onFocus.call(void 0, {
|
|
@@ -49,7 +49,7 @@ const l = class l extends d.Component {
|
|
|
49
49
|
}));
|
|
50
50
|
}, this.setValidity = () => {
|
|
51
51
|
this.element && this.element.setCustomValidity(this.validity.valid ? "" : this.props.validationMessage || "");
|
|
52
|
-
},
|
|
52
|
+
}, V(B);
|
|
53
53
|
}
|
|
54
54
|
/**
|
|
55
55
|
* Gets the element of the MaskedTextBox.
|
|
@@ -135,7 +135,7 @@ const l = class l extends d.Component {
|
|
|
135
135
|
const o = i.selection, a = this.props.selection;
|
|
136
136
|
(!o && a || o && a && (o.start !== a.start || o.end !== a.end)) && (r = a.start, s = a.end), r !== null && s !== null && this.element.setSelectionRange(r, s);
|
|
137
137
|
}
|
|
138
|
-
|
|
138
|
+
O(i, this.props) && this.updateService(), this.setValidity();
|
|
139
139
|
}
|
|
140
140
|
/**
|
|
141
141
|
* @hidden
|
|
@@ -152,30 +152,30 @@ const l = class l extends d.Component {
|
|
|
152
152
|
fillMode: t = l.defaultProps.fillMode,
|
|
153
153
|
rounded: r = l.defaultProps.rounded,
|
|
154
154
|
autoFocus: s = l.defaultProps.autoFocus,
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
} = this.props, [
|
|
155
|
+
prefix: o = l.defaultProps.prefix,
|
|
156
|
+
suffix: a = l.defaultProps.suffix,
|
|
157
|
+
inputAttributes: d,
|
|
158
|
+
unstyled: n,
|
|
159
|
+
className: h
|
|
160
|
+
} = this.props, u = this.props.id || this._inputId, f = !this.validityStyles || this.validity.valid, v = this.props.style || {}, m = n && n.uMaskedTextBox, [x] = P(o), [S] = P(a), g = /* @__PURE__ */ p.createElement(
|
|
161
161
|
"span",
|
|
162
162
|
{
|
|
163
163
|
dir: this.props.dir,
|
|
164
|
-
className:
|
|
165
|
-
|
|
166
|
-
c:
|
|
167
|
-
invalid: !
|
|
164
|
+
className: _(
|
|
165
|
+
C.wrapper({
|
|
166
|
+
c: m,
|
|
167
|
+
invalid: !f,
|
|
168
168
|
disabled: this.props.disabled,
|
|
169
169
|
size: i,
|
|
170
170
|
fillMode: t,
|
|
171
171
|
rounded: r
|
|
172
172
|
}),
|
|
173
|
-
|
|
173
|
+
h
|
|
174
174
|
),
|
|
175
|
-
style: this.props.label ?
|
|
175
|
+
style: this.props.label ? v : { width: this.props.width, ...v }
|
|
176
176
|
},
|
|
177
|
-
/* @__PURE__ */
|
|
178
|
-
/* @__PURE__ */
|
|
177
|
+
/* @__PURE__ */ p.createElement(x, null),
|
|
178
|
+
/* @__PURE__ */ p.createElement(
|
|
179
179
|
"input",
|
|
180
180
|
{
|
|
181
181
|
type: "text",
|
|
@@ -184,45 +184,46 @@ const l = class l extends d.Component {
|
|
|
184
184
|
autoCapitalize: "off",
|
|
185
185
|
autoFocus: s,
|
|
186
186
|
spellCheck: !1,
|
|
187
|
-
className:
|
|
187
|
+
className: _(C.inputInner({ c: m })),
|
|
188
188
|
value: this.value,
|
|
189
|
-
id:
|
|
189
|
+
id: u,
|
|
190
190
|
"aria-labelledby": this.props.ariaLabelledBy,
|
|
191
191
|
"aria-describedby": this.props.ariaDescribedBy,
|
|
192
192
|
"aria-placeholder": this.props.mask,
|
|
193
193
|
"aria-required": this.props.required,
|
|
194
194
|
name: this.props.name,
|
|
195
|
-
tabIndex:
|
|
195
|
+
tabIndex: w(this.props.tabIndex, this.props.disabled, !0),
|
|
196
196
|
accessKey: this.props.accessKey,
|
|
197
197
|
title: this.props.title,
|
|
198
198
|
disabled: this.props.disabled || void 0,
|
|
199
199
|
readOnly: this.props.readonly || void 0,
|
|
200
200
|
placeholder: this.props.placeholder,
|
|
201
|
-
ref: (
|
|
201
|
+
ref: (k) => this._input = k,
|
|
202
202
|
onChange: this.onChangeHandler,
|
|
203
203
|
onPaste: this.pasteHandler,
|
|
204
204
|
onFocus: this.focusHandler,
|
|
205
205
|
onBlur: this.blurHandler,
|
|
206
|
-
onDragStart:
|
|
207
|
-
onDrop:
|
|
206
|
+
onDragStart: b,
|
|
207
|
+
onDrop: b,
|
|
208
|
+
...d
|
|
208
209
|
}
|
|
209
210
|
),
|
|
210
|
-
/* @__PURE__ */
|
|
211
|
+
/* @__PURE__ */ p.createElement(S, null)
|
|
211
212
|
);
|
|
212
|
-
return this.props.label ? /* @__PURE__ */
|
|
213
|
-
|
|
213
|
+
return this.props.label ? /* @__PURE__ */ p.createElement(
|
|
214
|
+
q,
|
|
214
215
|
{
|
|
215
216
|
label: this.props.label,
|
|
216
|
-
editorId:
|
|
217
|
+
editorId: u,
|
|
217
218
|
editorValue: this.value,
|
|
218
|
-
editorValid:
|
|
219
|
+
editorValid: f,
|
|
219
220
|
editorDisabled: this.props.disabled,
|
|
220
221
|
editorPlaceholder: this.props.placeholder,
|
|
221
|
-
children:
|
|
222
|
+
children: g,
|
|
222
223
|
style: { width: this.props.width },
|
|
223
224
|
dir: this.props.dir
|
|
224
225
|
}
|
|
225
|
-
) :
|
|
226
|
+
) : g;
|
|
226
227
|
}
|
|
227
228
|
triggerOnChange(i, t) {
|
|
228
229
|
if (this.setState({
|
|
@@ -254,7 +255,7 @@ const l = class l extends d.Component {
|
|
|
254
255
|
this._service.update(t);
|
|
255
256
|
}
|
|
256
257
|
get rules() {
|
|
257
|
-
return Object.assign({},
|
|
258
|
+
return Object.assign({}, y, this.props.rules);
|
|
258
259
|
}
|
|
259
260
|
};
|
|
260
261
|
l.displayName = "MaskedTextBox", l.propTypes = {
|
|
@@ -300,13 +301,14 @@ l.displayName = "MaskedTextBox", l.propTypes = {
|
|
|
300
301
|
size: e.oneOf([null, "small", "medium", "large"]),
|
|
301
302
|
rounded: e.oneOf([null, "small", "medium", "large", "full"]),
|
|
302
303
|
fillMode: e.oneOf([null, "solid", "flat", "outline"]),
|
|
303
|
-
autoFocus: e.bool
|
|
304
|
+
autoFocus: e.bool,
|
|
305
|
+
inputAttributes: e.object
|
|
304
306
|
}, l.defaultProps = {
|
|
305
307
|
prompt: "_",
|
|
306
308
|
promptPlaceholder: " ",
|
|
307
309
|
includeLiterals: !1,
|
|
308
310
|
maskValidation: !0,
|
|
309
|
-
rules:
|
|
311
|
+
rules: y,
|
|
310
312
|
validityStyles: !0,
|
|
311
313
|
prefix: (i) => null,
|
|
312
314
|
suffix: (i) => null,
|
|
@@ -316,15 +318,15 @@ l.displayName = "MaskedTextBox", l.propTypes = {
|
|
|
316
318
|
autoFocus: !1
|
|
317
319
|
};
|
|
318
320
|
let c = l;
|
|
319
|
-
const
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
321
|
+
const F = I(), R = M(
|
|
322
|
+
D(
|
|
323
|
+
F,
|
|
324
|
+
H(c)
|
|
323
325
|
)
|
|
324
326
|
);
|
|
325
|
-
|
|
327
|
+
R.displayName = "KendoReactMaskedTextBox";
|
|
326
328
|
export {
|
|
327
|
-
|
|
328
|
-
|
|
329
|
+
R as MaskedTextBox,
|
|
330
|
+
F as MaskedTextBoxPropsContext,
|
|
329
331
|
c as MaskedTextBoxWithoutContext
|
|
330
332
|
};
|
|
@@ -5,4 +5,4 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
8
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const we=require("react"),t=require("prop-types"),fe=require("@progress/kendo-react-intl"),o=require("@progress/kendo-react-common"),be=require("@progress/kendo-svg-icons"),Ke=require("@progress/kendo-react-labels"),$e=require("../package-metadata.js"),g=require("../messages/index.js"),s=require("./utils/index.js"),pe=require("@progress/kendo-react-buttons");function Ue(m){const L=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(m){for(const v in m)if(v!=="default"){const N=Object.getOwnPropertyDescriptor(m,v);Object.defineProperty(L,v,N.get?N:{enumerable:!0,get:()=>m[v]})}}return L.default=m,Object.freeze(L)}const n=Ue(we),We="Please enter a valid value!",ge=o.createPropsContext(),Q=n.forwardRef((m,L)=>{o.validatePackage($e.packageMetadata);const v=o.usePropsContext(ge,m),{className:N,value:k,defaultValue:ve,format:u,width:X,tabIndex:ye,accessKey:Ve,title:ke,placeholder:Z,min:f,max:b,dir:ee,name:_,label:R,id:Ce,ariaDescribedBy:Se,ariaLabelledBy:Ee,ariaLabel:xe,inputType:Oe,readOnly:C,validationMessage:G,children:Ie,style:te,inputStyle:he,valid:H,step:S=i.step,spinners:Le=i.spinners,disabled:c=i.disabled,required:q=i.required,validityStyles:ne=i.validityStyles,prefix:Pe=i.prefix,suffix:De=i.suffix,onChange:I=i.onChange,onFocus:re=i.onFocus,onBlur:ae=i.onBlur,rangeOnEnter:ue=i.rangeOnEnter,size:w=i.size,rounded:K=i.rounded,fillMode:B=i.fillMode,autoFocus:Ne=i.autoFocus,inputAttributes:Re,...se}=v,qe=o.useId(),le=Ce||qe,l=fe.useInternationalization(),M=fe.useLocalization(),a=n.useRef(null),T=n.useRef(),[Be,h]=n.useState(!1),d=n.useRef(s.getInitialState()),F=n.useRef(!1),$=n.useRef(),P=n.useRef(ve),D=s.formatValue(d.current.focused&&!c?d.current.currentLooseValue:s.getStateOrPropsValue(k,P.current),u,l);$.current=D;const[Me]=o.useCustomComponent(Pe),[Te]=o.useCustomComponent(De);n.useEffect(()=>{a.current&&a.current.setCustomValidity&&a.current.setCustomValidity(A().valid?"":G||We)});const oe=n.useCallback(()=>{a.current&&a.current.focus()},[]),j=n.useCallback(()=>T.current!==void 0?T.current:s.getStateOrPropsValue(k,P.current),[k]),ce=n.useCallback(()=>_,[_]),z=n.useCallback(()=>q,[q]),A=n.useCallback(()=>{const r=G!==void 0,e=j(),x=H!==void 0?H:!d.current.valueIsOutOfRange&&(!z()||e!=null);return{customError:r,valid:x,valueMissing:e==null}},[G,H,j,z]),U=n.useCallback(()=>ne,[ne]),ie=n.useCallback(()=>v,[v]),E=n.useCallback(()=>{const r={element:a.current,focus:oe};return Object.defineProperty(r,"name",{get:ce}),Object.defineProperty(r,"value",{get:j}),Object.defineProperty(r,"validity",{get:A}),Object.defineProperty(r,"validityStyles",{get:U}),Object.defineProperty(r,"required",{get:z}),Object.defineProperty(r,"props",{get:ie}),r},[ce,j,A,U,z,oe,ie]);n.useImperativeHandle(L,E);const y=n.useCallback(()=>({eventValue:s.getStateOrPropsValue(k,P.current),prevLooseValue:$.current,currentLooseValue:a.current.value,selectionStart:a.current.selectionStart,selectionEnd:a.current.selectionEnd,decimalSelect:!1,valueIsCorrected:!1,valueIsOutOfRange:!1,isPaste:F.current,focused:d.current.focused}),[k]),V=n.useCallback((r,e)=>{if(c)return;T.current=e.eventValue,P.current=e.eventValue;const x=s.formatValue(s.rangeValue(e.eventValue,f,b),u,l),p=s.rangeValue(l.parseNumber(x,u),f,b);p!==e.eventValue&&(e.valueIsOutOfRange=!0,e.eventValue=p,P.current=p),k!==e.eventValue&&o.dispatchEvent(I,r,E(),{value:e.eventValue}),T.current=void 0,d.current=e,h(J=>!J)},[k,I,c,h,E]),Fe=n.useCallback(r=>{const e=y();F.current=!1,V(r,s.sanitizeNumber(e,u,l))},[u,I,l,V,y]),je=n.useCallback(r=>{let e=y();const x=l.parseNumber(String(e.currentLooseValue),u);if(e.selectionEnd>e.selectionStart&&e.selectionEnd-e.selectionStart===String(e.currentLooseValue).length){const p=l.numberSymbols(),O=p&&r.key===p.minusSign,J=p&&r.key===p.decimal;F.current=!O&&!J;return}switch(r.keyCode){case 38:s.increaseValue(x,e,S,f,b,u,l);break;case 40:s.decreaseValue(x,e,S,f,b,u,l);break;case 13:{if(ue===!1)return;const p=s.formatValue(s.rangeValue(x,f,b),u,l),O=s.rangeValue(l.parseNumber(p,u),f,b);e.eventValue=O,e.currentLooseValue=s.formatValue(O,u,l),e.selectionStart=e.selectionEnd=e.currentLooseValue.length;break}case 110:{const p=a.current,O=l.numberSymbols();p&&(e.currentLooseValue=e.currentLooseValue.slice(0,e.selectionStart)+O.decimal+e.currentLooseValue.slice(e.selectionEnd),e.selectionStart=e.selectionEnd=e.selectionStart+1,e=s.sanitizeNumber(e,u,l));break}default:return}r.preventDefault(),V(r,e)},[u,f,b,S,I,ue,V,y]),ze=n.useCallback(()=>{F.current=!0},[]),W=n.useCallback(r=>{if(C||c)return;const e=y();s.increaseValue(l.parseNumber(String(e.currentLooseValue),u),e,S,f,b,u,l),V(r,e)},[u,f,b,S,I,C,c,V,y]),Y=n.useCallback(r=>{if(C||c)return;const e=y();s.decreaseValue(l.parseNumber(String(e.currentLooseValue),u),e,S,f,b,u,l),V(r,e)},[u,f,b,S,I,C,c,V,y]),Ae=n.useCallback(r=>{const e=o.getActiveElement(document);!document||e!==a.current||!a.current||C||c||(r.nativeEvent.deltaY<0&&W(r),r.nativeEvent.deltaY>0&&Y(r))},[W,Y,c,C]),_e=n.useCallback(r=>{d.current.currentLooseValue=$.current,d.current.focused=!0,o.dispatchEvent(re,r,E(),{}),h(e=>!e)},[re,h,E]),Ge=n.useCallback(r=>{d.current=s.getInitialState(),o.dispatchEvent(ae,r,E(),{}),h(e=>!e)},[ae,h,E]),He=n.useCallback(r=>{if(document&&a.current){const e=o.getActiveElement(document);r.preventDefault(),e!==a.current&&a.current.focus()}},[]);o.useIsomorphicLayoutEffect(()=>{a.current&&a.current.type!=="number"&&d.current.selectionStart!==void 0&&d.current.selectionEnd!==void 0&&(a.current.selectionStart=d.current.selectionStart,a.current.selectionEnd=d.current.selectionEnd,d.current.selectionStart=void 0,d.current.selectionEnd=void 0)},[Be]);const de=!U()||A().valid,me=n.createElement("span",{dir:ee,style:R?te:{width:X,...te},className:o.classNames("k-input","k-numerictextbox",{[`k-input-${o.kendoThemeMaps.sizeMap[w]||w}`]:w,[`k-input-${B}`]:B,[`k-rounded-${o.kendoThemeMaps.roundedMap[K]||K}`]:K,"k-invalid":!de,"k-required":q,"k-disabled":c},N),"aria-disabled":c?"true":void 0,...R?{}:se},n.createElement(Me,null),n.createElement("input",{role:"spinbutton",value:D===null?"":D,tabIndex:o.getTabIndex(ye,c),accessKey:Ve,disabled:c,title:ke,"aria-disabled":c?"true":void 0,"aria-valuemin":f,"aria-valuemax":b,"aria-label":xe,"aria-labelledby":Ee,"aria-describedby":Se,"aria-required":q,placeholder:Z,spellCheck:!1,autoComplete:"off",autoCorrect:"off",autoFocus:Ne,type:Oe||"tel",className:"k-input-inner",id:le,name:_,readOnly:C,style:he,onChange:Fe,onFocus:_e,onBlur:Ge,onKeyDown:je,onPaste:ze,onWheel:Ae,ref:a,...Re}),n.createElement(Te,null),Ie,Le&&n.createElement("span",{className:"k-input-spinner k-spin-button",onMouseDown:He},n.createElement(pe.Button,{tabIndex:-1,type:"button",icon:"caret-alt-up",svgIcon:be.caretAltUpIcon,rounded:null,fillMode:B,className:"k-spinner-increase","aria-label":M.toLanguageString(g.numericIncreaseValue,g.messages[g.numericIncreaseValue]),title:M.toLanguageString(g.numericIncreaseValue,g.messages[g.numericIncreaseValue]),onClick:W}),n.createElement(pe.Button,{tabIndex:-1,type:"button",icon:"caret-alt-down",svgIcon:be.caretAltDownIcon,rounded:null,fillMode:B,className:"k-spinner-decrease","aria-label":M.toLanguageString(g.numericDecreaseValue,g.messages[g.numericDecreaseValue]),title:M.toLanguageString(g.numericDecreaseValue,g.messages[g.numericDecreaseValue]),onClick:Y})));return R?n.createElement(Ke.FloatingLabel,{label:R,editorId:le,editorValue:D===null?"":D,editorValid:de,editorDisabled:c,editorPlaceholder:Z,children:me,style:{width:X},dir:ee,...se}):me});Q.propTypes={value:t.number,defaultValue:t.number,step:t.number,format:t.oneOfType([t.string,t.shape({style:t.oneOf(["decimal","currency","percent","scientific","accounting"]),currency:t.string,currencyDisplay:t.oneOf(["symbol","code","name"]),useGrouping:t.bool,minimumIntegerDigits:t.number,minimumFractionDigits:t.number,maximumFractionDigits:t.number})]),width:t.oneOfType([t.string,t.number]),tabIndex:t.number,accessKey:t.string,title:t.string,placeholder:t.string,min:t.number,max:t.number,spinners:t.bool,disabled:t.bool,readOnly:t.bool,dir:t.string,name:t.string,label:t.string,validationMessage:t.string,required:t.bool,id:t.string,rangeOnEnter:t.bool,ariaLabelledBy:t.string,ariaDescribedBy:t.string,ariaLabel:t.string,onChange:t.func,onFocus:t.func,onBlur:t.func,size:t.oneOf([null,"small","medium","large"]),rounded:t.oneOf([null,"small","medium","large","full"]),fillMode:t.oneOf([null,"solid","flat","outline"]),inputAttributes:t.object};const i={prefix:m=>null,suffix:m=>null,step:1,spinners:!0,disabled:!1,required:!1,validityStyles:!0,rangeOnEnter:!0,autoFocus:!1,onChange:m=>{},onFocus:m=>{},onBlur:m=>{},size:"medium",rounded:"medium",fillMode:"solid"};Q.displayName="KendoNumericTextBox";exports.NumericTextBox=Q;exports.NumericTextBoxPropsContext=ge;
|