@progress/kendo-vue-layout 3.7.4-dev.202211041243 → 3.7.4-dev.202211280833
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/dist/cdn/js/kendo-vue-layout.js +1 -1
- package/dist/es/menu/components/Menu.js +3 -3
- package/dist/es/package-metadata.js +1 -1
- package/dist/es/panelbar/PanelBar.js +0 -9
- package/dist/es/tilelayout/ResizeHandlers.d.ts +1 -1
- package/dist/es/tilelayout/ResizeHandlers.js +98 -42
- package/dist/es/tilelayout/Tile.js +192 -151
- package/dist/es/tilelayout/TileLayout.js +125 -99
- package/dist/es/tilelayout/interfaces/main.d.ts +18 -4
- package/dist/esm/menu/components/Menu.js +3 -3
- package/dist/esm/package-metadata.js +1 -1
- package/dist/esm/panelbar/PanelBar.js +0 -9
- package/dist/esm/tilelayout/ResizeHandlers.d.ts +1 -1
- package/dist/esm/tilelayout/ResizeHandlers.js +98 -42
- package/dist/esm/tilelayout/Tile.js +192 -151
- package/dist/esm/tilelayout/TileLayout.js +125 -99
- package/dist/esm/tilelayout/interfaces/main.d.ts +18 -4
- package/dist/npm/menu/components/Menu.js +2 -2
- package/dist/npm/package-metadata.js +1 -1
- package/dist/npm/panelbar/PanelBar.js +0 -9
- package/dist/npm/tilelayout/ResizeHandlers.d.ts +1 -1
- package/dist/npm/tilelayout/ResizeHandlers.js +98 -42
- package/dist/npm/tilelayout/Tile.js +191 -151
- package/dist/npm/tilelayout/TileLayout.js +124 -98
- package/dist/npm/tilelayout/interfaces/main.d.ts +18 -4
- package/package.json +13 -11
|
@@ -15,7 +15,7 @@ import * as Vue from 'vue';
|
|
|
15
15
|
var allVue = Vue;
|
|
16
16
|
var gh = allVue.h;
|
|
17
17
|
var isV3 = allVue.version && allVue.version[0] === '3';
|
|
18
|
-
import {
|
|
18
|
+
import { canUseDOM, Draggable, getDefaultSlots } from '@progress/kendo-vue-common';
|
|
19
19
|
import { ResizeHandlers } from './ResizeHandlers.js';
|
|
20
20
|
/**
|
|
21
21
|
* @hidden
|
|
@@ -28,12 +28,11 @@ var TileVue2 = {
|
|
|
28
28
|
name: 'KendoTile',
|
|
29
29
|
props: {
|
|
30
30
|
defaultPosition: {
|
|
31
|
-
type: Object,
|
|
32
31
|
required: true
|
|
33
32
|
},
|
|
34
33
|
index: Number,
|
|
35
34
|
hintStyle: Object,
|
|
36
|
-
|
|
35
|
+
hintClass: String,
|
|
37
36
|
header: [String, Function, Object],
|
|
38
37
|
body: [String, Function, Object],
|
|
39
38
|
item: [String, Function, Object],
|
|
@@ -50,85 +49,115 @@ var TileVue2 = {
|
|
|
50
49
|
}
|
|
51
50
|
},
|
|
52
51
|
created: function created() {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
52
|
+
this.oldSize = {};
|
|
53
|
+
this.dragging = false;
|
|
54
|
+
this.resizing = false;
|
|
55
|
+
this.ignoreDrag = false;
|
|
56
|
+
this.pressOffset = {
|
|
57
|
+
x: 0,
|
|
58
|
+
y: 0
|
|
59
|
+
};
|
|
60
|
+
this.pressXY = {
|
|
61
|
+
x: 0,
|
|
62
|
+
y: 0
|
|
63
|
+
};
|
|
64
|
+
this.currentTranslate = {
|
|
65
|
+
x: 0,
|
|
66
|
+
y: 0
|
|
67
|
+
};
|
|
68
|
+
this.prevDefaultPosition = this.$props.defaultPosition;
|
|
69
|
+
this.preventDataOps = undefined;
|
|
70
|
+
},
|
|
71
|
+
computed: {
|
|
72
|
+
wrapperClass: function wrapperClass() {
|
|
73
|
+
return {
|
|
74
|
+
'k-tilelayout-item': true,
|
|
75
|
+
'k-card': true,
|
|
76
|
+
'k-cursor-grab': this.reorderable
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
data: function data() {
|
|
81
|
+
return {
|
|
82
|
+
rtl: false
|
|
83
|
+
};
|
|
69
84
|
},
|
|
70
85
|
mounted: function mounted() {
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
86
|
+
if (!this.$el) {
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
if (this.$el) {
|
|
90
|
+
this.draggable = this.$refs.draggable;
|
|
91
|
+
}
|
|
92
|
+
if (getComputedStyle(this.$el).direction === 'rtl') {
|
|
93
|
+
this.rtl = true;
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
watch: {
|
|
97
|
+
defaultPosition: function defaultPosition(_, oldValue) {
|
|
98
|
+
this.prevDefaultPosition = oldValue;
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
beforeUpdate: function beforeUpdate() {
|
|
102
|
+
this.oldSize = {};
|
|
103
|
+
var dragElement = this.dragElement();
|
|
104
|
+
if (dragElement) {
|
|
105
|
+
this.oldSize = dragElement.getBoundingClientRect();
|
|
106
|
+
}
|
|
107
|
+
return null;
|
|
79
108
|
},
|
|
80
109
|
updated: function updated() {
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
110
|
+
var dragElement = this.dragElement();
|
|
111
|
+
if (!dragElement) {
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
var newBox = dragElement.getBoundingClientRect();
|
|
115
|
+
var oldBox = this.oldSize;
|
|
116
|
+
var that = this;
|
|
117
|
+
if (this.resizing) {
|
|
118
|
+
var diffCol = newBox.width - oldBox.width;
|
|
119
|
+
if (this.rtl) {
|
|
120
|
+
var currentM = parseFloat(dragElement.style.marginLeft || '0');
|
|
121
|
+
dragElement.style.marginLeft = currentM - diffCol + 'px';
|
|
122
|
+
} else {
|
|
123
|
+
var currentM = parseFloat(dragElement.style.marginRight || '0');
|
|
124
|
+
dragElement.style.marginRight = currentM + diffCol + 'px';
|
|
125
|
+
}
|
|
126
|
+
this.pressXY.x += this.rtl ? -diffCol : diffCol;
|
|
127
|
+
var diffRow = newBox.height - oldBox.height;
|
|
128
|
+
var currentBot = parseFloat(dragElement.style.height.substring(12));
|
|
129
|
+
dragElement.style.height = "calc(100% + ".concat(currentBot + diffRow, "px)");
|
|
130
|
+
this.pressXY.y += diffRow;
|
|
131
|
+
}
|
|
132
|
+
var deltaX = oldBox.left - newBox.left;
|
|
133
|
+
var deltaY = oldBox.top - newBox.top;
|
|
134
|
+
if (deltaX === 0 && deltaY === 0) {
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
if (this.dragging) {
|
|
138
|
+
if (this.prevDefaultPosition.order !== this.$props.defaultPosition.order || this.prevDefaultPosition.col !== this.$props.defaultPosition.col) {
|
|
139
|
+
this.currentTranslate.x = 0;
|
|
140
|
+
this.currentTranslate.y = 0;
|
|
141
|
+
dragElement.style.transform = '';
|
|
142
|
+
}
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
145
|
+
if (Math.abs(deltaY) < 15 && Math.abs(deltaX) < 15) {
|
|
146
|
+
// improves performance and removes random flickering
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
149
|
+
requestAnimationFrame(function () {
|
|
150
|
+
var domNode = that.$el;
|
|
151
|
+
if (!domNode) {
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
domNode.style.transform = "translate(".concat(deltaX, "px, ").concat(deltaY, "px)");
|
|
155
|
+
domNode.style.transition = 'transform 0s';
|
|
156
|
+
requestAnimationFrame(function () {
|
|
157
|
+
domNode.style.transform = '';
|
|
158
|
+
domNode.style.transition = "transform ".concat(ANIMATION_DURATION, "ms cubic-bezier(0.2, 0, 0, 1) 0s");
|
|
159
|
+
});
|
|
160
|
+
});
|
|
132
161
|
},
|
|
133
162
|
// @ts-ignore
|
|
134
163
|
setup: !isV3 ? undefined : function () {
|
|
@@ -143,9 +172,11 @@ var TileVue2 = {
|
|
|
143
172
|
var defaultSlots = getDefaultSlots(this);
|
|
144
173
|
if (clearTimeout && typeof clearTimeout === 'function') {
|
|
145
174
|
clearTimeout(this.preventDataOps);
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
175
|
+
if (canUseDOM) {
|
|
176
|
+
this.preventDataOps = window.setTimeout(function () {
|
|
177
|
+
_this.preventDataOps = undefined;
|
|
178
|
+
}, 200);
|
|
179
|
+
}
|
|
149
180
|
}
|
|
150
181
|
var position = this.$props.defaultPosition;
|
|
151
182
|
var resizable = this.$props.resizable;
|
|
@@ -158,83 +189,102 @@ var TileVue2 = {
|
|
|
158
189
|
order: position.order
|
|
159
190
|
}, this.$props.hintStyle);
|
|
160
191
|
var card = h("div", {
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
element: e
|
|
164
|
-
} : null;
|
|
165
|
-
},
|
|
166
|
-
"class": classNames('k-tilelayout-item k-card', {
|
|
167
|
-
'k-cursor-grab': this.reorderable
|
|
168
|
-
}, this.$props.className),
|
|
169
|
-
style: __assign({
|
|
192
|
+
"class": this.wrapperClass,
|
|
193
|
+
style: {
|
|
170
194
|
height: '100%'
|
|
171
|
-
}
|
|
172
|
-
}, [defaultSlots,
|
|
173
|
-
|
|
174
|
-
|
|
195
|
+
}
|
|
196
|
+
}, [defaultSlots, resizable !== 'vertical' && h(ResizeHandlers, {
|
|
197
|
+
onPress: this.handlePress,
|
|
198
|
+
on: this.v3 ? undefined : {
|
|
199
|
+
"press": this.handlePress,
|
|
200
|
+
"resize": this.handleResize
|
|
201
|
+
},
|
|
202
|
+
onResize: this.handleResize,
|
|
203
|
+
direction: "ew",
|
|
204
|
+
attrs: this.v3 ? undefined : {
|
|
205
|
+
direction: "ew",
|
|
206
|
+
rtl: this.rtl
|
|
207
|
+
},
|
|
208
|
+
rtl: this.rtl
|
|
209
|
+
}), resizable !== 'horizontal' && h(ResizeHandlers, {
|
|
175
210
|
onPress: this.handlePress,
|
|
176
211
|
on: this.v3 ? undefined : {
|
|
177
212
|
"press": this.handlePress,
|
|
178
213
|
"resize": this.handleResize
|
|
179
214
|
},
|
|
180
215
|
onResize: this.handleResize,
|
|
181
|
-
|
|
216
|
+
direction: "ns",
|
|
182
217
|
attrs: this.v3 ? undefined : {
|
|
183
|
-
|
|
184
|
-
rtl: this.
|
|
218
|
+
direction: "ns",
|
|
219
|
+
rtl: this.rtl
|
|
185
220
|
},
|
|
186
|
-
rtl: this.
|
|
221
|
+
rtl: this.rtl
|
|
222
|
+
}), resizable === true && h(ResizeHandlers, {
|
|
223
|
+
onPress: this.handlePress,
|
|
224
|
+
on: this.v3 ? undefined : {
|
|
225
|
+
"press": this.handlePress,
|
|
226
|
+
"resize": this.handleResize
|
|
227
|
+
},
|
|
228
|
+
onResize: this.handleResize,
|
|
229
|
+
direction: this.rtl ? 'nesw' : 'nwse',
|
|
230
|
+
attrs: this.v3 ? undefined : {
|
|
231
|
+
direction: this.rtl ? 'nesw' : 'nwse',
|
|
232
|
+
rtl: this.rtl
|
|
233
|
+
},
|
|
234
|
+
rtl: this.rtl
|
|
187
235
|
})]);
|
|
188
236
|
return h("div", {
|
|
189
237
|
style: itemStyles,
|
|
190
|
-
"class": this.$props.
|
|
238
|
+
"class": this.$props.hintClass
|
|
191
239
|
}, [
|
|
192
240
|
// @ts-ignore function children
|
|
193
241
|
h(Draggable, {
|
|
194
|
-
ref:
|
|
195
|
-
|
|
196
|
-
},
|
|
197
|
-
onDrag: this.$props.reorderable ? this.handleDrag : undefined,
|
|
242
|
+
ref: 'draggable',
|
|
243
|
+
onDrag: this.handleDrag,
|
|
198
244
|
on: this.v3 ? undefined : {
|
|
199
|
-
"drag": this
|
|
200
|
-
"release": this
|
|
201
|
-
"press": this
|
|
245
|
+
"drag": this.handleDrag,
|
|
246
|
+
"release": this.handleRelease,
|
|
247
|
+
"press": this.handlePress
|
|
202
248
|
},
|
|
203
|
-
onRelease: this
|
|
204
|
-
onPress: this
|
|
249
|
+
onRelease: this.handleRelease,
|
|
250
|
+
onPress: this.handlePress
|
|
205
251
|
}, this.v3 ? function () {
|
|
206
252
|
return [card];
|
|
207
253
|
} : [card])]);
|
|
208
254
|
},
|
|
209
255
|
methods: {
|
|
256
|
+
dragElement: function dragElement() {
|
|
257
|
+
return this.draggable && this.draggable.element;
|
|
258
|
+
},
|
|
210
259
|
handleResize: function handleResize(e, q) {
|
|
260
|
+
var dragElement = this.dragElement();
|
|
211
261
|
if (q.end) {
|
|
212
262
|
this.handleRelease();
|
|
213
263
|
return;
|
|
214
264
|
}
|
|
215
|
-
if (!this.
|
|
265
|
+
if (!this.reorderable || !this.$el) {
|
|
216
266
|
return;
|
|
217
267
|
}
|
|
218
268
|
var x = e.clientX;
|
|
219
269
|
var y = e.clientY;
|
|
220
270
|
this.resizing = true;
|
|
221
|
-
var dX = (q.direction !== 'ns' ? x - this.pressXY.x : 0) * (this.
|
|
271
|
+
var dX = (q.direction !== 'ns' ? x - this.pressXY.x : 0) * (this.rtl ? -1 : 1);
|
|
222
272
|
var dY = q.direction !== 'ew' ? y - this.pressXY.y : 0;
|
|
223
|
-
if (
|
|
224
|
-
if (this.
|
|
225
|
-
|
|
273
|
+
if (dragElement) {
|
|
274
|
+
if (this.rtl) {
|
|
275
|
+
dragElement.style.marginLeft = -dX + 'px';
|
|
226
276
|
} else {
|
|
227
|
-
|
|
277
|
+
dragElement.style.marginRight = -dX + 'px';
|
|
228
278
|
}
|
|
229
|
-
|
|
279
|
+
dragElement.style.height = "calc(100% + ".concat(dY, "px)");
|
|
230
280
|
}
|
|
231
|
-
this.
|
|
281
|
+
this.$el.classList.add('k-layout-item-hint', 'k-layout-item-hint-resize');
|
|
232
282
|
if (this.preventDataOps) {
|
|
233
283
|
return;
|
|
234
284
|
}
|
|
235
285
|
var col = 0;
|
|
236
286
|
var row = 0;
|
|
237
|
-
var wrapBox = this.
|
|
287
|
+
var wrapBox = this.$el.getBoundingClientRect();
|
|
238
288
|
if (dX > wrapBox.width / this.$props.defaultPosition.colSpan / 3) {
|
|
239
289
|
col = 1;
|
|
240
290
|
}
|
|
@@ -249,48 +299,49 @@ var TileVue2 = {
|
|
|
249
299
|
row = -1;
|
|
250
300
|
}
|
|
251
301
|
if (col !== 0 || row !== 0) {
|
|
252
|
-
this.$
|
|
302
|
+
this.$emit('update', this.$props.index, 0, 0, row, col);
|
|
253
303
|
}
|
|
254
304
|
},
|
|
255
305
|
handlePress: function handlePress(e) {
|
|
256
|
-
|
|
306
|
+
var dragElement = this.dragElement();
|
|
307
|
+
if (!this.reorderable || !dragElement) {
|
|
257
308
|
return;
|
|
258
309
|
}
|
|
259
310
|
this.ignoreDrag = false;
|
|
260
|
-
if (this.$props.ignoreDrag && this.$props.ignoreDrag(e.
|
|
311
|
+
if (this.$props.ignoreDrag && this.$props.ignoreDrag(e.originalEvent)) {
|
|
261
312
|
this.ignoreDrag = true;
|
|
262
313
|
return;
|
|
263
314
|
}
|
|
264
|
-
if (this
|
|
265
|
-
this.
|
|
266
|
-
this.
|
|
315
|
+
if (this.$el) {
|
|
316
|
+
this.$el.style.zIndex = '10';
|
|
317
|
+
this.$el.classList.add('k-layout-item-hint');
|
|
267
318
|
}
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
var rec =
|
|
319
|
+
dragElement.classList.remove('k-cursor-grab');
|
|
320
|
+
dragElement.classList.add('k-cursor-grabbing');
|
|
321
|
+
var rec = dragElement.getBoundingClientRect();
|
|
271
322
|
this.pressXY = {
|
|
272
|
-
x: e.
|
|
273
|
-
y: e.
|
|
323
|
+
x: e.clientX,
|
|
324
|
+
y: e.clientY
|
|
274
325
|
};
|
|
275
326
|
this.pressOffset = {
|
|
276
|
-
x: e.
|
|
277
|
-
y: e.
|
|
327
|
+
x: e.clientX - rec.x,
|
|
328
|
+
y: e.clientY - rec.y
|
|
278
329
|
};
|
|
279
330
|
},
|
|
280
331
|
handleDrag: function handleDrag(e) {
|
|
281
|
-
if (this.ignoreDrag) {
|
|
332
|
+
if (!this.reorderable || this.ignoreDrag) {
|
|
282
333
|
return;
|
|
283
334
|
}
|
|
284
|
-
var dragElement = this.dragElement;
|
|
285
|
-
if (e.
|
|
335
|
+
var dragElement = this.dragElement();
|
|
336
|
+
if (e.originalEvent.defaultPrevented || !dragElement) {
|
|
286
337
|
return;
|
|
287
338
|
}
|
|
288
339
|
this.dragging = true;
|
|
289
|
-
e.
|
|
340
|
+
e.originalEvent.preventDefault();
|
|
290
341
|
var rec = dragElement.getBoundingClientRect();
|
|
291
342
|
this.currentTranslate = {
|
|
292
|
-
x: e.
|
|
293
|
-
y: e.
|
|
343
|
+
x: e.clientX - rec.x - this.pressOffset.x + this.currentTranslate.x,
|
|
344
|
+
y: e.clientY - rec.y - this.pressOffset.y + this.currentTranslate.y
|
|
294
345
|
};
|
|
295
346
|
dragElement.style.transform = "translate(".concat(this.currentTranslate.x, "px, ").concat(this.currentTranslate.y, "px)");
|
|
296
347
|
dragElement.style.transition = 'transform 0s';
|
|
@@ -311,7 +362,7 @@ var TileVue2 = {
|
|
|
311
362
|
if (this.currentTranslate.x < 0.7 * -rec.width / this.$props.defaultPosition.colSpan) {
|
|
312
363
|
col = -1;
|
|
313
364
|
}
|
|
314
|
-
this.$
|
|
365
|
+
this.$emit('update', this.$props.index, row, this.rtl ? -col : col, 0, 0);
|
|
315
366
|
},
|
|
316
367
|
handleRelease: function handleRelease() {
|
|
317
368
|
this.dragging = this.resizing = false;
|
|
@@ -319,11 +370,11 @@ var TileVue2 = {
|
|
|
319
370
|
x: 0,
|
|
320
371
|
y: 0
|
|
321
372
|
};
|
|
322
|
-
if (this
|
|
323
|
-
this.
|
|
324
|
-
this.
|
|
373
|
+
if (this.$el) {
|
|
374
|
+
this.$el.style.zIndex = '1';
|
|
375
|
+
this.$el.classList.remove('k-layout-item-hint', 'k-layout-item-hint-resize');
|
|
325
376
|
}
|
|
326
|
-
var dragElement = this.dragElement;
|
|
377
|
+
var dragElement = this.dragElement();
|
|
327
378
|
if (dragElement) {
|
|
328
379
|
dragElement.style.transform = 'translate(0px, 0px)';
|
|
329
380
|
dragElement.style.transition = "transform ".concat(ANIMATION_DURATION, "ms cubic-bezier(0.2, 0, 0, 1) 0s");
|
|
@@ -335,16 +386,6 @@ var TileVue2 = {
|
|
|
335
386
|
}
|
|
336
387
|
}
|
|
337
388
|
}
|
|
338
|
-
// /**
|
|
339
|
-
// * @hidden
|
|
340
|
-
// */
|
|
341
|
-
// getSnapshotBeforeUpdate(_: any) {
|
|
342
|
-
// this.oldSize = {};
|
|
343
|
-
// if (this.dragElement) {
|
|
344
|
-
// this.oldSize = this.dragElement.getBoundingClientRect();
|
|
345
|
-
// }
|
|
346
|
-
// return null;
|
|
347
|
-
// }
|
|
348
389
|
};
|
|
349
390
|
/**
|
|
350
391
|
* @hidden
|