@progress/kendo-vue-data-tools 3.12.0 → 3.13.0-dev.202308171358

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.
@@ -25,14 +25,6 @@ import { messages, pagerFirstPage, pagerLastPage, pagerNextPage, pagerPreviousPa
25
25
  import { provideLocalizationService } from '@progress/kendo-vue-intl';
26
26
  import { getListeners, getTemplate, hasListener, isRtl, kendoThemeMaps, templateRendering } from '@progress/kendo-vue-common';
27
27
  import { caretAltLeftIcon, caretAltRightIcon, caretAltToLeftIcon, caretAltToRightIcon } from '@progress/kendo-svg-icons';
28
- /**
29
- * @hidden
30
- */
31
- var RESPONSIVE_BREAKPOINT_MEDIUM = 600;
32
- /**
33
- * @hidden
34
- */
35
- var RESPONSIVE_BREAKPOINT_LARGE = 768;
36
28
  /**
37
29
  * @hidden
38
30
  */
@@ -83,18 +75,23 @@ var PagerVue2 = {
83
75
  default: undefined
84
76
  }
85
77
  },
78
+ created: function created() {
79
+ this.pagerSizesIndex = 1;
80
+ this.pagerInfoIndex = 2;
81
+ },
86
82
  data: function data() {
87
83
  return {
88
84
  currentSize: 'medium',
89
- currentRtl: false
85
+ currentRtl: false,
86
+ itemsToFit: undefined,
87
+ itemsWidths: undefined
90
88
  };
91
89
  },
92
90
  mounted: function mounted() {
93
91
  window.addEventListener('resize', this.onWindowResize);
94
92
  this.currentRtl = isRtl(this.$el);
95
- this.onWindowResize();
96
- },
97
- updated: function updated() {
93
+ var childsWidths = this.collectPagerChildsWidths();
94
+ this.itemsWidths = childsWidths;
98
95
  this.onWindowResize();
99
96
  },
100
97
  destroyed: !!isV3 ? undefined : function () {
@@ -161,17 +158,41 @@ var PagerVue2 = {
161
158
  if (!element || !this.$props.responsive || this.$props.settings.responsive === false) {
162
159
  return;
163
160
  }
164
- var width = element.offsetWidth;
165
- if (width < RESPONSIVE_BREAKPOINT_MEDIUM) {
166
- this.currentSize = 'small';
167
- } else if (width >= RESPONSIVE_BREAKPOINT_MEDIUM && width < RESPONSIVE_BREAKPOINT_LARGE) {
168
- this.currentSize = 'medium';
169
- } else {
170
- this.currentSize = 'large';
171
- }
161
+ this.itemsToFit = this.fitChildsInParent(element, this.itemsWidths || []);
172
162
  },
173
163
  transformDimesion: function transformDimesion(initialValue) {
174
164
  return typeof initialValue === 'string' ? initialValue.endsWith('px') ? initialValue : initialValue + 'px' : initialValue + 'px';
165
+ },
166
+ collectPagerChildsWidths: function collectPagerChildsWidths() {
167
+ var _a;
168
+ var arrayChildren = Array.from(((_a = this.$el) === null || _a === void 0 ? void 0 : _a.children) || []);
169
+ var widths = arrayChildren.map(function (item) {
170
+ if (item instanceof HTMLElement) {
171
+ return item.offsetWidth;
172
+ }
173
+ return 0;
174
+ });
175
+ return widths;
176
+ },
177
+ fitChildsInParent: function fitChildsInParent(parent, childsWidths) {
178
+ var fitItems = [0];
179
+ var elementsWith = 0;
180
+ var updatedWidths = childsWidths;
181
+ var parentWidth = parent.offsetWidth;
182
+ var firstElement = childsWidths[0];
183
+ var buffer = 40;
184
+ elementsWith += firstElement;
185
+ for (var index = 1; index < childsWidths.length; index++) {
186
+ var parentChild = parent.children[index];
187
+ var currentElement = (parentChild === null || parentChild === void 0 ? void 0 : parentChild.offsetWidth) || childsWidths[index];
188
+ if ((elementsWith += currentElement) < parentWidth - buffer) {
189
+ fitItems.push(index);
190
+ } else {
191
+ updatedWidths[index] = currentElement;
192
+ }
193
+ }
194
+ this.itemsWidths = updatedWidths;
195
+ return fitItems;
175
196
  }
176
197
  },
177
198
  // @ts-ignore
@@ -187,18 +208,19 @@ var PagerVue2 = {
187
208
  },
188
209
  // @ts-ignore
189
210
  render: function render(createElement) {
211
+ var _a, _b;
190
212
  var h = gh || createElement;
191
- var _a = this.$props,
192
- skip = _a.skip,
193
- take = _a.take,
194
- total = _a.total,
195
- pageSizes = _a.pageSizes,
196
- buttonCount = _a.buttonCount,
197
- messagesMap = _a.messagesMap,
198
- info = _a.info,
199
- type = _a.type,
200
- previousNext = _a.previousNext,
201
- pageSizeValue = _a.pageSizeValue;
213
+ var _c = this.$props,
214
+ skip = _c.skip,
215
+ take = _c.take,
216
+ total = _c.total,
217
+ pageSizes = _c.pageSizes,
218
+ buttonCount = _c.buttonCount,
219
+ messagesMap = _c.messagesMap,
220
+ info = _c.info,
221
+ type = _c.type,
222
+ previousNext = _c.previousNext,
223
+ pageSizeValue = _c.pageSizeValue;
202
224
  var settings = __assign({
203
225
  pageSizes: pageSizes,
204
226
  buttonCount: buttonCount,
@@ -233,9 +255,9 @@ var PagerVue2 = {
233
255
  var changer = settings.type === 'numeric' ?
234
256
  // @ts-ignore
235
257
  h(PagerNumericButtons, {
236
- responsiveSize: this.currentSize,
258
+ responsiveSize: this.responsive && this.itemsToFit && this.itemsToFit.length < 2 ? 'small' : 'large',
237
259
  attrs: this.v3 ? undefined : {
238
- responsiveSize: this.currentSize,
260
+ responsiveSize: this.responsive && this.itemsToFit && this.itemsToFit.length < 2 ? 'small' : 'large',
239
261
  size: this.size,
240
262
  buttonCount: settings.buttonCount || 0,
241
263
  totalPages: this.totalPages,
@@ -435,7 +457,7 @@ var PagerVue2 = {
435
457
  "aria-controls": this.$props.ariaControls
436
458
  }, [h("div", {
437
459
  "class": 'k-pager-numbers-wrap'
438
- }, [first, prev, changer, next, last]), renderPageSizes, infoElement]);
460
+ }, [first, prev, changer, next, last]), !(this.responsive && this.itemsToFit && !((_a = this.itemsToFit) === null || _a === void 0 ? void 0 : _a.includes(this.pagerSizesIndex))) && renderPageSizes, !(this.responsive && this.itemsToFit && !((_b = this.itemsToFit) === null || _b === void 0 ? void 0 : _b.includes(this.pagerInfoIndex))) && infoElement]);
439
461
  }
440
462
  };
441
463
  /**
@@ -45,8 +45,8 @@ var PagerInfoVue2 = {
45
45
  messageKey: pagerInfo,
46
46
  defaultMessage: messages[pagerInfo]
47
47
  };
48
- return h("div", {
49
- "class": "k-pager-info k-label"
48
+ return h("span", {
49
+ "class": "k-pager-info"
50
50
  }, [intlService.format(localizationService.toLanguageString(infoMessage.messageKey, infoMessage.defaultMessage), [Math.min(this.$props.skip + 1, this.$props.totalPages), Math.min(this.$props.skip + this.$props.currentPage, this.$props.totalPages), this.$props.totalPages])]);
51
51
  }
52
52
  };
@@ -6,7 +6,7 @@ var isV3 = allVue.version && allVue.version[0] === '3';
6
6
  var inject = allVue.inject;
7
7
  import { messages, pagerOf, pagerPage, pagerTotalPages, pagerPageInputAriaLabel } from '../messages/main';
8
8
  import { provideIntlService, provideLocalizationService } from '@progress/kendo-vue-intl';
9
- import { kendoThemeMaps } from '@progress/kendo-vue-common';
9
+ import { NumericTextBox } from '@progress/kendo-vue-inputs';
10
10
  /**
11
11
  * @hidden
12
12
  */
@@ -26,36 +26,22 @@ var PagerInputVue2 = {
26
26
  default: null
27
27
  }
28
28
  },
29
- created: function created() {
30
- this._text = undefined;
29
+ data: function data() {
30
+ return {
31
+ currentText: undefined
32
+ };
31
33
  },
32
34
  computed: {
33
- inputClass: function inputClass() {
34
- var _a;
35
- var size = this.$props.size;
36
- return _a = {
37
- 'k-textbox': true,
38
- 'k-input': true,
39
- 'k-rounded-md': true,
40
- 'k-input-solid': true
41
- }, _a["k-input-".concat(kendoThemeMaps.sizeMap[size] || size)] = size, _a;
35
+ computedValue: function computedValue() {
36
+ return this.$props.currentPage !== undefined ? this.$props.currentPage : this.currentText;
42
37
  }
43
38
  },
44
39
  methods: {
45
40
  changeHangler: function changeHangler(e) {
46
- var text = this._text = e.target.value.replace(/\D/g, '');
47
- this.$forceUpdate();
48
- if (text) {
49
- this.$emit('pagechange', parseInt(text, 10), e);
41
+ this.currentText = e.target.value;
42
+ if (this.currentText) {
43
+ this.$emit('pagechange', this.currentText, e);
50
44
  }
51
- },
52
- blurHandler: function blurHandler() {
53
- this.$forceUpdate();
54
- },
55
- value: function value() {
56
- var value = this._text === undefined ? this.$props.currentPage.toString() : this._text;
57
- this._text = undefined;
58
- return value;
59
45
  }
60
46
  },
61
47
  // @ts-ignore
@@ -91,26 +77,25 @@ var PagerInputVue2 = {
91
77
  defaultMessage: messages[pagerPageInputAriaLabel]
92
78
  };
93
79
  return h("span", {
94
- "class": "k-pager-input k-label"
95
- }, [localizationService.toLanguageString(pageMessage.messageKey, pageMessage.defaultMessage), h("span", {
96
- "class": this.inputClass
97
- }, [h("input", {
98
- "class": "k-input-inner",
99
- value: this.v3 ? this.value() : null,
100
- domProps: this.v3 ? undefined : {
101
- "value": this.value()
102
- },
103
- ariaLabel: localizationService.toLanguageString(pageInputAriaLabel.messageKey, pageInputAriaLabel.defaultMessage),
80
+ "class": "k-pager-input"
81
+ }, [h("span", [localizationService.toLanguageString(pageMessage.messageKey, pageMessage.defaultMessage)]), h(NumericTextBox, {
82
+ min: 1,
104
83
  attrs: this.v3 ? undefined : {
84
+ min: 1,
85
+ value: this.computedValue,
86
+ spinners: false,
87
+ size: this.$props.size,
105
88
  ariaLabel: localizationService.toLanguageString(pageInputAriaLabel.messageKey, pageInputAriaLabel.defaultMessage)
106
89
  },
107
- onBlur: this.blurHandler,
90
+ value: this.computedValue,
91
+ onChange: this.changeHangler,
108
92
  on: this.v3 ? undefined : {
109
- "blur": this.blurHandler,
110
93
  "change": this.changeHangler
111
94
  },
112
- onChange: this.changeHangler
113
- })]), " ", "".concat(localizationService.toLanguageString(ofMessage.messageKey, ofMessage.defaultMessage), " ").concat(intlService.format(localizationService.toLanguageString(totalPagesMessage.messageKey, totalPagesMessage.defaultMessage), [this.$props.totalPages]))]);
95
+ spinners: false,
96
+ size: this.$props.size,
97
+ ariaLabel: localizationService.toLanguageString(pageInputAriaLabel.messageKey, pageInputAriaLabel.defaultMessage)
98
+ }), h("span", ["".concat(localizationService.toLanguageString(ofMessage.messageKey, ofMessage.defaultMessage), " ").concat(intlService.format(localizationService.toLanguageString(totalPagesMessage.messageKey, totalPagesMessage.defaultMessage), [this.$props.totalPages]))])]);
114
99
  }
115
100
  };
116
101
  /**
@@ -170,6 +170,11 @@ var PagerNumericButtonsVue2 = {
170
170
  }, this);
171
171
  var dropdown = function dropdown(currentButtons) {
172
172
  return h("select", {
173
+ style: {
174
+ width: '5em',
175
+ margin: '0px 1em',
176
+ display: this.$props.responsiveSize === 'small' ? 'inline-flex' : 'none'
177
+ },
173
178
  "class": this.dropdownClass,
174
179
  ariaLabel: localizationService.toLanguageString(pagerSmallPageSelectoLabel.messageKey, pagerSmallPageSelectoLabel.defaultMessage),
175
180
  attrs: this.v3 ? undefined : {
@@ -193,7 +198,10 @@ var PagerNumericButtonsVue2 = {
193
198
  return h("div", {
194
199
  "class": "k-pager-numbers-wrap"
195
200
  }, [h("div", {
196
- "class": "k-pager-numbers"
201
+ "class": "k-pager-numbers",
202
+ style: {
203
+ display: this.$props.responsiveSize !== 'small' ? '' : 'none'
204
+ }
197
205
  }, [prevDots, numerics, postDots]), dropdown.call(this, buttons)]);
198
206
  }
199
207
  };
@@ -268,46 +268,26 @@ var ExpressionVue2 = {
268
268
  }, _this.v3 ? function () {
269
269
  return [field && filterEditors.call(_this, field.filter, field.filterRender)];
270
270
  } : [field && filterEditors.call(_this, field.filter, field.filterRender)]),
271
- // @ts-ignore function children
272
- h(ToolbarItem, _this.v3 ? function () {
273
- return [
274
- // @ts-ignore
275
- h(Button, {
276
- title: locService.toLanguageString(filterClose, messages[filterClose]),
277
- attrs: _this.v3 ? undefined : {
278
- title: locService.toLanguageString(filterClose, messages[filterClose]),
279
- icon: "x",
280
- svgIcon: xIcon,
281
- look: "flat",
282
- type: "button"
283
- },
284
- icon: "x",
285
- svgIcon: xIcon,
286
- look: "flat",
287
- type: "button",
288
- onClick: _this.onFilterRemove,
289
- on: _this.v3 ? undefined : {
290
- "click": _this.onFilterRemove
291
- }
292
- })];
293
- } : [h(Button, {
271
+ // @ts-ignore
272
+ h(Button, {
294
273
  title: locService.toLanguageString(filterClose, messages[filterClose]),
295
274
  attrs: _this.v3 ? undefined : {
296
275
  title: locService.toLanguageString(filterClose, messages[filterClose]),
297
276
  icon: "x",
298
277
  svgIcon: xIcon,
299
- look: "flat",
278
+ fillMode: "flat",
300
279
  type: "button"
301
280
  },
302
281
  icon: "x",
303
282
  svgIcon: xIcon,
304
- look: "flat",
283
+ fillMode: "flat",
305
284
  type: "button",
285
+ "class": "k-toolbar-button",
306
286
  onClick: _this.onFilterRemove,
307
287
  on: _this.v3 ? undefined : {
308
288
  "click": _this.onFilterRemove
309
289
  }
310
- })])];
290
+ })];
311
291
  } : [h(ToolbarItem, {
312
292
  "class": "k-filter-field"
313
293
  }, _this.v3 ? function () {
@@ -398,43 +378,25 @@ var ExpressionVue2 = {
398
378
  "class": "k-filter-value"
399
379
  }, _this.v3 ? function () {
400
380
  return [field && filterEditors.call(_this, field.filter, field.filterRender)];
401
- } : [field && filterEditors.call(_this, field.filter, field.filterRender)]), h(ToolbarItem, _this.v3 ? function () {
402
- return [h(Button, {
403
- title: locService.toLanguageString(filterClose, messages[filterClose]),
404
- attrs: _this.v3 ? undefined : {
405
- title: locService.toLanguageString(filterClose, messages[filterClose]),
406
- icon: "x",
407
- svgIcon: xIcon,
408
- look: "flat",
409
- type: "button"
410
- },
411
- icon: "x",
412
- svgIcon: xIcon,
413
- look: "flat",
414
- type: "button",
415
- onClick: _this.onFilterRemove,
416
- on: _this.v3 ? undefined : {
417
- "click": _this.onFilterRemove
418
- }
419
- })];
420
- } : [h(Button, {
381
+ } : [field && filterEditors.call(_this, field.filter, field.filterRender)]), h(Button, {
421
382
  title: locService.toLanguageString(filterClose, messages[filterClose]),
422
383
  attrs: _this.v3 ? undefined : {
423
384
  title: locService.toLanguageString(filterClose, messages[filterClose]),
424
385
  icon: "x",
425
386
  svgIcon: xIcon,
426
- look: "flat",
387
+ fillMode: "flat",
427
388
  type: "button"
428
389
  },
429
390
  icon: "x",
430
391
  svgIcon: xIcon,
431
- look: "flat",
392
+ fillMode: "flat",
432
393
  type: "button",
394
+ "class": "k-toolbar-button",
433
395
  onClick: _this.onFilterRemove,
434
396
  on: _this.v3 ? undefined : {
435
397
  "click": _this.onFilterRemove
436
398
  }
437
- })])])]);
399
+ })])]);
438
400
  },
439
401
  methods: {
440
402
  onFieldChange: function onFieldChange(event) {
@@ -86,7 +86,7 @@ var FilterVue2 = {
86
86
  });
87
87
  }, this);
88
88
  return h("div", {
89
- "class": 'k-widget k-filter'
89
+ "class": 'k-filter'
90
90
  }, [h("ul", {
91
91
  "class": "k-filter-container",
92
92
  role: "tree",