@progress/kendo-react-grid 10.2.0-develop.9 → 10.3.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.
@@ -0,0 +1,9 @@
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 client";
9
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react"),q=require("react-dom"),I=require("@progress/kendo-react-layout"),s=require("@progress/kendo-react-buttons"),o=require("@progress/kendo-react-labels"),x=require("@progress/kendo-react-intl"),M=require("@progress/kendo-react-dateinputs"),_=require("@progress/kendo-react-common"),m=require("@progress/kendo-svg-icons"),L=require("@progress/kendo-react-inputs"),T=require("@progress/kendo-react-data-tools"),R=require("@progress/kendo-react-dialogs"),r=require("@progress/kendo-react-form"),A=require("../GridClientWrapper.js"),i=require("../messages/index.js"),w=l=>{var p;const S=x.useLocalization(),E=_.useAdaptiveModeContext(),n=e.useContext(A.GridContext),u=(a,t)=>{n.onDialogEditSubmit&&n.onDialogEditSubmit({dataItem:a,syntheticEvent:t})},c=a=>{n.onDialogEditCancel&&n.onDialogEditCancel({syntheticEvent:a})},N=a=>{const{validationMessage:t,visited:z,id:v,valid:O,editor:F,value:b,label:f,...k}=a,C=n.mobileMode?"large":"medium";switch(F){case"numeric":return e.createElement(e.Fragment,null,e.createElement(o.Label,{editorId:v,className:"k-form-label"},f,":"),e.createElement("div",{className:"k-form-field-wrap"},e.createElement(L.NumericTextBox,{...k,size:C,value:b,[T.TABLE_PREVENT_SELECTION_ELEMENT]:!0}),t&&e.createElement(o.Error,null,t)));case"date":return e.createElement(e.Fragment,null,e.createElement(o.Label,{editorId:v,className:"k-form-label"},f,":"),e.createElement("div",{className:"k-form-field-wrap"},e.createElement(M.DatePicker,{valid:!0,...k,value:b,adaptive:n.mobileMode,size:C,[T.TABLE_PREVENT_SELECTION_ELEMENT]:!0}),t&&e.createElement(o.Error,null,t)));case"boolean":return e.createElement("div",{className:"k-form-field-wrap"},e.createElement(o.Label,{editorId:v,className:"k-form-label"},f,":  ",e.createElement(L.Checkbox,{...k,size:C,value:b,[T.TABLE_PREVENT_SELECTION_ELEMENT]:!0}),t&&e.createElement(o.Error,null,t)));default:return e.createElement(e.Fragment,null,e.createElement(o.Label,{editorId:v,className:"k-form-label"},f,":"),e.createElement("div",{className:"k-form-field-wrap"},e.createElement(L.TextBox,{...k,size:C,value:b||"",[T.TABLE_PREVENT_SELECTION_ELEMENT]:!0}),t&&e.createElement(o.Error,null,t)))}},D=S.toLanguageString(i.editDialogTitle,i.messages[i.editDialogTitle]),h=S.toLanguageString(i.editDialogSaveButtonTitle,i.messages[i.editDialogSaveButtonTitle]),B=S.toLanguageString(i.editDialogCancelButtonTitle,i.messages[i.editDialogCancelButtonTitle]),y={animation:!0,navigatable:!1,navigatableElements:[],expand:!0,title:n.adpativeTitle||D,suffixActions:e.createElement(s.Button,{svgIcon:m.xIcon,onClick:c,fillMode:"flat"}),animationStyles:E&&n.adaptiveColumnMenuRef<=E.small?{top:0,width:"100%",height:"100%"}:void 0,className:"k-adaptive-actionsheet",position:E&&n.adaptiveColumnMenuRef<=E.small?"fullscreen":void 0},{customEditDialog:g}=l,d=(p=l.columns)==null?void 0:p.filter(a=>a.editable);return e.createElement(e.Fragment,null,q.createPortal(e.createElement(e.Fragment,null,n.mobileMode?e.createElement(e.Fragment,null,g?e.createElement(g,{columns:l.columns,dataItem:l.dataItem,onSubmit:u,onCancel:c}):e.createElement(r.Form,{initialValues:l.dataItem,onSubmit:u,id:"kendo-grid-edit-dialog",render:a=>e.createElement(I.ActionSheet,{...y},e.createElement(I.ActionSheetContent,null,e.createElement(r.FormElement,null,d==null?void 0:d.map(t=>e.createElement(r.FieldWrapper,{key:t.field},e.createElement(r.Field,{name:t.field,id:t.field,editor:t.editor,component:N,label:t.title||t.field,validator:t==null?void 0:t.validator}))))),e.createElement(I.ActionSheetFooter,null,e.createElement(s.Button,{onClick:c,type:"reset",icon:"cancel",size:"large",svgIcon:m.cancelIcon},B),e.createElement(s.Button,{type:"submit",themeColor:"primary",size:"large",disabled:!a.allowSubmit||!a.valid,onClick:a.onSubmit,icon:"save",svgIcon:m.saveIcon},h)))})):g?e.createElement(g,{columns:l.columns,dataItem:l.dataItem,onSubmit:u,onCancel:c}):e.createElement(r.Form,{initialValues:l.dataItem,onSubmit:u,id:"kendo-grid-edit-dialog",render:a=>e.createElement(R.Dialog,{title:D,width:450,onClose:t=>c(t.syntheticEvent)},e.createElement(r.FormElement,null,d==null?void 0:d.map(t=>e.createElement(r.FieldWrapper,{key:t.field},e.createElement(r.Field,{name:t.field,id:t.field,editor:t.editor,component:N,label:t.title||t.field,validator:t==null?void 0:t.validator})))),e.createElement(R.DialogActionsBar,{layout:"start"},e.createElement(s.Button,{type:"submit",themeColor:"primary",disabled:!a.allowSubmit||!a.valid,onClick:a.onSubmit,icon:"save",svgIcon:m.saveIcon},h),e.createElement(s.Button,{onClick:c,type:"reset",icon:"cancel",svgIcon:m.cancelIcon},B)))})),document.body))};exports.GridEditDialog=w;
@@ -0,0 +1,207 @@
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 client";
9
+ import e from "react";
10
+ import _ from "react-dom";
11
+ import { ActionSheet as O, ActionSheetContent as V, ActionSheetFooter as G } from "@progress/kendo-react-layout";
12
+ import { Button as r } from "@progress/kendo-react-buttons";
13
+ import { Label as v, Error as b } from "@progress/kendo-react-labels";
14
+ import { useLocalization as W } from "@progress/kendo-react-intl";
15
+ import { DatePicker as j } from "@progress/kendo-react-dateinputs";
16
+ import { useAdaptiveModeContext as q } from "@progress/kendo-react-common";
17
+ import { xIcon as H, cancelIcon as D, saveIcon as N } from "@progress/kendo-svg-icons";
18
+ import { TextBox as J, Checkbox as K, NumericTextBox as P } from "@progress/kendo-react-inputs";
19
+ import { TABLE_PREVENT_SELECTION_ELEMENT as p } from "@progress/kendo-react-data-tools";
20
+ import { Dialog as Q, DialogActionsBar as U } from "@progress/kendo-react-dialogs";
21
+ import { Form as T, FormElement as F, FieldWrapper as M, Field as w } from "@progress/kendo-react-form";
22
+ import { GridContext as X } from "../GridClientWrapper.mjs";
23
+ import { editDialogTitle as z, messages as S, editDialogSaveButtonTitle as B, editDialogCancelButtonTitle as L } from "../messages/index.mjs";
24
+ const fe = (l) => {
25
+ var y;
26
+ const C = W(), m = q(), i = e.useContext(X), c = (a, t) => {
27
+ i.onDialogEditSubmit && i.onDialogEditSubmit({ dataItem: a, syntheticEvent: t });
28
+ }, n = (a) => {
29
+ i.onDialogEditCancel && i.onDialogEditCancel({ syntheticEvent: a });
30
+ }, k = (a) => {
31
+ const { validationMessage: t, visited: Y, id: s, valid: Z, editor: R, value: E, label: u, ...f } = a, g = i.mobileMode ? "large" : "medium";
32
+ switch (R) {
33
+ case "numeric":
34
+ return /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement(v, { editorId: s, className: "k-form-label" }, u, ":"), /* @__PURE__ */ e.createElement("div", { className: "k-form-field-wrap" }, /* @__PURE__ */ e.createElement(
35
+ P,
36
+ {
37
+ ...f,
38
+ size: g,
39
+ value: E,
40
+ [p]: !0
41
+ }
42
+ ), t && /* @__PURE__ */ e.createElement(b, null, t)));
43
+ case "date":
44
+ return /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement(v, { editorId: s, className: "k-form-label" }, u, ":"), /* @__PURE__ */ e.createElement("div", { className: "k-form-field-wrap" }, /* @__PURE__ */ e.createElement(
45
+ j,
46
+ {
47
+ valid: !0,
48
+ ...f,
49
+ value: E,
50
+ adaptive: i.mobileMode,
51
+ size: g,
52
+ [p]: !0
53
+ }
54
+ ), t && /* @__PURE__ */ e.createElement(b, null, t)));
55
+ case "boolean":
56
+ return /* @__PURE__ */ e.createElement("div", { className: "k-form-field-wrap" }, /* @__PURE__ */ e.createElement(v, { editorId: s, className: "k-form-label" }, u, ":  ", /* @__PURE__ */ e.createElement(
57
+ K,
58
+ {
59
+ ...f,
60
+ size: g,
61
+ value: E,
62
+ [p]: !0
63
+ }
64
+ ), t && /* @__PURE__ */ e.createElement(b, null, t)));
65
+ default:
66
+ return /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement(v, { editorId: s, className: "k-form-label" }, u, ":"), /* @__PURE__ */ e.createElement("div", { className: "k-form-field-wrap" }, /* @__PURE__ */ e.createElement(
67
+ J,
68
+ {
69
+ ...f,
70
+ size: g,
71
+ value: E || "",
72
+ [p]: !0
73
+ }
74
+ ), t && /* @__PURE__ */ e.createElement(b, null, t)));
75
+ }
76
+ }, I = C.toLanguageString(z, S[z]), h = C.toLanguageString(
77
+ B,
78
+ S[B]
79
+ ), x = C.toLanguageString(
80
+ L,
81
+ S[L]
82
+ ), A = {
83
+ animation: !0,
84
+ navigatable: !1,
85
+ navigatableElements: [],
86
+ expand: !0,
87
+ title: i.adpativeTitle || I,
88
+ suffixActions: /* @__PURE__ */ e.createElement(r, { svgIcon: H, onClick: n, fillMode: "flat" }),
89
+ animationStyles: m && i.adaptiveColumnMenuRef <= m.small ? { top: 0, width: "100%", height: "100%" } : void 0,
90
+ className: "k-adaptive-actionsheet",
91
+ position: m && i.adaptiveColumnMenuRef <= m.small ? "fullscreen" : void 0
92
+ }, { customEditDialog: d } = l, o = (y = l.columns) == null ? void 0 : y.filter((a) => a.editable);
93
+ return /* @__PURE__ */ e.createElement(e.Fragment, null, _.createPortal(
94
+ // eslint-disable-next-line react/jsx-no-useless-fragment
95
+ /* @__PURE__ */ e.createElement(e.Fragment, null, i.mobileMode ? (
96
+ // eslint-disable-next-line react/jsx-no-useless-fragment
97
+ /* @__PURE__ */ e.createElement(e.Fragment, null, d ? /* @__PURE__ */ e.createElement(
98
+ d,
99
+ {
100
+ columns: l.columns,
101
+ dataItem: l.dataItem,
102
+ onSubmit: c,
103
+ onCancel: n
104
+ }
105
+ ) : /* @__PURE__ */ e.createElement(
106
+ T,
107
+ {
108
+ initialValues: l.dataItem,
109
+ onSubmit: c,
110
+ id: "kendo-grid-edit-dialog",
111
+ render: (a) => /* @__PURE__ */ e.createElement(O, { ...A }, /* @__PURE__ */ e.createElement(V, null, /* @__PURE__ */ e.createElement(F, null, o == null ? void 0 : o.map((t) => /* @__PURE__ */ e.createElement(M, { key: t.field }, /* @__PURE__ */ e.createElement(
112
+ w,
113
+ {
114
+ name: t.field,
115
+ id: t.field,
116
+ editor: t.editor,
117
+ component: k,
118
+ label: t.title || t.field,
119
+ validator: t == null ? void 0 : t.validator
120
+ }
121
+ ))))), /* @__PURE__ */ e.createElement(G, null, /* @__PURE__ */ e.createElement(
122
+ r,
123
+ {
124
+ onClick: n,
125
+ type: "reset",
126
+ icon: "cancel",
127
+ size: "large",
128
+ svgIcon: D
129
+ },
130
+ x
131
+ ), /* @__PURE__ */ e.createElement(
132
+ r,
133
+ {
134
+ type: "submit",
135
+ themeColor: "primary",
136
+ size: "large",
137
+ disabled: !a.allowSubmit || !a.valid,
138
+ onClick: a.onSubmit,
139
+ icon: "save",
140
+ svgIcon: N
141
+ },
142
+ h
143
+ )))
144
+ }
145
+ ))
146
+ ) : d ? /* @__PURE__ */ e.createElement(
147
+ d,
148
+ {
149
+ columns: l.columns,
150
+ dataItem: l.dataItem,
151
+ onSubmit: c,
152
+ onCancel: n
153
+ }
154
+ ) : /* @__PURE__ */ e.createElement(
155
+ T,
156
+ {
157
+ initialValues: l.dataItem,
158
+ onSubmit: c,
159
+ id: "kendo-grid-edit-dialog",
160
+ render: (a) => /* @__PURE__ */ e.createElement(
161
+ Q,
162
+ {
163
+ title: I,
164
+ width: 450,
165
+ onClose: (t) => n(t.syntheticEvent)
166
+ },
167
+ /* @__PURE__ */ e.createElement(F, null, o == null ? void 0 : o.map((t) => /* @__PURE__ */ e.createElement(M, { key: t.field }, /* @__PURE__ */ e.createElement(
168
+ w,
169
+ {
170
+ name: t.field,
171
+ id: t.field,
172
+ editor: t.editor,
173
+ component: k,
174
+ label: t.title || t.field,
175
+ validator: t == null ? void 0 : t.validator
176
+ }
177
+ )))),
178
+ /* @__PURE__ */ e.createElement(U, { layout: "start" }, /* @__PURE__ */ e.createElement(
179
+ r,
180
+ {
181
+ type: "submit",
182
+ themeColor: "primary",
183
+ disabled: !a.allowSubmit || !a.valid,
184
+ onClick: a.onSubmit,
185
+ icon: "save",
186
+ svgIcon: N
187
+ },
188
+ h
189
+ ), /* @__PURE__ */ e.createElement(
190
+ r,
191
+ {
192
+ onClick: n,
193
+ type: "reset",
194
+ icon: "cancel",
195
+ svgIcon: D
196
+ },
197
+ x
198
+ ))
199
+ )
200
+ }
201
+ )),
202
+ document.body
203
+ ));
204
+ };
205
+ export {
206
+ fe as GridEditDialog
207
+ };