@mescius/wijmo.grid.transposed 5.20232.939

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/index.d.ts ADDED
@@ -0,0 +1,305 @@
1
+ /*!
2
+ *
3
+ * Wijmo Library 5.20232.939
4
+ * https://developer.mescius.com/wijmo
5
+ *
6
+ * Copyright(c) MESCIUS inc. All rights reserved.
7
+ *
8
+ * Licensed under the End-User License Agreement For MESCIUS Wijmo Software.
9
+ * us.sales@mescius.com
10
+ * https://developer.mescius.com/wijmo/licensing
11
+ *
12
+ */
13
+ /**
14
+ * {@module wijmo.grid.transposed}
15
+ * Extension that includes the {@link TransposedGrid} control,
16
+ * which provides extends the {@link FlexGrid} control to display
17
+ * data using a transposed layout.
18
+ *
19
+ * In transposed layouts, data items are shown as columns and their
20
+ * properties as rows. This the opposite of regular grid layouts,
21
+ * where data items are shown as rows and their properties as columns.
22
+ */
23
+ /**
24
+ *
25
+ */
26
+ export declare var ___keepComment: any;
27
+ import { MergeManager, GridPanel, CellRange, FlexGrid, Column, ColumnCollection, CellRangeEventArgs, AllowSorting, _IColumnGroupHandler, _ColumnGroupProperties, ColumnGroupCollection } from '@grapecity/wijmo.grid';
28
+ import { EventArgs, ICollectionView, IBindingInfo, ObservableArray, NotifyCollectionChangedEventArgs } from '@grapecity/wijmo';
29
+ /**
30
+ * Provides custom merging for {@link TransposedGrid} controls.
31
+ */
32
+ export declare class _MergeManager extends MergeManager {
33
+ /**
34
+ * Gets a {@link CellRange} that specifies the merged extent of a cell
35
+ * in a {@link GridPanel}.
36
+ *
37
+ * @param p The {@link GridPanel} that contains the range.
38
+ * @param r The index of the row that contains the cell.
39
+ * @param c The index of the column that contains the cell.
40
+ * @param clip Specifies whether to clip the merged range to the grid's current view range.
41
+ * @return A {@link CellRange} that specifies the merged range, or null if the cell is not merged.
42
+ */
43
+ getMergedRange(p: GridPanel, r: number, c: number, clip?: boolean): CellRange;
44
+ }
45
+ /**
46
+ * Extends the {@link FlexGrid} control to display data using a transposed
47
+ * layout, where columns represent data items and rows represent item
48
+ * properties.
49
+ *
50
+ * Features based on regular (non-transposed) data sources only apply to the
51
+ * original data source, so you can sort, filter, group, or paginate items before
52
+ * assigning them to the {@link TransposedGrid}, but if you later change those
53
+ * parameters, the grid will not be automatically updated.
54
+ *
55
+ * Also, some regular {@link FlexGrid} features are not available in the
56
+ * {@link TransposedGrid} because they don't make sense with transposed data
57
+ * sources.
58
+ *
59
+ * For example, adding or removing rows in a transposed grid would mean adding
60
+ * or removing properties to the data items. For this reason, the {@link allowAddNew}
61
+ * and {@link allowDelete} properties are disabled.
62
+ *
63
+ * Also, the {@link autoGenerateColumns} property has no effect on the
64
+ * {@link TransposedGrid}, which has an {@link autoGenerateRows} property instead.
65
+ *
66
+ * The list of disabled properties includes the following:
67
+ * {@link FlexGrid.allowAddNew}, {@link FlexGrid.allowDelete},
68
+ * {@link FlexGrid.allowSorting}, {@link Column.cellTemplate},
69
+ * {@link Column.editor}, {@link FlexGridFilter},
70
+ * {@link Selector}.
71
+ */
72
+ export declare class TransposedGrid extends FlexGrid {
73
+ protected _sourceItems: any;
74
+ protected _keyPrefix: string;
75
+ protected _autoGenRows: boolean;
76
+ protected _toRowInfo: any;
77
+ _rowInfo: ColumnCollection;
78
+ /**
79
+ * Initializes a new instance of the {@link TransposedGrid} class.
80
+ *
81
+ * @param element The DOM element that hosts the control, or a CSS selector for the host element (e.g. '#theCtrl').
82
+ * @param options JavaScript object containing initialization data for the control.
83
+ */
84
+ constructor(element: any, options?: any);
85
+ /**
86
+ * Gets or sets a value that determines whether the grid should generate
87
+ * rows automatically based on the {@link itemsSource}.
88
+ *
89
+ * The default value for this property is <b>true</b>.
90
+ */
91
+ autoGenerateRows: boolean;
92
+ /**
93
+ * Gets or sets an array used to define hierarchical row groups.
94
+ *
95
+ * The items in the array should be JSON objects with properties of
96
+ * {@link Column} objects, plus three optional members:
97
+ *
98
+ * * 'rows' array containing an array of child rows,
99
+ * * 'collapseTo' string containing the binding(s) of the child row(s)
100
+ * that should remain visible when the group is collapsed.
101
+ * * 'isCollapsed' boolean that determines if the group should be
102
+ * initially collapsed.
103
+ *
104
+ * Please note that 'width' property defines row header width.
105
+ * If width is defined in more than one group/row header that corresponds the same header column,
106
+ * the maximal width will be used.
107
+ *
108
+ * Moreover, it is possible to define row height using 'height' property.
109
+ * This property should be used for empty rows which don't contain child rows.
110
+ * Using this property for rows which contain child ones will have no effect.
111
+ *
112
+ * For example, the code below generates a grid with two row groups,
113
+ * both initially collapsed:
114
+ *
115
+ * ```typescript
116
+ * new TransposedGrid('#trnGrid', {
117
+ * autoGenerateRows: false,
118
+ * rowGroups: [
119
+ * { header: 'Group 1', width: 100, align: 'center', collapseTo: ['id', 'country'], isCollapsed: true, rows: [
120
+ * { binding: 'id', header: 'ID', width: 20, height: 50 },
121
+ * { binding: 'date', header: 'Date', width: 60, dataType: 'Date' },
122
+ * { binding: 'country', header: 'Country', width: 80, dataType: 'String' },
123
+ * { binding: 'active', header: 'Active', width: 20, dataType: 'Boolean' },
124
+ * ]},
125
+ * { header: 'Group 2', width: 100, align: 'center', collapseTo: 'sales', isCollapsed: true, rows: [
126
+ * { binding: 'sales', header: 'Sales', width: 60, dataType: 'Number' },
127
+ * { binding: 'expenses', header: 'Expenses', width: 60, dataType: 'Number' },
128
+ * ]}
129
+ * ],
130
+ * itemsSource: getData(20)
131
+ * });
132
+ * ```
133
+ *
134
+ * Note that these row groups will be represented by row header with two columns,
135
+ * 100 and 80 pixels wide, respectively.
136
+ */
137
+ rowGroups: any[];
138
+ refresh(fullUpdate?: boolean): void;
139
+ allowAddNew: boolean;
140
+ allowDelete: boolean;
141
+ allowSorting: AllowSorting;
142
+ /**
143
+ * Not supported. Use {@link rowGroups} instead.
144
+ */
145
+ columnGroups: any[];
146
+ onRowEditEnded(e: CellRangeEventArgs): void;
147
+ protected _getCollectionView(value: any): ICollectionView;
148
+ _getColumnTypes(arr: any[]): IBindingInfo[];
149
+ _copy(key: string, value: any): boolean;
150
+ onLoadedRows(e?: EventArgs): void;
151
+ _getBindingColumn(p: GridPanel, r: number, c: Column): Column;
152
+ _isTransposed(): boolean;
153
+ _autoSizeRows(): void;
154
+ private _copyProps;
155
+ private _updateRowHeaders;
156
+ _rowInfoChanged(): void;
157
+ _sourceViewChanged(sender: ICollectionView, e: NotifyCollectionChangedEventArgs): void;
158
+ _transposeItemsSource(arr: any[]): ObservableArray;
159
+ _supportsProxies(): boolean;
160
+ _createProxy(arr: any[], rowInfo: any, proxyKeys: string[]): any;
161
+ _createTransposedObject(arr: any[], rowInfo: any, keyPrefix: string): {
162
+ _arr: any[];
163
+ _rowInfo: any;
164
+ };
165
+ _getRowInfo(arr: any[]): any[];
166
+ }
167
+ /**
168
+ * This class is for internal use only.
169
+ */
170
+ export declare class TransposedGridRow extends Column {
171
+ private _height;
172
+ /**
173
+ * Gets or sets the height of the row.
174
+ * Setting this property to null or negative values causes the element to use the
175
+ * parent collection's default size.
176
+ */
177
+ height: number | null;
178
+ }
179
+ /**
180
+ * Provides custom handling of row groups for {@link TransposedGrid} controls.
181
+ */
182
+ export declare class _RowGroupHandler implements _IColumnGroupHandler {
183
+ private _grid;
184
+ private _colGroups;
185
+ private _groupDefs;
186
+ /**
187
+ * Initializes a new instance of the {@link _RowGroupHandler} class.
188
+ *
189
+ * @param g {@link TransposedGrid} that owns this {@link _RowGroupHandler}.
190
+ */
191
+ constructor(grid: TransposedGrid);
192
+ /**
193
+ * Gets the collection of column groups.
194
+ * Currently does not support and returns null;
195
+ */
196
+ readonly columnGroups: ColumnGroupCollection;
197
+ /**
198
+ * Initializes the column groups based on an array of
199
+ * column definition objects.
200
+ *
201
+ * @param arr Array of column definition objects that defines the groups.
202
+ */
203
+ createColumnGroups(arr: any[]): void;
204
+ /**
205
+ * Gets a value that determines whether the grid has any
206
+ * column groups.
207
+ */
208
+ hasColumnGroups(): boolean;
209
+ /**
210
+ * Gets the original array used to define the column groups.
211
+ */
212
+ getGroupDefinitions(): any[];
213
+ /**
214
+ * Gets the column group that contains a given row and column.
215
+ *
216
+ * @param r Index of the row containted in the group.
217
+ * @param c Index of the column containted in the group.
218
+ */
219
+ getColumnGroup(r: number, c: number): Column & _ColumnGroupProperties;
220
+ /**
221
+ * Checks whether the column group can be moved from one position to another.
222
+ *
223
+ * @param srcRow The row index of the column group to move.
224
+ * @param srcCol The column index of the column group to move.
225
+ * @param dstRow The row position to which to move the column group.
226
+ * @param dstCol The column position to which to move the column group.
227
+ * @returns Returns true if the move is valid, false otherwise.
228
+ */
229
+ canMoveColumnGroup(srcRow: number, srcCol: number, dstRow: number, dstCol: number): boolean;
230
+ /**
231
+ * Moves the column group from one position to another.
232
+ *
233
+ * Note: it is allowed to move the column group to child groups (child == true)
234
+ * only if the parent group is empty. Otherwise returns false.
235
+ *
236
+ * @param srcRow The row index of the column group to move.
237
+ * @param srcCol The column index of the column group to move.
238
+ * @param dstRow The row position to which to move the column group.
239
+ * @param dstCol The column position to which to move the column group.
240
+ * @param child Whether to move the column group to child groups or to sibling groups.
241
+ * @returns Returns true if the element was moved, false otherwise.
242
+ */
243
+ moveColumnGroup(srcRow: number, srcCol: number, dstRow: number, dstCol: number, child: boolean): boolean;
244
+ private _createRowGroups;
245
+ private _addRowGroup;
246
+ }
247
+ /**
248
+ * Extends the {@link Column} class to provide custom row groups
249
+ * for {@link TransposedGrid} controls.
250
+ */
251
+ export declare class _RowGroup extends Column {
252
+ private _height;
253
+ _rng: CellRange;
254
+ _grid: TransposedGrid;
255
+ protected _pGrp: _RowGroup;
256
+ protected _cols: _RowGroup[];
257
+ protected _lvl: number;
258
+ protected _collTo: string | string[];
259
+ protected _collapsed: boolean;
260
+ /**
261
+ * Initializes a new instance of the {@link _RowGroup} class.
262
+ *
263
+ * @param options JavaScript object containing initialization data for the instance.
264
+ * @param parent Parent group, or null for top-level groups.
265
+ */
266
+ constructor(options: any, parent: _RowGroup);
267
+ /**
268
+ * Gets or sets the collection of child {@link _RowGroup} columns.
269
+ */
270
+ columns: _RowGroup[];
271
+ readonly rows: _RowGroup[];
272
+ /**
273
+ * Gets the value that indicates whether the group contains child columns or not.
274
+ */
275
+ readonly isEmpty: boolean;
276
+ /**
277
+ * Gets or sets the height of the row.
278
+ * Setting this property to null or negative values causes the element to use the
279
+ * parent collection's default size.
280
+ */
281
+ height: number | null;
282
+ /**
283
+ * Gets this {@link _RowGroup}'s level (the number of parent groups it has).
284
+ *
285
+ * Top level groups have level zero. Their children have level 1, and so on.
286
+ */
287
+ readonly level: number;
288
+ /**
289
+ * Gets or sets the binding(s) of the column(s) that should remain
290
+ * visible when this {@link _RowGroup} is collapsed.
291
+ */
292
+ collapseTo: string | string[];
293
+ /**
294
+ * Gets or sets a value that determines whether this {@link _RowGroup}
295
+ * is collapsed.
296
+ */
297
+ isCollapsed: boolean;
298
+ _copy(key: string, value: any): boolean;
299
+ _updateCollapsedState(): void;
300
+ _getMaxLevel(): number;
301
+ _expandRange(maxLevel: number): void;
302
+ _shiftRange(delta: number): void;
303
+ private _getCollapseToBindings;
304
+ private _getCollapseToIndices;
305
+ }
package/index.js ADDED
@@ -0,0 +1,14 @@
1
+ /*!
2
+ *
3
+ * Wijmo Library 5.20232.939
4
+ * https://developer.mescius.com/wijmo
5
+ *
6
+ * Copyright(c) MESCIUS inc. All rights reserved.
7
+ *
8
+ * Licensed under the End-User License Agreement For MESCIUS Wijmo Software.
9
+ * us.sales@mescius.com
10
+ * https://developer.mescius.com/wijmo/licensing
11
+ *
12
+ */
13
+
14
+ "use strict";var __extends=this&&this.__extends||function(){var extendStatics=function(o,e){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(o,e){o.__proto__=e}||function(o,e){for(var r in e)e.hasOwnProperty(r)&&(o[r]=e[r])})(o,e)};return function(o,e){extendStatics(o,e);function __(){this.constructor=o}o.prototype=null===e?Object.create(e):(__.prototype=e.prototype,new __)}}(),__importStar=this&&this.__importStar||function(o){if(o&&o.__esModule)return o;var e={};if(null!=o)for(var r in o)Object.hasOwnProperty.call(o,r)&&(e[r]=o[r]);e.default=o;return e};Object.defineProperty(exports,"__esModule",{value:!0});var wijmo_grid_1=require("@mescius/wijmo.grid"),wijmo_1=require("@mescius/wijmo"),selfModule=__importStar(require("@mescius/wijmo.grid.transposed")),_MergeManager=function(o){__extends(_MergeManager,o);function _MergeManager(){return null!==o&&o.apply(this,arguments)||this}_MergeManager.prototype.getMergedRange=function(e,r,t,n){void 0===n&&(n=!0);var i=e.grid,s=i._hasColumnGroups();if(e==i.columnHeaders&&s)return null;if(e==i.rowHeaders&&s){if(r<0||r>=e.rows.length||t<0||t>=e.columns.length)return null;var a=i._getColumnGroup(r,t);if(a){var u=a._rng,l=e.rows;if(l.isFrozen(u.row)!=l.isFrozen(u.row2)){u=u.clone();l.isFrozen(r)?u.row2=l.frozen-1:u.row=l.frozen}return u}return null}return o.prototype.getMergedRange.call(this,e,r,t,n)};return _MergeManager}(wijmo_grid_1.MergeManager);exports._MergeManager=_MergeManager;var TransposedGrid=function(o){__extends(TransposedGrid,o);function TransposedGrid(e,r){var t=o.call(this,e,null)||this;t._keyPrefix="item";t._autoGenRows=!0;wijmo_1.addClass(t.hostElement,"wj-transposed-grid");t.allowSorting=wijmo_grid_1.AllowSorting.None;t.headersVisibility=wijmo_grid_1.HeadersVisibility.Row;t._rowInfo=new wijmo_grid_1.ColumnCollection(t,t.columns.defaultSize);t._grpHdl=new _RowGroupHandler(t);t.mergeManager=new _MergeManager;t.initialize(r);t._rowInfo.collectionChanged.addHandler(t._rowInfoChanged,t);t.deferUpdate((function(){var o=t.rowHeaders.columns;if(o.length){o[o.length-1].width=t.columns.defaultSize}}));return t}Object.defineProperty(TransposedGrid.prototype,"autoGenerateRows",{get:function(){return this._autoGenRows},set:function(o){this._autoGenRows=wijmo_1.asBoolean(o)},enumerable:!0,configurable:!0});Object.defineProperty(TransposedGrid.prototype,"rowGroups",{get:function(){return this._grpHdl.getGroupDefinitions()},set:function(o){var e=this;this._rowInfo.deferUpdate((function(){e.autoGenerateRows=!1;e._rowInfo.clear();e._grpHdl.createColumnGroups(wijmo_1.asArray(o))}))},enumerable:!0,configurable:!0});TransposedGrid.prototype.refresh=function(e){var r=this._rowInfo;if(r._dirty){r._dirty=!1;this._rowInfoChanged()}else o.prototype.refresh.call(this,e)};Object.defineProperty(TransposedGrid.prototype,"allowAddNew",{get:function(){return!1},set:function(o){},enumerable:!0,configurable:!0});Object.defineProperty(TransposedGrid.prototype,"allowDelete",{get:function(){return!1},set:function(o){},enumerable:!0,configurable:!0});Object.defineProperty(TransposedGrid.prototype,"allowSorting",{get:function(){return wijmo_grid_1.AllowSorting.None},set:function(o){wijmo_1.assert(o===wijmo_grid_1.AllowSorting.None,"TransposedGrid does not support sorting.");this._alSorting=o},enumerable:!0,configurable:!0});Object.defineProperty(TransposedGrid.prototype,"columnGroups",{get:function(){return null},set:function(o){throw"TransposedGrid does not support columnGroups, use rowGroups instead."},enumerable:!0,configurable:!0});TransposedGrid.prototype.onRowEditEnded=function(e){var r=wijmo_1.tryCast(this._sourceItems,"ICollectionView");if(r){var t=new wijmo_1.NotifyCollectionChangedEventArgs(wijmo_1.NotifyCollectionChangedAction.Change);r.collectionChanged.raise(r,t)}o.prototype.onRowEditEnded.call(this,e)};TransposedGrid.prototype._getCollectionView=function(e){var r=this,t=wijmo_1.tryCast(this._sourceItems,"ICollectionView");t&&t.collectionChanged.removeHandler(this._sourceViewChanged);t=wijmo_1.tryCast(e,"ICollectionView");var n=e;if(wijmo_1.isArray(e))n=this._transposeItemsSource(e);else if(t){t.collectionChanged.addHandler(this._sourceViewChanged,this);n=this._transposeItemsSource(t.items)}this.autoGenerateColumns=!0;var i=o.prototype._getCollectionView.call(this,n),s=null;t instanceof wijmo_1.CollectionView&&(s=t.getError);s&&i instanceof wijmo_1.CollectionView&&(this._supportsProxies()?i.getError=function(o,e){if(null==e)return null;var r=o._keys.indexOf(e);return s(o._arr[r],o._bnd.path)}:i.getError=function(o,e){if(null==e)return null;var t=parseInt(e.substr(r._keyPrefix.length));return s(o._arr[t],o._rowInfo.binding)});this._sourceItems=e;return i};TransposedGrid.prototype._getColumnTypes=function(o){var e,r=this;if(this._sourceItems)if(wijmo_1.isArray(this._sourceItems))e=this._sourceItems;else{var t=wijmo_1.tryCast(this._sourceItems,"ICollectionView");t&&(e=t.items)}return e?e.map((function(o,e){return{binding:r._keyPrefix+e,dataType:wijmo_1.DataType.Object}})):wijmo_1.getTypes(o)};TransposedGrid.prototype._copy=function(e,r){var t=this;if(/rows|columns/.test(e)){wijmo_1.assert(wijmo_1.isArray(r),"Array Expected.");var n=wijmo_1.asArray(r);n.some((function(o){return null!=o.columns}))?this.rowGroups=n:this._rowInfo.deferUpdate((function(){t.autoGenerateRows=!1;t._rowInfo.clear();r.forEach((function(o){var e=new TransposedGridRow(o);t._rowInfo.push(e)}))}));return!0}return o.prototype._copy.call(this,e,r)};TransposedGrid.prototype.onLoadedRows=function(e){for(var r=this,t=this.columns,n=0;n<t.length;n++){var i=t[n];i.align=null;i.dataType=0}var s=this.rowHeaders.columns;for(n=0;n<s.length;n++){s[n].align="left";s[n].width=0}var a=wijmo_grid_1.FlexGrid._getSerializableProperties(wijmo_grid_1.Row);this.rows.forEach((function(o){var e=o.dataItem._rowInfo;if(e){r._copyProps(e,o,a,["showDropDown","width","size"]);if(r._hasColumnGroups())for(var t=0;t<s.length;t++){var n=r._grpHdl.getColumnGroup(o.index,t);n&&r._updateRowHeaders(o.index,t,n)}else s.length&&r._updateRowHeaders(o.index,s.length-1,e)}}));for(n=0;n<s.length;n++)0===s[n].width&&(s[n].width=this.columns.defaultSize);o.prototype.onLoadedRows.call(this,e)};TransposedGrid.prototype._getBindingColumn=function(o,e,r){var t=r;if(o!=this.cells)return t;var n=o.rows[e],i=n&&n.dataItem&&n.dataItem._rowInfo;if(wijmo_1.isUndefined(i))return t;t=new wijmo_grid_1.Column;var s=wijmo_grid_1.FlexGrid._getSerializableProperties(wijmo_grid_1.Column);this._copyProps(i,t,s);t.binding=r.binding;t.header=i.header||wijmo_1.toHeaderCase(i.binding);return t};TransposedGrid.prototype._isTransposed=function(){return!0};TransposedGrid.prototype._autoSizeRows=function(){this.autoSizeMode&wijmo_grid_1.AutoSizeMode.Both&&this.autoSizeRows();o.prototype._autoSizeRows.call(this)};TransposedGrid.prototype._copyProps=function(o,e,r,t){void 0===t&&(t=[]);for(var n in o)if(r.indexOf(n)>-1&&-1===t.indexOf(n)){var i=o[n];if(!wijmo_1.isUndefined(i))try{e[n]=i}catch(o){}}};TransposedGrid.prototype._updateRowHeaders=function(o,e,r){var t=r.header||wijmo_1.toHeaderCase(r.binding);this.rowHeaders.setCellData(o,e,t);var n=this.rowHeaders.columns,i=r.width;if(wijmo_1.isNumber(i)&&i>0){var s=r._rng;if(s&&s instanceof wijmo_grid_1.CellRange&&s.isValid){var a=s.columnSpan;wijmo_1.assert(a>0,"Column span is negative or equal to 0");i/=a}n[e].width=Math.max(n[e].width,i)}};TransposedGrid.prototype._rowInfoChanged=function(){var o=this;this._toRowInfo&&clearTimeout(this._toRowInfo);this._toRowInfo=setTimeout((function(){var e=o.selection,r=o.itemsSource;o.itemsSource=null;o.itemsSource=r;o.selection=e}),wijmo_1.Control._REFRESH_INTERVAL)};TransposedGrid.prototype._sourceViewChanged=function(o,e){this.activeEditor||this.invalidate()};TransposedGrid.prototype._transposeItemsSource=function(o){var e=this,r=new wijmo_1.ObservableArray,t=wijmo_1.getTypes(o),n=o.map((function(o,r){return e._keyPrefix+r}));(this.autoGenerateRows?this._getRowInfo(o):this._rowInfo).forEach((function(i,s){var a=new wijmo_1.Binding(i.binding);if(null==i.dataType&&o.length){var u=a.getValue(o[0]);i.dataType=null!=u?wijmo_1.getType(u):t[s].dataType}if(e._supportsProxies()){var l=e._createProxy(o,i,n);r.push(l)}else{var p=e._createTransposedObject(o,i,e._keyPrefix);r.push(p)}}));o instanceof wijmo_1.ObservableArray&&o.collectionChanged.addHandler((function(o,t){if(t.action===wijmo_1.NotifyCollectionChangedAction.Change)e.activeEditor||e.invalidate();else{var n=new wijmo_1.NotifyCollectionChangedEventArgs(wijmo_1.NotifyCollectionChangedAction.Reset);r.onCollectionChanged(n);e._rowInfoChanged()}}));return r};TransposedGrid.prototype._supportsProxies=function(){return null!=window.Proxy};TransposedGrid.prototype._createProxy=function(o,e,r){var t={_arr:o,_rowInfo:e,_bnd:new wijmo_1.Binding(e.binding),_keys:r};return new Proxy(t,{ownKeys:function(o){return o._keys},getOwnPropertyDescriptor:function(){return{enumerable:!0,configurable:!0,writable:!0}},get:function(o,e){var r=o._keys.indexOf(e);return r>-1?o._bnd.getValue(o._arr[r]):o[e]},set:function(o,e,r){var t=o._keys.indexOf(e);if(t>-1){var n=o._arr,i=n[t];o._bnd.setValue(i,r);if(n instanceof wijmo_1.ObservableArray){var s=new wijmo_1.NotifyCollectionChangedEventArgs(wijmo_1.NotifyCollectionChangedAction.Change,i,t);n.onCollectionChanged(s)}return!0}return!1}})};TransposedGrid.prototype._createTransposedObject=function(o,e,r){for(var t={_arr:o,_rowInfo:e},n=new wijmo_1.Binding(e.binding),_loop_1=function(e){var i=o[e];Object.defineProperty(t,r+e,{enumerable:!0,get:function(){return n.getValue(i)},set:function(r){n.setValue(i,r);if(o instanceof wijmo_1.ObservableArray){var t=new wijmo_1.NotifyCollectionChangedEventArgs(wijmo_1.NotifyCollectionChangedAction.Change,i,e);o.onCollectionChanged(t)}return!0}})},i=0;i<o.length;i++)_loop_1(i);return t};TransposedGrid.prototype._getRowInfo=function(o){var e=this,r=[];wijmo_1.getTypes(o).forEach((function(o){var t=o.binding,n=o.dataType;if(n!=wijmo_1.DataType.Object&&n!=wijmo_1.DataType.Array){var i={binding:t,header:wijmo_1.toHeaderCase(t),dataType:n},s=wijmo_grid_1.FlexGrid._defTypeWidth[n];if(null!=s){if(wijmo_1.isString(s)){var a=Math.round(parseFloat(s));s=s.indexOf("*")<0?a:a*e.columns.defaultSize}wijmo_1.isNumber(s)&&s>0&&(i.width=s)}r.push(i)}}));return r};return TransposedGrid}(wijmo_grid_1.FlexGrid);exports.TransposedGrid=TransposedGrid;var TransposedGridRow=function(o){__extends(TransposedGridRow,o);function TransposedGridRow(){return null!==o&&o.apply(this,arguments)||this}Object.defineProperty(TransposedGridRow.prototype,"height",{get:function(){return this._height},set:function(o){this._height=o},enumerable:!0,configurable:!0});return TransposedGridRow}(wijmo_grid_1.Column);exports.TransposedGridRow=TransposedGridRow;var _RowGroupHandler=function(){function _RowGroupHandler(o){this._grid=o}Object.defineProperty(_RowGroupHandler.prototype,"columnGroups",{get:function(){return null},enumerable:!0,configurable:!0});_RowGroupHandler.prototype.createColumnGroups=function(o){this._createRowGroups(o)};_RowGroupHandler.prototype.hasColumnGroups=function(){return null!=this._colGroups&&this._colGroups.length>0};_RowGroupHandler.prototype.getGroupDefinitions=function(){return this._groupDefs};_RowGroupHandler.prototype.getColumnGroup=function(o,e){var r=this._grid;if(e<r.rowHeaders.columns.length&&o<r._rowInfo.length)for(var t=this._colGroups;t;){for(var n=t,i=0;i<t.length;i++){var s=t[i],a=s._rng;if(a.containsRow(o)){if(a.containsColumn(e)||0==s.columns.length)return s;t=s.columns;break}}if(t==n)break}return null};_RowGroupHandler.prototype.canMoveColumnGroup=function(o,e,r,t){return this._grid.columns.canMoveElement(e,t)};_RowGroupHandler.prototype.moveColumnGroup=function(o,e,r,t,n){return this._grid.columns.moveElement(e,t)};_RowGroupHandler.prototype._createRowGroups=function(o){var e=this,r=this._grid;this._groupDefs=wijmo_1.asArray(o);r.autoGenerateRows=!1;r._rowInfo.clear();this._colGroups=[];o.forEach((function(o){e._colGroups.push(new _RowGroup(o,null))}));var t=1;this._colGroups.forEach((function(o){e._addRowGroup(o);t=Math.max(t,o._getMaxLevel())}));this._colGroups.forEach((function(o){o._expandRange(t)}));var n=r.rowHeaders.columns;n.clear();for(var i=0;i<=t;i++){var s=new wijmo_grid_1.Column;n.splice(i,0,s);i<t&&(s.cssClassAll="wj-colgroup")}};_RowGroupHandler.prototype._addRowGroup=function(o){var e=this,r=this._grid;o._grid=r;o._rng.row=r._rowInfo.length;0==o.columns.length?r._rowInfo.push(o):o.columns.forEach((function(o){e._addRowGroup(o)}));o._rng.row2=r._rowInfo.length-1};return _RowGroupHandler}();exports._RowGroupHandler=_RowGroupHandler;var _RowGroup=function(o){__extends(_RowGroup,o);function _RowGroup(e,r){var t=o.call(this)||this;t._rng=new wijmo_grid_1.CellRange(-1,0);t._cols=[];t._lvl=0;t._collapsed=!1;t._pGrp=r;t._lvl=0;for(var n=r;n;n=n._pGrp)t._lvl++;r&&r.columns.indexOf(t)<0&&r.columns.push(t);t._rng.col=t._rng.col2=t._lvl;t.allowDragging=!1;wijmo_1.copy(t,e);return t}Object.defineProperty(_RowGroup.prototype,"columns",{get:function(){return this._cols},set:function(o){var e=this,r=this._cols=[];o.forEach((function(o){var t=new _RowGroup(o,e);r.indexOf(t)<0&&r.push(t)}))},enumerable:!0,configurable:!0});Object.defineProperty(_RowGroup.prototype,"rows",{get:function(){return this._cols},enumerable:!0,configurable:!0});Object.defineProperty(_RowGroup.prototype,"isEmpty",{get:function(){return 0===this._cols.length},enumerable:!0,configurable:!0});Object.defineProperty(_RowGroup.prototype,"height",{get:function(){return this._height},set:function(o){this._height=o},enumerable:!0,configurable:!0});Object.defineProperty(_RowGroup.prototype,"level",{get:function(){for(var o=this,e=0;o._pGrp;){o=o._pGrp;e++}return e},enumerable:!0,configurable:!0});Object.defineProperty(_RowGroup.prototype,"collapseTo",{get:function(){return this._collTo},set:function(o){wijmo_1.assert(wijmo_1.isArray(o)||wijmo_1.isString(o),"collapseTo should be an array or a string.");this._collTo=o},enumerable:!0,configurable:!0});Object.defineProperty(_RowGroup.prototype,"isCollapsed",{get:function(){return this._collapsed},set:function(o){var e=this;if(o!=this._collapsed){var r=this._grid;if(r){var t=new wijmo_grid_1.CellRangeEventArgs(r.rowHeaders,this._rng,this);if(r.onColumnGroupCollapsedChanging(t)){this._collapsed=wijmo_1.asBoolean(o);r.onColumnGroupCollapsedChanged(t)}}else this._collapsed=wijmo_1.asBoolean(o)}setTimeout((function(){e._updateCollapsedState()}))},enumerable:!0,configurable:!0});_RowGroup.prototype._copy=function(o,e){if(/rows|columns/.test(o)){var r=wijmo_1.asArray(e);this.columns=r;return!0}return!1};_RowGroup.prototype._updateCollapsedState=function(){var o=this._grid._rowInfo,e=this._rng,r=this._collapsed;this._cols.forEach((function(o){if(o instanceof _RowGroup){o._collapsed=r;o._updateCollapsedState()}}));for(var t=this._getCollapseToIndices(),n=e.topRow;n<=e.bottomRow;n++)o[n].visible=!r||t.indexOf(n)>-1};_RowGroup.prototype._getMaxLevel=function(){var o=this._lvl;this.columns.forEach((function(e){o=Math.max(o,e._getMaxLevel())}));return o};_RowGroup.prototype._expandRange=function(o){var e=o-this._getMaxLevel();if(e>0){this._rng.col2+=e;this._cols.forEach((function(o){o._shiftRange(e)}))}for(var r=this._grid._rowInfo,t=this._rng,n=t.row;n<=t.row2;n++){r[n]._rng.col2=o}};_RowGroup.prototype._shiftRange=function(o){this._rng.col+=o;this._rng.col2+=o;this._cols.forEach((function(e){e._shiftRange(o)}))};_RowGroup.prototype._getCollapseToBindings=function(){var o=this.collapseTo;return wijmo_1.isString(o)?[o]:o};_RowGroup.prototype._getCollapseToIndices=function(){var o=this._grid,e=this._rng,r=this._getCollapseToBindings();if(r&&r.length){for(var t=[],n=o._rowInfo,i=0;i<r.length;i++)switch(r[i]){case"$first":t.push(e.topRow);break;case"$last":t.push(e.bottomRow);break;default:var s=n.indexOf(r[i]);s>-1&&t.push(s)}if(t.length)return t}return[e.bottomRow]};return _RowGroup}(wijmo_grid_1.Column);exports._RowGroup=_RowGroup;wijmo_1._registerModule("wijmo.grid.transposed",selfModule);
package/package.json ADDED
@@ -0,0 +1,45 @@
1
+ {
2
+ "name": "@mescius/wijmo.grid.transposed",
3
+ "version": "5.20232.939",
4
+ "description": "UI library for pure JS, Angular, React, Vue and more...",
5
+ "author": "MESCIUS inc",
6
+ "license": "Commercial",
7
+ "main": "./index.js",
8
+ "types": "./index.d.ts",
9
+ "dependencies": {
10
+ "@mescius/wijmo": "5.20232.939",
11
+ "@mescius/wijmo.grid": "5.20232.939"
12
+ },
13
+ "homepage": "https://developer.mescius.com/wijmo",
14
+ "bugs": {
15
+ "url": "https://developer.mescius.com/forums/wijmo"
16
+ },
17
+ "keywords": [
18
+ "control",
19
+ "component",
20
+ "ui",
21
+ "control library",
22
+ "component library",
23
+ "ui library",
24
+ "control-library",
25
+ "component-library",
26
+ "ui-library",
27
+ "grid",
28
+ "data grid",
29
+ "data-grid",
30
+ "datagrid",
31
+ "angular grid",
32
+ "react grid",
33
+ "vue grid",
34
+ "angular-grid",
35
+ "react-grid",
36
+ "vue-grid"
37
+ ],
38
+ "module": "./es5-esm.js",
39
+ "esm5": "./es5-esm.js",
40
+ "wj-esm5": "./es5-esm.js",
41
+ "es2015Cjs": "./es2015-commonjs.js",
42
+ "wj-es2015Cjs": "./es2015-commonjs.js",
43
+ "esm2015": "./es2015-esm.js",
44
+ "wj-esm2015": "./es2015-esm.js"
45
+ }