@wcardinal/wcardinal-ui 0.410.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 (97) hide show
  1. package/dist/types/wcardinal/ui/d-base.d.ts +1 -0
  2. package/dist/types/wcardinal/ui/d-dialog-gesture-impl.d.ts +2 -2
  3. package/dist/types/wcardinal/ui/d-table-body-cell.d.ts +2 -2
  4. package/dist/types/wcardinal/ui/d-table-body-row.d.ts +9 -9
  5. package/dist/types/wcardinal/ui/d-table-body.d.ts +5 -7
  6. package/dist/types/wcardinal/ui/d-table-category-cell.d.ts +37 -0
  7. package/dist/types/wcardinal/ui/d-table-category-column-impl.d.ts +24 -0
  8. package/dist/types/wcardinal/ui/d-table-category-column.d.ts +10 -0
  9. package/dist/types/wcardinal/ui/d-table-category-container-impl.d.ts +12 -0
  10. package/dist/types/wcardinal/ui/d-table-category-container.d.ts +4 -0
  11. package/dist/types/wcardinal/ui/d-table-category.d.ts +13 -12
  12. package/dist/types/wcardinal/ui/d-table-column-container-impl.d.ts +25 -0
  13. package/dist/types/wcardinal/ui/d-table-column-container.d.ts +12 -0
  14. package/dist/types/wcardinal/ui/d-table-column-impl.d.ts +44 -0
  15. package/dist/types/wcardinal/ui/d-table-column.d.ts +22 -19
  16. package/dist/types/wcardinal/ui/d-table-header-cell-check.d.ts +1 -1
  17. package/dist/types/wcardinal/ui/d-table-header-cell.d.ts +34 -12
  18. package/dist/types/wcardinal/ui/d-table-header.d.ts +8 -9
  19. package/dist/types/wcardinal/ui/d-table-row.d.ts +8 -9
  20. package/dist/types/wcardinal/ui/d-table-state.d.ts +8 -0
  21. package/dist/types/wcardinal/ui/d-table.d.ts +15 -18
  22. package/dist/types/wcardinal/ui/theme/dark/d-theme-dark-table-header-cell.d.ts +1 -0
  23. package/dist/types/wcardinal/ui/theme/dark/d-theme-dark-table-header.d.ts +1 -0
  24. package/dist/types/wcardinal/ui/theme/white/d-theme-white-table-header-cell.d.ts +1 -0
  25. package/dist/types/wcardinal/ui/theme/white/d-theme-white-table-header.d.ts +1 -0
  26. package/dist/types/wcardinal/ui/util/util-gesture-easing.d.ts +1 -0
  27. package/dist/wcardinal/ui/d-base.js +9 -2
  28. package/dist/wcardinal/ui/d-base.js.map +1 -1
  29. package/dist/wcardinal/ui/d-dialog-gesture-impl.js.map +1 -1
  30. package/dist/wcardinal/ui/d-table-body-cell.js.map +1 -1
  31. package/dist/wcardinal/ui/d-table-body-row.js +4 -4
  32. package/dist/wcardinal/ui/d-table-body-row.js.map +1 -1
  33. package/dist/wcardinal/ui/d-table-body.js +6 -15
  34. package/dist/wcardinal/ui/d-table-body.js.map +1 -1
  35. package/dist/wcardinal/ui/d-table-category-cell.js +244 -2
  36. package/dist/wcardinal/ui/d-table-category-cell.js.map +1 -1
  37. package/dist/wcardinal/ui/d-table-category-column-impl.js +222 -0
  38. package/dist/wcardinal/ui/d-table-category-column-impl.js.map +1 -0
  39. package/dist/wcardinal/ui/d-table-category-column.js +6 -0
  40. package/dist/wcardinal/ui/d-table-category-column.js.map +1 -0
  41. package/dist/wcardinal/ui/d-table-category-container-impl.js +149 -0
  42. package/dist/wcardinal/ui/d-table-category-container-impl.js.map +1 -0
  43. package/dist/wcardinal/ui/d-table-category-container.js +2 -0
  44. package/dist/wcardinal/ui/d-table-category-container.js.map +1 -0
  45. package/dist/wcardinal/ui/d-table-category.js +49 -7
  46. package/dist/wcardinal/ui/d-table-category.js.map +1 -1
  47. package/dist/wcardinal/ui/d-table-column-container-impl.js +126 -0
  48. package/dist/wcardinal/ui/d-table-column-container-impl.js.map +1 -0
  49. package/dist/wcardinal/ui/d-table-column-container.js +2 -0
  50. package/dist/wcardinal/ui/d-table-column-container.js.map +1 -0
  51. package/dist/wcardinal/ui/d-table-column-impl.js +375 -0
  52. package/dist/wcardinal/ui/d-table-column-impl.js.map +1 -0
  53. package/dist/wcardinal/ui/d-table-column.js.map +1 -1
  54. package/dist/wcardinal/ui/d-table-header-cell-check.js.map +1 -1
  55. package/dist/wcardinal/ui/d-table-header-cell.js +245 -48
  56. package/dist/wcardinal/ui/d-table-header-cell.js.map +1 -1
  57. package/dist/wcardinal/ui/d-table-header.js +8 -22
  58. package/dist/wcardinal/ui/d-table-header.js.map +1 -1
  59. package/dist/wcardinal/ui/d-table-row.js +7 -5
  60. package/dist/wcardinal/ui/d-table-row.js.map +1 -1
  61. package/dist/wcardinal/ui/d-table-state.js +9 -1
  62. package/dist/wcardinal/ui/d-table-state.js.map +1 -1
  63. package/dist/wcardinal/ui/d-table.js +69 -631
  64. package/dist/wcardinal/ui/d-table.js.map +1 -1
  65. package/dist/wcardinal/ui/theme/dark/d-theme-dark-table-header-cell.js +7 -1
  66. package/dist/wcardinal/ui/theme/dark/d-theme-dark-table-header-cell.js.map +1 -1
  67. package/dist/wcardinal/ui/theme/dark/d-theme-dark-table-header.js +7 -0
  68. package/dist/wcardinal/ui/theme/dark/d-theme-dark-table-header.js.map +1 -1
  69. package/dist/wcardinal/ui/theme/white/d-theme-white-table-header-cell.js +7 -1
  70. package/dist/wcardinal/ui/theme/white/d-theme-white-table-header-cell.js.map +1 -1
  71. package/dist/wcardinal/ui/theme/white/d-theme-white-table-header.js +7 -0
  72. package/dist/wcardinal/ui/theme/white/d-theme-white-table-header.js.map +1 -1
  73. package/dist/wcardinal/ui/util/util-gesture-easing.js +16 -5
  74. package/dist/wcardinal/ui/util/util-gesture-easing.js.map +1 -1
  75. package/dist/wcardinal/ui/util/util-gesture.js +2 -1
  76. package/dist/wcardinal/ui/util/util-gesture.js.map +1 -1
  77. package/dist/wcardinal-ui-theme-dark-en-us.js +14 -2
  78. package/dist/wcardinal-ui-theme-dark-en-us.min.js +2 -2
  79. package/dist/wcardinal-ui-theme-dark-en-us.min.js.map +1 -1
  80. package/dist/wcardinal-ui-theme-dark-ja-jp.js +14 -2
  81. package/dist/wcardinal-ui-theme-dark-ja-jp.min.js +2 -2
  82. package/dist/wcardinal-ui-theme-dark-ja-jp.min.js.map +1 -1
  83. package/dist/wcardinal-ui-theme-dark.js +14 -2
  84. package/dist/wcardinal-ui-theme-dark.min.js +2 -2
  85. package/dist/wcardinal-ui-theme-white-en-us.js +14 -2
  86. package/dist/wcardinal-ui-theme-white-en-us.min.js +2 -2
  87. package/dist/wcardinal-ui-theme-white-en-us.min.js.map +1 -1
  88. package/dist/wcardinal-ui-theme-white-ja-jp.js +14 -2
  89. package/dist/wcardinal-ui-theme-white-ja-jp.min.js +2 -2
  90. package/dist/wcardinal-ui-theme-white-ja-jp.min.js.map +1 -1
  91. package/dist/wcardinal-ui-theme-white.js +14 -2
  92. package/dist/wcardinal-ui-theme-white.min.js +2 -2
  93. package/dist/wcardinal-ui.cjs.js +1178 -377
  94. package/dist/wcardinal-ui.js +1152 -375
  95. package/dist/wcardinal-ui.min.js +2 -2
  96. package/dist/wcardinal-ui.min.js.map +1 -1
  97. package/package.json +1 -1
@@ -1,5 +1,5 @@
1
1
  /*
2
- Winter Cardinal UI v0.410.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
 
@@ -14354,6 +14354,13 @@
14354
14354
  get: function () {
14355
14355
  return this._weight;
14356
14356
  },
14357
+ set: function (weight) {
14358
+ if (this._weight !== weight) {
14359
+ this._weight = weight;
14360
+ this.toHierarchyDirty();
14361
+ DApplications.update(this);
14362
+ }
14363
+ },
14357
14364
  enumerable: false,
14358
14365
  configurable: true
14359
14366
  });
@@ -15171,10 +15178,10 @@
15171
15178
  this.emit("down", e, this);
15172
15179
  };
15173
15180
  DBase.prototype.onDownThis = function (e) {
15181
+ var _a;
15174
15182
  var oe = e.data.originalEvent;
15175
15183
  if ("touches" in oe) {
15176
- var lastDownPoint = this._lastDownPoint || new pixi_js.Point();
15177
- this._lastDownPoint = lastDownPoint;
15184
+ var lastDownPoint = ((_a = this._lastDownPoint) !== null && _a !== void 0 ? _a : (this._lastDownPoint = new pixi_js.Point()));
15178
15185
  lastDownPoint.copyFrom(e.data.global);
15179
15186
  }
15180
15187
  else {
@@ -15806,6 +15813,7 @@
15806
15813
  this._dt = 0;
15807
15814
  this._dtw = 0;
15808
15815
  this._t = 0;
15816
+ this._duration = 333 * ((_a = options === null || options === void 0 ? void 0 : options.duration) !== null && _a !== void 0 ? _a : 1);
15809
15817
  this._animation = new DAnimationBase({
15810
15818
  onTime: function (t) {
15811
15819
  _this.onEase(t);
@@ -15814,7 +15822,7 @@
15814
15822
  _this.onEaseEnd();
15815
15823
  },
15816
15824
  timing: DAnimationTimings.LINEAR,
15817
- duration: 333 * ((_a = options === null || options === void 0 ? void 0 : options.duration) !== null && _a !== void 0 ? _a : 1)
15825
+ duration: this._duration
15818
15826
  });
15819
15827
  this._onMove = onMove;
15820
15828
  this._onEnd = onEnd;
@@ -15895,6 +15903,11 @@
15895
15903
  }
15896
15904
  };
15897
15905
  UtilGestureEasing.prototype.onEnd = function (ldt) {
15906
+ var d0 = this._duration;
15907
+ var d = d0 - ldt;
15908
+ if (d <= 0) {
15909
+ return this.onEaseEnd();
15910
+ }
15898
15911
  this.updateHistoriesSorted(ldt);
15899
15912
  var sorted = this._historiesSorted;
15900
15913
  var sortedLength = sorted.length;
@@ -15919,22 +15932,27 @@
15919
15932
  dx *= w;
15920
15933
  dy *= w;
15921
15934
  ds *= w;
15922
- dt *= w;
15935
+ dt *= w * (d0 / d); // Effectively, this lowers the velocity (dx, dy, ds) by d / d0.
15923
15936
  this._dx = dx;
15924
15937
  this._dy = dy;
15925
15938
  this._ds = ds;
15926
15939
  this._dt = dt;
15927
15940
  // Start animation
15928
15941
  var animation = this._animation;
15929
- var d = animation.duration;
15930
- this._t = -ldt / d;
15942
+ animation.duration = d;
15943
+ this._t = 0;
15931
15944
  this._dtw = d / dt;
15932
15945
  animation.start();
15933
15946
  };
15934
15947
  UtilGestureEasing.prototype.onEase = function (t) {
15935
15948
  var ot = this._t;
15936
15949
  this._t = t;
15937
- // Note: Integral of (1-x) is x (1 - 0.5 x) + c.
15950
+ // Note: Integral_{x=ot...t} (1-x) dx
15951
+ // = [x (1 - 0.5 x)]_{x=ot...t}
15952
+ // = t (1 - 0.5 t) - ot (1 - 0.5 ot)
15953
+ // = t - ot - 0.5 t t + 0.5 ot ot
15954
+ // = (t - ot) - 0.5 (t + ot) (t - ot)
15955
+ // = (1 - 0.5 (t + ot)) * (t - ot)
15938
15956
  var w = (1 - 0.5 * (t + ot)) * (t - ot) * this._dtw;
15939
15957
  this._onMove(this._dx * w, this._dy * w, 1 + (this._ds - 1) * w, t);
15940
15958
  };
@@ -16139,6 +16157,7 @@
16139
16157
  if (target == null || !target.state.isGesturing) {
16140
16158
  return;
16141
16159
  }
16160
+ var oldTime = data.time;
16142
16161
  if (!data.end(e)) {
16143
16162
  return;
16144
16163
  }
@@ -16170,7 +16189,7 @@
16170
16189
  }
16171
16190
  var easing = data.easing;
16172
16191
  if (easing) {
16173
- easing.onEnd(e.data.originalEvent.timeStamp - data.time);
16192
+ easing.onEnd(data.time - oldTime);
16174
16193
  }
16175
16194
  else {
16176
16195
  this.deleteData(data);
@@ -71492,7 +71511,15 @@
71492
71511
  /**
71493
71512
  * Selectable row
71494
71513
  */
71495
- 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"
71496
71523
  };
71497
71524
 
71498
71525
  /*
@@ -72146,15 +72173,17 @@
72146
72173
  */
72147
72174
  var DTableRow = /** @class */ (function (_super) {
72148
72175
  __extends(DTableRow, _super);
72149
- function DTableRow(options) {
72150
- var _a, _b;
72176
+ function DTableRow(columns, frozen, options) {
72151
72177
  var _this = _super.call(this, options) || this;
72152
72178
  _this._reverse = true;
72153
- _this._frozen = (_a = options.frozen) !== null && _a !== void 0 ? _a : 0;
72154
- _this._columns = (_b = options.columns) !== null && _b !== void 0 ? _b : [];
72179
+ _this._frozen = frozen;
72180
+ _this._columns = columns;
72155
72181
  return _this;
72156
72182
  }
72157
- 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;
72158
72187
  var iend = this.toIndexEnd(columns);
72159
72188
  for (var i = columns.length - 1; 0 <= i; --i) {
72160
72189
  var cell = this.newCell(i, columns[i], columns, options);
@@ -72246,8 +72275,8 @@
72246
72275
  */
72247
72276
  var DTableBodyRow = /** @class */ (function (_super) {
72248
72277
  __extends(DTableBodyRow, _super);
72249
- function DTableBodyRow(onChange, isEven, columnIndexToCellOptions, options) {
72250
- 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;
72251
72280
  _this._index = -1;
72252
72281
  _this._onChange = onChange;
72253
72282
  _this._onCellChangeBound = function (newValue, oldValue, row, rowIndex, columnIndex, column) {
@@ -72255,7 +72284,7 @@
72255
72284
  };
72256
72285
  _this._columnIndexToCellOptions = columnIndexToCellOptions;
72257
72286
  _this.state.isAlternated = !isEven;
72258
- _this.initCells(options, _this._columns, _this._frozen);
72287
+ _this.initCells();
72259
72288
  return _this;
72260
72289
  }
72261
72290
  DTableBodyRow.prototype.onCellChange = function (newValue, oldValue, row, rowIndex, columnIndex, column) {
@@ -72399,7 +72428,7 @@
72399
72428
  DTableBodyRow.prototype.toCellOptions = function (columnIndex, column, options) {
72400
72429
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
72401
72430
  var _p;
72402
- var result = toMerged(column.body, options.cell);
72431
+ var result = toMerged(column.body, options === null || options === void 0 ? void 0 : options.cell);
72403
72432
  // Weight
72404
72433
  result.weight = column.weight;
72405
72434
  // Width
@@ -73468,18 +73497,11 @@
73468
73497
  * SPDX-License-Identifier: Apache-2.0
73469
73498
  */
73470
73499
  var toRowOptions = function (theme, options, selectionType) {
73471
- var columns = options.columns || [];
73472
73500
  var result = options.row;
73473
73501
  if (result != null) {
73474
73502
  if (result.height == null) {
73475
73503
  result.height = theme.getRowHeight();
73476
73504
  }
73477
- if (result.columns === undefined) {
73478
- result.columns = columns;
73479
- }
73480
- if (result.frozen == null) {
73481
- result.frozen = options.frozen;
73482
- }
73483
73505
  if (result.selection === undefined) {
73484
73506
  result.selection = {
73485
73507
  type: selectionType
@@ -73491,9 +73513,7 @@
73491
73513
  }
73492
73514
  else {
73493
73515
  result = {
73494
- columns: columns,
73495
73516
  height: theme.getRowHeight(),
73496
- frozen: options.frozen,
73497
73517
  selection: {
73498
73518
  type: selectionType
73499
73519
  }
@@ -73503,18 +73523,18 @@
73503
73523
  };
73504
73524
  var DTableBody = /** @class */ (function (_super) {
73505
73525
  __extends(DTableBody, _super);
73506
- function DTableBody(options) {
73507
- var _a;
73526
+ function DTableBody(columns, frozen, offset, options) {
73508
73527
  var _this = _super.call(this, options) || this;
73509
- _this.transform.position.y = (_a = options.offset) !== null && _a !== void 0 ? _a : 0;
73528
+ _this.transform.position.y = offset;
73510
73529
  var data = _this.toData(options.data);
73511
73530
  _this._data = data;
73512
73531
  data.bind(_this);
73513
73532
  var theme = _this.theme;
73533
+ _this._columns = columns;
73534
+ _this._frozen = frozen;
73514
73535
  var rowOptions = toRowOptions(theme, options, data.selection.type);
73515
73536
  _this._rowOptions = rowOptions;
73516
73537
  _this._rowHeight = rowOptions.height != null ? rowOptions.height : theme.getRowHeight();
73517
- _this._columns = rowOptions.columns || [];
73518
73538
  _this._rowIndexMappedStart = 0;
73519
73539
  _this._rowIndexMappedEnd = 0;
73520
73540
  _this._updateRowsCount = 0;
@@ -73725,14 +73745,14 @@
73725
73745
  return row;
73726
73746
  };
73727
73747
  DTableBody.prototype.newRow = function (isEven) {
73728
- 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);
73729
73749
  };
73730
73750
  DTableBody.prototype.onParentMove = function (newX, newY, oldX, oldY) {
73731
73751
  _super.prototype.onParentMove.call(this, newX, newY, oldX, oldY);
73732
73752
  this.updateFrozenCellPosition(newX);
73733
73753
  };
73734
73754
  DTableBody.prototype.updateFrozenCellPosition = function (x) {
73735
- var frozen = this._rowOptions.frozen;
73755
+ var frozen = this._frozen;
73736
73756
  if (frozen != null && 0 < frozen) {
73737
73757
  var rows = this.children;
73738
73758
  for (var i = 0, imax = rows.length; i < imax; ++i) {
@@ -73947,11 +73967,249 @@
73947
73967
  * Copyright (C) 2019 Toshiba Corporation
73948
73968
  * SPDX-License-Identifier: Apache-2.0
73949
73969
  */
73970
+ var DTableCategoryCellEdge = {
73971
+ NONE: 0,
73972
+ LEFT: 1,
73973
+ RIGHT: 2,
73974
+ BOTH: 3
73975
+ };
73950
73976
  var DTableCategoryCell = /** @class */ (function (_super) {
73951
73977
  __extends(DTableCategoryCell, _super);
73952
- function DTableCategoryCell() {
73953
- 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;
73954
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
+ };
73955
74213
  DTableCategoryCell.prototype.getType = function () {
73956
74214
  return "DTableCategoryCell";
73957
74215
  };
@@ -73964,15 +74222,53 @@
73964
74222
  */
73965
74223
  var DTableCategory = /** @class */ (function (_super) {
73966
74224
  __extends(DTableCategory, _super);
73967
- function DTableCategory(options) {
73968
- var _a;
73969
- var _this = _super.call(this, options) || this;
73970
- 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;
73971
74229
  _this._offset = offset;
73972
74230
  _this.transform.position.y = offset;
73973
- _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
+ }
73974
74236
  return _this;
73975
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
+ };
73976
74272
  DTableCategory.prototype.onParentMove = function (newX, newY, oldX, oldY) {
73977
74273
  _super.prototype.onParentMove.call(this, newX, newY, oldX, oldY);
73978
74274
  this.transform.position.y = -newY + this._offset;
@@ -73986,16 +74282,20 @@
73986
74282
  return 0;
73987
74283
  };
73988
74284
  DTableCategory.prototype.newCell = function (columnIndex, column, columns, options) {
73989
- return new DTableCategoryCell(this.toCellOptions(columnIndex, column, options));
74285
+ return new DTableCategoryCell(this, columnIndex, column, this.toCellOptions(columnIndex, column, options));
73990
74286
  };
73991
74287
  DTableCategory.prototype.toCellOptions = function (columnIndex, column, options) {
73992
- var result = options.cell;
74288
+ var result = options === null || options === void 0 ? void 0 : options.cell;
73993
74289
  if (result) {
74290
+ // Weight
73994
74291
  result.weight = column.weight;
74292
+ // Width
73995
74293
  result.width = column.width;
74294
+ // Label
73996
74295
  var text = result.text || {};
73997
74296
  result.text = text;
73998
74297
  text.value = text.value || column.label;
74298
+ // Done
73999
74299
  return result;
74000
74300
  }
74001
74301
  else {
@@ -74985,24 +75285,37 @@
74985
75285
  * Copyright (C) 2019 Toshiba Corporation
74986
75286
  * SPDX-License-Identifier: Apache-2.0
74987
75287
  */
75288
+ var DTableHeaderCellEdge = {
75289
+ NONE: 0,
75290
+ LEFT: 1,
75291
+ RIGHT: 2,
75292
+ BOTH: 3
75293
+ };
74988
75294
  var DTableHeaderCell = /** @class */ (function (_super) {
74989
75295
  __extends(DTableHeaderCell, _super);
74990
- function DTableHeaderCell() {
74991
- return _super !== null && _super.apply(this, arguments) || this;
74992
- }
74993
- DTableHeaderCell.prototype.init = function (options) {
74994
- if (options != null) {
74995
- this._header = options.header;
74996
- this._column = options.column;
74997
- this._columnIndex = options.columnIndex;
74998
- this._check = new DTableHeaderCellCheck(this, options.check);
74999
- }
75000
- else {
75001
- 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();
75002
75316
  }
75003
- _super.prototype.init.call(this, options);
75004
- this.initOnClick(options);
75005
- };
75317
+ return _this;
75318
+ }
75006
75319
  Object.defineProperty(DTableHeaderCell.prototype, "column", {
75007
75320
  get: function () {
75008
75321
  return this._column;
@@ -75031,23 +75344,201 @@
75031
75344
  enumerable: false,
75032
75345
  configurable: true
75033
75346
  });
75034
- 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) {
75035
75431
  var _this = this;
75036
- var column = this._column;
75037
- if (column) {
75038
- var sortable = column.sorting.enable;
75039
- var checkable = this._check.isEnabled;
75040
- if (checkable || sortable) {
75041
- this.on(UtilPointerEvent.tap, function (e) {
75042
- _this.onClick(e);
75043
- });
75044
- var state = this.state;
75045
- state.lock();
75046
- state.set(DTableState.SORTABLE, sortable);
75047
- state.set(DTableState.CHECKABLE, checkable);
75048
- 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);
75466
+ }
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);
75049
75474
  }
75050
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
+ }
75051
75542
  };
75052
75543
  Object.defineProperty(DTableHeaderCell.prototype, "sorter", {
75053
75544
  get: function () {
@@ -75082,11 +75573,7 @@
75082
75573
  });
75083
75574
  Object.defineProperty(DTableHeaderCell.prototype, "comparator", {
75084
75575
  get: function () {
75085
- var column = this._column;
75086
- if (column) {
75087
- return column.sorting.comparator || null;
75088
- }
75089
- return null;
75576
+ return this._column.sorting.comparator || null;
75090
75577
  },
75091
75578
  enumerable: false,
75092
75579
  configurable: true
@@ -75113,8 +75600,8 @@
75113
75600
  }
75114
75601
  };
75115
75602
  DTableHeaderCell.prototype.toClickPosition = function (e) {
75116
- var checkWork = this._checkWork || new pixi_js.Point();
75117
- this._checkWork = checkWork;
75603
+ var _a;
75604
+ var checkWork = ((_a = this._checkWork) !== null && _a !== void 0 ? _a : (this._checkWork = new pixi_js.Point()));
75118
75605
  return e.data.getLocalPosition(this, checkWork).x;
75119
75606
  };
75120
75607
  DTableHeaderCell.prototype.isCheckClicked = function (e) {
@@ -75139,6 +75626,10 @@
75139
75626
  }
75140
75627
  return false;
75141
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
+ };
75142
75633
  DTableHeaderCell.prototype.onClick = function (e) {
75143
75634
  if (this.state.isActionable) {
75144
75635
  this.activate(e);
@@ -75148,13 +75639,15 @@
75148
75639
  this.onActivate(e);
75149
75640
  };
75150
75641
  DTableHeaderCell.prototype.onActivate = function (e) {
75151
- if (this.isCheckClicked(e)) {
75152
- this.onToggleStart();
75153
- this.onToggleEnd();
75154
- }
75155
- else {
75156
- this.doSort(e);
75157
- 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
+ }
75158
75651
  }
75159
75652
  };
75160
75653
  DTableHeaderCell.prototype.doSort = function (e) {
@@ -75184,11 +75677,14 @@
75184
75677
  };
75185
75678
  Object.defineProperty(DTableHeaderCell.prototype, "isSortable", {
75186
75679
  get: function () {
75187
- var column = this._column;
75188
- if (column) {
75189
- return column.sorting.enable;
75190
- }
75191
- 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;
75192
75688
  },
75193
75689
  enumerable: false,
75194
75690
  configurable: true
@@ -75278,14 +75774,12 @@
75278
75774
  */
75279
75775
  var DTableHeader = /** @class */ (function (_super) {
75280
75776
  __extends(DTableHeader, _super);
75281
- function DTableHeader(options) {
75282
- var _a, _b;
75283
- var _this = _super.call(this, options) || this;
75284
- _this._table = (_a = options.table) !== null && _a !== void 0 ? _a : null;
75285
- 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;
75286
75780
  _this._offset = offset;
75287
75781
  _this.transform.position.y = offset;
75288
- _this.initCells(options, _this._columns, _this._frozen);
75782
+ _this.initCells();
75289
75783
  return _this;
75290
75784
  }
75291
75785
  Object.defineProperty(DTableHeader.prototype, "table", {
@@ -75308,10 +75802,10 @@
75308
75802
  return 0;
75309
75803
  };
75310
75804
  DTableHeader.prototype.newCell = function (columnIndex, column, columns, options) {
75311
- return new DTableHeaderCell(this.toCellOptions(columnIndex, column, options));
75805
+ return new DTableHeaderCell(this, columnIndex, column, this.toCellOptions(column, options));
75312
75806
  };
75313
- DTableHeader.prototype.toCellOptions = function (columnIndex, column, options) {
75314
- 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);
75315
75809
  if (result != null) {
75316
75810
  if (result.weight === undefined) {
75317
75811
  result.weight = column.weight;
@@ -75327,15 +75821,6 @@
75327
75821
  else if (result.text.value === undefined) {
75328
75822
  result.text.value = column.label;
75329
75823
  }
75330
- if (result.header === undefined) {
75331
- result.header = this;
75332
- }
75333
- if (result.column === undefined) {
75334
- result.column = column;
75335
- }
75336
- if (result.columnIndex === undefined) {
75337
- result.columnIndex = columnIndex;
75338
- }
75339
75824
  return result;
75340
75825
  }
75341
75826
  else {
@@ -75344,10 +75829,7 @@
75344
75829
  width: column.width,
75345
75830
  text: {
75346
75831
  value: column.label
75347
- },
75348
- header: this,
75349
- column: column,
75350
- columnIndex: columnIndex
75832
+ }
75351
75833
  };
75352
75834
  }
75353
75835
  };
@@ -75368,10 +75850,6 @@
75368
75850
  return DTableScrollBar;
75369
75851
  }(DPaneScrollBar));
75370
75852
 
75371
- /*
75372
- * Copyright (C) 2019 Toshiba Corporation
75373
- * SPDX-License-Identifier: Apache-2.0
75374
- */
75375
75853
  var defaultGetter = function (row, columnIndex) {
75376
75854
  return row[columnIndex];
75377
75855
  };
@@ -75432,7 +75910,7 @@
75432
75910
  };
75433
75911
  }
75434
75912
  };
75435
- var toColumnAlign = function (options, type) {
75913
+ var toAlign = function (options, type) {
75436
75914
  var align = options.align;
75437
75915
  if (align != null) {
75438
75916
  if (isString(align)) {
@@ -75462,7 +75940,7 @@
75462
75940
  return DAlignHorizontal.LEFT;
75463
75941
  }
75464
75942
  };
75465
- var toColumnDataChecker = function (path) {
75943
+ var toDataChecker = function (path) {
75466
75944
  if (path != null) {
75467
75945
  var pathLength_1 = path.length;
75468
75946
  if (pathLength_1 <= 1) {
@@ -75490,9 +75968,9 @@
75490
75968
  return columnIndex < row.length;
75491
75969
  };
75492
75970
  };
75493
- var toColumnEditingEnable = function (enable, path) {
75971
+ var toEditingEnable = function (enable, path) {
75494
75972
  if (isString(enable)) {
75495
- return toColumnDataChecker(path);
75973
+ return toDataChecker(path);
75496
75974
  }
75497
75975
  else if (enable != null) {
75498
75976
  return enable;
@@ -75501,20 +75979,20 @@
75501
75979
  return false;
75502
75980
  }
75503
75981
  };
75504
- var toColumnEditing = function (options, path) {
75982
+ var toEditing = function (options, path) {
75505
75983
  var _a;
75506
75984
  var editing = options.editing;
75507
75985
  var editable = options.editable;
75508
75986
  if (editing) {
75509
75987
  return {
75510
- 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),
75511
75989
  formatter: editing.formatter,
75512
75990
  unformatter: editing.unformatter,
75513
75991
  validator: editing.validator
75514
75992
  };
75515
75993
  }
75516
75994
  return {
75517
- enable: toColumnEditingEnable(editable, path)
75995
+ enable: toEditingEnable(editable, path)
75518
75996
  };
75519
75997
  };
75520
75998
  var toComparator = function (getter, index) {
@@ -75524,7 +76002,7 @@
75524
76002
  return valueA < valueB ? -1 : valueB < valueA ? +1 : 0;
75525
76003
  };
75526
76004
  };
75527
- var toColumnSorting = function (getter, index, options) {
76005
+ var toSorting = function (getter, index, options) {
75528
76006
  var sorting = options.sorting;
75529
76007
  var sortable = options.sortable;
75530
76008
  if (sorting) {
@@ -75548,7 +76026,7 @@
75548
76026
  enable: false
75549
76027
  };
75550
76028
  };
75551
- var toColumnMenu = function (options) {
76029
+ var toMenu = function (options) {
75552
76030
  if (options == null) {
75553
76031
  return undefined;
75554
76032
  }
@@ -75559,7 +76037,7 @@
75559
76037
  return new DMenu(options);
75560
76038
  }
75561
76039
  };
75562
- var toColumnDialog = function (options) {
76040
+ var toDialog = function (options) {
75563
76041
  if (options == null) {
75564
76042
  return undefined;
75565
76043
  }
@@ -75576,14 +76054,14 @@
75576
76054
  var defaultSelectingSetter = function () {
75577
76055
  // DO NOTHING
75578
76056
  };
75579
- var toColumnSelecting = function (options) {
76057
+ var toSelecting = function (options) {
75580
76058
  if (options) {
75581
76059
  return {
75582
76060
  getter: options.getter || defaultSelectingGetter,
75583
76061
  setter: options.setter || defaultSelectingSetter,
75584
- menu: toColumnMenu(options.menu),
75585
- multiple: toColumnMenu(options.multiple),
75586
- dialog: toColumnDialog(options.dialog),
76062
+ menu: toMenu(options.menu),
76063
+ multiple: toMenu(options.multiple),
76064
+ dialog: toDialog(options.dialog),
75587
76065
  promise: options.promise
75588
76066
  };
75589
76067
  }
@@ -75592,7 +76070,7 @@
75592
76070
  setter: defaultSelectingSetter
75593
76071
  };
75594
76072
  };
75595
- var toColumnGetter = function (options, type, parts) {
76073
+ var toGetter = function (options, type, parts) {
75596
76074
  var getter = options.getter;
75597
76075
  if (getter) {
75598
76076
  return getter;
@@ -75610,7 +76088,7 @@
75610
76088
  }
75611
76089
  }
75612
76090
  };
75613
- var toColumnSetter = function (options, type, path) {
76091
+ var toSetter = function (options, type, path) {
75614
76092
  var setter = options.setter;
75615
76093
  if (setter) {
75616
76094
  return setter;
@@ -75629,7 +76107,7 @@
75629
76107
  }
75630
76108
  }
75631
76109
  };
75632
- var toColumnState = function (options) {
76110
+ var toState = function (options) {
75633
76111
  var state = options.state;
75634
76112
  if (state != null) {
75635
76113
  if (isString(state) || isArray(state)) {
@@ -75650,155 +76128,445 @@
75650
76128
  modifier: undefined
75651
76129
  };
75652
76130
  };
75653
- var toColumnPath = function (options) {
76131
+ var toPath = function (options) {
75654
76132
  return options.path != null ? options.path.split(".") : null;
75655
76133
  };
75656
- var toColumnRenderable = function (options, path) {
76134
+ var toRenderable = function (options, path) {
75657
76135
  var renderable = options.renderable;
75658
76136
  if (isString(renderable)) {
75659
- return toColumnDataChecker(path);
76137
+ return toDataChecker(path);
75660
76138
  }
75661
76139
  else if (renderable != null) {
75662
76140
  return renderable;
75663
76141
  }
75664
76142
  return true;
75665
76143
  };
75666
- var toColumn = function (index, options) {
75667
- var _a, _b;
75668
- var weight = options.weight;
75669
- var width = options.width;
75670
- if (weight != null) {
75671
- if (width != null) {
75672
- width = undefined;
75673
- }
75674
- }
75675
- else if (width == null) {
75676
- weight = 1;
75677
- }
75678
- var type = toEnum((_a = options.type) !== null && _a !== void 0 ? _a : DTableColumnType.TEXT, DTableColumnType);
75679
- var align = toColumnAlign(options, type);
75680
- var label = options.label || "";
75681
- var path = toColumnPath(options);
75682
- var getter = toColumnGetter(options, type, path);
75683
- var setter = toColumnSetter(options, type, path);
75684
- return {
75685
- weight: weight,
75686
- width: width,
75687
- type: type,
75688
- label: label,
75689
- getter: getter,
75690
- setter: setter,
75691
- formatter: options.formatter,
75692
- renderable: toColumnRenderable(options, path),
75693
- align: align,
75694
- state: toColumnState(options),
75695
- editing: toColumnEditing(options, path),
75696
- sorting: toColumnSorting(getter, index, options),
75697
- header: options.header,
75698
- body: options.body,
75699
- selecting: toColumnSelecting(options.selecting),
75700
- category: options.category,
75701
- frozen: options.frozen,
75702
- offset: 0.0,
75703
- link: options.link,
75704
- update: toEnum((_b = options.update) !== null && _b !== void 0 ? _b : DTableColumnUpdate.CELL, DTableColumnUpdate)
75705
- };
75706
- };
75707
- var toColumns = function (options) {
75708
- var result = [];
75709
- for (var i = 0, imax = options.length; i < imax; ++i) {
75710
- 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;
75711
76187
  }
75712
- return result;
75713
- };
75714
- var toFrozen = function (columns) {
75715
- for (var i = columns.length - 1; 0 <= i; --i) {
75716
- if (columns[i].frozen === true) {
75717
- 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
+ }
75718
76237
  }
76238
+ _this.frozen = frozen;
76239
+ return _this;
75719
76240
  }
75720
- return 0;
75721
- };
75722
- var DTable = /** @class */ (function (_super) {
75723
- __extends(DTable, _super);
75724
- function DTable(options) {
75725
- var _this = _super.call(this, options) || this;
75726
- var content = _this.content;
75727
- content.setWidth(_this.toContentWidth(options));
75728
- var body = _this.body;
75729
- content.addChild(body);
75730
- if (body.data.selection.type !== DTableDataSelectionType.NONE) {
75731
- _this.on(UtilPointerEvent.tap, function (e) {
75732
- body.onRowClick(e);
75733
- });
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
+ }
75734
76265
  }
75735
- var header = _this.header;
75736
- if (header) {
75737
- 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
+ }
75738
76274
  }
75739
- var categories = _this.categories;
75740
- for (var i = categories.length - 1; 0 <= i; --i) {
75741
- 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
+ }
75742
76282
  }
75743
- 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);
75744
76372
  return _this;
75745
76373
  }
75746
- 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", {
75747
76407
  get: function () {
75748
- var result = this._columns;
75749
- if (result == null) {
75750
- var options = this._options;
75751
- result = options ? toColumns(options.columns) : [];
75752
- 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
+ }
75753
76450
  }
75754
- return result;
75755
76451
  },
75756
76452
  enumerable: false,
75757
76453
  configurable: true
75758
76454
  });
75759
- Object.defineProperty(DTable.prototype, "frozen", {
76455
+ Object.defineProperty(DTableCategoryColumnImpl.prototype, "minWeight", {
75760
76456
  get: function () {
75761
- var result = this._frozen;
75762
- if (result == null) {
75763
- result = toFrozen(this.columns);
75764
- 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
+ }
75765
76466
  }
75766
76467
  return result;
75767
76468
  },
75768
76469
  enumerable: false,
75769
76470
  configurable: true
75770
76471
  });
75771
- Object.defineProperty(DTable.prototype, "categories", {
76472
+ Object.defineProperty(DTableCategoryColumnImpl.prototype, "width", {
75772
76473
  get: function () {
75773
- var result = this._categories;
75774
- if (result == null) {
75775
- result = this.newCategories(this._options, this.columns, this.frozen);
75776
- 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
+ }
75777
76525
  }
75778
76526
  return result;
75779
76527
  },
75780
76528
  enumerable: false,
75781
76529
  configurable: true
75782
76530
  });
75783
- DTable.prototype.initContent = function (content) {
75784
- _super.prototype.initContent.call(this, content);
75785
- content.state.isFocusReverse = true;
75786
- };
75787
- DTable.prototype.onContentChange = function () {
75788
- _super.prototype.onContentChange.call(this);
75789
- this.body.update();
75790
- };
75791
- DTable.prototype.onResize = function (newWidth, newHeight, oldWidth, oldHeight) {
75792
- var scrollbar = this.scrollbar;
75793
- scrollbar.lock();
75794
- var body = this.body;
75795
- body.lock();
75796
- _super.prototype.onResize.call(this, newWidth, newHeight, oldWidth, oldHeight);
75797
- body.update();
75798
- body.unlock(true);
75799
- 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
+ }
75800
76553
  };
75801
- 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) {
75802
76570
  var result = 0;
75803
76571
  for (var i = 0, imax = columns.length; i < imax; ++i) {
75804
76572
  var category = columns[i].category;
@@ -75809,22 +76577,7 @@
75809
76577
  }
75810
76578
  return result;
75811
76579
  };
75812
- DTable.prototype.toCategoryLabel = function (index, category) {
75813
- if (category) {
75814
- if (isString(category)) {
75815
- if (index === 0) {
75816
- return category;
75817
- }
75818
- }
75819
- else {
75820
- if (index < category.length) {
75821
- return category[index];
75822
- }
75823
- }
75824
- }
75825
- return undefined;
75826
- };
75827
- DTable.prototype.isSameCategory = function (index, a, b) {
76580
+ DTableCategoryContainerImpl.prototype.isCategory = function (index, a, b) {
75828
76581
  if (a != null) {
75829
76582
  if (b != null) {
75830
76583
  if (isString(a)) {
@@ -75913,7 +76666,7 @@
75913
76666
  }
75914
76667
  }
75915
76668
  };
75916
- DTable.prototype.toCategoryColumns = function (index, columns, frozen) {
76669
+ DTableCategoryContainerImpl.prototype.toColumns = function (index, columns, frozen) {
75917
76670
  var result = [];
75918
76671
  var tcolumn = null;
75919
76672
  var ccolumn = null;
@@ -75922,66 +76675,119 @@
75922
76675
  if (i !== frozen &&
75923
76676
  ccolumn &&
75924
76677
  tcolumn &&
75925
- this.isSameCategory(index, tcolumn.category, column.category)) {
76678
+ this.isCategory(index, tcolumn.category, column.category)) {
75926
76679
  if (ccolumn.weight != null && column.weight != null) {
75927
- ccolumn.weight += column.weight;
76680
+ ccolumn.add(column);
75928
76681
  }
75929
76682
  else if (ccolumn.width != null && column.width != null) {
75930
- ccolumn.width += column.width;
76683
+ ccolumn.add(column);
75931
76684
  }
75932
76685
  else {
75933
76686
  tcolumn = column;
75934
- ccolumn = {
75935
- label: this.toCategoryLabel(index, column.category),
75936
- weight: column.weight,
75937
- width: column.width,
75938
- offset: 0.0
75939
- };
76687
+ ccolumn = new DTableCategoryColumnImpl(index, column);
75940
76688
  result.push(ccolumn);
75941
76689
  }
75942
76690
  }
75943
76691
  else {
75944
76692
  tcolumn = column;
75945
- ccolumn = {
75946
- label: this.toCategoryLabel(index, column.category),
75947
- weight: column.weight,
75948
- width: column.width,
75949
- offset: 0.0
75950
- };
76693
+ ccolumn = new DTableCategoryColumnImpl(index, column);
75951
76694
  result.push(ccolumn);
75952
76695
  }
75953
76696
  }
75954
76697
  return result;
75955
76698
  };
75956
- DTable.prototype.toCategoryOptions = function (index, options, columns, frozen, offset) {
75957
- if (options) {
75958
- if (options.columns === undefined) {
75959
- options.columns = this.toCategoryColumns(index, columns, frozen);
75960
- }
75961
- if (options.frozen == null) {
75962
- options.frozen = frozen;
75963
- }
75964
- if (options.offset == null) {
75965
- options.offset = offset;
75966
- }
75967
- 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
+ });
75968
76717
  }
75969
- return {
75970
- columns: this.toCategoryColumns(index, columns, frozen),
75971
- frozen: frozen,
75972
- offset: offset
75973
- };
75974
- };
75975
- DTable.prototype.newCategories = function (options, columns, frozen) {
75976
- var count = this.getCategoryCount(columns);
75977
- var result = [];
75978
- var offset = 0;
75979
- for (var i = count - 1; 0 <= i; --i) {
75980
- var category = new DTableCategory(this.toCategoryOptions(i, options === null || options === void 0 ? void 0 : options.category, columns, frozen, offset));
75981
- result.push(category);
75982
- offset += category.height;
76718
+ var header = _this.header;
76719
+ if (header) {
76720
+ content.addChild(header);
75983
76721
  }
75984
- 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);
75985
76791
  };
75986
76792
  DTable.prototype.onDblClick = function (e, interactionManager) {
75987
76793
  var result = this.body.onDblClick(e, interactionManager);
@@ -75993,24 +76799,35 @@
75993
76799
  _this.onScrollBarUpdate(isRegionVisible);
75994
76800
  });
75995
76801
  };
75996
- DTable.prototype.toContentWidth = function (options) {
75997
- var columnWidthTotal = 0;
75998
- var columns = options === null || options === void 0 ? void 0 : options.columns;
75999
- if (columns) {
76000
- for (var i = 0, imax = columns.length; i < imax; ++i) {
76001
- var column = columns[i];
76002
- var columnWidth = column.width;
76003
- if (columnWidth != null) {
76004
- columnWidthTotal += columnWidth;
76005
- }
76006
- }
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
+ });
76007
76825
  }
76008
- if (0 < columnWidthTotal) {
76009
- return function (p) {
76010
- return Math.max(p, columnWidthTotal);
76011
- };
76826
+ else {
76827
+ result.setWidth("100%");
76012
76828
  }
76013
- return "100%";
76829
+ // Done
76830
+ return result;
76014
76831
  };
76015
76832
  DTable.prototype.getHeaderOffset = function () {
76016
76833
  var result = this._headerOffset;
@@ -76032,7 +76849,7 @@
76032
76849
  get: function () {
76033
76850
  var result = this._header;
76034
76851
  if (result === undefined) {
76035
- result = this.newHeader(this._options, this.columns, this.frozen, this.getHeaderOffset());
76852
+ result = this.newHeader();
76036
76853
  this._header = result;
76037
76854
  }
76038
76855
  return result;
@@ -76051,42 +76868,17 @@
76051
76868
  }
76052
76869
  return false;
76053
76870
  };
76054
- DTable.prototype.newHeader = function (options, columns, frozen, offset) {
76871
+ DTable.prototype.newHeader = function () {
76872
+ var options = this._options;
76055
76873
  if (this.hasHeader(options)) {
76056
- 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);
76057
76876
  }
76058
76877
  return null;
76059
76878
  };
76060
- DTable.prototype.toHeaderOptions = function (options, columns, frozen, offset) {
76061
- if (options) {
76062
- if (options.columns === undefined) {
76063
- options.columns = columns;
76064
- }
76065
- if (options.frozen == null) {
76066
- options.frozen = frozen;
76067
- }
76068
- if (options.offset === undefined) {
76069
- options.offset = offset;
76070
- }
76071
- if (options.table === undefined) {
76072
- options.table = this;
76073
- }
76074
- return options;
76075
- }
76076
- return {
76077
- columns: columns,
76078
- frozen: frozen,
76079
- offset: offset,
76080
- table: this
76081
- };
76082
- };
76083
76879
  DTable.prototype.getBodyOffset = function () {
76084
- var result = this._bodyOffset;
76085
- if (result == null) {
76086
- result = this.newBodyOffset();
76087
- this._bodyOffset = result;
76088
- }
76089
- return result;
76880
+ var _a;
76881
+ return ((_a = this._bodyOffset) !== null && _a !== void 0 ? _a : (this._bodyOffset = this.newBodyOffset()));
76090
76882
  };
76091
76883
  DTable.prototype.newBodyOffset = function () {
76092
76884
  var _a, _b;
@@ -76094,30 +76886,19 @@
76094
76886
  };
76095
76887
  Object.defineProperty(DTable.prototype, "body", {
76096
76888
  get: function () {
76097
- var result = this._body;
76098
- if (result == null) {
76099
- result = this.newBody(this._options, this.columns, this.frozen, this.getBodyOffset());
76100
- this._body = result;
76101
- }
76102
- return result;
76889
+ var _a;
76890
+ return ((_a = this._body) !== null && _a !== void 0 ? _a : (this._body = this.newBody()));
76103
76891
  },
76104
76892
  enumerable: false,
76105
76893
  configurable: true
76106
76894
  });
76107
- DTable.prototype.newBody = function (options, columns, frozen, offset) {
76108
- 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));
76109
76899
  };
76110
- DTable.prototype.toBodyOptions = function (options, columns, frozen, offset, data) {
76900
+ DTable.prototype.toBodyOptions = function (options, data) {
76111
76901
  if (options != null) {
76112
- if (options.columns === undefined) {
76113
- options.columns = columns;
76114
- }
76115
- if (options.frozen == null) {
76116
- options.frozen = frozen;
76117
- }
76118
- if (options.offset === undefined) {
76119
- options.offset = offset;
76120
- }
76121
76902
  if (options.data === undefined && data !== undefined) {
76122
76903
  if (isArray(data)) {
76123
76904
  options.data = {
@@ -76135,9 +76916,6 @@
76135
76916
  }
76136
76917
  if (isArray(data)) {
76137
76918
  return {
76138
- columns: columns,
76139
- frozen: frozen,
76140
- offset: offset,
76141
76919
  data: {
76142
76920
  rows: data
76143
76921
  },
@@ -76146,9 +76924,6 @@
76146
76924
  }
76147
76925
  else {
76148
76926
  return {
76149
- columns: columns,
76150
- frozen: frozen,
76151
- offset: offset,
76152
76927
  data: data,
76153
76928
  weight: 1
76154
76929
  };
@@ -78655,6 +79430,7 @@
78655
79430
  DTableBodyCells: DTableBodyCells,
78656
79431
  DTableBodyRow: DTableBodyRow,
78657
79432
  DTableBody: DTableBody,
79433
+ DTableCategoryCellEdge: DTableCategoryCellEdge,
78658
79434
  DTableCategoryCell: DTableCategoryCell,
78659
79435
  DTableCategory: DTableCategory,
78660
79436
  DTableColumnType: DTableColumnType,
@@ -78672,6 +79448,7 @@
78672
79448
  DTableDataTreeSorter: DTableDataTreeSorter,
78673
79449
  DTableDataTree: DTableDataTree,
78674
79450
  DTableHeaderCellCheck: DTableHeaderCellCheck,
79451
+ DTableHeaderCellEdge: DTableHeaderCellEdge,
78675
79452
  DTableHeaderCell: DTableHeaderCell,
78676
79453
  DTableHeader: DTableHeader,
78677
79454
  DTableRow: DTableRow,