@progress/kendo-vue-layout 3.7.2 → 3.7.3-dev.202211021441
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/main.d.ts +2 -0
- package/dist/es/main.js +2 -0
- package/dist/es/package-metadata.js +1 -1
- package/dist/es/tilelayout/ResizeHandlers.d.ts +53 -0
- package/dist/es/tilelayout/ResizeHandlers.js +79 -0
- package/dist/es/tilelayout/Tile.d.ts +51 -0
- package/dist/es/tilelayout/Tile.js +353 -0
- package/dist/es/tilelayout/TileLayout.d.ts +108 -0
- package/dist/es/tilelayout/TileLayout.js +222 -0
- package/dist/es/tilelayout/interfaces/main.d.ts +135 -0
- package/dist/es/tilelayout/interfaces/main.js +1 -0
- package/dist/esm/main.d.ts +2 -0
- package/dist/esm/main.js +2 -0
- package/dist/esm/package-metadata.js +1 -1
- package/dist/esm/tilelayout/ResizeHandlers.d.ts +53 -0
- package/dist/esm/tilelayout/ResizeHandlers.js +79 -0
- package/dist/esm/tilelayout/Tile.d.ts +51 -0
- package/dist/esm/tilelayout/Tile.js +353 -0
- package/dist/esm/tilelayout/TileLayout.d.ts +108 -0
- package/dist/esm/tilelayout/TileLayout.js +222 -0
- package/dist/esm/tilelayout/interfaces/main.d.ts +135 -0
- package/dist/esm/tilelayout/interfaces/main.js +1 -0
- package/dist/npm/main.d.ts +2 -0
- package/dist/npm/main.js +2 -0
- package/dist/npm/package-metadata.js +1 -1
- package/dist/npm/tilelayout/ResizeHandlers.d.ts +53 -0
- package/dist/npm/tilelayout/ResizeHandlers.js +86 -0
- package/dist/npm/tilelayout/Tile.d.ts +51 -0
- package/dist/npm/tilelayout/Tile.js +361 -0
- package/dist/npm/tilelayout/TileLayout.d.ts +108 -0
- package/dist/npm/tilelayout/TileLayout.js +229 -0
- package/dist/npm/tilelayout/interfaces/main.d.ts +135 -0
- package/dist/npm/tilelayout/interfaces/main.js +2 -0
- package/package.json +11 -11
package/dist/es/main.d.ts
CHANGED
|
@@ -47,6 +47,8 @@ export * from './panelbar/interfaces/PanelBarProps';
|
|
|
47
47
|
export * from './panelbar/interfaces/PanelBarItemProps';
|
|
48
48
|
export * from './panelbar/interfaces/RenderPanelBarItem';
|
|
49
49
|
export * from './panelbar/interfaces/PanelBarSelectEventArguments';
|
|
50
|
+
export * from './tilelayout/TileLayout';
|
|
51
|
+
export * from './tilelayout/interfaces/main';
|
|
50
52
|
export * from './appbar/AppBar';
|
|
51
53
|
export * from './appbar/interfaces/AppBarProps';
|
|
52
54
|
export * from './appbar/AppBarSection';
|
package/dist/es/main.js
CHANGED
|
@@ -47,6 +47,8 @@ export * from './panelbar/interfaces/PanelBarProps';
|
|
|
47
47
|
export * from './panelbar/interfaces/PanelBarItemProps';
|
|
48
48
|
export * from './panelbar/interfaces/RenderPanelBarItem';
|
|
49
49
|
export * from './panelbar/interfaces/PanelBarSelectEventArguments';
|
|
50
|
+
export * from './tilelayout/TileLayout';
|
|
51
|
+
export * from './tilelayout/interfaces/main';
|
|
50
52
|
export * from './appbar/AppBar';
|
|
51
53
|
export * from './appbar/interfaces/AppBarProps';
|
|
52
54
|
export * from './appbar/AppBarSection';
|
|
@@ -5,7 +5,7 @@ export var packageMetadata = {
|
|
|
5
5
|
name: '@progress/kendo-vue-layout',
|
|
6
6
|
productName: 'Kendo UI for Vue',
|
|
7
7
|
productCodes: ['KENDOUIVUE', 'KENDOUICOMPLETE'],
|
|
8
|
-
publishDate:
|
|
8
|
+
publishDate: 1667399417,
|
|
9
9
|
version: '',
|
|
10
10
|
licensingDocsUrl: 'https://www.telerik.com/kendo-vue-ui/my-license/?utm_medium=product&utm_source=kendovue&utm_campaign=kendo-ui-vue-purchase-license-keys-warning'
|
|
11
11
|
};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
declare type DefaultData<V> = object | ((this: V) => {});
|
|
2
|
+
declare type DefaultMethods<V> = {
|
|
3
|
+
[key: string]: (this: V, ...args: any[]) => any;
|
|
4
|
+
};
|
|
5
|
+
import { DefineComponent, RecordPropsDefinition, ComponentOptions, Vue2type } from '../additionalTypes';
|
|
6
|
+
/**
|
|
7
|
+
* @hidden
|
|
8
|
+
*/
|
|
9
|
+
export interface ResizeHandlersProps {
|
|
10
|
+
resizable: string | boolean;
|
|
11
|
+
onResize?: (e: any, args: {
|
|
12
|
+
end: boolean;
|
|
13
|
+
direction: any;
|
|
14
|
+
}) => void;
|
|
15
|
+
onPress?: (e: any) => void;
|
|
16
|
+
rtl: boolean;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* @hidden
|
|
20
|
+
*/
|
|
21
|
+
interface ResizeHandlersState {
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* @hidden
|
|
25
|
+
*/
|
|
26
|
+
interface ResizeHandlersData {
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* @hidden
|
|
30
|
+
*/
|
|
31
|
+
export interface ResizeHandlersMethods {
|
|
32
|
+
[key: string]: any;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* @hidden
|
|
36
|
+
*/
|
|
37
|
+
export interface ResizeHandlersComputed {
|
|
38
|
+
[key: string]: any;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* @hidden
|
|
42
|
+
*/
|
|
43
|
+
export interface ResizeHandlersAll extends ResizeHandlersMethods, ResizeHandlersState, ResizeHandlersData, ResizeHandlersComputed, Vue2type {
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* @hidden
|
|
47
|
+
*/
|
|
48
|
+
declare const ResizeHandlersVue2: ComponentOptions<Vue2type, DefaultData<ResizeHandlersData>, DefaultMethods<ResizeHandlersAll>, ResizeHandlersComputed, RecordPropsDefinition<ResizeHandlersProps>>;
|
|
49
|
+
/**
|
|
50
|
+
* @hidden
|
|
51
|
+
*/
|
|
52
|
+
declare const ResizeHandlers: DefineComponent<ResizeHandlersProps, any, ResizeHandlersData, ResizeHandlersComputed, ResizeHandlersMethods, {}, {}, {}, string, ResizeHandlersProps, ResizeHandlersProps, {}>;
|
|
53
|
+
export { ResizeHandlers, ResizeHandlersVue2 };
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
// @ts-ignore
|
|
2
|
+
import * as Vue from 'vue';
|
|
3
|
+
var allVue = Vue;
|
|
4
|
+
var gh = allVue.h;
|
|
5
|
+
var isV3 = allVue.version && allVue.version[0] === '3';
|
|
6
|
+
/**
|
|
7
|
+
* @hidden
|
|
8
|
+
*/
|
|
9
|
+
var ResizeHandlersVue2 = {
|
|
10
|
+
name: 'KendoResizeHandlers',
|
|
11
|
+
props: {
|
|
12
|
+
resizable: [String, Boolean],
|
|
13
|
+
rtl: Boolean
|
|
14
|
+
},
|
|
15
|
+
// @ts-ignore
|
|
16
|
+
setup: !isV3 ? undefined : function () {
|
|
17
|
+
var v3 = !!isV3;
|
|
18
|
+
return {
|
|
19
|
+
v3: v3
|
|
20
|
+
};
|
|
21
|
+
},
|
|
22
|
+
render: function render(createElement) {
|
|
23
|
+
var h = gh || createElement;
|
|
24
|
+
var _a = this.$props,
|
|
25
|
+
resizable = _a.resizable,
|
|
26
|
+
onPress = _a.onPress,
|
|
27
|
+
rtl = _a.rtl;
|
|
28
|
+
if (!resizable) {
|
|
29
|
+
return null;
|
|
30
|
+
}
|
|
31
|
+
// const Handle = (props: { onResize: any; style: {}; d: string; onPress: any }) => (
|
|
32
|
+
// // @ts-ignore
|
|
33
|
+
// <Draggable
|
|
34
|
+
// onPress={props.onPress}
|
|
35
|
+
// onDrag={(data: any) => { props.onResize(data.event, false, props.d); }}
|
|
36
|
+
// onRelease={(data: any) => { props.onResize(data.event, true, props.d); }}
|
|
37
|
+
// >
|
|
38
|
+
// <div className={'k-resize-handle k-cursor-' + props.d + '-resize'}
|
|
39
|
+
// style={{ bottom: 0, right: 0, ...props.style }} />
|
|
40
|
+
// </Draggable>
|
|
41
|
+
// );
|
|
42
|
+
return h("div")
|
|
43
|
+
// <React.Fragment>
|
|
44
|
+
// {resizable !== 'vertical' && (
|
|
45
|
+
// <Handle
|
|
46
|
+
// onPress={onPress}
|
|
47
|
+
// onResize={this.handleResize}
|
|
48
|
+
// d="ew"
|
|
49
|
+
// style={rtl ? { top: 0, width: 9, left: 0, right: '' } : { top: 0, width: 9, right: 0, left: '' }}
|
|
50
|
+
// />
|
|
51
|
+
// )}
|
|
52
|
+
// {resizable !== 'horizontal' && (
|
|
53
|
+
// <Handle onPress={onPress} onResize={this.handleResize} d="ns" style={{ left: 0, height: 9 }} />)}
|
|
54
|
+
// {(resizable === true) && (
|
|
55
|
+
// <Handle
|
|
56
|
+
// onPress={onPress}
|
|
57
|
+
// onResize={this.handleResize}
|
|
58
|
+
// d={rtl ? 'nesw' : 'nwse'}
|
|
59
|
+
// style={rtl ? { width: 9, height: 9, right: '', left: 0 } : { width: 9, height: 9, right: 0, left: '' }}
|
|
60
|
+
// />)}
|
|
61
|
+
// </React.Fragment>
|
|
62
|
+
;
|
|
63
|
+
},
|
|
64
|
+
|
|
65
|
+
methods: {
|
|
66
|
+
handleResize: function handleResize(event, isEnd, direction) {
|
|
67
|
+
event.originalEvent.preventDefault();
|
|
68
|
+
this.$props.onResize(event, {
|
|
69
|
+
end: isEnd,
|
|
70
|
+
direction: direction
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
/**
|
|
76
|
+
* @hidden
|
|
77
|
+
*/
|
|
78
|
+
var ResizeHandlers = ResizeHandlersVue2;
|
|
79
|
+
export { ResizeHandlers, ResizeHandlersVue2 };
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
declare type DefaultData<V> = object | ((this: V) => {});
|
|
2
|
+
declare type DefaultMethods<V> = {
|
|
3
|
+
[key: string]: (this: V, ...args: any[]) => any;
|
|
4
|
+
};
|
|
5
|
+
import { DefineComponent, RecordPropsDefinition, ComponentOptions, Vue2type } from '../additionalTypes';
|
|
6
|
+
import { TileStrictPosition, TileLayoutItem } from './interfaces/main';
|
|
7
|
+
/**
|
|
8
|
+
* @hidden
|
|
9
|
+
*/
|
|
10
|
+
export interface TileProps extends TileLayoutItem {
|
|
11
|
+
update?: (index: number, dRow: number, dCol: number, row: number, col: number) => void;
|
|
12
|
+
index: number;
|
|
13
|
+
defaultPosition: TileStrictPosition;
|
|
14
|
+
ignoreDrag?: (event: any) => boolean;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* @hidden
|
|
18
|
+
*/
|
|
19
|
+
interface TileState {
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* @hidden
|
|
23
|
+
*/
|
|
24
|
+
interface TileData {
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* @hidden
|
|
28
|
+
*/
|
|
29
|
+
export interface TileMethods {
|
|
30
|
+
[key: string]: any;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* @hidden
|
|
34
|
+
*/
|
|
35
|
+
export interface TileComputed {
|
|
36
|
+
[key: string]: any;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* @hidden
|
|
40
|
+
*/
|
|
41
|
+
export interface TileAll extends TileMethods, TileState, TileData, TileComputed, Vue2type {
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* @hidden
|
|
45
|
+
*/
|
|
46
|
+
declare const TileVue2: ComponentOptions<Vue2type, DefaultData<TileData>, DefaultMethods<TileAll>, TileComputed, RecordPropsDefinition<TileProps>>;
|
|
47
|
+
/**
|
|
48
|
+
* @hidden
|
|
49
|
+
*/
|
|
50
|
+
declare const Tile: DefineComponent<TileProps, any, TileData, TileComputed, TileMethods, {}, {}, {}, string, TileProps, TileProps, {}>;
|
|
51
|
+
export { Tile, TileVue2 };
|
|
@@ -0,0 +1,353 @@
|
|
|
1
|
+
var __assign = this && this.__assign || function () {
|
|
2
|
+
__assign = Object.assign || function (t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) {
|
|
6
|
+
if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
// @ts-ignore
|
|
14
|
+
import * as Vue from 'vue';
|
|
15
|
+
var allVue = Vue;
|
|
16
|
+
var gh = allVue.h;
|
|
17
|
+
var isV3 = allVue.version && allVue.version[0] === '3';
|
|
18
|
+
import { classNames, Draggable, getDefaultSlots } from '@progress/kendo-vue-common';
|
|
19
|
+
import { ResizeHandlers } from './ResizeHandlers';
|
|
20
|
+
/**
|
|
21
|
+
* @hidden
|
|
22
|
+
*/
|
|
23
|
+
var ANIMATION_DURATION = 200;
|
|
24
|
+
/**
|
|
25
|
+
* @hidden
|
|
26
|
+
*/
|
|
27
|
+
var TileVue2 = {
|
|
28
|
+
name: 'KendoTile',
|
|
29
|
+
props: {
|
|
30
|
+
defaultPosition: {
|
|
31
|
+
type: Object,
|
|
32
|
+
required: true
|
|
33
|
+
},
|
|
34
|
+
index: Number,
|
|
35
|
+
hintStyle: Object,
|
|
36
|
+
hintClassName: String,
|
|
37
|
+
header: [String, Function, Object],
|
|
38
|
+
body: [String, Function, Object],
|
|
39
|
+
item: [String, Function, Object],
|
|
40
|
+
resizable: {
|
|
41
|
+
type: [String, Boolean],
|
|
42
|
+
default: true,
|
|
43
|
+
validator: function validator(value) {
|
|
44
|
+
return ['horizontal', 'vertical', true, false].includes(value);
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
reorderable: {
|
|
48
|
+
type: Boolean,
|
|
49
|
+
default: true
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
created: function created() {
|
|
53
|
+
// state = {
|
|
54
|
+
// rtl: false
|
|
55
|
+
// };
|
|
56
|
+
// oldSize = {};
|
|
57
|
+
// draggable: { element: HTMLElement | null } | null = null;
|
|
58
|
+
// dragging = false;
|
|
59
|
+
// resizing = false;
|
|
60
|
+
// element: HTMLElement | null = null;
|
|
61
|
+
// get dragElement() {
|
|
62
|
+
// return this.draggable ? this.draggable.element : undefined;
|
|
63
|
+
// }
|
|
64
|
+
// ignoreDrag: boolean = false;
|
|
65
|
+
// pressOffset = { x: 0, y: 0 };
|
|
66
|
+
// pressXY = { x: 0, y: 0 };
|
|
67
|
+
// currentTranslate = { x: 0, y: 0 };
|
|
68
|
+
// preventDataOps: any = undefined;
|
|
69
|
+
},
|
|
70
|
+
mounted: function mounted() {
|
|
71
|
+
// if (!this.element) {
|
|
72
|
+
// return;
|
|
73
|
+
// }
|
|
74
|
+
// if (getComputedStyle(this.element).direction === 'rtl') {
|
|
75
|
+
// this.setState({
|
|
76
|
+
// rtl: true
|
|
77
|
+
// });
|
|
78
|
+
// }
|
|
79
|
+
},
|
|
80
|
+
updated: function updated() {
|
|
81
|
+
// const dragElement = this.dragElement;
|
|
82
|
+
// if (!dragElement) {
|
|
83
|
+
// return;
|
|
84
|
+
// }
|
|
85
|
+
// const newBox = dragElement.getBoundingClientRect();
|
|
86
|
+
// const oldBox = this.oldSize as any;
|
|
87
|
+
// if (this.resizing) {
|
|
88
|
+
// const diffCol = newBox.width - oldBox.width;
|
|
89
|
+
// if (this.state.rtl) {
|
|
90
|
+
// const currentM: number = parseFloat(dragElement.style.marginLeft || '0');
|
|
91
|
+
// dragElement.style.marginLeft = (currentM - diffCol) + 'px';
|
|
92
|
+
// } else {
|
|
93
|
+
// const currentM: number = parseFloat(dragElement.style.marginRight || '0');
|
|
94
|
+
// dragElement.style.marginRight = (currentM + diffCol) + 'px';
|
|
95
|
+
// }
|
|
96
|
+
// this.pressXY.x += this.state.rtl ? -diffCol : diffCol;
|
|
97
|
+
// const diffRow = newBox.height - oldBox.height;
|
|
98
|
+
// const currentBot: number = parseFloat(dragElement.style!.height!.substring(12) as any);
|
|
99
|
+
// dragElement.style.height = `calc(100% + ${(currentBot + diffRow)}px)`;
|
|
100
|
+
// this.pressXY.y += diffRow;
|
|
101
|
+
// }
|
|
102
|
+
// const deltaX = oldBox.left - newBox.left;
|
|
103
|
+
// const deltaY = oldBox.top - newBox.top;
|
|
104
|
+
// if (deltaX === 0 && deltaY === 0) {
|
|
105
|
+
// return;
|
|
106
|
+
// }
|
|
107
|
+
// if (this.dragging) {
|
|
108
|
+
// if ((prevProps.defaultPosition.order !== this.$props.defaultPosition.order ||
|
|
109
|
+
// prevProps.defaultPosition.col !== this.$props.defaultPosition.col)) {
|
|
110
|
+
// this.currentTranslate.x = 0;
|
|
111
|
+
// this.currentTranslate.y = 0;
|
|
112
|
+
// dragElement.style.transform = '';
|
|
113
|
+
// }
|
|
114
|
+
// return;
|
|
115
|
+
// }
|
|
116
|
+
// if (Math.abs(deltaY) < 15 && Math.abs(deltaX) < 15) {
|
|
117
|
+
// // improves performance and removes random flickering
|
|
118
|
+
// return;
|
|
119
|
+
// }
|
|
120
|
+
// requestAnimationFrame(() => {
|
|
121
|
+
// const domNode = this.element;
|
|
122
|
+
// if (!domNode) {
|
|
123
|
+
// return;
|
|
124
|
+
// }
|
|
125
|
+
// domNode.style.transform = `translate(${deltaX}px, ${deltaY}px)`;
|
|
126
|
+
// domNode.style.transition = 'transform 0s';
|
|
127
|
+
// requestAnimationFrame(() => {
|
|
128
|
+
// domNode.style.transform = '';
|
|
129
|
+
// domNode.style.transition = `transform ${ANIMATION_DURATION}ms cubic-bezier(0.2, 0, 0, 1) 0s`;
|
|
130
|
+
// });
|
|
131
|
+
// });
|
|
132
|
+
},
|
|
133
|
+
// @ts-ignore
|
|
134
|
+
setup: !isV3 ? undefined : function () {
|
|
135
|
+
var v3 = !!isV3;
|
|
136
|
+
return {
|
|
137
|
+
v3: v3
|
|
138
|
+
};
|
|
139
|
+
},
|
|
140
|
+
render: function render(createElement) {
|
|
141
|
+
var _this = this;
|
|
142
|
+
var h = gh || createElement;
|
|
143
|
+
var defaultSlots = getDefaultSlots(this);
|
|
144
|
+
if (clearTimeout && typeof clearTimeout === 'function') {
|
|
145
|
+
clearTimeout(this.preventDataOps);
|
|
146
|
+
this.preventDataOps = window.setTimeout(function () {
|
|
147
|
+
_this.preventDataOps = undefined;
|
|
148
|
+
}, 200);
|
|
149
|
+
}
|
|
150
|
+
var position = this.$props.defaultPosition;
|
|
151
|
+
var resizable = this.$props.resizable;
|
|
152
|
+
var itemStyles = __assign({
|
|
153
|
+
gridColumnStart: position.col,
|
|
154
|
+
gridColumnEnd: "span ".concat(position.colSpan),
|
|
155
|
+
gridRowStart: position.row,
|
|
156
|
+
gridRowEnd: "span ".concat(position.rowSpan),
|
|
157
|
+
outline: 'none',
|
|
158
|
+
order: position.order
|
|
159
|
+
}, this.$props.hintStyle);
|
|
160
|
+
var card = h("div", {
|
|
161
|
+
ref: function ref(e) {
|
|
162
|
+
_this.draggable = e ? {
|
|
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({
|
|
170
|
+
height: '100%'
|
|
171
|
+
}, this.$props.style)
|
|
172
|
+
}, [defaultSlots,
|
|
173
|
+
// @ts-ignore
|
|
174
|
+
h(ResizeHandlers, {
|
|
175
|
+
onPress: this.handlePress,
|
|
176
|
+
on: this.v3 ? undefined : {
|
|
177
|
+
"press": this.handlePress,
|
|
178
|
+
"resize": this.handleResize
|
|
179
|
+
},
|
|
180
|
+
onResize: this.handleResize,
|
|
181
|
+
resizable: resizable,
|
|
182
|
+
attrs: this.v3 ? undefined : {
|
|
183
|
+
resizable: resizable,
|
|
184
|
+
rtl: this.state.rtl
|
|
185
|
+
},
|
|
186
|
+
rtl: this.state.rtl
|
|
187
|
+
})]);
|
|
188
|
+
return h("div", {
|
|
189
|
+
style: itemStyles,
|
|
190
|
+
"class": this.$props.hintClassName
|
|
191
|
+
}, [
|
|
192
|
+
// @ts-ignore function children
|
|
193
|
+
h(Draggable, {
|
|
194
|
+
ref: function ref(e) {
|
|
195
|
+
_this.draggable = e;
|
|
196
|
+
},
|
|
197
|
+
onDrag: this.$props.reorderable ? this.handleDrag : undefined,
|
|
198
|
+
on: this.v3 ? undefined : {
|
|
199
|
+
"drag": this.$props.reorderable ? this.handleDrag : undefined,
|
|
200
|
+
"release": this.$props.reorderable ? this.handleRelease : undefined,
|
|
201
|
+
"press": this.$props.reorderable ? this.handlePress : undefined
|
|
202
|
+
},
|
|
203
|
+
onRelease: this.$props.reorderable ? this.handleRelease : undefined,
|
|
204
|
+
onPress: this.$props.reorderable ? this.handlePress : undefined
|
|
205
|
+
}, this.v3 ? function () {
|
|
206
|
+
return [card];
|
|
207
|
+
} : [card])]);
|
|
208
|
+
},
|
|
209
|
+
methods: {
|
|
210
|
+
handleResize: function handleResize(e, q) {
|
|
211
|
+
if (q.end) {
|
|
212
|
+
this.handleRelease();
|
|
213
|
+
return;
|
|
214
|
+
}
|
|
215
|
+
if (!this.element) {
|
|
216
|
+
return;
|
|
217
|
+
}
|
|
218
|
+
var x = e.clientX;
|
|
219
|
+
var y = e.clientY;
|
|
220
|
+
this.resizing = true;
|
|
221
|
+
var dX = (q.direction !== 'ns' ? x - this.pressXY.x : 0) * (this.state.rtl ? -1 : 1);
|
|
222
|
+
var dY = q.direction !== 'ew' ? y - this.pressXY.y : 0;
|
|
223
|
+
if (this.dragElement) {
|
|
224
|
+
if (this.state.rtl) {
|
|
225
|
+
this.dragElement.style.marginLeft = -dX + 'px';
|
|
226
|
+
} else {
|
|
227
|
+
this.dragElement.style.marginRight = -dX + 'px';
|
|
228
|
+
}
|
|
229
|
+
this.dragElement.style.height = "calc(100% + ".concat(dY, "px)");
|
|
230
|
+
}
|
|
231
|
+
this.element.classList.add('k-layout-item-hint', 'k-layout-item-hint-resize');
|
|
232
|
+
if (this.preventDataOps) {
|
|
233
|
+
return;
|
|
234
|
+
}
|
|
235
|
+
var col = 0;
|
|
236
|
+
var row = 0;
|
|
237
|
+
var wrapBox = this.element.getBoundingClientRect();
|
|
238
|
+
if (dX > wrapBox.width / this.$props.defaultPosition.colSpan / 3) {
|
|
239
|
+
col = 1;
|
|
240
|
+
}
|
|
241
|
+
if (dX < -wrapBox.width / this.$props.defaultPosition.colSpan / 1.25) {
|
|
242
|
+
col = -1;
|
|
243
|
+
}
|
|
244
|
+
// vertical
|
|
245
|
+
if (dY > wrapBox.height / this.$props.defaultPosition.rowSpan / 3) {
|
|
246
|
+
row = 1;
|
|
247
|
+
}
|
|
248
|
+
if (dY < -wrapBox.height / this.$props.defaultPosition.rowSpan / 1.25) {
|
|
249
|
+
row = -1;
|
|
250
|
+
}
|
|
251
|
+
if (col !== 0 || row !== 0) {
|
|
252
|
+
this.$props.update(this.$props.index, 0, 0, row, col);
|
|
253
|
+
}
|
|
254
|
+
},
|
|
255
|
+
handlePress: function handlePress(e) {
|
|
256
|
+
if (!this.dragElement) {
|
|
257
|
+
return;
|
|
258
|
+
}
|
|
259
|
+
this.ignoreDrag = false;
|
|
260
|
+
if (this.$props.ignoreDrag && this.$props.ignoreDrag(e.event.originalEvent)) {
|
|
261
|
+
this.ignoreDrag = true;
|
|
262
|
+
return;
|
|
263
|
+
}
|
|
264
|
+
if (this.element) {
|
|
265
|
+
this.element.style.zIndex = '10';
|
|
266
|
+
this.element.classList.add('k-layout-item-hint');
|
|
267
|
+
}
|
|
268
|
+
this.dragElement.classList.remove('k-cursor-grab');
|
|
269
|
+
this.dragElement.classList.add('k-cursor-grabbing');
|
|
270
|
+
var rec = this.dragElement.getBoundingClientRect();
|
|
271
|
+
this.pressXY = {
|
|
272
|
+
x: e.event.clientX,
|
|
273
|
+
y: e.event.clientY
|
|
274
|
+
};
|
|
275
|
+
this.pressOffset = {
|
|
276
|
+
x: e.event.clientX - rec.x,
|
|
277
|
+
y: e.event.clientY - rec.y
|
|
278
|
+
};
|
|
279
|
+
},
|
|
280
|
+
handleDrag: function handleDrag(e) {
|
|
281
|
+
if (this.ignoreDrag) {
|
|
282
|
+
return;
|
|
283
|
+
}
|
|
284
|
+
var dragElement = this.dragElement;
|
|
285
|
+
if (e.event.originalEvent.defaultPrevented || !dragElement) {
|
|
286
|
+
return;
|
|
287
|
+
}
|
|
288
|
+
this.dragging = true;
|
|
289
|
+
e.event.originalEvent.preventDefault();
|
|
290
|
+
var rec = dragElement.getBoundingClientRect();
|
|
291
|
+
this.currentTranslate = {
|
|
292
|
+
x: e.event.clientX - rec.x - this.pressOffset.x + this.currentTranslate.x,
|
|
293
|
+
y: e.event.clientY - rec.y - this.pressOffset.y + this.currentTranslate.y
|
|
294
|
+
};
|
|
295
|
+
dragElement.style.transform = "translate(".concat(this.currentTranslate.x, "px, ").concat(this.currentTranslate.y, "px)");
|
|
296
|
+
dragElement.style.transition = 'transform 0s';
|
|
297
|
+
if (this.preventDataOps) {
|
|
298
|
+
return;
|
|
299
|
+
}
|
|
300
|
+
var col = 0;
|
|
301
|
+
var row = 0;
|
|
302
|
+
if (this.currentTranslate.y > 0.7 * rec.height / this.$props.defaultPosition.rowSpan) {
|
|
303
|
+
row = 1;
|
|
304
|
+
}
|
|
305
|
+
if (this.currentTranslate.y < 0.7 * -rec.height / this.$props.defaultPosition.rowSpan) {
|
|
306
|
+
row = -1;
|
|
307
|
+
}
|
|
308
|
+
if (this.currentTranslate.x > 0.7 * rec.width / this.$props.defaultPosition.colSpan) {
|
|
309
|
+
col = 1;
|
|
310
|
+
}
|
|
311
|
+
if (this.currentTranslate.x < 0.7 * -rec.width / this.$props.defaultPosition.colSpan) {
|
|
312
|
+
col = -1;
|
|
313
|
+
}
|
|
314
|
+
this.$props.update(this.$props.index, row, this.state.rtl ? -col : col, 0, 0);
|
|
315
|
+
},
|
|
316
|
+
handleRelease: function handleRelease() {
|
|
317
|
+
this.dragging = this.resizing = false;
|
|
318
|
+
this.currentTranslate = {
|
|
319
|
+
x: 0,
|
|
320
|
+
y: 0
|
|
321
|
+
};
|
|
322
|
+
if (this.element) {
|
|
323
|
+
this.element.style.zIndex = '1';
|
|
324
|
+
this.element.classList.remove('k-layout-item-hint', 'k-layout-item-hint-resize');
|
|
325
|
+
}
|
|
326
|
+
var dragElement = this.dragElement;
|
|
327
|
+
if (dragElement) {
|
|
328
|
+
dragElement.style.transform = 'translate(0px, 0px)';
|
|
329
|
+
dragElement.style.transition = "transform ".concat(ANIMATION_DURATION, "ms cubic-bezier(0.2, 0, 0, 1) 0s");
|
|
330
|
+
dragElement.style.marginRight = '0px';
|
|
331
|
+
dragElement.style.marginLeft = '0px';
|
|
332
|
+
dragElement.style.height = '100%';
|
|
333
|
+
dragElement.classList.remove('k-cursor-grabbing');
|
|
334
|
+
dragElement.classList.add('k-cursor-grab');
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
}
|
|
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
|
+
};
|
|
349
|
+
/**
|
|
350
|
+
* @hidden
|
|
351
|
+
*/
|
|
352
|
+
var Tile = TileVue2;
|
|
353
|
+
export { Tile, TileVue2 };
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
declare type DefaultData<V> = object | ((this: V) => {});
|
|
2
|
+
declare type DefaultMethods<V> = {
|
|
3
|
+
[key: string]: (this: V, ...args: any[]) => any;
|
|
4
|
+
};
|
|
5
|
+
import { DefineComponent, RecordPropsDefinition, ComponentOptions, Vue2type } from '../additionalTypes';
|
|
6
|
+
import { TileLayoutGap, TileLayoutItem, TilePosition, TileLayoutRepositionEvent, TileStrictPosition, TileLayoutAutoFlow } from './interfaces/main';
|
|
7
|
+
/**
|
|
8
|
+
* Represents the properties of [TileLayout](% slug overview_tilelayout %) component.
|
|
9
|
+
*/
|
|
10
|
+
export interface TileLayoutProps {
|
|
11
|
+
/**
|
|
12
|
+
* Sets the `id` property of the root element.
|
|
13
|
+
*/
|
|
14
|
+
id?: string;
|
|
15
|
+
/**
|
|
16
|
+
* Represents the `dir` HTML attribute. This is used to switch from LTR to RTL.
|
|
17
|
+
*/
|
|
18
|
+
dir?: string;
|
|
19
|
+
/**
|
|
20
|
+
* Specifies the gaps between the tiles ([see example]({% slug overview_tilelayout %}#toc-tilelayout-configuration-options)).
|
|
21
|
+
*
|
|
22
|
+
* * The possible keys are:
|
|
23
|
+
* * `rows`
|
|
24
|
+
* * `columns`
|
|
25
|
+
*/
|
|
26
|
+
gap?: TileLayoutGap;
|
|
27
|
+
/**
|
|
28
|
+
* Specifies the default number of columns ([see example]({% slug overview_tilelayout %}#toc-tilelayout-configuration-options)).
|
|
29
|
+
*/
|
|
30
|
+
columns?: number;
|
|
31
|
+
/**
|
|
32
|
+
* Specifies the default width of the columns ([see example]({% slug overview_tilelayout %}#toc-tilelayout-configuration-options)).
|
|
33
|
+
*/
|
|
34
|
+
columnWidth?: number | string;
|
|
35
|
+
/**
|
|
36
|
+
* Specifies the default height of the rows ([see example]({% slug overview_tilelayout %}#toc-tilelayout-configuration-options)).
|
|
37
|
+
*/
|
|
38
|
+
rowHeight?: number | string;
|
|
39
|
+
/**
|
|
40
|
+
* Represents the `key` field of the TileLayout item. Used for setting unique keys to the TileLayout items.
|
|
41
|
+
*/
|
|
42
|
+
dataItemKey?: string;
|
|
43
|
+
/**
|
|
44
|
+
* The collection of items that will be rendered in the TileLayout
|
|
45
|
+
* ([see example]({% slug overview_tilelayout %}#toc-tilelayout-configuration-options)).
|
|
46
|
+
*/
|
|
47
|
+
items?: TileLayoutItem[];
|
|
48
|
+
/**
|
|
49
|
+
* The list of tiles' positions which are used when the TileLayout is in controlled mode
|
|
50
|
+
* ([see example]({% slug tiles_tilelayout %}#toc-controlling-the-position)).
|
|
51
|
+
*/
|
|
52
|
+
positions?: TilePosition[];
|
|
53
|
+
/**
|
|
54
|
+
* Fires when the user repositions the tile by either dragging or resizing
|
|
55
|
+
* ([see example]({% slug tiles_tilelayout %}#toc-controlling-the-position)).
|
|
56
|
+
*/
|
|
57
|
+
onReposition?: (event: TileLayoutRepositionEvent) => void;
|
|
58
|
+
/**
|
|
59
|
+
* Controls how the auto-placement algorithm works, specifying exactly how auto-placed items get flowed into the TileLayout.
|
|
60
|
+
* For further reference, check [grid-auto-flow CSS](https://developer.mozilla.org/en-US/docs/Web/CSS/grid-auto-flow) article.
|
|
61
|
+
* Defaults to `column`
|
|
62
|
+
* ([see example]({% slug autoflows_tilelayout %})).
|
|
63
|
+
*/
|
|
64
|
+
autoFlow?: TileLayoutAutoFlow | String;
|
|
65
|
+
/**
|
|
66
|
+
* Use this callback to prevent or allow dragging of the tiles based on specific dom event.
|
|
67
|
+
* Setting `ignoreDrag={(e) => { return !(e.target.classList.contains("k-card-title")); }}` will make only the headers draggable.
|
|
68
|
+
* Setting `ignoreDrag={(e) => { return e.target.nodeName == "INPUT"; }}` will ignore dragging input elements.
|
|
69
|
+
*/
|
|
70
|
+
ignoreDrag?: (event: any) => boolean;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* @hidden
|
|
74
|
+
*/
|
|
75
|
+
export interface TileLayoutState {
|
|
76
|
+
positions: TileStrictPosition[];
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* @hidden
|
|
80
|
+
*/
|
|
81
|
+
interface TileLayoutData {
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* @hidden
|
|
85
|
+
*/
|
|
86
|
+
export interface TileLayoutMethods {
|
|
87
|
+
[key: string]: any;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* @hidden
|
|
91
|
+
*/
|
|
92
|
+
export interface TileLayoutComputed {
|
|
93
|
+
[key: string]: any;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* @hidden
|
|
97
|
+
*/
|
|
98
|
+
export interface TileLayoutAll extends TileLayoutMethods, TileLayoutState, TileLayoutData, TileLayoutComputed, Vue2type {
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* @hidden
|
|
102
|
+
*/
|
|
103
|
+
declare const TileLayoutVue2: ComponentOptions<Vue2type, DefaultData<TileLayoutData>, DefaultMethods<TileLayoutAll>, TileLayoutComputed, RecordPropsDefinition<TileLayoutProps>>;
|
|
104
|
+
/**
|
|
105
|
+
* @hidden
|
|
106
|
+
*/
|
|
107
|
+
declare const TileLayout: DefineComponent<TileLayoutProps, any, TileLayoutData, TileLayoutComputed, TileLayoutMethods, {}, {}, {}, string, TileLayoutProps, TileLayoutProps, {}>;
|
|
108
|
+
export { TileLayout, TileLayoutVue2 };
|