@progress/kendo-react-form 11.4.0-develop.3 → 11.4.0-develop.5
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/FieldWrapper.js +1 -1
- package/FieldWrapper.mjs +32 -13
- package/FormElement.js +1 -1
- package/FormElement.mjs +69 -26
- package/FormFieldSet.js +8 -0
- package/FormFieldSet.mjs +78 -0
- package/FormSeparator.js +8 -0
- package/FormSeparator.mjs +46 -0
- package/README.md +16 -0
- package/dist/cdn/js/kendo-react-form.js +1 -1
- package/index.d.mts +157 -2
- package/index.d.ts +157 -2
- package/index.js +1 -1
- package/index.mjs +12 -8
- package/package-metadata.js +1 -1
- package/package-metadata.mjs +2 -2
- package/package.json +3 -3
- package/utils.js +8 -0
- package/utils.mjs +85 -0
package/FieldWrapper.js
CHANGED
|
@@ -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 strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const R=require("react"),d=require("@progress/kendo-react-common"),f=require("./utils.js");function F(e){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const s in e)if(s!=="default"){const o=Object.getOwnPropertyDescriptor(e,s);Object.defineProperty(n,s,o.get?o:{enumerable:!0,get:()=>e[s]})}}return n.default=e,Object.freeze(n)}const t=F(R),S=e=>{const{className:n,style:s,dir:o,colSpan:i,children:w}=e,a=t.useRef(null),C=d.useUnstyled(),p=e.unstyled||C,m=p&&p.uForm,[b,y]=t.useState(void 0),l=t.useRef(null);t.useEffect(()=>{a.current&&(l.current=a.current.closest("form"))},[]),t.useEffect(()=>{let c;const r=l==null?void 0:l.current,v=()=>{let u=0;if(r?u=f.innerWidth(r):typeof window!="undefined"&&(u=window.innerWidth),i!==void 0){const O=f.calculateColSpan(i,u);y(f.generateColSpanClass(O))}else y(void 0)};return v(),r&&typeof window!="undefined"&&"ResizeObserver"in window&&(c=new ResizeObserver(v),c.observe(r)),()=>{c&&r&&c.unobserve(r)}},[i]);const g=t.useMemo(()=>d.classNames(d.uForm.field({c:m,isRtl:o==="rtl"}),b,n),[m,n,o,b]);return t.createElement("div",{ref:a,className:g,style:s},w)};S.displayName="KendoReactFieldWrapper";exports.FieldWrapper=S;
|
package/FieldWrapper.mjs
CHANGED
|
@@ -5,22 +5,41 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
import * as
|
|
9
|
-
import { useUnstyled as
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
8
|
+
import * as e from "react";
|
|
9
|
+
import { useUnstyled as R, classNames as b, uForm as F } from "@progress/kendo-react-common";
|
|
10
|
+
import { innerWidth as N, calculateColSpan as W, generateColSpanClass as h } from "./utils.mjs";
|
|
11
|
+
const E = (i) => {
|
|
12
|
+
const { className: a, style: v, dir: c, colSpan: l, children: w } = i, o = e.useRef(null), C = R(), d = i.unstyled || C, u = d && d.uForm, [f, m] = e.useState(void 0), n = e.useRef(null);
|
|
13
|
+
e.useEffect(() => {
|
|
14
|
+
o.current && (n.current = o.current.closest("form"));
|
|
15
|
+
}, []), e.useEffect(() => {
|
|
16
|
+
let t;
|
|
17
|
+
const s = n == null ? void 0 : n.current, p = () => {
|
|
18
|
+
let r = 0;
|
|
19
|
+
if (s ? r = N(s) : typeof window != "undefined" && (r = window.innerWidth), l !== void 0) {
|
|
20
|
+
const S = W(l, r);
|
|
21
|
+
m(h(S));
|
|
22
|
+
} else
|
|
23
|
+
m(void 0);
|
|
24
|
+
};
|
|
25
|
+
return p(), s && typeof window != "undefined" && "ResizeObserver" in window && (t = new ResizeObserver(p), t.observe(s)), () => {
|
|
26
|
+
t && s && t.unobserve(s);
|
|
27
|
+
};
|
|
28
|
+
}, [l]);
|
|
29
|
+
const y = e.useMemo(
|
|
30
|
+
() => b(
|
|
31
|
+
F.field({
|
|
32
|
+
c: u,
|
|
33
|
+
isRtl: c === "rtl"
|
|
16
34
|
}),
|
|
17
|
-
|
|
35
|
+
f,
|
|
36
|
+
a
|
|
18
37
|
),
|
|
19
|
-
[
|
|
38
|
+
[u, a, c, f]
|
|
20
39
|
);
|
|
21
|
-
return /* @__PURE__ */
|
|
40
|
+
return /* @__PURE__ */ e.createElement("div", { ref: o, className: y, style: v }, w);
|
|
22
41
|
};
|
|
23
|
-
|
|
42
|
+
E.displayName = "KendoReactFieldWrapper";
|
|
24
43
|
export {
|
|
25
|
-
|
|
44
|
+
E as FieldWrapper
|
|
26
45
|
};
|
package/FormElement.js
CHANGED
|
@@ -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 strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const G=require("react"),u=require("@progress/kendo-react-common"),_=require("./FormContext.js"),s=require("./utils.js");function M(t){const o=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const r in t)if(r!=="default"){const n=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(o,r,n.get?n:{enumerable:!0,get:()=>t[r]})}}return o.default=t,Object.freeze(o)}const e=M(G),a={rows:"0px",cols:"32px"},N=e.forwardRef((t,o)=>{const r={size:"medium",...t},n=e.useRef(null),S=e.useRef(null);e.useImperativeHandle(S,()=>({element:n.current,props:r})),e.useImperativeHandle(o,()=>S.current);const c=e.useContext(_.FormContext),{className:F,style:j,horizontal:g,size:R,cols:l,gutters:i=a,...O}=r,p=u.useUnstyled(),v=p&&p.uForm,[h,w]=e.useState(void 0),[T,b]=e.useState(void 0),C=e.useMemo(()=>{if(g)return"horizontal";if(g===!1)return"vertical"},[g]),z=e.useMemo(()=>u.classNames(u.uForm.form({c:v,size:R,orientation:C}),F),[F,v,C,R]);return e.useEffect(()=>{if(!l&&!i){w(void 0);return}if(!i){b(void 0);return}const E=()=>{let f=0;if(n.current?f=s.innerWidth(n.current):typeof window!="undefined"&&(f=window.innerWidth),l){const y=s.calculateColumns(l,f);w(s.generateColumnClass(y))}if(i){const y=s.calculateGutters(i,f);b(y?{gap:s.generateGuttersStyling(y,a)}:{gap:s.generateGuttersStyling(a,a)})}};E();let m;const d=n.current;return d&&typeof window!="undefined"&&"ResizeObserver"in window&&(m=new ResizeObserver(E),m.observe(d)),()=>{m&&d&&m.unobserve(d)}},[l,i]),e.createElement("form",{ref:n,...O,id:t.id||(c?c.id:void 0),style:t.style,className:z,onSubmit:c?c.onSubmit:void 0},l?e.createElement("div",{className:u.classNames(u.uForm.formLayout({c:v}),h),style:T},t.children):t.children)});N.displayName="KendoReactFormElement";exports.DEFAULT_FORM_GUTTERS=a;exports.FormElement=N;
|
package/FormElement.mjs
CHANGED
|
@@ -6,44 +6,87 @@
|
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
8
|
import * as e from "react";
|
|
9
|
-
import { useUnstyled as
|
|
10
|
-
import { FormContext as
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
import { useUnstyled as L, classNames as g, uForm as h } from "@progress/kendo-react-common";
|
|
10
|
+
import { FormContext as M } from "./FormContext.mjs";
|
|
11
|
+
import { innerWidth as O, calculateColumns as T, generateColumnClass as U, calculateGutters as W, generateGuttersStyling as E } from "./utils.mjs";
|
|
12
|
+
const m = {
|
|
13
|
+
rows: "0px",
|
|
14
|
+
cols: "32px"
|
|
15
|
+
}, A = e.forwardRef((t, F) => {
|
|
16
|
+
const y = {
|
|
13
17
|
size: "medium",
|
|
14
18
|
...t
|
|
15
|
-
},
|
|
16
|
-
e.useImperativeHandle(
|
|
17
|
-
const
|
|
18
|
-
if (
|
|
19
|
+
}, s = e.useRef(null), v = e.useRef(null);
|
|
20
|
+
e.useImperativeHandle(v, () => ({ element: s.current, props: y })), e.useImperativeHandle(F, () => v.current);
|
|
21
|
+
const n = e.useContext(M), { className: w, style: H, horizontal: c, size: p, cols: r, gutters: o = m, ...N } = y, C = L(), d = C && C.uForm, [z, R] = e.useState(void 0), [x, f] = e.useState(void 0), S = e.useMemo(() => {
|
|
22
|
+
if (c)
|
|
19
23
|
return "horizontal";
|
|
20
|
-
if (
|
|
24
|
+
if (c === !1)
|
|
21
25
|
return "vertical";
|
|
22
|
-
}, [
|
|
23
|
-
() =>
|
|
24
|
-
|
|
25
|
-
c,
|
|
26
|
-
size:
|
|
27
|
-
orientation:
|
|
26
|
+
}, [c]), G = e.useMemo(
|
|
27
|
+
() => g(
|
|
28
|
+
h.form({
|
|
29
|
+
c: d,
|
|
30
|
+
size: p,
|
|
31
|
+
orientation: S
|
|
28
32
|
}),
|
|
29
|
-
|
|
33
|
+
w
|
|
30
34
|
),
|
|
31
|
-
[
|
|
35
|
+
[w, d, S, p]
|
|
32
36
|
);
|
|
33
|
-
return
|
|
37
|
+
return e.useEffect(() => {
|
|
38
|
+
if (!r && !o) {
|
|
39
|
+
R(void 0);
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
if (!o) {
|
|
43
|
+
f(void 0);
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
const b = () => {
|
|
47
|
+
let a = 0;
|
|
48
|
+
if (s.current ? a = O(s.current) : typeof window != "undefined" && (a = window.innerWidth), r) {
|
|
49
|
+
const u = T(r, a);
|
|
50
|
+
R(U(u));
|
|
51
|
+
}
|
|
52
|
+
if (o) {
|
|
53
|
+
const u = W(o, a);
|
|
54
|
+
f(u ? { gap: E(u, m) } : { gap: E(m, m) });
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
b();
|
|
58
|
+
let i;
|
|
59
|
+
const l = s.current;
|
|
60
|
+
return l && typeof window != "undefined" && "ResizeObserver" in window && (i = new ResizeObserver(b), i.observe(l)), () => {
|
|
61
|
+
i && l && i.unobserve(l);
|
|
62
|
+
};
|
|
63
|
+
}, [r, o]), /* @__PURE__ */ e.createElement(
|
|
34
64
|
"form",
|
|
35
65
|
{
|
|
36
|
-
ref:
|
|
37
|
-
...
|
|
38
|
-
id: t.id || (
|
|
66
|
+
ref: s,
|
|
67
|
+
...N,
|
|
68
|
+
id: t.id || (n ? n.id : void 0),
|
|
39
69
|
style: t.style,
|
|
40
|
-
className:
|
|
41
|
-
onSubmit:
|
|
70
|
+
className: G,
|
|
71
|
+
onSubmit: n ? n.onSubmit : void 0
|
|
42
72
|
},
|
|
43
|
-
|
|
73
|
+
r ? /* @__PURE__ */ e.createElement(
|
|
74
|
+
"div",
|
|
75
|
+
{
|
|
76
|
+
className: g(
|
|
77
|
+
h.formLayout({
|
|
78
|
+
c: d
|
|
79
|
+
}),
|
|
80
|
+
z
|
|
81
|
+
),
|
|
82
|
+
style: x
|
|
83
|
+
},
|
|
84
|
+
t.children
|
|
85
|
+
) : t.children
|
|
44
86
|
);
|
|
45
87
|
});
|
|
46
|
-
|
|
88
|
+
A.displayName = "KendoReactFormElement";
|
|
47
89
|
export {
|
|
48
|
-
|
|
90
|
+
m as DEFAULT_FORM_GUTTERS,
|
|
91
|
+
A as FormElement
|
|
49
92
|
};
|
package/FormFieldSet.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*-------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright © 2025 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 j=require("react"),l=require("@progress/kendo-react-common"),n=require("./utils.js");function M(t){const a=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const s in t)if(s!=="default"){const c=Object.getOwnPropertyDescriptor(t,s);Object.defineProperty(a,s,c.get?c:{enumerable:!0,get:()=>t[s]})}}return a.default=t,Object.freeze(a)}const e=M(j),i={rows:"0px",cols:"16px"},T=e.forwardRef((t,a)=>{const s=e.useRef(null),c=e.useRef(null);e.useImperativeHandle(c,()=>({element:s.current,props:t})),e.useImperativeHandle(a,()=>c.current);const{className:C,style:U,cols:d,colSpan:y,gutters:m=i,legend:F,...O}=t,p=l.useUnstyled(),o=p&&p.uForm,[E,b]=e.useState(void 0),[w,N]=e.useState(void 0),[G,v]=e.useState(void 0),L=e.useMemo(()=>l.classNames(l.uForm.fieldset({c:o}),w,C),[C,o,w]),_=e.useMemo(()=>l.classNames(l.uForm.formLayout({c:o}),E),[o,E]),h=e.useMemo(()=>l.classNames(l.uForm.legend({c:o})),[o]),f=e.useRef(null);return e.useEffect(()=>{s.current&&(f.current=s.current.closest("form"))},[]),e.useEffect(()=>{if(!d){b(void 0);return}if(!m){v(void 0);return}const r=f==null?void 0:f.current,R=()=>{let u=0;r?u=n.innerWidth(r):typeof window!="undefined"&&(u=window.innerWidth);const D=n.calculateColumns(d,u);if(b(n.generateColumnClass(D)),y!==void 0){const g=n.calculateColSpan(y,u);N(n.generateColSpanClass(g))}else N(void 0);if(m){const g=n.calculateGutters(m,u);v(g?{gap:n.generateGuttersStyling(g,i)}:{gap:n.generateGuttersStyling(i,i)})}};R();let S;return r&&typeof window!="undefined"&&"ResizeObserver"in window&&(S=new ResizeObserver(R),S.observe(r)),()=>{S&&r&&S.unobserve(r)}},[d,y,m]),e.createElement("fieldset",{ref:s,...O,style:t.style,className:L},F&&e.createElement("legend",{className:h},F),d?e.createElement("div",{className:_,style:G},t.children):t.children)});T.displayName="KendoReactFormFieldSet";exports.DEFAULT_FIELDSET_GUTTERS=i;exports.FormFieldSet=T;
|
package/FormFieldSet.mjs
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*-------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright © 2025 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 * as e from "react";
|
|
9
|
+
import { useUnstyled as U, classNames as S, uForm as C } from "@progress/kendo-react-common";
|
|
10
|
+
import { innerWidth as W, calculateColumns as z, generateColumnClass as A, calculateColSpan as D, generateColSpanClass as H, calculateGutters as O, generateGuttersStyling as h } from "./utils.mjs";
|
|
11
|
+
const d = {
|
|
12
|
+
rows: "0px",
|
|
13
|
+
cols: "16px"
|
|
14
|
+
}, _ = e.forwardRef((l, b) => {
|
|
15
|
+
const o = e.useRef(null), v = e.useRef(null);
|
|
16
|
+
e.useImperativeHandle(v, () => ({ element: o.current, props: l })), e.useImperativeHandle(b, () => v.current);
|
|
17
|
+
const { className: y, style: K, cols: a, colSpan: m, gutters: r = d, legend: g, ...G } = l, p = U(), t = p && p.uForm, [w, E] = e.useState(void 0), [F, N] = e.useState(void 0), [L, f] = e.useState(void 0), T = e.useMemo(
|
|
18
|
+
() => S(
|
|
19
|
+
C.fieldset({
|
|
20
|
+
c: t
|
|
21
|
+
}),
|
|
22
|
+
F,
|
|
23
|
+
y
|
|
24
|
+
),
|
|
25
|
+
[y, t, F]
|
|
26
|
+
), x = e.useMemo(
|
|
27
|
+
() => S(
|
|
28
|
+
C.formLayout({
|
|
29
|
+
c: t
|
|
30
|
+
}),
|
|
31
|
+
w
|
|
32
|
+
),
|
|
33
|
+
[t, w]
|
|
34
|
+
), I = e.useMemo(
|
|
35
|
+
() => S(
|
|
36
|
+
C.legend({
|
|
37
|
+
c: t
|
|
38
|
+
})
|
|
39
|
+
),
|
|
40
|
+
[t]
|
|
41
|
+
), c = e.useRef(null);
|
|
42
|
+
return e.useEffect(() => {
|
|
43
|
+
o.current && (c.current = o.current.closest("form"));
|
|
44
|
+
}, []), e.useEffect(() => {
|
|
45
|
+
if (!a) {
|
|
46
|
+
E(void 0);
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
if (!r) {
|
|
50
|
+
f(void 0);
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
const s = c == null ? void 0 : c.current, R = () => {
|
|
54
|
+
let n = 0;
|
|
55
|
+
s ? n = W(s) : typeof window != "undefined" && (n = window.innerWidth);
|
|
56
|
+
const M = z(a, n);
|
|
57
|
+
if (E(A(M)), m !== void 0) {
|
|
58
|
+
const u = D(m, n);
|
|
59
|
+
N(H(u));
|
|
60
|
+
} else
|
|
61
|
+
N(void 0);
|
|
62
|
+
if (r) {
|
|
63
|
+
const u = O(r, n);
|
|
64
|
+
f(u ? { gap: h(u, d) } : { gap: h(d, d) });
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
R();
|
|
68
|
+
let i;
|
|
69
|
+
return s && typeof window != "undefined" && "ResizeObserver" in window && (i = new ResizeObserver(R), i.observe(s)), () => {
|
|
70
|
+
i && s && i.unobserve(s);
|
|
71
|
+
};
|
|
72
|
+
}, [a, m, r]), /* @__PURE__ */ e.createElement("fieldset", { ref: o, ...G, style: l.style, className: T }, g && /* @__PURE__ */ e.createElement("legend", { className: I }, g), a ? /* @__PURE__ */ e.createElement("div", { className: x, style: L }, l.children) : l.children);
|
|
73
|
+
});
|
|
74
|
+
_.displayName = "KendoReactFormFieldSet";
|
|
75
|
+
export {
|
|
76
|
+
d as DEFAULT_FIELDSET_GUTTERS,
|
|
77
|
+
_ as FormFieldSet
|
|
78
|
+
};
|
package/FormSeparator.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*-------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright © 2025 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 g=require("react"),u=require("@progress/kendo-react-common"),i=require("./utils.js");function O(t){const s=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const r in t)if(r!=="default"){const o=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(s,r,o.get?o:{enumerable:!0,get:()=>t[r]})}}return s.default=t,Object.freeze(s)}const e=O(g),v=e.forwardRef((t,s)=>{const r=e.useRef(null),o=e.useRef(null);e.useImperativeHandle(o,()=>({element:r.current,props:t})),e.useImperativeHandle(s,()=>o.current);const{className:f,style:N,colSpan:c,...w}=t,d=u.useUnstyled(),m=d&&d.uForm,[p,S]=e.useState(void 0),b=e.useRef(null);e.useEffect(()=>{r.current&&(b.current=r.current.closest("form"))},[]),e.useEffect(()=>{let a;const n=b.current,y=()=>{let l=0;if(n?l=i.innerWidth(n):typeof window!="undefined"&&(l=window.innerWidth),c!==void 0){const C=i.calculateColSpan(c,l);S(i.generateColSpanClass(C))}else S(void 0)};return y(),n&&typeof window!="undefined"&&"ResizeObserver"in window&&(a=new ResizeObserver(y),a.observe(n)),()=>{a&&n&&a.unobserve(n)}},[c]);const R=e.useMemo(()=>u.classNames(u.uForm.separator({c:m}),p,f),[f,m,p]);return e.createElement("span",{ref:r,...w,style:t.style,className:R})});v.displayName="KendoReactFormSeparator";exports.FormSeparator=v;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*-------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright © 2025 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 * as e from "react";
|
|
9
|
+
import { useUnstyled as R, classNames as y, uForm as b } from "@progress/kendo-react-common";
|
|
10
|
+
import { innerWidth as N, calculateColSpan as h, generateColSpanClass as E } from "./utils.mjs";
|
|
11
|
+
const F = e.forwardRef((n, S) => {
|
|
12
|
+
const t = e.useRef(null), l = e.useRef(null);
|
|
13
|
+
e.useImperativeHandle(l, () => ({ element: t.current, props: n })), e.useImperativeHandle(S, () => l.current);
|
|
14
|
+
const { className: c, style: W, colSpan: o, ...v } = n, i = R(), u = i && i.uForm, [f, m] = e.useState(void 0), d = e.useRef(null);
|
|
15
|
+
e.useEffect(() => {
|
|
16
|
+
t.current && (d.current = t.current.closest("form"));
|
|
17
|
+
}, []), e.useEffect(() => {
|
|
18
|
+
let r;
|
|
19
|
+
const s = d.current, p = () => {
|
|
20
|
+
let a = 0;
|
|
21
|
+
if (s ? a = N(s) : typeof window != "undefined" && (a = window.innerWidth), o !== void 0) {
|
|
22
|
+
const C = h(o, a);
|
|
23
|
+
m(E(C));
|
|
24
|
+
} else
|
|
25
|
+
m(void 0);
|
|
26
|
+
};
|
|
27
|
+
return p(), s && typeof window != "undefined" && "ResizeObserver" in window && (r = new ResizeObserver(p), r.observe(s)), () => {
|
|
28
|
+
r && s && r.unobserve(s);
|
|
29
|
+
};
|
|
30
|
+
}, [o]);
|
|
31
|
+
const w = e.useMemo(
|
|
32
|
+
() => y(
|
|
33
|
+
b.separator({
|
|
34
|
+
c: u
|
|
35
|
+
}),
|
|
36
|
+
f,
|
|
37
|
+
c
|
|
38
|
+
),
|
|
39
|
+
[c, u, f]
|
|
40
|
+
);
|
|
41
|
+
return /* @__PURE__ */ e.createElement("span", { ref: t, ...v, style: n.style, className: w });
|
|
42
|
+
});
|
|
43
|
+
F.displayName = "KendoReactFormSeparator";
|
|
44
|
+
export {
|
|
45
|
+
F as FormSeparator
|
|
46
|
+
};
|
package/README.md
CHANGED
|
@@ -23,6 +23,22 @@ Among the features which the KendoReact Form component delivers are:
|
|
|
23
23
|
- [Custom components](https://www.telerik.com/kendo-react-ui/components/form/custom-components/?utm_medium=referral&utm_source=npm&utm_campaign=kendo-ui-react-trial-npm-form)—You can render custom components in the [KendoReact field](https://www.telerik.com/kendo-react-ui/components/form/api/Field/?utm_medium=referral&utm_source=npm&utm_campaign=kendo-ui-react-trial-npm-form) component by using the built-in properties of the [`FieldRenderProps`](https://www.telerik.com/kendo-react-ui/components/form/api/FieldRenderProps/?utm_medium=referral&utm_source=npm&utm_campaign=kendo-ui-react-trial-npm-form) interface and any custom properties.
|
|
24
24
|
- [Theme support](https://www.telerik.com/kendo-react-ui/components/styling/)—The KendoReact Form, as well as all 100+ components in the KendoReact suite, are styled in three polished themes (Bootstrap, Material, and Default) and can be further customized to match your specific design guidelines.
|
|
25
25
|
|
|
26
|
+
## Using for Free vs Commercial License
|
|
27
|
+
|
|
28
|
+
The following table outlines the key resources available with KendoReact and KendoReact Free.
|
|
29
|
+
|
|
30
|
+
| | [KendoReact Free](https://www.telerik.com/kendo-react-ui/components/free) | [KendoReact](https://www.telerik.com/kendo-react-ui) |
|
|
31
|
+
| -------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
32
|
+
| React components | 50+ | 120+ |
|
|
33
|
+
| Four professional themes | <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M20.285 2l-11.285 11.567-5.286-5.011-3.714 3.716 9 8.728 15-15.285z" stroke="white" stroke-width="2"/></svg> | <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M20.285 2l-11.285 11.567-5.286-5.011-3.714 3.716 9 8.728 15-15.285z" stroke="white" stroke-width="2"/></svg> |
|
|
34
|
+
| Four Figma UI Kits | <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M20.285 2l-11.285 11.567-5.286-5.011-3.714 3.716 9 8.728 15-15.285z" stroke="white" stroke-width="2"/></svg> | <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M20.285 2l-11.285 11.567-5.286-5.011-3.714 3.716 9 8.728 15-15.285z" stroke="white" stroke-width="2"/></svg> |
|
|
35
|
+
| Page Templates & Building Blocks | 1 template | <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M20.285 2l-11.285 11.567-5.286-5.011-3.714 3.716 9 8.728 15-15.285z" stroke="white" stroke-width="2"/></svg> |
|
|
36
|
+
| ThemeBuilder | Free\* | Ultimate |
|
|
37
|
+
| Source code | No | <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M20.285 2l-11.285 11.567-5.286-5.011-3.714 3.716 9 8.728 15-15.285z" stroke="white" stroke-width="2"/></svg> |
|
|
38
|
+
| Visual Studio Code extension | 1 starter template | Full functionality |
|
|
39
|
+
| Legendary customer support | No | <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M20.285 2l-11.285 11.567-5.286-5.011-3.714 3.716 9 8.728 15-15.285z" stroke="white" stroke-width="2"/></svg> |
|
|
40
|
+
| AI coding assistant | No | <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M20.285 2l-11.285 11.567-5.286-5.011-3.714 3.716 9 8.728 15-15.285z" stroke="white" stroke-width="2"/></svg> |
|
|
41
|
+
|
|
26
42
|
## Support Options
|
|
27
43
|
|
|
28
44
|
For any issues you might encounter while working with the KendoReact Form, use any of the available support channels:
|
|
@@ -12,4 +12,4 @@
|
|
|
12
12
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
13
13
|
*-------------------------------------------------------------------------------------------
|
|
14
14
|
*/
|
|
15
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react"),require("prop-types"),require("@progress/kendo-react-common")):"function"==typeof define&&define.amd?define(["exports","react","prop-types","@progress/kendo-react-common"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).KendoReactForm={},e.React,e.PropTypes,e.KendoReactCommon)}(this,(function(e,t,i,s){"use strict";function o(e){var t=Object.create(null);return e&&Object.keys(e).forEach((function(i){if("default"!==i){var s=Object.getOwnPropertyDescriptor(e,i);Object.defineProperty(t,i,s.get?s:{enumerable:!0,get:function(){return e[i]}})}})),t.default=e,Object.freeze(t)}var r=o(t);const n=r.createContext(null),a=e=>{const{name:t,component:i,validator:s,children:o,onChange:a,...d}=e,l=r.useContext(n),h=l?l.id:"";r.useEffect((()=>l?l.registerField(t,s):void 0),[t,h,s]);const u=r.useCallback((e=>{const i=e&&(void 0!==e.value?e.value:e.target?e.target.value:e.target);l.onChange(t,{value:i}),a&&a.call(void 0,e)}),[t,h,a]),c=r.useCallback((e=>l.onChange(t,{value:e.target.value})),[t,h]),m=r.useCallback((()=>l.onBlur(t)),[t,h]),v=r.useCallback((()=>l.onFocus(t)),[t,h]);if(!l)return null;const p=l.valueGetter(t);return"string"==typeof i?r.createElement(i,{onChange:c,onBlur:m,onFocus:v,value:p,children:o,...d}):r.createElement(i,{children:o,...d,onChange:u,onBlur:m,onFocus:v,value:p,validationMessage:l.errors[t],touched:l.touched[t],modified:l.modified[t],visited:l.visited[t],valid:!(l.errors[t]&&l.touched[t]),name:t})};a.displayName="KendoReactField";const d={name:"@progress/kendo-react-form",productName:"KendoReact",productCode:"KENDOUIREACT",productCodes:["KENDOUIREACT"],publishDate:0,version:"11.4.0-develop.3",licensingDocsUrl:"https://www.telerik.com/kendo-react-ui/components/my-license/"},l=class extends r.Component{constructor(e){super(e),this._touched={},this._visited={},this._modified={},this._validatorsByField={},this._values={},this._fields={},this._unmounted=!1,this._submitted=!1,this.showLicenseWatermark=!1,this.isValid=()=>this.isFormValid(this.errors),this.accumulatedForceUpdate=()=>{this._accumulatorTimeout&&clearTimeout(this._accumulatorTimeout),this._accumulatorTimeout=window.setTimeout((()=>{this._accumulatorTimeout=void 0,this.forceUpdate()}),0)},this.resetForm=()=>{this.values=s.clone(this.props.initialValues),this._key=s.guid(),this._touched={},this._visited={},this._modified={},this._validatorsByField={},this._fields={},this._submitted=!1,this.forceUpdate()},this.onReset=()=>this.resetForm(),this.addField=e=>{this._fields[e]=!0},this.onSubmit=e=>{const t={},i=this.fields;e&&("function"==typeof e.preventDefault&&e.preventDefault(),"function"==typeof e.stopPropagation&&e.stopPropagation()),i.forEach((e=>{t[e]=!0})),this.visited={...t},this.touched={...t};const s=this.values,o=this.isFormValid(this.errors),r=this.isFormModified(this.modified,i);this.props.onSubmitClick&&this.props.onSubmitClick.call(void 0,{values:s,isValid:o,isModified:r,event:e}),o&&(this.props.ignoreModified||r)&&this.props.onSubmit&&(this._submitted=!0,this.props.onSubmit.call(void 0,s,e)),this.forceUpdate()},this.onChange=(e,t)=>{const{value:i}=t;this.addField(e),this.modified[e]||(this.modified={...this.modified,[e]:!0}),this.valueSetter(e,i),this.forceUpdate()},this.onFocus=(e,t)=>{this.visited[e]||(this.visited={...this.visited,[e]:!0},t||this.forceUpdate())},this.onBlur=(e,t)=>{this.touched[e]||(this.onFocus(e,t),this.touched={...this.touched,[e]:!0},t||this.forceUpdate())},this.onFieldRegister=(e,t)=>{this.addField(e);const i=this.validatorsByField[e]||[],s=i.length;return this.validatorsByField={...this.validatorsByField,[e]:[...i,t]},this.accumulatedForceUpdate(),()=>{if(this._unmounted)return;const t=[...this.validatorsByField[e]||[]],i=!!t[s];t[s]=void 0,this.validatorsByField={...this.validatorsByField,[e]:t},i&&this.accumulatedForceUpdate()}},this.isFormValid=e=>!Object.keys(e).some((t=>!!e[t])),this.isFormModified=(e,t)=>t.some((t=>e[t])),this.isFormHasNotTouched=(e,t)=>t.some((t=>!e[t])),this.isFormTouched=(e,t)=>t.some((t=>e[t])),this.isFormVisited=(e,t)=>t.some((t=>e[t])),this.valueGetter=e=>s.getter(e)(this.values),this.valueSetter=(e,t)=>s.setter(e)(this.values,t),this.onArrayAction=e=>{this.addField(e),this.modified[e]||(this.modified={...this.modified,[e]:!0}),this.onBlur(e,!0)},this.onInsert=(e,t)=>{this.onArrayAction(e);const i=[...this.valueGetter(e)||[]];i.splice(t.index,0,t.value),this.valueSetter(e,i),this.forceUpdate()},this.onUnshift=(e,t)=>{this.onInsert(e,{value:t.value,index:0})},this.onPush=(e,t)=>{this.onArrayAction(e);const i=[...this.valueGetter(e)||[],t.value];this.valueSetter(e,i),this.forceUpdate()},this.onPop=e=>{this.onArrayAction(e);const t=[...this.valueGetter(e)||[]],i=t.pop();return this.valueSetter(e,t),this.forceUpdate(),i},this.onRemove=(e,t)=>{this.onArrayAction(e);const i=[...this.valueGetter(e)||[]],s=i.splice(t.index,1);return this.valueSetter(e,i),this.forceUpdate(),s},this.onReplace=(e,t)=>{this.onArrayAction(e);const i=[...this.valueGetter(e)||[]];i.splice(t.index,1,t.value),this.valueSetter(e,i),this.forceUpdate()},this.onMove=(e,t)=>{this.onArrayAction(e);const i=[...this.valueGetter(e)||[]],s=i[t.prevIndex];i.splice(t.prevIndex,1),i.splice(t.nextIndex,0,s),this.valueSetter(e,i),this.forceUpdate()},this.showLicenseWatermark=!s.validatePackage(d,{component:"Form"}),this.values=s.clone(e.initialValues)}get touched(){return this._touched}set touched(e){this._touched=e}get visited(){return this._visited}set visited(e){this._visited=e}get modified(){return this._modified}set modified(e){this._modified=e}get validatorsByField(){return this._validatorsByField}set validatorsByField(e){this._validatorsByField=e}get values(){return this._values}set values(e){this._values=e}get fields(){return Object.keys(this._fields)}get formErrors(){if(this.props.validator)return this.props.validator(this.values,this.valueGetter)}get errors(){const e={},t=this.fields,i=this.validatorsByField;return t.forEach((t=>{if(e[t]="",i[t]){const s=[];i[t].forEach((e=>{Array.isArray(e)?s.push(...e):s.push(e)})),s.find((i=>{if(i){const s=i(this.valueGetter(t),this.valueGetter,{name:t});if(s)return e[t]=s,!0}return!1}))}})),this.formErrors&&s.cloneObject(this.formErrors,e),e}componentWillUnmount(){this._unmounted=!0,this._accumulatorTimeout&&clearTimeout(this._accumulatorTimeout)}render(){const{render:e}=this.props,t=this.touched,i=this.visited,o=this.modified,a=this.fields,d=this.errors,l=this.isFormValid(d),h=this.isFormModified(o,a),u=this.isFormTouched(t,a),c=this.isFormVisited(i,a),m=this.isFormHasNotTouched(t,a)&&!l||l&&(this.props.ignoreModified||h);return r.createElement(r.Fragment,null,r.createElement(n.Provider,{key:this._key||this.props.id,value:{id:this.props.id,valueGetter:this.valueGetter,errors:d,modified:o,touched:t,visited:i,registerField:this.onFieldRegister,onSubmit:this.onSubmit,onChange:this.onChange,onFocus:this.onFocus,onBlur:this.onBlur,onUnshift:this.onUnshift,onPush:this.onPush,onInsert:this.onInsert,onPop:this.onPop,onRemove:this.onRemove,onReplace:this.onReplace,onMove:this.onMove}},e({valid:l,modified:h,touched:u,visited:c,submitted:this._submitted,valueGetter:this.valueGetter,errors:d,allowSubmit:m,onChange:this.onChange,onSubmit:this.onSubmit,onFormReset:this.resetForm})),this.showLicenseWatermark&&r.createElement(s.WatermarkOverlay,null))}};l.displayName="KendoReactForm",l.propTypes={initialValues:i.any,onSubmit:i.func,onSubmitClick:i.func,render:i.func.isRequired,id:i.string};let h=l;const u=e=>{const{name:t,component:i,validator:s,type:o,children:a,...d}=e,l=r.useContext(n),h=l?l.id:"";r.useEffect((()=>l?l.registerField(t,s):void 0),[t,h,s]);const u=r.useCallback((e=>l.onUnshift(t,e)),[t,h]),c=r.useCallback((e=>l.onPush(t,e)),[t,h]),m=r.useCallback((e=>l.onInsert(t,e)),[t,h]),v=r.useCallback((()=>l.onPop(t)),[t,h]),p=r.useCallback((e=>l.onRemove(t,e)),[t,h]),f=r.useCallback((e=>l.onReplace(t,e)),[t,h]),F=r.useCallback((e=>l.onMove(t,e)),[t,h]);if(!l)return null;const y=l.valueGetter(t);return r.createElement(i,{value:y,validationMessage:l.errors[t],touched:l.touched[t],modified:l.modified[t],visited:l.visited[t],valid:!(l.errors[t]&&l.touched[t]),onUnshift:u,onPush:c,onInsert:m,onPop:v,onRemove:p,onReplace:f,onMove:F,children:a,name:t,...d})};u.displayName="KendoReactFieldArray";const c=e=>{const t=s.useUnstyled(),i=e.unstyled||t,o=i&&i.uForm,n=r.useMemo((()=>s.classNames(s.uForm.field({c:o,isRtl:"rtl"===e.dir}),e.className)),[o,e.className,e.dir]);return r.createElement("div",{className:n,style:e.style},e.children)};c.displayName="KendoReactFieldWrapper";const m=r.forwardRef(((e,t)=>{const i={size:"medium",...e},o=r.useRef(null),a=r.useRef(null);r.useImperativeHandle(a,(()=>({element:o.current,props:i}))),r.useImperativeHandle(t,(()=>a.current));const d=r.useContext(n),{className:l,style:h,horizontal:u,size:c,...m}=i,v=s.useUnstyled(),p=v&&v.uForm,f=r.useMemo((()=>u?"horizontal":!1===u?"vertical":void 0),[u]),F=r.useMemo((()=>s.classNames(s.uForm.form({c:p,size:c,orientation:f}),l)),[l,p,f,c]);return r.createElement("form",{ref:o,...m,id:e.id||(d?d.id:void 0),style:e.style,className:F,onSubmit:d?d.onSubmit:void 0},e.children)}));m.displayName="KendoReactFormElement";const v=s.withIdHOC(h);v.displayName="KendoReactForm",e.Field=a,e.FieldArray=u,e.FieldWrapper=c,e.Form=v,e.FormClassComponent=h,e.FormElement=m}));
|
|
15
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react"),require("prop-types"),require("@progress/kendo-react-common")):"function"==typeof define&&define.amd?define(["exports","react","prop-types","@progress/kendo-react-common"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).KendoReactForm={},e.React,e.PropTypes,e.KendoReactCommon)}(this,(function(e,t,s,i){"use strict";function o(e){var t=Object.create(null);return e&&Object.keys(e).forEach((function(s){if("default"!==s){var i=Object.getOwnPropertyDescriptor(e,s);Object.defineProperty(t,s,i.get?i:{enumerable:!0,get:function(){return e[s]}})}})),t.default=e,Object.freeze(t)}var r=o(t);const n=r.createContext(null),l=e=>{const{name:t,component:s,validator:i,children:o,onChange:l,...a}=e,u=r.useContext(n),d=u?u.id:"";r.useEffect((()=>u?u.registerField(t,i):void 0),[t,d,i]);const c=r.useCallback((e=>{const s=e&&(void 0!==e.value?e.value:e.target?e.target.value:e.target);u.onChange(t,{value:s}),l&&l.call(void 0,e)}),[t,d,l]),h=r.useCallback((e=>u.onChange(t,{value:e.target.value})),[t,d]),m=r.useCallback((()=>u.onBlur(t)),[t,d]),f=r.useCallback((()=>u.onFocus(t)),[t,d]);if(!u)return null;const v=u.valueGetter(t);return"string"==typeof s?r.createElement(s,{onChange:h,onBlur:m,onFocus:f,value:v,children:o,...a}):r.createElement(s,{children:o,...a,onChange:c,onBlur:m,onFocus:f,value:v,validationMessage:u.errors[t],touched:u.touched[t],modified:u.modified[t],visited:u.visited[t],valid:!(u.errors[t]&&u.touched[t]),name:t})};l.displayName="KendoReactField";const a={name:"@progress/kendo-react-form",productName:"KendoReact",productCode:"KENDOUIREACT",productCodes:["KENDOUIREACT"],publishDate:0,version:"11.4.0-develop.5",licensingDocsUrl:"https://www.telerik.com/kendo-react-ui/components/my-license/"},u=class extends r.Component{constructor(e){super(e),this._touched={},this._visited={},this._modified={},this._validatorsByField={},this._values={},this._fields={},this._unmounted=!1,this._submitted=!1,this.showLicenseWatermark=!1,this.isValid=()=>this.isFormValid(this.errors),this.accumulatedForceUpdate=()=>{this._accumulatorTimeout&&clearTimeout(this._accumulatorTimeout),this._accumulatorTimeout=window.setTimeout((()=>{this._accumulatorTimeout=void 0,this.forceUpdate()}),0)},this.resetForm=()=>{this.values=i.clone(this.props.initialValues),this._key=i.guid(),this._touched={},this._visited={},this._modified={},this._validatorsByField={},this._fields={},this._submitted=!1,this.forceUpdate()},this.onReset=()=>this.resetForm(),this.addField=e=>{this._fields[e]=!0},this.onSubmit=e=>{const t={},s=this.fields;e&&("function"==typeof e.preventDefault&&e.preventDefault(),"function"==typeof e.stopPropagation&&e.stopPropagation()),s.forEach((e=>{t[e]=!0})),this.visited={...t},this.touched={...t};const i=this.values,o=this.isFormValid(this.errors),r=this.isFormModified(this.modified,s);this.props.onSubmitClick&&this.props.onSubmitClick.call(void 0,{values:i,isValid:o,isModified:r,event:e}),o&&(this.props.ignoreModified||r)&&this.props.onSubmit&&(this._submitted=!0,this.props.onSubmit.call(void 0,i,e)),this.forceUpdate()},this.onChange=(e,t)=>{const{value:s}=t;this.addField(e),this.modified[e]||(this.modified={...this.modified,[e]:!0}),this.valueSetter(e,s),this.forceUpdate()},this.onFocus=(e,t)=>{this.visited[e]||(this.visited={...this.visited,[e]:!0},t||this.forceUpdate())},this.onBlur=(e,t)=>{this.touched[e]||(this.onFocus(e,t),this.touched={...this.touched,[e]:!0},t||this.forceUpdate())},this.onFieldRegister=(e,t)=>{this.addField(e);const s=this.validatorsByField[e]||[],i=s.length;return this.validatorsByField={...this.validatorsByField,[e]:[...s,t]},this.accumulatedForceUpdate(),()=>{if(this._unmounted)return;const t=[...this.validatorsByField[e]||[]],s=!!t[i];t[i]=void 0,this.validatorsByField={...this.validatorsByField,[e]:t},s&&this.accumulatedForceUpdate()}},this.isFormValid=e=>!Object.keys(e).some((t=>!!e[t])),this.isFormModified=(e,t)=>t.some((t=>e[t])),this.isFormHasNotTouched=(e,t)=>t.some((t=>!e[t])),this.isFormTouched=(e,t)=>t.some((t=>e[t])),this.isFormVisited=(e,t)=>t.some((t=>e[t])),this.valueGetter=e=>i.getter(e)(this.values),this.valueSetter=(e,t)=>i.setter(e)(this.values,t),this.onArrayAction=e=>{this.addField(e),this.modified[e]||(this.modified={...this.modified,[e]:!0}),this.onBlur(e,!0)},this.onInsert=(e,t)=>{this.onArrayAction(e);const s=[...this.valueGetter(e)||[]];s.splice(t.index,0,t.value),this.valueSetter(e,s),this.forceUpdate()},this.onUnshift=(e,t)=>{this.onInsert(e,{value:t.value,index:0})},this.onPush=(e,t)=>{this.onArrayAction(e);const s=[...this.valueGetter(e)||[],t.value];this.valueSetter(e,s),this.forceUpdate()},this.onPop=e=>{this.onArrayAction(e);const t=[...this.valueGetter(e)||[]],s=t.pop();return this.valueSetter(e,t),this.forceUpdate(),s},this.onRemove=(e,t)=>{this.onArrayAction(e);const s=[...this.valueGetter(e)||[]],i=s.splice(t.index,1);return this.valueSetter(e,s),this.forceUpdate(),i},this.onReplace=(e,t)=>{this.onArrayAction(e);const s=[...this.valueGetter(e)||[]];s.splice(t.index,1,t.value),this.valueSetter(e,s),this.forceUpdate()},this.onMove=(e,t)=>{this.onArrayAction(e);const s=[...this.valueGetter(e)||[]],i=s[t.prevIndex];s.splice(t.prevIndex,1),s.splice(t.nextIndex,0,i),this.valueSetter(e,s),this.forceUpdate()},this.showLicenseWatermark=!i.validatePackage(a,{component:"Form"}),this.values=i.clone(e.initialValues)}get touched(){return this._touched}set touched(e){this._touched=e}get visited(){return this._visited}set visited(e){this._visited=e}get modified(){return this._modified}set modified(e){this._modified=e}get validatorsByField(){return this._validatorsByField}set validatorsByField(e){this._validatorsByField=e}get values(){return this._values}set values(e){this._values=e}get fields(){return Object.keys(this._fields)}get formErrors(){if(this.props.validator)return this.props.validator(this.values,this.valueGetter)}get errors(){const e={},t=this.fields,s=this.validatorsByField;return t.forEach((t=>{if(e[t]="",s[t]){const i=[];s[t].forEach((e=>{Array.isArray(e)?i.push(...e):i.push(e)})),i.find((s=>{if(s){const i=s(this.valueGetter(t),this.valueGetter,{name:t});if(i)return e[t]=i,!0}return!1}))}})),this.formErrors&&i.cloneObject(this.formErrors,e),e}componentWillUnmount(){this._unmounted=!0,this._accumulatorTimeout&&clearTimeout(this._accumulatorTimeout)}render(){const{render:e}=this.props,t=this.touched,s=this.visited,o=this.modified,l=this.fields,a=this.errors,u=this.isFormValid(a),d=this.isFormModified(o,l),c=this.isFormTouched(t,l),h=this.isFormVisited(s,l),m=this.isFormHasNotTouched(t,l)&&!u||u&&(this.props.ignoreModified||d);return r.createElement(r.Fragment,null,r.createElement(n.Provider,{key:this._key||this.props.id,value:{id:this.props.id,valueGetter:this.valueGetter,errors:a,modified:o,touched:t,visited:s,registerField:this.onFieldRegister,onSubmit:this.onSubmit,onChange:this.onChange,onFocus:this.onFocus,onBlur:this.onBlur,onUnshift:this.onUnshift,onPush:this.onPush,onInsert:this.onInsert,onPop:this.onPop,onRemove:this.onRemove,onReplace:this.onReplace,onMove:this.onMove}},e({valid:u,modified:d,touched:c,visited:h,submitted:this._submitted,valueGetter:this.valueGetter,errors:a,allowSubmit:m,onChange:this.onChange,onSubmit:this.onSubmit,onFormReset:this.resetForm})),this.showLicenseWatermark&&r.createElement(i.WatermarkOverlay,null))}};u.displayName="KendoReactForm",u.propTypes={initialValues:s.any,onSubmit:s.func,onSubmitClick:s.func,render:s.func.isRequired,id:s.string};let d=u;const c=e=>{const{name:t,component:s,validator:i,type:o,children:l,...a}=e,u=r.useContext(n),d=u?u.id:"";r.useEffect((()=>u?u.registerField(t,i):void 0),[t,d,i]);const c=r.useCallback((e=>u.onUnshift(t,e)),[t,d]),h=r.useCallback((e=>u.onPush(t,e)),[t,d]),m=r.useCallback((e=>u.onInsert(t,e)),[t,d]),f=r.useCallback((()=>u.onPop(t)),[t,d]),v=r.useCallback((e=>u.onRemove(t,e)),[t,d]),p=r.useCallback((e=>u.onReplace(t,e)),[t,d]),y=r.useCallback((e=>u.onMove(t,e)),[t,d]);if(!u)return null;const F=u.valueGetter(t);return r.createElement(s,{value:F,validationMessage:u.errors[t],touched:u.touched[t],modified:u.modified[t],visited:u.visited[t],valid:!(u.errors[t]&&u.touched[t]),onUnshift:c,onPush:h,onInsert:m,onPop:f,onRemove:v,onReplace:p,onMove:y,children:l,name:t,...a})};c.displayName="KendoReactFieldArray";function h(e){let t=e.clientWidth;const s=getComputedStyle(e);return t-=(parseFloat(s.paddingLeft)||0)+(parseFloat(s.borderLeftWidth)||0),t-=(parseFloat(s.paddingRight)||0)+(parseFloat(s.borderRightWidth)||0),t}function m(e,t){var s,i;if(null==e||!e.length||null==t)return"";for(const[o,r]of e.entries()){const n=o>0&&void 0!==e[o-1].maxWidth?e[o-1].maxWidth:void 0,l=o<e.length-1&&void 0!==e[o+1].minWidth?e[o+1].minWidth:void 0,a=null!=(s=r.minWidth)?s:void 0!==n?n+1:0,u=null!=(i=r.maxWidth)?i:void 0!==l?l-1:1/0;if(t>=a&&t<=u)return r.value}return""}const f=e=>{if("number"==typeof e)return`${e}px`;if("string"==typeof e){const t=e.trim(),s=parseInt(t,10);return!isNaN(s)&&Number.isFinite(s)?s.toString()===t?`${s}px`:e:null}return null},v=(e,t)=>{if(!e)return null;if(Array.isArray(e)&&e.length>0){const s=m(e,t)||null;return"string"==typeof s?parseInt(s,10):s}return"number"==typeof e?e:null},p=e=>e&&e>0?`k-grid-cols-${e}`:"",y=(e,t)=>{if(!e)return null;if("number"==typeof e)return e;if(Array.isArray(e)&&e.length>0){const s=m(e,t)||null;return"string"==typeof s?parseInt(s,10):s}return null},F=e=>e?`k-col-span-${e}`:"",g=(e,t)=>{if(!e)return null;if("number"==typeof e)return{cols:e,rows:e};if("string"==typeof e){if(!e.includes(" "))return{cols:e,rows:e};const t=e.split(" ");return{cols:t[1],rows:t[0]}}if(Array.isArray(e)){const s=m(e,t)||null;return null!==s?{cols:s,rows:s}:null}if("object"==typeof e){const s=e,i={rows:null,cols:null};return void 0!==s.cols&&null!==s.cols?"number"==typeof s.cols||"string"==typeof s.cols?i.cols=s.cols:Array.isArray(s.cols)&&(i.cols=m(s.cols,t)||null):i.cols=null,void 0!==s.rows?"number"==typeof s.rows||"string"==typeof s.rows?i.rows=s.rows:Array.isArray(s.rows)&&(i.rows=m(s.rows,t)||null):i.rows=null,i}return null},b=(e,t)=>{var s,i,o,r;return`${f(null!=(i=null!=(s=null==e?void 0:e.rows)?s:t.rows)?i:"0px")} ${f(null!=(r=null!=(o=null==e?void 0:e.cols)?o:t.cols)?r:"32px")}`},w=e=>{const{className:t,style:s,dir:o,colSpan:n,children:l}=e,a=r.useRef(null),u=i.useUnstyled(),d=e.unstyled||u,c=d&&d.uForm,[m,f]=r.useState(void 0),v=r.useRef(null);r.useEffect((()=>{a.current&&(v.current=a.current.closest("form"))}),[]),r.useEffect((()=>{let e;const t=null==v?void 0:v.current,s=()=>{let e=0;if(t?e=h(t):"undefined"!=typeof window&&(e=window.innerWidth),void 0!==n){const t=y(n,e);f(F(t))}else f(void 0)};return s(),t&&"undefined"!=typeof window&&"ResizeObserver"in window&&(e=new ResizeObserver(s),e.observe(t)),()=>{e&&t&&e.unobserve(t)}}),[n]);const p=r.useMemo((()=>i.classNames(i.uForm.field({c:c,isRtl:"rtl"===o}),m,t)),[c,t,o,m]);return r.createElement("div",{ref:a,className:p,style:s},l)};w.displayName="KendoReactFieldWrapper";const R={rows:"0px",cols:"32px"},S=r.forwardRef(((e,t)=>{const s={size:"medium",...e},o=r.useRef(null),l=r.useRef(null);r.useImperativeHandle(l,(()=>({element:o.current,props:s}))),r.useImperativeHandle(t,(()=>l.current));const a=r.useContext(n),{className:u,style:d,horizontal:c,size:m,cols:f,gutters:y=R,...F}=s,w=i.useUnstyled(),S=w&&w.uForm,[C,_]=r.useState(void 0),[E,N]=r.useState(void 0),k=r.useMemo((()=>c?"horizontal":!1===c?"vertical":void 0),[c]),A=r.useMemo((()=>i.classNames(i.uForm.form({c:S,size:m,orientation:k}),u)),[u,S,k,m]);return r.useEffect((()=>{if(!f&&!y)return void _(void 0);if(!y)return void N(void 0);const e=()=>{let e=0;if(o.current?e=h(o.current):"undefined"!=typeof window&&(e=window.innerWidth),f){const t=v(f,e);_(p(t))}if(y){const t=g(y,e);N(t?{gap:b(t,R)}:{gap:b(R,R)})}};let t;e();const s=o.current;return s&&"undefined"!=typeof window&&"ResizeObserver"in window&&(t=new ResizeObserver(e),t.observe(s)),()=>{t&&s&&t.unobserve(s)}}),[f,y]),r.createElement("form",{ref:o,...F,id:e.id||(a?a.id:void 0),style:e.style,className:A,onSubmit:a?a.onSubmit:void 0},f?r.createElement("div",{className:i.classNames(i.uForm.formLayout({c:S}),C),style:E},e.children):e.children)}));S.displayName="KendoReactFormElement";const C=r.forwardRef(((e,t)=>{const s=r.useRef(null),o=r.useRef(null);r.useImperativeHandle(o,(()=>({element:s.current,props:e}))),r.useImperativeHandle(t,(()=>o.current));const{className:n,style:l,colSpan:a,...u}=e,d=i.useUnstyled(),c=d&&d.uForm,[m,f]=r.useState(void 0),v=r.useRef(null);r.useEffect((()=>{s.current&&(v.current=s.current.closest("form"))}),[]),r.useEffect((()=>{let e;const t=v.current,s=()=>{let e=0;if(t?e=h(t):"undefined"!=typeof window&&(e=window.innerWidth),void 0!==a){const t=y(a,e);f(F(t))}else f(void 0)};return s(),t&&"undefined"!=typeof window&&"ResizeObserver"in window&&(e=new ResizeObserver(s),e.observe(t)),()=>{e&&t&&e.unobserve(t)}}),[a]);const p=r.useMemo((()=>i.classNames(i.uForm.separator({c:c}),m,n)),[n,c,m]);return r.createElement("span",{ref:s,...u,style:e.style,className:p})}));C.displayName="KendoReactFormSeparator";const _={rows:"0px",cols:"16px"},E=r.forwardRef(((e,t)=>{const s=r.useRef(null),o=r.useRef(null);r.useImperativeHandle(o,(()=>({element:s.current,props:e}))),r.useImperativeHandle(t,(()=>o.current));const{className:n,style:l,cols:a,colSpan:u,gutters:d=_,legend:c,...m}=e,f=i.useUnstyled(),w=f&&f.uForm,[R,S]=r.useState(void 0),[C,E]=r.useState(void 0),[N,k]=r.useState(void 0),A=r.useMemo((()=>i.classNames(i.uForm.fieldset({c:w}),C,n)),[n,w,C]),U=r.useMemo((()=>i.classNames(i.uForm.formLayout({c:w}),R)),[w,R]),x=r.useMemo((()=>i.classNames(i.uForm.legend({c:w}))),[w]),I=r.useRef(null);return r.useEffect((()=>{s.current&&(I.current=s.current.closest("form"))}),[]),r.useEffect((()=>{if(!a)return void S(void 0);if(!d)return void k(void 0);const e=null==I?void 0:I.current,t=()=>{let t=0;e?t=h(e):"undefined"!=typeof window&&(t=window.innerWidth);const s=v(a,t);if(S(p(s)),void 0!==u){const e=y(u,t);E(F(e))}else E(void 0);if(d){const e=g(d,t);k(e?{gap:b(e,_)}:{gap:b(_,_)})}};let s;return t(),e&&"undefined"!=typeof window&&"ResizeObserver"in window&&(s=new ResizeObserver(t),s.observe(e)),()=>{s&&e&&s.unobserve(e)}}),[a,u,d]),r.createElement("fieldset",{ref:s,...m,style:e.style,className:A},c&&r.createElement("legend",{className:x},c),a?r.createElement("div",{className:U,style:N},e.children):e.children)}));E.displayName="KendoReactFormFieldSet";const N=i.withIdHOC(d);N.displayName="KendoReactForm",e.Field=l,e.FieldArray=c,e.FieldWrapper=w,e.Form=N,e.FormClassComponent=d,e.FormElement=S,e.FormFieldSet=E,e.FormSeparator=C}));
|
package/index.d.mts
CHANGED
|
@@ -197,6 +197,10 @@ export declare interface FieldProps {
|
|
|
197
197
|
* ```
|
|
198
198
|
*/
|
|
199
199
|
children?: any;
|
|
200
|
+
/**
|
|
201
|
+
* Defines the colspan for the Form field. Can be a number or an array of responsive breakpoints.
|
|
202
|
+
*/
|
|
203
|
+
colSpan?: number | ResponsiveFormBreakPoint[];
|
|
200
204
|
/**
|
|
201
205
|
* Called when the underlying editor triggers its `onChange` event and the Form updates its internal state.
|
|
202
206
|
* Useful for updating related fields.
|
|
@@ -253,13 +257,17 @@ export declare interface FieldWrapperProps {
|
|
|
253
257
|
*/
|
|
254
258
|
style?: React_2.CSSProperties;
|
|
255
259
|
/**
|
|
256
|
-
* Sets a class
|
|
260
|
+
* Sets a class for the FieldWrapper DOM element.
|
|
257
261
|
*/
|
|
258
262
|
className?: string;
|
|
259
263
|
/**
|
|
260
264
|
* Specifies the direction of the content.
|
|
261
265
|
*/
|
|
262
266
|
dir?: string;
|
|
267
|
+
/**
|
|
268
|
+
* Defines the colspan for the form field element related to the parent Form component columns. Can be a number or an array of responsive breakpoints.
|
|
269
|
+
*/
|
|
270
|
+
colSpan?: number | ResponsiveFormBreakPoint[];
|
|
263
271
|
/**
|
|
264
272
|
* @hidden
|
|
265
273
|
*/
|
|
@@ -541,7 +549,13 @@ export declare const FormElement: React_2.FunctionComponent<FormElementProps>;
|
|
|
541
549
|
* Represent the `ref` of the FormElement component.
|
|
542
550
|
*/
|
|
543
551
|
export declare interface FormElementHandle {
|
|
552
|
+
/**
|
|
553
|
+
* Represents the props of the FormElement component.
|
|
554
|
+
*/
|
|
544
555
|
props: FormElementProps;
|
|
556
|
+
/**
|
|
557
|
+
* Represents the element of the FormElement component.
|
|
558
|
+
*/
|
|
545
559
|
element: HTMLFormElement | null;
|
|
546
560
|
}
|
|
547
561
|
|
|
@@ -558,7 +572,7 @@ export declare interface FormElementProps {
|
|
|
558
572
|
*/
|
|
559
573
|
style?: React_2.CSSProperties;
|
|
560
574
|
/**
|
|
561
|
-
* Sets a class
|
|
575
|
+
* Sets a class for the form DOM element.
|
|
562
576
|
*/
|
|
563
577
|
className?: string;
|
|
564
578
|
/**
|
|
@@ -569,6 +583,14 @@ export declare interface FormElementProps {
|
|
|
569
583
|
* Sets the id of the form DOM element. Takes priority over the Form's id.
|
|
570
584
|
*/
|
|
571
585
|
id?: string;
|
|
586
|
+
/**
|
|
587
|
+
* Defines the number of columns in the form. Can be a number or an array of responsive breakpoints.
|
|
588
|
+
*/
|
|
589
|
+
cols?: number | ResponsiveFormBreakPoint[];
|
|
590
|
+
/**
|
|
591
|
+
* Defines the gutters for the form. You can specify gutters for rows and columns. Number is equivalent to px.
|
|
592
|
+
*/
|
|
593
|
+
gutters?: string | number | Gutters | ResponsiveFormBreakPoint[];
|
|
572
594
|
/**
|
|
573
595
|
* @hidden
|
|
574
596
|
*/
|
|
@@ -591,6 +613,59 @@ export declare interface FormElementProps {
|
|
|
591
613
|
unstyled?: FormClassStructure;
|
|
592
614
|
}
|
|
593
615
|
|
|
616
|
+
/**
|
|
617
|
+
* Represents the KendoReact FormFieldSet component.
|
|
618
|
+
*/
|
|
619
|
+
export declare const FormFieldSet: React_2.FunctionComponent<FormFieldSetProps>;
|
|
620
|
+
|
|
621
|
+
/**
|
|
622
|
+
* Represent the `ref` of the FormFieldSet component.
|
|
623
|
+
*/
|
|
624
|
+
export declare interface FormFieldSetHandle {
|
|
625
|
+
/**
|
|
626
|
+
* Represents the props of the FormFieldSet component.
|
|
627
|
+
*/
|
|
628
|
+
props: FormFieldSetProps;
|
|
629
|
+
/**
|
|
630
|
+
* Represents the element of the FormFieldSet component.
|
|
631
|
+
*/
|
|
632
|
+
element: HTMLFieldSetElement | null;
|
|
633
|
+
}
|
|
634
|
+
|
|
635
|
+
/**
|
|
636
|
+
* Represents the props of the KendoReact FormFieldSet component.
|
|
637
|
+
*/
|
|
638
|
+
export declare interface FormFieldSetProps {
|
|
639
|
+
/**
|
|
640
|
+
* Defines the number of columns of the fieldset. Can be a number or an array of responsive breakpoints.
|
|
641
|
+
*/
|
|
642
|
+
cols?: number | ResponsiveFormBreakPoint[];
|
|
643
|
+
/**
|
|
644
|
+
* Defines the colspan for the fieldset related to the parent Form component columns. Can be a number or an array of responsive breakpoints.
|
|
645
|
+
*/
|
|
646
|
+
colSpan?: number | ResponsiveFormBreakPoint[];
|
|
647
|
+
/**
|
|
648
|
+
* Defines the gutters for the fieldset. You can specify gutters for rows and columns. Number is equivalent to px.
|
|
649
|
+
*/
|
|
650
|
+
gutters?: string | number | Gutters | ResponsiveFormBreakPoint[];
|
|
651
|
+
/**
|
|
652
|
+
* Defines the legend for the fieldset.
|
|
653
|
+
*/
|
|
654
|
+
legend?: string;
|
|
655
|
+
/**
|
|
656
|
+
* @hidden
|
|
657
|
+
*/
|
|
658
|
+
children?: any;
|
|
659
|
+
/**
|
|
660
|
+
* The styles that are applied to the form DOM element.
|
|
661
|
+
*/
|
|
662
|
+
style?: React_2.CSSProperties;
|
|
663
|
+
/**
|
|
664
|
+
* Sets a class for the form DOM element.
|
|
665
|
+
*/
|
|
666
|
+
className?: string;
|
|
667
|
+
}
|
|
668
|
+
|
|
594
669
|
/**
|
|
595
670
|
* Represent the `ref` of the Form component.
|
|
596
671
|
*/
|
|
@@ -812,6 +887,47 @@ export declare interface FormRenderProps {
|
|
|
812
887
|
valueGetter: (name: string) => any;
|
|
813
888
|
}
|
|
814
889
|
|
|
890
|
+
/**
|
|
891
|
+
* Represents the KendoReact FormSeparator component.
|
|
892
|
+
*/
|
|
893
|
+
export declare const FormSeparator: React_2.FunctionComponent<FormSeparatorProps>;
|
|
894
|
+
|
|
895
|
+
/**
|
|
896
|
+
* Represent the `ref` of the FormSeparator component.
|
|
897
|
+
*/
|
|
898
|
+
export declare interface FormSeparatorHandle {
|
|
899
|
+
/**
|
|
900
|
+
* Represents the props of the FormSeparator component.
|
|
901
|
+
*/
|
|
902
|
+
props: FormSeparatorProps;
|
|
903
|
+
/**
|
|
904
|
+
* Represents the element of the FormSeparator component.
|
|
905
|
+
*/
|
|
906
|
+
element: HTMLSpanElement | null;
|
|
907
|
+
}
|
|
908
|
+
|
|
909
|
+
/**
|
|
910
|
+
* Represents the props of the KendoReact FormSeparator component.
|
|
911
|
+
*/
|
|
912
|
+
export declare interface FormSeparatorProps {
|
|
913
|
+
/**
|
|
914
|
+
* Defines the colspan for the separator element related to the parent Form component columns. Can be a number or an array of responsive breakpoints.
|
|
915
|
+
*/
|
|
916
|
+
colSpan?: number | ResponsiveFormBreakPoint[];
|
|
917
|
+
/**
|
|
918
|
+
* @hidden
|
|
919
|
+
*/
|
|
920
|
+
children?: any;
|
|
921
|
+
/**
|
|
922
|
+
* The styles that are applied to the form DOM element.
|
|
923
|
+
*/
|
|
924
|
+
style?: React_2.CSSProperties;
|
|
925
|
+
/**
|
|
926
|
+
* Sets a class for the form DOM element.
|
|
927
|
+
*/
|
|
928
|
+
className?: string;
|
|
929
|
+
}
|
|
930
|
+
|
|
815
931
|
/**
|
|
816
932
|
* The FormSubmitClick event.
|
|
817
933
|
*/
|
|
@@ -846,6 +962,24 @@ export declare interface FormSubmitClickEvent {
|
|
|
846
962
|
*/
|
|
847
963
|
export declare type FormValidatorType = (values: any, valueGetter: (name: string) => any) => KeyValue<string> | undefined;
|
|
848
964
|
|
|
965
|
+
/**
|
|
966
|
+
* Represents the [gutters](https://developer.mozilla.org/en-US/docs/Web/CSS/gap) configuration for a form layout.
|
|
967
|
+
* It allows defining the spacing between the columns and rows of the form.
|
|
968
|
+
* Each property can be a number or an array of responsive breakpoints.
|
|
969
|
+
*/
|
|
970
|
+
export declare interface Gutters {
|
|
971
|
+
/**
|
|
972
|
+
* Defines the gutters for the columns in the form.
|
|
973
|
+
* Can be a number or an array of responsive breakpoints.
|
|
974
|
+
*/
|
|
975
|
+
cols?: string | number | ResponsiveFormBreakPoint[];
|
|
976
|
+
/**
|
|
977
|
+
* Defines the gutters for the rows in the form.
|
|
978
|
+
* Can be a number or an array of responsive breakpoints.
|
|
979
|
+
*/
|
|
980
|
+
rows?: string | number | ResponsiveFormBreakPoint[];
|
|
981
|
+
}
|
|
982
|
+
|
|
849
983
|
/**
|
|
850
984
|
*
|
|
851
985
|
*/
|
|
@@ -853,4 +987,25 @@ export declare interface KeyValue<ValueType> {
|
|
|
853
987
|
[name: string]: ValueType;
|
|
854
988
|
}
|
|
855
989
|
|
|
990
|
+
/**
|
|
991
|
+
* Allows to define responsive breakpoints for the Form component.
|
|
992
|
+
* Each breakpoint can specify a minimum and/or maximum width, and a value that represents either the number of columns
|
|
993
|
+
* or the colspan/gutters for that breakpoint.
|
|
994
|
+
*/
|
|
995
|
+
export declare interface ResponsiveFormBreakPoint {
|
|
996
|
+
/**
|
|
997
|
+
* The minimum width for this breakpoint in pixels.
|
|
998
|
+
*/
|
|
999
|
+
minWidth?: number;
|
|
1000
|
+
/**
|
|
1001
|
+
* The maximum width for this breakpoint in pixels.
|
|
1002
|
+
*/
|
|
1003
|
+
maxWidth?: number;
|
|
1004
|
+
/**
|
|
1005
|
+
* The value associated with this breakpoint.
|
|
1006
|
+
* It can represent the number of columns or the colspan/gutters for the form control.
|
|
1007
|
+
*/
|
|
1008
|
+
value: number | string;
|
|
1009
|
+
}
|
|
1010
|
+
|
|
856
1011
|
export { }
|
package/index.d.ts
CHANGED
|
@@ -197,6 +197,10 @@ export declare interface FieldProps {
|
|
|
197
197
|
* ```
|
|
198
198
|
*/
|
|
199
199
|
children?: any;
|
|
200
|
+
/**
|
|
201
|
+
* Defines the colspan for the Form field. Can be a number or an array of responsive breakpoints.
|
|
202
|
+
*/
|
|
203
|
+
colSpan?: number | ResponsiveFormBreakPoint[];
|
|
200
204
|
/**
|
|
201
205
|
* Called when the underlying editor triggers its `onChange` event and the Form updates its internal state.
|
|
202
206
|
* Useful for updating related fields.
|
|
@@ -253,13 +257,17 @@ export declare interface FieldWrapperProps {
|
|
|
253
257
|
*/
|
|
254
258
|
style?: React_2.CSSProperties;
|
|
255
259
|
/**
|
|
256
|
-
* Sets a class
|
|
260
|
+
* Sets a class for the FieldWrapper DOM element.
|
|
257
261
|
*/
|
|
258
262
|
className?: string;
|
|
259
263
|
/**
|
|
260
264
|
* Specifies the direction of the content.
|
|
261
265
|
*/
|
|
262
266
|
dir?: string;
|
|
267
|
+
/**
|
|
268
|
+
* Defines the colspan for the form field element related to the parent Form component columns. Can be a number or an array of responsive breakpoints.
|
|
269
|
+
*/
|
|
270
|
+
colSpan?: number | ResponsiveFormBreakPoint[];
|
|
263
271
|
/**
|
|
264
272
|
* @hidden
|
|
265
273
|
*/
|
|
@@ -541,7 +549,13 @@ export declare const FormElement: React_2.FunctionComponent<FormElementProps>;
|
|
|
541
549
|
* Represent the `ref` of the FormElement component.
|
|
542
550
|
*/
|
|
543
551
|
export declare interface FormElementHandle {
|
|
552
|
+
/**
|
|
553
|
+
* Represents the props of the FormElement component.
|
|
554
|
+
*/
|
|
544
555
|
props: FormElementProps;
|
|
556
|
+
/**
|
|
557
|
+
* Represents the element of the FormElement component.
|
|
558
|
+
*/
|
|
545
559
|
element: HTMLFormElement | null;
|
|
546
560
|
}
|
|
547
561
|
|
|
@@ -558,7 +572,7 @@ export declare interface FormElementProps {
|
|
|
558
572
|
*/
|
|
559
573
|
style?: React_2.CSSProperties;
|
|
560
574
|
/**
|
|
561
|
-
* Sets a class
|
|
575
|
+
* Sets a class for the form DOM element.
|
|
562
576
|
*/
|
|
563
577
|
className?: string;
|
|
564
578
|
/**
|
|
@@ -569,6 +583,14 @@ export declare interface FormElementProps {
|
|
|
569
583
|
* Sets the id of the form DOM element. Takes priority over the Form's id.
|
|
570
584
|
*/
|
|
571
585
|
id?: string;
|
|
586
|
+
/**
|
|
587
|
+
* Defines the number of columns in the form. Can be a number or an array of responsive breakpoints.
|
|
588
|
+
*/
|
|
589
|
+
cols?: number | ResponsiveFormBreakPoint[];
|
|
590
|
+
/**
|
|
591
|
+
* Defines the gutters for the form. You can specify gutters for rows and columns. Number is equivalent to px.
|
|
592
|
+
*/
|
|
593
|
+
gutters?: string | number | Gutters | ResponsiveFormBreakPoint[];
|
|
572
594
|
/**
|
|
573
595
|
* @hidden
|
|
574
596
|
*/
|
|
@@ -591,6 +613,59 @@ export declare interface FormElementProps {
|
|
|
591
613
|
unstyled?: FormClassStructure;
|
|
592
614
|
}
|
|
593
615
|
|
|
616
|
+
/**
|
|
617
|
+
* Represents the KendoReact FormFieldSet component.
|
|
618
|
+
*/
|
|
619
|
+
export declare const FormFieldSet: React_2.FunctionComponent<FormFieldSetProps>;
|
|
620
|
+
|
|
621
|
+
/**
|
|
622
|
+
* Represent the `ref` of the FormFieldSet component.
|
|
623
|
+
*/
|
|
624
|
+
export declare interface FormFieldSetHandle {
|
|
625
|
+
/**
|
|
626
|
+
* Represents the props of the FormFieldSet component.
|
|
627
|
+
*/
|
|
628
|
+
props: FormFieldSetProps;
|
|
629
|
+
/**
|
|
630
|
+
* Represents the element of the FormFieldSet component.
|
|
631
|
+
*/
|
|
632
|
+
element: HTMLFieldSetElement | null;
|
|
633
|
+
}
|
|
634
|
+
|
|
635
|
+
/**
|
|
636
|
+
* Represents the props of the KendoReact FormFieldSet component.
|
|
637
|
+
*/
|
|
638
|
+
export declare interface FormFieldSetProps {
|
|
639
|
+
/**
|
|
640
|
+
* Defines the number of columns of the fieldset. Can be a number or an array of responsive breakpoints.
|
|
641
|
+
*/
|
|
642
|
+
cols?: number | ResponsiveFormBreakPoint[];
|
|
643
|
+
/**
|
|
644
|
+
* Defines the colspan for the fieldset related to the parent Form component columns. Can be a number or an array of responsive breakpoints.
|
|
645
|
+
*/
|
|
646
|
+
colSpan?: number | ResponsiveFormBreakPoint[];
|
|
647
|
+
/**
|
|
648
|
+
* Defines the gutters for the fieldset. You can specify gutters for rows and columns. Number is equivalent to px.
|
|
649
|
+
*/
|
|
650
|
+
gutters?: string | number | Gutters | ResponsiveFormBreakPoint[];
|
|
651
|
+
/**
|
|
652
|
+
* Defines the legend for the fieldset.
|
|
653
|
+
*/
|
|
654
|
+
legend?: string;
|
|
655
|
+
/**
|
|
656
|
+
* @hidden
|
|
657
|
+
*/
|
|
658
|
+
children?: any;
|
|
659
|
+
/**
|
|
660
|
+
* The styles that are applied to the form DOM element.
|
|
661
|
+
*/
|
|
662
|
+
style?: React_2.CSSProperties;
|
|
663
|
+
/**
|
|
664
|
+
* Sets a class for the form DOM element.
|
|
665
|
+
*/
|
|
666
|
+
className?: string;
|
|
667
|
+
}
|
|
668
|
+
|
|
594
669
|
/**
|
|
595
670
|
* Represent the `ref` of the Form component.
|
|
596
671
|
*/
|
|
@@ -812,6 +887,47 @@ export declare interface FormRenderProps {
|
|
|
812
887
|
valueGetter: (name: string) => any;
|
|
813
888
|
}
|
|
814
889
|
|
|
890
|
+
/**
|
|
891
|
+
* Represents the KendoReact FormSeparator component.
|
|
892
|
+
*/
|
|
893
|
+
export declare const FormSeparator: React_2.FunctionComponent<FormSeparatorProps>;
|
|
894
|
+
|
|
895
|
+
/**
|
|
896
|
+
* Represent the `ref` of the FormSeparator component.
|
|
897
|
+
*/
|
|
898
|
+
export declare interface FormSeparatorHandle {
|
|
899
|
+
/**
|
|
900
|
+
* Represents the props of the FormSeparator component.
|
|
901
|
+
*/
|
|
902
|
+
props: FormSeparatorProps;
|
|
903
|
+
/**
|
|
904
|
+
* Represents the element of the FormSeparator component.
|
|
905
|
+
*/
|
|
906
|
+
element: HTMLSpanElement | null;
|
|
907
|
+
}
|
|
908
|
+
|
|
909
|
+
/**
|
|
910
|
+
* Represents the props of the KendoReact FormSeparator component.
|
|
911
|
+
*/
|
|
912
|
+
export declare interface FormSeparatorProps {
|
|
913
|
+
/**
|
|
914
|
+
* Defines the colspan for the separator element related to the parent Form component columns. Can be a number or an array of responsive breakpoints.
|
|
915
|
+
*/
|
|
916
|
+
colSpan?: number | ResponsiveFormBreakPoint[];
|
|
917
|
+
/**
|
|
918
|
+
* @hidden
|
|
919
|
+
*/
|
|
920
|
+
children?: any;
|
|
921
|
+
/**
|
|
922
|
+
* The styles that are applied to the form DOM element.
|
|
923
|
+
*/
|
|
924
|
+
style?: React_2.CSSProperties;
|
|
925
|
+
/**
|
|
926
|
+
* Sets a class for the form DOM element.
|
|
927
|
+
*/
|
|
928
|
+
className?: string;
|
|
929
|
+
}
|
|
930
|
+
|
|
815
931
|
/**
|
|
816
932
|
* The FormSubmitClick event.
|
|
817
933
|
*/
|
|
@@ -846,6 +962,24 @@ export declare interface FormSubmitClickEvent {
|
|
|
846
962
|
*/
|
|
847
963
|
export declare type FormValidatorType = (values: any, valueGetter: (name: string) => any) => KeyValue<string> | undefined;
|
|
848
964
|
|
|
965
|
+
/**
|
|
966
|
+
* Represents the [gutters](https://developer.mozilla.org/en-US/docs/Web/CSS/gap) configuration for a form layout.
|
|
967
|
+
* It allows defining the spacing between the columns and rows of the form.
|
|
968
|
+
* Each property can be a number or an array of responsive breakpoints.
|
|
969
|
+
*/
|
|
970
|
+
export declare interface Gutters {
|
|
971
|
+
/**
|
|
972
|
+
* Defines the gutters for the columns in the form.
|
|
973
|
+
* Can be a number or an array of responsive breakpoints.
|
|
974
|
+
*/
|
|
975
|
+
cols?: string | number | ResponsiveFormBreakPoint[];
|
|
976
|
+
/**
|
|
977
|
+
* Defines the gutters for the rows in the form.
|
|
978
|
+
* Can be a number or an array of responsive breakpoints.
|
|
979
|
+
*/
|
|
980
|
+
rows?: string | number | ResponsiveFormBreakPoint[];
|
|
981
|
+
}
|
|
982
|
+
|
|
849
983
|
/**
|
|
850
984
|
*
|
|
851
985
|
*/
|
|
@@ -853,4 +987,25 @@ export declare interface KeyValue<ValueType> {
|
|
|
853
987
|
[name: string]: ValueType;
|
|
854
988
|
}
|
|
855
989
|
|
|
990
|
+
/**
|
|
991
|
+
* Allows to define responsive breakpoints for the Form component.
|
|
992
|
+
* Each breakpoint can specify a minimum and/or maximum width, and a value that represents either the number of columns
|
|
993
|
+
* or the colspan/gutters for that breakpoint.
|
|
994
|
+
*/
|
|
995
|
+
export declare interface ResponsiveFormBreakPoint {
|
|
996
|
+
/**
|
|
997
|
+
* The minimum width for this breakpoint in pixels.
|
|
998
|
+
*/
|
|
999
|
+
minWidth?: number;
|
|
1000
|
+
/**
|
|
1001
|
+
* The maximum width for this breakpoint in pixels.
|
|
1002
|
+
*/
|
|
1003
|
+
maxWidth?: number;
|
|
1004
|
+
/**
|
|
1005
|
+
* The value associated with this breakpoint.
|
|
1006
|
+
* It can represent the number of columns or the colspan/gutters for the form control.
|
|
1007
|
+
*/
|
|
1008
|
+
value: number | string;
|
|
1009
|
+
}
|
|
1010
|
+
|
|
856
1011
|
export { }
|
package/index.js
CHANGED
|
@@ -6,4 +6,4 @@
|
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
8
|
"use client";
|
|
9
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./Field.js"),e=require("./Form.js"),
|
|
9
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./Field.js"),e=require("./Form.js"),t=require("./FieldArray.js"),F=require("./FieldWrapper.js"),i=require("./FormElement.js"),m=require("@progress/kendo-react-common"),l=require("./FormSeparator.js"),a=require("./FormFieldSet.js"),r=m.withIdHOC(e.Form);r.displayName="KendoReactForm";exports.Field=o.Field;exports.FormClassComponent=e.Form;exports.FieldArray=t.FieldArray;exports.FieldWrapper=F.FieldWrapper;exports.FormElement=i.FormElement;exports.FormSeparator=l.FormSeparator;exports.FormFieldSet=a.FormFieldSet;exports.Form=r;
|
package/index.mjs
CHANGED
|
@@ -7,18 +7,22 @@
|
|
|
7
7
|
*/
|
|
8
8
|
"use client";
|
|
9
9
|
import { Field as a } from "./Field.mjs";
|
|
10
|
-
import { Form as
|
|
11
|
-
import { FieldArray as
|
|
10
|
+
import { Form as r } from "./Form.mjs";
|
|
11
|
+
import { FieldArray as i } from "./FieldArray.mjs";
|
|
12
12
|
import { FieldWrapper as l } from "./FieldWrapper.mjs";
|
|
13
|
-
import { FormElement as
|
|
14
|
-
import { withIdHOC as
|
|
15
|
-
|
|
13
|
+
import { FormElement as s } from "./FormElement.mjs";
|
|
14
|
+
import { withIdHOC as o } from "@progress/kendo-react-common";
|
|
15
|
+
import { FormSeparator as C } from "./FormSeparator.mjs";
|
|
16
|
+
import { FormFieldSet as y } from "./FormFieldSet.mjs";
|
|
17
|
+
const m = o(r);
|
|
16
18
|
m.displayName = "KendoReactForm";
|
|
17
19
|
export {
|
|
18
20
|
a as Field,
|
|
19
|
-
|
|
21
|
+
i as FieldArray,
|
|
20
22
|
l as FieldWrapper,
|
|
21
23
|
m as Form,
|
|
22
|
-
|
|
23
|
-
|
|
24
|
+
r as FormClassComponent,
|
|
25
|
+
s as FormElement,
|
|
26
|
+
y as FormFieldSet,
|
|
27
|
+
C as FormSeparator
|
|
24
28
|
};
|
package/package-metadata.js
CHANGED
|
@@ -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 strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e={name:"@progress/kendo-react-form",productName:"KendoReact",productCode:"KENDOUIREACT",productCodes:["KENDOUIREACT"],publishDate:
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e={name:"@progress/kendo-react-form",productName:"KendoReact",productCode:"KENDOUIREACT",productCodes:["KENDOUIREACT"],publishDate: 1754052736,version:"11.4.0-develop.5",licensingDocsUrl:"https://www.telerik.com/kendo-react-ui/components/my-license/"};exports.packageMetadata=e;
|
package/package-metadata.mjs
CHANGED
|
@@ -10,8 +10,8 @@ const e = {
|
|
|
10
10
|
productName: "KendoReact",
|
|
11
11
|
productCode: "KENDOUIREACT",
|
|
12
12
|
productCodes: ["KENDOUIREACT"],
|
|
13
|
-
publishDate:
|
|
14
|
-
version: "11.4.0-develop.
|
|
13
|
+
publishDate: 1754052736,
|
|
14
|
+
version: "11.4.0-develop.5",
|
|
15
15
|
licensingDocsUrl: "https://www.telerik.com/kendo-react-ui/components/my-license/"
|
|
16
16
|
};
|
|
17
17
|
export {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@progress/kendo-react-form",
|
|
3
|
-
"version": "11.4.0-develop.
|
|
3
|
+
"version": "11.4.0-develop.5",
|
|
4
4
|
"description": "React Form is a small and fast package for form state management with zero dependencies. KendoReact Form package",
|
|
5
5
|
"author": "Progress",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"sideEffects": false,
|
|
27
27
|
"peerDependencies": {
|
|
28
28
|
"@progress/kendo-licensing": "^1.6.0",
|
|
29
|
-
"@progress/kendo-react-common": "11.4.0-develop.
|
|
29
|
+
"@progress/kendo-react-common": "11.4.0-develop.5",
|
|
30
30
|
"react": "^16.8.2 || ^17.0.0 || ^18.0.0 || ^19.0.0 || ^19.0.0-rc",
|
|
31
31
|
"react-dom": "^16.8.2 || ^17.0.0 || ^18.0.0 || ^19.0.0 || ^19.0.0-rc"
|
|
32
32
|
},
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"package": {
|
|
52
52
|
"productName": "KendoReact",
|
|
53
53
|
"productCode": "KENDOUIREACT",
|
|
54
|
-
"publishDate":
|
|
54
|
+
"publishDate": 1754052736,
|
|
55
55
|
"licensingDocsUrl": "https://www.telerik.com/kendo-react-ui/components/my-license/"
|
|
56
56
|
}
|
|
57
57
|
},
|
package/utils.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*-------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright © 2025 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 a=" ";function p(r){let e=r.clientWidth;const n=getComputedStyle(r);return e-=(parseFloat(n.paddingLeft)||0)+(parseFloat(n.borderLeftWidth)||0),e-=(parseFloat(n.paddingRight)||0)+(parseFloat(n.borderRightWidth)||0),e}function o(r,e){var n,l;if(!(r!=null&&r.length)||e==null)return"";for(const[s,t]of r.entries()){const i=s>0&&r[s-1].maxWidth!==void 0?r[s-1].maxWidth:void 0,c=s<r.length-1&&r[s+1].minWidth!==void 0?r[s+1].minWidth:void 0,f=(n=t.minWidth)!=null?n:i!==void 0?i+1:0,d=(l=t.maxWidth)!=null?l:c!==void 0?c-1:1/0;if(e>=f&&e<=d)return t.value}return""}const u=r=>{if(typeof r=="number")return`${r}px`;if(typeof r=="string"){const e=r.trim(),n=parseInt(e,10);return!isNaN(n)&&Number.isFinite(n)?n.toString()===e?`${n}px`:r:null}return null},y=(r,e)=>{if(!r)return null;if(Array.isArray(r)&&r.length>0){const n=o(r,e)||null;return typeof n=="string"?parseInt(n,10):n}else if(typeof r=="number")return r;return null},m=r=>r&&r>0?`k-grid-cols-${r}`:"",C=(r,e)=>{if(!r)return null;if(typeof r=="number")return r;if(Array.isArray(r)&&r.length>0){const n=o(r,e)||null;return typeof n=="string"?parseInt(n,10):n}return null},h=r=>r?`k-col-span-${r}`:"",w=(r,e)=>{if(!r)return null;if(typeof r=="number")return{cols:r,rows:r};if(typeof r=="string"){if(!r.includes(a))return{cols:r,rows:r};const n=r.split(a);return{cols:n[1],rows:n[0]}}else if(Array.isArray(r)){const n=o(r,e)||null;return n!==null?{cols:n,rows:n}:null}else if(typeof r=="object"){const n=r,l={rows:null,cols:null};return n.cols!==void 0&&n.cols!==null?typeof n.cols=="number"||typeof n.cols=="string"?l.cols=n.cols:Array.isArray(n.cols)&&(l.cols=o(n.cols,e)||null):l.cols=null,n.rows!==void 0?typeof n.rows=="number"||typeof n.rows=="string"?l.rows=n.rows:Array.isArray(n.rows)&&(l.rows=o(n.rows,e)||null):l.rows=null,l}return null},A=(r,e)=>{var s,t,i,c;const n=u((t=(s=r==null?void 0:r.rows)!=null?s:e.rows)!=null?t:"0px"),l=u((c=(i=r==null?void 0:r.cols)!=null?i:e.cols)!=null?c:"32px");return`${n} ${l}`};exports.calculateColSpan=C;exports.calculateColumns=y;exports.calculateGutters=w;exports.generateColSpanClass=h;exports.generateColumnClass=m;exports.generateGuttersStyling=A;exports.innerWidth=p;exports.processBreakpoints=o;exports.processCssValue=u;
|
package/utils.mjs
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*-------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright © 2025 Progress Software Corporation. All rights reserved.
|
|
5
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
|
+
*-------------------------------------------------------------------------------------------
|
|
7
|
+
*/
|
|
8
|
+
const f = " ";
|
|
9
|
+
function p(r) {
|
|
10
|
+
let e = r.clientWidth;
|
|
11
|
+
const n = getComputedStyle(r);
|
|
12
|
+
return e -= (parseFloat(n.paddingLeft) || 0) + (parseFloat(n.borderLeftWidth) || 0), e -= (parseFloat(n.paddingRight) || 0) + (parseFloat(n.borderRightWidth) || 0), e;
|
|
13
|
+
}
|
|
14
|
+
function c(r, e) {
|
|
15
|
+
var n, l;
|
|
16
|
+
if (!(r != null && r.length) || e == null)
|
|
17
|
+
return "";
|
|
18
|
+
for (const [o, s] of r.entries()) {
|
|
19
|
+
const t = o > 0 && r[o - 1].maxWidth !== void 0 ? r[o - 1].maxWidth : void 0, i = o < r.length - 1 && r[o + 1].minWidth !== void 0 ? r[o + 1].minWidth : void 0, d = (n = s.minWidth) != null ? n : t !== void 0 ? t + 1 : 0, a = (l = s.maxWidth) != null ? l : i !== void 0 ? i - 1 : 1 / 0;
|
|
20
|
+
if (e >= d && e <= a)
|
|
21
|
+
return s.value;
|
|
22
|
+
}
|
|
23
|
+
return "";
|
|
24
|
+
}
|
|
25
|
+
const u = (r) => {
|
|
26
|
+
if (typeof r == "number")
|
|
27
|
+
return `${r}px`;
|
|
28
|
+
if (typeof r == "string") {
|
|
29
|
+
const e = r.trim(), n = parseInt(e, 10);
|
|
30
|
+
return !isNaN(n) && Number.isFinite(n) ? n.toString() === e ? `${n}px` : r : null;
|
|
31
|
+
}
|
|
32
|
+
return null;
|
|
33
|
+
}, y = (r, e) => {
|
|
34
|
+
if (!r)
|
|
35
|
+
return null;
|
|
36
|
+
if (Array.isArray(r) && r.length > 0) {
|
|
37
|
+
const n = c(r, e) || null;
|
|
38
|
+
return typeof n == "string" ? parseInt(n, 10) : n;
|
|
39
|
+
} else if (typeof r == "number")
|
|
40
|
+
return r;
|
|
41
|
+
return null;
|
|
42
|
+
}, w = (r) => r && r > 0 ? `k-grid-cols-${r}` : "", h = (r, e) => {
|
|
43
|
+
if (!r)
|
|
44
|
+
return null;
|
|
45
|
+
if (typeof r == "number")
|
|
46
|
+
return r;
|
|
47
|
+
if (Array.isArray(r) && r.length > 0) {
|
|
48
|
+
const n = c(r, e) || null;
|
|
49
|
+
return typeof n == "string" ? parseInt(n, 10) : n;
|
|
50
|
+
}
|
|
51
|
+
return null;
|
|
52
|
+
}, m = (r) => r ? `k-col-span-${r}` : "", A = (r, e) => {
|
|
53
|
+
if (!r)
|
|
54
|
+
return null;
|
|
55
|
+
if (typeof r == "number")
|
|
56
|
+
return { cols: r, rows: r };
|
|
57
|
+
if (typeof r == "string") {
|
|
58
|
+
if (!r.includes(f))
|
|
59
|
+
return { cols: r, rows: r };
|
|
60
|
+
const n = r.split(f);
|
|
61
|
+
return { cols: n[1], rows: n[0] };
|
|
62
|
+
} else if (Array.isArray(r)) {
|
|
63
|
+
const n = c(r, e) || null;
|
|
64
|
+
return n !== null ? { cols: n, rows: n } : null;
|
|
65
|
+
} else if (typeof r == "object") {
|
|
66
|
+
const n = r, l = { rows: null, cols: null };
|
|
67
|
+
return n.cols !== void 0 && n.cols !== null ? typeof n.cols == "number" || typeof n.cols == "string" ? l.cols = n.cols : Array.isArray(n.cols) && (l.cols = c(n.cols, e) || null) : l.cols = null, n.rows !== void 0 ? typeof n.rows == "number" || typeof n.rows == "string" ? l.rows = n.rows : Array.isArray(n.rows) && (l.rows = c(n.rows, e) || null) : l.rows = null, l;
|
|
68
|
+
}
|
|
69
|
+
return null;
|
|
70
|
+
}, C = (r, e) => {
|
|
71
|
+
var o, s, t, i;
|
|
72
|
+
const n = u((s = (o = r == null ? void 0 : r.rows) != null ? o : e.rows) != null ? s : "0px"), l = u((i = (t = r == null ? void 0 : r.cols) != null ? t : e.cols) != null ? i : "32px");
|
|
73
|
+
return `${n} ${l}`;
|
|
74
|
+
};
|
|
75
|
+
export {
|
|
76
|
+
h as calculateColSpan,
|
|
77
|
+
y as calculateColumns,
|
|
78
|
+
A as calculateGutters,
|
|
79
|
+
m as generateColSpanClass,
|
|
80
|
+
w as generateColumnClass,
|
|
81
|
+
C as generateGuttersStyling,
|
|
82
|
+
p as innerWidth,
|
|
83
|
+
c as processBreakpoints,
|
|
84
|
+
u as processCssValue
|
|
85
|
+
};
|