@wcardinal/wcardinal-ui 0.371.0 → 0.372.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.
@@ -86,9 +86,29 @@ export declare class DTableBody<ROW, DATA extends DTableData<ROW> = DTableDataLi
86
86
  * @returns true if succeeded
87
87
  */
88
88
  scrollTo(target: ROW | number): boolean;
89
- protected toRowIndexMapped(local: Point): number;
90
- protected toRow(rowIndexMapped: number): DTableBodyRow<ROW> | null;
91
- protected toCell(row: DTableBodyRow<ROW>, local: Point): DTableBodyCell<ROW, unknown> | null;
89
+ /**
90
+ * Returns a mapped row index at the given local Y position or -1.
91
+ *
92
+ * @param localY a local Y position
93
+ * @returns a mapped row index at the given local Y position or -1.
94
+ */
95
+ toRowIndexMapped(localY: number): number;
96
+ /**
97
+ * Returns a row at the given mapped row index or null if not exits.
98
+ *
99
+ * @param rowIndexMapped a mapped row index
100
+ * @returns a row at the given mapped row index or null if not exists.
101
+ */
102
+ toRow(rowIndexMapped: number): DTableBodyRow<ROW> | null;
103
+ /**
104
+ * Returns a cell at the given local X position or null if not exits.
105
+ * This method assumes the given local X position is on the given row.
106
+ *
107
+ * @param row a row
108
+ * @param localX a local X position
109
+ * @returns a cell at the given local X position or null if not exits
110
+ */
111
+ toCell(row: DTableBodyRow<ROW>, localX: number): DTableBodyCell<ROW, unknown> | null;
92
112
  onRowClick(e: InteractionEvent): void;
93
113
  protected onRowSelect(e: InteractionEvent, rowIndexMapped: number): void;
94
114
  onDblClick(e: MouseEvent | TouchEvent, interactionManager: interaction.InteractionManager): boolean;
@@ -333,12 +333,27 @@ var DTableBody = /** @class */ (function (_super) {
333
333
  DApplications.update(this);
334
334
  return true;
335
335
  };
336
- DTableBody.prototype.toRowIndexMapped = function (local) {
337
- if (0 <= this.parent.position.y + local.y) {
338
- return Math.floor(local.y / this._rowHeight);
336
+ /**
337
+ * Returns a mapped row index at the given local Y position or -1.
338
+ *
339
+ * @param localY a local Y position
340
+ * @returns a mapped row index at the given local Y position or -1.
341
+ */
342
+ DTableBody.prototype.toRowIndexMapped = function (localY) {
343
+ if (0 <= this.parent.position.y + localY) {
344
+ var result = Math.floor(localY / this._rowHeight);
345
+ if (0 <= result && result < this._data.mapped.size()) {
346
+ return result;
347
+ }
339
348
  }
340
349
  return -1;
341
350
  };
351
+ /**
352
+ * Returns a row at the given mapped row index or null if not exits.
353
+ *
354
+ * @param rowIndexMapped a mapped row index
355
+ * @returns a row at the given mapped row index or null if not exists.
356
+ */
342
357
  DTableBody.prototype.toRow = function (rowIndexMapped) {
343
358
  var index = rowIndexMapped - this._rowIndexMappedStart;
344
359
  var rows = this.children;
@@ -347,14 +362,22 @@ var DTableBody = /** @class */ (function (_super) {
347
362
  }
348
363
  return null;
349
364
  };
350
- DTableBody.prototype.toCell = function (row, local) {
365
+ /**
366
+ * Returns a cell at the given local X position or null if not exits.
367
+ * This method assumes the given local X position is on the given row.
368
+ *
369
+ * @param row a row
370
+ * @param localX a local X position
371
+ * @returns a cell at the given local X position or null if not exits
372
+ */
373
+ DTableBody.prototype.toCell = function (row, localX) {
351
374
  var cells = row.children;
352
375
  var cellsLength = cells.length;
353
376
  var columns = this._columns;
354
377
  var columnsLength = columns.length;
355
378
  for (var i = 0, imax = Math.min(cellsLength, columnsLength); i < imax; ++i) {
356
379
  var cell = cells[cellsLength - i - 1];
357
- var x = local.x - cell.position.x;
380
+ var x = localX - cell.position.x;
358
381
  if (0 <= x && x <= cell.width) {
359
382
  return cell;
360
383
  }
@@ -366,12 +389,12 @@ var DTableBody = /** @class */ (function (_super) {
366
389
  var local = DTableBody.WORK_ON_CLICK;
367
390
  local.copyFrom(e.data.global);
368
391
  this.toLocal(local, undefined, local, false);
369
- var rowIndexMapped = this.toRowIndexMapped(local);
370
- if (0 <= rowIndexMapped && rowIndexMapped < this._data.mapped.size()) {
392
+ var rowIndexMapped = this.toRowIndexMapped(local.y);
393
+ if (0 <= rowIndexMapped) {
371
394
  // Delegate to the cell at first
372
395
  var row = this.toRow(rowIndexMapped);
373
396
  if (row) {
374
- var cell = this.toCell(row, local);
397
+ var cell = this.toCell(row, local.x);
375
398
  if (cell && cell.onRowSelect && cell.onRowSelect(e, local)) {
376
399
  return;
377
400
  }
@@ -1 +1 @@
1
- {"version":3,"file":"d-table-body.js","sourceRoot":"","sources":["../../../src/main/typescript/wcardinal/ui/d-table-body.ts"],"names":[],"mappings":"AAAA;;;GAGG;;AAEH,OAAO,EAAe,KAAK,EAAa,MAAM,SAAS,CAAC;AAExD,OAAO,EAAE,KAAK,EAAyC,MAAM,UAAU,CAAC;AACxE,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,aAAa,EAA+C,MAAM,oBAAoB,CAAC;AAGhG,OAAO,EAAE,cAAc,EAAyB,MAAM,qBAAqB,CAAC;AAC5E,OAAO,EAAuB,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;AAExF,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAG9C,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAgD7D,IAAM,YAAY,GAAG,UACpB,KAAsB,EACtB,OAAqC,EACrC,aAAsC;IAEtC,IAAM,OAAO,GAAG,OAAO,CAAC,OAAO,IAAI,EAAE,CAAC;IACtC,IAAI,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC;IACzB,IAAI,MAAM,IAAI,IAAI,EAAE;QACnB,IAAI,MAAM,CAAC,MAAM,IAAI,IAAI,EAAE;YAC1B,MAAM,CAAC,MAAM,GAAG,KAAK,CAAC,YAAY,EAAE,CAAC;SACrC;QACD,IAAI,MAAM,CAAC,OAAO,KAAK,SAAS,EAAE;YACjC,MAAM,CAAC,OAAO,GAAG,OAAO,CAAC;SACzB;QACD,IAAI,MAAM,CAA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C,CAAC,CAAC;oCACzC,IAAI,MAAM,IAAI,aAAa,IAAI,aAAa,GAAG,IAAI,EAAE;wCACpD,UAAU,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;qCAC/B;iCACD;6BACD;yBACD;6BAAM;4BACN,IAAI,aAAa,EAAE;gCAClB,KAAK,IAAI,CAAC,GAAG,MAAM,EAAE,CAAC,GAAG,IAAI,EAAE,EAAE,CAAC,EAAE;oCACnC,UAAU,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC;iCAClC;6BACD;iCAAM;gCACN,KAAK,IAAI,CAAC,GAAG,MAAM,EAAE,CAAC,GAAG,IAAI,EAAE,EAAE,CAAC,EAAE;oCACnC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;iCACnB;6BACD;yBACD;wBACD,SAAS,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;qBAC7B;iBACD;aACD;SACD;IACF,CAAC;IAED,+BAAU,GAAV,UACC,CAA0B,EAC1B,kBAAkD;QAElD,OAAO,iBAAM,UAAU,YAAC,CAAC,EAAE,kBAAkB,CAAC,CAAC;IAChD,CAAC;IAES,4BAAO,GAAjB;QACC,OAAO,YAAY,CAAC;IACrB,CAAC;IAED,sBAAI,4BAAI;aAAR;YACC,OAAO,IAAI,CAAC,KAAK,CAAC;QACnB,CAAC;;;OAAA;IAregB,wBAAa,GAAG,IAAI,KAAK,EAAE,CAAC;IAse9C,iBAAC;CAAA,AA5eD,CAKU,KAAK,GAued;SA5eY,UAAU","sourcesContent":["/*\n * Copyright (C) 2019 Toshiba Corporation\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { interaction, Point, Rectangle } from \"pixi.js\";\nimport InteractionEvent = interaction.InteractionEvent;\nimport { DBase, DBaseEvents, DBaseOptions, DThemeBase } from \"./d-base\";\nimport { DBaseState } from \"./d-base-state\";\nimport { DTableBodyRow, DTableBodyRowOnChange, DTableBodyRowOptions } from \"./d-table-body-row\";\nimport { DTableColumn } from \"./d-table-column\";\nimport { DTableData, DTableDataOptions, DTableDataSupplimental } from \"./d-table-data\";\nimport { DTableDataList, DTableDataListOptions } from \"./d-table-data-list\";\nimport { DTableDataSelection, DTableDataSelectionType } from \"./d-table-data-selection\";\nimport { DTableBodyCell } from \"./d-table-body-cell\";\nimport { DTableState } from \"./d-table-state\";\nimport { DTableBodyCellOptions } from \"./d-table-body-cell-options\";\nimport { DOnOptions } from \"./d-on-options\";\nimport { DApplications } from \"./d-applications\";\nimport { isNumber } from \"./util/is-number\";\nimport { DTableColumnUpdate } from \"./d-table-column-update\";\n\n/**\n * {@link DTableBody} events.\n */\nexport interface DTableBodyEvents<EMITTER> extends DBaseEvents<EMITTER> {\n\t/**\n\t * Triggered when rows are updated.\n\t * The first and second parameters are an mapped index range of visible data.\n\t * Please note that these parameters are real numbers.\n\t * For instance, An index range of [0.5, 2.5] means:\n\t *\n\t * * The row at index 0 is partially visible.\n\t * * The row at index 1 is fully visible.\n\t * * The row at index 2 is partially visible.\n\t *\n\t * @param from a lowest mapped index of visible data\n\t * @param to a highest mapped index of vislble data\n\t * @param emitter an emitter\n\t */\n\tupdate(from: number, to: number, emitter: EMITTER): void;\n}\n\n/**\n * {@link DTableBody} \"on\" options.\n */\nexport interface DTableBodyOnOptions<EMITTER>\n\textends Partial<DTableBodyEvents<EMITTER>>,\n\t\tDOnOptions {}\n\nexport interface DTableBodyOptions<\n\tROW,\n\tDATA extends DTableData<ROW> = DTableDataList<ROW>,\n\tTHEME extends DThemeTableBody = DThemeTableBody,\n\tEMITTER = any\n> extends DBaseOptions<THEME, EMITTER> {\n\tcolumns?: Array<DTableColumn<ROW, unknown>>;\n\trow?: DTableBodyRowOptions<ROW>;\n\tdata?: DTableDataListOptions<ROW> | DATA;\n\toffset?: number;\n\tfrozen?: number;\n\ton?: DTableBodyOnOptions<EMITTER>;\n}\n\nexport interface DThemeTableBody extends DThemeBase {\n\tgetRowHeight(): number;\n}\n\nconst toRowOptions = <ROW, DATA extends DTableData<ROW>>(\n\ttheme: DThemeTableBody,\n\toptions: DTableBodyOptions<ROW, DATA>,\n\tselectionType: DTableDataSelectionType\n): DTableBodyRowOptions<ROW> => {\n\tconst columns = options.columns || [];\n\tlet result = options.row;\n\tif (result != null) {\n\t\tif (result.height == null) {\n\t\t\tresult.height = theme.getRowHeight();\n\t\t}\n\t\tif (result.columns === undefined) {\n\t\t\tresult.columns = columns;\n\t\t}\n\t\tif (result.frozen == null) {\n\t\t\tresult.frozen = options.frozen;\n\t\t}\n\t\tif (result.selection === undefined) {\n\t\t\tresult.selection = {\n\t\t\t\ttype: selectionType\n\t\t\t};\n\t\t} else if (result.selection.type === undefined) {\n\t\t\tresult.selection.type = selectionType;\n\t\t}\n\t} else {\n\t\tresult = {\n\t\t\tcolumns,\n\t\t\theight: theme.getRowHeight(),\n\t\t\tfrozen: options.frozen,\n\t\t\tselection: {\n\t\t\t\ttype: selectionType\n\t\t\t}\n\t\t};\n\t}\n\treturn result as DTableBodyRowOptions<ROW>;\n};\n\nexport class DTableBody<\n\tROW,\n\tDATA extends DTableData<ROW> = DTableDataList<ROW>,\n\tTHEME extends DThemeTableBody = DThemeTableBody,\n\tOPTIONS extends DTableBodyOptions<ROW, DATA, THEME> = DTableBodyOptions<ROW, DATA, THEME>\n> extends DBase<THEME, OPTIONS> {\n\tprotected static WORK_ON_CLICK = new Point();\n\n\tprotected _columns: Array<DTableColumn<ROW, unknown>>;\n\tprotected _rowHeight: number;\n\tprotected _rowIndexMappedStart: number;\n\tprotected _rowIndexMappedEnd: number;\n\tprotected _rowOptions: DTableBodyRowOptions<ROW>;\n\tprotected _updateRowsCount: number;\n\tprotected _isUpdateRowsCalled: boolean;\n\tprotected _isUpdateRowsCalledForcibly: boolean;\n\tprotected _workRows: Array<DTableBodyRow<ROW>>;\n\tprotected _onRowChangeBound: DTableBodyRowOnChange<ROW, unknown>;\n\tprotected _columnIndexToCellOptions: Map<number, DTableBodyCellOptions<ROW>>;\n\tprotected _data: DATA;\n\n\tconstructor(options: OPTIONS) {\n\t\tsuper(options);\n\n\t\tthis.transform.position.y = options.offset ?? 0;\n\t\tconst data = this.toData(options.data);\n\t\tthis._data = data;\n\t\tdata.bind(this);\n\t\tconst theme = this.theme;\n\t\tconst rowOptions = toRowOptions(theme, options, data.selection.type);\n\t\tthis._rowOptions = rowOptions;\n\t\tthis._rowHeight = rowOptions.height != null ? rowOptions.height : theme.getRowHeight();\n\t\tthis._columns = rowOptions.columns || [];\n\t\tthis._rowIndexMappedStart = 0;\n\t\tthis._rowIndexMappedEnd = 0;\n\t\tthis._updateRowsCount = 0;\n\t\tthis._isUpdateRowsCalled = false;\n\t\tthis._isUpdateRowsCalledForcibly = false;\n\t\tthis._workRows = [];\n\t\tthis._onRowChangeBound = (newValue, oldValue, row, rowIndex, columnIndex, column): void => {\n\t\t\tthis.onRowChange(newValue, oldValue, row, rowIndex, columnIndex, column);\n\t\t};\n\t\tthis._columnIndexToCellOptions = new Map<number, DTableBodyCellOptions<ROW>>();\n\t\tthis._data.emit(\"init\", this._data);\n\t}\n\n\tprotected onRowChange(\n\t\tnewValue: unknown,\n\t\toldValue: unknown,\n\t\trow: ROW,\n\t\trowIndex: number,\n\t\tcolumnIndex: number,\n\t\tcolumn: DTableColumn<ROW, unknown>\n\t): void {\n\t\tconst data = this._data;\n\t\tdata.emit(\"change\", newValue, oldValue, row, rowIndex, columnIndex, data);\n\t\tif (column.update === DTableColumnUpdate.ALL) {\n\t\t\tthis.update(true);\n\t\t}\n\t}\n\n\tprotected toData(options?: DATA | DTableDataListOptions<ROW>): DATA {\n\t\tif (this.isData(options)) {\n\t\t\treturn options;\n\t\t}\n\t\treturn new DTableDataList<ROW>(options) as any;\n\t}\n\n\tprotected isData(\n\t\ttarget?: ROW[] | DTableDataOptions<ROW> | DTableData<ROW>\n\t): target is DTableData<ROW> {\n\t\treturn target != null && \"mapped\" in target;\n\t}\n\n\tonResize(newWidth: number, newHeight: number, oldWidth: number, oldHeight: number): void {\n\t\tsuper.onResize(newWidth, newHeight, oldWidth, oldHeight);\n\t\tthis.update();\n\t}\n\n\tget selection(): DTableDataSelection<ROW> {\n\t\treturn this._data.selection;\n\t}\n\n\tlock(): void {\n\t\tthis._updateRowsCount += 1;\n\t\tif (this._updateRowsCount === 1) {\n\t\t\tthis._isUpdateRowsCalled = false;\n\t\t\tthis._isUpdateRowsCalledForcibly = false;\n\t\t}\n\t}\n\n\tunlock(callIfNeeded: boolean): void {\n\t\tthis._updateRowsCount -= 1;\n\t\tif (this._updateRowsCount === 0) {\n\t\t\tif (callIfNeeded && this._isUpdateRowsCalled) {\n\t\t\t\tthis.update(this._isUpdateRowsCalledForcibly);\n\t\t\t}\n\t\t\tthis._isUpdateRowsCalled = false;\n\t\t\tthis._isUpdateRowsCalledForcibly = false;\n\t\t}\n\t}\n\n\t/**\n\t * Updates rows. If the `forcibly` is true, some dirty checkings for\n\t * avoiding unnecessary state changes are skipped.\n\t *\n\t * @param forcibly true to update forcibly\n\t */\n\tupdate(forcibly?: boolean): void {\n\t\tif (0 < this._updateRowsCount) {\n\t\t\tthis._isUpdateRowsCalled = true;\n\t\t\tif (forcibly) {\n\t\t\t\tthis._isUpdateRowsCalledForcibly = true;\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\n\t\tconst content = this.parent;\n\t\tif (content == null) {\n\t\t\treturn;\n\t\t}\n\t\tconst contentParent = content.parent;\n\t\tif (contentParent == null) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst rows = this.children as Array<DTableBodyRow<ROW>>;\n\t\tconst height = contentParent.height;\n\t\tconst rowHeight = this._rowHeight;\n\n\t\tconst data = this._data;\n\t\tconst dataMappedSize = data.mapped.size();\n\n\t\tconst oldRowIndexMappedStart = this._rowIndexMappedStart;\n\t\tlet oldRowIndexMappedEnd = this._rowIndexMappedEnd;\n\t\tlet oldRowCount = oldRowIndexMappedEnd - oldRowIndexMappedStart;\n\n\t\tconst y = this.transform.position.y;\n\t\tconst newHeight = y + dataMappedSize * rowHeight;\n\t\tconst newContentHeight = Math.max(height, newHeight);\n\t\tconst newContentY = Math.max(height - newContentHeight, content.position.y);\n\n\t\tconst newRowIndexMappedLowerBound = -newContentY / rowHeight;\n\t\tconst newRowIndexMappedUpperBound = (height - (newContentY + y)) / rowHeight;\n\t\tlet newRowIndexMappedStart = Math.floor(newRowIndexMappedLowerBound);\n\t\tnewRowIndexMappedStart -= newRowIndexMappedStart % 2 === 0 ? 2 : 1;\n\t\tlet newRowIndexMappedEnd = Math.floor(newRowIndexMappedUpperBound);\n\t\tnewRowIndexMappedEnd += (newRowIndexMappedEnd - newRowIndexMappedStart) % 2 === 1 ? 3 : 2;\n\t\tlet newRowCount = newRowIndexMappedEnd - newRowIndexMappedStart;\n\t\tif (newRowCount < oldRowCount && oldRowCount - 2 <= newRowCount) {\n\t\t\tnewRowCount = oldRowCount;\n\t\t\tnewRowIndexMappedEnd = newRowIndexMappedStart + newRowCount;\n\t\t}\n\n\t\tif (oldRowCount < newRowCount) {\n\t\t\tfor (let i = oldRowCount; i < newRowCount; ++i) {\n\t\t\t\tconst oldRowIndexMapped = oldRowIndexMappedStart + i;\n\t\t\t\tconst newRow = this.newRow(oldRowIndexMapped % 2 === 0);\n\t\t\t\tthis.addChild(newRow);\n\t\t\t}\n\t\t\toldRowCount = newRowCount;\n\t\t\toldRowIndexMappedEnd = oldRowIndexMappedStart + oldRowCount;\n\t\t} else if (newRowCount < oldRowCount) {\n\t\t\tfor (let i = oldRowCount - 1; newRowCount <= i; --i) {\n\t\t\t\tthis.removeChild(rows[i]);\n\t\t\t}\n\t\t\toldRowCount = newRowCount;\n\t\t\toldRowIndexMappedEnd = oldRowIndexMappedStart + oldRowCount;\n\t\t}\n\n\t\tthis._rowIndexMappedStart = newRowIndexMappedStart;\n\t\tthis._rowIndexMappedEnd = newRowIndexMappedEnd;\n\n\t\tconst rowIndexMappedStartDelta = newRowIndexMappedStart - oldRowIndexMappedStart;\n\t\tconst rowIndexMappedStartDeltaAbs = Math.abs(rowIndexMappedStartDelta);\n\t\tconst rowsLength = rows.length;\n\t\tif (0 < rowIndexMappedStartDeltaAbs && rowIndexMappedStartDeltaAbs < rowsLength) {\n\t\t\tconst work = this._workRows;\n\t\t\tif (0 < rowIndexMappedStartDelta) {\n\t\t\t\tfor (let i = 0; i < rowIndexMappedStartDeltaAbs; ++i) {\n\t\t\t\t\twork.push(this.resetRow(rows[i]));\n\t\t\t\t}\n\t\t\t\tfor (let i = rowIndexMappedStartDeltaAbs; i < rowsLength; ++i) {\n\t\t\t\t\trows[i - rowIndexMappedStartDeltaAbs] = rows[i];\n\t\t\t\t}\n\t\t\t\tfor (let i = 0; i < rowIndexMappedStartDeltaAbs; ++i) {\n\t\t\t\t\trows[rowsLength - rowIndexMappedStartDeltaAbs + i] = work[i];\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tfor (let i = 0; i < rowIndexMappedStartDeltaAbs; ++i) {\n\t\t\t\t\twork.push(this.resetRow(rows[rowsLength - rowIndexMappedStartDeltaAbs + i]));\n\t\t\t\t}\n\t\t\t\tfor (let i = rowsLength - rowIndexMappedStartDeltaAbs - 1; 0 <= i; --i) {\n\t\t\t\t\trows[i + rowIndexMappedStartDeltaAbs] = rows[i];\n\t\t\t\t}\n\t\t\t\tfor (let i = 0; i < rowIndexMappedStartDeltaAbs; ++i) {\n\t\t\t\t\trows[i] = work[i];\n\t\t\t\t}\n\t\t\t}\n\t\t\twork.length = 0;\n\t\t}\n\n\t\tconst selection = data.selection;\n\t\tconst isRowSelectable = selection.type !== DTableDataSelectionType.NONE;\n\t\tdata.mapped.each(\n\t\t\t(\n\t\t\t\tdatum: ROW,\n\t\t\t\tsupplimental: DTableDataSupplimental | null,\n\t\t\t\tindex: number,\n\t\t\t\tunmappedIndex: number\n\t\t\t): void | boolean => {\n\t\t\t\tconst row = rows[index - newRowIndexMappedStart];\n\n\t\t\t\t// Position\n\t\t\t\trow.position.y = index * rowHeight;\n\n\t\t\t\t// State\n\t\t\t\tconst rowState = row.state;\n\t\t\t\trowState.lock();\n\t\t\t\trowState.set(DTableState.SELECTABLE, isRowSelectable);\n\t\t\t\trowState.set(DBaseState.ACTIVE, selection.contains(unmappedIndex));\n\t\t\t\trowState.remove(DBaseState.DISABLED);\n\t\t\t\trowState.unlock();\n\n\t\t\t\t// Data\n\t\t\t\trow.set(datum, supplimental, unmappedIndex, forcibly);\n\t\t\t},\n\t\t\tnewRowIndexMappedStart,\n\t\t\tnewRowIndexMappedStart + rowsLength\n\t\t);\n\n\t\tfor (let i = 0; newRowIndexMappedStart + i < 0 && i < rowsLength; ++i) {\n\t\t\tconst row = rows[i];\n\n\t\t\t// Position\n\t\t\trow.position.y = (newRowIndexMappedStart + i) * rowHeight;\n\n\t\t\t// State\n\t\t\tconst rowState = row.state;\n\t\t\trowState.lock();\n\t\t\trowState.add(DBaseState.DISABLED);\n\t\t\trowState.removeAll(DTableState.SELECTABLE, DBaseState.ACTIVE);\n\t\t\trowState.unlock();\n\n\t\t\t// Data\n\t\t\trow.unset();\n\t\t}\n\n\t\tfor (let i = rowsLength - 1; dataMappedSize <= newRowIndexMappedStart + i && 0 <= i; --i) {\n\t\t\tconst row = rows[i];\n\n\t\t\t// Position\n\t\t\trow.position.y = (newRowIndexMappedStart + i) * rowHeight;\n\n\t\t\t// State\n\t\t\tconst rowState = row.state;\n\t\t\trowState.lock();\n\t\t\trowState.add(DBaseState.DISABLED);\n\t\t\trowState.removeAll(DTableState.SELECTABLE, DBaseState.ACTIVE);\n\t\t\trowState.unlock();\n\n\t\t\t// Data\n\t\t\trow.unset();\n\t\t}\n\n\t\tthis.lock();\n\t\tcontent.position.y = newContentY;\n\t\tcontent.height = newContentHeight;\n\t\tthis.height = newHeight;\n\t\tthis.unlock(false);\n\t\tthis.emit(\"update\", newRowIndexMappedLowerBound, newRowIndexMappedUpperBound, this);\n\t}\n\n\tprotected resetRow(row: DTableBodyRow<ROW>): DTableBodyRow<ROW> {\n\t\trow.blur(true);\n\t\tconst cells = row.children;\n\t\tfor (let i = 0, imax = cells.length; i < imax; ++i) {\n\t\t\tconst cell = cells[i];\n\t\t\tif (cell instanceof DBase) {\n\t\t\t\tcell.state.isPressed = false;\n\t\t\t}\n\t\t}\n\t\treturn row;\n\t}\n\n\tprotected newRow(isEven: boolean): DTableBodyRow<ROW> {\n\t\treturn new DTableBodyRow<ROW>(\n\t\t\tthis._onRowChangeBound,\n\t\t\tisEven,\n\t\t\tthis._columnIndexToCellOptions,\n\t\t\tthis._rowOptions\n\t\t);\n\t}\n\n\tprotected onParentMove(newX: number, newY: number, oldX: number, oldY: number): void {\n\t\tsuper.onParentMove(newX, newY, oldX, oldY);\n\t\tthis.updateFrozenCellPosition(newX);\n\t}\n\n\tprotected updateFrozenCellPosition(x: number): void {\n\t\tconst frozen = this._rowOptions.frozen;\n\t\tif (frozen != null && 0 < frozen) {\n\t\t\tconst rows = this.children as Array<DTableBodyRow<ROW>>;\n\t\t\tfor (let i = 0, imax = rows.length; i < imax; ++i) {\n\t\t\t\trows[i].updateFrozenCellPosition(x);\n\t\t\t}\n\t\t}\n\t}\n\n\tgetClippingRect(target: unknown, result: Rectangle): void {\n\t\tsuper.getClippingRect(target, result);\n\n\t\tconst parent = this.parent;\n\t\tif (parent) {\n\t\t\tconst dy = -parent.transform.position.y;\n\t\t\tresult.y += dy;\n\t\t\tresult.height -= dy;\n\t\t}\n\t}\n\n\t/**\n\t * Scroll to the given row or row index.\n\t *\n\t * @param target a row or an row index to which the body scrolls to.\n\t * @returns true if succeeded\n\t */\n\tscrollTo(target: ROW | number): boolean {\n\t\tconst parent = this.parent;\n\t\tif (parent == null) {\n\t\t\treturn false;\n\t\t}\n\t\tconst parentParent = parent.parent;\n\t\tif (parentParent == null) {\n\t\t\treturn false;\n\t\t}\n\t\tlet rowIndexMapped = -1;\n\t\tif (isNumber(target)) {\n\t\t\tif (0 <= target && target < this.data.mapped.size()) {\n\t\t\t\trowIndexMapped = target;\n\t\t\t}\n\t\t} else {\n\t\t\tthis.data.mapped.each((row: ROW, _: unknown, index: number): boolean => {\n\t\t\t\tif (row === target) {\n\t\t\t\t\trowIndexMapped = index;\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\treturn true;\n\t\t\t});\n\t\t}\n\t\tif (rowIndexMapped < 0) {\n\t\t\treturn false;\n\t\t}\n\t\tparent.position.y = Math.max(\n\t\t\tMath.min(0, parentParent.height - parent.height),\n\t\t\t-rowIndexMapped * this._rowHeight\n\t\t);\n\t\tDApplications.update(this);\n\t\treturn true;\n\t}\n\n\tprotected toRowIndexMapped(local: Point): number {\n\t\tif (0 <= this.parent.position.y + local.y) {\n\t\t\treturn Math.floor(local.y / this._rowHeight);\n\t\t}\n\t\treturn -1;\n\t}\n\n\tprotected toRow(rowIndexMapped: number): DTableBodyRow<ROW> | null {\n\t\tconst index = rowIndexMapped - this._rowIndexMappedStart;\n\t\tconst rows = this.children as Array<DTableBodyRow<ROW>>;\n\t\tif (0 <= index && index < rows.length) {\n\t\t\treturn rows[index];\n\t\t}\n\t\treturn null;\n\t}\n\n\tprotected toCell(row: DTableBodyRow<ROW>, local: Point): DTableBodyCell<ROW, unknown> | null {\n\t\tconst cells = row.children as Array<DTableBodyCell<ROW, unknown>>;\n\t\tconst cellsLength = cells.length;\n\t\tconst columns = this._columns;\n\t\tconst columnsLength = columns.length;\n\t\tfor (let i = 0, imax = Math.min(cellsLength, columnsLength); i < imax; ++i) {\n\t\t\tconst cell = cells[cellsLength - i - 1];\n\t\t\tconst x = local.x - cell.position.x;\n\t\t\tif (0 <= x && x <= cell.width) {\n\t\t\t\treturn cell;\n\t\t\t}\n\t\t}\n\t\treturn null;\n\t}\n\n\tonRowClick(e: InteractionEvent): void {\n\t\tif (this.state.isActionable) {\n\t\t\tconst local = DTableBody.WORK_ON_CLICK;\n\t\t\tlocal.copyFrom(e.data.global);\n\t\t\tthis.toLocal(local, undefined, local, false);\n\t\t\tconst rowIndexMapped = this.toRowIndexMapped(local);\n\t\t\tif (0 <= rowIndexMapped && rowIndexMapped < this._data.mapped.size()) {\n\t\t\t\t// Delegate to the cell at first\n\t\t\t\tconst row = this.toRow(rowIndexMapped);\n\t\t\t\tif (row) {\n\t\t\t\t\tconst cell = this.toCell(row, local);\n\t\t\t\t\tif (cell && cell.onRowSelect && cell.onRowSelect(e, local)) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// Fallback to the default\n\t\t\t\tthis.onRowSelect(e, rowIndexMapped);\n\t\t\t}\n\t\t}\n\t}\n\n\tprotected onRowSelect(e: InteractionEvent, rowIndexMapped: number): void {\n\t\tconst data = this._data;\n\t\tconst selection = data.selection;\n\t\tconst isSingle = selection.type === DTableDataSelectionType.SINGLE;\n\t\tconst isNotSingle = !isSingle;\n\t\tconst rowIndex = data.mapped.unmap(rowIndexMapped);\n\t\tconst originalEvent = e.data.originalEvent;\n\t\tconst ctrlKey = originalEvent.ctrlKey;\n\t\tconst shiftKey = originalEvent.shiftKey;\n\t\tif (isSingle || selection.isEmpty() || !(isNotSingle && (ctrlKey || shiftKey))) {\n\t\t\tselection.clearAndAdd(rowIndex);\n\t\t} else if (ctrlKey) {\n\t\t\tselection.toggle(rowIndex);\n\t\t} else if (shiftKey) {\n\t\t\tconst lastRowIndex = selection.last;\n\t\t\tif (lastRowIndex != null) {\n\t\t\t\tconst sorter = data.sorter;\n\t\t\t\tconst filter = data.filter;\n\t\t\t\tconst rowIndexSorted = sorter.map(rowIndex);\n\t\t\t\tconst lastRowIndexSorted = sorter.map(lastRowIndex);\n\t\t\t\tif (rowIndexSorted != null && lastRowIndexSorted != null) {\n\t\t\t\t\tlet istart = lastRowIndexSorted + 1;\n\t\t\t\t\tlet iend = rowIndexSorted + 1;\n\t\t\t\t\tif (rowIndexSorted < lastRowIndexSorted) {\n\t\t\t\t\t\tistart = rowIndexSorted;\n\t\t\t\t\t\tiend = lastRowIndexSorted;\n\t\t\t\t\t}\n\t\t\t\t\tif (istart < iend) {\n\t\t\t\t\t\tconst rowIndices: number[] = [];\n\t\t\t\t\t\tconst indicesFiltered = filter.indices;\n\t\t\t\t\t\tconst indicesSorted = sorter.indices;\n\t\t\t\t\t\tif (indicesFiltered) {\n\t\t\t\t\t\t\tif (indicesSorted) {\n\t\t\t\t\t\t\t\tfor (let i = 0, imax = indicesFiltered.length; i < imax; ++i) {\n\t\t\t\t\t\t\t\t\tconst indexFiltered = indicesFiltered[i];\n\t\t\t\t\t\t\t\t\tif (istart <= indexFiltered && indexFiltered < iend) {\n\t\t\t\t\t\t\t\t\t\trowIndices.push(indicesSorted[indexFiltered]);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tfor (let i = 0, imax = indicesFiltered.length; i < imax; ++i) {\n\t\t\t\t\t\t\t\t\tconst indexFiltered = indicesFiltered[i];\n\t\t\t\t\t\t\t\t\tif (istart <= indexFiltered && indexFiltered < iend) {\n\t\t\t\t\t\t\t\t\t\trowIndices.push(indexFiltered);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tif (indicesSorted) {\n\t\t\t\t\t\t\t\tfor (let i = istart; i < iend; ++i) {\n\t\t\t\t\t\t\t\t\trowIndices.push(indicesSorted[i]);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tfor (let i = istart; i < iend; ++i) {\n\t\t\t\t\t\t\t\t\trowIndices.push(i);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tselection.addAll(rowIndices);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tonDblClick(\n\t\te: MouseEvent | TouchEvent,\n\t\tinteractionManager: interaction.InteractionManager\n\t): boolean {\n\t\treturn super.onDblClick(e, interactionManager);\n\t}\n\n\tprotected getType(): string {\n\t\treturn \"DTableBody\";\n\t}\n\n\tget data(): DATA {\n\t\treturn this._data;\n\t}\n}\n"]}
1
+ {"version":3,"file":"d-table-body.js","sourceRoot":"","sources":["../../../src/main/typescript/wcardinal/ui/d-table-body.ts"],"names":[],"mappings":"AAAA;;;GAGG;;AAEH,OAAO,EAAe,KAAK,EAAa,MAAM,SAAS,CAAC;AAExD,OAAO,EAAE,KAAK,EAAyC,MAAM,UAAU,CAAC;AACxE,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,aAAa,EAA+C,MAAM,oBAAoB,CAAC;AAGhG,OAAO,EAAE,cAAc,EAAyB,MAAM,qBAAqB,CAAC;AAC5E,OAAO,EAAuB,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;AAExF,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAG9C,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAgD7D,IAAM,YAAY,GAAG,UACpB,KAAsB,EACtB,OAAqC,EACrC,aAAsC;IAEtC,IAAM,OAAO,GAAG,OAAO,CAAC,OAAO,IAAI,EAAE,CAAC;IACtC,IAAI,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC;IACzB,IAAI,MAAM,IAAI,IAAI,EAAE;QACnB,IAAI,MAAM,CAAC,MAAM,IAAI,IAAI,EAAE;YAC1B,MAAM,CAAC,MAAM,GAAG,KAAK,CAAC,YAAY,EAAE,CAAC;SACrC;QACD,IAAI,MAAM,CAAC,OAAO,KAAK,SAAS,EAAE;YACjC,MAAM,CAAC,OAAO,GAAG,OAAO,CAAC;SACzB;QACD,IAAI,MAAM,CAAC,MAAM,IAAI,IAAI,EAAE;YAC1B,MAAM,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;SA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aAAa,GAAG,eAAe,CAAC,CAAC,CAAC,CAAC;oCACzC,IAAI,MAAM,IAAI,aAAa,IAAI,aAAa,GAAG,IAAI,EAAE;wCACpD,UAAU,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;qCAC/B;iCACD;6BACD;yBACD;6BAAM;4BACN,IAAI,aAAa,EAAE;gCAClB,KAAK,IAAI,CAAC,GAAG,MAAM,EAAE,CAAC,GAAG,IAAI,EAAE,EAAE,CAAC,EAAE;oCACnC,UAAU,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC;iCAClC;6BACD;iCAAM;gCACN,KAAK,IAAI,CAAC,GAAG,MAAM,EAAE,CAAC,GAAG,IAAI,EAAE,EAAE,CAAC,EAAE;oCACnC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;iCACnB;6BACD;yBACD;wBACD,SAAS,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;qBAC7B;iBACD;aACD;SACD;IACF,CAAC;IAED,+BAAU,GAAV,UACC,CAA0B,EAC1B,kBAAkD;QAElD,OAAO,iBAAM,UAAU,YAAC,CAAC,EAAE,kBAAkB,CAAC,CAAC;IAChD,CAAC;IAES,4BAAO,GAAjB;QACC,OAAO,YAAY,CAAC;IACrB,CAAC;IAED,sBAAI,4BAAI;aAAR;YACC,OAAO,IAAI,CAAC,KAAK,CAAC;QACnB,CAAC;;;OAAA;IA5fgB,wBAAa,GAAG,IAAI,KAAK,EAAE,CAAC;IA6f9C,iBAAC;CAAA,AAngBD,CAKU,KAAK,GA8fd;SAngBY,UAAU","sourcesContent":["/*\n * Copyright (C) 2019 Toshiba Corporation\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { interaction, Point, Rectangle } from \"pixi.js\";\nimport InteractionEvent = interaction.InteractionEvent;\nimport { DBase, DBaseEvents, DBaseOptions, DThemeBase } from \"./d-base\";\nimport { DBaseState } from \"./d-base-state\";\nimport { DTableBodyRow, DTableBodyRowOnChange, DTableBodyRowOptions } from \"./d-table-body-row\";\nimport { DTableColumn } from \"./d-table-column\";\nimport { DTableData, DTableDataOptions, DTableDataSupplimental } from \"./d-table-data\";\nimport { DTableDataList, DTableDataListOptions } from \"./d-table-data-list\";\nimport { DTableDataSelection, DTableDataSelectionType } from \"./d-table-data-selection\";\nimport { DTableBodyCell } from \"./d-table-body-cell\";\nimport { DTableState } from \"./d-table-state\";\nimport { DTableBodyCellOptions } from \"./d-table-body-cell-options\";\nimport { DOnOptions } from \"./d-on-options\";\nimport { DApplications } from \"./d-applications\";\nimport { isNumber } from \"./util/is-number\";\nimport { DTableColumnUpdate } from \"./d-table-column-update\";\n\n/**\n * {@link DTableBody} events.\n */\nexport interface DTableBodyEvents<EMITTER> extends DBaseEvents<EMITTER> {\n\t/**\n\t * Triggered when rows are updated.\n\t * The first and second parameters are an mapped index range of visible data.\n\t * Please note that these parameters are real numbers.\n\t * For instance, An index range of [0.5, 2.5] means:\n\t *\n\t * * The row at index 0 is partially visible.\n\t * * The row at index 1 is fully visible.\n\t * * The row at index 2 is partially visible.\n\t *\n\t * @param from a lowest mapped index of visible data\n\t * @param to a highest mapped index of vislble data\n\t * @param emitter an emitter\n\t */\n\tupdate(from: number, to: number, emitter: EMITTER): void;\n}\n\n/**\n * {@link DTableBody} \"on\" options.\n */\nexport interface DTableBodyOnOptions<EMITTER>\n\textends Partial<DTableBodyEvents<EMITTER>>,\n\t\tDOnOptions {}\n\nexport interface DTableBodyOptions<\n\tROW,\n\tDATA extends DTableData<ROW> = DTableDataList<ROW>,\n\tTHEME extends DThemeTableBody = DThemeTableBody,\n\tEMITTER = any\n> extends DBaseOptions<THEME, EMITTER> {\n\tcolumns?: Array<DTableColumn<ROW, unknown>>;\n\trow?: DTableBodyRowOptions<ROW>;\n\tdata?: DTableDataListOptions<ROW> | DATA;\n\toffset?: number;\n\tfrozen?: number;\n\ton?: DTableBodyOnOptions<EMITTER>;\n}\n\nexport interface DThemeTableBody extends DThemeBase {\n\tgetRowHeight(): number;\n}\n\nconst toRowOptions = <ROW, DATA extends DTableData<ROW>>(\n\ttheme: DThemeTableBody,\n\toptions: DTableBodyOptions<ROW, DATA>,\n\tselectionType: DTableDataSelectionType\n): DTableBodyRowOptions<ROW> => {\n\tconst columns = options.columns || [];\n\tlet result = options.row;\n\tif (result != null) {\n\t\tif (result.height == null) {\n\t\t\tresult.height = theme.getRowHeight();\n\t\t}\n\t\tif (result.columns === undefined) {\n\t\t\tresult.columns = columns;\n\t\t}\n\t\tif (result.frozen == null) {\n\t\t\tresult.frozen = options.frozen;\n\t\t}\n\t\tif (result.selection === undefined) {\n\t\t\tresult.selection = {\n\t\t\t\ttype: selectionType\n\t\t\t};\n\t\t} else if (result.selection.type === undefined) {\n\t\t\tresult.selection.type = selectionType;\n\t\t}\n\t} else {\n\t\tresult = {\n\t\t\tcolumns,\n\t\t\theight: theme.getRowHeight(),\n\t\t\tfrozen: options.frozen,\n\t\t\tselection: {\n\t\t\t\ttype: selectionType\n\t\t\t}\n\t\t};\n\t}\n\treturn result as DTableBodyRowOptions<ROW>;\n};\n\nexport class DTableBody<\n\tROW,\n\tDATA extends DTableData<ROW> = DTableDataList<ROW>,\n\tTHEME extends DThemeTableBody = DThemeTableBody,\n\tOPTIONS extends DTableBodyOptions<ROW, DATA, THEME> = DTableBodyOptions<ROW, DATA, THEME>\n> extends DBase<THEME, OPTIONS> {\n\tprotected static WORK_ON_CLICK = new Point();\n\n\tprotected _columns: Array<DTableColumn<ROW, unknown>>;\n\tprotected _rowHeight: number;\n\tprotected _rowIndexMappedStart: number;\n\tprotected _rowIndexMappedEnd: number;\n\tprotected _rowOptions: DTableBodyRowOptions<ROW>;\n\tprotected _updateRowsCount: number;\n\tprotected _isUpdateRowsCalled: boolean;\n\tprotected _isUpdateRowsCalledForcibly: boolean;\n\tprotected _workRows: Array<DTableBodyRow<ROW>>;\n\tprotected _onRowChangeBound: DTableBodyRowOnChange<ROW, unknown>;\n\tprotected _columnIndexToCellOptions: Map<number, DTableBodyCellOptions<ROW>>;\n\tprotected _data: DATA;\n\n\tconstructor(options: OPTIONS) {\n\t\tsuper(options);\n\n\t\tthis.transform.position.y = options.offset ?? 0;\n\t\tconst data = this.toData(options.data);\n\t\tthis._data = data;\n\t\tdata.bind(this);\n\t\tconst theme = this.theme;\n\t\tconst rowOptions = toRowOptions(theme, options, data.selection.type);\n\t\tthis._rowOptions = rowOptions;\n\t\tthis._rowHeight = rowOptions.height != null ? rowOptions.height : theme.getRowHeight();\n\t\tthis._columns = rowOptions.columns || [];\n\t\tthis._rowIndexMappedStart = 0;\n\t\tthis._rowIndexMappedEnd = 0;\n\t\tthis._updateRowsCount = 0;\n\t\tthis._isUpdateRowsCalled = false;\n\t\tthis._isUpdateRowsCalledForcibly = false;\n\t\tthis._workRows = [];\n\t\tthis._onRowChangeBound = (newValue, oldValue, row, rowIndex, columnIndex, column): void => {\n\t\t\tthis.onRowChange(newValue, oldValue, row, rowIndex, columnIndex, column);\n\t\t};\n\t\tthis._columnIndexToCellOptions = new Map<number, DTableBodyCellOptions<ROW>>();\n\t\tthis._data.emit(\"init\", this._data);\n\t}\n\n\tprotected onRowChange(\n\t\tnewValue: unknown,\n\t\toldValue: unknown,\n\t\trow: ROW,\n\t\trowIndex: number,\n\t\tcolumnIndex: number,\n\t\tcolumn: DTableColumn<ROW, unknown>\n\t): void {\n\t\tconst data = this._data;\n\t\tdata.emit(\"change\", newValue, oldValue, row, rowIndex, columnIndex, data);\n\t\tif (column.update === DTableColumnUpdate.ALL) {\n\t\t\tthis.update(true);\n\t\t}\n\t}\n\n\tprotected toData(options?: DATA | DTableDataListOptions<ROW>): DATA {\n\t\tif (this.isData(options)) {\n\t\t\treturn options;\n\t\t}\n\t\treturn new DTableDataList<ROW>(options) as any;\n\t}\n\n\tprotected isData(\n\t\ttarget?: ROW[] | DTableDataOptions<ROW> | DTableData<ROW>\n\t): target is DTableData<ROW> {\n\t\treturn target != null && \"mapped\" in target;\n\t}\n\n\tonResize(newWidth: number, newHeight: number, oldWidth: number, oldHeight: number): void {\n\t\tsuper.onResize(newWidth, newHeight, oldWidth, oldHeight);\n\t\tthis.update();\n\t}\n\n\tget selection(): DTableDataSelection<ROW> {\n\t\treturn this._data.selection;\n\t}\n\n\tlock(): void {\n\t\tthis._updateRowsCount += 1;\n\t\tif (this._updateRowsCount === 1) {\n\t\t\tthis._isUpdateRowsCalled = false;\n\t\t\tthis._isUpdateRowsCalledForcibly = false;\n\t\t}\n\t}\n\n\tunlock(callIfNeeded: boolean): void {\n\t\tthis._updateRowsCount -= 1;\n\t\tif (this._updateRowsCount === 0) {\n\t\t\tif (callIfNeeded && this._isUpdateRowsCalled) {\n\t\t\t\tthis.update(this._isUpdateRowsCalledForcibly);\n\t\t\t}\n\t\t\tthis._isUpdateRowsCalled = false;\n\t\t\tthis._isUpdateRowsCalledForcibly = false;\n\t\t}\n\t}\n\n\t/**\n\t * Updates rows. If the `forcibly` is true, some dirty checkings for\n\t * avoiding unnecessary state changes are skipped.\n\t *\n\t * @param forcibly true to update forcibly\n\t */\n\tupdate(forcibly?: boolean): void {\n\t\tif (0 < this._updateRowsCount) {\n\t\t\tthis._isUpdateRowsCalled = true;\n\t\t\tif (forcibly) {\n\t\t\t\tthis._isUpdateRowsCalledForcibly = true;\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\n\t\tconst content = this.parent;\n\t\tif (content == null) {\n\t\t\treturn;\n\t\t}\n\t\tconst contentParent = content.parent;\n\t\tif (contentParent == null) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst rows = this.children as Array<DTableBodyRow<ROW>>;\n\t\tconst height = contentParent.height;\n\t\tconst rowHeight = this._rowHeight;\n\n\t\tconst data = this._data;\n\t\tconst dataMappedSize = data.mapped.size();\n\n\t\tconst oldRowIndexMappedStart = this._rowIndexMappedStart;\n\t\tlet oldRowIndexMappedEnd = this._rowIndexMappedEnd;\n\t\tlet oldRowCount = oldRowIndexMappedEnd - oldRowIndexMappedStart;\n\n\t\tconst y = this.transform.position.y;\n\t\tconst newHeight = y + dataMappedSize * rowHeight;\n\t\tconst newContentHeight = Math.max(height, newHeight);\n\t\tconst newContentY = Math.max(height - newContentHeight, content.position.y);\n\n\t\tconst newRowIndexMappedLowerBound = -newContentY / rowHeight;\n\t\tconst newRowIndexMappedUpperBound = (height - (newContentY + y)) / rowHeight;\n\t\tlet newRowIndexMappedStart = Math.floor(newRowIndexMappedLowerBound);\n\t\tnewRowIndexMappedStart -= newRowIndexMappedStart % 2 === 0 ? 2 : 1;\n\t\tlet newRowIndexMappedEnd = Math.floor(newRowIndexMappedUpperBound);\n\t\tnewRowIndexMappedEnd += (newRowIndexMappedEnd - newRowIndexMappedStart) % 2 === 1 ? 3 : 2;\n\t\tlet newRowCount = newRowIndexMappedEnd - newRowIndexMappedStart;\n\t\tif (newRowCount < oldRowCount && oldRowCount - 2 <= newRowCount) {\n\t\t\tnewRowCount = oldRowCount;\n\t\t\tnewRowIndexMappedEnd = newRowIndexMappedStart + newRowCount;\n\t\t}\n\n\t\tif (oldRowCount < newRowCount) {\n\t\t\tfor (let i = oldRowCount; i < newRowCount; ++i) {\n\t\t\t\tconst oldRowIndexMapped = oldRowIndexMappedStart + i;\n\t\t\t\tconst newRow = this.newRow(oldRowIndexMapped % 2 === 0);\n\t\t\t\tthis.addChild(newRow);\n\t\t\t}\n\t\t\toldRowCount = newRowCount;\n\t\t\toldRowIndexMappedEnd = oldRowIndexMappedStart + oldRowCount;\n\t\t} else if (newRowCount < oldRowCount) {\n\t\t\tfor (let i = oldRowCount - 1; newRowCount <= i; --i) {\n\t\t\t\tthis.removeChild(rows[i]);\n\t\t\t}\n\t\t\toldRowCount = newRowCount;\n\t\t\toldRowIndexMappedEnd = oldRowIndexMappedStart + oldRowCount;\n\t\t}\n\n\t\tthis._rowIndexMappedStart = newRowIndexMappedStart;\n\t\tthis._rowIndexMappedEnd = newRowIndexMappedEnd;\n\n\t\tconst rowIndexMappedStartDelta = newRowIndexMappedStart - oldRowIndexMappedStart;\n\t\tconst rowIndexMappedStartDeltaAbs = Math.abs(rowIndexMappedStartDelta);\n\t\tconst rowsLength = rows.length;\n\t\tif (0 < rowIndexMappedStartDeltaAbs && rowIndexMappedStartDeltaAbs < rowsLength) {\n\t\t\tconst work = this._workRows;\n\t\t\tif (0 < rowIndexMappedStartDelta) {\n\t\t\t\tfor (let i = 0; i < rowIndexMappedStartDeltaAbs; ++i) {\n\t\t\t\t\twork.push(this.resetRow(rows[i]));\n\t\t\t\t}\n\t\t\t\tfor (let i = rowIndexMappedStartDeltaAbs; i < rowsLength; ++i) {\n\t\t\t\t\trows[i - rowIndexMappedStartDeltaAbs] = rows[i];\n\t\t\t\t}\n\t\t\t\tfor (let i = 0; i < rowIndexMappedStartDeltaAbs; ++i) {\n\t\t\t\t\trows[rowsLength - rowIndexMappedStartDeltaAbs + i] = work[i];\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tfor (let i = 0; i < rowIndexMappedStartDeltaAbs; ++i) {\n\t\t\t\t\twork.push(this.resetRow(rows[rowsLength - rowIndexMappedStartDeltaAbs + i]));\n\t\t\t\t}\n\t\t\t\tfor (let i = rowsLength - rowIndexMappedStartDeltaAbs - 1; 0 <= i; --i) {\n\t\t\t\t\trows[i + rowIndexMappedStartDeltaAbs] = rows[i];\n\t\t\t\t}\n\t\t\t\tfor (let i = 0; i < rowIndexMappedStartDeltaAbs; ++i) {\n\t\t\t\t\trows[i] = work[i];\n\t\t\t\t}\n\t\t\t}\n\t\t\twork.length = 0;\n\t\t}\n\n\t\tconst selection = data.selection;\n\t\tconst isRowSelectable = selection.type !== DTableDataSelectionType.NONE;\n\t\tdata.mapped.each(\n\t\t\t(\n\t\t\t\tdatum: ROW,\n\t\t\t\tsupplimental: DTableDataSupplimental | null,\n\t\t\t\tindex: number,\n\t\t\t\tunmappedIndex: number\n\t\t\t): void | boolean => {\n\t\t\t\tconst row = rows[index - newRowIndexMappedStart];\n\n\t\t\t\t// Position\n\t\t\t\trow.position.y = index * rowHeight;\n\n\t\t\t\t// State\n\t\t\t\tconst rowState = row.state;\n\t\t\t\trowState.lock();\n\t\t\t\trowState.set(DTableState.SELECTABLE, isRowSelectable);\n\t\t\t\trowState.set(DBaseState.ACTIVE, selection.contains(unmappedIndex));\n\t\t\t\trowState.remove(DBaseState.DISABLED);\n\t\t\t\trowState.unlock();\n\n\t\t\t\t// Data\n\t\t\t\trow.set(datum, supplimental, unmappedIndex, forcibly);\n\t\t\t},\n\t\t\tnewRowIndexMappedStart,\n\t\t\tnewRowIndexMappedStart + rowsLength\n\t\t);\n\n\t\tfor (let i = 0; newRowIndexMappedStart + i < 0 && i < rowsLength; ++i) {\n\t\t\tconst row = rows[i];\n\n\t\t\t// Position\n\t\t\trow.position.y = (newRowIndexMappedStart + i) * rowHeight;\n\n\t\t\t// State\n\t\t\tconst rowState = row.state;\n\t\t\trowState.lock();\n\t\t\trowState.add(DBaseState.DISABLED);\n\t\t\trowState.removeAll(DTableState.SELECTABLE, DBaseState.ACTIVE);\n\t\t\trowState.unlock();\n\n\t\t\t// Data\n\t\t\trow.unset();\n\t\t}\n\n\t\tfor (let i = rowsLength - 1; dataMappedSize <= newRowIndexMappedStart + i && 0 <= i; --i) {\n\t\t\tconst row = rows[i];\n\n\t\t\t// Position\n\t\t\trow.position.y = (newRowIndexMappedStart + i) * rowHeight;\n\n\t\t\t// State\n\t\t\tconst rowState = row.state;\n\t\t\trowState.lock();\n\t\t\trowState.add(DBaseState.DISABLED);\n\t\t\trowState.removeAll(DTableState.SELECTABLE, DBaseState.ACTIVE);\n\t\t\trowState.unlock();\n\n\t\t\t// Data\n\t\t\trow.unset();\n\t\t}\n\n\t\tthis.lock();\n\t\tcontent.position.y = newContentY;\n\t\tcontent.height = newContentHeight;\n\t\tthis.height = newHeight;\n\t\tthis.unlock(false);\n\t\tthis.emit(\"update\", newRowIndexMappedLowerBound, newRowIndexMappedUpperBound, this);\n\t}\n\n\tprotected resetRow(row: DTableBodyRow<ROW>): DTableBodyRow<ROW> {\n\t\trow.blur(true);\n\t\tconst cells = row.children;\n\t\tfor (let i = 0, imax = cells.length; i < imax; ++i) {\n\t\t\tconst cell = cells[i];\n\t\t\tif (cell instanceof DBase) {\n\t\t\t\tcell.state.isPressed = false;\n\t\t\t}\n\t\t}\n\t\treturn row;\n\t}\n\n\tprotected newRow(isEven: boolean): DTableBodyRow<ROW> {\n\t\treturn new DTableBodyRow<ROW>(\n\t\t\tthis._onRowChangeBound,\n\t\t\tisEven,\n\t\t\tthis._columnIndexToCellOptions,\n\t\t\tthis._rowOptions\n\t\t);\n\t}\n\n\tprotected onParentMove(newX: number, newY: number, oldX: number, oldY: number): void {\n\t\tsuper.onParentMove(newX, newY, oldX, oldY);\n\t\tthis.updateFrozenCellPosition(newX);\n\t}\n\n\tprotected updateFrozenCellPosition(x: number): void {\n\t\tconst frozen = this._rowOptions.frozen;\n\t\tif (frozen != null && 0 < frozen) {\n\t\t\tconst rows = this.children as Array<DTableBodyRow<ROW>>;\n\t\t\tfor (let i = 0, imax = rows.length; i < imax; ++i) {\n\t\t\t\trows[i].updateFrozenCellPosition(x);\n\t\t\t}\n\t\t}\n\t}\n\n\tgetClippingRect(target: unknown, result: Rectangle): void {\n\t\tsuper.getClippingRect(target, result);\n\n\t\tconst parent = this.parent;\n\t\tif (parent) {\n\t\t\tconst dy = -parent.transform.position.y;\n\t\t\tresult.y += dy;\n\t\t\tresult.height -= dy;\n\t\t}\n\t}\n\n\t/**\n\t * Scroll to the given row or row index.\n\t *\n\t * @param target a row or an row index to which the body scrolls to.\n\t * @returns true if succeeded\n\t */\n\tscrollTo(target: ROW | number): boolean {\n\t\tconst parent = this.parent;\n\t\tif (parent == null) {\n\t\t\treturn false;\n\t\t}\n\t\tconst parentParent = parent.parent;\n\t\tif (parentParent == null) {\n\t\t\treturn false;\n\t\t}\n\t\tlet rowIndexMapped = -1;\n\t\tif (isNumber(target)) {\n\t\t\tif (0 <= target && target < this.data.mapped.size()) {\n\t\t\t\trowIndexMapped = target;\n\t\t\t}\n\t\t} else {\n\t\t\tthis.data.mapped.each((row: ROW, _: unknown, index: number): boolean => {\n\t\t\t\tif (row === target) {\n\t\t\t\t\trowIndexMapped = index;\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\treturn true;\n\t\t\t});\n\t\t}\n\t\tif (rowIndexMapped < 0) {\n\t\t\treturn false;\n\t\t}\n\t\tparent.position.y = Math.max(\n\t\t\tMath.min(0, parentParent.height - parent.height),\n\t\t\t-rowIndexMapped * this._rowHeight\n\t\t);\n\t\tDApplications.update(this);\n\t\treturn true;\n\t}\n\n\t/**\n\t * Returns a mapped row index at the given local Y position or -1.\n\t *\n\t * @param localY a local Y position\n\t * @returns a mapped row index at the given local Y position or -1.\n\t */\n\ttoRowIndexMapped(localY: number): number {\n\t\tif (0 <= this.parent.position.y + localY) {\n\t\t\tconst result = Math.floor(localY / this._rowHeight);\n\t\t\tif (0 <= result && result < this._data.mapped.size()) {\n\t\t\t\treturn result;\n\t\t\t}\n\t\t}\n\t\treturn -1;\n\t}\n\n\t/**\n\t * Returns a row at the given mapped row index or null if not exits.\n\t *\n\t * @param rowIndexMapped a mapped row index\n\t * @returns a row at the given mapped row index or null if not exists.\n\t */\n\ttoRow(rowIndexMapped: number): DTableBodyRow<ROW> | null {\n\t\tconst index = rowIndexMapped - this._rowIndexMappedStart;\n\t\tconst rows = this.children as Array<DTableBodyRow<ROW>>;\n\t\tif (0 <= index && index < rows.length) {\n\t\t\treturn rows[index];\n\t\t}\n\t\treturn null;\n\t}\n\n\t/**\n\t * Returns a cell at the given local X position or null if not exits.\n\t * This method assumes the given local X position is on the given row.\n\t *\n\t * @param row a row\n\t * @param localX a local X position\n\t * @returns a cell at the given local X position or null if not exits\n\t */\n\ttoCell(row: DTableBodyRow<ROW>, localX: number): DTableBodyCell<ROW, unknown> | null {\n\t\tconst cells = row.children as Array<DTableBodyCell<ROW, unknown>>;\n\t\tconst cellsLength = cells.length;\n\t\tconst columns = this._columns;\n\t\tconst columnsLength = columns.length;\n\t\tfor (let i = 0, imax = Math.min(cellsLength, columnsLength); i < imax; ++i) {\n\t\t\tconst cell = cells[cellsLength - i - 1];\n\t\t\tconst x = localX - cell.position.x;\n\t\t\tif (0 <= x && x <= cell.width) {\n\t\t\t\treturn cell;\n\t\t\t}\n\t\t}\n\t\treturn null;\n\t}\n\n\tonRowClick(e: InteractionEvent): void {\n\t\tif (this.state.isActionable) {\n\t\t\tconst local = DTableBody.WORK_ON_CLICK;\n\t\t\tlocal.copyFrom(e.data.global);\n\t\t\tthis.toLocal(local, undefined, local, false);\n\t\t\tconst rowIndexMapped = this.toRowIndexMapped(local.y);\n\t\t\tif (0 <= rowIndexMapped) {\n\t\t\t\t// Delegate to the cell at first\n\t\t\t\tconst row = this.toRow(rowIndexMapped);\n\t\t\t\tif (row) {\n\t\t\t\t\tconst cell = this.toCell(row, local.x);\n\t\t\t\t\tif (cell && cell.onRowSelect && cell.onRowSelect(e, local)) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// Fallback to the default\n\t\t\t\tthis.onRowSelect(e, rowIndexMapped);\n\t\t\t}\n\t\t}\n\t}\n\n\tprotected onRowSelect(e: InteractionEvent, rowIndexMapped: number): void {\n\t\tconst data = this._data;\n\t\tconst selection = data.selection;\n\t\tconst isSingle = selection.type === DTableDataSelectionType.SINGLE;\n\t\tconst isNotSingle = !isSingle;\n\t\tconst rowIndex = data.mapped.unmap(rowIndexMapped);\n\t\tconst originalEvent = e.data.originalEvent;\n\t\tconst ctrlKey = originalEvent.ctrlKey;\n\t\tconst shiftKey = originalEvent.shiftKey;\n\t\tif (isSingle || selection.isEmpty() || !(isNotSingle && (ctrlKey || shiftKey))) {\n\t\t\tselection.clearAndAdd(rowIndex);\n\t\t} else if (ctrlKey) {\n\t\t\tselection.toggle(rowIndex);\n\t\t} else if (shiftKey) {\n\t\t\tconst lastRowIndex = selection.last;\n\t\t\tif (lastRowIndex != null) {\n\t\t\t\tconst sorter = data.sorter;\n\t\t\t\tconst filter = data.filter;\n\t\t\t\tconst rowIndexSorted = sorter.map(rowIndex);\n\t\t\t\tconst lastRowIndexSorted = sorter.map(lastRowIndex);\n\t\t\t\tif (rowIndexSorted != null && lastRowIndexSorted != null) {\n\t\t\t\t\tlet istart = lastRowIndexSorted + 1;\n\t\t\t\t\tlet iend = rowIndexSorted + 1;\n\t\t\t\t\tif (rowIndexSorted < lastRowIndexSorted) {\n\t\t\t\t\t\tistart = rowIndexSorted;\n\t\t\t\t\t\tiend = lastRowIndexSorted;\n\t\t\t\t\t}\n\t\t\t\t\tif (istart < iend) {\n\t\t\t\t\t\tconst rowIndices: number[] = [];\n\t\t\t\t\t\tconst indicesFiltered = filter.indices;\n\t\t\t\t\t\tconst indicesSorted = sorter.indices;\n\t\t\t\t\t\tif (indicesFiltered) {\n\t\t\t\t\t\t\tif (indicesSorted) {\n\t\t\t\t\t\t\t\tfor (let i = 0, imax = indicesFiltered.length; i < imax; ++i) {\n\t\t\t\t\t\t\t\t\tconst indexFiltered = indicesFiltered[i];\n\t\t\t\t\t\t\t\t\tif (istart <= indexFiltered && indexFiltered < iend) {\n\t\t\t\t\t\t\t\t\t\trowIndices.push(indicesSorted[indexFiltered]);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tfor (let i = 0, imax = indicesFiltered.length; i < imax; ++i) {\n\t\t\t\t\t\t\t\t\tconst indexFiltered = indicesFiltered[i];\n\t\t\t\t\t\t\t\t\tif (istart <= indexFiltered && indexFiltered < iend) {\n\t\t\t\t\t\t\t\t\t\trowIndices.push(indexFiltered);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tif (indicesSorted) {\n\t\t\t\t\t\t\t\tfor (let i = istart; i < iend; ++i) {\n\t\t\t\t\t\t\t\t\trowIndices.push(indicesSorted[i]);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tfor (let i = istart; i < iend; ++i) {\n\t\t\t\t\t\t\t\t\trowIndices.push(i);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tselection.addAll(rowIndices);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tonDblClick(\n\t\te: MouseEvent | TouchEvent,\n\t\tinteractionManager: interaction.InteractionManager\n\t): boolean {\n\t\treturn super.onDblClick(e, interactionManager);\n\t}\n\n\tprotected getType(): string {\n\t\treturn \"DTableBody\";\n\t}\n\n\tget data(): DATA {\n\t\treturn this._data;\n\t}\n}\n"]}
@@ -1,5 +1,5 @@
1
1
  /*
2
- Winter Cardinal UI v0.371.0
2
+ Winter Cardinal UI v0.372.0
3
3
  Copyright (C) 2019 Toshiba Corporation
4
4
  SPDX-License-Identifier: Apache-2.0
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*
2
- Winter Cardinal UI v0.371.0
2
+ Winter Cardinal UI v0.372.0
3
3
  Copyright (C) 2019 Toshiba Corporation
4
4
  SPDX-License-Identifier: Apache-2.0
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*
2
- Winter Cardinal UI v0.371.0
2
+ Winter Cardinal UI v0.372.0
3
3
  Copyright (C) 2019 Toshiba Corporation
4
4
  SPDX-License-Identifier: Apache-2.0
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*
2
- Winter Cardinal UI v0.371.0
2
+ Winter Cardinal UI v0.372.0
3
3
  Copyright (C) 2019 Toshiba Corporation
4
4
  SPDX-License-Identifier: Apache-2.0
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*
2
- Winter Cardinal UI v0.371.0
2
+ Winter Cardinal UI v0.372.0
3
3
  Copyright (C) 2019 Toshiba Corporation
4
4
  SPDX-License-Identifier: Apache-2.0
5
5
 
@@ -90726,12 +90726,27 @@ var DTableBody = /** @class */ (function (_super) {
90726
90726
  DApplications.update(this);
90727
90727
  return true;
90728
90728
  };
90729
- DTableBody.prototype.toRowIndexMapped = function (local) {
90730
- if (0 <= this.parent.position.y + local.y) {
90731
- return Math.floor(local.y / this._rowHeight);
90729
+ /**
90730
+ * Returns a mapped row index at the given local Y position or -1.
90731
+ *
90732
+ * @param localY a local Y position
90733
+ * @returns a mapped row index at the given local Y position or -1.
90734
+ */
90735
+ DTableBody.prototype.toRowIndexMapped = function (localY) {
90736
+ if (0 <= this.parent.position.y + localY) {
90737
+ var result = Math.floor(localY / this._rowHeight);
90738
+ if (0 <= result && result < this._data.mapped.size()) {
90739
+ return result;
90740
+ }
90732
90741
  }
90733
90742
  return -1;
90734
90743
  };
90744
+ /**
90745
+ * Returns a row at the given mapped row index or null if not exits.
90746
+ *
90747
+ * @param rowIndexMapped a mapped row index
90748
+ * @returns a row at the given mapped row index or null if not exists.
90749
+ */
90735
90750
  DTableBody.prototype.toRow = function (rowIndexMapped) {
90736
90751
  var index = rowIndexMapped - this._rowIndexMappedStart;
90737
90752
  var rows = this.children;
@@ -90740,14 +90755,22 @@ var DTableBody = /** @class */ (function (_super) {
90740
90755
  }
90741
90756
  return null;
90742
90757
  };
90743
- DTableBody.prototype.toCell = function (row, local) {
90758
+ /**
90759
+ * Returns a cell at the given local X position or null if not exits.
90760
+ * This method assumes the given local X position is on the given row.
90761
+ *
90762
+ * @param row a row
90763
+ * @param localX a local X position
90764
+ * @returns a cell at the given local X position or null if not exits
90765
+ */
90766
+ DTableBody.prototype.toCell = function (row, localX) {
90744
90767
  var cells = row.children;
90745
90768
  var cellsLength = cells.length;
90746
90769
  var columns = this._columns;
90747
90770
  var columnsLength = columns.length;
90748
90771
  for (var i = 0, imax = Math.min(cellsLength, columnsLength); i < imax; ++i) {
90749
90772
  var cell = cells[cellsLength - i - 1];
90750
- var x = local.x - cell.position.x;
90773
+ var x = localX - cell.position.x;
90751
90774
  if (0 <= x && x <= cell.width) {
90752
90775
  return cell;
90753
90776
  }
@@ -90759,12 +90782,12 @@ var DTableBody = /** @class */ (function (_super) {
90759
90782
  var local = DTableBody.WORK_ON_CLICK;
90760
90783
  local.copyFrom(e.data.global);
90761
90784
  this.toLocal(local, undefined, local, false);
90762
- var rowIndexMapped = this.toRowIndexMapped(local);
90763
- if (0 <= rowIndexMapped && rowIndexMapped < this._data.mapped.size()) {
90785
+ var rowIndexMapped = this.toRowIndexMapped(local.y);
90786
+ if (0 <= rowIndexMapped) {
90764
90787
  // Delegate to the cell at first
90765
90788
  var row = this.toRow(rowIndexMapped);
90766
90789
  if (row) {
90767
- var cell = this.toCell(row, local);
90790
+ var cell = this.toCell(row, local.x);
90768
90791
  if (cell && cell.onRowSelect && cell.onRowSelect(e, local)) {
90769
90792
  return;
90770
90793
  }
@@ -1,5 +1,5 @@
1
1
  /*
2
- Winter Cardinal UI v0.371.0
2
+ Winter Cardinal UI v0.372.0
3
3
  Copyright (C) 2019 Toshiba Corporation
4
4
  SPDX-License-Identifier: Apache-2.0
5
5
 
@@ -72151,12 +72151,27 @@
72151
72151
  DApplications.update(this);
72152
72152
  return true;
72153
72153
  };
72154
- DTableBody.prototype.toRowIndexMapped = function (local) {
72155
- if (0 <= this.parent.position.y + local.y) {
72156
- return Math.floor(local.y / this._rowHeight);
72154
+ /**
72155
+ * Returns a mapped row index at the given local Y position or -1.
72156
+ *
72157
+ * @param localY a local Y position
72158
+ * @returns a mapped row index at the given local Y position or -1.
72159
+ */
72160
+ DTableBody.prototype.toRowIndexMapped = function (localY) {
72161
+ if (0 <= this.parent.position.y + localY) {
72162
+ var result = Math.floor(localY / this._rowHeight);
72163
+ if (0 <= result && result < this._data.mapped.size()) {
72164
+ return result;
72165
+ }
72157
72166
  }
72158
72167
  return -1;
72159
72168
  };
72169
+ /**
72170
+ * Returns a row at the given mapped row index or null if not exits.
72171
+ *
72172
+ * @param rowIndexMapped a mapped row index
72173
+ * @returns a row at the given mapped row index or null if not exists.
72174
+ */
72160
72175
  DTableBody.prototype.toRow = function (rowIndexMapped) {
72161
72176
  var index = rowIndexMapped - this._rowIndexMappedStart;
72162
72177
  var rows = this.children;
@@ -72165,14 +72180,22 @@
72165
72180
  }
72166
72181
  return null;
72167
72182
  };
72168
- DTableBody.prototype.toCell = function (row, local) {
72183
+ /**
72184
+ * Returns a cell at the given local X position or null if not exits.
72185
+ * This method assumes the given local X position is on the given row.
72186
+ *
72187
+ * @param row a row
72188
+ * @param localX a local X position
72189
+ * @returns a cell at the given local X position or null if not exits
72190
+ */
72191
+ DTableBody.prototype.toCell = function (row, localX) {
72169
72192
  var cells = row.children;
72170
72193
  var cellsLength = cells.length;
72171
72194
  var columns = this._columns;
72172
72195
  var columnsLength = columns.length;
72173
72196
  for (var i = 0, imax = Math.min(cellsLength, columnsLength); i < imax; ++i) {
72174
72197
  var cell = cells[cellsLength - i - 1];
72175
- var x = local.x - cell.position.x;
72198
+ var x = localX - cell.position.x;
72176
72199
  if (0 <= x && x <= cell.width) {
72177
72200
  return cell;
72178
72201
  }
@@ -72184,12 +72207,12 @@
72184
72207
  var local = DTableBody.WORK_ON_CLICK;
72185
72208
  local.copyFrom(e.data.global);
72186
72209
  this.toLocal(local, undefined, local, false);
72187
- var rowIndexMapped = this.toRowIndexMapped(local);
72188
- if (0 <= rowIndexMapped && rowIndexMapped < this._data.mapped.size()) {
72210
+ var rowIndexMapped = this.toRowIndexMapped(local.y);
72211
+ if (0 <= rowIndexMapped) {
72189
72212
  // Delegate to the cell at first
72190
72213
  var row = this.toRow(rowIndexMapped);
72191
72214
  if (row) {
72192
- var cell = this.toCell(row, local);
72215
+ var cell = this.toCell(row, local.x);
72193
72216
  if (cell && cell.onRowSelect && cell.onRowSelect(e, local)) {
72194
72217
  return;
72195
72218
  }