@wcardinal/wcardinal-ui 0.413.0 → 0.415.0

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 (43) hide show
  1. package/dist/types/wcardinal/ui/d-select.d.ts +1 -1
  2. package/dist/types/wcardinal/ui/d-table-category-cell.d.ts +3 -20
  3. package/dist/types/wcardinal/ui/d-table-category-column-impl.d.ts +1 -2
  4. package/dist/types/wcardinal/ui/d-table-category-container-impl.d.ts +1 -1
  5. package/dist/types/wcardinal/ui/d-table-cell-edge.d.ts +69 -0
  6. package/dist/types/wcardinal/ui/d-table-column-impl.d.ts +2 -0
  7. package/dist/types/wcardinal/ui/d-table-column.d.ts +2 -0
  8. package/dist/types/wcardinal/ui/d-table-data.d.ts +3 -3
  9. package/dist/types/wcardinal/ui/d-table-header-cell.d.ts +3 -19
  10. package/dist/types/wcardinal/ui/d-tree-data.d.ts +1 -1
  11. package/dist/wcardinal/ui/d-select.js.map +1 -1
  12. package/dist/wcardinal/ui/d-table-category-cell.js +5 -207
  13. package/dist/wcardinal/ui/d-table-category-cell.js.map +1 -1
  14. package/dist/wcardinal/ui/d-table-category-column-impl.js +19 -34
  15. package/dist/wcardinal/ui/d-table-category-column-impl.js.map +1 -1
  16. package/dist/wcardinal/ui/d-table-category-container-impl.js +14 -7
  17. package/dist/wcardinal/ui/d-table-category-container-impl.js.map +1 -1
  18. package/dist/wcardinal/ui/d-table-cell-edge.js +557 -0
  19. package/dist/wcardinal/ui/d-table-cell-edge.js.map +1 -0
  20. package/dist/wcardinal/ui/d-table-column-impl.js +2 -0
  21. package/dist/wcardinal/ui/d-table-column-impl.js.map +1 -1
  22. package/dist/wcardinal/ui/d-table-column.js.map +1 -1
  23. package/dist/wcardinal/ui/d-table-data.js.map +1 -1
  24. package/dist/wcardinal/ui/d-table-header-cell.js +6 -200
  25. package/dist/wcardinal/ui/d-table-header-cell.js.map +1 -1
  26. package/dist/wcardinal/ui/d-tree-data.js.map +1 -1
  27. package/dist/wcardinal-ui-theme-dark-en-us.js +1 -1
  28. package/dist/wcardinal-ui-theme-dark-en-us.min.js +1 -1
  29. package/dist/wcardinal-ui-theme-dark-ja-jp.js +1 -1
  30. package/dist/wcardinal-ui-theme-dark-ja-jp.min.js +1 -1
  31. package/dist/wcardinal-ui-theme-dark.js +1 -1
  32. package/dist/wcardinal-ui-theme-dark.min.js +1 -1
  33. package/dist/wcardinal-ui-theme-white-en-us.js +1 -1
  34. package/dist/wcardinal-ui-theme-white-en-us.min.js +1 -1
  35. package/dist/wcardinal-ui-theme-white-ja-jp.js +1 -1
  36. package/dist/wcardinal-ui-theme-white-ja-jp.min.js +1 -1
  37. package/dist/wcardinal-ui-theme-white.js +1 -1
  38. package/dist/wcardinal-ui-theme-white.min.js +1 -1
  39. package/dist/wcardinal-ui.cjs.js +558 -407
  40. package/dist/wcardinal-ui.js +558 -407
  41. package/dist/wcardinal-ui.min.js +2 -2
  42. package/dist/wcardinal-ui.min.js.map +1 -1
  43. package/package.json +2 -2
@@ -1,5 +1,5 @@
1
1
  /*
2
- Winter Cardinal UI v0.413.0
2
+ Winter Cardinal UI v0.415.0
3
3
  Copyright (C) 2019 Toshiba Corporation
4
4
  SPDX-License-Identifier: Apache-2.0
5
5
 
@@ -95024,249 +95024,602 @@ var DTableBody = /** @class */ (function (_super) {
95024
95024
  * Copyright (C) 2019 Toshiba Corporation
95025
95025
  * SPDX-License-Identifier: Apache-2.0
95026
95026
  */
95027
- var DTableCategoryCellEdge = {
95027
+ var DTableCellEdgeHovered = {
95028
95028
  NONE: 0,
95029
95029
  LEFT: 1,
95030
95030
  RIGHT: 2,
95031
95031
  BOTH: 3
95032
95032
  };
95033
- var DTableCategoryCell = /** @class */ (function (_super) {
95034
- __extends(DTableCategoryCell, _super);
95035
- function DTableCategoryCell(category, columnIndex, column, options) {
95036
- var _this = _super.call(this, options) || this;
95037
- _this._category = category;
95038
- _this._columnIndex = columnIndex;
95039
- _this._column = column;
95040
- _this._edgeSize = _this.theme.getEdgeWidth();
95041
- _this._wasResizing = false;
95042
- return _this;
95033
+ var DTableCellEdge = /** @class */ (function () {
95034
+ function DTableCellEdge(row, cell, columnIndex, size) {
95035
+ this._row = row;
95036
+ this._cell = cell;
95037
+ this._columnIndex = columnIndex;
95038
+ this._size = size;
95039
+ this._dragged = false;
95040
+ this._minWidth = 8;
95043
95041
  }
95044
- Object.defineProperty(DTableCategoryCell.prototype, "column", {
95045
- get: function () {
95046
- return this._column;
95047
- },
95048
- enumerable: false,
95049
- configurable: true
95050
- });
95051
- Object.defineProperty(DTableCategoryCell.prototype, "columnIndex", {
95052
- get: function () {
95053
- return this._columnIndex;
95054
- },
95055
- enumerable: false,
95056
- configurable: true
95057
- });
95058
- Object.defineProperty(DTableCategoryCell.prototype, "category", {
95059
- get: function () {
95060
- return this._category;
95061
- },
95062
- enumerable: false,
95063
- configurable: true
95064
- });
95065
- DTableCategoryCell.prototype.onDown = function (e) {
95066
- var edges = this.state.valueOf(DTableState.HOVERED_ON_EDGE);
95067
- if (edges != null) {
95068
- this._wasResizing = true;
95069
- var layer = DApplications.getLayer(this);
95070
- if (layer != null) {
95071
- var interactionManager = layer.renderer.plugins.interaction;
95072
- var columnIndex = this._columnIndex;
95073
- if (edges === DTableCategoryCellEdge.LEFT) {
95074
- this.onDownEdge(e.data.global.x, columnIndex - 1, interactionManager);
95075
- }
95076
- else {
95077
- this.onDownEdge(e.data.global.x, columnIndex, interactionManager);
95042
+ DTableCellEdge.prototype.findResizableCell = function (columnIndex, direction, weight) {
95043
+ var children = this._row.children;
95044
+ var childrenLength = children.length;
95045
+ if (direction) {
95046
+ for (var i = columnIndex; i < childrenLength; ++i) {
95047
+ var child = children[childrenLength - i - 1];
95048
+ var childColumn = child.column;
95049
+ if (childColumn.resizable) {
95050
+ if (weight == null) {
95051
+ return child;
95052
+ }
95053
+ else if (weight === true) {
95054
+ if (childColumn.weight != null) {
95055
+ return child;
95056
+ }
95057
+ }
95058
+ else {
95059
+ if (childColumn.weight == null) {
95060
+ return child;
95061
+ }
95062
+ }
95078
95063
  }
95079
95064
  }
95080
95065
  }
95081
95066
  else {
95082
- this._wasResizing = false;
95083
- _super.prototype.onDown.call(this, e);
95084
- }
95085
- };
95086
- DTableCategoryCell.prototype.findLeftResizableCell = function (columnIndex) {
95087
- var children = this._category.children;
95088
- var childrenLength = children.length;
95089
- for (var i = columnIndex; 0 <= i; --i) {
95090
- var child = children[childrenLength - i - 1];
95091
- if (child.column.resizable) {
95092
- return child;
95067
+ for (var i = columnIndex; 0 <= i; --i) {
95068
+ var child = children[childrenLength - i - 1];
95069
+ var childColumn = child.column;
95070
+ if (childColumn.resizable) {
95071
+ if (weight == null) {
95072
+ return child;
95073
+ }
95074
+ else if (weight === true) {
95075
+ if (childColumn.weight != null) {
95076
+ return child;
95077
+ }
95078
+ }
95079
+ else {
95080
+ if (childColumn.weight == null) {
95081
+ return child;
95082
+ }
95083
+ }
95084
+ }
95093
95085
  }
95094
95086
  }
95095
95087
  return null;
95096
95088
  };
95097
- DTableCategoryCell.prototype.findRightResizableCellOfWeight = function (columnIndex) {
95098
- var children = this._category.children;
95089
+ DTableCellEdge.prototype.findCells = function (columnIndex, direction, weight) {
95090
+ var result = [];
95091
+ var children = this._row.children;
95099
95092
  var childrenLength = children.length;
95100
- for (var i = columnIndex + 1; i < childrenLength; ++i) {
95101
- var child = children[childrenLength - i - 1];
95102
- var childColumn = child.column;
95103
- if (childColumn.resizable) {
95104
- var childColumnWeight = childColumn.weight;
95105
- if (childColumnWeight != null) {
95106
- return child;
95093
+ if (direction) {
95094
+ for (var i = columnIndex; i < childrenLength; ++i) {
95095
+ var child = children[childrenLength - i - 1];
95096
+ if (weight) {
95097
+ if (child.column.weight != null) {
95098
+ result.push(child);
95099
+ }
95100
+ }
95101
+ else {
95102
+ if (child.column.weight == null) {
95103
+ result.push(child);
95104
+ }
95107
95105
  }
95108
95106
  }
95109
95107
  }
95110
- return null;
95111
- };
95112
- DTableCategoryCell.prototype.checkIfEdgeResizable = function (columnIndex) {
95113
- var target = this.findLeftResizableCell(columnIndex);
95114
- if (target != null) {
95115
- if (target.column.weight != null) {
95116
- return this.findRightResizableCellOfWeight(target.columnIndex) != null;
95117
- }
95118
- else {
95119
- return true;
95108
+ else {
95109
+ for (var i = columnIndex; 0 <= i; --i) {
95110
+ var child = children[childrenLength - i - 1];
95111
+ if (weight) {
95112
+ if (child.column.weight != null) {
95113
+ result.push(child);
95114
+ }
95115
+ }
95116
+ else {
95117
+ if (child.column.weight == null) {
95118
+ result.push(child);
95119
+ }
95120
+ }
95120
95121
  }
95121
95122
  }
95122
- return false;
95123
+ return result;
95123
95124
  };
95124
- DTableCategoryCell.prototype.getResizableEdges = function () {
95125
- var result = this._resizableEdges;
95126
- if (result == null) {
95127
- var columnIndex = this._columnIndex;
95128
- if (this.checkIfEdgeResizable(columnIndex - 1)) {
95129
- if (this.checkIfEdgeResizable(columnIndex)) {
95130
- result = DTableCategoryCellEdge.BOTH;
95125
+ DTableCellEdge.prototype.calcData = function (columnIndex) {
95126
+ var left = this.findResizableCell(columnIndex, false, null);
95127
+ if (left != null) {
95128
+ var leftColumn = left.column;
95129
+ var right = this.findResizableCell(columnIndex + 1, true, null);
95130
+ if (right != null) {
95131
+ var rightColumn = right.column;
95132
+ if (leftColumn.weight == null) {
95133
+ if (rightColumn.weight == null) {
95134
+ // Width - Width
95135
+ return [1, left, right];
95136
+ }
95137
+ else {
95138
+ // Width - Weight
95139
+ var others = this.findCells(0, true, true);
95140
+ return [2, left, right, others];
95141
+ }
95131
95142
  }
95132
95143
  else {
95133
- result = DTableCategoryCellEdge.LEFT;
95144
+ if (rightColumn.weight == null) {
95145
+ // Weight - Width
95146
+ var others = this.findCells(0, true, true);
95147
+ return [3, left, right, others];
95148
+ }
95149
+ else {
95150
+ // Weight - Weight
95151
+ return [1, left, right];
95152
+ }
95134
95153
  }
95135
95154
  }
95136
95155
  else {
95137
- if (this.checkIfEdgeResizable(columnIndex)) {
95138
- result = DTableCategoryCellEdge.RIGHT;
95156
+ if (leftColumn.weight == null) {
95157
+ // Width
95158
+ var ls = this.findCells(left.columnIndex - 1, false, true);
95159
+ if (ls.length <= 0) {
95160
+ return [0, left];
95161
+ }
95162
+ // Not resizable
95163
+ return null;
95139
95164
  }
95140
95165
  else {
95141
- result = DTableCategoryCellEdge.NONE;
95166
+ // Not resizable
95167
+ return null;
95142
95168
  }
95143
95169
  }
95144
- this._resizableEdges = result;
95145
95170
  }
95146
- return result;
95171
+ // Not resizable
95172
+ return null;
95147
95173
  };
95148
- DTableCategoryCell.prototype.onOver = function (e) {
95174
+ Object.defineProperty(DTableCellEdge.prototype, "left", {
95175
+ get: function () {
95176
+ var result = this._left;
95177
+ if (result === undefined) {
95178
+ result = this.calcData(this._columnIndex - 1);
95179
+ this._left = result;
95180
+ }
95181
+ return result;
95182
+ },
95183
+ enumerable: false,
95184
+ configurable: true
95185
+ });
95186
+ Object.defineProperty(DTableCellEdge.prototype, "right", {
95187
+ get: function () {
95188
+ var result = this._right;
95189
+ if (result === undefined) {
95190
+ result = this.calcData(this._columnIndex);
95191
+ this._right = result;
95192
+ }
95193
+ return result;
95194
+ },
95195
+ enumerable: false,
95196
+ configurable: true
95197
+ });
95198
+ DTableCellEdge.prototype.onDown = function (e) {
95199
+ var cell = this._cell;
95200
+ var hoveredOnEdge = cell.state.valueOf(DTableState.HOVERED_ON_EDGE);
95201
+ if (hoveredOnEdge != null) {
95202
+ this._dragged = true;
95203
+ var layer = DApplications.getLayer(cell);
95204
+ if (layer != null) {
95205
+ var interactionManager = layer.renderer.plugins.interaction;
95206
+ if (hoveredOnEdge === DTableCellEdgeHovered.LEFT) {
95207
+ var left = this.left;
95208
+ if (left != null) {
95209
+ this.onDown_(e.data.global.x, left, interactionManager);
95210
+ }
95211
+ }
95212
+ else {
95213
+ var right = this.right;
95214
+ if (right != null) {
95215
+ this.onDown_(e.data.global.x, right, interactionManager);
95216
+ }
95217
+ }
95218
+ }
95219
+ return true;
95220
+ }
95221
+ else {
95222
+ this._dragged = false;
95223
+ return false;
95224
+ }
95225
+ };
95226
+ DTableCellEdge.prototype.onDown_ = function (onDownPoint, data, interactionManager) {
95227
+ switch (data[0]) {
95228
+ case 0:
95229
+ this.onDown0(onDownPoint, data, interactionManager);
95230
+ break;
95231
+ case 1:
95232
+ this.onDown1(onDownPoint, data, interactionManager);
95233
+ break;
95234
+ case 2:
95235
+ this.onDown2(onDownPoint, data, interactionManager);
95236
+ break;
95237
+ case 3:
95238
+ this.onDown3(onDownPoint, data, interactionManager);
95239
+ break;
95240
+ }
95241
+ };
95242
+ DTableCellEdge.prototype.onOver = function (e) {
95149
95243
  var _this = this;
95150
95244
  var _a;
95151
- _super.prototype.onOver.call(this, e);
95152
- if (this.getResizableEdges() !== DTableCategoryCellEdge.NONE) {
95245
+ if (this.left != null || this.right != null) {
95153
95246
  var onHoveredBound = ((_a = this._onHoveredBound) !== null && _a !== void 0 ? _a : (this._onHoveredBound = function (event) {
95154
95247
  _this.onHovered(event);
95155
95248
  }));
95156
- this.on(UtilPointerEvent.move, onHoveredBound);
95249
+ var cell = this._cell;
95250
+ cell.off(UtilPointerEvent.move, onHoveredBound);
95251
+ cell.on(UtilPointerEvent.move, onHoveredBound);
95157
95252
  // Since the cursor is set by InteractionManager before this method is called,
95158
95253
  // the cursor need to be overriden.
95159
95254
  this.onHovered(e);
95160
- var layer = DApplications.getLayer(this);
95255
+ var layer = DApplications.getLayer(cell);
95161
95256
  if (layer != null) {
95162
- layer.renderer.plugins.interaction.cursor = this.cursor;
95257
+ layer.renderer.plugins.interaction.cursor = cell.cursor;
95163
95258
  }
95164
95259
  }
95165
95260
  };
95166
- DTableCategoryCell.prototype.onOut = function (e) {
95167
- _super.prototype.onOut.call(this, e);
95261
+ DTableCellEdge.prototype.onOut = function (e) {
95168
95262
  var onHoveredBound = this._onHoveredBound;
95169
95263
  if (onHoveredBound != null) {
95170
- this.state.remove(DTableState.HOVERED_ON_EDGE);
95171
- this.off(UtilPointerEvent.move, onHoveredBound);
95264
+ var cell = this._cell;
95265
+ cell.state.remove(DTableState.HOVERED_ON_EDGE);
95266
+ cell.off(UtilPointerEvent.move, onHoveredBound);
95172
95267
  }
95173
95268
  };
95174
- DTableCategoryCell.prototype.onHovered = function (e) {
95175
- var width = this.width;
95176
- var x = this.toClickPosition(e);
95177
- var edgeSize = this._edgeSize;
95178
- if (0 <= x && x <= edgeSize) {
95179
- if (this.getResizableEdges() & DTableCategoryCellEdge.LEFT) {
95180
- this.state.add(DTableState.HOVERED_ON_EDGE, DTableCategoryCellEdge.LEFT);
95269
+ DTableCellEdge.prototype.onHovered = function (e) {
95270
+ var cell = this._cell;
95271
+ var width = cell.width;
95272
+ var x = this.toX(e);
95273
+ var size = this._size;
95274
+ var onLeft = 0 <= x && x <= size;
95275
+ var onRight = width - size <= x && x <= width;
95276
+ if (onLeft && onRight) {
95277
+ if (x <= width - x) {
95278
+ onRight = false;
95279
+ }
95280
+ else {
95281
+ onLeft = false;
95282
+ }
95283
+ }
95284
+ if (onLeft) {
95285
+ if (this.left != null) {
95286
+ cell.state.add(DTableState.HOVERED_ON_EDGE, DTableCellEdgeHovered.LEFT);
95181
95287
  }
95182
95288
  else {
95183
- this.state.remove(DTableState.HOVERED_ON_EDGE);
95289
+ cell.state.remove(DTableState.HOVERED_ON_EDGE);
95184
95290
  }
95185
95291
  }
95186
- else if (width - edgeSize <= x && x <= width) {
95187
- if (this.getResizableEdges() & DTableCategoryCellEdge.RIGHT) {
95188
- this.state.add(DTableState.HOVERED_ON_EDGE, DTableCategoryCellEdge.RIGHT);
95292
+ else if (onRight) {
95293
+ if (this.right != null) {
95294
+ cell.state.add(DTableState.HOVERED_ON_EDGE, DTableCellEdgeHovered.RIGHT);
95189
95295
  }
95190
95296
  else {
95191
- this.state.remove(DTableState.HOVERED_ON_EDGE);
95297
+ cell.state.remove(DTableState.HOVERED_ON_EDGE);
95192
95298
  }
95193
95299
  }
95194
95300
  else {
95195
- this.state.remove(DTableState.HOVERED_ON_EDGE);
95301
+ cell.state.remove(DTableState.HOVERED_ON_EDGE);
95196
95302
  }
95197
95303
  };
95198
- DTableCategoryCell.prototype.toClickPosition = function (e) {
95304
+ DTableCellEdge.prototype.toX = function (e) {
95199
95305
  var _a;
95200
95306
  var checkWork = ((_a = this._checkWork) !== null && _a !== void 0 ? _a : (this._checkWork = new pixi_js.Point()));
95201
- return e.data.getLocalPosition(this, checkWork).x;
95307
+ return this._cell.toLocal(e.data.global, undefined, checkWork, true).x;
95202
95308
  };
95203
- DTableCategoryCell.prototype.onDownEdge = function (onDownPoint, columnIndex, interactionManager) {
95204
- // Find the resizable cell
95205
- var left = this.findLeftResizableCell(columnIndex);
95206
- if (left == null) {
95207
- // No resizable cell
95208
- return;
95209
- }
95210
- var category = this._category;
95309
+ DTableCellEdge.prototype.onDown0 = function (onDownPoint, data, interactionManager) {
95310
+ var left = data[1];
95311
+ var leftColumn = left.column;
95312
+ var leftOldWidth = left.width;
95313
+ var leftMinWidth = Math.max(this._minWidth, leftColumn.minWidth);
95314
+ var onMove = function (e) {
95315
+ leftColumn.width = Math.max(leftMinWidth, leftOldWidth + e.data.global.x - onDownPoint);
95316
+ };
95317
+ this.newOnUp(onMove, interactionManager);
95318
+ };
95319
+ DTableCellEdge.prototype.onDown1 = function (onDownPoint, data, interactionManager) {
95320
+ var minWidth = this._minWidth;
95321
+ var left = data[1];
95211
95322
  var leftColumn = left.column;
95212
95323
  var leftOldWidth = left.width;
95213
- var leftOldWeight = left.weight;
95324
+ var right = data[2];
95325
+ var rightColumn = right.column;
95326
+ var rightOldWidth = right.width;
95327
+ var totalWidth = leftOldWidth + rightOldWidth;
95214
95328
  if (leftColumn.weight == null) {
95215
- category.state.add(DTableState.RESIZING);
95216
- var leftMinWidth_1 = leftColumn.minWidth;
95217
- var onMove_1 = function (e) {
95218
- leftColumn.width = Math.max(leftMinWidth_1, leftOldWidth + e.data.global.x - onDownPoint);
95219
- };
95220
- var onUp_1 = function (e) {
95221
- category.state.remove(DTableState.RESIZING);
95222
- interactionManager.off(UtilPointerEvent.move, onMove_1);
95223
- interactionManager.off(UtilPointerEvent.up, onUp_1);
95224
- interactionManager.off(UtilPointerEvent.upoutside, onUp_1);
95225
- interactionManager.off(UtilPointerEvent.cancel, onUp_1);
95329
+ var leftMinWidth_1 = Math.max(minWidth, leftColumn.minWidth);
95330
+ var rightMinWidth = Math.max(minWidth, rightColumn.minWidth);
95331
+ var leftMaxWidth_1 = totalWidth - rightMinWidth;
95332
+ if (totalWidth <= 0 || leftMaxWidth_1 <= leftMinWidth_1) {
95333
+ // The left and right resizable cells doesn't have enough width
95334
+ return;
95335
+ }
95336
+ var onMove = function (e) {
95337
+ var leftNewWidth = Math.max(leftMinWidth_1, Math.min(leftMaxWidth_1, leftOldWidth + e.data.global.x - onDownPoint));
95338
+ leftColumn.width = leftNewWidth;
95339
+ rightColumn.width = totalWidth - leftNewWidth;
95226
95340
  };
95227
- interactionManager.on(UtilPointerEvent.move, onMove_1);
95228
- interactionManager.on(UtilPointerEvent.up, onUp_1);
95229
- interactionManager.on(UtilPointerEvent.upoutside, onUp_1);
95230
- interactionManager.on(UtilPointerEvent.cancel, onUp_1);
95341
+ this.newOnUp(onMove, interactionManager);
95231
95342
  }
95232
95343
  else {
95233
- var right = this.findRightResizableCellOfWeight(left.columnIndex);
95234
- if (right == null) {
95235
- // No right resizable cell found
95236
- return;
95237
- }
95238
- var rightColumn_1 = right.column;
95344
+ var leftOldWeight = left.weight;
95239
95345
  var rightOldWeight = right.weight;
95240
- var rightOldWidth = right.width;
95241
- var totalWidth_1 = leftOldWidth + rightOldWidth;
95242
95346
  var totalWeight_1 = leftOldWeight + rightOldWeight;
95243
95347
  var leftMinWeight_1 = leftColumn.minWeight;
95244
- var rightMinWeight = rightColumn_1.minWeight;
95348
+ var rightMinWeight = rightColumn.minWeight;
95245
95349
  var leftMaxWeight_1 = totalWeight_1 - rightMinWeight;
95246
- if (totalWidth_1 <= 0 || leftMaxWeight_1 <= leftMinWeight_1) {
95247
- // The left and right resizable cells doesn't non-zero width
95350
+ var leftMinWidth_2 = minWidth;
95351
+ var rightMinWidth = minWidth;
95352
+ var leftMaxWidth_2 = totalWidth - rightMinWidth;
95353
+ if (totalWidth <= 0 || leftMaxWidth_2 <= leftMinWidth_2 || leftMaxWeight_1 <= leftMinWeight_1) {
95354
+ // The left and right resizable cells doesn't have enough width
95248
95355
  return;
95249
95356
  }
95250
- category.state.add(DTableState.RESIZING);
95251
- var onMove_2 = function (e) {
95252
- var leftNewWidth = Math.max(0, Math.min(totalWidth_1, leftOldWidth + e.data.global.x - onDownPoint));
95253
- var leftNewWeight = Math.max(leftMinWeight_1, Math.min(leftMaxWeight_1, totalWeight_1 * (leftNewWidth / totalWidth_1)));
95357
+ var onMove = function (e) {
95358
+ var leftNewWidth = Math.max(leftMinWidth_2, Math.min(leftMaxWidth_2, leftOldWidth + e.data.global.x - onDownPoint));
95359
+ var leftNewWeight = Math.max(leftMinWeight_1, Math.min(leftMaxWeight_1, totalWeight_1 * (leftNewWidth / totalWidth)));
95254
95360
  leftColumn.weight = leftNewWeight;
95255
- rightColumn_1.weight = totalWeight_1 - leftNewWeight;
95361
+ rightColumn.weight = totalWeight_1 - leftNewWeight;
95362
+ };
95363
+ this.newOnUp(onMove, interactionManager);
95364
+ }
95365
+ };
95366
+ DTableCellEdge.prototype.onDown2 = function (onDownPoint, data, interactionManager) {
95367
+ if (data[3].length <= 1) {
95368
+ this.onDown2a(onDownPoint, data, interactionManager);
95369
+ }
95370
+ else {
95371
+ this.onDown2b(onDownPoint, data, interactionManager);
95372
+ }
95373
+ };
95374
+ DTableCellEdge.prototype.onDown2a = function (onDownPoint, data, interactionManager) {
95375
+ var minWidth = this._minWidth;
95376
+ var left = data[1];
95377
+ var leftColumn = left.column;
95378
+ var leftOldWidth = left.width;
95379
+ var leftMinWidth = Math.max(minWidth, leftColumn.minWidth);
95380
+ var right = data[2];
95381
+ var rightOldWidth = right.width;
95382
+ var rightMinWidth = minWidth;
95383
+ var totalWidth = leftOldWidth + rightOldWidth;
95384
+ var leftMaxWidth = totalWidth - rightMinWidth;
95385
+ if (totalWidth <= 0 || leftMaxWidth <= leftMinWidth) {
95386
+ // The left and right resizable cells doesn't have enough width
95387
+ return;
95388
+ }
95389
+ var onMove = function (e) {
95390
+ leftColumn.width = Math.max(leftMinWidth, Math.min(leftMaxWidth, leftOldWidth + e.data.global.x - onDownPoint));
95391
+ };
95392
+ this.newOnUp(onMove, interactionManager);
95393
+ };
95394
+ DTableCellEdge.prototype.onDown2b = function (onDownPoint, data, interactionManager) {
95395
+ var minWidth = this._minWidth;
95396
+ var left = data[1];
95397
+ var leftColumn = left.column;
95398
+ var leftOldWidth = left.width;
95399
+ var leftMinWidth = Math.max(minWidth, leftColumn.minWidth);
95400
+ var right = data[2];
95401
+ var rightColumn = right.column;
95402
+ var rightOldWidth = right.width;
95403
+ var rightMinWeight = rightColumn.minWeight;
95404
+ var totalWidth = leftOldWidth + rightOldWidth;
95405
+ var others = data[3];
95406
+ var totalWeight = 0;
95407
+ var totalSpace = 0;
95408
+ for (var i = 0, imax = others.length; i < imax; ++i) {
95409
+ var other = others[i];
95410
+ totalWeight += other.weight;
95411
+ totalSpace += other.width;
95412
+ }
95413
+ if (totalWeight <= 0 || totalSpace <= 0) {
95414
+ var rightMinWidth = minWidth;
95415
+ var leftMaxWidth_3 = totalWidth - rightMinWidth;
95416
+ if (totalWidth <= 0 || leftMaxWidth_3 <= leftMinWidth) {
95417
+ // The left and right resizable cells doesn't have enough width
95418
+ return;
95419
+ }
95420
+ if (totalWeight <= 0) {
95421
+ totalWeight = 0;
95422
+ for (var i = 0, imax = others.length; i < imax; ++i) {
95423
+ var other = others[i];
95424
+ var otherColumn = other.column;
95425
+ if (other !== right) {
95426
+ var otherNewWeight = otherColumn.minWeight;
95427
+ otherColumn.weight = otherNewWeight;
95428
+ totalWeight += otherNewWeight;
95429
+ }
95430
+ else {
95431
+ var rightNewWeight = Math.max(1, rightMinWeight);
95432
+ otherColumn.weight = rightNewWeight;
95433
+ totalWeight += rightNewWeight;
95434
+ }
95435
+ }
95436
+ }
95437
+ var onMove = function (e) {
95438
+ leftColumn.width = Math.max(leftMinWidth, Math.min(leftMaxWidth_3, leftOldWidth + e.data.global.x - onDownPoint));
95439
+ };
95440
+ this.newOnUp(onMove, interactionManager);
95441
+ }
95442
+ else {
95443
+ var rightMinWidth = Math.max(minWidth, totalSpace * (rightMinWeight / totalWeight));
95444
+ var leftMaxWidth_4 = totalWidth - rightMinWidth;
95445
+ if (totalWidth <= 0 || leftMaxWidth_4 <= leftMinWidth) {
95446
+ // The left and right resizable cells doesn't have enough width
95447
+ return;
95448
+ }
95449
+ var onMove = function (e) {
95450
+ var leftNewWidth = Math.max(leftMinWidth, Math.min(leftMaxWidth_4, leftOldWidth + e.data.global.x - onDownPoint));
95451
+ var rightNewWidth = totalWidth - leftNewWidth;
95452
+ var rightNewWeight = Math.max(rightMinWeight, totalWeight * (rightNewWidth / totalSpace));
95453
+ leftColumn.width = leftNewWidth;
95454
+ rightColumn.weight = rightNewWeight;
95455
+ };
95456
+ this.newOnUp(onMove, interactionManager);
95457
+ }
95458
+ };
95459
+ DTableCellEdge.prototype.onDown3 = function (onDownPoint, data, interactionManager) {
95460
+ if (data[3].length <= 1) {
95461
+ this.onDown3a(onDownPoint, data, interactionManager);
95462
+ }
95463
+ else {
95464
+ this.onDown3b(onDownPoint, data, interactionManager);
95465
+ }
95466
+ };
95467
+ DTableCellEdge.prototype.onDown3a = function (onDownPoint, data, interactionManager) {
95468
+ var minWidth = this._minWidth;
95469
+ var left = data[1];
95470
+ var leftOldWidth = left.width;
95471
+ var leftMinWidth = minWidth;
95472
+ var right = data[2];
95473
+ var rightColumn = right.column;
95474
+ var rightOldWidth = right.width;
95475
+ var rightMinWidth = Math.max(minWidth, rightColumn.minWidth);
95476
+ var totalWidth = leftOldWidth + rightOldWidth;
95477
+ var rightMaxWidth = totalWidth - leftMinWidth;
95478
+ if (totalWidth <= 0 || rightMaxWidth <= rightMinWidth) {
95479
+ // The left and right resizable cells doesn't have enough width
95480
+ return;
95481
+ }
95482
+ var onMove = function (e) {
95483
+ rightColumn.width = Math.max(rightMinWidth, Math.min(rightMaxWidth, rightOldWidth + onDownPoint - e.data.global.x));
95484
+ };
95485
+ this.newOnUp(onMove, interactionManager);
95486
+ };
95487
+ DTableCellEdge.prototype.onDown3b = function (onDownPoint, data, interactionManager) {
95488
+ var minWidth = this._minWidth;
95489
+ var left = data[1];
95490
+ var leftColumn = left.column;
95491
+ var leftOldWidth = left.width;
95492
+ var leftMinWeight = leftColumn.minWeight;
95493
+ var right = data[2];
95494
+ var rightColumn = right.column;
95495
+ var rightOldWidth = right.width;
95496
+ var rightMinWidth = Math.max(minWidth, rightColumn.minWidth);
95497
+ var totalWidth = leftOldWidth + rightOldWidth;
95498
+ var others = data[3];
95499
+ var totalWeight = 0;
95500
+ var totalSpace = 0;
95501
+ for (var i = 0, imax = others.length; i < imax; ++i) {
95502
+ var other = others[i];
95503
+ totalWeight += other.weight;
95504
+ totalSpace += other.width;
95505
+ }
95506
+ if (totalWeight <= 0 || totalSpace <= 0) {
95507
+ var leftMinWidth = minWidth;
95508
+ var rightMaxWidth_1 = totalWidth - leftMinWidth;
95509
+ if (totalWidth <= 0 || rightMaxWidth_1 <= rightMinWidth) {
95510
+ // The left and right resizable cells doesn't have enough width
95511
+ return;
95512
+ }
95513
+ if (totalWeight <= 0) {
95514
+ totalWeight = 0;
95515
+ for (var i = 0, imax = others.length; i < imax; ++i) {
95516
+ var other = others[i];
95517
+ var otherColumn = other.column;
95518
+ if (other !== left) {
95519
+ var otherNewWeight = otherColumn.minWeight;
95520
+ otherColumn.weight = otherNewWeight;
95521
+ totalWeight += otherNewWeight;
95522
+ }
95523
+ else {
95524
+ var leftNewWeight = Math.max(1, leftMinWeight);
95525
+ otherColumn.weight = leftNewWeight;
95526
+ totalWeight += leftNewWeight;
95527
+ }
95528
+ }
95529
+ }
95530
+ var onMove = function (e) {
95531
+ rightColumn.width = Math.max(rightMinWidth, Math.min(rightMaxWidth_1, rightOldWidth + onDownPoint - e.data.global.x));
95256
95532
  };
95257
- var onUp_2 = function (e) {
95258
- category.state.remove(DTableState.RESIZING);
95259
- interactionManager.off(UtilPointerEvent.move, onMove_2);
95260
- interactionManager.off(UtilPointerEvent.up, onUp_2);
95261
- interactionManager.off(UtilPointerEvent.upoutside, onUp_2);
95262
- interactionManager.off(UtilPointerEvent.cancel, onUp_2);
95533
+ this.newOnUp(onMove, interactionManager);
95534
+ }
95535
+ else {
95536
+ var leftMinWidth = Math.max(minWidth, totalSpace * (leftMinWeight / totalWeight));
95537
+ var rightMaxWidth_2 = totalWidth - leftMinWidth;
95538
+ if (totalWidth <= 0 || rightMaxWidth_2 <= rightMinWidth) {
95539
+ // The left and right resizable cells doesn't have enough width
95540
+ return;
95541
+ }
95542
+ var onMove = function (e) {
95543
+ var rightNewWidth = Math.max(rightMinWidth, Math.min(rightMaxWidth_2, rightOldWidth + onDownPoint - e.data.global.x));
95544
+ var leftNewWidth = totalWidth - rightNewWidth;
95545
+ var leftNewWeight = Math.max(leftMinWeight, totalWeight * (leftNewWidth / totalSpace));
95546
+ rightColumn.width = rightNewWidth;
95547
+ leftColumn.weight = leftNewWeight;
95263
95548
  };
95264
- interactionManager.on(UtilPointerEvent.move, onMove_2);
95265
- interactionManager.on(UtilPointerEvent.up, onUp_2);
95266
- interactionManager.on(UtilPointerEvent.upoutside, onUp_2);
95267
- interactionManager.on(UtilPointerEvent.cancel, onUp_2);
95549
+ this.newOnUp(onMove, interactionManager);
95268
95550
  }
95269
95551
  };
95552
+ DTableCellEdge.prototype.newOnUp = function (onMove, interactionManager) {
95553
+ var row = this._row;
95554
+ row.state.add(DTableState.RESIZING);
95555
+ var onUp = function () {
95556
+ row.state.remove(DTableState.RESIZING);
95557
+ interactionManager.off(UtilPointerEvent.move, onMove);
95558
+ interactionManager.off(UtilPointerEvent.up, onUp);
95559
+ interactionManager.off(UtilPointerEvent.upoutside, onUp);
95560
+ interactionManager.off(UtilPointerEvent.cancel, onUp);
95561
+ };
95562
+ interactionManager.on(UtilPointerEvent.move, onMove);
95563
+ interactionManager.on(UtilPointerEvent.up, onUp);
95564
+ interactionManager.on(UtilPointerEvent.upoutside, onUp);
95565
+ interactionManager.on(UtilPointerEvent.cancel, onUp);
95566
+ return onUp;
95567
+ };
95568
+ DTableCellEdge.prototype.isClicked = function (e) {
95569
+ return (e instanceof pixi_js.InteractionEvent &&
95570
+ (this._cell.state.is(DTableState.HOVERED_ON_EDGE) || this._dragged));
95571
+ };
95572
+ return DTableCellEdge;
95573
+ }());
95574
+
95575
+ /*
95576
+ * Copyright (C) 2019 Toshiba Corporation
95577
+ * SPDX-License-Identifier: Apache-2.0
95578
+ */
95579
+ var DTableCategoryCell = /** @class */ (function (_super) {
95580
+ __extends(DTableCategoryCell, _super);
95581
+ function DTableCategoryCell(category, columnIndex, column, options) {
95582
+ var _this = _super.call(this, options) || this;
95583
+ _this._category = category;
95584
+ _this._columnIndex = columnIndex;
95585
+ _this._column = column;
95586
+ _this._edge = new DTableCellEdge(_this._category, _this, columnIndex, _this.theme.getEdgeWidth());
95587
+ return _this;
95588
+ }
95589
+ Object.defineProperty(DTableCategoryCell.prototype, "column", {
95590
+ get: function () {
95591
+ return this._column;
95592
+ },
95593
+ enumerable: false,
95594
+ configurable: true
95595
+ });
95596
+ Object.defineProperty(DTableCategoryCell.prototype, "columnIndex", {
95597
+ get: function () {
95598
+ return this._columnIndex;
95599
+ },
95600
+ enumerable: false,
95601
+ configurable: true
95602
+ });
95603
+ Object.defineProperty(DTableCategoryCell.prototype, "category", {
95604
+ get: function () {
95605
+ return this._category;
95606
+ },
95607
+ enumerable: false,
95608
+ configurable: true
95609
+ });
95610
+ DTableCategoryCell.prototype.onDown = function (e) {
95611
+ if (!this._edge.onDown(e)) {
95612
+ _super.prototype.onDown.call(this, e);
95613
+ }
95614
+ };
95615
+ DTableCategoryCell.prototype.onOver = function (e) {
95616
+ _super.prototype.onOver.call(this, e);
95617
+ this._edge.onOver(e);
95618
+ };
95619
+ DTableCategoryCell.prototype.onOut = function (e) {
95620
+ _super.prototype.onOut.call(this, e);
95621
+ this._edge.onOut(e);
95622
+ };
95270
95623
  DTableCategoryCell.prototype.getType = function () {
95271
95624
  return "DTableCategoryCell";
95272
95625
  };
@@ -95300,7 +95653,7 @@ var DTableCategoryColumnImpl = /** @class */ (function (_super) {
95300
95653
  _this._isLocked = false;
95301
95654
  _this.offset = 0.0;
95302
95655
  _this._columns = [column];
95303
- _this._nresizable = column.resizable ? 1 : 0;
95656
+ _this.resizable = column.resizable;
95304
95657
  var onResizeBound = function () {
95305
95658
  _this.onResize();
95306
95659
  };
@@ -95340,21 +95693,13 @@ var DTableCategoryColumnImpl = /** @class */ (function (_super) {
95340
95693
  }
95341
95694
  }
95342
95695
  };
95343
- Object.defineProperty(DTableCategoryColumnImpl.prototype, "resizable", {
95344
- get: function () {
95345
- return 0 < this._nresizable;
95346
- },
95347
- enumerable: false,
95348
- configurable: true
95349
- });
95350
95696
  Object.defineProperty(DTableCategoryColumnImpl.prototype, "weight", {
95351
95697
  get: function () {
95352
95698
  return this._weight;
95353
95699
  },
95354
95700
  set: function (weight) {
95355
95701
  var oldWeight = this._weight;
95356
- var nresizable = this._nresizable;
95357
- if (0 < nresizable && oldWeight != null && oldWeight !== weight) {
95702
+ if (oldWeight != null && oldWeight !== weight) {
95358
95703
  var columns = this._columns;
95359
95704
  var columnsLength = columns.length;
95360
95705
  var minWeight = this.minWeight;
@@ -95362,22 +95707,22 @@ var DTableCategoryColumnImpl = /** @class */ (function (_super) {
95362
95707
  if (this._weight !== newWeight) {
95363
95708
  this._isLocked = true;
95364
95709
  if (minWeight < oldWeight) {
95365
- var columnWeightRatio = (newWeight - minWeight) / (oldWeight - minWeight);
95710
+ // TODO: IMPROVE THIS
95711
+ var columnWeightRatio = newWeight / oldWeight;
95366
95712
  for (var i = 0; i < columnsLength; ++i) {
95367
95713
  var column = columns[i];
95368
95714
  var columnWeight = column.weight;
95369
- if (column.resizable && columnWeight != null) {
95370
- column.weight = columnWeight * columnWeightRatio;
95715
+ if (columnWeight != null) {
95716
+ column.weight = Math.max(column.minWeight, columnWeight * columnWeightRatio);
95371
95717
  }
95372
95718
  }
95373
95719
  }
95374
95720
  else {
95375
- var newColumnWeight = (newWeight - minWeight) / this._nresizable;
95376
95721
  for (var i = 0; i < columnsLength; ++i) {
95377
95722
  var column = columns[i];
95378
95723
  var columnWeight = column.weight;
95379
- if (column.resizable && columnWeight != null) {
95380
- column.weight = newColumnWeight;
95724
+ if (columnWeight != null) {
95725
+ column.weight = column.minWeight;
95381
95726
  }
95382
95727
  }
95383
95728
  }
@@ -95397,8 +95742,8 @@ var DTableCategoryColumnImpl = /** @class */ (function (_super) {
95397
95742
  for (var i = 0; i < columnsLength; ++i) {
95398
95743
  var column = columns[i];
95399
95744
  var columnWeight = column.weight;
95400
- if (!column.resizable && columnWeight != null) {
95401
- result += columnWeight;
95745
+ if (columnWeight != null) {
95746
+ result += column.minWeight;
95402
95747
  }
95403
95748
  }
95404
95749
  return result;
@@ -95412,8 +95757,7 @@ var DTableCategoryColumnImpl = /** @class */ (function (_super) {
95412
95757
  },
95413
95758
  set: function (width) {
95414
95759
  var oldWidth = this._width;
95415
- var nresizable = this._nresizable;
95416
- if (0 < nresizable && oldWidth != null && oldWidth !== width) {
95760
+ if (oldWidth != null && oldWidth !== width) {
95417
95761
  var columns = this._columns;
95418
95762
  var columnsLength = columns.length;
95419
95763
  var minWidth = this.minWidth;
@@ -95421,22 +95765,22 @@ var DTableCategoryColumnImpl = /** @class */ (function (_super) {
95421
95765
  if (oldWidth !== newWidth) {
95422
95766
  this._isLocked = true;
95423
95767
  if (minWidth < oldWidth) {
95424
- var columnWidthRatio = (newWidth - minWidth) / (oldWidth - minWidth);
95768
+ // TODO: IMPROVE THIS
95769
+ var columnWidthRatio = newWidth / oldWidth;
95425
95770
  for (var i = 0; i < columnsLength; ++i) {
95426
95771
  var column = columns[i];
95427
95772
  var columnWidth = column.width;
95428
- if (column.resizable && columnWidth != null) {
95429
- column.width = columnWidth * columnWidthRatio;
95773
+ if (columnWidth != null) {
95774
+ column.width = Math.max(column.minWidth, columnWidth * columnWidthRatio);
95430
95775
  }
95431
95776
  }
95432
95777
  }
95433
95778
  else {
95434
- var newColumnWidth = (newWidth - minWidth) / this._nresizable;
95435
95779
  for (var i = 0; i < columnsLength; ++i) {
95436
95780
  var column = columns[i];
95437
95781
  var columnWidth = column.width;
95438
- if (column.resizable && columnWidth != null) {
95439
- column.width = newColumnWidth;
95782
+ if (columnWidth != null) {
95783
+ column.width = column.minWidth;
95440
95784
  }
95441
95785
  }
95442
95786
  }
@@ -95456,8 +95800,8 @@ var DTableCategoryColumnImpl = /** @class */ (function (_super) {
95456
95800
  for (var i = 0; i < columnsLength; ++i) {
95457
95801
  var column = columns[i];
95458
95802
  var columnWidth = column.width;
95459
- if (!column.resizable && columnWidth != null) {
95460
- result += columnWidth;
95803
+ if (columnWidth != null) {
95804
+ result += column.minWidth;
95461
95805
  }
95462
95806
  }
95463
95807
  return result;
@@ -95471,9 +95815,6 @@ var DTableCategoryColumnImpl = /** @class */ (function (_super) {
95471
95815
  var weight = column.weight;
95472
95816
  if (weight != null) {
95473
95817
  this._weight += weight;
95474
- if (column.resizable) {
95475
- this._nresizable += 1;
95476
- }
95477
95818
  column.on("resize", this._onResizeBound);
95478
95819
  }
95479
95820
  }
@@ -95481,9 +95822,6 @@ var DTableCategoryColumnImpl = /** @class */ (function (_super) {
95481
95822
  var width = column.width;
95482
95823
  if (width != null) {
95483
95824
  this._width += width;
95484
- if (column.resizable) {
95485
- this._nresizable += 1;
95486
- }
95487
95825
  column.on("resize", this._onResizeBound);
95488
95826
  }
95489
95827
  }
@@ -95612,7 +95950,7 @@ var DTableCategoryContainerImpl = /** @class */ (function () {
95612
95950
  }
95613
95951
  return result;
95614
95952
  };
95615
- DTableCategoryContainerImpl.prototype.isCategory = function (index, a, b) {
95953
+ DTableCategoryContainerImpl.prototype.isEqual = function (index, a, b) {
95616
95954
  if (a != null) {
95617
95955
  if (b != null) {
95618
95956
  if (isString(a)) {
@@ -95710,12 +96048,19 @@ var DTableCategoryContainerImpl = /** @class */ (function () {
95710
96048
  if (i !== frozen &&
95711
96049
  ccolumn &&
95712
96050
  tcolumn &&
95713
- this.isCategory(index, tcolumn.category, column.category)) {
95714
- if (ccolumn.weight != null && column.weight != null) {
95715
- ccolumn.add(column);
95716
- }
95717
- else if (ccolumn.width != null && column.width != null) {
95718
- ccolumn.add(column);
96051
+ this.isEqual(index, tcolumn.category, column.category)) {
96052
+ if (ccolumn.resizable === column.resizable) {
96053
+ if (ccolumn.weight != null && column.weight != null) {
96054
+ ccolumn.add(column);
96055
+ }
96056
+ else if (ccolumn.width != null && column.width != null) {
96057
+ ccolumn.add(column);
96058
+ }
96059
+ else {
96060
+ tcolumn = column;
96061
+ ccolumn = new DTableCategoryColumnImpl(index, column);
96062
+ result.push(ccolumn);
96063
+ }
95719
96064
  }
95720
96065
  else {
95721
96066
  tcolumn = column;
@@ -96047,7 +96392,9 @@ var DTableColumnImpl = /** @class */ (function (_super) {
96047
96392
  var getter = toGetter(options, type, path);
96048
96393
  var setter = toSetter(options, type, path);
96049
96394
  _this._weight = weight;
96395
+ _this.minWeight = 0;
96050
96396
  _this._width = width;
96397
+ _this.minWidth = 0;
96051
96398
  _this.resizable = (_b = options.resizable) !== null && _b !== void 0 ? _b : false;
96052
96399
  _this.type = type;
96053
96400
  _this.label = label;
@@ -97191,12 +97538,6 @@ var DTableHeaderCellCheck = /** @class */ (function () {
97191
97538
  * Copyright (C) 2019 Toshiba Corporation
97192
97539
  * SPDX-License-Identifier: Apache-2.0
97193
97540
  */
97194
- var DTableHeaderCellEdge = {
97195
- NONE: 0,
97196
- LEFT: 1,
97197
- RIGHT: 2,
97198
- BOTH: 3
97199
- };
97200
97541
  var DTableHeaderCell = /** @class */ (function (_super) {
97201
97542
  __extends(DTableHeaderCell, _super);
97202
97543
  function DTableHeaderCell(header, columnIndex, column, options) {
@@ -97206,8 +97547,7 @@ var DTableHeaderCell = /** @class */ (function (_super) {
97206
97547
  _this._columnIndex = columnIndex;
97207
97548
  var check = new DTableHeaderCellCheck(_this, options === null || options === void 0 ? void 0 : options.check);
97208
97549
  _this._check = check;
97209
- _this._edgeSize = _this.theme.getEdgeWidth();
97210
- _this._wasResizing = false;
97550
+ _this._edge = new DTableCellEdge(_this._header, _this, columnIndex, _this.theme.getEdgeWidth());
97211
97551
  var sortable = column.sorting.enable;
97212
97552
  var checkable = check.isEnabled;
97213
97553
  if (checkable || sortable) {
@@ -97251,200 +97591,17 @@ var DTableHeaderCell = /** @class */ (function (_super) {
97251
97591
  configurable: true
97252
97592
  });
97253
97593
  DTableHeaderCell.prototype.onDown = function (e) {
97254
- var edges = this.state.valueOf(DTableState.HOVERED_ON_EDGE);
97255
- if (edges != null) {
97256
- this._wasResizing = true;
97257
- var layer = DApplications.getLayer(this);
97258
- if (layer != null) {
97259
- var interactionManager = layer.renderer.plugins.interaction;
97260
- var columnIndex = this._columnIndex;
97261
- if (edges === DTableHeaderCellEdge.LEFT) {
97262
- this.onDownEdge(e.data.global.x, columnIndex - 1, interactionManager);
97263
- }
97264
- else {
97265
- this.onDownEdge(e.data.global.x, columnIndex, interactionManager);
97266
- }
97267
- }
97268
- }
97269
- else {
97270
- this._wasResizing = false;
97594
+ if (!this._edge.onDown(e)) {
97271
97595
  _super.prototype.onDown.call(this, e);
97272
97596
  }
97273
97597
  };
97274
- DTableHeaderCell.prototype.findLeftResizableCell = function (columnIndex) {
97275
- var children = this._header.children;
97276
- var childrenLength = children.length;
97277
- for (var i = columnIndex; 0 <= i; --i) {
97278
- var child = children[childrenLength - i - 1];
97279
- if (child.column.resizable) {
97280
- return child;
97281
- }
97282
- }
97283
- return null;
97284
- };
97285
- DTableHeaderCell.prototype.findRightResizableCellOfWeight = function (columnIndex) {
97286
- var children = this._header.children;
97287
- var childrenLength = children.length;
97288
- for (var i = columnIndex + 1; i < childrenLength; ++i) {
97289
- var child = children[childrenLength - i - 1];
97290
- var childColumn = child.column;
97291
- if (childColumn.resizable) {
97292
- var childColumnWeight = childColumn.weight;
97293
- if (childColumnWeight != null) {
97294
- return child;
97295
- }
97296
- }
97297
- }
97298
- return null;
97299
- };
97300
- DTableHeaderCell.prototype.checkIfEdgeResizable = function (columnIndex) {
97301
- var target = this.findLeftResizableCell(columnIndex);
97302
- if (target != null) {
97303
- if (target.column.weight != null) {
97304
- return this.findRightResizableCellOfWeight(target.columnIndex) != null;
97305
- }
97306
- else {
97307
- return true;
97308
- }
97309
- }
97310
- return false;
97311
- };
97312
- DTableHeaderCell.prototype.getResizableEdges = function () {
97313
- var result = this._resizableEdges;
97314
- if (result == null) {
97315
- var columnIndex = this._columnIndex;
97316
- if (this.checkIfEdgeResizable(columnIndex - 1)) {
97317
- if (this.checkIfEdgeResizable(columnIndex)) {
97318
- result = DTableHeaderCellEdge.BOTH;
97319
- }
97320
- else {
97321
- result = DTableHeaderCellEdge.LEFT;
97322
- }
97323
- }
97324
- else {
97325
- if (this.checkIfEdgeResizable(columnIndex)) {
97326
- result = DTableHeaderCellEdge.RIGHT;
97327
- }
97328
- else {
97329
- result = DTableHeaderCellEdge.NONE;
97330
- }
97331
- }
97332
- this._resizableEdges = result;
97333
- }
97334
- return result;
97335
- };
97336
97598
  DTableHeaderCell.prototype.onOver = function (e) {
97337
- var _this = this;
97338
- var _a;
97339
97599
  _super.prototype.onOver.call(this, e);
97340
- if (this.getResizableEdges() !== DTableHeaderCellEdge.NONE) {
97341
- var onHoveredBound = ((_a = this._onHoveredBound) !== null && _a !== void 0 ? _a : (this._onHoveredBound = function (event) {
97342
- _this.onHovered(event);
97343
- }));
97344
- this.on(UtilPointerEvent.move, onHoveredBound);
97345
- // Since the cursor is set by InteractionManager before this method is called,
97346
- // the cursor need to be overriden.
97347
- this.onHovered(e);
97348
- var layer = DApplications.getLayer(this);
97349
- if (layer != null) {
97350
- layer.renderer.plugins.interaction.cursor = this.cursor;
97351
- }
97352
- }
97600
+ this._edge.onOver(e);
97353
97601
  };
97354
97602
  DTableHeaderCell.prototype.onOut = function (e) {
97355
97603
  _super.prototype.onOut.call(this, e);
97356
- var onHoveredBound = this._onHoveredBound;
97357
- if (onHoveredBound != null) {
97358
- this.state.remove(DTableState.HOVERED_ON_EDGE);
97359
- this.off(UtilPointerEvent.move, onHoveredBound);
97360
- }
97361
- };
97362
- DTableHeaderCell.prototype.onHovered = function (e) {
97363
- var width = this.width;
97364
- var x = this.toClickPosition(e);
97365
- var edgeSize = this._edgeSize;
97366
- if (0 <= x && x <= edgeSize) {
97367
- if (this.getResizableEdges() & DTableHeaderCellEdge.LEFT) {
97368
- this.state.add(DTableState.HOVERED_ON_EDGE, DTableHeaderCellEdge.LEFT);
97369
- }
97370
- else {
97371
- this.state.remove(DTableState.HOVERED_ON_EDGE);
97372
- }
97373
- }
97374
- else if (width - edgeSize <= x && x <= width) {
97375
- if (this.getResizableEdges() & DTableHeaderCellEdge.RIGHT) {
97376
- this.state.add(DTableState.HOVERED_ON_EDGE, DTableHeaderCellEdge.RIGHT);
97377
- }
97378
- else {
97379
- this.state.remove(DTableState.HOVERED_ON_EDGE);
97380
- }
97381
- }
97382
- else {
97383
- this.state.remove(DTableState.HOVERED_ON_EDGE);
97384
- }
97385
- };
97386
- DTableHeaderCell.prototype.onDownEdge = function (onDownPoint, columnIndex, interactionManager) {
97387
- // Find the resizable cell
97388
- var left = this.findLeftResizableCell(columnIndex);
97389
- if (left == null) {
97390
- // No resizable cell
97391
- return;
97392
- }
97393
- var header = this._header;
97394
- var leftColumn = left.column;
97395
- var leftOldWidth = left.width;
97396
- var leftOldWeight = left.weight;
97397
- if (leftColumn.weight == null) {
97398
- header.state.add(DTableState.RESIZING);
97399
- var onMove_1 = function (e) {
97400
- leftColumn.width = Math.max(1, leftOldWidth + e.data.global.x - onDownPoint);
97401
- };
97402
- var onUp_1 = function (e) {
97403
- header.state.remove(DTableState.RESIZING);
97404
- interactionManager.off(UtilPointerEvent.move, onMove_1);
97405
- interactionManager.off(UtilPointerEvent.up, onUp_1);
97406
- interactionManager.off(UtilPointerEvent.upoutside, onUp_1);
97407
- interactionManager.off(UtilPointerEvent.cancel, onUp_1);
97408
- };
97409
- interactionManager.on(UtilPointerEvent.move, onMove_1);
97410
- interactionManager.on(UtilPointerEvent.up, onUp_1);
97411
- interactionManager.on(UtilPointerEvent.upoutside, onUp_1);
97412
- interactionManager.on(UtilPointerEvent.cancel, onUp_1);
97413
- }
97414
- else {
97415
- var right = this.findRightResizableCellOfWeight(left.columnIndex);
97416
- if (right == null) {
97417
- // No right resizable cell found
97418
- return;
97419
- }
97420
- var rightColumn_1 = right.column;
97421
- var rightOldWeight = right.weight;
97422
- var rightOldWidth = right.width;
97423
- var totalWidth_1 = leftOldWidth + rightOldWidth;
97424
- var totalWeight_1 = leftOldWeight + rightOldWeight;
97425
- if (totalWidth_1 <= 0) {
97426
- // The left and right resizable cells doesn't have non-zero width
97427
- return;
97428
- }
97429
- header.state.add(DTableState.RESIZING);
97430
- var onMove_2 = function (e) {
97431
- var leftNewWidth = Math.max(0, Math.min(totalWidth_1, leftOldWidth + e.data.global.x - onDownPoint));
97432
- var leftNewWeight = totalWeight_1 * (leftNewWidth / totalWidth_1);
97433
- leftColumn.weight = leftNewWeight;
97434
- rightColumn_1.weight = totalWeight_1 - leftNewWeight;
97435
- };
97436
- var onUp_2 = function (e) {
97437
- header.state.remove(DTableState.RESIZING);
97438
- interactionManager.off(UtilPointerEvent.move, onMove_2);
97439
- interactionManager.off(UtilPointerEvent.up, onUp_2);
97440
- interactionManager.off(UtilPointerEvent.upoutside, onUp_2);
97441
- interactionManager.off(UtilPointerEvent.cancel, onUp_2);
97442
- };
97443
- interactionManager.on(UtilPointerEvent.move, onMove_2);
97444
- interactionManager.on(UtilPointerEvent.up, onUp_2);
97445
- interactionManager.on(UtilPointerEvent.upoutside, onUp_2);
97446
- interactionManager.on(UtilPointerEvent.cancel, onUp_2);
97447
- }
97604
+ this._edge.onOut(e);
97448
97605
  };
97449
97606
  Object.defineProperty(DTableHeaderCell.prototype, "sorter", {
97450
97607
  get: function () {
@@ -97532,10 +97689,6 @@ var DTableHeaderCell = /** @class */ (function (_super) {
97532
97689
  }
97533
97690
  return false;
97534
97691
  };
97535
- DTableHeaderCell.prototype.isEdgeClicked = function (e) {
97536
- return (e instanceof pixi_js.InteractionEvent &&
97537
- (this.state.is(DTableState.HOVERED_ON_EDGE) || this._wasResizing));
97538
- };
97539
97692
  DTableHeaderCell.prototype.onClick = function (e) {
97540
97693
  if (this.state.isActionable) {
97541
97694
  this.activate(e);
@@ -97545,7 +97698,7 @@ var DTableHeaderCell = /** @class */ (function (_super) {
97545
97698
  this.onActivate(e);
97546
97699
  };
97547
97700
  DTableHeaderCell.prototype.onActivate = function (e) {
97548
- if (!this.isEdgeClicked(e)) {
97701
+ if (!this._edge.isClicked(e)) {
97549
97702
  if (this.isCheckClicked(e)) {
97550
97703
  this.onToggleStart();
97551
97704
  this.onToggleEnd();
@@ -99924,7 +100077,6 @@ exports.DTableBodyCells = DTableBodyCells;
99924
100077
  exports.DTableBodyRow = DTableBodyRow;
99925
100078
  exports.DTableCategory = DTableCategory;
99926
100079
  exports.DTableCategoryCell = DTableCategoryCell;
99927
- exports.DTableCategoryCellEdge = DTableCategoryCellEdge;
99928
100080
  exports.DTableCategoryColumnImpl = DTableCategoryColumnImpl;
99929
100081
  exports.DTableCategoryContainerImpl = DTableCategoryContainerImpl;
99930
100082
  exports.DTableColumnContainerImpl = DTableColumnContainerImpl;
@@ -99946,7 +100098,6 @@ exports.DTableDataTreeSorter = DTableDataTreeSorter;
99946
100098
  exports.DTableHeader = DTableHeader;
99947
100099
  exports.DTableHeaderCell = DTableHeaderCell;
99948
100100
  exports.DTableHeaderCellCheck = DTableHeaderCellCheck;
99949
- exports.DTableHeaderCellEdge = DTableHeaderCellEdge;
99950
100101
  exports.DTableRow = DTableRow;
99951
100102
  exports.DTableScrollBar = DTableScrollBar;
99952
100103
  exports.DTableState = DTableState;