@progress/kendo-react-grid 15.1.0-develop.1 → 15.1.0-develop.10
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/GridClientWrapper.js +1 -1
- package/GridClientWrapper.mjs +411 -407
- package/GridComponent.js +1 -1
- package/GridComponent.mjs +305 -290
- package/VirtualScroll.d.ts +4 -0
- package/VirtualScroll.js +1 -1
- package/VirtualScroll.mjs +32 -27
- package/cells/groupcell/useGroupCellClientTdProps.js +1 -1
- package/cells/groupcell/useGroupCellClientTdProps.mjs +7 -7
- package/cells/hierarchycell/GridHierarchyCellToggle.js +1 -1
- package/cells/hierarchycell/GridHierarchyCellToggle.mjs +15 -15
- package/columnMenu/GridColumnMenuWrapper.js +1 -1
- package/columnMenu/GridColumnMenuWrapper.mjs +118 -82
- package/components/GridEditDialog.js +1 -1
- package/components/GridEditDialog.mjs +19 -19
- package/components/VirtualScrollOverlay.d.ts +12 -0
- package/components/VirtualScrollOverlay.js +16 -0
- package/components/VirtualScrollOverlay.mjs +65 -0
- package/components/noRecords/GridNoRecordsContainer.js +1 -1
- package/components/noRecords/GridNoRecordsContainer.mjs +10 -9
- package/dist/cdn/js/kendo-react-grid.js +1 -1
- package/drag/ColumnResize.js +1 -1
- package/drag/ColumnResize.mjs +84 -84
- package/getRowContents.js +1 -1
- package/getRowContents.mjs +12 -12
- package/index.d.mts +2 -1
- package/index.d.ts +2 -1
- package/interfaces/GridProps.d.ts +2 -1
- package/interfaces/GridScrollableSettings.d.ts +33 -0
- package/interfaces/VirtualScrollInterface.d.ts +2 -0
- package/package-metadata.js +1 -1
- package/package-metadata.mjs +2 -2
- package/package.json +17 -17
- package/toolbar-tools/GridToolbarColumnsChooser.js +1 -1
- package/toolbar-tools/GridToolbarColumnsChooser.mjs +33 -33
- package/toolbar-tools/GridToolbarFilter.js +1 -1
- package/toolbar-tools/GridToolbarFilter.mjs +207 -194
- package/toolbar-tools/GridToolbarSort.js +1 -1
- package/toolbar-tools/GridToolbarSort.mjs +84 -101
- package/toolbar-tools/adaptiveContent/GridAdaptiveToolbarFilter.js +1 -1
- package/toolbar-tools/adaptiveContent/GridAdaptiveToolbarFilter.mjs +50 -46
- package/toolbar-tools/adaptiveContent/GridAdaptiveToolbarSort.d.ts +0 -1
- package/toolbar-tools/adaptiveContent/GridAdaptiveToolbarSort.js +1 -1
- package/toolbar-tools/adaptiveContent/GridAdaptiveToolbarSort.mjs +10 -19
- package/utils/index.js +1 -1
- package/utils/index.mjs +161 -161
package/VirtualScroll.d.ts
CHANGED
|
@@ -24,14 +24,18 @@ export declare class VirtualScroll implements VirtualScrollInterface {
|
|
|
24
24
|
fixedScroll: boolean;
|
|
25
25
|
tableTransform: string;
|
|
26
26
|
rowHeightService?: RowHeightService;
|
|
27
|
+
scrollbarOverlaySpacerElement: HTMLDivElement | null;
|
|
27
28
|
private reactVersion;
|
|
28
29
|
private scrollSyncing;
|
|
30
|
+
private pendingTranslate;
|
|
31
|
+
private deferredScrollTop;
|
|
29
32
|
private firstToLoad;
|
|
30
33
|
private lastScrollTop;
|
|
31
34
|
private firstLoaded;
|
|
32
35
|
private lastLoaded;
|
|
33
36
|
constructor();
|
|
34
37
|
reset(): void;
|
|
38
|
+
scrollToPosition(scrollTop: number, e: React.SyntheticEvent<HTMLDivElement>, deferTranslate?: boolean): void;
|
|
35
39
|
scrollHandler(e: React.SyntheticEvent<HTMLDivElement>): void;
|
|
36
40
|
update(): void;
|
|
37
41
|
private loadPage;
|
package/VirtualScroll.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 d=require("react"),f=require("./utils/index.js");function g(o){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(o){for(const e in o)if(e!=="default"){const i=Object.getOwnPropertyDescriptor(o,e);Object.defineProperty(t,e,i.get?i:{enumerable:!0,get:()=>o[e]})}}return t.default=o,Object.freeze(t)}const u=g(d),S=.3;class p{constructor(){this.table=null,this.tableBody=null,this.container=null,this.scrollHeightContainer=null,this.total=0,this.scrollableVirtual=!1,this.pageSize=0,this.PageChange=null,this.fixedScroll=!1,this.tableTransform="",this.scrollbarOverlaySpacerElement=null,this.reactVersion=Number.parseFloat(u.version),this.scrollSyncing=!1,this.pendingTranslate=!1,this.deferredScrollTop=0,this.firstToLoad=0,this.lastScrollTop=0,this.firstLoaded=0,this.lastLoaded=0,this.scrollHandler=this.scrollHandler.bind(this)}reset(){if(this.firstToLoad=0,this.firstLoaded=0,this.lastLoaded=0,this.rowHeightService=void 0,this.fixedScroll){this.lastScrollTop=this.container?this.container.scrollTop:0;return}this.container&&this.container.scrollTop!==0&&(this.scrollSyncing=!0,this.container.scrollTop=0,this.lastScrollTop=0,this.translate(0,!0))}scrollToPosition(t,e,i=!1){var c;if(!this.scrollableVirtual||!this.rowHeightService)return;i&&(this.pendingTranslate=!0,this.deferredScrollTop=t);const s=this.lastScrollTop>=t,a=!s;this.lastScrollTop=t;const l=((c=this.container)==null?void 0:c.offsetHeight)||0;let r=this.rowHeightService.index(t);const h=this.rowHeightService.index(t+l),n=Math.max(r+this.pageSize-this.total,0);r=Math.max(r-n,0),a&&h>=this.lastLoaded&&this.lastLoaded<this.total-1?(this.firstToLoad=r,this.loadPage(e)):(s&&r<this.firstToLoad||r>this.lastLoaded||h<this.firstLoaded)&&this.loadPageWithBuffer(r,n,s,e)}scrollHandler(t){if(this.scrollSyncing){this.scrollSyncing=!1;return}!this.scrollableVirtual||!this.container||!this.table||!this.rowHeightService||this.scrollToPosition(this.container.scrollTop,t)}update(){var e;const t=this.getItemHeights();if(this.firstLoaded>this.firstToLoad){const i=Math.min(this.firstLoaded-this.firstToLoad,this.pageSize),s=this.getTotalHeight(i,t),a=this.getExpectedTotalHeight(i),l=s-a;l!==0&&this.adjustScroll(l)}(e=this.rowHeightService)==null||e.update(this.firstToLoad,t),this.setScrollHeightContainerHeight(),this.firstLoaded=this.firstToLoad,this.lastLoaded=this.firstLoaded+t.length-1,this.pendingTranslate&&this.rowHeightService&&(this.translate(this.rowHeightService.offset(this.firstLoaded),!0),this.container&&(this.scrollSyncing=!0,this.container.scrollTop=this.deferredScrollTop),this.pendingTranslate=!1)}loadPage(t){this.rowHeightService&&(this.pendingTranslate||this.translate(this.rowHeightService.offset(this.firstToLoad)),this.changePage(this.firstToLoad,t))}loadPageWithBuffer(t,e,i,s){const a=i?Math.max(Math.floor(this.pageSize*S)-e,0):0;this.firstToLoad=Math.max(t-a,0),this.loadPage(s)}translate(t,e){this.scrollableVirtual&&this.table&&((this.reactVersion<=17||e)&&(this.table.style.transform="translateY("+t+"px)"),this.reactVersion>17&&(this.tableTransform="translateY("+t+"px)"))}changePage(t,e){this.PageChange&&this.PageChange({skip:Math.max(0,t),take:this.pageSize},e)}adjustScroll(t){this.scrollSyncing=!0,this.container&&(this.container.scrollTop+=t)}setScrollHeightContainerHeight(){var t;if(this.scrollableVirtual&&this.scrollHeightContainer){let e=((t=this.rowHeightService)==null?void 0:t.totalHeight())||0;e=f.firefox?Math.min(f.firefoxMaxHeight,e):e,this.scrollHeightContainer.style.height=e+"px",this.scrollbarOverlaySpacerElement&&(this.scrollbarOverlaySpacerElement.style.height=e+"px")}}getItemHeights(){const t=[];return this.tableBody&&Array.from(this.tableBody.children).forEach(e=>{const i=e.offsetHeight;e.classList.contains("k-detail-row")?t[t.length-1]+=i:t.push(i)}),t}getTotalHeight(t,e){return e.slice(0,t).reduce((i,s)=>i+s,0)}getExpectedTotalHeight(t){const e=this.rowHeightService;if(!e)return 0;const i=this.firstToLoad+(t-1);return e.offset(i)+e.height(i)-e.offset(this.firstToLoad)}}exports.VirtualScroll=p;
|
package/VirtualScroll.mjs
CHANGED
|
@@ -5,12 +5,12 @@
|
|
|
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 { firefox as
|
|
10
|
-
const
|
|
11
|
-
class
|
|
8
|
+
import * as c from "react";
|
|
9
|
+
import { firefox as f, firefoxMaxHeight as d } from "./utils/index.mjs";
|
|
10
|
+
const g = 0.3;
|
|
11
|
+
class p {
|
|
12
12
|
constructor() {
|
|
13
|
-
this.table = null, this.tableBody = null, this.container = null, this.scrollHeightContainer = null, this.total = 0, this.scrollableVirtual = !1, this.pageSize = 0, this.PageChange = null, this.fixedScroll = !1, this.tableTransform = "", this.reactVersion = Number.parseFloat(
|
|
13
|
+
this.table = null, this.tableBody = null, this.container = null, this.scrollHeightContainer = null, this.total = 0, this.scrollableVirtual = !1, this.pageSize = 0, this.PageChange = null, this.fixedScroll = !1, this.tableTransform = "", this.scrollbarOverlaySpacerElement = null, this.reactVersion = Number.parseFloat(c.version), this.scrollSyncing = !1, this.pendingTranslate = !1, this.deferredScrollTop = 0, this.firstToLoad = 0, this.lastScrollTop = 0, this.firstLoaded = 0, this.lastLoaded = 0, this.scrollHandler = this.scrollHandler.bind(this);
|
|
14
14
|
}
|
|
15
15
|
reset() {
|
|
16
16
|
if (this.firstToLoad = 0, this.firstLoaded = 0, this.lastLoaded = 0, this.rowHeightService = void 0, this.fixedScroll) {
|
|
@@ -19,35 +19,40 @@ class u {
|
|
|
19
19
|
}
|
|
20
20
|
this.container && this.container.scrollTop !== 0 && (this.scrollSyncing = !0, this.container.scrollTop = 0, this.lastScrollTop = 0, this.translate(0, !0));
|
|
21
21
|
}
|
|
22
|
+
scrollToPosition(t, i, e = !1) {
|
|
23
|
+
var n;
|
|
24
|
+
if (!this.scrollableVirtual || !this.rowHeightService)
|
|
25
|
+
return;
|
|
26
|
+
e && (this.pendingTranslate = !0, this.deferredScrollTop = t);
|
|
27
|
+
const s = this.lastScrollTop >= t, o = !s;
|
|
28
|
+
this.lastScrollTop = t;
|
|
29
|
+
const a = ((n = this.container) == null ? void 0 : n.offsetHeight) || 0;
|
|
30
|
+
let r = this.rowHeightService.index(t);
|
|
31
|
+
const h = this.rowHeightService.index(t + a), l = Math.max(r + this.pageSize - this.total, 0);
|
|
32
|
+
r = Math.max(r - l, 0), o && h >= this.lastLoaded && this.lastLoaded < this.total - 1 ? (this.firstToLoad = r, this.loadPage(i)) : (s && r < this.firstToLoad || r > this.lastLoaded || h < this.firstLoaded) && this.loadPageWithBuffer(r, l, s, i);
|
|
33
|
+
}
|
|
22
34
|
scrollHandler(t) {
|
|
23
35
|
if (this.scrollSyncing) {
|
|
24
36
|
this.scrollSyncing = !1;
|
|
25
37
|
return;
|
|
26
38
|
}
|
|
27
|
-
|
|
28
|
-
return;
|
|
29
|
-
const i = this.container.scrollTop, s = this.lastScrollTop >= i, o = !s;
|
|
30
|
-
this.lastScrollTop = i;
|
|
31
|
-
const r = this.container.offsetHeight;
|
|
32
|
-
let e = this.rowHeightService.index(i);
|
|
33
|
-
const a = this.rowHeightService.index(i + r), h = Math.max(e + this.pageSize - this.total, 0);
|
|
34
|
-
e = Math.max(e - h, 0), o && a >= this.lastLoaded && this.lastLoaded < this.total - 1 ? (this.firstToLoad = e, this.loadPage(t)) : (s && e < this.firstToLoad || e > this.lastLoaded || a < this.firstLoaded) && this.loadPageWithBuffer(e, h, s, t);
|
|
39
|
+
!this.scrollableVirtual || !this.container || !this.table || !this.rowHeightService || this.scrollToPosition(this.container.scrollTop, t);
|
|
35
40
|
}
|
|
36
41
|
update() {
|
|
37
42
|
var i;
|
|
38
43
|
const t = this.getItemHeights();
|
|
39
44
|
if (this.firstLoaded > this.firstToLoad) {
|
|
40
|
-
const
|
|
41
|
-
|
|
45
|
+
const e = Math.min(this.firstLoaded - this.firstToLoad, this.pageSize), s = this.getTotalHeight(e, t), o = this.getExpectedTotalHeight(e), a = s - o;
|
|
46
|
+
a !== 0 && this.adjustScroll(a);
|
|
42
47
|
}
|
|
43
|
-
(i = this.rowHeightService) == null || i.update(this.firstToLoad, t), this.setScrollHeightContainerHeight(), this.firstLoaded = this.firstToLoad, this.lastLoaded = this.firstLoaded + t.length - 1;
|
|
48
|
+
(i = this.rowHeightService) == null || i.update(this.firstToLoad, t), this.setScrollHeightContainerHeight(), this.firstLoaded = this.firstToLoad, this.lastLoaded = this.firstLoaded + t.length - 1, this.pendingTranslate && this.rowHeightService && (this.translate(this.rowHeightService.offset(this.firstLoaded), !0), this.container && (this.scrollSyncing = !0, this.container.scrollTop = this.deferredScrollTop), this.pendingTranslate = !1);
|
|
44
49
|
}
|
|
45
50
|
loadPage(t) {
|
|
46
|
-
this.rowHeightService && (this.translate(this.rowHeightService.offset(this.firstToLoad)), this.changePage(this.firstToLoad, t));
|
|
51
|
+
this.rowHeightService && (this.pendingTranslate || this.translate(this.rowHeightService.offset(this.firstToLoad)), this.changePage(this.firstToLoad, t));
|
|
47
52
|
}
|
|
48
|
-
loadPageWithBuffer(t, i,
|
|
49
|
-
const
|
|
50
|
-
this.firstToLoad = Math.max(t -
|
|
53
|
+
loadPageWithBuffer(t, i, e, s) {
|
|
54
|
+
const o = e ? Math.max(Math.floor(this.pageSize * g) - i, 0) : 0;
|
|
55
|
+
this.firstToLoad = Math.max(t - o, 0), this.loadPage(s);
|
|
51
56
|
}
|
|
52
57
|
translate(t, i) {
|
|
53
58
|
this.scrollableVirtual && this.table && ((this.reactVersion <= 17 || i) && (this.table.style.transform = "translateY(" + t + "px)"), this.reactVersion > 17 && (this.tableTransform = "translateY(" + t + "px)"));
|
|
@@ -68,27 +73,27 @@ class u {
|
|
|
68
73
|
var t;
|
|
69
74
|
if (this.scrollableVirtual && this.scrollHeightContainer) {
|
|
70
75
|
let i = ((t = this.rowHeightService) == null ? void 0 : t.totalHeight()) || 0;
|
|
71
|
-
i =
|
|
76
|
+
i = f ? Math.min(d, i) : i, this.scrollHeightContainer.style.height = i + "px", this.scrollbarOverlaySpacerElement && (this.scrollbarOverlaySpacerElement.style.height = i + "px");
|
|
72
77
|
}
|
|
73
78
|
}
|
|
74
79
|
getItemHeights() {
|
|
75
80
|
const t = [];
|
|
76
81
|
return this.tableBody && Array.from(this.tableBody.children).forEach((i) => {
|
|
77
|
-
const
|
|
78
|
-
i.classList.contains("k-detail-row") ? t[t.length - 1] +=
|
|
82
|
+
const e = i.offsetHeight;
|
|
83
|
+
i.classList.contains("k-detail-row") ? t[t.length - 1] += e : t.push(e);
|
|
79
84
|
}), t;
|
|
80
85
|
}
|
|
81
86
|
getTotalHeight(t, i) {
|
|
82
|
-
return i.slice(0, t).reduce((
|
|
87
|
+
return i.slice(0, t).reduce((e, s) => e + s, 0);
|
|
83
88
|
}
|
|
84
89
|
getExpectedTotalHeight(t) {
|
|
85
90
|
const i = this.rowHeightService;
|
|
86
91
|
if (!i)
|
|
87
92
|
return 0;
|
|
88
|
-
const
|
|
89
|
-
return i.offset(
|
|
93
|
+
const e = this.firstToLoad + (t - 1);
|
|
94
|
+
return i.offset(e) + i.height(e) - i.offset(this.firstToLoad);
|
|
90
95
|
}
|
|
91
96
|
}
|
|
92
97
|
export {
|
|
93
|
-
|
|
98
|
+
p as VirtualScroll
|
|
94
99
|
};
|
|
@@ -6,4 +6,4 @@
|
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
8
|
"use client";
|
|
9
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("react"),y=require("../../utils/GridContext.js"),
|
|
9
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("react"),y=require("../../utils/GridContext.js"),r=require("@progress/kendo-react-data-tools"),C=require("@progress/kendo-react-common"),u=require("../hooks.js");function g(e){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const a=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,a.get?a:{enumerable:!0,get:()=>e[t]})}}return n.default=e,Object.freeze(n)}const d=g(f),m=(e,n)=>{const t=d.useContext(y.GridContext),a=r.useTableKeyboardNavigation(e.id),i=u.useContextMenuHandler(e.dataItem,e.field),s=u.usePositionStyle(e),c=d.useCallback(o=>{o.isDefaultPrevented()||o.keyCode===C.Keys.enter&&(t!=null&&t.itemChange)&&(o.preventDefault(),t.itemChange({dataItem:e.dataItem,dataIndex:e.dataIndex,syntheticEvent:o,field:void 0,value:!e.expanded}),t.dispatchGroupExpand({type:r.GROUP_EXPAND_ACTION.TOGGLE,group:e.group},o))},[t,e.dataItem,e.dataIndex,e.expanded,e.group]);return{...a,...n?{onKeyDown:c}:{},onContextMenu:i,style:s}};exports.useGroupCellClientTdProps=m;
|
|
@@ -10,9 +10,9 @@ import * as a from "react";
|
|
|
10
10
|
import { GridContext as m } from "../../utils/GridContext.mjs";
|
|
11
11
|
import { useTableKeyboardNavigation as s, GROUP_EXPAND_ACTION as f } from "@progress/kendo-react-data-tools";
|
|
12
12
|
import { Keys as y } from "@progress/kendo-react-common";
|
|
13
|
-
import { useContextMenuHandler as
|
|
14
|
-
const
|
|
15
|
-
const e = a.useContext(m), d = s(t.id), i =
|
|
13
|
+
import { useContextMenuHandler as x, usePositionStyle as C } from "../hooks.mjs";
|
|
14
|
+
const K = (t, o) => {
|
|
15
|
+
const e = a.useContext(m), d = s(t.id), i = x(t.dataItem, t.field), r = C(t), u = a.useCallback(
|
|
16
16
|
(n) => {
|
|
17
17
|
n.isDefaultPrevented() || n.keyCode === y.enter && (e != null && e.itemChange) && (n.preventDefault(), e.itemChange({
|
|
18
18
|
dataItem: t.dataItem,
|
|
@@ -20,7 +20,7 @@ const b = (t, o) => {
|
|
|
20
20
|
syntheticEvent: n,
|
|
21
21
|
field: void 0,
|
|
22
22
|
value: !t.expanded
|
|
23
|
-
}), e
|
|
23
|
+
}), e.dispatchGroupExpand(
|
|
24
24
|
{
|
|
25
25
|
type: f.TOGGLE,
|
|
26
26
|
group: t.group
|
|
@@ -33,12 +33,12 @@ const b = (t, o) => {
|
|
|
33
33
|
return {
|
|
34
34
|
...d,
|
|
35
35
|
...o ? {
|
|
36
|
-
onKeyDown:
|
|
36
|
+
onKeyDown: u
|
|
37
37
|
} : {},
|
|
38
38
|
onContextMenu: i,
|
|
39
|
-
style:
|
|
39
|
+
style: r
|
|
40
40
|
};
|
|
41
41
|
};
|
|
42
42
|
export {
|
|
43
|
-
|
|
43
|
+
K as useGroupCellClientTdProps
|
|
44
44
|
};
|
|
@@ -6,4 +6,4 @@
|
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
8
|
"use client";
|
|
9
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react"),u=require("../../utils/GridContext.js"),m=require("@progress/kendo-react-common"),
|
|
9
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react"),u=require("../../utils/GridContext.js"),m=require("@progress/kendo-react-common"),d=require("@progress/kendo-svg-icons"),g=require("@progress/kendo-react-intl"),o=require("../../messages/index.js"),f=require("@progress/kendo-react-data-tools");function I(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const a=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,a.get?a:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const c=I(s),b=e=>{const t=c.useContext(u.GridContext),n=g.useLocalization(),a=e.expanded,i=a?o.detailCollapse:o.detailExpand,l=n.toLanguageString(i,o.messages[i]);return c.createElement("a",{onClick:r=>{r.preventDefault(),t!=null&&t.itemChange&&t.itemChange({dataItem:e.dataItem,dataIndex:e.dataIndex,syntheticEvent:r,field:e.field,value:!a,_expand:!0}),t&&e.dataItem[t.dataItemKey]!==void 0&&t.dispatchDetailExpand({type:f.DETAIL_EXPAND_ACTION.TOGGLE,id:e.dataItem[t.dataItemKey]})},"aria-label":l,href:"#",tabIndex:-1},c.createElement(m.IconWrap,{name:a?"minus":"plus",icon:a?d.minusIcon:d.plusIcon}))};exports.GridHierarchyCellToggle=b;
|
|
@@ -7,35 +7,35 @@
|
|
|
7
7
|
*/
|
|
8
8
|
"use client";
|
|
9
9
|
import * as n from "react";
|
|
10
|
-
import { GridContext as
|
|
11
|
-
import { IconWrap as
|
|
10
|
+
import { GridContext as r } from "../../utils/GridContext.mjs";
|
|
11
|
+
import { IconWrap as l } from "@progress/kendo-react-common";
|
|
12
12
|
import { minusIcon as c, plusIcon as s } from "@progress/kendo-svg-icons";
|
|
13
13
|
import { useLocalization as I } from "@progress/kendo-react-intl";
|
|
14
14
|
import { detailCollapse as f, detailExpand as u, messages as p } from "../../messages/index.mjs";
|
|
15
15
|
import { DETAIL_EXPAND_ACTION as x } from "@progress/kendo-react-data-tools";
|
|
16
|
-
const D = (
|
|
17
|
-
const e = n.useContext(
|
|
16
|
+
const D = (t) => {
|
|
17
|
+
const e = n.useContext(r), m = I(), a = t.expanded, i = a ? f : u, d = m.toLanguageString(i, p[i]);
|
|
18
18
|
return /* @__PURE__ */ n.createElement(
|
|
19
19
|
"a",
|
|
20
20
|
{
|
|
21
|
-
onClick: (
|
|
22
|
-
|
|
23
|
-
dataItem:
|
|
24
|
-
dataIndex:
|
|
25
|
-
syntheticEvent:
|
|
26
|
-
field:
|
|
27
|
-
value: !
|
|
21
|
+
onClick: (o) => {
|
|
22
|
+
o.preventDefault(), e != null && e.itemChange && e.itemChange({
|
|
23
|
+
dataItem: t.dataItem,
|
|
24
|
+
dataIndex: t.dataIndex,
|
|
25
|
+
syntheticEvent: o,
|
|
26
|
+
field: t.field,
|
|
27
|
+
value: !a,
|
|
28
28
|
_expand: !0
|
|
29
|
-
}),
|
|
29
|
+
}), e && t.dataItem[e.dataItemKey] !== void 0 && e.dispatchDetailExpand({
|
|
30
30
|
type: x.TOGGLE,
|
|
31
|
-
id:
|
|
32
|
-
})
|
|
31
|
+
id: t.dataItem[e.dataItemKey]
|
|
32
|
+
});
|
|
33
33
|
},
|
|
34
34
|
"aria-label": d,
|
|
35
35
|
href: "#",
|
|
36
36
|
tabIndex: -1
|
|
37
37
|
},
|
|
38
|
-
/* @__PURE__ */ n.createElement(
|
|
38
|
+
/* @__PURE__ */ n.createElement(l, { name: a ? "minus" : "plus", icon: a ? c : s })
|
|
39
39
|
);
|
|
40
40
|
};
|
|
41
41
|
export {
|
|
@@ -6,4 +6,4 @@
|
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
8
|
"use client";
|
|
9
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
9
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const J=require("react"),Q=require("@progress/kendo-react-popup"),d=require("@progress/kendo-react-common"),X=require("@progress/kendo-svg-icons"),w=require("../messages/index.js"),Y=require("@progress/kendo-react-intl"),Z=require("../utils/GridContext.js"),ee=require("./adaptiveContext/GridColumnMenuAdaptiveContext.js"),ne=require("./adaptiveContent/GridAdaptiveColumnMenu.js"),te=require("react-dom");function oe(r){const c=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const l in r)if(l!=="default"){const a=Object.getOwnPropertyDescriptor(r,l);Object.defineProperty(c,l,a.get?a:{enumerable:!0,get:()=>r[l]})}}return c.default=r,Object.freeze(c)}const t=oe(J),re=[".k-columnmenu-item-content",".k-filter-menu-container"].map(r=>d.FOCUSABLE_ELEMENTS.map(c=>`${r} ${c}`)),ce=[[".k-columnmenu-item"],...re],se=r=>{var A;const c=t.useContext(Z.GridContext),[l,a]=t.useState(!1),i=t.useRef(null),E=t.useRef(null),m=t.useRef(null),M=t.useRef(0),x=d.useDocument(i),{columnMenu:v,...b}=r,{column:f,columnMenuIcon:h,navigatable:y}=r,I=Y.useLocalization(),D=f.title||f.field,P=D?`${D} `:"",L="#",N=n=>{const e=d.getActiveElement(document);clearTimeout(M.current),M.current=window.setTimeout(()=>{!c.mobileMode&&e&&n.relatedTarget!==i.current&&E.current&&!E.current.contains(e)&&C()})},W=()=>{clearTimeout(M.current)},z=n=>{n.preventDefault(),l&&r.onCloseMenu&&r.onCloseMenu(),a(!l)},C=()=>{r.onCloseMenu&&r.onCloseMenu(),a(!1),!r.navigatable&&i.current&&i.current.focus()},B=n=>{var e;if(n.key==="Tab"){const o=n.target,u=o&&((e=o.closest(".k-grid"))==null?void 0:e.getElementsByClassName("k-grid-content")[0]);u&&u.scrollWidth>u.clientWidth&&o.scrollIntoView({inline:"center"})}},g=t.useMemo(()=>r.show!==void 0?r.show:l,[r.show,l]);t.useEffect(()=>{var G;if(!g||!i.current)return;const n=i.current,e=n.closest(".k-grid-header-wrap"),o=[];let u=n.closest(".k-grid");for(;u;){const s=(G=u.parentElement)==null?void 0:G.closest(".k-grid-content, .k-virtual-content");if(s)o.push(s),u=s.closest(".k-grid");else break}const p=()=>{a(!1),r.onCloseMenu&&r.onCloseMenu()},R=()=>{p()},T=()=>{const s=n.getBoundingClientRect();for(const j of o){const q=j.getBoundingClientRect();if(s.bottom<q.top||s.top>q.bottom){p();return}}};return e&&e.addEventListener("scroll",R),o.forEach(s=>{s.addEventListener("scroll",T)}),()=>{e&&e.removeEventListener("scroll",R),o.forEach(s=>{s.removeEventListener("scroll",T)})}},[g]);const F=n=>{var e;(e=m.current)==null||e.triggerKeyboardEvent(n)},K=n=>{var e;(e=m.current)==null||e.triggerMouseEvent(n)},_=(n,e,o)=>{o.preventDefault(),o.shiftKey?e.focusPrevious(n):e.focusNext(n)},$=(n,e,o)=>{n&&(o.preventDefault(),n.click())},O=(n,e,o)=>{o.preventDefault(),C()},V=(n,e,o)=>{e.focusElement(n)},H=n=>{!n.isAnchorClicked&&a(!1)},k=t.useCallback((n,e)=>{const o=[];if(!e||typeof e!="object")return!1;if(Array.isArray(e.filters)){for(const u of e.filters)if(k(n,u))return!0}return"field"in e&&typeof e.field=="string"&&o.push(e.field),o.includes(n)},[]),S=t.useCallback((n,e)=>!e||!Array.isArray(e)?!1:e.some(o=>o.field===n),[]),U=t.useMemo(()=>f.field&&(k(f.field,c.filter)||S(f.field,c.group)),[f.field,c.filter,c.group,k,S]);return t.useEffect(()=>(g&&E.current&&(m.current=new d.Navigation({tabIndex:0,root:E,selectors:ce,keyboardEvents:{keydown:{Tab:_,Enter:$,Escape:O}},mouseEvents:{mousedown:V}}),m.current.focusElement(m.current.first,null)),()=>{m.current&&(m.current=null)}),[g]),t.createElement(t.Fragment,null,t.createElement("a",{className:d.classNames("k-grid-header-menu k-grid-column-menu",{"k-active":U}),ref:i,onClick:z,onKeyDown:B,href:L,tabIndex:y?-1:void 0,"aria-label":`${y?"":P}${I.toLanguageString(w.columnMenu,w.messages[w.columnMenu])}`},h?t.createElement(d.IconWrap,{name:h.name,icon:h}):t.createElement(d.IconWrap,{name:"more-vertical",icon:X.moreVerticalIcon})),t.createElement(ee.GridColumnMenuAdaptiveProvider,null,c.mobileMode?t.createElement(t.Fragment,null,te.createPortal(t.createElement(ne.GridAdaptiveColumnMenu,{computedShow:g,ColumnMenu:v,closeMenu:C},v&&t.createElement(v,{...b,onCloseMenu:C})),(A=x())==null?void 0:A.body)):t.createElement(Q.Popup,{anchor:i.current,show:g,popupClass:"k-grid-columnmenu-popup",onMouseDownOutside:H},t.createElement("div",{ref:E,onBlur:N,onFocus:W,onMouseDown:K,onKeyDown:F,className:"k-column-menu k-column-menu-md"},v&&t.createElement(v,{...b,onCloseMenu:C})))))};exports.GridColumnMenuWrapper=se;
|
|
@@ -6,125 +6,161 @@
|
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
8
|
"use client";
|
|
9
|
-
import * as
|
|
10
|
-
import { Popup as
|
|
11
|
-
import { useDocument as
|
|
12
|
-
import { moreVerticalIcon as
|
|
13
|
-
import { columnMenu as
|
|
14
|
-
import { useLocalization as
|
|
15
|
-
import { GridContext as
|
|
16
|
-
import { GridColumnMenuAdaptiveProvider as
|
|
17
|
-
import { GridAdaptiveColumnMenu as
|
|
18
|
-
import
|
|
19
|
-
const
|
|
20
|
-
var
|
|
21
|
-
const
|
|
22
|
-
const e =
|
|
23
|
-
clearTimeout(
|
|
24
|
-
!
|
|
9
|
+
import * as t from "react";
|
|
10
|
+
import { Popup as X } from "@progress/kendo-react-popup";
|
|
11
|
+
import { useDocument as Y, Navigation as Z, classNames as O, IconWrap as L, FOCUSABLE_ELEMENTS as j, getActiveElement as ee } from "@progress/kendo-react-common";
|
|
12
|
+
import { moreVerticalIcon as ne } from "@progress/kendo-svg-icons";
|
|
13
|
+
import { columnMenu as x, messages as te } from "../messages/index.mjs";
|
|
14
|
+
import { useLocalization as oe } from "@progress/kendo-react-intl";
|
|
15
|
+
import { GridContext as re } from "../utils/GridContext.mjs";
|
|
16
|
+
import { GridColumnMenuAdaptiveProvider as ce } from "./adaptiveContext/GridColumnMenuAdaptiveContext.mjs";
|
|
17
|
+
import { GridAdaptiveColumnMenu as se } from "./adaptiveContent/GridAdaptiveColumnMenu.mjs";
|
|
18
|
+
import le from "react-dom";
|
|
19
|
+
const ue = [".k-columnmenu-item-content", ".k-filter-menu-container"].map((r) => j.map((l) => `${r} ${l}`)), ie = [[".k-columnmenu-item"], ...ue], Me = (r) => {
|
|
20
|
+
var D;
|
|
21
|
+
const l = t.useContext(re), [h, g] = t.useState(!1), u = t.useRef(null), f = t.useRef(null), i = t.useRef(null), v = t.useRef(0), G = Y(u), { columnMenu: d, ...p } = r, { column: a, columnMenuIcon: C, navigatable: w } = r, N = oe(), y = a.title || a.field, B = y ? `${y} ` : "", F = "#", I = (n) => {
|
|
22
|
+
const e = ee(document);
|
|
23
|
+
clearTimeout(v.current), v.current = window.setTimeout(() => {
|
|
24
|
+
!l.mobileMode && e && n.relatedTarget !== u.current && f.current && !f.current.contains(e) && E();
|
|
25
25
|
});
|
|
26
|
-
},
|
|
27
|
-
clearTimeout(
|
|
28
|
-
},
|
|
29
|
-
n.preventDefault(),
|
|
30
|
-
},
|
|
31
|
-
r.onCloseMenu && r.onCloseMenu(),
|
|
32
|
-
},
|
|
26
|
+
}, K = () => {
|
|
27
|
+
clearTimeout(v.current);
|
|
28
|
+
}, z = (n) => {
|
|
29
|
+
n.preventDefault(), h && r.onCloseMenu && r.onCloseMenu(), g(!h);
|
|
30
|
+
}, E = () => {
|
|
31
|
+
r.onCloseMenu && r.onCloseMenu(), g(!1), !r.navigatable && u.current && u.current.focus();
|
|
32
|
+
}, P = (n) => {
|
|
33
33
|
var e;
|
|
34
34
|
if (n.key === "Tab") {
|
|
35
|
-
const
|
|
36
|
-
|
|
35
|
+
const o = n.target, s = o && ((e = o.closest(".k-grid")) == null ? void 0 : e.getElementsByClassName("k-grid-content")[0]);
|
|
36
|
+
s && s.scrollWidth > s.clientWidth && o.scrollIntoView({ inline: "center" });
|
|
37
37
|
}
|
|
38
|
-
},
|
|
38
|
+
}, m = t.useMemo(() => r.show !== void 0 ? r.show : h, [r.show, h]);
|
|
39
|
+
t.useEffect(() => {
|
|
40
|
+
var R;
|
|
41
|
+
if (!m || !u.current)
|
|
42
|
+
return;
|
|
43
|
+
const n = u.current, e = n.closest(".k-grid-header-wrap"), o = [];
|
|
44
|
+
let s = n.closest(".k-grid");
|
|
45
|
+
for (; s; ) {
|
|
46
|
+
const c = (R = s.parentElement) == null ? void 0 : R.closest(".k-grid-content, .k-virtual-content");
|
|
47
|
+
if (c)
|
|
48
|
+
o.push(c), s = c.closest(".k-grid");
|
|
49
|
+
else
|
|
50
|
+
break;
|
|
51
|
+
}
|
|
52
|
+
const k = () => {
|
|
53
|
+
g(!1), r.onCloseMenu && r.onCloseMenu();
|
|
54
|
+
}, A = () => {
|
|
55
|
+
k();
|
|
56
|
+
}, S = () => {
|
|
57
|
+
const c = n.getBoundingClientRect();
|
|
58
|
+
for (const Q of o) {
|
|
59
|
+
const T = Q.getBoundingClientRect();
|
|
60
|
+
if (c.bottom < T.top || c.top > T.bottom) {
|
|
61
|
+
k();
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
return e && e.addEventListener("scroll", A), o.forEach((c) => {
|
|
67
|
+
c.addEventListener("scroll", S);
|
|
68
|
+
}), () => {
|
|
69
|
+
e && e.removeEventListener("scroll", A), o.forEach((c) => {
|
|
70
|
+
c.removeEventListener("scroll", S);
|
|
71
|
+
});
|
|
72
|
+
};
|
|
73
|
+
}, [m]);
|
|
74
|
+
const W = (n) => {
|
|
39
75
|
var e;
|
|
40
|
-
(e =
|
|
41
|
-
},
|
|
76
|
+
(e = i.current) == null || e.triggerKeyboardEvent(n);
|
|
77
|
+
}, $ = (n) => {
|
|
42
78
|
var e;
|
|
43
|
-
(e =
|
|
44
|
-
},
|
|
45
|
-
|
|
46
|
-
},
|
|
47
|
-
n && (
|
|
48
|
-
},
|
|
49
|
-
|
|
50
|
-
},
|
|
79
|
+
(e = i.current) == null || e.triggerMouseEvent(n);
|
|
80
|
+
}, V = (n, e, o) => {
|
|
81
|
+
o.preventDefault(), o.shiftKey ? e.focusPrevious(n) : e.focusNext(n);
|
|
82
|
+
}, H = (n, e, o) => {
|
|
83
|
+
n && (o.preventDefault(), n.click());
|
|
84
|
+
}, _ = (n, e, o) => {
|
|
85
|
+
o.preventDefault(), E();
|
|
86
|
+
}, U = (n, e, o) => {
|
|
51
87
|
e.focusElement(n);
|
|
52
|
-
},
|
|
53
|
-
!n.isAnchorClicked &&
|
|
54
|
-
},
|
|
88
|
+
}, q = (n) => {
|
|
89
|
+
!n.isAnchorClicked && g(!1);
|
|
90
|
+
}, M = t.useCallback(
|
|
55
91
|
(n, e) => {
|
|
56
|
-
const
|
|
92
|
+
const o = [];
|
|
57
93
|
if (!e || typeof e != "object")
|
|
58
94
|
return !1;
|
|
59
95
|
if (Array.isArray(e.filters)) {
|
|
60
|
-
for (const
|
|
61
|
-
if (
|
|
96
|
+
for (const s of e.filters)
|
|
97
|
+
if (M(n, s))
|
|
62
98
|
return !0;
|
|
63
99
|
}
|
|
64
|
-
return "field" in e && typeof e.field == "string" &&
|
|
100
|
+
return "field" in e && typeof e.field == "string" && o.push(e.field), o.includes(n);
|
|
65
101
|
},
|
|
66
102
|
[]
|
|
67
|
-
),
|
|
68
|
-
return
|
|
103
|
+
), b = t.useCallback((n, e) => !e || !Array.isArray(e) ? !1 : e.some((o) => o.field === n), []), J = t.useMemo(() => a.field && (M(a.field, l.filter) || b(a.field, l.group)), [a.field, l.filter, l.group, M, b]);
|
|
104
|
+
return t.useEffect(() => (m && f.current && (i.current = new Z({
|
|
69
105
|
tabIndex: 0,
|
|
70
|
-
root:
|
|
71
|
-
selectors:
|
|
106
|
+
root: f,
|
|
107
|
+
selectors: ie,
|
|
72
108
|
keyboardEvents: {
|
|
73
|
-
keydown: { Tab:
|
|
109
|
+
keydown: { Tab: V, Enter: H, Escape: _ }
|
|
74
110
|
},
|
|
75
|
-
mouseEvents: { mousedown:
|
|
76
|
-
}),
|
|
77
|
-
|
|
78
|
-
}), [
|
|
111
|
+
mouseEvents: { mousedown: U }
|
|
112
|
+
}), i.current.focusElement(i.current.first, null)), () => {
|
|
113
|
+
i.current && (i.current = null);
|
|
114
|
+
}), [m]), /* @__PURE__ */ t.createElement(t.Fragment, null, /* @__PURE__ */ t.createElement(
|
|
79
115
|
"a",
|
|
80
116
|
{
|
|
81
|
-
className:
|
|
82
|
-
"k-active":
|
|
117
|
+
className: O("k-grid-header-menu k-grid-column-menu", {
|
|
118
|
+
"k-active": J
|
|
83
119
|
}),
|
|
84
120
|
ref: u,
|
|
85
|
-
onClick:
|
|
86
|
-
onKeyDown:
|
|
87
|
-
href:
|
|
88
|
-
tabIndex:
|
|
89
|
-
"aria-label": `${
|
|
90
|
-
|
|
91
|
-
|
|
121
|
+
onClick: z,
|
|
122
|
+
onKeyDown: P,
|
|
123
|
+
href: F,
|
|
124
|
+
tabIndex: w ? -1 : void 0,
|
|
125
|
+
"aria-label": `${w ? "" : B}${N.toLanguageString(
|
|
126
|
+
x,
|
|
127
|
+
te[x]
|
|
92
128
|
)}`
|
|
93
129
|
},
|
|
94
|
-
|
|
95
|
-
), /* @__PURE__ */
|
|
96
|
-
/* @__PURE__ */
|
|
97
|
-
|
|
130
|
+
C ? /* @__PURE__ */ t.createElement(L, { name: C.name, icon: C }) : /* @__PURE__ */ t.createElement(L, { name: "more-vertical", icon: ne })
|
|
131
|
+
), /* @__PURE__ */ t.createElement(ce, null, l.mobileMode ? /* @__PURE__ */ t.createElement(t.Fragment, null, le.createPortal(
|
|
132
|
+
/* @__PURE__ */ t.createElement(
|
|
133
|
+
se,
|
|
98
134
|
{
|
|
99
|
-
computedShow:
|
|
100
|
-
ColumnMenu:
|
|
101
|
-
closeMenu:
|
|
135
|
+
computedShow: m,
|
|
136
|
+
ColumnMenu: d,
|
|
137
|
+
closeMenu: E
|
|
102
138
|
},
|
|
103
|
-
|
|
139
|
+
d && /* @__PURE__ */ t.createElement(d, { ...p, onCloseMenu: E })
|
|
104
140
|
),
|
|
105
|
-
(
|
|
106
|
-
)) : /* @__PURE__ */
|
|
107
|
-
|
|
141
|
+
(D = G()) == null ? void 0 : D.body
|
|
142
|
+
)) : /* @__PURE__ */ t.createElement(
|
|
143
|
+
X,
|
|
108
144
|
{
|
|
109
145
|
anchor: u.current,
|
|
110
|
-
show:
|
|
146
|
+
show: m,
|
|
111
147
|
popupClass: "k-grid-columnmenu-popup",
|
|
112
|
-
onMouseDownOutside:
|
|
148
|
+
onMouseDownOutside: q
|
|
113
149
|
},
|
|
114
|
-
/* @__PURE__ */
|
|
150
|
+
/* @__PURE__ */ t.createElement(
|
|
115
151
|
"div",
|
|
116
152
|
{
|
|
117
|
-
ref:
|
|
118
|
-
onBlur:
|
|
119
|
-
onFocus:
|
|
120
|
-
onMouseDown:
|
|
121
|
-
onKeyDown:
|
|
153
|
+
ref: f,
|
|
154
|
+
onBlur: I,
|
|
155
|
+
onFocus: K,
|
|
156
|
+
onMouseDown: $,
|
|
157
|
+
onKeyDown: W,
|
|
122
158
|
className: "k-column-menu k-column-menu-md"
|
|
123
159
|
},
|
|
124
|
-
|
|
160
|
+
d && /* @__PURE__ */ t.createElement(d, { ...p, onCloseMenu: E })
|
|
125
161
|
)
|
|
126
162
|
)));
|
|
127
163
|
};
|
|
128
164
|
export {
|
|
129
|
-
|
|
165
|
+
Me as GridColumnMenuWrapper
|
|
130
166
|
};
|
|
@@ -6,4 +6,4 @@
|
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
8
|
"use client";
|
|
9
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const q=require("react"),x=require("react-dom"),I=require("@progress/kendo-react-layout"),u=require("@progress/kendo-react-buttons"),r=require("@progress/kendo-react-labels"),M=require("@progress/kendo-react-intl"),_=require("@progress/kendo-react-dateinputs"),O=require("@progress/kendo-react-common"),E=require("@progress/kendo-svg-icons"),D=require("@progress/kendo-react-inputs"),C=require("@progress/kendo-react-data-tools"),B=require("@progress/kendo-react-dialogs"),c=require("@progress/kendo-react-form"),w=require("../utils/GridContext.js"),o=require("../messages/index.js");function z(n){const d=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(n){for(const
|
|
9
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const q=require("react"),x=require("react-dom"),I=require("@progress/kendo-react-layout"),u=require("@progress/kendo-react-buttons"),r=require("@progress/kendo-react-labels"),M=require("@progress/kendo-react-intl"),_=require("@progress/kendo-react-dateinputs"),O=require("@progress/kendo-react-common"),E=require("@progress/kendo-svg-icons"),D=require("@progress/kendo-react-inputs"),C=require("@progress/kendo-react-data-tools"),B=require("@progress/kendo-react-dialogs"),c=require("@progress/kendo-react-form"),w=require("../utils/GridContext.js"),o=require("../messages/index.js");function z(n){const d=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(n){for(const i in n)if(i!=="default"){const l=Object.getOwnPropertyDescriptor(n,i);Object.defineProperty(d,i,l.get?l:{enumerable:!0,get:()=>n[i]})}}return d.default=n,Object.freeze(d)}const e=z(q),A=n=>{var h;const d=M.useLocalization(),i=O.useAdaptiveModeContext(),l=e.useContext(w.GridContext),g=(a,t)=>{l.onDialogEditSubmit&&l.onDialogEditSubmit({dataItem:a,syntheticEvent:t})},m=a=>{l.onDialogEditCancel&&l.onDialogEditCancel({syntheticEvent:a})},N=a=>{const{validationMessage:t,visited:P,id:f,valid:V,editor:F,value:b,label:k,...S}=a,T=l.mobileMode?"large":"medium";switch(F){case"numeric":return e.createElement(e.Fragment,null,e.createElement(r.Label,{editorId:f,className:"k-form-label"},k,":"),e.createElement("div",{className:"k-form-field-wrap"},e.createElement(D.NumericTextBox,{...S,size:T,value:b,[C.TABLE_PREVENT_SELECTION_ELEMENT]:!0}),t&&e.createElement(r.Error,null,t)));case"date":return e.createElement(e.Fragment,null,e.createElement(r.Label,{editorId:f,className:"k-form-label"},k,":"),e.createElement("div",{className:"k-form-field-wrap"},e.createElement(_.DatePicker,{valid:!0,...S,value:b,adaptive:l.mobileMode,size:T,[C.TABLE_PREVENT_SELECTION_ELEMENT]:!0}),t&&e.createElement(r.Error,null,t)));case"boolean":return e.createElement("div",{className:"k-form-field-wrap"},e.createElement(r.Label,{editorId:f,className:"k-form-label"},k,": ",e.createElement(D.Checkbox,{...S,size:T,value:b,[C.TABLE_PREVENT_SELECTION_ELEMENT]:!0}),t&&e.createElement(r.Error,null,t)));default:return e.createElement(e.Fragment,null,e.createElement(r.Label,{editorId:f,className:"k-form-label"},k,":"),e.createElement("div",{className:"k-form-field-wrap"},e.createElement(D.TextBox,{...S,size:T,value:b||"",[C.TABLE_PREVENT_SELECTION_ELEMENT]:!0}),t&&e.createElement(r.Error,null,t)))}},p=d.toLanguageString(o.editDialogTitle,o.messages[o.editDialogTitle]),L=d.toLanguageString(o.editDialogSaveButtonTitle,o.messages[o.editDialogSaveButtonTitle]),y=d.toLanguageString(o.editDialogCancelButtonTitle,o.messages[o.editDialogCancelButtonTitle]),R={animation:!0,navigatable:!1,navigatableElements:[],expand:!0,title:l.adpativeTitle||p,suffixActions:e.createElement(u.Button,{svgIcon:E.xIcon,onClick:m,fillMode:"flat"}),animationStyles:i&&l.adaptiveColumnMenuRef<=i.small?{top:0,width:"100%",height:"100%"}:void 0,className:"k-adaptive-actionsheet",position:i&&l.adaptiveColumnMenuRef<=i.small?"fullscreen":void 0},{customEditDialog:v}=n,s=(h=n.columns)==null?void 0:h.filter(a=>a.editable);return e.createElement(e.Fragment,null,x.createPortal(e.createElement(e.Fragment,null,l.mobileMode?e.createElement(e.Fragment,null,v?e.createElement(v,{columns:n.columns,dataItem:n.dataItem,onSubmit:g,onCancel:m}):e.createElement(c.Form,{initialValues:n.dataItem,onSubmit:g,id:"kendo-grid-edit-dialog",render:a=>e.createElement(I.ActionSheet,{...R},e.createElement(I.ActionSheetContent,null,e.createElement(c.FormElement,null,s==null?void 0:s.map(t=>e.createElement(c.FieldWrapper,{key:t.field},e.createElement(c.Field,{name:t.field,id:t.field,editor:t.editor,component:N,label:t.title||t.field,validator:t.validator}))))),e.createElement(I.ActionSheetFooter,null,e.createElement(u.Button,{onClick:m,type:"reset",icon:"cancel",size:"large",svgIcon:E.cancelIcon},y),e.createElement(u.Button,{type:"submit",themeColor:"primary",size:"large",disabled:!a.allowSubmit||!a.valid,onClick:a.onSubmit,icon:"save",svgIcon:E.saveIcon},L)))})):v?e.createElement(v,{columns:n.columns,dataItem:n.dataItem,onSubmit:g,onCancel:m}):e.createElement(c.Form,{initialValues:n.dataItem,onSubmit:g,id:"kendo-grid-edit-dialog",render:a=>e.createElement(B.Dialog,{title:p,width:450,onClose:t=>m(t.syntheticEvent)},e.createElement(c.FormElement,null,s==null?void 0:s.map(t=>e.createElement(c.FieldWrapper,{key:t.field},e.createElement(c.Field,{name:t.field,id:t.field,editor:t.editor,component:N,label:t.title||t.field,validator:t.validator})))),e.createElement(B.DialogActionsBar,{layout:"start"},e.createElement(u.Button,{type:"submit",themeColor:"primary",disabled:!a.allowSubmit||!a.valid,onClick:a.onSubmit,icon:"save",svgIcon:E.saveIcon},L),e.createElement(u.Button,{onClick:m,type:"reset",icon:"cancel",svgIcon:E.cancelIcon},y)))})),document.body))};exports.GridEditDialog=A;
|