@progress/kendo-vue-grid 7.1.0-develop.4 → 7.1.0-develop.6
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/Grid.js +1 -1
- package/Grid.mjs +647 -588
- package/GridNav.js +1 -1
- package/GridNav.mjs +3 -1
- package/GridState.js +1 -1
- package/GridState.mjs +80 -60
- package/VirtualScroll.js +1 -1
- package/VirtualScroll.mjs +65 -109
- package/cells/GridCell.js +1 -1
- package/cells/GridCell.mjs +24 -19
- package/cells/GridFilterCell.js +1 -1
- package/cells/GridFilterCell.mjs +23 -23
- package/cells/GridHierarchyCell.js +1 -1
- package/cells/GridHierarchyCell.mjs +13 -14
- package/common.js +1 -1
- package/common.mjs +3 -0
- package/{GridNoRecords.js → components/noRecords/GridNoRecords.js} +1 -1
- package/{GridNoRecords.mjs → components/noRecords/GridNoRecords.mjs} +1 -1
- package/components/noRecords/GridNoRecordsContainer.js +8 -0
- package/components/noRecords/GridNoRecordsContainer.mjs +30 -0
- package/dist/cdn/js/kendo-vue-grid.js +1 -1
- package/footer/Footer.js +1 -1
- package/footer/Footer.mjs +9 -16
- package/header/Header.js +1 -1
- package/header/Header.mjs +20 -26
- package/index.d.mts +102 -23
- package/index.d.ts +102 -23
- package/index.js +1 -1
- package/index.mjs +30 -29
- package/package-metadata.js +1 -1
- package/package-metadata.mjs +2 -2
- package/package.json +12 -12
- package/rows/GridRow.js +1 -1
- package/rows/GridRow.mjs +18 -17
- package/utils/main.js +1 -1
- package/utils/main.mjs +30 -22
- package/VirtualScrollFixed.js +0 -8
- package/VirtualScrollFixed.mjs +0 -86
- package/utils/browser-support.service.js +0 -8
- package/utils/browser-support.service.mjs +0 -21
package/GridNav.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 o=require("vue"),e=require("@progress/kendo-vue-common"),n=o.defineComponent({name:"KendoGridNav",props:{currentData:Array},inject:{onNavKeyDown:{default:e.noop},onNavFocus:{default:e.noop},onNavMount:{default:e.noop},handleDispatchFocus:{default:e.noop},kbContext:{default:null},navigation:{default:null}},mounted(){this.onNavMount({scope:this.$el||void 0})},updated(){this.onNavMount({scope:this.$el||void 0})},methods:{onKeyDown(t){this.onNavKeyDown(t,{navigation:this.navigation,kbContext:this.kbContext,onNavigationAction:this.onNavigationAction}),this.$emit("keydown",{dataItems:this.getLeafDataItems(),componentId:this._gridId,selectedField:this.$props.selectedField,event:t})},onFocus(t){this.onNavFocus(t,{kbContext:this.kbContext})},onNavigationAction(t){this.$emit("navigationaction",{focusElement:t.focusElement,event:t.event})},getLeafDataItems(){return this.$props.currentData.filter(t=>t.rowType==="data").map(t=>t.dataItem)}},render(){const t=e.getDefaultSlots(this);return o.createVNode("div",{onKeydown:this.onKeyDown,onFocusin:this.onFocus,"data-keyboardnavscope":!0},[t])}});exports.GridNav=n;
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("vue"),e=require("@progress/kendo-vue-common"),n=o.defineComponent({name:"KendoGridNav",props:{currentData:Array,id:String},inject:{onNavKeyDown:{default:e.noop},onNavFocus:{default:e.noop},onNavMount:{default:e.noop},handleDispatchFocus:{default:e.noop},kbContext:{default:null},navigation:{default:null}},mounted(){this.onNavMount({scope:this.$el||void 0})},updated(){this.onNavMount({scope:this.$el||void 0})},methods:{onKeyDown(t){this.onNavKeyDown(t,{navigation:this.navigation,kbContext:this.kbContext,onNavigationAction:this.onNavigationAction}),this.$emit("keydown",{dataItems:this.getLeafDataItems(),componentId:this._gridId,selectedField:this.$props.selectedField,event:t})},onFocus(t){this.onNavFocus(t,{kbContext:this.kbContext})},onNavigationAction(t){this.$emit("navigationaction",{focusElement:t.focusElement,event:t.event})},getLeafDataItems(){return this.$props.currentData.filter(t=>t.rowType==="data").map(t=>t.dataItem)}},render(){const t=e.getDefaultSlots(this);return o.createVNode("div",{onKeydown:this.onKeyDown,onFocusin:this.onFocus,id:this.$props.id,"data-keyboardnavscope":!0},[t])}});exports.GridNav=n;
|
package/GridNav.mjs
CHANGED
|
@@ -10,7 +10,8 @@ import { noop as e, getDefaultSlots as a } from "@progress/kendo-vue-common";
|
|
|
10
10
|
const d = /* @__PURE__ */ o({
|
|
11
11
|
name: "KendoGridNav",
|
|
12
12
|
props: {
|
|
13
|
-
currentData: Array
|
|
13
|
+
currentData: Array,
|
|
14
|
+
id: String
|
|
14
15
|
},
|
|
15
16
|
inject: {
|
|
16
17
|
onNavKeyDown: {
|
|
@@ -77,6 +78,7 @@ const d = /* @__PURE__ */ o({
|
|
|
77
78
|
return n("div", {
|
|
78
79
|
onKeydown: this.onKeyDown,
|
|
79
80
|
onFocusin: this.onFocus,
|
|
81
|
+
id: this.$props.id,
|
|
80
82
|
"data-keyboardnavscope": !0
|
|
81
83
|
}, [t]);
|
|
82
84
|
}
|
package/GridState.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 n=require("vue"),T=require("./key.js"),V=require("./common.js"),j=require("@progress/kendo-vue-common"),A=n.defineComponent({name:"KendoVueGridStateProvider",inheritAttrs:!1,props:V.gridProps,setup(e,{emit:l}){var u,c,d,o,h,g,r,i,s;const t=n.ref({filter:(u=e.defaultFilter)!=null?u:e.filter,highlight:e.highlight,search:(c=e.defaultSearch)!=null?c:e.search,sort:(d=e.defaultSort)!=null?d:e.sort,take:(o=e.defaultTake)!=null?o:e.take,skip:(h=e.defaultSkip)!=null?h:e.skip,group:(g=e.defaultGroup)!=null?g:e.group,detailExpand:(r=e.defaultDetailExpand)!=null?r:e.detailExpand,groupExpand:(i=e.defaultGroupExpand)!=null?i:e.groupExpand,columnsState:(s=e.defaultColumnsState)!=null?s:e.columnsState}),f=a=>{t.value={...t.value,...a.data},l("datastatechange",a)},v=n.computed(()=>e.filter||t.value.filter||null),x=a=>{t.value.filter=a.filter,l("filterchange",a)};n.watch(()=>e.filter,a=>{t.value.filter=a});const S=n.computed(()=>e.search||t.value.search||null),k=a=>{t.value.search=a.search,l("searchchange",a)};n.watch(()=>e.search,a=>{t.value.search=a});const E=n.computed(()=>e.sort||t.value.sort||[]),m=a=>{t.value.sort=a.sort,l("sortchange",a)};n.watch(()=>e.sort,a=>{t.value.sort=a});const C=n.computed(()=>e.skip||t.value.skip||0),w=n.computed(()=>e.take||t.value.take||0),p=a=>{t.value.skip=a.page.skip,t.value.take=a.page.take,l("pagechange",a)};n.watch(()=>e.skip,a=>{t.value.skip=a}),n.watch(()=>e.take,a=>{t.value.take=a});const G=n.computed(()=>e.group||t.value.group||[]),P=a=>{t.value.group=a.group,l("groupchange",a)};n.watch(()=>e.group,a=>{t.value.group=a});const q=n.computed(()=>e.detailExpand||t.value.detailExpand||{}),y=a=>{t.value.detailExpand=a.detailExpand,l("detailexpandchange",a)};n.watch(()=>e.detailExpand,a=>{t.value.detailExpand=a});const D=n.computed(()=>e.groupExpand||t.value.groupExpand||[]),K=a=>{t.value.groupExpand=a.groupExpand,l("groupexpandchange",a)};n.watch(()=>e.groupExpand,a=>{t.value.groupExpand=a});const b=n.computed(()=>e.columnsState||e.defaultColumnsState||[]),F=a=>{t.value.columnsState=a.columnsState,l("columnsstatechange",a)};n.watch(()=>e.columnsState,a=>{t.value.columnsState=a}),n.provide(T.KendoKey,{sort:E,sortchange:m,filter:v,filterchange:x,search:S,searchchange:k,skip:C,take:w,pagechange:p,group:G,groupchange:P,detailExpand:q,detailexpandchange:y,groupExpand:D,groupexpandchange:K,columnsState:b,columnsstatechange:F,datastatechange:f})},render(){return j.getDefaultSlots(this)}});exports.GridStateProvider=A;
|
package/GridState.mjs
CHANGED
|
@@ -5,90 +5,110 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
import { defineComponent as
|
|
9
|
-
import { KendoKey as
|
|
10
|
-
import { gridProps as
|
|
11
|
-
import { getDefaultSlots as
|
|
12
|
-
const
|
|
8
|
+
import { defineComponent as b, ref as j, computed as n, watch as u, provide as q } from "vue";
|
|
9
|
+
import { KendoKey as z } from "./key.mjs";
|
|
10
|
+
import { gridProps as B } from "./common.mjs";
|
|
11
|
+
import { getDefaultSlots as H } from "@progress/kendo-vue-common";
|
|
12
|
+
const N = /* @__PURE__ */ b({
|
|
13
13
|
name: "KendoVueGridStateProvider",
|
|
14
14
|
inheritAttrs: !1,
|
|
15
|
-
props:
|
|
15
|
+
props: B,
|
|
16
16
|
setup(e, {
|
|
17
17
|
emit: l
|
|
18
18
|
}) {
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
var d, c, o, g, h, r, i, s, f;
|
|
20
|
+
const t = j({
|
|
21
|
+
// edit: props.defaultEdit ?? props.edit,
|
|
22
|
+
filter: (d = e.defaultFilter) != null ? d : e.filter,
|
|
23
|
+
highlight: e.highlight,
|
|
24
|
+
// select: props.defaultSelect ?? props.select,
|
|
25
|
+
search: (c = e.defaultSearch) != null ? c : e.search,
|
|
26
|
+
sort: (o = e.defaultSort) != null ? o : e.sort,
|
|
27
|
+
take: (g = e.defaultTake) != null ? g : e.take,
|
|
28
|
+
skip: (h = e.defaultSkip) != null ? h : e.skip,
|
|
29
|
+
group: (r = e.defaultGroup) != null ? r : e.group,
|
|
30
|
+
detailExpand: (i = e.defaultDetailExpand) != null ? i : e.detailExpand,
|
|
31
|
+
groupExpand: (s = e.defaultGroupExpand) != null ? s : e.groupExpand,
|
|
32
|
+
columnsState: (f = e.defaultColumnsState) != null ? f : e.columnsState
|
|
33
|
+
}), x = (a) => {
|
|
34
|
+
t.value = {
|
|
35
|
+
...t.value,
|
|
36
|
+
...a.data
|
|
37
|
+
}, l("datastatechange", a);
|
|
38
|
+
}, v = n(() => e.filter || t.value.filter || null), S = (a) => {
|
|
39
|
+
t.value.filter = a.filter, l("filterchange", a);
|
|
21
40
|
};
|
|
22
|
-
|
|
23
|
-
|
|
41
|
+
u(() => e.filter, (a) => {
|
|
42
|
+
t.value.filter = a;
|
|
24
43
|
});
|
|
25
|
-
const
|
|
26
|
-
|
|
44
|
+
const E = n(() => e.search || t.value.search || null), k = (a) => {
|
|
45
|
+
t.value.search = a.search, l("searchchange", a);
|
|
27
46
|
};
|
|
28
|
-
|
|
29
|
-
|
|
47
|
+
u(() => e.search, (a) => {
|
|
48
|
+
t.value.search = a;
|
|
30
49
|
});
|
|
31
|
-
const
|
|
32
|
-
|
|
50
|
+
const m = n(() => e.sort || t.value.sort || []), C = (a) => {
|
|
51
|
+
t.value.sort = a.sort, l("sortchange", a);
|
|
33
52
|
};
|
|
34
|
-
|
|
35
|
-
|
|
53
|
+
u(() => e.sort, (a) => {
|
|
54
|
+
t.value.sort = a;
|
|
36
55
|
});
|
|
37
|
-
const
|
|
38
|
-
|
|
56
|
+
const G = n(() => e.skip || t.value.skip || 0), p = n(() => e.take || t.value.take || 0), D = (a) => {
|
|
57
|
+
t.value.skip = a.page.skip, t.value.take = a.page.take, l("pagechange", a);
|
|
39
58
|
};
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
}),
|
|
43
|
-
|
|
59
|
+
u(() => e.skip, (a) => {
|
|
60
|
+
t.value.skip = a;
|
|
61
|
+
}), u(() => e.take, (a) => {
|
|
62
|
+
t.value.take = a;
|
|
44
63
|
});
|
|
45
|
-
const
|
|
46
|
-
|
|
64
|
+
const P = n(() => e.group || t.value.group || []), K = (a) => {
|
|
65
|
+
t.value.group = a.group, l("groupchange", a);
|
|
47
66
|
};
|
|
48
|
-
|
|
49
|
-
|
|
67
|
+
u(() => e.group, (a) => {
|
|
68
|
+
t.value.group = a;
|
|
50
69
|
});
|
|
51
|
-
const
|
|
52
|
-
|
|
70
|
+
const F = n(() => e.detailExpand || t.value.detailExpand || {}), w = (a) => {
|
|
71
|
+
t.value.detailExpand = a.detailExpand, l("detailexpandchange", a);
|
|
53
72
|
};
|
|
54
|
-
|
|
55
|
-
|
|
73
|
+
u(() => e.detailExpand, (a) => {
|
|
74
|
+
t.value.detailExpand = a;
|
|
56
75
|
});
|
|
57
|
-
const
|
|
58
|
-
|
|
76
|
+
const y = n(() => e.groupExpand || t.value.groupExpand || []), A = (a) => {
|
|
77
|
+
t.value.groupExpand = a.groupExpand, l("groupexpandchange", a);
|
|
59
78
|
};
|
|
60
|
-
|
|
61
|
-
|
|
79
|
+
u(() => e.groupExpand, (a) => {
|
|
80
|
+
t.value.groupExpand = a;
|
|
62
81
|
});
|
|
63
|
-
const
|
|
64
|
-
|
|
82
|
+
const T = n(() => e.columnsState || e.defaultColumnsState || []), V = (a) => {
|
|
83
|
+
t.value.columnsState = a.columnsState, l("columnsstatechange", a);
|
|
65
84
|
};
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
}),
|
|
69
|
-
sort:
|
|
70
|
-
sortchange:
|
|
71
|
-
filter:
|
|
72
|
-
filterchange:
|
|
73
|
-
search:
|
|
74
|
-
searchchange:
|
|
75
|
-
skip:
|
|
76
|
-
take:
|
|
77
|
-
pagechange:
|
|
78
|
-
group:
|
|
79
|
-
groupchange:
|
|
80
|
-
detailExpand:
|
|
81
|
-
detailexpandchange:
|
|
82
|
-
groupExpand:
|
|
83
|
-
groupexpandchange:
|
|
84
|
-
columnsState:
|
|
85
|
-
columnsstatechange:
|
|
85
|
+
u(() => e.columnsState, (a) => {
|
|
86
|
+
t.value.columnsState = a;
|
|
87
|
+
}), q(z, {
|
|
88
|
+
sort: m,
|
|
89
|
+
sortchange: C,
|
|
90
|
+
filter: v,
|
|
91
|
+
filterchange: S,
|
|
92
|
+
search: E,
|
|
93
|
+
searchchange: k,
|
|
94
|
+
skip: G,
|
|
95
|
+
take: p,
|
|
96
|
+
pagechange: D,
|
|
97
|
+
group: P,
|
|
98
|
+
groupchange: K,
|
|
99
|
+
detailExpand: F,
|
|
100
|
+
detailexpandchange: w,
|
|
101
|
+
groupExpand: y,
|
|
102
|
+
groupexpandchange: A,
|
|
103
|
+
columnsState: T,
|
|
104
|
+
columnsstatechange: V,
|
|
105
|
+
datastatechange: x
|
|
86
106
|
});
|
|
87
107
|
},
|
|
88
108
|
render() {
|
|
89
|
-
return
|
|
109
|
+
return H(this);
|
|
90
110
|
}
|
|
91
111
|
});
|
|
92
112
|
export {
|
|
93
|
-
|
|
113
|
+
N as GridStateProvider
|
|
94
114
|
};
|
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"});class
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("./utils/main.js");require("@progress/kendo-vue-common");class c{constructor(){this.table=null,this.tableBody=null,this.container=null,this.scrollHeightContainer=null,this.total=0,this.scrollableVirtual=!1,this.pageSize=0,this.fixedScroll=!1,this.tableTransform="",this.scrollSyncing=!1,this.firstToLoad=0,this.lastScrollTop=0,this.firstLoaded=0,this.lastLoaded=0,this.scrollHandler=this.scrollHandler.bind(this)}reset(){this.firstToLoad=0,this.firstLoaded=0,this.lastLoaded=0,this.rowHeightService=void 0,!this.fixedScroll&&this.container&&this.container.scrollTop!==0&&(this.scrollSyncing=!0,this.container.scrollTop=0,this.lastScrollTop=0,this.translate(0,!0))}scrollHandler(t){if(this.scrollSyncing){this.scrollSyncing=!1;return}if(!this.scrollableVirtual||!this.container||!this.table||!this.rowHeightService||!this.container)return;const i=this.container.scrollTop,e=this.lastScrollTop>=i,o=!e;this.lastScrollTop=i;const r=this.container.offsetHeight;let s=this.rowHeightService.index(i);const a=this.rowHeightService.index(i+r),h=Math.max(s+this.pageSize-this.total,0);if(s=Math.max(s-h,0),o&&a>=this.lastLoaded&&this.lastLoaded<this.total-1)this.firstToLoad=s,this.loadPage(t);else if(e&&s<this.firstToLoad){const n=Math.max(Math.floor(this.pageSize*.3)-h,0);this.firstToLoad=Math.max(s-n,0),this.loadPage(t)}}update(){var i;const t=this.getItemHeights();if(this.firstLoaded>this.firstToLoad){const e=Math.min(this.firstLoaded-this.firstToLoad,this.pageSize),o=this.getTotalHeight(e,t),r=this.getExpectedTotalHeight(e),s=o-r;s!==0&&this.adjustScroll(s)}(i=this.rowHeightService)==null||i.update(this.firstToLoad,t),this.setScrollHeightContainerHeight(),this.firstLoaded=this.firstToLoad,this.lastLoaded=this.firstLoaded+t.length-1}loadPage(t){this.rowHeightService&&(this.translate(this.rowHeightService.offset(this.firstToLoad)),this.changePage(this.firstToLoad,t))}translate(t,i){this.scrollableVirtual&&this.table&&(i?this.table.style.transform="translateY("+t+"px)":this.tableTransform="translateY("+t+"px)")}changePage(t,i){this.PageChange&&this.PageChange({skip:Math.max(0,t),take:this.pageSize},i)}adjustScroll(t){this.scrollSyncing=!0,this.container&&(this.container.scrollTop+=t)}setScrollHeightContainerHeight(){var t;if(this.scrollableVirtual&&this.scrollHeightContainer){let i=((t=this.rowHeightService)==null?void 0:t.totalHeight())||0;i=l.firefox?Math.min(l.firefoxMaxHeight,i):i,this.scrollHeightContainer.style.height=i+"px"}}getItemHeights(){const t=[];return this.tableBody&&Array.from(this.tableBody.children).forEach(i=>{const e=i.getBoundingClientRect().height;i.classList.contains("k-detail-row")?t[t.length-1]+=e:t.push(e)}),t}getTotalHeight(t,i){return i.slice(0,t).reduce((e,o)=>e+o,0)}getExpectedTotalHeight(t){const i=this.rowHeightService;if(!i)return 0;const e=this.firstToLoad+(t-1);return i.offset(e)+i.height(e)-i.offset(this.firstToLoad)}}exports.VirtualScroll=c;
|
package/VirtualScroll.mjs
CHANGED
|
@@ -5,130 +5,86 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
const i = this.container.clientHeight, n = this.container.querySelectorAll(".k-group-footer").length, l = Math.ceil(i / o[0].line), h = Math.ceil(n / l), a = Math.max(h, Math.ceil((o.length - l) / 2));
|
|
14
|
-
let r = 0;
|
|
15
|
-
for (let p = 0; p < a; p++)
|
|
16
|
-
r += o[p].line + o[p].acc;
|
|
17
|
-
const c = h ? n / (1 + h) : 0, g = l + l / 2 + c;
|
|
18
|
-
return {
|
|
19
|
-
topItemsCount: a,
|
|
20
|
-
topItemsHeight: r,
|
|
21
|
-
itemsNeededOnScreen: g
|
|
22
|
-
};
|
|
23
|
-
}, this.horizontalScrollbarHeight = () => this.container ? this.container.offsetHeight - this.container.clientHeight : 0, s && (this.topCacheCount = t, this.attendedSkip = -this.topCacheCount), this.scrollHandler = this.scrollHandler.bind(this);
|
|
8
|
+
import { firefox as n, firefoxMaxHeight as c } from "./utils/main.mjs";
|
|
9
|
+
import "@progress/kendo-vue-common";
|
|
10
|
+
class H {
|
|
11
|
+
constructor() {
|
|
12
|
+
this.table = null, this.tableBody = null, this.container = null, this.scrollHeightContainer = null, this.total = 0, this.scrollableVirtual = !1, this.pageSize = 0, this.fixedScroll = !1, this.tableTransform = "", this.scrollSyncing = !1, this.firstToLoad = 0, this.lastScrollTop = 0, this.firstLoaded = 0, this.lastLoaded = 0, this.scrollHandler = this.scrollHandler.bind(this);
|
|
24
13
|
}
|
|
25
|
-
|
|
26
|
-
|
|
14
|
+
reset() {
|
|
15
|
+
this.firstToLoad = 0, this.firstLoaded = 0, this.lastLoaded = 0, this.rowHeightService = void 0, !this.fixedScroll && this.container && this.container.scrollTop !== 0 && (this.scrollSyncing = !0, this.container.scrollTop = 0, this.lastScrollTop = 0, this.translate(0, !0));
|
|
16
|
+
}
|
|
17
|
+
scrollHandler(t) {
|
|
18
|
+
if (this.scrollSyncing) {
|
|
19
|
+
this.scrollSyncing = !1;
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
if (!this.scrollableVirtual || !this.container || !this.table || !this.rowHeightService || !this.container)
|
|
23
|
+
return;
|
|
24
|
+
const i = this.container.scrollTop, e = this.lastScrollTop >= i, o = !e;
|
|
25
|
+
this.lastScrollTop = i;
|
|
26
|
+
const h = this.container.offsetHeight;
|
|
27
|
+
let s = this.rowHeightService.index(i);
|
|
28
|
+
const a = this.rowHeightService.index(i + h), r = Math.max(s + this.pageSize - this.total, 0);
|
|
29
|
+
if (s = Math.max(s - r, 0), o && a >= this.lastLoaded && this.lastLoaded < this.total - 1)
|
|
30
|
+
this.firstToLoad = s, this.loadPage(t);
|
|
31
|
+
else if (e && s < this.firstToLoad) {
|
|
32
|
+
const l = Math.max(Math.floor(this.pageSize * 0.3) - r, 0);
|
|
33
|
+
this.firstToLoad = Math.max(s - l, 0), this.loadPage(t);
|
|
34
|
+
}
|
|
27
35
|
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
for (let e = 0; e < t.length; e++) {
|
|
35
|
-
if (t[e].className.indexOf("k-grouping-row") > -1) {
|
|
36
|
-
o += t[e].scrollHeight;
|
|
37
|
-
continue;
|
|
38
|
-
}
|
|
39
|
-
t[e].className.indexOf("k-detail-row") > -1 ? s[s.length - 1].line += t[e].scrollHeight : (s.push({
|
|
40
|
-
line: t[e].scrollHeight,
|
|
41
|
-
acc: o
|
|
42
|
-
}), o = 0);
|
|
36
|
+
update() {
|
|
37
|
+
var i;
|
|
38
|
+
const t = this.getItemHeights();
|
|
39
|
+
if (this.firstLoaded > this.firstToLoad) {
|
|
40
|
+
const e = Math.min(this.firstLoaded - this.firstToLoad, this.pageSize), o = this.getTotalHeight(e, t), h = this.getExpectedTotalHeight(e), s = o - h;
|
|
41
|
+
s !== 0 && this.adjustScroll(s);
|
|
43
42
|
}
|
|
44
|
-
|
|
43
|
+
(i = this.rowHeightService) == null || i.update(this.firstToLoad, t), this.setScrollHeightContainerHeight(), this.firstLoaded = this.firstToLoad, this.lastLoaded = this.firstLoaded + t.length - 1;
|
|
44
|
+
}
|
|
45
|
+
loadPage(t) {
|
|
46
|
+
this.rowHeightService && (this.translate(this.rowHeightService.offset(this.firstToLoad)), this.changePage(this.firstToLoad, t));
|
|
45
47
|
}
|
|
46
|
-
|
|
47
|
-
this.
|
|
48
|
+
translate(t, i) {
|
|
49
|
+
this.scrollableVirtual && this.table && (i ? this.table.style.transform = "translateY(" + t + "px)" : this.tableTransform = "translateY(" + t + "px)");
|
|
50
|
+
}
|
|
51
|
+
changePage(t, i) {
|
|
52
|
+
this.PageChange && this.PageChange(
|
|
48
53
|
{
|
|
49
|
-
skip: Math.max(0,
|
|
54
|
+
skip: Math.max(0, t),
|
|
50
55
|
take: this.pageSize
|
|
51
56
|
},
|
|
52
|
-
|
|
57
|
+
i
|
|
53
58
|
);
|
|
54
59
|
}
|
|
55
|
-
|
|
56
|
-
this.
|
|
57
|
-
}
|
|
58
|
-
reset() {
|
|
59
|
-
this.scrollSyncing = !0, !this.fixedScroll && (this.container && (this.container.scrollTop = 0), this.translate(0));
|
|
60
|
+
adjustScroll(t) {
|
|
61
|
+
this.scrollSyncing = !0, this.container && (this.container.scrollTop += t);
|
|
60
62
|
}
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
const {
|
|
67
|
-
topItemsCount: n,
|
|
68
|
-
topItemsHeight: l,
|
|
69
|
-
itemsNeededOnScreen: h
|
|
70
|
-
} = this.topItems(t, !!this.topCacheCount), a = o - e;
|
|
71
|
-
if (!(a > l || t.length <= h)) {
|
|
72
|
-
for (; i < this.topCacheCount + this.attendedSkip - this.realSkip + n && this.propsSkip - i > 0 && !(e + (t[t.length - 1 - i].line + t[t.length - 1 - i].acc) + a <= o); )
|
|
73
|
-
e -= t[t.length - 1 - i].line + t[t.length - 1 - i].acc, i++;
|
|
74
|
-
if (i === 0 && this.topCacheCount === 0 && this.attendedSkip > 0 && (e = Math.max(e - t[0].line, 0), i = 1), this.propsSkip - i <= 0 && e > o) {
|
|
75
|
-
this.translate(0), this.changePage(0, s), this.container.scrollTop = 0;
|
|
76
|
-
return;
|
|
77
|
-
}
|
|
78
|
-
if (e > o && (e = o), e !== this.tableTranslate) {
|
|
79
|
-
this.translate(Math.max(0, e - l));
|
|
80
|
-
const r = Math.max(0, this.propsSkip - i - n);
|
|
81
|
-
this.changePage(r, s);
|
|
82
|
-
}
|
|
63
|
+
setScrollHeightContainerHeight() {
|
|
64
|
+
var t;
|
|
65
|
+
if (this.scrollableVirtual && this.scrollHeightContainer) {
|
|
66
|
+
let i = ((t = this.rowHeightService) == null ? void 0 : t.totalHeight()) || 0;
|
|
67
|
+
i = n ? Math.min(c, i) : i, this.scrollHeightContainer.style.height = i + "px";
|
|
83
68
|
}
|
|
84
69
|
}
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
topItemsCount: n,
|
|
92
|
-
topItemsHeight: l,
|
|
93
|
-
itemsNeededOnScreen: h
|
|
94
|
-
} = this.topItems(t, !!this.topCacheCount);
|
|
95
|
-
for (; i < t.length - this.topCacheCount && !(e + t[i].line + t[i].acc > o); )
|
|
96
|
-
e += t[i].line + t[i].acc, i++;
|
|
97
|
-
n > this.propsSkip + i || t.length <= h || (i >= t.length - this.topCacheCount && this.propsSkip + i >= this.total ? (this.translate(e - l), this.changePage(this.total - 1 - n, s)) : e !== this.tableTranslate && this.propsSkip + i - n !== this.propsSkip && (this.translate(e - l), this.changePage(this.propsSkip + i - n, s)));
|
|
70
|
+
getItemHeights() {
|
|
71
|
+
const t = [];
|
|
72
|
+
return this.tableBody && Array.from(this.tableBody.children).forEach((i) => {
|
|
73
|
+
const e = i.getBoundingClientRect().height;
|
|
74
|
+
i.classList.contains("k-detail-row") ? t[t.length - 1] += e : t.push(e);
|
|
75
|
+
}), t;
|
|
98
76
|
}
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
let o = Math.floor(t);
|
|
102
|
-
o >= this.total && (o = this.total - 1);
|
|
103
|
-
const e = Math.min(t - o, 1);
|
|
104
|
-
let i = 0;
|
|
105
|
-
const n = o - this.propsSkip, l = this.rowHeights;
|
|
106
|
-
n >= 0 && n <= 1 ? i = -((l[0].line + l[0].acc) * e) : n === -1 && (i = -((l[l.length - 1].line + l[l.length - 1].acc) * e));
|
|
107
|
-
const {
|
|
108
|
-
topItemsCount: h,
|
|
109
|
-
topItemsHeight: a,
|
|
110
|
-
itemsNeededOnScreen: r
|
|
111
|
-
} = this.topItems(l, !!this.topCacheCount), c = Math.max(
|
|
112
|
-
0,
|
|
113
|
-
i - a - this.horizontalScrollbarHeight() + this.containerHeight * t / this.total
|
|
114
|
-
);
|
|
115
|
-
this.prevScrollPos < c && l.length <= r || (this.translate(c), this.changePage(o - h, s));
|
|
77
|
+
getTotalHeight(t, i) {
|
|
78
|
+
return i.slice(0, t).reduce((e, o) => e + o, 0);
|
|
116
79
|
}
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
}
|
|
124
|
-
const t = this.container.scrollTop, o = this.prevScrollPos;
|
|
125
|
-
if (this.prevScrollPos = t, this.askedSkip !== void 0) {
|
|
126
|
-
this.translate(this.containerHeight * this.askedSkip / this.total), this.changePage(this.askedSkip, s), this.prevScrollPos = t, this.askedSkip = void 0;
|
|
127
|
-
return;
|
|
128
|
-
}
|
|
129
|
-
t - o < 0 && t > this.tableTranslate - this.table.scrollHeight / 10 ? this.localScrollUp(s) : t - o > 0 && t < this.tableTranslate + this.table.scrollHeight * 2 / 3 ? this.localScrollDown(s) : this.scrollNonStrict(s), this.prevScrollPos = t;
|
|
80
|
+
getExpectedTotalHeight(t) {
|
|
81
|
+
const i = this.rowHeightService;
|
|
82
|
+
if (!i)
|
|
83
|
+
return 0;
|
|
84
|
+
const e = this.firstToLoad + (t - 1);
|
|
85
|
+
return i.offset(e) + i.height(e) - i.offset(this.firstToLoad);
|
|
130
86
|
}
|
|
131
87
|
}
|
|
132
88
|
export {
|
|
133
|
-
|
|
89
|
+
H as VirtualScroll
|
|
134
90
|
};
|
package/cells/GridCell.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 r=require("vue"),
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("vue"),a=require("../utils/main.js"),c=require("@progress/kendo-vue-intl"),d=require("@progress/kendo-vue-common"),p=require("@progress/kendo-vue-data-tools"),g=r.defineComponent({name:"GridCell",inheritAttrs:!1,emits:{cellclick:null,cellkeydown:null},props:{id:String,field:String,dataItem:Object,format:String,readFormat:String,className:String,colSpan:Number,columnIndex:Number,columnsCount:Number,dataIndex:Number,rowType:String,level:Number,expanded:Boolean,type:String,editor:String,rowSpan:[Number,Object],isSelected:Boolean,isHighlighted:Boolean,ariaColumnIndex:Number,render:[String,Function,Object],isRtl:Boolean,onEdit:Function,onSave:Function,onRemove:Function,onCancel:Function,onChange:Function,onSelectionchange:Function},inject:{kendoIntlService:{default:null},getKeyboardNavigationAttributes:{default:d.noop}},methods:{triggerClick(){this.$emit("cellclick",{dataItem:this.$props.dataItem,field:this.$props.field})},triggerKeydown(e){this.$emit("cellkeydown",{event:e,dataItem:this.$props.dataItem,field:this.$props.field})},triggerEdit(e){this.$emit("edit",e)},triggerAdd(e){this.$emit("add",e)},triggerCancel(e){this.$emit("cancel",e)},triggerSave(e){this.$emit("save",e)},triggerRemove(e){this.$emit("remove",e)}},created(){this._intl=c.provideIntlService(this)},computed:{tdClass(){const{className:e,isHighlighted:t}=this.$props;return{"k-table-td":!0,"k-highlighted":t,[e]:e}}},setup(){return{kendoIntlService:r.inject("kendoIntlService",{})}},render(){var n,o,s;let e=null;const t=this.getKeyboardNavigationAttributes(this.$props.id);if(((n=this.$props.rowSpan)==null?void 0:n.count)===null)return null;if(this.$props.rowType==="groupFooter")e=r.createVNode("td",{class:this.tdClass},null);else if(this.$props.field!==void 0&&this.$props.rowType!=="groupHeader"){const i=a.getNestedValue(this.$props.field,this.$props.dataItem);let l="";i!=null&&(l=this.$props.format?this.$props.type?this._intl.format(this.$props.format,a.parsers[this.$props.type](i,this._intl,this.$props.readFormat)):this._intl.format(this.$props.format,i):i.toString()),e=r.createVNode("td",{style:this.$attrs.style,colspan:this.$props.colSpan,rowspan:(s=(o=this.$props.rowSpan)==null?void 0:o.count)!=null?s:void 0,class:this.tdClass,onKeydown:this.triggerKeydown,onClick:this.triggerClick,role:"gridcell","aria-colindex":this.$props.ariaColumnIndex,"aria-selected":this.$props.isSelected,"data-grid-col-index":this.$props.columnIndex,tabindex:t.tabIndex,"data-keyboardnavlevel":t[p.KEYBOARD_NAV_DATA_LEVEL],"data-keyboardnavid":t[p.KEYBOARD_NAV_DATA_ID]},[l])}return d.getTemplate.call(this,{h:r.h,template:this.$props.render,defaultRendering:e,additionalProps:this.$props,additionalListeners:{click:this.triggerClick,keydown:this.triggerKeydown,edit:this.triggerEdit,add:this.triggerAdd,cancel:this.triggerCancel,save:this.triggerSave,remove:this.triggerRemove}})}});exports.GridCell=g;
|
package/cells/GridCell.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 { defineComponent as
|
|
9
|
-
import { getNestedValue as
|
|
10
|
-
import { provideIntlService as
|
|
11
|
-
import { noop as
|
|
12
|
-
import { KEYBOARD_NAV_DATA_ID as
|
|
13
|
-
const
|
|
8
|
+
import { defineComponent as l, createVNode as a, h as d, inject as p } from "vue";
|
|
9
|
+
import { getNestedValue as c, parsers as h } from "../utils/main.mjs";
|
|
10
|
+
import { provideIntlService as g } from "@progress/kendo-vue-intl";
|
|
11
|
+
import { noop as m, getTemplate as u } from "@progress/kendo-vue-common";
|
|
12
|
+
import { KEYBOARD_NAV_DATA_ID as $, KEYBOARD_NAV_DATA_LEVEL as f } from "@progress/kendo-vue-data-tools";
|
|
13
|
+
const I = /* @__PURE__ */ l({
|
|
14
14
|
name: "GridCell",
|
|
15
15
|
inheritAttrs: !1,
|
|
16
16
|
emits: {
|
|
@@ -33,6 +33,7 @@ const y = /* @__PURE__ */ o({
|
|
|
33
33
|
expanded: Boolean,
|
|
34
34
|
type: String,
|
|
35
35
|
editor: String,
|
|
36
|
+
rowSpan: [Number, Object],
|
|
36
37
|
isSelected: Boolean,
|
|
37
38
|
isHighlighted: Boolean,
|
|
38
39
|
ariaColumnIndex: Number,
|
|
@@ -50,7 +51,7 @@ const y = /* @__PURE__ */ o({
|
|
|
50
51
|
default: null
|
|
51
52
|
},
|
|
52
53
|
getKeyboardNavigationAttributes: {
|
|
53
|
-
default:
|
|
54
|
+
default: m
|
|
54
55
|
}
|
|
55
56
|
},
|
|
56
57
|
methods: {
|
|
@@ -84,7 +85,7 @@ const y = /* @__PURE__ */ o({
|
|
|
84
85
|
}
|
|
85
86
|
},
|
|
86
87
|
created() {
|
|
87
|
-
this._intl =
|
|
88
|
+
this._intl = g(this);
|
|
88
89
|
},
|
|
89
90
|
computed: {
|
|
90
91
|
tdClass() {
|
|
@@ -101,22 +102,26 @@ const y = /* @__PURE__ */ o({
|
|
|
101
102
|
},
|
|
102
103
|
setup() {
|
|
103
104
|
return {
|
|
104
|
-
kendoIntlService:
|
|
105
|
+
kendoIntlService: p("kendoIntlService", {})
|
|
105
106
|
};
|
|
106
107
|
},
|
|
107
108
|
render() {
|
|
109
|
+
var r, n, o;
|
|
108
110
|
let t = null;
|
|
109
111
|
const e = this.getKeyboardNavigationAttributes(this.$props.id);
|
|
112
|
+
if (((r = this.$props.rowSpan) == null ? void 0 : r.count) === null)
|
|
113
|
+
return null;
|
|
110
114
|
if (this.$props.rowType === "groupFooter")
|
|
111
|
-
t =
|
|
115
|
+
t = a("td", {
|
|
112
116
|
class: this.tdClass
|
|
113
117
|
}, null);
|
|
114
118
|
else if (this.$props.field !== void 0 && this.$props.rowType !== "groupHeader") {
|
|
115
|
-
const i =
|
|
116
|
-
let
|
|
117
|
-
i != null && (
|
|
119
|
+
const i = c(this.$props.field, this.$props.dataItem);
|
|
120
|
+
let s = "";
|
|
121
|
+
i != null && (s = this.$props.format ? this.$props.type ? this._intl.format(this.$props.format, h[this.$props.type](i, this._intl, this.$props.readFormat)) : this._intl.format(this.$props.format, i) : i.toString()), t = a("td", {
|
|
118
122
|
style: this.$attrs.style,
|
|
119
123
|
colspan: this.$props.colSpan,
|
|
124
|
+
rowspan: (o = (n = this.$props.rowSpan) == null ? void 0 : n.count) != null ? o : void 0,
|
|
120
125
|
class: this.tdClass,
|
|
121
126
|
onKeydown: this.triggerKeydown,
|
|
122
127
|
onClick: this.triggerClick,
|
|
@@ -125,12 +130,12 @@ const y = /* @__PURE__ */ o({
|
|
|
125
130
|
"aria-selected": this.$props.isSelected,
|
|
126
131
|
"data-grid-col-index": this.$props.columnIndex,
|
|
127
132
|
tabindex: e.tabIndex,
|
|
128
|
-
"data-keyboardnavlevel": e[
|
|
129
|
-
"data-keyboardnavid": e[
|
|
130
|
-
}, [
|
|
133
|
+
"data-keyboardnavlevel": e[f],
|
|
134
|
+
"data-keyboardnavid": e[$]
|
|
135
|
+
}, [s]);
|
|
131
136
|
}
|
|
132
|
-
return
|
|
133
|
-
h:
|
|
137
|
+
return u.call(this, {
|
|
138
|
+
h: d,
|
|
134
139
|
template: this.$props.render,
|
|
135
140
|
defaultRendering: t,
|
|
136
141
|
additionalProps: this.$props,
|
|
@@ -147,5 +152,5 @@ const y = /* @__PURE__ */ o({
|
|
|
147
152
|
}
|
|
148
153
|
});
|
|
149
154
|
export {
|
|
150
|
-
|
|
155
|
+
I as GridCell
|
|
151
156
|
};
|
package/cells/GridFilterCell.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 r=require("vue"),$=require("@progress/kendo-vue-buttons"),n=require("../messages/main.js"),u=require("@progress/kendo-vue-dropdowns"),d=require("@progress/kendo-vue-inputs"),S=require("@progress/kendo-vue-dateinputs"),h=require("@progress/kendo-svg-icons"),m=require("@progress/kendo-vue-intl"),p=require("../filterCommon.js"),c=require("@progress/kendo-vue-common"),k=r.defineComponent({name:"KendoGridFilterCell",inheritAttrs:!1,props:{id:String,grid:Object,field:String,filterType:String,colSpan:Number,title:String,value:[String,Number,Boolean,Date],operator:[String,Function],operators:Array,booleanValues:Array,onChange:Function,render:[String,Function,Object],ariaLabel:String,size:String},inject:{kendoLocalizationService:{default:null},kendoIntlService:{default:null}},methods:{inputChange(e,t){const o=p.cellInputChange(e,t,this.$props);this.triggerChange(o)},operatorChange(e,t){const o=p.cellOperatorChange(e.value.operator,t,this.$props.value);this.triggerChange(o)},boolDropdownChange(e,t){const o=p.cellBoolDropdownChange(e.value.operator,t);this.triggerChange(o)},clear(e){e.preventDefault(),this.triggerChange({value:"",operator:"",event:e})},triggerChange(e){e.field=this.$props.field,this.$emit("change",e)}},setup(){const e=r.inject("kendoIntlService",{}),t=r.inject("kendoLocalizationService",{});return{kendoIntlService:e,kendoLocalizationService:t}},render(){const e=m.provideLocalizationService(this),{size:t}=this.$props,o=this.$props.operators.find(l=>l.operator===this.$props.operator)||null,g=function(){if(this.$props.filterType!=="boolean")return r.createVNode(u.DropDownList,{onChange:this.operatorChange,value:o,size:t,class:"k-dropdown-operator",icon:"filter",svgIcon:h.filterIcon,iconClassName:"filter k-button-icon","data-items":this.$props.operators,textField:"text",title:e.toLanguageString(n.filterChooseOperator,n.messages[n.filterChooseOperator]),popupSettings:{width:"",anchor:""},ariaLabel:this.ariaLabel},null)},f=function(l,a){let s;switch(l){case"numeric":return r.createVNode(d.NumericTextBox,{size:t,value:a,onChange:i=>{this.inputChange(i.value,i.event)},title:this.$props.title,ariaLabel:this.ariaLabel},null);case"date":return r.createVNode(S.DatePicker,{size:t,value:a,onChange:i=>{this.inputChange(i.value,i)},title:this.$props.title,ariaLabel:this.ariaLabel},null);case"boolean":return s=this.$props.booleanValues,r.createVNode(u.DropDownList,{onChange:this.boolDropdownChange,size:t,value:s.find(i=>i.operator===(a!==null?a:"")),"data-items":s,textField:"text",title:this.$props.title,ariaLabel:this.ariaLabel},null);default:return r.createVNode(d.TextBox,{value:a||"",size:t,onInput:i=>{this.inputChange(i.target.value,i)},title:this.$props.title,"aria-label":this.ariaLabel},null)}},C=r.createVNode("div",{class:"k-filtercell",style:this.$attrs.style},[r.createVNode("div",{class:"k-filtercell-wrapper"},[f.call(this,this.$props.filterType,this.$props.value),r.createVNode("div",{class:"k-filtercell-operator"},[g.call(this),r.createVNode($.Button,{type:"button",size:t,icon:"filter-clear",svgIcon:h.filterClearIcon,class:{"k-disabled":!(!(this.$props.value===null||this.$props.value==="")||this.$props.operator)},title:e.toLanguageString(n.filterClearButton,n.messages[n.filterClearButton]),onClick:this.clear},null)])])]),v=this.$props.grid?c.getListeners.call(this.$props.grid):null,b=c.templateRendering.call(this.$props.grid,this.$props.render,v);return c.getTemplate.call(this,{h:r.h,template:b,defaultRendering:C,additionalProps:this.$props,additionalListeners:{change:this.triggerChange}})}});exports.GridFilterCell=k;
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("vue"),$=require("@progress/kendo-vue-buttons"),n=require("../messages/main.js"),u=require("@progress/kendo-vue-dropdowns"),d=require("@progress/kendo-vue-inputs"),S=require("@progress/kendo-vue-dateinputs"),h=require("@progress/kendo-svg-icons"),m=require("@progress/kendo-vue-intl"),p=require("../filterCommon.js"),c=require("@progress/kendo-vue-common"),k=r.defineComponent({name:"KendoGridFilterCell",inheritAttrs:!1,props:{id:String,grid:Object,field:String,filterType:String,colSpan:Number,title:String,value:[String,Number,Boolean,Date],operator:[String,Function],operators:Array,booleanValues:Array,onChange:Function,render:[String,Function,Object],ariaLabel:String,size:String},inject:{kendoLocalizationService:{default:null},kendoIntlService:{default:null}},methods:{inputChange(e,t){const o=p.cellInputChange(e,t,this.$props);this.triggerChange(o)},operatorChange(e,t){const o=p.cellOperatorChange(e.value.operator,t,this.$props.value);this.triggerChange(o)},boolDropdownChange(e,t){const o=p.cellBoolDropdownChange(e.value.operator,t);this.triggerChange(o)},clear(e){e.preventDefault(),this.triggerChange({value:"",operator:"",event:e})},triggerChange(e){e.field=this.$props.field,this.$emit("change",e)}},setup(){const e=r.inject("kendoIntlService",{}),t=r.inject("kendoLocalizationService",{});return{kendoIntlService:e,kendoLocalizationService:t}},render(){const e=m.provideLocalizationService(this),{size:t}=this.$props,o=this.$props.operators.find(l=>l.operator===this.$props.operator)||null,g=function(){if(this.$props.filterType!=="boolean")return r.createVNode(u.DropDownList,{onChange:this.operatorChange,value:o,size:t,class:"k-dropdown-operator",icon:"filter",svgIcon:h.filterIcon,iconClassName:"filter k-button-icon","data-items":this.$props.operators,textField:"text",title:e.toLanguageString(n.filterChooseOperator,n.messages[n.filterChooseOperator]),popupSettings:{width:"",anchor:""},ariaLabel:this.ariaLabel},null)},f=function(l,a){let s;switch(l){case"numeric":return r.createVNode(d.NumericTextBox,{size:t,value:a,onChange:i=>{this.inputChange(i.value,i.event)},title:this.$props.title,ariaLabel:this.ariaLabel},null);case"date":return r.createVNode(S.DatePicker,{size:t,value:a,onChange:i=>{this.inputChange(i.value,i)},title:this.$props.title,ariaLabel:this.ariaLabel},null);case"boolean":return s=this.$props.booleanValues,r.createVNode(u.DropDownList,{onChange:this.boolDropdownChange,size:t,value:s.find(i=>i.operator===(a!==null?a:"")),"data-items":s,textField:"text",title:this.$props.title,ariaLabel:this.ariaLabel},null);default:return r.createVNode(d.TextBox,{value:a||"",size:t,onInput:i=>{this.inputChange(i.target.value,i)},title:this.$props.title,"aria-label":this.ariaLabel},null)}},C=r.createVNode("div",{class:"k-filtercell",style:this.$attrs.style},[r.createVNode("div",{class:"k-filtercell-wrapper"},[f.call(this,this.$props.filterType,this.$props.value),r.createVNode("div",{class:"k-filtercell-operator"},[g.call(this),r.createTextVNode(" "),r.createVNode($.Button,{type:"button",size:t,icon:"filter-clear",svgIcon:h.filterClearIcon,class:{"k-disabled":!(!(this.$props.value===null||this.$props.value==="")||this.$props.operator)},title:e.toLanguageString(n.filterClearButton,n.messages[n.filterClearButton]),onClick:this.clear},null)])])]),v=this.$props.grid?c.getListeners.call(this.$props.grid):null,b=c.templateRendering.call(this.$props.grid,this.$props.render,v);return c.getTemplate.call(this,{h:r.h,template:b,defaultRendering:C,additionalProps:this.$props,additionalListeners:{change:this.triggerChange}})}});exports.GridFilterCell=k;
|