@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
 
@@ -66990,15 +66990,17 @@
66990
66990
  return DExpandable;
66991
66991
  }(DLayoutVertical));
66992
66992
 
66993
- var STATE_INITIAL = 0;
66994
- var STATE_STARTED = 1;
66995
- var STATE_RESOLVED = 2;
66996
- var STATE_REJECTED = 3;
66993
+ var DIndicatorProcessingState = {
66994
+ INITIAL: 0,
66995
+ STARTED: 1,
66996
+ RESOLVED: 2,
66997
+ REJECTED: 3
66998
+ };
66997
66999
  var DIndicatorProcessing = /** @class */ (function () {
66998
67000
  function DIndicatorProcessing(parent, options) {
66999
67001
  var _a, _b, _c, _d, _e, _f, _g;
67000
67002
  this._parent = parent;
67001
- this._state = STATE_INITIAL;
67003
+ this._state = DIndicatorProcessingState.INITIAL;
67002
67004
  this._startTime = 0;
67003
67005
  // Delay
67004
67006
  var theme = this.theme;
@@ -67021,12 +67023,13 @@
67021
67023
  }
67022
67024
  DIndicatorProcessing.prototype.start = function () {
67023
67025
  var state = this._state;
67024
- if (state === STATE_INITIAL) {
67025
- this._state = STATE_STARTED;
67026
+ if (state === DIndicatorProcessingState.INITIAL) {
67027
+ this._state = DIndicatorProcessingState.STARTED;
67026
67028
  this.onBegin();
67027
67029
  }
67028
- else if (state === STATE_RESOLVED || state === STATE_REJECTED) {
67029
- this._state = STATE_STARTED;
67030
+ else if (state === DIndicatorProcessingState.RESOLVED ||
67031
+ state === DIndicatorProcessingState.REJECTED) {
67032
+ this._state = DIndicatorProcessingState.STARTED;
67030
67033
  this.onEnd();
67031
67034
  this.onBegin();
67032
67035
  }
@@ -67077,8 +67080,10 @@
67077
67080
  };
67078
67081
  DIndicatorProcessing.prototype.end = function () {
67079
67082
  var state = this._state;
67080
- if (state === STATE_STARTED || state === STATE_RESOLVED || state === STATE_REJECTED) {
67081
- this._state = STATE_INITIAL;
67083
+ if (state === DIndicatorProcessingState.STARTED ||
67084
+ state === DIndicatorProcessingState.RESOLVED ||
67085
+ state === DIndicatorProcessingState.REJECTED) {
67086
+ this._state = DIndicatorProcessingState.INITIAL;
67082
67087
  this.onEnd();
67083
67088
  }
67084
67089
  return this;
@@ -67114,8 +67119,8 @@
67114
67119
  };
67115
67120
  DIndicatorProcessing.prototype.resolve = function (message) {
67116
67121
  var _this = this;
67117
- if (this._state === STATE_STARTED) {
67118
- this._state = STATE_RESOLVED;
67122
+ if (this._state === DIndicatorProcessingState.STARTED) {
67123
+ this._state = DIndicatorProcessingState.RESOLVED;
67119
67124
  var elapsedTime = Date.now() - this._startTime;
67120
67125
  var delay = this._delayDone - elapsedTime;
67121
67126
  if (0 < delay) {
@@ -67147,8 +67152,8 @@
67147
67152
  };
67148
67153
  DIndicatorProcessing.prototype.reject = function (message) {
67149
67154
  var _this = this;
67150
- if (this._state === STATE_STARTED) {
67151
- this._state = STATE_REJECTED;
67155
+ if (this._state === DIndicatorProcessingState.STARTED) {
67156
+ this._state = DIndicatorProcessingState.REJECTED;
67152
67157
  var elapsedTime = Date.now() - this._startTime;
67153
67158
  var delay = this._delayDone - elapsedTime;
67154
67159
  if (0 < delay) {
@@ -68766,7 +68771,7 @@
68766
68771
  };
68767
68772
  /**
68768
68773
  * Goes to the last page.
68769
- * Unlike {@link #value}, this method emits the change event if silently is not true.
68774
+ * Unlike {@link value}, this method emits the change event if silently is not true.
68770
68775
  *
68771
68776
  * @param silently true to suppress the change event
68772
68777
  * @returns true if succeeded.
@@ -68776,7 +68781,7 @@
68776
68781
  };
68777
68782
  /**
68778
68783
  * Goes to the given page.
68779
- * Unlike {@link #value}, this method emits the change event if silently is not true.
68784
+ * Unlike {@link value}, this method emits the change event if silently is not true.
68780
68785
  *
68781
68786
  * @param index a page index
68782
68787
  * @param silently true to suppress the change event
@@ -68825,7 +68830,7 @@
68825
68830
  };
68826
68831
  /**
68827
68832
  * Goes to the next page.
68828
- * Unlike {@link #value}, this method emits the change event if silently is not true.
68833
+ * Unlike {@link value}, this method emits the change event if silently is not true.
68829
68834
  *
68830
68835
  * @param silently true to suppress the change event
68831
68836
  * @returns true if succeeded.
@@ -68863,7 +68868,7 @@
68863
68868
  };
68864
68869
  /**
68865
68870
  * Goes to the previous page.
68866
- * Unlike {@link #value}, this method emits the change event if silently is not true.
68871
+ * Unlike {@link value}, this method emits the change event if silently is not true.
68867
68872
  *
68868
68873
  * @param silently true to suppress the change event
68869
68874
  * @returns true if succeeded.
@@ -68901,7 +68906,7 @@
68901
68906
  };
68902
68907
  /**
68903
68908
  * Goes to the top page.
68904
- * Unlike {@link #value}, this method emits the change event if silently is not true.
68909
+ * Unlike {@link value}, this method emits the change event if silently is not true.
68905
68910
  *
68906
68911
  * @param silently true to suppress the change event
68907
68912
  * @returns true if succeeded.
@@ -74216,6 +74221,224 @@
74216
74221
  return DTableCategoryCell;
74217
74222
  }(DImage));
74218
74223
 
74224
+ /*
74225
+ * Copyright (C) 2019 Toshiba Corporation
74226
+ * SPDX-License-Identifier: Apache-2.0
74227
+ */
74228
+ var DTableCategoryColumnImpl = /** @class */ (function (_super) {
74229
+ __extends(DTableCategoryColumnImpl, _super);
74230
+ function DTableCategoryColumnImpl(index, column) {
74231
+ var _this = _super.call(this) || this;
74232
+ // Label
74233
+ var category = column.category;
74234
+ if (category) {
74235
+ if (isString(category)) {
74236
+ if (index === 0) {
74237
+ _this.label = category;
74238
+ }
74239
+ }
74240
+ else {
74241
+ if (index < category.length) {
74242
+ _this.label = category[index];
74243
+ }
74244
+ }
74245
+ }
74246
+ _this._weight = column.weight;
74247
+ _this._width = column.width;
74248
+ _this._isLocked = false;
74249
+ _this.offset = 0.0;
74250
+ _this._columns = [column];
74251
+ _this._nresizable = column.resizable ? 1 : 0;
74252
+ var onResizeBound = function () {
74253
+ _this.onResize();
74254
+ };
74255
+ _this._onResizeBound = onResizeBound;
74256
+ column.on("resize", onResizeBound);
74257
+ return _this;
74258
+ }
74259
+ DTableCategoryColumnImpl.prototype.onResize = function () {
74260
+ if (this._isLocked) {
74261
+ return;
74262
+ }
74263
+ var columns = this._columns;
74264
+ if (this._weight != null) {
74265
+ var newWeight = 0;
74266
+ for (var i = 0, imax = columns.length; i < imax; ++i) {
74267
+ var weight = columns[i].weight;
74268
+ if (weight != null) {
74269
+ newWeight += weight;
74270
+ }
74271
+ }
74272
+ if (this._weight !== newWeight) {
74273
+ this._weight = newWeight;
74274
+ this.emit("resize", this);
74275
+ }
74276
+ }
74277
+ else {
74278
+ var newWidth = 0;
74279
+ for (var i = 0, imax = columns.length; i < imax; ++i) {
74280
+ var width = columns[i].width;
74281
+ if (width != null) {
74282
+ newWidth += width;
74283
+ }
74284
+ }
74285
+ if (this._width !== newWidth) {
74286
+ this._width = newWidth;
74287
+ this.emit("resize", this);
74288
+ }
74289
+ }
74290
+ };
74291
+ Object.defineProperty(DTableCategoryColumnImpl.prototype, "resizable", {
74292
+ get: function () {
74293
+ return 0 < this._nresizable;
74294
+ },
74295
+ enumerable: false,
74296
+ configurable: true
74297
+ });
74298
+ Object.defineProperty(DTableCategoryColumnImpl.prototype, "weight", {
74299
+ get: function () {
74300
+ return this._weight;
74301
+ },
74302
+ set: function (weight) {
74303
+ var oldWeight = this._weight;
74304
+ var nresizable = this._nresizable;
74305
+ if (0 < nresizable && oldWeight != null && oldWeight !== weight) {
74306
+ var columns = this._columns;
74307
+ var columnsLength = columns.length;
74308
+ var minWeight = this.minWeight;
74309
+ var newWeight = Math.max(minWeight, weight);
74310
+ if (this._weight !== newWeight) {
74311
+ this._isLocked = true;
74312
+ if (minWeight < oldWeight) {
74313
+ var columnWeightRatio = (newWeight - minWeight) / (oldWeight - minWeight);
74314
+ for (var i = 0; i < columnsLength; ++i) {
74315
+ var column = columns[i];
74316
+ var columnWeight = column.weight;
74317
+ if (column.resizable && columnWeight != null) {
74318
+ column.weight = columnWeight * columnWeightRatio;
74319
+ }
74320
+ }
74321
+ }
74322
+ else {
74323
+ var newColumnWeight = (newWeight - minWeight) / this._nresizable;
74324
+ for (var i = 0; i < columnsLength; ++i) {
74325
+ var column = columns[i];
74326
+ var columnWeight = column.weight;
74327
+ if (column.resizable && columnWeight != null) {
74328
+ column.weight = newColumnWeight;
74329
+ }
74330
+ }
74331
+ }
74332
+ this._isLocked = false;
74333
+ this.onResize();
74334
+ }
74335
+ }
74336
+ },
74337
+ enumerable: false,
74338
+ configurable: true
74339
+ });
74340
+ Object.defineProperty(DTableCategoryColumnImpl.prototype, "minWeight", {
74341
+ get: function () {
74342
+ var result = 0;
74343
+ var columns = this._columns;
74344
+ var columnsLength = columns.length;
74345
+ for (var i = 0; i < columnsLength; ++i) {
74346
+ var column = columns[i];
74347
+ var columnWeight = column.weight;
74348
+ if (!column.resizable && columnWeight != null) {
74349
+ result += columnWeight;
74350
+ }
74351
+ }
74352
+ return result;
74353
+ },
74354
+ enumerable: false,
74355
+ configurable: true
74356
+ });
74357
+ Object.defineProperty(DTableCategoryColumnImpl.prototype, "width", {
74358
+ get: function () {
74359
+ return this._width;
74360
+ },
74361
+ set: function (width) {
74362
+ var oldWidth = this._width;
74363
+ var nresizable = this._nresizable;
74364
+ if (0 < nresizable && oldWidth != null && oldWidth !== width) {
74365
+ var columns = this._columns;
74366
+ var columnsLength = columns.length;
74367
+ var minWidth = this.minWidth;
74368
+ var newWidth = Math.max(minWidth, width);
74369
+ if (oldWidth !== newWidth) {
74370
+ this._isLocked = true;
74371
+ if (minWidth < oldWidth) {
74372
+ var columnWidthRatio = (newWidth - minWidth) / (oldWidth - minWidth);
74373
+ for (var i = 0; i < columnsLength; ++i) {
74374
+ var column = columns[i];
74375
+ var columnWidth = column.width;
74376
+ if (column.resizable && columnWidth != null) {
74377
+ column.width = columnWidth * columnWidthRatio;
74378
+ }
74379
+ }
74380
+ }
74381
+ else {
74382
+ var newColumnWidth = (newWidth - minWidth) / this._nresizable;
74383
+ for (var i = 0; i < columnsLength; ++i) {
74384
+ var column = columns[i];
74385
+ var columnWidth = column.width;
74386
+ if (column.resizable && columnWidth != null) {
74387
+ column.width = newColumnWidth;
74388
+ }
74389
+ }
74390
+ }
74391
+ this._isLocked = false;
74392
+ this.onResize();
74393
+ }
74394
+ }
74395
+ },
74396
+ enumerable: false,
74397
+ configurable: true
74398
+ });
74399
+ Object.defineProperty(DTableCategoryColumnImpl.prototype, "minWidth", {
74400
+ get: function () {
74401
+ var result = 0;
74402
+ var columns = this._columns;
74403
+ var columnsLength = columns.length;
74404
+ for (var i = 0; i < columnsLength; ++i) {
74405
+ var column = columns[i];
74406
+ var columnWidth = column.width;
74407
+ if (!column.resizable && columnWidth != null) {
74408
+ result += columnWidth;
74409
+ }
74410
+ }
74411
+ return result;
74412
+ },
74413
+ enumerable: false,
74414
+ configurable: true
74415
+ });
74416
+ DTableCategoryColumnImpl.prototype.add = function (column) {
74417
+ this._columns.push(column);
74418
+ if (this._weight != null) {
74419
+ var weight = column.weight;
74420
+ if (weight != null) {
74421
+ this._weight += weight;
74422
+ if (column.resizable) {
74423
+ this._nresizable += 1;
74424
+ }
74425
+ column.on("resize", this._onResizeBound);
74426
+ }
74427
+ }
74428
+ else if (this._width != null) {
74429
+ var width = column.width;
74430
+ if (width != null) {
74431
+ this._width += width;
74432
+ if (column.resizable) {
74433
+ this._nresizable += 1;
74434
+ }
74435
+ column.on("resize", this._onResizeBound);
74436
+ }
74437
+ }
74438
+ };
74439
+ return DTableCategoryColumnImpl;
74440
+ }(pixi_js.utils.EventEmitter));
74441
+
74219
74442
  /*
74220
74443
  * Copyright (C) 2019 Toshiba Corporation
74221
74444
  * SPDX-License-Identifier: Apache-2.0
@@ -74314,403 +74537,1034 @@
74314
74537
  return DTableCategory;
74315
74538
  }(DTableRow));
74316
74539
 
74317
- /*
74318
- * Copyright (C) 2019 Toshiba Corporation
74319
- * SPDX-License-Identifier: Apache-2.0
74320
- */
74321
- var DTableDataTreeFilter = /** @class */ (function (_super) {
74322
- __extends(DTableDataTreeFilter, _super);
74323
- function DTableDataTreeFilter(parent) {
74324
- var _this = _super.call(this) || this;
74325
- _this._id = 0;
74326
- _this._idUpdated = -1;
74327
- _this._isApplied = false;
74328
- _this._parent = parent;
74329
- _this._filter = null;
74330
- _this._filtered = null;
74331
- return _this;
74332
- }
74333
- Object.defineProperty(DTableDataTreeFilter.prototype, "id", {
74334
- get: function () {
74335
- return this._id;
74336
- },
74337
- enumerable: false,
74338
- configurable: true
74339
- });
74340
- DTableDataTreeFilter.prototype.apply = function () {
74341
- this._isApplied = true;
74342
- this._id += 1;
74343
- this._parent.update();
74344
- };
74345
- DTableDataTreeFilter.prototype.unapply = function () {
74346
- if (this._isApplied) {
74347
- this._isApplied = false;
74348
- this._id += 1;
74349
- this._parent.update();
74350
- }
74351
- };
74352
- DTableDataTreeFilter.prototype.isApplied = function () {
74353
- return this._isApplied;
74354
- };
74355
- DTableDataTreeFilter.prototype.isFiltered = function (node, index, filter) {
74356
- if (isFunction(filter)) {
74357
- return filter(node, index);
74358
- }
74359
- else {
74360
- return filter.test(node, index);
74361
- }
74362
- };
74363
- DTableDataTreeFilter.prototype.hasFiltered = function (parent, nodes, filter) {
74364
- var accessor = this._parent.accessor;
74365
- var toChildren = accessor.toChildren;
74366
- var hasChildren = accessor.hasChildren;
74367
- for (var i = 0, imax = nodes.length; i < imax; ++i) {
74368
- var node = nodes[i];
74369
- if (this.isFiltered(node, -1, filter)) {
74370
- return true;
74371
- }
74372
- var children = toChildren(node);
74373
- if (hasChildren(node, children) && this.hasFiltered(parent, children, filter)) {
74374
- return true;
74375
- }
74540
+ var DTableCategoryContainerImpl = /** @class */ (function () {
74541
+ function DTableCategoryContainerImpl(columns, frozen, options) {
74542
+ var count = this.toCount(columns);
74543
+ var items = [];
74544
+ var offset = 0;
74545
+ for (var i = count - 1; 0 <= i; --i) {
74546
+ var item = new DTableCategory(this.toColumns(i, columns, frozen), frozen, offset, options);
74547
+ items.push(item);
74548
+ offset += item.height;
74376
74549
  }
74377
- return false;
74378
- };
74379
- DTableDataTreeFilter.prototype.addAllToFiltered = function (parent, nodes, filtered, cursor) {
74380
- var accessor = this._parent.accessor;
74381
- var toChildren = accessor.toChildren;
74382
- var hasChildren = accessor.hasChildren;
74383
- for (var i = 0, imax = nodes.length; i < imax; ++i) {
74384
- var node = nodes[i];
74385
- filtered.push(cursor[0]);
74386
- cursor[0] += 1;
74387
- var children = toChildren(node);
74388
- if (hasChildren(node, children) && parent.isOpened(node)) {
74389
- this.addAllToFiltered(parent, children, filtered, cursor);
74550
+ this.items = items;
74551
+ }
74552
+ DTableCategoryContainerImpl.prototype.toCount = function (columns) {
74553
+ var result = 0;
74554
+ for (var i = 0, imax = columns.length; i < imax; ++i) {
74555
+ var category = columns[i].category;
74556
+ if (category != null) {
74557
+ var count = isString(category) ? 1 : category.length;
74558
+ result = Math.max(result, count);
74390
74559
  }
74391
74560
  }
74561
+ return result;
74392
74562
  };
74393
- DTableDataTreeFilter.prototype.newFilteredSub = function (parent, nodes, filter, filtered, cursor) {
74394
- var result = false;
74395
- var accessor = this._parent.accessor;
74396
- var toChildren = accessor.toChildren;
74397
- var hasChildren = accessor.hasChildren;
74398
- for (var i = 0, imax = nodes.length; i < imax; ++i) {
74399
- var node = nodes[i];
74400
- var index = cursor[0];
74401
- cursor[0] += 1;
74402
- var isFiltered = this.isFiltered(node, index, filter);
74403
- var children = toChildren(node);
74404
- if (hasChildren(node, children)) {
74405
- if (parent.isOpened(node)) {
74406
- if (isFiltered) {
74407
- filtered.push(index);
74408
- result = true;
74409
- this.addAllToFiltered(parent, children, filtered, cursor);
74563
+ DTableCategoryContainerImpl.prototype.isCategory = function (index, a, b) {
74564
+ if (a != null) {
74565
+ if (b != null) {
74566
+ if (isString(a)) {
74567
+ if (isString(b)) {
74568
+ if (0 < index) {
74569
+ return true;
74570
+ }
74571
+ else {
74572
+ return a === b;
74573
+ }
74410
74574
  }
74411
74575
  else {
74412
- var position = filtered.length;
74413
- if (this.newFilteredSub(parent, children, filter, filtered, cursor)) {
74414
- filtered.splice(position, 0, index);
74415
- result = true;
74576
+ if (0 < index) {
74577
+ return b.length <= index;
74578
+ }
74579
+ else {
74580
+ return b.length === 1 && a === b[0];
74416
74581
  }
74417
74582
  }
74418
74583
  }
74419
- else if (isFiltered || this.hasFiltered(parent, children, filter)) {
74420
- filtered.push(index);
74421
- result = true;
74584
+ else {
74585
+ if (isString(b)) {
74586
+ if (0 < index) {
74587
+ return a.length <= index;
74588
+ }
74589
+ else {
74590
+ return a.length === 1 && a[0] === b;
74591
+ }
74592
+ }
74593
+ else {
74594
+ if (a.length <= index && b.length <= index) {
74595
+ return true;
74596
+ }
74597
+ else if (b.length === a.length) {
74598
+ for (var i = index, imax = a.length; i < imax; ++i) {
74599
+ if (a[i] !== b[i]) {
74600
+ return false;
74601
+ }
74602
+ }
74603
+ return true;
74604
+ }
74605
+ return false;
74606
+ }
74422
74607
  }
74423
74608
  }
74424
- else if (isFiltered) {
74425
- filtered.push(index);
74426
- result = true;
74427
- }
74428
- }
74429
- return result;
74430
- };
74431
- DTableDataTreeFilter.prototype.newFiltered = function () {
74432
- var filter = this._filter;
74433
- if (filter != null) {
74434
- var filtered = [];
74435
- var parent_1 = this._parent;
74436
- var nodes = parent_1.nodes;
74437
- if (nodes) {
74438
- var cursor = [0];
74439
- this.newFilteredSub(parent_1, nodes, filter, filtered, cursor);
74609
+ else {
74610
+ if (isString(a)) {
74611
+ if (0 < index) {
74612
+ return true;
74613
+ }
74614
+ else {
74615
+ return false;
74616
+ }
74617
+ }
74618
+ else {
74619
+ if (a.length <= index) {
74620
+ return true;
74621
+ }
74622
+ else {
74623
+ return false;
74624
+ }
74625
+ }
74440
74626
  }
74441
- return filtered;
74442
- }
74443
- return null;
74444
- };
74445
- DTableDataTreeFilter.prototype.get = function () {
74446
- return this._filter;
74447
- };
74448
- DTableDataTreeFilter.prototype.set = function (filter) {
74449
- if (this._filter !== filter) {
74450
- this._filter = filter;
74451
74627
  }
74452
- };
74453
- DTableDataTreeFilter.prototype.toDirty = function () {
74454
- this._id += 1;
74455
- };
74456
- DTableDataTreeFilter.prototype.update = function () {
74457
- if (this._id !== this._idUpdated) {
74458
- this._idUpdated = this._id;
74459
- if (this._isApplied) {
74460
- this._filtered = this.newFiltered();
74461
- this.emit("change", this);
74628
+ else {
74629
+ if (b != null) {
74630
+ if (isString(b)) {
74631
+ if (0 < index) {
74632
+ return true;
74633
+ }
74634
+ else {
74635
+ return false;
74636
+ }
74637
+ }
74638
+ else {
74639
+ if (b.length <= index) {
74640
+ return true;
74641
+ }
74642
+ else {
74643
+ return false;
74644
+ }
74645
+ }
74462
74646
  }
74463
- else if (this._filtered != null) {
74464
- this._filtered = null;
74465
- this.emit("change", this);
74647
+ else {
74648
+ return true;
74466
74649
  }
74467
74650
  }
74468
74651
  };
74469
- Object.defineProperty(DTableDataTreeFilter.prototype, "indices", {
74470
- get: function () {
74471
- this.update();
74472
- return this._filtered;
74473
- },
74474
- enumerable: false,
74475
- configurable: true
74476
- });
74477
- DTableDataTreeFilter.prototype.map = function (sortedIndex) {
74478
- var result = sortedIndex;
74479
- var indices = this.indices;
74480
- if (indices) {
74481
- var index = indices.indexOf(result);
74482
- if (0 <= index) {
74483
- result = index;
74652
+ DTableCategoryContainerImpl.prototype.toColumns = function (index, columns, frozen) {
74653
+ var result = [];
74654
+ var tcolumn = null;
74655
+ var ccolumn = null;
74656
+ for (var i = 0, imax = columns.length; i < imax; ++i) {
74657
+ var column = columns[i];
74658
+ if (i !== frozen &&
74659
+ ccolumn &&
74660
+ tcolumn &&
74661
+ this.isCategory(index, tcolumn.category, column.category)) {
74662
+ if (ccolumn.weight != null && column.weight != null) {
74663
+ ccolumn.add(column);
74664
+ }
74665
+ else if (ccolumn.width != null && column.width != null) {
74666
+ ccolumn.add(column);
74667
+ }
74668
+ else {
74669
+ tcolumn = column;
74670
+ ccolumn = new DTableCategoryColumnImpl(index, column);
74671
+ result.push(ccolumn);
74672
+ }
74484
74673
  }
74485
74674
  else {
74486
- return null;
74675
+ tcolumn = column;
74676
+ ccolumn = new DTableCategoryColumnImpl(index, column);
74677
+ result.push(ccolumn);
74487
74678
  }
74488
74679
  }
74489
74680
  return result;
74490
74681
  };
74491
- DTableDataTreeFilter.prototype.unmap = function (index) {
74492
- var result = index;
74493
- var indices = this.indices;
74494
- if (indices) {
74495
- result = indices[result];
74496
- }
74497
- return result;
74498
- };
74499
- return DTableDataTreeFilter;
74500
- }(pixi_js.utils.EventEmitter));
74682
+ return DTableCategoryContainerImpl;
74683
+ }());
74501
74684
 
74502
- /*
74503
- * Copyright (C) 2021 Toshiba Corporation
74504
- * SPDX-License-Identifier: Apache-2.0
74505
- */
74506
- var toParent = function (node) {
74507
- return node.parent;
74508
- };
74509
- var toChildren$1 = function (node) {
74510
- return node.children;
74685
+ var defaultGetter = function (row, columnIndex) {
74686
+ return row[columnIndex];
74511
74687
  };
74512
- var hasChildren = function (node, children) {
74513
- return children != null && 0 < children.length;
74688
+ var defaultSetter = function (row, columnIndex, cell) {
74689
+ row[columnIndex] = cell;
74514
74690
  };
74515
- var DTableDataTreeItemAccessor = /** @class */ (function () {
74516
- function DTableDataTreeItemAccessor(options) {
74517
- if (options != null) {
74518
- this.toParent = options.toParent || toParent;
74519
- this.toChildren = options.toChildren || toChildren$1;
74520
- this.hasChildren = options.hasChildren || hasChildren;
74691
+ var defaultGetterEmpty = function () { return ""; };
74692
+ var defaultSetterEmpty = function () {
74693
+ // DO NOTHING
74694
+ };
74695
+ var toPathGetter = function (path, def) {
74696
+ if (path.length <= 1) {
74697
+ var key_1 = path[0];
74698
+ if (def === undefined) {
74699
+ return function (row) {
74700
+ return row[key_1];
74701
+ };
74521
74702
  }
74522
74703
  else {
74523
- this.toParent = toParent;
74524
- this.toChildren = toChildren$1;
74525
- this.hasChildren = hasChildren;
74704
+ return function (row) {
74705
+ return Object.prototype.hasOwnProperty.call(row, key_1) ? row[key_1] : def;
74706
+ };
74526
74707
  }
74527
74708
  }
74528
- return DTableDataTreeItemAccessor;
74529
- }());
74530
-
74531
- /*
74532
- * Copyright (C) 2021 Toshiba Corporation
74533
- * SPDX-License-Identifier: Apache-2.0
74534
- */
74535
- var COMPARATOR = function (a, b) {
74536
- return a[0] - b[0];
74537
- };
74538
- var DTableDataTreeSelectionImpl = /** @class */ (function (_super) {
74539
- __extends(DTableDataTreeSelectionImpl, _super);
74540
- function DTableDataTreeSelectionImpl(parent, options) {
74541
- var _a;
74542
- var _this = _super.call(this) || this;
74543
- _this._parent = parent;
74544
- _this._type = toEnum((_a = options === null || options === void 0 ? void 0 : options.type) !== null && _a !== void 0 ? _a : DTableDataSelectionType.NONE, DTableDataSelectionType);
74545
- _this._rows = new Set();
74546
- // Events
74547
- var on = options === null || options === void 0 ? void 0 : options.on;
74548
- if (on) {
74549
- for (var name_1 in on) {
74550
- var handler = on[name_1];
74551
- if (handler) {
74552
- _this.on(name_1, handler);
74709
+ else {
74710
+ if (def === undefined) {
74711
+ return function (row) {
74712
+ for (var i = 0, imax = path.length - 1; i < imax; ++i) {
74713
+ row = row[path[i]];
74553
74714
  }
74554
- }
74715
+ return row[path[path.length - 1]];
74716
+ };
74717
+ }
74718
+ else {
74719
+ return function (row) {
74720
+ for (var i = 0, imax = path.length - 1; i < imax; ++i) {
74721
+ row = row[path[i]];
74722
+ }
74723
+ var key = path[path.length - 1];
74724
+ return Object.prototype.hasOwnProperty.call(row, key) ? row[key] : def;
74725
+ };
74555
74726
  }
74556
- return _this;
74557
74727
  }
74558
- Object.defineProperty(DTableDataTreeSelectionImpl.prototype, "parent", {
74559
- get: function () {
74560
- return this._parent;
74561
- },
74562
- enumerable: false,
74563
- configurable: true
74564
- });
74565
- DTableDataTreeSelectionImpl.prototype.onNodeChange = function (nodes) {
74566
- if (nodes != null) {
74567
- var accessor = this._parent.accessor;
74568
- var toChildren = accessor.toChildren;
74569
- var hasChildren = accessor.hasChildren;
74570
- var oldRows = this._rows;
74571
- var newRows = this.newRows(nodes, toChildren, hasChildren, oldRows, new Set());
74572
- if (oldRows.size !== newRows.size) {
74573
- this._rows = newRows;
74574
- this.onChange();
74728
+ };
74729
+ var toPathSetter = function (path) {
74730
+ if (path.length <= 1) {
74731
+ var key_2 = path[0];
74732
+ return function (row, columnIndex, cell) {
74733
+ row[key_2] = cell;
74734
+ };
74735
+ }
74736
+ else {
74737
+ return function (row, columnIndex, cell) {
74738
+ for (var i = 0, imax = path.length - 1; i < imax; ++i) {
74739
+ row = row[path[i]] || {};
74575
74740
  }
74741
+ row[path[path.length - 1]] = cell;
74742
+ };
74743
+ }
74744
+ };
74745
+ var toAlign = function (options, type) {
74746
+ var align = options.align;
74747
+ if (align != null) {
74748
+ if (isString(align)) {
74749
+ return DAlignHorizontal[align];
74576
74750
  }
74577
74751
  else {
74578
- var rows = this._rows;
74579
- if (0 < rows.size) {
74580
- rows.clear();
74581
- this.onChange();
74582
- }
74752
+ return align;
74583
74753
  }
74584
- };
74585
- DTableDataTreeSelectionImpl.prototype.newRows = function (nodes, toChildren, hasChildren, rows, result) {
74586
- for (var i = 0, imax = nodes.length; i < imax; ++i) {
74587
- var node = nodes[i];
74588
- if (rows.has(node)) {
74589
- result.add(node);
74590
- }
74591
- var children = toChildren(node);
74592
- if (hasChildren(node, children)) {
74593
- this.newRows(children, toChildren, hasChildren, rows, result);
74594
- }
74754
+ }
74755
+ switch (type) {
74756
+ case DTableColumnType.TEXT:
74757
+ case DTableColumnType.TEXT_AREA:
74758
+ return DAlignHorizontal.LEFT;
74759
+ case DTableColumnType.REAL:
74760
+ case DTableColumnType.INTEGER:
74761
+ return DAlignHorizontal.RIGHT;
74762
+ case DTableColumnType.BUTTON:
74763
+ case DTableColumnType.INDEX:
74764
+ case DTableColumnType.SELECT:
74765
+ case DTableColumnType.ACTION:
74766
+ case DTableColumnType.LINK:
74767
+ case DTableColumnType.CHECK:
74768
+ case DTableColumnType.CHECK_SINGLE:
74769
+ case DTableColumnType.COLOR:
74770
+ return DAlignHorizontal.CENTER;
74771
+ default:
74772
+ return DAlignHorizontal.LEFT;
74773
+ }
74774
+ };
74775
+ var toDataChecker = function (path) {
74776
+ if (path != null) {
74777
+ var pathLength_1 = path.length;
74778
+ if (pathLength_1 <= 1) {
74779
+ var key_3 = path[0];
74780
+ return function (row) {
74781
+ return Object.prototype.hasOwnProperty.call(row, key_3);
74782
+ };
74595
74783
  }
74596
- return result;
74597
- };
74598
- Object.defineProperty(DTableDataTreeSelectionImpl.prototype, "indices", {
74599
- get: function () {
74600
- var rows = this._rows;
74601
- var result = [];
74602
- this._parent.each(function (row, index) {
74603
- if (rows.has(row)) {
74604
- result.push(index);
74605
- }
74606
- });
74607
- return result;
74608
- },
74609
- enumerable: false,
74610
- configurable: true
74611
- });
74612
- Object.defineProperty(DTableDataTreeSelectionImpl.prototype, "rows", {
74613
- get: function () {
74614
- var result = [];
74615
- this._rows.forEach(function (row) {
74616
- result.push(row);
74617
- });
74618
- return result;
74619
- },
74620
- enumerable: false,
74621
- configurable: true
74622
- });
74623
- Object.defineProperty(DTableDataTreeSelectionImpl.prototype, "type", {
74624
- get: function () {
74625
- return this._type;
74626
- },
74627
- enumerable: false,
74628
- configurable: true
74629
- });
74630
- DTableDataTreeSelectionImpl.prototype.getFirst = function () {
74631
- var rows = this._rows;
74632
- if (0 < rows.size) {
74633
- var result_1 = null;
74634
- rows.forEach(function (row) {
74635
- if (result_1 == null) {
74636
- result_1 = row;
74784
+ else {
74785
+ return function (row) {
74786
+ for (var i = 0; i < pathLength_1; ++i) {
74787
+ var part = path[i];
74788
+ if (part in row) {
74789
+ row = row[part];
74790
+ }
74791
+ else {
74792
+ return false;
74793
+ }
74637
74794
  }
74638
- });
74639
- return result_1;
74795
+ return true;
74796
+ };
74640
74797
  }
74641
- return null;
74798
+ }
74799
+ return function (row, columnIndex) {
74800
+ return columnIndex < row.length;
74642
74801
  };
74643
- DTableDataTreeSelectionImpl.prototype.getLast = function () {
74644
- var rows = this._rows;
74645
- if (0 < rows.size) {
74646
- var result_2 = null;
74647
- rows.forEach(function (row) {
74648
- result_2 = row;
74649
- });
74650
- return result_2;
74802
+ };
74803
+ var toEditingEnable = function (enable, path) {
74804
+ if (isString(enable)) {
74805
+ return toDataChecker(path);
74806
+ }
74807
+ else if (enable != null) {
74808
+ return enable;
74809
+ }
74810
+ else {
74811
+ return false;
74812
+ }
74813
+ };
74814
+ var toEditing = function (options, path) {
74815
+ var _a;
74816
+ var editing = options.editing;
74817
+ var editable = options.editable;
74818
+ if (editing) {
74819
+ return {
74820
+ enable: toEditingEnable((_a = editing.enable) !== null && _a !== void 0 ? _a : editable, path),
74821
+ formatter: editing.formatter,
74822
+ unformatter: editing.unformatter,
74823
+ validator: editing.validator
74824
+ };
74825
+ }
74826
+ return {
74827
+ enable: toEditingEnable(editable, path)
74828
+ };
74829
+ };
74830
+ var toComparator = function (getter, index) {
74831
+ return function (rowA, rowB) {
74832
+ var valueA = getter(rowA, index);
74833
+ var valueB = getter(rowB, index);
74834
+ return valueA < valueB ? -1 : valueB < valueA ? +1 : 0;
74835
+ };
74836
+ };
74837
+ var toSorting = function (getter, index, options) {
74838
+ var sorting = options.sorting;
74839
+ var sortable = options.sortable;
74840
+ if (sorting) {
74841
+ if (sorting.enable || sortable) {
74842
+ return {
74843
+ enable: true,
74844
+ comparator: sorting.comparator || toComparator(getter, index)
74845
+ };
74651
74846
  }
74652
- return null;
74847
+ return {
74848
+ enable: false
74849
+ };
74850
+ }
74851
+ if (sortable) {
74852
+ return {
74853
+ enable: true,
74854
+ comparator: toComparator(getter, index)
74855
+ };
74856
+ }
74857
+ return {
74858
+ enable: false
74653
74859
  };
74654
- DTableDataTreeSelectionImpl.prototype.toIndex = function (target) {
74655
- var result = null;
74656
- this._parent.each(function (row, index) {
74657
- if (target === row) {
74658
- result = index;
74659
- return false;
74860
+ };
74861
+ var toMenu = function (options) {
74862
+ if (options == null) {
74863
+ return undefined;
74864
+ }
74865
+ else if (options instanceof DMenu) {
74866
+ return options;
74867
+ }
74868
+ else {
74869
+ return new DMenu(options);
74870
+ }
74871
+ };
74872
+ var toDialog = function (options) {
74873
+ if (options == null) {
74874
+ return undefined;
74875
+ }
74876
+ else if ("open" in options) {
74877
+ return options;
74878
+ }
74879
+ else {
74880
+ return new DDialogSelect(options);
74881
+ }
74882
+ };
74883
+ var defaultSelectingGetter = function (dialog) {
74884
+ return dialog.value;
74885
+ };
74886
+ var defaultSelectingSetter = function () {
74887
+ // DO NOTHING
74888
+ };
74889
+ var toSelecting = function (options) {
74890
+ if (options) {
74891
+ return {
74892
+ getter: options.getter || defaultSelectingGetter,
74893
+ setter: options.setter || defaultSelectingSetter,
74894
+ menu: toMenu(options.menu),
74895
+ multiple: toMenu(options.multiple),
74896
+ dialog: toDialog(options.dialog),
74897
+ promise: options.promise
74898
+ };
74899
+ }
74900
+ return {
74901
+ getter: defaultSelectingGetter,
74902
+ setter: defaultSelectingSetter
74903
+ };
74904
+ };
74905
+ var toGetter = function (options, type, parts) {
74906
+ var getter = options.getter;
74907
+ if (getter) {
74908
+ return getter;
74909
+ }
74910
+ switch (type) {
74911
+ case DTableColumnType.ACTION:
74912
+ case DTableColumnType.LINK:
74913
+ return defaultGetterEmpty;
74914
+ default:
74915
+ if (parts == null) {
74916
+ return defaultGetter;
74660
74917
  }
74661
- return true;
74662
- });
74663
- return result;
74918
+ else {
74919
+ return toPathGetter(parts, options.default);
74920
+ }
74921
+ }
74922
+ };
74923
+ var toSetter = function (options, type, path) {
74924
+ var setter = options.setter;
74925
+ if (setter) {
74926
+ return setter;
74927
+ }
74928
+ switch (type) {
74929
+ case DTableColumnType.BUTTON:
74930
+ case DTableColumnType.ACTION:
74931
+ case DTableColumnType.LINK:
74932
+ return defaultSetterEmpty;
74933
+ default:
74934
+ if (path == null) {
74935
+ return defaultSetter;
74936
+ }
74937
+ else {
74938
+ return toPathSetter(path);
74939
+ }
74940
+ }
74941
+ };
74942
+ var toState = function (options) {
74943
+ var state = options.state;
74944
+ if (state != null) {
74945
+ if (isString(state) || isArray(state)) {
74946
+ return {
74947
+ initial: state,
74948
+ modifier: undefined
74949
+ };
74950
+ }
74951
+ else {
74952
+ return {
74953
+ initial: undefined,
74954
+ modifier: state
74955
+ };
74956
+ }
74957
+ }
74958
+ return {
74959
+ initial: undefined,
74960
+ modifier: undefined
74664
74961
  };
74665
- Object.defineProperty(DTableDataTreeSelectionImpl.prototype, "first", {
74962
+ };
74963
+ var toPath = function (options) {
74964
+ return options.path != null ? options.path.split(".") : null;
74965
+ };
74966
+ var toRenderable = function (options, path) {
74967
+ var renderable = options.renderable;
74968
+ if (isString(renderable)) {
74969
+ return toDataChecker(path);
74970
+ }
74971
+ else if (renderable != null) {
74972
+ return renderable;
74973
+ }
74974
+ return true;
74975
+ };
74976
+ var DTableColumnImpl = /** @class */ (function (_super) {
74977
+ __extends(DTableColumnImpl, _super);
74978
+ function DTableColumnImpl(index, options) {
74979
+ var _a, _b, _c;
74980
+ var _this = _super.call(this) || this;
74981
+ var weight = options.weight;
74982
+ var width = options.width;
74983
+ if (weight != null) {
74984
+ if (width != null) {
74985
+ width = undefined;
74986
+ }
74987
+ }
74988
+ else if (width == null) {
74989
+ weight = 1;
74990
+ }
74991
+ var type = toEnum((_a = options.type) !== null && _a !== void 0 ? _a : DTableColumnType.TEXT, DTableColumnType);
74992
+ var align = toAlign(options, type);
74993
+ var label = options.label || "";
74994
+ var path = toPath(options);
74995
+ var getter = toGetter(options, type, path);
74996
+ var setter = toSetter(options, type, path);
74997
+ _this._weight = weight;
74998
+ _this._width = width;
74999
+ _this.resizable = (_b = options.resizable) !== null && _b !== void 0 ? _b : false;
75000
+ _this.type = type;
75001
+ _this.label = label;
75002
+ _this.getter = getter;
75003
+ _this.setter = setter;
75004
+ _this.formatter = options.formatter;
75005
+ _this.renderable = toRenderable(options, path);
75006
+ _this.align = align;
75007
+ _this.state = toState(options);
75008
+ _this.editing = toEditing(options, path);
75009
+ _this.sorting = toSorting(getter, index, options);
75010
+ _this.header = options.header;
75011
+ _this.body = options.body;
75012
+ _this.selecting = toSelecting(options.selecting);
75013
+ _this.category = options.category;
75014
+ _this.frozen = options.frozen;
75015
+ _this.offset = 0.0;
75016
+ _this.link = options.link;
75017
+ _this.update = toEnum((_c = options.update) !== null && _c !== void 0 ? _c : DTableColumnUpdate.CELL, DTableColumnUpdate);
75018
+ return _this;
75019
+ }
75020
+ Object.defineProperty(DTableColumnImpl.prototype, "weight", {
74666
75021
  get: function () {
74667
- var row = this.getFirst();
74668
- if (row) {
74669
- return this.toIndex(row);
75022
+ return this._weight;
75023
+ },
75024
+ set: function (weight) {
75025
+ if (this._weight != null && this._weight !== weight) {
75026
+ this._weight = weight;
75027
+ this.emit("resize", this);
74670
75028
  }
74671
- return null;
74672
75029
  },
74673
75030
  enumerable: false,
74674
75031
  configurable: true
74675
75032
  });
74676
- Object.defineProperty(DTableDataTreeSelectionImpl.prototype, "last", {
75033
+ Object.defineProperty(DTableColumnImpl.prototype, "width", {
74677
75034
  get: function () {
74678
- var row = this.getLast();
74679
- if (row) {
74680
- return this.toIndex(row);
75035
+ return this._width;
75036
+ },
75037
+ set: function (width) {
75038
+ if (this._width != null && this._width !== width) {
75039
+ this._width = width;
75040
+ this.emit("resize", this);
74681
75041
  }
74682
- return null;
74683
75042
  },
74684
75043
  enumerable: false,
74685
75044
  configurable: true
74686
75045
  });
74687
- DTableDataTreeSelectionImpl.prototype.onChange = function () {
74688
- this._parent.update();
74689
- this.emit("change", this);
74690
- };
74691
- DTableDataTreeSelectionImpl.prototype.toggle = function (rowIndex) {
74692
- var row = this._parent.get(rowIndex);
74693
- if (row) {
74694
- var rows = this._rows;
74695
- if (rows.has(row)) {
74696
- rows.delete(row);
74697
- }
74698
- else {
74699
- rows.add(row);
75046
+ return DTableColumnImpl;
75047
+ }(pixi_js.utils.EventEmitter));
75048
+
75049
+ var DTableColumnContainerImpl = /** @class */ (function (_super) {
75050
+ __extends(DTableColumnContainerImpl, _super);
75051
+ function DTableColumnContainerImpl(parent, options) {
75052
+ var _this = _super.call(this) || this;
75053
+ _this.parent = parent;
75054
+ var columns = [];
75055
+ if (options != null) {
75056
+ for (var i = 0, imax = options.length; i < imax; ++i) {
75057
+ var column = new DTableColumnImpl(i, options[i]);
75058
+ columns.push(column);
75059
+ column.on("resize", _this.newOnColumnResize(i, column));
74700
75060
  }
74701
- this.onChange();
74702
75061
  }
74703
- };
74704
- DTableDataTreeSelectionImpl.prototype.add = function (rowIndex) {
74705
- var row = this._parent.get(rowIndex);
74706
- if (row) {
74707
- var rows = this._rows;
74708
- if (!rows.has(row)) {
74709
- rows.add(row);
74710
- this.onChange();
75062
+ _this.items = columns;
75063
+ var frozen = 0;
75064
+ for (var i = columns.length - 1; 0 <= i; --i) {
75065
+ if (columns[i].frozen === true) {
75066
+ frozen = i + 1;
75067
+ break;
74711
75068
  }
74712
75069
  }
74713
- };
75070
+ _this.frozen = frozen;
75071
+ return _this;
75072
+ }
75073
+ DTableColumnContainerImpl.prototype.newOnColumnResize = function (index, column) {
75074
+ var _this = this;
75075
+ return function () {
75076
+ _this.onColumnResize(index, column);
75077
+ };
75078
+ };
75079
+ DTableColumnContainerImpl.prototype.onColumnResize = function (index, column) {
75080
+ this.onColumnResizeHeader(index, column);
75081
+ this.onColumnResizeBody(index, column);
75082
+ this.emit("resize", index, column, this);
75083
+ };
75084
+ DTableColumnContainerImpl.prototype.onColumnResizeHeader = function (index, column) {
75085
+ var header = this.parent.header;
75086
+ if (header != null) {
75087
+ var columnWeight = column.weight;
75088
+ if (columnWeight != null) {
75089
+ this.onColumnResizeWeight(header, index, columnWeight);
75090
+ }
75091
+ else {
75092
+ var columnWidth = column.width;
75093
+ if (columnWidth != null) {
75094
+ this.onColumnResizeWidth(header, index, columnWidth);
75095
+ }
75096
+ }
75097
+ }
75098
+ };
75099
+ DTableColumnContainerImpl.prototype.onColumnResizeBody = function (index, column) {
75100
+ var rows = this.parent.body.children;
75101
+ var columnWeight = column.weight;
75102
+ if (columnWeight != null) {
75103
+ for (var i = 0, imax = rows.length; i < imax; ++i) {
75104
+ this.onColumnResizeWeight(rows[i], index, columnWeight);
75105
+ }
75106
+ }
75107
+ else {
75108
+ var columnWidth = column.width;
75109
+ if (columnWidth != null) {
75110
+ for (var i = 0, imax = rows.length; i < imax; ++i) {
75111
+ this.onColumnResizeWidth(rows[i], index, columnWidth);
75112
+ }
75113
+ }
75114
+ }
75115
+ };
75116
+ DTableColumnContainerImpl.prototype.onColumnResizeWeight = function (row, index, columnWeight) {
75117
+ var cells = row.children;
75118
+ var cellsLength = cells.length;
75119
+ var cellsIndex = cellsLength - index - 1;
75120
+ if (0 <= cellsIndex && cellsIndex < cellsLength) {
75121
+ cells[cellsIndex].weight = columnWeight;
75122
+ }
75123
+ };
75124
+ DTableColumnContainerImpl.prototype.onColumnResizeWidth = function (row, index, columnWidth) {
75125
+ var cells = row.children;
75126
+ var cellsLength = cells.length;
75127
+ var cellsIndex = cellsLength - index - 1;
75128
+ if (0 <= cellsIndex && cellsIndex < cellsLength) {
75129
+ cells[cellsIndex].width = columnWidth;
75130
+ }
75131
+ };
75132
+ Object.defineProperty(DTableColumnContainerImpl.prototype, "width", {
75133
+ get: function () {
75134
+ var result = 0;
75135
+ var items = this.items;
75136
+ var length = items.length;
75137
+ for (var i = 0; i < length; ++i) {
75138
+ var item = items[i];
75139
+ var itemWidth = item.width;
75140
+ if (itemWidth != null) {
75141
+ result += itemWidth;
75142
+ }
75143
+ }
75144
+ return result;
75145
+ },
75146
+ enumerable: false,
75147
+ configurable: true
75148
+ });
75149
+ DTableColumnContainerImpl.prototype.get = function (index) {
75150
+ var columns = this.items;
75151
+ if (0 <= index && index < columns.length) {
75152
+ return columns[index];
75153
+ }
75154
+ return null;
75155
+ };
75156
+ DTableColumnContainerImpl.prototype.each = function (iteratee) {
75157
+ var columns = this.items;
75158
+ for (var i = 0, imax = columns.length; i < imax; ++i) {
75159
+ if (iteratee(columns[i], i) === false) {
75160
+ break;
75161
+ }
75162
+ }
75163
+ return this;
75164
+ };
75165
+ DTableColumnContainerImpl.prototype.size = function () {
75166
+ return this.items.length;
75167
+ };
75168
+ return DTableColumnContainerImpl;
75169
+ }(pixi_js.utils.EventEmitter));
75170
+
75171
+ /*
75172
+ * Copyright (C) 2019 Toshiba Corporation
75173
+ * SPDX-License-Identifier: Apache-2.0
75174
+ */
75175
+ var DTableDataTreeFilter = /** @class */ (function (_super) {
75176
+ __extends(DTableDataTreeFilter, _super);
75177
+ function DTableDataTreeFilter(parent) {
75178
+ var _this = _super.call(this) || this;
75179
+ _this._id = 0;
75180
+ _this._idUpdated = -1;
75181
+ _this._isApplied = false;
75182
+ _this._parent = parent;
75183
+ _this._filter = null;
75184
+ _this._filtered = null;
75185
+ return _this;
75186
+ }
75187
+ Object.defineProperty(DTableDataTreeFilter.prototype, "id", {
75188
+ get: function () {
75189
+ return this._id;
75190
+ },
75191
+ enumerable: false,
75192
+ configurable: true
75193
+ });
75194
+ DTableDataTreeFilter.prototype.apply = function () {
75195
+ this._isApplied = true;
75196
+ this._id += 1;
75197
+ this._parent.update();
75198
+ };
75199
+ DTableDataTreeFilter.prototype.unapply = function () {
75200
+ if (this._isApplied) {
75201
+ this._isApplied = false;
75202
+ this._id += 1;
75203
+ this._parent.update();
75204
+ }
75205
+ };
75206
+ DTableDataTreeFilter.prototype.isApplied = function () {
75207
+ return this._isApplied;
75208
+ };
75209
+ DTableDataTreeFilter.prototype.isFiltered = function (node, index, filter) {
75210
+ if (isFunction(filter)) {
75211
+ return filter(node, index);
75212
+ }
75213
+ else {
75214
+ return filter.test(node, index);
75215
+ }
75216
+ };
75217
+ DTableDataTreeFilter.prototype.hasFiltered = function (parent, nodes, filter) {
75218
+ var accessor = this._parent.accessor;
75219
+ var toChildren = accessor.toChildren;
75220
+ var hasChildren = accessor.hasChildren;
75221
+ for (var i = 0, imax = nodes.length; i < imax; ++i) {
75222
+ var node = nodes[i];
75223
+ if (this.isFiltered(node, -1, filter)) {
75224
+ return true;
75225
+ }
75226
+ var children = toChildren(node);
75227
+ if (hasChildren(node, children) && this.hasFiltered(parent, children, filter)) {
75228
+ return true;
75229
+ }
75230
+ }
75231
+ return false;
75232
+ };
75233
+ DTableDataTreeFilter.prototype.addAllToFiltered = function (parent, nodes, filtered, cursor) {
75234
+ var accessor = this._parent.accessor;
75235
+ var toChildren = accessor.toChildren;
75236
+ var hasChildren = accessor.hasChildren;
75237
+ for (var i = 0, imax = nodes.length; i < imax; ++i) {
75238
+ var node = nodes[i];
75239
+ filtered.push(cursor[0]);
75240
+ cursor[0] += 1;
75241
+ var children = toChildren(node);
75242
+ if (hasChildren(node, children) && parent.isOpened(node)) {
75243
+ this.addAllToFiltered(parent, children, filtered, cursor);
75244
+ }
75245
+ }
75246
+ };
75247
+ DTableDataTreeFilter.prototype.newFilteredSub = function (parent, nodes, filter, filtered, cursor) {
75248
+ var result = false;
75249
+ var accessor = this._parent.accessor;
75250
+ var toChildren = accessor.toChildren;
75251
+ var hasChildren = accessor.hasChildren;
75252
+ for (var i = 0, imax = nodes.length; i < imax; ++i) {
75253
+ var node = nodes[i];
75254
+ var index = cursor[0];
75255
+ cursor[0] += 1;
75256
+ var isFiltered = this.isFiltered(node, index, filter);
75257
+ var children = toChildren(node);
75258
+ if (hasChildren(node, children)) {
75259
+ if (parent.isOpened(node)) {
75260
+ if (isFiltered) {
75261
+ filtered.push(index);
75262
+ result = true;
75263
+ this.addAllToFiltered(parent, children, filtered, cursor);
75264
+ }
75265
+ else {
75266
+ var position = filtered.length;
75267
+ if (this.newFilteredSub(parent, children, filter, filtered, cursor)) {
75268
+ filtered.splice(position, 0, index);
75269
+ result = true;
75270
+ }
75271
+ }
75272
+ }
75273
+ else if (isFiltered || this.hasFiltered(parent, children, filter)) {
75274
+ filtered.push(index);
75275
+ result = true;
75276
+ }
75277
+ }
75278
+ else if (isFiltered) {
75279
+ filtered.push(index);
75280
+ result = true;
75281
+ }
75282
+ }
75283
+ return result;
75284
+ };
75285
+ DTableDataTreeFilter.prototype.newFiltered = function () {
75286
+ var filter = this._filter;
75287
+ if (filter != null) {
75288
+ var filtered = [];
75289
+ var parent_1 = this._parent;
75290
+ var nodes = parent_1.nodes;
75291
+ if (nodes) {
75292
+ var cursor = [0];
75293
+ this.newFilteredSub(parent_1, nodes, filter, filtered, cursor);
75294
+ }
75295
+ return filtered;
75296
+ }
75297
+ return null;
75298
+ };
75299
+ DTableDataTreeFilter.prototype.get = function () {
75300
+ return this._filter;
75301
+ };
75302
+ DTableDataTreeFilter.prototype.set = function (filter) {
75303
+ if (this._filter !== filter) {
75304
+ this._filter = filter;
75305
+ }
75306
+ };
75307
+ DTableDataTreeFilter.prototype.toDirty = function () {
75308
+ this._id += 1;
75309
+ };
75310
+ DTableDataTreeFilter.prototype.update = function () {
75311
+ if (this._id !== this._idUpdated) {
75312
+ this._idUpdated = this._id;
75313
+ if (this._isApplied) {
75314
+ this._filtered = this.newFiltered();
75315
+ this.emit("change", this);
75316
+ }
75317
+ else if (this._filtered != null) {
75318
+ this._filtered = null;
75319
+ this.emit("change", this);
75320
+ }
75321
+ }
75322
+ };
75323
+ Object.defineProperty(DTableDataTreeFilter.prototype, "indices", {
75324
+ get: function () {
75325
+ this.update();
75326
+ return this._filtered;
75327
+ },
75328
+ enumerable: false,
75329
+ configurable: true
75330
+ });
75331
+ DTableDataTreeFilter.prototype.map = function (sortedIndex) {
75332
+ var result = sortedIndex;
75333
+ var indices = this.indices;
75334
+ if (indices) {
75335
+ var index = indices.indexOf(result);
75336
+ if (0 <= index) {
75337
+ result = index;
75338
+ }
75339
+ else {
75340
+ return null;
75341
+ }
75342
+ }
75343
+ return result;
75344
+ };
75345
+ DTableDataTreeFilter.prototype.unmap = function (index) {
75346
+ var result = index;
75347
+ var indices = this.indices;
75348
+ if (indices) {
75349
+ result = indices[result];
75350
+ }
75351
+ return result;
75352
+ };
75353
+ return DTableDataTreeFilter;
75354
+ }(pixi_js.utils.EventEmitter));
75355
+
75356
+ /*
75357
+ * Copyright (C) 2021 Toshiba Corporation
75358
+ * SPDX-License-Identifier: Apache-2.0
75359
+ */
75360
+ var toParent = function (node) {
75361
+ return node.parent;
75362
+ };
75363
+ var toChildren$1 = function (node) {
75364
+ return node.children;
75365
+ };
75366
+ var hasChildren = function (node, children) {
75367
+ return children != null && 0 < children.length;
75368
+ };
75369
+ var DTableDataTreeItemAccessor = /** @class */ (function () {
75370
+ function DTableDataTreeItemAccessor(options) {
75371
+ if (options != null) {
75372
+ this.toParent = options.toParent || toParent;
75373
+ this.toChildren = options.toChildren || toChildren$1;
75374
+ this.hasChildren = options.hasChildren || hasChildren;
75375
+ }
75376
+ else {
75377
+ this.toParent = toParent;
75378
+ this.toChildren = toChildren$1;
75379
+ this.hasChildren = hasChildren;
75380
+ }
75381
+ }
75382
+ return DTableDataTreeItemAccessor;
75383
+ }());
75384
+
75385
+ /*
75386
+ * Copyright (C) 2021 Toshiba Corporation
75387
+ * SPDX-License-Identifier: Apache-2.0
75388
+ */
75389
+ var COMPARATOR = function (a, b) {
75390
+ return a[0] - b[0];
75391
+ };
75392
+ var DTableDataTreeSelectionImpl = /** @class */ (function (_super) {
75393
+ __extends(DTableDataTreeSelectionImpl, _super);
75394
+ function DTableDataTreeSelectionImpl(parent, options) {
75395
+ var _a;
75396
+ var _this = _super.call(this) || this;
75397
+ _this._parent = parent;
75398
+ _this._type = toEnum((_a = options === null || options === void 0 ? void 0 : options.type) !== null && _a !== void 0 ? _a : DTableDataSelectionType.NONE, DTableDataSelectionType);
75399
+ _this._rows = new Set();
75400
+ // Events
75401
+ var on = options === null || options === void 0 ? void 0 : options.on;
75402
+ if (on) {
75403
+ for (var name_1 in on) {
75404
+ var handler = on[name_1];
75405
+ if (handler) {
75406
+ _this.on(name_1, handler);
75407
+ }
75408
+ }
75409
+ }
75410
+ return _this;
75411
+ }
75412
+ Object.defineProperty(DTableDataTreeSelectionImpl.prototype, "parent", {
75413
+ get: function () {
75414
+ return this._parent;
75415
+ },
75416
+ enumerable: false,
75417
+ configurable: true
75418
+ });
75419
+ DTableDataTreeSelectionImpl.prototype.onNodeChange = function (nodes) {
75420
+ if (nodes != null) {
75421
+ var accessor = this._parent.accessor;
75422
+ var toChildren = accessor.toChildren;
75423
+ var hasChildren = accessor.hasChildren;
75424
+ var oldRows = this._rows;
75425
+ var newRows = this.newRows(nodes, toChildren, hasChildren, oldRows, new Set());
75426
+ if (oldRows.size !== newRows.size) {
75427
+ this._rows = newRows;
75428
+ this.onChange();
75429
+ }
75430
+ }
75431
+ else {
75432
+ var rows = this._rows;
75433
+ if (0 < rows.size) {
75434
+ rows.clear();
75435
+ this.onChange();
75436
+ }
75437
+ }
75438
+ };
75439
+ DTableDataTreeSelectionImpl.prototype.newRows = function (nodes, toChildren, hasChildren, rows, result) {
75440
+ for (var i = 0, imax = nodes.length; i < imax; ++i) {
75441
+ var node = nodes[i];
75442
+ if (rows.has(node)) {
75443
+ result.add(node);
75444
+ }
75445
+ var children = toChildren(node);
75446
+ if (hasChildren(node, children)) {
75447
+ this.newRows(children, toChildren, hasChildren, rows, result);
75448
+ }
75449
+ }
75450
+ return result;
75451
+ };
75452
+ Object.defineProperty(DTableDataTreeSelectionImpl.prototype, "indices", {
75453
+ get: function () {
75454
+ var rows = this._rows;
75455
+ var result = [];
75456
+ this._parent.each(function (row, index) {
75457
+ if (rows.has(row)) {
75458
+ result.push(index);
75459
+ }
75460
+ });
75461
+ return result;
75462
+ },
75463
+ enumerable: false,
75464
+ configurable: true
75465
+ });
75466
+ Object.defineProperty(DTableDataTreeSelectionImpl.prototype, "rows", {
75467
+ get: function () {
75468
+ var result = [];
75469
+ this._rows.forEach(function (row) {
75470
+ result.push(row);
75471
+ });
75472
+ return result;
75473
+ },
75474
+ enumerable: false,
75475
+ configurable: true
75476
+ });
75477
+ Object.defineProperty(DTableDataTreeSelectionImpl.prototype, "type", {
75478
+ get: function () {
75479
+ return this._type;
75480
+ },
75481
+ enumerable: false,
75482
+ configurable: true
75483
+ });
75484
+ DTableDataTreeSelectionImpl.prototype.getFirst = function () {
75485
+ var rows = this._rows;
75486
+ if (0 < rows.size) {
75487
+ var result_1 = null;
75488
+ rows.forEach(function (row) {
75489
+ if (result_1 == null) {
75490
+ result_1 = row;
75491
+ }
75492
+ });
75493
+ return result_1;
75494
+ }
75495
+ return null;
75496
+ };
75497
+ DTableDataTreeSelectionImpl.prototype.getLast = function () {
75498
+ var rows = this._rows;
75499
+ if (0 < rows.size) {
75500
+ var result_2 = null;
75501
+ rows.forEach(function (row) {
75502
+ result_2 = row;
75503
+ });
75504
+ return result_2;
75505
+ }
75506
+ return null;
75507
+ };
75508
+ DTableDataTreeSelectionImpl.prototype.toIndex = function (target) {
75509
+ var result = null;
75510
+ this._parent.each(function (row, index) {
75511
+ if (target === row) {
75512
+ result = index;
75513
+ return false;
75514
+ }
75515
+ return true;
75516
+ });
75517
+ return result;
75518
+ };
75519
+ Object.defineProperty(DTableDataTreeSelectionImpl.prototype, "first", {
75520
+ get: function () {
75521
+ var row = this.getFirst();
75522
+ if (row) {
75523
+ return this.toIndex(row);
75524
+ }
75525
+ return null;
75526
+ },
75527
+ enumerable: false,
75528
+ configurable: true
75529
+ });
75530
+ Object.defineProperty(DTableDataTreeSelectionImpl.prototype, "last", {
75531
+ get: function () {
75532
+ var row = this.getLast();
75533
+ if (row) {
75534
+ return this.toIndex(row);
75535
+ }
75536
+ return null;
75537
+ },
75538
+ enumerable: false,
75539
+ configurable: true
75540
+ });
75541
+ DTableDataTreeSelectionImpl.prototype.onChange = function () {
75542
+ this._parent.update();
75543
+ this.emit("change", this);
75544
+ };
75545
+ DTableDataTreeSelectionImpl.prototype.toggle = function (rowIndex) {
75546
+ var row = this._parent.get(rowIndex);
75547
+ if (row) {
75548
+ var rows = this._rows;
75549
+ if (rows.has(row)) {
75550
+ rows.delete(row);
75551
+ }
75552
+ else {
75553
+ rows.add(row);
75554
+ }
75555
+ this.onChange();
75556
+ }
75557
+ };
75558
+ DTableDataTreeSelectionImpl.prototype.add = function (rowIndex) {
75559
+ var row = this._parent.get(rowIndex);
75560
+ if (row) {
75561
+ var rows = this._rows;
75562
+ if (!rows.has(row)) {
75563
+ rows.add(row);
75564
+ this.onChange();
75565
+ }
75566
+ }
75567
+ };
74714
75568
  DTableDataTreeSelectionImpl.prototype.addTo = function (rowIndex) {
74715
75569
  var lastRowIndex = this.last;
74716
75570
  if (lastRowIndex != null) {
@@ -75206,1498 +76060,649 @@
75206
76060
  return this._isFilterable;
75207
76061
  },
75208
76062
  set: function (isFilterable) {
75209
- this._isFilterable = isFilterable;
75210
- },
75211
- enumerable: false,
75212
- configurable: true
75213
- });
75214
- Object.defineProperty(DTableHeaderCellCheck.prototype, "isEmittable", {
75215
- get: function () {
75216
- return this._isEmittable;
75217
- },
75218
- set: function (isEmittable) {
75219
- this._isEmittable = isEmittable;
75220
- },
75221
- enumerable: false,
75222
- configurable: true
75223
- });
75224
- DTableHeaderCellCheck.prototype.newIteratee = function (table, isChecked) {
75225
- var parent = this._parent;
75226
- var column = parent.column;
75227
- var columnIndex = parent.columnIndex;
75228
- if (column != null && columnIndex != null) {
75229
- var getter_1 = column.getter;
75230
- var setter_1 = column.setter;
75231
- if (this._isEmittable) {
75232
- var data_1 = table.data;
75233
- return function (row, rowIndex) {
75234
- if (getter_1(row, columnIndex) !== isChecked) {
75235
- setter_1(row, columnIndex, isChecked);
75236
- data_1.emit("change", isChecked, !isChecked, row, rowIndex, columnIndex, data_1);
75237
- return true;
75238
- }
75239
- return false;
75240
- };
75241
- }
75242
- else {
75243
- return function (row) {
75244
- if (getter_1(row, columnIndex) !== isChecked) {
75245
- setter_1(row, columnIndex, isChecked);
75246
- return true;
75247
- }
75248
- return false;
75249
- };
75250
- }
75251
- }
75252
- return null;
75253
- };
75254
- DTableHeaderCellCheck.prototype.execute = function (isChecked) {
75255
- var _a;
75256
- var table = (_a = this._parent.header) === null || _a === void 0 ? void 0 : _a.table;
75257
- if (table) {
75258
- var iteratee_1 = this.newIteratee(table, isChecked);
75259
- if (iteratee_1) {
75260
- var isChanged_1 = false;
75261
- if (this._isFilterable) {
75262
- table.data.mapped.each(function (row, supplimental, index, unmappedIndex) {
75263
- if (iteratee_1(row, unmappedIndex)) {
75264
- isChanged_1 = true;
75265
- }
75266
- });
75267
- }
75268
- else {
75269
- table.data.each(function (row, index) {
75270
- if (iteratee_1(row, index)) {
75271
- isChanged_1 = true;
75272
- }
75273
- });
75274
- }
75275
- if (isChanged_1) {
75276
- table.body.update(true);
75277
- }
75278
- }
75279
- }
75280
- };
75281
- return DTableHeaderCellCheck;
75282
- }());
75283
-
75284
- /*
75285
- * Copyright (C) 2019 Toshiba Corporation
75286
- * SPDX-License-Identifier: Apache-2.0
75287
- */
75288
- var DTableHeaderCellEdge = {
75289
- NONE: 0,
75290
- LEFT: 1,
75291
- RIGHT: 2,
75292
- BOTH: 3
75293
- };
75294
- var DTableHeaderCell = /** @class */ (function (_super) {
75295
- __extends(DTableHeaderCell, _super);
75296
- function DTableHeaderCell(header, columnIndex, column, options) {
75297
- var _this = _super.call(this, options) || this;
75298
- _this._header = header;
75299
- _this._column = column;
75300
- _this._columnIndex = columnIndex;
75301
- var check = new DTableHeaderCellCheck(_this, options === null || options === void 0 ? void 0 : options.check);
75302
- _this._check = check;
75303
- _this._edgeSize = _this.theme.getEdgeWidth();
75304
- _this._wasResizing = false;
75305
- var sortable = column.sorting.enable;
75306
- var checkable = check.isEnabled;
75307
- if (checkable || sortable) {
75308
- _this.on(UtilPointerEvent.tap, function (e) {
75309
- _this.onClick(e);
75310
- });
75311
- var state = _this.state;
75312
- state.lock();
75313
- state.set(DTableState.SORTABLE, sortable);
75314
- state.set(DTableState.CHECKABLE, checkable);
75315
- state.unlock();
75316
- }
75317
- return _this;
75318
- }
75319
- Object.defineProperty(DTableHeaderCell.prototype, "column", {
75320
- get: function () {
75321
- return this._column;
75322
- },
75323
- enumerable: false,
75324
- configurable: true
75325
- });
75326
- Object.defineProperty(DTableHeaderCell.prototype, "columnIndex", {
75327
- get: function () {
75328
- return this._columnIndex;
75329
- },
75330
- enumerable: false,
75331
- configurable: true
75332
- });
75333
- Object.defineProperty(DTableHeaderCell.prototype, "header", {
75334
- get: function () {
75335
- return this._header;
75336
- },
75337
- enumerable: false,
75338
- configurable: true
75339
- });
75340
- Object.defineProperty(DTableHeaderCell.prototype, "check", {
75341
- get: function () {
75342
- return this._check;
75343
- },
75344
- enumerable: false,
75345
- configurable: true
75346
- });
75347
- DTableHeaderCell.prototype.onDown = function (e) {
75348
- var edges = this.state.valueOf(DTableState.HOVERED_ON_EDGE);
75349
- if (edges != null) {
75350
- this._wasResizing = true;
75351
- var layer = DApplications.getLayer(this);
75352
- if (layer != null) {
75353
- var interactionManager = layer.renderer.plugins.interaction;
75354
- var columnIndex = this._columnIndex;
75355
- if (edges === DTableHeaderCellEdge.LEFT) {
75356
- this.onDownEdge(e.data.global.x, columnIndex - 1, interactionManager);
75357
- }
75358
- else {
75359
- this.onDownEdge(e.data.global.x, columnIndex, interactionManager);
75360
- }
75361
- }
75362
- }
75363
- else {
75364
- this._wasResizing = false;
75365
- _super.prototype.onDown.call(this, e);
75366
- }
75367
- };
75368
- DTableHeaderCell.prototype.findLeftResizableCell = function (columnIndex) {
75369
- var children = this._header.children;
75370
- var childrenLength = children.length;
75371
- for (var i = columnIndex; 0 <= i; --i) {
75372
- var child = children[childrenLength - i - 1];
75373
- if (child.column.resizable) {
75374
- return child;
75375
- }
75376
- }
75377
- return null;
75378
- };
75379
- DTableHeaderCell.prototype.findRightResizableCellOfWeight = function (columnIndex) {
75380
- var children = this._header.children;
75381
- var childrenLength = children.length;
75382
- for (var i = columnIndex + 1; i < childrenLength; ++i) {
75383
- var child = children[childrenLength - i - 1];
75384
- var childColumn = child.column;
75385
- if (childColumn.resizable) {
75386
- var childColumnWeight = childColumn.weight;
75387
- if (childColumnWeight != null) {
75388
- return child;
75389
- }
75390
- }
75391
- }
75392
- return null;
75393
- };
75394
- DTableHeaderCell.prototype.checkIfEdgeResizable = function (columnIndex) {
75395
- var target = this.findLeftResizableCell(columnIndex);
75396
- if (target != null) {
75397
- if (target.column.weight != null) {
75398
- return this.findRightResizableCellOfWeight(target.columnIndex) != null;
75399
- }
75400
- else {
75401
- return true;
75402
- }
75403
- }
75404
- return false;
75405
- };
75406
- DTableHeaderCell.prototype.getResizableEdges = function () {
75407
- var result = this._resizableEdges;
75408
- if (result == null) {
75409
- var columnIndex = this._columnIndex;
75410
- if (this.checkIfEdgeResizable(columnIndex - 1)) {
75411
- if (this.checkIfEdgeResizable(columnIndex)) {
75412
- result = DTableHeaderCellEdge.BOTH;
75413
- }
75414
- else {
75415
- result = DTableHeaderCellEdge.LEFT;
75416
- }
75417
- }
75418
- else {
75419
- if (this.checkIfEdgeResizable(columnIndex)) {
75420
- result = DTableHeaderCellEdge.RIGHT;
75421
- }
75422
- else {
75423
- result = DTableHeaderCellEdge.NONE;
75424
- }
75425
- }
75426
- this._resizableEdges = result;
75427
- }
75428
- return result;
75429
- };
75430
- DTableHeaderCell.prototype.onOver = function (e) {
75431
- var _this = this;
75432
- var _a;
75433
- _super.prototype.onOver.call(this, e);
75434
- if (this.getResizableEdges() !== DTableHeaderCellEdge.NONE) {
75435
- var onHoveredBound = ((_a = this._onHoveredBound) !== null && _a !== void 0 ? _a : (this._onHoveredBound = function (event) {
75436
- _this.onHovered(event);
75437
- }));
75438
- this.on(UtilPointerEvent.move, onHoveredBound);
75439
- // Since the cursor is set by InteractionManager before this method is called,
75440
- // the cursor need to be overriden.
75441
- this.onHovered(e);
75442
- var layer = DApplications.getLayer(this);
75443
- if (layer != null) {
75444
- layer.renderer.plugins.interaction.cursor = this.cursor;
75445
- }
75446
- }
75447
- };
75448
- DTableHeaderCell.prototype.onOut = function (e) {
75449
- _super.prototype.onOut.call(this, e);
75450
- var onHoveredBound = this._onHoveredBound;
75451
- if (onHoveredBound != null) {
75452
- this.state.remove(DTableState.HOVERED_ON_EDGE);
75453
- this.off(UtilPointerEvent.move, onHoveredBound);
75454
- }
75455
- };
75456
- DTableHeaderCell.prototype.onHovered = function (e) {
75457
- var width = this.width;
75458
- var x = this.toClickPosition(e);
75459
- var edgeSize = this._edgeSize;
75460
- if (0 <= x && x <= edgeSize) {
75461
- if (this.getResizableEdges() & DTableHeaderCellEdge.LEFT) {
75462
- this.state.add(DTableState.HOVERED_ON_EDGE, DTableHeaderCellEdge.LEFT);
75463
- }
75464
- else {
75465
- this.state.remove(DTableState.HOVERED_ON_EDGE);
75466
- }
75467
- }
75468
- else if (width - edgeSize <= x && x <= width) {
75469
- if (this.getResizableEdges() & DTableHeaderCellEdge.RIGHT) {
75470
- this.state.add(DTableState.HOVERED_ON_EDGE, DTableHeaderCellEdge.RIGHT);
75471
- }
75472
- else {
75473
- this.state.remove(DTableState.HOVERED_ON_EDGE);
75474
- }
75475
- }
75476
- else {
75477
- this.state.remove(DTableState.HOVERED_ON_EDGE);
75478
- }
75479
- };
75480
- DTableHeaderCell.prototype.onDownEdge = function (onDownPoint, columnIndex, interactionManager) {
75481
- // Find the resizable cell
75482
- var left = this.findLeftResizableCell(columnIndex);
75483
- if (left == null) {
75484
- // No resizable cell
75485
- return;
75486
- }
75487
- var header = this._header;
75488
- var leftColumn = left.column;
75489
- var leftOldWidth = left.width;
75490
- var leftOldWeight = left.weight;
75491
- if (leftColumn.weight == null) {
75492
- header.state.add(DTableState.RESIZING);
75493
- var onMove_1 = function (e) {
75494
- leftColumn.width = Math.max(1, leftOldWidth + e.data.global.x - onDownPoint);
75495
- };
75496
- var onUp_1 = function (e) {
75497
- header.state.remove(DTableState.RESIZING);
75498
- interactionManager.off(UtilPointerEvent.move, onMove_1);
75499
- interactionManager.off(UtilPointerEvent.up, onUp_1);
75500
- interactionManager.off(UtilPointerEvent.upoutside, onUp_1);
75501
- interactionManager.off(UtilPointerEvent.cancel, onUp_1);
75502
- };
75503
- interactionManager.on(UtilPointerEvent.move, onMove_1);
75504
- interactionManager.on(UtilPointerEvent.up, onUp_1);
75505
- interactionManager.on(UtilPointerEvent.upoutside, onUp_1);
75506
- interactionManager.on(UtilPointerEvent.cancel, onUp_1);
75507
- }
75508
- else {
75509
- var right = this.findRightResizableCellOfWeight(left.columnIndex);
75510
- if (right == null) {
75511
- // No right resizable cell found
75512
- return;
75513
- }
75514
- var rightColumn_1 = right.column;
75515
- var rightOldWeight = right.weight;
75516
- var rightOldWidth = right.width;
75517
- var totalWidth_1 = leftOldWidth + rightOldWidth;
75518
- var totalWeight_1 = leftOldWeight + rightOldWeight;
75519
- if (totalWidth_1 <= 0) {
75520
- // The left and right resizable cells doesn't have non-zero width
75521
- return;
75522
- }
75523
- header.state.add(DTableState.RESIZING);
75524
- var onMove_2 = function (e) {
75525
- var leftNewWidth = Math.max(0, Math.min(totalWidth_1, leftOldWidth + e.data.global.x - onDownPoint));
75526
- var leftNewWeight = totalWeight_1 * (leftNewWidth / totalWidth_1);
75527
- leftColumn.weight = leftNewWeight;
75528
- rightColumn_1.weight = totalWeight_1 - leftNewWeight;
75529
- };
75530
- var onUp_2 = function (e) {
75531
- header.state.remove(DTableState.RESIZING);
75532
- interactionManager.off(UtilPointerEvent.move, onMove_2);
75533
- interactionManager.off(UtilPointerEvent.up, onUp_2);
75534
- interactionManager.off(UtilPointerEvent.upoutside, onUp_2);
75535
- interactionManager.off(UtilPointerEvent.cancel, onUp_2);
75536
- };
75537
- interactionManager.on(UtilPointerEvent.move, onMove_2);
75538
- interactionManager.on(UtilPointerEvent.up, onUp_2);
75539
- interactionManager.on(UtilPointerEvent.upoutside, onUp_2);
75540
- interactionManager.on(UtilPointerEvent.cancel, onUp_2);
75541
- }
75542
- };
75543
- Object.defineProperty(DTableHeaderCell.prototype, "sorter", {
75544
- get: function () {
75545
- var _this = this;
75546
- var sorter = this._sorter;
75547
- if (sorter == null) {
75548
- var header = this._header;
75549
- if (header) {
75550
- var table = header.table;
75551
- if (table) {
75552
- sorter = table.data.sorter;
75553
- this._sorter = sorter;
75554
- this._onSorterChangeBound =
75555
- this._onSorterChangeBound ||
75556
- (function () {
75557
- _this.onSorterChange();
75558
- });
75559
- sorter.on("change", this._onSorterChangeBound);
75560
- }
75561
- else {
75562
- return null;
75563
- }
75564
- }
75565
- else {
75566
- return null;
75567
- }
75568
- }
75569
- return sorter;
75570
- },
75571
- enumerable: false,
75572
- configurable: true
75573
- });
75574
- Object.defineProperty(DTableHeaderCell.prototype, "comparator", {
75575
- get: function () {
75576
- return this._column.sorting.comparator || null;
75577
- },
75578
- enumerable: false,
75579
- configurable: true
75580
- });
75581
- DTableHeaderCell.prototype.onSorterChange = function () {
75582
- var comparator = this.comparator;
75583
- if (comparator) {
75584
- var sorter = this._sorter;
75585
- if (sorter) {
75586
- var SORTED_ASCENDING = DTableState.SORTED_ASCENDING;
75587
- var SORTED_DESCENDING = DTableState.SORTED_DESCENDING;
75588
- if (sorter.isApplied() && sorter.get() === comparator) {
75589
- if (sorter.order === DTableDataOrder.ASCENDING) {
75590
- this.state.set(SORTED_ASCENDING, SORTED_DESCENDING);
75591
- }
75592
- else {
75593
- this.state.set(SORTED_DESCENDING, SORTED_ASCENDING);
75594
- }
75595
- }
75596
- else {
75597
- this.state.removeAll(SORTED_ASCENDING, SORTED_DESCENDING);
75598
- }
75599
- }
75600
- }
75601
- };
75602
- DTableHeaderCell.prototype.toClickPosition = function (e) {
75603
- var _a;
75604
- var checkWork = ((_a = this._checkWork) !== null && _a !== void 0 ? _a : (this._checkWork = new pixi_js.Point()));
75605
- return e.data.getLocalPosition(this, checkWork).x;
75606
- };
75607
- DTableHeaderCell.prototype.isCheckClicked = function (e) {
75608
- if (e instanceof pixi_js.InteractionEvent && this._check.isEnabled) {
75609
- if (this.isSortable) {
75610
- var image = this.image.get(1);
75611
- if (image) {
75612
- var position = this.toClickPosition(e);
75613
- var object = image.object;
75614
- if (object != null) {
75615
- var bound = object.getLocalBounds();
75616
- var margin = image.margin.horizontal;
75617
- var x = object.x;
75618
- return (x + bound.left - margin <= position &&
75619
- position <= x + bound.right + margin);
75620
- }
75621
- }
75622
- }
75623
- else {
75624
- return true;
75625
- }
75626
- }
75627
- return false;
75628
- };
75629
- DTableHeaderCell.prototype.isEdgeClicked = function (e) {
75630
- return (e instanceof pixi_js.InteractionEvent &&
75631
- (this.state.is(DTableState.HOVERED_ON_EDGE) || this._wasResizing));
75632
- };
75633
- DTableHeaderCell.prototype.onClick = function (e) {
75634
- if (this.state.isActionable) {
75635
- this.activate(e);
75636
- }
75637
- };
75638
- DTableHeaderCell.prototype.activate = function (e) {
75639
- this.onActivate(e);
75640
- };
75641
- DTableHeaderCell.prototype.onActivate = function (e) {
75642
- if (!this.isEdgeClicked(e)) {
75643
- if (this.isCheckClicked(e)) {
75644
- this.onToggleStart();
75645
- this.onToggleEnd();
75646
- }
75647
- else {
75648
- this.doSort(e);
75649
- this.emit("active", this);
75650
- }
75651
- }
75652
- };
75653
- DTableHeaderCell.prototype.doSort = function (e) {
75654
- if (this.isSortable) {
75655
- var comparator = this.comparator;
75656
- if (comparator) {
75657
- var sorter = this.sorter;
75658
- if (sorter) {
75659
- if (sorter.get() === comparator) {
75660
- if (sorter.order === DTableDataOrder.ASCENDING) {
75661
- sorter.order = DTableDataOrder.DESCENDING;
75662
- sorter.apply();
75663
- }
75664
- else {
75665
- sorter.set(null);
75666
- sorter.apply();
75667
- }
75668
- }
75669
- else {
75670
- sorter.set(comparator);
75671
- sorter.order = DTableDataOrder.ASCENDING;
75672
- sorter.apply();
75673
- }
75674
- }
75675
- }
75676
- }
75677
- };
75678
- Object.defineProperty(DTableHeaderCell.prototype, "isSortable", {
75679
- get: function () {
75680
- return this._column.sorting.enable;
75681
- },
75682
- enumerable: false,
75683
- configurable: true
75684
- });
75685
- Object.defineProperty(DTableHeaderCell.prototype, "isResizable", {
75686
- get: function () {
75687
- return this._column.resizable;
75688
- },
75689
- enumerable: false,
75690
- configurable: true
75691
- });
75692
- Object.defineProperty(DTableHeaderCell.prototype, "isToggle", {
75693
- get: function () {
75694
- return this._check.isEnabled;
75695
- },
75696
- enumerable: false,
75697
- configurable: true
75698
- });
75699
- DTableHeaderCell.prototype.toggle = function () {
75700
- if (this.state.isActionable) {
75701
- if (this.isToggle) {
75702
- this.onToggleStart();
75703
- this.onToggleEnd();
75704
- }
75705
- }
75706
- };
75707
- DTableHeaderCell.prototype.onToggleStart = function () {
75708
- this.state.isActive = !this.state.isActive;
75709
- };
75710
- DTableHeaderCell.prototype.onToggleEnd = function () {
75711
- if (this.state.isActive) {
75712
- this._check.execute(true);
75713
- this.emit("active", this);
75714
- }
75715
- else {
75716
- this._check.execute(false);
75717
- this.emit("inactive", this);
75718
- }
75719
- };
75720
- DTableHeaderCell.prototype.onActivateKeyDown = function (e) {
75721
- if (this.state.isActionable) {
75722
- if (this.isToggle) {
75723
- this.onToggleStart();
75724
- }
75725
- else {
75726
- this.state.isPressed = true;
75727
- }
75728
- }
75729
- };
75730
- DTableHeaderCell.prototype.onActivateKeyUp = function (e) {
75731
- if (this.state.isActionable) {
75732
- if (this.isToggle) {
75733
- this.onToggleEnd();
75734
- }
75735
- else {
75736
- if (this.state.isPressed) {
75737
- this.activate(e);
75738
- }
75739
- this.state.isPressed = false;
75740
- }
75741
- }
75742
- };
75743
- DTableHeaderCell.prototype.onKeyDown = function (e) {
75744
- if (UtilKeyboardEvent.isActivateKey(e)) {
75745
- this.onActivateKeyDown(e);
75746
- }
75747
- return _super.prototype.onKeyDown.call(this, e);
75748
- };
75749
- DTableHeaderCell.prototype.onKeyUp = function (e) {
75750
- if (UtilKeyboardEvent.isActivateKey(e)) {
75751
- this.onActivateKeyUp(e);
75752
- }
75753
- return _super.prototype.onKeyUp.call(this, e);
75754
- };
75755
- DTableHeaderCell.prototype.getType = function () {
75756
- return "DTableHeaderCell";
75757
- };
75758
- DTableHeaderCell.prototype.destroy = function () {
75759
- var sorter = this._sorter;
75760
- var onSorterChangeBound = this._onSorterChangeBound;
75761
- if (sorter && onSorterChangeBound) {
75762
- sorter.off("change", onSorterChangeBound);
75763
- }
75764
- this._sorter = undefined;
75765
- this._onSorterChangeBound = undefined;
75766
- _super.prototype.destroy.call(this);
75767
- };
75768
- return DTableHeaderCell;
75769
- }(DImage));
75770
-
75771
- /*
75772
- * Copyright (C) 2019 Toshiba Corporation
75773
- * SPDX-License-Identifier: Apache-2.0
75774
- */
75775
- var DTableHeader = /** @class */ (function (_super) {
75776
- __extends(DTableHeader, _super);
75777
- function DTableHeader(table, columns, frozen, offset, options) {
75778
- var _this = _super.call(this, columns, frozen, options) || this;
75779
- _this._table = table;
75780
- _this._offset = offset;
75781
- _this.transform.position.y = offset;
75782
- _this.initCells();
75783
- return _this;
75784
- }
75785
- Object.defineProperty(DTableHeader.prototype, "table", {
75786
- get: function () {
75787
- return this._table;
75788
- },
75789
- enumerable: false,
75790
- configurable: true
75791
- });
75792
- DTableHeader.prototype.onParentMove = function (newX, newY, oldX, oldY) {
75793
- _super.prototype.onParentMove.call(this, newX, newY, oldX, oldY);
75794
- this.transform.position.y = -newY + this._offset;
75795
- this.updateFrozenCellPosition(newX);
75796
- };
75797
- DTableHeader.prototype.getContentPositionX = function () {
75798
- var content = this.parent;
75799
- if (content) {
75800
- return content.position.x;
75801
- }
75802
- return 0;
75803
- };
75804
- DTableHeader.prototype.newCell = function (columnIndex, column, columns, options) {
75805
- return new DTableHeaderCell(this, columnIndex, column, this.toCellOptions(column, options));
75806
- };
75807
- DTableHeader.prototype.toCellOptions = function (column, options) {
75808
- var result = column.header || (options === null || options === void 0 ? void 0 : options.cell);
75809
- if (result != null) {
75810
- if (result.weight === undefined) {
75811
- result.weight = column.weight;
75812
- }
75813
- if (result.width === undefined) {
75814
- result.width = column.width;
75815
- }
75816
- if (result.text === undefined) {
75817
- result.text = {
75818
- value: column.label
75819
- };
75820
- }
75821
- else if (result.text.value === undefined) {
75822
- result.text.value = column.label;
75823
- }
75824
- return result;
75825
- }
75826
- else {
75827
- return {
75828
- weight: column.weight,
75829
- width: column.width,
75830
- text: {
75831
- value: column.label
75832
- }
75833
- };
75834
- }
75835
- };
75836
- DTableHeader.prototype.getType = function () {
75837
- return "DTableHeader";
75838
- };
75839
- return DTableHeader;
75840
- }(DTableRow));
75841
-
75842
- var DTableScrollBar = /** @class */ (function (_super) {
75843
- __extends(DTableScrollBar, _super);
75844
- function DTableScrollBar() {
75845
- return _super !== null && _super.apply(this, arguments) || this;
75846
- }
75847
- DTableScrollBar.prototype.getOffsetVerticalStart = function (size) {
75848
- return size * 0.5 + this._parent.body.position.y;
75849
- };
75850
- return DTableScrollBar;
75851
- }(DPaneScrollBar));
75852
-
75853
- var defaultGetter = function (row, columnIndex) {
75854
- return row[columnIndex];
75855
- };
75856
- var defaultSetter = function (row, columnIndex, cell) {
75857
- row[columnIndex] = cell;
75858
- };
75859
- var defaultGetterEmpty = function () { return ""; };
75860
- var defaultSetterEmpty = function () {
75861
- // DO NOTHING
75862
- };
75863
- var toPathGetter = function (path, def) {
75864
- if (path.length <= 1) {
75865
- var key_1 = path[0];
75866
- if (def === undefined) {
75867
- return function (row) {
75868
- return row[key_1];
75869
- };
75870
- }
75871
- else {
75872
- return function (row) {
75873
- return Object.prototype.hasOwnProperty.call(row, key_1) ? row[key_1] : def;
75874
- };
75875
- }
75876
- }
75877
- else {
75878
- if (def === undefined) {
75879
- return function (row) {
75880
- for (var i = 0, imax = path.length - 1; i < imax; ++i) {
75881
- row = row[path[i]];
75882
- }
75883
- return row[path[path.length - 1]];
75884
- };
75885
- }
75886
- else {
75887
- return function (row) {
75888
- for (var i = 0, imax = path.length - 1; i < imax; ++i) {
75889
- row = row[path[i]];
75890
- }
75891
- var key = path[path.length - 1];
75892
- return Object.prototype.hasOwnProperty.call(row, key) ? row[key] : def;
75893
- };
75894
- }
75895
- }
75896
- };
75897
- var toPathSetter = function (path) {
75898
- if (path.length <= 1) {
75899
- var key_2 = path[0];
75900
- return function (row, columnIndex, cell) {
75901
- row[key_2] = cell;
75902
- };
75903
- }
75904
- else {
75905
- return function (row, columnIndex, cell) {
75906
- for (var i = 0, imax = path.length - 1; i < imax; ++i) {
75907
- row = row[path[i]] || {};
75908
- }
75909
- row[path[path.length - 1]] = cell;
75910
- };
75911
- }
75912
- };
75913
- var toAlign = function (options, type) {
75914
- var align = options.align;
75915
- if (align != null) {
75916
- if (isString(align)) {
75917
- return DAlignHorizontal[align];
75918
- }
75919
- else {
75920
- return align;
75921
- }
75922
- }
75923
- switch (type) {
75924
- case DTableColumnType.TEXT:
75925
- case DTableColumnType.TEXT_AREA:
75926
- return DAlignHorizontal.LEFT;
75927
- case DTableColumnType.REAL:
75928
- case DTableColumnType.INTEGER:
75929
- return DAlignHorizontal.RIGHT;
75930
- case DTableColumnType.BUTTON:
75931
- case DTableColumnType.INDEX:
75932
- case DTableColumnType.SELECT:
75933
- case DTableColumnType.ACTION:
75934
- case DTableColumnType.LINK:
75935
- case DTableColumnType.CHECK:
75936
- case DTableColumnType.CHECK_SINGLE:
75937
- case DTableColumnType.COLOR:
75938
- return DAlignHorizontal.CENTER;
75939
- default:
75940
- return DAlignHorizontal.LEFT;
75941
- }
75942
- };
75943
- var toDataChecker = function (path) {
75944
- if (path != null) {
75945
- var pathLength_1 = path.length;
75946
- if (pathLength_1 <= 1) {
75947
- var key_3 = path[0];
75948
- return function (row) {
75949
- return Object.prototype.hasOwnProperty.call(row, key_3);
75950
- };
75951
- }
75952
- else {
75953
- return function (row) {
75954
- for (var i = 0; i < pathLength_1; ++i) {
75955
- var part = path[i];
75956
- if (part in row) {
75957
- row = row[part];
75958
- }
75959
- else {
75960
- return false;
75961
- }
75962
- }
75963
- return true;
75964
- };
75965
- }
75966
- }
75967
- return function (row, columnIndex) {
75968
- return columnIndex < row.length;
75969
- };
75970
- };
75971
- var toEditingEnable = function (enable, path) {
75972
- if (isString(enable)) {
75973
- return toDataChecker(path);
75974
- }
75975
- else if (enable != null) {
75976
- return enable;
75977
- }
75978
- else {
75979
- return false;
75980
- }
75981
- };
75982
- var toEditing = function (options, path) {
75983
- var _a;
75984
- var editing = options.editing;
75985
- var editable = options.editable;
75986
- if (editing) {
75987
- return {
75988
- enable: toEditingEnable((_a = editing.enable) !== null && _a !== void 0 ? _a : editable, path),
75989
- formatter: editing.formatter,
75990
- unformatter: editing.unformatter,
75991
- validator: editing.validator
75992
- };
75993
- }
75994
- return {
75995
- enable: toEditingEnable(editable, path)
75996
- };
75997
- };
75998
- var toComparator = function (getter, index) {
75999
- return function (rowA, rowB) {
76000
- var valueA = getter(rowA, index);
76001
- var valueB = getter(rowB, index);
76002
- return valueA < valueB ? -1 : valueB < valueA ? +1 : 0;
76003
- };
76004
- };
76005
- var toSorting = function (getter, index, options) {
76006
- var sorting = options.sorting;
76007
- var sortable = options.sortable;
76008
- if (sorting) {
76009
- if (sorting.enable || sortable) {
76010
- return {
76011
- enable: true,
76012
- comparator: sorting.comparator || toComparator(getter, index)
76013
- };
76014
- }
76015
- return {
76016
- enable: false
76017
- };
76018
- }
76019
- if (sortable) {
76020
- return {
76021
- enable: true,
76022
- comparator: toComparator(getter, index)
76023
- };
76024
- }
76025
- return {
76026
- enable: false
76027
- };
76028
- };
76029
- var toMenu = function (options) {
76030
- if (options == null) {
76031
- return undefined;
76032
- }
76033
- else if (options instanceof DMenu) {
76034
- return options;
76035
- }
76036
- else {
76037
- return new DMenu(options);
76038
- }
76039
- };
76040
- var toDialog = function (options) {
76041
- if (options == null) {
76042
- return undefined;
76043
- }
76044
- else if ("open" in options) {
76045
- return options;
76046
- }
76047
- else {
76048
- return new DDialogSelect(options);
76049
- }
76050
- };
76051
- var defaultSelectingGetter = function (dialog) {
76052
- return dialog.value;
76053
- };
76054
- var defaultSelectingSetter = function () {
76055
- // DO NOTHING
76056
- };
76057
- var toSelecting = function (options) {
76058
- if (options) {
76059
- return {
76060
- getter: options.getter || defaultSelectingGetter,
76061
- setter: options.setter || defaultSelectingSetter,
76062
- menu: toMenu(options.menu),
76063
- multiple: toMenu(options.multiple),
76064
- dialog: toDialog(options.dialog),
76065
- promise: options.promise
76066
- };
76067
- }
76068
- return {
76069
- getter: defaultSelectingGetter,
76070
- setter: defaultSelectingSetter
76071
- };
76072
- };
76073
- var toGetter = function (options, type, parts) {
76074
- var getter = options.getter;
76075
- if (getter) {
76076
- return getter;
76077
- }
76078
- switch (type) {
76079
- case DTableColumnType.ACTION:
76080
- case DTableColumnType.LINK:
76081
- return defaultGetterEmpty;
76082
- default:
76083
- if (parts == null) {
76084
- return defaultGetter;
76085
- }
76086
- else {
76087
- return toPathGetter(parts, options.default);
76088
- }
76089
- }
76090
- };
76091
- var toSetter = function (options, type, path) {
76092
- var setter = options.setter;
76093
- if (setter) {
76094
- return setter;
76095
- }
76096
- switch (type) {
76097
- case DTableColumnType.BUTTON:
76098
- case DTableColumnType.ACTION:
76099
- case DTableColumnType.LINK:
76100
- return defaultSetterEmpty;
76101
- default:
76102
- if (path == null) {
76103
- return defaultSetter;
76063
+ this._isFilterable = isFilterable;
76064
+ },
76065
+ enumerable: false,
76066
+ configurable: true
76067
+ });
76068
+ Object.defineProperty(DTableHeaderCellCheck.prototype, "isEmittable", {
76069
+ get: function () {
76070
+ return this._isEmittable;
76071
+ },
76072
+ set: function (isEmittable) {
76073
+ this._isEmittable = isEmittable;
76074
+ },
76075
+ enumerable: false,
76076
+ configurable: true
76077
+ });
76078
+ DTableHeaderCellCheck.prototype.newIteratee = function (table, isChecked) {
76079
+ var parent = this._parent;
76080
+ var column = parent.column;
76081
+ var columnIndex = parent.columnIndex;
76082
+ if (column != null && columnIndex != null) {
76083
+ var getter_1 = column.getter;
76084
+ var setter_1 = column.setter;
76085
+ if (this._isEmittable) {
76086
+ var data_1 = table.data;
76087
+ return function (row, rowIndex) {
76088
+ if (getter_1(row, columnIndex) !== isChecked) {
76089
+ setter_1(row, columnIndex, isChecked);
76090
+ data_1.emit("change", isChecked, !isChecked, row, rowIndex, columnIndex, data_1);
76091
+ return true;
76092
+ }
76093
+ return false;
76094
+ };
76104
76095
  }
76105
76096
  else {
76106
- return toPathSetter(path);
76097
+ return function (row) {
76098
+ if (getter_1(row, columnIndex) !== isChecked) {
76099
+ setter_1(row, columnIndex, isChecked);
76100
+ return true;
76101
+ }
76102
+ return false;
76103
+ };
76107
76104
  }
76108
- }
76109
- };
76110
- var toState = function (options) {
76111
- var state = options.state;
76112
- if (state != null) {
76113
- if (isString(state) || isArray(state)) {
76114
- return {
76115
- initial: state,
76116
- modifier: undefined
76117
- };
76118
- }
76119
- else {
76120
- return {
76121
- initial: undefined,
76122
- modifier: state
76123
- };
76124
76105
  }
76125
- }
76126
- return {
76127
- initial: undefined,
76128
- modifier: undefined
76106
+ return null;
76129
76107
  };
76130
- };
76131
- var toPath = function (options) {
76132
- return options.path != null ? options.path.split(".") : null;
76133
- };
76134
- var toRenderable = function (options, path) {
76135
- var renderable = options.renderable;
76136
- if (isString(renderable)) {
76137
- return toDataChecker(path);
76138
- }
76139
- else if (renderable != null) {
76140
- return renderable;
76141
- }
76142
- return true;
76143
- };
76144
- var DTableColumnImpl = /** @class */ (function (_super) {
76145
- __extends(DTableColumnImpl, _super);
76146
- function DTableColumnImpl(index, options) {
76147
- var _a, _b, _c;
76148
- var _this = _super.call(this) || this;
76149
- var weight = options.weight;
76150
- var width = options.width;
76151
- if (weight != null) {
76152
- if (width != null) {
76153
- width = undefined;
76108
+ DTableHeaderCellCheck.prototype.execute = function (isChecked) {
76109
+ var _a;
76110
+ var table = (_a = this._parent.header) === null || _a === void 0 ? void 0 : _a.table;
76111
+ if (table) {
76112
+ var iteratee_1 = this.newIteratee(table, isChecked);
76113
+ if (iteratee_1) {
76114
+ var isChanged_1 = false;
76115
+ if (this._isFilterable) {
76116
+ table.data.mapped.each(function (row, supplimental, index, unmappedIndex) {
76117
+ if (iteratee_1(row, unmappedIndex)) {
76118
+ isChanged_1 = true;
76119
+ }
76120
+ });
76121
+ }
76122
+ else {
76123
+ table.data.each(function (row, index) {
76124
+ if (iteratee_1(row, index)) {
76125
+ isChanged_1 = true;
76126
+ }
76127
+ });
76128
+ }
76129
+ if (isChanged_1) {
76130
+ table.body.update(true);
76131
+ }
76154
76132
  }
76155
76133
  }
76156
- else if (width == null) {
76157
- weight = 1;
76134
+ };
76135
+ return DTableHeaderCellCheck;
76136
+ }());
76137
+
76138
+ /*
76139
+ * Copyright (C) 2019 Toshiba Corporation
76140
+ * SPDX-License-Identifier: Apache-2.0
76141
+ */
76142
+ var DTableHeaderCellEdge = {
76143
+ NONE: 0,
76144
+ LEFT: 1,
76145
+ RIGHT: 2,
76146
+ BOTH: 3
76147
+ };
76148
+ var DTableHeaderCell = /** @class */ (function (_super) {
76149
+ __extends(DTableHeaderCell, _super);
76150
+ function DTableHeaderCell(header, columnIndex, column, options) {
76151
+ var _this = _super.call(this, options) || this;
76152
+ _this._header = header;
76153
+ _this._column = column;
76154
+ _this._columnIndex = columnIndex;
76155
+ var check = new DTableHeaderCellCheck(_this, options === null || options === void 0 ? void 0 : options.check);
76156
+ _this._check = check;
76157
+ _this._edgeSize = _this.theme.getEdgeWidth();
76158
+ _this._wasResizing = false;
76159
+ var sortable = column.sorting.enable;
76160
+ var checkable = check.isEnabled;
76161
+ if (checkable || sortable) {
76162
+ _this.on(UtilPointerEvent.tap, function (e) {
76163
+ _this.onClick(e);
76164
+ });
76165
+ var state = _this.state;
76166
+ state.lock();
76167
+ state.set(DTableState.SORTABLE, sortable);
76168
+ state.set(DTableState.CHECKABLE, checkable);
76169
+ state.unlock();
76158
76170
  }
76159
- var type = toEnum((_a = options.type) !== null && _a !== void 0 ? _a : DTableColumnType.TEXT, DTableColumnType);
76160
- var align = toAlign(options, type);
76161
- var label = options.label || "";
76162
- var path = toPath(options);
76163
- var getter = toGetter(options, type, path);
76164
- var setter = toSetter(options, type, path);
76165
- _this._weight = weight;
76166
- _this._width = width;
76167
- _this.resizable = (_b = options.resizable) !== null && _b !== void 0 ? _b : false;
76168
- _this.type = type;
76169
- _this.label = label;
76170
- _this.getter = getter;
76171
- _this.setter = setter;
76172
- _this.formatter = options.formatter;
76173
- _this.renderable = toRenderable(options, path);
76174
- _this.align = align;
76175
- _this.state = toState(options);
76176
- _this.editing = toEditing(options, path);
76177
- _this.sorting = toSorting(getter, index, options);
76178
- _this.header = options.header;
76179
- _this.body = options.body;
76180
- _this.selecting = toSelecting(options.selecting);
76181
- _this.category = options.category;
76182
- _this.frozen = options.frozen;
76183
- _this.offset = 0.0;
76184
- _this.link = options.link;
76185
- _this.update = toEnum((_c = options.update) !== null && _c !== void 0 ? _c : DTableColumnUpdate.CELL, DTableColumnUpdate);
76186
76171
  return _this;
76187
76172
  }
76188
- Object.defineProperty(DTableColumnImpl.prototype, "weight", {
76173
+ Object.defineProperty(DTableHeaderCell.prototype, "column", {
76189
76174
  get: function () {
76190
- return this._weight;
76175
+ return this._column;
76191
76176
  },
76192
- set: function (weight) {
76193
- if (this._weight != null && this._weight !== weight) {
76194
- this._weight = weight;
76195
- this.emit("resize", this);
76196
- }
76177
+ enumerable: false,
76178
+ configurable: true
76179
+ });
76180
+ Object.defineProperty(DTableHeaderCell.prototype, "columnIndex", {
76181
+ get: function () {
76182
+ return this._columnIndex;
76197
76183
  },
76198
76184
  enumerable: false,
76199
76185
  configurable: true
76200
76186
  });
76201
- Object.defineProperty(DTableColumnImpl.prototype, "width", {
76187
+ Object.defineProperty(DTableHeaderCell.prototype, "header", {
76202
76188
  get: function () {
76203
- return this._width;
76189
+ return this._header;
76204
76190
  },
76205
- set: function (width) {
76206
- if (this._width != null && this._width !== width) {
76207
- this._width = width;
76208
- this.emit("resize", this);
76209
- }
76191
+ enumerable: false,
76192
+ configurable: true
76193
+ });
76194
+ Object.defineProperty(DTableHeaderCell.prototype, "check", {
76195
+ get: function () {
76196
+ return this._check;
76210
76197
  },
76211
76198
  enumerable: false,
76212
76199
  configurable: true
76213
76200
  });
76214
- return DTableColumnImpl;
76215
- }(pixi_js.utils.EventEmitter));
76216
-
76217
- var DTableColumnContainerImpl = /** @class */ (function (_super) {
76218
- __extends(DTableColumnContainerImpl, _super);
76219
- function DTableColumnContainerImpl(parent, options) {
76220
- var _this = _super.call(this) || this;
76221
- _this.parent = parent;
76222
- var columns = [];
76223
- if (options != null) {
76224
- for (var i = 0, imax = options.length; i < imax; ++i) {
76225
- var column = new DTableColumnImpl(i, options[i]);
76226
- columns.push(column);
76227
- column.on("resize", _this.newOnColumnResize(i, column));
76201
+ DTableHeaderCell.prototype.onDown = function (e) {
76202
+ var edges = this.state.valueOf(DTableState.HOVERED_ON_EDGE);
76203
+ if (edges != null) {
76204
+ this._wasResizing = true;
76205
+ var layer = DApplications.getLayer(this);
76206
+ if (layer != null) {
76207
+ var interactionManager = layer.renderer.plugins.interaction;
76208
+ var columnIndex = this._columnIndex;
76209
+ if (edges === DTableHeaderCellEdge.LEFT) {
76210
+ this.onDownEdge(e.data.global.x, columnIndex - 1, interactionManager);
76211
+ }
76212
+ else {
76213
+ this.onDownEdge(e.data.global.x, columnIndex, interactionManager);
76214
+ }
76228
76215
  }
76229
76216
  }
76230
- _this.items = columns;
76231
- var frozen = 0;
76232
- for (var i = columns.length - 1; 0 <= i; --i) {
76233
- if (columns[i].frozen === true) {
76234
- frozen = i + 1;
76235
- break;
76217
+ else {
76218
+ this._wasResizing = false;
76219
+ _super.prototype.onDown.call(this, e);
76220
+ }
76221
+ };
76222
+ DTableHeaderCell.prototype.findLeftResizableCell = function (columnIndex) {
76223
+ var children = this._header.children;
76224
+ var childrenLength = children.length;
76225
+ for (var i = columnIndex; 0 <= i; --i) {
76226
+ var child = children[childrenLength - i - 1];
76227
+ if (child.column.resizable) {
76228
+ return child;
76236
76229
  }
76237
76230
  }
76238
- _this.frozen = frozen;
76239
- return _this;
76240
- }
76241
- DTableColumnContainerImpl.prototype.newOnColumnResize = function (index, column) {
76242
- var _this = this;
76243
- return function () {
76244
- _this.onColumnResize(index, column);
76245
- };
76231
+ return null;
76246
76232
  };
76247
- DTableColumnContainerImpl.prototype.onColumnResize = function (index, column) {
76248
- this.onColumnResizeHeader(index, column);
76249
- this.onColumnResizeBody(index, column);
76250
- this.emit("resize", index, column, this);
76233
+ DTableHeaderCell.prototype.findRightResizableCellOfWeight = function (columnIndex) {
76234
+ var children = this._header.children;
76235
+ var childrenLength = children.length;
76236
+ for (var i = columnIndex + 1; i < childrenLength; ++i) {
76237
+ var child = children[childrenLength - i - 1];
76238
+ var childColumn = child.column;
76239
+ if (childColumn.resizable) {
76240
+ var childColumnWeight = childColumn.weight;
76241
+ if (childColumnWeight != null) {
76242
+ return child;
76243
+ }
76244
+ }
76245
+ }
76246
+ return null;
76251
76247
  };
76252
- DTableColumnContainerImpl.prototype.onColumnResizeHeader = function (index, column) {
76253
- var header = this.parent.header;
76254
- if (header != null) {
76255
- var columnWeight = column.weight;
76256
- if (columnWeight != null) {
76257
- this.onColumnResizeWeight(header, index, columnWeight);
76248
+ DTableHeaderCell.prototype.checkIfEdgeResizable = function (columnIndex) {
76249
+ var target = this.findLeftResizableCell(columnIndex);
76250
+ if (target != null) {
76251
+ if (target.column.weight != null) {
76252
+ return this.findRightResizableCellOfWeight(target.columnIndex) != null;
76258
76253
  }
76259
76254
  else {
76260
- var columnWidth = column.width;
76261
- if (columnWidth != null) {
76262
- this.onColumnResizeWidth(header, index, columnWidth);
76263
- }
76255
+ return true;
76264
76256
  }
76265
76257
  }
76258
+ return false;
76266
76259
  };
76267
- DTableColumnContainerImpl.prototype.onColumnResizeBody = function (index, column) {
76268
- var rows = this.parent.body.children;
76269
- var columnWeight = column.weight;
76270
- if (columnWeight != null) {
76271
- for (var i = 0, imax = rows.length; i < imax; ++i) {
76272
- this.onColumnResizeWeight(rows[i], index, columnWeight);
76260
+ DTableHeaderCell.prototype.getResizableEdges = function () {
76261
+ var result = this._resizableEdges;
76262
+ if (result == null) {
76263
+ var columnIndex = this._columnIndex;
76264
+ if (this.checkIfEdgeResizable(columnIndex - 1)) {
76265
+ if (this.checkIfEdgeResizable(columnIndex)) {
76266
+ result = DTableHeaderCellEdge.BOTH;
76267
+ }
76268
+ else {
76269
+ result = DTableHeaderCellEdge.LEFT;
76270
+ }
76273
76271
  }
76274
- }
76275
- else {
76276
- var columnWidth = column.width;
76277
- if (columnWidth != null) {
76278
- for (var i = 0, imax = rows.length; i < imax; ++i) {
76279
- this.onColumnResizeWidth(rows[i], index, columnWidth);
76272
+ else {
76273
+ if (this.checkIfEdgeResizable(columnIndex)) {
76274
+ result = DTableHeaderCellEdge.RIGHT;
76275
+ }
76276
+ else {
76277
+ result = DTableHeaderCellEdge.NONE;
76280
76278
  }
76281
76279
  }
76280
+ this._resizableEdges = result;
76282
76281
  }
76282
+ return result;
76283
76283
  };
76284
- DTableColumnContainerImpl.prototype.onColumnResizeWeight = function (row, index, columnWeight) {
76285
- var cells = row.children;
76286
- var cellsLength = cells.length;
76287
- var cellsIndex = cellsLength - index - 1;
76288
- if (0 <= cellsIndex && cellsIndex < cellsLength) {
76289
- cells[cellsIndex].weight = columnWeight;
76284
+ DTableHeaderCell.prototype.onOver = function (e) {
76285
+ var _this = this;
76286
+ var _a;
76287
+ _super.prototype.onOver.call(this, e);
76288
+ if (this.getResizableEdges() !== DTableHeaderCellEdge.NONE) {
76289
+ var onHoveredBound = ((_a = this._onHoveredBound) !== null && _a !== void 0 ? _a : (this._onHoveredBound = function (event) {
76290
+ _this.onHovered(event);
76291
+ }));
76292
+ this.on(UtilPointerEvent.move, onHoveredBound);
76293
+ // Since the cursor is set by InteractionManager before this method is called,
76294
+ // the cursor need to be overriden.
76295
+ this.onHovered(e);
76296
+ var layer = DApplications.getLayer(this);
76297
+ if (layer != null) {
76298
+ layer.renderer.plugins.interaction.cursor = this.cursor;
76299
+ }
76290
76300
  }
76291
76301
  };
76292
- DTableColumnContainerImpl.prototype.onColumnResizeWidth = function (row, index, columnWidth) {
76293
- var cells = row.children;
76294
- var cellsLength = cells.length;
76295
- var cellsIndex = cellsLength - index - 1;
76296
- if (0 <= cellsIndex && cellsIndex < cellsLength) {
76297
- cells[cellsIndex].width = columnWidth;
76302
+ DTableHeaderCell.prototype.onOut = function (e) {
76303
+ _super.prototype.onOut.call(this, e);
76304
+ var onHoveredBound = this._onHoveredBound;
76305
+ if (onHoveredBound != null) {
76306
+ this.state.remove(DTableState.HOVERED_ON_EDGE);
76307
+ this.off(UtilPointerEvent.move, onHoveredBound);
76298
76308
  }
76299
76309
  };
76300
- Object.defineProperty(DTableColumnContainerImpl.prototype, "width", {
76301
- get: function () {
76302
- var result = 0;
76303
- var items = this.items;
76304
- var length = items.length;
76305
- for (var i = 0; i < length; ++i) {
76306
- var item = items[i];
76307
- var itemWidth = item.width;
76308
- if (itemWidth != null) {
76309
- result += itemWidth;
76310
- }
76310
+ DTableHeaderCell.prototype.onHovered = function (e) {
76311
+ var width = this.width;
76312
+ var x = this.toClickPosition(e);
76313
+ var edgeSize = this._edgeSize;
76314
+ if (0 <= x && x <= edgeSize) {
76315
+ if (this.getResizableEdges() & DTableHeaderCellEdge.LEFT) {
76316
+ this.state.add(DTableState.HOVERED_ON_EDGE, DTableHeaderCellEdge.LEFT);
76311
76317
  }
76312
- return result;
76313
- },
76314
- enumerable: false,
76315
- configurable: true
76316
- });
76317
- DTableColumnContainerImpl.prototype.get = function (index) {
76318
- var columns = this.items;
76319
- if (0 <= index && index < columns.length) {
76320
- return columns[index];
76321
- }
76322
- return null;
76323
- };
76324
- DTableColumnContainerImpl.prototype.each = function (iteratee) {
76325
- var columns = this.items;
76326
- for (var i = 0, imax = columns.length; i < imax; ++i) {
76327
- if (iteratee(columns[i], i) === false) {
76328
- break;
76318
+ else {
76319
+ this.state.remove(DTableState.HOVERED_ON_EDGE);
76329
76320
  }
76330
76321
  }
76331
- return this;
76332
- };
76333
- DTableColumnContainerImpl.prototype.size = function () {
76334
- return this.items.length;
76335
- };
76336
- return DTableColumnContainerImpl;
76337
- }(pixi_js.utils.EventEmitter));
76338
-
76339
- /*
76340
- * Copyright (C) 2019 Toshiba Corporation
76341
- * SPDX-License-Identifier: Apache-2.0
76342
- */
76343
- var DTableCategoryColumnImpl = /** @class */ (function (_super) {
76344
- __extends(DTableCategoryColumnImpl, _super);
76345
- function DTableCategoryColumnImpl(index, column) {
76346
- var _this = _super.call(this) || this;
76347
- // Label
76348
- var category = column.category;
76349
- if (category) {
76350
- if (isString(category)) {
76351
- if (index === 0) {
76352
- _this.label = category;
76353
- }
76322
+ else if (width - edgeSize <= x && x <= width) {
76323
+ if (this.getResizableEdges() & DTableHeaderCellEdge.RIGHT) {
76324
+ this.state.add(DTableState.HOVERED_ON_EDGE, DTableHeaderCellEdge.RIGHT);
76354
76325
  }
76355
76326
  else {
76356
- if (index < category.length) {
76357
- _this.label = category[index];
76358
- }
76327
+ this.state.remove(DTableState.HOVERED_ON_EDGE);
76359
76328
  }
76360
76329
  }
76361
- _this._weight = column.weight;
76362
- _this._width = column.width;
76363
- _this._isLocked = false;
76364
- _this.offset = 0.0;
76365
- _this._columns = [column];
76366
- _this._nresizable = column.resizable ? 1 : 0;
76367
- var onResizeBound = function () {
76368
- _this.onResize();
76369
- };
76370
- _this._onResizeBound = onResizeBound;
76371
- column.on("resize", onResizeBound);
76372
- return _this;
76373
- }
76374
- DTableCategoryColumnImpl.prototype.onResize = function () {
76375
- if (this._isLocked) {
76330
+ else {
76331
+ this.state.remove(DTableState.HOVERED_ON_EDGE);
76332
+ }
76333
+ };
76334
+ DTableHeaderCell.prototype.onDownEdge = function (onDownPoint, columnIndex, interactionManager) {
76335
+ // Find the resizable cell
76336
+ var left = this.findLeftResizableCell(columnIndex);
76337
+ if (left == null) {
76338
+ // No resizable cell
76376
76339
  return;
76377
76340
  }
76378
- var columns = this._columns;
76379
- if (this._weight != null) {
76380
- var newWeight = 0;
76381
- for (var i = 0, imax = columns.length; i < imax; ++i) {
76382
- var weight = columns[i].weight;
76383
- if (weight != null) {
76384
- newWeight += weight;
76385
- }
76386
- }
76387
- if (this._weight !== newWeight) {
76388
- this._weight = newWeight;
76389
- this.emit("resize", this);
76390
- }
76341
+ var header = this._header;
76342
+ var leftColumn = left.column;
76343
+ var leftOldWidth = left.width;
76344
+ var leftOldWeight = left.weight;
76345
+ if (leftColumn.weight == null) {
76346
+ header.state.add(DTableState.RESIZING);
76347
+ var onMove_1 = function (e) {
76348
+ leftColumn.width = Math.max(1, leftOldWidth + e.data.global.x - onDownPoint);
76349
+ };
76350
+ var onUp_1 = function (e) {
76351
+ header.state.remove(DTableState.RESIZING);
76352
+ interactionManager.off(UtilPointerEvent.move, onMove_1);
76353
+ interactionManager.off(UtilPointerEvent.up, onUp_1);
76354
+ interactionManager.off(UtilPointerEvent.upoutside, onUp_1);
76355
+ interactionManager.off(UtilPointerEvent.cancel, onUp_1);
76356
+ };
76357
+ interactionManager.on(UtilPointerEvent.move, onMove_1);
76358
+ interactionManager.on(UtilPointerEvent.up, onUp_1);
76359
+ interactionManager.on(UtilPointerEvent.upoutside, onUp_1);
76360
+ interactionManager.on(UtilPointerEvent.cancel, onUp_1);
76391
76361
  }
76392
76362
  else {
76393
- var newWidth = 0;
76394
- for (var i = 0, imax = columns.length; i < imax; ++i) {
76395
- var width = columns[i].width;
76396
- if (width != null) {
76397
- newWidth += width;
76398
- }
76363
+ var right = this.findRightResizableCellOfWeight(left.columnIndex);
76364
+ if (right == null) {
76365
+ // No right resizable cell found
76366
+ return;
76399
76367
  }
76400
- if (this._width !== newWidth) {
76401
- this._width = newWidth;
76402
- this.emit("resize", this);
76368
+ var rightColumn_1 = right.column;
76369
+ var rightOldWeight = right.weight;
76370
+ var rightOldWidth = right.width;
76371
+ var totalWidth_1 = leftOldWidth + rightOldWidth;
76372
+ var totalWeight_1 = leftOldWeight + rightOldWeight;
76373
+ if (totalWidth_1 <= 0) {
76374
+ // The left and right resizable cells doesn't have non-zero width
76375
+ return;
76403
76376
  }
76377
+ header.state.add(DTableState.RESIZING);
76378
+ var onMove_2 = function (e) {
76379
+ var leftNewWidth = Math.max(0, Math.min(totalWidth_1, leftOldWidth + e.data.global.x - onDownPoint));
76380
+ var leftNewWeight = totalWeight_1 * (leftNewWidth / totalWidth_1);
76381
+ leftColumn.weight = leftNewWeight;
76382
+ rightColumn_1.weight = totalWeight_1 - leftNewWeight;
76383
+ };
76384
+ var onUp_2 = function (e) {
76385
+ header.state.remove(DTableState.RESIZING);
76386
+ interactionManager.off(UtilPointerEvent.move, onMove_2);
76387
+ interactionManager.off(UtilPointerEvent.up, onUp_2);
76388
+ interactionManager.off(UtilPointerEvent.upoutside, onUp_2);
76389
+ interactionManager.off(UtilPointerEvent.cancel, onUp_2);
76390
+ };
76391
+ interactionManager.on(UtilPointerEvent.move, onMove_2);
76392
+ interactionManager.on(UtilPointerEvent.up, onUp_2);
76393
+ interactionManager.on(UtilPointerEvent.upoutside, onUp_2);
76394
+ interactionManager.on(UtilPointerEvent.cancel, onUp_2);
76404
76395
  }
76405
76396
  };
76406
- Object.defineProperty(DTableCategoryColumnImpl.prototype, "resizable", {
76407
- get: function () {
76408
- return 0 < this._nresizable;
76409
- },
76410
- enumerable: false,
76411
- configurable: true
76412
- });
76413
- Object.defineProperty(DTableCategoryColumnImpl.prototype, "weight", {
76397
+ Object.defineProperty(DTableHeaderCell.prototype, "sorter", {
76414
76398
  get: function () {
76415
- return this._weight;
76416
- },
76417
- set: function (weight) {
76418
- var oldWeight = this._weight;
76419
- var nresizable = this._nresizable;
76420
- if (0 < nresizable && oldWeight != null && oldWeight !== weight) {
76421
- var columns = this._columns;
76422
- var columnsLength = columns.length;
76423
- var minWeight = this.minWeight;
76424
- var newWeight = Math.max(minWeight, weight);
76425
- if (this._weight !== newWeight) {
76426
- this._isLocked = true;
76427
- if (minWeight < oldWeight) {
76428
- var columnWeightRatio = (newWeight - minWeight) / (oldWeight - minWeight);
76429
- for (var i = 0; i < columnsLength; ++i) {
76430
- var column = columns[i];
76431
- var columnWeight = column.weight;
76432
- if (column.resizable && columnWeight != null) {
76433
- column.weight = columnWeight * columnWeightRatio;
76434
- }
76435
- }
76399
+ var _this = this;
76400
+ var sorter = this._sorter;
76401
+ if (sorter == null) {
76402
+ var header = this._header;
76403
+ if (header) {
76404
+ var table = header.table;
76405
+ if (table) {
76406
+ sorter = table.data.sorter;
76407
+ this._sorter = sorter;
76408
+ this._onSorterChangeBound =
76409
+ this._onSorterChangeBound ||
76410
+ (function () {
76411
+ _this.onSorterChange();
76412
+ });
76413
+ sorter.on("change", this._onSorterChangeBound);
76436
76414
  }
76437
76415
  else {
76438
- var newColumnWeight = (newWeight - minWeight) / this._nresizable;
76439
- for (var i = 0; i < columnsLength; ++i) {
76440
- var column = columns[i];
76441
- var columnWeight = column.weight;
76442
- if (column.resizable && columnWeight != null) {
76443
- column.weight = newColumnWeight;
76444
- }
76445
- }
76416
+ return null;
76446
76417
  }
76447
- this._isLocked = false;
76448
- this.onResize();
76418
+ }
76419
+ else {
76420
+ return null;
76449
76421
  }
76450
76422
  }
76423
+ return sorter;
76451
76424
  },
76452
76425
  enumerable: false,
76453
76426
  configurable: true
76454
76427
  });
76455
- Object.defineProperty(DTableCategoryColumnImpl.prototype, "minWeight", {
76428
+ Object.defineProperty(DTableHeaderCell.prototype, "comparator", {
76456
76429
  get: function () {
76457
- var result = 0;
76458
- var columns = this._columns;
76459
- var columnsLength = columns.length;
76460
- for (var i = 0; i < columnsLength; ++i) {
76461
- var column = columns[i];
76462
- var columnWeight = column.weight;
76463
- if (!column.resizable && columnWeight != null) {
76464
- result += columnWeight;
76465
- }
76466
- }
76467
- return result;
76430
+ return this._column.sorting.comparator || null;
76468
76431
  },
76469
76432
  enumerable: false,
76470
76433
  configurable: true
76471
76434
  });
76472
- Object.defineProperty(DTableCategoryColumnImpl.prototype, "width", {
76473
- get: function () {
76474
- return this._width;
76475
- },
76476
- set: function (width) {
76477
- var oldWidth = this._width;
76478
- var nresizable = this._nresizable;
76479
- if (0 < nresizable && oldWidth != null && oldWidth !== width) {
76480
- var columns = this._columns;
76481
- var columnsLength = columns.length;
76482
- var minWidth = this.minWidth;
76483
- var newWidth = Math.max(minWidth, width);
76484
- if (oldWidth !== newWidth) {
76485
- this._isLocked = true;
76486
- if (minWidth < oldWidth) {
76487
- var columnWidthRatio = (newWidth - minWidth) / (oldWidth - minWidth);
76488
- for (var i = 0; i < columnsLength; ++i) {
76489
- var column = columns[i];
76490
- var columnWidth = column.width;
76491
- if (column.resizable && columnWidth != null) {
76492
- column.width = columnWidth * columnWidthRatio;
76493
- }
76494
- }
76435
+ DTableHeaderCell.prototype.onSorterChange = function () {
76436
+ var comparator = this.comparator;
76437
+ if (comparator) {
76438
+ var sorter = this._sorter;
76439
+ if (sorter) {
76440
+ var SORTED_ASCENDING = DTableState.SORTED_ASCENDING;
76441
+ var SORTED_DESCENDING = DTableState.SORTED_DESCENDING;
76442
+ if (sorter.isApplied() && sorter.get() === comparator) {
76443
+ if (sorter.order === DTableDataOrder.ASCENDING) {
76444
+ this.state.set(SORTED_ASCENDING, SORTED_DESCENDING);
76495
76445
  }
76496
76446
  else {
76497
- var newColumnWidth = (newWidth - minWidth) / this._nresizable;
76498
- for (var i = 0; i < columnsLength; ++i) {
76499
- var column = columns[i];
76500
- var columnWidth = column.width;
76501
- if (column.resizable && columnWidth != null) {
76502
- column.width = newColumnWidth;
76503
- }
76504
- }
76447
+ this.state.set(SORTED_DESCENDING, SORTED_ASCENDING);
76505
76448
  }
76506
- this._isLocked = false;
76507
- this.onResize();
76508
76449
  }
76509
- }
76510
- },
76511
- enumerable: false,
76512
- configurable: true
76513
- });
76514
- Object.defineProperty(DTableCategoryColumnImpl.prototype, "minWidth", {
76515
- get: function () {
76516
- var result = 0;
76517
- var columns = this._columns;
76518
- var columnsLength = columns.length;
76519
- for (var i = 0; i < columnsLength; ++i) {
76520
- var column = columns[i];
76521
- var columnWidth = column.width;
76522
- if (!column.resizable && columnWidth != null) {
76523
- result += columnWidth;
76524
- }
76525
- }
76526
- return result;
76527
- },
76528
- enumerable: false,
76529
- configurable: true
76530
- });
76531
- DTableCategoryColumnImpl.prototype.add = function (column) {
76532
- this._columns.push(column);
76533
- if (this._weight != null) {
76534
- var weight = column.weight;
76535
- if (weight != null) {
76536
- this._weight += weight;
76537
- if (column.resizable) {
76538
- this._nresizable += 1;
76450
+ else {
76451
+ this.state.removeAll(SORTED_ASCENDING, SORTED_DESCENDING);
76539
76452
  }
76540
- column.on("resize", this._onResizeBound);
76541
76453
  }
76542
76454
  }
76543
- else if (this._width != null) {
76544
- var width = column.width;
76545
- if (width != null) {
76546
- this._width += width;
76547
- if (column.resizable) {
76548
- this._nresizable += 1;
76455
+ };
76456
+ DTableHeaderCell.prototype.toClickPosition = function (e) {
76457
+ var _a;
76458
+ var checkWork = ((_a = this._checkWork) !== null && _a !== void 0 ? _a : (this._checkWork = new pixi_js.Point()));
76459
+ return e.data.getLocalPosition(this, checkWork).x;
76460
+ };
76461
+ DTableHeaderCell.prototype.isCheckClicked = function (e) {
76462
+ if (e instanceof pixi_js.InteractionEvent && this._check.isEnabled) {
76463
+ if (this.isSortable) {
76464
+ var image = this.image.get(1);
76465
+ if (image) {
76466
+ var position = this.toClickPosition(e);
76467
+ var object = image.object;
76468
+ if (object != null) {
76469
+ var bound = object.getLocalBounds();
76470
+ var margin = image.margin.horizontal;
76471
+ var x = object.x;
76472
+ return (x + bound.left - margin <= position &&
76473
+ position <= x + bound.right + margin);
76474
+ }
76549
76475
  }
76550
- column.on("resize", this._onResizeBound);
76476
+ }
76477
+ else {
76478
+ return true;
76551
76479
  }
76552
76480
  }
76481
+ return false;
76553
76482
  };
76554
- return DTableCategoryColumnImpl;
76555
- }(pixi_js.utils.EventEmitter));
76556
-
76557
- var DTableCategoryContainerImpl = /** @class */ (function () {
76558
- function DTableCategoryContainerImpl(columns, frozen, options) {
76559
- var count = this.toCount(columns);
76560
- var items = [];
76561
- var offset = 0;
76562
- for (var i = count - 1; 0 <= i; --i) {
76563
- var item = new DTableCategory(this.toColumns(i, columns, frozen), frozen, offset, options);
76564
- items.push(item);
76565
- offset += item.height;
76483
+ DTableHeaderCell.prototype.isEdgeClicked = function (e) {
76484
+ return (e instanceof pixi_js.InteractionEvent &&
76485
+ (this.state.is(DTableState.HOVERED_ON_EDGE) || this._wasResizing));
76486
+ };
76487
+ DTableHeaderCell.prototype.onClick = function (e) {
76488
+ if (this.state.isActionable) {
76489
+ this.activate(e);
76566
76490
  }
76567
- this.items = items;
76568
- }
76569
- DTableCategoryContainerImpl.prototype.toCount = function (columns) {
76570
- var result = 0;
76571
- for (var i = 0, imax = columns.length; i < imax; ++i) {
76572
- var category = columns[i].category;
76573
- if (category != null) {
76574
- var count = isString(category) ? 1 : category.length;
76575
- result = Math.max(result, count);
76491
+ };
76492
+ DTableHeaderCell.prototype.activate = function (e) {
76493
+ this.onActivate(e);
76494
+ };
76495
+ DTableHeaderCell.prototype.onActivate = function (e) {
76496
+ if (!this.isEdgeClicked(e)) {
76497
+ if (this.isCheckClicked(e)) {
76498
+ this.onToggleStart();
76499
+ this.onToggleEnd();
76500
+ }
76501
+ else {
76502
+ this.doSort(e);
76503
+ this.emit("active", this);
76576
76504
  }
76577
76505
  }
76578
- return result;
76579
76506
  };
76580
- DTableCategoryContainerImpl.prototype.isCategory = function (index, a, b) {
76581
- if (a != null) {
76582
- if (b != null) {
76583
- if (isString(a)) {
76584
- if (isString(b)) {
76585
- if (0 < index) {
76586
- return true;
76587
- }
76588
- else {
76589
- return a === b;
76590
- }
76591
- }
76592
- else {
76593
- if (0 < index) {
76594
- return b.length <= index;
76595
- }
76596
- else {
76597
- return b.length === 1 && a === b[0];
76598
- }
76599
- }
76600
- }
76601
- else {
76602
- if (isString(b)) {
76603
- if (0 < index) {
76604
- return a.length <= index;
76507
+ DTableHeaderCell.prototype.doSort = function (e) {
76508
+ if (this.isSortable) {
76509
+ var comparator = this.comparator;
76510
+ if (comparator) {
76511
+ var sorter = this.sorter;
76512
+ if (sorter) {
76513
+ if (sorter.get() === comparator) {
76514
+ if (sorter.order === DTableDataOrder.ASCENDING) {
76515
+ sorter.order = DTableDataOrder.DESCENDING;
76516
+ sorter.apply();
76605
76517
  }
76606
76518
  else {
76607
- return a.length === 1 && a[0] === b;
76519
+ sorter.set(null);
76520
+ sorter.apply();
76608
76521
  }
76609
76522
  }
76610
76523
  else {
76611
- if (a.length <= index && b.length <= index) {
76612
- return true;
76613
- }
76614
- else if (b.length === a.length) {
76615
- for (var i = index, imax = a.length; i < imax; ++i) {
76616
- if (a[i] !== b[i]) {
76617
- return false;
76618
- }
76619
- }
76620
- return true;
76621
- }
76622
- return false;
76524
+ sorter.set(comparator);
76525
+ sorter.order = DTableDataOrder.ASCENDING;
76526
+ sorter.apply();
76623
76527
  }
76624
76528
  }
76625
76529
  }
76626
- else {
76627
- if (isString(a)) {
76628
- if (0 < index) {
76629
- return true;
76630
- }
76631
- else {
76632
- return false;
76633
- }
76634
- }
76635
- else {
76636
- if (a.length <= index) {
76637
- return true;
76638
- }
76639
- else {
76640
- return false;
76641
- }
76642
- }
76530
+ }
76531
+ };
76532
+ Object.defineProperty(DTableHeaderCell.prototype, "isSortable", {
76533
+ get: function () {
76534
+ return this._column.sorting.enable;
76535
+ },
76536
+ enumerable: false,
76537
+ configurable: true
76538
+ });
76539
+ Object.defineProperty(DTableHeaderCell.prototype, "isResizable", {
76540
+ get: function () {
76541
+ return this._column.resizable;
76542
+ },
76543
+ enumerable: false,
76544
+ configurable: true
76545
+ });
76546
+ Object.defineProperty(DTableHeaderCell.prototype, "isToggle", {
76547
+ get: function () {
76548
+ return this._check.isEnabled;
76549
+ },
76550
+ enumerable: false,
76551
+ configurable: true
76552
+ });
76553
+ DTableHeaderCell.prototype.toggle = function () {
76554
+ if (this.state.isActionable) {
76555
+ if (this.isToggle) {
76556
+ this.onToggleStart();
76557
+ this.onToggleEnd();
76643
76558
  }
76644
76559
  }
76560
+ };
76561
+ DTableHeaderCell.prototype.onToggleStart = function () {
76562
+ this.state.isActive = !this.state.isActive;
76563
+ };
76564
+ DTableHeaderCell.prototype.onToggleEnd = function () {
76565
+ if (this.state.isActive) {
76566
+ this._check.execute(true);
76567
+ this.emit("active", this);
76568
+ }
76645
76569
  else {
76646
- if (b != null) {
76647
- if (isString(b)) {
76648
- if (0 < index) {
76649
- return true;
76650
- }
76651
- else {
76652
- return false;
76653
- }
76654
- }
76655
- else {
76656
- if (b.length <= index) {
76657
- return true;
76658
- }
76659
- else {
76660
- return false;
76661
- }
76662
- }
76570
+ this._check.execute(false);
76571
+ this.emit("inactive", this);
76572
+ }
76573
+ };
76574
+ DTableHeaderCell.prototype.onActivateKeyDown = function (e) {
76575
+ if (this.state.isActionable) {
76576
+ if (this.isToggle) {
76577
+ this.onToggleStart();
76663
76578
  }
76664
76579
  else {
76665
- return true;
76580
+ this.state.isPressed = true;
76666
76581
  }
76667
76582
  }
76668
76583
  };
76669
- DTableCategoryContainerImpl.prototype.toColumns = function (index, columns, frozen) {
76670
- var result = [];
76671
- var tcolumn = null;
76672
- var ccolumn = null;
76673
- for (var i = 0, imax = columns.length; i < imax; ++i) {
76674
- var column = columns[i];
76675
- if (i !== frozen &&
76676
- ccolumn &&
76677
- tcolumn &&
76678
- this.isCategory(index, tcolumn.category, column.category)) {
76679
- if (ccolumn.weight != null && column.weight != null) {
76680
- ccolumn.add(column);
76681
- }
76682
- else if (ccolumn.width != null && column.width != null) {
76683
- ccolumn.add(column);
76684
- }
76685
- else {
76686
- tcolumn = column;
76687
- ccolumn = new DTableCategoryColumnImpl(index, column);
76688
- result.push(ccolumn);
76689
- }
76584
+ DTableHeaderCell.prototype.onActivateKeyUp = function (e) {
76585
+ if (this.state.isActionable) {
76586
+ if (this.isToggle) {
76587
+ this.onToggleEnd();
76690
76588
  }
76691
76589
  else {
76692
- tcolumn = column;
76693
- ccolumn = new DTableCategoryColumnImpl(index, column);
76694
- result.push(ccolumn);
76590
+ if (this.state.isPressed) {
76591
+ this.activate(e);
76592
+ }
76593
+ this.state.isPressed = false;
76695
76594
  }
76696
76595
  }
76697
- return result;
76698
76596
  };
76699
- return DTableCategoryContainerImpl;
76700
- }());
76597
+ DTableHeaderCell.prototype.onKeyDown = function (e) {
76598
+ if (UtilKeyboardEvent.isActivateKey(e)) {
76599
+ this.onActivateKeyDown(e);
76600
+ }
76601
+ return _super.prototype.onKeyDown.call(this, e);
76602
+ };
76603
+ DTableHeaderCell.prototype.onKeyUp = function (e) {
76604
+ if (UtilKeyboardEvent.isActivateKey(e)) {
76605
+ this.onActivateKeyUp(e);
76606
+ }
76607
+ return _super.prototype.onKeyUp.call(this, e);
76608
+ };
76609
+ DTableHeaderCell.prototype.getType = function () {
76610
+ return "DTableHeaderCell";
76611
+ };
76612
+ DTableHeaderCell.prototype.destroy = function () {
76613
+ var sorter = this._sorter;
76614
+ var onSorterChangeBound = this._onSorterChangeBound;
76615
+ if (sorter && onSorterChangeBound) {
76616
+ sorter.off("change", onSorterChangeBound);
76617
+ }
76618
+ this._sorter = undefined;
76619
+ this._onSorterChangeBound = undefined;
76620
+ _super.prototype.destroy.call(this);
76621
+ };
76622
+ return DTableHeaderCell;
76623
+ }(DImage));
76624
+
76625
+ /*
76626
+ * Copyright (C) 2019 Toshiba Corporation
76627
+ * SPDX-License-Identifier: Apache-2.0
76628
+ */
76629
+ var DTableHeader = /** @class */ (function (_super) {
76630
+ __extends(DTableHeader, _super);
76631
+ function DTableHeader(table, columns, frozen, offset, options) {
76632
+ var _this = _super.call(this, columns, frozen, options) || this;
76633
+ _this._table = table;
76634
+ _this._offset = offset;
76635
+ _this.transform.position.y = offset;
76636
+ _this.initCells();
76637
+ return _this;
76638
+ }
76639
+ Object.defineProperty(DTableHeader.prototype, "table", {
76640
+ get: function () {
76641
+ return this._table;
76642
+ },
76643
+ enumerable: false,
76644
+ configurable: true
76645
+ });
76646
+ DTableHeader.prototype.onParentMove = function (newX, newY, oldX, oldY) {
76647
+ _super.prototype.onParentMove.call(this, newX, newY, oldX, oldY);
76648
+ this.transform.position.y = -newY + this._offset;
76649
+ this.updateFrozenCellPosition(newX);
76650
+ };
76651
+ DTableHeader.prototype.getContentPositionX = function () {
76652
+ var content = this.parent;
76653
+ if (content) {
76654
+ return content.position.x;
76655
+ }
76656
+ return 0;
76657
+ };
76658
+ DTableHeader.prototype.newCell = function (columnIndex, column, columns, options) {
76659
+ return new DTableHeaderCell(this, columnIndex, column, this.toCellOptions(column, options));
76660
+ };
76661
+ DTableHeader.prototype.toCellOptions = function (column, options) {
76662
+ var result = column.header || (options === null || options === void 0 ? void 0 : options.cell);
76663
+ if (result != null) {
76664
+ if (result.weight === undefined) {
76665
+ result.weight = column.weight;
76666
+ }
76667
+ if (result.width === undefined) {
76668
+ result.width = column.width;
76669
+ }
76670
+ if (result.text === undefined) {
76671
+ result.text = {
76672
+ value: column.label
76673
+ };
76674
+ }
76675
+ else if (result.text.value === undefined) {
76676
+ result.text.value = column.label;
76677
+ }
76678
+ return result;
76679
+ }
76680
+ else {
76681
+ return {
76682
+ weight: column.weight,
76683
+ width: column.width,
76684
+ text: {
76685
+ value: column.label
76686
+ }
76687
+ };
76688
+ }
76689
+ };
76690
+ DTableHeader.prototype.getType = function () {
76691
+ return "DTableHeader";
76692
+ };
76693
+ return DTableHeader;
76694
+ }(DTableRow));
76695
+
76696
+ var DTableScrollBar = /** @class */ (function (_super) {
76697
+ __extends(DTableScrollBar, _super);
76698
+ function DTableScrollBar() {
76699
+ return _super !== null && _super.apply(this, arguments) || this;
76700
+ }
76701
+ DTableScrollBar.prototype.getOffsetVerticalStart = function (size) {
76702
+ return size * 0.5 + this._parent.body.position.y;
76703
+ };
76704
+ return DTableScrollBar;
76705
+ }(DPaneScrollBar));
76701
76706
 
76702
76707
  /*
76703
76708
  * Copyright (C) 2019 Toshiba Corporation
@@ -79231,6 +79236,7 @@
79231
79236
  DImagePieceMarginImpl: DImagePieceMarginImpl,
79232
79237
  DImagePieceTintImpl: DImagePieceTintImpl,
79233
79238
  DImage: DImage,
79239
+ DIndicatorProcessingState: DIndicatorProcessingState,
79234
79240
  DIndicatorProcessing: DIndicatorProcessing,
79235
79241
  DInputAndLabel: DInputAndLabel,
79236
79242
  DInputBooleanButtonOff: DInputBooleanButtonOff,
@@ -79432,7 +79438,11 @@
79432
79438
  DTableBody: DTableBody,
79433
79439
  DTableCategoryCellEdge: DTableCategoryCellEdge,
79434
79440
  DTableCategoryCell: DTableCategoryCell,
79441
+ DTableCategoryColumnImpl: DTableCategoryColumnImpl,
79442
+ DTableCategoryContainerImpl: DTableCategoryContainerImpl,
79435
79443
  DTableCategory: DTableCategory,
79444
+ DTableColumnContainerImpl: DTableColumnContainerImpl,
79445
+ DTableColumnImpl: DTableColumnImpl,
79436
79446
  DTableColumnType: DTableColumnType,
79437
79447
  DTableColumnUpdate: DTableColumnUpdate,
79438
79448
  DTableDataListFilter: DTableDataListFilter,