@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.
@@ -1,17 +1,5 @@
1
1
  "use strict";
2
2
 
3
- var __assign = undefined && undefined.__assign || function () {
4
- __assign = Object.assign || function (t) {
5
- for (var s, i = 1, n = arguments.length; i < n; i++) {
6
- s = arguments[i];
7
- for (var p in s) {
8
- if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
9
- }
10
- }
11
- return t;
12
- };
13
- return __assign.apply(this, arguments);
14
- };
15
3
  Object.defineProperty(exports, "__esModule", {
16
4
  value: true
17
5
  });
@@ -55,16 +43,37 @@ var TileLayoutVue2 = {
55
43
  validator: function validator(value) {
56
44
  return ['column', 'row', 'column dense', 'row dense', 'unset'].includes(value);
57
45
  }
58
- }
59
- // onReposition: PropTypes.func,
60
- // ignoreDrag: PropTypes.func
46
+ },
47
+ ignoreDrag: Function
61
48
  },
62
-
63
49
  created: function created() {
64
50
  (0, kendo_vue_common_1.validatePackage)(package_metadata_1.packageMetadata);
65
51
  },
52
+ data: function data() {
53
+ return {
54
+ currentPositions: []
55
+ };
56
+ },
66
57
  computed: {
67
- positions: function positions() {
58
+ compPositions: function compPositions() {
59
+ if (this.positions) {
60
+ return this.positions.map(function (p, i) {
61
+ return Object.assign({
62
+ order: i,
63
+ rowSpan: 1,
64
+ colSpan: 1
65
+ }, p);
66
+ });
67
+ }
68
+ if (this.items && this.currentPositions.length) {
69
+ return this.currentPositions.map(function (p, i) {
70
+ return Object.assign({
71
+ order: i,
72
+ rowSpan: 1,
73
+ colSpan: 1
74
+ }, p);
75
+ });
76
+ }
68
77
  return (this.$props.items || []).map(function (p, i) {
69
78
  return Object.assign({
70
79
  order: i,
@@ -72,65 +81,15 @@ var TileLayoutVue2 = {
72
81
  colSpan: 1
73
82
  }, p.defaultPosition);
74
83
  });
84
+ },
85
+ wrapperClass: function wrapperClass() {
86
+ var _a;
87
+ var autoFlow = this.$props.autoFlow;
88
+ return _a = {
89
+ 'k-tilelayout': true
90
+ }, _a[AUTO_FLOW_CLASSES[autoFlow]] = true, _a;
75
91
  }
76
92
  },
77
- // /**
78
- // * @hidden
79
- // */
80
- // static getDerivedStateFromProps(props: TileLayoutProps, state: TileLayoutState) {
81
- // if (props.positions) {
82
- // // The component is in controlled mode.
83
- // return {
84
- // positions: props.positions.map((p, i) => (Object.assign({ order: i, rowSpan: 1, colSpan: 1 }, p)))
85
- // };
86
- // }
87
- // if (props.items && (!state.positions || (props.items.length !== state.positions.length))) {
88
- // // The component is in uncontrolled mode.
89
- // return {
90
- // positions: props.items.map((p, i) => (Object.assign(
91
- // { order: i, rowSpan: 1, colSpan: 1 }, p.defaultPosition)))
92
- // };
93
- // }
94
- // return null;
95
- // }
96
- // /**
97
- // * @hidden
98
- // */
99
- // update = (index: number, dOrder: number, dCol: number, dRowSpan = 0, dColSpan = 0) => {
100
- // if (dOrder === 0 && dCol === 0 && !dColSpan && !dRowSpan) {
101
- // return;
102
- // }
103
- // let shouldUpdate = false;
104
- // const positions: Array<TileStrictPosition> = this.state.positions.map(p => Object.assign({}, p));
105
- // // reordering:
106
- // const current = positions[index];
107
- // const other = positions.find(item => (item.order === current.order + dOrder));
108
- // if (other && other !== current) {
109
- // current.order += dOrder;
110
- // other.order += -dOrder;
111
- // shouldUpdate = true;
112
- // }
113
- // const proposedCol = current.col + dCol;
114
- // if (dCol !== 0 && proposedCol >= 1 && proposedCol + current.colSpan <= (this.$props.columns || 3) + 1) {
115
- // current.col = proposedCol;
116
- // shouldUpdate = true;
117
- // }
118
- // // resizing:
119
- // const proposedColSpan = current.colSpan + dColSpan;
120
- // if (dColSpan && proposedColSpan >= 1 && proposedColSpan + current.col <= (this.$props.columns || 3) + 1) {
121
- // current.colSpan = proposedColSpan;
122
- // shouldUpdate = true;
123
- // }
124
- // const proposedRowSpan = current.rowSpan + dRowSpan;
125
- // if (dRowSpan && proposedRowSpan >= 1) {
126
- // current.rowSpan = proposedRowSpan;
127
- // shouldUpdate = true;
128
- // }
129
- // if (shouldUpdate) {
130
- // this.setState({ positions: positions });
131
- // dispatchEvent(this.$props.onReposition, {} as any, this, { value: positions });
132
- // }
133
- // };
134
93
  // @ts-ignore
135
94
  setup: !isV3 ? undefined : function () {
136
95
  var v3 = !!isV3;
@@ -141,7 +100,6 @@ var TileLayoutVue2 = {
141
100
  render: function render(createElement) {
142
101
  var h = gh || createElement;
143
102
  var _a = this.$props,
144
- className = _a.className,
145
103
  _b = _a.columns,
146
104
  columns = _b === void 0 ? 3 : _b,
147
105
  _c = _a.columnWidth,
@@ -149,67 +107,88 @@ var TileLayoutVue2 = {
149
107
  gap = _a.gap,
150
108
  _d = _a.rowHeight,
151
109
  rowHeight = _d === void 0 ? '1fr' : _d,
152
- style = _a.style,
153
- _e = _a.autoFlow,
154
- autoFlow = _e === void 0 ? 'column' : _e,
155
- _f = _a.items,
156
- items = _f === void 0 ? [] : _f;
110
+ _e = _a.items,
111
+ items = _e === void 0 ? [] : _e;
157
112
  var gapValue = gap ? "".concat(typeof gap.rows === 'number' ? gap.rows + 'px' : gap.rows) + ' ' + "".concat(typeof gap.columns === 'number' ? gap.columns + 'px' : gap.columns) : 16;
158
- var tileLayoutStyles = __assign({
113
+ var tileLayoutStyles = {
159
114
  gridTemplateColumns: "repeat(".concat(columns, ", minmax(0px, ").concat(typeof columnWidth === 'number' ? columnWidth + 'px' : columnWidth, "))"),
160
115
  gridAutoRows: "minmax(0px, ".concat(typeof rowHeight === 'number' ? rowHeight + 'px' : rowHeight, ")"),
161
116
  gap: gapValue,
162
117
  padding: gapValue
163
- }, style);
118
+ };
164
119
  return h("div", {
165
120
  dir: this.$props.dir,
166
121
  attrs: this.v3 ? undefined : {
167
122
  dir: this.$props.dir,
168
123
  id: this.$props.id
169
124
  },
170
- "class": (0, kendo_vue_common_1.classNames)('k-tilelayout', AUTO_FLOW_CLASSES[autoFlow], className),
125
+ "class": this.wrapperClass,
171
126
  style: tileLayoutStyles,
172
127
  id: this.$props.id
173
128
  }, [items.map(function (tile, index) {
129
+ var item = kendo_vue_common_1.templateRendering.call(this, tile.item, kendo_vue_common_1.getListeners.call(this));
130
+ var itemContent = kendo_vue_common_1.getTemplate.call(this, {
131
+ h: h,
132
+ template: item,
133
+ defaultRendering: null
134
+ });
135
+ var header = kendo_vue_common_1.templateRendering.call(this, tile.header, kendo_vue_common_1.getListeners.call(this));
136
+ var headerContent = kendo_vue_common_1.getTemplate.call(this, {
137
+ h: h,
138
+ template: header,
139
+ defaultRendering: null
140
+ });
141
+ var body = kendo_vue_common_1.templateRendering.call(this, tile.body, kendo_vue_common_1.getListeners.call(this));
142
+ var bodyContent = kendo_vue_common_1.getTemplate.call(this, {
143
+ h: h,
144
+ template: body,
145
+ defaultRendering: null
146
+ });
174
147
  return (
175
148
  // @ts-ignore function children
176
149
  h(Tile_1.Tile, {
177
150
  key: this.$props.dataItemKey ? (0, kendo_vue_common_1.getter)(this.$props.dataItemKey)(tile) : index,
178
- update: this.update,
151
+ onUpdate: this.updateHandle,
152
+ on: this.v3 ? undefined : {
153
+ "update": this.updateHandle
154
+ },
155
+ defaultPosition: this.compPositions[index],
179
156
  attrs: this.v3 ? undefined : {
180
- update: this.update,
181
- defaultPosition: this.state.positions[index],
157
+ defaultPosition: this.compPositions[index],
182
158
  index: index,
183
159
  resizable: tile.resizable,
184
160
  reorderable: tile.reorderable,
185
- hintClassName: tile.hintClassName,
161
+ hintClass: tile.hintClass,
186
162
  hintStyle: tile.hintStyle,
187
163
  ignoreDrag: this.$props.ignoreDrag
188
164
  },
189
- defaultPosition: this.state.positions[index],
190
165
  index: index,
191
166
  resizable: tile.resizable,
192
167
  reorderable: tile.reorderable,
193
168
  style: tile.style,
194
- "class": tile.className,
195
- hintClassName: tile.hintClassName,
169
+ "class": tile.class,
170
+ hintClass: tile.hintClass,
196
171
  hintStyle: tile.hintStyle,
197
172
  ignoreDrag: this.$props.ignoreDrag
198
173
  }, this.v3 ? function () {
199
- return [tile.item ? tile.item : [h("div", {
174
+ return [tile.item ? {
175
+ itemContent: itemContent
176
+ } : [h("div", {
200
177
  "class": "k-tilelayout-item-header k-card-header"
201
- }, [tile.header ? tile.header : h("h5", {
178
+ }, [tile.header ? headerContent : h("h5", {
202
179
  "class": 'k-card-title'
203
- }, [tile.header])]), h("div", {
180
+ }, [tile.headerText])]), h("div", {
204
181
  "class": 'k-tilelayout-item-body k-card-body'
205
- }, [tile.body])]];
206
- } : [tile.item ? tile.item : [h("div", {
182
+ }, [tile.body ? bodyContent : tile.bodyText])]];
183
+ } : [tile.item ? {
184
+ itemContent: itemContent
185
+ } : [h("div", {
207
186
  "class": "k-tilelayout-item-header k-card-header"
208
- }, [tile.header ? tile.header : h("h5", {
187
+ }, [tile.header ? headerContent : h("h5", {
209
188
  "class": 'k-card-title'
210
- }, [tile.header])]), h("div", {
189
+ }, [tile.headerText])]), h("div", {
211
190
  "class": 'k-tilelayout-item-body k-card-body'
212
- }, [tile.body])]])
191
+ }, [tile.body ? bodyContent : tile.bodyText])]])
213
192
  );
214
193
  }, this)]);
215
194
  },
@@ -218,6 +197,53 @@ var TileLayoutVue2 = {
218
197
  if (this.$el) {
219
198
  this.$el.focus();
220
199
  }
200
+ },
201
+ updateHandle: function updateHandle(index, dOrder, dCol, dRowSpan, dColSpan) {
202
+ if (dRowSpan === void 0) {
203
+ dRowSpan = 0;
204
+ }
205
+ if (dColSpan === void 0) {
206
+ dColSpan = 0;
207
+ }
208
+ if (dOrder === 0 && dCol === 0 && !dColSpan && !dRowSpan) {
209
+ return;
210
+ }
211
+ var shouldUpdate = false;
212
+ var positions = this.compPositions.map(function (p) {
213
+ return Object.assign({}, p);
214
+ });
215
+ // reordering:
216
+ var current = positions[index];
217
+ var other = positions.find(function (item) {
218
+ return item.order === current.order + dOrder;
219
+ });
220
+ if (other && other !== current) {
221
+ current.order += dOrder;
222
+ other.order += -dOrder;
223
+ shouldUpdate = true;
224
+ }
225
+ var proposedCol = current.col + dCol;
226
+ if (dCol !== 0 && proposedCol >= 1 && proposedCol + current.colSpan <= (this.$props.columns || 3) + 1) {
227
+ current.col = proposedCol;
228
+ shouldUpdate = true;
229
+ }
230
+ // resizing:
231
+ var proposedColSpan = current.colSpan + dColSpan;
232
+ if (dColSpan && proposedColSpan >= 1 && proposedColSpan + current.col <= (this.$props.columns || 3) + 1) {
233
+ current.colSpan = proposedColSpan;
234
+ shouldUpdate = true;
235
+ }
236
+ var proposedRowSpan = current.rowSpan + dRowSpan;
237
+ if (dRowSpan && proposedRowSpan >= 1) {
238
+ current.rowSpan = proposedRowSpan;
239
+ shouldUpdate = true;
240
+ }
241
+ if (shouldUpdate) {
242
+ this.currentPositions = positions;
243
+ this.$emit('reposition', {
244
+ value: positions
245
+ });
246
+ }
221
247
  }
222
248
  }
223
249
  };
@@ -7,10 +7,14 @@ export interface TileLayoutItem {
7
7
  * ([see example]({% slug tiles_tilelayout %}#toc-position-and-dimensions)).
8
8
  */
9
9
  defaultPosition?: TilePosition;
10
+ /**
11
+ * Sets additional styles to the TileLayoutItem.
12
+ */
13
+ style?: object;
10
14
  /**
11
15
  * Sets additional classes to the TileLayoutItem.
12
16
  */
13
- className?: string;
17
+ class?: string;
14
18
  /**
15
19
  * Sets additional CSS styles to the TileLayoutItem hint element.
16
20
  */
@@ -18,17 +22,27 @@ export interface TileLayoutItem {
18
22
  /**
19
23
  * Sets additional classes to the TileLayoutItem hint element.
20
24
  */
21
- hintClassName?: string;
25
+ hintClass?: string;
22
26
  /**
23
- * Sets the title in the TileLayoutItem's header
27
+ * Sets the title in the TileLayoutItem's header content
24
28
  * ([see example]({% slug tiles_tilelayout %})).
25
29
  */
26
30
  header?: any;
27
31
  /**
28
- * Sets the content in TileLayoutItem's body
32
+ * Sets the title in the TileLayoutItem's header text
33
+ * ([see example]({% slug tiles_tilelayout %})).
34
+ */
35
+ headerText?: string;
36
+ /**
37
+ * Sets the content in TileLayoutItem's body content
29
38
  * ([see example]({% slug tiles_tilelayout %})).
30
39
  */
31
40
  body?: any;
41
+ /**
42
+ * Sets the content in TileLayoutItem's body text
43
+ * ([see example]({% slug tiles_tilelayout %})).
44
+ */
45
+ bodyText?: string;
32
46
  /**
33
47
  * Overrides the default rendering of the TileLayoutItem
34
48
  * ([see example]({% slug tiles_tilelayout %}#toc-custom-rendering)).
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@progress/kendo-vue-layout",
3
3
  "description": "Kendo UI for Vue Layouts package",
4
- "version": "3.7.4-dev.202211100847",
4
+ "version": "3.7.4-dev.202211301436",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/telerik/kendo-vue.git"
@@ -43,22 +43,24 @@
43
43
  "vue": "^2.6.12 || ^3.0.2"
44
44
  },
45
45
  "dependencies": {
46
- "@progress/kendo-vue-animation": "3.7.4-dev.202211100847",
47
- "@progress/kendo-vue-common": "3.7.4-dev.202211100847",
48
- "@progress/kendo-vue-popup": "3.7.4-dev.202211100847"
46
+ "@progress/kendo-vue-animation": "3.7.4-dev.202211301436",
47
+ "@progress/kendo-vue-common": "3.7.4-dev.202211301436",
48
+ "@progress/kendo-vue-popup": "3.7.4-dev.202211301436"
49
49
  },
50
50
  "devDependencies": {
51
51
  "@progress/kendo-data-query": "^1.5.0",
52
52
  "@progress/kendo-date-math": "^1.5.1",
53
53
  "@progress/kendo-drawing": "^1.8.0",
54
54
  "@progress/kendo-licensing": "^1.0.1",
55
- "@progress/kendo-vue-buttons": "3.7.4-dev.202211100847",
56
- "@progress/kendo-vue-dateinputs": "3.7.4-dev.202211100847",
57
- "@progress/kendo-vue-dropdowns": "3.7.4-dev.202211100847",
58
- "@progress/kendo-vue-indicators": "3.7.4-dev.202211100847",
59
- "@progress/kendo-vue-inputs": "3.7.4-dev.202211100847",
60
- "@progress/kendo-vue-intl": "3.7.4-dev.202211100847",
61
- "@progress/kendo-vue-progressbars": "3.7.4-dev.202211100847"
55
+ "@progress/kendo-vue-buttons": "3.7.4-dev.202211301436",
56
+ "@progress/kendo-vue-charts": "3.7.4-dev.202211301436",
57
+ "@progress/kendo-vue-dateinputs": "3.7.4-dev.202211301436",
58
+ "@progress/kendo-vue-dropdowns": "3.7.4-dev.202211301436",
59
+ "@progress/kendo-vue-grid": "3.7.4-dev.202211301436",
60
+ "@progress/kendo-vue-indicators": "3.7.4-dev.202211301436",
61
+ "@progress/kendo-vue-inputs": "3.7.4-dev.202211301436",
62
+ "@progress/kendo-vue-intl": "3.7.4-dev.202211301436",
63
+ "@progress/kendo-vue-progressbars": "3.7.4-dev.202211301436"
62
64
  },
63
65
  "@progress": {
64
66
  "friendlyName": "Layouts",