@wcardinal/wcardinal-ui 0.414.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 (37) hide show
  1. package/dist/types/wcardinal/ui/d-table-category-cell.d.ts +3 -20
  2. package/dist/types/wcardinal/ui/d-table-category-column-impl.d.ts +1 -2
  3. package/dist/types/wcardinal/ui/d-table-category-container-impl.d.ts +1 -1
  4. package/dist/types/wcardinal/ui/d-table-cell-edge.d.ts +69 -0
  5. package/dist/types/wcardinal/ui/d-table-column-impl.d.ts +2 -0
  6. package/dist/types/wcardinal/ui/d-table-column.d.ts +2 -0
  7. package/dist/types/wcardinal/ui/d-table-header-cell.d.ts +3 -19
  8. package/dist/wcardinal/ui/d-table-category-cell.js +5 -207
  9. package/dist/wcardinal/ui/d-table-category-cell.js.map +1 -1
  10. package/dist/wcardinal/ui/d-table-category-column-impl.js +19 -34
  11. package/dist/wcardinal/ui/d-table-category-column-impl.js.map +1 -1
  12. package/dist/wcardinal/ui/d-table-category-container-impl.js +14 -7
  13. package/dist/wcardinal/ui/d-table-category-container-impl.js.map +1 -1
  14. package/dist/wcardinal/ui/d-table-cell-edge.js +557 -0
  15. package/dist/wcardinal/ui/d-table-cell-edge.js.map +1 -0
  16. package/dist/wcardinal/ui/d-table-column-impl.js +2 -0
  17. package/dist/wcardinal/ui/d-table-column-impl.js.map +1 -1
  18. package/dist/wcardinal/ui/d-table-column.js.map +1 -1
  19. package/dist/wcardinal/ui/d-table-header-cell.js +6 -200
  20. package/dist/wcardinal/ui/d-table-header-cell.js.map +1 -1
  21. package/dist/wcardinal-ui-theme-dark-en-us.js +1 -1
  22. package/dist/wcardinal-ui-theme-dark-en-us.min.js +1 -1
  23. package/dist/wcardinal-ui-theme-dark-ja-jp.js +1 -1
  24. package/dist/wcardinal-ui-theme-dark-ja-jp.min.js +1 -1
  25. package/dist/wcardinal-ui-theme-dark.js +1 -1
  26. package/dist/wcardinal-ui-theme-dark.min.js +1 -1
  27. package/dist/wcardinal-ui-theme-white-en-us.js +1 -1
  28. package/dist/wcardinal-ui-theme-white-en-us.min.js +1 -1
  29. package/dist/wcardinal-ui-theme-white-ja-jp.js +1 -1
  30. package/dist/wcardinal-ui-theme-white-ja-jp.min.js +1 -1
  31. package/dist/wcardinal-ui-theme-white.js +1 -1
  32. package/dist/wcardinal-ui-theme-white.min.js +1 -1
  33. package/dist/wcardinal-ui.cjs.js +558 -407
  34. package/dist/wcardinal-ui.js +558 -407
  35. package/dist/wcardinal-ui.min.js +2 -2
  36. package/dist/wcardinal-ui.min.js.map +1 -1
  37. package/package.json +2 -2
@@ -1,5 +1,5 @@
1
1
  /*
2
- Winter Cardinal UI v0.414.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
 
@@ -73972,249 +73972,602 @@
73972
73972
  * Copyright (C) 2019 Toshiba Corporation
73973
73973
  * SPDX-License-Identifier: Apache-2.0
73974
73974
  */
73975
- var DTableCategoryCellEdge = {
73975
+ var DTableCellEdgeHovered = {
73976
73976
  NONE: 0,
73977
73977
  LEFT: 1,
73978
73978
  RIGHT: 2,
73979
73979
  BOTH: 3
73980
73980
  };
73981
- var DTableCategoryCell = /** @class */ (function (_super) {
73982
- __extends(DTableCategoryCell, _super);
73983
- function DTableCategoryCell(category, columnIndex, column, options) {
73984
- var _this = _super.call(this, options) || this;
73985
- _this._category = category;
73986
- _this._columnIndex = columnIndex;
73987
- _this._column = column;
73988
- _this._edgeSize = _this.theme.getEdgeWidth();
73989
- _this._wasResizing = false;
73990
- return _this;
73981
+ var DTableCellEdge = /** @class */ (function () {
73982
+ function DTableCellEdge(row, cell, columnIndex, size) {
73983
+ this._row = row;
73984
+ this._cell = cell;
73985
+ this._columnIndex = columnIndex;
73986
+ this._size = size;
73987
+ this._dragged = false;
73988
+ this._minWidth = 8;
73991
73989
  }
73992
- Object.defineProperty(DTableCategoryCell.prototype, "column", {
73993
- get: function () {
73994
- return this._column;
73995
- },
73996
- enumerable: false,
73997
- configurable: true
73998
- });
73999
- Object.defineProperty(DTableCategoryCell.prototype, "columnIndex", {
74000
- get: function () {
74001
- return this._columnIndex;
74002
- },
74003
- enumerable: false,
74004
- configurable: true
74005
- });
74006
- Object.defineProperty(DTableCategoryCell.prototype, "category", {
74007
- get: function () {
74008
- return this._category;
74009
- },
74010
- enumerable: false,
74011
- configurable: true
74012
- });
74013
- DTableCategoryCell.prototype.onDown = function (e) {
74014
- var edges = this.state.valueOf(DTableState.HOVERED_ON_EDGE);
74015
- if (edges != null) {
74016
- this._wasResizing = true;
74017
- var layer = DApplications.getLayer(this);
74018
- if (layer != null) {
74019
- var interactionManager = layer.renderer.plugins.interaction;
74020
- var columnIndex = this._columnIndex;
74021
- if (edges === DTableCategoryCellEdge.LEFT) {
74022
- this.onDownEdge(e.data.global.x, columnIndex - 1, interactionManager);
74023
- }
74024
- else {
74025
- this.onDownEdge(e.data.global.x, columnIndex, interactionManager);
73990
+ DTableCellEdge.prototype.findResizableCell = function (columnIndex, direction, weight) {
73991
+ var children = this._row.children;
73992
+ var childrenLength = children.length;
73993
+ if (direction) {
73994
+ for (var i = columnIndex; i < childrenLength; ++i) {
73995
+ var child = children[childrenLength - i - 1];
73996
+ var childColumn = child.column;
73997
+ if (childColumn.resizable) {
73998
+ if (weight == null) {
73999
+ return child;
74000
+ }
74001
+ else if (weight === true) {
74002
+ if (childColumn.weight != null) {
74003
+ return child;
74004
+ }
74005
+ }
74006
+ else {
74007
+ if (childColumn.weight == null) {
74008
+ return child;
74009
+ }
74010
+ }
74026
74011
  }
74027
74012
  }
74028
74013
  }
74029
74014
  else {
74030
- this._wasResizing = false;
74031
- _super.prototype.onDown.call(this, e);
74032
- }
74033
- };
74034
- DTableCategoryCell.prototype.findLeftResizableCell = function (columnIndex) {
74035
- var children = this._category.children;
74036
- var childrenLength = children.length;
74037
- for (var i = columnIndex; 0 <= i; --i) {
74038
- var child = children[childrenLength - i - 1];
74039
- if (child.column.resizable) {
74040
- return child;
74015
+ for (var i = columnIndex; 0 <= i; --i) {
74016
+ var child = children[childrenLength - i - 1];
74017
+ var childColumn = child.column;
74018
+ if (childColumn.resizable) {
74019
+ if (weight == null) {
74020
+ return child;
74021
+ }
74022
+ else if (weight === true) {
74023
+ if (childColumn.weight != null) {
74024
+ return child;
74025
+ }
74026
+ }
74027
+ else {
74028
+ if (childColumn.weight == null) {
74029
+ return child;
74030
+ }
74031
+ }
74032
+ }
74041
74033
  }
74042
74034
  }
74043
74035
  return null;
74044
74036
  };
74045
- DTableCategoryCell.prototype.findRightResizableCellOfWeight = function (columnIndex) {
74046
- var children = this._category.children;
74037
+ DTableCellEdge.prototype.findCells = function (columnIndex, direction, weight) {
74038
+ var result = [];
74039
+ var children = this._row.children;
74047
74040
  var childrenLength = children.length;
74048
- for (var i = columnIndex + 1; i < childrenLength; ++i) {
74049
- var child = children[childrenLength - i - 1];
74050
- var childColumn = child.column;
74051
- if (childColumn.resizable) {
74052
- var childColumnWeight = childColumn.weight;
74053
- if (childColumnWeight != null) {
74054
- return child;
74041
+ if (direction) {
74042
+ for (var i = columnIndex; i < childrenLength; ++i) {
74043
+ var child = children[childrenLength - i - 1];
74044
+ if (weight) {
74045
+ if (child.column.weight != null) {
74046
+ result.push(child);
74047
+ }
74048
+ }
74049
+ else {
74050
+ if (child.column.weight == null) {
74051
+ result.push(child);
74052
+ }
74055
74053
  }
74056
74054
  }
74057
74055
  }
74058
- return null;
74059
- };
74060
- DTableCategoryCell.prototype.checkIfEdgeResizable = function (columnIndex) {
74061
- var target = this.findLeftResizableCell(columnIndex);
74062
- if (target != null) {
74063
- if (target.column.weight != null) {
74064
- return this.findRightResizableCellOfWeight(target.columnIndex) != null;
74065
- }
74066
- else {
74067
- return true;
74056
+ else {
74057
+ for (var i = columnIndex; 0 <= i; --i) {
74058
+ var child = children[childrenLength - i - 1];
74059
+ if (weight) {
74060
+ if (child.column.weight != null) {
74061
+ result.push(child);
74062
+ }
74063
+ }
74064
+ else {
74065
+ if (child.column.weight == null) {
74066
+ result.push(child);
74067
+ }
74068
+ }
74068
74069
  }
74069
74070
  }
74070
- return false;
74071
+ return result;
74071
74072
  };
74072
- DTableCategoryCell.prototype.getResizableEdges = function () {
74073
- var result = this._resizableEdges;
74074
- if (result == null) {
74075
- var columnIndex = this._columnIndex;
74076
- if (this.checkIfEdgeResizable(columnIndex - 1)) {
74077
- if (this.checkIfEdgeResizable(columnIndex)) {
74078
- result = DTableCategoryCellEdge.BOTH;
74073
+ DTableCellEdge.prototype.calcData = function (columnIndex) {
74074
+ var left = this.findResizableCell(columnIndex, false, null);
74075
+ if (left != null) {
74076
+ var leftColumn = left.column;
74077
+ var right = this.findResizableCell(columnIndex + 1, true, null);
74078
+ if (right != null) {
74079
+ var rightColumn = right.column;
74080
+ if (leftColumn.weight == null) {
74081
+ if (rightColumn.weight == null) {
74082
+ // Width - Width
74083
+ return [1, left, right];
74084
+ }
74085
+ else {
74086
+ // Width - Weight
74087
+ var others = this.findCells(0, true, true);
74088
+ return [2, left, right, others];
74089
+ }
74079
74090
  }
74080
74091
  else {
74081
- result = DTableCategoryCellEdge.LEFT;
74092
+ if (rightColumn.weight == null) {
74093
+ // Weight - Width
74094
+ var others = this.findCells(0, true, true);
74095
+ return [3, left, right, others];
74096
+ }
74097
+ else {
74098
+ // Weight - Weight
74099
+ return [1, left, right];
74100
+ }
74082
74101
  }
74083
74102
  }
74084
74103
  else {
74085
- if (this.checkIfEdgeResizable(columnIndex)) {
74086
- result = DTableCategoryCellEdge.RIGHT;
74104
+ if (leftColumn.weight == null) {
74105
+ // Width
74106
+ var ls = this.findCells(left.columnIndex - 1, false, true);
74107
+ if (ls.length <= 0) {
74108
+ return [0, left];
74109
+ }
74110
+ // Not resizable
74111
+ return null;
74087
74112
  }
74088
74113
  else {
74089
- result = DTableCategoryCellEdge.NONE;
74114
+ // Not resizable
74115
+ return null;
74090
74116
  }
74091
74117
  }
74092
- this._resizableEdges = result;
74093
74118
  }
74094
- return result;
74119
+ // Not resizable
74120
+ return null;
74095
74121
  };
74096
- DTableCategoryCell.prototype.onOver = function (e) {
74122
+ Object.defineProperty(DTableCellEdge.prototype, "left", {
74123
+ get: function () {
74124
+ var result = this._left;
74125
+ if (result === undefined) {
74126
+ result = this.calcData(this._columnIndex - 1);
74127
+ this._left = result;
74128
+ }
74129
+ return result;
74130
+ },
74131
+ enumerable: false,
74132
+ configurable: true
74133
+ });
74134
+ Object.defineProperty(DTableCellEdge.prototype, "right", {
74135
+ get: function () {
74136
+ var result = this._right;
74137
+ if (result === undefined) {
74138
+ result = this.calcData(this._columnIndex);
74139
+ this._right = result;
74140
+ }
74141
+ return result;
74142
+ },
74143
+ enumerable: false,
74144
+ configurable: true
74145
+ });
74146
+ DTableCellEdge.prototype.onDown = function (e) {
74147
+ var cell = this._cell;
74148
+ var hoveredOnEdge = cell.state.valueOf(DTableState.HOVERED_ON_EDGE);
74149
+ if (hoveredOnEdge != null) {
74150
+ this._dragged = true;
74151
+ var layer = DApplications.getLayer(cell);
74152
+ if (layer != null) {
74153
+ var interactionManager = layer.renderer.plugins.interaction;
74154
+ if (hoveredOnEdge === DTableCellEdgeHovered.LEFT) {
74155
+ var left = this.left;
74156
+ if (left != null) {
74157
+ this.onDown_(e.data.global.x, left, interactionManager);
74158
+ }
74159
+ }
74160
+ else {
74161
+ var right = this.right;
74162
+ if (right != null) {
74163
+ this.onDown_(e.data.global.x, right, interactionManager);
74164
+ }
74165
+ }
74166
+ }
74167
+ return true;
74168
+ }
74169
+ else {
74170
+ this._dragged = false;
74171
+ return false;
74172
+ }
74173
+ };
74174
+ DTableCellEdge.prototype.onDown_ = function (onDownPoint, data, interactionManager) {
74175
+ switch (data[0]) {
74176
+ case 0:
74177
+ this.onDown0(onDownPoint, data, interactionManager);
74178
+ break;
74179
+ case 1:
74180
+ this.onDown1(onDownPoint, data, interactionManager);
74181
+ break;
74182
+ case 2:
74183
+ this.onDown2(onDownPoint, data, interactionManager);
74184
+ break;
74185
+ case 3:
74186
+ this.onDown3(onDownPoint, data, interactionManager);
74187
+ break;
74188
+ }
74189
+ };
74190
+ DTableCellEdge.prototype.onOver = function (e) {
74097
74191
  var _this = this;
74098
74192
  var _a;
74099
- _super.prototype.onOver.call(this, e);
74100
- if (this.getResizableEdges() !== DTableCategoryCellEdge.NONE) {
74193
+ if (this.left != null || this.right != null) {
74101
74194
  var onHoveredBound = ((_a = this._onHoveredBound) !== null && _a !== void 0 ? _a : (this._onHoveredBound = function (event) {
74102
74195
  _this.onHovered(event);
74103
74196
  }));
74104
- this.on(UtilPointerEvent.move, onHoveredBound);
74197
+ var cell = this._cell;
74198
+ cell.off(UtilPointerEvent.move, onHoveredBound);
74199
+ cell.on(UtilPointerEvent.move, onHoveredBound);
74105
74200
  // Since the cursor is set by InteractionManager before this method is called,
74106
74201
  // the cursor need to be overriden.
74107
74202
  this.onHovered(e);
74108
- var layer = DApplications.getLayer(this);
74203
+ var layer = DApplications.getLayer(cell);
74109
74204
  if (layer != null) {
74110
- layer.renderer.plugins.interaction.cursor = this.cursor;
74205
+ layer.renderer.plugins.interaction.cursor = cell.cursor;
74111
74206
  }
74112
74207
  }
74113
74208
  };
74114
- DTableCategoryCell.prototype.onOut = function (e) {
74115
- _super.prototype.onOut.call(this, e);
74209
+ DTableCellEdge.prototype.onOut = function (e) {
74116
74210
  var onHoveredBound = this._onHoveredBound;
74117
74211
  if (onHoveredBound != null) {
74118
- this.state.remove(DTableState.HOVERED_ON_EDGE);
74119
- this.off(UtilPointerEvent.move, onHoveredBound);
74212
+ var cell = this._cell;
74213
+ cell.state.remove(DTableState.HOVERED_ON_EDGE);
74214
+ cell.off(UtilPointerEvent.move, onHoveredBound);
74120
74215
  }
74121
74216
  };
74122
- DTableCategoryCell.prototype.onHovered = function (e) {
74123
- var width = this.width;
74124
- var x = this.toClickPosition(e);
74125
- var edgeSize = this._edgeSize;
74126
- if (0 <= x && x <= edgeSize) {
74127
- if (this.getResizableEdges() & DTableCategoryCellEdge.LEFT) {
74128
- this.state.add(DTableState.HOVERED_ON_EDGE, DTableCategoryCellEdge.LEFT);
74217
+ DTableCellEdge.prototype.onHovered = function (e) {
74218
+ var cell = this._cell;
74219
+ var width = cell.width;
74220
+ var x = this.toX(e);
74221
+ var size = this._size;
74222
+ var onLeft = 0 <= x && x <= size;
74223
+ var onRight = width - size <= x && x <= width;
74224
+ if (onLeft && onRight) {
74225
+ if (x <= width - x) {
74226
+ onRight = false;
74227
+ }
74228
+ else {
74229
+ onLeft = false;
74230
+ }
74231
+ }
74232
+ if (onLeft) {
74233
+ if (this.left != null) {
74234
+ cell.state.add(DTableState.HOVERED_ON_EDGE, DTableCellEdgeHovered.LEFT);
74129
74235
  }
74130
74236
  else {
74131
- this.state.remove(DTableState.HOVERED_ON_EDGE);
74237
+ cell.state.remove(DTableState.HOVERED_ON_EDGE);
74132
74238
  }
74133
74239
  }
74134
- else if (width - edgeSize <= x && x <= width) {
74135
- if (this.getResizableEdges() & DTableCategoryCellEdge.RIGHT) {
74136
- this.state.add(DTableState.HOVERED_ON_EDGE, DTableCategoryCellEdge.RIGHT);
74240
+ else if (onRight) {
74241
+ if (this.right != null) {
74242
+ cell.state.add(DTableState.HOVERED_ON_EDGE, DTableCellEdgeHovered.RIGHT);
74137
74243
  }
74138
74244
  else {
74139
- this.state.remove(DTableState.HOVERED_ON_EDGE);
74245
+ cell.state.remove(DTableState.HOVERED_ON_EDGE);
74140
74246
  }
74141
74247
  }
74142
74248
  else {
74143
- this.state.remove(DTableState.HOVERED_ON_EDGE);
74249
+ cell.state.remove(DTableState.HOVERED_ON_EDGE);
74144
74250
  }
74145
74251
  };
74146
- DTableCategoryCell.prototype.toClickPosition = function (e) {
74252
+ DTableCellEdge.prototype.toX = function (e) {
74147
74253
  var _a;
74148
74254
  var checkWork = ((_a = this._checkWork) !== null && _a !== void 0 ? _a : (this._checkWork = new pixi_js.Point()));
74149
- return e.data.getLocalPosition(this, checkWork).x;
74255
+ return this._cell.toLocal(e.data.global, undefined, checkWork, true).x;
74150
74256
  };
74151
- DTableCategoryCell.prototype.onDownEdge = function (onDownPoint, columnIndex, interactionManager) {
74152
- // Find the resizable cell
74153
- var left = this.findLeftResizableCell(columnIndex);
74154
- if (left == null) {
74155
- // No resizable cell
74156
- return;
74157
- }
74158
- var category = this._category;
74257
+ DTableCellEdge.prototype.onDown0 = function (onDownPoint, data, interactionManager) {
74258
+ var left = data[1];
74259
+ var leftColumn = left.column;
74260
+ var leftOldWidth = left.width;
74261
+ var leftMinWidth = Math.max(this._minWidth, leftColumn.minWidth);
74262
+ var onMove = function (e) {
74263
+ leftColumn.width = Math.max(leftMinWidth, leftOldWidth + e.data.global.x - onDownPoint);
74264
+ };
74265
+ this.newOnUp(onMove, interactionManager);
74266
+ };
74267
+ DTableCellEdge.prototype.onDown1 = function (onDownPoint, data, interactionManager) {
74268
+ var minWidth = this._minWidth;
74269
+ var left = data[1];
74159
74270
  var leftColumn = left.column;
74160
74271
  var leftOldWidth = left.width;
74161
- var leftOldWeight = left.weight;
74272
+ var right = data[2];
74273
+ var rightColumn = right.column;
74274
+ var rightOldWidth = right.width;
74275
+ var totalWidth = leftOldWidth + rightOldWidth;
74162
74276
  if (leftColumn.weight == null) {
74163
- category.state.add(DTableState.RESIZING);
74164
- var leftMinWidth_1 = leftColumn.minWidth;
74165
- var onMove_1 = function (e) {
74166
- leftColumn.width = Math.max(leftMinWidth_1, leftOldWidth + e.data.global.x - onDownPoint);
74167
- };
74168
- var onUp_1 = function (e) {
74169
- category.state.remove(DTableState.RESIZING);
74170
- interactionManager.off(UtilPointerEvent.move, onMove_1);
74171
- interactionManager.off(UtilPointerEvent.up, onUp_1);
74172
- interactionManager.off(UtilPointerEvent.upoutside, onUp_1);
74173
- interactionManager.off(UtilPointerEvent.cancel, onUp_1);
74277
+ var leftMinWidth_1 = Math.max(minWidth, leftColumn.minWidth);
74278
+ var rightMinWidth = Math.max(minWidth, rightColumn.minWidth);
74279
+ var leftMaxWidth_1 = totalWidth - rightMinWidth;
74280
+ if (totalWidth <= 0 || leftMaxWidth_1 <= leftMinWidth_1) {
74281
+ // The left and right resizable cells doesn't have enough width
74282
+ return;
74283
+ }
74284
+ var onMove = function (e) {
74285
+ var leftNewWidth = Math.max(leftMinWidth_1, Math.min(leftMaxWidth_1, leftOldWidth + e.data.global.x - onDownPoint));
74286
+ leftColumn.width = leftNewWidth;
74287
+ rightColumn.width = totalWidth - leftNewWidth;
74174
74288
  };
74175
- interactionManager.on(UtilPointerEvent.move, onMove_1);
74176
- interactionManager.on(UtilPointerEvent.up, onUp_1);
74177
- interactionManager.on(UtilPointerEvent.upoutside, onUp_1);
74178
- interactionManager.on(UtilPointerEvent.cancel, onUp_1);
74289
+ this.newOnUp(onMove, interactionManager);
74179
74290
  }
74180
74291
  else {
74181
- var right = this.findRightResizableCellOfWeight(left.columnIndex);
74182
- if (right == null) {
74183
- // No right resizable cell found
74184
- return;
74185
- }
74186
- var rightColumn_1 = right.column;
74292
+ var leftOldWeight = left.weight;
74187
74293
  var rightOldWeight = right.weight;
74188
- var rightOldWidth = right.width;
74189
- var totalWidth_1 = leftOldWidth + rightOldWidth;
74190
74294
  var totalWeight_1 = leftOldWeight + rightOldWeight;
74191
74295
  var leftMinWeight_1 = leftColumn.minWeight;
74192
- var rightMinWeight = rightColumn_1.minWeight;
74296
+ var rightMinWeight = rightColumn.minWeight;
74193
74297
  var leftMaxWeight_1 = totalWeight_1 - rightMinWeight;
74194
- if (totalWidth_1 <= 0 || leftMaxWeight_1 <= leftMinWeight_1) {
74195
- // The left and right resizable cells doesn't non-zero width
74298
+ var leftMinWidth_2 = minWidth;
74299
+ var rightMinWidth = minWidth;
74300
+ var leftMaxWidth_2 = totalWidth - rightMinWidth;
74301
+ if (totalWidth <= 0 || leftMaxWidth_2 <= leftMinWidth_2 || leftMaxWeight_1 <= leftMinWeight_1) {
74302
+ // The left and right resizable cells doesn't have enough width
74196
74303
  return;
74197
74304
  }
74198
- category.state.add(DTableState.RESIZING);
74199
- var onMove_2 = function (e) {
74200
- var leftNewWidth = Math.max(0, Math.min(totalWidth_1, leftOldWidth + e.data.global.x - onDownPoint));
74201
- var leftNewWeight = Math.max(leftMinWeight_1, Math.min(leftMaxWeight_1, totalWeight_1 * (leftNewWidth / totalWidth_1)));
74305
+ var onMove = function (e) {
74306
+ var leftNewWidth = Math.max(leftMinWidth_2, Math.min(leftMaxWidth_2, leftOldWidth + e.data.global.x - onDownPoint));
74307
+ var leftNewWeight = Math.max(leftMinWeight_1, Math.min(leftMaxWeight_1, totalWeight_1 * (leftNewWidth / totalWidth)));
74202
74308
  leftColumn.weight = leftNewWeight;
74203
- rightColumn_1.weight = totalWeight_1 - leftNewWeight;
74309
+ rightColumn.weight = totalWeight_1 - leftNewWeight;
74310
+ };
74311
+ this.newOnUp(onMove, interactionManager);
74312
+ }
74313
+ };
74314
+ DTableCellEdge.prototype.onDown2 = function (onDownPoint, data, interactionManager) {
74315
+ if (data[3].length <= 1) {
74316
+ this.onDown2a(onDownPoint, data, interactionManager);
74317
+ }
74318
+ else {
74319
+ this.onDown2b(onDownPoint, data, interactionManager);
74320
+ }
74321
+ };
74322
+ DTableCellEdge.prototype.onDown2a = function (onDownPoint, data, interactionManager) {
74323
+ var minWidth = this._minWidth;
74324
+ var left = data[1];
74325
+ var leftColumn = left.column;
74326
+ var leftOldWidth = left.width;
74327
+ var leftMinWidth = Math.max(minWidth, leftColumn.minWidth);
74328
+ var right = data[2];
74329
+ var rightOldWidth = right.width;
74330
+ var rightMinWidth = minWidth;
74331
+ var totalWidth = leftOldWidth + rightOldWidth;
74332
+ var leftMaxWidth = totalWidth - rightMinWidth;
74333
+ if (totalWidth <= 0 || leftMaxWidth <= leftMinWidth) {
74334
+ // The left and right resizable cells doesn't have enough width
74335
+ return;
74336
+ }
74337
+ var onMove = function (e) {
74338
+ leftColumn.width = Math.max(leftMinWidth, Math.min(leftMaxWidth, leftOldWidth + e.data.global.x - onDownPoint));
74339
+ };
74340
+ this.newOnUp(onMove, interactionManager);
74341
+ };
74342
+ DTableCellEdge.prototype.onDown2b = function (onDownPoint, data, interactionManager) {
74343
+ var minWidth = this._minWidth;
74344
+ var left = data[1];
74345
+ var leftColumn = left.column;
74346
+ var leftOldWidth = left.width;
74347
+ var leftMinWidth = Math.max(minWidth, leftColumn.minWidth);
74348
+ var right = data[2];
74349
+ var rightColumn = right.column;
74350
+ var rightOldWidth = right.width;
74351
+ var rightMinWeight = rightColumn.minWeight;
74352
+ var totalWidth = leftOldWidth + rightOldWidth;
74353
+ var others = data[3];
74354
+ var totalWeight = 0;
74355
+ var totalSpace = 0;
74356
+ for (var i = 0, imax = others.length; i < imax; ++i) {
74357
+ var other = others[i];
74358
+ totalWeight += other.weight;
74359
+ totalSpace += other.width;
74360
+ }
74361
+ if (totalWeight <= 0 || totalSpace <= 0) {
74362
+ var rightMinWidth = minWidth;
74363
+ var leftMaxWidth_3 = totalWidth - rightMinWidth;
74364
+ if (totalWidth <= 0 || leftMaxWidth_3 <= leftMinWidth) {
74365
+ // The left and right resizable cells doesn't have enough width
74366
+ return;
74367
+ }
74368
+ if (totalWeight <= 0) {
74369
+ totalWeight = 0;
74370
+ for (var i = 0, imax = others.length; i < imax; ++i) {
74371
+ var other = others[i];
74372
+ var otherColumn = other.column;
74373
+ if (other !== right) {
74374
+ var otherNewWeight = otherColumn.minWeight;
74375
+ otherColumn.weight = otherNewWeight;
74376
+ totalWeight += otherNewWeight;
74377
+ }
74378
+ else {
74379
+ var rightNewWeight = Math.max(1, rightMinWeight);
74380
+ otherColumn.weight = rightNewWeight;
74381
+ totalWeight += rightNewWeight;
74382
+ }
74383
+ }
74384
+ }
74385
+ var onMove = function (e) {
74386
+ leftColumn.width = Math.max(leftMinWidth, Math.min(leftMaxWidth_3, leftOldWidth + e.data.global.x - onDownPoint));
74387
+ };
74388
+ this.newOnUp(onMove, interactionManager);
74389
+ }
74390
+ else {
74391
+ var rightMinWidth = Math.max(minWidth, totalSpace * (rightMinWeight / totalWeight));
74392
+ var leftMaxWidth_4 = totalWidth - rightMinWidth;
74393
+ if (totalWidth <= 0 || leftMaxWidth_4 <= leftMinWidth) {
74394
+ // The left and right resizable cells doesn't have enough width
74395
+ return;
74396
+ }
74397
+ var onMove = function (e) {
74398
+ var leftNewWidth = Math.max(leftMinWidth, Math.min(leftMaxWidth_4, leftOldWidth + e.data.global.x - onDownPoint));
74399
+ var rightNewWidth = totalWidth - leftNewWidth;
74400
+ var rightNewWeight = Math.max(rightMinWeight, totalWeight * (rightNewWidth / totalSpace));
74401
+ leftColumn.width = leftNewWidth;
74402
+ rightColumn.weight = rightNewWeight;
74403
+ };
74404
+ this.newOnUp(onMove, interactionManager);
74405
+ }
74406
+ };
74407
+ DTableCellEdge.prototype.onDown3 = function (onDownPoint, data, interactionManager) {
74408
+ if (data[3].length <= 1) {
74409
+ this.onDown3a(onDownPoint, data, interactionManager);
74410
+ }
74411
+ else {
74412
+ this.onDown3b(onDownPoint, data, interactionManager);
74413
+ }
74414
+ };
74415
+ DTableCellEdge.prototype.onDown3a = function (onDownPoint, data, interactionManager) {
74416
+ var minWidth = this._minWidth;
74417
+ var left = data[1];
74418
+ var leftOldWidth = left.width;
74419
+ var leftMinWidth = minWidth;
74420
+ var right = data[2];
74421
+ var rightColumn = right.column;
74422
+ var rightOldWidth = right.width;
74423
+ var rightMinWidth = Math.max(minWidth, rightColumn.minWidth);
74424
+ var totalWidth = leftOldWidth + rightOldWidth;
74425
+ var rightMaxWidth = totalWidth - leftMinWidth;
74426
+ if (totalWidth <= 0 || rightMaxWidth <= rightMinWidth) {
74427
+ // The left and right resizable cells doesn't have enough width
74428
+ return;
74429
+ }
74430
+ var onMove = function (e) {
74431
+ rightColumn.width = Math.max(rightMinWidth, Math.min(rightMaxWidth, rightOldWidth + onDownPoint - e.data.global.x));
74432
+ };
74433
+ this.newOnUp(onMove, interactionManager);
74434
+ };
74435
+ DTableCellEdge.prototype.onDown3b = function (onDownPoint, data, interactionManager) {
74436
+ var minWidth = this._minWidth;
74437
+ var left = data[1];
74438
+ var leftColumn = left.column;
74439
+ var leftOldWidth = left.width;
74440
+ var leftMinWeight = leftColumn.minWeight;
74441
+ var right = data[2];
74442
+ var rightColumn = right.column;
74443
+ var rightOldWidth = right.width;
74444
+ var rightMinWidth = Math.max(minWidth, rightColumn.minWidth);
74445
+ var totalWidth = leftOldWidth + rightOldWidth;
74446
+ var others = data[3];
74447
+ var totalWeight = 0;
74448
+ var totalSpace = 0;
74449
+ for (var i = 0, imax = others.length; i < imax; ++i) {
74450
+ var other = others[i];
74451
+ totalWeight += other.weight;
74452
+ totalSpace += other.width;
74453
+ }
74454
+ if (totalWeight <= 0 || totalSpace <= 0) {
74455
+ var leftMinWidth = minWidth;
74456
+ var rightMaxWidth_1 = totalWidth - leftMinWidth;
74457
+ if (totalWidth <= 0 || rightMaxWidth_1 <= rightMinWidth) {
74458
+ // The left and right resizable cells doesn't have enough width
74459
+ return;
74460
+ }
74461
+ if (totalWeight <= 0) {
74462
+ totalWeight = 0;
74463
+ for (var i = 0, imax = others.length; i < imax; ++i) {
74464
+ var other = others[i];
74465
+ var otherColumn = other.column;
74466
+ if (other !== left) {
74467
+ var otherNewWeight = otherColumn.minWeight;
74468
+ otherColumn.weight = otherNewWeight;
74469
+ totalWeight += otherNewWeight;
74470
+ }
74471
+ else {
74472
+ var leftNewWeight = Math.max(1, leftMinWeight);
74473
+ otherColumn.weight = leftNewWeight;
74474
+ totalWeight += leftNewWeight;
74475
+ }
74476
+ }
74477
+ }
74478
+ var onMove = function (e) {
74479
+ rightColumn.width = Math.max(rightMinWidth, Math.min(rightMaxWidth_1, rightOldWidth + onDownPoint - e.data.global.x));
74204
74480
  };
74205
- var onUp_2 = function (e) {
74206
- category.state.remove(DTableState.RESIZING);
74207
- interactionManager.off(UtilPointerEvent.move, onMove_2);
74208
- interactionManager.off(UtilPointerEvent.up, onUp_2);
74209
- interactionManager.off(UtilPointerEvent.upoutside, onUp_2);
74210
- interactionManager.off(UtilPointerEvent.cancel, onUp_2);
74481
+ this.newOnUp(onMove, interactionManager);
74482
+ }
74483
+ else {
74484
+ var leftMinWidth = Math.max(minWidth, totalSpace * (leftMinWeight / totalWeight));
74485
+ var rightMaxWidth_2 = totalWidth - leftMinWidth;
74486
+ if (totalWidth <= 0 || rightMaxWidth_2 <= rightMinWidth) {
74487
+ // The left and right resizable cells doesn't have enough width
74488
+ return;
74489
+ }
74490
+ var onMove = function (e) {
74491
+ var rightNewWidth = Math.max(rightMinWidth, Math.min(rightMaxWidth_2, rightOldWidth + onDownPoint - e.data.global.x));
74492
+ var leftNewWidth = totalWidth - rightNewWidth;
74493
+ var leftNewWeight = Math.max(leftMinWeight, totalWeight * (leftNewWidth / totalSpace));
74494
+ rightColumn.width = rightNewWidth;
74495
+ leftColumn.weight = leftNewWeight;
74211
74496
  };
74212
- interactionManager.on(UtilPointerEvent.move, onMove_2);
74213
- interactionManager.on(UtilPointerEvent.up, onUp_2);
74214
- interactionManager.on(UtilPointerEvent.upoutside, onUp_2);
74215
- interactionManager.on(UtilPointerEvent.cancel, onUp_2);
74497
+ this.newOnUp(onMove, interactionManager);
74216
74498
  }
74217
74499
  };
74500
+ DTableCellEdge.prototype.newOnUp = function (onMove, interactionManager) {
74501
+ var row = this._row;
74502
+ row.state.add(DTableState.RESIZING);
74503
+ var onUp = function () {
74504
+ row.state.remove(DTableState.RESIZING);
74505
+ interactionManager.off(UtilPointerEvent.move, onMove);
74506
+ interactionManager.off(UtilPointerEvent.up, onUp);
74507
+ interactionManager.off(UtilPointerEvent.upoutside, onUp);
74508
+ interactionManager.off(UtilPointerEvent.cancel, onUp);
74509
+ };
74510
+ interactionManager.on(UtilPointerEvent.move, onMove);
74511
+ interactionManager.on(UtilPointerEvent.up, onUp);
74512
+ interactionManager.on(UtilPointerEvent.upoutside, onUp);
74513
+ interactionManager.on(UtilPointerEvent.cancel, onUp);
74514
+ return onUp;
74515
+ };
74516
+ DTableCellEdge.prototype.isClicked = function (e) {
74517
+ return (e instanceof pixi_js.InteractionEvent &&
74518
+ (this._cell.state.is(DTableState.HOVERED_ON_EDGE) || this._dragged));
74519
+ };
74520
+ return DTableCellEdge;
74521
+ }());
74522
+
74523
+ /*
74524
+ * Copyright (C) 2019 Toshiba Corporation
74525
+ * SPDX-License-Identifier: Apache-2.0
74526
+ */
74527
+ var DTableCategoryCell = /** @class */ (function (_super) {
74528
+ __extends(DTableCategoryCell, _super);
74529
+ function DTableCategoryCell(category, columnIndex, column, options) {
74530
+ var _this = _super.call(this, options) || this;
74531
+ _this._category = category;
74532
+ _this._columnIndex = columnIndex;
74533
+ _this._column = column;
74534
+ _this._edge = new DTableCellEdge(_this._category, _this, columnIndex, _this.theme.getEdgeWidth());
74535
+ return _this;
74536
+ }
74537
+ Object.defineProperty(DTableCategoryCell.prototype, "column", {
74538
+ get: function () {
74539
+ return this._column;
74540
+ },
74541
+ enumerable: false,
74542
+ configurable: true
74543
+ });
74544
+ Object.defineProperty(DTableCategoryCell.prototype, "columnIndex", {
74545
+ get: function () {
74546
+ return this._columnIndex;
74547
+ },
74548
+ enumerable: false,
74549
+ configurable: true
74550
+ });
74551
+ Object.defineProperty(DTableCategoryCell.prototype, "category", {
74552
+ get: function () {
74553
+ return this._category;
74554
+ },
74555
+ enumerable: false,
74556
+ configurable: true
74557
+ });
74558
+ DTableCategoryCell.prototype.onDown = function (e) {
74559
+ if (!this._edge.onDown(e)) {
74560
+ _super.prototype.onDown.call(this, e);
74561
+ }
74562
+ };
74563
+ DTableCategoryCell.prototype.onOver = function (e) {
74564
+ _super.prototype.onOver.call(this, e);
74565
+ this._edge.onOver(e);
74566
+ };
74567
+ DTableCategoryCell.prototype.onOut = function (e) {
74568
+ _super.prototype.onOut.call(this, e);
74569
+ this._edge.onOut(e);
74570
+ };
74218
74571
  DTableCategoryCell.prototype.getType = function () {
74219
74572
  return "DTableCategoryCell";
74220
74573
  };
@@ -74248,7 +74601,7 @@
74248
74601
  _this._isLocked = false;
74249
74602
  _this.offset = 0.0;
74250
74603
  _this._columns = [column];
74251
- _this._nresizable = column.resizable ? 1 : 0;
74604
+ _this.resizable = column.resizable;
74252
74605
  var onResizeBound = function () {
74253
74606
  _this.onResize();
74254
74607
  };
@@ -74288,21 +74641,13 @@
74288
74641
  }
74289
74642
  }
74290
74643
  };
74291
- Object.defineProperty(DTableCategoryColumnImpl.prototype, "resizable", {
74292
- get: function () {
74293
- return 0 < this._nresizable;
74294
- },
74295
- enumerable: false,
74296
- configurable: true
74297
- });
74298
74644
  Object.defineProperty(DTableCategoryColumnImpl.prototype, "weight", {
74299
74645
  get: function () {
74300
74646
  return this._weight;
74301
74647
  },
74302
74648
  set: function (weight) {
74303
74649
  var oldWeight = this._weight;
74304
- var nresizable = this._nresizable;
74305
- if (0 < nresizable && oldWeight != null && oldWeight !== weight) {
74650
+ if (oldWeight != null && oldWeight !== weight) {
74306
74651
  var columns = this._columns;
74307
74652
  var columnsLength = columns.length;
74308
74653
  var minWeight = this.minWeight;
@@ -74310,22 +74655,22 @@
74310
74655
  if (this._weight !== newWeight) {
74311
74656
  this._isLocked = true;
74312
74657
  if (minWeight < oldWeight) {
74313
- var columnWeightRatio = (newWeight - minWeight) / (oldWeight - minWeight);
74658
+ // TODO: IMPROVE THIS
74659
+ var columnWeightRatio = newWeight / oldWeight;
74314
74660
  for (var i = 0; i < columnsLength; ++i) {
74315
74661
  var column = columns[i];
74316
74662
  var columnWeight = column.weight;
74317
- if (column.resizable && columnWeight != null) {
74318
- column.weight = columnWeight * columnWeightRatio;
74663
+ if (columnWeight != null) {
74664
+ column.weight = Math.max(column.minWeight, columnWeight * columnWeightRatio);
74319
74665
  }
74320
74666
  }
74321
74667
  }
74322
74668
  else {
74323
- var newColumnWeight = (newWeight - minWeight) / this._nresizable;
74324
74669
  for (var i = 0; i < columnsLength; ++i) {
74325
74670
  var column = columns[i];
74326
74671
  var columnWeight = column.weight;
74327
- if (column.resizable && columnWeight != null) {
74328
- column.weight = newColumnWeight;
74672
+ if (columnWeight != null) {
74673
+ column.weight = column.minWeight;
74329
74674
  }
74330
74675
  }
74331
74676
  }
@@ -74345,8 +74690,8 @@
74345
74690
  for (var i = 0; i < columnsLength; ++i) {
74346
74691
  var column = columns[i];
74347
74692
  var columnWeight = column.weight;
74348
- if (!column.resizable && columnWeight != null) {
74349
- result += columnWeight;
74693
+ if (columnWeight != null) {
74694
+ result += column.minWeight;
74350
74695
  }
74351
74696
  }
74352
74697
  return result;
@@ -74360,8 +74705,7 @@
74360
74705
  },
74361
74706
  set: function (width) {
74362
74707
  var oldWidth = this._width;
74363
- var nresizable = this._nresizable;
74364
- if (0 < nresizable && oldWidth != null && oldWidth !== width) {
74708
+ if (oldWidth != null && oldWidth !== width) {
74365
74709
  var columns = this._columns;
74366
74710
  var columnsLength = columns.length;
74367
74711
  var minWidth = this.minWidth;
@@ -74369,22 +74713,22 @@
74369
74713
  if (oldWidth !== newWidth) {
74370
74714
  this._isLocked = true;
74371
74715
  if (minWidth < oldWidth) {
74372
- var columnWidthRatio = (newWidth - minWidth) / (oldWidth - minWidth);
74716
+ // TODO: IMPROVE THIS
74717
+ var columnWidthRatio = newWidth / oldWidth;
74373
74718
  for (var i = 0; i < columnsLength; ++i) {
74374
74719
  var column = columns[i];
74375
74720
  var columnWidth = column.width;
74376
- if (column.resizable && columnWidth != null) {
74377
- column.width = columnWidth * columnWidthRatio;
74721
+ if (columnWidth != null) {
74722
+ column.width = Math.max(column.minWidth, columnWidth * columnWidthRatio);
74378
74723
  }
74379
74724
  }
74380
74725
  }
74381
74726
  else {
74382
- var newColumnWidth = (newWidth - minWidth) / this._nresizable;
74383
74727
  for (var i = 0; i < columnsLength; ++i) {
74384
74728
  var column = columns[i];
74385
74729
  var columnWidth = column.width;
74386
- if (column.resizable && columnWidth != null) {
74387
- column.width = newColumnWidth;
74730
+ if (columnWidth != null) {
74731
+ column.width = column.minWidth;
74388
74732
  }
74389
74733
  }
74390
74734
  }
@@ -74404,8 +74748,8 @@
74404
74748
  for (var i = 0; i < columnsLength; ++i) {
74405
74749
  var column = columns[i];
74406
74750
  var columnWidth = column.width;
74407
- if (!column.resizable && columnWidth != null) {
74408
- result += columnWidth;
74751
+ if (columnWidth != null) {
74752
+ result += column.minWidth;
74409
74753
  }
74410
74754
  }
74411
74755
  return result;
@@ -74419,9 +74763,6 @@
74419
74763
  var weight = column.weight;
74420
74764
  if (weight != null) {
74421
74765
  this._weight += weight;
74422
- if (column.resizable) {
74423
- this._nresizable += 1;
74424
- }
74425
74766
  column.on("resize", this._onResizeBound);
74426
74767
  }
74427
74768
  }
@@ -74429,9 +74770,6 @@
74429
74770
  var width = column.width;
74430
74771
  if (width != null) {
74431
74772
  this._width += width;
74432
- if (column.resizable) {
74433
- this._nresizable += 1;
74434
- }
74435
74773
  column.on("resize", this._onResizeBound);
74436
74774
  }
74437
74775
  }
@@ -74560,7 +74898,7 @@
74560
74898
  }
74561
74899
  return result;
74562
74900
  };
74563
- DTableCategoryContainerImpl.prototype.isCategory = function (index, a, b) {
74901
+ DTableCategoryContainerImpl.prototype.isEqual = function (index, a, b) {
74564
74902
  if (a != null) {
74565
74903
  if (b != null) {
74566
74904
  if (isString(a)) {
@@ -74658,12 +74996,19 @@
74658
74996
  if (i !== frozen &&
74659
74997
  ccolumn &&
74660
74998
  tcolumn &&
74661
- this.isCategory(index, tcolumn.category, column.category)) {
74662
- if (ccolumn.weight != null && column.weight != null) {
74663
- ccolumn.add(column);
74664
- }
74665
- else if (ccolumn.width != null && column.width != null) {
74666
- ccolumn.add(column);
74999
+ this.isEqual(index, tcolumn.category, column.category)) {
75000
+ if (ccolumn.resizable === column.resizable) {
75001
+ if (ccolumn.weight != null && column.weight != null) {
75002
+ ccolumn.add(column);
75003
+ }
75004
+ else if (ccolumn.width != null && column.width != null) {
75005
+ ccolumn.add(column);
75006
+ }
75007
+ else {
75008
+ tcolumn = column;
75009
+ ccolumn = new DTableCategoryColumnImpl(index, column);
75010
+ result.push(ccolumn);
75011
+ }
74667
75012
  }
74668
75013
  else {
74669
75014
  tcolumn = column;
@@ -74995,7 +75340,9 @@
74995
75340
  var getter = toGetter(options, type, path);
74996
75341
  var setter = toSetter(options, type, path);
74997
75342
  _this._weight = weight;
75343
+ _this.minWeight = 0;
74998
75344
  _this._width = width;
75345
+ _this.minWidth = 0;
74999
75346
  _this.resizable = (_b = options.resizable) !== null && _b !== void 0 ? _b : false;
75000
75347
  _this.type = type;
75001
75348
  _this.label = label;
@@ -76139,12 +76486,6 @@
76139
76486
  * Copyright (C) 2019 Toshiba Corporation
76140
76487
  * SPDX-License-Identifier: Apache-2.0
76141
76488
  */
76142
- var DTableHeaderCellEdge = {
76143
- NONE: 0,
76144
- LEFT: 1,
76145
- RIGHT: 2,
76146
- BOTH: 3
76147
- };
76148
76489
  var DTableHeaderCell = /** @class */ (function (_super) {
76149
76490
  __extends(DTableHeaderCell, _super);
76150
76491
  function DTableHeaderCell(header, columnIndex, column, options) {
@@ -76154,8 +76495,7 @@
76154
76495
  _this._columnIndex = columnIndex;
76155
76496
  var check = new DTableHeaderCellCheck(_this, options === null || options === void 0 ? void 0 : options.check);
76156
76497
  _this._check = check;
76157
- _this._edgeSize = _this.theme.getEdgeWidth();
76158
- _this._wasResizing = false;
76498
+ _this._edge = new DTableCellEdge(_this._header, _this, columnIndex, _this.theme.getEdgeWidth());
76159
76499
  var sortable = column.sorting.enable;
76160
76500
  var checkable = check.isEnabled;
76161
76501
  if (checkable || sortable) {
@@ -76199,200 +76539,17 @@
76199
76539
  configurable: true
76200
76540
  });
76201
76541
  DTableHeaderCell.prototype.onDown = function (e) {
76202
- var edges = this.state.valueOf(DTableState.HOVERED_ON_EDGE);
76203
- if (edges != null) {
76204
- this._wasResizing = true;
76205
- var layer = DApplications.getLayer(this);
76206
- if (layer != null) {
76207
- var interactionManager = layer.renderer.plugins.interaction;
76208
- var columnIndex = this._columnIndex;
76209
- if (edges === DTableHeaderCellEdge.LEFT) {
76210
- this.onDownEdge(e.data.global.x, columnIndex - 1, interactionManager);
76211
- }
76212
- else {
76213
- this.onDownEdge(e.data.global.x, columnIndex, interactionManager);
76214
- }
76215
- }
76216
- }
76217
- else {
76218
- this._wasResizing = false;
76542
+ if (!this._edge.onDown(e)) {
76219
76543
  _super.prototype.onDown.call(this, e);
76220
76544
  }
76221
76545
  };
76222
- DTableHeaderCell.prototype.findLeftResizableCell = function (columnIndex) {
76223
- var children = this._header.children;
76224
- var childrenLength = children.length;
76225
- for (var i = columnIndex; 0 <= i; --i) {
76226
- var child = children[childrenLength - i - 1];
76227
- if (child.column.resizable) {
76228
- return child;
76229
- }
76230
- }
76231
- return null;
76232
- };
76233
- DTableHeaderCell.prototype.findRightResizableCellOfWeight = function (columnIndex) {
76234
- var children = this._header.children;
76235
- var childrenLength = children.length;
76236
- for (var i = columnIndex + 1; i < childrenLength; ++i) {
76237
- var child = children[childrenLength - i - 1];
76238
- var childColumn = child.column;
76239
- if (childColumn.resizable) {
76240
- var childColumnWeight = childColumn.weight;
76241
- if (childColumnWeight != null) {
76242
- return child;
76243
- }
76244
- }
76245
- }
76246
- return null;
76247
- };
76248
- DTableHeaderCell.prototype.checkIfEdgeResizable = function (columnIndex) {
76249
- var target = this.findLeftResizableCell(columnIndex);
76250
- if (target != null) {
76251
- if (target.column.weight != null) {
76252
- return this.findRightResizableCellOfWeight(target.columnIndex) != null;
76253
- }
76254
- else {
76255
- return true;
76256
- }
76257
- }
76258
- return false;
76259
- };
76260
- DTableHeaderCell.prototype.getResizableEdges = function () {
76261
- var result = this._resizableEdges;
76262
- if (result == null) {
76263
- var columnIndex = this._columnIndex;
76264
- if (this.checkIfEdgeResizable(columnIndex - 1)) {
76265
- if (this.checkIfEdgeResizable(columnIndex)) {
76266
- result = DTableHeaderCellEdge.BOTH;
76267
- }
76268
- else {
76269
- result = DTableHeaderCellEdge.LEFT;
76270
- }
76271
- }
76272
- else {
76273
- if (this.checkIfEdgeResizable(columnIndex)) {
76274
- result = DTableHeaderCellEdge.RIGHT;
76275
- }
76276
- else {
76277
- result = DTableHeaderCellEdge.NONE;
76278
- }
76279
- }
76280
- this._resizableEdges = result;
76281
- }
76282
- return result;
76283
- };
76284
76546
  DTableHeaderCell.prototype.onOver = function (e) {
76285
- var _this = this;
76286
- var _a;
76287
76547
  _super.prototype.onOver.call(this, e);
76288
- if (this.getResizableEdges() !== DTableHeaderCellEdge.NONE) {
76289
- var onHoveredBound = ((_a = this._onHoveredBound) !== null && _a !== void 0 ? _a : (this._onHoveredBound = function (event) {
76290
- _this.onHovered(event);
76291
- }));
76292
- this.on(UtilPointerEvent.move, onHoveredBound);
76293
- // Since the cursor is set by InteractionManager before this method is called,
76294
- // the cursor need to be overriden.
76295
- this.onHovered(e);
76296
- var layer = DApplications.getLayer(this);
76297
- if (layer != null) {
76298
- layer.renderer.plugins.interaction.cursor = this.cursor;
76299
- }
76300
- }
76548
+ this._edge.onOver(e);
76301
76549
  };
76302
76550
  DTableHeaderCell.prototype.onOut = function (e) {
76303
76551
  _super.prototype.onOut.call(this, e);
76304
- var onHoveredBound = this._onHoveredBound;
76305
- if (onHoveredBound != null) {
76306
- this.state.remove(DTableState.HOVERED_ON_EDGE);
76307
- this.off(UtilPointerEvent.move, onHoveredBound);
76308
- }
76309
- };
76310
- DTableHeaderCell.prototype.onHovered = function (e) {
76311
- var width = this.width;
76312
- var x = this.toClickPosition(e);
76313
- var edgeSize = this._edgeSize;
76314
- if (0 <= x && x <= edgeSize) {
76315
- if (this.getResizableEdges() & DTableHeaderCellEdge.LEFT) {
76316
- this.state.add(DTableState.HOVERED_ON_EDGE, DTableHeaderCellEdge.LEFT);
76317
- }
76318
- else {
76319
- this.state.remove(DTableState.HOVERED_ON_EDGE);
76320
- }
76321
- }
76322
- else if (width - edgeSize <= x && x <= width) {
76323
- if (this.getResizableEdges() & DTableHeaderCellEdge.RIGHT) {
76324
- this.state.add(DTableState.HOVERED_ON_EDGE, DTableHeaderCellEdge.RIGHT);
76325
- }
76326
- else {
76327
- this.state.remove(DTableState.HOVERED_ON_EDGE);
76328
- }
76329
- }
76330
- else {
76331
- this.state.remove(DTableState.HOVERED_ON_EDGE);
76332
- }
76333
- };
76334
- DTableHeaderCell.prototype.onDownEdge = function (onDownPoint, columnIndex, interactionManager) {
76335
- // Find the resizable cell
76336
- var left = this.findLeftResizableCell(columnIndex);
76337
- if (left == null) {
76338
- // No resizable cell
76339
- return;
76340
- }
76341
- var header = this._header;
76342
- var leftColumn = left.column;
76343
- var leftOldWidth = left.width;
76344
- var leftOldWeight = left.weight;
76345
- if (leftColumn.weight == null) {
76346
- header.state.add(DTableState.RESIZING);
76347
- var onMove_1 = function (e) {
76348
- leftColumn.width = Math.max(1, leftOldWidth + e.data.global.x - onDownPoint);
76349
- };
76350
- var onUp_1 = function (e) {
76351
- header.state.remove(DTableState.RESIZING);
76352
- interactionManager.off(UtilPointerEvent.move, onMove_1);
76353
- interactionManager.off(UtilPointerEvent.up, onUp_1);
76354
- interactionManager.off(UtilPointerEvent.upoutside, onUp_1);
76355
- interactionManager.off(UtilPointerEvent.cancel, onUp_1);
76356
- };
76357
- interactionManager.on(UtilPointerEvent.move, onMove_1);
76358
- interactionManager.on(UtilPointerEvent.up, onUp_1);
76359
- interactionManager.on(UtilPointerEvent.upoutside, onUp_1);
76360
- interactionManager.on(UtilPointerEvent.cancel, onUp_1);
76361
- }
76362
- else {
76363
- var right = this.findRightResizableCellOfWeight(left.columnIndex);
76364
- if (right == null) {
76365
- // No right resizable cell found
76366
- return;
76367
- }
76368
- var rightColumn_1 = right.column;
76369
- var rightOldWeight = right.weight;
76370
- var rightOldWidth = right.width;
76371
- var totalWidth_1 = leftOldWidth + rightOldWidth;
76372
- var totalWeight_1 = leftOldWeight + rightOldWeight;
76373
- if (totalWidth_1 <= 0) {
76374
- // The left and right resizable cells doesn't have non-zero width
76375
- return;
76376
- }
76377
- header.state.add(DTableState.RESIZING);
76378
- var onMove_2 = function (e) {
76379
- var leftNewWidth = Math.max(0, Math.min(totalWidth_1, leftOldWidth + e.data.global.x - onDownPoint));
76380
- var leftNewWeight = totalWeight_1 * (leftNewWidth / totalWidth_1);
76381
- leftColumn.weight = leftNewWeight;
76382
- rightColumn_1.weight = totalWeight_1 - leftNewWeight;
76383
- };
76384
- var onUp_2 = function (e) {
76385
- header.state.remove(DTableState.RESIZING);
76386
- interactionManager.off(UtilPointerEvent.move, onMove_2);
76387
- interactionManager.off(UtilPointerEvent.up, onUp_2);
76388
- interactionManager.off(UtilPointerEvent.upoutside, onUp_2);
76389
- interactionManager.off(UtilPointerEvent.cancel, onUp_2);
76390
- };
76391
- interactionManager.on(UtilPointerEvent.move, onMove_2);
76392
- interactionManager.on(UtilPointerEvent.up, onUp_2);
76393
- interactionManager.on(UtilPointerEvent.upoutside, onUp_2);
76394
- interactionManager.on(UtilPointerEvent.cancel, onUp_2);
76395
- }
76552
+ this._edge.onOut(e);
76396
76553
  };
76397
76554
  Object.defineProperty(DTableHeaderCell.prototype, "sorter", {
76398
76555
  get: function () {
@@ -76480,10 +76637,6 @@
76480
76637
  }
76481
76638
  return false;
76482
76639
  };
76483
- DTableHeaderCell.prototype.isEdgeClicked = function (e) {
76484
- return (e instanceof pixi_js.InteractionEvent &&
76485
- (this.state.is(DTableState.HOVERED_ON_EDGE) || this._wasResizing));
76486
- };
76487
76640
  DTableHeaderCell.prototype.onClick = function (e) {
76488
76641
  if (this.state.isActionable) {
76489
76642
  this.activate(e);
@@ -76493,7 +76646,7 @@
76493
76646
  this.onActivate(e);
76494
76647
  };
76495
76648
  DTableHeaderCell.prototype.onActivate = function (e) {
76496
- if (!this.isEdgeClicked(e)) {
76649
+ if (!this._edge.isClicked(e)) {
76497
76650
  if (this.isCheckClicked(e)) {
76498
76651
  this.onToggleStart();
76499
76652
  this.onToggleEnd();
@@ -79436,7 +79589,6 @@
79436
79589
  DTableBodyCells: DTableBodyCells,
79437
79590
  DTableBodyRow: DTableBodyRow,
79438
79591
  DTableBody: DTableBody,
79439
- DTableCategoryCellEdge: DTableCategoryCellEdge,
79440
79592
  DTableCategoryCell: DTableCategoryCell,
79441
79593
  DTableCategoryColumnImpl: DTableCategoryColumnImpl,
79442
79594
  DTableCategoryContainerImpl: DTableCategoryContainerImpl,
@@ -79458,7 +79610,6 @@
79458
79610
  DTableDataTreeSorter: DTableDataTreeSorter,
79459
79611
  DTableDataTree: DTableDataTree,
79460
79612
  DTableHeaderCellCheck: DTableHeaderCellCheck,
79461
- DTableHeaderCellEdge: DTableHeaderCellEdge,
79462
79613
  DTableHeaderCell: DTableHeaderCell,
79463
79614
  DTableHeader: DTableHeader,
79464
79615
  DTableRow: DTableRow,