@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.
Files changed (35) hide show
  1. package/dist/cdn/js/kendo-vue-layout.js +1 -1
  2. package/dist/es/main.d.ts +2 -0
  3. package/dist/es/main.js +2 -0
  4. package/dist/es/package-metadata.js +1 -1
  5. package/dist/es/tilelayout/ResizeHandlers.d.ts +53 -0
  6. package/dist/es/tilelayout/ResizeHandlers.js +79 -0
  7. package/dist/es/tilelayout/Tile.d.ts +51 -0
  8. package/dist/es/tilelayout/Tile.js +353 -0
  9. package/dist/es/tilelayout/TileLayout.d.ts +108 -0
  10. package/dist/es/tilelayout/TileLayout.js +222 -0
  11. package/dist/es/tilelayout/interfaces/main.d.ts +135 -0
  12. package/dist/es/tilelayout/interfaces/main.js +1 -0
  13. package/dist/esm/main.d.ts +2 -0
  14. package/dist/esm/main.js +2 -0
  15. package/dist/esm/package-metadata.js +1 -1
  16. package/dist/esm/tilelayout/ResizeHandlers.d.ts +53 -0
  17. package/dist/esm/tilelayout/ResizeHandlers.js +79 -0
  18. package/dist/esm/tilelayout/Tile.d.ts +51 -0
  19. package/dist/esm/tilelayout/Tile.js +353 -0
  20. package/dist/esm/tilelayout/TileLayout.d.ts +108 -0
  21. package/dist/esm/tilelayout/TileLayout.js +222 -0
  22. package/dist/esm/tilelayout/interfaces/main.d.ts +135 -0
  23. package/dist/esm/tilelayout/interfaces/main.js +1 -0
  24. package/dist/npm/main.d.ts +2 -0
  25. package/dist/npm/main.js +2 -0
  26. package/dist/npm/package-metadata.js +1 -1
  27. package/dist/npm/tilelayout/ResizeHandlers.d.ts +53 -0
  28. package/dist/npm/tilelayout/ResizeHandlers.js +86 -0
  29. package/dist/npm/tilelayout/Tile.d.ts +51 -0
  30. package/dist/npm/tilelayout/Tile.js +361 -0
  31. package/dist/npm/tilelayout/TileLayout.d.ts +108 -0
  32. package/dist/npm/tilelayout/TileLayout.js +229 -0
  33. package/dist/npm/tilelayout/interfaces/main.d.ts +135 -0
  34. package/dist/npm/tilelayout/interfaces/main.js +2 -0
  35. package/package.json +11 -11
@@ -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.js';
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 };
@@ -0,0 +1,222 @@
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 { getter, classNames, validatePackage } from '@progress/kendo-vue-common';
19
+ import { packageMetadata } from '../package-metadata.js';
20
+ import { Tile } from './Tile.js';
21
+ /**
22
+ * @hidden
23
+ */
24
+ var AUTO_FLOW_CLASSES = {
25
+ 'column': 'k-grid-flow-col',
26
+ 'row': 'k-grid-flow-row',
27
+ 'column dense': 'k-grid-flow-col-dense',
28
+ 'row dense': 'k-grid-flow-row-dense',
29
+ 'unset': 'k-grid-flow-unset'
30
+ };
31
+ /**
32
+ * @hidden
33
+ */
34
+ var TileLayoutVue2 = {
35
+ name: 'KendoTileLayout',
36
+ props: {
37
+ id: String,
38
+ dir: String,
39
+ gap: Object,
40
+ columns: Number,
41
+ columnWidth: [Number, String],
42
+ rowHeight: [Number, String],
43
+ dataItemKey: String,
44
+ items: Array,
45
+ positions: Array,
46
+ autoFlow: {
47
+ type: String,
48
+ default: 'column',
49
+ validator: function validator(value) {
50
+ return ['column', 'row', 'column dense', 'row dense', 'unset'].includes(value);
51
+ }
52
+ }
53
+ // onReposition: PropTypes.func,
54
+ // ignoreDrag: PropTypes.func
55
+ },
56
+
57
+ created: function created() {
58
+ validatePackage(packageMetadata);
59
+ },
60
+ computed: {
61
+ positions: function positions() {
62
+ return (this.$props.items || []).map(function (p, i) {
63
+ return Object.assign({
64
+ order: i,
65
+ rowSpan: 1,
66
+ colSpan: 1
67
+ }, p.defaultPosition);
68
+ });
69
+ }
70
+ },
71
+ // /**
72
+ // * @hidden
73
+ // */
74
+ // static getDerivedStateFromProps(props: TileLayoutProps, state: TileLayoutState) {
75
+ // if (props.positions) {
76
+ // // The component is in controlled mode.
77
+ // return {
78
+ // positions: props.positions.map((p, i) => (Object.assign({ order: i, rowSpan: 1, colSpan: 1 }, p)))
79
+ // };
80
+ // }
81
+ // if (props.items && (!state.positions || (props.items.length !== state.positions.length))) {
82
+ // // The component is in uncontrolled mode.
83
+ // return {
84
+ // positions: props.items.map((p, i) => (Object.assign(
85
+ // { order: i, rowSpan: 1, colSpan: 1 }, p.defaultPosition)))
86
+ // };
87
+ // }
88
+ // return null;
89
+ // }
90
+ // /**
91
+ // * @hidden
92
+ // */
93
+ // update = (index: number, dOrder: number, dCol: number, dRowSpan = 0, dColSpan = 0) => {
94
+ // if (dOrder === 0 && dCol === 0 && !dColSpan && !dRowSpan) {
95
+ // return;
96
+ // }
97
+ // let shouldUpdate = false;
98
+ // const positions: Array<TileStrictPosition> = this.state.positions.map(p => Object.assign({}, p));
99
+ // // reordering:
100
+ // const current = positions[index];
101
+ // const other = positions.find(item => (item.order === current.order + dOrder));
102
+ // if (other && other !== current) {
103
+ // current.order += dOrder;
104
+ // other.order += -dOrder;
105
+ // shouldUpdate = true;
106
+ // }
107
+ // const proposedCol = current.col + dCol;
108
+ // if (dCol !== 0 && proposedCol >= 1 && proposedCol + current.colSpan <= (this.$props.columns || 3) + 1) {
109
+ // current.col = proposedCol;
110
+ // shouldUpdate = true;
111
+ // }
112
+ // // resizing:
113
+ // const proposedColSpan = current.colSpan + dColSpan;
114
+ // if (dColSpan && proposedColSpan >= 1 && proposedColSpan + current.col <= (this.$props.columns || 3) + 1) {
115
+ // current.colSpan = proposedColSpan;
116
+ // shouldUpdate = true;
117
+ // }
118
+ // const proposedRowSpan = current.rowSpan + dRowSpan;
119
+ // if (dRowSpan && proposedRowSpan >= 1) {
120
+ // current.rowSpan = proposedRowSpan;
121
+ // shouldUpdate = true;
122
+ // }
123
+ // if (shouldUpdate) {
124
+ // this.setState({ positions: positions });
125
+ // dispatchEvent(this.$props.onReposition, {} as any, this, { value: positions });
126
+ // }
127
+ // };
128
+ // @ts-ignore
129
+ setup: !isV3 ? undefined : function () {
130
+ var v3 = !!isV3;
131
+ return {
132
+ v3: v3
133
+ };
134
+ },
135
+ render: function render(createElement) {
136
+ var h = gh || createElement;
137
+ var _a = this.$props,
138
+ className = _a.className,
139
+ _b = _a.columns,
140
+ columns = _b === void 0 ? 3 : _b,
141
+ _c = _a.columnWidth,
142
+ columnWidth = _c === void 0 ? '1fr' : _c,
143
+ gap = _a.gap,
144
+ _d = _a.rowHeight,
145
+ rowHeight = _d === void 0 ? '1fr' : _d,
146
+ style = _a.style,
147
+ _e = _a.autoFlow,
148
+ autoFlow = _e === void 0 ? 'column' : _e,
149
+ _f = _a.items,
150
+ items = _f === void 0 ? [] : _f;
151
+ var gapValue = gap ? "".concat(typeof gap.rows === 'number' ? gap.rows + 'px' : gap.rows) + ' ' + "".concat(typeof gap.columns === 'number' ? gap.columns + 'px' : gap.columns) : 16;
152
+ var tileLayoutStyles = __assign({
153
+ gridTemplateColumns: "repeat(".concat(columns, ", minmax(0px, ").concat(typeof columnWidth === 'number' ? columnWidth + 'px' : columnWidth, "))"),
154
+ gridAutoRows: "minmax(0px, ".concat(typeof rowHeight === 'number' ? rowHeight + 'px' : rowHeight, ")"),
155
+ gap: gapValue,
156
+ padding: gapValue
157
+ }, style);
158
+ return h("div", {
159
+ dir: this.$props.dir,
160
+ attrs: this.v3 ? undefined : {
161
+ dir: this.$props.dir,
162
+ id: this.$props.id
163
+ },
164
+ "class": classNames('k-tilelayout', AUTO_FLOW_CLASSES[autoFlow], className),
165
+ style: tileLayoutStyles,
166
+ id: this.$props.id
167
+ }, [items.map(function (tile, index) {
168
+ return (
169
+ // @ts-ignore function children
170
+ h(Tile, {
171
+ key: this.$props.dataItemKey ? getter(this.$props.dataItemKey)(tile) : index,
172
+ update: this.update,
173
+ attrs: this.v3 ? undefined : {
174
+ update: this.update,
175
+ defaultPosition: this.state.positions[index],
176
+ index: index,
177
+ resizable: tile.resizable,
178
+ reorderable: tile.reorderable,
179
+ hintClassName: tile.hintClassName,
180
+ hintStyle: tile.hintStyle,
181
+ ignoreDrag: this.$props.ignoreDrag
182
+ },
183
+ defaultPosition: this.state.positions[index],
184
+ index: index,
185
+ resizable: tile.resizable,
186
+ reorderable: tile.reorderable,
187
+ style: tile.style,
188
+ "class": tile.className,
189
+ hintClassName: tile.hintClassName,
190
+ hintStyle: tile.hintStyle,
191
+ ignoreDrag: this.$props.ignoreDrag
192
+ }, this.v3 ? function () {
193
+ return [tile.item ? tile.item : [h("div", {
194
+ "class": "k-tilelayout-item-header k-card-header"
195
+ }, [tile.header ? tile.header : h("h5", {
196
+ "class": 'k-card-title'
197
+ }, [tile.header])]), h("div", {
198
+ "class": 'k-tilelayout-item-body k-card-body'
199
+ }, [tile.body])]];
200
+ } : [tile.item ? tile.item : [h("div", {
201
+ "class": "k-tilelayout-item-header k-card-header"
202
+ }, [tile.header ? tile.header : h("h5", {
203
+ "class": 'k-card-title'
204
+ }, [tile.header])]), h("div", {
205
+ "class": 'k-tilelayout-item-body k-card-body'
206
+ }, [tile.body])]])
207
+ );
208
+ }, this)]);
209
+ },
210
+ methods: {
211
+ focus: function focus() {
212
+ if (this.$el) {
213
+ this.$el.focus();
214
+ }
215
+ }
216
+ }
217
+ };
218
+ /**
219
+ * @hidden
220
+ */
221
+ var TileLayout = TileLayoutVue2;
222
+ export { TileLayout, TileLayoutVue2 };