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