@wcardinal/wcardinal-ui 0.411.0 → 0.412.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 (89) hide show
  1. package/dist/types/wcardinal/ui/d-table-body-cell.d.ts +2 -2
  2. package/dist/types/wcardinal/ui/d-table-body-row.d.ts +9 -9
  3. package/dist/types/wcardinal/ui/d-table-body.d.ts +5 -7
  4. package/dist/types/wcardinal/ui/d-table-category-cell.d.ts +37 -0
  5. package/dist/types/wcardinal/ui/d-table-category-column-impl.d.ts +24 -0
  6. package/dist/types/wcardinal/ui/d-table-category-column.d.ts +10 -0
  7. package/dist/types/wcardinal/ui/d-table-category-container-impl.d.ts +12 -0
  8. package/dist/types/wcardinal/ui/d-table-category-container.d.ts +4 -0
  9. package/dist/types/wcardinal/ui/d-table-category.d.ts +13 -12
  10. package/dist/types/wcardinal/ui/d-table-column-container-impl.d.ts +25 -0
  11. package/dist/types/wcardinal/ui/d-table-column-container.d.ts +12 -0
  12. package/dist/types/wcardinal/ui/d-table-column-impl.d.ts +44 -0
  13. package/dist/types/wcardinal/ui/d-table-column.d.ts +22 -19
  14. package/dist/types/wcardinal/ui/d-table-header-cell-check.d.ts +1 -1
  15. package/dist/types/wcardinal/ui/d-table-header-cell.d.ts +34 -12
  16. package/dist/types/wcardinal/ui/d-table-header.d.ts +8 -9
  17. package/dist/types/wcardinal/ui/d-table-row.d.ts +8 -9
  18. package/dist/types/wcardinal/ui/d-table-state.d.ts +8 -0
  19. package/dist/types/wcardinal/ui/d-table.d.ts +15 -18
  20. package/dist/types/wcardinal/ui/theme/dark/d-theme-dark-table-header-cell.d.ts +1 -0
  21. package/dist/types/wcardinal/ui/theme/dark/d-theme-dark-table-header.d.ts +1 -0
  22. package/dist/types/wcardinal/ui/theme/white/d-theme-white-table-header-cell.d.ts +1 -0
  23. package/dist/types/wcardinal/ui/theme/white/d-theme-white-table-header.d.ts +1 -0
  24. package/dist/wcardinal/ui/d-base.js +2 -2
  25. package/dist/wcardinal/ui/d-base.js.map +1 -1
  26. package/dist/wcardinal/ui/d-table-body-cell.js.map +1 -1
  27. package/dist/wcardinal/ui/d-table-body-row.js +4 -4
  28. package/dist/wcardinal/ui/d-table-body-row.js.map +1 -1
  29. package/dist/wcardinal/ui/d-table-body.js +6 -15
  30. package/dist/wcardinal/ui/d-table-body.js.map +1 -1
  31. package/dist/wcardinal/ui/d-table-category-cell.js +244 -2
  32. package/dist/wcardinal/ui/d-table-category-cell.js.map +1 -1
  33. package/dist/wcardinal/ui/d-table-category-column-impl.js +222 -0
  34. package/dist/wcardinal/ui/d-table-category-column-impl.js.map +1 -0
  35. package/dist/wcardinal/ui/d-table-category-column.js +6 -0
  36. package/dist/wcardinal/ui/d-table-category-column.js.map +1 -0
  37. package/dist/wcardinal/ui/d-table-category-container-impl.js +149 -0
  38. package/dist/wcardinal/ui/d-table-category-container-impl.js.map +1 -0
  39. package/dist/wcardinal/ui/d-table-category-container.js +2 -0
  40. package/dist/wcardinal/ui/d-table-category-container.js.map +1 -0
  41. package/dist/wcardinal/ui/d-table-category.js +49 -7
  42. package/dist/wcardinal/ui/d-table-category.js.map +1 -1
  43. package/dist/wcardinal/ui/d-table-column-container-impl.js +126 -0
  44. package/dist/wcardinal/ui/d-table-column-container-impl.js.map +1 -0
  45. package/dist/wcardinal/ui/d-table-column-container.js +2 -0
  46. package/dist/wcardinal/ui/d-table-column-container.js.map +1 -0
  47. package/dist/wcardinal/ui/d-table-column-impl.js +375 -0
  48. package/dist/wcardinal/ui/d-table-column-impl.js.map +1 -0
  49. package/dist/wcardinal/ui/d-table-column.js.map +1 -1
  50. package/dist/wcardinal/ui/d-table-header-cell-check.js.map +1 -1
  51. package/dist/wcardinal/ui/d-table-header-cell.js +245 -48
  52. package/dist/wcardinal/ui/d-table-header-cell.js.map +1 -1
  53. package/dist/wcardinal/ui/d-table-header.js +8 -22
  54. package/dist/wcardinal/ui/d-table-header.js.map +1 -1
  55. package/dist/wcardinal/ui/d-table-row.js +7 -5
  56. package/dist/wcardinal/ui/d-table-row.js.map +1 -1
  57. package/dist/wcardinal/ui/d-table-state.js +9 -1
  58. package/dist/wcardinal/ui/d-table-state.js.map +1 -1
  59. package/dist/wcardinal/ui/d-table.js +69 -631
  60. package/dist/wcardinal/ui/d-table.js.map +1 -1
  61. package/dist/wcardinal/ui/theme/dark/d-theme-dark-table-header-cell.js +7 -1
  62. package/dist/wcardinal/ui/theme/dark/d-theme-dark-table-header-cell.js.map +1 -1
  63. package/dist/wcardinal/ui/theme/dark/d-theme-dark-table-header.js +7 -0
  64. package/dist/wcardinal/ui/theme/dark/d-theme-dark-table-header.js.map +1 -1
  65. package/dist/wcardinal/ui/theme/white/d-theme-white-table-header-cell.js +7 -1
  66. package/dist/wcardinal/ui/theme/white/d-theme-white-table-header-cell.js.map +1 -1
  67. package/dist/wcardinal/ui/theme/white/d-theme-white-table-header.js +7 -0
  68. package/dist/wcardinal/ui/theme/white/d-theme-white-table-header.js.map +1 -1
  69. package/dist/wcardinal-ui-theme-dark-en-us.js +14 -2
  70. package/dist/wcardinal-ui-theme-dark-en-us.min.js +2 -2
  71. package/dist/wcardinal-ui-theme-dark-en-us.min.js.map +1 -1
  72. package/dist/wcardinal-ui-theme-dark-ja-jp.js +14 -2
  73. package/dist/wcardinal-ui-theme-dark-ja-jp.min.js +2 -2
  74. package/dist/wcardinal-ui-theme-dark-ja-jp.min.js.map +1 -1
  75. package/dist/wcardinal-ui-theme-dark.js +14 -2
  76. package/dist/wcardinal-ui-theme-dark.min.js +2 -2
  77. package/dist/wcardinal-ui-theme-white-en-us.js +14 -2
  78. package/dist/wcardinal-ui-theme-white-en-us.min.js +2 -2
  79. package/dist/wcardinal-ui-theme-white-en-us.min.js.map +1 -1
  80. package/dist/wcardinal-ui-theme-white-ja-jp.js +14 -2
  81. package/dist/wcardinal-ui-theme-white-ja-jp.min.js +2 -2
  82. package/dist/wcardinal-ui-theme-white-ja-jp.min.js.map +1 -1
  83. package/dist/wcardinal-ui-theme-white.js +14 -2
  84. package/dist/wcardinal-ui-theme-white.min.js +2 -2
  85. package/dist/wcardinal-ui.cjs.js +1153 -371
  86. package/dist/wcardinal-ui.js +1127 -369
  87. package/dist/wcardinal-ui.min.js +2 -2
  88. package/dist/wcardinal-ui.min.js.map +1 -1
  89. package/package.json +1 -1
@@ -1,5 +1,5 @@
1
1
  /*
2
- Winter Cardinal UI v0.411.0
2
+ Winter Cardinal UI v0.412.0
3
3
  Copyright (C) 2019 Toshiba Corporation
4
4
  SPDX-License-Identifier: Apache-2.0
5
5
 
@@ -15178,10 +15178,10 @@
15178
15178
  this.emit("down", e, this);
15179
15179
  };
15180
15180
  DBase.prototype.onDownThis = function (e) {
15181
+ var _a;
15181
15182
  var oe = e.data.originalEvent;
15182
15183
  if ("touches" in oe) {
15183
- var lastDownPoint = this._lastDownPoint || new pixi_js.Point();
15184
- this._lastDownPoint = lastDownPoint;
15184
+ var lastDownPoint = ((_a = this._lastDownPoint) !== null && _a !== void 0 ? _a : (this._lastDownPoint = new pixi_js.Point()));
15185
15185
  lastDownPoint.copyFrom(e.data.global);
15186
15186
  }
15187
15187
  else {
@@ -71511,7 +71511,15 @@
71511
71511
  /**
71512
71512
  * Selectable row
71513
71513
  */
71514
- SELECTABLE: "SELECTABLE"
71514
+ SELECTABLE: "SELECTABLE",
71515
+ /**
71516
+ * Header or category cells hovered on their edges.
71517
+ */
71518
+ HOVERED_ON_EDGE: "HOVERED_ON_EDGE",
71519
+ /**
71520
+ * Header or category of being resized.
71521
+ */
71522
+ RESIZING: "RESIZING"
71515
71523
  };
71516
71524
 
71517
71525
  /*
@@ -72165,15 +72173,17 @@
72165
72173
  */
72166
72174
  var DTableRow = /** @class */ (function (_super) {
72167
72175
  __extends(DTableRow, _super);
72168
- function DTableRow(options) {
72169
- var _a, _b;
72176
+ function DTableRow(columns, frozen, options) {
72170
72177
  var _this = _super.call(this, options) || this;
72171
72178
  _this._reverse = true;
72172
- _this._frozen = (_a = options.frozen) !== null && _a !== void 0 ? _a : 0;
72173
- _this._columns = (_b = options.columns) !== null && _b !== void 0 ? _b : [];
72179
+ _this._frozen = frozen;
72180
+ _this._columns = columns;
72174
72181
  return _this;
72175
72182
  }
72176
- DTableRow.prototype.initCells = function (options, columns, frozen) {
72183
+ DTableRow.prototype.initCells = function () {
72184
+ var columns = this._columns;
72185
+ var frozen = this._frozen;
72186
+ var options = this._options;
72177
72187
  var iend = this.toIndexEnd(columns);
72178
72188
  for (var i = columns.length - 1; 0 <= i; --i) {
72179
72189
  var cell = this.newCell(i, columns[i], columns, options);
@@ -72265,8 +72275,8 @@
72265
72275
  */
72266
72276
  var DTableBodyRow = /** @class */ (function (_super) {
72267
72277
  __extends(DTableBodyRow, _super);
72268
- function DTableBodyRow(onChange, isEven, columnIndexToCellOptions, options) {
72269
- var _this = _super.call(this, options) || this;
72278
+ function DTableBodyRow(onChange, isEven, columnIndexToCellOptions, columns, frozen, options) {
72279
+ var _this = _super.call(this, columns, frozen, options) || this;
72270
72280
  _this._index = -1;
72271
72281
  _this._onChange = onChange;
72272
72282
  _this._onCellChangeBound = function (newValue, oldValue, row, rowIndex, columnIndex, column) {
@@ -72274,7 +72284,7 @@
72274
72284
  };
72275
72285
  _this._columnIndexToCellOptions = columnIndexToCellOptions;
72276
72286
  _this.state.isAlternated = !isEven;
72277
- _this.initCells(options, _this._columns, _this._frozen);
72287
+ _this.initCells();
72278
72288
  return _this;
72279
72289
  }
72280
72290
  DTableBodyRow.prototype.onCellChange = function (newValue, oldValue, row, rowIndex, columnIndex, column) {
@@ -72418,7 +72428,7 @@
72418
72428
  DTableBodyRow.prototype.toCellOptions = function (columnIndex, column, options) {
72419
72429
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
72420
72430
  var _p;
72421
- var result = toMerged(column.body, options.cell);
72431
+ var result = toMerged(column.body, options === null || options === void 0 ? void 0 : options.cell);
72422
72432
  // Weight
72423
72433
  result.weight = column.weight;
72424
72434
  // Width
@@ -73487,18 +73497,11 @@
73487
73497
  * SPDX-License-Identifier: Apache-2.0
73488
73498
  */
73489
73499
  var toRowOptions = function (theme, options, selectionType) {
73490
- var columns = options.columns || [];
73491
73500
  var result = options.row;
73492
73501
  if (result != null) {
73493
73502
  if (result.height == null) {
73494
73503
  result.height = theme.getRowHeight();
73495
73504
  }
73496
- if (result.columns === undefined) {
73497
- result.columns = columns;
73498
- }
73499
- if (result.frozen == null) {
73500
- result.frozen = options.frozen;
73501
- }
73502
73505
  if (result.selection === undefined) {
73503
73506
  result.selection = {
73504
73507
  type: selectionType
@@ -73510,9 +73513,7 @@
73510
73513
  }
73511
73514
  else {
73512
73515
  result = {
73513
- columns: columns,
73514
73516
  height: theme.getRowHeight(),
73515
- frozen: options.frozen,
73516
73517
  selection: {
73517
73518
  type: selectionType
73518
73519
  }
@@ -73522,18 +73523,18 @@
73522
73523
  };
73523
73524
  var DTableBody = /** @class */ (function (_super) {
73524
73525
  __extends(DTableBody, _super);
73525
- function DTableBody(options) {
73526
- var _a;
73526
+ function DTableBody(columns, frozen, offset, options) {
73527
73527
  var _this = _super.call(this, options) || this;
73528
- _this.transform.position.y = (_a = options.offset) !== null && _a !== void 0 ? _a : 0;
73528
+ _this.transform.position.y = offset;
73529
73529
  var data = _this.toData(options.data);
73530
73530
  _this._data = data;
73531
73531
  data.bind(_this);
73532
73532
  var theme = _this.theme;
73533
+ _this._columns = columns;
73534
+ _this._frozen = frozen;
73533
73535
  var rowOptions = toRowOptions(theme, options, data.selection.type);
73534
73536
  _this._rowOptions = rowOptions;
73535
73537
  _this._rowHeight = rowOptions.height != null ? rowOptions.height : theme.getRowHeight();
73536
- _this._columns = rowOptions.columns || [];
73537
73538
  _this._rowIndexMappedStart = 0;
73538
73539
  _this._rowIndexMappedEnd = 0;
73539
73540
  _this._updateRowsCount = 0;
@@ -73744,14 +73745,14 @@
73744
73745
  return row;
73745
73746
  };
73746
73747
  DTableBody.prototype.newRow = function (isEven) {
73747
- return new DTableBodyRow(this._onRowChangeBound, isEven, this._columnIndexToCellOptions, this._rowOptions);
73748
+ return new DTableBodyRow(this._onRowChangeBound, isEven, this._columnIndexToCellOptions, this._columns, this._frozen, this._rowOptions);
73748
73749
  };
73749
73750
  DTableBody.prototype.onParentMove = function (newX, newY, oldX, oldY) {
73750
73751
  _super.prototype.onParentMove.call(this, newX, newY, oldX, oldY);
73751
73752
  this.updateFrozenCellPosition(newX);
73752
73753
  };
73753
73754
  DTableBody.prototype.updateFrozenCellPosition = function (x) {
73754
- var frozen = this._rowOptions.frozen;
73755
+ var frozen = this._frozen;
73755
73756
  if (frozen != null && 0 < frozen) {
73756
73757
  var rows = this.children;
73757
73758
  for (var i = 0, imax = rows.length; i < imax; ++i) {
@@ -73966,11 +73967,249 @@
73966
73967
  * Copyright (C) 2019 Toshiba Corporation
73967
73968
  * SPDX-License-Identifier: Apache-2.0
73968
73969
  */
73970
+ var DTableCategoryCellEdge = {
73971
+ NONE: 0,
73972
+ LEFT: 1,
73973
+ RIGHT: 2,
73974
+ BOTH: 3
73975
+ };
73969
73976
  var DTableCategoryCell = /** @class */ (function (_super) {
73970
73977
  __extends(DTableCategoryCell, _super);
73971
- function DTableCategoryCell() {
73972
- return _super !== null && _super.apply(this, arguments) || this;
73978
+ function DTableCategoryCell(category, columnIndex, column, options) {
73979
+ var _this = _super.call(this, options) || this;
73980
+ _this._category = category;
73981
+ _this._columnIndex = columnIndex;
73982
+ _this._column = column;
73983
+ _this._edgeSize = _this.theme.getEdgeWidth();
73984
+ _this._wasResizing = false;
73985
+ return _this;
73973
73986
  }
73987
+ Object.defineProperty(DTableCategoryCell.prototype, "column", {
73988
+ get: function () {
73989
+ return this._column;
73990
+ },
73991
+ enumerable: false,
73992
+ configurable: true
73993
+ });
73994
+ Object.defineProperty(DTableCategoryCell.prototype, "columnIndex", {
73995
+ get: function () {
73996
+ return this._columnIndex;
73997
+ },
73998
+ enumerable: false,
73999
+ configurable: true
74000
+ });
74001
+ Object.defineProperty(DTableCategoryCell.prototype, "category", {
74002
+ get: function () {
74003
+ return this._category;
74004
+ },
74005
+ enumerable: false,
74006
+ configurable: true
74007
+ });
74008
+ DTableCategoryCell.prototype.onDown = function (e) {
74009
+ var edges = this.state.valueOf(DTableState.HOVERED_ON_EDGE);
74010
+ if (edges != null) {
74011
+ this._wasResizing = true;
74012
+ var layer = DApplications.getLayer(this);
74013
+ if (layer != null) {
74014
+ var interactionManager = layer.renderer.plugins.interaction;
74015
+ var columnIndex = this._columnIndex;
74016
+ if (edges === DTableCategoryCellEdge.LEFT) {
74017
+ this.onDownEdge(e.data.global.x, columnIndex - 1, interactionManager);
74018
+ }
74019
+ else {
74020
+ this.onDownEdge(e.data.global.x, columnIndex, interactionManager);
74021
+ }
74022
+ }
74023
+ }
74024
+ else {
74025
+ this._wasResizing = false;
74026
+ _super.prototype.onDown.call(this, e);
74027
+ }
74028
+ };
74029
+ DTableCategoryCell.prototype.findLeftResizableCell = function (columnIndex) {
74030
+ var children = this._category.children;
74031
+ var childrenLength = children.length;
74032
+ for (var i = columnIndex; 0 <= i; --i) {
74033
+ var child = children[childrenLength - i - 1];
74034
+ if (child.column.resizable) {
74035
+ return child;
74036
+ }
74037
+ }
74038
+ return null;
74039
+ };
74040
+ DTableCategoryCell.prototype.findRightResizableCellOfWeight = function (columnIndex) {
74041
+ var children = this._category.children;
74042
+ var childrenLength = children.length;
74043
+ for (var i = columnIndex + 1; i < childrenLength; ++i) {
74044
+ var child = children[childrenLength - i - 1];
74045
+ var childColumn = child.column;
74046
+ if (childColumn.resizable) {
74047
+ var childColumnWeight = childColumn.weight;
74048
+ if (childColumnWeight != null) {
74049
+ return child;
74050
+ }
74051
+ }
74052
+ }
74053
+ return null;
74054
+ };
74055
+ DTableCategoryCell.prototype.checkIfEdgeResizable = function (columnIndex) {
74056
+ var target = this.findLeftResizableCell(columnIndex);
74057
+ if (target != null) {
74058
+ if (target.column.weight != null) {
74059
+ return this.findRightResizableCellOfWeight(target.columnIndex) != null;
74060
+ }
74061
+ else {
74062
+ return true;
74063
+ }
74064
+ }
74065
+ return false;
74066
+ };
74067
+ DTableCategoryCell.prototype.getResizableEdges = function () {
74068
+ var result = this._resizableEdges;
74069
+ if (result == null) {
74070
+ var columnIndex = this._columnIndex;
74071
+ if (this.checkIfEdgeResizable(columnIndex - 1)) {
74072
+ if (this.checkIfEdgeResizable(columnIndex)) {
74073
+ result = DTableCategoryCellEdge.BOTH;
74074
+ }
74075
+ else {
74076
+ result = DTableCategoryCellEdge.LEFT;
74077
+ }
74078
+ }
74079
+ else {
74080
+ if (this.checkIfEdgeResizable(columnIndex)) {
74081
+ result = DTableCategoryCellEdge.RIGHT;
74082
+ }
74083
+ else {
74084
+ result = DTableCategoryCellEdge.NONE;
74085
+ }
74086
+ }
74087
+ this._resizableEdges = result;
74088
+ }
74089
+ return result;
74090
+ };
74091
+ DTableCategoryCell.prototype.onOver = function (e) {
74092
+ var _this = this;
74093
+ var _a;
74094
+ _super.prototype.onOver.call(this, e);
74095
+ if (this.getResizableEdges() !== DTableCategoryCellEdge.NONE) {
74096
+ var onHoveredBound = ((_a = this._onHoveredBound) !== null && _a !== void 0 ? _a : (this._onHoveredBound = function (event) {
74097
+ _this.onHovered(event);
74098
+ }));
74099
+ this.on(UtilPointerEvent.move, onHoveredBound);
74100
+ // Since the cursor is set by InteractionManager before this method is called,
74101
+ // the cursor need to be overriden.
74102
+ this.onHovered(e);
74103
+ var layer = DApplications.getLayer(this);
74104
+ if (layer != null) {
74105
+ layer.renderer.plugins.interaction.cursor = this.cursor;
74106
+ }
74107
+ }
74108
+ };
74109
+ DTableCategoryCell.prototype.onOut = function (e) {
74110
+ _super.prototype.onOut.call(this, e);
74111
+ var onHoveredBound = this._onHoveredBound;
74112
+ if (onHoveredBound != null) {
74113
+ this.state.remove(DTableState.HOVERED_ON_EDGE);
74114
+ this.off(UtilPointerEvent.move, onHoveredBound);
74115
+ }
74116
+ };
74117
+ DTableCategoryCell.prototype.onHovered = function (e) {
74118
+ var width = this.width;
74119
+ var x = this.toClickPosition(e);
74120
+ var edgeSize = this._edgeSize;
74121
+ if (0 <= x && x <= edgeSize) {
74122
+ if (this.getResizableEdges() & DTableCategoryCellEdge.LEFT) {
74123
+ this.state.add(DTableState.HOVERED_ON_EDGE, DTableCategoryCellEdge.LEFT);
74124
+ }
74125
+ else {
74126
+ this.state.remove(DTableState.HOVERED_ON_EDGE);
74127
+ }
74128
+ }
74129
+ else if (width - edgeSize <= x && x <= width) {
74130
+ if (this.getResizableEdges() & DTableCategoryCellEdge.RIGHT) {
74131
+ this.state.add(DTableState.HOVERED_ON_EDGE, DTableCategoryCellEdge.RIGHT);
74132
+ }
74133
+ else {
74134
+ this.state.remove(DTableState.HOVERED_ON_EDGE);
74135
+ }
74136
+ }
74137
+ else {
74138
+ this.state.remove(DTableState.HOVERED_ON_EDGE);
74139
+ }
74140
+ };
74141
+ DTableCategoryCell.prototype.toClickPosition = function (e) {
74142
+ var _a;
74143
+ var checkWork = ((_a = this._checkWork) !== null && _a !== void 0 ? _a : (this._checkWork = new pixi_js.Point()));
74144
+ return e.data.getLocalPosition(this, checkWork).x;
74145
+ };
74146
+ DTableCategoryCell.prototype.onDownEdge = function (onDownPoint, columnIndex, interactionManager) {
74147
+ // Find the resizable cell
74148
+ var left = this.findLeftResizableCell(columnIndex);
74149
+ if (left == null) {
74150
+ // No resizable cell
74151
+ return;
74152
+ }
74153
+ var category = this._category;
74154
+ var leftColumn = left.column;
74155
+ var leftOldWidth = left.width;
74156
+ var leftOldWeight = left.weight;
74157
+ if (leftColumn.weight == null) {
74158
+ category.state.add(DTableState.RESIZING);
74159
+ var leftMinWidth_1 = leftColumn.minWidth;
74160
+ var onMove_1 = function (e) {
74161
+ leftColumn.width = Math.max(leftMinWidth_1, leftOldWidth + e.data.global.x - onDownPoint);
74162
+ };
74163
+ var onUp_1 = function (e) {
74164
+ category.state.remove(DTableState.RESIZING);
74165
+ interactionManager.off(UtilPointerEvent.move, onMove_1);
74166
+ interactionManager.off(UtilPointerEvent.up, onUp_1);
74167
+ interactionManager.off(UtilPointerEvent.upoutside, onUp_1);
74168
+ interactionManager.off(UtilPointerEvent.cancel, onUp_1);
74169
+ };
74170
+ interactionManager.on(UtilPointerEvent.move, onMove_1);
74171
+ interactionManager.on(UtilPointerEvent.up, onUp_1);
74172
+ interactionManager.on(UtilPointerEvent.upoutside, onUp_1);
74173
+ interactionManager.on(UtilPointerEvent.cancel, onUp_1);
74174
+ }
74175
+ else {
74176
+ var right = this.findRightResizableCellOfWeight(left.columnIndex);
74177
+ if (right == null) {
74178
+ // No right resizable cell found
74179
+ return;
74180
+ }
74181
+ var rightColumn_1 = right.column;
74182
+ var rightOldWeight = right.weight;
74183
+ var rightOldWidth = right.width;
74184
+ var totalWidth_1 = leftOldWidth + rightOldWidth;
74185
+ var totalWeight_1 = leftOldWeight + rightOldWeight;
74186
+ var leftMinWeight_1 = leftColumn.minWeight;
74187
+ var rightMinWeight = rightColumn_1.minWeight;
74188
+ var leftMaxWeight_1 = totalWeight_1 - rightMinWeight;
74189
+ if (totalWidth_1 <= 0 || leftMaxWeight_1 <= leftMinWeight_1) {
74190
+ // The left and right resizable cells doesn't non-zero width
74191
+ return;
74192
+ }
74193
+ category.state.add(DTableState.RESIZING);
74194
+ var onMove_2 = function (e) {
74195
+ var leftNewWidth = Math.max(0, Math.min(totalWidth_1, leftOldWidth + e.data.global.x - onDownPoint));
74196
+ var leftNewWeight = Math.max(leftMinWeight_1, Math.min(leftMaxWeight_1, totalWeight_1 * (leftNewWidth / totalWidth_1)));
74197
+ leftColumn.weight = leftNewWeight;
74198
+ rightColumn_1.weight = totalWeight_1 - leftNewWeight;
74199
+ };
74200
+ var onUp_2 = function (e) {
74201
+ category.state.remove(DTableState.RESIZING);
74202
+ interactionManager.off(UtilPointerEvent.move, onMove_2);
74203
+ interactionManager.off(UtilPointerEvent.up, onUp_2);
74204
+ interactionManager.off(UtilPointerEvent.upoutside, onUp_2);
74205
+ interactionManager.off(UtilPointerEvent.cancel, onUp_2);
74206
+ };
74207
+ interactionManager.on(UtilPointerEvent.move, onMove_2);
74208
+ interactionManager.on(UtilPointerEvent.up, onUp_2);
74209
+ interactionManager.on(UtilPointerEvent.upoutside, onUp_2);
74210
+ interactionManager.on(UtilPointerEvent.cancel, onUp_2);
74211
+ }
74212
+ };
73974
74213
  DTableCategoryCell.prototype.getType = function () {
73975
74214
  return "DTableCategoryCell";
73976
74215
  };
@@ -73983,15 +74222,53 @@
73983
74222
  */
73984
74223
  var DTableCategory = /** @class */ (function (_super) {
73985
74224
  __extends(DTableCategory, _super);
73986
- function DTableCategory(options) {
73987
- var _a;
73988
- var _this = _super.call(this, options) || this;
73989
- var offset = (_a = options.offset) !== null && _a !== void 0 ? _a : 0;
74225
+ function DTableCategory(columns, frozen, offset, options) {
74226
+ var _this = _super.call(this, columns, frozen, options) || this;
74227
+ _this._columns = columns;
74228
+ _this._frozen = frozen;
73990
74229
  _this._offset = offset;
73991
74230
  _this.transform.position.y = offset;
73992
- _this.initCells(options, _this._columns, _this._frozen);
74231
+ _this.initCells();
74232
+ for (var i = 0, imax = columns.length; i < imax; ++i) {
74233
+ var column = columns[i];
74234
+ column.on("resize", _this.newOnColumnResize(i, column));
74235
+ }
73993
74236
  return _this;
73994
74237
  }
74238
+ DTableCategory.prototype.newOnColumnResize = function (index, column) {
74239
+ var _this = this;
74240
+ return function () {
74241
+ _this.onColumnResize(index, column);
74242
+ };
74243
+ };
74244
+ DTableCategory.prototype.onColumnResize = function (index, column) {
74245
+ var columnWeight = column.weight;
74246
+ if (columnWeight != null) {
74247
+ this.onColumnResizeWeight(this, index, columnWeight);
74248
+ }
74249
+ else {
74250
+ var columnWidth = column.width;
74251
+ if (columnWidth != null) {
74252
+ this.onColumnResizeWidth(this, index, columnWidth);
74253
+ }
74254
+ }
74255
+ };
74256
+ DTableCategory.prototype.onColumnResizeWeight = function (row, index, columnWeight) {
74257
+ var cells = row.children;
74258
+ var cellsLength = cells.length;
74259
+ var cellsIndex = cellsLength - index - 1;
74260
+ if (0 <= cellsIndex && cellsIndex < cellsLength) {
74261
+ cells[cellsIndex].weight = columnWeight;
74262
+ }
74263
+ };
74264
+ DTableCategory.prototype.onColumnResizeWidth = function (row, index, columnWidth) {
74265
+ var cells = row.children;
74266
+ var cellsLength = cells.length;
74267
+ var cellsIndex = cellsLength - index - 1;
74268
+ if (0 <= cellsIndex && cellsIndex < cellsLength) {
74269
+ cells[cellsIndex].width = columnWidth;
74270
+ }
74271
+ };
73995
74272
  DTableCategory.prototype.onParentMove = function (newX, newY, oldX, oldY) {
73996
74273
  _super.prototype.onParentMove.call(this, newX, newY, oldX, oldY);
73997
74274
  this.transform.position.y = -newY + this._offset;
@@ -74005,16 +74282,20 @@
74005
74282
  return 0;
74006
74283
  };
74007
74284
  DTableCategory.prototype.newCell = function (columnIndex, column, columns, options) {
74008
- return new DTableCategoryCell(this.toCellOptions(columnIndex, column, options));
74285
+ return new DTableCategoryCell(this, columnIndex, column, this.toCellOptions(columnIndex, column, options));
74009
74286
  };
74010
74287
  DTableCategory.prototype.toCellOptions = function (columnIndex, column, options) {
74011
- var result = options.cell;
74288
+ var result = options === null || options === void 0 ? void 0 : options.cell;
74012
74289
  if (result) {
74290
+ // Weight
74013
74291
  result.weight = column.weight;
74292
+ // Width
74014
74293
  result.width = column.width;
74294
+ // Label
74015
74295
  var text = result.text || {};
74016
74296
  result.text = text;
74017
74297
  text.value = text.value || column.label;
74298
+ // Done
74018
74299
  return result;
74019
74300
  }
74020
74301
  else {
@@ -75004,24 +75285,37 @@
75004
75285
  * Copyright (C) 2019 Toshiba Corporation
75005
75286
  * SPDX-License-Identifier: Apache-2.0
75006
75287
  */
75288
+ var DTableHeaderCellEdge = {
75289
+ NONE: 0,
75290
+ LEFT: 1,
75291
+ RIGHT: 2,
75292
+ BOTH: 3
75293
+ };
75007
75294
  var DTableHeaderCell = /** @class */ (function (_super) {
75008
75295
  __extends(DTableHeaderCell, _super);
75009
- function DTableHeaderCell() {
75010
- return _super !== null && _super.apply(this, arguments) || this;
75011
- }
75012
- DTableHeaderCell.prototype.init = function (options) {
75013
- if (options != null) {
75014
- this._header = options.header;
75015
- this._column = options.column;
75016
- this._columnIndex = options.columnIndex;
75017
- this._check = new DTableHeaderCellCheck(this, options.check);
75018
- }
75019
- else {
75020
- this._check = new DTableHeaderCellCheck(this);
75296
+ function DTableHeaderCell(header, columnIndex, column, options) {
75297
+ var _this = _super.call(this, options) || this;
75298
+ _this._header = header;
75299
+ _this._column = column;
75300
+ _this._columnIndex = columnIndex;
75301
+ var check = new DTableHeaderCellCheck(_this, options === null || options === void 0 ? void 0 : options.check);
75302
+ _this._check = check;
75303
+ _this._edgeSize = _this.theme.getEdgeWidth();
75304
+ _this._wasResizing = false;
75305
+ var sortable = column.sorting.enable;
75306
+ var checkable = check.isEnabled;
75307
+ if (checkable || sortable) {
75308
+ _this.on(UtilPointerEvent.tap, function (e) {
75309
+ _this.onClick(e);
75310
+ });
75311
+ var state = _this.state;
75312
+ state.lock();
75313
+ state.set(DTableState.SORTABLE, sortable);
75314
+ state.set(DTableState.CHECKABLE, checkable);
75315
+ state.unlock();
75021
75316
  }
75022
- _super.prototype.init.call(this, options);
75023
- this.initOnClick(options);
75024
- };
75317
+ return _this;
75318
+ }
75025
75319
  Object.defineProperty(DTableHeaderCell.prototype, "column", {
75026
75320
  get: function () {
75027
75321
  return this._column;
@@ -75050,23 +75344,201 @@
75050
75344
  enumerable: false,
75051
75345
  configurable: true
75052
75346
  });
75053
- DTableHeaderCell.prototype.initOnClick = function (options) {
75347
+ DTableHeaderCell.prototype.onDown = function (e) {
75348
+ var edges = this.state.valueOf(DTableState.HOVERED_ON_EDGE);
75349
+ if (edges != null) {
75350
+ this._wasResizing = true;
75351
+ var layer = DApplications.getLayer(this);
75352
+ if (layer != null) {
75353
+ var interactionManager = layer.renderer.plugins.interaction;
75354
+ var columnIndex = this._columnIndex;
75355
+ if (edges === DTableHeaderCellEdge.LEFT) {
75356
+ this.onDownEdge(e.data.global.x, columnIndex - 1, interactionManager);
75357
+ }
75358
+ else {
75359
+ this.onDownEdge(e.data.global.x, columnIndex, interactionManager);
75360
+ }
75361
+ }
75362
+ }
75363
+ else {
75364
+ this._wasResizing = false;
75365
+ _super.prototype.onDown.call(this, e);
75366
+ }
75367
+ };
75368
+ DTableHeaderCell.prototype.findLeftResizableCell = function (columnIndex) {
75369
+ var children = this._header.children;
75370
+ var childrenLength = children.length;
75371
+ for (var i = columnIndex; 0 <= i; --i) {
75372
+ var child = children[childrenLength - i - 1];
75373
+ if (child.column.resizable) {
75374
+ return child;
75375
+ }
75376
+ }
75377
+ return null;
75378
+ };
75379
+ DTableHeaderCell.prototype.findRightResizableCellOfWeight = function (columnIndex) {
75380
+ var children = this._header.children;
75381
+ var childrenLength = children.length;
75382
+ for (var i = columnIndex + 1; i < childrenLength; ++i) {
75383
+ var child = children[childrenLength - i - 1];
75384
+ var childColumn = child.column;
75385
+ if (childColumn.resizable) {
75386
+ var childColumnWeight = childColumn.weight;
75387
+ if (childColumnWeight != null) {
75388
+ return child;
75389
+ }
75390
+ }
75391
+ }
75392
+ return null;
75393
+ };
75394
+ DTableHeaderCell.prototype.checkIfEdgeResizable = function (columnIndex) {
75395
+ var target = this.findLeftResizableCell(columnIndex);
75396
+ if (target != null) {
75397
+ if (target.column.weight != null) {
75398
+ return this.findRightResizableCellOfWeight(target.columnIndex) != null;
75399
+ }
75400
+ else {
75401
+ return true;
75402
+ }
75403
+ }
75404
+ return false;
75405
+ };
75406
+ DTableHeaderCell.prototype.getResizableEdges = function () {
75407
+ var result = this._resizableEdges;
75408
+ if (result == null) {
75409
+ var columnIndex = this._columnIndex;
75410
+ if (this.checkIfEdgeResizable(columnIndex - 1)) {
75411
+ if (this.checkIfEdgeResizable(columnIndex)) {
75412
+ result = DTableHeaderCellEdge.BOTH;
75413
+ }
75414
+ else {
75415
+ result = DTableHeaderCellEdge.LEFT;
75416
+ }
75417
+ }
75418
+ else {
75419
+ if (this.checkIfEdgeResizable(columnIndex)) {
75420
+ result = DTableHeaderCellEdge.RIGHT;
75421
+ }
75422
+ else {
75423
+ result = DTableHeaderCellEdge.NONE;
75424
+ }
75425
+ }
75426
+ this._resizableEdges = result;
75427
+ }
75428
+ return result;
75429
+ };
75430
+ DTableHeaderCell.prototype.onOver = function (e) {
75054
75431
  var _this = this;
75055
- var column = this._column;
75056
- if (column) {
75057
- var sortable = column.sorting.enable;
75058
- var checkable = this._check.isEnabled;
75059
- if (checkable || sortable) {
75060
- this.on(UtilPointerEvent.tap, function (e) {
75061
- _this.onClick(e);
75062
- });
75063
- var state = this.state;
75064
- state.lock();
75065
- state.set(DTableState.SORTABLE, sortable);
75066
- state.set(DTableState.CHECKABLE, checkable);
75067
- state.unlock();
75432
+ var _a;
75433
+ _super.prototype.onOver.call(this, e);
75434
+ if (this.getResizableEdges() !== DTableHeaderCellEdge.NONE) {
75435
+ var onHoveredBound = ((_a = this._onHoveredBound) !== null && _a !== void 0 ? _a : (this._onHoveredBound = function (event) {
75436
+ _this.onHovered(event);
75437
+ }));
75438
+ this.on(UtilPointerEvent.move, onHoveredBound);
75439
+ // Since the cursor is set by InteractionManager before this method is called,
75440
+ // the cursor need to be overriden.
75441
+ this.onHovered(e);
75442
+ var layer = DApplications.getLayer(this);
75443
+ if (layer != null) {
75444
+ layer.renderer.plugins.interaction.cursor = this.cursor;
75445
+ }
75446
+ }
75447
+ };
75448
+ DTableHeaderCell.prototype.onOut = function (e) {
75449
+ _super.prototype.onOut.call(this, e);
75450
+ var onHoveredBound = this._onHoveredBound;
75451
+ if (onHoveredBound != null) {
75452
+ this.state.remove(DTableState.HOVERED_ON_EDGE);
75453
+ this.off(UtilPointerEvent.move, onHoveredBound);
75454
+ }
75455
+ };
75456
+ DTableHeaderCell.prototype.onHovered = function (e) {
75457
+ var width = this.width;
75458
+ var x = this.toClickPosition(e);
75459
+ var edgeSize = this._edgeSize;
75460
+ if (0 <= x && x <= edgeSize) {
75461
+ if (this.getResizableEdges() & DTableHeaderCellEdge.LEFT) {
75462
+ this.state.add(DTableState.HOVERED_ON_EDGE, DTableHeaderCellEdge.LEFT);
75463
+ }
75464
+ else {
75465
+ this.state.remove(DTableState.HOVERED_ON_EDGE);
75068
75466
  }
75069
75467
  }
75468
+ else if (width - edgeSize <= x && x <= width) {
75469
+ if (this.getResizableEdges() & DTableHeaderCellEdge.RIGHT) {
75470
+ this.state.add(DTableState.HOVERED_ON_EDGE, DTableHeaderCellEdge.RIGHT);
75471
+ }
75472
+ else {
75473
+ this.state.remove(DTableState.HOVERED_ON_EDGE);
75474
+ }
75475
+ }
75476
+ else {
75477
+ this.state.remove(DTableState.HOVERED_ON_EDGE);
75478
+ }
75479
+ };
75480
+ DTableHeaderCell.prototype.onDownEdge = function (onDownPoint, columnIndex, interactionManager) {
75481
+ // Find the resizable cell
75482
+ var left = this.findLeftResizableCell(columnIndex);
75483
+ if (left == null) {
75484
+ // No resizable cell
75485
+ return;
75486
+ }
75487
+ var header = this._header;
75488
+ var leftColumn = left.column;
75489
+ var leftOldWidth = left.width;
75490
+ var leftOldWeight = left.weight;
75491
+ if (leftColumn.weight == null) {
75492
+ header.state.add(DTableState.RESIZING);
75493
+ var onMove_1 = function (e) {
75494
+ leftColumn.width = Math.max(1, leftOldWidth + e.data.global.x - onDownPoint);
75495
+ };
75496
+ var onUp_1 = function (e) {
75497
+ header.state.remove(DTableState.RESIZING);
75498
+ interactionManager.off(UtilPointerEvent.move, onMove_1);
75499
+ interactionManager.off(UtilPointerEvent.up, onUp_1);
75500
+ interactionManager.off(UtilPointerEvent.upoutside, onUp_1);
75501
+ interactionManager.off(UtilPointerEvent.cancel, onUp_1);
75502
+ };
75503
+ interactionManager.on(UtilPointerEvent.move, onMove_1);
75504
+ interactionManager.on(UtilPointerEvent.up, onUp_1);
75505
+ interactionManager.on(UtilPointerEvent.upoutside, onUp_1);
75506
+ interactionManager.on(UtilPointerEvent.cancel, onUp_1);
75507
+ }
75508
+ else {
75509
+ var right = this.findRightResizableCellOfWeight(left.columnIndex);
75510
+ if (right == null) {
75511
+ // No right resizable cell found
75512
+ return;
75513
+ }
75514
+ var rightColumn_1 = right.column;
75515
+ var rightOldWeight = right.weight;
75516
+ var rightOldWidth = right.width;
75517
+ var totalWidth_1 = leftOldWidth + rightOldWidth;
75518
+ var totalWeight_1 = leftOldWeight + rightOldWeight;
75519
+ if (totalWidth_1 <= 0) {
75520
+ // The left and right resizable cells doesn't have non-zero width
75521
+ return;
75522
+ }
75523
+ header.state.add(DTableState.RESIZING);
75524
+ var onMove_2 = function (e) {
75525
+ var leftNewWidth = Math.max(0, Math.min(totalWidth_1, leftOldWidth + e.data.global.x - onDownPoint));
75526
+ var leftNewWeight = totalWeight_1 * (leftNewWidth / totalWidth_1);
75527
+ leftColumn.weight = leftNewWeight;
75528
+ rightColumn_1.weight = totalWeight_1 - leftNewWeight;
75529
+ };
75530
+ var onUp_2 = function (e) {
75531
+ header.state.remove(DTableState.RESIZING);
75532
+ interactionManager.off(UtilPointerEvent.move, onMove_2);
75533
+ interactionManager.off(UtilPointerEvent.up, onUp_2);
75534
+ interactionManager.off(UtilPointerEvent.upoutside, onUp_2);
75535
+ interactionManager.off(UtilPointerEvent.cancel, onUp_2);
75536
+ };
75537
+ interactionManager.on(UtilPointerEvent.move, onMove_2);
75538
+ interactionManager.on(UtilPointerEvent.up, onUp_2);
75539
+ interactionManager.on(UtilPointerEvent.upoutside, onUp_2);
75540
+ interactionManager.on(UtilPointerEvent.cancel, onUp_2);
75541
+ }
75070
75542
  };
75071
75543
  Object.defineProperty(DTableHeaderCell.prototype, "sorter", {
75072
75544
  get: function () {
@@ -75101,11 +75573,7 @@
75101
75573
  });
75102
75574
  Object.defineProperty(DTableHeaderCell.prototype, "comparator", {
75103
75575
  get: function () {
75104
- var column = this._column;
75105
- if (column) {
75106
- return column.sorting.comparator || null;
75107
- }
75108
- return null;
75576
+ return this._column.sorting.comparator || null;
75109
75577
  },
75110
75578
  enumerable: false,
75111
75579
  configurable: true
@@ -75132,8 +75600,8 @@
75132
75600
  }
75133
75601
  };
75134
75602
  DTableHeaderCell.prototype.toClickPosition = function (e) {
75135
- var checkWork = this._checkWork || new pixi_js.Point();
75136
- this._checkWork = checkWork;
75603
+ var _a;
75604
+ var checkWork = ((_a = this._checkWork) !== null && _a !== void 0 ? _a : (this._checkWork = new pixi_js.Point()));
75137
75605
  return e.data.getLocalPosition(this, checkWork).x;
75138
75606
  };
75139
75607
  DTableHeaderCell.prototype.isCheckClicked = function (e) {
@@ -75158,6 +75626,10 @@
75158
75626
  }
75159
75627
  return false;
75160
75628
  };
75629
+ DTableHeaderCell.prototype.isEdgeClicked = function (e) {
75630
+ return (e instanceof pixi_js.InteractionEvent &&
75631
+ (this.state.is(DTableState.HOVERED_ON_EDGE) || this._wasResizing));
75632
+ };
75161
75633
  DTableHeaderCell.prototype.onClick = function (e) {
75162
75634
  if (this.state.isActionable) {
75163
75635
  this.activate(e);
@@ -75167,13 +75639,15 @@
75167
75639
  this.onActivate(e);
75168
75640
  };
75169
75641
  DTableHeaderCell.prototype.onActivate = function (e) {
75170
- if (this.isCheckClicked(e)) {
75171
- this.onToggleStart();
75172
- this.onToggleEnd();
75173
- }
75174
- else {
75175
- this.doSort(e);
75176
- this.emit("active", this);
75642
+ if (!this.isEdgeClicked(e)) {
75643
+ if (this.isCheckClicked(e)) {
75644
+ this.onToggleStart();
75645
+ this.onToggleEnd();
75646
+ }
75647
+ else {
75648
+ this.doSort(e);
75649
+ this.emit("active", this);
75650
+ }
75177
75651
  }
75178
75652
  };
75179
75653
  DTableHeaderCell.prototype.doSort = function (e) {
@@ -75203,11 +75677,14 @@
75203
75677
  };
75204
75678
  Object.defineProperty(DTableHeaderCell.prototype, "isSortable", {
75205
75679
  get: function () {
75206
- var column = this._column;
75207
- if (column) {
75208
- return column.sorting.enable;
75209
- }
75210
- return false;
75680
+ return this._column.sorting.enable;
75681
+ },
75682
+ enumerable: false,
75683
+ configurable: true
75684
+ });
75685
+ Object.defineProperty(DTableHeaderCell.prototype, "isResizable", {
75686
+ get: function () {
75687
+ return this._column.resizable;
75211
75688
  },
75212
75689
  enumerable: false,
75213
75690
  configurable: true
@@ -75297,14 +75774,12 @@
75297
75774
  */
75298
75775
  var DTableHeader = /** @class */ (function (_super) {
75299
75776
  __extends(DTableHeader, _super);
75300
- function DTableHeader(options) {
75301
- var _a, _b;
75302
- var _this = _super.call(this, options) || this;
75303
- _this._table = (_a = options.table) !== null && _a !== void 0 ? _a : null;
75304
- var offset = (_b = options.offset) !== null && _b !== void 0 ? _b : 0;
75777
+ function DTableHeader(table, columns, frozen, offset, options) {
75778
+ var _this = _super.call(this, columns, frozen, options) || this;
75779
+ _this._table = table;
75305
75780
  _this._offset = offset;
75306
75781
  _this.transform.position.y = offset;
75307
- _this.initCells(options, _this._columns, _this._frozen);
75782
+ _this.initCells();
75308
75783
  return _this;
75309
75784
  }
75310
75785
  Object.defineProperty(DTableHeader.prototype, "table", {
@@ -75327,10 +75802,10 @@
75327
75802
  return 0;
75328
75803
  };
75329
75804
  DTableHeader.prototype.newCell = function (columnIndex, column, columns, options) {
75330
- return new DTableHeaderCell(this.toCellOptions(columnIndex, column, options));
75805
+ return new DTableHeaderCell(this, columnIndex, column, this.toCellOptions(column, options));
75331
75806
  };
75332
- DTableHeader.prototype.toCellOptions = function (columnIndex, column, options) {
75333
- var result = column.header || options.cell;
75807
+ DTableHeader.prototype.toCellOptions = function (column, options) {
75808
+ var result = column.header || (options === null || options === void 0 ? void 0 : options.cell);
75334
75809
  if (result != null) {
75335
75810
  if (result.weight === undefined) {
75336
75811
  result.weight = column.weight;
@@ -75346,15 +75821,6 @@
75346
75821
  else if (result.text.value === undefined) {
75347
75822
  result.text.value = column.label;
75348
75823
  }
75349
- if (result.header === undefined) {
75350
- result.header = this;
75351
- }
75352
- if (result.column === undefined) {
75353
- result.column = column;
75354
- }
75355
- if (result.columnIndex === undefined) {
75356
- result.columnIndex = columnIndex;
75357
- }
75358
75824
  return result;
75359
75825
  }
75360
75826
  else {
@@ -75363,10 +75829,7 @@
75363
75829
  width: column.width,
75364
75830
  text: {
75365
75831
  value: column.label
75366
- },
75367
- header: this,
75368
- column: column,
75369
- columnIndex: columnIndex
75832
+ }
75370
75833
  };
75371
75834
  }
75372
75835
  };
@@ -75387,10 +75850,6 @@
75387
75850
  return DTableScrollBar;
75388
75851
  }(DPaneScrollBar));
75389
75852
 
75390
- /*
75391
- * Copyright (C) 2019 Toshiba Corporation
75392
- * SPDX-License-Identifier: Apache-2.0
75393
- */
75394
75853
  var defaultGetter = function (row, columnIndex) {
75395
75854
  return row[columnIndex];
75396
75855
  };
@@ -75451,7 +75910,7 @@
75451
75910
  };
75452
75911
  }
75453
75912
  };
75454
- var toColumnAlign = function (options, type) {
75913
+ var toAlign = function (options, type) {
75455
75914
  var align = options.align;
75456
75915
  if (align != null) {
75457
75916
  if (isString(align)) {
@@ -75481,7 +75940,7 @@
75481
75940
  return DAlignHorizontal.LEFT;
75482
75941
  }
75483
75942
  };
75484
- var toColumnDataChecker = function (path) {
75943
+ var toDataChecker = function (path) {
75485
75944
  if (path != null) {
75486
75945
  var pathLength_1 = path.length;
75487
75946
  if (pathLength_1 <= 1) {
@@ -75509,9 +75968,9 @@
75509
75968
  return columnIndex < row.length;
75510
75969
  };
75511
75970
  };
75512
- var toColumnEditingEnable = function (enable, path) {
75971
+ var toEditingEnable = function (enable, path) {
75513
75972
  if (isString(enable)) {
75514
- return toColumnDataChecker(path);
75973
+ return toDataChecker(path);
75515
75974
  }
75516
75975
  else if (enable != null) {
75517
75976
  return enable;
@@ -75520,20 +75979,20 @@
75520
75979
  return false;
75521
75980
  }
75522
75981
  };
75523
- var toColumnEditing = function (options, path) {
75982
+ var toEditing = function (options, path) {
75524
75983
  var _a;
75525
75984
  var editing = options.editing;
75526
75985
  var editable = options.editable;
75527
75986
  if (editing) {
75528
75987
  return {
75529
- enable: toColumnEditingEnable((_a = editing.enable) !== null && _a !== void 0 ? _a : editable, path),
75988
+ enable: toEditingEnable((_a = editing.enable) !== null && _a !== void 0 ? _a : editable, path),
75530
75989
  formatter: editing.formatter,
75531
75990
  unformatter: editing.unformatter,
75532
75991
  validator: editing.validator
75533
75992
  };
75534
75993
  }
75535
75994
  return {
75536
- enable: toColumnEditingEnable(editable, path)
75995
+ enable: toEditingEnable(editable, path)
75537
75996
  };
75538
75997
  };
75539
75998
  var toComparator = function (getter, index) {
@@ -75543,7 +76002,7 @@
75543
76002
  return valueA < valueB ? -1 : valueB < valueA ? +1 : 0;
75544
76003
  };
75545
76004
  };
75546
- var toColumnSorting = function (getter, index, options) {
76005
+ var toSorting = function (getter, index, options) {
75547
76006
  var sorting = options.sorting;
75548
76007
  var sortable = options.sortable;
75549
76008
  if (sorting) {
@@ -75567,7 +76026,7 @@
75567
76026
  enable: false
75568
76027
  };
75569
76028
  };
75570
- var toColumnMenu = function (options) {
76029
+ var toMenu = function (options) {
75571
76030
  if (options == null) {
75572
76031
  return undefined;
75573
76032
  }
@@ -75578,7 +76037,7 @@
75578
76037
  return new DMenu(options);
75579
76038
  }
75580
76039
  };
75581
- var toColumnDialog = function (options) {
76040
+ var toDialog = function (options) {
75582
76041
  if (options == null) {
75583
76042
  return undefined;
75584
76043
  }
@@ -75595,14 +76054,14 @@
75595
76054
  var defaultSelectingSetter = function () {
75596
76055
  // DO NOTHING
75597
76056
  };
75598
- var toColumnSelecting = function (options) {
76057
+ var toSelecting = function (options) {
75599
76058
  if (options) {
75600
76059
  return {
75601
76060
  getter: options.getter || defaultSelectingGetter,
75602
76061
  setter: options.setter || defaultSelectingSetter,
75603
- menu: toColumnMenu(options.menu),
75604
- multiple: toColumnMenu(options.multiple),
75605
- dialog: toColumnDialog(options.dialog),
76062
+ menu: toMenu(options.menu),
76063
+ multiple: toMenu(options.multiple),
76064
+ dialog: toDialog(options.dialog),
75606
76065
  promise: options.promise
75607
76066
  };
75608
76067
  }
@@ -75611,7 +76070,7 @@
75611
76070
  setter: defaultSelectingSetter
75612
76071
  };
75613
76072
  };
75614
- var toColumnGetter = function (options, type, parts) {
76073
+ var toGetter = function (options, type, parts) {
75615
76074
  var getter = options.getter;
75616
76075
  if (getter) {
75617
76076
  return getter;
@@ -75629,7 +76088,7 @@
75629
76088
  }
75630
76089
  }
75631
76090
  };
75632
- var toColumnSetter = function (options, type, path) {
76091
+ var toSetter = function (options, type, path) {
75633
76092
  var setter = options.setter;
75634
76093
  if (setter) {
75635
76094
  return setter;
@@ -75648,7 +76107,7 @@
75648
76107
  }
75649
76108
  }
75650
76109
  };
75651
- var toColumnState = function (options) {
76110
+ var toState = function (options) {
75652
76111
  var state = options.state;
75653
76112
  if (state != null) {
75654
76113
  if (isString(state) || isArray(state)) {
@@ -75669,155 +76128,445 @@
75669
76128
  modifier: undefined
75670
76129
  };
75671
76130
  };
75672
- var toColumnPath = function (options) {
76131
+ var toPath = function (options) {
75673
76132
  return options.path != null ? options.path.split(".") : null;
75674
76133
  };
75675
- var toColumnRenderable = function (options, path) {
76134
+ var toRenderable = function (options, path) {
75676
76135
  var renderable = options.renderable;
75677
76136
  if (isString(renderable)) {
75678
- return toColumnDataChecker(path);
76137
+ return toDataChecker(path);
75679
76138
  }
75680
76139
  else if (renderable != null) {
75681
76140
  return renderable;
75682
76141
  }
75683
76142
  return true;
75684
76143
  };
75685
- var toColumn = function (index, options) {
75686
- var _a, _b;
75687
- var weight = options.weight;
75688
- var width = options.width;
75689
- if (weight != null) {
75690
- if (width != null) {
75691
- width = undefined;
75692
- }
75693
- }
75694
- else if (width == null) {
75695
- weight = 1;
75696
- }
75697
- var type = toEnum((_a = options.type) !== null && _a !== void 0 ? _a : DTableColumnType.TEXT, DTableColumnType);
75698
- var align = toColumnAlign(options, type);
75699
- var label = options.label || "";
75700
- var path = toColumnPath(options);
75701
- var getter = toColumnGetter(options, type, path);
75702
- var setter = toColumnSetter(options, type, path);
75703
- return {
75704
- weight: weight,
75705
- width: width,
75706
- type: type,
75707
- label: label,
75708
- getter: getter,
75709
- setter: setter,
75710
- formatter: options.formatter,
75711
- renderable: toColumnRenderable(options, path),
75712
- align: align,
75713
- state: toColumnState(options),
75714
- editing: toColumnEditing(options, path),
75715
- sorting: toColumnSorting(getter, index, options),
75716
- header: options.header,
75717
- body: options.body,
75718
- selecting: toColumnSelecting(options.selecting),
75719
- category: options.category,
75720
- frozen: options.frozen,
75721
- offset: 0.0,
75722
- link: options.link,
75723
- update: toEnum((_b = options.update) !== null && _b !== void 0 ? _b : DTableColumnUpdate.CELL, DTableColumnUpdate)
75724
- };
75725
- };
75726
- var toColumns = function (options) {
75727
- var result = [];
75728
- for (var i = 0, imax = options.length; i < imax; ++i) {
75729
- result.push(toColumn(i, options[i]));
76144
+ var DTableColumnImpl = /** @class */ (function (_super) {
76145
+ __extends(DTableColumnImpl, _super);
76146
+ function DTableColumnImpl(index, options) {
76147
+ var _a, _b, _c;
76148
+ var _this = _super.call(this) || this;
76149
+ var weight = options.weight;
76150
+ var width = options.width;
76151
+ if (weight != null) {
76152
+ if (width != null) {
76153
+ width = undefined;
76154
+ }
76155
+ }
76156
+ else if (width == null) {
76157
+ weight = 1;
76158
+ }
76159
+ var type = toEnum((_a = options.type) !== null && _a !== void 0 ? _a : DTableColumnType.TEXT, DTableColumnType);
76160
+ var align = toAlign(options, type);
76161
+ var label = options.label || "";
76162
+ var path = toPath(options);
76163
+ var getter = toGetter(options, type, path);
76164
+ var setter = toSetter(options, type, path);
76165
+ _this._weight = weight;
76166
+ _this._width = width;
76167
+ _this.resizable = (_b = options.resizable) !== null && _b !== void 0 ? _b : false;
76168
+ _this.type = type;
76169
+ _this.label = label;
76170
+ _this.getter = getter;
76171
+ _this.setter = setter;
76172
+ _this.formatter = options.formatter;
76173
+ _this.renderable = toRenderable(options, path);
76174
+ _this.align = align;
76175
+ _this.state = toState(options);
76176
+ _this.editing = toEditing(options, path);
76177
+ _this.sorting = toSorting(getter, index, options);
76178
+ _this.header = options.header;
76179
+ _this.body = options.body;
76180
+ _this.selecting = toSelecting(options.selecting);
76181
+ _this.category = options.category;
76182
+ _this.frozen = options.frozen;
76183
+ _this.offset = 0.0;
76184
+ _this.link = options.link;
76185
+ _this.update = toEnum((_c = options.update) !== null && _c !== void 0 ? _c : DTableColumnUpdate.CELL, DTableColumnUpdate);
76186
+ return _this;
75730
76187
  }
75731
- return result;
75732
- };
75733
- var toFrozen = function (columns) {
75734
- for (var i = columns.length - 1; 0 <= i; --i) {
75735
- if (columns[i].frozen === true) {
75736
- return i + 1;
76188
+ Object.defineProperty(DTableColumnImpl.prototype, "weight", {
76189
+ get: function () {
76190
+ return this._weight;
76191
+ },
76192
+ set: function (weight) {
76193
+ if (this._weight != null && this._weight !== weight) {
76194
+ this._weight = weight;
76195
+ this.emit("resize", this);
76196
+ }
76197
+ },
76198
+ enumerable: false,
76199
+ configurable: true
76200
+ });
76201
+ Object.defineProperty(DTableColumnImpl.prototype, "width", {
76202
+ get: function () {
76203
+ return this._width;
76204
+ },
76205
+ set: function (width) {
76206
+ if (this._width != null && this._width !== width) {
76207
+ this._width = width;
76208
+ this.emit("resize", this);
76209
+ }
76210
+ },
76211
+ enumerable: false,
76212
+ configurable: true
76213
+ });
76214
+ return DTableColumnImpl;
76215
+ }(pixi_js.utils.EventEmitter));
76216
+
76217
+ var DTableColumnContainerImpl = /** @class */ (function (_super) {
76218
+ __extends(DTableColumnContainerImpl, _super);
76219
+ function DTableColumnContainerImpl(parent, options) {
76220
+ var _this = _super.call(this) || this;
76221
+ _this.parent = parent;
76222
+ var columns = [];
76223
+ if (options != null) {
76224
+ for (var i = 0, imax = options.length; i < imax; ++i) {
76225
+ var column = new DTableColumnImpl(i, options[i]);
76226
+ columns.push(column);
76227
+ column.on("resize", _this.newOnColumnResize(i, column));
76228
+ }
76229
+ }
76230
+ _this.items = columns;
76231
+ var frozen = 0;
76232
+ for (var i = columns.length - 1; 0 <= i; --i) {
76233
+ if (columns[i].frozen === true) {
76234
+ frozen = i + 1;
76235
+ break;
76236
+ }
75737
76237
  }
76238
+ _this.frozen = frozen;
76239
+ return _this;
75738
76240
  }
75739
- return 0;
75740
- };
75741
- var DTable = /** @class */ (function (_super) {
75742
- __extends(DTable, _super);
75743
- function DTable(options) {
75744
- var _this = _super.call(this, options) || this;
75745
- var content = _this.content;
75746
- content.setWidth(_this.toContentWidth(options));
75747
- var body = _this.body;
75748
- content.addChild(body);
75749
- if (body.data.selection.type !== DTableDataSelectionType.NONE) {
75750
- _this.on(UtilPointerEvent.tap, function (e) {
75751
- body.onRowClick(e);
75752
- });
76241
+ DTableColumnContainerImpl.prototype.newOnColumnResize = function (index, column) {
76242
+ var _this = this;
76243
+ return function () {
76244
+ _this.onColumnResize(index, column);
76245
+ };
76246
+ };
76247
+ DTableColumnContainerImpl.prototype.onColumnResize = function (index, column) {
76248
+ this.onColumnResizeHeader(index, column);
76249
+ this.onColumnResizeBody(index, column);
76250
+ this.emit("resize", index, column, this);
76251
+ };
76252
+ DTableColumnContainerImpl.prototype.onColumnResizeHeader = function (index, column) {
76253
+ var header = this.parent.header;
76254
+ if (header != null) {
76255
+ var columnWeight = column.weight;
76256
+ if (columnWeight != null) {
76257
+ this.onColumnResizeWeight(header, index, columnWeight);
76258
+ }
76259
+ else {
76260
+ var columnWidth = column.width;
76261
+ if (columnWidth != null) {
76262
+ this.onColumnResizeWidth(header, index, columnWidth);
76263
+ }
76264
+ }
75753
76265
  }
75754
- var header = _this.header;
75755
- if (header) {
75756
- content.addChild(header);
76266
+ };
76267
+ DTableColumnContainerImpl.prototype.onColumnResizeBody = function (index, column) {
76268
+ var rows = this.parent.body.children;
76269
+ var columnWeight = column.weight;
76270
+ if (columnWeight != null) {
76271
+ for (var i = 0, imax = rows.length; i < imax; ++i) {
76272
+ this.onColumnResizeWeight(rows[i], index, columnWeight);
76273
+ }
75757
76274
  }
75758
- var categories = _this.categories;
75759
- for (var i = categories.length - 1; 0 <= i; --i) {
75760
- content.addChild(categories[i]);
76275
+ else {
76276
+ var columnWidth = column.width;
76277
+ if (columnWidth != null) {
76278
+ for (var i = 0, imax = rows.length; i < imax; ++i) {
76279
+ this.onColumnResizeWidth(rows[i], index, columnWidth);
76280
+ }
76281
+ }
75761
76282
  }
75762
- body.update();
76283
+ };
76284
+ DTableColumnContainerImpl.prototype.onColumnResizeWeight = function (row, index, columnWeight) {
76285
+ var cells = row.children;
76286
+ var cellsLength = cells.length;
76287
+ var cellsIndex = cellsLength - index - 1;
76288
+ if (0 <= cellsIndex && cellsIndex < cellsLength) {
76289
+ cells[cellsIndex].weight = columnWeight;
76290
+ }
76291
+ };
76292
+ DTableColumnContainerImpl.prototype.onColumnResizeWidth = function (row, index, columnWidth) {
76293
+ var cells = row.children;
76294
+ var cellsLength = cells.length;
76295
+ var cellsIndex = cellsLength - index - 1;
76296
+ if (0 <= cellsIndex && cellsIndex < cellsLength) {
76297
+ cells[cellsIndex].width = columnWidth;
76298
+ }
76299
+ };
76300
+ Object.defineProperty(DTableColumnContainerImpl.prototype, "width", {
76301
+ get: function () {
76302
+ var result = 0;
76303
+ var items = this.items;
76304
+ var length = items.length;
76305
+ for (var i = 0; i < length; ++i) {
76306
+ var item = items[i];
76307
+ var itemWidth = item.width;
76308
+ if (itemWidth != null) {
76309
+ result += itemWidth;
76310
+ }
76311
+ }
76312
+ return result;
76313
+ },
76314
+ enumerable: false,
76315
+ configurable: true
76316
+ });
76317
+ DTableColumnContainerImpl.prototype.get = function (index) {
76318
+ var columns = this.items;
76319
+ if (0 <= index && index < columns.length) {
76320
+ return columns[index];
76321
+ }
76322
+ return null;
76323
+ };
76324
+ DTableColumnContainerImpl.prototype.each = function (iteratee) {
76325
+ var columns = this.items;
76326
+ for (var i = 0, imax = columns.length; i < imax; ++i) {
76327
+ if (iteratee(columns[i], i) === false) {
76328
+ break;
76329
+ }
76330
+ }
76331
+ return this;
76332
+ };
76333
+ DTableColumnContainerImpl.prototype.size = function () {
76334
+ return this.items.length;
76335
+ };
76336
+ return DTableColumnContainerImpl;
76337
+ }(pixi_js.utils.EventEmitter));
76338
+
76339
+ /*
76340
+ * Copyright (C) 2019 Toshiba Corporation
76341
+ * SPDX-License-Identifier: Apache-2.0
76342
+ */
76343
+ var DTableCategoryColumnImpl = /** @class */ (function (_super) {
76344
+ __extends(DTableCategoryColumnImpl, _super);
76345
+ function DTableCategoryColumnImpl(index, column) {
76346
+ var _this = _super.call(this) || this;
76347
+ // Label
76348
+ var category = column.category;
76349
+ if (category) {
76350
+ if (isString(category)) {
76351
+ if (index === 0) {
76352
+ _this.label = category;
76353
+ }
76354
+ }
76355
+ else {
76356
+ if (index < category.length) {
76357
+ _this.label = category[index];
76358
+ }
76359
+ }
76360
+ }
76361
+ _this._weight = column.weight;
76362
+ _this._width = column.width;
76363
+ _this._isLocked = false;
76364
+ _this.offset = 0.0;
76365
+ _this._columns = [column];
76366
+ _this._nresizable = column.resizable ? 1 : 0;
76367
+ var onResizeBound = function () {
76368
+ _this.onResize();
76369
+ };
76370
+ _this._onResizeBound = onResizeBound;
76371
+ column.on("resize", onResizeBound);
75763
76372
  return _this;
75764
76373
  }
75765
- Object.defineProperty(DTable.prototype, "columns", {
76374
+ DTableCategoryColumnImpl.prototype.onResize = function () {
76375
+ if (this._isLocked) {
76376
+ return;
76377
+ }
76378
+ var columns = this._columns;
76379
+ if (this._weight != null) {
76380
+ var newWeight = 0;
76381
+ for (var i = 0, imax = columns.length; i < imax; ++i) {
76382
+ var weight = columns[i].weight;
76383
+ if (weight != null) {
76384
+ newWeight += weight;
76385
+ }
76386
+ }
76387
+ if (this._weight !== newWeight) {
76388
+ this._weight = newWeight;
76389
+ this.emit("resize", this);
76390
+ }
76391
+ }
76392
+ else {
76393
+ var newWidth = 0;
76394
+ for (var i = 0, imax = columns.length; i < imax; ++i) {
76395
+ var width = columns[i].width;
76396
+ if (width != null) {
76397
+ newWidth += width;
76398
+ }
76399
+ }
76400
+ if (this._width !== newWidth) {
76401
+ this._width = newWidth;
76402
+ this.emit("resize", this);
76403
+ }
76404
+ }
76405
+ };
76406
+ Object.defineProperty(DTableCategoryColumnImpl.prototype, "resizable", {
75766
76407
  get: function () {
75767
- var result = this._columns;
75768
- if (result == null) {
75769
- var options = this._options;
75770
- result = options ? toColumns(options.columns) : [];
75771
- this._columns = result;
76408
+ return 0 < this._nresizable;
76409
+ },
76410
+ enumerable: false,
76411
+ configurable: true
76412
+ });
76413
+ Object.defineProperty(DTableCategoryColumnImpl.prototype, "weight", {
76414
+ get: function () {
76415
+ return this._weight;
76416
+ },
76417
+ set: function (weight) {
76418
+ var oldWeight = this._weight;
76419
+ var nresizable = this._nresizable;
76420
+ if (0 < nresizable && oldWeight != null && oldWeight !== weight) {
76421
+ var columns = this._columns;
76422
+ var columnsLength = columns.length;
76423
+ var minWeight = this.minWeight;
76424
+ var newWeight = Math.max(minWeight, weight);
76425
+ if (this._weight !== newWeight) {
76426
+ this._isLocked = true;
76427
+ if (minWeight < oldWeight) {
76428
+ var columnWeightRatio = (newWeight - minWeight) / (oldWeight - minWeight);
76429
+ for (var i = 0; i < columnsLength; ++i) {
76430
+ var column = columns[i];
76431
+ var columnWeight = column.weight;
76432
+ if (column.resizable && columnWeight != null) {
76433
+ column.weight = columnWeight * columnWeightRatio;
76434
+ }
76435
+ }
76436
+ }
76437
+ else {
76438
+ var newColumnWeight = (newWeight - minWeight) / this._nresizable;
76439
+ for (var i = 0; i < columnsLength; ++i) {
76440
+ var column = columns[i];
76441
+ var columnWeight = column.weight;
76442
+ if (column.resizable && columnWeight != null) {
76443
+ column.weight = newColumnWeight;
76444
+ }
76445
+ }
76446
+ }
76447
+ this._isLocked = false;
76448
+ this.onResize();
76449
+ }
75772
76450
  }
75773
- return result;
75774
76451
  },
75775
76452
  enumerable: false,
75776
76453
  configurable: true
75777
76454
  });
75778
- Object.defineProperty(DTable.prototype, "frozen", {
76455
+ Object.defineProperty(DTableCategoryColumnImpl.prototype, "minWeight", {
75779
76456
  get: function () {
75780
- var result = this._frozen;
75781
- if (result == null) {
75782
- result = toFrozen(this.columns);
75783
- this._frozen = result;
76457
+ var result = 0;
76458
+ var columns = this._columns;
76459
+ var columnsLength = columns.length;
76460
+ for (var i = 0; i < columnsLength; ++i) {
76461
+ var column = columns[i];
76462
+ var columnWeight = column.weight;
76463
+ if (!column.resizable && columnWeight != null) {
76464
+ result += columnWeight;
76465
+ }
75784
76466
  }
75785
76467
  return result;
75786
76468
  },
75787
76469
  enumerable: false,
75788
76470
  configurable: true
75789
76471
  });
75790
- Object.defineProperty(DTable.prototype, "categories", {
76472
+ Object.defineProperty(DTableCategoryColumnImpl.prototype, "width", {
75791
76473
  get: function () {
75792
- var result = this._categories;
75793
- if (result == null) {
75794
- result = this.newCategories(this._options, this.columns, this.frozen);
75795
- this._categories = result;
76474
+ return this._width;
76475
+ },
76476
+ set: function (width) {
76477
+ var oldWidth = this._width;
76478
+ var nresizable = this._nresizable;
76479
+ if (0 < nresizable && oldWidth != null && oldWidth !== width) {
76480
+ var columns = this._columns;
76481
+ var columnsLength = columns.length;
76482
+ var minWidth = this.minWidth;
76483
+ var newWidth = Math.max(minWidth, width);
76484
+ if (oldWidth !== newWidth) {
76485
+ this._isLocked = true;
76486
+ if (minWidth < oldWidth) {
76487
+ var columnWidthRatio = (newWidth - minWidth) / (oldWidth - minWidth);
76488
+ for (var i = 0; i < columnsLength; ++i) {
76489
+ var column = columns[i];
76490
+ var columnWidth = column.width;
76491
+ if (column.resizable && columnWidth != null) {
76492
+ column.width = columnWidth * columnWidthRatio;
76493
+ }
76494
+ }
76495
+ }
76496
+ else {
76497
+ var newColumnWidth = (newWidth - minWidth) / this._nresizable;
76498
+ for (var i = 0; i < columnsLength; ++i) {
76499
+ var column = columns[i];
76500
+ var columnWidth = column.width;
76501
+ if (column.resizable && columnWidth != null) {
76502
+ column.width = newColumnWidth;
76503
+ }
76504
+ }
76505
+ }
76506
+ this._isLocked = false;
76507
+ this.onResize();
76508
+ }
76509
+ }
76510
+ },
76511
+ enumerable: false,
76512
+ configurable: true
76513
+ });
76514
+ Object.defineProperty(DTableCategoryColumnImpl.prototype, "minWidth", {
76515
+ get: function () {
76516
+ var result = 0;
76517
+ var columns = this._columns;
76518
+ var columnsLength = columns.length;
76519
+ for (var i = 0; i < columnsLength; ++i) {
76520
+ var column = columns[i];
76521
+ var columnWidth = column.width;
76522
+ if (!column.resizable && columnWidth != null) {
76523
+ result += columnWidth;
76524
+ }
75796
76525
  }
75797
76526
  return result;
75798
76527
  },
75799
76528
  enumerable: false,
75800
76529
  configurable: true
75801
76530
  });
75802
- DTable.prototype.initContent = function (content) {
75803
- _super.prototype.initContent.call(this, content);
75804
- content.state.isFocusReverse = true;
75805
- };
75806
- DTable.prototype.onContentChange = function () {
75807
- _super.prototype.onContentChange.call(this);
75808
- this.body.update();
75809
- };
75810
- DTable.prototype.onResize = function (newWidth, newHeight, oldWidth, oldHeight) {
75811
- var scrollbar = this.scrollbar;
75812
- scrollbar.lock();
75813
- var body = this.body;
75814
- body.lock();
75815
- _super.prototype.onResize.call(this, newWidth, newHeight, oldWidth, oldHeight);
75816
- body.update();
75817
- body.unlock(true);
75818
- scrollbar.unlock(true);
76531
+ DTableCategoryColumnImpl.prototype.add = function (column) {
76532
+ this._columns.push(column);
76533
+ if (this._weight != null) {
76534
+ var weight = column.weight;
76535
+ if (weight != null) {
76536
+ this._weight += weight;
76537
+ if (column.resizable) {
76538
+ this._nresizable += 1;
76539
+ }
76540
+ column.on("resize", this._onResizeBound);
76541
+ }
76542
+ }
76543
+ else if (this._width != null) {
76544
+ var width = column.width;
76545
+ if (width != null) {
76546
+ this._width += width;
76547
+ if (column.resizable) {
76548
+ this._nresizable += 1;
76549
+ }
76550
+ column.on("resize", this._onResizeBound);
76551
+ }
76552
+ }
75819
76553
  };
75820
- DTable.prototype.getCategoryCount = function (columns) {
76554
+ return DTableCategoryColumnImpl;
76555
+ }(pixi_js.utils.EventEmitter));
76556
+
76557
+ var DTableCategoryContainerImpl = /** @class */ (function () {
76558
+ function DTableCategoryContainerImpl(columns, frozen, options) {
76559
+ var count = this.toCount(columns);
76560
+ var items = [];
76561
+ var offset = 0;
76562
+ for (var i = count - 1; 0 <= i; --i) {
76563
+ var item = new DTableCategory(this.toColumns(i, columns, frozen), frozen, offset, options);
76564
+ items.push(item);
76565
+ offset += item.height;
76566
+ }
76567
+ this.items = items;
76568
+ }
76569
+ DTableCategoryContainerImpl.prototype.toCount = function (columns) {
75821
76570
  var result = 0;
75822
76571
  for (var i = 0, imax = columns.length; i < imax; ++i) {
75823
76572
  var category = columns[i].category;
@@ -75828,22 +76577,7 @@
75828
76577
  }
75829
76578
  return result;
75830
76579
  };
75831
- DTable.prototype.toCategoryLabel = function (index, category) {
75832
- if (category) {
75833
- if (isString(category)) {
75834
- if (index === 0) {
75835
- return category;
75836
- }
75837
- }
75838
- else {
75839
- if (index < category.length) {
75840
- return category[index];
75841
- }
75842
- }
75843
- }
75844
- return undefined;
75845
- };
75846
- DTable.prototype.isSameCategory = function (index, a, b) {
76580
+ DTableCategoryContainerImpl.prototype.isCategory = function (index, a, b) {
75847
76581
  if (a != null) {
75848
76582
  if (b != null) {
75849
76583
  if (isString(a)) {
@@ -75932,7 +76666,7 @@
75932
76666
  }
75933
76667
  }
75934
76668
  };
75935
- DTable.prototype.toCategoryColumns = function (index, columns, frozen) {
76669
+ DTableCategoryContainerImpl.prototype.toColumns = function (index, columns, frozen) {
75936
76670
  var result = [];
75937
76671
  var tcolumn = null;
75938
76672
  var ccolumn = null;
@@ -75941,66 +76675,119 @@
75941
76675
  if (i !== frozen &&
75942
76676
  ccolumn &&
75943
76677
  tcolumn &&
75944
- this.isSameCategory(index, tcolumn.category, column.category)) {
76678
+ this.isCategory(index, tcolumn.category, column.category)) {
75945
76679
  if (ccolumn.weight != null && column.weight != null) {
75946
- ccolumn.weight += column.weight;
76680
+ ccolumn.add(column);
75947
76681
  }
75948
76682
  else if (ccolumn.width != null && column.width != null) {
75949
- ccolumn.width += column.width;
76683
+ ccolumn.add(column);
75950
76684
  }
75951
76685
  else {
75952
76686
  tcolumn = column;
75953
- ccolumn = {
75954
- label: this.toCategoryLabel(index, column.category),
75955
- weight: column.weight,
75956
- width: column.width,
75957
- offset: 0.0
75958
- };
76687
+ ccolumn = new DTableCategoryColumnImpl(index, column);
75959
76688
  result.push(ccolumn);
75960
76689
  }
75961
76690
  }
75962
76691
  else {
75963
76692
  tcolumn = column;
75964
- ccolumn = {
75965
- label: this.toCategoryLabel(index, column.category),
75966
- weight: column.weight,
75967
- width: column.width,
75968
- offset: 0.0
75969
- };
76693
+ ccolumn = new DTableCategoryColumnImpl(index, column);
75970
76694
  result.push(ccolumn);
75971
76695
  }
75972
76696
  }
75973
76697
  return result;
75974
76698
  };
75975
- DTable.prototype.toCategoryOptions = function (index, options, columns, frozen, offset) {
75976
- if (options) {
75977
- if (options.columns === undefined) {
75978
- options.columns = this.toCategoryColumns(index, columns, frozen);
75979
- }
75980
- if (options.frozen == null) {
75981
- options.frozen = frozen;
75982
- }
75983
- if (options.offset == null) {
75984
- options.offset = offset;
75985
- }
75986
- return options;
76699
+ return DTableCategoryContainerImpl;
76700
+ }());
76701
+
76702
+ /*
76703
+ * Copyright (C) 2019 Toshiba Corporation
76704
+ * SPDX-License-Identifier: Apache-2.0
76705
+ */
76706
+ var DTable = /** @class */ (function (_super) {
76707
+ __extends(DTable, _super);
76708
+ function DTable(options) {
76709
+ var _this = _super.call(this, options) || this;
76710
+ var content = _this.content;
76711
+ var body = _this.body;
76712
+ content.addChild(body);
76713
+ if (body.data.selection.type !== DTableDataSelectionType.NONE) {
76714
+ _this.on(UtilPointerEvent.tap, function (e) {
76715
+ body.onRowClick(e);
76716
+ });
75987
76717
  }
75988
- return {
75989
- columns: this.toCategoryColumns(index, columns, frozen),
75990
- frozen: frozen,
75991
- offset: offset
75992
- };
75993
- };
75994
- DTable.prototype.newCategories = function (options, columns, frozen) {
75995
- var count = this.getCategoryCount(columns);
75996
- var result = [];
75997
- var offset = 0;
75998
- for (var i = count - 1; 0 <= i; --i) {
75999
- var category = new DTableCategory(this.toCategoryOptions(i, options === null || options === void 0 ? void 0 : options.category, columns, frozen, offset));
76000
- result.push(category);
76001
- offset += category.height;
76718
+ var header = _this.header;
76719
+ if (header) {
76720
+ content.addChild(header);
76002
76721
  }
76003
- return result;
76722
+ var categories = _this.categories;
76723
+ for (var i = categories.length - 1; 0 <= i; --i) {
76724
+ content.addChild(categories[i]);
76725
+ }
76726
+ body.update();
76727
+ return _this;
76728
+ }
76729
+ Object.defineProperty(DTable.prototype, "column", {
76730
+ get: function () {
76731
+ var _a;
76732
+ return ((_a = this._column) !== null && _a !== void 0 ? _a : (this._column = this.newColumn()));
76733
+ },
76734
+ enumerable: false,
76735
+ configurable: true
76736
+ });
76737
+ DTable.prototype.newColumn = function () {
76738
+ var _a;
76739
+ return new DTableColumnContainerImpl(this, (_a = this._options) === null || _a === void 0 ? void 0 : _a.columns);
76740
+ };
76741
+ Object.defineProperty(DTable.prototype, "columns", {
76742
+ get: function () {
76743
+ return this.column.items;
76744
+ },
76745
+ enumerable: false,
76746
+ configurable: true
76747
+ });
76748
+ Object.defineProperty(DTable.prototype, "frozen", {
76749
+ get: function () {
76750
+ return this.column.frozen;
76751
+ },
76752
+ enumerable: false,
76753
+ configurable: true
76754
+ });
76755
+ Object.defineProperty(DTable.prototype, "category", {
76756
+ get: function () {
76757
+ return (this._category = this.newCategory());
76758
+ },
76759
+ enumerable: false,
76760
+ configurable: true
76761
+ });
76762
+ DTable.prototype.newCategory = function () {
76763
+ var _a;
76764
+ var column = this.column;
76765
+ return new DTableCategoryContainerImpl(column.items, column.frozen, (_a = this._options) === null || _a === void 0 ? void 0 : _a.category);
76766
+ };
76767
+ Object.defineProperty(DTable.prototype, "categories", {
76768
+ get: function () {
76769
+ return this.category.items;
76770
+ },
76771
+ enumerable: false,
76772
+ configurable: true
76773
+ });
76774
+ DTable.prototype.initContent = function (content) {
76775
+ _super.prototype.initContent.call(this, content);
76776
+ content.state.isFocusReverse = true;
76777
+ };
76778
+ DTable.prototype.onContentChange = function () {
76779
+ _super.prototype.onContentChange.call(this);
76780
+ this.body.update();
76781
+ };
76782
+ DTable.prototype.onResize = function (newWidth, newHeight, oldWidth, oldHeight) {
76783
+ var scrollbar = this.scrollbar;
76784
+ scrollbar.lock();
76785
+ var body = this.body;
76786
+ body.lock();
76787
+ _super.prototype.onResize.call(this, newWidth, newHeight, oldWidth, oldHeight);
76788
+ body.update();
76789
+ body.unlock(true);
76790
+ scrollbar.unlock(true);
76004
76791
  };
76005
76792
  DTable.prototype.onDblClick = function (e, interactionManager) {
76006
76793
  var result = this.body.onDblClick(e, interactionManager);
@@ -76012,24 +76799,35 @@
76012
76799
  _this.onScrollBarUpdate(isRegionVisible);
76013
76800
  });
76014
76801
  };
76015
- DTable.prototype.toContentWidth = function (options) {
76016
- var columnWidthTotal = 0;
76017
- var columns = options === null || options === void 0 ? void 0 : options.columns;
76018
- if (columns) {
76019
- for (var i = 0, imax = columns.length; i < imax; ++i) {
76020
- var column = columns[i];
76021
- var columnWidth = column.width;
76022
- if (columnWidth != null) {
76023
- columnWidthTotal += columnWidth;
76024
- }
76025
- }
76802
+ DTable.prototype.newContent = function (options) {
76803
+ var _this = this;
76804
+ var result = _super.prototype.newContent.call(this, options);
76805
+ // X & Width
76806
+ var column = this.column;
76807
+ var columnWidth = column.width;
76808
+ if (0 < columnWidth) {
76809
+ column.on("resize", function () {
76810
+ columnWidth = column.width;
76811
+ var parentWidth = _this.width;
76812
+ var parentHeight = _this.height;
76813
+ var newWidth = Math.max(parentWidth, columnWidth);
76814
+ var newXMin = parentWidth - newWidth;
76815
+ // The X position must be in [newXMin, 0].
76816
+ if (result.x < newXMin) {
76817
+ result.x = newXMin;
76818
+ }
76819
+ // Force the with reevaluated
76820
+ result.onParentResize(parentWidth, parentHeight, _this.padding);
76821
+ });
76822
+ result.setWidth(function (p) {
76823
+ return Math.max(p, columnWidth);
76824
+ });
76026
76825
  }
76027
- if (0 < columnWidthTotal) {
76028
- return function (p) {
76029
- return Math.max(p, columnWidthTotal);
76030
- };
76826
+ else {
76827
+ result.setWidth("100%");
76031
76828
  }
76032
- return "100%";
76829
+ // Done
76830
+ return result;
76033
76831
  };
76034
76832
  DTable.prototype.getHeaderOffset = function () {
76035
76833
  var result = this._headerOffset;
@@ -76051,7 +76849,7 @@
76051
76849
  get: function () {
76052
76850
  var result = this._header;
76053
76851
  if (result === undefined) {
76054
- result = this.newHeader(this._options, this.columns, this.frozen, this.getHeaderOffset());
76852
+ result = this.newHeader();
76055
76853
  this._header = result;
76056
76854
  }
76057
76855
  return result;
@@ -76070,42 +76868,17 @@
76070
76868
  }
76071
76869
  return false;
76072
76870
  };
76073
- DTable.prototype.newHeader = function (options, columns, frozen, offset) {
76871
+ DTable.prototype.newHeader = function () {
76872
+ var options = this._options;
76074
76873
  if (this.hasHeader(options)) {
76075
- return new DTableHeader(this.toHeaderOptions(options === null || options === void 0 ? void 0 : options.header, columns, frozen, offset));
76874
+ var column = this.column;
76875
+ return new DTableHeader(this, column.items, column.frozen, this.getHeaderOffset(), options === null || options === void 0 ? void 0 : options.header);
76076
76876
  }
76077
76877
  return null;
76078
76878
  };
76079
- DTable.prototype.toHeaderOptions = function (options, columns, frozen, offset) {
76080
- if (options) {
76081
- if (options.columns === undefined) {
76082
- options.columns = columns;
76083
- }
76084
- if (options.frozen == null) {
76085
- options.frozen = frozen;
76086
- }
76087
- if (options.offset === undefined) {
76088
- options.offset = offset;
76089
- }
76090
- if (options.table === undefined) {
76091
- options.table = this;
76092
- }
76093
- return options;
76094
- }
76095
- return {
76096
- columns: columns,
76097
- frozen: frozen,
76098
- offset: offset,
76099
- table: this
76100
- };
76101
- };
76102
76879
  DTable.prototype.getBodyOffset = function () {
76103
- var result = this._bodyOffset;
76104
- if (result == null) {
76105
- result = this.newBodyOffset();
76106
- this._bodyOffset = result;
76107
- }
76108
- return result;
76880
+ var _a;
76881
+ return ((_a = this._bodyOffset) !== null && _a !== void 0 ? _a : (this._bodyOffset = this.newBodyOffset()));
76109
76882
  };
76110
76883
  DTable.prototype.newBodyOffset = function () {
76111
76884
  var _a, _b;
@@ -76113,30 +76886,19 @@
76113
76886
  };
76114
76887
  Object.defineProperty(DTable.prototype, "body", {
76115
76888
  get: function () {
76116
- var result = this._body;
76117
- if (result == null) {
76118
- result = this.newBody(this._options, this.columns, this.frozen, this.getBodyOffset());
76119
- this._body = result;
76120
- }
76121
- return result;
76889
+ var _a;
76890
+ return ((_a = this._body) !== null && _a !== void 0 ? _a : (this._body = this.newBody()));
76122
76891
  },
76123
76892
  enumerable: false,
76124
76893
  configurable: true
76125
76894
  });
76126
- DTable.prototype.newBody = function (options, columns, frozen, offset) {
76127
- return new DTableBody(this.toBodyOptions(options === null || options === void 0 ? void 0 : options.body, columns, frozen, offset, options === null || options === void 0 ? void 0 : options.data));
76895
+ DTable.prototype.newBody = function () {
76896
+ var options = this._options;
76897
+ var column = this.column;
76898
+ return new DTableBody(column.items, column.frozen, this.getBodyOffset(), this.toBodyOptions(options === null || options === void 0 ? void 0 : options.body, options === null || options === void 0 ? void 0 : options.data));
76128
76899
  };
76129
- DTable.prototype.toBodyOptions = function (options, columns, frozen, offset, data) {
76900
+ DTable.prototype.toBodyOptions = function (options, data) {
76130
76901
  if (options != null) {
76131
- if (options.columns === undefined) {
76132
- options.columns = columns;
76133
- }
76134
- if (options.frozen == null) {
76135
- options.frozen = frozen;
76136
- }
76137
- if (options.offset === undefined) {
76138
- options.offset = offset;
76139
- }
76140
76902
  if (options.data === undefined && data !== undefined) {
76141
76903
  if (isArray(data)) {
76142
76904
  options.data = {
@@ -76154,9 +76916,6 @@
76154
76916
  }
76155
76917
  if (isArray(data)) {
76156
76918
  return {
76157
- columns: columns,
76158
- frozen: frozen,
76159
- offset: offset,
76160
76919
  data: {
76161
76920
  rows: data
76162
76921
  },
@@ -76165,9 +76924,6 @@
76165
76924
  }
76166
76925
  else {
76167
76926
  return {
76168
- columns: columns,
76169
- frozen: frozen,
76170
- offset: offset,
76171
76927
  data: data,
76172
76928
  weight: 1
76173
76929
  };
@@ -78674,6 +79430,7 @@
78674
79430
  DTableBodyCells: DTableBodyCells,
78675
79431
  DTableBodyRow: DTableBodyRow,
78676
79432
  DTableBody: DTableBody,
79433
+ DTableCategoryCellEdge: DTableCategoryCellEdge,
78677
79434
  DTableCategoryCell: DTableCategoryCell,
78678
79435
  DTableCategory: DTableCategory,
78679
79436
  DTableColumnType: DTableColumnType,
@@ -78691,6 +79448,7 @@
78691
79448
  DTableDataTreeSorter: DTableDataTreeSorter,
78692
79449
  DTableDataTree: DTableDataTree,
78693
79450
  DTableHeaderCellCheck: DTableHeaderCellCheck,
79451
+ DTableHeaderCellEdge: DTableHeaderCellEdge,
78694
79452
  DTableHeaderCell: DTableHeaderCell,
78695
79453
  DTableHeader: DTableHeader,
78696
79454
  DTableRow: DTableRow,