@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
|
@@ -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 () {
|
|
@@ -149,9 +178,11 @@ var TileVue2 = {
|
|
|
149
178
|
var defaultSlots = (0, kendo_vue_common_1.getDefaultSlots)(this);
|
|
150
179
|
if (clearTimeout && typeof clearTimeout === 'function') {
|
|
151
180
|
clearTimeout(this.preventDataOps);
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
181
|
+
if (kendo_vue_common_1.canUseDOM) {
|
|
182
|
+
this.preventDataOps = window.setTimeout(function () {
|
|
183
|
+
_this.preventDataOps = undefined;
|
|
184
|
+
}, 200);
|
|
185
|
+
}
|
|
155
186
|
}
|
|
156
187
|
var position = this.$props.defaultPosition;
|
|
157
188
|
var resizable = this.$props.resizable;
|
|
@@ -164,83 +195,102 @@ var TileVue2 = {
|
|
|
164
195
|
order: position.order
|
|
165
196
|
}, this.$props.hintStyle);
|
|
166
197
|
var card = h("div", {
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
element: e
|
|
170
|
-
} : null;
|
|
171
|
-
},
|
|
172
|
-
"class": (0, kendo_vue_common_1.classNames)('k-tilelayout-item k-card', {
|
|
173
|
-
'k-cursor-grab': this.reorderable
|
|
174
|
-
}, this.$props.className),
|
|
175
|
-
style: __assign({
|
|
198
|
+
"class": this.wrapperClass,
|
|
199
|
+
style: {
|
|
176
200
|
height: '100%'
|
|
177
|
-
}
|
|
178
|
-
}, [defaultSlots,
|
|
179
|
-
// @ts-ignore
|
|
180
|
-
h(ResizeHandlers_1.ResizeHandlers, {
|
|
201
|
+
}
|
|
202
|
+
}, [defaultSlots, resizable !== 'vertical' && h(ResizeHandlers_1.ResizeHandlers, {
|
|
181
203
|
onPress: this.handlePress,
|
|
182
204
|
on: this.v3 ? undefined : {
|
|
183
205
|
"press": this.handlePress,
|
|
184
206
|
"resize": this.handleResize
|
|
185
207
|
},
|
|
186
208
|
onResize: this.handleResize,
|
|
187
|
-
|
|
209
|
+
direction: "ew",
|
|
188
210
|
attrs: this.v3 ? undefined : {
|
|
189
|
-
|
|
190
|
-
rtl: this.
|
|
211
|
+
direction: "ew",
|
|
212
|
+
rtl: this.rtl
|
|
191
213
|
},
|
|
192
|
-
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
|
|
193
241
|
})]);
|
|
194
242
|
return h("div", {
|
|
195
243
|
style: itemStyles,
|
|
196
|
-
"class": this.$props.
|
|
244
|
+
"class": this.$props.hintClass
|
|
197
245
|
}, [
|
|
198
246
|
// @ts-ignore function children
|
|
199
247
|
h(kendo_vue_common_1.Draggable, {
|
|
200
|
-
ref:
|
|
201
|
-
|
|
202
|
-
},
|
|
203
|
-
onDrag: this.$props.reorderable ? this.handleDrag : undefined,
|
|
248
|
+
ref: 'draggable',
|
|
249
|
+
onDrag: this.handleDrag,
|
|
204
250
|
on: this.v3 ? undefined : {
|
|
205
|
-
"drag": this
|
|
206
|
-
"release": this
|
|
207
|
-
"press": this
|
|
251
|
+
"drag": this.handleDrag,
|
|
252
|
+
"release": this.handleRelease,
|
|
253
|
+
"press": this.handlePress
|
|
208
254
|
},
|
|
209
|
-
onRelease: this
|
|
210
|
-
onPress: this
|
|
255
|
+
onRelease: this.handleRelease,
|
|
256
|
+
onPress: this.handlePress
|
|
211
257
|
}, this.v3 ? function () {
|
|
212
258
|
return [card];
|
|
213
259
|
} : [card])]);
|
|
214
260
|
},
|
|
215
261
|
methods: {
|
|
262
|
+
dragElement: function dragElement() {
|
|
263
|
+
return this.draggable && this.draggable.element;
|
|
264
|
+
},
|
|
216
265
|
handleResize: function handleResize(e, q) {
|
|
266
|
+
var dragElement = this.dragElement();
|
|
217
267
|
if (q.end) {
|
|
218
268
|
this.handleRelease();
|
|
219
269
|
return;
|
|
220
270
|
}
|
|
221
|
-
if (!this.
|
|
271
|
+
if (!this.reorderable || !this.$el) {
|
|
222
272
|
return;
|
|
223
273
|
}
|
|
224
274
|
var x = e.clientX;
|
|
225
275
|
var y = e.clientY;
|
|
226
276
|
this.resizing = true;
|
|
227
|
-
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);
|
|
228
278
|
var dY = q.direction !== 'ew' ? y - this.pressXY.y : 0;
|
|
229
|
-
if (
|
|
230
|
-
if (this.
|
|
231
|
-
|
|
279
|
+
if (dragElement) {
|
|
280
|
+
if (this.rtl) {
|
|
281
|
+
dragElement.style.marginLeft = -dX + 'px';
|
|
232
282
|
} else {
|
|
233
|
-
|
|
283
|
+
dragElement.style.marginRight = -dX + 'px';
|
|
234
284
|
}
|
|
235
|
-
|
|
285
|
+
dragElement.style.height = "calc(100% + ".concat(dY, "px)");
|
|
236
286
|
}
|
|
237
|
-
this.
|
|
287
|
+
this.$el.classList.add('k-layout-item-hint', 'k-layout-item-hint-resize');
|
|
238
288
|
if (this.preventDataOps) {
|
|
239
289
|
return;
|
|
240
290
|
}
|
|
241
291
|
var col = 0;
|
|
242
292
|
var row = 0;
|
|
243
|
-
var wrapBox = this.
|
|
293
|
+
var wrapBox = this.$el.getBoundingClientRect();
|
|
244
294
|
if (dX > wrapBox.width / this.$props.defaultPosition.colSpan / 3) {
|
|
245
295
|
col = 1;
|
|
246
296
|
}
|
|
@@ -255,48 +305,49 @@ var TileVue2 = {
|
|
|
255
305
|
row = -1;
|
|
256
306
|
}
|
|
257
307
|
if (col !== 0 || row !== 0) {
|
|
258
|
-
this.$
|
|
308
|
+
this.$emit('update', this.$props.index, 0, 0, row, col);
|
|
259
309
|
}
|
|
260
310
|
},
|
|
261
311
|
handlePress: function handlePress(e) {
|
|
262
|
-
|
|
312
|
+
var dragElement = this.dragElement();
|
|
313
|
+
if (!this.reorderable || !dragElement) {
|
|
263
314
|
return;
|
|
264
315
|
}
|
|
265
316
|
this.ignoreDrag = false;
|
|
266
|
-
if (this.$props.ignoreDrag && this.$props.ignoreDrag(e.
|
|
317
|
+
if (this.$props.ignoreDrag && this.$props.ignoreDrag(e.originalEvent)) {
|
|
267
318
|
this.ignoreDrag = true;
|
|
268
319
|
return;
|
|
269
320
|
}
|
|
270
|
-
if (this
|
|
271
|
-
this.
|
|
272
|
-
this.
|
|
321
|
+
if (this.$el) {
|
|
322
|
+
this.$el.style.zIndex = '10';
|
|
323
|
+
this.$el.classList.add('k-layout-item-hint');
|
|
273
324
|
}
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
var rec =
|
|
325
|
+
dragElement.classList.remove('k-cursor-grab');
|
|
326
|
+
dragElement.classList.add('k-cursor-grabbing');
|
|
327
|
+
var rec = dragElement.getBoundingClientRect();
|
|
277
328
|
this.pressXY = {
|
|
278
|
-
x: e.
|
|
279
|
-
y: e.
|
|
329
|
+
x: e.clientX,
|
|
330
|
+
y: e.clientY
|
|
280
331
|
};
|
|
281
332
|
this.pressOffset = {
|
|
282
|
-
x: e.
|
|
283
|
-
y: e.
|
|
333
|
+
x: e.clientX - rec.x,
|
|
334
|
+
y: e.clientY - rec.y
|
|
284
335
|
};
|
|
285
336
|
},
|
|
286
337
|
handleDrag: function handleDrag(e) {
|
|
287
|
-
if (this.ignoreDrag) {
|
|
338
|
+
if (!this.reorderable || this.ignoreDrag) {
|
|
288
339
|
return;
|
|
289
340
|
}
|
|
290
|
-
var dragElement = this.dragElement;
|
|
291
|
-
if (e.
|
|
341
|
+
var dragElement = this.dragElement();
|
|
342
|
+
if (e.originalEvent.defaultPrevented || !dragElement) {
|
|
292
343
|
return;
|
|
293
344
|
}
|
|
294
345
|
this.dragging = true;
|
|
295
|
-
e.
|
|
346
|
+
e.originalEvent.preventDefault();
|
|
296
347
|
var rec = dragElement.getBoundingClientRect();
|
|
297
348
|
this.currentTranslate = {
|
|
298
|
-
x: e.
|
|
299
|
-
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
|
|
300
351
|
};
|
|
301
352
|
dragElement.style.transform = "translate(".concat(this.currentTranslate.x, "px, ").concat(this.currentTranslate.y, "px)");
|
|
302
353
|
dragElement.style.transition = 'transform 0s';
|
|
@@ -317,7 +368,7 @@ var TileVue2 = {
|
|
|
317
368
|
if (this.currentTranslate.x < 0.7 * -rec.width / this.$props.defaultPosition.colSpan) {
|
|
318
369
|
col = -1;
|
|
319
370
|
}
|
|
320
|
-
this.$
|
|
371
|
+
this.$emit('update', this.$props.index, row, this.rtl ? -col : col, 0, 0);
|
|
321
372
|
},
|
|
322
373
|
handleRelease: function handleRelease() {
|
|
323
374
|
this.dragging = this.resizing = false;
|
|
@@ -325,11 +376,11 @@ var TileVue2 = {
|
|
|
325
376
|
x: 0,
|
|
326
377
|
y: 0
|
|
327
378
|
};
|
|
328
|
-
if (this
|
|
329
|
-
this.
|
|
330
|
-
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');
|
|
331
382
|
}
|
|
332
|
-
var dragElement = this.dragElement;
|
|
383
|
+
var dragElement = this.dragElement();
|
|
333
384
|
if (dragElement) {
|
|
334
385
|
dragElement.style.transform = 'translate(0px, 0px)';
|
|
335
386
|
dragElement.style.transition = "transform ".concat(ANIMATION_DURATION, "ms cubic-bezier(0.2, 0, 0, 1) 0s");
|
|
@@ -341,18 +392,7 @@ var TileVue2 = {
|
|
|
341
392
|
}
|
|
342
393
|
}
|
|
343
394
|
}
|
|
344
|
-
// /**
|
|
345
|
-
// * @hidden
|
|
346
|
-
// */
|
|
347
|
-
// getSnapshotBeforeUpdate(_: any) {
|
|
348
|
-
// this.oldSize = {};
|
|
349
|
-
// if (this.dragElement) {
|
|
350
|
-
// this.oldSize = this.dragElement.getBoundingClientRect();
|
|
351
|
-
// }
|
|
352
|
-
// return null;
|
|
353
|
-
// }
|
|
354
395
|
};
|
|
355
|
-
|
|
356
396
|
exports.TileVue2 = TileVue2;
|
|
357
397
|
/**
|
|
358
398
|
* @hidden
|