@wcardinal/wcardinal-ui 0.411.0 → 0.413.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 (98) hide show
  1. package/dist/types/wcardinal/ui/d-indicator-processing.d.ts +8 -7
  2. package/dist/types/wcardinal/ui/d-pagination.d.ts +5 -5
  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/index.d.ts +7 -0
  23. package/dist/types/wcardinal/ui/theme/dark/d-theme-dark-table-header-cell.d.ts +1 -0
  24. package/dist/types/wcardinal/ui/theme/dark/d-theme-dark-table-header.d.ts +1 -0
  25. package/dist/types/wcardinal/ui/theme/white/d-theme-white-table-header-cell.d.ts +1 -0
  26. package/dist/types/wcardinal/ui/theme/white/d-theme-white-table-header.d.ts +1 -0
  27. package/dist/wcardinal/ui/d-base.js +2 -2
  28. package/dist/wcardinal/ui/d-base.js.map +1 -1
  29. package/dist/wcardinal/ui/d-indicator-processing.js +20 -15
  30. package/dist/wcardinal/ui/d-indicator-processing.js.map +1 -1
  31. package/dist/wcardinal/ui/d-pagination.js +5 -5
  32. package/dist/wcardinal/ui/d-pagination.js.map +1 -1
  33. package/dist/wcardinal/ui/d-table-body-cell.js.map +1 -1
  34. package/dist/wcardinal/ui/d-table-body-row.js +4 -4
  35. package/dist/wcardinal/ui/d-table-body-row.js.map +1 -1
  36. package/dist/wcardinal/ui/d-table-body.js +6 -15
  37. package/dist/wcardinal/ui/d-table-body.js.map +1 -1
  38. package/dist/wcardinal/ui/d-table-category-cell.js +244 -2
  39. package/dist/wcardinal/ui/d-table-category-cell.js.map +1 -1
  40. package/dist/wcardinal/ui/d-table-category-column-impl.js +222 -0
  41. package/dist/wcardinal/ui/d-table-category-column-impl.js.map +1 -0
  42. package/dist/wcardinal/ui/d-table-category-column.js +6 -0
  43. package/dist/wcardinal/ui/d-table-category-column.js.map +1 -0
  44. package/dist/wcardinal/ui/d-table-category-container-impl.js +149 -0
  45. package/dist/wcardinal/ui/d-table-category-container-impl.js.map +1 -0
  46. package/dist/wcardinal/ui/d-table-category-container.js +2 -0
  47. package/dist/wcardinal/ui/d-table-category-container.js.map +1 -0
  48. package/dist/wcardinal/ui/d-table-category.js +49 -7
  49. package/dist/wcardinal/ui/d-table-category.js.map +1 -1
  50. package/dist/wcardinal/ui/d-table-column-container-impl.js +126 -0
  51. package/dist/wcardinal/ui/d-table-column-container-impl.js.map +1 -0
  52. package/dist/wcardinal/ui/d-table-column-container.js +2 -0
  53. package/dist/wcardinal/ui/d-table-column-container.js.map +1 -0
  54. package/dist/wcardinal/ui/d-table-column-impl.js +375 -0
  55. package/dist/wcardinal/ui/d-table-column-impl.js.map +1 -0
  56. package/dist/wcardinal/ui/d-table-column.js.map +1 -1
  57. package/dist/wcardinal/ui/d-table-header-cell-check.js.map +1 -1
  58. package/dist/wcardinal/ui/d-table-header-cell.js +245 -48
  59. package/dist/wcardinal/ui/d-table-header-cell.js.map +1 -1
  60. package/dist/wcardinal/ui/d-table-header.js +8 -22
  61. package/dist/wcardinal/ui/d-table-header.js.map +1 -1
  62. package/dist/wcardinal/ui/d-table-row.js +7 -5
  63. package/dist/wcardinal/ui/d-table-row.js.map +1 -1
  64. package/dist/wcardinal/ui/d-table-state.js +9 -1
  65. package/dist/wcardinal/ui/d-table-state.js.map +1 -1
  66. package/dist/wcardinal/ui/d-table.js +69 -631
  67. package/dist/wcardinal/ui/d-table.js.map +1 -1
  68. package/dist/wcardinal/ui/index.js +7 -0
  69. package/dist/wcardinal/ui/index.js.map +1 -1
  70. package/dist/wcardinal/ui/theme/dark/d-theme-dark-table-header-cell.js +7 -1
  71. package/dist/wcardinal/ui/theme/dark/d-theme-dark-table-header-cell.js.map +1 -1
  72. package/dist/wcardinal/ui/theme/dark/d-theme-dark-table-header.js +7 -0
  73. package/dist/wcardinal/ui/theme/dark/d-theme-dark-table-header.js.map +1 -1
  74. package/dist/wcardinal/ui/theme/white/d-theme-white-table-header-cell.js +7 -1
  75. package/dist/wcardinal/ui/theme/white/d-theme-white-table-header-cell.js.map +1 -1
  76. package/dist/wcardinal/ui/theme/white/d-theme-white-table-header.js +7 -0
  77. package/dist/wcardinal/ui/theme/white/d-theme-white-table-header.js.map +1 -1
  78. package/dist/wcardinal-ui-theme-dark-en-us.js +14 -2
  79. package/dist/wcardinal-ui-theme-dark-en-us.min.js +2 -2
  80. package/dist/wcardinal-ui-theme-dark-en-us.min.js.map +1 -1
  81. package/dist/wcardinal-ui-theme-dark-ja-jp.js +14 -2
  82. package/dist/wcardinal-ui-theme-dark-ja-jp.min.js +2 -2
  83. package/dist/wcardinal-ui-theme-dark-ja-jp.min.js.map +1 -1
  84. package/dist/wcardinal-ui-theme-dark.js +14 -2
  85. package/dist/wcardinal-ui-theme-dark.min.js +2 -2
  86. package/dist/wcardinal-ui-theme-white-en-us.js +14 -2
  87. package/dist/wcardinal-ui-theme-white-en-us.min.js +2 -2
  88. package/dist/wcardinal-ui-theme-white-en-us.min.js.map +1 -1
  89. package/dist/wcardinal-ui-theme-white-ja-jp.js +14 -2
  90. package/dist/wcardinal-ui-theme-white-ja-jp.min.js +2 -2
  91. package/dist/wcardinal-ui-theme-white-ja-jp.min.js.map +1 -1
  92. package/dist/wcardinal-ui-theme-white.js +14 -2
  93. package/dist/wcardinal-ui-theme-white.min.js +2 -2
  94. package/dist/wcardinal-ui.cjs.js +1545 -753
  95. package/dist/wcardinal-ui.js +1882 -1114
  96. package/dist/wcardinal-ui.min.js +2 -2
  97. package/dist/wcardinal-ui.min.js.map +1 -1
  98. package/package.json +1 -1
@@ -1,5 +1,5 @@
1
1
  /*
2
- Winter Cardinal UI v0.411.0
2
+ Winter Cardinal UI v0.413.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 {
@@ -66990,15 +66990,17 @@
66990
66990
  return DExpandable;
66991
66991
  }(DLayoutVertical));
66992
66992
 
66993
- var STATE_INITIAL = 0;
66994
- var STATE_STARTED = 1;
66995
- var STATE_RESOLVED = 2;
66996
- var STATE_REJECTED = 3;
66993
+ var DIndicatorProcessingState = {
66994
+ INITIAL: 0,
66995
+ STARTED: 1,
66996
+ RESOLVED: 2,
66997
+ REJECTED: 3
66998
+ };
66997
66999
  var DIndicatorProcessing = /** @class */ (function () {
66998
67000
  function DIndicatorProcessing(parent, options) {
66999
67001
  var _a, _b, _c, _d, _e, _f, _g;
67000
67002
  this._parent = parent;
67001
- this._state = STATE_INITIAL;
67003
+ this._state = DIndicatorProcessingState.INITIAL;
67002
67004
  this._startTime = 0;
67003
67005
  // Delay
67004
67006
  var theme = this.theme;
@@ -67021,12 +67023,13 @@
67021
67023
  }
67022
67024
  DIndicatorProcessing.prototype.start = function () {
67023
67025
  var state = this._state;
67024
- if (state === STATE_INITIAL) {
67025
- this._state = STATE_STARTED;
67026
+ if (state === DIndicatorProcessingState.INITIAL) {
67027
+ this._state = DIndicatorProcessingState.STARTED;
67026
67028
  this.onBegin();
67027
67029
  }
67028
- else if (state === STATE_RESOLVED || state === STATE_REJECTED) {
67029
- this._state = STATE_STARTED;
67030
+ else if (state === DIndicatorProcessingState.RESOLVED ||
67031
+ state === DIndicatorProcessingState.REJECTED) {
67032
+ this._state = DIndicatorProcessingState.STARTED;
67030
67033
  this.onEnd();
67031
67034
  this.onBegin();
67032
67035
  }
@@ -67077,8 +67080,10 @@
67077
67080
  };
67078
67081
  DIndicatorProcessing.prototype.end = function () {
67079
67082
  var state = this._state;
67080
- if (state === STATE_STARTED || state === STATE_RESOLVED || state === STATE_REJECTED) {
67081
- this._state = STATE_INITIAL;
67083
+ if (state === DIndicatorProcessingState.STARTED ||
67084
+ state === DIndicatorProcessingState.RESOLVED ||
67085
+ state === DIndicatorProcessingState.REJECTED) {
67086
+ this._state = DIndicatorProcessingState.INITIAL;
67082
67087
  this.onEnd();
67083
67088
  }
67084
67089
  return this;
@@ -67114,8 +67119,8 @@
67114
67119
  };
67115
67120
  DIndicatorProcessing.prototype.resolve = function (message) {
67116
67121
  var _this = this;
67117
- if (this._state === STATE_STARTED) {
67118
- this._state = STATE_RESOLVED;
67122
+ if (this._state === DIndicatorProcessingState.STARTED) {
67123
+ this._state = DIndicatorProcessingState.RESOLVED;
67119
67124
  var elapsedTime = Date.now() - this._startTime;
67120
67125
  var delay = this._delayDone - elapsedTime;
67121
67126
  if (0 < delay) {
@@ -67147,8 +67152,8 @@
67147
67152
  };
67148
67153
  DIndicatorProcessing.prototype.reject = function (message) {
67149
67154
  var _this = this;
67150
- if (this._state === STATE_STARTED) {
67151
- this._state = STATE_REJECTED;
67155
+ if (this._state === DIndicatorProcessingState.STARTED) {
67156
+ this._state = DIndicatorProcessingState.REJECTED;
67152
67157
  var elapsedTime = Date.now() - this._startTime;
67153
67158
  var delay = this._delayDone - elapsedTime;
67154
67159
  if (0 < delay) {
@@ -68766,7 +68771,7 @@
68766
68771
  };
68767
68772
  /**
68768
68773
  * Goes to the last page.
68769
- * Unlike {@link #value}, this method emits the change event if silently is not true.
68774
+ * Unlike {@link value}, this method emits the change event if silently is not true.
68770
68775
  *
68771
68776
  * @param silently true to suppress the change event
68772
68777
  * @returns true if succeeded.
@@ -68776,7 +68781,7 @@
68776
68781
  };
68777
68782
  /**
68778
68783
  * Goes to the given page.
68779
- * Unlike {@link #value}, this method emits the change event if silently is not true.
68784
+ * Unlike {@link value}, this method emits the change event if silently is not true.
68780
68785
  *
68781
68786
  * @param index a page index
68782
68787
  * @param silently true to suppress the change event
@@ -68825,7 +68830,7 @@
68825
68830
  };
68826
68831
  /**
68827
68832
  * Goes to the next page.
68828
- * Unlike {@link #value}, this method emits the change event if silently is not true.
68833
+ * Unlike {@link value}, this method emits the change event if silently is not true.
68829
68834
  *
68830
68835
  * @param silently true to suppress the change event
68831
68836
  * @returns true if succeeded.
@@ -68863,7 +68868,7 @@
68863
68868
  };
68864
68869
  /**
68865
68870
  * Goes to the previous page.
68866
- * Unlike {@link #value}, this method emits the change event if silently is not true.
68871
+ * Unlike {@link value}, this method emits the change event if silently is not true.
68867
68872
  *
68868
68873
  * @param silently true to suppress the change event
68869
68874
  * @returns true if succeeded.
@@ -68901,7 +68906,7 @@
68901
68906
  };
68902
68907
  /**
68903
68908
  * Goes to the top page.
68904
- * Unlike {@link #value}, this method emits the change event if silently is not true.
68909
+ * Unlike {@link value}, this method emits the change event if silently is not true.
68905
68910
  *
68906
68911
  * @param silently true to suppress the change event
68907
68912
  * @returns true if succeeded.
@@ -71511,7 +71516,15 @@
71511
71516
  /**
71512
71517
  * Selectable row
71513
71518
  */
71514
- SELECTABLE: "SELECTABLE"
71519
+ SELECTABLE: "SELECTABLE",
71520
+ /**
71521
+ * Header or category cells hovered on their edges.
71522
+ */
71523
+ HOVERED_ON_EDGE: "HOVERED_ON_EDGE",
71524
+ /**
71525
+ * Header or category of being resized.
71526
+ */
71527
+ RESIZING: "RESIZING"
71515
71528
  };
71516
71529
 
71517
71530
  /*
@@ -72165,15 +72178,17 @@
72165
72178
  */
72166
72179
  var DTableRow = /** @class */ (function (_super) {
72167
72180
  __extends(DTableRow, _super);
72168
- function DTableRow(options) {
72169
- var _a, _b;
72181
+ function DTableRow(columns, frozen, options) {
72170
72182
  var _this = _super.call(this, options) || this;
72171
72183
  _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 : [];
72184
+ _this._frozen = frozen;
72185
+ _this._columns = columns;
72174
72186
  return _this;
72175
72187
  }
72176
- DTableRow.prototype.initCells = function (options, columns, frozen) {
72188
+ DTableRow.prototype.initCells = function () {
72189
+ var columns = this._columns;
72190
+ var frozen = this._frozen;
72191
+ var options = this._options;
72177
72192
  var iend = this.toIndexEnd(columns);
72178
72193
  for (var i = columns.length - 1; 0 <= i; --i) {
72179
72194
  var cell = this.newCell(i, columns[i], columns, options);
@@ -72265,8 +72280,8 @@
72265
72280
  */
72266
72281
  var DTableBodyRow = /** @class */ (function (_super) {
72267
72282
  __extends(DTableBodyRow, _super);
72268
- function DTableBodyRow(onChange, isEven, columnIndexToCellOptions, options) {
72269
- var _this = _super.call(this, options) || this;
72283
+ function DTableBodyRow(onChange, isEven, columnIndexToCellOptions, columns, frozen, options) {
72284
+ var _this = _super.call(this, columns, frozen, options) || this;
72270
72285
  _this._index = -1;
72271
72286
  _this._onChange = onChange;
72272
72287
  _this._onCellChangeBound = function (newValue, oldValue, row, rowIndex, columnIndex, column) {
@@ -72274,7 +72289,7 @@
72274
72289
  };
72275
72290
  _this._columnIndexToCellOptions = columnIndexToCellOptions;
72276
72291
  _this.state.isAlternated = !isEven;
72277
- _this.initCells(options, _this._columns, _this._frozen);
72292
+ _this.initCells();
72278
72293
  return _this;
72279
72294
  }
72280
72295
  DTableBodyRow.prototype.onCellChange = function (newValue, oldValue, row, rowIndex, columnIndex, column) {
@@ -72418,7 +72433,7 @@
72418
72433
  DTableBodyRow.prototype.toCellOptions = function (columnIndex, column, options) {
72419
72434
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
72420
72435
  var _p;
72421
- var result = toMerged(column.body, options.cell);
72436
+ var result = toMerged(column.body, options === null || options === void 0 ? void 0 : options.cell);
72422
72437
  // Weight
72423
72438
  result.weight = column.weight;
72424
72439
  // Width
@@ -73487,18 +73502,11 @@
73487
73502
  * SPDX-License-Identifier: Apache-2.0
73488
73503
  */
73489
73504
  var toRowOptions = function (theme, options, selectionType) {
73490
- var columns = options.columns || [];
73491
73505
  var result = options.row;
73492
73506
  if (result != null) {
73493
73507
  if (result.height == null) {
73494
73508
  result.height = theme.getRowHeight();
73495
73509
  }
73496
- if (result.columns === undefined) {
73497
- result.columns = columns;
73498
- }
73499
- if (result.frozen == null) {
73500
- result.frozen = options.frozen;
73501
- }
73502
73510
  if (result.selection === undefined) {
73503
73511
  result.selection = {
73504
73512
  type: selectionType
@@ -73510,9 +73518,7 @@
73510
73518
  }
73511
73519
  else {
73512
73520
  result = {
73513
- columns: columns,
73514
73521
  height: theme.getRowHeight(),
73515
- frozen: options.frozen,
73516
73522
  selection: {
73517
73523
  type: selectionType
73518
73524
  }
@@ -73522,18 +73528,18 @@
73522
73528
  };
73523
73529
  var DTableBody = /** @class */ (function (_super) {
73524
73530
  __extends(DTableBody, _super);
73525
- function DTableBody(options) {
73526
- var _a;
73531
+ function DTableBody(columns, frozen, offset, options) {
73527
73532
  var _this = _super.call(this, options) || this;
73528
- _this.transform.position.y = (_a = options.offset) !== null && _a !== void 0 ? _a : 0;
73533
+ _this.transform.position.y = offset;
73529
73534
  var data = _this.toData(options.data);
73530
73535
  _this._data = data;
73531
73536
  data.bind(_this);
73532
73537
  var theme = _this.theme;
73538
+ _this._columns = columns;
73539
+ _this._frozen = frozen;
73533
73540
  var rowOptions = toRowOptions(theme, options, data.selection.type);
73534
73541
  _this._rowOptions = rowOptions;
73535
73542
  _this._rowHeight = rowOptions.height != null ? rowOptions.height : theme.getRowHeight();
73536
- _this._columns = rowOptions.columns || [];
73537
73543
  _this._rowIndexMappedStart = 0;
73538
73544
  _this._rowIndexMappedEnd = 0;
73539
73545
  _this._updateRowsCount = 0;
@@ -73744,14 +73750,14 @@
73744
73750
  return row;
73745
73751
  };
73746
73752
  DTableBody.prototype.newRow = function (isEven) {
73747
- return new DTableBodyRow(this._onRowChangeBound, isEven, this._columnIndexToCellOptions, this._rowOptions);
73753
+ return new DTableBodyRow(this._onRowChangeBound, isEven, this._columnIndexToCellOptions, this._columns, this._frozen, this._rowOptions);
73748
73754
  };
73749
73755
  DTableBody.prototype.onParentMove = function (newX, newY, oldX, oldY) {
73750
73756
  _super.prototype.onParentMove.call(this, newX, newY, oldX, oldY);
73751
73757
  this.updateFrozenCellPosition(newX);
73752
73758
  };
73753
73759
  DTableBody.prototype.updateFrozenCellPosition = function (x) {
73754
- var frozen = this._rowOptions.frozen;
73760
+ var frozen = this._frozen;
73755
73761
  if (frozen != null && 0 < frozen) {
73756
73762
  var rows = this.children;
73757
73763
  for (var i = 0, imax = rows.length; i < imax; ++i) {
@@ -73966,472 +73972,1601 @@
73966
73972
  * Copyright (C) 2019 Toshiba Corporation
73967
73973
  * SPDX-License-Identifier: Apache-2.0
73968
73974
  */
73975
+ var DTableCategoryCellEdge = {
73976
+ NONE: 0,
73977
+ LEFT: 1,
73978
+ RIGHT: 2,
73979
+ BOTH: 3
73980
+ };
73969
73981
  var DTableCategoryCell = /** @class */ (function (_super) {
73970
73982
  __extends(DTableCategoryCell, _super);
73971
- function DTableCategoryCell() {
73972
- return _super !== null && _super.apply(this, arguments) || this;
73973
- }
73974
- DTableCategoryCell.prototype.getType = function () {
73975
- return "DTableCategoryCell";
73976
- };
73977
- return DTableCategoryCell;
73978
- }(DImage));
73979
-
73980
- /*
73981
- * Copyright (C) 2019 Toshiba Corporation
73982
- * SPDX-License-Identifier: Apache-2.0
73983
- */
73984
- var DTableCategory = /** @class */ (function (_super) {
73985
- __extends(DTableCategory, _super);
73986
- function DTableCategory(options) {
73987
- var _a;
73983
+ function DTableCategoryCell(category, columnIndex, column, options) {
73988
73984
  var _this = _super.call(this, options) || this;
73989
- var offset = (_a = options.offset) !== null && _a !== void 0 ? _a : 0;
73990
- _this._offset = offset;
73991
- _this.transform.position.y = offset;
73992
- _this.initCells(options, _this._columns, _this._frozen);
73993
- return _this;
73994
- }
73995
- DTableCategory.prototype.onParentMove = function (newX, newY, oldX, oldY) {
73996
- _super.prototype.onParentMove.call(this, newX, newY, oldX, oldY);
73997
- this.transform.position.y = -newY + this._offset;
73998
- this.updateFrozenCellPosition(newX);
73999
- };
74000
- DTableCategory.prototype.getContentPositionX = function () {
74001
- var content = this.parent;
74002
- if (content) {
74003
- return content.position.x;
74004
- }
74005
- return 0;
74006
- };
74007
- DTableCategory.prototype.newCell = function (columnIndex, column, columns, options) {
74008
- return new DTableCategoryCell(this.toCellOptions(columnIndex, column, options));
74009
- };
74010
- DTableCategory.prototype.toCellOptions = function (columnIndex, column, options) {
74011
- var result = options.cell;
74012
- if (result) {
74013
- result.weight = column.weight;
74014
- result.width = column.width;
74015
- var text = result.text || {};
74016
- result.text = text;
74017
- text.value = text.value || column.label;
74018
- return result;
74019
- }
74020
- else {
74021
- return {
74022
- weight: column.weight,
74023
- width: column.width,
74024
- text: {
74025
- value: column.label
74026
- }
74027
- };
74028
- }
74029
- };
74030
- DTableCategory.prototype.getType = function () {
74031
- return "DTableCategory";
74032
- };
74033
- return DTableCategory;
74034
- }(DTableRow));
74035
-
74036
- /*
74037
- * Copyright (C) 2019 Toshiba Corporation
74038
- * SPDX-License-Identifier: Apache-2.0
74039
- */
74040
- var DTableDataTreeFilter = /** @class */ (function (_super) {
74041
- __extends(DTableDataTreeFilter, _super);
74042
- function DTableDataTreeFilter(parent) {
74043
- var _this = _super.call(this) || this;
74044
- _this._id = 0;
74045
- _this._idUpdated = -1;
74046
- _this._isApplied = false;
74047
- _this._parent = parent;
74048
- _this._filter = null;
74049
- _this._filtered = null;
73985
+ _this._category = category;
73986
+ _this._columnIndex = columnIndex;
73987
+ _this._column = column;
73988
+ _this._edgeSize = _this.theme.getEdgeWidth();
73989
+ _this._wasResizing = false;
74050
73990
  return _this;
74051
73991
  }
74052
- Object.defineProperty(DTableDataTreeFilter.prototype, "id", {
73992
+ Object.defineProperty(DTableCategoryCell.prototype, "column", {
74053
73993
  get: function () {
74054
- return this._id;
73994
+ return this._column;
74055
73995
  },
74056
73996
  enumerable: false,
74057
73997
  configurable: true
74058
73998
  });
74059
- DTableDataTreeFilter.prototype.apply = function () {
74060
- this._isApplied = true;
74061
- this._id += 1;
74062
- this._parent.update();
74063
- };
74064
- DTableDataTreeFilter.prototype.unapply = function () {
74065
- if (this._isApplied) {
74066
- this._isApplied = false;
74067
- this._id += 1;
74068
- this._parent.update();
74069
- }
74070
- };
74071
- DTableDataTreeFilter.prototype.isApplied = function () {
74072
- return this._isApplied;
74073
- };
74074
- DTableDataTreeFilter.prototype.isFiltered = function (node, index, filter) {
74075
- if (isFunction(filter)) {
74076
- return filter(node, index);
73999
+ Object.defineProperty(DTableCategoryCell.prototype, "columnIndex", {
74000
+ get: function () {
74001
+ return this._columnIndex;
74002
+ },
74003
+ enumerable: false,
74004
+ configurable: true
74005
+ });
74006
+ Object.defineProperty(DTableCategoryCell.prototype, "category", {
74007
+ get: function () {
74008
+ return this._category;
74009
+ },
74010
+ enumerable: false,
74011
+ configurable: true
74012
+ });
74013
+ DTableCategoryCell.prototype.onDown = function (e) {
74014
+ var edges = this.state.valueOf(DTableState.HOVERED_ON_EDGE);
74015
+ if (edges != null) {
74016
+ this._wasResizing = true;
74017
+ var layer = DApplications.getLayer(this);
74018
+ if (layer != null) {
74019
+ var interactionManager = layer.renderer.plugins.interaction;
74020
+ var columnIndex = this._columnIndex;
74021
+ if (edges === DTableCategoryCellEdge.LEFT) {
74022
+ this.onDownEdge(e.data.global.x, columnIndex - 1, interactionManager);
74023
+ }
74024
+ else {
74025
+ this.onDownEdge(e.data.global.x, columnIndex, interactionManager);
74026
+ }
74027
+ }
74077
74028
  }
74078
74029
  else {
74079
- return filter.test(node, index);
74030
+ this._wasResizing = false;
74031
+ _super.prototype.onDown.call(this, e);
74080
74032
  }
74081
74033
  };
74082
- DTableDataTreeFilter.prototype.hasFiltered = function (parent, nodes, filter) {
74083
- var accessor = this._parent.accessor;
74084
- var toChildren = accessor.toChildren;
74085
- var hasChildren = accessor.hasChildren;
74086
- for (var i = 0, imax = nodes.length; i < imax; ++i) {
74087
- var node = nodes[i];
74088
- if (this.isFiltered(node, -1, filter)) {
74089
- return true;
74034
+ DTableCategoryCell.prototype.findLeftResizableCell = function (columnIndex) {
74035
+ var children = this._category.children;
74036
+ var childrenLength = children.length;
74037
+ for (var i = columnIndex; 0 <= i; --i) {
74038
+ var child = children[childrenLength - i - 1];
74039
+ if (child.column.resizable) {
74040
+ return child;
74090
74041
  }
74091
- var children = toChildren(node);
74092
- if (hasChildren(node, children) && this.hasFiltered(parent, children, filter)) {
74093
- return true;
74042
+ }
74043
+ return null;
74044
+ };
74045
+ DTableCategoryCell.prototype.findRightResizableCellOfWeight = function (columnIndex) {
74046
+ var children = this._category.children;
74047
+ var childrenLength = children.length;
74048
+ for (var i = columnIndex + 1; i < childrenLength; ++i) {
74049
+ var child = children[childrenLength - i - 1];
74050
+ var childColumn = child.column;
74051
+ if (childColumn.resizable) {
74052
+ var childColumnWeight = childColumn.weight;
74053
+ if (childColumnWeight != null) {
74054
+ return child;
74055
+ }
74094
74056
  }
74095
74057
  }
74096
- return false;
74058
+ return null;
74097
74059
  };
74098
- DTableDataTreeFilter.prototype.addAllToFiltered = function (parent, nodes, filtered, cursor) {
74099
- var accessor = this._parent.accessor;
74100
- var toChildren = accessor.toChildren;
74101
- var hasChildren = accessor.hasChildren;
74102
- for (var i = 0, imax = nodes.length; i < imax; ++i) {
74103
- var node = nodes[i];
74104
- filtered.push(cursor[0]);
74105
- cursor[0] += 1;
74106
- var children = toChildren(node);
74107
- if (hasChildren(node, children) && parent.isOpened(node)) {
74108
- this.addAllToFiltered(parent, children, filtered, cursor);
74060
+ DTableCategoryCell.prototype.checkIfEdgeResizable = function (columnIndex) {
74061
+ var target = this.findLeftResizableCell(columnIndex);
74062
+ if (target != null) {
74063
+ if (target.column.weight != null) {
74064
+ return this.findRightResizableCellOfWeight(target.columnIndex) != null;
74065
+ }
74066
+ else {
74067
+ return true;
74109
74068
  }
74110
74069
  }
74070
+ return false;
74111
74071
  };
74112
- DTableDataTreeFilter.prototype.newFilteredSub = function (parent, nodes, filter, filtered, cursor) {
74113
- var result = false;
74114
- var accessor = this._parent.accessor;
74115
- var toChildren = accessor.toChildren;
74116
- var hasChildren = accessor.hasChildren;
74117
- for (var i = 0, imax = nodes.length; i < imax; ++i) {
74118
- var node = nodes[i];
74119
- var index = cursor[0];
74120
- cursor[0] += 1;
74121
- var isFiltered = this.isFiltered(node, index, filter);
74122
- var children = toChildren(node);
74123
- if (hasChildren(node, children)) {
74124
- if (parent.isOpened(node)) {
74125
- if (isFiltered) {
74126
- filtered.push(index);
74127
- result = true;
74128
- this.addAllToFiltered(parent, children, filtered, cursor);
74129
- }
74130
- else {
74131
- var position = filtered.length;
74132
- if (this.newFilteredSub(parent, children, filter, filtered, cursor)) {
74133
- filtered.splice(position, 0, index);
74134
- result = true;
74135
- }
74136
- }
74072
+ DTableCategoryCell.prototype.getResizableEdges = function () {
74073
+ var result = this._resizableEdges;
74074
+ if (result == null) {
74075
+ var columnIndex = this._columnIndex;
74076
+ if (this.checkIfEdgeResizable(columnIndex - 1)) {
74077
+ if (this.checkIfEdgeResizable(columnIndex)) {
74078
+ result = DTableCategoryCellEdge.BOTH;
74137
74079
  }
74138
- else if (isFiltered || this.hasFiltered(parent, children, filter)) {
74139
- filtered.push(index);
74140
- result = true;
74080
+ else {
74081
+ result = DTableCategoryCellEdge.LEFT;
74141
74082
  }
74142
74083
  }
74143
- else if (isFiltered) {
74144
- filtered.push(index);
74145
- result = true;
74084
+ else {
74085
+ if (this.checkIfEdgeResizable(columnIndex)) {
74086
+ result = DTableCategoryCellEdge.RIGHT;
74087
+ }
74088
+ else {
74089
+ result = DTableCategoryCellEdge.NONE;
74090
+ }
74146
74091
  }
74092
+ this._resizableEdges = result;
74147
74093
  }
74148
74094
  return result;
74149
74095
  };
74150
- DTableDataTreeFilter.prototype.newFiltered = function () {
74151
- var filter = this._filter;
74152
- if (filter != null) {
74153
- var filtered = [];
74154
- var parent_1 = this._parent;
74155
- var nodes = parent_1.nodes;
74156
- if (nodes) {
74157
- var cursor = [0];
74158
- this.newFilteredSub(parent_1, nodes, filter, filtered, cursor);
74096
+ DTableCategoryCell.prototype.onOver = function (e) {
74097
+ var _this = this;
74098
+ var _a;
74099
+ _super.prototype.onOver.call(this, e);
74100
+ if (this.getResizableEdges() !== DTableCategoryCellEdge.NONE) {
74101
+ var onHoveredBound = ((_a = this._onHoveredBound) !== null && _a !== void 0 ? _a : (this._onHoveredBound = function (event) {
74102
+ _this.onHovered(event);
74103
+ }));
74104
+ this.on(UtilPointerEvent.move, onHoveredBound);
74105
+ // Since the cursor is set by InteractionManager before this method is called,
74106
+ // the cursor need to be overriden.
74107
+ this.onHovered(e);
74108
+ var layer = DApplications.getLayer(this);
74109
+ if (layer != null) {
74110
+ layer.renderer.plugins.interaction.cursor = this.cursor;
74159
74111
  }
74160
- return filtered;
74161
74112
  }
74162
- return null;
74163
- };
74164
- DTableDataTreeFilter.prototype.get = function () {
74165
- return this._filter;
74166
74113
  };
74167
- DTableDataTreeFilter.prototype.set = function (filter) {
74168
- if (this._filter !== filter) {
74169
- this._filter = filter;
74114
+ DTableCategoryCell.prototype.onOut = function (e) {
74115
+ _super.prototype.onOut.call(this, e);
74116
+ var onHoveredBound = this._onHoveredBound;
74117
+ if (onHoveredBound != null) {
74118
+ this.state.remove(DTableState.HOVERED_ON_EDGE);
74119
+ this.off(UtilPointerEvent.move, onHoveredBound);
74170
74120
  }
74171
74121
  };
74172
- DTableDataTreeFilter.prototype.toDirty = function () {
74173
- this._id += 1;
74174
- };
74175
- DTableDataTreeFilter.prototype.update = function () {
74176
- if (this._id !== this._idUpdated) {
74177
- this._idUpdated = this._id;
74178
- if (this._isApplied) {
74179
- this._filtered = this.newFiltered();
74180
- this.emit("change", this);
74122
+ DTableCategoryCell.prototype.onHovered = function (e) {
74123
+ var width = this.width;
74124
+ var x = this.toClickPosition(e);
74125
+ var edgeSize = this._edgeSize;
74126
+ if (0 <= x && x <= edgeSize) {
74127
+ if (this.getResizableEdges() & DTableCategoryCellEdge.LEFT) {
74128
+ this.state.add(DTableState.HOVERED_ON_EDGE, DTableCategoryCellEdge.LEFT);
74181
74129
  }
74182
- else if (this._filtered != null) {
74183
- this._filtered = null;
74184
- this.emit("change", this);
74130
+ else {
74131
+ this.state.remove(DTableState.HOVERED_ON_EDGE);
74185
74132
  }
74186
74133
  }
74187
- };
74188
- Object.defineProperty(DTableDataTreeFilter.prototype, "indices", {
74189
- get: function () {
74190
- this.update();
74191
- return this._filtered;
74192
- },
74193
- enumerable: false,
74194
- configurable: true
74195
- });
74196
- DTableDataTreeFilter.prototype.map = function (sortedIndex) {
74197
- var result = sortedIndex;
74198
- var indices = this.indices;
74199
- if (indices) {
74200
- var index = indices.indexOf(result);
74201
- if (0 <= index) {
74202
- result = index;
74134
+ else if (width - edgeSize <= x && x <= width) {
74135
+ if (this.getResizableEdges() & DTableCategoryCellEdge.RIGHT) {
74136
+ this.state.add(DTableState.HOVERED_ON_EDGE, DTableCategoryCellEdge.RIGHT);
74203
74137
  }
74204
74138
  else {
74205
- return null;
74139
+ this.state.remove(DTableState.HOVERED_ON_EDGE);
74206
74140
  }
74207
74141
  }
74208
- return result;
74209
- };
74210
- DTableDataTreeFilter.prototype.unmap = function (index) {
74211
- var result = index;
74212
- var indices = this.indices;
74213
- if (indices) {
74214
- result = indices[result];
74142
+ else {
74143
+ this.state.remove(DTableState.HOVERED_ON_EDGE);
74215
74144
  }
74216
- return result;
74217
74145
  };
74218
- return DTableDataTreeFilter;
74219
- }(pixi_js.utils.EventEmitter));
74220
-
74221
- /*
74222
- * Copyright (C) 2021 Toshiba Corporation
74223
- * SPDX-License-Identifier: Apache-2.0
74224
- */
74225
- var toParent = function (node) {
74226
- return node.parent;
74227
- };
74228
- var toChildren$1 = function (node) {
74229
- return node.children;
74230
- };
74231
- var hasChildren = function (node, children) {
74232
- return children != null && 0 < children.length;
74233
- };
74234
- var DTableDataTreeItemAccessor = /** @class */ (function () {
74235
- function DTableDataTreeItemAccessor(options) {
74236
- if (options != null) {
74237
- this.toParent = options.toParent || toParent;
74238
- this.toChildren = options.toChildren || toChildren$1;
74239
- this.hasChildren = options.hasChildren || hasChildren;
74146
+ DTableCategoryCell.prototype.toClickPosition = function (e) {
74147
+ var _a;
74148
+ var checkWork = ((_a = this._checkWork) !== null && _a !== void 0 ? _a : (this._checkWork = new pixi_js.Point()));
74149
+ return e.data.getLocalPosition(this, checkWork).x;
74150
+ };
74151
+ DTableCategoryCell.prototype.onDownEdge = function (onDownPoint, columnIndex, interactionManager) {
74152
+ // Find the resizable cell
74153
+ var left = this.findLeftResizableCell(columnIndex);
74154
+ if (left == null) {
74155
+ // No resizable cell
74156
+ return;
74157
+ }
74158
+ var category = this._category;
74159
+ var leftColumn = left.column;
74160
+ var leftOldWidth = left.width;
74161
+ var leftOldWeight = left.weight;
74162
+ if (leftColumn.weight == null) {
74163
+ category.state.add(DTableState.RESIZING);
74164
+ var leftMinWidth_1 = leftColumn.minWidth;
74165
+ var onMove_1 = function (e) {
74166
+ leftColumn.width = Math.max(leftMinWidth_1, leftOldWidth + e.data.global.x - onDownPoint);
74167
+ };
74168
+ var onUp_1 = function (e) {
74169
+ category.state.remove(DTableState.RESIZING);
74170
+ interactionManager.off(UtilPointerEvent.move, onMove_1);
74171
+ interactionManager.off(UtilPointerEvent.up, onUp_1);
74172
+ interactionManager.off(UtilPointerEvent.upoutside, onUp_1);
74173
+ interactionManager.off(UtilPointerEvent.cancel, onUp_1);
74174
+ };
74175
+ interactionManager.on(UtilPointerEvent.move, onMove_1);
74176
+ interactionManager.on(UtilPointerEvent.up, onUp_1);
74177
+ interactionManager.on(UtilPointerEvent.upoutside, onUp_1);
74178
+ interactionManager.on(UtilPointerEvent.cancel, onUp_1);
74240
74179
  }
74241
74180
  else {
74242
- this.toParent = toParent;
74243
- this.toChildren = toChildren$1;
74244
- this.hasChildren = hasChildren;
74181
+ var right = this.findRightResizableCellOfWeight(left.columnIndex);
74182
+ if (right == null) {
74183
+ // No right resizable cell found
74184
+ return;
74185
+ }
74186
+ var rightColumn_1 = right.column;
74187
+ var rightOldWeight = right.weight;
74188
+ var rightOldWidth = right.width;
74189
+ var totalWidth_1 = leftOldWidth + rightOldWidth;
74190
+ var totalWeight_1 = leftOldWeight + rightOldWeight;
74191
+ var leftMinWeight_1 = leftColumn.minWeight;
74192
+ var rightMinWeight = rightColumn_1.minWeight;
74193
+ var leftMaxWeight_1 = totalWeight_1 - rightMinWeight;
74194
+ if (totalWidth_1 <= 0 || leftMaxWeight_1 <= leftMinWeight_1) {
74195
+ // The left and right resizable cells doesn't non-zero width
74196
+ return;
74197
+ }
74198
+ category.state.add(DTableState.RESIZING);
74199
+ var onMove_2 = function (e) {
74200
+ var leftNewWidth = Math.max(0, Math.min(totalWidth_1, leftOldWidth + e.data.global.x - onDownPoint));
74201
+ var leftNewWeight = Math.max(leftMinWeight_1, Math.min(leftMaxWeight_1, totalWeight_1 * (leftNewWidth / totalWidth_1)));
74202
+ leftColumn.weight = leftNewWeight;
74203
+ rightColumn_1.weight = totalWeight_1 - leftNewWeight;
74204
+ };
74205
+ var onUp_2 = function (e) {
74206
+ category.state.remove(DTableState.RESIZING);
74207
+ interactionManager.off(UtilPointerEvent.move, onMove_2);
74208
+ interactionManager.off(UtilPointerEvent.up, onUp_2);
74209
+ interactionManager.off(UtilPointerEvent.upoutside, onUp_2);
74210
+ interactionManager.off(UtilPointerEvent.cancel, onUp_2);
74211
+ };
74212
+ interactionManager.on(UtilPointerEvent.move, onMove_2);
74213
+ interactionManager.on(UtilPointerEvent.up, onUp_2);
74214
+ interactionManager.on(UtilPointerEvent.upoutside, onUp_2);
74215
+ interactionManager.on(UtilPointerEvent.cancel, onUp_2);
74245
74216
  }
74246
- }
74247
- return DTableDataTreeItemAccessor;
74248
- }());
74217
+ };
74218
+ DTableCategoryCell.prototype.getType = function () {
74219
+ return "DTableCategoryCell";
74220
+ };
74221
+ return DTableCategoryCell;
74222
+ }(DImage));
74249
74223
 
74250
74224
  /*
74251
- * Copyright (C) 2021 Toshiba Corporation
74225
+ * Copyright (C) 2019 Toshiba Corporation
74252
74226
  * SPDX-License-Identifier: Apache-2.0
74253
74227
  */
74254
- var COMPARATOR = function (a, b) {
74255
- return a[0] - b[0];
74256
- };
74257
- var DTableDataTreeSelectionImpl = /** @class */ (function (_super) {
74258
- __extends(DTableDataTreeSelectionImpl, _super);
74259
- function DTableDataTreeSelectionImpl(parent, options) {
74260
- var _a;
74228
+ var DTableCategoryColumnImpl = /** @class */ (function (_super) {
74229
+ __extends(DTableCategoryColumnImpl, _super);
74230
+ function DTableCategoryColumnImpl(index, column) {
74261
74231
  var _this = _super.call(this) || this;
74262
- _this._parent = parent;
74263
- _this._type = toEnum((_a = options === null || options === void 0 ? void 0 : options.type) !== null && _a !== void 0 ? _a : DTableDataSelectionType.NONE, DTableDataSelectionType);
74264
- _this._rows = new Set();
74265
- // Events
74266
- var on = options === null || options === void 0 ? void 0 : options.on;
74267
- if (on) {
74268
- for (var name_1 in on) {
74269
- var handler = on[name_1];
74270
- if (handler) {
74271
- _this.on(name_1, handler);
74232
+ // Label
74233
+ var category = column.category;
74234
+ if (category) {
74235
+ if (isString(category)) {
74236
+ if (index === 0) {
74237
+ _this.label = category;
74238
+ }
74239
+ }
74240
+ else {
74241
+ if (index < category.length) {
74242
+ _this.label = category[index];
74272
74243
  }
74273
74244
  }
74274
74245
  }
74246
+ _this._weight = column.weight;
74247
+ _this._width = column.width;
74248
+ _this._isLocked = false;
74249
+ _this.offset = 0.0;
74250
+ _this._columns = [column];
74251
+ _this._nresizable = column.resizable ? 1 : 0;
74252
+ var onResizeBound = function () {
74253
+ _this.onResize();
74254
+ };
74255
+ _this._onResizeBound = onResizeBound;
74256
+ column.on("resize", onResizeBound);
74275
74257
  return _this;
74276
74258
  }
74277
- Object.defineProperty(DTableDataTreeSelectionImpl.prototype, "parent", {
74278
- get: function () {
74279
- return this._parent;
74280
- },
74281
- enumerable: false,
74282
- configurable: true
74283
- });
74284
- DTableDataTreeSelectionImpl.prototype.onNodeChange = function (nodes) {
74285
- if (nodes != null) {
74286
- var accessor = this._parent.accessor;
74287
- var toChildren = accessor.toChildren;
74288
- var hasChildren = accessor.hasChildren;
74289
- var oldRows = this._rows;
74290
- var newRows = this.newRows(nodes, toChildren, hasChildren, oldRows, new Set());
74291
- if (oldRows.size !== newRows.size) {
74292
- this._rows = newRows;
74293
- this.onChange();
74294
- }
74259
+ DTableCategoryColumnImpl.prototype.onResize = function () {
74260
+ if (this._isLocked) {
74261
+ return;
74295
74262
  }
74296
- else {
74297
- var rows = this._rows;
74298
- if (0 < rows.size) {
74299
- rows.clear();
74300
- this.onChange();
74263
+ var columns = this._columns;
74264
+ if (this._weight != null) {
74265
+ var newWeight = 0;
74266
+ for (var i = 0, imax = columns.length; i < imax; ++i) {
74267
+ var weight = columns[i].weight;
74268
+ if (weight != null) {
74269
+ newWeight += weight;
74270
+ }
74271
+ }
74272
+ if (this._weight !== newWeight) {
74273
+ this._weight = newWeight;
74274
+ this.emit("resize", this);
74301
74275
  }
74302
74276
  }
74303
- };
74304
- DTableDataTreeSelectionImpl.prototype.newRows = function (nodes, toChildren, hasChildren, rows, result) {
74305
- for (var i = 0, imax = nodes.length; i < imax; ++i) {
74306
- var node = nodes[i];
74307
- if (rows.has(node)) {
74308
- result.add(node);
74277
+ else {
74278
+ var newWidth = 0;
74279
+ for (var i = 0, imax = columns.length; i < imax; ++i) {
74280
+ var width = columns[i].width;
74281
+ if (width != null) {
74282
+ newWidth += width;
74283
+ }
74309
74284
  }
74310
- var children = toChildren(node);
74311
- if (hasChildren(node, children)) {
74312
- this.newRows(children, toChildren, hasChildren, rows, result);
74285
+ if (this._width !== newWidth) {
74286
+ this._width = newWidth;
74287
+ this.emit("resize", this);
74313
74288
  }
74314
74289
  }
74315
- return result;
74316
74290
  };
74317
- Object.defineProperty(DTableDataTreeSelectionImpl.prototype, "indices", {
74291
+ Object.defineProperty(DTableCategoryColumnImpl.prototype, "resizable", {
74318
74292
  get: function () {
74319
- var rows = this._rows;
74320
- var result = [];
74321
- this._parent.each(function (row, index) {
74322
- if (rows.has(row)) {
74323
- result.push(index);
74324
- }
74325
- });
74326
- return result;
74293
+ return 0 < this._nresizable;
74327
74294
  },
74328
74295
  enumerable: false,
74329
74296
  configurable: true
74330
74297
  });
74331
- Object.defineProperty(DTableDataTreeSelectionImpl.prototype, "rows", {
74298
+ Object.defineProperty(DTableCategoryColumnImpl.prototype, "weight", {
74332
74299
  get: function () {
74333
- var result = [];
74334
- this._rows.forEach(function (row) {
74335
- result.push(row);
74336
- });
74337
- return result;
74300
+ return this._weight;
74301
+ },
74302
+ set: function (weight) {
74303
+ var oldWeight = this._weight;
74304
+ var nresizable = this._nresizable;
74305
+ if (0 < nresizable && oldWeight != null && oldWeight !== weight) {
74306
+ var columns = this._columns;
74307
+ var columnsLength = columns.length;
74308
+ var minWeight = this.minWeight;
74309
+ var newWeight = Math.max(minWeight, weight);
74310
+ if (this._weight !== newWeight) {
74311
+ this._isLocked = true;
74312
+ if (minWeight < oldWeight) {
74313
+ var columnWeightRatio = (newWeight - minWeight) / (oldWeight - minWeight);
74314
+ for (var i = 0; i < columnsLength; ++i) {
74315
+ var column = columns[i];
74316
+ var columnWeight = column.weight;
74317
+ if (column.resizable && columnWeight != null) {
74318
+ column.weight = columnWeight * columnWeightRatio;
74319
+ }
74320
+ }
74321
+ }
74322
+ else {
74323
+ var newColumnWeight = (newWeight - minWeight) / this._nresizable;
74324
+ for (var i = 0; i < columnsLength; ++i) {
74325
+ var column = columns[i];
74326
+ var columnWeight = column.weight;
74327
+ if (column.resizable && columnWeight != null) {
74328
+ column.weight = newColumnWeight;
74329
+ }
74330
+ }
74331
+ }
74332
+ this._isLocked = false;
74333
+ this.onResize();
74334
+ }
74335
+ }
74338
74336
  },
74339
74337
  enumerable: false,
74340
74338
  configurable: true
74341
74339
  });
74342
- Object.defineProperty(DTableDataTreeSelectionImpl.prototype, "type", {
74340
+ Object.defineProperty(DTableCategoryColumnImpl.prototype, "minWeight", {
74343
74341
  get: function () {
74344
- return this._type;
74342
+ var result = 0;
74343
+ var columns = this._columns;
74344
+ var columnsLength = columns.length;
74345
+ for (var i = 0; i < columnsLength; ++i) {
74346
+ var column = columns[i];
74347
+ var columnWeight = column.weight;
74348
+ if (!column.resizable && columnWeight != null) {
74349
+ result += columnWeight;
74350
+ }
74351
+ }
74352
+ return result;
74345
74353
  },
74346
74354
  enumerable: false,
74347
74355
  configurable: true
74348
74356
  });
74349
- DTableDataTreeSelectionImpl.prototype.getFirst = function () {
74350
- var rows = this._rows;
74351
- if (0 < rows.size) {
74352
- var result_1 = null;
74353
- rows.forEach(function (row) {
74354
- if (result_1 == null) {
74355
- result_1 = row;
74356
- }
74357
- });
74358
- return result_1;
74359
- }
74360
- return null;
74361
- };
74362
- DTableDataTreeSelectionImpl.prototype.getLast = function () {
74363
- var rows = this._rows;
74364
- if (0 < rows.size) {
74365
- var result_2 = null;
74366
- rows.forEach(function (row) {
74367
- result_2 = row;
74368
- });
74369
- return result_2;
74370
- }
74371
- return null;
74372
- };
74373
- DTableDataTreeSelectionImpl.prototype.toIndex = function (target) {
74374
- var result = null;
74375
- this._parent.each(function (row, index) {
74376
- if (target === row) {
74377
- result = index;
74378
- return false;
74379
- }
74380
- return true;
74381
- });
74382
- return result;
74383
- };
74384
- Object.defineProperty(DTableDataTreeSelectionImpl.prototype, "first", {
74357
+ Object.defineProperty(DTableCategoryColumnImpl.prototype, "width", {
74385
74358
  get: function () {
74386
- var row = this.getFirst();
74387
- if (row) {
74388
- return this.toIndex(row);
74359
+ return this._width;
74360
+ },
74361
+ set: function (width) {
74362
+ var oldWidth = this._width;
74363
+ var nresizable = this._nresizable;
74364
+ if (0 < nresizable && oldWidth != null && oldWidth !== width) {
74365
+ var columns = this._columns;
74366
+ var columnsLength = columns.length;
74367
+ var minWidth = this.minWidth;
74368
+ var newWidth = Math.max(minWidth, width);
74369
+ if (oldWidth !== newWidth) {
74370
+ this._isLocked = true;
74371
+ if (minWidth < oldWidth) {
74372
+ var columnWidthRatio = (newWidth - minWidth) / (oldWidth - minWidth);
74373
+ for (var i = 0; i < columnsLength; ++i) {
74374
+ var column = columns[i];
74375
+ var columnWidth = column.width;
74376
+ if (column.resizable && columnWidth != null) {
74377
+ column.width = columnWidth * columnWidthRatio;
74378
+ }
74379
+ }
74380
+ }
74381
+ else {
74382
+ var newColumnWidth = (newWidth - minWidth) / this._nresizable;
74383
+ for (var i = 0; i < columnsLength; ++i) {
74384
+ var column = columns[i];
74385
+ var columnWidth = column.width;
74386
+ if (column.resizable && columnWidth != null) {
74387
+ column.width = newColumnWidth;
74388
+ }
74389
+ }
74390
+ }
74391
+ this._isLocked = false;
74392
+ this.onResize();
74393
+ }
74389
74394
  }
74390
- return null;
74391
74395
  },
74392
74396
  enumerable: false,
74393
74397
  configurable: true
74394
74398
  });
74395
- Object.defineProperty(DTableDataTreeSelectionImpl.prototype, "last", {
74399
+ Object.defineProperty(DTableCategoryColumnImpl.prototype, "minWidth", {
74396
74400
  get: function () {
74397
- var row = this.getLast();
74398
- if (row) {
74399
- return this.toIndex(row);
74401
+ var result = 0;
74402
+ var columns = this._columns;
74403
+ var columnsLength = columns.length;
74404
+ for (var i = 0; i < columnsLength; ++i) {
74405
+ var column = columns[i];
74406
+ var columnWidth = column.width;
74407
+ if (!column.resizable && columnWidth != null) {
74408
+ result += columnWidth;
74409
+ }
74400
74410
  }
74401
- return null;
74411
+ return result;
74402
74412
  },
74403
74413
  enumerable: false,
74404
74414
  configurable: true
74405
74415
  });
74406
- DTableDataTreeSelectionImpl.prototype.onChange = function () {
74407
- this._parent.update();
74408
- this.emit("change", this);
74409
- };
74410
- DTableDataTreeSelectionImpl.prototype.toggle = function (rowIndex) {
74411
- var row = this._parent.get(rowIndex);
74412
- if (row) {
74413
- var rows = this._rows;
74414
- if (rows.has(row)) {
74415
- rows.delete(row);
74416
- }
74417
- else {
74418
- rows.add(row);
74416
+ DTableCategoryColumnImpl.prototype.add = function (column) {
74417
+ this._columns.push(column);
74418
+ if (this._weight != null) {
74419
+ var weight = column.weight;
74420
+ if (weight != null) {
74421
+ this._weight += weight;
74422
+ if (column.resizable) {
74423
+ this._nresizable += 1;
74424
+ }
74425
+ column.on("resize", this._onResizeBound);
74419
74426
  }
74420
- this.onChange();
74421
74427
  }
74422
- };
74423
- DTableDataTreeSelectionImpl.prototype.add = function (rowIndex) {
74424
- var row = this._parent.get(rowIndex);
74425
- if (row) {
74426
- var rows = this._rows;
74427
- if (!rows.has(row)) {
74428
- rows.add(row);
74429
- this.onChange();
74428
+ else if (this._width != null) {
74429
+ var width = column.width;
74430
+ if (width != null) {
74431
+ this._width += width;
74432
+ if (column.resizable) {
74433
+ this._nresizable += 1;
74434
+ }
74435
+ column.on("resize", this._onResizeBound);
74430
74436
  }
74431
74437
  }
74432
74438
  };
74433
- DTableDataTreeSelectionImpl.prototype.addTo = function (rowIndex) {
74434
- var lastRowIndex = this.last;
74439
+ return DTableCategoryColumnImpl;
74440
+ }(pixi_js.utils.EventEmitter));
74441
+
74442
+ /*
74443
+ * Copyright (C) 2019 Toshiba Corporation
74444
+ * SPDX-License-Identifier: Apache-2.0
74445
+ */
74446
+ var DTableCategory = /** @class */ (function (_super) {
74447
+ __extends(DTableCategory, _super);
74448
+ function DTableCategory(columns, frozen, offset, options) {
74449
+ var _this = _super.call(this, columns, frozen, options) || this;
74450
+ _this._columns = columns;
74451
+ _this._frozen = frozen;
74452
+ _this._offset = offset;
74453
+ _this.transform.position.y = offset;
74454
+ _this.initCells();
74455
+ for (var i = 0, imax = columns.length; i < imax; ++i) {
74456
+ var column = columns[i];
74457
+ column.on("resize", _this.newOnColumnResize(i, column));
74458
+ }
74459
+ return _this;
74460
+ }
74461
+ DTableCategory.prototype.newOnColumnResize = function (index, column) {
74462
+ var _this = this;
74463
+ return function () {
74464
+ _this.onColumnResize(index, column);
74465
+ };
74466
+ };
74467
+ DTableCategory.prototype.onColumnResize = function (index, column) {
74468
+ var columnWeight = column.weight;
74469
+ if (columnWeight != null) {
74470
+ this.onColumnResizeWeight(this, index, columnWeight);
74471
+ }
74472
+ else {
74473
+ var columnWidth = column.width;
74474
+ if (columnWidth != null) {
74475
+ this.onColumnResizeWidth(this, index, columnWidth);
74476
+ }
74477
+ }
74478
+ };
74479
+ DTableCategory.prototype.onColumnResizeWeight = function (row, index, columnWeight) {
74480
+ var cells = row.children;
74481
+ var cellsLength = cells.length;
74482
+ var cellsIndex = cellsLength - index - 1;
74483
+ if (0 <= cellsIndex && cellsIndex < cellsLength) {
74484
+ cells[cellsIndex].weight = columnWeight;
74485
+ }
74486
+ };
74487
+ DTableCategory.prototype.onColumnResizeWidth = function (row, index, columnWidth) {
74488
+ var cells = row.children;
74489
+ var cellsLength = cells.length;
74490
+ var cellsIndex = cellsLength - index - 1;
74491
+ if (0 <= cellsIndex && cellsIndex < cellsLength) {
74492
+ cells[cellsIndex].width = columnWidth;
74493
+ }
74494
+ };
74495
+ DTableCategory.prototype.onParentMove = function (newX, newY, oldX, oldY) {
74496
+ _super.prototype.onParentMove.call(this, newX, newY, oldX, oldY);
74497
+ this.transform.position.y = -newY + this._offset;
74498
+ this.updateFrozenCellPosition(newX);
74499
+ };
74500
+ DTableCategory.prototype.getContentPositionX = function () {
74501
+ var content = this.parent;
74502
+ if (content) {
74503
+ return content.position.x;
74504
+ }
74505
+ return 0;
74506
+ };
74507
+ DTableCategory.prototype.newCell = function (columnIndex, column, columns, options) {
74508
+ return new DTableCategoryCell(this, columnIndex, column, this.toCellOptions(columnIndex, column, options));
74509
+ };
74510
+ DTableCategory.prototype.toCellOptions = function (columnIndex, column, options) {
74511
+ var result = options === null || options === void 0 ? void 0 : options.cell;
74512
+ if (result) {
74513
+ // Weight
74514
+ result.weight = column.weight;
74515
+ // Width
74516
+ result.width = column.width;
74517
+ // Label
74518
+ var text = result.text || {};
74519
+ result.text = text;
74520
+ text.value = text.value || column.label;
74521
+ // Done
74522
+ return result;
74523
+ }
74524
+ else {
74525
+ return {
74526
+ weight: column.weight,
74527
+ width: column.width,
74528
+ text: {
74529
+ value: column.label
74530
+ }
74531
+ };
74532
+ }
74533
+ };
74534
+ DTableCategory.prototype.getType = function () {
74535
+ return "DTableCategory";
74536
+ };
74537
+ return DTableCategory;
74538
+ }(DTableRow));
74539
+
74540
+ var DTableCategoryContainerImpl = /** @class */ (function () {
74541
+ function DTableCategoryContainerImpl(columns, frozen, options) {
74542
+ var count = this.toCount(columns);
74543
+ var items = [];
74544
+ var offset = 0;
74545
+ for (var i = count - 1; 0 <= i; --i) {
74546
+ var item = new DTableCategory(this.toColumns(i, columns, frozen), frozen, offset, options);
74547
+ items.push(item);
74548
+ offset += item.height;
74549
+ }
74550
+ this.items = items;
74551
+ }
74552
+ DTableCategoryContainerImpl.prototype.toCount = function (columns) {
74553
+ var result = 0;
74554
+ for (var i = 0, imax = columns.length; i < imax; ++i) {
74555
+ var category = columns[i].category;
74556
+ if (category != null) {
74557
+ var count = isString(category) ? 1 : category.length;
74558
+ result = Math.max(result, count);
74559
+ }
74560
+ }
74561
+ return result;
74562
+ };
74563
+ DTableCategoryContainerImpl.prototype.isCategory = function (index, a, b) {
74564
+ if (a != null) {
74565
+ if (b != null) {
74566
+ if (isString(a)) {
74567
+ if (isString(b)) {
74568
+ if (0 < index) {
74569
+ return true;
74570
+ }
74571
+ else {
74572
+ return a === b;
74573
+ }
74574
+ }
74575
+ else {
74576
+ if (0 < index) {
74577
+ return b.length <= index;
74578
+ }
74579
+ else {
74580
+ return b.length === 1 && a === b[0];
74581
+ }
74582
+ }
74583
+ }
74584
+ else {
74585
+ if (isString(b)) {
74586
+ if (0 < index) {
74587
+ return a.length <= index;
74588
+ }
74589
+ else {
74590
+ return a.length === 1 && a[0] === b;
74591
+ }
74592
+ }
74593
+ else {
74594
+ if (a.length <= index && b.length <= index) {
74595
+ return true;
74596
+ }
74597
+ else if (b.length === a.length) {
74598
+ for (var i = index, imax = a.length; i < imax; ++i) {
74599
+ if (a[i] !== b[i]) {
74600
+ return false;
74601
+ }
74602
+ }
74603
+ return true;
74604
+ }
74605
+ return false;
74606
+ }
74607
+ }
74608
+ }
74609
+ else {
74610
+ if (isString(a)) {
74611
+ if (0 < index) {
74612
+ return true;
74613
+ }
74614
+ else {
74615
+ return false;
74616
+ }
74617
+ }
74618
+ else {
74619
+ if (a.length <= index) {
74620
+ return true;
74621
+ }
74622
+ else {
74623
+ return false;
74624
+ }
74625
+ }
74626
+ }
74627
+ }
74628
+ else {
74629
+ if (b != null) {
74630
+ if (isString(b)) {
74631
+ if (0 < index) {
74632
+ return true;
74633
+ }
74634
+ else {
74635
+ return false;
74636
+ }
74637
+ }
74638
+ else {
74639
+ if (b.length <= index) {
74640
+ return true;
74641
+ }
74642
+ else {
74643
+ return false;
74644
+ }
74645
+ }
74646
+ }
74647
+ else {
74648
+ return true;
74649
+ }
74650
+ }
74651
+ };
74652
+ DTableCategoryContainerImpl.prototype.toColumns = function (index, columns, frozen) {
74653
+ var result = [];
74654
+ var tcolumn = null;
74655
+ var ccolumn = null;
74656
+ for (var i = 0, imax = columns.length; i < imax; ++i) {
74657
+ var column = columns[i];
74658
+ if (i !== frozen &&
74659
+ ccolumn &&
74660
+ tcolumn &&
74661
+ this.isCategory(index, tcolumn.category, column.category)) {
74662
+ if (ccolumn.weight != null && column.weight != null) {
74663
+ ccolumn.add(column);
74664
+ }
74665
+ else if (ccolumn.width != null && column.width != null) {
74666
+ ccolumn.add(column);
74667
+ }
74668
+ else {
74669
+ tcolumn = column;
74670
+ ccolumn = new DTableCategoryColumnImpl(index, column);
74671
+ result.push(ccolumn);
74672
+ }
74673
+ }
74674
+ else {
74675
+ tcolumn = column;
74676
+ ccolumn = new DTableCategoryColumnImpl(index, column);
74677
+ result.push(ccolumn);
74678
+ }
74679
+ }
74680
+ return result;
74681
+ };
74682
+ return DTableCategoryContainerImpl;
74683
+ }());
74684
+
74685
+ var defaultGetter = function (row, columnIndex) {
74686
+ return row[columnIndex];
74687
+ };
74688
+ var defaultSetter = function (row, columnIndex, cell) {
74689
+ row[columnIndex] = cell;
74690
+ };
74691
+ var defaultGetterEmpty = function () { return ""; };
74692
+ var defaultSetterEmpty = function () {
74693
+ // DO NOTHING
74694
+ };
74695
+ var toPathGetter = function (path, def) {
74696
+ if (path.length <= 1) {
74697
+ var key_1 = path[0];
74698
+ if (def === undefined) {
74699
+ return function (row) {
74700
+ return row[key_1];
74701
+ };
74702
+ }
74703
+ else {
74704
+ return function (row) {
74705
+ return Object.prototype.hasOwnProperty.call(row, key_1) ? row[key_1] : def;
74706
+ };
74707
+ }
74708
+ }
74709
+ else {
74710
+ if (def === undefined) {
74711
+ return function (row) {
74712
+ for (var i = 0, imax = path.length - 1; i < imax; ++i) {
74713
+ row = row[path[i]];
74714
+ }
74715
+ return row[path[path.length - 1]];
74716
+ };
74717
+ }
74718
+ else {
74719
+ return function (row) {
74720
+ for (var i = 0, imax = path.length - 1; i < imax; ++i) {
74721
+ row = row[path[i]];
74722
+ }
74723
+ var key = path[path.length - 1];
74724
+ return Object.prototype.hasOwnProperty.call(row, key) ? row[key] : def;
74725
+ };
74726
+ }
74727
+ }
74728
+ };
74729
+ var toPathSetter = function (path) {
74730
+ if (path.length <= 1) {
74731
+ var key_2 = path[0];
74732
+ return function (row, columnIndex, cell) {
74733
+ row[key_2] = cell;
74734
+ };
74735
+ }
74736
+ else {
74737
+ return function (row, columnIndex, cell) {
74738
+ for (var i = 0, imax = path.length - 1; i < imax; ++i) {
74739
+ row = row[path[i]] || {};
74740
+ }
74741
+ row[path[path.length - 1]] = cell;
74742
+ };
74743
+ }
74744
+ };
74745
+ var toAlign = function (options, type) {
74746
+ var align = options.align;
74747
+ if (align != null) {
74748
+ if (isString(align)) {
74749
+ return DAlignHorizontal[align];
74750
+ }
74751
+ else {
74752
+ return align;
74753
+ }
74754
+ }
74755
+ switch (type) {
74756
+ case DTableColumnType.TEXT:
74757
+ case DTableColumnType.TEXT_AREA:
74758
+ return DAlignHorizontal.LEFT;
74759
+ case DTableColumnType.REAL:
74760
+ case DTableColumnType.INTEGER:
74761
+ return DAlignHorizontal.RIGHT;
74762
+ case DTableColumnType.BUTTON:
74763
+ case DTableColumnType.INDEX:
74764
+ case DTableColumnType.SELECT:
74765
+ case DTableColumnType.ACTION:
74766
+ case DTableColumnType.LINK:
74767
+ case DTableColumnType.CHECK:
74768
+ case DTableColumnType.CHECK_SINGLE:
74769
+ case DTableColumnType.COLOR:
74770
+ return DAlignHorizontal.CENTER;
74771
+ default:
74772
+ return DAlignHorizontal.LEFT;
74773
+ }
74774
+ };
74775
+ var toDataChecker = function (path) {
74776
+ if (path != null) {
74777
+ var pathLength_1 = path.length;
74778
+ if (pathLength_1 <= 1) {
74779
+ var key_3 = path[0];
74780
+ return function (row) {
74781
+ return Object.prototype.hasOwnProperty.call(row, key_3);
74782
+ };
74783
+ }
74784
+ else {
74785
+ return function (row) {
74786
+ for (var i = 0; i < pathLength_1; ++i) {
74787
+ var part = path[i];
74788
+ if (part in row) {
74789
+ row = row[part];
74790
+ }
74791
+ else {
74792
+ return false;
74793
+ }
74794
+ }
74795
+ return true;
74796
+ };
74797
+ }
74798
+ }
74799
+ return function (row, columnIndex) {
74800
+ return columnIndex < row.length;
74801
+ };
74802
+ };
74803
+ var toEditingEnable = function (enable, path) {
74804
+ if (isString(enable)) {
74805
+ return toDataChecker(path);
74806
+ }
74807
+ else if (enable != null) {
74808
+ return enable;
74809
+ }
74810
+ else {
74811
+ return false;
74812
+ }
74813
+ };
74814
+ var toEditing = function (options, path) {
74815
+ var _a;
74816
+ var editing = options.editing;
74817
+ var editable = options.editable;
74818
+ if (editing) {
74819
+ return {
74820
+ enable: toEditingEnable((_a = editing.enable) !== null && _a !== void 0 ? _a : editable, path),
74821
+ formatter: editing.formatter,
74822
+ unformatter: editing.unformatter,
74823
+ validator: editing.validator
74824
+ };
74825
+ }
74826
+ return {
74827
+ enable: toEditingEnable(editable, path)
74828
+ };
74829
+ };
74830
+ var toComparator = function (getter, index) {
74831
+ return function (rowA, rowB) {
74832
+ var valueA = getter(rowA, index);
74833
+ var valueB = getter(rowB, index);
74834
+ return valueA < valueB ? -1 : valueB < valueA ? +1 : 0;
74835
+ };
74836
+ };
74837
+ var toSorting = function (getter, index, options) {
74838
+ var sorting = options.sorting;
74839
+ var sortable = options.sortable;
74840
+ if (sorting) {
74841
+ if (sorting.enable || sortable) {
74842
+ return {
74843
+ enable: true,
74844
+ comparator: sorting.comparator || toComparator(getter, index)
74845
+ };
74846
+ }
74847
+ return {
74848
+ enable: false
74849
+ };
74850
+ }
74851
+ if (sortable) {
74852
+ return {
74853
+ enable: true,
74854
+ comparator: toComparator(getter, index)
74855
+ };
74856
+ }
74857
+ return {
74858
+ enable: false
74859
+ };
74860
+ };
74861
+ var toMenu = function (options) {
74862
+ if (options == null) {
74863
+ return undefined;
74864
+ }
74865
+ else if (options instanceof DMenu) {
74866
+ return options;
74867
+ }
74868
+ else {
74869
+ return new DMenu(options);
74870
+ }
74871
+ };
74872
+ var toDialog = function (options) {
74873
+ if (options == null) {
74874
+ return undefined;
74875
+ }
74876
+ else if ("open" in options) {
74877
+ return options;
74878
+ }
74879
+ else {
74880
+ return new DDialogSelect(options);
74881
+ }
74882
+ };
74883
+ var defaultSelectingGetter = function (dialog) {
74884
+ return dialog.value;
74885
+ };
74886
+ var defaultSelectingSetter = function () {
74887
+ // DO NOTHING
74888
+ };
74889
+ var toSelecting = function (options) {
74890
+ if (options) {
74891
+ return {
74892
+ getter: options.getter || defaultSelectingGetter,
74893
+ setter: options.setter || defaultSelectingSetter,
74894
+ menu: toMenu(options.menu),
74895
+ multiple: toMenu(options.multiple),
74896
+ dialog: toDialog(options.dialog),
74897
+ promise: options.promise
74898
+ };
74899
+ }
74900
+ return {
74901
+ getter: defaultSelectingGetter,
74902
+ setter: defaultSelectingSetter
74903
+ };
74904
+ };
74905
+ var toGetter = function (options, type, parts) {
74906
+ var getter = options.getter;
74907
+ if (getter) {
74908
+ return getter;
74909
+ }
74910
+ switch (type) {
74911
+ case DTableColumnType.ACTION:
74912
+ case DTableColumnType.LINK:
74913
+ return defaultGetterEmpty;
74914
+ default:
74915
+ if (parts == null) {
74916
+ return defaultGetter;
74917
+ }
74918
+ else {
74919
+ return toPathGetter(parts, options.default);
74920
+ }
74921
+ }
74922
+ };
74923
+ var toSetter = function (options, type, path) {
74924
+ var setter = options.setter;
74925
+ if (setter) {
74926
+ return setter;
74927
+ }
74928
+ switch (type) {
74929
+ case DTableColumnType.BUTTON:
74930
+ case DTableColumnType.ACTION:
74931
+ case DTableColumnType.LINK:
74932
+ return defaultSetterEmpty;
74933
+ default:
74934
+ if (path == null) {
74935
+ return defaultSetter;
74936
+ }
74937
+ else {
74938
+ return toPathSetter(path);
74939
+ }
74940
+ }
74941
+ };
74942
+ var toState = function (options) {
74943
+ var state = options.state;
74944
+ if (state != null) {
74945
+ if (isString(state) || isArray(state)) {
74946
+ return {
74947
+ initial: state,
74948
+ modifier: undefined
74949
+ };
74950
+ }
74951
+ else {
74952
+ return {
74953
+ initial: undefined,
74954
+ modifier: state
74955
+ };
74956
+ }
74957
+ }
74958
+ return {
74959
+ initial: undefined,
74960
+ modifier: undefined
74961
+ };
74962
+ };
74963
+ var toPath = function (options) {
74964
+ return options.path != null ? options.path.split(".") : null;
74965
+ };
74966
+ var toRenderable = function (options, path) {
74967
+ var renderable = options.renderable;
74968
+ if (isString(renderable)) {
74969
+ return toDataChecker(path);
74970
+ }
74971
+ else if (renderable != null) {
74972
+ return renderable;
74973
+ }
74974
+ return true;
74975
+ };
74976
+ var DTableColumnImpl = /** @class */ (function (_super) {
74977
+ __extends(DTableColumnImpl, _super);
74978
+ function DTableColumnImpl(index, options) {
74979
+ var _a, _b, _c;
74980
+ var _this = _super.call(this) || this;
74981
+ var weight = options.weight;
74982
+ var width = options.width;
74983
+ if (weight != null) {
74984
+ if (width != null) {
74985
+ width = undefined;
74986
+ }
74987
+ }
74988
+ else if (width == null) {
74989
+ weight = 1;
74990
+ }
74991
+ var type = toEnum((_a = options.type) !== null && _a !== void 0 ? _a : DTableColumnType.TEXT, DTableColumnType);
74992
+ var align = toAlign(options, type);
74993
+ var label = options.label || "";
74994
+ var path = toPath(options);
74995
+ var getter = toGetter(options, type, path);
74996
+ var setter = toSetter(options, type, path);
74997
+ _this._weight = weight;
74998
+ _this._width = width;
74999
+ _this.resizable = (_b = options.resizable) !== null && _b !== void 0 ? _b : false;
75000
+ _this.type = type;
75001
+ _this.label = label;
75002
+ _this.getter = getter;
75003
+ _this.setter = setter;
75004
+ _this.formatter = options.formatter;
75005
+ _this.renderable = toRenderable(options, path);
75006
+ _this.align = align;
75007
+ _this.state = toState(options);
75008
+ _this.editing = toEditing(options, path);
75009
+ _this.sorting = toSorting(getter, index, options);
75010
+ _this.header = options.header;
75011
+ _this.body = options.body;
75012
+ _this.selecting = toSelecting(options.selecting);
75013
+ _this.category = options.category;
75014
+ _this.frozen = options.frozen;
75015
+ _this.offset = 0.0;
75016
+ _this.link = options.link;
75017
+ _this.update = toEnum((_c = options.update) !== null && _c !== void 0 ? _c : DTableColumnUpdate.CELL, DTableColumnUpdate);
75018
+ return _this;
75019
+ }
75020
+ Object.defineProperty(DTableColumnImpl.prototype, "weight", {
75021
+ get: function () {
75022
+ return this._weight;
75023
+ },
75024
+ set: function (weight) {
75025
+ if (this._weight != null && this._weight !== weight) {
75026
+ this._weight = weight;
75027
+ this.emit("resize", this);
75028
+ }
75029
+ },
75030
+ enumerable: false,
75031
+ configurable: true
75032
+ });
75033
+ Object.defineProperty(DTableColumnImpl.prototype, "width", {
75034
+ get: function () {
75035
+ return this._width;
75036
+ },
75037
+ set: function (width) {
75038
+ if (this._width != null && this._width !== width) {
75039
+ this._width = width;
75040
+ this.emit("resize", this);
75041
+ }
75042
+ },
75043
+ enumerable: false,
75044
+ configurable: true
75045
+ });
75046
+ return DTableColumnImpl;
75047
+ }(pixi_js.utils.EventEmitter));
75048
+
75049
+ var DTableColumnContainerImpl = /** @class */ (function (_super) {
75050
+ __extends(DTableColumnContainerImpl, _super);
75051
+ function DTableColumnContainerImpl(parent, options) {
75052
+ var _this = _super.call(this) || this;
75053
+ _this.parent = parent;
75054
+ var columns = [];
75055
+ if (options != null) {
75056
+ for (var i = 0, imax = options.length; i < imax; ++i) {
75057
+ var column = new DTableColumnImpl(i, options[i]);
75058
+ columns.push(column);
75059
+ column.on("resize", _this.newOnColumnResize(i, column));
75060
+ }
75061
+ }
75062
+ _this.items = columns;
75063
+ var frozen = 0;
75064
+ for (var i = columns.length - 1; 0 <= i; --i) {
75065
+ if (columns[i].frozen === true) {
75066
+ frozen = i + 1;
75067
+ break;
75068
+ }
75069
+ }
75070
+ _this.frozen = frozen;
75071
+ return _this;
75072
+ }
75073
+ DTableColumnContainerImpl.prototype.newOnColumnResize = function (index, column) {
75074
+ var _this = this;
75075
+ return function () {
75076
+ _this.onColumnResize(index, column);
75077
+ };
75078
+ };
75079
+ DTableColumnContainerImpl.prototype.onColumnResize = function (index, column) {
75080
+ this.onColumnResizeHeader(index, column);
75081
+ this.onColumnResizeBody(index, column);
75082
+ this.emit("resize", index, column, this);
75083
+ };
75084
+ DTableColumnContainerImpl.prototype.onColumnResizeHeader = function (index, column) {
75085
+ var header = this.parent.header;
75086
+ if (header != null) {
75087
+ var columnWeight = column.weight;
75088
+ if (columnWeight != null) {
75089
+ this.onColumnResizeWeight(header, index, columnWeight);
75090
+ }
75091
+ else {
75092
+ var columnWidth = column.width;
75093
+ if (columnWidth != null) {
75094
+ this.onColumnResizeWidth(header, index, columnWidth);
75095
+ }
75096
+ }
75097
+ }
75098
+ };
75099
+ DTableColumnContainerImpl.prototype.onColumnResizeBody = function (index, column) {
75100
+ var rows = this.parent.body.children;
75101
+ var columnWeight = column.weight;
75102
+ if (columnWeight != null) {
75103
+ for (var i = 0, imax = rows.length; i < imax; ++i) {
75104
+ this.onColumnResizeWeight(rows[i], index, columnWeight);
75105
+ }
75106
+ }
75107
+ else {
75108
+ var columnWidth = column.width;
75109
+ if (columnWidth != null) {
75110
+ for (var i = 0, imax = rows.length; i < imax; ++i) {
75111
+ this.onColumnResizeWidth(rows[i], index, columnWidth);
75112
+ }
75113
+ }
75114
+ }
75115
+ };
75116
+ DTableColumnContainerImpl.prototype.onColumnResizeWeight = function (row, index, columnWeight) {
75117
+ var cells = row.children;
75118
+ var cellsLength = cells.length;
75119
+ var cellsIndex = cellsLength - index - 1;
75120
+ if (0 <= cellsIndex && cellsIndex < cellsLength) {
75121
+ cells[cellsIndex].weight = columnWeight;
75122
+ }
75123
+ };
75124
+ DTableColumnContainerImpl.prototype.onColumnResizeWidth = function (row, index, columnWidth) {
75125
+ var cells = row.children;
75126
+ var cellsLength = cells.length;
75127
+ var cellsIndex = cellsLength - index - 1;
75128
+ if (0 <= cellsIndex && cellsIndex < cellsLength) {
75129
+ cells[cellsIndex].width = columnWidth;
75130
+ }
75131
+ };
75132
+ Object.defineProperty(DTableColumnContainerImpl.prototype, "width", {
75133
+ get: function () {
75134
+ var result = 0;
75135
+ var items = this.items;
75136
+ var length = items.length;
75137
+ for (var i = 0; i < length; ++i) {
75138
+ var item = items[i];
75139
+ var itemWidth = item.width;
75140
+ if (itemWidth != null) {
75141
+ result += itemWidth;
75142
+ }
75143
+ }
75144
+ return result;
75145
+ },
75146
+ enumerable: false,
75147
+ configurable: true
75148
+ });
75149
+ DTableColumnContainerImpl.prototype.get = function (index) {
75150
+ var columns = this.items;
75151
+ if (0 <= index && index < columns.length) {
75152
+ return columns[index];
75153
+ }
75154
+ return null;
75155
+ };
75156
+ DTableColumnContainerImpl.prototype.each = function (iteratee) {
75157
+ var columns = this.items;
75158
+ for (var i = 0, imax = columns.length; i < imax; ++i) {
75159
+ if (iteratee(columns[i], i) === false) {
75160
+ break;
75161
+ }
75162
+ }
75163
+ return this;
75164
+ };
75165
+ DTableColumnContainerImpl.prototype.size = function () {
75166
+ return this.items.length;
75167
+ };
75168
+ return DTableColumnContainerImpl;
75169
+ }(pixi_js.utils.EventEmitter));
75170
+
75171
+ /*
75172
+ * Copyright (C) 2019 Toshiba Corporation
75173
+ * SPDX-License-Identifier: Apache-2.0
75174
+ */
75175
+ var DTableDataTreeFilter = /** @class */ (function (_super) {
75176
+ __extends(DTableDataTreeFilter, _super);
75177
+ function DTableDataTreeFilter(parent) {
75178
+ var _this = _super.call(this) || this;
75179
+ _this._id = 0;
75180
+ _this._idUpdated = -1;
75181
+ _this._isApplied = false;
75182
+ _this._parent = parent;
75183
+ _this._filter = null;
75184
+ _this._filtered = null;
75185
+ return _this;
75186
+ }
75187
+ Object.defineProperty(DTableDataTreeFilter.prototype, "id", {
75188
+ get: function () {
75189
+ return this._id;
75190
+ },
75191
+ enumerable: false,
75192
+ configurable: true
75193
+ });
75194
+ DTableDataTreeFilter.prototype.apply = function () {
75195
+ this._isApplied = true;
75196
+ this._id += 1;
75197
+ this._parent.update();
75198
+ };
75199
+ DTableDataTreeFilter.prototype.unapply = function () {
75200
+ if (this._isApplied) {
75201
+ this._isApplied = false;
75202
+ this._id += 1;
75203
+ this._parent.update();
75204
+ }
75205
+ };
75206
+ DTableDataTreeFilter.prototype.isApplied = function () {
75207
+ return this._isApplied;
75208
+ };
75209
+ DTableDataTreeFilter.prototype.isFiltered = function (node, index, filter) {
75210
+ if (isFunction(filter)) {
75211
+ return filter(node, index);
75212
+ }
75213
+ else {
75214
+ return filter.test(node, index);
75215
+ }
75216
+ };
75217
+ DTableDataTreeFilter.prototype.hasFiltered = function (parent, nodes, filter) {
75218
+ var accessor = this._parent.accessor;
75219
+ var toChildren = accessor.toChildren;
75220
+ var hasChildren = accessor.hasChildren;
75221
+ for (var i = 0, imax = nodes.length; i < imax; ++i) {
75222
+ var node = nodes[i];
75223
+ if (this.isFiltered(node, -1, filter)) {
75224
+ return true;
75225
+ }
75226
+ var children = toChildren(node);
75227
+ if (hasChildren(node, children) && this.hasFiltered(parent, children, filter)) {
75228
+ return true;
75229
+ }
75230
+ }
75231
+ return false;
75232
+ };
75233
+ DTableDataTreeFilter.prototype.addAllToFiltered = function (parent, nodes, filtered, cursor) {
75234
+ var accessor = this._parent.accessor;
75235
+ var toChildren = accessor.toChildren;
75236
+ var hasChildren = accessor.hasChildren;
75237
+ for (var i = 0, imax = nodes.length; i < imax; ++i) {
75238
+ var node = nodes[i];
75239
+ filtered.push(cursor[0]);
75240
+ cursor[0] += 1;
75241
+ var children = toChildren(node);
75242
+ if (hasChildren(node, children) && parent.isOpened(node)) {
75243
+ this.addAllToFiltered(parent, children, filtered, cursor);
75244
+ }
75245
+ }
75246
+ };
75247
+ DTableDataTreeFilter.prototype.newFilteredSub = function (parent, nodes, filter, filtered, cursor) {
75248
+ var result = false;
75249
+ var accessor = this._parent.accessor;
75250
+ var toChildren = accessor.toChildren;
75251
+ var hasChildren = accessor.hasChildren;
75252
+ for (var i = 0, imax = nodes.length; i < imax; ++i) {
75253
+ var node = nodes[i];
75254
+ var index = cursor[0];
75255
+ cursor[0] += 1;
75256
+ var isFiltered = this.isFiltered(node, index, filter);
75257
+ var children = toChildren(node);
75258
+ if (hasChildren(node, children)) {
75259
+ if (parent.isOpened(node)) {
75260
+ if (isFiltered) {
75261
+ filtered.push(index);
75262
+ result = true;
75263
+ this.addAllToFiltered(parent, children, filtered, cursor);
75264
+ }
75265
+ else {
75266
+ var position = filtered.length;
75267
+ if (this.newFilteredSub(parent, children, filter, filtered, cursor)) {
75268
+ filtered.splice(position, 0, index);
75269
+ result = true;
75270
+ }
75271
+ }
75272
+ }
75273
+ else if (isFiltered || this.hasFiltered(parent, children, filter)) {
75274
+ filtered.push(index);
75275
+ result = true;
75276
+ }
75277
+ }
75278
+ else if (isFiltered) {
75279
+ filtered.push(index);
75280
+ result = true;
75281
+ }
75282
+ }
75283
+ return result;
75284
+ };
75285
+ DTableDataTreeFilter.prototype.newFiltered = function () {
75286
+ var filter = this._filter;
75287
+ if (filter != null) {
75288
+ var filtered = [];
75289
+ var parent_1 = this._parent;
75290
+ var nodes = parent_1.nodes;
75291
+ if (nodes) {
75292
+ var cursor = [0];
75293
+ this.newFilteredSub(parent_1, nodes, filter, filtered, cursor);
75294
+ }
75295
+ return filtered;
75296
+ }
75297
+ return null;
75298
+ };
75299
+ DTableDataTreeFilter.prototype.get = function () {
75300
+ return this._filter;
75301
+ };
75302
+ DTableDataTreeFilter.prototype.set = function (filter) {
75303
+ if (this._filter !== filter) {
75304
+ this._filter = filter;
75305
+ }
75306
+ };
75307
+ DTableDataTreeFilter.prototype.toDirty = function () {
75308
+ this._id += 1;
75309
+ };
75310
+ DTableDataTreeFilter.prototype.update = function () {
75311
+ if (this._id !== this._idUpdated) {
75312
+ this._idUpdated = this._id;
75313
+ if (this._isApplied) {
75314
+ this._filtered = this.newFiltered();
75315
+ this.emit("change", this);
75316
+ }
75317
+ else if (this._filtered != null) {
75318
+ this._filtered = null;
75319
+ this.emit("change", this);
75320
+ }
75321
+ }
75322
+ };
75323
+ Object.defineProperty(DTableDataTreeFilter.prototype, "indices", {
75324
+ get: function () {
75325
+ this.update();
75326
+ return this._filtered;
75327
+ },
75328
+ enumerable: false,
75329
+ configurable: true
75330
+ });
75331
+ DTableDataTreeFilter.prototype.map = function (sortedIndex) {
75332
+ var result = sortedIndex;
75333
+ var indices = this.indices;
75334
+ if (indices) {
75335
+ var index = indices.indexOf(result);
75336
+ if (0 <= index) {
75337
+ result = index;
75338
+ }
75339
+ else {
75340
+ return null;
75341
+ }
75342
+ }
75343
+ return result;
75344
+ };
75345
+ DTableDataTreeFilter.prototype.unmap = function (index) {
75346
+ var result = index;
75347
+ var indices = this.indices;
75348
+ if (indices) {
75349
+ result = indices[result];
75350
+ }
75351
+ return result;
75352
+ };
75353
+ return DTableDataTreeFilter;
75354
+ }(pixi_js.utils.EventEmitter));
75355
+
75356
+ /*
75357
+ * Copyright (C) 2021 Toshiba Corporation
75358
+ * SPDX-License-Identifier: Apache-2.0
75359
+ */
75360
+ var toParent = function (node) {
75361
+ return node.parent;
75362
+ };
75363
+ var toChildren$1 = function (node) {
75364
+ return node.children;
75365
+ };
75366
+ var hasChildren = function (node, children) {
75367
+ return children != null && 0 < children.length;
75368
+ };
75369
+ var DTableDataTreeItemAccessor = /** @class */ (function () {
75370
+ function DTableDataTreeItemAccessor(options) {
75371
+ if (options != null) {
75372
+ this.toParent = options.toParent || toParent;
75373
+ this.toChildren = options.toChildren || toChildren$1;
75374
+ this.hasChildren = options.hasChildren || hasChildren;
75375
+ }
75376
+ else {
75377
+ this.toParent = toParent;
75378
+ this.toChildren = toChildren$1;
75379
+ this.hasChildren = hasChildren;
75380
+ }
75381
+ }
75382
+ return DTableDataTreeItemAccessor;
75383
+ }());
75384
+
75385
+ /*
75386
+ * Copyright (C) 2021 Toshiba Corporation
75387
+ * SPDX-License-Identifier: Apache-2.0
75388
+ */
75389
+ var COMPARATOR = function (a, b) {
75390
+ return a[0] - b[0];
75391
+ };
75392
+ var DTableDataTreeSelectionImpl = /** @class */ (function (_super) {
75393
+ __extends(DTableDataTreeSelectionImpl, _super);
75394
+ function DTableDataTreeSelectionImpl(parent, options) {
75395
+ var _a;
75396
+ var _this = _super.call(this) || this;
75397
+ _this._parent = parent;
75398
+ _this._type = toEnum((_a = options === null || options === void 0 ? void 0 : options.type) !== null && _a !== void 0 ? _a : DTableDataSelectionType.NONE, DTableDataSelectionType);
75399
+ _this._rows = new Set();
75400
+ // Events
75401
+ var on = options === null || options === void 0 ? void 0 : options.on;
75402
+ if (on) {
75403
+ for (var name_1 in on) {
75404
+ var handler = on[name_1];
75405
+ if (handler) {
75406
+ _this.on(name_1, handler);
75407
+ }
75408
+ }
75409
+ }
75410
+ return _this;
75411
+ }
75412
+ Object.defineProperty(DTableDataTreeSelectionImpl.prototype, "parent", {
75413
+ get: function () {
75414
+ return this._parent;
75415
+ },
75416
+ enumerable: false,
75417
+ configurable: true
75418
+ });
75419
+ DTableDataTreeSelectionImpl.prototype.onNodeChange = function (nodes) {
75420
+ if (nodes != null) {
75421
+ var accessor = this._parent.accessor;
75422
+ var toChildren = accessor.toChildren;
75423
+ var hasChildren = accessor.hasChildren;
75424
+ var oldRows = this._rows;
75425
+ var newRows = this.newRows(nodes, toChildren, hasChildren, oldRows, new Set());
75426
+ if (oldRows.size !== newRows.size) {
75427
+ this._rows = newRows;
75428
+ this.onChange();
75429
+ }
75430
+ }
75431
+ else {
75432
+ var rows = this._rows;
75433
+ if (0 < rows.size) {
75434
+ rows.clear();
75435
+ this.onChange();
75436
+ }
75437
+ }
75438
+ };
75439
+ DTableDataTreeSelectionImpl.prototype.newRows = function (nodes, toChildren, hasChildren, rows, result) {
75440
+ for (var i = 0, imax = nodes.length; i < imax; ++i) {
75441
+ var node = nodes[i];
75442
+ if (rows.has(node)) {
75443
+ result.add(node);
75444
+ }
75445
+ var children = toChildren(node);
75446
+ if (hasChildren(node, children)) {
75447
+ this.newRows(children, toChildren, hasChildren, rows, result);
75448
+ }
75449
+ }
75450
+ return result;
75451
+ };
75452
+ Object.defineProperty(DTableDataTreeSelectionImpl.prototype, "indices", {
75453
+ get: function () {
75454
+ var rows = this._rows;
75455
+ var result = [];
75456
+ this._parent.each(function (row, index) {
75457
+ if (rows.has(row)) {
75458
+ result.push(index);
75459
+ }
75460
+ });
75461
+ return result;
75462
+ },
75463
+ enumerable: false,
75464
+ configurable: true
75465
+ });
75466
+ Object.defineProperty(DTableDataTreeSelectionImpl.prototype, "rows", {
75467
+ get: function () {
75468
+ var result = [];
75469
+ this._rows.forEach(function (row) {
75470
+ result.push(row);
75471
+ });
75472
+ return result;
75473
+ },
75474
+ enumerable: false,
75475
+ configurable: true
75476
+ });
75477
+ Object.defineProperty(DTableDataTreeSelectionImpl.prototype, "type", {
75478
+ get: function () {
75479
+ return this._type;
75480
+ },
75481
+ enumerable: false,
75482
+ configurable: true
75483
+ });
75484
+ DTableDataTreeSelectionImpl.prototype.getFirst = function () {
75485
+ var rows = this._rows;
75486
+ if (0 < rows.size) {
75487
+ var result_1 = null;
75488
+ rows.forEach(function (row) {
75489
+ if (result_1 == null) {
75490
+ result_1 = row;
75491
+ }
75492
+ });
75493
+ return result_1;
75494
+ }
75495
+ return null;
75496
+ };
75497
+ DTableDataTreeSelectionImpl.prototype.getLast = function () {
75498
+ var rows = this._rows;
75499
+ if (0 < rows.size) {
75500
+ var result_2 = null;
75501
+ rows.forEach(function (row) {
75502
+ result_2 = row;
75503
+ });
75504
+ return result_2;
75505
+ }
75506
+ return null;
75507
+ };
75508
+ DTableDataTreeSelectionImpl.prototype.toIndex = function (target) {
75509
+ var result = null;
75510
+ this._parent.each(function (row, index) {
75511
+ if (target === row) {
75512
+ result = index;
75513
+ return false;
75514
+ }
75515
+ return true;
75516
+ });
75517
+ return result;
75518
+ };
75519
+ Object.defineProperty(DTableDataTreeSelectionImpl.prototype, "first", {
75520
+ get: function () {
75521
+ var row = this.getFirst();
75522
+ if (row) {
75523
+ return this.toIndex(row);
75524
+ }
75525
+ return null;
75526
+ },
75527
+ enumerable: false,
75528
+ configurable: true
75529
+ });
75530
+ Object.defineProperty(DTableDataTreeSelectionImpl.prototype, "last", {
75531
+ get: function () {
75532
+ var row = this.getLast();
75533
+ if (row) {
75534
+ return this.toIndex(row);
75535
+ }
75536
+ return null;
75537
+ },
75538
+ enumerable: false,
75539
+ configurable: true
75540
+ });
75541
+ DTableDataTreeSelectionImpl.prototype.onChange = function () {
75542
+ this._parent.update();
75543
+ this.emit("change", this);
75544
+ };
75545
+ DTableDataTreeSelectionImpl.prototype.toggle = function (rowIndex) {
75546
+ var row = this._parent.get(rowIndex);
75547
+ if (row) {
75548
+ var rows = this._rows;
75549
+ if (rows.has(row)) {
75550
+ rows.delete(row);
75551
+ }
75552
+ else {
75553
+ rows.add(row);
75554
+ }
75555
+ this.onChange();
75556
+ }
75557
+ };
75558
+ DTableDataTreeSelectionImpl.prototype.add = function (rowIndex) {
75559
+ var row = this._parent.get(rowIndex);
75560
+ if (row) {
75561
+ var rows = this._rows;
75562
+ if (!rows.has(row)) {
75563
+ rows.add(row);
75564
+ this.onChange();
75565
+ }
75566
+ }
75567
+ };
75568
+ DTableDataTreeSelectionImpl.prototype.addTo = function (rowIndex) {
75569
+ var lastRowIndex = this.last;
74435
75570
  if (lastRowIndex != null) {
74436
75571
  this.addRange(lastRowIndex, false, rowIndex, true);
74437
75572
  }
@@ -75004,24 +76139,37 @@
75004
76139
  * Copyright (C) 2019 Toshiba Corporation
75005
76140
  * SPDX-License-Identifier: Apache-2.0
75006
76141
  */
76142
+ var DTableHeaderCellEdge = {
76143
+ NONE: 0,
76144
+ LEFT: 1,
76145
+ RIGHT: 2,
76146
+ BOTH: 3
76147
+ };
75007
76148
  var DTableHeaderCell = /** @class */ (function (_super) {
75008
76149
  __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);
76150
+ function DTableHeaderCell(header, columnIndex, column, options) {
76151
+ var _this = _super.call(this, options) || this;
76152
+ _this._header = header;
76153
+ _this._column = column;
76154
+ _this._columnIndex = columnIndex;
76155
+ var check = new DTableHeaderCellCheck(_this, options === null || options === void 0 ? void 0 : options.check);
76156
+ _this._check = check;
76157
+ _this._edgeSize = _this.theme.getEdgeWidth();
76158
+ _this._wasResizing = false;
76159
+ var sortable = column.sorting.enable;
76160
+ var checkable = check.isEnabled;
76161
+ if (checkable || sortable) {
76162
+ _this.on(UtilPointerEvent.tap, function (e) {
76163
+ _this.onClick(e);
76164
+ });
76165
+ var state = _this.state;
76166
+ state.lock();
76167
+ state.set(DTableState.SORTABLE, sortable);
76168
+ state.set(DTableState.CHECKABLE, checkable);
76169
+ state.unlock();
75021
76170
  }
75022
- _super.prototype.init.call(this, options);
75023
- this.initOnClick(options);
75024
- };
76171
+ return _this;
76172
+ }
75025
76173
  Object.defineProperty(DTableHeaderCell.prototype, "column", {
75026
76174
  get: function () {
75027
76175
  return this._column;
@@ -75050,22 +76198,200 @@
75050
76198
  enumerable: false,
75051
76199
  configurable: true
75052
76200
  });
75053
- DTableHeaderCell.prototype.initOnClick = function (options) {
76201
+ DTableHeaderCell.prototype.onDown = function (e) {
76202
+ var edges = this.state.valueOf(DTableState.HOVERED_ON_EDGE);
76203
+ if (edges != null) {
76204
+ this._wasResizing = true;
76205
+ var layer = DApplications.getLayer(this);
76206
+ if (layer != null) {
76207
+ var interactionManager = layer.renderer.plugins.interaction;
76208
+ var columnIndex = this._columnIndex;
76209
+ if (edges === DTableHeaderCellEdge.LEFT) {
76210
+ this.onDownEdge(e.data.global.x, columnIndex - 1, interactionManager);
76211
+ }
76212
+ else {
76213
+ this.onDownEdge(e.data.global.x, columnIndex, interactionManager);
76214
+ }
76215
+ }
76216
+ }
76217
+ else {
76218
+ this._wasResizing = false;
76219
+ _super.prototype.onDown.call(this, e);
76220
+ }
76221
+ };
76222
+ DTableHeaderCell.prototype.findLeftResizableCell = function (columnIndex) {
76223
+ var children = this._header.children;
76224
+ var childrenLength = children.length;
76225
+ for (var i = columnIndex; 0 <= i; --i) {
76226
+ var child = children[childrenLength - i - 1];
76227
+ if (child.column.resizable) {
76228
+ return child;
76229
+ }
76230
+ }
76231
+ return null;
76232
+ };
76233
+ DTableHeaderCell.prototype.findRightResizableCellOfWeight = function (columnIndex) {
76234
+ var children = this._header.children;
76235
+ var childrenLength = children.length;
76236
+ for (var i = columnIndex + 1; i < childrenLength; ++i) {
76237
+ var child = children[childrenLength - i - 1];
76238
+ var childColumn = child.column;
76239
+ if (childColumn.resizable) {
76240
+ var childColumnWeight = childColumn.weight;
76241
+ if (childColumnWeight != null) {
76242
+ return child;
76243
+ }
76244
+ }
76245
+ }
76246
+ return null;
76247
+ };
76248
+ DTableHeaderCell.prototype.checkIfEdgeResizable = function (columnIndex) {
76249
+ var target = this.findLeftResizableCell(columnIndex);
76250
+ if (target != null) {
76251
+ if (target.column.weight != null) {
76252
+ return this.findRightResizableCellOfWeight(target.columnIndex) != null;
76253
+ }
76254
+ else {
76255
+ return true;
76256
+ }
76257
+ }
76258
+ return false;
76259
+ };
76260
+ DTableHeaderCell.prototype.getResizableEdges = function () {
76261
+ var result = this._resizableEdges;
76262
+ if (result == null) {
76263
+ var columnIndex = this._columnIndex;
76264
+ if (this.checkIfEdgeResizable(columnIndex - 1)) {
76265
+ if (this.checkIfEdgeResizable(columnIndex)) {
76266
+ result = DTableHeaderCellEdge.BOTH;
76267
+ }
76268
+ else {
76269
+ result = DTableHeaderCellEdge.LEFT;
76270
+ }
76271
+ }
76272
+ else {
76273
+ if (this.checkIfEdgeResizable(columnIndex)) {
76274
+ result = DTableHeaderCellEdge.RIGHT;
76275
+ }
76276
+ else {
76277
+ result = DTableHeaderCellEdge.NONE;
76278
+ }
76279
+ }
76280
+ this._resizableEdges = result;
76281
+ }
76282
+ return result;
76283
+ };
76284
+ DTableHeaderCell.prototype.onOver = function (e) {
75054
76285
  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();
76286
+ var _a;
76287
+ _super.prototype.onOver.call(this, e);
76288
+ if (this.getResizableEdges() !== DTableHeaderCellEdge.NONE) {
76289
+ var onHoveredBound = ((_a = this._onHoveredBound) !== null && _a !== void 0 ? _a : (this._onHoveredBound = function (event) {
76290
+ _this.onHovered(event);
76291
+ }));
76292
+ this.on(UtilPointerEvent.move, onHoveredBound);
76293
+ // Since the cursor is set by InteractionManager before this method is called,
76294
+ // the cursor need to be overriden.
76295
+ this.onHovered(e);
76296
+ var layer = DApplications.getLayer(this);
76297
+ if (layer != null) {
76298
+ layer.renderer.plugins.interaction.cursor = this.cursor;
76299
+ }
76300
+ }
76301
+ };
76302
+ DTableHeaderCell.prototype.onOut = function (e) {
76303
+ _super.prototype.onOut.call(this, e);
76304
+ var onHoveredBound = this._onHoveredBound;
76305
+ if (onHoveredBound != null) {
76306
+ this.state.remove(DTableState.HOVERED_ON_EDGE);
76307
+ this.off(UtilPointerEvent.move, onHoveredBound);
76308
+ }
76309
+ };
76310
+ DTableHeaderCell.prototype.onHovered = function (e) {
76311
+ var width = this.width;
76312
+ var x = this.toClickPosition(e);
76313
+ var edgeSize = this._edgeSize;
76314
+ if (0 <= x && x <= edgeSize) {
76315
+ if (this.getResizableEdges() & DTableHeaderCellEdge.LEFT) {
76316
+ this.state.add(DTableState.HOVERED_ON_EDGE, DTableHeaderCellEdge.LEFT);
76317
+ }
76318
+ else {
76319
+ this.state.remove(DTableState.HOVERED_ON_EDGE);
76320
+ }
76321
+ }
76322
+ else if (width - edgeSize <= x && x <= width) {
76323
+ if (this.getResizableEdges() & DTableHeaderCellEdge.RIGHT) {
76324
+ this.state.add(DTableState.HOVERED_ON_EDGE, DTableHeaderCellEdge.RIGHT);
76325
+ }
76326
+ else {
76327
+ this.state.remove(DTableState.HOVERED_ON_EDGE);
76328
+ }
76329
+ }
76330
+ else {
76331
+ this.state.remove(DTableState.HOVERED_ON_EDGE);
76332
+ }
76333
+ };
76334
+ DTableHeaderCell.prototype.onDownEdge = function (onDownPoint, columnIndex, interactionManager) {
76335
+ // Find the resizable cell
76336
+ var left = this.findLeftResizableCell(columnIndex);
76337
+ if (left == null) {
76338
+ // No resizable cell
76339
+ return;
76340
+ }
76341
+ var header = this._header;
76342
+ var leftColumn = left.column;
76343
+ var leftOldWidth = left.width;
76344
+ var leftOldWeight = left.weight;
76345
+ if (leftColumn.weight == null) {
76346
+ header.state.add(DTableState.RESIZING);
76347
+ var onMove_1 = function (e) {
76348
+ leftColumn.width = Math.max(1, leftOldWidth + e.data.global.x - onDownPoint);
76349
+ };
76350
+ var onUp_1 = function (e) {
76351
+ header.state.remove(DTableState.RESIZING);
76352
+ interactionManager.off(UtilPointerEvent.move, onMove_1);
76353
+ interactionManager.off(UtilPointerEvent.up, onUp_1);
76354
+ interactionManager.off(UtilPointerEvent.upoutside, onUp_1);
76355
+ interactionManager.off(UtilPointerEvent.cancel, onUp_1);
76356
+ };
76357
+ interactionManager.on(UtilPointerEvent.move, onMove_1);
76358
+ interactionManager.on(UtilPointerEvent.up, onUp_1);
76359
+ interactionManager.on(UtilPointerEvent.upoutside, onUp_1);
76360
+ interactionManager.on(UtilPointerEvent.cancel, onUp_1);
76361
+ }
76362
+ else {
76363
+ var right = this.findRightResizableCellOfWeight(left.columnIndex);
76364
+ if (right == null) {
76365
+ // No right resizable cell found
76366
+ return;
76367
+ }
76368
+ var rightColumn_1 = right.column;
76369
+ var rightOldWeight = right.weight;
76370
+ var rightOldWidth = right.width;
76371
+ var totalWidth_1 = leftOldWidth + rightOldWidth;
76372
+ var totalWeight_1 = leftOldWeight + rightOldWeight;
76373
+ if (totalWidth_1 <= 0) {
76374
+ // The left and right resizable cells doesn't have non-zero width
76375
+ return;
75068
76376
  }
76377
+ header.state.add(DTableState.RESIZING);
76378
+ var onMove_2 = function (e) {
76379
+ var leftNewWidth = Math.max(0, Math.min(totalWidth_1, leftOldWidth + e.data.global.x - onDownPoint));
76380
+ var leftNewWeight = totalWeight_1 * (leftNewWidth / totalWidth_1);
76381
+ leftColumn.weight = leftNewWeight;
76382
+ rightColumn_1.weight = totalWeight_1 - leftNewWeight;
76383
+ };
76384
+ var onUp_2 = function (e) {
76385
+ header.state.remove(DTableState.RESIZING);
76386
+ interactionManager.off(UtilPointerEvent.move, onMove_2);
76387
+ interactionManager.off(UtilPointerEvent.up, onUp_2);
76388
+ interactionManager.off(UtilPointerEvent.upoutside, onUp_2);
76389
+ interactionManager.off(UtilPointerEvent.cancel, onUp_2);
76390
+ };
76391
+ interactionManager.on(UtilPointerEvent.move, onMove_2);
76392
+ interactionManager.on(UtilPointerEvent.up, onUp_2);
76393
+ interactionManager.on(UtilPointerEvent.upoutside, onUp_2);
76394
+ interactionManager.on(UtilPointerEvent.cancel, onUp_2);
75069
76395
  }
75070
76396
  };
75071
76397
  Object.defineProperty(DTableHeaderCell.prototype, "sorter", {
@@ -75101,11 +76427,7 @@
75101
76427
  });
75102
76428
  Object.defineProperty(DTableHeaderCell.prototype, "comparator", {
75103
76429
  get: function () {
75104
- var column = this._column;
75105
- if (column) {
75106
- return column.sorting.comparator || null;
75107
- }
75108
- return null;
76430
+ return this._column.sorting.comparator || null;
75109
76431
  },
75110
76432
  enumerable: false,
75111
76433
  configurable: true
@@ -75132,8 +76454,8 @@
75132
76454
  }
75133
76455
  };
75134
76456
  DTableHeaderCell.prototype.toClickPosition = function (e) {
75135
- var checkWork = this._checkWork || new pixi_js.Point();
75136
- this._checkWork = checkWork;
76457
+ var _a;
76458
+ var checkWork = ((_a = this._checkWork) !== null && _a !== void 0 ? _a : (this._checkWork = new pixi_js.Point()));
75137
76459
  return e.data.getLocalPosition(this, checkWork).x;
75138
76460
  };
75139
76461
  DTableHeaderCell.prototype.isCheckClicked = function (e) {
@@ -75158,6 +76480,10 @@
75158
76480
  }
75159
76481
  return false;
75160
76482
  };
76483
+ DTableHeaderCell.prototype.isEdgeClicked = function (e) {
76484
+ return (e instanceof pixi_js.InteractionEvent &&
76485
+ (this.state.is(DTableState.HOVERED_ON_EDGE) || this._wasResizing));
76486
+ };
75161
76487
  DTableHeaderCell.prototype.onClick = function (e) {
75162
76488
  if (this.state.isActionable) {
75163
76489
  this.activate(e);
@@ -75167,13 +76493,15 @@
75167
76493
  this.onActivate(e);
75168
76494
  };
75169
76495
  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);
76496
+ if (!this.isEdgeClicked(e)) {
76497
+ if (this.isCheckClicked(e)) {
76498
+ this.onToggleStart();
76499
+ this.onToggleEnd();
76500
+ }
76501
+ else {
76502
+ this.doSort(e);
76503
+ this.emit("active", this);
76504
+ }
75177
76505
  }
75178
76506
  };
75179
76507
  DTableHeaderCell.prototype.doSort = function (e) {
@@ -75203,11 +76531,14 @@
75203
76531
  };
75204
76532
  Object.defineProperty(DTableHeaderCell.prototype, "isSortable", {
75205
76533
  get: function () {
75206
- var column = this._column;
75207
- if (column) {
75208
- return column.sorting.enable;
75209
- }
75210
- return false;
76534
+ return this._column.sorting.enable;
76535
+ },
76536
+ enumerable: false,
76537
+ configurable: true
76538
+ });
76539
+ Object.defineProperty(DTableHeaderCell.prototype, "isResizable", {
76540
+ get: function () {
76541
+ return this._column.resizable;
75211
76542
  },
75212
76543
  enumerable: false,
75213
76544
  configurable: true
@@ -75297,14 +76628,12 @@
75297
76628
  */
75298
76629
  var DTableHeader = /** @class */ (function (_super) {
75299
76630
  __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;
76631
+ function DTableHeader(table, columns, frozen, offset, options) {
76632
+ var _this = _super.call(this, columns, frozen, options) || this;
76633
+ _this._table = table;
75305
76634
  _this._offset = offset;
75306
76635
  _this.transform.position.y = offset;
75307
- _this.initCells(options, _this._columns, _this._frozen);
76636
+ _this.initCells();
75308
76637
  return _this;
75309
76638
  }
75310
76639
  Object.defineProperty(DTableHeader.prototype, "table", {
@@ -75327,10 +76656,10 @@
75327
76656
  return 0;
75328
76657
  };
75329
76658
  DTableHeader.prototype.newCell = function (columnIndex, column, columns, options) {
75330
- return new DTableHeaderCell(this.toCellOptions(columnIndex, column, options));
76659
+ return new DTableHeaderCell(this, columnIndex, column, this.toCellOptions(column, options));
75331
76660
  };
75332
- DTableHeader.prototype.toCellOptions = function (columnIndex, column, options) {
75333
- var result = column.header || options.cell;
76661
+ DTableHeader.prototype.toCellOptions = function (column, options) {
76662
+ var result = column.header || (options === null || options === void 0 ? void 0 : options.cell);
75334
76663
  if (result != null) {
75335
76664
  if (result.weight === undefined) {
75336
76665
  result.weight = column.weight;
@@ -75346,15 +76675,6 @@
75346
76675
  else if (result.text.value === undefined) {
75347
76676
  result.text.value = column.label;
75348
76677
  }
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
76678
  return result;
75359
76679
  }
75360
76680
  else {
@@ -75363,10 +76683,7 @@
75363
76683
  width: column.width,
75364
76684
  text: {
75365
76685
  value: column.label
75366
- },
75367
- header: this,
75368
- column: column,
75369
- columnIndex: columnIndex
76686
+ }
75370
76687
  };
75371
76688
  }
75372
76689
  };
@@ -75391,359 +76708,11 @@
75391
76708
  * Copyright (C) 2019 Toshiba Corporation
75392
76709
  * SPDX-License-Identifier: Apache-2.0
75393
76710
  */
75394
- var defaultGetter = function (row, columnIndex) {
75395
- return row[columnIndex];
75396
- };
75397
- var defaultSetter = function (row, columnIndex, cell) {
75398
- row[columnIndex] = cell;
75399
- };
75400
- var defaultGetterEmpty = function () { return ""; };
75401
- var defaultSetterEmpty = function () {
75402
- // DO NOTHING
75403
- };
75404
- var toPathGetter = function (path, def) {
75405
- if (path.length <= 1) {
75406
- var key_1 = path[0];
75407
- if (def === undefined) {
75408
- return function (row) {
75409
- return row[key_1];
75410
- };
75411
- }
75412
- else {
75413
- return function (row) {
75414
- return Object.prototype.hasOwnProperty.call(row, key_1) ? row[key_1] : def;
75415
- };
75416
- }
75417
- }
75418
- else {
75419
- if (def === undefined) {
75420
- return function (row) {
75421
- for (var i = 0, imax = path.length - 1; i < imax; ++i) {
75422
- row = row[path[i]];
75423
- }
75424
- return row[path[path.length - 1]];
75425
- };
75426
- }
75427
- else {
75428
- return function (row) {
75429
- for (var i = 0, imax = path.length - 1; i < imax; ++i) {
75430
- row = row[path[i]];
75431
- }
75432
- var key = path[path.length - 1];
75433
- return Object.prototype.hasOwnProperty.call(row, key) ? row[key] : def;
75434
- };
75435
- }
75436
- }
75437
- };
75438
- var toPathSetter = function (path) {
75439
- if (path.length <= 1) {
75440
- var key_2 = path[0];
75441
- return function (row, columnIndex, cell) {
75442
- row[key_2] = cell;
75443
- };
75444
- }
75445
- else {
75446
- return function (row, columnIndex, cell) {
75447
- for (var i = 0, imax = path.length - 1; i < imax; ++i) {
75448
- row = row[path[i]] || {};
75449
- }
75450
- row[path[path.length - 1]] = cell;
75451
- };
75452
- }
75453
- };
75454
- var toColumnAlign = function (options, type) {
75455
- var align = options.align;
75456
- if (align != null) {
75457
- if (isString(align)) {
75458
- return DAlignHorizontal[align];
75459
- }
75460
- else {
75461
- return align;
75462
- }
75463
- }
75464
- switch (type) {
75465
- case DTableColumnType.TEXT:
75466
- case DTableColumnType.TEXT_AREA:
75467
- return DAlignHorizontal.LEFT;
75468
- case DTableColumnType.REAL:
75469
- case DTableColumnType.INTEGER:
75470
- return DAlignHorizontal.RIGHT;
75471
- case DTableColumnType.BUTTON:
75472
- case DTableColumnType.INDEX:
75473
- case DTableColumnType.SELECT:
75474
- case DTableColumnType.ACTION:
75475
- case DTableColumnType.LINK:
75476
- case DTableColumnType.CHECK:
75477
- case DTableColumnType.CHECK_SINGLE:
75478
- case DTableColumnType.COLOR:
75479
- return DAlignHorizontal.CENTER;
75480
- default:
75481
- return DAlignHorizontal.LEFT;
75482
- }
75483
- };
75484
- var toColumnDataChecker = function (path) {
75485
- if (path != null) {
75486
- var pathLength_1 = path.length;
75487
- if (pathLength_1 <= 1) {
75488
- var key_3 = path[0];
75489
- return function (row) {
75490
- return Object.prototype.hasOwnProperty.call(row, key_3);
75491
- };
75492
- }
75493
- else {
75494
- return function (row) {
75495
- for (var i = 0; i < pathLength_1; ++i) {
75496
- var part = path[i];
75497
- if (part in row) {
75498
- row = row[part];
75499
- }
75500
- else {
75501
- return false;
75502
- }
75503
- }
75504
- return true;
75505
- };
75506
- }
75507
- }
75508
- return function (row, columnIndex) {
75509
- return columnIndex < row.length;
75510
- };
75511
- };
75512
- var toColumnEditingEnable = function (enable, path) {
75513
- if (isString(enable)) {
75514
- return toColumnDataChecker(path);
75515
- }
75516
- else if (enable != null) {
75517
- return enable;
75518
- }
75519
- else {
75520
- return false;
75521
- }
75522
- };
75523
- var toColumnEditing = function (options, path) {
75524
- var _a;
75525
- var editing = options.editing;
75526
- var editable = options.editable;
75527
- if (editing) {
75528
- return {
75529
- enable: toColumnEditingEnable((_a = editing.enable) !== null && _a !== void 0 ? _a : editable, path),
75530
- formatter: editing.formatter,
75531
- unformatter: editing.unformatter,
75532
- validator: editing.validator
75533
- };
75534
- }
75535
- return {
75536
- enable: toColumnEditingEnable(editable, path)
75537
- };
75538
- };
75539
- var toComparator = function (getter, index) {
75540
- return function (rowA, rowB) {
75541
- var valueA = getter(rowA, index);
75542
- var valueB = getter(rowB, index);
75543
- return valueA < valueB ? -1 : valueB < valueA ? +1 : 0;
75544
- };
75545
- };
75546
- var toColumnSorting = function (getter, index, options) {
75547
- var sorting = options.sorting;
75548
- var sortable = options.sortable;
75549
- if (sorting) {
75550
- if (sorting.enable || sortable) {
75551
- return {
75552
- enable: true,
75553
- comparator: sorting.comparator || toComparator(getter, index)
75554
- };
75555
- }
75556
- return {
75557
- enable: false
75558
- };
75559
- }
75560
- if (sortable) {
75561
- return {
75562
- enable: true,
75563
- comparator: toComparator(getter, index)
75564
- };
75565
- }
75566
- return {
75567
- enable: false
75568
- };
75569
- };
75570
- var toColumnMenu = function (options) {
75571
- if (options == null) {
75572
- return undefined;
75573
- }
75574
- else if (options instanceof DMenu) {
75575
- return options;
75576
- }
75577
- else {
75578
- return new DMenu(options);
75579
- }
75580
- };
75581
- var toColumnDialog = function (options) {
75582
- if (options == null) {
75583
- return undefined;
75584
- }
75585
- else if ("open" in options) {
75586
- return options;
75587
- }
75588
- else {
75589
- return new DDialogSelect(options);
75590
- }
75591
- };
75592
- var defaultSelectingGetter = function (dialog) {
75593
- return dialog.value;
75594
- };
75595
- var defaultSelectingSetter = function () {
75596
- // DO NOTHING
75597
- };
75598
- var toColumnSelecting = function (options) {
75599
- if (options) {
75600
- return {
75601
- getter: options.getter || defaultSelectingGetter,
75602
- setter: options.setter || defaultSelectingSetter,
75603
- menu: toColumnMenu(options.menu),
75604
- multiple: toColumnMenu(options.multiple),
75605
- dialog: toColumnDialog(options.dialog),
75606
- promise: options.promise
75607
- };
75608
- }
75609
- return {
75610
- getter: defaultSelectingGetter,
75611
- setter: defaultSelectingSetter
75612
- };
75613
- };
75614
- var toColumnGetter = function (options, type, parts) {
75615
- var getter = options.getter;
75616
- if (getter) {
75617
- return getter;
75618
- }
75619
- switch (type) {
75620
- case DTableColumnType.ACTION:
75621
- case DTableColumnType.LINK:
75622
- return defaultGetterEmpty;
75623
- default:
75624
- if (parts == null) {
75625
- return defaultGetter;
75626
- }
75627
- else {
75628
- return toPathGetter(parts, options.default);
75629
- }
75630
- }
75631
- };
75632
- var toColumnSetter = function (options, type, path) {
75633
- var setter = options.setter;
75634
- if (setter) {
75635
- return setter;
75636
- }
75637
- switch (type) {
75638
- case DTableColumnType.BUTTON:
75639
- case DTableColumnType.ACTION:
75640
- case DTableColumnType.LINK:
75641
- return defaultSetterEmpty;
75642
- default:
75643
- if (path == null) {
75644
- return defaultSetter;
75645
- }
75646
- else {
75647
- return toPathSetter(path);
75648
- }
75649
- }
75650
- };
75651
- var toColumnState = function (options) {
75652
- var state = options.state;
75653
- if (state != null) {
75654
- if (isString(state) || isArray(state)) {
75655
- return {
75656
- initial: state,
75657
- modifier: undefined
75658
- };
75659
- }
75660
- else {
75661
- return {
75662
- initial: undefined,
75663
- modifier: state
75664
- };
75665
- }
75666
- }
75667
- return {
75668
- initial: undefined,
75669
- modifier: undefined
75670
- };
75671
- };
75672
- var toColumnPath = function (options) {
75673
- return options.path != null ? options.path.split(".") : null;
75674
- };
75675
- var toColumnRenderable = function (options, path) {
75676
- var renderable = options.renderable;
75677
- if (isString(renderable)) {
75678
- return toColumnDataChecker(path);
75679
- }
75680
- else if (renderable != null) {
75681
- return renderable;
75682
- }
75683
- return true;
75684
- };
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]));
75730
- }
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;
75737
- }
75738
- }
75739
- return 0;
75740
- };
75741
76711
  var DTable = /** @class */ (function (_super) {
75742
76712
  __extends(DTable, _super);
75743
76713
  function DTable(options) {
75744
76714
  var _this = _super.call(this, options) || this;
75745
76715
  var content = _this.content;
75746
- content.setWidth(_this.toContentWidth(options));
75747
76716
  var body = _this.body;
75748
76717
  content.addChild(body);
75749
76718
  if (body.data.selection.type !== DTableDataSelectionType.NONE) {
@@ -75762,39 +76731,47 @@
75762
76731
  body.update();
75763
76732
  return _this;
75764
76733
  }
76734
+ Object.defineProperty(DTable.prototype, "column", {
76735
+ get: function () {
76736
+ var _a;
76737
+ return ((_a = this._column) !== null && _a !== void 0 ? _a : (this._column = this.newColumn()));
76738
+ },
76739
+ enumerable: false,
76740
+ configurable: true
76741
+ });
76742
+ DTable.prototype.newColumn = function () {
76743
+ var _a;
76744
+ return new DTableColumnContainerImpl(this, (_a = this._options) === null || _a === void 0 ? void 0 : _a.columns);
76745
+ };
75765
76746
  Object.defineProperty(DTable.prototype, "columns", {
75766
76747
  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;
75772
- }
75773
- return result;
76748
+ return this.column.items;
75774
76749
  },
75775
76750
  enumerable: false,
75776
76751
  configurable: true
75777
76752
  });
75778
76753
  Object.defineProperty(DTable.prototype, "frozen", {
75779
76754
  get: function () {
75780
- var result = this._frozen;
75781
- if (result == null) {
75782
- result = toFrozen(this.columns);
75783
- this._frozen = result;
75784
- }
75785
- return result;
76755
+ return this.column.frozen;
76756
+ },
76757
+ enumerable: false,
76758
+ configurable: true
76759
+ });
76760
+ Object.defineProperty(DTable.prototype, "category", {
76761
+ get: function () {
76762
+ return (this._category = this.newCategory());
75786
76763
  },
75787
76764
  enumerable: false,
75788
76765
  configurable: true
75789
76766
  });
76767
+ DTable.prototype.newCategory = function () {
76768
+ var _a;
76769
+ var column = this.column;
76770
+ return new DTableCategoryContainerImpl(column.items, column.frozen, (_a = this._options) === null || _a === void 0 ? void 0 : _a.category);
76771
+ };
75790
76772
  Object.defineProperty(DTable.prototype, "categories", {
75791
76773
  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;
75796
- }
75797
- return result;
76774
+ return this.category.items;
75798
76775
  },
75799
76776
  enumerable: false,
75800
76777
  configurable: true
@@ -75817,191 +76794,6 @@
75817
76794
  body.unlock(true);
75818
76795
  scrollbar.unlock(true);
75819
76796
  };
75820
- DTable.prototype.getCategoryCount = function (columns) {
75821
- var result = 0;
75822
- for (var i = 0, imax = columns.length; i < imax; ++i) {
75823
- var category = columns[i].category;
75824
- if (category != null) {
75825
- var count = isString(category) ? 1 : category.length;
75826
- result = Math.max(result, count);
75827
- }
75828
- }
75829
- return result;
75830
- };
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) {
75847
- if (a != null) {
75848
- if (b != null) {
75849
- if (isString(a)) {
75850
- if (isString(b)) {
75851
- if (0 < index) {
75852
- return true;
75853
- }
75854
- else {
75855
- return a === b;
75856
- }
75857
- }
75858
- else {
75859
- if (0 < index) {
75860
- return b.length <= index;
75861
- }
75862
- else {
75863
- return b.length === 1 && a === b[0];
75864
- }
75865
- }
75866
- }
75867
- else {
75868
- if (isString(b)) {
75869
- if (0 < index) {
75870
- return a.length <= index;
75871
- }
75872
- else {
75873
- return a.length === 1 && a[0] === b;
75874
- }
75875
- }
75876
- else {
75877
- if (a.length <= index && b.length <= index) {
75878
- return true;
75879
- }
75880
- else if (b.length === a.length) {
75881
- for (var i = index, imax = a.length; i < imax; ++i) {
75882
- if (a[i] !== b[i]) {
75883
- return false;
75884
- }
75885
- }
75886
- return true;
75887
- }
75888
- return false;
75889
- }
75890
- }
75891
- }
75892
- else {
75893
- if (isString(a)) {
75894
- if (0 < index) {
75895
- return true;
75896
- }
75897
- else {
75898
- return false;
75899
- }
75900
- }
75901
- else {
75902
- if (a.length <= index) {
75903
- return true;
75904
- }
75905
- else {
75906
- return false;
75907
- }
75908
- }
75909
- }
75910
- }
75911
- else {
75912
- if (b != null) {
75913
- if (isString(b)) {
75914
- if (0 < index) {
75915
- return true;
75916
- }
75917
- else {
75918
- return false;
75919
- }
75920
- }
75921
- else {
75922
- if (b.length <= index) {
75923
- return true;
75924
- }
75925
- else {
75926
- return false;
75927
- }
75928
- }
75929
- }
75930
- else {
75931
- return true;
75932
- }
75933
- }
75934
- };
75935
- DTable.prototype.toCategoryColumns = function (index, columns, frozen) {
75936
- var result = [];
75937
- var tcolumn = null;
75938
- var ccolumn = null;
75939
- for (var i = 0, imax = columns.length; i < imax; ++i) {
75940
- var column = columns[i];
75941
- if (i !== frozen &&
75942
- ccolumn &&
75943
- tcolumn &&
75944
- this.isSameCategory(index, tcolumn.category, column.category)) {
75945
- if (ccolumn.weight != null && column.weight != null) {
75946
- ccolumn.weight += column.weight;
75947
- }
75948
- else if (ccolumn.width != null && column.width != null) {
75949
- ccolumn.width += column.width;
75950
- }
75951
- else {
75952
- tcolumn = column;
75953
- ccolumn = {
75954
- label: this.toCategoryLabel(index, column.category),
75955
- weight: column.weight,
75956
- width: column.width,
75957
- offset: 0.0
75958
- };
75959
- result.push(ccolumn);
75960
- }
75961
- }
75962
- else {
75963
- tcolumn = column;
75964
- ccolumn = {
75965
- label: this.toCategoryLabel(index, column.category),
75966
- weight: column.weight,
75967
- width: column.width,
75968
- offset: 0.0
75969
- };
75970
- result.push(ccolumn);
75971
- }
75972
- }
75973
- return result;
75974
- };
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;
75987
- }
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;
76002
- }
76003
- return result;
76004
- };
76005
76797
  DTable.prototype.onDblClick = function (e, interactionManager) {
76006
76798
  var result = this.body.onDblClick(e, interactionManager);
76007
76799
  return _super.prototype.onDblClick.call(this, e, interactionManager) || result;
@@ -76012,24 +76804,35 @@
76012
76804
  _this.onScrollBarUpdate(isRegionVisible);
76013
76805
  });
76014
76806
  };
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
- }
76807
+ DTable.prototype.newContent = function (options) {
76808
+ var _this = this;
76809
+ var result = _super.prototype.newContent.call(this, options);
76810
+ // X & Width
76811
+ var column = this.column;
76812
+ var columnWidth = column.width;
76813
+ if (0 < columnWidth) {
76814
+ column.on("resize", function () {
76815
+ columnWidth = column.width;
76816
+ var parentWidth = _this.width;
76817
+ var parentHeight = _this.height;
76818
+ var newWidth = Math.max(parentWidth, columnWidth);
76819
+ var newXMin = parentWidth - newWidth;
76820
+ // The X position must be in [newXMin, 0].
76821
+ if (result.x < newXMin) {
76822
+ result.x = newXMin;
76823
+ }
76824
+ // Force the with reevaluated
76825
+ result.onParentResize(parentWidth, parentHeight, _this.padding);
76826
+ });
76827
+ result.setWidth(function (p) {
76828
+ return Math.max(p, columnWidth);
76829
+ });
76026
76830
  }
76027
- if (0 < columnWidthTotal) {
76028
- return function (p) {
76029
- return Math.max(p, columnWidthTotal);
76030
- };
76831
+ else {
76832
+ result.setWidth("100%");
76031
76833
  }
76032
- return "100%";
76834
+ // Done
76835
+ return result;
76033
76836
  };
76034
76837
  DTable.prototype.getHeaderOffset = function () {
76035
76838
  var result = this._headerOffset;
@@ -76051,7 +76854,7 @@
76051
76854
  get: function () {
76052
76855
  var result = this._header;
76053
76856
  if (result === undefined) {
76054
- result = this.newHeader(this._options, this.columns, this.frozen, this.getHeaderOffset());
76857
+ result = this.newHeader();
76055
76858
  this._header = result;
76056
76859
  }
76057
76860
  return result;
@@ -76070,42 +76873,17 @@
76070
76873
  }
76071
76874
  return false;
76072
76875
  };
76073
- DTable.prototype.newHeader = function (options, columns, frozen, offset) {
76876
+ DTable.prototype.newHeader = function () {
76877
+ var options = this._options;
76074
76878
  if (this.hasHeader(options)) {
76075
- return new DTableHeader(this.toHeaderOptions(options === null || options === void 0 ? void 0 : options.header, columns, frozen, offset));
76879
+ var column = this.column;
76880
+ return new DTableHeader(this, column.items, column.frozen, this.getHeaderOffset(), options === null || options === void 0 ? void 0 : options.header);
76076
76881
  }
76077
76882
  return null;
76078
76883
  };
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
76884
  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;
76885
+ var _a;
76886
+ return ((_a = this._bodyOffset) !== null && _a !== void 0 ? _a : (this._bodyOffset = this.newBodyOffset()));
76109
76887
  };
76110
76888
  DTable.prototype.newBodyOffset = function () {
76111
76889
  var _a, _b;
@@ -76113,30 +76891,19 @@
76113
76891
  };
76114
76892
  Object.defineProperty(DTable.prototype, "body", {
76115
76893
  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;
76894
+ var _a;
76895
+ return ((_a = this._body) !== null && _a !== void 0 ? _a : (this._body = this.newBody()));
76122
76896
  },
76123
76897
  enumerable: false,
76124
76898
  configurable: true
76125
76899
  });
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));
76900
+ DTable.prototype.newBody = function () {
76901
+ var options = this._options;
76902
+ var column = this.column;
76903
+ 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
76904
  };
76129
- DTable.prototype.toBodyOptions = function (options, columns, frozen, offset, data) {
76905
+ DTable.prototype.toBodyOptions = function (options, data) {
76130
76906
  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
76907
  if (options.data === undefined && data !== undefined) {
76141
76908
  if (isArray(data)) {
76142
76909
  options.data = {
@@ -76154,9 +76921,6 @@
76154
76921
  }
76155
76922
  if (isArray(data)) {
76156
76923
  return {
76157
- columns: columns,
76158
- frozen: frozen,
76159
- offset: offset,
76160
76924
  data: {
76161
76925
  rows: data
76162
76926
  },
@@ -76165,9 +76929,6 @@
76165
76929
  }
76166
76930
  else {
76167
76931
  return {
76168
- columns: columns,
76169
- frozen: frozen,
76170
- offset: offset,
76171
76932
  data: data,
76172
76933
  weight: 1
76173
76934
  };
@@ -78475,6 +79236,7 @@
78475
79236
  DImagePieceMarginImpl: DImagePieceMarginImpl,
78476
79237
  DImagePieceTintImpl: DImagePieceTintImpl,
78477
79238
  DImage: DImage,
79239
+ DIndicatorProcessingState: DIndicatorProcessingState,
78478
79240
  DIndicatorProcessing: DIndicatorProcessing,
78479
79241
  DInputAndLabel: DInputAndLabel,
78480
79242
  DInputBooleanButtonOff: DInputBooleanButtonOff,
@@ -78674,8 +79436,13 @@
78674
79436
  DTableBodyCells: DTableBodyCells,
78675
79437
  DTableBodyRow: DTableBodyRow,
78676
79438
  DTableBody: DTableBody,
79439
+ DTableCategoryCellEdge: DTableCategoryCellEdge,
78677
79440
  DTableCategoryCell: DTableCategoryCell,
79441
+ DTableCategoryColumnImpl: DTableCategoryColumnImpl,
79442
+ DTableCategoryContainerImpl: DTableCategoryContainerImpl,
78678
79443
  DTableCategory: DTableCategory,
79444
+ DTableColumnContainerImpl: DTableColumnContainerImpl,
79445
+ DTableColumnImpl: DTableColumnImpl,
78679
79446
  DTableColumnType: DTableColumnType,
78680
79447
  DTableColumnUpdate: DTableColumnUpdate,
78681
79448
  DTableDataListFilter: DTableDataListFilter,
@@ -78691,6 +79458,7 @@
78691
79458
  DTableDataTreeSorter: DTableDataTreeSorter,
78692
79459
  DTableDataTree: DTableDataTree,
78693
79460
  DTableHeaderCellCheck: DTableHeaderCellCheck,
79461
+ DTableHeaderCellEdge: DTableHeaderCellEdge,
78694
79462
  DTableHeaderCell: DTableHeaderCell,
78695
79463
  DTableHeader: DTableHeader,
78696
79464
  DTableRow: DTableRow,