@wcardinal/wcardinal-ui 0.411.0 → 0.413.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (98) hide show
  1. package/dist/types/wcardinal/ui/d-indicator-processing.d.ts +8 -7
  2. package/dist/types/wcardinal/ui/d-pagination.d.ts +5 -5
  3. package/dist/types/wcardinal/ui/d-table-body-cell.d.ts +2 -2
  4. package/dist/types/wcardinal/ui/d-table-body-row.d.ts +9 -9
  5. package/dist/types/wcardinal/ui/d-table-body.d.ts +5 -7
  6. package/dist/types/wcardinal/ui/d-table-category-cell.d.ts +37 -0
  7. package/dist/types/wcardinal/ui/d-table-category-column-impl.d.ts +24 -0
  8. package/dist/types/wcardinal/ui/d-table-category-column.d.ts +10 -0
  9. package/dist/types/wcardinal/ui/d-table-category-container-impl.d.ts +12 -0
  10. package/dist/types/wcardinal/ui/d-table-category-container.d.ts +4 -0
  11. package/dist/types/wcardinal/ui/d-table-category.d.ts +13 -12
  12. package/dist/types/wcardinal/ui/d-table-column-container-impl.d.ts +25 -0
  13. package/dist/types/wcardinal/ui/d-table-column-container.d.ts +12 -0
  14. package/dist/types/wcardinal/ui/d-table-column-impl.d.ts +44 -0
  15. package/dist/types/wcardinal/ui/d-table-column.d.ts +22 -19
  16. package/dist/types/wcardinal/ui/d-table-header-cell-check.d.ts +1 -1
  17. package/dist/types/wcardinal/ui/d-table-header-cell.d.ts +34 -12
  18. package/dist/types/wcardinal/ui/d-table-header.d.ts +8 -9
  19. package/dist/types/wcardinal/ui/d-table-row.d.ts +8 -9
  20. package/dist/types/wcardinal/ui/d-table-state.d.ts +8 -0
  21. package/dist/types/wcardinal/ui/d-table.d.ts +15 -18
  22. package/dist/types/wcardinal/ui/index.d.ts +7 -0
  23. package/dist/types/wcardinal/ui/theme/dark/d-theme-dark-table-header-cell.d.ts +1 -0
  24. package/dist/types/wcardinal/ui/theme/dark/d-theme-dark-table-header.d.ts +1 -0
  25. package/dist/types/wcardinal/ui/theme/white/d-theme-white-table-header-cell.d.ts +1 -0
  26. package/dist/types/wcardinal/ui/theme/white/d-theme-white-table-header.d.ts +1 -0
  27. package/dist/wcardinal/ui/d-base.js +2 -2
  28. package/dist/wcardinal/ui/d-base.js.map +1 -1
  29. package/dist/wcardinal/ui/d-indicator-processing.js +20 -15
  30. package/dist/wcardinal/ui/d-indicator-processing.js.map +1 -1
  31. package/dist/wcardinal/ui/d-pagination.js +5 -5
  32. package/dist/wcardinal/ui/d-pagination.js.map +1 -1
  33. package/dist/wcardinal/ui/d-table-body-cell.js.map +1 -1
  34. package/dist/wcardinal/ui/d-table-body-row.js +4 -4
  35. package/dist/wcardinal/ui/d-table-body-row.js.map +1 -1
  36. package/dist/wcardinal/ui/d-table-body.js +6 -15
  37. package/dist/wcardinal/ui/d-table-body.js.map +1 -1
  38. package/dist/wcardinal/ui/d-table-category-cell.js +244 -2
  39. package/dist/wcardinal/ui/d-table-category-cell.js.map +1 -1
  40. package/dist/wcardinal/ui/d-table-category-column-impl.js +222 -0
  41. package/dist/wcardinal/ui/d-table-category-column-impl.js.map +1 -0
  42. package/dist/wcardinal/ui/d-table-category-column.js +6 -0
  43. package/dist/wcardinal/ui/d-table-category-column.js.map +1 -0
  44. package/dist/wcardinal/ui/d-table-category-container-impl.js +149 -0
  45. package/dist/wcardinal/ui/d-table-category-container-impl.js.map +1 -0
  46. package/dist/wcardinal/ui/d-table-category-container.js +2 -0
  47. package/dist/wcardinal/ui/d-table-category-container.js.map +1 -0
  48. package/dist/wcardinal/ui/d-table-category.js +49 -7
  49. package/dist/wcardinal/ui/d-table-category.js.map +1 -1
  50. package/dist/wcardinal/ui/d-table-column-container-impl.js +126 -0
  51. package/dist/wcardinal/ui/d-table-column-container-impl.js.map +1 -0
  52. package/dist/wcardinal/ui/d-table-column-container.js +2 -0
  53. package/dist/wcardinal/ui/d-table-column-container.js.map +1 -0
  54. package/dist/wcardinal/ui/d-table-column-impl.js +375 -0
  55. package/dist/wcardinal/ui/d-table-column-impl.js.map +1 -0
  56. package/dist/wcardinal/ui/d-table-column.js.map +1 -1
  57. package/dist/wcardinal/ui/d-table-header-cell-check.js.map +1 -1
  58. package/dist/wcardinal/ui/d-table-header-cell.js +245 -48
  59. package/dist/wcardinal/ui/d-table-header-cell.js.map +1 -1
  60. package/dist/wcardinal/ui/d-table-header.js +8 -22
  61. package/dist/wcardinal/ui/d-table-header.js.map +1 -1
  62. package/dist/wcardinal/ui/d-table-row.js +7 -5
  63. package/dist/wcardinal/ui/d-table-row.js.map +1 -1
  64. package/dist/wcardinal/ui/d-table-state.js +9 -1
  65. package/dist/wcardinal/ui/d-table-state.js.map +1 -1
  66. package/dist/wcardinal/ui/d-table.js +69 -631
  67. package/dist/wcardinal/ui/d-table.js.map +1 -1
  68. package/dist/wcardinal/ui/index.js +7 -0
  69. package/dist/wcardinal/ui/index.js.map +1 -1
  70. package/dist/wcardinal/ui/theme/dark/d-theme-dark-table-header-cell.js +7 -1
  71. package/dist/wcardinal/ui/theme/dark/d-theme-dark-table-header-cell.js.map +1 -1
  72. package/dist/wcardinal/ui/theme/dark/d-theme-dark-table-header.js +7 -0
  73. package/dist/wcardinal/ui/theme/dark/d-theme-dark-table-header.js.map +1 -1
  74. package/dist/wcardinal/ui/theme/white/d-theme-white-table-header-cell.js +7 -1
  75. package/dist/wcardinal/ui/theme/white/d-theme-white-table-header-cell.js.map +1 -1
  76. package/dist/wcardinal/ui/theme/white/d-theme-white-table-header.js +7 -0
  77. package/dist/wcardinal/ui/theme/white/d-theme-white-table-header.js.map +1 -1
  78. package/dist/wcardinal-ui-theme-dark-en-us.js +14 -2
  79. package/dist/wcardinal-ui-theme-dark-en-us.min.js +2 -2
  80. package/dist/wcardinal-ui-theme-dark-en-us.min.js.map +1 -1
  81. package/dist/wcardinal-ui-theme-dark-ja-jp.js +14 -2
  82. package/dist/wcardinal-ui-theme-dark-ja-jp.min.js +2 -2
  83. package/dist/wcardinal-ui-theme-dark-ja-jp.min.js.map +1 -1
  84. package/dist/wcardinal-ui-theme-dark.js +14 -2
  85. package/dist/wcardinal-ui-theme-dark.min.js +2 -2
  86. package/dist/wcardinal-ui-theme-white-en-us.js +14 -2
  87. package/dist/wcardinal-ui-theme-white-en-us.min.js +2 -2
  88. package/dist/wcardinal-ui-theme-white-en-us.min.js.map +1 -1
  89. package/dist/wcardinal-ui-theme-white-ja-jp.js +14 -2
  90. package/dist/wcardinal-ui-theme-white-ja-jp.min.js +2 -2
  91. package/dist/wcardinal-ui-theme-white-ja-jp.min.js.map +1 -1
  92. package/dist/wcardinal-ui-theme-white.js +14 -2
  93. package/dist/wcardinal-ui-theme-white.min.js +2 -2
  94. package/dist/wcardinal-ui.cjs.js +1545 -753
  95. package/dist/wcardinal-ui.js +1882 -1114
  96. package/dist/wcardinal-ui.min.js +2 -2
  97. package/dist/wcardinal-ui.min.js.map +1 -1
  98. package/package.json +1 -1
@@ -3,378 +3,24 @@
3
3
  * SPDX-License-Identifier: Apache-2.0
4
4
  */
5
5
  import { __extends } from "tslib";
6
- import { DAlignHorizontal } from "./d-align-horizontal";
7
6
  import { DApplications } from "./d-applications";
8
7
  import { DBase } from "./d-base";
9
- import { DDialogSelect } from "./d-dialog-select";
10
- import { DMenu } from "./d-menu";
11
8
  import { DPane } from "./d-pane";
12
9
  import { DTableBody } from "./d-table-body";
13
- import { DTableCategory } from "./d-table-category";
14
10
  import { DTableDataSelectionType } from "./d-table-data-selection";
15
11
  import { DTableHeader } from "./d-table-header";
16
12
  import { DTableRow } from "./d-table-row";
17
13
  import { isArray } from "./util/is-array";
18
- import { isString } from "./util/is-string";
19
- import { toEnum } from "./util/to-enum";
20
14
  import { UtilKeyboardEvent } from "./util/util-keyboard-event";
21
15
  import { UtilPointerEvent } from "./util/util-pointer-event";
22
16
  import { DTableScrollBar } from "./d-table-scrollbar";
23
- import { DTableColumnType } from "./d-table-column-type";
24
- import { DTableColumnUpdate } from "./d-table-column-update";
25
- var defaultGetter = function (row, columnIndex) {
26
- return row[columnIndex];
27
- };
28
- var defaultSetter = function (row, columnIndex, cell) {
29
- row[columnIndex] = cell;
30
- };
31
- var defaultGetterEmpty = function () { return ""; };
32
- var defaultSetterEmpty = function () {
33
- // DO NOTHING
34
- };
35
- var toPathGetter = function (path, def) {
36
- if (path.length <= 1) {
37
- var key_1 = path[0];
38
- if (def === undefined) {
39
- return function (row) {
40
- return row[key_1];
41
- };
42
- }
43
- else {
44
- return function (row) {
45
- return Object.prototype.hasOwnProperty.call(row, key_1) ? row[key_1] : def;
46
- };
47
- }
48
- }
49
- else {
50
- if (def === undefined) {
51
- return function (row) {
52
- for (var i = 0, imax = path.length - 1; i < imax; ++i) {
53
- row = row[path[i]];
54
- }
55
- return row[path[path.length - 1]];
56
- };
57
- }
58
- else {
59
- return function (row) {
60
- for (var i = 0, imax = path.length - 1; i < imax; ++i) {
61
- row = row[path[i]];
62
- }
63
- var key = path[path.length - 1];
64
- return Object.prototype.hasOwnProperty.call(row, key) ? row[key] : def;
65
- };
66
- }
67
- }
68
- };
69
- var toPathSetter = function (path) {
70
- if (path.length <= 1) {
71
- var key_2 = path[0];
72
- return function (row, columnIndex, cell) {
73
- row[key_2] = cell;
74
- };
75
- }
76
- else {
77
- return function (row, columnIndex, cell) {
78
- for (var i = 0, imax = path.length - 1; i < imax; ++i) {
79
- row = row[path[i]] || {};
80
- }
81
- row[path[path.length - 1]] = cell;
82
- };
83
- }
84
- };
85
- var toColumnAlign = function (options, type) {
86
- var align = options.align;
87
- if (align != null) {
88
- if (isString(align)) {
89
- return DAlignHorizontal[align];
90
- }
91
- else {
92
- return align;
93
- }
94
- }
95
- switch (type) {
96
- case DTableColumnType.TEXT:
97
- case DTableColumnType.TEXT_AREA:
98
- return DAlignHorizontal.LEFT;
99
- case DTableColumnType.REAL:
100
- case DTableColumnType.INTEGER:
101
- return DAlignHorizontal.RIGHT;
102
- case DTableColumnType.BUTTON:
103
- case DTableColumnType.INDEX:
104
- case DTableColumnType.SELECT:
105
- case DTableColumnType.ACTION:
106
- case DTableColumnType.LINK:
107
- case DTableColumnType.CHECK:
108
- case DTableColumnType.CHECK_SINGLE:
109
- case DTableColumnType.COLOR:
110
- return DAlignHorizontal.CENTER;
111
- default:
112
- return DAlignHorizontal.LEFT;
113
- }
114
- };
115
- var toColumnDataChecker = function (path) {
116
- if (path != null) {
117
- var pathLength_1 = path.length;
118
- if (pathLength_1 <= 1) {
119
- var key_3 = path[0];
120
- return function (row) {
121
- return Object.prototype.hasOwnProperty.call(row, key_3);
122
- };
123
- }
124
- else {
125
- return function (row) {
126
- for (var i = 0; i < pathLength_1; ++i) {
127
- var part = path[i];
128
- if (part in row) {
129
- row = row[part];
130
- }
131
- else {
132
- return false;
133
- }
134
- }
135
- return true;
136
- };
137
- }
138
- }
139
- return function (row, columnIndex) {
140
- return columnIndex < row.length;
141
- };
142
- };
143
- var toColumnEditingEnable = function (enable, path) {
144
- if (isString(enable)) {
145
- return toColumnDataChecker(path);
146
- }
147
- else if (enable != null) {
148
- return enable;
149
- }
150
- else {
151
- return false;
152
- }
153
- };
154
- var toColumnEditing = function (options, path) {
155
- var _a;
156
- var editing = options.editing;
157
- var editable = options.editable;
158
- if (editing) {
159
- return {
160
- enable: toColumnEditingEnable((_a = editing.enable) !== null && _a !== void 0 ? _a : editable, path),
161
- formatter: editing.formatter,
162
- unformatter: editing.unformatter,
163
- validator: editing.validator
164
- };
165
- }
166
- return {
167
- enable: toColumnEditingEnable(editable, path)
168
- };
169
- };
170
- var toComparator = function (getter, index) {
171
- return function (rowA, rowB) {
172
- var valueA = getter(rowA, index);
173
- var valueB = getter(rowB, index);
174
- return valueA < valueB ? -1 : valueB < valueA ? +1 : 0;
175
- };
176
- };
177
- var toColumnSorting = function (getter, index, options) {
178
- var sorting = options.sorting;
179
- var sortable = options.sortable;
180
- if (sorting) {
181
- if (sorting.enable || sortable) {
182
- return {
183
- enable: true,
184
- comparator: sorting.comparator || toComparator(getter, index)
185
- };
186
- }
187
- return {
188
- enable: false
189
- };
190
- }
191
- if (sortable) {
192
- return {
193
- enable: true,
194
- comparator: toComparator(getter, index)
195
- };
196
- }
197
- return {
198
- enable: false
199
- };
200
- };
201
- var toColumnMenu = function (options) {
202
- if (options == null) {
203
- return undefined;
204
- }
205
- else if (options instanceof DMenu) {
206
- return options;
207
- }
208
- else {
209
- return new DMenu(options);
210
- }
211
- };
212
- var toColumnDialog = function (options) {
213
- if (options == null) {
214
- return undefined;
215
- }
216
- else if ("open" in options) {
217
- return options;
218
- }
219
- else {
220
- return new DDialogSelect(options);
221
- }
222
- };
223
- var defaultSelectingGetter = function (dialog) {
224
- return dialog.value;
225
- };
226
- var defaultSelectingSetter = function () {
227
- // DO NOTHING
228
- };
229
- var toColumnSelecting = function (options) {
230
- if (options) {
231
- return {
232
- getter: options.getter || defaultSelectingGetter,
233
- setter: options.setter || defaultSelectingSetter,
234
- menu: toColumnMenu(options.menu),
235
- multiple: toColumnMenu(options.multiple),
236
- dialog: toColumnDialog(options.dialog),
237
- promise: options.promise
238
- };
239
- }
240
- return {
241
- getter: defaultSelectingGetter,
242
- setter: defaultSelectingSetter
243
- };
244
- };
245
- var toColumnGetter = function (options, type, parts) {
246
- var getter = options.getter;
247
- if (getter) {
248
- return getter;
249
- }
250
- switch (type) {
251
- case DTableColumnType.ACTION:
252
- case DTableColumnType.LINK:
253
- return defaultGetterEmpty;
254
- default:
255
- if (parts == null) {
256
- return defaultGetter;
257
- }
258
- else {
259
- return toPathGetter(parts, options.default);
260
- }
261
- }
262
- };
263
- var toColumnSetter = function (options, type, path) {
264
- var setter = options.setter;
265
- if (setter) {
266
- return setter;
267
- }
268
- switch (type) {
269
- case DTableColumnType.BUTTON:
270
- case DTableColumnType.ACTION:
271
- case DTableColumnType.LINK:
272
- return defaultSetterEmpty;
273
- default:
274
- if (path == null) {
275
- return defaultSetter;
276
- }
277
- else {
278
- return toPathSetter(path);
279
- }
280
- }
281
- };
282
- var toColumnState = function (options) {
283
- var state = options.state;
284
- if (state != null) {
285
- if (isString(state) || isArray(state)) {
286
- return {
287
- initial: state,
288
- modifier: undefined
289
- };
290
- }
291
- else {
292
- return {
293
- initial: undefined,
294
- modifier: state
295
- };
296
- }
297
- }
298
- return {
299
- initial: undefined,
300
- modifier: undefined
301
- };
302
- };
303
- var toColumnPath = function (options) {
304
- return options.path != null ? options.path.split(".") : null;
305
- };
306
- var toColumnRenderable = function (options, path) {
307
- var renderable = options.renderable;
308
- if (isString(renderable)) {
309
- return toColumnDataChecker(path);
310
- }
311
- else if (renderable != null) {
312
- return renderable;
313
- }
314
- return true;
315
- };
316
- var toColumn = function (index, options) {
317
- var _a, _b;
318
- var weight = options.weight;
319
- var width = options.width;
320
- if (weight != null) {
321
- if (width != null) {
322
- width = undefined;
323
- }
324
- }
325
- else if (width == null) {
326
- weight = 1;
327
- }
328
- var type = toEnum((_a = options.type) !== null && _a !== void 0 ? _a : DTableColumnType.TEXT, DTableColumnType);
329
- var align = toColumnAlign(options, type);
330
- var label = options.label || "";
331
- var path = toColumnPath(options);
332
- var getter = toColumnGetter(options, type, path);
333
- var setter = toColumnSetter(options, type, path);
334
- return {
335
- weight: weight,
336
- width: width,
337
- type: type,
338
- label: label,
339
- getter: getter,
340
- setter: setter,
341
- formatter: options.formatter,
342
- renderable: toColumnRenderable(options, path),
343
- align: align,
344
- state: toColumnState(options),
345
- editing: toColumnEditing(options, path),
346
- sorting: toColumnSorting(getter, index, options),
347
- header: options.header,
348
- body: options.body,
349
- selecting: toColumnSelecting(options.selecting),
350
- category: options.category,
351
- frozen: options.frozen,
352
- offset: 0.0,
353
- link: options.link,
354
- update: toEnum((_b = options.update) !== null && _b !== void 0 ? _b : DTableColumnUpdate.CELL, DTableColumnUpdate)
355
- };
356
- };
357
- var toColumns = function (options) {
358
- var result = [];
359
- for (var i = 0, imax = options.length; i < imax; ++i) {
360
- result.push(toColumn(i, options[i]));
361
- }
362
- return result;
363
- };
364
- var toFrozen = function (columns) {
365
- for (var i = columns.length - 1; 0 <= i; --i) {
366
- if (columns[i].frozen === true) {
367
- return i + 1;
368
- }
369
- }
370
- return 0;
371
- };
17
+ import { DTableColumnContainerImpl } from "./d-table-column-container-impl";
18
+ import { DTableCategoryContainerImpl } from "./d-table-category-container-impl";
372
19
  var DTable = /** @class */ (function (_super) {
373
20
  __extends(DTable, _super);
374
21
  function DTable(options) {
375
22
  var _this = _super.call(this, options) || this;
376
23
  var content = _this.content;
377
- content.setWidth(_this.toContentWidth(options));
378
24
  var body = _this.body;
379
25
  content.addChild(body);
380
26
  if (body.data.selection.type !== DTableDataSelectionType.NONE) {
@@ -393,39 +39,47 @@ var DTable = /** @class */ (function (_super) {
393
39
  body.update();
394
40
  return _this;
395
41
  }
42
+ Object.defineProperty(DTable.prototype, "column", {
43
+ get: function () {
44
+ var _a;
45
+ return ((_a = this._column) !== null && _a !== void 0 ? _a : (this._column = this.newColumn()));
46
+ },
47
+ enumerable: false,
48
+ configurable: true
49
+ });
50
+ DTable.prototype.newColumn = function () {
51
+ var _a;
52
+ return new DTableColumnContainerImpl(this, (_a = this._options) === null || _a === void 0 ? void 0 : _a.columns);
53
+ };
396
54
  Object.defineProperty(DTable.prototype, "columns", {
397
55
  get: function () {
398
- var result = this._columns;
399
- if (result == null) {
400
- var options = this._options;
401
- result = options ? toColumns(options.columns) : [];
402
- this._columns = result;
403
- }
404
- return result;
56
+ return this.column.items;
405
57
  },
406
58
  enumerable: false,
407
59
  configurable: true
408
60
  });
409
61
  Object.defineProperty(DTable.prototype, "frozen", {
410
62
  get: function () {
411
- var result = this._frozen;
412
- if (result == null) {
413
- result = toFrozen(this.columns);
414
- this._frozen = result;
415
- }
416
- return result;
63
+ return this.column.frozen;
417
64
  },
418
65
  enumerable: false,
419
66
  configurable: true
420
67
  });
68
+ Object.defineProperty(DTable.prototype, "category", {
69
+ get: function () {
70
+ return (this._category = this.newCategory());
71
+ },
72
+ enumerable: false,
73
+ configurable: true
74
+ });
75
+ DTable.prototype.newCategory = function () {
76
+ var _a;
77
+ var column = this.column;
78
+ return new DTableCategoryContainerImpl(column.items, column.frozen, (_a = this._options) === null || _a === void 0 ? void 0 : _a.category);
79
+ };
421
80
  Object.defineProperty(DTable.prototype, "categories", {
422
81
  get: function () {
423
- var result = this._categories;
424
- if (result == null) {
425
- result = this.newCategories(this._options, this.columns, this.frozen);
426
- this._categories = result;
427
- }
428
- return result;
82
+ return this.category.items;
429
83
  },
430
84
  enumerable: false,
431
85
  configurable: true
@@ -448,191 +102,6 @@ var DTable = /** @class */ (function (_super) {
448
102
  body.unlock(true);
449
103
  scrollbar.unlock(true);
450
104
  };
451
- DTable.prototype.getCategoryCount = function (columns) {
452
- var result = 0;
453
- for (var i = 0, imax = columns.length; i < imax; ++i) {
454
- var category = columns[i].category;
455
- if (category != null) {
456
- var count = isString(category) ? 1 : category.length;
457
- result = Math.max(result, count);
458
- }
459
- }
460
- return result;
461
- };
462
- DTable.prototype.toCategoryLabel = function (index, category) {
463
- if (category) {
464
- if (isString(category)) {
465
- if (index === 0) {
466
- return category;
467
- }
468
- }
469
- else {
470
- if (index < category.length) {
471
- return category[index];
472
- }
473
- }
474
- }
475
- return undefined;
476
- };
477
- DTable.prototype.isSameCategory = function (index, a, b) {
478
- if (a != null) {
479
- if (b != null) {
480
- if (isString(a)) {
481
- if (isString(b)) {
482
- if (0 < index) {
483
- return true;
484
- }
485
- else {
486
- return a === b;
487
- }
488
- }
489
- else {
490
- if (0 < index) {
491
- return b.length <= index;
492
- }
493
- else {
494
- return b.length === 1 && a === b[0];
495
- }
496
- }
497
- }
498
- else {
499
- if (isString(b)) {
500
- if (0 < index) {
501
- return a.length <= index;
502
- }
503
- else {
504
- return a.length === 1 && a[0] === b;
505
- }
506
- }
507
- else {
508
- if (a.length <= index && b.length <= index) {
509
- return true;
510
- }
511
- else if (b.length === a.length) {
512
- for (var i = index, imax = a.length; i < imax; ++i) {
513
- if (a[i] !== b[i]) {
514
- return false;
515
- }
516
- }
517
- return true;
518
- }
519
- return false;
520
- }
521
- }
522
- }
523
- else {
524
- if (isString(a)) {
525
- if (0 < index) {
526
- return true;
527
- }
528
- else {
529
- return false;
530
- }
531
- }
532
- else {
533
- if (a.length <= index) {
534
- return true;
535
- }
536
- else {
537
- return false;
538
- }
539
- }
540
- }
541
- }
542
- else {
543
- if (b != null) {
544
- if (isString(b)) {
545
- if (0 < index) {
546
- return true;
547
- }
548
- else {
549
- return false;
550
- }
551
- }
552
- else {
553
- if (b.length <= index) {
554
- return true;
555
- }
556
- else {
557
- return false;
558
- }
559
- }
560
- }
561
- else {
562
- return true;
563
- }
564
- }
565
- };
566
- DTable.prototype.toCategoryColumns = function (index, columns, frozen) {
567
- var result = [];
568
- var tcolumn = null;
569
- var ccolumn = null;
570
- for (var i = 0, imax = columns.length; i < imax; ++i) {
571
- var column = columns[i];
572
- if (i !== frozen &&
573
- ccolumn &&
574
- tcolumn &&
575
- this.isSameCategory(index, tcolumn.category, column.category)) {
576
- if (ccolumn.weight != null && column.weight != null) {
577
- ccolumn.weight += column.weight;
578
- }
579
- else if (ccolumn.width != null && column.width != null) {
580
- ccolumn.width += column.width;
581
- }
582
- else {
583
- tcolumn = column;
584
- ccolumn = {
585
- label: this.toCategoryLabel(index, column.category),
586
- weight: column.weight,
587
- width: column.width,
588
- offset: 0.0
589
- };
590
- result.push(ccolumn);
591
- }
592
- }
593
- else {
594
- tcolumn = column;
595
- ccolumn = {
596
- label: this.toCategoryLabel(index, column.category),
597
- weight: column.weight,
598
- width: column.width,
599
- offset: 0.0
600
- };
601
- result.push(ccolumn);
602
- }
603
- }
604
- return result;
605
- };
606
- DTable.prototype.toCategoryOptions = function (index, options, columns, frozen, offset) {
607
- if (options) {
608
- if (options.columns === undefined) {
609
- options.columns = this.toCategoryColumns(index, columns, frozen);
610
- }
611
- if (options.frozen == null) {
612
- options.frozen = frozen;
613
- }
614
- if (options.offset == null) {
615
- options.offset = offset;
616
- }
617
- return options;
618
- }
619
- return {
620
- columns: this.toCategoryColumns(index, columns, frozen),
621
- frozen: frozen,
622
- offset: offset
623
- };
624
- };
625
- DTable.prototype.newCategories = function (options, columns, frozen) {
626
- var count = this.getCategoryCount(columns);
627
- var result = [];
628
- var offset = 0;
629
- for (var i = count - 1; 0 <= i; --i) {
630
- var category = new DTableCategory(this.toCategoryOptions(i, options === null || options === void 0 ? void 0 : options.category, columns, frozen, offset));
631
- result.push(category);
632
- offset += category.height;
633
- }
634
- return result;
635
- };
636
105
  DTable.prototype.onDblClick = function (e, interactionManager) {
637
106
  var result = this.body.onDblClick(e, interactionManager);
638
107
  return _super.prototype.onDblClick.call(this, e, interactionManager) || result;
@@ -643,24 +112,35 @@ var DTable = /** @class */ (function (_super) {
643
112
  _this.onScrollBarUpdate(isRegionVisible);
644
113
  });
645
114
  };
646
- DTable.prototype.toContentWidth = function (options) {
647
- var columnWidthTotal = 0;
648
- var columns = options === null || options === void 0 ? void 0 : options.columns;
649
- if (columns) {
650
- for (var i = 0, imax = columns.length; i < imax; ++i) {
651
- var column = columns[i];
652
- var columnWidth = column.width;
653
- if (columnWidth != null) {
654
- columnWidthTotal += columnWidth;
115
+ DTable.prototype.newContent = function (options) {
116
+ var _this = this;
117
+ var result = _super.prototype.newContent.call(this, options);
118
+ // X & Width
119
+ var column = this.column;
120
+ var columnWidth = column.width;
121
+ if (0 < columnWidth) {
122
+ column.on("resize", function () {
123
+ columnWidth = column.width;
124
+ var parentWidth = _this.width;
125
+ var parentHeight = _this.height;
126
+ var newWidth = Math.max(parentWidth, columnWidth);
127
+ var newXMin = parentWidth - newWidth;
128
+ // The X position must be in [newXMin, 0].
129
+ if (result.x < newXMin) {
130
+ result.x = newXMin;
655
131
  }
656
- }
132
+ // Force the with reevaluated
133
+ result.onParentResize(parentWidth, parentHeight, _this.padding);
134
+ });
135
+ result.setWidth(function (p) {
136
+ return Math.max(p, columnWidth);
137
+ });
657
138
  }
658
- if (0 < columnWidthTotal) {
659
- return function (p) {
660
- return Math.max(p, columnWidthTotal);
661
- };
139
+ else {
140
+ result.setWidth("100%");
662
141
  }
663
- return "100%";
142
+ // Done
143
+ return result;
664
144
  };
665
145
  DTable.prototype.getHeaderOffset = function () {
666
146
  var result = this._headerOffset;
@@ -682,7 +162,7 @@ var DTable = /** @class */ (function (_super) {
682
162
  get: function () {
683
163
  var result = this._header;
684
164
  if (result === undefined) {
685
- result = this.newHeader(this._options, this.columns, this.frozen, this.getHeaderOffset());
165
+ result = this.newHeader();
686
166
  this._header = result;
687
167
  }
688
168
  return result;
@@ -701,42 +181,17 @@ var DTable = /** @class */ (function (_super) {
701
181
  }
702
182
  return false;
703
183
  };
704
- DTable.prototype.newHeader = function (options, columns, frozen, offset) {
184
+ DTable.prototype.newHeader = function () {
185
+ var options = this._options;
705
186
  if (this.hasHeader(options)) {
706
- return new DTableHeader(this.toHeaderOptions(options === null || options === void 0 ? void 0 : options.header, columns, frozen, offset));
187
+ var column = this.column;
188
+ return new DTableHeader(this, column.items, column.frozen, this.getHeaderOffset(), options === null || options === void 0 ? void 0 : options.header);
707
189
  }
708
190
  return null;
709
191
  };
710
- DTable.prototype.toHeaderOptions = function (options, columns, frozen, offset) {
711
- if (options) {
712
- if (options.columns === undefined) {
713
- options.columns = columns;
714
- }
715
- if (options.frozen == null) {
716
- options.frozen = frozen;
717
- }
718
- if (options.offset === undefined) {
719
- options.offset = offset;
720
- }
721
- if (options.table === undefined) {
722
- options.table = this;
723
- }
724
- return options;
725
- }
726
- return {
727
- columns: columns,
728
- frozen: frozen,
729
- offset: offset,
730
- table: this
731
- };
732
- };
733
192
  DTable.prototype.getBodyOffset = function () {
734
- var result = this._bodyOffset;
735
- if (result == null) {
736
- result = this.newBodyOffset();
737
- this._bodyOffset = result;
738
- }
739
- return result;
193
+ var _a;
194
+ return ((_a = this._bodyOffset) !== null && _a !== void 0 ? _a : (this._bodyOffset = this.newBodyOffset()));
740
195
  };
741
196
  DTable.prototype.newBodyOffset = function () {
742
197
  var _a, _b;
@@ -744,30 +199,19 @@ var DTable = /** @class */ (function (_super) {
744
199
  };
745
200
  Object.defineProperty(DTable.prototype, "body", {
746
201
  get: function () {
747
- var result = this._body;
748
- if (result == null) {
749
- result = this.newBody(this._options, this.columns, this.frozen, this.getBodyOffset());
750
- this._body = result;
751
- }
752
- return result;
202
+ var _a;
203
+ return ((_a = this._body) !== null && _a !== void 0 ? _a : (this._body = this.newBody()));
753
204
  },
754
205
  enumerable: false,
755
206
  configurable: true
756
207
  });
757
- DTable.prototype.newBody = function (options, columns, frozen, offset) {
758
- return new DTableBody(this.toBodyOptions(options === null || options === void 0 ? void 0 : options.body, columns, frozen, offset, options === null || options === void 0 ? void 0 : options.data));
208
+ DTable.prototype.newBody = function () {
209
+ var options = this._options;
210
+ var column = this.column;
211
+ return new DTableBody(column.items, column.frozen, this.getBodyOffset(), this.toBodyOptions(options === null || options === void 0 ? void 0 : options.body, options === null || options === void 0 ? void 0 : options.data));
759
212
  };
760
- DTable.prototype.toBodyOptions = function (options, columns, frozen, offset, data) {
213
+ DTable.prototype.toBodyOptions = function (options, data) {
761
214
  if (options != null) {
762
- if (options.columns === undefined) {
763
- options.columns = columns;
764
- }
765
- if (options.frozen == null) {
766
- options.frozen = frozen;
767
- }
768
- if (options.offset === undefined) {
769
- options.offset = offset;
770
- }
771
215
  if (options.data === undefined && data !== undefined) {
772
216
  if (isArray(data)) {
773
217
  options.data = {
@@ -785,9 +229,6 @@ var DTable = /** @class */ (function (_super) {
785
229
  }
786
230
  if (isArray(data)) {
787
231
  return {
788
- columns: columns,
789
- frozen: frozen,
790
- offset: offset,
791
232
  data: {
792
233
  rows: data
793
234
  },
@@ -796,9 +237,6 @@ var DTable = /** @class */ (function (_super) {
796
237
  }
797
238
  else {
798
239
  return {
799
- columns: columns,
800
- frozen: frozen,
801
- offset: offset,
802
240
  data: data,
803
241
  weight: 1
804
242
  };