@wcardinal/wcardinal-ui 0.412.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.
@@ -1,5 +1,5 @@
1
1
  /*
2
- Winter Cardinal UI v0.412.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
 
@@ -88145,15 +88145,17 @@ var DExpandable = /** @class */ (function (_super) {
88145
88145
  return DExpandable;
88146
88146
  }(DLayoutVertical));
88147
88147
 
88148
- var STATE_INITIAL = 0;
88149
- var STATE_STARTED = 1;
88150
- var STATE_RESOLVED = 2;
88151
- var STATE_REJECTED = 3;
88148
+ var DIndicatorProcessingState = {
88149
+ INITIAL: 0,
88150
+ STARTED: 1,
88151
+ RESOLVED: 2,
88152
+ REJECTED: 3
88153
+ };
88152
88154
  var DIndicatorProcessing = /** @class */ (function () {
88153
88155
  function DIndicatorProcessing(parent, options) {
88154
88156
  var _a, _b, _c, _d, _e, _f, _g;
88155
88157
  this._parent = parent;
88156
- this._state = STATE_INITIAL;
88158
+ this._state = DIndicatorProcessingState.INITIAL;
88157
88159
  this._startTime = 0;
88158
88160
  // Delay
88159
88161
  var theme = this.theme;
@@ -88176,12 +88178,13 @@ var DIndicatorProcessing = /** @class */ (function () {
88176
88178
  }
88177
88179
  DIndicatorProcessing.prototype.start = function () {
88178
88180
  var state = this._state;
88179
- if (state === STATE_INITIAL) {
88180
- this._state = STATE_STARTED;
88181
+ if (state === DIndicatorProcessingState.INITIAL) {
88182
+ this._state = DIndicatorProcessingState.STARTED;
88181
88183
  this.onBegin();
88182
88184
  }
88183
- else if (state === STATE_RESOLVED || state === STATE_REJECTED) {
88184
- this._state = STATE_STARTED;
88185
+ else if (state === DIndicatorProcessingState.RESOLVED ||
88186
+ state === DIndicatorProcessingState.REJECTED) {
88187
+ this._state = DIndicatorProcessingState.STARTED;
88185
88188
  this.onEnd();
88186
88189
  this.onBegin();
88187
88190
  }
@@ -88232,8 +88235,10 @@ var DIndicatorProcessing = /** @class */ (function () {
88232
88235
  };
88233
88236
  DIndicatorProcessing.prototype.end = function () {
88234
88237
  var state = this._state;
88235
- if (state === STATE_STARTED || state === STATE_RESOLVED || state === STATE_REJECTED) {
88236
- this._state = STATE_INITIAL;
88238
+ if (state === DIndicatorProcessingState.STARTED ||
88239
+ state === DIndicatorProcessingState.RESOLVED ||
88240
+ state === DIndicatorProcessingState.REJECTED) {
88241
+ this._state = DIndicatorProcessingState.INITIAL;
88237
88242
  this.onEnd();
88238
88243
  }
88239
88244
  return this;
@@ -88269,8 +88274,8 @@ var DIndicatorProcessing = /** @class */ (function () {
88269
88274
  };
88270
88275
  DIndicatorProcessing.prototype.resolve = function (message) {
88271
88276
  var _this = this;
88272
- if (this._state === STATE_STARTED) {
88273
- this._state = STATE_RESOLVED;
88277
+ if (this._state === DIndicatorProcessingState.STARTED) {
88278
+ this._state = DIndicatorProcessingState.RESOLVED;
88274
88279
  var elapsedTime = Date.now() - this._startTime;
88275
88280
  var delay = this._delayDone - elapsedTime;
88276
88281
  if (0 < delay) {
@@ -88302,8 +88307,8 @@ var DIndicatorProcessing = /** @class */ (function () {
88302
88307
  };
88303
88308
  DIndicatorProcessing.prototype.reject = function (message) {
88304
88309
  var _this = this;
88305
- if (this._state === STATE_STARTED) {
88306
- this._state = STATE_REJECTED;
88310
+ if (this._state === DIndicatorProcessingState.STARTED) {
88311
+ this._state = DIndicatorProcessingState.REJECTED;
88307
88312
  var elapsedTime = Date.now() - this._startTime;
88308
88313
  var delay = this._delayDone - elapsedTime;
88309
88314
  if (0 < delay) {
@@ -89921,7 +89926,7 @@ var DPagination = /** @class */ (function (_super) {
89921
89926
  };
89922
89927
  /**
89923
89928
  * Goes to the last page.
89924
- * Unlike {@link #value}, this method emits the change event if silently is not true.
89929
+ * Unlike {@link value}, this method emits the change event if silently is not true.
89925
89930
  *
89926
89931
  * @param silently true to suppress the change event
89927
89932
  * @returns true if succeeded.
@@ -89931,7 +89936,7 @@ var DPagination = /** @class */ (function (_super) {
89931
89936
  };
89932
89937
  /**
89933
89938
  * Goes to the given page.
89934
- * Unlike {@link #value}, this method emits the change event if silently is not true.
89939
+ * Unlike {@link value}, this method emits the change event if silently is not true.
89935
89940
  *
89936
89941
  * @param index a page index
89937
89942
  * @param silently true to suppress the change event
@@ -89980,7 +89985,7 @@ var DPagination = /** @class */ (function (_super) {
89980
89985
  };
89981
89986
  /**
89982
89987
  * Goes to the next page.
89983
- * Unlike {@link #value}, this method emits the change event if silently is not true.
89988
+ * Unlike {@link value}, this method emits the change event if silently is not true.
89984
89989
  *
89985
89990
  * @param silently true to suppress the change event
89986
89991
  * @returns true if succeeded.
@@ -90018,7 +90023,7 @@ var DPagination = /** @class */ (function (_super) {
90018
90023
  };
90019
90024
  /**
90020
90025
  * Goes to the previous page.
90021
- * Unlike {@link #value}, this method emits the change event if silently is not true.
90026
+ * Unlike {@link value}, this method emits the change event if silently is not true.
90022
90027
  *
90023
90028
  * @param silently true to suppress the change event
90024
90029
  * @returns true if succeeded.
@@ -90056,7 +90061,7 @@ var DPagination = /** @class */ (function (_super) {
90056
90061
  };
90057
90062
  /**
90058
90063
  * Goes to the top page.
90059
- * Unlike {@link #value}, this method emits the change event if silently is not true.
90064
+ * Unlike {@link value}, this method emits the change event if silently is not true.
90060
90065
  *
90061
90066
  * @param silently true to suppress the change event
90062
90067
  * @returns true if succeeded.
@@ -95268,6 +95273,224 @@ var DTableCategoryCell = /** @class */ (function (_super) {
95268
95273
  return DTableCategoryCell;
95269
95274
  }(DImage));
95270
95275
 
95276
+ /*
95277
+ * Copyright (C) 2019 Toshiba Corporation
95278
+ * SPDX-License-Identifier: Apache-2.0
95279
+ */
95280
+ var DTableCategoryColumnImpl = /** @class */ (function (_super) {
95281
+ __extends(DTableCategoryColumnImpl, _super);
95282
+ function DTableCategoryColumnImpl(index, column) {
95283
+ var _this = _super.call(this) || this;
95284
+ // Label
95285
+ var category = column.category;
95286
+ if (category) {
95287
+ if (isString(category)) {
95288
+ if (index === 0) {
95289
+ _this.label = category;
95290
+ }
95291
+ }
95292
+ else {
95293
+ if (index < category.length) {
95294
+ _this.label = category[index];
95295
+ }
95296
+ }
95297
+ }
95298
+ _this._weight = column.weight;
95299
+ _this._width = column.width;
95300
+ _this._isLocked = false;
95301
+ _this.offset = 0.0;
95302
+ _this._columns = [column];
95303
+ _this._nresizable = column.resizable ? 1 : 0;
95304
+ var onResizeBound = function () {
95305
+ _this.onResize();
95306
+ };
95307
+ _this._onResizeBound = onResizeBound;
95308
+ column.on("resize", onResizeBound);
95309
+ return _this;
95310
+ }
95311
+ DTableCategoryColumnImpl.prototype.onResize = function () {
95312
+ if (this._isLocked) {
95313
+ return;
95314
+ }
95315
+ var columns = this._columns;
95316
+ if (this._weight != null) {
95317
+ var newWeight = 0;
95318
+ for (var i = 0, imax = columns.length; i < imax; ++i) {
95319
+ var weight = columns[i].weight;
95320
+ if (weight != null) {
95321
+ newWeight += weight;
95322
+ }
95323
+ }
95324
+ if (this._weight !== newWeight) {
95325
+ this._weight = newWeight;
95326
+ this.emit("resize", this);
95327
+ }
95328
+ }
95329
+ else {
95330
+ var newWidth = 0;
95331
+ for (var i = 0, imax = columns.length; i < imax; ++i) {
95332
+ var width = columns[i].width;
95333
+ if (width != null) {
95334
+ newWidth += width;
95335
+ }
95336
+ }
95337
+ if (this._width !== newWidth) {
95338
+ this._width = newWidth;
95339
+ this.emit("resize", this);
95340
+ }
95341
+ }
95342
+ };
95343
+ Object.defineProperty(DTableCategoryColumnImpl.prototype, "resizable", {
95344
+ get: function () {
95345
+ return 0 < this._nresizable;
95346
+ },
95347
+ enumerable: false,
95348
+ configurable: true
95349
+ });
95350
+ Object.defineProperty(DTableCategoryColumnImpl.prototype, "weight", {
95351
+ get: function () {
95352
+ return this._weight;
95353
+ },
95354
+ set: function (weight) {
95355
+ var oldWeight = this._weight;
95356
+ var nresizable = this._nresizable;
95357
+ if (0 < nresizable && oldWeight != null && oldWeight !== weight) {
95358
+ var columns = this._columns;
95359
+ var columnsLength = columns.length;
95360
+ var minWeight = this.minWeight;
95361
+ var newWeight = Math.max(minWeight, weight);
95362
+ if (this._weight !== newWeight) {
95363
+ this._isLocked = true;
95364
+ if (minWeight < oldWeight) {
95365
+ var columnWeightRatio = (newWeight - minWeight) / (oldWeight - minWeight);
95366
+ for (var i = 0; i < columnsLength; ++i) {
95367
+ var column = columns[i];
95368
+ var columnWeight = column.weight;
95369
+ if (column.resizable && columnWeight != null) {
95370
+ column.weight = columnWeight * columnWeightRatio;
95371
+ }
95372
+ }
95373
+ }
95374
+ else {
95375
+ var newColumnWeight = (newWeight - minWeight) / this._nresizable;
95376
+ for (var i = 0; i < columnsLength; ++i) {
95377
+ var column = columns[i];
95378
+ var columnWeight = column.weight;
95379
+ if (column.resizable && columnWeight != null) {
95380
+ column.weight = newColumnWeight;
95381
+ }
95382
+ }
95383
+ }
95384
+ this._isLocked = false;
95385
+ this.onResize();
95386
+ }
95387
+ }
95388
+ },
95389
+ enumerable: false,
95390
+ configurable: true
95391
+ });
95392
+ Object.defineProperty(DTableCategoryColumnImpl.prototype, "minWeight", {
95393
+ get: function () {
95394
+ var result = 0;
95395
+ var columns = this._columns;
95396
+ var columnsLength = columns.length;
95397
+ for (var i = 0; i < columnsLength; ++i) {
95398
+ var column = columns[i];
95399
+ var columnWeight = column.weight;
95400
+ if (!column.resizable && columnWeight != null) {
95401
+ result += columnWeight;
95402
+ }
95403
+ }
95404
+ return result;
95405
+ },
95406
+ enumerable: false,
95407
+ configurable: true
95408
+ });
95409
+ Object.defineProperty(DTableCategoryColumnImpl.prototype, "width", {
95410
+ get: function () {
95411
+ return this._width;
95412
+ },
95413
+ set: function (width) {
95414
+ var oldWidth = this._width;
95415
+ var nresizable = this._nresizable;
95416
+ if (0 < nresizable && oldWidth != null && oldWidth !== width) {
95417
+ var columns = this._columns;
95418
+ var columnsLength = columns.length;
95419
+ var minWidth = this.minWidth;
95420
+ var newWidth = Math.max(minWidth, width);
95421
+ if (oldWidth !== newWidth) {
95422
+ this._isLocked = true;
95423
+ if (minWidth < oldWidth) {
95424
+ var columnWidthRatio = (newWidth - minWidth) / (oldWidth - minWidth);
95425
+ for (var i = 0; i < columnsLength; ++i) {
95426
+ var column = columns[i];
95427
+ var columnWidth = column.width;
95428
+ if (column.resizable && columnWidth != null) {
95429
+ column.width = columnWidth * columnWidthRatio;
95430
+ }
95431
+ }
95432
+ }
95433
+ else {
95434
+ var newColumnWidth = (newWidth - minWidth) / this._nresizable;
95435
+ for (var i = 0; i < columnsLength; ++i) {
95436
+ var column = columns[i];
95437
+ var columnWidth = column.width;
95438
+ if (column.resizable && columnWidth != null) {
95439
+ column.width = newColumnWidth;
95440
+ }
95441
+ }
95442
+ }
95443
+ this._isLocked = false;
95444
+ this.onResize();
95445
+ }
95446
+ }
95447
+ },
95448
+ enumerable: false,
95449
+ configurable: true
95450
+ });
95451
+ Object.defineProperty(DTableCategoryColumnImpl.prototype, "minWidth", {
95452
+ get: function () {
95453
+ var result = 0;
95454
+ var columns = this._columns;
95455
+ var columnsLength = columns.length;
95456
+ for (var i = 0; i < columnsLength; ++i) {
95457
+ var column = columns[i];
95458
+ var columnWidth = column.width;
95459
+ if (!column.resizable && columnWidth != null) {
95460
+ result += columnWidth;
95461
+ }
95462
+ }
95463
+ return result;
95464
+ },
95465
+ enumerable: false,
95466
+ configurable: true
95467
+ });
95468
+ DTableCategoryColumnImpl.prototype.add = function (column) {
95469
+ this._columns.push(column);
95470
+ if (this._weight != null) {
95471
+ var weight = column.weight;
95472
+ if (weight != null) {
95473
+ this._weight += weight;
95474
+ if (column.resizable) {
95475
+ this._nresizable += 1;
95476
+ }
95477
+ column.on("resize", this._onResizeBound);
95478
+ }
95479
+ }
95480
+ else if (this._width != null) {
95481
+ var width = column.width;
95482
+ if (width != null) {
95483
+ this._width += width;
95484
+ if (column.resizable) {
95485
+ this._nresizable += 1;
95486
+ }
95487
+ column.on("resize", this._onResizeBound);
95488
+ }
95489
+ }
95490
+ };
95491
+ return DTableCategoryColumnImpl;
95492
+ }(pixi_js.utils.EventEmitter));
95493
+
95271
95494
  /*
95272
95495
  * Copyright (C) 2019 Toshiba Corporation
95273
95496
  * SPDX-License-Identifier: Apache-2.0
@@ -95366,403 +95589,1034 @@ var DTableCategory = /** @class */ (function (_super) {
95366
95589
  return DTableCategory;
95367
95590
  }(DTableRow));
95368
95591
 
95369
- /*
95370
- * Copyright (C) 2019 Toshiba Corporation
95371
- * SPDX-License-Identifier: Apache-2.0
95372
- */
95373
- var DTableDataTreeFilter = /** @class */ (function (_super) {
95374
- __extends(DTableDataTreeFilter, _super);
95375
- function DTableDataTreeFilter(parent) {
95376
- var _this = _super.call(this) || this;
95377
- _this._id = 0;
95378
- _this._idUpdated = -1;
95379
- _this._isApplied = false;
95380
- _this._parent = parent;
95381
- _this._filter = null;
95382
- _this._filtered = null;
95383
- return _this;
95384
- }
95385
- Object.defineProperty(DTableDataTreeFilter.prototype, "id", {
95386
- get: function () {
95387
- return this._id;
95388
- },
95389
- enumerable: false,
95390
- configurable: true
95391
- });
95392
- DTableDataTreeFilter.prototype.apply = function () {
95393
- this._isApplied = true;
95394
- this._id += 1;
95395
- this._parent.update();
95396
- };
95397
- DTableDataTreeFilter.prototype.unapply = function () {
95398
- if (this._isApplied) {
95399
- this._isApplied = false;
95400
- this._id += 1;
95401
- this._parent.update();
95402
- }
95403
- };
95404
- DTableDataTreeFilter.prototype.isApplied = function () {
95405
- return this._isApplied;
95406
- };
95407
- DTableDataTreeFilter.prototype.isFiltered = function (node, index, filter) {
95408
- if (isFunction(filter)) {
95409
- return filter(node, index);
95410
- }
95411
- else {
95412
- return filter.test(node, index);
95413
- }
95414
- };
95415
- DTableDataTreeFilter.prototype.hasFiltered = function (parent, nodes, filter) {
95416
- var accessor = this._parent.accessor;
95417
- var toChildren = accessor.toChildren;
95418
- var hasChildren = accessor.hasChildren;
95419
- for (var i = 0, imax = nodes.length; i < imax; ++i) {
95420
- var node = nodes[i];
95421
- if (this.isFiltered(node, -1, filter)) {
95422
- return true;
95423
- }
95424
- var children = toChildren(node);
95425
- if (hasChildren(node, children) && this.hasFiltered(parent, children, filter)) {
95426
- return true;
95427
- }
95592
+ var DTableCategoryContainerImpl = /** @class */ (function () {
95593
+ function DTableCategoryContainerImpl(columns, frozen, options) {
95594
+ var count = this.toCount(columns);
95595
+ var items = [];
95596
+ var offset = 0;
95597
+ for (var i = count - 1; 0 <= i; --i) {
95598
+ var item = new DTableCategory(this.toColumns(i, columns, frozen), frozen, offset, options);
95599
+ items.push(item);
95600
+ offset += item.height;
95428
95601
  }
95429
- return false;
95430
- };
95431
- DTableDataTreeFilter.prototype.addAllToFiltered = function (parent, nodes, filtered, cursor) {
95432
- var accessor = this._parent.accessor;
95433
- var toChildren = accessor.toChildren;
95434
- var hasChildren = accessor.hasChildren;
95435
- for (var i = 0, imax = nodes.length; i < imax; ++i) {
95436
- var node = nodes[i];
95437
- filtered.push(cursor[0]);
95438
- cursor[0] += 1;
95439
- var children = toChildren(node);
95440
- if (hasChildren(node, children) && parent.isOpened(node)) {
95441
- this.addAllToFiltered(parent, children, filtered, cursor);
95602
+ this.items = items;
95603
+ }
95604
+ DTableCategoryContainerImpl.prototype.toCount = function (columns) {
95605
+ var result = 0;
95606
+ for (var i = 0, imax = columns.length; i < imax; ++i) {
95607
+ var category = columns[i].category;
95608
+ if (category != null) {
95609
+ var count = isString(category) ? 1 : category.length;
95610
+ result = Math.max(result, count);
95442
95611
  }
95443
95612
  }
95613
+ return result;
95444
95614
  };
95445
- DTableDataTreeFilter.prototype.newFilteredSub = function (parent, nodes, filter, filtered, cursor) {
95446
- var result = false;
95447
- var accessor = this._parent.accessor;
95448
- var toChildren = accessor.toChildren;
95449
- var hasChildren = accessor.hasChildren;
95450
- for (var i = 0, imax = nodes.length; i < imax; ++i) {
95451
- var node = nodes[i];
95452
- var index = cursor[0];
95453
- cursor[0] += 1;
95454
- var isFiltered = this.isFiltered(node, index, filter);
95455
- var children = toChildren(node);
95456
- if (hasChildren(node, children)) {
95457
- if (parent.isOpened(node)) {
95458
- if (isFiltered) {
95459
- filtered.push(index);
95460
- result = true;
95461
- this.addAllToFiltered(parent, children, filtered, cursor);
95615
+ DTableCategoryContainerImpl.prototype.isCategory = function (index, a, b) {
95616
+ if (a != null) {
95617
+ if (b != null) {
95618
+ if (isString(a)) {
95619
+ if (isString(b)) {
95620
+ if (0 < index) {
95621
+ return true;
95622
+ }
95623
+ else {
95624
+ return a === b;
95625
+ }
95462
95626
  }
95463
95627
  else {
95464
- var position = filtered.length;
95465
- if (this.newFilteredSub(parent, children, filter, filtered, cursor)) {
95466
- filtered.splice(position, 0, index);
95467
- result = true;
95628
+ if (0 < index) {
95629
+ return b.length <= index;
95630
+ }
95631
+ else {
95632
+ return b.length === 1 && a === b[0];
95468
95633
  }
95469
95634
  }
95470
95635
  }
95471
- else if (isFiltered || this.hasFiltered(parent, children, filter)) {
95472
- filtered.push(index);
95473
- result = true;
95636
+ else {
95637
+ if (isString(b)) {
95638
+ if (0 < index) {
95639
+ return a.length <= index;
95640
+ }
95641
+ else {
95642
+ return a.length === 1 && a[0] === b;
95643
+ }
95644
+ }
95645
+ else {
95646
+ if (a.length <= index && b.length <= index) {
95647
+ return true;
95648
+ }
95649
+ else if (b.length === a.length) {
95650
+ for (var i = index, imax = a.length; i < imax; ++i) {
95651
+ if (a[i] !== b[i]) {
95652
+ return false;
95653
+ }
95654
+ }
95655
+ return true;
95656
+ }
95657
+ return false;
95658
+ }
95474
95659
  }
95475
95660
  }
95476
- else if (isFiltered) {
95477
- filtered.push(index);
95478
- result = true;
95479
- }
95480
- }
95481
- return result;
95482
- };
95483
- DTableDataTreeFilter.prototype.newFiltered = function () {
95484
- var filter = this._filter;
95485
- if (filter != null) {
95486
- var filtered = [];
95487
- var parent_1 = this._parent;
95488
- var nodes = parent_1.nodes;
95489
- if (nodes) {
95490
- var cursor = [0];
95491
- this.newFilteredSub(parent_1, nodes, filter, filtered, cursor);
95661
+ else {
95662
+ if (isString(a)) {
95663
+ if (0 < index) {
95664
+ return true;
95665
+ }
95666
+ else {
95667
+ return false;
95668
+ }
95669
+ }
95670
+ else {
95671
+ if (a.length <= index) {
95672
+ return true;
95673
+ }
95674
+ else {
95675
+ return false;
95676
+ }
95677
+ }
95492
95678
  }
95493
- return filtered;
95494
- }
95495
- return null;
95496
- };
95497
- DTableDataTreeFilter.prototype.get = function () {
95498
- return this._filter;
95499
- };
95500
- DTableDataTreeFilter.prototype.set = function (filter) {
95501
- if (this._filter !== filter) {
95502
- this._filter = filter;
95503
95679
  }
95504
- };
95505
- DTableDataTreeFilter.prototype.toDirty = function () {
95506
- this._id += 1;
95507
- };
95508
- DTableDataTreeFilter.prototype.update = function () {
95509
- if (this._id !== this._idUpdated) {
95510
- this._idUpdated = this._id;
95511
- if (this._isApplied) {
95512
- this._filtered = this.newFiltered();
95513
- this.emit("change", this);
95680
+ else {
95681
+ if (b != null) {
95682
+ if (isString(b)) {
95683
+ if (0 < index) {
95684
+ return true;
95685
+ }
95686
+ else {
95687
+ return false;
95688
+ }
95689
+ }
95690
+ else {
95691
+ if (b.length <= index) {
95692
+ return true;
95693
+ }
95694
+ else {
95695
+ return false;
95696
+ }
95697
+ }
95514
95698
  }
95515
- else if (this._filtered != null) {
95516
- this._filtered = null;
95517
- this.emit("change", this);
95699
+ else {
95700
+ return true;
95518
95701
  }
95519
95702
  }
95520
95703
  };
95521
- Object.defineProperty(DTableDataTreeFilter.prototype, "indices", {
95522
- get: function () {
95523
- this.update();
95524
- return this._filtered;
95525
- },
95526
- enumerable: false,
95527
- configurable: true
95528
- });
95529
- DTableDataTreeFilter.prototype.map = function (sortedIndex) {
95530
- var result = sortedIndex;
95531
- var indices = this.indices;
95532
- if (indices) {
95533
- var index = indices.indexOf(result);
95534
- if (0 <= index) {
95535
- result = index;
95704
+ DTableCategoryContainerImpl.prototype.toColumns = function (index, columns, frozen) {
95705
+ var result = [];
95706
+ var tcolumn = null;
95707
+ var ccolumn = null;
95708
+ for (var i = 0, imax = columns.length; i < imax; ++i) {
95709
+ var column = columns[i];
95710
+ if (i !== frozen &&
95711
+ ccolumn &&
95712
+ tcolumn &&
95713
+ this.isCategory(index, tcolumn.category, column.category)) {
95714
+ if (ccolumn.weight != null && column.weight != null) {
95715
+ ccolumn.add(column);
95716
+ }
95717
+ else if (ccolumn.width != null && column.width != null) {
95718
+ ccolumn.add(column);
95719
+ }
95720
+ else {
95721
+ tcolumn = column;
95722
+ ccolumn = new DTableCategoryColumnImpl(index, column);
95723
+ result.push(ccolumn);
95724
+ }
95536
95725
  }
95537
95726
  else {
95538
- return null;
95727
+ tcolumn = column;
95728
+ ccolumn = new DTableCategoryColumnImpl(index, column);
95729
+ result.push(ccolumn);
95539
95730
  }
95540
95731
  }
95541
95732
  return result;
95542
95733
  };
95543
- DTableDataTreeFilter.prototype.unmap = function (index) {
95544
- var result = index;
95545
- var indices = this.indices;
95546
- if (indices) {
95547
- result = indices[result];
95548
- }
95549
- return result;
95550
- };
95551
- return DTableDataTreeFilter;
95552
- }(pixi_js.utils.EventEmitter));
95734
+ return DTableCategoryContainerImpl;
95735
+ }());
95553
95736
 
95554
- /*
95555
- * Copyright (C) 2021 Toshiba Corporation
95556
- * SPDX-License-Identifier: Apache-2.0
95557
- */
95558
- var toParent = function (node) {
95559
- return node.parent;
95560
- };
95561
- var toChildren$1 = function (node) {
95562
- return node.children;
95737
+ var defaultGetter = function (row, columnIndex) {
95738
+ return row[columnIndex];
95563
95739
  };
95564
- var hasChildren = function (node, children) {
95565
- return children != null && 0 < children.length;
95740
+ var defaultSetter = function (row, columnIndex, cell) {
95741
+ row[columnIndex] = cell;
95566
95742
  };
95567
- var DTableDataTreeItemAccessor = /** @class */ (function () {
95568
- function DTableDataTreeItemAccessor(options) {
95569
- if (options != null) {
95570
- this.toParent = options.toParent || toParent;
95571
- this.toChildren = options.toChildren || toChildren$1;
95572
- this.hasChildren = options.hasChildren || hasChildren;
95743
+ var defaultGetterEmpty = function () { return ""; };
95744
+ var defaultSetterEmpty = function () {
95745
+ // DO NOTHING
95746
+ };
95747
+ var toPathGetter = function (path, def) {
95748
+ if (path.length <= 1) {
95749
+ var key_1 = path[0];
95750
+ if (def === undefined) {
95751
+ return function (row) {
95752
+ return row[key_1];
95753
+ };
95573
95754
  }
95574
95755
  else {
95575
- this.toParent = toParent;
95576
- this.toChildren = toChildren$1;
95577
- this.hasChildren = hasChildren;
95756
+ return function (row) {
95757
+ return Object.prototype.hasOwnProperty.call(row, key_1) ? row[key_1] : def;
95758
+ };
95578
95759
  }
95579
95760
  }
95580
- return DTableDataTreeItemAccessor;
95581
- }());
95582
-
95583
- /*
95584
- * Copyright (C) 2021 Toshiba Corporation
95585
- * SPDX-License-Identifier: Apache-2.0
95586
- */
95587
- var COMPARATOR = function (a, b) {
95588
- return a[0] - b[0];
95589
- };
95590
- var DTableDataTreeSelectionImpl = /** @class */ (function (_super) {
95591
- __extends(DTableDataTreeSelectionImpl, _super);
95592
- function DTableDataTreeSelectionImpl(parent, options) {
95593
- var _a;
95594
- var _this = _super.call(this) || this;
95595
- _this._parent = parent;
95596
- _this._type = toEnum((_a = options === null || options === void 0 ? void 0 : options.type) !== null && _a !== void 0 ? _a : DTableDataSelectionType.NONE, DTableDataSelectionType);
95597
- _this._rows = new Set();
95598
- // Events
95599
- var on = options === null || options === void 0 ? void 0 : options.on;
95600
- if (on) {
95601
- for (var name_1 in on) {
95602
- var handler = on[name_1];
95603
- if (handler) {
95604
- _this.on(name_1, handler);
95761
+ else {
95762
+ if (def === undefined) {
95763
+ return function (row) {
95764
+ for (var i = 0, imax = path.length - 1; i < imax; ++i) {
95765
+ row = row[path[i]];
95605
95766
  }
95606
- }
95767
+ return row[path[path.length - 1]];
95768
+ };
95769
+ }
95770
+ else {
95771
+ return function (row) {
95772
+ for (var i = 0, imax = path.length - 1; i < imax; ++i) {
95773
+ row = row[path[i]];
95774
+ }
95775
+ var key = path[path.length - 1];
95776
+ return Object.prototype.hasOwnProperty.call(row, key) ? row[key] : def;
95777
+ };
95607
95778
  }
95608
- return _this;
95609
95779
  }
95610
- Object.defineProperty(DTableDataTreeSelectionImpl.prototype, "parent", {
95611
- get: function () {
95612
- return this._parent;
95613
- },
95614
- enumerable: false,
95615
- configurable: true
95616
- });
95617
- DTableDataTreeSelectionImpl.prototype.onNodeChange = function (nodes) {
95618
- if (nodes != null) {
95619
- var accessor = this._parent.accessor;
95620
- var toChildren = accessor.toChildren;
95621
- var hasChildren = accessor.hasChildren;
95622
- var oldRows = this._rows;
95623
- var newRows = this.newRows(nodes, toChildren, hasChildren, oldRows, new Set());
95624
- if (oldRows.size !== newRows.size) {
95625
- this._rows = newRows;
95626
- this.onChange();
95780
+ };
95781
+ var toPathSetter = function (path) {
95782
+ if (path.length <= 1) {
95783
+ var key_2 = path[0];
95784
+ return function (row, columnIndex, cell) {
95785
+ row[key_2] = cell;
95786
+ };
95787
+ }
95788
+ else {
95789
+ return function (row, columnIndex, cell) {
95790
+ for (var i = 0, imax = path.length - 1; i < imax; ++i) {
95791
+ row = row[path[i]] || {};
95627
95792
  }
95793
+ row[path[path.length - 1]] = cell;
95794
+ };
95795
+ }
95796
+ };
95797
+ var toAlign = function (options, type) {
95798
+ var align = options.align;
95799
+ if (align != null) {
95800
+ if (isString(align)) {
95801
+ return DAlignHorizontal[align];
95628
95802
  }
95629
95803
  else {
95630
- var rows = this._rows;
95631
- if (0 < rows.size) {
95632
- rows.clear();
95633
- this.onChange();
95634
- }
95804
+ return align;
95635
95805
  }
95636
- };
95637
- DTableDataTreeSelectionImpl.prototype.newRows = function (nodes, toChildren, hasChildren, rows, result) {
95638
- for (var i = 0, imax = nodes.length; i < imax; ++i) {
95639
- var node = nodes[i];
95640
- if (rows.has(node)) {
95641
- result.add(node);
95642
- }
95643
- var children = toChildren(node);
95644
- if (hasChildren(node, children)) {
95645
- this.newRows(children, toChildren, hasChildren, rows, result);
95646
- }
95806
+ }
95807
+ switch (type) {
95808
+ case DTableColumnType.TEXT:
95809
+ case DTableColumnType.TEXT_AREA:
95810
+ return DAlignHorizontal.LEFT;
95811
+ case DTableColumnType.REAL:
95812
+ case DTableColumnType.INTEGER:
95813
+ return DAlignHorizontal.RIGHT;
95814
+ case DTableColumnType.BUTTON:
95815
+ case DTableColumnType.INDEX:
95816
+ case DTableColumnType.SELECT:
95817
+ case DTableColumnType.ACTION:
95818
+ case DTableColumnType.LINK:
95819
+ case DTableColumnType.CHECK:
95820
+ case DTableColumnType.CHECK_SINGLE:
95821
+ case DTableColumnType.COLOR:
95822
+ return DAlignHorizontal.CENTER;
95823
+ default:
95824
+ return DAlignHorizontal.LEFT;
95825
+ }
95826
+ };
95827
+ var toDataChecker = function (path) {
95828
+ if (path != null) {
95829
+ var pathLength_1 = path.length;
95830
+ if (pathLength_1 <= 1) {
95831
+ var key_3 = path[0];
95832
+ return function (row) {
95833
+ return Object.prototype.hasOwnProperty.call(row, key_3);
95834
+ };
95647
95835
  }
95648
- return result;
95649
- };
95650
- Object.defineProperty(DTableDataTreeSelectionImpl.prototype, "indices", {
95651
- get: function () {
95652
- var rows = this._rows;
95653
- var result = [];
95654
- this._parent.each(function (row, index) {
95655
- if (rows.has(row)) {
95656
- result.push(index);
95657
- }
95658
- });
95659
- return result;
95660
- },
95661
- enumerable: false,
95662
- configurable: true
95663
- });
95664
- Object.defineProperty(DTableDataTreeSelectionImpl.prototype, "rows", {
95665
- get: function () {
95666
- var result = [];
95667
- this._rows.forEach(function (row) {
95668
- result.push(row);
95669
- });
95670
- return result;
95671
- },
95672
- enumerable: false,
95673
- configurable: true
95674
- });
95675
- Object.defineProperty(DTableDataTreeSelectionImpl.prototype, "type", {
95676
- get: function () {
95677
- return this._type;
95678
- },
95679
- enumerable: false,
95680
- configurable: true
95681
- });
95682
- DTableDataTreeSelectionImpl.prototype.getFirst = function () {
95683
- var rows = this._rows;
95684
- if (0 < rows.size) {
95685
- var result_1 = null;
95686
- rows.forEach(function (row) {
95687
- if (result_1 == null) {
95688
- result_1 = row;
95836
+ else {
95837
+ return function (row) {
95838
+ for (var i = 0; i < pathLength_1; ++i) {
95839
+ var part = path[i];
95840
+ if (part in row) {
95841
+ row = row[part];
95842
+ }
95843
+ else {
95844
+ return false;
95845
+ }
95689
95846
  }
95690
- });
95691
- return result_1;
95847
+ return true;
95848
+ };
95692
95849
  }
95693
- return null;
95850
+ }
95851
+ return function (row, columnIndex) {
95852
+ return columnIndex < row.length;
95694
95853
  };
95695
- DTableDataTreeSelectionImpl.prototype.getLast = function () {
95696
- var rows = this._rows;
95697
- if (0 < rows.size) {
95698
- var result_2 = null;
95699
- rows.forEach(function (row) {
95700
- result_2 = row;
95701
- });
95702
- return result_2;
95854
+ };
95855
+ var toEditingEnable = function (enable, path) {
95856
+ if (isString(enable)) {
95857
+ return toDataChecker(path);
95858
+ }
95859
+ else if (enable != null) {
95860
+ return enable;
95861
+ }
95862
+ else {
95863
+ return false;
95864
+ }
95865
+ };
95866
+ var toEditing = function (options, path) {
95867
+ var _a;
95868
+ var editing = options.editing;
95869
+ var editable = options.editable;
95870
+ if (editing) {
95871
+ return {
95872
+ enable: toEditingEnable((_a = editing.enable) !== null && _a !== void 0 ? _a : editable, path),
95873
+ formatter: editing.formatter,
95874
+ unformatter: editing.unformatter,
95875
+ validator: editing.validator
95876
+ };
95877
+ }
95878
+ return {
95879
+ enable: toEditingEnable(editable, path)
95880
+ };
95881
+ };
95882
+ var toComparator = function (getter, index) {
95883
+ return function (rowA, rowB) {
95884
+ var valueA = getter(rowA, index);
95885
+ var valueB = getter(rowB, index);
95886
+ return valueA < valueB ? -1 : valueB < valueA ? +1 : 0;
95887
+ };
95888
+ };
95889
+ var toSorting = function (getter, index, options) {
95890
+ var sorting = options.sorting;
95891
+ var sortable = options.sortable;
95892
+ if (sorting) {
95893
+ if (sorting.enable || sortable) {
95894
+ return {
95895
+ enable: true,
95896
+ comparator: sorting.comparator || toComparator(getter, index)
95897
+ };
95703
95898
  }
95704
- return null;
95899
+ return {
95900
+ enable: false
95901
+ };
95902
+ }
95903
+ if (sortable) {
95904
+ return {
95905
+ enable: true,
95906
+ comparator: toComparator(getter, index)
95907
+ };
95908
+ }
95909
+ return {
95910
+ enable: false
95705
95911
  };
95706
- DTableDataTreeSelectionImpl.prototype.toIndex = function (target) {
95707
- var result = null;
95708
- this._parent.each(function (row, index) {
95709
- if (target === row) {
95710
- result = index;
95711
- return false;
95912
+ };
95913
+ var toMenu = function (options) {
95914
+ if (options == null) {
95915
+ return undefined;
95916
+ }
95917
+ else if (options instanceof DMenu) {
95918
+ return options;
95919
+ }
95920
+ else {
95921
+ return new DMenu(options);
95922
+ }
95923
+ };
95924
+ var toDialog = function (options) {
95925
+ if (options == null) {
95926
+ return undefined;
95927
+ }
95928
+ else if ("open" in options) {
95929
+ return options;
95930
+ }
95931
+ else {
95932
+ return new DDialogSelect(options);
95933
+ }
95934
+ };
95935
+ var defaultSelectingGetter = function (dialog) {
95936
+ return dialog.value;
95937
+ };
95938
+ var defaultSelectingSetter = function () {
95939
+ // DO NOTHING
95940
+ };
95941
+ var toSelecting = function (options) {
95942
+ if (options) {
95943
+ return {
95944
+ getter: options.getter || defaultSelectingGetter,
95945
+ setter: options.setter || defaultSelectingSetter,
95946
+ menu: toMenu(options.menu),
95947
+ multiple: toMenu(options.multiple),
95948
+ dialog: toDialog(options.dialog),
95949
+ promise: options.promise
95950
+ };
95951
+ }
95952
+ return {
95953
+ getter: defaultSelectingGetter,
95954
+ setter: defaultSelectingSetter
95955
+ };
95956
+ };
95957
+ var toGetter = function (options, type, parts) {
95958
+ var getter = options.getter;
95959
+ if (getter) {
95960
+ return getter;
95961
+ }
95962
+ switch (type) {
95963
+ case DTableColumnType.ACTION:
95964
+ case DTableColumnType.LINK:
95965
+ return defaultGetterEmpty;
95966
+ default:
95967
+ if (parts == null) {
95968
+ return defaultGetter;
95712
95969
  }
95713
- return true;
95714
- });
95715
- return result;
95970
+ else {
95971
+ return toPathGetter(parts, options.default);
95972
+ }
95973
+ }
95974
+ };
95975
+ var toSetter = function (options, type, path) {
95976
+ var setter = options.setter;
95977
+ if (setter) {
95978
+ return setter;
95979
+ }
95980
+ switch (type) {
95981
+ case DTableColumnType.BUTTON:
95982
+ case DTableColumnType.ACTION:
95983
+ case DTableColumnType.LINK:
95984
+ return defaultSetterEmpty;
95985
+ default:
95986
+ if (path == null) {
95987
+ return defaultSetter;
95988
+ }
95989
+ else {
95990
+ return toPathSetter(path);
95991
+ }
95992
+ }
95993
+ };
95994
+ var toState = function (options) {
95995
+ var state = options.state;
95996
+ if (state != null) {
95997
+ if (isString(state) || isArray(state)) {
95998
+ return {
95999
+ initial: state,
96000
+ modifier: undefined
96001
+ };
96002
+ }
96003
+ else {
96004
+ return {
96005
+ initial: undefined,
96006
+ modifier: state
96007
+ };
96008
+ }
96009
+ }
96010
+ return {
96011
+ initial: undefined,
96012
+ modifier: undefined
95716
96013
  };
95717
- Object.defineProperty(DTableDataTreeSelectionImpl.prototype, "first", {
96014
+ };
96015
+ var toPath = function (options) {
96016
+ return options.path != null ? options.path.split(".") : null;
96017
+ };
96018
+ var toRenderable = function (options, path) {
96019
+ var renderable = options.renderable;
96020
+ if (isString(renderable)) {
96021
+ return toDataChecker(path);
96022
+ }
96023
+ else if (renderable != null) {
96024
+ return renderable;
96025
+ }
96026
+ return true;
96027
+ };
96028
+ var DTableColumnImpl = /** @class */ (function (_super) {
96029
+ __extends(DTableColumnImpl, _super);
96030
+ function DTableColumnImpl(index, options) {
96031
+ var _a, _b, _c;
96032
+ var _this = _super.call(this) || this;
96033
+ var weight = options.weight;
96034
+ var width = options.width;
96035
+ if (weight != null) {
96036
+ if (width != null) {
96037
+ width = undefined;
96038
+ }
96039
+ }
96040
+ else if (width == null) {
96041
+ weight = 1;
96042
+ }
96043
+ var type = toEnum((_a = options.type) !== null && _a !== void 0 ? _a : DTableColumnType.TEXT, DTableColumnType);
96044
+ var align = toAlign(options, type);
96045
+ var label = options.label || "";
96046
+ var path = toPath(options);
96047
+ var getter = toGetter(options, type, path);
96048
+ var setter = toSetter(options, type, path);
96049
+ _this._weight = weight;
96050
+ _this._width = width;
96051
+ _this.resizable = (_b = options.resizable) !== null && _b !== void 0 ? _b : false;
96052
+ _this.type = type;
96053
+ _this.label = label;
96054
+ _this.getter = getter;
96055
+ _this.setter = setter;
96056
+ _this.formatter = options.formatter;
96057
+ _this.renderable = toRenderable(options, path);
96058
+ _this.align = align;
96059
+ _this.state = toState(options);
96060
+ _this.editing = toEditing(options, path);
96061
+ _this.sorting = toSorting(getter, index, options);
96062
+ _this.header = options.header;
96063
+ _this.body = options.body;
96064
+ _this.selecting = toSelecting(options.selecting);
96065
+ _this.category = options.category;
96066
+ _this.frozen = options.frozen;
96067
+ _this.offset = 0.0;
96068
+ _this.link = options.link;
96069
+ _this.update = toEnum((_c = options.update) !== null && _c !== void 0 ? _c : DTableColumnUpdate.CELL, DTableColumnUpdate);
96070
+ return _this;
96071
+ }
96072
+ Object.defineProperty(DTableColumnImpl.prototype, "weight", {
95718
96073
  get: function () {
95719
- var row = this.getFirst();
95720
- if (row) {
95721
- return this.toIndex(row);
96074
+ return this._weight;
96075
+ },
96076
+ set: function (weight) {
96077
+ if (this._weight != null && this._weight !== weight) {
96078
+ this._weight = weight;
96079
+ this.emit("resize", this);
95722
96080
  }
95723
- return null;
95724
96081
  },
95725
96082
  enumerable: false,
95726
96083
  configurable: true
95727
96084
  });
95728
- Object.defineProperty(DTableDataTreeSelectionImpl.prototype, "last", {
96085
+ Object.defineProperty(DTableColumnImpl.prototype, "width", {
95729
96086
  get: function () {
95730
- var row = this.getLast();
95731
- if (row) {
95732
- return this.toIndex(row);
96087
+ return this._width;
96088
+ },
96089
+ set: function (width) {
96090
+ if (this._width != null && this._width !== width) {
96091
+ this._width = width;
96092
+ this.emit("resize", this);
95733
96093
  }
95734
- return null;
95735
96094
  },
95736
96095
  enumerable: false,
95737
96096
  configurable: true
95738
96097
  });
95739
- DTableDataTreeSelectionImpl.prototype.onChange = function () {
95740
- this._parent.update();
95741
- this.emit("change", this);
95742
- };
95743
- DTableDataTreeSelectionImpl.prototype.toggle = function (rowIndex) {
95744
- var row = this._parent.get(rowIndex);
95745
- if (row) {
95746
- var rows = this._rows;
95747
- if (rows.has(row)) {
95748
- rows.delete(row);
95749
- }
95750
- else {
95751
- rows.add(row);
96098
+ return DTableColumnImpl;
96099
+ }(pixi_js.utils.EventEmitter));
96100
+
96101
+ var DTableColumnContainerImpl = /** @class */ (function (_super) {
96102
+ __extends(DTableColumnContainerImpl, _super);
96103
+ function DTableColumnContainerImpl(parent, options) {
96104
+ var _this = _super.call(this) || this;
96105
+ _this.parent = parent;
96106
+ var columns = [];
96107
+ if (options != null) {
96108
+ for (var i = 0, imax = options.length; i < imax; ++i) {
96109
+ var column = new DTableColumnImpl(i, options[i]);
96110
+ columns.push(column);
96111
+ column.on("resize", _this.newOnColumnResize(i, column));
95752
96112
  }
95753
- this.onChange();
95754
96113
  }
95755
- };
95756
- DTableDataTreeSelectionImpl.prototype.add = function (rowIndex) {
95757
- var row = this._parent.get(rowIndex);
95758
- if (row) {
95759
- var rows = this._rows;
95760
- if (!rows.has(row)) {
95761
- rows.add(row);
95762
- this.onChange();
96114
+ _this.items = columns;
96115
+ var frozen = 0;
96116
+ for (var i = columns.length - 1; 0 <= i; --i) {
96117
+ if (columns[i].frozen === true) {
96118
+ frozen = i + 1;
96119
+ break;
95763
96120
  }
95764
96121
  }
95765
- };
96122
+ _this.frozen = frozen;
96123
+ return _this;
96124
+ }
96125
+ DTableColumnContainerImpl.prototype.newOnColumnResize = function (index, column) {
96126
+ var _this = this;
96127
+ return function () {
96128
+ _this.onColumnResize(index, column);
96129
+ };
96130
+ };
96131
+ DTableColumnContainerImpl.prototype.onColumnResize = function (index, column) {
96132
+ this.onColumnResizeHeader(index, column);
96133
+ this.onColumnResizeBody(index, column);
96134
+ this.emit("resize", index, column, this);
96135
+ };
96136
+ DTableColumnContainerImpl.prototype.onColumnResizeHeader = function (index, column) {
96137
+ var header = this.parent.header;
96138
+ if (header != null) {
96139
+ var columnWeight = column.weight;
96140
+ if (columnWeight != null) {
96141
+ this.onColumnResizeWeight(header, index, columnWeight);
96142
+ }
96143
+ else {
96144
+ var columnWidth = column.width;
96145
+ if (columnWidth != null) {
96146
+ this.onColumnResizeWidth(header, index, columnWidth);
96147
+ }
96148
+ }
96149
+ }
96150
+ };
96151
+ DTableColumnContainerImpl.prototype.onColumnResizeBody = function (index, column) {
96152
+ var rows = this.parent.body.children;
96153
+ var columnWeight = column.weight;
96154
+ if (columnWeight != null) {
96155
+ for (var i = 0, imax = rows.length; i < imax; ++i) {
96156
+ this.onColumnResizeWeight(rows[i], index, columnWeight);
96157
+ }
96158
+ }
96159
+ else {
96160
+ var columnWidth = column.width;
96161
+ if (columnWidth != null) {
96162
+ for (var i = 0, imax = rows.length; i < imax; ++i) {
96163
+ this.onColumnResizeWidth(rows[i], index, columnWidth);
96164
+ }
96165
+ }
96166
+ }
96167
+ };
96168
+ DTableColumnContainerImpl.prototype.onColumnResizeWeight = function (row, index, columnWeight) {
96169
+ var cells = row.children;
96170
+ var cellsLength = cells.length;
96171
+ var cellsIndex = cellsLength - index - 1;
96172
+ if (0 <= cellsIndex && cellsIndex < cellsLength) {
96173
+ cells[cellsIndex].weight = columnWeight;
96174
+ }
96175
+ };
96176
+ DTableColumnContainerImpl.prototype.onColumnResizeWidth = function (row, index, columnWidth) {
96177
+ var cells = row.children;
96178
+ var cellsLength = cells.length;
96179
+ var cellsIndex = cellsLength - index - 1;
96180
+ if (0 <= cellsIndex && cellsIndex < cellsLength) {
96181
+ cells[cellsIndex].width = columnWidth;
96182
+ }
96183
+ };
96184
+ Object.defineProperty(DTableColumnContainerImpl.prototype, "width", {
96185
+ get: function () {
96186
+ var result = 0;
96187
+ var items = this.items;
96188
+ var length = items.length;
96189
+ for (var i = 0; i < length; ++i) {
96190
+ var item = items[i];
96191
+ var itemWidth = item.width;
96192
+ if (itemWidth != null) {
96193
+ result += itemWidth;
96194
+ }
96195
+ }
96196
+ return result;
96197
+ },
96198
+ enumerable: false,
96199
+ configurable: true
96200
+ });
96201
+ DTableColumnContainerImpl.prototype.get = function (index) {
96202
+ var columns = this.items;
96203
+ if (0 <= index && index < columns.length) {
96204
+ return columns[index];
96205
+ }
96206
+ return null;
96207
+ };
96208
+ DTableColumnContainerImpl.prototype.each = function (iteratee) {
96209
+ var columns = this.items;
96210
+ for (var i = 0, imax = columns.length; i < imax; ++i) {
96211
+ if (iteratee(columns[i], i) === false) {
96212
+ break;
96213
+ }
96214
+ }
96215
+ return this;
96216
+ };
96217
+ DTableColumnContainerImpl.prototype.size = function () {
96218
+ return this.items.length;
96219
+ };
96220
+ return DTableColumnContainerImpl;
96221
+ }(pixi_js.utils.EventEmitter));
96222
+
96223
+ /*
96224
+ * Copyright (C) 2019 Toshiba Corporation
96225
+ * SPDX-License-Identifier: Apache-2.0
96226
+ */
96227
+ var DTableDataTreeFilter = /** @class */ (function (_super) {
96228
+ __extends(DTableDataTreeFilter, _super);
96229
+ function DTableDataTreeFilter(parent) {
96230
+ var _this = _super.call(this) || this;
96231
+ _this._id = 0;
96232
+ _this._idUpdated = -1;
96233
+ _this._isApplied = false;
96234
+ _this._parent = parent;
96235
+ _this._filter = null;
96236
+ _this._filtered = null;
96237
+ return _this;
96238
+ }
96239
+ Object.defineProperty(DTableDataTreeFilter.prototype, "id", {
96240
+ get: function () {
96241
+ return this._id;
96242
+ },
96243
+ enumerable: false,
96244
+ configurable: true
96245
+ });
96246
+ DTableDataTreeFilter.prototype.apply = function () {
96247
+ this._isApplied = true;
96248
+ this._id += 1;
96249
+ this._parent.update();
96250
+ };
96251
+ DTableDataTreeFilter.prototype.unapply = function () {
96252
+ if (this._isApplied) {
96253
+ this._isApplied = false;
96254
+ this._id += 1;
96255
+ this._parent.update();
96256
+ }
96257
+ };
96258
+ DTableDataTreeFilter.prototype.isApplied = function () {
96259
+ return this._isApplied;
96260
+ };
96261
+ DTableDataTreeFilter.prototype.isFiltered = function (node, index, filter) {
96262
+ if (isFunction(filter)) {
96263
+ return filter(node, index);
96264
+ }
96265
+ else {
96266
+ return filter.test(node, index);
96267
+ }
96268
+ };
96269
+ DTableDataTreeFilter.prototype.hasFiltered = function (parent, nodes, filter) {
96270
+ var accessor = this._parent.accessor;
96271
+ var toChildren = accessor.toChildren;
96272
+ var hasChildren = accessor.hasChildren;
96273
+ for (var i = 0, imax = nodes.length; i < imax; ++i) {
96274
+ var node = nodes[i];
96275
+ if (this.isFiltered(node, -1, filter)) {
96276
+ return true;
96277
+ }
96278
+ var children = toChildren(node);
96279
+ if (hasChildren(node, children) && this.hasFiltered(parent, children, filter)) {
96280
+ return true;
96281
+ }
96282
+ }
96283
+ return false;
96284
+ };
96285
+ DTableDataTreeFilter.prototype.addAllToFiltered = function (parent, nodes, filtered, cursor) {
96286
+ var accessor = this._parent.accessor;
96287
+ var toChildren = accessor.toChildren;
96288
+ var hasChildren = accessor.hasChildren;
96289
+ for (var i = 0, imax = nodes.length; i < imax; ++i) {
96290
+ var node = nodes[i];
96291
+ filtered.push(cursor[0]);
96292
+ cursor[0] += 1;
96293
+ var children = toChildren(node);
96294
+ if (hasChildren(node, children) && parent.isOpened(node)) {
96295
+ this.addAllToFiltered(parent, children, filtered, cursor);
96296
+ }
96297
+ }
96298
+ };
96299
+ DTableDataTreeFilter.prototype.newFilteredSub = function (parent, nodes, filter, filtered, cursor) {
96300
+ var result = false;
96301
+ var accessor = this._parent.accessor;
96302
+ var toChildren = accessor.toChildren;
96303
+ var hasChildren = accessor.hasChildren;
96304
+ for (var i = 0, imax = nodes.length; i < imax; ++i) {
96305
+ var node = nodes[i];
96306
+ var index = cursor[0];
96307
+ cursor[0] += 1;
96308
+ var isFiltered = this.isFiltered(node, index, filter);
96309
+ var children = toChildren(node);
96310
+ if (hasChildren(node, children)) {
96311
+ if (parent.isOpened(node)) {
96312
+ if (isFiltered) {
96313
+ filtered.push(index);
96314
+ result = true;
96315
+ this.addAllToFiltered(parent, children, filtered, cursor);
96316
+ }
96317
+ else {
96318
+ var position = filtered.length;
96319
+ if (this.newFilteredSub(parent, children, filter, filtered, cursor)) {
96320
+ filtered.splice(position, 0, index);
96321
+ result = true;
96322
+ }
96323
+ }
96324
+ }
96325
+ else if (isFiltered || this.hasFiltered(parent, children, filter)) {
96326
+ filtered.push(index);
96327
+ result = true;
96328
+ }
96329
+ }
96330
+ else if (isFiltered) {
96331
+ filtered.push(index);
96332
+ result = true;
96333
+ }
96334
+ }
96335
+ return result;
96336
+ };
96337
+ DTableDataTreeFilter.prototype.newFiltered = function () {
96338
+ var filter = this._filter;
96339
+ if (filter != null) {
96340
+ var filtered = [];
96341
+ var parent_1 = this._parent;
96342
+ var nodes = parent_1.nodes;
96343
+ if (nodes) {
96344
+ var cursor = [0];
96345
+ this.newFilteredSub(parent_1, nodes, filter, filtered, cursor);
96346
+ }
96347
+ return filtered;
96348
+ }
96349
+ return null;
96350
+ };
96351
+ DTableDataTreeFilter.prototype.get = function () {
96352
+ return this._filter;
96353
+ };
96354
+ DTableDataTreeFilter.prototype.set = function (filter) {
96355
+ if (this._filter !== filter) {
96356
+ this._filter = filter;
96357
+ }
96358
+ };
96359
+ DTableDataTreeFilter.prototype.toDirty = function () {
96360
+ this._id += 1;
96361
+ };
96362
+ DTableDataTreeFilter.prototype.update = function () {
96363
+ if (this._id !== this._idUpdated) {
96364
+ this._idUpdated = this._id;
96365
+ if (this._isApplied) {
96366
+ this._filtered = this.newFiltered();
96367
+ this.emit("change", this);
96368
+ }
96369
+ else if (this._filtered != null) {
96370
+ this._filtered = null;
96371
+ this.emit("change", this);
96372
+ }
96373
+ }
96374
+ };
96375
+ Object.defineProperty(DTableDataTreeFilter.prototype, "indices", {
96376
+ get: function () {
96377
+ this.update();
96378
+ return this._filtered;
96379
+ },
96380
+ enumerable: false,
96381
+ configurable: true
96382
+ });
96383
+ DTableDataTreeFilter.prototype.map = function (sortedIndex) {
96384
+ var result = sortedIndex;
96385
+ var indices = this.indices;
96386
+ if (indices) {
96387
+ var index = indices.indexOf(result);
96388
+ if (0 <= index) {
96389
+ result = index;
96390
+ }
96391
+ else {
96392
+ return null;
96393
+ }
96394
+ }
96395
+ return result;
96396
+ };
96397
+ DTableDataTreeFilter.prototype.unmap = function (index) {
96398
+ var result = index;
96399
+ var indices = this.indices;
96400
+ if (indices) {
96401
+ result = indices[result];
96402
+ }
96403
+ return result;
96404
+ };
96405
+ return DTableDataTreeFilter;
96406
+ }(pixi_js.utils.EventEmitter));
96407
+
96408
+ /*
96409
+ * Copyright (C) 2021 Toshiba Corporation
96410
+ * SPDX-License-Identifier: Apache-2.0
96411
+ */
96412
+ var toParent = function (node) {
96413
+ return node.parent;
96414
+ };
96415
+ var toChildren$1 = function (node) {
96416
+ return node.children;
96417
+ };
96418
+ var hasChildren = function (node, children) {
96419
+ return children != null && 0 < children.length;
96420
+ };
96421
+ var DTableDataTreeItemAccessor = /** @class */ (function () {
96422
+ function DTableDataTreeItemAccessor(options) {
96423
+ if (options != null) {
96424
+ this.toParent = options.toParent || toParent;
96425
+ this.toChildren = options.toChildren || toChildren$1;
96426
+ this.hasChildren = options.hasChildren || hasChildren;
96427
+ }
96428
+ else {
96429
+ this.toParent = toParent;
96430
+ this.toChildren = toChildren$1;
96431
+ this.hasChildren = hasChildren;
96432
+ }
96433
+ }
96434
+ return DTableDataTreeItemAccessor;
96435
+ }());
96436
+
96437
+ /*
96438
+ * Copyright (C) 2021 Toshiba Corporation
96439
+ * SPDX-License-Identifier: Apache-2.0
96440
+ */
96441
+ var COMPARATOR = function (a, b) {
96442
+ return a[0] - b[0];
96443
+ };
96444
+ var DTableDataTreeSelectionImpl = /** @class */ (function (_super) {
96445
+ __extends(DTableDataTreeSelectionImpl, _super);
96446
+ function DTableDataTreeSelectionImpl(parent, options) {
96447
+ var _a;
96448
+ var _this = _super.call(this) || this;
96449
+ _this._parent = parent;
96450
+ _this._type = toEnum((_a = options === null || options === void 0 ? void 0 : options.type) !== null && _a !== void 0 ? _a : DTableDataSelectionType.NONE, DTableDataSelectionType);
96451
+ _this._rows = new Set();
96452
+ // Events
96453
+ var on = options === null || options === void 0 ? void 0 : options.on;
96454
+ if (on) {
96455
+ for (var name_1 in on) {
96456
+ var handler = on[name_1];
96457
+ if (handler) {
96458
+ _this.on(name_1, handler);
96459
+ }
96460
+ }
96461
+ }
96462
+ return _this;
96463
+ }
96464
+ Object.defineProperty(DTableDataTreeSelectionImpl.prototype, "parent", {
96465
+ get: function () {
96466
+ return this._parent;
96467
+ },
96468
+ enumerable: false,
96469
+ configurable: true
96470
+ });
96471
+ DTableDataTreeSelectionImpl.prototype.onNodeChange = function (nodes) {
96472
+ if (nodes != null) {
96473
+ var accessor = this._parent.accessor;
96474
+ var toChildren = accessor.toChildren;
96475
+ var hasChildren = accessor.hasChildren;
96476
+ var oldRows = this._rows;
96477
+ var newRows = this.newRows(nodes, toChildren, hasChildren, oldRows, new Set());
96478
+ if (oldRows.size !== newRows.size) {
96479
+ this._rows = newRows;
96480
+ this.onChange();
96481
+ }
96482
+ }
96483
+ else {
96484
+ var rows = this._rows;
96485
+ if (0 < rows.size) {
96486
+ rows.clear();
96487
+ this.onChange();
96488
+ }
96489
+ }
96490
+ };
96491
+ DTableDataTreeSelectionImpl.prototype.newRows = function (nodes, toChildren, hasChildren, rows, result) {
96492
+ for (var i = 0, imax = nodes.length; i < imax; ++i) {
96493
+ var node = nodes[i];
96494
+ if (rows.has(node)) {
96495
+ result.add(node);
96496
+ }
96497
+ var children = toChildren(node);
96498
+ if (hasChildren(node, children)) {
96499
+ this.newRows(children, toChildren, hasChildren, rows, result);
96500
+ }
96501
+ }
96502
+ return result;
96503
+ };
96504
+ Object.defineProperty(DTableDataTreeSelectionImpl.prototype, "indices", {
96505
+ get: function () {
96506
+ var rows = this._rows;
96507
+ var result = [];
96508
+ this._parent.each(function (row, index) {
96509
+ if (rows.has(row)) {
96510
+ result.push(index);
96511
+ }
96512
+ });
96513
+ return result;
96514
+ },
96515
+ enumerable: false,
96516
+ configurable: true
96517
+ });
96518
+ Object.defineProperty(DTableDataTreeSelectionImpl.prototype, "rows", {
96519
+ get: function () {
96520
+ var result = [];
96521
+ this._rows.forEach(function (row) {
96522
+ result.push(row);
96523
+ });
96524
+ return result;
96525
+ },
96526
+ enumerable: false,
96527
+ configurable: true
96528
+ });
96529
+ Object.defineProperty(DTableDataTreeSelectionImpl.prototype, "type", {
96530
+ get: function () {
96531
+ return this._type;
96532
+ },
96533
+ enumerable: false,
96534
+ configurable: true
96535
+ });
96536
+ DTableDataTreeSelectionImpl.prototype.getFirst = function () {
96537
+ var rows = this._rows;
96538
+ if (0 < rows.size) {
96539
+ var result_1 = null;
96540
+ rows.forEach(function (row) {
96541
+ if (result_1 == null) {
96542
+ result_1 = row;
96543
+ }
96544
+ });
96545
+ return result_1;
96546
+ }
96547
+ return null;
96548
+ };
96549
+ DTableDataTreeSelectionImpl.prototype.getLast = function () {
96550
+ var rows = this._rows;
96551
+ if (0 < rows.size) {
96552
+ var result_2 = null;
96553
+ rows.forEach(function (row) {
96554
+ result_2 = row;
96555
+ });
96556
+ return result_2;
96557
+ }
96558
+ return null;
96559
+ };
96560
+ DTableDataTreeSelectionImpl.prototype.toIndex = function (target) {
96561
+ var result = null;
96562
+ this._parent.each(function (row, index) {
96563
+ if (target === row) {
96564
+ result = index;
96565
+ return false;
96566
+ }
96567
+ return true;
96568
+ });
96569
+ return result;
96570
+ };
96571
+ Object.defineProperty(DTableDataTreeSelectionImpl.prototype, "first", {
96572
+ get: function () {
96573
+ var row = this.getFirst();
96574
+ if (row) {
96575
+ return this.toIndex(row);
96576
+ }
96577
+ return null;
96578
+ },
96579
+ enumerable: false,
96580
+ configurable: true
96581
+ });
96582
+ Object.defineProperty(DTableDataTreeSelectionImpl.prototype, "last", {
96583
+ get: function () {
96584
+ var row = this.getLast();
96585
+ if (row) {
96586
+ return this.toIndex(row);
96587
+ }
96588
+ return null;
96589
+ },
96590
+ enumerable: false,
96591
+ configurable: true
96592
+ });
96593
+ DTableDataTreeSelectionImpl.prototype.onChange = function () {
96594
+ this._parent.update();
96595
+ this.emit("change", this);
96596
+ };
96597
+ DTableDataTreeSelectionImpl.prototype.toggle = function (rowIndex) {
96598
+ var row = this._parent.get(rowIndex);
96599
+ if (row) {
96600
+ var rows = this._rows;
96601
+ if (rows.has(row)) {
96602
+ rows.delete(row);
96603
+ }
96604
+ else {
96605
+ rows.add(row);
96606
+ }
96607
+ this.onChange();
96608
+ }
96609
+ };
96610
+ DTableDataTreeSelectionImpl.prototype.add = function (rowIndex) {
96611
+ var row = this._parent.get(rowIndex);
96612
+ if (row) {
96613
+ var rows = this._rows;
96614
+ if (!rows.has(row)) {
96615
+ rows.add(row);
96616
+ this.onChange();
96617
+ }
96618
+ }
96619
+ };
95766
96620
  DTableDataTreeSelectionImpl.prototype.addTo = function (rowIndex) {
95767
96621
  var lastRowIndex = this.last;
95768
96622
  if (lastRowIndex != null) {
@@ -96258,1498 +97112,649 @@ var DTableHeaderCellCheck = /** @class */ (function () {
96258
97112
  return this._isFilterable;
96259
97113
  },
96260
97114
  set: function (isFilterable) {
96261
- this._isFilterable = isFilterable;
96262
- },
96263
- enumerable: false,
96264
- configurable: true
96265
- });
96266
- Object.defineProperty(DTableHeaderCellCheck.prototype, "isEmittable", {
96267
- get: function () {
96268
- return this._isEmittable;
96269
- },
96270
- set: function (isEmittable) {
96271
- this._isEmittable = isEmittable;
96272
- },
96273
- enumerable: false,
96274
- configurable: true
96275
- });
96276
- DTableHeaderCellCheck.prototype.newIteratee = function (table, isChecked) {
96277
- var parent = this._parent;
96278
- var column = parent.column;
96279
- var columnIndex = parent.columnIndex;
96280
- if (column != null && columnIndex != null) {
96281
- var getter_1 = column.getter;
96282
- var setter_1 = column.setter;
96283
- if (this._isEmittable) {
96284
- var data_1 = table.data;
96285
- return function (row, rowIndex) {
96286
- if (getter_1(row, columnIndex) !== isChecked) {
96287
- setter_1(row, columnIndex, isChecked);
96288
- data_1.emit("change", isChecked, !isChecked, row, rowIndex, columnIndex, data_1);
96289
- return true;
96290
- }
96291
- return false;
96292
- };
96293
- }
96294
- else {
96295
- return function (row) {
96296
- if (getter_1(row, columnIndex) !== isChecked) {
96297
- setter_1(row, columnIndex, isChecked);
96298
- return true;
96299
- }
96300
- return false;
96301
- };
96302
- }
96303
- }
96304
- return null;
96305
- };
96306
- DTableHeaderCellCheck.prototype.execute = function (isChecked) {
96307
- var _a;
96308
- var table = (_a = this._parent.header) === null || _a === void 0 ? void 0 : _a.table;
96309
- if (table) {
96310
- var iteratee_1 = this.newIteratee(table, isChecked);
96311
- if (iteratee_1) {
96312
- var isChanged_1 = false;
96313
- if (this._isFilterable) {
96314
- table.data.mapped.each(function (row, supplimental, index, unmappedIndex) {
96315
- if (iteratee_1(row, unmappedIndex)) {
96316
- isChanged_1 = true;
96317
- }
96318
- });
96319
- }
96320
- else {
96321
- table.data.each(function (row, index) {
96322
- if (iteratee_1(row, index)) {
96323
- isChanged_1 = true;
96324
- }
96325
- });
96326
- }
96327
- if (isChanged_1) {
96328
- table.body.update(true);
96329
- }
96330
- }
96331
- }
96332
- };
96333
- return DTableHeaderCellCheck;
96334
- }());
96335
-
96336
- /*
96337
- * Copyright (C) 2019 Toshiba Corporation
96338
- * SPDX-License-Identifier: Apache-2.0
96339
- */
96340
- var DTableHeaderCellEdge = {
96341
- NONE: 0,
96342
- LEFT: 1,
96343
- RIGHT: 2,
96344
- BOTH: 3
96345
- };
96346
- var DTableHeaderCell = /** @class */ (function (_super) {
96347
- __extends(DTableHeaderCell, _super);
96348
- function DTableHeaderCell(header, columnIndex, column, options) {
96349
- var _this = _super.call(this, options) || this;
96350
- _this._header = header;
96351
- _this._column = column;
96352
- _this._columnIndex = columnIndex;
96353
- var check = new DTableHeaderCellCheck(_this, options === null || options === void 0 ? void 0 : options.check);
96354
- _this._check = check;
96355
- _this._edgeSize = _this.theme.getEdgeWidth();
96356
- _this._wasResizing = false;
96357
- var sortable = column.sorting.enable;
96358
- var checkable = check.isEnabled;
96359
- if (checkable || sortable) {
96360
- _this.on(UtilPointerEvent.tap, function (e) {
96361
- _this.onClick(e);
96362
- });
96363
- var state = _this.state;
96364
- state.lock();
96365
- state.set(DTableState.SORTABLE, sortable);
96366
- state.set(DTableState.CHECKABLE, checkable);
96367
- state.unlock();
96368
- }
96369
- return _this;
96370
- }
96371
- Object.defineProperty(DTableHeaderCell.prototype, "column", {
96372
- get: function () {
96373
- return this._column;
96374
- },
96375
- enumerable: false,
96376
- configurable: true
96377
- });
96378
- Object.defineProperty(DTableHeaderCell.prototype, "columnIndex", {
96379
- get: function () {
96380
- return this._columnIndex;
96381
- },
96382
- enumerable: false,
96383
- configurable: true
96384
- });
96385
- Object.defineProperty(DTableHeaderCell.prototype, "header", {
96386
- get: function () {
96387
- return this._header;
96388
- },
96389
- enumerable: false,
96390
- configurable: true
96391
- });
96392
- Object.defineProperty(DTableHeaderCell.prototype, "check", {
96393
- get: function () {
96394
- return this._check;
96395
- },
96396
- enumerable: false,
96397
- configurable: true
96398
- });
96399
- DTableHeaderCell.prototype.onDown = function (e) {
96400
- var edges = this.state.valueOf(DTableState.HOVERED_ON_EDGE);
96401
- if (edges != null) {
96402
- this._wasResizing = true;
96403
- var layer = DApplications.getLayer(this);
96404
- if (layer != null) {
96405
- var interactionManager = layer.renderer.plugins.interaction;
96406
- var columnIndex = this._columnIndex;
96407
- if (edges === DTableHeaderCellEdge.LEFT) {
96408
- this.onDownEdge(e.data.global.x, columnIndex - 1, interactionManager);
96409
- }
96410
- else {
96411
- this.onDownEdge(e.data.global.x, columnIndex, interactionManager);
96412
- }
96413
- }
96414
- }
96415
- else {
96416
- this._wasResizing = false;
96417
- _super.prototype.onDown.call(this, e);
96418
- }
96419
- };
96420
- DTableHeaderCell.prototype.findLeftResizableCell = function (columnIndex) {
96421
- var children = this._header.children;
96422
- var childrenLength = children.length;
96423
- for (var i = columnIndex; 0 <= i; --i) {
96424
- var child = children[childrenLength - i - 1];
96425
- if (child.column.resizable) {
96426
- return child;
96427
- }
96428
- }
96429
- return null;
96430
- };
96431
- DTableHeaderCell.prototype.findRightResizableCellOfWeight = function (columnIndex) {
96432
- var children = this._header.children;
96433
- var childrenLength = children.length;
96434
- for (var i = columnIndex + 1; i < childrenLength; ++i) {
96435
- var child = children[childrenLength - i - 1];
96436
- var childColumn = child.column;
96437
- if (childColumn.resizable) {
96438
- var childColumnWeight = childColumn.weight;
96439
- if (childColumnWeight != null) {
96440
- return child;
96441
- }
96442
- }
96443
- }
96444
- return null;
96445
- };
96446
- DTableHeaderCell.prototype.checkIfEdgeResizable = function (columnIndex) {
96447
- var target = this.findLeftResizableCell(columnIndex);
96448
- if (target != null) {
96449
- if (target.column.weight != null) {
96450
- return this.findRightResizableCellOfWeight(target.columnIndex) != null;
96451
- }
96452
- else {
96453
- return true;
96454
- }
96455
- }
96456
- return false;
96457
- };
96458
- DTableHeaderCell.prototype.getResizableEdges = function () {
96459
- var result = this._resizableEdges;
96460
- if (result == null) {
96461
- var columnIndex = this._columnIndex;
96462
- if (this.checkIfEdgeResizable(columnIndex - 1)) {
96463
- if (this.checkIfEdgeResizable(columnIndex)) {
96464
- result = DTableHeaderCellEdge.BOTH;
96465
- }
96466
- else {
96467
- result = DTableHeaderCellEdge.LEFT;
96468
- }
96469
- }
96470
- else {
96471
- if (this.checkIfEdgeResizable(columnIndex)) {
96472
- result = DTableHeaderCellEdge.RIGHT;
96473
- }
96474
- else {
96475
- result = DTableHeaderCellEdge.NONE;
96476
- }
96477
- }
96478
- this._resizableEdges = result;
96479
- }
96480
- return result;
96481
- };
96482
- DTableHeaderCell.prototype.onOver = function (e) {
96483
- var _this = this;
96484
- var _a;
96485
- _super.prototype.onOver.call(this, e);
96486
- if (this.getResizableEdges() !== DTableHeaderCellEdge.NONE) {
96487
- var onHoveredBound = ((_a = this._onHoveredBound) !== null && _a !== void 0 ? _a : (this._onHoveredBound = function (event) {
96488
- _this.onHovered(event);
96489
- }));
96490
- this.on(UtilPointerEvent.move, onHoveredBound);
96491
- // Since the cursor is set by InteractionManager before this method is called,
96492
- // the cursor need to be overriden.
96493
- this.onHovered(e);
96494
- var layer = DApplications.getLayer(this);
96495
- if (layer != null) {
96496
- layer.renderer.plugins.interaction.cursor = this.cursor;
96497
- }
96498
- }
96499
- };
96500
- DTableHeaderCell.prototype.onOut = function (e) {
96501
- _super.prototype.onOut.call(this, e);
96502
- var onHoveredBound = this._onHoveredBound;
96503
- if (onHoveredBound != null) {
96504
- this.state.remove(DTableState.HOVERED_ON_EDGE);
96505
- this.off(UtilPointerEvent.move, onHoveredBound);
96506
- }
96507
- };
96508
- DTableHeaderCell.prototype.onHovered = function (e) {
96509
- var width = this.width;
96510
- var x = this.toClickPosition(e);
96511
- var edgeSize = this._edgeSize;
96512
- if (0 <= x && x <= edgeSize) {
96513
- if (this.getResizableEdges() & DTableHeaderCellEdge.LEFT) {
96514
- this.state.add(DTableState.HOVERED_ON_EDGE, DTableHeaderCellEdge.LEFT);
96515
- }
96516
- else {
96517
- this.state.remove(DTableState.HOVERED_ON_EDGE);
96518
- }
96519
- }
96520
- else if (width - edgeSize <= x && x <= width) {
96521
- if (this.getResizableEdges() & DTableHeaderCellEdge.RIGHT) {
96522
- this.state.add(DTableState.HOVERED_ON_EDGE, DTableHeaderCellEdge.RIGHT);
96523
- }
96524
- else {
96525
- this.state.remove(DTableState.HOVERED_ON_EDGE);
96526
- }
96527
- }
96528
- else {
96529
- this.state.remove(DTableState.HOVERED_ON_EDGE);
96530
- }
96531
- };
96532
- DTableHeaderCell.prototype.onDownEdge = function (onDownPoint, columnIndex, interactionManager) {
96533
- // Find the resizable cell
96534
- var left = this.findLeftResizableCell(columnIndex);
96535
- if (left == null) {
96536
- // No resizable cell
96537
- return;
96538
- }
96539
- var header = this._header;
96540
- var leftColumn = left.column;
96541
- var leftOldWidth = left.width;
96542
- var leftOldWeight = left.weight;
96543
- if (leftColumn.weight == null) {
96544
- header.state.add(DTableState.RESIZING);
96545
- var onMove_1 = function (e) {
96546
- leftColumn.width = Math.max(1, leftOldWidth + e.data.global.x - onDownPoint);
96547
- };
96548
- var onUp_1 = function (e) {
96549
- header.state.remove(DTableState.RESIZING);
96550
- interactionManager.off(UtilPointerEvent.move, onMove_1);
96551
- interactionManager.off(UtilPointerEvent.up, onUp_1);
96552
- interactionManager.off(UtilPointerEvent.upoutside, onUp_1);
96553
- interactionManager.off(UtilPointerEvent.cancel, onUp_1);
96554
- };
96555
- interactionManager.on(UtilPointerEvent.move, onMove_1);
96556
- interactionManager.on(UtilPointerEvent.up, onUp_1);
96557
- interactionManager.on(UtilPointerEvent.upoutside, onUp_1);
96558
- interactionManager.on(UtilPointerEvent.cancel, onUp_1);
96559
- }
96560
- else {
96561
- var right = this.findRightResizableCellOfWeight(left.columnIndex);
96562
- if (right == null) {
96563
- // No right resizable cell found
96564
- return;
96565
- }
96566
- var rightColumn_1 = right.column;
96567
- var rightOldWeight = right.weight;
96568
- var rightOldWidth = right.width;
96569
- var totalWidth_1 = leftOldWidth + rightOldWidth;
96570
- var totalWeight_1 = leftOldWeight + rightOldWeight;
96571
- if (totalWidth_1 <= 0) {
96572
- // The left and right resizable cells doesn't have non-zero width
96573
- return;
96574
- }
96575
- header.state.add(DTableState.RESIZING);
96576
- var onMove_2 = function (e) {
96577
- var leftNewWidth = Math.max(0, Math.min(totalWidth_1, leftOldWidth + e.data.global.x - onDownPoint));
96578
- var leftNewWeight = totalWeight_1 * (leftNewWidth / totalWidth_1);
96579
- leftColumn.weight = leftNewWeight;
96580
- rightColumn_1.weight = totalWeight_1 - leftNewWeight;
96581
- };
96582
- var onUp_2 = function (e) {
96583
- header.state.remove(DTableState.RESIZING);
96584
- interactionManager.off(UtilPointerEvent.move, onMove_2);
96585
- interactionManager.off(UtilPointerEvent.up, onUp_2);
96586
- interactionManager.off(UtilPointerEvent.upoutside, onUp_2);
96587
- interactionManager.off(UtilPointerEvent.cancel, onUp_2);
96588
- };
96589
- interactionManager.on(UtilPointerEvent.move, onMove_2);
96590
- interactionManager.on(UtilPointerEvent.up, onUp_2);
96591
- interactionManager.on(UtilPointerEvent.upoutside, onUp_2);
96592
- interactionManager.on(UtilPointerEvent.cancel, onUp_2);
96593
- }
96594
- };
96595
- Object.defineProperty(DTableHeaderCell.prototype, "sorter", {
96596
- get: function () {
96597
- var _this = this;
96598
- var sorter = this._sorter;
96599
- if (sorter == null) {
96600
- var header = this._header;
96601
- if (header) {
96602
- var table = header.table;
96603
- if (table) {
96604
- sorter = table.data.sorter;
96605
- this._sorter = sorter;
96606
- this._onSorterChangeBound =
96607
- this._onSorterChangeBound ||
96608
- (function () {
96609
- _this.onSorterChange();
96610
- });
96611
- sorter.on("change", this._onSorterChangeBound);
96612
- }
96613
- else {
96614
- return null;
96615
- }
96616
- }
96617
- else {
96618
- return null;
96619
- }
96620
- }
96621
- return sorter;
96622
- },
96623
- enumerable: false,
96624
- configurable: true
96625
- });
96626
- Object.defineProperty(DTableHeaderCell.prototype, "comparator", {
96627
- get: function () {
96628
- return this._column.sorting.comparator || null;
96629
- },
96630
- enumerable: false,
96631
- configurable: true
96632
- });
96633
- DTableHeaderCell.prototype.onSorterChange = function () {
96634
- var comparator = this.comparator;
96635
- if (comparator) {
96636
- var sorter = this._sorter;
96637
- if (sorter) {
96638
- var SORTED_ASCENDING = DTableState.SORTED_ASCENDING;
96639
- var SORTED_DESCENDING = DTableState.SORTED_DESCENDING;
96640
- if (sorter.isApplied() && sorter.get() === comparator) {
96641
- if (sorter.order === DTableDataOrder.ASCENDING) {
96642
- this.state.set(SORTED_ASCENDING, SORTED_DESCENDING);
96643
- }
96644
- else {
96645
- this.state.set(SORTED_DESCENDING, SORTED_ASCENDING);
96646
- }
96647
- }
96648
- else {
96649
- this.state.removeAll(SORTED_ASCENDING, SORTED_DESCENDING);
96650
- }
96651
- }
96652
- }
96653
- };
96654
- DTableHeaderCell.prototype.toClickPosition = function (e) {
96655
- var _a;
96656
- var checkWork = ((_a = this._checkWork) !== null && _a !== void 0 ? _a : (this._checkWork = new pixi_js.Point()));
96657
- return e.data.getLocalPosition(this, checkWork).x;
96658
- };
96659
- DTableHeaderCell.prototype.isCheckClicked = function (e) {
96660
- if (e instanceof pixi_js.InteractionEvent && this._check.isEnabled) {
96661
- if (this.isSortable) {
96662
- var image = this.image.get(1);
96663
- if (image) {
96664
- var position = this.toClickPosition(e);
96665
- var object = image.object;
96666
- if (object != null) {
96667
- var bound = object.getLocalBounds();
96668
- var margin = image.margin.horizontal;
96669
- var x = object.x;
96670
- return (x + bound.left - margin <= position &&
96671
- position <= x + bound.right + margin);
96672
- }
96673
- }
96674
- }
96675
- else {
96676
- return true;
96677
- }
96678
- }
96679
- return false;
96680
- };
96681
- DTableHeaderCell.prototype.isEdgeClicked = function (e) {
96682
- return (e instanceof pixi_js.InteractionEvent &&
96683
- (this.state.is(DTableState.HOVERED_ON_EDGE) || this._wasResizing));
96684
- };
96685
- DTableHeaderCell.prototype.onClick = function (e) {
96686
- if (this.state.isActionable) {
96687
- this.activate(e);
96688
- }
96689
- };
96690
- DTableHeaderCell.prototype.activate = function (e) {
96691
- this.onActivate(e);
96692
- };
96693
- DTableHeaderCell.prototype.onActivate = function (e) {
96694
- if (!this.isEdgeClicked(e)) {
96695
- if (this.isCheckClicked(e)) {
96696
- this.onToggleStart();
96697
- this.onToggleEnd();
96698
- }
96699
- else {
96700
- this.doSort(e);
96701
- this.emit("active", this);
96702
- }
96703
- }
96704
- };
96705
- DTableHeaderCell.prototype.doSort = function (e) {
96706
- if (this.isSortable) {
96707
- var comparator = this.comparator;
96708
- if (comparator) {
96709
- var sorter = this.sorter;
96710
- if (sorter) {
96711
- if (sorter.get() === comparator) {
96712
- if (sorter.order === DTableDataOrder.ASCENDING) {
96713
- sorter.order = DTableDataOrder.DESCENDING;
96714
- sorter.apply();
96715
- }
96716
- else {
96717
- sorter.set(null);
96718
- sorter.apply();
96719
- }
96720
- }
96721
- else {
96722
- sorter.set(comparator);
96723
- sorter.order = DTableDataOrder.ASCENDING;
96724
- sorter.apply();
96725
- }
96726
- }
96727
- }
96728
- }
96729
- };
96730
- Object.defineProperty(DTableHeaderCell.prototype, "isSortable", {
96731
- get: function () {
96732
- return this._column.sorting.enable;
96733
- },
96734
- enumerable: false,
96735
- configurable: true
96736
- });
96737
- Object.defineProperty(DTableHeaderCell.prototype, "isResizable", {
96738
- get: function () {
96739
- return this._column.resizable;
96740
- },
96741
- enumerable: false,
96742
- configurable: true
96743
- });
96744
- Object.defineProperty(DTableHeaderCell.prototype, "isToggle", {
96745
- get: function () {
96746
- return this._check.isEnabled;
96747
- },
96748
- enumerable: false,
96749
- configurable: true
96750
- });
96751
- DTableHeaderCell.prototype.toggle = function () {
96752
- if (this.state.isActionable) {
96753
- if (this.isToggle) {
96754
- this.onToggleStart();
96755
- this.onToggleEnd();
96756
- }
96757
- }
96758
- };
96759
- DTableHeaderCell.prototype.onToggleStart = function () {
96760
- this.state.isActive = !this.state.isActive;
96761
- };
96762
- DTableHeaderCell.prototype.onToggleEnd = function () {
96763
- if (this.state.isActive) {
96764
- this._check.execute(true);
96765
- this.emit("active", this);
96766
- }
96767
- else {
96768
- this._check.execute(false);
96769
- this.emit("inactive", this);
96770
- }
96771
- };
96772
- DTableHeaderCell.prototype.onActivateKeyDown = function (e) {
96773
- if (this.state.isActionable) {
96774
- if (this.isToggle) {
96775
- this.onToggleStart();
96776
- }
96777
- else {
96778
- this.state.isPressed = true;
96779
- }
96780
- }
96781
- };
96782
- DTableHeaderCell.prototype.onActivateKeyUp = function (e) {
96783
- if (this.state.isActionable) {
96784
- if (this.isToggle) {
96785
- this.onToggleEnd();
96786
- }
96787
- else {
96788
- if (this.state.isPressed) {
96789
- this.activate(e);
96790
- }
96791
- this.state.isPressed = false;
96792
- }
96793
- }
96794
- };
96795
- DTableHeaderCell.prototype.onKeyDown = function (e) {
96796
- if (UtilKeyboardEvent.isActivateKey(e)) {
96797
- this.onActivateKeyDown(e);
96798
- }
96799
- return _super.prototype.onKeyDown.call(this, e);
96800
- };
96801
- DTableHeaderCell.prototype.onKeyUp = function (e) {
96802
- if (UtilKeyboardEvent.isActivateKey(e)) {
96803
- this.onActivateKeyUp(e);
96804
- }
96805
- return _super.prototype.onKeyUp.call(this, e);
96806
- };
96807
- DTableHeaderCell.prototype.getType = function () {
96808
- return "DTableHeaderCell";
96809
- };
96810
- DTableHeaderCell.prototype.destroy = function () {
96811
- var sorter = this._sorter;
96812
- var onSorterChangeBound = this._onSorterChangeBound;
96813
- if (sorter && onSorterChangeBound) {
96814
- sorter.off("change", onSorterChangeBound);
96815
- }
96816
- this._sorter = undefined;
96817
- this._onSorterChangeBound = undefined;
96818
- _super.prototype.destroy.call(this);
96819
- };
96820
- return DTableHeaderCell;
96821
- }(DImage));
96822
-
96823
- /*
96824
- * Copyright (C) 2019 Toshiba Corporation
96825
- * SPDX-License-Identifier: Apache-2.0
96826
- */
96827
- var DTableHeader = /** @class */ (function (_super) {
96828
- __extends(DTableHeader, _super);
96829
- function DTableHeader(table, columns, frozen, offset, options) {
96830
- var _this = _super.call(this, columns, frozen, options) || this;
96831
- _this._table = table;
96832
- _this._offset = offset;
96833
- _this.transform.position.y = offset;
96834
- _this.initCells();
96835
- return _this;
96836
- }
96837
- Object.defineProperty(DTableHeader.prototype, "table", {
96838
- get: function () {
96839
- return this._table;
96840
- },
96841
- enumerable: false,
96842
- configurable: true
96843
- });
96844
- DTableHeader.prototype.onParentMove = function (newX, newY, oldX, oldY) {
96845
- _super.prototype.onParentMove.call(this, newX, newY, oldX, oldY);
96846
- this.transform.position.y = -newY + this._offset;
96847
- this.updateFrozenCellPosition(newX);
96848
- };
96849
- DTableHeader.prototype.getContentPositionX = function () {
96850
- var content = this.parent;
96851
- if (content) {
96852
- return content.position.x;
96853
- }
96854
- return 0;
96855
- };
96856
- DTableHeader.prototype.newCell = function (columnIndex, column, columns, options) {
96857
- return new DTableHeaderCell(this, columnIndex, column, this.toCellOptions(column, options));
96858
- };
96859
- DTableHeader.prototype.toCellOptions = function (column, options) {
96860
- var result = column.header || (options === null || options === void 0 ? void 0 : options.cell);
96861
- if (result != null) {
96862
- if (result.weight === undefined) {
96863
- result.weight = column.weight;
96864
- }
96865
- if (result.width === undefined) {
96866
- result.width = column.width;
96867
- }
96868
- if (result.text === undefined) {
96869
- result.text = {
96870
- value: column.label
96871
- };
96872
- }
96873
- else if (result.text.value === undefined) {
96874
- result.text.value = column.label;
96875
- }
96876
- return result;
96877
- }
96878
- else {
96879
- return {
96880
- weight: column.weight,
96881
- width: column.width,
96882
- text: {
96883
- value: column.label
96884
- }
96885
- };
96886
- }
96887
- };
96888
- DTableHeader.prototype.getType = function () {
96889
- return "DTableHeader";
96890
- };
96891
- return DTableHeader;
96892
- }(DTableRow));
96893
-
96894
- var DTableScrollBar = /** @class */ (function (_super) {
96895
- __extends(DTableScrollBar, _super);
96896
- function DTableScrollBar() {
96897
- return _super !== null && _super.apply(this, arguments) || this;
96898
- }
96899
- DTableScrollBar.prototype.getOffsetVerticalStart = function (size) {
96900
- return size * 0.5 + this._parent.body.position.y;
96901
- };
96902
- return DTableScrollBar;
96903
- }(DPaneScrollBar));
96904
-
96905
- var defaultGetter = function (row, columnIndex) {
96906
- return row[columnIndex];
96907
- };
96908
- var defaultSetter = function (row, columnIndex, cell) {
96909
- row[columnIndex] = cell;
96910
- };
96911
- var defaultGetterEmpty = function () { return ""; };
96912
- var defaultSetterEmpty = function () {
96913
- // DO NOTHING
96914
- };
96915
- var toPathGetter = function (path, def) {
96916
- if (path.length <= 1) {
96917
- var key_1 = path[0];
96918
- if (def === undefined) {
96919
- return function (row) {
96920
- return row[key_1];
96921
- };
96922
- }
96923
- else {
96924
- return function (row) {
96925
- return Object.prototype.hasOwnProperty.call(row, key_1) ? row[key_1] : def;
96926
- };
96927
- }
96928
- }
96929
- else {
96930
- if (def === undefined) {
96931
- return function (row) {
96932
- for (var i = 0, imax = path.length - 1; i < imax; ++i) {
96933
- row = row[path[i]];
96934
- }
96935
- return row[path[path.length - 1]];
96936
- };
96937
- }
96938
- else {
96939
- return function (row) {
96940
- for (var i = 0, imax = path.length - 1; i < imax; ++i) {
96941
- row = row[path[i]];
96942
- }
96943
- var key = path[path.length - 1];
96944
- return Object.prototype.hasOwnProperty.call(row, key) ? row[key] : def;
96945
- };
96946
- }
96947
- }
96948
- };
96949
- var toPathSetter = function (path) {
96950
- if (path.length <= 1) {
96951
- var key_2 = path[0];
96952
- return function (row, columnIndex, cell) {
96953
- row[key_2] = cell;
96954
- };
96955
- }
96956
- else {
96957
- return function (row, columnIndex, cell) {
96958
- for (var i = 0, imax = path.length - 1; i < imax; ++i) {
96959
- row = row[path[i]] || {};
96960
- }
96961
- row[path[path.length - 1]] = cell;
96962
- };
96963
- }
96964
- };
96965
- var toAlign = function (options, type) {
96966
- var align = options.align;
96967
- if (align != null) {
96968
- if (isString(align)) {
96969
- return DAlignHorizontal[align];
96970
- }
96971
- else {
96972
- return align;
96973
- }
96974
- }
96975
- switch (type) {
96976
- case DTableColumnType.TEXT:
96977
- case DTableColumnType.TEXT_AREA:
96978
- return DAlignHorizontal.LEFT;
96979
- case DTableColumnType.REAL:
96980
- case DTableColumnType.INTEGER:
96981
- return DAlignHorizontal.RIGHT;
96982
- case DTableColumnType.BUTTON:
96983
- case DTableColumnType.INDEX:
96984
- case DTableColumnType.SELECT:
96985
- case DTableColumnType.ACTION:
96986
- case DTableColumnType.LINK:
96987
- case DTableColumnType.CHECK:
96988
- case DTableColumnType.CHECK_SINGLE:
96989
- case DTableColumnType.COLOR:
96990
- return DAlignHorizontal.CENTER;
96991
- default:
96992
- return DAlignHorizontal.LEFT;
96993
- }
96994
- };
96995
- var toDataChecker = function (path) {
96996
- if (path != null) {
96997
- var pathLength_1 = path.length;
96998
- if (pathLength_1 <= 1) {
96999
- var key_3 = path[0];
97000
- return function (row) {
97001
- return Object.prototype.hasOwnProperty.call(row, key_3);
97002
- };
97003
- }
97004
- else {
97005
- return function (row) {
97006
- for (var i = 0; i < pathLength_1; ++i) {
97007
- var part = path[i];
97008
- if (part in row) {
97009
- row = row[part];
97010
- }
97011
- else {
97012
- return false;
97013
- }
97014
- }
97015
- return true;
97016
- };
97017
- }
97018
- }
97019
- return function (row, columnIndex) {
97020
- return columnIndex < row.length;
97021
- };
97022
- };
97023
- var toEditingEnable = function (enable, path) {
97024
- if (isString(enable)) {
97025
- return toDataChecker(path);
97026
- }
97027
- else if (enable != null) {
97028
- return enable;
97029
- }
97030
- else {
97031
- return false;
97032
- }
97033
- };
97034
- var toEditing = function (options, path) {
97035
- var _a;
97036
- var editing = options.editing;
97037
- var editable = options.editable;
97038
- if (editing) {
97039
- return {
97040
- enable: toEditingEnable((_a = editing.enable) !== null && _a !== void 0 ? _a : editable, path),
97041
- formatter: editing.formatter,
97042
- unformatter: editing.unformatter,
97043
- validator: editing.validator
97044
- };
97045
- }
97046
- return {
97047
- enable: toEditingEnable(editable, path)
97048
- };
97049
- };
97050
- var toComparator = function (getter, index) {
97051
- return function (rowA, rowB) {
97052
- var valueA = getter(rowA, index);
97053
- var valueB = getter(rowB, index);
97054
- return valueA < valueB ? -1 : valueB < valueA ? +1 : 0;
97055
- };
97056
- };
97057
- var toSorting = function (getter, index, options) {
97058
- var sorting = options.sorting;
97059
- var sortable = options.sortable;
97060
- if (sorting) {
97061
- if (sorting.enable || sortable) {
97062
- return {
97063
- enable: true,
97064
- comparator: sorting.comparator || toComparator(getter, index)
97065
- };
97066
- }
97067
- return {
97068
- enable: false
97069
- };
97070
- }
97071
- if (sortable) {
97072
- return {
97073
- enable: true,
97074
- comparator: toComparator(getter, index)
97075
- };
97076
- }
97077
- return {
97078
- enable: false
97079
- };
97080
- };
97081
- var toMenu = function (options) {
97082
- if (options == null) {
97083
- return undefined;
97084
- }
97085
- else if (options instanceof DMenu) {
97086
- return options;
97087
- }
97088
- else {
97089
- return new DMenu(options);
97090
- }
97091
- };
97092
- var toDialog = function (options) {
97093
- if (options == null) {
97094
- return undefined;
97095
- }
97096
- else if ("open" in options) {
97097
- return options;
97098
- }
97099
- else {
97100
- return new DDialogSelect(options);
97101
- }
97102
- };
97103
- var defaultSelectingGetter = function (dialog) {
97104
- return dialog.value;
97105
- };
97106
- var defaultSelectingSetter = function () {
97107
- // DO NOTHING
97108
- };
97109
- var toSelecting = function (options) {
97110
- if (options) {
97111
- return {
97112
- getter: options.getter || defaultSelectingGetter,
97113
- setter: options.setter || defaultSelectingSetter,
97114
- menu: toMenu(options.menu),
97115
- multiple: toMenu(options.multiple),
97116
- dialog: toDialog(options.dialog),
97117
- promise: options.promise
97118
- };
97119
- }
97120
- return {
97121
- getter: defaultSelectingGetter,
97122
- setter: defaultSelectingSetter
97123
- };
97124
- };
97125
- var toGetter = function (options, type, parts) {
97126
- var getter = options.getter;
97127
- if (getter) {
97128
- return getter;
97129
- }
97130
- switch (type) {
97131
- case DTableColumnType.ACTION:
97132
- case DTableColumnType.LINK:
97133
- return defaultGetterEmpty;
97134
- default:
97135
- if (parts == null) {
97136
- return defaultGetter;
97137
- }
97138
- else {
97139
- return toPathGetter(parts, options.default);
97140
- }
97141
- }
97142
- };
97143
- var toSetter = function (options, type, path) {
97144
- var setter = options.setter;
97145
- if (setter) {
97146
- return setter;
97147
- }
97148
- switch (type) {
97149
- case DTableColumnType.BUTTON:
97150
- case DTableColumnType.ACTION:
97151
- case DTableColumnType.LINK:
97152
- return defaultSetterEmpty;
97153
- default:
97154
- if (path == null) {
97155
- return defaultSetter;
97115
+ this._isFilterable = isFilterable;
97116
+ },
97117
+ enumerable: false,
97118
+ configurable: true
97119
+ });
97120
+ Object.defineProperty(DTableHeaderCellCheck.prototype, "isEmittable", {
97121
+ get: function () {
97122
+ return this._isEmittable;
97123
+ },
97124
+ set: function (isEmittable) {
97125
+ this._isEmittable = isEmittable;
97126
+ },
97127
+ enumerable: false,
97128
+ configurable: true
97129
+ });
97130
+ DTableHeaderCellCheck.prototype.newIteratee = function (table, isChecked) {
97131
+ var parent = this._parent;
97132
+ var column = parent.column;
97133
+ var columnIndex = parent.columnIndex;
97134
+ if (column != null && columnIndex != null) {
97135
+ var getter_1 = column.getter;
97136
+ var setter_1 = column.setter;
97137
+ if (this._isEmittable) {
97138
+ var data_1 = table.data;
97139
+ return function (row, rowIndex) {
97140
+ if (getter_1(row, columnIndex) !== isChecked) {
97141
+ setter_1(row, columnIndex, isChecked);
97142
+ data_1.emit("change", isChecked, !isChecked, row, rowIndex, columnIndex, data_1);
97143
+ return true;
97144
+ }
97145
+ return false;
97146
+ };
97156
97147
  }
97157
97148
  else {
97158
- return toPathSetter(path);
97149
+ return function (row) {
97150
+ if (getter_1(row, columnIndex) !== isChecked) {
97151
+ setter_1(row, columnIndex, isChecked);
97152
+ return true;
97153
+ }
97154
+ return false;
97155
+ };
97159
97156
  }
97160
- }
97161
- };
97162
- var toState = function (options) {
97163
- var state = options.state;
97164
- if (state != null) {
97165
- if (isString(state) || isArray(state)) {
97166
- return {
97167
- initial: state,
97168
- modifier: undefined
97169
- };
97170
- }
97171
- else {
97172
- return {
97173
- initial: undefined,
97174
- modifier: state
97175
- };
97176
97157
  }
97177
- }
97178
- return {
97179
- initial: undefined,
97180
- modifier: undefined
97158
+ return null;
97181
97159
  };
97182
- };
97183
- var toPath = function (options) {
97184
- return options.path != null ? options.path.split(".") : null;
97185
- };
97186
- var toRenderable = function (options, path) {
97187
- var renderable = options.renderable;
97188
- if (isString(renderable)) {
97189
- return toDataChecker(path);
97190
- }
97191
- else if (renderable != null) {
97192
- return renderable;
97193
- }
97194
- return true;
97195
- };
97196
- var DTableColumnImpl = /** @class */ (function (_super) {
97197
- __extends(DTableColumnImpl, _super);
97198
- function DTableColumnImpl(index, options) {
97199
- var _a, _b, _c;
97200
- var _this = _super.call(this) || this;
97201
- var weight = options.weight;
97202
- var width = options.width;
97203
- if (weight != null) {
97204
- if (width != null) {
97205
- width = undefined;
97160
+ DTableHeaderCellCheck.prototype.execute = function (isChecked) {
97161
+ var _a;
97162
+ var table = (_a = this._parent.header) === null || _a === void 0 ? void 0 : _a.table;
97163
+ if (table) {
97164
+ var iteratee_1 = this.newIteratee(table, isChecked);
97165
+ if (iteratee_1) {
97166
+ var isChanged_1 = false;
97167
+ if (this._isFilterable) {
97168
+ table.data.mapped.each(function (row, supplimental, index, unmappedIndex) {
97169
+ if (iteratee_1(row, unmappedIndex)) {
97170
+ isChanged_1 = true;
97171
+ }
97172
+ });
97173
+ }
97174
+ else {
97175
+ table.data.each(function (row, index) {
97176
+ if (iteratee_1(row, index)) {
97177
+ isChanged_1 = true;
97178
+ }
97179
+ });
97180
+ }
97181
+ if (isChanged_1) {
97182
+ table.body.update(true);
97183
+ }
97206
97184
  }
97207
97185
  }
97208
- else if (width == null) {
97209
- weight = 1;
97186
+ };
97187
+ return DTableHeaderCellCheck;
97188
+ }());
97189
+
97190
+ /*
97191
+ * Copyright (C) 2019 Toshiba Corporation
97192
+ * SPDX-License-Identifier: Apache-2.0
97193
+ */
97194
+ var DTableHeaderCellEdge = {
97195
+ NONE: 0,
97196
+ LEFT: 1,
97197
+ RIGHT: 2,
97198
+ BOTH: 3
97199
+ };
97200
+ var DTableHeaderCell = /** @class */ (function (_super) {
97201
+ __extends(DTableHeaderCell, _super);
97202
+ function DTableHeaderCell(header, columnIndex, column, options) {
97203
+ var _this = _super.call(this, options) || this;
97204
+ _this._header = header;
97205
+ _this._column = column;
97206
+ _this._columnIndex = columnIndex;
97207
+ var check = new DTableHeaderCellCheck(_this, options === null || options === void 0 ? void 0 : options.check);
97208
+ _this._check = check;
97209
+ _this._edgeSize = _this.theme.getEdgeWidth();
97210
+ _this._wasResizing = false;
97211
+ var sortable = column.sorting.enable;
97212
+ var checkable = check.isEnabled;
97213
+ if (checkable || sortable) {
97214
+ _this.on(UtilPointerEvent.tap, function (e) {
97215
+ _this.onClick(e);
97216
+ });
97217
+ var state = _this.state;
97218
+ state.lock();
97219
+ state.set(DTableState.SORTABLE, sortable);
97220
+ state.set(DTableState.CHECKABLE, checkable);
97221
+ state.unlock();
97210
97222
  }
97211
- var type = toEnum((_a = options.type) !== null && _a !== void 0 ? _a : DTableColumnType.TEXT, DTableColumnType);
97212
- var align = toAlign(options, type);
97213
- var label = options.label || "";
97214
- var path = toPath(options);
97215
- var getter = toGetter(options, type, path);
97216
- var setter = toSetter(options, type, path);
97217
- _this._weight = weight;
97218
- _this._width = width;
97219
- _this.resizable = (_b = options.resizable) !== null && _b !== void 0 ? _b : false;
97220
- _this.type = type;
97221
- _this.label = label;
97222
- _this.getter = getter;
97223
- _this.setter = setter;
97224
- _this.formatter = options.formatter;
97225
- _this.renderable = toRenderable(options, path);
97226
- _this.align = align;
97227
- _this.state = toState(options);
97228
- _this.editing = toEditing(options, path);
97229
- _this.sorting = toSorting(getter, index, options);
97230
- _this.header = options.header;
97231
- _this.body = options.body;
97232
- _this.selecting = toSelecting(options.selecting);
97233
- _this.category = options.category;
97234
- _this.frozen = options.frozen;
97235
- _this.offset = 0.0;
97236
- _this.link = options.link;
97237
- _this.update = toEnum((_c = options.update) !== null && _c !== void 0 ? _c : DTableColumnUpdate.CELL, DTableColumnUpdate);
97238
97223
  return _this;
97239
97224
  }
97240
- Object.defineProperty(DTableColumnImpl.prototype, "weight", {
97225
+ Object.defineProperty(DTableHeaderCell.prototype, "column", {
97241
97226
  get: function () {
97242
- return this._weight;
97227
+ return this._column;
97243
97228
  },
97244
- set: function (weight) {
97245
- if (this._weight != null && this._weight !== weight) {
97246
- this._weight = weight;
97247
- this.emit("resize", this);
97248
- }
97229
+ enumerable: false,
97230
+ configurable: true
97231
+ });
97232
+ Object.defineProperty(DTableHeaderCell.prototype, "columnIndex", {
97233
+ get: function () {
97234
+ return this._columnIndex;
97249
97235
  },
97250
97236
  enumerable: false,
97251
97237
  configurable: true
97252
97238
  });
97253
- Object.defineProperty(DTableColumnImpl.prototype, "width", {
97239
+ Object.defineProperty(DTableHeaderCell.prototype, "header", {
97254
97240
  get: function () {
97255
- return this._width;
97241
+ return this._header;
97256
97242
  },
97257
- set: function (width) {
97258
- if (this._width != null && this._width !== width) {
97259
- this._width = width;
97260
- this.emit("resize", this);
97261
- }
97243
+ enumerable: false,
97244
+ configurable: true
97245
+ });
97246
+ Object.defineProperty(DTableHeaderCell.prototype, "check", {
97247
+ get: function () {
97248
+ return this._check;
97262
97249
  },
97263
97250
  enumerable: false,
97264
97251
  configurable: true
97265
97252
  });
97266
- return DTableColumnImpl;
97267
- }(pixi_js.utils.EventEmitter));
97268
-
97269
- var DTableColumnContainerImpl = /** @class */ (function (_super) {
97270
- __extends(DTableColumnContainerImpl, _super);
97271
- function DTableColumnContainerImpl(parent, options) {
97272
- var _this = _super.call(this) || this;
97273
- _this.parent = parent;
97274
- var columns = [];
97275
- if (options != null) {
97276
- for (var i = 0, imax = options.length; i < imax; ++i) {
97277
- var column = new DTableColumnImpl(i, options[i]);
97278
- columns.push(column);
97279
- column.on("resize", _this.newOnColumnResize(i, column));
97253
+ DTableHeaderCell.prototype.onDown = function (e) {
97254
+ var edges = this.state.valueOf(DTableState.HOVERED_ON_EDGE);
97255
+ if (edges != null) {
97256
+ this._wasResizing = true;
97257
+ var layer = DApplications.getLayer(this);
97258
+ if (layer != null) {
97259
+ var interactionManager = layer.renderer.plugins.interaction;
97260
+ var columnIndex = this._columnIndex;
97261
+ if (edges === DTableHeaderCellEdge.LEFT) {
97262
+ this.onDownEdge(e.data.global.x, columnIndex - 1, interactionManager);
97263
+ }
97264
+ else {
97265
+ this.onDownEdge(e.data.global.x, columnIndex, interactionManager);
97266
+ }
97280
97267
  }
97281
97268
  }
97282
- _this.items = columns;
97283
- var frozen = 0;
97284
- for (var i = columns.length - 1; 0 <= i; --i) {
97285
- if (columns[i].frozen === true) {
97286
- frozen = i + 1;
97287
- break;
97269
+ else {
97270
+ this._wasResizing = false;
97271
+ _super.prototype.onDown.call(this, e);
97272
+ }
97273
+ };
97274
+ DTableHeaderCell.prototype.findLeftResizableCell = function (columnIndex) {
97275
+ var children = this._header.children;
97276
+ var childrenLength = children.length;
97277
+ for (var i = columnIndex; 0 <= i; --i) {
97278
+ var child = children[childrenLength - i - 1];
97279
+ if (child.column.resizable) {
97280
+ return child;
97288
97281
  }
97289
97282
  }
97290
- _this.frozen = frozen;
97291
- return _this;
97292
- }
97293
- DTableColumnContainerImpl.prototype.newOnColumnResize = function (index, column) {
97294
- var _this = this;
97295
- return function () {
97296
- _this.onColumnResize(index, column);
97297
- };
97283
+ return null;
97298
97284
  };
97299
- DTableColumnContainerImpl.prototype.onColumnResize = function (index, column) {
97300
- this.onColumnResizeHeader(index, column);
97301
- this.onColumnResizeBody(index, column);
97302
- this.emit("resize", index, column, this);
97285
+ DTableHeaderCell.prototype.findRightResizableCellOfWeight = function (columnIndex) {
97286
+ var children = this._header.children;
97287
+ var childrenLength = children.length;
97288
+ for (var i = columnIndex + 1; i < childrenLength; ++i) {
97289
+ var child = children[childrenLength - i - 1];
97290
+ var childColumn = child.column;
97291
+ if (childColumn.resizable) {
97292
+ var childColumnWeight = childColumn.weight;
97293
+ if (childColumnWeight != null) {
97294
+ return child;
97295
+ }
97296
+ }
97297
+ }
97298
+ return null;
97303
97299
  };
97304
- DTableColumnContainerImpl.prototype.onColumnResizeHeader = function (index, column) {
97305
- var header = this.parent.header;
97306
- if (header != null) {
97307
- var columnWeight = column.weight;
97308
- if (columnWeight != null) {
97309
- this.onColumnResizeWeight(header, index, columnWeight);
97300
+ DTableHeaderCell.prototype.checkIfEdgeResizable = function (columnIndex) {
97301
+ var target = this.findLeftResizableCell(columnIndex);
97302
+ if (target != null) {
97303
+ if (target.column.weight != null) {
97304
+ return this.findRightResizableCellOfWeight(target.columnIndex) != null;
97310
97305
  }
97311
97306
  else {
97312
- var columnWidth = column.width;
97313
- if (columnWidth != null) {
97314
- this.onColumnResizeWidth(header, index, columnWidth);
97315
- }
97307
+ return true;
97316
97308
  }
97317
97309
  }
97310
+ return false;
97318
97311
  };
97319
- DTableColumnContainerImpl.prototype.onColumnResizeBody = function (index, column) {
97320
- var rows = this.parent.body.children;
97321
- var columnWeight = column.weight;
97322
- if (columnWeight != null) {
97323
- for (var i = 0, imax = rows.length; i < imax; ++i) {
97324
- this.onColumnResizeWeight(rows[i], index, columnWeight);
97312
+ DTableHeaderCell.prototype.getResizableEdges = function () {
97313
+ var result = this._resizableEdges;
97314
+ if (result == null) {
97315
+ var columnIndex = this._columnIndex;
97316
+ if (this.checkIfEdgeResizable(columnIndex - 1)) {
97317
+ if (this.checkIfEdgeResizable(columnIndex)) {
97318
+ result = DTableHeaderCellEdge.BOTH;
97319
+ }
97320
+ else {
97321
+ result = DTableHeaderCellEdge.LEFT;
97322
+ }
97325
97323
  }
97326
- }
97327
- else {
97328
- var columnWidth = column.width;
97329
- if (columnWidth != null) {
97330
- for (var i = 0, imax = rows.length; i < imax; ++i) {
97331
- this.onColumnResizeWidth(rows[i], index, columnWidth);
97324
+ else {
97325
+ if (this.checkIfEdgeResizable(columnIndex)) {
97326
+ result = DTableHeaderCellEdge.RIGHT;
97327
+ }
97328
+ else {
97329
+ result = DTableHeaderCellEdge.NONE;
97332
97330
  }
97333
97331
  }
97332
+ this._resizableEdges = result;
97334
97333
  }
97334
+ return result;
97335
97335
  };
97336
- DTableColumnContainerImpl.prototype.onColumnResizeWeight = function (row, index, columnWeight) {
97337
- var cells = row.children;
97338
- var cellsLength = cells.length;
97339
- var cellsIndex = cellsLength - index - 1;
97340
- if (0 <= cellsIndex && cellsIndex < cellsLength) {
97341
- cells[cellsIndex].weight = columnWeight;
97336
+ DTableHeaderCell.prototype.onOver = function (e) {
97337
+ var _this = this;
97338
+ var _a;
97339
+ _super.prototype.onOver.call(this, e);
97340
+ if (this.getResizableEdges() !== DTableHeaderCellEdge.NONE) {
97341
+ var onHoveredBound = ((_a = this._onHoveredBound) !== null && _a !== void 0 ? _a : (this._onHoveredBound = function (event) {
97342
+ _this.onHovered(event);
97343
+ }));
97344
+ this.on(UtilPointerEvent.move, onHoveredBound);
97345
+ // Since the cursor is set by InteractionManager before this method is called,
97346
+ // the cursor need to be overriden.
97347
+ this.onHovered(e);
97348
+ var layer = DApplications.getLayer(this);
97349
+ if (layer != null) {
97350
+ layer.renderer.plugins.interaction.cursor = this.cursor;
97351
+ }
97342
97352
  }
97343
97353
  };
97344
- DTableColumnContainerImpl.prototype.onColumnResizeWidth = function (row, index, columnWidth) {
97345
- var cells = row.children;
97346
- var cellsLength = cells.length;
97347
- var cellsIndex = cellsLength - index - 1;
97348
- if (0 <= cellsIndex && cellsIndex < cellsLength) {
97349
- cells[cellsIndex].width = columnWidth;
97354
+ DTableHeaderCell.prototype.onOut = function (e) {
97355
+ _super.prototype.onOut.call(this, e);
97356
+ var onHoveredBound = this._onHoveredBound;
97357
+ if (onHoveredBound != null) {
97358
+ this.state.remove(DTableState.HOVERED_ON_EDGE);
97359
+ this.off(UtilPointerEvent.move, onHoveredBound);
97350
97360
  }
97351
97361
  };
97352
- Object.defineProperty(DTableColumnContainerImpl.prototype, "width", {
97353
- get: function () {
97354
- var result = 0;
97355
- var items = this.items;
97356
- var length = items.length;
97357
- for (var i = 0; i < length; ++i) {
97358
- var item = items[i];
97359
- var itemWidth = item.width;
97360
- if (itemWidth != null) {
97361
- result += itemWidth;
97362
- }
97362
+ DTableHeaderCell.prototype.onHovered = function (e) {
97363
+ var width = this.width;
97364
+ var x = this.toClickPosition(e);
97365
+ var edgeSize = this._edgeSize;
97366
+ if (0 <= x && x <= edgeSize) {
97367
+ if (this.getResizableEdges() & DTableHeaderCellEdge.LEFT) {
97368
+ this.state.add(DTableState.HOVERED_ON_EDGE, DTableHeaderCellEdge.LEFT);
97363
97369
  }
97364
- return result;
97365
- },
97366
- enumerable: false,
97367
- configurable: true
97368
- });
97369
- DTableColumnContainerImpl.prototype.get = function (index) {
97370
- var columns = this.items;
97371
- if (0 <= index && index < columns.length) {
97372
- return columns[index];
97373
- }
97374
- return null;
97375
- };
97376
- DTableColumnContainerImpl.prototype.each = function (iteratee) {
97377
- var columns = this.items;
97378
- for (var i = 0, imax = columns.length; i < imax; ++i) {
97379
- if (iteratee(columns[i], i) === false) {
97380
- break;
97370
+ else {
97371
+ this.state.remove(DTableState.HOVERED_ON_EDGE);
97381
97372
  }
97382
97373
  }
97383
- return this;
97384
- };
97385
- DTableColumnContainerImpl.prototype.size = function () {
97386
- return this.items.length;
97387
- };
97388
- return DTableColumnContainerImpl;
97389
- }(pixi_js.utils.EventEmitter));
97390
-
97391
- /*
97392
- * Copyright (C) 2019 Toshiba Corporation
97393
- * SPDX-License-Identifier: Apache-2.0
97394
- */
97395
- var DTableCategoryColumnImpl = /** @class */ (function (_super) {
97396
- __extends(DTableCategoryColumnImpl, _super);
97397
- function DTableCategoryColumnImpl(index, column) {
97398
- var _this = _super.call(this) || this;
97399
- // Label
97400
- var category = column.category;
97401
- if (category) {
97402
- if (isString(category)) {
97403
- if (index === 0) {
97404
- _this.label = category;
97405
- }
97374
+ else if (width - edgeSize <= x && x <= width) {
97375
+ if (this.getResizableEdges() & DTableHeaderCellEdge.RIGHT) {
97376
+ this.state.add(DTableState.HOVERED_ON_EDGE, DTableHeaderCellEdge.RIGHT);
97406
97377
  }
97407
97378
  else {
97408
- if (index < category.length) {
97409
- _this.label = category[index];
97410
- }
97379
+ this.state.remove(DTableState.HOVERED_ON_EDGE);
97411
97380
  }
97412
97381
  }
97413
- _this._weight = column.weight;
97414
- _this._width = column.width;
97415
- _this._isLocked = false;
97416
- _this.offset = 0.0;
97417
- _this._columns = [column];
97418
- _this._nresizable = column.resizable ? 1 : 0;
97419
- var onResizeBound = function () {
97420
- _this.onResize();
97421
- };
97422
- _this._onResizeBound = onResizeBound;
97423
- column.on("resize", onResizeBound);
97424
- return _this;
97425
- }
97426
- DTableCategoryColumnImpl.prototype.onResize = function () {
97427
- if (this._isLocked) {
97382
+ else {
97383
+ this.state.remove(DTableState.HOVERED_ON_EDGE);
97384
+ }
97385
+ };
97386
+ DTableHeaderCell.prototype.onDownEdge = function (onDownPoint, columnIndex, interactionManager) {
97387
+ // Find the resizable cell
97388
+ var left = this.findLeftResizableCell(columnIndex);
97389
+ if (left == null) {
97390
+ // No resizable cell
97428
97391
  return;
97429
97392
  }
97430
- var columns = this._columns;
97431
- if (this._weight != null) {
97432
- var newWeight = 0;
97433
- for (var i = 0, imax = columns.length; i < imax; ++i) {
97434
- var weight = columns[i].weight;
97435
- if (weight != null) {
97436
- newWeight += weight;
97437
- }
97438
- }
97439
- if (this._weight !== newWeight) {
97440
- this._weight = newWeight;
97441
- this.emit("resize", this);
97442
- }
97393
+ var header = this._header;
97394
+ var leftColumn = left.column;
97395
+ var leftOldWidth = left.width;
97396
+ var leftOldWeight = left.weight;
97397
+ if (leftColumn.weight == null) {
97398
+ header.state.add(DTableState.RESIZING);
97399
+ var onMove_1 = function (e) {
97400
+ leftColumn.width = Math.max(1, leftOldWidth + e.data.global.x - onDownPoint);
97401
+ };
97402
+ var onUp_1 = function (e) {
97403
+ header.state.remove(DTableState.RESIZING);
97404
+ interactionManager.off(UtilPointerEvent.move, onMove_1);
97405
+ interactionManager.off(UtilPointerEvent.up, onUp_1);
97406
+ interactionManager.off(UtilPointerEvent.upoutside, onUp_1);
97407
+ interactionManager.off(UtilPointerEvent.cancel, onUp_1);
97408
+ };
97409
+ interactionManager.on(UtilPointerEvent.move, onMove_1);
97410
+ interactionManager.on(UtilPointerEvent.up, onUp_1);
97411
+ interactionManager.on(UtilPointerEvent.upoutside, onUp_1);
97412
+ interactionManager.on(UtilPointerEvent.cancel, onUp_1);
97443
97413
  }
97444
97414
  else {
97445
- var newWidth = 0;
97446
- for (var i = 0, imax = columns.length; i < imax; ++i) {
97447
- var width = columns[i].width;
97448
- if (width != null) {
97449
- newWidth += width;
97450
- }
97415
+ var right = this.findRightResizableCellOfWeight(left.columnIndex);
97416
+ if (right == null) {
97417
+ // No right resizable cell found
97418
+ return;
97451
97419
  }
97452
- if (this._width !== newWidth) {
97453
- this._width = newWidth;
97454
- this.emit("resize", this);
97420
+ var rightColumn_1 = right.column;
97421
+ var rightOldWeight = right.weight;
97422
+ var rightOldWidth = right.width;
97423
+ var totalWidth_1 = leftOldWidth + rightOldWidth;
97424
+ var totalWeight_1 = leftOldWeight + rightOldWeight;
97425
+ if (totalWidth_1 <= 0) {
97426
+ // The left and right resizable cells doesn't have non-zero width
97427
+ return;
97455
97428
  }
97429
+ header.state.add(DTableState.RESIZING);
97430
+ var onMove_2 = function (e) {
97431
+ var leftNewWidth = Math.max(0, Math.min(totalWidth_1, leftOldWidth + e.data.global.x - onDownPoint));
97432
+ var leftNewWeight = totalWeight_1 * (leftNewWidth / totalWidth_1);
97433
+ leftColumn.weight = leftNewWeight;
97434
+ rightColumn_1.weight = totalWeight_1 - leftNewWeight;
97435
+ };
97436
+ var onUp_2 = function (e) {
97437
+ header.state.remove(DTableState.RESIZING);
97438
+ interactionManager.off(UtilPointerEvent.move, onMove_2);
97439
+ interactionManager.off(UtilPointerEvent.up, onUp_2);
97440
+ interactionManager.off(UtilPointerEvent.upoutside, onUp_2);
97441
+ interactionManager.off(UtilPointerEvent.cancel, onUp_2);
97442
+ };
97443
+ interactionManager.on(UtilPointerEvent.move, onMove_2);
97444
+ interactionManager.on(UtilPointerEvent.up, onUp_2);
97445
+ interactionManager.on(UtilPointerEvent.upoutside, onUp_2);
97446
+ interactionManager.on(UtilPointerEvent.cancel, onUp_2);
97456
97447
  }
97457
97448
  };
97458
- Object.defineProperty(DTableCategoryColumnImpl.prototype, "resizable", {
97459
- get: function () {
97460
- return 0 < this._nresizable;
97461
- },
97462
- enumerable: false,
97463
- configurable: true
97464
- });
97465
- Object.defineProperty(DTableCategoryColumnImpl.prototype, "weight", {
97449
+ Object.defineProperty(DTableHeaderCell.prototype, "sorter", {
97466
97450
  get: function () {
97467
- return this._weight;
97468
- },
97469
- set: function (weight) {
97470
- var oldWeight = this._weight;
97471
- var nresizable = this._nresizable;
97472
- if (0 < nresizable && oldWeight != null && oldWeight !== weight) {
97473
- var columns = this._columns;
97474
- var columnsLength = columns.length;
97475
- var minWeight = this.minWeight;
97476
- var newWeight = Math.max(minWeight, weight);
97477
- if (this._weight !== newWeight) {
97478
- this._isLocked = true;
97479
- if (minWeight < oldWeight) {
97480
- var columnWeightRatio = (newWeight - minWeight) / (oldWeight - minWeight);
97481
- for (var i = 0; i < columnsLength; ++i) {
97482
- var column = columns[i];
97483
- var columnWeight = column.weight;
97484
- if (column.resizable && columnWeight != null) {
97485
- column.weight = columnWeight * columnWeightRatio;
97486
- }
97487
- }
97451
+ var _this = this;
97452
+ var sorter = this._sorter;
97453
+ if (sorter == null) {
97454
+ var header = this._header;
97455
+ if (header) {
97456
+ var table = header.table;
97457
+ if (table) {
97458
+ sorter = table.data.sorter;
97459
+ this._sorter = sorter;
97460
+ this._onSorterChangeBound =
97461
+ this._onSorterChangeBound ||
97462
+ (function () {
97463
+ _this.onSorterChange();
97464
+ });
97465
+ sorter.on("change", this._onSorterChangeBound);
97488
97466
  }
97489
97467
  else {
97490
- var newColumnWeight = (newWeight - minWeight) / this._nresizable;
97491
- for (var i = 0; i < columnsLength; ++i) {
97492
- var column = columns[i];
97493
- var columnWeight = column.weight;
97494
- if (column.resizable && columnWeight != null) {
97495
- column.weight = newColumnWeight;
97496
- }
97497
- }
97468
+ return null;
97498
97469
  }
97499
- this._isLocked = false;
97500
- this.onResize();
97470
+ }
97471
+ else {
97472
+ return null;
97501
97473
  }
97502
97474
  }
97475
+ return sorter;
97503
97476
  },
97504
97477
  enumerable: false,
97505
97478
  configurable: true
97506
97479
  });
97507
- Object.defineProperty(DTableCategoryColumnImpl.prototype, "minWeight", {
97480
+ Object.defineProperty(DTableHeaderCell.prototype, "comparator", {
97508
97481
  get: function () {
97509
- var result = 0;
97510
- var columns = this._columns;
97511
- var columnsLength = columns.length;
97512
- for (var i = 0; i < columnsLength; ++i) {
97513
- var column = columns[i];
97514
- var columnWeight = column.weight;
97515
- if (!column.resizable && columnWeight != null) {
97516
- result += columnWeight;
97517
- }
97518
- }
97519
- return result;
97482
+ return this._column.sorting.comparator || null;
97520
97483
  },
97521
97484
  enumerable: false,
97522
97485
  configurable: true
97523
97486
  });
97524
- Object.defineProperty(DTableCategoryColumnImpl.prototype, "width", {
97525
- get: function () {
97526
- return this._width;
97527
- },
97528
- set: function (width) {
97529
- var oldWidth = this._width;
97530
- var nresizable = this._nresizable;
97531
- if (0 < nresizable && oldWidth != null && oldWidth !== width) {
97532
- var columns = this._columns;
97533
- var columnsLength = columns.length;
97534
- var minWidth = this.minWidth;
97535
- var newWidth = Math.max(minWidth, width);
97536
- if (oldWidth !== newWidth) {
97537
- this._isLocked = true;
97538
- if (minWidth < oldWidth) {
97539
- var columnWidthRatio = (newWidth - minWidth) / (oldWidth - minWidth);
97540
- for (var i = 0; i < columnsLength; ++i) {
97541
- var column = columns[i];
97542
- var columnWidth = column.width;
97543
- if (column.resizable && columnWidth != null) {
97544
- column.width = columnWidth * columnWidthRatio;
97545
- }
97546
- }
97487
+ DTableHeaderCell.prototype.onSorterChange = function () {
97488
+ var comparator = this.comparator;
97489
+ if (comparator) {
97490
+ var sorter = this._sorter;
97491
+ if (sorter) {
97492
+ var SORTED_ASCENDING = DTableState.SORTED_ASCENDING;
97493
+ var SORTED_DESCENDING = DTableState.SORTED_DESCENDING;
97494
+ if (sorter.isApplied() && sorter.get() === comparator) {
97495
+ if (sorter.order === DTableDataOrder.ASCENDING) {
97496
+ this.state.set(SORTED_ASCENDING, SORTED_DESCENDING);
97547
97497
  }
97548
97498
  else {
97549
- var newColumnWidth = (newWidth - minWidth) / this._nresizable;
97550
- for (var i = 0; i < columnsLength; ++i) {
97551
- var column = columns[i];
97552
- var columnWidth = column.width;
97553
- if (column.resizable && columnWidth != null) {
97554
- column.width = newColumnWidth;
97555
- }
97556
- }
97499
+ this.state.set(SORTED_DESCENDING, SORTED_ASCENDING);
97557
97500
  }
97558
- this._isLocked = false;
97559
- this.onResize();
97560
97501
  }
97561
- }
97562
- },
97563
- enumerable: false,
97564
- configurable: true
97565
- });
97566
- Object.defineProperty(DTableCategoryColumnImpl.prototype, "minWidth", {
97567
- get: function () {
97568
- var result = 0;
97569
- var columns = this._columns;
97570
- var columnsLength = columns.length;
97571
- for (var i = 0; i < columnsLength; ++i) {
97572
- var column = columns[i];
97573
- var columnWidth = column.width;
97574
- if (!column.resizable && columnWidth != null) {
97575
- result += columnWidth;
97576
- }
97577
- }
97578
- return result;
97579
- },
97580
- enumerable: false,
97581
- configurable: true
97582
- });
97583
- DTableCategoryColumnImpl.prototype.add = function (column) {
97584
- this._columns.push(column);
97585
- if (this._weight != null) {
97586
- var weight = column.weight;
97587
- if (weight != null) {
97588
- this._weight += weight;
97589
- if (column.resizable) {
97590
- this._nresizable += 1;
97502
+ else {
97503
+ this.state.removeAll(SORTED_ASCENDING, SORTED_DESCENDING);
97591
97504
  }
97592
- column.on("resize", this._onResizeBound);
97593
97505
  }
97594
97506
  }
97595
- else if (this._width != null) {
97596
- var width = column.width;
97597
- if (width != null) {
97598
- this._width += width;
97599
- if (column.resizable) {
97600
- this._nresizable += 1;
97507
+ };
97508
+ DTableHeaderCell.prototype.toClickPosition = function (e) {
97509
+ var _a;
97510
+ var checkWork = ((_a = this._checkWork) !== null && _a !== void 0 ? _a : (this._checkWork = new pixi_js.Point()));
97511
+ return e.data.getLocalPosition(this, checkWork).x;
97512
+ };
97513
+ DTableHeaderCell.prototype.isCheckClicked = function (e) {
97514
+ if (e instanceof pixi_js.InteractionEvent && this._check.isEnabled) {
97515
+ if (this.isSortable) {
97516
+ var image = this.image.get(1);
97517
+ if (image) {
97518
+ var position = this.toClickPosition(e);
97519
+ var object = image.object;
97520
+ if (object != null) {
97521
+ var bound = object.getLocalBounds();
97522
+ var margin = image.margin.horizontal;
97523
+ var x = object.x;
97524
+ return (x + bound.left - margin <= position &&
97525
+ position <= x + bound.right + margin);
97526
+ }
97601
97527
  }
97602
- column.on("resize", this._onResizeBound);
97528
+ }
97529
+ else {
97530
+ return true;
97603
97531
  }
97604
97532
  }
97533
+ return false;
97605
97534
  };
97606
- return DTableCategoryColumnImpl;
97607
- }(pixi_js.utils.EventEmitter));
97608
-
97609
- var DTableCategoryContainerImpl = /** @class */ (function () {
97610
- function DTableCategoryContainerImpl(columns, frozen, options) {
97611
- var count = this.toCount(columns);
97612
- var items = [];
97613
- var offset = 0;
97614
- for (var i = count - 1; 0 <= i; --i) {
97615
- var item = new DTableCategory(this.toColumns(i, columns, frozen), frozen, offset, options);
97616
- items.push(item);
97617
- offset += item.height;
97535
+ DTableHeaderCell.prototype.isEdgeClicked = function (e) {
97536
+ return (e instanceof pixi_js.InteractionEvent &&
97537
+ (this.state.is(DTableState.HOVERED_ON_EDGE) || this._wasResizing));
97538
+ };
97539
+ DTableHeaderCell.prototype.onClick = function (e) {
97540
+ if (this.state.isActionable) {
97541
+ this.activate(e);
97618
97542
  }
97619
- this.items = items;
97620
- }
97621
- DTableCategoryContainerImpl.prototype.toCount = function (columns) {
97622
- var result = 0;
97623
- for (var i = 0, imax = columns.length; i < imax; ++i) {
97624
- var category = columns[i].category;
97625
- if (category != null) {
97626
- var count = isString(category) ? 1 : category.length;
97627
- result = Math.max(result, count);
97543
+ };
97544
+ DTableHeaderCell.prototype.activate = function (e) {
97545
+ this.onActivate(e);
97546
+ };
97547
+ DTableHeaderCell.prototype.onActivate = function (e) {
97548
+ if (!this.isEdgeClicked(e)) {
97549
+ if (this.isCheckClicked(e)) {
97550
+ this.onToggleStart();
97551
+ this.onToggleEnd();
97552
+ }
97553
+ else {
97554
+ this.doSort(e);
97555
+ this.emit("active", this);
97628
97556
  }
97629
97557
  }
97630
- return result;
97631
97558
  };
97632
- DTableCategoryContainerImpl.prototype.isCategory = function (index, a, b) {
97633
- if (a != null) {
97634
- if (b != null) {
97635
- if (isString(a)) {
97636
- if (isString(b)) {
97637
- if (0 < index) {
97638
- return true;
97639
- }
97640
- else {
97641
- return a === b;
97642
- }
97643
- }
97644
- else {
97645
- if (0 < index) {
97646
- return b.length <= index;
97647
- }
97648
- else {
97649
- return b.length === 1 && a === b[0];
97650
- }
97651
- }
97652
- }
97653
- else {
97654
- if (isString(b)) {
97655
- if (0 < index) {
97656
- return a.length <= index;
97559
+ DTableHeaderCell.prototype.doSort = function (e) {
97560
+ if (this.isSortable) {
97561
+ var comparator = this.comparator;
97562
+ if (comparator) {
97563
+ var sorter = this.sorter;
97564
+ if (sorter) {
97565
+ if (sorter.get() === comparator) {
97566
+ if (sorter.order === DTableDataOrder.ASCENDING) {
97567
+ sorter.order = DTableDataOrder.DESCENDING;
97568
+ sorter.apply();
97657
97569
  }
97658
97570
  else {
97659
- return a.length === 1 && a[0] === b;
97571
+ sorter.set(null);
97572
+ sorter.apply();
97660
97573
  }
97661
97574
  }
97662
97575
  else {
97663
- if (a.length <= index && b.length <= index) {
97664
- return true;
97665
- }
97666
- else if (b.length === a.length) {
97667
- for (var i = index, imax = a.length; i < imax; ++i) {
97668
- if (a[i] !== b[i]) {
97669
- return false;
97670
- }
97671
- }
97672
- return true;
97673
- }
97674
- return false;
97576
+ sorter.set(comparator);
97577
+ sorter.order = DTableDataOrder.ASCENDING;
97578
+ sorter.apply();
97675
97579
  }
97676
97580
  }
97677
97581
  }
97678
- else {
97679
- if (isString(a)) {
97680
- if (0 < index) {
97681
- return true;
97682
- }
97683
- else {
97684
- return false;
97685
- }
97686
- }
97687
- else {
97688
- if (a.length <= index) {
97689
- return true;
97690
- }
97691
- else {
97692
- return false;
97693
- }
97694
- }
97582
+ }
97583
+ };
97584
+ Object.defineProperty(DTableHeaderCell.prototype, "isSortable", {
97585
+ get: function () {
97586
+ return this._column.sorting.enable;
97587
+ },
97588
+ enumerable: false,
97589
+ configurable: true
97590
+ });
97591
+ Object.defineProperty(DTableHeaderCell.prototype, "isResizable", {
97592
+ get: function () {
97593
+ return this._column.resizable;
97594
+ },
97595
+ enumerable: false,
97596
+ configurable: true
97597
+ });
97598
+ Object.defineProperty(DTableHeaderCell.prototype, "isToggle", {
97599
+ get: function () {
97600
+ return this._check.isEnabled;
97601
+ },
97602
+ enumerable: false,
97603
+ configurable: true
97604
+ });
97605
+ DTableHeaderCell.prototype.toggle = function () {
97606
+ if (this.state.isActionable) {
97607
+ if (this.isToggle) {
97608
+ this.onToggleStart();
97609
+ this.onToggleEnd();
97695
97610
  }
97696
97611
  }
97612
+ };
97613
+ DTableHeaderCell.prototype.onToggleStart = function () {
97614
+ this.state.isActive = !this.state.isActive;
97615
+ };
97616
+ DTableHeaderCell.prototype.onToggleEnd = function () {
97617
+ if (this.state.isActive) {
97618
+ this._check.execute(true);
97619
+ this.emit("active", this);
97620
+ }
97697
97621
  else {
97698
- if (b != null) {
97699
- if (isString(b)) {
97700
- if (0 < index) {
97701
- return true;
97702
- }
97703
- else {
97704
- return false;
97705
- }
97706
- }
97707
- else {
97708
- if (b.length <= index) {
97709
- return true;
97710
- }
97711
- else {
97712
- return false;
97713
- }
97714
- }
97622
+ this._check.execute(false);
97623
+ this.emit("inactive", this);
97624
+ }
97625
+ };
97626
+ DTableHeaderCell.prototype.onActivateKeyDown = function (e) {
97627
+ if (this.state.isActionable) {
97628
+ if (this.isToggle) {
97629
+ this.onToggleStart();
97715
97630
  }
97716
97631
  else {
97717
- return true;
97632
+ this.state.isPressed = true;
97718
97633
  }
97719
97634
  }
97720
97635
  };
97721
- DTableCategoryContainerImpl.prototype.toColumns = function (index, columns, frozen) {
97722
- var result = [];
97723
- var tcolumn = null;
97724
- var ccolumn = null;
97725
- for (var i = 0, imax = columns.length; i < imax; ++i) {
97726
- var column = columns[i];
97727
- if (i !== frozen &&
97728
- ccolumn &&
97729
- tcolumn &&
97730
- this.isCategory(index, tcolumn.category, column.category)) {
97731
- if (ccolumn.weight != null && column.weight != null) {
97732
- ccolumn.add(column);
97733
- }
97734
- else if (ccolumn.width != null && column.width != null) {
97735
- ccolumn.add(column);
97736
- }
97737
- else {
97738
- tcolumn = column;
97739
- ccolumn = new DTableCategoryColumnImpl(index, column);
97740
- result.push(ccolumn);
97741
- }
97636
+ DTableHeaderCell.prototype.onActivateKeyUp = function (e) {
97637
+ if (this.state.isActionable) {
97638
+ if (this.isToggle) {
97639
+ this.onToggleEnd();
97742
97640
  }
97743
97641
  else {
97744
- tcolumn = column;
97745
- ccolumn = new DTableCategoryColumnImpl(index, column);
97746
- result.push(ccolumn);
97642
+ if (this.state.isPressed) {
97643
+ this.activate(e);
97644
+ }
97645
+ this.state.isPressed = false;
97747
97646
  }
97748
97647
  }
97749
- return result;
97750
97648
  };
97751
- return DTableCategoryContainerImpl;
97752
- }());
97649
+ DTableHeaderCell.prototype.onKeyDown = function (e) {
97650
+ if (UtilKeyboardEvent.isActivateKey(e)) {
97651
+ this.onActivateKeyDown(e);
97652
+ }
97653
+ return _super.prototype.onKeyDown.call(this, e);
97654
+ };
97655
+ DTableHeaderCell.prototype.onKeyUp = function (e) {
97656
+ if (UtilKeyboardEvent.isActivateKey(e)) {
97657
+ this.onActivateKeyUp(e);
97658
+ }
97659
+ return _super.prototype.onKeyUp.call(this, e);
97660
+ };
97661
+ DTableHeaderCell.prototype.getType = function () {
97662
+ return "DTableHeaderCell";
97663
+ };
97664
+ DTableHeaderCell.prototype.destroy = function () {
97665
+ var sorter = this._sorter;
97666
+ var onSorterChangeBound = this._onSorterChangeBound;
97667
+ if (sorter && onSorterChangeBound) {
97668
+ sorter.off("change", onSorterChangeBound);
97669
+ }
97670
+ this._sorter = undefined;
97671
+ this._onSorterChangeBound = undefined;
97672
+ _super.prototype.destroy.call(this);
97673
+ };
97674
+ return DTableHeaderCell;
97675
+ }(DImage));
97676
+
97677
+ /*
97678
+ * Copyright (C) 2019 Toshiba Corporation
97679
+ * SPDX-License-Identifier: Apache-2.0
97680
+ */
97681
+ var DTableHeader = /** @class */ (function (_super) {
97682
+ __extends(DTableHeader, _super);
97683
+ function DTableHeader(table, columns, frozen, offset, options) {
97684
+ var _this = _super.call(this, columns, frozen, options) || this;
97685
+ _this._table = table;
97686
+ _this._offset = offset;
97687
+ _this.transform.position.y = offset;
97688
+ _this.initCells();
97689
+ return _this;
97690
+ }
97691
+ Object.defineProperty(DTableHeader.prototype, "table", {
97692
+ get: function () {
97693
+ return this._table;
97694
+ },
97695
+ enumerable: false,
97696
+ configurable: true
97697
+ });
97698
+ DTableHeader.prototype.onParentMove = function (newX, newY, oldX, oldY) {
97699
+ _super.prototype.onParentMove.call(this, newX, newY, oldX, oldY);
97700
+ this.transform.position.y = -newY + this._offset;
97701
+ this.updateFrozenCellPosition(newX);
97702
+ };
97703
+ DTableHeader.prototype.getContentPositionX = function () {
97704
+ var content = this.parent;
97705
+ if (content) {
97706
+ return content.position.x;
97707
+ }
97708
+ return 0;
97709
+ };
97710
+ DTableHeader.prototype.newCell = function (columnIndex, column, columns, options) {
97711
+ return new DTableHeaderCell(this, columnIndex, column, this.toCellOptions(column, options));
97712
+ };
97713
+ DTableHeader.prototype.toCellOptions = function (column, options) {
97714
+ var result = column.header || (options === null || options === void 0 ? void 0 : options.cell);
97715
+ if (result != null) {
97716
+ if (result.weight === undefined) {
97717
+ result.weight = column.weight;
97718
+ }
97719
+ if (result.width === undefined) {
97720
+ result.width = column.width;
97721
+ }
97722
+ if (result.text === undefined) {
97723
+ result.text = {
97724
+ value: column.label
97725
+ };
97726
+ }
97727
+ else if (result.text.value === undefined) {
97728
+ result.text.value = column.label;
97729
+ }
97730
+ return result;
97731
+ }
97732
+ else {
97733
+ return {
97734
+ weight: column.weight,
97735
+ width: column.width,
97736
+ text: {
97737
+ value: column.label
97738
+ }
97739
+ };
97740
+ }
97741
+ };
97742
+ DTableHeader.prototype.getType = function () {
97743
+ return "DTableHeader";
97744
+ };
97745
+ return DTableHeader;
97746
+ }(DTableRow));
97747
+
97748
+ var DTableScrollBar = /** @class */ (function (_super) {
97749
+ __extends(DTableScrollBar, _super);
97750
+ function DTableScrollBar() {
97751
+ return _super !== null && _super.apply(this, arguments) || this;
97752
+ }
97753
+ DTableScrollBar.prototype.getOffsetVerticalStart = function (size) {
97754
+ return size * 0.5 + this._parent.body.position.y;
97755
+ };
97756
+ return DTableScrollBar;
97757
+ }(DPaneScrollBar));
97753
97758
 
97754
97759
  /*
97755
97760
  * Copyright (C) 2019 Toshiba Corporation
@@ -99720,6 +99725,7 @@ exports.DImagePieceLayouterPartTop = DImagePieceLayouterPartTop;
99720
99725
  exports.DImagePieceMarginImpl = DImagePieceMarginImpl;
99721
99726
  exports.DImagePieceTintImpl = DImagePieceTintImpl;
99722
99727
  exports.DIndicatorProcessing = DIndicatorProcessing;
99728
+ exports.DIndicatorProcessingState = DIndicatorProcessingState;
99723
99729
  exports.DInput = DInput;
99724
99730
  exports.DInputAndLabel = DInputAndLabel;
99725
99731
  exports.DInputBoolean = DInputBoolean;
@@ -99919,6 +99925,10 @@ exports.DTableBodyRow = DTableBodyRow;
99919
99925
  exports.DTableCategory = DTableCategory;
99920
99926
  exports.DTableCategoryCell = DTableCategoryCell;
99921
99927
  exports.DTableCategoryCellEdge = DTableCategoryCellEdge;
99928
+ exports.DTableCategoryColumnImpl = DTableCategoryColumnImpl;
99929
+ exports.DTableCategoryContainerImpl = DTableCategoryContainerImpl;
99930
+ exports.DTableColumnContainerImpl = DTableColumnContainerImpl;
99931
+ exports.DTableColumnImpl = DTableColumnImpl;
99922
99932
  exports.DTableColumnType = DTableColumnType;
99923
99933
  exports.DTableColumnUpdate = DTableColumnUpdate;
99924
99934
  exports.DTableDataList = DTableDataList;