@progress/kendo-vue-dateinputs 7.0.1-develop.2 → 7.0.1-develop.3
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/calendar/components/CalendarCell.js +1 -1
- package/calendar/components/CalendarCell.mjs +4 -4
- package/calendar/components/CalendarHeaderTitle.js +1 -1
- package/calendar/components/CalendarHeaderTitle.mjs +5 -5
- package/calendar/components/CalendarWeekCell.js +1 -1
- package/calendar/components/CalendarWeekCell.mjs +5 -5
- package/dateinput/DateInput.js +1 -1
- package/dateinput/DateInput.mjs +71 -67
- package/datepicker/DatePicker.js +1 -1
- package/datepicker/DatePicker.mjs +35 -27
- package/daterangepicker/DateRangePicker.js +1 -1
- package/daterangepicker/DateRangePicker.mjs +31 -27
- package/datetimepicker/DateTimePicker.js +1 -1
- package/datetimepicker/DateTimePicker.mjs +51 -45
- package/dist/cdn/js/kendo-vue-dateinputs.js +1 -1
- package/index.d.mts +230 -128
- package/index.d.ts +230 -128
- package/package-metadata.js +1 -1
- package/package-metadata.mjs +2 -2
- package/package.json +8 -8
- package/timepicker/TimeList.js +1 -1
- package/timepicker/TimeList.mjs +10 -10
- package/timepicker/TimePart.js +1 -1
- package/timepicker/TimePart.mjs +13 -13
- package/timepicker/TimePicker.js +1 -1
- package/timepicker/TimePicker.mjs +51 -45
- package/timepicker/TimeSelector.js +1 -1
- package/timepicker/TimeSelector.mjs +14 -12
- package/virtualization/Virtualization.js +1 -1
- package/virtualization/Virtualization.mjs +2 -2
package/timepicker/TimeList.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 n=require("vue"),c=require("@progress/kendo-date-math"),o=require("@progress/kendo-vue-common"),m=require("@progress/kendo-vue-intl"),f=require("../virtualization/Virtualization.js"),l=require("./models/TimePart.js"),v=require("./services/DayPeriodService.js"),g=require("./services/DOMService.js"),$=require("./services/HoursService.js"),S=require("./services/MinutesService.js"),T=require("./services/SecondsService.js"),u=require("../utils.js");function y(e){return typeof e=="function"||Object.prototype.toString.call(e)==="[object Object]"&&!n.isVNode(e)}const x=2,d=.05,I=0,b={[o.Keys.end]:(e,t)=>e[e.length-1],[o.Keys.home]:(e,t)=>e[0],[o.Keys.up]:(e,t)=>e[t-1],[o.Keys.down]:(e,t)=>e[t+1]},p={[l.TIME_PART.dayperiod]:v.DayPeriodService,[l.TIME_PART.hour]:$.HoursService,[l.TIME_PART.minute]:S.MinutesService,[l.TIME_PART.second]:T.SecondsService},O=n.defineComponent({name:"KendoTimeList",emits:{change:
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("vue"),c=require("@progress/kendo-date-math"),o=require("@progress/kendo-vue-common"),m=require("@progress/kendo-vue-intl"),f=require("../virtualization/Virtualization.js"),l=require("./models/TimePart.js"),v=require("./services/DayPeriodService.js"),g=require("./services/DOMService.js"),$=require("./services/HoursService.js"),S=require("./services/MinutesService.js"),T=require("./services/SecondsService.js"),u=require("../utils.js");function y(e){return typeof e=="function"||Object.prototype.toString.call(e)==="[object Object]"&&!n.isVNode(e)}const x=2,d=.05,I=0,b={[o.Keys.end]:(e,t)=>e[e.length-1],[o.Keys.home]:(e,t)=>e[0],[o.Keys.up]:(e,t)=>e[t-1],[o.Keys.down]:(e,t)=>e[t+1]},p={[l.TIME_PART.dayperiod]:v.DayPeriodService,[l.TIME_PART.hour]:$.HoursService,[l.TIME_PART.minute]:S.MinutesService,[l.TIME_PART.second]:T.SecondsService},O=n.defineComponent({name:"KendoTimeList",emits:{change:e=>!0,focus:e=>!0,blur:e=>!0},props:{id:Number,boundRange:{type:Boolean,default:!1},max:{type:Date,default:function(){return u.MAX_TIME}},min:{type:Date,default:function(){return u.MIDNIGHT_DATE}},part:Object,step:{type:Number,default:1},value:Date,smoothScroll:{type:Boolean,default:!0},disabled:{type:Boolean,default:!1}},inject:{kendoIntlService:{default:null}},data(){return{animateToIndex:!1}},created(){this.topOffset=void 0,this.dom=new g.DOMService},computed:{animate(){return!!(this.$props.smoothScroll&&this.animateToIndex)}},mounted(){this.virtualization=this.$refs.virtualization,Promise.resolve().then(()=>{this.$el&&(this.dom.calculateHeights(this.$el),this.$forceUpdate())})},updated(){if(!this.$refs.virtualization)return;this.virtualization=this.$refs.virtualization;const e=this.service.selectedIndex(this.$props.value);this.virtualization[this.animate?"animateToIndex":"scrollToIndex"](e),this.animateToIndex=!0},setup(){return{kendoIntlService:n.inject("kendoIntlService",{})}},render(){let e;if(!this.$props.part.type||!p[this.$props.part.type])return;this.calculateHeights(),this.intl=m.provideIntlService(this),this.service=new p[this.$props.part.type](this.intl),this.configureServices();const t=this.service.data(this.$props.value),i="translateY("+this.topOffset+"px)",s=this.service.total(this.$props.value),r=function(){return n.createVNode("ul",{style:{transform:i,msTransform:i},class:"k-reset"},[t.map(function(a,h){return n.createVNode("li",{key:h,class:"k-item",onClick:()=>{this.handleChange(a)}},[n.createVNode("span",null,[a.text])])},this)])};return n.createVNode("div",{class:"k-time-list",id:String(this.$props.id||""),tabindex:this.$props.disabled?-1:0,onKeydown:this.handleKeyDown,onFocusin:this.handleFocus,onFocusout:this.handleBlur,onMouseover:this.handleMouseOver},[this.dom.didCalculate?n.createVNode(f.Virtualization,{bottomOffset:this.bottomOffset,class:"k-time-container",itemHeight:this.itemHeight,maxScrollDifference:this.listHeight,onScrollaction:this.handleScrollAction,ref:"virtualization",role:"presentation",skip:I,tabIndex:-1,take:s,topOffset:this.topOffset,total:s},y(e=r.call(this))?e:{default:()=>[e]}):n.createVNode("div",{class:"k-time-container"},[r.call(this)])])},methods:{focus(e){Promise.resolve().then(()=>{this.$el&&this.$el.focus(e)})},itemOffset(e){if(!this.virtualization)return-1;const t=this.service.selectedIndex(this.$props.value),i=this.virtualization.activeIndex(),s=this.virtualization.itemOffset(i),r=Math.abs(Math.ceil(e)-s);if(t===i&&r<x)return s;const a=t>i;return a&&r>=this.bottomThreshold||!a&&r>this.topThreshold?this.virtualization.itemOffset(i+1):s},calculateHeights(){this.dom.didCalculate&&(this.itemHeight=this.dom.itemHeight,this.listHeight=this.dom.timeListHeight,this.topOffset=(this.listHeight-this.itemHeight)/2,this.bottomOffset=this.listHeight-this.itemHeight,this.topThreshold=this.itemHeight*d,this.bottomThreshold=this.itemHeight*(1-d))},configureServices(e){let{min:t,max:i,value:s}=e||this.$props;const[r,a]=this.service.limitRange(t||this.$props.min,i||this.$props.max,s||this.$props.value);this.service.configure(this.serviceSettings({min:r,max:a}))},serviceSettings(e){const t={boundRange:this.$props.boundRange,insertUndividedMax:!1,min:c.cloneDate(this.$props.min),max:c.cloneDate(this.$props.max),part:this.$props.part,step:this.$props.step},i=Object.assign({},t,e);return i.boundRange=i.part.type!=="hour"||this.$props.boundRange,i},handleScrollAction({target:e,animationInProgress:t}){if(this.virtualization&&e&&!t){this.animateToIndex=!1;const i=this.virtualization.itemIndex(this.itemOffset(e.scrollTop)),s=this.service.data(this.$props.value)[i];this.handleChange(s)}},handleFocus(e){this.$emit("focus",e)},handleBlur(e){this.$emit("blur",e)},handleMouseOver(){this.$el&&o.canUseDOM&&document.activeElement!==this.$el&&this.$el.focus({preventScroll:!0})},handleKeyDown(e){const{keyCode:t}=e;(t===o.Keys.down||t===o.Keys.up||t===o.Keys.end||t===o.Keys.home)&&e.preventDefault();const s=(b[e.keyCode]||o.noop)(this.service.data(this.$props.value),this.service.selectedIndex(this.$props.value));s&&this.handleChange(s)},handleChange(e){const t=this.service.apply(this.$props.value,e.value);this.$props.value.getTime()!==t.getTime()&&(this.currentValue=t,this.$emit("change",t))}}});exports.TimeList=O;
|
package/timepicker/TimeList.mjs
CHANGED
|
@@ -10,7 +10,7 @@ import { cloneDate as c } from "@progress/kendo-date-math";
|
|
|
10
10
|
import { Keys as n, noop as v, canUseDOM as g } from "@progress/kendo-vue-common";
|
|
11
11
|
import { provideIntlService as $ } from "@progress/kendo-vue-intl";
|
|
12
12
|
import { Virtualization as x } from "../virtualization/Virtualization.mjs";
|
|
13
|
-
import { TIME_PART as
|
|
13
|
+
import { TIME_PART as h } from "./models/TimePart.mjs";
|
|
14
14
|
import { DayPeriodService as S } from "./services/DayPeriodService.mjs";
|
|
15
15
|
import { DOMService as I } from "./services/DOMService.mjs";
|
|
16
16
|
import { HoursService as T } from "./services/HoursService.mjs";
|
|
@@ -26,16 +26,16 @@ const D = 2, u = 0.05, M = 0, z = {
|
|
|
26
26
|
[n.up]: (t, e) => t[e - 1],
|
|
27
27
|
[n.down]: (t, e) => t[e + 1]
|
|
28
28
|
}, p = {
|
|
29
|
-
[
|
|
30
|
-
[
|
|
31
|
-
[
|
|
32
|
-
[
|
|
29
|
+
[h.dayperiod]: S,
|
|
30
|
+
[h.hour]: T,
|
|
31
|
+
[h.minute]: b,
|
|
32
|
+
[h.second]: y
|
|
33
33
|
}, F = /* @__PURE__ */ d({
|
|
34
34
|
name: "KendoTimeList",
|
|
35
35
|
emits: {
|
|
36
|
-
change:
|
|
37
|
-
focus:
|
|
38
|
-
blur:
|
|
36
|
+
change: (t) => !0,
|
|
37
|
+
focus: (t) => !0,
|
|
38
|
+
blur: (t) => !0
|
|
39
39
|
},
|
|
40
40
|
props: {
|
|
41
41
|
id: Number,
|
|
@@ -117,9 +117,9 @@ const D = 2, u = 0.05, M = 0, z = {
|
|
|
117
117
|
msTransform: i
|
|
118
118
|
},
|
|
119
119
|
class: "k-reset"
|
|
120
|
-
}, [e.map(function(r,
|
|
120
|
+
}, [e.map(function(r, l) {
|
|
121
121
|
return a("li", {
|
|
122
|
-
key:
|
|
122
|
+
key: l,
|
|
123
123
|
class: "k-item",
|
|
124
124
|
onClick: () => {
|
|
125
125
|
this.handleChange(r);
|
package/timepicker/TimePart.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 s=require("vue"),k=require("@progress/kendo-vue-buttons"),L=require("@progress/kendo-date-math"),l=require("@progress/kendo-vue-common"),
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("vue"),k=require("@progress/kendo-vue-buttons"),L=require("@progress/kendo-date-math"),l=require("@progress/kendo-vue-common"),g=require("@progress/kendo-vue-intl"),u=require("../messages/main.js"),$=require("./TimeList.js"),p=require("../utils.js"),c=require("./models/TimePart.js"),o=require("./utils.js");function w(e){return typeof e=="function"||Object.prototype.toString.call(e)==="[object Object]"&&!s.isVNode(e)}const m=new RegExp(`${c.TIME_PART.hour}|${c.TIME_PART.minute}|${c.TIME_PART.second}|${c.TIME_PART.dayperiod}|literal`);let h=function(e){return e[e.Left=0]="Left",e[e.Right=1]="Right",e}({});const T=s.defineComponent({name:"KendoTimePart",props:{cancelButton:{type:Boolean,default:!0},disabled:{type:Boolean,default:!1},format:{type:[String,Object],default:function(){return"hh:mm a"}},max:{type:Date,default:function(){return p.MAX_TIME}},min:{type:Date,default:function(){return p.MIN_TIME}},nowButton:{type:Boolean,default:!0},steps:{type:Object,default:function(){return{}}},smoothScroll:{type:Boolean,default:!0},tabIndex:Number,value:{type:Date,default:function(){return null}},boundRange:{type:Boolean,default:!1}},emits:{change:e=>!0,focus:e=>!0,blur:e=>!0,nowclick:e=>!0},created(){this.timeLists=[],this.snapTime=o.snapTime(o.generateSnappers(this.$props.steps,this.$props.min)),this.activeListIndex=-1,this.hasActiveButton=this.hasActiveButton.bind(this)},inject:{kendoIntlService:{default:null},kendoLocalizationService:{default:null}},data(){return{activeListIndex:null}},computed:{element(){return this._element},computedValue(){return o.timeInRange(this.snapTime(L.cloneDate(this.$props.value||p.MIDNIGHT_DATE)),this.computedMin,this.computedMax)},intl(){return g.provideIntlService(this)},computedMin(){return this.snapTime(this.$props.min)},computedMax(){return this.snapTime(this.$props.max)}},mounted(){this._nowButton=this.$refs.nowButton,this.dateFormatParts.forEach((e,t)=>{e.type!=="literal"&&this.timeLists.push(this.$refs["timeList"+t])})},setup(){const e=s.inject("kendoIntlService",{}),t=s.inject("kendoLocalizationService",{});return{kendoIntlService:e,kendoLocalizationService:t}},render(){let e;const{format:t,smoothScroll:n,disabled:i}=this.$props;this.snapTime=o.snapTime(o.generateSnappers(this.$props.steps,this.computedMin)),this.dateFormatParts=this.intl.splitDateFormat(t).filter(this.timeFormatFilter);const y=l.classNames({"k-disabled":i},"k-time-part"),f=g.provideLocalizationService(this),v=f.toLanguageString(u.selectNow,u.messages[u.selectNow]);return s.createVNode("div",{class:y},[s.createVNode("div",{class:"k-time-header"},[s.createVNode("span",{class:"k-title"},[this.intl.formatDate(this.computedValue,this.dateFormatParts.reduce(this.timeFormatReducer,""))]),this.showNowButton()&&s.createVNode(k.Button,{type:"button",ref:"nowButton",fillMode:"flat",class:"k-time-now",title:v,"aria-label":v,onClick:this.onNowClick,tabIndex:i?-1:0},w(e=f.toLanguageString(u.now,u.messages[u.now]))?e:{default:()=>[e]})]),s.createVNode("div",{class:"k-time-list-container",onKeydown:this.handleKeyDown},[s.createVNode("span",{class:"k-time-highlight"},null),this.dateFormatParts.map(function(r,a){return r.type!=="literal"?s.createVNode("div",{key:a,class:l.classNames("k-time-list-wrapper",{"k-focus":a===this.activeListIndex}),role:"presentation",tabindex:-1},[s.createVNode("span",{class:"k-title",onMousedown:d=>{d.preventDefault()}},[this.intl.dateFieldName(r)]),s.createVNode($.TimeList,{min:this.computedMin,max:this.computedMax,boundRange:this.$props.boundRange,part:r,step:r.type?this.$props.steps[r.type]:1,smoothScroll:n,ref:"timeList"+a,id:a,onFocus:d=>{this.handleListFocus(d,a)},onBlur:this.handleListBlur,onChange:this.handleChange,value:this.computedValue,disabled:i},null)]):s.createVNode("div",{key:a,class:"k-time-separator"},[r.pattern])},this)])])},methods:{onNowClick(e){this.$emit("nowclick",e)},focus(e){this.$nextTick(()=>{const t=this.timeLists[0];!this.hasActiveButton()&&t&&t.$el&&t.focus(e)})},timeFormatReducer(e,t){return e+t.pattern},timeFormatFilter(e,t,n){const i=t>=1&&n[t-1];return i&&i&&e.type==="literal"?m.test(i.type||""):m.test(e.type||"")},hasActiveButton(){return l.canUseDOM&&this._nowButton&&document.activeElement===this._nowButton.$el},focusList(e){this.timeLists.length&&this.timeLists.reduce(this.listReducer,[]).map(t=>e===h.Right?t.next:t.prev).map(t=>t&&t.$el&&t.$el.focus({preventScroll:!0}))},listReducer(e,t,n,i){return e.length||t.$props.id!==this.activeListIndex?e:[{next:i[n+1]||t,prev:i[n-1]||t}]},showNowButton(){return!this.hasSteps()&&this.$props.nowButton&&o.isInTimeRange(o.getNow(),this.computedMin,this.computedMax)},hasSteps(){const e=Object.keys(this.$props.steps);return e.length!==e.reduce((t,n)=>t+this.$props.steps[n],0)},handleKeyDown(e){const{keyCode:t}=e;switch(t){case l.Keys.left:e.preventDefault(),this.focusList(h.Left);return;case l.Keys.right:e.preventDefault(),this.focusList(h.Right);return;default:return}},handleListBlur(e){this.$emit("blur",e)},handleListFocus(e,t){this.$emit("focus",e),this.activeListIndex=t},handleChange(e){this.$emit("change",e)}}});exports.Direction=h;exports.TimePart=T;
|
package/timepicker/TimePart.mjs
CHANGED
|
@@ -10,7 +10,7 @@ import { Button as b } from "@progress/kendo-vue-buttons";
|
|
|
10
10
|
import { cloneDate as S } from "@progress/kendo-date-math";
|
|
11
11
|
import { Keys as d, canUseDOM as I, classNames as f } from "@progress/kendo-vue-common";
|
|
12
12
|
import { provideLocalizationService as M, provideIntlService as T } from "@progress/kendo-vue-intl";
|
|
13
|
-
import { selectNow as
|
|
13
|
+
import { selectNow as v, messages as g, now as y } from "../messages/main.mjs";
|
|
14
14
|
import { TimeList as R } from "./TimeList.mjs";
|
|
15
15
|
import { MIDNIGHT_DATE as F, MIN_TIME as N, MAX_TIME as x } from "../utils.mjs";
|
|
16
16
|
import { TIME_PART as a } from "./models/TimePart.mjs";
|
|
@@ -18,7 +18,7 @@ import { isInTimeRange as D, getNow as _, snapTime as L, generateSnappers as k,
|
|
|
18
18
|
function j(t) {
|
|
19
19
|
return typeof t == "function" || Object.prototype.toString.call(t) === "[object Object]" && !B(t);
|
|
20
20
|
}
|
|
21
|
-
const
|
|
21
|
+
const l = new RegExp(`${a.hour}|${a.minute}|${a.second}|${a.dayperiod}|literal`);
|
|
22
22
|
let c = /* @__PURE__ */ function(t) {
|
|
23
23
|
return t[t.Left = 0] = "Left", t[t.Right = 1] = "Right", t;
|
|
24
24
|
}({});
|
|
@@ -78,10 +78,10 @@ const X = /* @__PURE__ */ w({
|
|
|
78
78
|
}
|
|
79
79
|
},
|
|
80
80
|
emits: {
|
|
81
|
-
change:
|
|
82
|
-
focus:
|
|
83
|
-
blur:
|
|
84
|
-
nowclick:
|
|
81
|
+
change: (t) => !0,
|
|
82
|
+
focus: (t) => !0,
|
|
83
|
+
blur: (t) => !0,
|
|
84
|
+
nowclick: (t) => !0
|
|
85
85
|
},
|
|
86
86
|
created() {
|
|
87
87
|
this.timeLists = [], this.snapTime = L(k(this.$props.steps, this.$props.min)), this.activeListIndex = -1, this.hasActiveButton = this.hasActiveButton.bind(this);
|
|
@@ -138,7 +138,7 @@ const X = /* @__PURE__ */ w({
|
|
|
138
138
|
this.snapTime = L(k(this.$props.steps, this.computedMin)), this.dateFormatParts = this.intl.splitDateFormat(e).filter(this.timeFormatFilter);
|
|
139
139
|
const $ = f({
|
|
140
140
|
"k-disabled": i
|
|
141
|
-
}, "k-time-part"), h = M(this), p = h.toLanguageString(
|
|
141
|
+
}, "k-time-part"), h = M(this), p = h.toLanguageString(v, g[v]);
|
|
142
142
|
return s("div", {
|
|
143
143
|
class: $
|
|
144
144
|
}, [s("div", {
|
|
@@ -154,7 +154,7 @@ const X = /* @__PURE__ */ w({
|
|
|
154
154
|
"aria-label": p,
|
|
155
155
|
onClick: this.onNowClick,
|
|
156
156
|
tabIndex: i ? -1 : 0
|
|
157
|
-
}, j(t = h.toLanguageString(y,
|
|
157
|
+
}, j(t = h.toLanguageString(y, g[y])) ? t : {
|
|
158
158
|
default: () => [t]
|
|
159
159
|
})]), s("div", {
|
|
160
160
|
class: "k-time-list-container",
|
|
@@ -171,8 +171,8 @@ const X = /* @__PURE__ */ w({
|
|
|
171
171
|
tabindex: -1
|
|
172
172
|
}, [s("span", {
|
|
173
173
|
class: "k-title",
|
|
174
|
-
onMousedown: (
|
|
175
|
-
|
|
174
|
+
onMousedown: (u) => {
|
|
175
|
+
u.preventDefault();
|
|
176
176
|
}
|
|
177
177
|
}, [this.intl.dateFieldName(o)]), s(R, {
|
|
178
178
|
min: this.computedMin,
|
|
@@ -183,8 +183,8 @@ const X = /* @__PURE__ */ w({
|
|
|
183
183
|
smoothScroll: n,
|
|
184
184
|
ref: "timeList" + r,
|
|
185
185
|
id: r,
|
|
186
|
-
onFocus: (
|
|
187
|
-
this.handleListFocus(
|
|
186
|
+
onFocus: (u) => {
|
|
187
|
+
this.handleListFocus(u, r);
|
|
188
188
|
},
|
|
189
189
|
onBlur: this.handleListBlur,
|
|
190
190
|
onChange: this.handleChange,
|
|
@@ -211,7 +211,7 @@ const X = /* @__PURE__ */ w({
|
|
|
211
211
|
},
|
|
212
212
|
timeFormatFilter(t, e, n) {
|
|
213
213
|
const i = e >= 1 && n[e - 1];
|
|
214
|
-
return i && i && t.type === "literal" ?
|
|
214
|
+
return i && i && t.type === "literal" ? l.test(i.type || "") : l.test(t.type || "");
|
|
215
215
|
},
|
|
216
216
|
hasActiveButton() {
|
|
217
217
|
return I && this._nowButton && document.activeElement === this._nowButton.$el;
|
package/timepicker/TimePicker.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 n=require("vue"),U=require("@progress/kendo-vue-labels"),H=require("@progress/kendo-vue-popup"),k=require("@progress/kendo-date-math"),t=require("@progress/kendo-vue-common"),G=require("@progress/kendo-vue-intl"),X=require("@progress/kendo-vue-buttons"),s=require("../messages/main.js"),J=require("../dateinput/DateInput.js"),Q=require("./TimeSelector.js"),l=require("../utils.js"),S=require("./utils.js"),W=require("../dateinput/utils.js"),Y=require("@progress/kendo-svg-icons");function w(e){return typeof e=="function"||Object.prototype.toString.call(e)==="[object Object]"&&!n.isVNode(e)}const Z=n.defineComponent({name:"KendoTimePicker",emits:{changemodel:null,"update:modelValue":null,iconclick:null,change:null,focus:null,blur:null,keydown:null,open:null,close:null},model:{event:"changemodel"},props:{cancelButton:{type:Boolean,default:!0},nowButton:{type:Boolean,default:void 0},defaultShow:{type:Boolean,default:!1},modelValue:{type:Date,default:void 0},defaultValue:{type:Date,default:function(){return null}},dateInput:{type:[String,Object,Function],default:function(){}},popup:{type:[String,Object,Function],default:function(){}},disabled:{type:Boolean,default:!1},format:{type:[String,Object],default:function(){return"t"}},formatPlaceholder:{type:[String,Object],default:function(){return W.defaultFormatPlaceholder}},rounded:{type:String,default:"medium",validator:function(e){return["small","medium","large","full"].includes(e)}},fillMode:{type:String,default:"solid",validator:function(e){return["solid","flat","outline"].includes(e)}},size:{type:String,default:"medium",validator:function(e){return["small","medium","large"].includes(e)}},id:String,ariaLabelledBy:String,ariaDescribedBy:String,min:{type:Date,default:function(){return l.MIN_TIME}},max:{type:Date,default:function(){return l.MAX_TIME}},name:String,label:String,placeholder:String,popupSettings:{type:Object,default:function(){return{}}},show:{type:Boolean,default:void 0},tabIndex:{type:Number,default:0},steps:{type:Object,default:function(){return{}}},smoothScroll:{type:Boolean,default:!0},title:{type:String,default:function(){return""}},value:{type:Date,default:function(){}},width:[Number,String],validationMessage:String,required:{type:Boolean,default:!1},validityStyles:{type:Boolean,default:!0},validate:Boolean,valid:{type:Boolean,default:void 0},inputAttributes:Object},created(){this._anchor=t.guid(),this._popupId="popup"+t.guid(),this._element=null,this._wrapper=null,this._dateInput=null,this._timeSelector=null,this.shouldFocusDateInput=!1,this.currentValue=this.$props.defaultValue,this.currentShow=this.$props.defaultShow},inject:{kendoLocalizationService:{default:null}},data(){return{currentValue:null,currentShow:!1,valueDuringOnChange:void 0,showDuringOnChange:void 0,isFocused:!1}},computed:{timeSelector(){return this._timeSelector},computedValue(){const e=this.valueDuringOnChange!==void 0?this.valueDuringOnChange:this.$props.value!==void 0?this.$props.value:this.$props.modelValue!==void 0?this.$props.modelValue:this.$data.currentValue;return e!==null?k.cloneDate(e):null},computedShow(){return this.showDuringOnChange!==void 0?this.showDuringOnChange:this.$props.show!==void 0?this.$props.show:this.currentShow}},watch:{show:function(e,i){this._oldShow=i},currentShow:function(e,i){this._oldShow=i}},mounted(){this.computedShow&&this.$forceUpdate(),this._dateInput=this.dateInputRef,this._timeSelector=this.$refs.timeSelector,this._wrapper=this.kendoAnchorRef,this._dateInput&&this._dateInput.element()&&this._dateInput.element().setAttribute("aria-haspopup","true")},updated(){this._dateInput=this.dateInputRef,this._timeSelector=this.$refs.timeSelector,this._wrapper=this.kendoAnchorRef,this._timeSelector&&this.computedShow&&!this._oldShow?this._timeSelector.focusActiveList():this._dateInput&&this._dateInput.element()&&!this.computedShow&&this.shouldFocusDateInput&&this._dateInput.element().focus({preventScroll:!0}),this.shouldFocusDateInput=!1},setup(){const e=n.ref(null),i=n.inject("kendoLocalizationService",{});return{kendoAnchorRef:e,kendoLocalizationService:i}},render(){const e=t.getDefaultSlots(this),{disabled:i,tabIndex:o,title:h,id:u,placeholder:c,format:a,formatPlaceholder:V,smoothScroll:$,width:I,name:_,steps:v,cancelButton:D,nowButton:T,validationMessage:B,required:C,validityStyles:M,ariaLabelledBy:ee,ariaDescribedBy:te,size:p,rounded:m,fillMode:y,inputAttributes:F}=this.$props,{popupClass:O,appendTo:R,animate:q}=this.$props.popupSettings,f=!this.$props.validityStyles||this.validity().valid;t.classNames("k-picker-wrap",{"k-invalid":!f,"k-disabled":i,"k-focus":this.isFocused});const z=t.classNames("k-group k-reset",O),b=G.provideLocalizationService(this),j=b.toLanguageString(s.toggleClock,s.messages[s.toggleClock]),x=b.toLanguageString(s.toggleTimeSelector,s.messages[s.toggleTimeSelector]),A=this.$props.dateInput?t.templateRendering.call(this,this.$props.dateInput,t.getListeners.call(this)):void 0,N=n.createVNode(J.DateInput,{ref:g=>{this.dateInputRef=g},placeholder:c,disabled:i,format:a,formatPlaceholder:V,id:u,size:null,rounded:null,fillMode:null,max:this.normalizeTime(this.$props.max),min:this.normalizeTime(this.$props.min),name:_,onChange:this.handleInputValueChange,required:C,steps:v,tabIndex:this.computedShow?-1:o,title:h,valid:this.validity().valid,validationMessage:B,validityStyles:M,value:this.computedValue&&this.normalizeTime(this.computedValue),ariaHasPopup:"grid",ariaExpanded:this.computedShow,ariaRole:"combobox",ariaControls:this._popupId,inputAttributes:F},w(e)?e:{default:()=>[e]}),r=n.createVNode(Q.TimeSelector,{ref:"timeSelector",cancelButton:D,disabled:i,nowButton:T,format:a,min:this.$props.min,max:this.$props.max,steps:v,smoothScroll:$,value:this.computedValue,onChange:this.handleValueChange,onReject:this.handleValueReject,onFocus:this.timeFocus,onBlur:this.timeBlur,onKeydown:this.handleKeyDown},null),P=t.getTemplate.call(this,{h:n.h,template:A,defaultRendering:N,additionalListeners:{change:this.handleInputValueChange}}),L=this.$props.popup?t.templateRendering.call(this,this.$props.popup,t.getListeners.call(this)):void 0,K=n.createVNode(H.Popup,{show:this.computedShow,anchor:this._anchor,class:z,id:this._popupId,anchorAlign:{horizontal:"left",vertical:"bottom"},popupAlign:{horizontal:"left",vertical:"top"},appendTo:R,animate:q},w(r)?r:{default:()=>[r]}),E=t.getTemplate.call(this,{h:n.h,template:L,defaultRendering:K,defaultSlots:r}),d=n.createVNode("div",{class:t.classNames("k-input","k-timepicker",{[`k-input-${t.kendoThemeMaps.sizeMap[p]||p}`]:p,[`k-input-${y}`]:y,[`k-rounded-${t.kendoThemeMaps.roundedMap[m]||m}`]:m,"k-invalid":!f,"k-required":this.required,"k-disabled":this.$props.disabled,"k-focus":this.isFocused}),onKeydown:this.handleKeyDown,style:{width:I},onFocusin:this.handleFocus,onFocusout:this.handleBlur,ref:g=>{this.kendoAnchorRef=g}},[P,n.createVNode(X.Button,{type:"button",tabIndex:-1,icon:"clock",svgIcon:Y.clockIcon,onMousedown:this.handleIconMouseDown,onClick:this.handleIconClick,title:x,rounded:null,class:"k-input-button","aria-controls":this._popupId,"aria-label":j},null),E]);return this.$props.label?n.createVNode(U.FloatingLabel,{label:this.$props.label,editorId:u,editorValid:f,editorValue:this.getDateInputText(),editorPlaceholder:this.$props.placeholder,editorDisabled:this.$props.disabled,style:{width:I}},w(d)?d:{default:()=>[d]}):d},methods:{validity(){const e=this.computedValue&&this.normalizeTime(this.computedValue),i=this.normalizeTime(this.$props.min),o=this.normalizeTime(this.$props.max),h=S.isInRange(e,i,o),u=this.$props.validationMessage!==void 0,c=(!this.$props.required||this.computedValue!==null)&&h,a=this.$props.valid!==void 0?this.$props.valid:c;return{customError:u,rangeOverflow:S.isBiggerThanMax(e,o),rangeUnderflow:S.isSmallerThanMin(e,i),valid:a,valueMissing:this.computedValue===null}},getDateInputText(){return this.computedValue?!0:this._dateInput?this._dateInput._element.value:""},focus(){this._dateInput&&this._dateInput.focus()},normalizeTime(e){return l.setTime(l.MIDNIGHT_DATE,e)},setShow(e){this.computedShow!==e&&(this.currentShow=e,this.$emit(e?"open":"close",{component:this}))},mergeTime(e){return this.computedValue&&e?l.setTime(this.computedValue,e):e},handleInputValueChange(e){const i=this.mergeTime(e.value);this.handleValueChange({...e,value:i})},handleValueChange(e){this.currentValue=k.cloneDate(e.value),this.valueDuringOnChange=e.value,this.showDuringOnChange=!1,this.shouldFocusDateInput=!0,this.$emit("changemodel",this.computedValue),this.$emit("update:modelValue",this.computedValue),this.$emit("change",{event:e.event,value:this.computedValue,show:this.computedShow,component:this,target:{name:this.$props.name,value:this.computedValue,valueAsDate:this.computedValue}}),this.valueDuringOnChange=void 0,this.showDuringOnChange=void 0,this.setShow(!1)},handleFocus(e){this._oldShow=this.computedShow,this.isFocused=!0,this.$emit("focus",e)},handleBlur(e){this.createBlurTimeout(),this.$emit("blur",e)},timeBlur(e){this.$emit("blur",e),clearTimeout(this._blurTimeout),this.createBlurTimeout()},timeFocus(){clearTimeout(this._blurTimeout)},createBlurTimeout(){this._blurTimeout=setTimeout(()=>{this.isFocused=!1;const e=document.activeElement&&document.activeElement.closest(`#${this._popupId}`);this._dateInput&&t.canUseDOM&&document.activeElement!==this._dateInput.element()&&!e&&this.setShow(!1)},200)},handleValueReject(e){this.setShow(!1)},handleIconClick(e){this.$props.disabled||(this.shouldFocusDateInput=!0,this.setShow(!this.computedShow),this.$emit("iconclick",e))},handleIconMouseDown(e){e.preventDefault()},handleKeyDown(e){const{altKey:i,keyCode:o}=e;if(o===t.Keys.tab&&this._dateInput&&e.target!==this._dateInput._element){e.preventDefault(),this.shouldFocusDateInput=!0,this.setShow(!1);return}if(o===t.Keys.esc){this.shouldFocusDateInput=!0,this.setShow(!1);return}i&&(o===t.Keys.up||o===t.Keys.down)&&(e.preventDefault(),e.stopPropagation(),this.shouldFocusDateInput=o===t.Keys.up,this.setShow(o===t.Keys.down)),this.$emit("keydown",e)}}});exports.TimePicker=Z;
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("vue"),U=require("@progress/kendo-vue-labels"),H=require("@progress/kendo-vue-popup"),k=require("@progress/kendo-date-math"),t=require("@progress/kendo-vue-common"),G=require("@progress/kendo-vue-intl"),X=require("@progress/kendo-vue-buttons"),s=require("../messages/main.js"),J=require("../dateinput/DateInput.js"),Q=require("./TimeSelector.js"),u=require("../utils.js"),S=require("./utils.js"),W=require("../dateinput/utils.js"),Y=require("@progress/kendo-svg-icons");function v(e){return typeof e=="function"||Object.prototype.toString.call(e)==="[object Object]"&&!n.isVNode(e)}const Z=n.defineComponent({name:"KendoTimePicker",emits:{changemodel:e=>!0,"update:modelValue":e=>!0,iconclick:e=>!0,change:e=>!0,focus:e=>!0,blur:e=>!0,keydown:e=>!0,open:e=>!0,close:e=>!0},model:{event:"changemodel"},props:{cancelButton:{type:Boolean,default:!0},nowButton:{type:Boolean,default:void 0},defaultShow:{type:Boolean,default:!1},modelValue:{type:Date,default:void 0},defaultValue:{type:Date,default:function(){return null}},dateInput:{type:[String,Object,Function],default:function(){}},popup:{type:[String,Object,Function],default:function(){}},disabled:{type:Boolean,default:!1},format:{type:[String,Object],default:function(){return"t"}},formatPlaceholder:{type:[String,Object],default:function(){return W.defaultFormatPlaceholder}},rounded:{type:String,default:"medium",validator:function(e){return["small","medium","large","full"].includes(e)}},fillMode:{type:String,default:"solid",validator:function(e){return["solid","flat","outline"].includes(e)}},size:{type:String,default:"medium",validator:function(e){return["small","medium","large"].includes(e)}},id:String,ariaLabelledBy:String,ariaDescribedBy:String,min:{type:Date,default:function(){return u.MIN_TIME}},max:{type:Date,default:function(){return u.MAX_TIME}},name:String,label:String,placeholder:String,popupSettings:{type:Object,default:function(){return{}}},show:{type:Boolean,default:void 0},tabIndex:{type:Number,default:0},steps:{type:Object,default:function(){return{}}},smoothScroll:{type:Boolean,default:!0},title:{type:String,default:function(){return""}},value:{type:Date,default:function(){}},width:[Number,String],validationMessage:String,required:{type:Boolean,default:!1},validityStyles:{type:Boolean,default:!0},validate:Boolean,valid:{type:Boolean,default:void 0},inputAttributes:Object},created(){this._anchor=t.guid(),this._popupId="popup"+t.guid(),this._element=null,this._wrapper=null,this._dateInput=null,this._timeSelector=null,this.shouldFocusDateInput=!1,this.currentValue=this.$props.defaultValue,this.currentShow=this.$props.defaultShow},inject:{kendoLocalizationService:{default:null}},data(){return{currentValue:null,currentShow:!1,valueDuringOnChange:void 0,showDuringOnChange:void 0,isFocused:!1}},computed:{timeSelector(){return this._timeSelector},computedValue(){const e=this.valueDuringOnChange!==void 0?this.valueDuringOnChange:this.$props.value!==void 0?this.$props.value:this.$props.modelValue!==void 0?this.$props.modelValue:this.$data.currentValue;return e!==null?k.cloneDate(e):null},computedShow(){return this.showDuringOnChange!==void 0?this.showDuringOnChange:this.$props.show!==void 0?this.$props.show:this.currentShow}},watch:{show:function(e,i){this._oldShow=i},currentShow:function(e,i){this._oldShow=i}},mounted(){this.computedShow&&this.$forceUpdate(),this._dateInput=this.dateInputRef,this._timeSelector=this.$refs.timeSelector,this._wrapper=this.kendoAnchorRef,this._dateInput&&this._dateInput.element()&&this._dateInput.element().setAttribute("aria-haspopup","true")},updated(){this._dateInput=this.dateInputRef,this._timeSelector=this.$refs.timeSelector,this._wrapper=this.kendoAnchorRef,this._timeSelector&&this.computedShow&&!this._oldShow?this._timeSelector.focusActiveList():this._dateInput&&this._dateInput.element()&&!this.computedShow&&this.shouldFocusDateInput&&this._dateInput.element().focus({preventScroll:!0}),this.shouldFocusDateInput=!1},setup(){const e=n.ref(null),i=n.inject("kendoLocalizationService",{});return{kendoAnchorRef:e,kendoLocalizationService:i}},render(){const e=t.getDefaultSlots(this),{disabled:i,tabIndex:o,title:h,id:a,placeholder:c,format:l,formatPlaceholder:V,smoothScroll:$,width:w,name:_,steps:I,cancelButton:D,nowButton:T,validationMessage:B,required:C,validityStyles:M,ariaLabelledBy:ee,ariaDescribedBy:te,size:p,rounded:m,fillMode:y,inputAttributes:F}=this.$props,{popupClass:O,appendTo:R,animate:q}=this.$props.popupSettings,f=!this.$props.validityStyles||this.validity().valid;t.classNames("k-picker-wrap",{"k-invalid":!f,"k-disabled":i,"k-focus":this.isFocused});const z=t.classNames("k-group k-reset",O),b=G.provideLocalizationService(this),j=b.toLanguageString(s.toggleClock,s.messages[s.toggleClock]),x=b.toLanguageString(s.toggleTimeSelector,s.messages[s.toggleTimeSelector]),A=this.$props.dateInput?t.templateRendering.call(this,this.$props.dateInput,t.getListeners.call(this)):void 0,N=n.createVNode(J.DateInput,{ref:g=>{this.dateInputRef=g},placeholder:c,disabled:i,format:l,formatPlaceholder:V,id:a,size:null,rounded:null,fillMode:null,max:this.normalizeTime(this.$props.max),min:this.normalizeTime(this.$props.min),name:_,onChange:this.handleInputValueChange,required:C,steps:I,tabIndex:this.computedShow?-1:o,title:h,valid:this.validity().valid,validationMessage:B,validityStyles:M,value:this.computedValue&&this.normalizeTime(this.computedValue),ariaHasPopup:"grid",ariaExpanded:this.computedShow,ariaRole:"combobox",ariaControls:this._popupId,inputAttributes:F},v(e)?e:{default:()=>[e]}),r=n.createVNode(Q.TimeSelector,{ref:"timeSelector",cancelButton:D,disabled:i,nowButton:T,format:l,min:this.$props.min,max:this.$props.max,steps:I,smoothScroll:$,value:this.computedValue,onChange:this.handleValueChange,onReject:this.handleValueReject,onFocus:this.timeFocus,onBlur:this.timeBlur,onKeydown:this.handleKeyDown},null),P=t.getTemplate.call(this,{h:n.h,template:A,defaultRendering:N,additionalListeners:{change:this.handleInputValueChange}}),L=this.$props.popup?t.templateRendering.call(this,this.$props.popup,t.getListeners.call(this)):void 0,K=n.createVNode(H.Popup,{show:this.computedShow,anchor:this._anchor,class:z,id:this._popupId,anchorAlign:{horizontal:"left",vertical:"bottom"},popupAlign:{horizontal:"left",vertical:"top"},appendTo:R,animate:q},v(r)?r:{default:()=>[r]}),E=t.getTemplate.call(this,{h:n.h,template:L,defaultRendering:K,defaultSlots:r}),d=n.createVNode("div",{class:t.classNames("k-input","k-timepicker",{[`k-input-${t.kendoThemeMaps.sizeMap[p]||p}`]:p,[`k-input-${y}`]:y,[`k-rounded-${t.kendoThemeMaps.roundedMap[m]||m}`]:m,"k-invalid":!f,"k-required":this.required,"k-disabled":this.$props.disabled,"k-focus":this.isFocused}),onKeydown:this.handleKeyDown,style:{width:w},onFocusin:this.handleFocus,onFocusout:this.handleBlur,ref:g=>{this.kendoAnchorRef=g}},[P,n.createVNode(X.Button,{type:"button",tabIndex:-1,icon:"clock",svgIcon:Y.clockIcon,onMousedown:this.handleIconMouseDown,onClick:this.handleIconClick,title:x,rounded:null,class:"k-input-button","aria-controls":this._popupId,"aria-label":j},null),E]);return this.$props.label?n.createVNode(U.FloatingLabel,{label:this.$props.label,editorId:a,editorValid:f,editorValue:this.getDateInputText(),editorPlaceholder:this.$props.placeholder,editorDisabled:this.$props.disabled,style:{width:w}},v(d)?d:{default:()=>[d]}):d},methods:{validity(){const e=this.computedValue&&this.normalizeTime(this.computedValue),i=this.normalizeTime(this.$props.min),o=this.normalizeTime(this.$props.max),h=S.isInRange(e,i,o),a=this.$props.validationMessage!==void 0,c=(!this.$props.required||this.computedValue!==null)&&h,l=this.$props.valid!==void 0?this.$props.valid:c;return{customError:a,rangeOverflow:S.isBiggerThanMax(e,o),rangeUnderflow:S.isSmallerThanMin(e,i),valid:l,valueMissing:this.computedValue===null}},getDateInputText(){return this.computedValue?!0:this._dateInput?this._dateInput._element.value:""},focus(){this._dateInput&&this._dateInput.focus()},normalizeTime(e){return u.setTime(u.MIDNIGHT_DATE,e)},setShow(e){this.computedShow!==e&&(this.currentShow=e,this.$emit(e?"open":"close",{component:this}))},mergeTime(e){return this.computedValue&&e?u.setTime(this.computedValue,e):e},handleInputValueChange(e){const i=this.mergeTime(e.value);this.handleValueChange({...e,value:i})},handleValueChange(e){this.currentValue=k.cloneDate(e.value),this.valueDuringOnChange=e.value,this.showDuringOnChange=!1,this.shouldFocusDateInput=!0,this.$emit("changemodel",this.computedValue),this.$emit("update:modelValue",this.computedValue),this.$emit("change",{event:e.event,value:this.computedValue,show:this.computedShow,component:this,target:{name:this.$props.name,value:this.computedValue,valueAsDate:this.computedValue}}),this.valueDuringOnChange=void 0,this.showDuringOnChange=void 0,this.setShow(!1)},handleFocus(e){this._oldShow=this.computedShow,this.isFocused=!0,this.$emit("focus",{event:e})},handleBlur(e){this.createBlurTimeout(),this.$emit("blur",{event:e})},timeBlur(e){this.$emit("blur",{event:e}),clearTimeout(this._blurTimeout),this.createBlurTimeout()},timeFocus(){clearTimeout(this._blurTimeout)},createBlurTimeout(){this._blurTimeout=setTimeout(()=>{this.isFocused=!1;const e=document.activeElement&&document.activeElement.closest(`#${this._popupId}`);this._dateInput&&t.canUseDOM&&document.activeElement!==this._dateInput.element()&&!e&&this.setShow(!1)},200)},handleValueReject(e){this.setShow(!1)},handleIconClick(e){this.$props.disabled||(this.shouldFocusDateInput=!0,this.setShow(!this.computedShow),this.$emit("iconclick",e))},handleIconMouseDown(e){e.preventDefault()},handleKeyDown(e){const{altKey:i,keyCode:o}=e;if(o===t.Keys.tab&&this._dateInput&&e.target!==this._dateInput._element){e.preventDefault(),this.shouldFocusDateInput=!0,this.setShow(!1);return}if(o===t.Keys.esc){this.shouldFocusDateInput=!0,this.setShow(!1);return}i&&(o===t.Keys.up||o===t.Keys.down)&&(e.preventDefault(),e.stopPropagation(),this.shouldFocusDateInput=o===t.Keys.up,this.setShow(o===t.Keys.down)),this.$emit("keydown",e)}}});exports.TimePicker=Z;
|
|
@@ -9,31 +9,31 @@ import { defineComponent as Z, createVNode as n, h as y, ref as ee, inject as te
|
|
|
9
9
|
import { FloatingLabel as ne } from "@progress/kendo-vue-labels";
|
|
10
10
|
import { Popup as oe } from "@progress/kendo-vue-popup";
|
|
11
11
|
import { cloneDate as b } from "@progress/kendo-date-math";
|
|
12
|
-
import { Keys as o, canUseDOM as
|
|
13
|
-
import { provideLocalizationService as
|
|
14
|
-
import { Button as
|
|
12
|
+
import { Keys as o, canUseDOM as se, getDefaultSlots as ae, classNames as f, templateRendering as _, getListeners as $, getTemplate as D, kendoThemeMaps as k, guid as V } from "@progress/kendo-vue-common";
|
|
13
|
+
import { provideLocalizationService as ue } from "@progress/kendo-vue-intl";
|
|
14
|
+
import { Button as le } from "@progress/kendo-vue-buttons";
|
|
15
15
|
import { toggleClock as T, messages as B, toggleTimeSelector as C } from "../messages/main.mjs";
|
|
16
16
|
import { DateInput as re } from "../dateinput/DateInput.mjs";
|
|
17
17
|
import { TimeSelector as de } from "./TimeSelector.mjs";
|
|
18
18
|
import { setTime as F, MAX_TIME as he, MIN_TIME as pe, MIDNIGHT_DATE as ce } from "../utils.mjs";
|
|
19
19
|
import { isInRange as me, isSmallerThanMin as fe, isBiggerThanMax as ge } from "./utils.mjs";
|
|
20
20
|
import { defaultFormatPlaceholder as Se } from "../dateinput/utils.mjs";
|
|
21
|
-
import { clockIcon as
|
|
21
|
+
import { clockIcon as ve } from "@progress/kendo-svg-icons";
|
|
22
22
|
function g(e) {
|
|
23
23
|
return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !ie(e);
|
|
24
24
|
}
|
|
25
25
|
const ze = /* @__PURE__ */ Z({
|
|
26
26
|
name: "KendoTimePicker",
|
|
27
27
|
emits: {
|
|
28
|
-
changemodel:
|
|
29
|
-
"update:modelValue":
|
|
30
|
-
iconclick:
|
|
31
|
-
change:
|
|
32
|
-
focus:
|
|
33
|
-
blur:
|
|
34
|
-
keydown:
|
|
35
|
-
open:
|
|
36
|
-
close:
|
|
28
|
+
changemodel: (e) => !0,
|
|
29
|
+
"update:modelValue": (e) => !0,
|
|
30
|
+
iconclick: (e) => !0,
|
|
31
|
+
change: (e) => !0,
|
|
32
|
+
focus: (e) => !0,
|
|
33
|
+
blur: (e) => !0,
|
|
34
|
+
keydown: (e) => !0,
|
|
35
|
+
open: (e) => !0,
|
|
36
|
+
close: (e) => !0
|
|
37
37
|
},
|
|
38
38
|
model: {
|
|
39
39
|
event: "changemodel"
|
|
@@ -231,28 +231,28 @@ const ze = /* @__PURE__ */ Z({
|
|
|
231
231
|
};
|
|
232
232
|
},
|
|
233
233
|
render() {
|
|
234
|
-
const e =
|
|
234
|
+
const e = ae(this), {
|
|
235
235
|
disabled: t,
|
|
236
236
|
tabIndex: i,
|
|
237
237
|
title: r,
|
|
238
|
-
id:
|
|
238
|
+
id: s,
|
|
239
239
|
placeholder: d,
|
|
240
|
-
format:
|
|
240
|
+
format: a,
|
|
241
241
|
formatPlaceholder: M,
|
|
242
242
|
smoothScroll: O,
|
|
243
243
|
width: S,
|
|
244
244
|
name: R,
|
|
245
|
-
steps:
|
|
245
|
+
steps: v,
|
|
246
246
|
cancelButton: z,
|
|
247
247
|
nowButton: x,
|
|
248
248
|
validationMessage: A,
|
|
249
249
|
required: j,
|
|
250
250
|
validityStyles: L,
|
|
251
|
-
ariaLabelledBy:
|
|
252
|
-
ariaDescribedBy:
|
|
251
|
+
ariaLabelledBy: we,
|
|
252
|
+
ariaDescribedBy: Ie,
|
|
253
253
|
size: h,
|
|
254
254
|
rounded: p,
|
|
255
|
-
fillMode:
|
|
255
|
+
fillMode: w,
|
|
256
256
|
inputAttributes: P
|
|
257
257
|
} = this.$props, {
|
|
258
258
|
popupClass: E,
|
|
@@ -264,15 +264,15 @@ const ze = /* @__PURE__ */ Z({
|
|
|
264
264
|
"k-disabled": t,
|
|
265
265
|
"k-focus": this.isFocused
|
|
266
266
|
});
|
|
267
|
-
const q = f("k-group k-reset", E),
|
|
267
|
+
const q = f("k-group k-reset", E), I = ue(this), U = I.toLanguageString(T, B[T]), H = I.toLanguageString(C, B[C]), G = this.$props.dateInput ? _.call(this, this.$props.dateInput, $.call(this)) : void 0, X = n(re, {
|
|
268
268
|
ref: (m) => {
|
|
269
269
|
this.dateInputRef = m;
|
|
270
270
|
},
|
|
271
271
|
placeholder: d,
|
|
272
272
|
disabled: t,
|
|
273
|
-
format:
|
|
273
|
+
format: a,
|
|
274
274
|
formatPlaceholder: M,
|
|
275
|
-
id:
|
|
275
|
+
id: s,
|
|
276
276
|
size: null,
|
|
277
277
|
rounded: null,
|
|
278
278
|
fillMode: null,
|
|
@@ -281,7 +281,7 @@ const ze = /* @__PURE__ */ Z({
|
|
|
281
281
|
name: R,
|
|
282
282
|
onChange: this.handleInputValueChange,
|
|
283
283
|
required: j,
|
|
284
|
-
steps:
|
|
284
|
+
steps: v,
|
|
285
285
|
tabIndex: this.computedShow ? -1 : i,
|
|
286
286
|
title: r,
|
|
287
287
|
valid: this.validity().valid,
|
|
@@ -295,15 +295,15 @@ const ze = /* @__PURE__ */ Z({
|
|
|
295
295
|
inputAttributes: P
|
|
296
296
|
}, g(e) ? e : {
|
|
297
297
|
default: () => [e]
|
|
298
|
-
}),
|
|
298
|
+
}), u = n(de, {
|
|
299
299
|
ref: "timeSelector",
|
|
300
300
|
cancelButton: z,
|
|
301
301
|
disabled: t,
|
|
302
302
|
nowButton: x,
|
|
303
|
-
format:
|
|
303
|
+
format: a,
|
|
304
304
|
min: this.$props.min,
|
|
305
305
|
max: this.$props.max,
|
|
306
|
-
steps:
|
|
306
|
+
steps: v,
|
|
307
307
|
smoothScroll: O,
|
|
308
308
|
value: this.computedValue,
|
|
309
309
|
onChange: this.handleValueChange,
|
|
@@ -333,17 +333,17 @@ const ze = /* @__PURE__ */ Z({
|
|
|
333
333
|
},
|
|
334
334
|
appendTo: K,
|
|
335
335
|
animate: N
|
|
336
|
-
}, g(
|
|
337
|
-
default: () => [
|
|
336
|
+
}, g(u) ? u : {
|
|
337
|
+
default: () => [u]
|
|
338
338
|
}), Y = D.call(this, {
|
|
339
339
|
h: y,
|
|
340
340
|
template: Q,
|
|
341
341
|
defaultRendering: W,
|
|
342
|
-
defaultSlots:
|
|
343
|
-
}),
|
|
342
|
+
defaultSlots: u
|
|
343
|
+
}), l = n("div", {
|
|
344
344
|
class: f("k-input", "k-timepicker", {
|
|
345
345
|
[`k-input-${k.sizeMap[h] || h}`]: h,
|
|
346
|
-
[`k-input-${
|
|
346
|
+
[`k-input-${w}`]: w,
|
|
347
347
|
[`k-rounded-${k.roundedMap[p] || p}`]: p,
|
|
348
348
|
"k-invalid": !c,
|
|
349
349
|
"k-required": this.required,
|
|
@@ -359,11 +359,11 @@ const ze = /* @__PURE__ */ Z({
|
|
|
359
359
|
ref: (m) => {
|
|
360
360
|
this.kendoAnchorRef = m;
|
|
361
361
|
}
|
|
362
|
-
}, [J, n(
|
|
362
|
+
}, [J, n(le, {
|
|
363
363
|
type: "button",
|
|
364
364
|
tabIndex: -1,
|
|
365
365
|
icon: "clock",
|
|
366
|
-
svgIcon:
|
|
366
|
+
svgIcon: ve,
|
|
367
367
|
onMousedown: this.handleIconMouseDown,
|
|
368
368
|
onClick: this.handleIconClick,
|
|
369
369
|
title: H,
|
|
@@ -374,7 +374,7 @@ const ze = /* @__PURE__ */ Z({
|
|
|
374
374
|
}, null), Y]);
|
|
375
375
|
return this.$props.label ? n(ne, {
|
|
376
376
|
label: this.$props.label,
|
|
377
|
-
editorId:
|
|
377
|
+
editorId: s,
|
|
378
378
|
editorValid: c,
|
|
379
379
|
editorValue: this.getDateInputText(),
|
|
380
380
|
editorPlaceholder: this.$props.placeholder,
|
|
@@ -382,18 +382,18 @@ const ze = /* @__PURE__ */ Z({
|
|
|
382
382
|
style: {
|
|
383
383
|
width: S
|
|
384
384
|
}
|
|
385
|
-
}, g(
|
|
386
|
-
default: () => [
|
|
387
|
-
}) :
|
|
385
|
+
}, g(l) ? l : {
|
|
386
|
+
default: () => [l]
|
|
387
|
+
}) : l;
|
|
388
388
|
},
|
|
389
389
|
methods: {
|
|
390
390
|
validity() {
|
|
391
|
-
const e = this.computedValue && this.normalizeTime(this.computedValue), t = this.normalizeTime(this.$props.min), i = this.normalizeTime(this.$props.max), r = me(e, t, i),
|
|
391
|
+
const e = this.computedValue && this.normalizeTime(this.computedValue), t = this.normalizeTime(this.$props.min), i = this.normalizeTime(this.$props.max), r = me(e, t, i), s = this.$props.validationMessage !== void 0, d = (!this.$props.required || this.computedValue !== null) && r, a = this.$props.valid !== void 0 ? this.$props.valid : d;
|
|
392
392
|
return {
|
|
393
|
-
customError:
|
|
393
|
+
customError: s,
|
|
394
394
|
rangeOverflow: ge(e, i),
|
|
395
395
|
rangeUnderflow: fe(e, t),
|
|
396
|
-
valid:
|
|
396
|
+
valid: a,
|
|
397
397
|
valueMissing: this.computedValue === null
|
|
398
398
|
};
|
|
399
399
|
},
|
|
@@ -435,13 +435,19 @@ const ze = /* @__PURE__ */ Z({
|
|
|
435
435
|
}), this.valueDuringOnChange = void 0, this.showDuringOnChange = void 0, this.setShow(!1);
|
|
436
436
|
},
|
|
437
437
|
handleFocus(e) {
|
|
438
|
-
this._oldShow = this.computedShow, this.isFocused = !0, this.$emit("focus",
|
|
438
|
+
this._oldShow = this.computedShow, this.isFocused = !0, this.$emit("focus", {
|
|
439
|
+
event: e
|
|
440
|
+
});
|
|
439
441
|
},
|
|
440
442
|
handleBlur(e) {
|
|
441
|
-
this.createBlurTimeout(), this.$emit("blur",
|
|
443
|
+
this.createBlurTimeout(), this.$emit("blur", {
|
|
444
|
+
event: e
|
|
445
|
+
});
|
|
442
446
|
},
|
|
443
447
|
timeBlur(e) {
|
|
444
|
-
this.$emit("blur",
|
|
448
|
+
this.$emit("blur", {
|
|
449
|
+
event: e
|
|
450
|
+
}), clearTimeout(this._blurTimeout), this.createBlurTimeout();
|
|
445
451
|
},
|
|
446
452
|
timeFocus() {
|
|
447
453
|
clearTimeout(this._blurTimeout);
|
|
@@ -450,7 +456,7 @@ const ze = /* @__PURE__ */ Z({
|
|
|
450
456
|
this._blurTimeout = setTimeout(() => {
|
|
451
457
|
this.isFocused = !1;
|
|
452
458
|
const e = document.activeElement && document.activeElement.closest(`#${this._popupId}`);
|
|
453
|
-
this._dateInput &&
|
|
459
|
+
this._dateInput && se && document.activeElement !== this._dateInput.element() && !e && this.setShow(!1);
|
|
454
460
|
}, 200);
|
|
455
461
|
},
|
|
456
462
|
handleValueReject(e) {
|
|
@@ -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 n=require("vue"),d=require("@progress/kendo-vue-buttons"),
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("vue"),d=require("@progress/kendo-vue-buttons"),u=require("@progress/kendo-date-math"),l=require("@progress/kendo-vue-common"),m=require("@progress/kendo-vue-intl"),a=require("../messages/main.js"),s=require("../utils.js"),r=require("./utils.js"),y=require("./TimePart.js");function p(e){return typeof e=="function"||Object.prototype.toString.call(e)==="[object Object]"&&!n.isVNode(e)}const V=n.defineComponent({name:"KendoTimeSelector",emits:{change:e=>!0,focus:e=>!0,blur:e=>!0,keydown:e=>!0,reject:e=>!0},props:{cancelButton:{type:Boolean,default:!0},boundRange:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},format:{type:[String,Object],default:function(){return"t"}},max:{type:Date,default:function(){return s.MAX_TIME}},min:{type:Date,default:function(){return s.MIN_TIME}},nowButton:Boolean,steps:{type:Object,default:function(){return{}}},smoothScroll:{type:Boolean,default:!0},tabIndex:Number,value:{type:Date,default:function(){return null}},onChange:Function,onReject:Function,onKeydown:Function},created(){this.dateFormatParts=this.intl.splitDateFormat(this.$props.format),this.mergeValue=r.valueMerger(r.generateGetters(this.dateFormatParts)),this.hasActiveButton=this.hasActiveButton.bind(this),this.currentState=this.$props.value||s.MIDNIGHT_DATE,this.currentValue=this.$props.value},inject:{kendoIntlService:{default:null},kendoLocalizationService:{default:null}},data(){return{currentState:null,currentValue:null,valueDuringOnChange:void 0}},computed:{computedValue(){const e=this.valueDuringOnChange!==void 0?this.valueDuringOnChange:this.$props.value!==null?this.$props.value:this.currentValue;return e!==null?u.cloneDate(e):null},intl(){return m.provideIntlService(this)},current(){return this.currentState!==null?u.cloneDate(this.currentState):null}},mounted(){this.timePart=this.$refs.timePart,this._acceptButton=this.$refs.acceptButton,this._cancelButton=this.$refs.cancelButton},setup(){const e=n.inject("kendoIntlService",{}),t=n.inject("kendoLocalizationService",{});return{kendoIntlService:e,kendoLocalizationService:t}},render(){const{format:e,cancelButton:t,disabled:c,tabIndex:f,smoothScroll:g,min:v,max:S,boundRange:k,nowButton:B,steps:b}=this.$props,h=m.provideLocalizationService(this),i=h.toLanguageString(a.timePickerCancel,a.messages[a.timePickerCancel]),o=h.toLanguageString(a.timePickerSet,a.messages[a.timePickerSet]);return n.createVNode("div",{tabindex:c?void 0:f||0,class:l.classNames("k-timeselector",{"k-disabled":c}),onKeydown:this.handleKeyDown},[n.createVNode(y.TimePart,{ref:"timePart",value:this.current,onChange:this.handleChange,onNowclick:this.handleNowClick,format:e,smoothScroll:g,min:v,max:S,onFocus:this.handleFocus,onBlur:this.handleBlur,boundRange:k,disabled:c,nowButton:B,steps:b},null),n.createVNode("div",{class:"k-time-footer k-actions k-actions-stretched"},[t&&n.createVNode(d.Button,{type:"button",ref:"cancelButton",class:"k-time-cancel",onClick:this.handleReject,title:i,"aria-label":i},p(i)?i:{default:()=>[i]}),n.createVNode(d.Button,{type:"button",ref:"acceptButton",themeColor:"primary",class:"k-time-accept",onClick:this.handleAccept,title:o,"aria-label":o},p(o)?o:{default:()=>[o]})])])},methods:{handleBlur(e){this.$emit("blur",e)},handleFocus(e){this.$emit("focus",e)},focusActiveList(){this.timePart&&this.timePart.focus({preventScroll:!0})},hasActiveButton(){return this._acceptButton?l.canUseDOM&&(document.activeElement===this._acceptButton.$el||document.activeElement===this._cancelButton.$el):!1},handleKeyDown(e){const{keyCode:t}=e;switch(this.$emit("keydown",e),t){case l.Keys.enter:this.hasActiveButton()||this.handleAccept(e);return;default:return}},handleAccept(e){const t=this.mergeValue(u.cloneDate(this.computedValue||r.getNow()),this.timePart?this.timePart.computedValue:this.current);this.currentValue=t,this.valueDuringOnChange=t,this.$emit("change",{event:e,value:this.computedValue,target:this}),this.valueDuringOnChange=void 0},handleReject(e){this.currentState=this.computedValue,this.$emit("reject",e)},handleNowClick(e){const t=this.mergeValue(u.cloneDate(this.computedValue||r.getNow()),r.getNow());this.currentState=t,this.currentValue=t,this.valueDuringOnChange=t,this.$emit("change",{event:e,value:this.computedValue,target:this}),this.valueDuringOnChange=void 0},handleChange(e){this.currentState=e}}});exports.TimeSelector=V;
|
|
@@ -9,9 +9,9 @@ import { defineComponent as y, createVNode as a, inject as c, isVNode as C } fro
|
|
|
9
9
|
import { Button as s } from "@progress/kendo-vue-buttons";
|
|
10
10
|
import { cloneDate as o } from "@progress/kendo-date-math";
|
|
11
11
|
import { Keys as D, canUseDOM as V, classNames as $ } from "@progress/kendo-vue-common";
|
|
12
|
-
import { provideLocalizationService as w, provideIntlService as
|
|
12
|
+
import { provideLocalizationService as w, provideIntlService as j } from "@progress/kendo-vue-intl";
|
|
13
13
|
import { timePickerCancel as h, messages as d, timePickerSet as m } from "../messages/main.mjs";
|
|
14
|
-
import { MIDNIGHT_DATE as
|
|
14
|
+
import { MIDNIGHT_DATE as O, MIN_TIME as P, MAX_TIME as I } from "../utils.mjs";
|
|
15
15
|
import { getNow as u, valueMerger as A, generateGetters as N } from "./utils.mjs";
|
|
16
16
|
import { TimePart as F } from "./TimePart.mjs";
|
|
17
17
|
function p(t) {
|
|
@@ -20,9 +20,11 @@ function p(t) {
|
|
|
20
20
|
const G = /* @__PURE__ */ y({
|
|
21
21
|
name: "KendoTimeSelector",
|
|
22
22
|
emits: {
|
|
23
|
-
change:
|
|
24
|
-
focus:
|
|
25
|
-
blur:
|
|
23
|
+
change: (t) => !0,
|
|
24
|
+
focus: (t) => !0,
|
|
25
|
+
blur: (t) => !0,
|
|
26
|
+
keydown: (t) => !0,
|
|
27
|
+
reject: (t) => !0
|
|
26
28
|
},
|
|
27
29
|
props: {
|
|
28
30
|
cancelButton: {
|
|
@@ -52,7 +54,7 @@ const G = /* @__PURE__ */ y({
|
|
|
52
54
|
min: {
|
|
53
55
|
type: Date,
|
|
54
56
|
default: function() {
|
|
55
|
-
return
|
|
57
|
+
return P;
|
|
56
58
|
}
|
|
57
59
|
},
|
|
58
60
|
nowButton: Boolean,
|
|
@@ -78,7 +80,7 @@ const G = /* @__PURE__ */ y({
|
|
|
78
80
|
onKeydown: Function
|
|
79
81
|
},
|
|
80
82
|
created() {
|
|
81
|
-
this.dateFormatParts = this.intl.splitDateFormat(this.$props.format), this.mergeValue = A(N(this.dateFormatParts)), this.hasActiveButton = this.hasActiveButton.bind(this), this.currentState = this.$props.value ||
|
|
83
|
+
this.dateFormatParts = this.intl.splitDateFormat(this.$props.format), this.mergeValue = A(N(this.dateFormatParts)), this.hasActiveButton = this.hasActiveButton.bind(this), this.currentState = this.$props.value || O, this.currentValue = this.$props.value;
|
|
82
84
|
},
|
|
83
85
|
inject: {
|
|
84
86
|
kendoIntlService: {
|
|
@@ -101,7 +103,7 @@ const G = /* @__PURE__ */ y({
|
|
|
101
103
|
return t !== null ? o(t) : null;
|
|
102
104
|
},
|
|
103
105
|
intl() {
|
|
104
|
-
return
|
|
106
|
+
return j(this);
|
|
105
107
|
},
|
|
106
108
|
current() {
|
|
107
109
|
return this.currentState !== null ? o(this.currentState) : null;
|
|
@@ -123,8 +125,8 @@ const G = /* @__PURE__ */ y({
|
|
|
123
125
|
cancelButton: e,
|
|
124
126
|
disabled: r,
|
|
125
127
|
tabIndex: f,
|
|
126
|
-
smoothScroll:
|
|
127
|
-
min:
|
|
128
|
+
smoothScroll: v,
|
|
129
|
+
min: g,
|
|
128
130
|
max: S,
|
|
129
131
|
boundRange: B,
|
|
130
132
|
nowButton: b,
|
|
@@ -142,8 +144,8 @@ const G = /* @__PURE__ */ y({
|
|
|
142
144
|
onChange: this.handleChange,
|
|
143
145
|
onNowclick: this.handleNowClick,
|
|
144
146
|
format: t,
|
|
145
|
-
smoothScroll:
|
|
146
|
-
min:
|
|
147
|
+
smoothScroll: v,
|
|
148
|
+
min: g,
|
|
147
149
|
max: S,
|
|
148
150
|
onFocus: this.handleFocus,
|
|
149
151
|
onBlur: this.handleBlur,
|
|
@@ -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 a=require("vue"),h=require("@progress/kendo-vue-common"),S=require("./services/RowHeightService.js"),m=require("./services/ScrollerService.js");let s=function(t){return t[t.Backward=0]="Backward",t[t.Forward=1]="Forward",t}({});const g=(t,e,r)=>Math.min(Math.abs(e-t),r),w=17,v={[s.Forward]:t=>e=>e+t,[s.Backward]:t=>e=>e-t},H={[s.Forward]:t=>e=>Math.min(e,t),[s.Backward]:t=>e=>Math.max(e,t)},$={[s.Forward]:t=>e=>e<t,[s.Backward]:t=>e=>e>t},b=a.defineComponent({name:"Virtualization",emits:{scroll:
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("vue"),h=require("@progress/kendo-vue-common"),S=require("./services/RowHeightService.js"),m=require("./services/ScrollerService.js");let s=function(t){return t[t.Backward=0]="Backward",t[t.Forward=1]="Forward",t}({});const g=(t,e,r)=>Math.min(Math.abs(e-t),r),w=17,v={[s.Forward]:t=>e=>e+t,[s.Backward]:t=>e=>e-t},H={[s.Forward]:t=>e=>Math.min(e,t),[s.Backward]:t=>e=>Math.max(e,t)},$={[s.Forward]:t=>e=>e<t,[s.Backward]:t=>e=>e>t},b=a.defineComponent({name:"Virtualization",emits:{scroll:t=>!0,scrollaction:t=>!0},props:{bottomOffset:{type:Number,required:!0},direction:{type:String,default:function(){return"vertical"}},forceScroll:{type:Boolean,default:!1},itemHeight:Number,itemWidth:Number,maxScrollDifference:{type:Number,default:100},scrollDuration:{type:Number,default:100},scrollOffsetSize:{type:Number,default:0},skip:{type:Number,required:!0},tabIndex:Number,take:{type:Number,required:!0},topOffset:{type:Number,required:!0},total:{type:Number,required:!0},role:String},created(){this.animationInProgress=!1,this.lastTotal=void 0,this.scrollerService=new m.ScrollerService(this.handleScrollAction,this.handlePageAction)},mounted(){this.scrollContainer=this.$refs.scrollContainer},computed:{element(){return this.scrollContainer}},methods:{containerOffsetSize(){return this.getContainerProperty(this.$props.direction==="vertical"?"offsetHeight":"offsetWidth")},containerScrollSize(){return this.getContainerProperty(this.$props.direction==="vertical"?"scrollHeight":"scrollWidth")},containerScrollPosition(){return this.getContainerProperty(this.$props.direction==="vertical"?"scrollTop":"scrollLeft")},activeIndex(){return this.itemIndex(Math.ceil(this.containerScrollPosition()))},itemIndex(t){return this.rowHeightService?this.rowHeightService.index(t):0},itemOffset(t){return this.rowHeightService?this.rowHeightService.offset(t):0},isIndexVisible(t){if(!this.rowHeightService)return!1;const e=this.containerScrollPosition(),r=e+this.containerOffsetSize(),i=this.rowHeightService.offset(t),o=i+this.rowHeightService.height(t);return i>=e&&o<=r},isListScrolled(t){return this.rowHeightService?this.containerScrollPosition()!==this.rowHeightService.offset(t):!1},scrollTo(t){const e=this.$props.direction==="vertical"?"scrollTop":"scrollLeft";this.scrollContainer&&(this.scrollContainer[e]=t)},scrollToIndex(t){this.rowHeightService&&(this.animationInProgress=!1,this.scrollTo(this.rowHeightService.offset(t)))},animateToIndex(t){if(!this.rowHeightService||!window)return;window.cancelAnimationFrame(this.cancelAnimation);const e=this.rowHeightService.offset(t),r=this.getContainerScrollDirection(e);let{start:i,end:o}=this.scrollRange(e,r);if(i===o)return;const l=this.scrollStep(i,o),n=v[r](l),d=H[r](o),f=$[r](n(o)),p=u=>{this.animationInProgress=!0;const c=n(u);this.scrollTo(d(c)),f(c)?this.cancelAnimation=window.requestAnimationFrame(()=>{p(c)}):this.animationInProgress=!1};this.cancelAnimation=window.requestAnimationFrame(()=>{p(i)})},scrollToBottom(){this.rowHeightService&&this.scrollTo(this.rowHeightService.totalHeight()+this.$props.bottomOffset)},scrollStep(t,e){const r=this.$props.scrollDuration;return Math.abs(e-t)/(r/w)},scrollRange(t,e){const r=this.containerScrollPosition();if(parseInt(`${t}`,10)===parseInt(`${r}`,10))return{start:t,end:t};const i=this.containerMaxScroll(),o=e===s.Backward?1:-1,l=g(r,t,this.$props.maxScrollDifference),n=Math.min(t,i);return{start:Math.min(Math.max(n+o*l,0),i),end:n}},containerMaxScroll(){return this.containerScrollSize()-this.containerOffsetSize()},getContainerScrollDirection(t){return t<this.containerScrollPosition()?s.Backward:s.Forward},initServices(t){const e=t||this.$props,r=e.direction==="vertical"?e.itemHeight:e.itemWidth;r!==void 0&&(this.rowHeightService=new S.RowHeightService(e.total,r,0),this.scrollerService.create(this.rowHeightService,e.skip,e.take,e.total,e.topOffset,this.$props.scrollOffsetSize,this.$props.direction))},getContainerProperty(t){return this.scrollContainer?this.scrollContainer[t]:0},handleScroll(t){if(!this.scrollContainer||!this.rowHeightService)return;const e=t.target;this.scrollerService.onScroll({scrollLeft:e.scrollLeft,scrollTop:e.scrollTop,offsetHeight:e.offsetHeight,offsetWidth:e.offsetWidth});const i={index:this.rowHeightService.index(this.containerScrollPosition()-this.$props.topOffset),target:e,scrollAction:this.scrollAction,pageAction:this.pageAction,animationInProgress:this.animationInProgress};this.$emit("scrollaction",i),this.scrollAction=void 0,this.pageAction=void 0},handleScrollAction(t){this.scrollAction=t},handlePageAction(t){this.pageAction=t}},render(){const t=h.getDefaultSlots(this);(this.lastTotal!==this.$props.total||this.lastDirection!==this.$props.direction||this.lastTake!==this.$props.take)&&(this.initServices(),this.lastTotal=this.$props.total,this.lastDirection=this.$props.direction,this.lastTake=this.$props.take);const e=`${(this.rowHeightService?this.rowHeightService.totalHeight():0)+this.$props.bottomOffset}`,r=this.$props.direction==="vertical"?{height:`${e}px`}:{width:`${e}px`},i=h.classNames("k-content k-scrollable",{"k-scrollable-horizontal":this.$props.direction==="horizontal"}),o=h.classNames("k-scrollable-placeholder",{"k-scrollable-horizontal-placeholder":this.$props.direction==="horizontal"});return a.createVNode("div",{ref:"scrollContainer",onScroll:this.handleScroll,class:i,tabindex:this.$props.tabIndex,role:this.$props.role},[t,a.createVNode("div",{style:r,class:o},null)])}});exports.ScrollDirection=s;exports.Virtualization=b;
|
|
@@ -24,8 +24,8 @@ const v = (t, e, r) => Math.min(Math.abs(e - t), r), H = 17, $ = {
|
|
|
24
24
|
}, y = /* @__PURE__ */ m({
|
|
25
25
|
name: "Virtualization",
|
|
26
26
|
emits: {
|
|
27
|
-
scroll:
|
|
28
|
-
scrollaction:
|
|
27
|
+
scroll: (t) => !0,
|
|
28
|
+
scrollaction: (t) => !0
|
|
29
29
|
},
|
|
30
30
|
props: {
|
|
31
31
|
bottomOffset: {
|