@wcardinal/wcardinal-ui 0.395.0 → 0.396.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.
@@ -144,7 +144,13 @@ var DApplicationLayer = /** @class */ (function (_super) {
144
144
  };
145
145
  DApplicationLayer.prototype.onResize = function () {
146
146
  var options = this._options;
147
- var bbox = this._rootElement.getBoundingClientRect();
147
+ var bboxes = this._rootElement.getClientRects();
148
+ if (bboxes.length <= 0) {
149
+ // The root element size is (0, 0) and not visible.
150
+ // In this case, skip the resizing.
151
+ return;
152
+ }
153
+ var bbox = bboxes[0];
148
154
  var newWidth = options.isWidthFixed() ? options.getWidth() : bbox.width;
149
155
  var newHeight = options.isHeightFixed() ? options.getHeight() : bbox.height;
150
156
  this.renderer.resize(newWidth, newHeight);
@@ -1 +1 @@
1
- {"version":3,"file":"d-application-layer.js","sourceRoot":"","sources":["../../../src/main/typescript/wcardinal/ui/d-application-layer.ts"],"names":[],"mappings":"AAAA;;;GAGG;;AAEH,OAAO,EAAE,WAAW,EAAe,KAAK,EAAE,MAAM,SAAS,CAAC;AAI1D,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAEjC,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AACjE,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EAAE,cAAc,EAAwB,MAAM,yBAAyB,CAAC;AAS/E,IAAM,cAAc,GAAG,UAAC,MAAW;IAClC,OAAO,MAAM,IAAI,IAAI,IAAI,MAAM,CAAC,UAAU,IAAI,IAAI,CAAC;AACpD,CAAC,CAAC;AAMF,IAAM,WAAW,GAAG,UAAC,MAAW;IAC/B,OAAO,MAAM,IAAI,IAAI,IAAI,MAAM,CAAC,OAAO,IAAI,IAAI,CAAC;AACjD,CAAC,CAAC;AAEF;IAAuC,qCAAW;IA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D;QACD,OAAO,IAAI,CAAC,mBAAmB,CAAC;IACjC,CAAC;IACF,wBAAC;AAAD,CAAC,AA7TD,CAAuC,WAAW,GA6TjD","sourcesContent":["/*\n * Copyright (C) 2019 Toshiba Corporation\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { Application, interaction, Point } from \"pixi.js\";\nimport { DApplicationLayerLike } from \"./d-application-layer-like\";\nimport { DApplicationLayerOptions } from \"./d-application-layer-options\";\nimport { DApplicationLike } from \"./d-application-like\";\nimport { DBase } from \"./d-base\";\nimport { DControllerFocus, DFocusable, DFocusableContainer } from \"./d-controller-focus\";\nimport { DControllers } from \"./d-controllers\";\nimport { DPadding } from \"./d-padding\";\nimport { DynamicFontAtlases } from \"./util/dynamic-font-atlases\";\nimport { UtilPointerEvent } from \"./util/util-pointer-event\";\nimport { UtilWheelEvent, UtilWheelEventDeltas } from \"./util/util-wheel-event\";\n\ninterface DblClickable {\n\tonDblClick(\n\t\te: MouseEvent | TouchEvent,\n\t\tinteractionManager: interaction.InteractionManager\n\t): boolean;\n}\n\nconst isDblClickable = (target: any): target is DblClickable => {\n\treturn target != null && target.onDblClick != null;\n};\n\ninterface Wheelable {\n\tonWheel(e: WheelEvent, deltas: UtilWheelEventDeltas, global: Point): boolean;\n}\n\nconst isWheelable = (target: any): target is Wheelable => {\n\treturn target != null && target.onWheel != null;\n};\n\nexport class DApplicationLayer extends Application implements DApplicationLayerLike {\n\tprotected _options: DApplicationLayerOptions;\n\tprotected _renderId: number | null = null;\n\tprotected _renderBound: () => void;\n\tprotected _isLocked: boolean;\n\tprotected _isOverlay: boolean;\n\tprotected _reflowLimit: number;\n\tprotected _rootElement: HTMLElement;\n\tprotected _elementContainer: HTMLElement;\n\tprotected _padding: DPadding;\n\tprotected _dynamicFontAtlases: DynamicFontAtlases | null = null;\n\tprotected _isVisible: boolean;\n\n\treadonly application: DApplicationLike;\n\n\tconstructor(application: DApplicationLike, options: DApplicationLayerOptions) {\n\t\tsuper(options.getPixiApplicationOptions());\n\n\t\tthis._options = options;\n\t\tthis._isLocked = false;\n\t\tthis._isVisible = true;\n\t\tthis._isOverlay = options.isOverlay();\n\t\tthis._padding = options.getPadding();\n\t\tthis._rootElement = options.getRootElement();\n\t\tthis._reflowLimit = 5;\n\t\tthis._elementContainer = this.newElementContainer();\n\n\t\tthis.application = application;\n\n\t\tthis._renderBound = (): void => {\n\t\t\tif (this._renderId != null) {\n\t\t\t\tthis.render();\n\t\t\t}\n\t\t};\n\n\t\tthis.initStage();\n\t\tthis.initView();\n\t\tthis.initRootElement();\n\t\tthis.initFocusHandling();\n\t\tthis.initResizeHandling();\n\t\tthis.initWheelHandling();\n\t\tthis.initDoubleClickHandling();\n\t}\n\n\tprotected newElementContainer(): HTMLElement {\n\t\tconst result = document.createElement(\"div\");\n\t\tresult.setAttribute(\n\t\t\t\"style\",\n\t\t\t\"position: absolute; top: 0; left: 0; width: 0; height: 0;\" +\n\t\t\t\t\"margin: 0; padding: 0; outline: none;\"\n\t\t);\n\t\treturn result;\n\t}\n\n\tprotected initStage(): void {\n\t\tconst stage = this.stage;\n\t\t(stage as any).layer = this;\n\t\t(stage as any).application = this.application;\n\t\tstage.interactive = true;\n\t}\n\n\tprotected initView(): void {\n\t\tconst view = this.view;\n\t\tconst style = view.style;\n\t\tstyle.position = \"absolute\";\n\t\tstyle.top = \"0\";\n\t\tstyle.left = \"0\";\n\t\tstyle.width = \"100%\";\n\t\tstyle.height = \"100%\";\n\t\tstyle.display = \"block\";\n\t\tstyle.outline = \"none\";\n\t\t(style as any).webkitTapHighlightColor = \"rgba(255,255,255,0)\";\n\t\tstyle.webkitUserSelect = \"none\";\n\t\tstyle.setProperty(\"-khtml-user-select\", \"none\");\n\t\tstyle.setProperty(\"-moz-user-select\", \"none\");\n\t\tstyle.setProperty(\"-ms-user-select\", \"none\");\n\t\tstyle.userSelect = \"none\";\n\t}\n\n\tprotected initRootElement(): void {\n\t\tconst view = this.view;\n\t\tconst isOverlay = this._isOverlay;\n\t\tconst rootElement = this._rootElement;\n\t\tconst elementContainer = this._elementContainer;\n\n\t\t// Insert elements\n\t\tconst insertionPosition = isOverlay ? 2 : 0;\n\t\tconst children = rootElement.children;\n\t\tif (insertionPosition < children.length) {\n\t\t\tconst child = children[insertionPosition];\n\t\t\trootElement.insertBefore(view, child);\n\t\t\trootElement.insertBefore(elementContainer, child);\n\t\t} else {\n\t\t\trootElement.appendChild(view);\n\t\t\trootElement.appendChild(elementContainer);\n\t\t}\n\n\t\tif (isOverlay) {\n\t\t\tconst stage = this.stage;\n\t\t\tconst oldOnChildrenChange = (stage as any).onChildrenChange;\n\t\t\t(stage as any).onChildrenChange = (): void => {\n\t\t\t\tthis.onStageDirty();\n\t\t\t\toldOnChildrenChange.call(stage);\n\t\t\t};\n\t\t}\n\n\t\t// Init styles\n\t\tconst rootElementStyle = rootElement.style;\n\t\tif (rootElement !== document.body) {\n\t\t\tconst rootElementStylePosition = window.getComputedStyle(rootElement).position;\n\t\t\tif (rootElementStylePosition === \"static\") {\n\t\t\t\trootElementStyle.position = \"relative\";\n\t\t\t}\n\t\t}\n\t\trootElementStyle.margin = \"0\";\n\t\trootElementStyle.padding = \"0\";\n\t\trootElementStyle.overflow = \"hidden\";\n\t}\n\n\tprotected initFocusHandling(): void {\n\t\tconst view = this.view;\n\t\tconst stage = this.stage;\n\t\tconst focusController = this.getFocusController();\n\n\t\tview.setAttribute(\"tabindex\", \"0\");\n\n\t\tDControllers.getKeyboardController().init(view, stage, focusController);\n\n\t\tconst interactionManager = this.renderer.plugins.interaction;\n\t\tinteractionManager.on(UtilPointerEvent.down, (e: interaction.InteractionEvent): void => {\n\t\t\tif (e.target == null || e.target === stage) {\n\t\t\t\tfocusController.clear();\n\t\t\t}\n\t\t});\n\t}\n\n\tprotected initResizeHandling(): void {\n\t\tconst options = this._options;\n\t\tconst isWidthFixed = options.isWidthFixed();\n\t\tconst isHeightFixed = options.isHeightFixed();\n\t\tif (!isWidthFixed || !isHeightFixed) {\n\t\t\tconst onResizeBound = (): void => {\n\t\t\t\tthis.onResize();\n\t\t\t};\n\t\t\tif (window.ResizeObserver != null) {\n\t\t\t\tnew ResizeObserver(onResizeBound).observe(this._rootElement);\n\t\t\t} else {\n\t\t\t\twindow.addEventListener(\"resize\", onResizeBound);\n\t\t\t\twindow.addEventListener(\"orientationchange\", onResizeBound);\n\t\t\t}\n\t\t}\n\t}\n\n\tprotected onResize(): void {\n\t\tconst options = this._options;\n\t\tconst bbox = this._rootElement.getBoundingClientRect();\n\t\tconst newWidth = options.isWidthFixed() ? options.getWidth() : bbox.width;\n\t\tconst newHeight = options.isHeightFixed() ? options.getHeight() : bbox.height;\n\t\tthis.renderer.resize(newWidth, newHeight);\n\n\t\tconst padding = this._padding;\n\t\tconst children = this.stage.children;\n\t\tfor (let i = 0, imax = children.length; i < imax; ++i) {\n\t\t\tconst child = children[i];\n\t\t\tif (child instanceof DBase) {\n\t\t\t\tchild.onParentResize(newWidth, newHeight, padding);\n\t\t\t}\n\t\t}\n\n\t\tthis.update();\n\t}\n\n\tprotected initWheelHandling(): void {\n\t\tconst global = new Point();\n\t\tconst util = UtilWheelEvent.getInstance();\n\t\tconst interactionManager = this.renderer.plugins.interaction;\n\t\tutil.on(this.view, (e: WheelEvent | Event): void => {\n\t\t\tconst wheelEvent = e as WheelEvent;\n\t\t\tUtilPointerEvent.toGlobal(wheelEvent, interactionManager, global);\n\t\t\tlet current = interactionManager.hitTest(global);\n\t\t\tconst deltas = util.normalize(e);\n\t\t\tif (deltas != null) {\n\t\t\t\twhile (current != null) {\n\t\t\t\t\tif (isWheelable(current)) {\n\t\t\t\t\t\tif (current.onWheel(wheelEvent, deltas, global)) {\n\t\t\t\t\t\t\twheelEvent.preventDefault();\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tcurrent = current.parent;\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}\n\n\tprotected initDoubleClickHandling(): void {\n\t\tconst focusController = this.getFocusController();\n\t\tconst interactionManager = this.renderer.plugins.interaction;\n\t\tUtilPointerEvent.onDblClick(this.view, (e: MouseEvent | TouchEvent): void => {\n\t\t\tconst focused = focusController.get();\n\t\t\tif (focused != null) {\n\t\t\t\tlet current: DFocusable | DFocusableContainer | null = focused;\n\t\t\t\twhile (current != null) {\n\t\t\t\t\tif (isDblClickable(current)) {\n\t\t\t\t\t\tif (current.onDblClick(e, interactionManager)) {\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tcurrent = current.parent;\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}\n\n\tlock(): void {\n\t\tthis._isLocked = true;\n\t}\n\n\tunlock(): void {\n\t\tthis._isLocked = false;\n\t}\n\n\tupdate(): void {\n\t\tif (!this._isLocked && this._renderId == null) {\n\t\t\tthis._renderId = requestAnimationFrame(this._renderBound);\n\t\t}\n\t}\n\n\tprotected onStageDirty(): void {\n\t\t// Update the visibility if this is a overlay layer.\n\t\tif (this._isOverlay) {\n\t\t\tif (0 < this.stage.children.length) {\n\t\t\t\t// There are more than one children,\n\t\t\t\t// therefore must be visible.\n\t\t\t\tif (!this._isVisible) {\n\t\t\t\t\tthis._isVisible = true;\n\t\t\t\t\tthis.view.style.display = \"block\";\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// There is no child,\n\t\t\t\t// therefore must not be visible.\n\t\t\t\tif (this._isVisible) {\n\t\t\t\t\tthis._isVisible = false;\n\t\t\t\t\tthis.view.style.display = \"none\";\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\trender(): void {\n\t\tthis.reflow();\n\n\t\t// Please note why the following line is here.\n\t\t//\n\t\t// Before this line, the update method does not enque a rendering task\n\t\t// because `this._renderId` is not null. As a result, this prevents\n\t\t// an unintentional rendering loop caused by the refit or the reflow.\n\t\t//\n\t\t// After this line, the update method enques a rendering task.\n\t\t// Namely, in the DisplayObject#render(Renderer) method, allowed to enque\n\t\t// a rendering task. For instance, please refer to the DDiagramShape#update().\n\t\tthis._renderId = null;\n\n\t\t// Render\n\t\tsuper.render();\n\t}\n\n\tget width(): number {\n\t\treturn this.screen.width;\n\t}\n\n\tget height(): number {\n\t\treturn this.screen.height;\n\t}\n\n\tget padding(): DPadding {\n\t\treturn this._padding;\n\t}\n\n\treflow(): void {\n\t\tconst children = this.stage.children;\n\t\tfor (let ilimit = 0, limit = this._reflowLimit; ilimit < limit; ++ilimit) {\n\t\t\tlet isDirty = false;\n\t\t\tfor (let i = 0, imax = children.length; i < imax; ++i) {\n\t\t\t\tconst child = children[i];\n\t\t\t\tif (child instanceof DBase) {\n\t\t\t\t\tchild.reflow();\n\t\t\t\t\tisDirty =\n\t\t\t\t\t\tisDirty || child.isDirty() || child.hasDirty() || child.isHierarchyDirty();\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// If DBases are changed during the `reflow` process, need to reflow again.\n\t\t\tif (!isDirty) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\n\tgetFocusController(): DControllerFocus {\n\t\treturn this.application.getFocusController();\n\t}\n\n\tgetRootElement(): HTMLElement {\n\t\treturn this._rootElement;\n\t}\n\n\tgetElementContainer(): HTMLElement {\n\t\treturn this._elementContainer;\n\t}\n\n\tgetDynamicFontAtlases(): DynamicFontAtlases {\n\t\tif (this._dynamicFontAtlases == null) {\n\t\t\tthis._dynamicFontAtlases = new DynamicFontAtlases(this);\n\t\t}\n\t\treturn this._dynamicFontAtlases;\n\t}\n}\n"]}
1
+ {"version":3,"file":"d-application-layer.js","sourceRoot":"","sources":["../../../src/main/typescript/wcardinal/ui/d-application-layer.ts"],"names":[],"mappings":"AAAA;;;GAGG;;AAEH,OAAO,EAAE,WAAW,EAAe,KAAK,EAAE,MAAM,SAAS,CAAC;AAI1D,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAEjC,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,OAAO,EAAE,k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O,IAAI,KAAK,CAAC,OAAO,EAAE,IAAI,KAAK,CAAC,QAAQ,EAAE,IAAI,KAAK,CAAC,gBAAgB,EAAE,CAAC;iBAC5E;aACD;YAED,2EAA2E;YAC3E,IAAI,CAAC,OAAO,EAAE;gBACb,MAAM;aACN;SACD;IACF,CAAC;IAED,8CAAkB,GAAlB;QACC,OAAO,IAAI,CAAC,WAAW,CAAC,kBAAkB,EAAE,CAAC;IAC9C,CAAC;IAED,0CAAc,GAAd;QACC,OAAO,IAAI,CAAC,YAAY,CAAC;IAC1B,CAAC;IAED,+CAAmB,GAAnB;QACC,OAAO,IAAI,CAAC,iBAAiB,CAAC;IAC/B,CAAC;IAED,iDAAqB,GAArB;QACC,IAAI,IAAI,CAAC,mBAAmB,IAAI,IAAI,EAAE;YACrC,IAAI,CAAC,mBAAmB,GAAG,IAAI,kBAAkB,CAAC,IAAI,CAAC,CAAC;SACxD;QACD,OAAO,IAAI,CAAC,mBAAmB,CAAC;IACjC,CAAC;IACF,wBAAC;AAAD,CAAC,AAnUD,CAAuC,WAAW,GAmUjD","sourcesContent":["/*\n * Copyright (C) 2019 Toshiba Corporation\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { Application, interaction, Point } from \"pixi.js\";\nimport { DApplicationLayerLike } from \"./d-application-layer-like\";\nimport { DApplicationLayerOptions } from \"./d-application-layer-options\";\nimport { DApplicationLike } from \"./d-application-like\";\nimport { DBase } from \"./d-base\";\nimport { DControllerFocus, DFocusable, DFocusableContainer } from \"./d-controller-focus\";\nimport { DControllers } from \"./d-controllers\";\nimport { DPadding } from \"./d-padding\";\nimport { DynamicFontAtlases } from \"./util/dynamic-font-atlases\";\nimport { UtilPointerEvent } from \"./util/util-pointer-event\";\nimport { UtilWheelEvent, UtilWheelEventDeltas } from \"./util/util-wheel-event\";\n\ninterface DblClickable {\n\tonDblClick(\n\t\te: MouseEvent | TouchEvent,\n\t\tinteractionManager: interaction.InteractionManager\n\t): boolean;\n}\n\nconst isDblClickable = (target: any): target is DblClickable => {\n\treturn target != null && target.onDblClick != null;\n};\n\ninterface Wheelable {\n\tonWheel(e: WheelEvent, deltas: UtilWheelEventDeltas, global: Point): boolean;\n}\n\nconst isWheelable = (target: any): target is Wheelable => {\n\treturn target != null && target.onWheel != null;\n};\n\nexport class DApplicationLayer extends Application implements DApplicationLayerLike {\n\tprotected _options: DApplicationLayerOptions;\n\tprotected _renderId: number | null = null;\n\tprotected _renderBound: () => void;\n\tprotected _isLocked: boolean;\n\tprotected _isOverlay: boolean;\n\tprotected _reflowLimit: number;\n\tprotected _rootElement: HTMLElement;\n\tprotected _elementContainer: HTMLElement;\n\tprotected _padding: DPadding;\n\tprotected _dynamicFontAtlases: DynamicFontAtlases | null = null;\n\tprotected _isVisible: boolean;\n\n\treadonly application: DApplicationLike;\n\n\tconstructor(application: DApplicationLike, options: DApplicationLayerOptions) {\n\t\tsuper(options.getPixiApplicationOptions());\n\n\t\tthis._options = options;\n\t\tthis._isLocked = false;\n\t\tthis._isVisible = true;\n\t\tthis._isOverlay = options.isOverlay();\n\t\tthis._padding = options.getPadding();\n\t\tthis._rootElement = options.getRootElement();\n\t\tthis._reflowLimit = 5;\n\t\tthis._elementContainer = this.newElementContainer();\n\n\t\tthis.application = application;\n\n\t\tthis._renderBound = (): void => {\n\t\t\tif (this._renderId != null) {\n\t\t\t\tthis.render();\n\t\t\t}\n\t\t};\n\n\t\tthis.initStage();\n\t\tthis.initView();\n\t\tthis.initRootElement();\n\t\tthis.initFocusHandling();\n\t\tthis.initResizeHandling();\n\t\tthis.initWheelHandling();\n\t\tthis.initDoubleClickHandling();\n\t}\n\n\tprotected newElementContainer(): HTMLElement {\n\t\tconst result = document.createElement(\"div\");\n\t\tresult.setAttribute(\n\t\t\t\"style\",\n\t\t\t\"position: absolute; top: 0; left: 0; width: 0; height: 0;\" +\n\t\t\t\t\"margin: 0; padding: 0; outline: none;\"\n\t\t);\n\t\treturn result;\n\t}\n\n\tprotected initStage(): void {\n\t\tconst stage = this.stage;\n\t\t(stage as any).layer = this;\n\t\t(stage as any).application = this.application;\n\t\tstage.interactive = true;\n\t}\n\n\tprotected initView(): void {\n\t\tconst view = this.view;\n\t\tconst style = view.style;\n\t\tstyle.position = \"absolute\";\n\t\tstyle.top = \"0\";\n\t\tstyle.left = \"0\";\n\t\tstyle.width = \"100%\";\n\t\tstyle.height = \"100%\";\n\t\tstyle.display = \"block\";\n\t\tstyle.outline = \"none\";\n\t\t(style as any).webkitTapHighlightColor = \"rgba(255,255,255,0)\";\n\t\tstyle.webkitUserSelect = \"none\";\n\t\tstyle.setProperty(\"-khtml-user-select\", \"none\");\n\t\tstyle.setProperty(\"-moz-user-select\", \"none\");\n\t\tstyle.setProperty(\"-ms-user-select\", \"none\");\n\t\tstyle.userSelect = \"none\";\n\t}\n\n\tprotected initRootElement(): void {\n\t\tconst view = this.view;\n\t\tconst isOverlay = this._isOverlay;\n\t\tconst rootElement = this._rootElement;\n\t\tconst elementContainer = this._elementContainer;\n\n\t\t// Insert elements\n\t\tconst insertionPosition = isOverlay ? 2 : 0;\n\t\tconst children = rootElement.children;\n\t\tif (insertionPosition < children.length) {\n\t\t\tconst child = children[insertionPosition];\n\t\t\trootElement.insertBefore(view, child);\n\t\t\trootElement.insertBefore(elementContainer, child);\n\t\t} else {\n\t\t\trootElement.appendChild(view);\n\t\t\trootElement.appendChild(elementContainer);\n\t\t}\n\n\t\tif (isOverlay) {\n\t\t\tconst stage = this.stage;\n\t\t\tconst oldOnChildrenChange = (stage as any).onChildrenChange;\n\t\t\t(stage as any).onChildrenChange = (): void => {\n\t\t\t\tthis.onStageDirty();\n\t\t\t\toldOnChildrenChange.call(stage);\n\t\t\t};\n\t\t}\n\n\t\t// Init styles\n\t\tconst rootElementStyle = rootElement.style;\n\t\tif (rootElement !== document.body) {\n\t\t\tconst rootElementStylePosition = window.getComputedStyle(rootElement).position;\n\t\t\tif (rootElementStylePosition === \"static\") {\n\t\t\t\trootElementStyle.position = \"relative\";\n\t\t\t}\n\t\t}\n\t\trootElementStyle.margin = \"0\";\n\t\trootElementStyle.padding = \"0\";\n\t\trootElementStyle.overflow = \"hidden\";\n\t}\n\n\tprotected initFocusHandling(): void {\n\t\tconst view = this.view;\n\t\tconst stage = this.stage;\n\t\tconst focusController = this.getFocusController();\n\n\t\tview.setAttribute(\"tabindex\", \"0\");\n\n\t\tDControllers.getKeyboardController().init(view, stage, focusController);\n\n\t\tconst interactionManager = this.renderer.plugins.interaction;\n\t\tinteractionManager.on(UtilPointerEvent.down, (e: interaction.InteractionEvent): void => {\n\t\t\tif (e.target == null || e.target === stage) {\n\t\t\t\tfocusController.clear();\n\t\t\t}\n\t\t});\n\t}\n\n\tprotected initResizeHandling(): void {\n\t\tconst options = this._options;\n\t\tconst isWidthFixed = options.isWidthFixed();\n\t\tconst isHeightFixed = options.isHeightFixed();\n\t\tif (!isWidthFixed || !isHeightFixed) {\n\t\t\tconst onResizeBound = (): void => {\n\t\t\t\tthis.onResize();\n\t\t\t};\n\t\t\tif (window.ResizeObserver != null) {\n\t\t\t\tnew ResizeObserver(onResizeBound).observe(this._rootElement);\n\t\t\t} else {\n\t\t\t\twindow.addEventListener(\"resize\", onResizeBound);\n\t\t\t\twindow.addEventListener(\"orientationchange\", onResizeBound);\n\t\t\t}\n\t\t}\n\t}\n\n\tprotected onResize(): void {\n\t\tconst options = this._options;\n\t\tconst bboxes = this._rootElement.getClientRects();\n\t\tif (bboxes.length <= 0) {\n\t\t\t// The root element size is (0, 0) and not visible.\n\t\t\t// In this case, skip the resizing.\n\t\t\treturn;\n\t\t}\n\t\tconst bbox = bboxes[0];\n\t\tconst newWidth = options.isWidthFixed() ? options.getWidth() : bbox.width;\n\t\tconst newHeight = options.isHeightFixed() ? options.getHeight() : bbox.height;\n\t\tthis.renderer.resize(newWidth, newHeight);\n\n\t\tconst padding = this._padding;\n\t\tconst children = this.stage.children;\n\t\tfor (let i = 0, imax = children.length; i < imax; ++i) {\n\t\t\tconst child = children[i];\n\t\t\tif (child instanceof DBase) {\n\t\t\t\tchild.onParentResize(newWidth, newHeight, padding);\n\t\t\t}\n\t\t}\n\n\t\tthis.update();\n\t}\n\n\tprotected initWheelHandling(): void {\n\t\tconst global = new Point();\n\t\tconst util = UtilWheelEvent.getInstance();\n\t\tconst interactionManager = this.renderer.plugins.interaction;\n\t\tutil.on(this.view, (e: WheelEvent | Event): void => {\n\t\t\tconst wheelEvent = e as WheelEvent;\n\t\t\tUtilPointerEvent.toGlobal(wheelEvent, interactionManager, global);\n\t\t\tlet current = interactionManager.hitTest(global);\n\t\t\tconst deltas = util.normalize(e);\n\t\t\tif (deltas != null) {\n\t\t\t\twhile (current != null) {\n\t\t\t\t\tif (isWheelable(current)) {\n\t\t\t\t\t\tif (current.onWheel(wheelEvent, deltas, global)) {\n\t\t\t\t\t\t\twheelEvent.preventDefault();\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tcurrent = current.parent;\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}\n\n\tprotected initDoubleClickHandling(): void {\n\t\tconst focusController = this.getFocusController();\n\t\tconst interactionManager = this.renderer.plugins.interaction;\n\t\tUtilPointerEvent.onDblClick(this.view, (e: MouseEvent | TouchEvent): void => {\n\t\t\tconst focused = focusController.get();\n\t\t\tif (focused != null) {\n\t\t\t\tlet current: DFocusable | DFocusableContainer | null = focused;\n\t\t\t\twhile (current != null) {\n\t\t\t\t\tif (isDblClickable(current)) {\n\t\t\t\t\t\tif (current.onDblClick(e, interactionManager)) {\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tcurrent = current.parent;\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}\n\n\tlock(): void {\n\t\tthis._isLocked = true;\n\t}\n\n\tunlock(): void {\n\t\tthis._isLocked = false;\n\t}\n\n\tupdate(): void {\n\t\tif (!this._isLocked && this._renderId == null) {\n\t\t\tthis._renderId = requestAnimationFrame(this._renderBound);\n\t\t}\n\t}\n\n\tprotected onStageDirty(): void {\n\t\t// Update the visibility if this is a overlay layer.\n\t\tif (this._isOverlay) {\n\t\t\tif (0 < this.stage.children.length) {\n\t\t\t\t// There are more than one children,\n\t\t\t\t// therefore must be visible.\n\t\t\t\tif (!this._isVisible) {\n\t\t\t\t\tthis._isVisible = true;\n\t\t\t\t\tthis.view.style.display = \"block\";\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// There is no child,\n\t\t\t\t// therefore must not be visible.\n\t\t\t\tif (this._isVisible) {\n\t\t\t\t\tthis._isVisible = false;\n\t\t\t\t\tthis.view.style.display = \"none\";\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\trender(): void {\n\t\tthis.reflow();\n\n\t\t// Please note why the following line is here.\n\t\t//\n\t\t// Before this line, the update method does not enque a rendering task\n\t\t// because `this._renderId` is not null. As a result, this prevents\n\t\t// an unintentional rendering loop caused by the refit or the reflow.\n\t\t//\n\t\t// After this line, the update method enques a rendering task.\n\t\t// Namely, in the DisplayObject#render(Renderer) method, allowed to enque\n\t\t// a rendering task. For instance, please refer to the DDiagramShape#update().\n\t\tthis._renderId = null;\n\n\t\t// Render\n\t\tsuper.render();\n\t}\n\n\tget width(): number {\n\t\treturn this.screen.width;\n\t}\n\n\tget height(): number {\n\t\treturn this.screen.height;\n\t}\n\n\tget padding(): DPadding {\n\t\treturn this._padding;\n\t}\n\n\treflow(): void {\n\t\tconst children = this.stage.children;\n\t\tfor (let ilimit = 0, limit = this._reflowLimit; ilimit < limit; ++ilimit) {\n\t\t\tlet isDirty = false;\n\t\t\tfor (let i = 0, imax = children.length; i < imax; ++i) {\n\t\t\t\tconst child = children[i];\n\t\t\t\tif (child instanceof DBase) {\n\t\t\t\t\tchild.reflow();\n\t\t\t\t\tisDirty =\n\t\t\t\t\t\tisDirty || child.isDirty() || child.hasDirty() || child.isHierarchyDirty();\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// If DBases are changed during the `reflow` process, need to reflow again.\n\t\t\tif (!isDirty) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\n\tgetFocusController(): DControllerFocus {\n\t\treturn this.application.getFocusController();\n\t}\n\n\tgetRootElement(): HTMLElement {\n\t\treturn this._rootElement;\n\t}\n\n\tgetElementContainer(): HTMLElement {\n\t\treturn this._elementContainer;\n\t}\n\n\tgetDynamicFontAtlases(): DynamicFontAtlases {\n\t\tif (this._dynamicFontAtlases == null) {\n\t\t\tthis._dynamicFontAtlases = new DynamicFontAtlases(this);\n\t\t}\n\t\treturn this._dynamicFontAtlases;\n\t}\n}\n"]}
@@ -143,7 +143,7 @@ var DItemUpdater = /** @class */ (function () {
143
143
  newItemIndexEnd += 1;
144
144
  }
145
145
  var newItemCount = newItemIndexEnd - newItemIndexStart;
146
- if (newItemCount < oldItemCount && oldItemCount - 2 <= newItemCount) {
146
+ if (newItemCount < oldItemCount) {
147
147
  newItemCount = oldItemCount;
148
148
  newItemIndexEnd = newItemIndexStart + newItemCount;
149
149
  }
@@ -1 +1 @@
1
- {"version":3,"file":"d-item-updater.js","sourceRoot":"","sources":["../../../src/main/typescript/wcardinal/ui/d-item-updater.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AACjC,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AA8C/D;;;;GAIG;AACH;IAsBC,sBAAY,IAAU,EAAE,OAAc,EAAE,SAAgB,EAAE,OAAiB;QAC1E,IAAI,CAAC,iBAAiB,GAAG,CAAC,CAAC;QAC3B,IAAI,CAAC,oBAAoB,GAAG,KAAK,CAAC;QAClC,IAAI,CAAC,4BAA4B,GAAG,KAAK,CAAC;QAC1C,IAAI,CAAC,WAAW,GAAG,CAAC,CAAC,CA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AAnYD,IAmYC","sourcesContent":["/*\n * Copyright (C) 2019 Toshiba Corporation\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { DApplications } from \"./d-applications\";\nimport { DBase } from \"./d-base\";\nimport { isNumber } from \"./util/is-number\";\nimport { UtilKeyboardEvent } from \"./util/util-keyboard-event\";\n\nexport interface DItemUpdaterItem<VALUE> extends DBase {\n\treadonly value?: VALUE;\n\treadonly index?: number;\n\tset(value: VALUE, index: number, forcibly?: boolean): void;\n\tunset(): void;\n}\n\nexport type DItemUpdaterNewItem<DATA, ITEM> = (data: DATA) => ITEM;\n\nexport type DItemUpdaterInitItem<DATA, ITEM> = (item: ITEM, index: number, data: DATA) => ITEM;\n\n/**\n * Item updater options.\n */\nexport interface DItemUpdaterOptions<VALUE, DATA, ITEM> {\n\t/**\n\t * Called to create items.\n\t */\n\tnewItem?: DItemUpdaterNewItem<DATA, ITEM>;\n\n\t/**\n\t * Called to initialize items.\n\t */\n\tinitItem?: DItemUpdaterInitItem<DATA, ITEM>;\n\n\t/**\n\t * True to make stripe-colored items. Defaults to true.\n\t */\n\tstripe?: boolean;\n}\n\nexport interface DItemUpdaterDataSelection<VALUE> {\n\tcontains(value: VALUE): boolean;\n}\n\nexport interface DItemUpdaterDataMapped<VALUE> {\n\tsize(): number;\n\teach(iteratee: (value: VALUE, index: number) => void | boolean, from: number, to: number): void;\n}\n\nexport interface DItemUpdaterData<VALUE> {\n\treadonly selection: DItemUpdaterDataSelection<VALUE>;\n}\n\n/**\n * The primary purpose of this class is to minimize the number of rendered items (e.g., {@link DListItem})\n * as low as possible and to update their positions and states. For this sake, the updater calculates the\n * required number of items whenever their container size changes and creates items if needed.\n */\nexport abstract class DItemUpdater<\n\tVALUE = unknown,\n\tDATA extends DItemUpdaterData<VALUE> = DItemUpdaterData<VALUE>,\n\tDATA_MAPPED extends DItemUpdaterDataMapped<VALUE> = DItemUpdaterDataMapped<VALUE>,\n\tITEM extends DItemUpdaterItem<VALUE> = DItemUpdaterItem<VALUE>,\n\tOPTIONS extends DItemUpdaterOptions<VALUE, DATA, ITEM> = DItemUpdaterOptions<VALUE, DATA, ITEM>\n> {\n\tprotected _updateItemsCount: number;\n\tprotected _isUpdateItemsCalled: boolean;\n\tprotected _isUpdateItemsCalledForcibly: boolean;\n\tprotected _itemHeight: number;\n\tprotected _itemWidth: number;\n\tprotected _multiplicity: number;\n\tprotected _itemIndexStart: number;\n\tprotected _itemIndexEnd: number;\n\tprotected _workItems: ITEM[];\n\tprotected _data: DATA;\n\tprotected _content: DBase;\n\tprotected _container: DBase;\n\tprotected _newItem: DItemUpdaterNewItem<DATA, ITEM>;\n\tprotected _initItem: DItemUpdaterInitItem<DATA, ITEM>;\n\n\tconstructor(data: DATA, content: DBase, container: DBase, options?: OPTIONS) {\n\t\tthis._updateItemsCount = 0;\n\t\tthis._isUpdateItemsCalled = false;\n\t\tthis._isUpdateItemsCalledForcibly = false;\n\t\tthis._itemHeight = -1;\n\t\tthis._itemWidth = -1;\n\t\tthis._multiplicity = 1;\n\t\tthis._itemIndexStart = 0;\n\t\tthis._itemIndexEnd = 0;\n\t\tthis._workItems = [];\n\t\tthis._data = data;\n\t\tthis._content = content;\n\t\tthis._container = container;\n\t\tthis._newItem = this.toNewItem(options);\n\t\tthis._initItem = this.toInitItem(options);\n\t}\n\n\tprotected toNewItem(\n\t\toptions?: DItemUpdaterOptions<VALUE, DATA, ITEM>\n\t): DItemUpdaterNewItem<DATA, ITEM> {\n\t\treturn options?.newItem || this.newItem;\n\t}\n\n\tprotected abstract newItem(this: undefined, data: DATA): ITEM;\n\n\tprotected toInitItem(\n\t\toptions?: DItemUpdaterOptions<VALUE, DATA, ITEM>\n\t): DItemUpdaterInitItem<DATA, ITEM> {\n\t\tif (options) {\n\t\t\tconst initItem = options.initItem;\n\t\t\tif (initItem) {\n\t\t\t\treturn initItem;\n\t\t\t}\n\t\t\tif (options.stripe !== false) {\n\t\t\t\treturn this.initItem;\n\t\t\t}\n\t\t\treturn this.initItemNoStriping;\n\t\t}\n\t\treturn this.initItem;\n\t}\n\n\tprotected initItem(this: undefined, item: ITEM, index: number, data: DATA): ITEM {\n\t\titem.state.isAlternated = index % 2 === 1;\n\t\treturn item;\n\t}\n\n\tprotected initItemNoStriping(this: undefined, item: ITEM, index: number, data: DATA): ITEM {\n\t\treturn item;\n\t}\n\n\tget multiplicity(): number {\n\t\treturn this._multiplicity;\n\t}\n\n\tlock(): void {\n\t\tthis._updateItemsCount += 1;\n\t\tif (this._updateItemsCount === 1) {\n\t\t\tthis._isUpdateItemsCalled = false;\n\t\t\tthis._isUpdateItemsCalledForcibly = false;\n\t\t}\n\t}\n\n\tunlock(callIfNeeded: boolean): void {\n\t\tthis._updateItemsCount -= 1;\n\t\tif (this._updateItemsCount === 0) {\n\t\t\tif (callIfNeeded && this._isUpdateItemsCalled) {\n\t\t\t\tthis.update(this._isUpdateItemsCalledForcibly);\n\t\t\t}\n\t\t\tthis._isUpdateItemsCalled = false;\n\t\t\tthis._isUpdateItemsCalledForcibly = false;\n\t\t}\n\t}\n\n\tupdate(forcibly?: boolean): void {\n\t\tif (0 < this._updateItemsCount) {\n\t\t\tthis._isUpdateItemsCalled = true;\n\t\t\tif (forcibly) {\n\t\t\t\tthis._isUpdateItemsCalledForcibly = true;\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\t\tconst content = this._content;\n\t\tconst contentParent = content.parent;\n\t\tif (contentParent == null) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst container = this._container;\n\t\tconst items = container.children as ITEM[];\n\t\tconst height = contentParent.height;\n\n\t\tconst data = this._data;\n\t\tconst mapped = this.toMapped(data);\n\t\tconst dataSize = mapped.size();\n\n\t\tconst oldItemIndexStart = this._itemIndexStart;\n\t\tlet oldItemIndexEnd = this._itemIndexEnd;\n\t\tlet oldItemCount = oldItemIndexEnd - oldItemIndexStart;\n\n\t\tconst newItem = this._newItem;\n\t\tconst initItem = this._initItem;\n\t\tlet itemHeight = this._itemHeight;\n\t\tlet itemWidth = this._itemWidth;\n\t\tif (this._itemHeight < 0) {\n\t\t\tlet item: ITEM;\n\t\t\tif (0 < items.length) {\n\t\t\t\titem = items[0];\n\t\t\t} else {\n\t\t\t\titem = initItem(newItem(data), oldItemIndexStart, data);\n\t\t\t\tcontainer.addChild(item);\n\t\t\t\toldItemIndexEnd += 1;\n\t\t\t\toldItemCount += 1;\n\t\t\t}\n\t\t\titemHeight = Math.max(1, item.height);\n\t\t\tif (isNumber(item.getWidth())) {\n\t\t\t\titemWidth = Math.max(1, item.width);\n\t\t\t}\n\t\t\tthis._itemHeight = itemHeight;\n\t\t\tthis._itemWidth = itemWidth;\n\t\t}\n\t\tconst contentPadding = content.padding;\n\t\tconst contentPaddingTop = contentPadding.getTop();\n\t\tconst contentPaddingBottom = contentPadding.getBottom();\n\t\tconst contentPaddingLeft = contentPadding.getLeft();\n\t\tconst contentPaddingRight = contentPadding.getRight();\n\t\tconst contentWidthAvailable = Math.max(\n\t\t\t0,\n\t\t\tcontent.width - contentPaddingLeft - contentPaddingRight\n\t\t);\n\t\tconst multiplicity =\n\t\t\t0 < itemWidth ? Math.max(1, Math.floor(contentWidthAvailable / itemWidth)) : 1;\n\t\tthis._multiplicity = multiplicity;\n\n\t\tconst y = content !== container ? container.transform.position.y : contentPaddingTop;\n\t\tconst newHeight = Math.ceil(dataSize / multiplicity) * itemHeight;\n\t\tconst newContentHeight = Math.max(\n\t\t\theight,\n\t\t\tcontentPaddingTop + newHeight + contentPaddingBottom\n\t\t);\n\t\tconst newContentY = Math.max(height - newContentHeight, content.position.y);\n\n\t\tconst newItemIndexLowerBound = Math.floor(\n\t\t\t((0 - (newContentY + y)) * multiplicity) / itemHeight\n\t\t);\n\t\tconst newItemIndexUpperBound = Math.floor(\n\t\t\t((height - (newContentY + y)) * multiplicity) / itemHeight\n\t\t);\n\t\tlet newItemIndexStart = newItemIndexLowerBound - multiplicity;\n\t\tif (newItemIndexStart % 2 !== 0) {\n\t\t\tnewItemIndexStart -= 1;\n\t\t}\n\t\tlet newItemIndexEnd = newItemIndexUpperBound + multiplicity + multiplicity;\n\t\tif (newItemIndexEnd % 2 !== 0) {\n\t\t\tnewItemIndexEnd += 1;\n\t\t}\n\t\tlet newItemCount = newItemIndexEnd - newItemIndexStart;\n\t\tif (newItemCount < oldItemCount && oldItemCount - 2 <= newItemCount) {\n\t\t\tnewItemCount = oldItemCount;\n\t\t\tnewItemIndexEnd = newItemIndexStart + newItemCount;\n\t\t}\n\n\t\tif (oldItemCount < newItemCount) {\n\t\t\tfor (let i = oldItemCount; i < newItemCount; ++i) {\n\t\t\t\tconst oldItemIndex = oldItemIndexStart + i;\n\t\t\t\tconst item = initItem(newItem(data), oldItemIndex, data);\n\t\t\t\tcontainer.addChild(item);\n\t\t\t}\n\t\t\toldItemCount = newItemCount;\n\t\t\toldItemIndexEnd = oldItemIndexStart + oldItemCount;\n\t\t} else if (newItemCount < oldItemCount) {\n\t\t\tfor (let i = oldItemCount - 1; newItemCount <= i; --i) {\n\t\t\t\tcontainer.removeChild(items[i]);\n\t\t\t}\n\t\t\toldItemCount = newItemCount;\n\t\t\toldItemIndexEnd = oldItemIndexStart + oldItemCount;\n\t\t}\n\n\t\tthis._itemIndexStart = newItemIndexStart;\n\t\tthis._itemIndexEnd = newItemIndexEnd;\n\n\t\tconst itemIndexStartDelta = newItemIndexStart - oldItemIndexStart;\n\t\tconst itemIndexStartDeltaAbs = Math.abs(itemIndexStartDelta);\n\t\tconst itemsLength = items.length;\n\t\tif (0 < itemIndexStartDeltaAbs && itemIndexStartDeltaAbs < itemsLength) {\n\t\t\tconst work = this._workItems;\n\t\t\tif (0 < itemIndexStartDelta) {\n\t\t\t\tfor (let i = 0; i < itemIndexStartDeltaAbs; ++i) {\n\t\t\t\t\tconst item = items[i];\n\t\t\t\t\tthis.reset(item);\n\t\t\t\t\twork.push(item);\n\t\t\t\t}\n\t\t\t\tfor (let i = itemIndexStartDeltaAbs; i < itemsLength; ++i) {\n\t\t\t\t\titems[i - itemIndexStartDeltaAbs] = items[i];\n\t\t\t\t}\n\t\t\t\tfor (let i = 0; i < itemIndexStartDeltaAbs; ++i) {\n\t\t\t\t\titems[itemsLength - itemIndexStartDeltaAbs + i] = work[i];\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tfor (let i = 0; i < itemIndexStartDeltaAbs; ++i) {\n\t\t\t\t\tconst item = items[itemsLength - itemIndexStartDeltaAbs + i];\n\t\t\t\t\tthis.reset(item);\n\t\t\t\t\twork.push(item);\n\t\t\t\t}\n\t\t\t\tfor (let i = itemsLength - itemIndexStartDeltaAbs - 1; 0 <= i; --i) {\n\t\t\t\t\titems[i + itemIndexStartDeltaAbs] = items[i];\n\t\t\t\t}\n\t\t\t\tfor (let i = 0; i < itemIndexStartDeltaAbs; ++i) {\n\t\t\t\t\titems[i] = work[i];\n\t\t\t\t}\n\t\t\t}\n\t\t\twork.length = 0;\n\t\t}\n\n\t\tlet itemOffsetX = 0;\n\t\tlet itemOffsetY = 0;\n\t\tif (content === container) {\n\t\t\titemOffsetX = contentPaddingLeft;\n\t\t\titemOffsetY = contentPaddingTop;\n\t\t}\n\t\tmapped.each(\n\t\t\t(datum: VALUE, index: number): void | boolean => {\n\t\t\t\tconst item = items[index - newItemIndexStart];\n\t\t\t\tconst ix = index % multiplicity;\n\t\t\t\tconst iy = Math.floor(index / multiplicity);\n\t\t\t\titem.position.set(itemOffsetX + ix * itemWidth, itemOffsetY + iy * itemHeight);\n\t\t\t\tthis.set(item, datum, index, forcibly);\n\t\t\t},\n\t\t\tnewItemIndexStart,\n\t\t\tnewItemIndexStart + itemsLength\n\t\t);\n\n\t\tfor (let i = 0; newItemIndexStart + i < 0 && i < itemsLength; ++i) {\n\t\t\tconst item = items[i];\n\t\t\tconst index = newItemIndexStart + i;\n\t\t\tconst ix = index % multiplicity;\n\t\t\tconst iy = Math.floor(index / multiplicity);\n\t\t\titem.position.set(itemOffsetX + ix * itemWidth, itemOffsetY + iy * itemHeight);\n\t\t\tthis.unset(item);\n\t\t}\n\n\t\tfor (let i = itemsLength - 1; dataSize <= newItemIndexStart + i && 0 <= i; --i) {\n\t\t\tconst item = items[i];\n\t\t\tconst index = newItemIndexStart + i;\n\t\t\tconst ix = index % multiplicity;\n\t\t\tconst iy = Math.floor(index / multiplicity);\n\t\t\titem.position.set(itemOffsetX + ix * itemWidth, itemOffsetY + iy * itemHeight);\n\t\t\tthis.unset(item);\n\t\t}\n\n\t\tthis.lock();\n\t\tcontent.position.y = newContentY;\n\t\tcontent.height = newContentHeight;\n\t\tif (content !== container) {\n\t\t\tcontainer.height = newHeight;\n\t\t}\n\t\tthis.unlock(false);\n\t}\n\n\tprotected abstract toMapped(data: DATA): DATA_MAPPED;\n\n\tprotected set(item: ITEM, value: VALUE, index: number, forcibly?: boolean): void {\n\t\titem.set(value, index, forcibly);\n\t}\n\n\tprotected unset(item: ITEM): void {\n\t\titem.unset();\n\t}\n\n\tprotected reset(item: ITEM): ITEM {\n\t\titem.blur(true);\n\t\tconst cells = item.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\tconst state = cell.state;\n\t\t\t\tstate.lock();\n\t\t\t\tstate.isPressed = false;\n\t\t\t\tstate.isHovered = false;\n\t\t\t\tstate.unlock();\n\t\t\t}\n\t\t}\n\t\titem.state.isHovered = false;\n\t\treturn item;\n\t}\n\n\tmoveFocus(\n\t\te: KeyboardEvent,\n\t\ttarget: DBase,\n\t\tmoveVertically: boolean,\n\t\tmoveHorizontally: boolean\n\t): boolean {\n\t\tif (!(moveVertically || moveHorizontally)) {\n\t\t\treturn false;\n\t\t}\n\t\tconst isUp = moveVertically && UtilKeyboardEvent.isArrowUpKey(e);\n\t\tconst isDown = moveVertically && UtilKeyboardEvent.isArrowDownKey(e);\n\t\tconst isLeft = moveHorizontally && UtilKeyboardEvent.isArrowLeftKey(e);\n\t\tconst isRight = moveHorizontally && UtilKeyboardEvent.isArrowRightKey(e);\n\t\tif (!(isUp || isDown || isLeft || isRight)) {\n\t\t\treturn false;\n\t\t}\n\t\tif (!target.state.isActionable) {\n\t\t\treturn false;\n\t\t}\n\t\tconst layer = DApplications.getLayer(target);\n\t\tif (layer == null) {\n\t\t\treturn false;\n\t\t}\n\t\tconst focusController = layer.getFocusController();\n\t\tconst focused = focusController.get();\n\t\tif (focused == null) {\n\t\t\treturn false;\n\t\t}\n\t\tconst container = this._container;\n\t\tif (focused.parent !== container) {\n\t\t\treturn false;\n\t\t}\n\t\tconst item = focused as ITEM;\n\t\tconst index = item.index;\n\t\tif (index == null) {\n\t\t\treturn false;\n\t\t}\n\t\tconst multiplicity = this._multiplicity;\n\t\tconst data = this._data;\n\t\tconst mapped = this.toMapped(data);\n\t\tconst dataSize = mapped.size();\n\t\tlet newIndex = index;\n\t\tif (isLeft || isRight) {\n\t\t\tif (isLeft) {\n\t\t\t\tif (0 <= newIndex - 1) {\n\t\t\t\t\tnewIndex -= 1;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif (newIndex + 1 < dataSize) {\n\t\t\t\t\tnewIndex += 1;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif (isUp || isDown) {\n\t\t\tif (isUp) {\n\t\t\t\tif (0 <= newIndex - multiplicity) {\n\t\t\t\t\tnewIndex -= multiplicity;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif (newIndex + multiplicity < dataSize) {\n\t\t\t\t\tnewIndex += multiplicity;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif (newIndex === index) {\n\t\t\treturn false;\n\t\t}\n\t\tconst items = container.children as ITEM[];\n\t\tconst itemIndex = items.indexOf(item);\n\t\tif (itemIndex < 0) {\n\t\t\treturn false;\n\t\t}\n\t\tconst newItemIndex = itemIndex + (newIndex - index);\n\t\tif (newItemIndex < 0 || items.length <= newItemIndex) {\n\t\t\treturn false;\n\t\t}\n\t\tconst newItem = items[newItemIndex];\n\t\tfocusController.focus(newItem);\n\t\tretur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AAK,KAAK,EAAE;YACvB,OAAO,KAAK,CAAC;SACb;QACD,IAAM,KAAK,GAAG,SAAS,CAAC,QAAkB,CAAC;QAC3C,IAAM,SAAS,GAAG,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QACtC,IAAI,SAAS,GAAG,CAAC,EAAE;YAClB,OAAO,KAAK,CAAC;SACb;QACD,IAAM,YAAY,GAAG,SAAS,GAAG,CAAC,QAAQ,GAAG,KAAK,CAAC,CAAC;QACpD,IAAI,YAAY,GAAG,CAAC,IAAI,KAAK,CAAC,MAAM,IAAI,YAAY,EAAE;YACrD,OAAO,KAAK,CAAC;SACb;QACD,IAAM,OAAO,GAAG,KAAK,CAAC,YAAY,CAAC,CAAC;QACpC,eAAe,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QAC/B,OAAO,IAAI,CAAC;IACb,CAAC;IACF,mBAAC;AAAD,CAAC,AAnYD,IAmYC","sourcesContent":["/*\n * Copyright (C) 2019 Toshiba Corporation\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { DApplications } from \"./d-applications\";\nimport { DBase } from \"./d-base\";\nimport { isNumber } from \"./util/is-number\";\nimport { UtilKeyboardEvent } from \"./util/util-keyboard-event\";\n\nexport interface DItemUpdaterItem<VALUE> extends DBase {\n\treadonly value?: VALUE;\n\treadonly index?: number;\n\tset(value: VALUE, index: number, forcibly?: boolean): void;\n\tunset(): void;\n}\n\nexport type DItemUpdaterNewItem<DATA, ITEM> = (data: DATA) => ITEM;\n\nexport type DItemUpdaterInitItem<DATA, ITEM> = (item: ITEM, index: number, data: DATA) => ITEM;\n\n/**\n * Item updater options.\n */\nexport interface DItemUpdaterOptions<VALUE, DATA, ITEM> {\n\t/**\n\t * Called to create items.\n\t */\n\tnewItem?: DItemUpdaterNewItem<DATA, ITEM>;\n\n\t/**\n\t * Called to initialize items.\n\t */\n\tinitItem?: DItemUpdaterInitItem<DATA, ITEM>;\n\n\t/**\n\t * True to make stripe-colored items. Defaults to true.\n\t */\n\tstripe?: boolean;\n}\n\nexport interface DItemUpdaterDataSelection<VALUE> {\n\tcontains(value: VALUE): boolean;\n}\n\nexport interface DItemUpdaterDataMapped<VALUE> {\n\tsize(): number;\n\teach(iteratee: (value: VALUE, index: number) => void | boolean, from: number, to: number): void;\n}\n\nexport interface DItemUpdaterData<VALUE> {\n\treadonly selection: DItemUpdaterDataSelection<VALUE>;\n}\n\n/**\n * The primary purpose of this class is to minimize the number of rendered items (e.g., {@link DListItem})\n * as low as possible and to update their positions and states. For this sake, the updater calculates the\n * required number of items whenever their container size changes and creates items if needed.\n */\nexport abstract class DItemUpdater<\n\tVALUE = unknown,\n\tDATA extends DItemUpdaterData<VALUE> = DItemUpdaterData<VALUE>,\n\tDATA_MAPPED extends DItemUpdaterDataMapped<VALUE> = DItemUpdaterDataMapped<VALUE>,\n\tITEM extends DItemUpdaterItem<VALUE> = DItemUpdaterItem<VALUE>,\n\tOPTIONS extends DItemUpdaterOptions<VALUE, DATA, ITEM> = DItemUpdaterOptions<VALUE, DATA, ITEM>\n> {\n\tprotected _updateItemsCount: number;\n\tprotected _isUpdateItemsCalled: boolean;\n\tprotected _isUpdateItemsCalledForcibly: boolean;\n\tprotected _itemHeight: number;\n\tprotected _itemWidth: number;\n\tprotected _multiplicity: number;\n\tprotected _itemIndexStart: number;\n\tprotected _itemIndexEnd: number;\n\tprotected _workItems: ITEM[];\n\tprotected _data: DATA;\n\tprotected _content: DBase;\n\tprotected _container: DBase;\n\tprotected _newItem: DItemUpdaterNewItem<DATA, ITEM>;\n\tprotected _initItem: DItemUpdaterInitItem<DATA, ITEM>;\n\n\tconstructor(data: DATA, content: DBase, container: DBase, options?: OPTIONS) {\n\t\tthis._updateItemsCount = 0;\n\t\tthis._isUpdateItemsCalled = false;\n\t\tthis._isUpdateItemsCalledForcibly = false;\n\t\tthis._itemHeight = -1;\n\t\tthis._itemWidth = -1;\n\t\tthis._multiplicity = 1;\n\t\tthis._itemIndexStart = 0;\n\t\tthis._itemIndexEnd = 0;\n\t\tthis._workItems = [];\n\t\tthis._data = data;\n\t\tthis._content = content;\n\t\tthis._container = container;\n\t\tthis._newItem = this.toNewItem(options);\n\t\tthis._initItem = this.toInitItem(options);\n\t}\n\n\tprotected toNewItem(\n\t\toptions?: DItemUpdaterOptions<VALUE, DATA, ITEM>\n\t): DItemUpdaterNewItem<DATA, ITEM> {\n\t\treturn options?.newItem || this.newItem;\n\t}\n\n\tprotected abstract newItem(this: undefined, data: DATA): ITEM;\n\n\tprotected toInitItem(\n\t\toptions?: DItemUpdaterOptions<VALUE, DATA, ITEM>\n\t): DItemUpdaterInitItem<DATA, ITEM> {\n\t\tif (options) {\n\t\t\tconst initItem = options.initItem;\n\t\t\tif (initItem) {\n\t\t\t\treturn initItem;\n\t\t\t}\n\t\t\tif (options.stripe !== false) {\n\t\t\t\treturn this.initItem;\n\t\t\t}\n\t\t\treturn this.initItemNoStriping;\n\t\t}\n\t\treturn this.initItem;\n\t}\n\n\tprotected initItem(this: undefined, item: ITEM, index: number, data: DATA): ITEM {\n\t\titem.state.isAlternated = index % 2 === 1;\n\t\treturn item;\n\t}\n\n\tprotected initItemNoStriping(this: undefined, item: ITEM, index: number, data: DATA): ITEM {\n\t\treturn item;\n\t}\n\n\tget multiplicity(): number {\n\t\treturn this._multiplicity;\n\t}\n\n\tlock(): void {\n\t\tthis._updateItemsCount += 1;\n\t\tif (this._updateItemsCount === 1) {\n\t\t\tthis._isUpdateItemsCalled = false;\n\t\t\tthis._isUpdateItemsCalledForcibly = false;\n\t\t}\n\t}\n\n\tunlock(callIfNeeded: boolean): void {\n\t\tthis._updateItemsCount -= 1;\n\t\tif (this._updateItemsCount === 0) {\n\t\t\tif (callIfNeeded && this._isUpdateItemsCalled) {\n\t\t\t\tthis.update(this._isUpdateItemsCalledForcibly);\n\t\t\t}\n\t\t\tthis._isUpdateItemsCalled = false;\n\t\t\tthis._isUpdateItemsCalledForcibly = false;\n\t\t}\n\t}\n\n\tupdate(forcibly?: boolean): void {\n\t\tif (0 < this._updateItemsCount) {\n\t\t\tthis._isUpdateItemsCalled = true;\n\t\t\tif (forcibly) {\n\t\t\t\tthis._isUpdateItemsCalledForcibly = true;\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\t\tconst content = this._content;\n\t\tconst contentParent = content.parent;\n\t\tif (contentParent == null) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst container = this._container;\n\t\tconst items = container.children as ITEM[];\n\t\tconst height = contentParent.height;\n\n\t\tconst data = this._data;\n\t\tconst mapped = this.toMapped(data);\n\t\tconst dataSize = mapped.size();\n\n\t\tconst oldItemIndexStart = this._itemIndexStart;\n\t\tlet oldItemIndexEnd = this._itemIndexEnd;\n\t\tlet oldItemCount = oldItemIndexEnd - oldItemIndexStart;\n\n\t\tconst newItem = this._newItem;\n\t\tconst initItem = this._initItem;\n\t\tlet itemHeight = this._itemHeight;\n\t\tlet itemWidth = this._itemWidth;\n\t\tif (this._itemHeight < 0) {\n\t\t\tlet item: ITEM;\n\t\t\tif (0 < items.length) {\n\t\t\t\titem = items[0];\n\t\t\t} else {\n\t\t\t\titem = initItem(newItem(data), oldItemIndexStart, data);\n\t\t\t\tcontainer.addChild(item);\n\t\t\t\toldItemIndexEnd += 1;\n\t\t\t\toldItemCount += 1;\n\t\t\t}\n\t\t\titemHeight = Math.max(1, item.height);\n\t\t\tif (isNumber(item.getWidth())) {\n\t\t\t\titemWidth = Math.max(1, item.width);\n\t\t\t}\n\t\t\tthis._itemHeight = itemHeight;\n\t\t\tthis._itemWidth = itemWidth;\n\t\t}\n\t\tconst contentPadding = content.padding;\n\t\tconst contentPaddingTop = contentPadding.getTop();\n\t\tconst contentPaddingBottom = contentPadding.getBottom();\n\t\tconst contentPaddingLeft = contentPadding.getLeft();\n\t\tconst contentPaddingRight = contentPadding.getRight();\n\t\tconst contentWidthAvailable = Math.max(\n\t\t\t0,\n\t\t\tcontent.width - contentPaddingLeft - contentPaddingRight\n\t\t);\n\t\tconst multiplicity =\n\t\t\t0 < itemWidth ? Math.max(1, Math.floor(contentWidthAvailable / itemWidth)) : 1;\n\t\tthis._multiplicity = multiplicity;\n\n\t\tconst y = content !== container ? container.transform.position.y : contentPaddingTop;\n\t\tconst newHeight = Math.ceil(dataSize / multiplicity) * itemHeight;\n\t\tconst newContentHeight = Math.max(\n\t\t\theight,\n\t\t\tcontentPaddingTop + newHeight + contentPaddingBottom\n\t\t);\n\t\tconst newContentY = Math.max(height - newContentHeight, content.position.y);\n\n\t\tconst newItemIndexLowerBound = Math.floor(\n\t\t\t((0 - (newContentY + y)) * multiplicity) / itemHeight\n\t\t);\n\t\tconst newItemIndexUpperBound = Math.floor(\n\t\t\t((height - (newContentY + y)) * multiplicity) / itemHeight\n\t\t);\n\t\tlet newItemIndexStart = newItemIndexLowerBound - multiplicity;\n\t\tif (newItemIndexStart % 2 !== 0) {\n\t\t\tnewItemIndexStart -= 1;\n\t\t}\n\t\tlet newItemIndexEnd = newItemIndexUpperBound + multiplicity + multiplicity;\n\t\tif (newItemIndexEnd % 2 !== 0) {\n\t\t\tnewItemIndexEnd += 1;\n\t\t}\n\t\tlet newItemCount = newItemIndexEnd - newItemIndexStart;\n\t\tif (newItemCount < oldItemCount) {\n\t\t\tnewItemCount = oldItemCount;\n\t\t\tnewItemIndexEnd = newItemIndexStart + newItemCount;\n\t\t}\n\n\t\tif (oldItemCount < newItemCount) {\n\t\t\tfor (let i = oldItemCount; i < newItemCount; ++i) {\n\t\t\t\tconst oldItemIndex = oldItemIndexStart + i;\n\t\t\t\tconst item = initItem(newItem(data), oldItemIndex, data);\n\t\t\t\tcontainer.addChild(item);\n\t\t\t}\n\t\t\toldItemCount = newItemCount;\n\t\t\toldItemIndexEnd = oldItemIndexStart + oldItemCount;\n\t\t} else if (newItemCount < oldItemCount) {\n\t\t\tfor (let i = oldItemCount - 1; newItemCount <= i; --i) {\n\t\t\t\tcontainer.removeChild(items[i]);\n\t\t\t}\n\t\t\toldItemCount = newItemCount;\n\t\t\toldItemIndexEnd = oldItemIndexStart + oldItemCount;\n\t\t}\n\n\t\tthis._itemIndexStart = newItemIndexStart;\n\t\tthis._itemIndexEnd = newItemIndexEnd;\n\n\t\tconst itemIndexStartDelta = newItemIndexStart - oldItemIndexStart;\n\t\tconst itemIndexStartDeltaAbs = Math.abs(itemIndexStartDelta);\n\t\tconst itemsLength = items.length;\n\t\tif (0 < itemIndexStartDeltaAbs && itemIndexStartDeltaAbs < itemsLength) {\n\t\t\tconst work = this._workItems;\n\t\t\tif (0 < itemIndexStartDelta) {\n\t\t\t\tfor (let i = 0; i < itemIndexStartDeltaAbs; ++i) {\n\t\t\t\t\tconst item = items[i];\n\t\t\t\t\tthis.reset(item);\n\t\t\t\t\twork.push(item);\n\t\t\t\t}\n\t\t\t\tfor (let i = itemIndexStartDeltaAbs; i < itemsLength; ++i) {\n\t\t\t\t\titems[i - itemIndexStartDeltaAbs] = items[i];\n\t\t\t\t}\n\t\t\t\tfor (let i = 0; i < itemIndexStartDeltaAbs; ++i) {\n\t\t\t\t\titems[itemsLength - itemIndexStartDeltaAbs + i] = work[i];\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tfor (let i = 0; i < itemIndexStartDeltaAbs; ++i) {\n\t\t\t\t\tconst item = items[itemsLength - itemIndexStartDeltaAbs + i];\n\t\t\t\t\tthis.reset(item);\n\t\t\t\t\twork.push(item);\n\t\t\t\t}\n\t\t\t\tfor (let i = itemsLength - itemIndexStartDeltaAbs - 1; 0 <= i; --i) {\n\t\t\t\t\titems[i + itemIndexStartDeltaAbs] = items[i];\n\t\t\t\t}\n\t\t\t\tfor (let i = 0; i < itemIndexStartDeltaAbs; ++i) {\n\t\t\t\t\titems[i] = work[i];\n\t\t\t\t}\n\t\t\t}\n\t\t\twork.length = 0;\n\t\t}\n\n\t\tlet itemOffsetX = 0;\n\t\tlet itemOffsetY = 0;\n\t\tif (content === container) {\n\t\t\titemOffsetX = contentPaddingLeft;\n\t\t\titemOffsetY = contentPaddingTop;\n\t\t}\n\t\tmapped.each(\n\t\t\t(datum: VALUE, index: number): void | boolean => {\n\t\t\t\tconst item = items[index - newItemIndexStart];\n\t\t\t\tconst ix = index % multiplicity;\n\t\t\t\tconst iy = Math.floor(index / multiplicity);\n\t\t\t\titem.position.set(itemOffsetX + ix * itemWidth, itemOffsetY + iy * itemHeight);\n\t\t\t\tthis.set(item, datum, index, forcibly);\n\t\t\t},\n\t\t\tnewItemIndexStart,\n\t\t\tnewItemIndexStart + itemsLength\n\t\t);\n\n\t\tfor (let i = 0; newItemIndexStart + i < 0 && i < itemsLength; ++i) {\n\t\t\tconst item = items[i];\n\t\t\tconst index = newItemIndexStart + i;\n\t\t\tconst ix = index % multiplicity;\n\t\t\tconst iy = Math.floor(index / multiplicity);\n\t\t\titem.position.set(itemOffsetX + ix * itemWidth, itemOffsetY + iy * itemHeight);\n\t\t\tthis.unset(item);\n\t\t}\n\n\t\tfor (let i = itemsLength - 1; dataSize <= newItemIndexStart + i && 0 <= i; --i) {\n\t\t\tconst item = items[i];\n\t\t\tconst index = newItemIndexStart + i;\n\t\t\tconst ix = index % multiplicity;\n\t\t\tconst iy = Math.floor(index / multiplicity);\n\t\t\titem.position.set(itemOffsetX + ix * itemWidth, itemOffsetY + iy * itemHeight);\n\t\t\tthis.unset(item);\n\t\t}\n\n\t\tthis.lock();\n\t\tcontent.position.y = newContentY;\n\t\tcontent.height = newContentHeight;\n\t\tif (content !== container) {\n\t\t\tcontainer.height = newHeight;\n\t\t}\n\t\tthis.unlock(false);\n\t}\n\n\tprotected abstract toMapped(data: DATA): DATA_MAPPED;\n\n\tprotected set(item: ITEM, value: VALUE, index: number, forcibly?: boolean): void {\n\t\titem.set(value, index, forcibly);\n\t}\n\n\tprotected unset(item: ITEM): void {\n\t\titem.unset();\n\t}\n\n\tprotected reset(item: ITEM): ITEM {\n\t\titem.blur(true);\n\t\tconst cells = item.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\tconst state = cell.state;\n\t\t\t\tstate.lock();\n\t\t\t\tstate.isPressed = false;\n\t\t\t\tstate.isHovered = false;\n\t\t\t\tstate.unlock();\n\t\t\t}\n\t\t}\n\t\titem.state.isHovered = false;\n\t\treturn item;\n\t}\n\n\tmoveFocus(\n\t\te: KeyboardEvent,\n\t\ttarget: DBase,\n\t\tmoveVertically: boolean,\n\t\tmoveHorizontally: boolean\n\t): boolean {\n\t\tif (!(moveVertically || moveHorizontally)) {\n\t\t\treturn false;\n\t\t}\n\t\tconst isUp = moveVertically && UtilKeyboardEvent.isArrowUpKey(e);\n\t\tconst isDown = moveVertically && UtilKeyboardEvent.isArrowDownKey(e);\n\t\tconst isLeft = moveHorizontally && UtilKeyboardEvent.isArrowLeftKey(e);\n\t\tconst isRight = moveHorizontally && UtilKeyboardEvent.isArrowRightKey(e);\n\t\tif (!(isUp || isDown || isLeft || isRight)) {\n\t\t\treturn false;\n\t\t}\n\t\tif (!target.state.isActionable) {\n\t\t\treturn false;\n\t\t}\n\t\tconst layer = DApplications.getLayer(target);\n\t\tif (layer == null) {\n\t\t\treturn false;\n\t\t}\n\t\tconst focusController = layer.getFocusController();\n\t\tconst focused = focusController.get();\n\t\tif (focused == null) {\n\t\t\treturn false;\n\t\t}\n\t\tconst container = this._container;\n\t\tif (focused.parent !== container) {\n\t\t\treturn false;\n\t\t}\n\t\tconst item = focused as ITEM;\n\t\tconst index = item.index;\n\t\tif (index == null) {\n\t\t\treturn false;\n\t\t}\n\t\tconst multiplicity = this._multiplicity;\n\t\tconst data = this._data;\n\t\tconst mapped = this.toMapped(data);\n\t\tconst dataSize = mapped.size();\n\t\tlet newIndex = index;\n\t\tif (isLeft || isRight) {\n\t\t\tif (isLeft) {\n\t\t\t\tif (0 <= newIndex - 1) {\n\t\t\t\t\tnewIndex -= 1;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif (newIndex + 1 < dataSize) {\n\t\t\t\t\tnewIndex += 1;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif (isUp || isDown) {\n\t\t\tif (isUp) {\n\t\t\t\tif (0 <= newIndex - multiplicity) {\n\t\t\t\t\tnewIndex -= multiplicity;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif (newIndex + multiplicity < dataSize) {\n\t\t\t\t\tnewIndex += multiplicity;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif (newIndex === index) {\n\t\t\treturn false;\n\t\t}\n\t\tconst items = container.children as ITEM[];\n\t\tconst itemIndex = items.indexOf(item);\n\t\tif (itemIndex < 0) {\n\t\t\treturn false;\n\t\t}\n\t\tconst newItemIndex = itemIndex + (newIndex - index);\n\t\tif (newItemIndex < 0 || items.length <= newItemIndex) {\n\t\t\treturn false;\n\t\t}\n\t\tconst newItem = items[newItemIndex];\n\t\tfocusController.focus(newItem);\n\t\treturn true;\n\t}\n}\n"]}
@@ -159,7 +159,7 @@ var DTableBody = /** @class */ (function (_super) {
159
159
  var newRowIndexMappedEnd = Math.floor(newRowIndexMappedUpperBound);
160
160
  newRowIndexMappedEnd += (newRowIndexMappedEnd - newRowIndexMappedStart) % 2 === 1 ? 3 : 2;
161
161
  var newRowCount = newRowIndexMappedEnd - newRowIndexMappedStart;
162
- if (newRowCount < oldRowCount && oldRowCount - 2 <= newRowCount) {
162
+ if (newRowCount < oldRowCount) {
163
163
  newRowCount = oldRowCount;
164
164
  newRowIndexMappedEnd = newRowIndexMappedStart + newRowCount;
165
165
  }
@@ -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,oBAA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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
+ {"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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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) {\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.395.0
2
+ Winter Cardinal UI v0.396.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.395.0
2
+ Winter Cardinal UI v0.396.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.395.0
2
+ Winter Cardinal UI v0.396.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.395.0
2
+ Winter Cardinal UI v0.396.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.395.0
2
+ Winter Cardinal UI v0.396.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.395.0
2
+ Winter Cardinal UI v0.396.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.395.0
2
+ Winter Cardinal UI v0.396.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.395.0
2
+ Winter Cardinal UI v0.396.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.395.0
2
+ Winter Cardinal UI v0.396.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.395.0
2
+ Winter Cardinal UI v0.396.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.395.0
2
+ Winter Cardinal UI v0.396.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.395.0
2
+ Winter Cardinal UI v0.396.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.395.0
2
+ Winter Cardinal UI v0.396.0
3
3
  Copyright (C) 2019 Toshiba Corporation
4
4
  SPDX-License-Identifier: Apache-2.0
5
5
 
@@ -70453,7 +70453,13 @@ var DApplicationLayer = /** @class */ (function (_super) {
70453
70453
  };
70454
70454
  DApplicationLayer.prototype.onResize = function () {
70455
70455
  var options = this._options;
70456
- var bbox = this._rootElement.getBoundingClientRect();
70456
+ var bboxes = this._rootElement.getClientRects();
70457
+ if (bboxes.length <= 0) {
70458
+ // The root element size is (0, 0) and not visible.
70459
+ // In this case, skip the resizing.
70460
+ return;
70461
+ }
70462
+ var bbox = bboxes[0];
70457
70463
  var newWidth = options.isWidthFixed() ? options.getWidth() : bbox.width;
70458
70464
  var newHeight = options.isHeightFixed() ? options.getHeight() : bbox.height;
70459
70465
  this.renderer.resize(newWidth, newHeight);
@@ -74310,7 +74316,7 @@ var DItemUpdater = /** @class */ (function () {
74310
74316
  newItemIndexEnd += 1;
74311
74317
  }
74312
74318
  var newItemCount = newItemIndexEnd - newItemIndexStart;
74313
- if (newItemCount < oldItemCount && oldItemCount - 2 <= newItemCount) {
74319
+ if (newItemCount < oldItemCount) {
74314
74320
  newItemCount = oldItemCount;
74315
74321
  newItemIndexEnd = newItemIndexStart + newItemCount;
74316
74322
  }
@@ -92687,7 +92693,7 @@ var DTableBody = /** @class */ (function (_super) {
92687
92693
  var newRowIndexMappedEnd = Math.floor(newRowIndexMappedUpperBound);
92688
92694
  newRowIndexMappedEnd += (newRowIndexMappedEnd - newRowIndexMappedStart) % 2 === 1 ? 3 : 2;
92689
92695
  var newRowCount = newRowIndexMappedEnd - newRowIndexMappedStart;
92690
- if (newRowCount < oldRowCount && oldRowCount - 2 <= newRowCount) {
92696
+ if (newRowCount < oldRowCount) {
92691
92697
  newRowCount = oldRowCount;
92692
92698
  newRowIndexMappedEnd = newRowIndexMappedStart + newRowCount;
92693
92699
  }