@jimka/typescript-ui 0.2.0 → 0.3.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.
- package/README.md +4 -0
- package/THIRD-PARTY-NOTICES.md +7 -3
- package/dist/lib/{AbstractBooleanInput-BGesvIZy.js → AbstractBooleanInput-C3O4kv7_.js} +2 -2
- package/dist/lib/{AbstractBooleanInput-BGesvIZy.js.map → AbstractBooleanInput-C3O4kv7_.js.map} +1 -1
- package/dist/lib/{AbstractInput-BxOtFrER.js → AbstractInput-DFWniHqq.js} +2 -2
- package/dist/lib/{AbstractInput-BxOtFrER.js.map → AbstractInput-DFWniHqq.js.map} +1 -1
- package/dist/lib/AnchorConstraints-CSUcj8Wx.js +2 -0
- package/dist/lib/AnchorConstraints-CSUcj8Wx.js.map +1 -0
- package/dist/lib/{AnimatedDropdown-CZQEqQi-.js → AnimatedDropdown-e9urCXK1.js} +2 -2
- package/dist/lib/{AnimatedDropdown-CZQEqQi-.js.map → AnimatedDropdown-e9urCXK1.js.map} +1 -1
- package/dist/lib/Border-Dq6dXkmS.js +2 -0
- package/dist/lib/{Border-BgaZkc1R.js.map → Border-Dq6dXkmS.js.map} +1 -1
- package/dist/lib/{Button-U1rsP4v8.js → Button-B36rBMKC.js} +2 -2
- package/dist/lib/{Button-U1rsP4v8.js.map → Button-B36rBMKC.js.map} +1 -1
- package/dist/lib/{Card-BVwOS8AG.js → Card-P8iUH2-C.js} +2 -2
- package/dist/lib/{Card-BVwOS8AG.js.map → Card-P8iUH2-C.js.map} +1 -1
- package/dist/lib/{ComboBox-B9EDPu6T.js → ComboBox-BjAhXXkY.js} +2 -2
- package/dist/lib/{ComboBox-B9EDPu6T.js.map → ComboBox-BjAhXXkY.js.map} +1 -1
- package/dist/lib/Component-CHTzJxEf.js +2 -0
- package/dist/lib/Component-CHTzJxEf.js.map +1 -0
- package/dist/lib/Container-xUbHk6l_.js +2 -0
- package/dist/lib/{Container-D5H8VxJK.js.map → Container-xUbHk6l_.js.map} +1 -1
- package/dist/lib/DOM-BeR95tE8.js +2 -0
- package/dist/lib/DOM-BeR95tE8.js.map +1 -0
- package/dist/lib/{DragManager-CI4mZQFy.js → DragManager-T5Oljd0F.js} +2 -2
- package/dist/lib/{DragManager-CI4mZQFy.js.map → DragManager-T5Oljd0F.js.map} +1 -1
- package/dist/lib/{FieldDecorator-CJs9gwqH.js → FieldDecorator-BaTGfKiW.js} +2 -2
- package/dist/lib/{FieldDecorator-CJs9gwqH.js.map → FieldDecorator-BaTGfKiW.js.map} +1 -1
- package/dist/lib/{Fit-DjRsiwlg.js → Fit-E-EIZv1k.js} +2 -2
- package/dist/lib/{Fit-DjRsiwlg.js.map → Fit-E-EIZv1k.js.map} +1 -1
- package/dist/lib/{Glyph-KEf4nIv2.js → Glyph-CnNslL95.js} +2 -2
- package/dist/lib/{Glyph-KEf4nIv2.js.map → Glyph-CnNslL95.js.map} +1 -1
- package/dist/lib/{Grid-DdL9TVeJ.js → Grid-BXS2T8MT.js} +2 -2
- package/dist/lib/{Grid-DdL9TVeJ.js.map → Grid-BXS2T8MT.js.map} +1 -1
- package/dist/lib/{GridConstraints-DkLueyrf.js → GridConstraints-D_kbd-h2.js} +2 -2
- package/dist/lib/{GridConstraints-DkLueyrf.js.map → GridConstraints-D_kbd-h2.js.map} +1 -1
- package/dist/lib/HBox-Dm3xgsDE.js +2 -0
- package/dist/lib/{HBox-Ce0GTCJP.js.map → HBox-Dm3xgsDE.js.map} +1 -1
- package/dist/lib/{Header-BQIVpBte.js → Header-CqFc2OUx.js} +2 -2
- package/dist/lib/{Header-BQIVpBte.js.map → Header-CqFc2OUx.js.map} +1 -1
- package/dist/lib/{IconText-Bo4Qcnot.js → IconText-CTM2r0Tv.js} +2 -2
- package/dist/lib/{IconText-Bo4Qcnot.js.map → IconText-CTM2r0Tv.js.map} +1 -1
- package/dist/lib/{LayoutSerialization-BT66TY83.js → LayoutSerialization-D1OHmxSB.js} +2 -2
- package/dist/lib/{LayoutSerialization-BT66TY83.js.map → LayoutSerialization-D1OHmxSB.js.map} +1 -1
- package/dist/lib/LayoutSizes-CvMmMgHJ.js +2 -0
- package/dist/lib/LayoutSizes-CvMmMgHJ.js.map +1 -0
- package/dist/lib/List-DHeOPAK2.js +2 -0
- package/dist/lib/List-DHeOPAK2.js.map +1 -0
- package/dist/lib/MemoryStore-DT6iWWco.js +2 -0
- package/dist/lib/MemoryStore-DT6iWWco.js.map +1 -0
- package/dist/lib/{Menu-Dz4L7EKJ.js → Menu-B6ippw-p.js} +2 -2
- package/dist/lib/{Menu-Dz4L7EKJ.js.map → Menu-B6ippw-p.js.map} +1 -1
- package/dist/lib/{MenuButton-VJ5uC3c1.js → MenuButton-Bjm1OyB-.js} +2 -2
- package/dist/lib/{MenuButton-VJ5uC3c1.js.map → MenuButton-Bjm1OyB-.js.map} +1 -1
- package/dist/lib/{Panel-DzWdYwq1.js → Panel-D9lTLGqP.js} +2 -2
- package/dist/lib/{Panel-DzWdYwq1.js.map → Panel-D9lTLGqP.js.map} +1 -1
- package/dist/lib/Position-DRSlWn4Z.js +2 -0
- package/dist/lib/Position-DRSlWn4Z.js.map +1 -0
- package/dist/lib/{ProgressSpinner-zJKtGyNJ.js → ProgressSpinner-glv-29eK.js} +2 -2
- package/dist/lib/{ProgressSpinner-zJKtGyNJ.js.map → ProgressSpinner-glv-29eK.js.map} +1 -1
- package/dist/lib/{RadioButton-CYSSv4nV.js → RadioButton-R4S3c9WD.js} +2 -2
- package/dist/lib/{RadioButton-CYSSv4nV.js.map → RadioButton-R4S3c9WD.js.map} +1 -1
- package/dist/lib/{RovingTabIndex-BSZ31Vp5.js → RovingTabIndex-Dgt01LOE.js} +2 -2
- package/dist/lib/{RovingTabIndex-BSZ31Vp5.js.map → RovingTabIndex-Dgt01LOE.js.map} +1 -1
- package/dist/lib/{Scrollbar-BhtOjqkG.js → Scrollbar-CiVV3axj.js} +2 -2
- package/dist/lib/{Scrollbar-BhtOjqkG.js.map → Scrollbar-CiVV3axj.js.map} +1 -1
- package/dist/lib/{Slider-CdXm7E64.js → Slider-_JVvuQ8M.js} +2 -2
- package/dist/lib/{Slider-CdXm7E64.js.map → Slider-_JVvuQ8M.js.map} +1 -1
- package/dist/lib/{Spacer-D9NGW4QG.js → Spacer-B57i2-_G.js} +2 -2
- package/dist/lib/{Spacer-D9NGW4QG.js.map → Spacer-B57i2-_G.js.map} +1 -1
- package/dist/lib/{TabButton-CThevdY_.js → TabButton-DEypdlZf.js} +2 -2
- package/dist/lib/{TabButton-CThevdY_.js.map → TabButton-DEypdlZf.js.map} +1 -1
- package/dist/lib/Text-Bni4icFY.js +2 -0
- package/dist/lib/Text-Bni4icFY.js.map +1 -0
- package/dist/lib/{Tooltip-tkXDk5Bo.js → Tooltip-BUy6uFKN.js} +2 -2
- package/dist/lib/{Tooltip-tkXDk5Bo.js.map → Tooltip-BUy6uFKN.js.map} +1 -1
- package/dist/lib/VBox-Dr7Ge9M6.js +2 -0
- package/dist/lib/VBox-Dr7Ge9M6.js.map +1 -0
- package/dist/lib/{VirtualScroller-DwEEJE1_.js → VirtualScroller-BPy6KmSX.js} +2 -2
- package/dist/lib/{VirtualScroller-DwEEJE1_.js.map → VirtualScroller-BPy6KmSX.js.map} +1 -1
- package/dist/lib/component/button.es.js +1 -1
- package/dist/lib/component/chart.es.js +1 -1
- package/dist/lib/component/chart.es.js.map +1 -1
- package/dist/lib/component/container.es.js +1 -1
- package/dist/lib/component/diagram.es.js +1 -1
- package/dist/lib/component/diagram.es.js.map +1 -1
- package/dist/lib/component/display.es.js +1 -1
- package/dist/lib/component/editor.es.js +3 -3
- package/dist/lib/component/editor.es.js.map +1 -1
- package/dist/lib/component/input.es.js +1 -1
- package/dist/lib/component/input.es.js.map +1 -1
- package/dist/lib/component/list.es.js +1 -1
- package/dist/lib/component/menubar.es.js +1 -1
- package/dist/lib/component/table.es.js +2 -2
- package/dist/lib/component/table.es.js.map +1 -1
- package/dist/lib/component/tree.es.js +1 -1
- package/dist/lib/component/tree.es.js.map +1 -1
- package/dist/lib/core.es.js +1 -1
- package/dist/lib/core.es.js.map +1 -1
- package/dist/lib/data.es.js +1 -1
- package/dist/lib/data.es.js.map +1 -1
- package/dist/lib/glyphs/solid/index.es.js +1 -1
- package/dist/lib/layout.es.js +1 -1
- package/dist/lib/layout.es.js.map +1 -1
- package/dist/lib/overlay.es.js +1 -1
- package/dist/lib/overlay.es.js.map +1 -1
- package/dist/lib/primitive.es.js +1 -1
- package/dist/lib/router.es.js +1 -1
- package/dist/lib/router.es.js.map +1 -1
- package/dist/lib/{VirtualRowView-BxpHQ_u8.js → selectionsEqual-2PJrcimg.js} +2 -2
- package/dist/lib/{VirtualRowView-BxpHQ_u8.js.map → selectionsEqual-2PJrcimg.js.map} +1 -1
- package/dist/lib/types/component/diagram/DiagramEdgeLayer.d.ts +14 -1
- package/dist/lib/types/component/diagram/DiagramModel.d.ts +1 -0
- package/dist/lib/types/component/diagram/DiagramNode.d.ts +4 -0
- package/dist/lib/types/component/diagram/DiagramView.d.ts +76 -5
- package/dist/lib/types/component/diagram/ElkLayoutEngine.d.ts +14 -1
- package/dist/lib/types/component/diagram/index.d.ts +2 -2
- package/dist/lib/types/component/editor/CodeEditor.d.ts +3 -2
- package/dist/lib/types/component/input/Text.d.ts +3 -1
- package/dist/lib/types/component/shared/selectionsEqual.d.ts +1 -0
- package/dist/lib/types/component/table/Column.d.ts +2 -0
- package/dist/lib/types/component/table/ColumnConfig.d.ts +1 -0
- package/dist/lib/types/component/table/Header.d.ts +1 -0
- package/dist/lib/types/component/table/Table.d.ts +20 -0
- package/dist/lib/types/component/table/cell/Header.d.ts +1 -0
- package/dist/lib/types/component/table/index.d.ts +1 -1
- package/dist/lib/types/component/tree/Tree.d.ts +1 -0
- package/dist/lib/types/core/Aria.d.ts +0 -2
- package/dist/lib/types/core/Body.d.ts +1 -0
- package/dist/lib/types/core/ClassStyleRules.d.ts +17 -0
- package/dist/lib/types/core/Component.d.ts +10 -2
- package/dist/lib/types/core/ComponentDefaults.d.ts +1 -0
- package/dist/lib/types/core/DOM.d.ts +11 -2
- package/dist/lib/types/core/ElementAttributes.d.ts +15 -0
- package/dist/lib/types/core/PendingTransitions.d.ts +4 -0
- package/dist/lib/types/core/StyleTarget.d.ts +1 -0
- package/dist/lib/types/core/Util.d.ts +2 -0
- package/dist/lib/types/core/index.d.ts +1 -0
- package/dist/lib/types/layout/Border.d.ts +1 -0
- package/dist/lib/types/layout/Tab.d.ts +4 -1
- package/dist/lib/types/layout/Table.d.ts +1 -0
- package/dist/lib/types/overlay/AbstractWindow.d.ts +1 -0
- package/dist/lib/types/router/RoutePattern.d.ts +7 -0
- package/dist/lib/types/router/Router.d.ts +13 -2
- package/dist/lib/types/router/index.d.ts +1 -1
- package/dist/lib/validation.es.js +1 -1
- package/llms.txt +1 -1
- package/package.json +4 -8
- package/dist/lib/Border-BgaZkc1R.js +0 -2
- package/dist/lib/BoxLayout-DrKGfsup.js +0 -2
- package/dist/lib/BoxLayout-DrKGfsup.js.map +0 -1
- package/dist/lib/Component-DXf5a3g0.js +0 -2
- package/dist/lib/Component-DXf5a3g0.js.map +0 -1
- package/dist/lib/Container-D5H8VxJK.js +0 -2
- package/dist/lib/DOM-CGn7xyTw.js +0 -2
- package/dist/lib/DOM-CGn7xyTw.js.map +0 -1
- package/dist/lib/HBox-Ce0GTCJP.js +0 -2
- package/dist/lib/LayoutSizes-DU3qSq0w.js +0 -2
- package/dist/lib/LayoutSizes-DU3qSq0w.js.map +0 -1
- package/dist/lib/List-DtTVTyWW.js +0 -2
- package/dist/lib/List-DtTVTyWW.js.map +0 -1
- package/dist/lib/Position-A39T7-_1.js +0 -2
- package/dist/lib/Position-A39T7-_1.js.map +0 -1
- package/dist/lib/Text-gz6qjFfP.js +0 -2
- package/dist/lib/Text-gz6qjFfP.js.map +0 -1
- package/dist/lib/VBox-EIqw85Rh.js +0 -2
- package/dist/lib/VBox-EIqw85Rh.js.map +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{d as e,
|
|
2
|
-
//# sourceMappingURL=Card-
|
|
1
|
+
import{d as e,m as t,p as n}from"./Component-CHTzJxEf.js";var Card=class extends e{_visibleComponentId=null;_currentVisible=null;constructor(e){super(),e&&this.applyOptions(e)}applyOptions(e){super.applyOptions(e),e.visibleComponentId!==void 0&&this.setVisibleComponentId(e.visibleComponentId)}getVisibleComponentId(){return this._visibleComponentId}getPreferredSize(){return this.computeSize(e=>e.getPreferredSize())}getMinSize(){return this.computeSize(e=>e.getMinSize())}getMaxSize(){return this.computeSize(e=>e.getMaxSize())}computeSize(e){let t=this.getContainer();if(!t)return null;let n=t.getPerimeterSize();if(!n)return null;let r=n.left+n.right,i=n.top+n.bottom,a=this.getVisibleComponent();if(!a)return null;let o=e(a);return o?{width:o.width+r,height:o.height+i}:null}setVisibleComponentId(e){return this._visibleComponentId===e?this:(this._visibleComponentId=e,this.syncVisible(),this.getContainer()?.scheduleLayout(),this)}getVisibleComponent(){return this._currentVisible||this.syncVisible(),this._currentVisible}syncVisible(){let e=this.getContainer();if(!e)return;let t=e.getComponents(),n=null;if(this._visibleComponentId){for(let e of t)if(e.getId()==this._visibleComponentId){n=e;break}n||console.warn(`Visible component id is specified but no matching component was found.`)}if(!n&&t.length>0&&(n=t[0]),n!==this._currentVisible){if(this._currentVisible===null)for(let e of t)e!==n&&e.setVisible(!1);else this._currentVisible.setVisible(!1);n&&n.setVisible(!0),this._currentVisible=n}}computeTotalMinSize(){return this._currentVisible?this._currentVisible.getMinSize()??{width:0,height:0}:{width:0,height:0}}doLayout(){let e=this.getContainer();if(!e||(this._currentVisible||this.syncVisible(),!this._currentVisible))return;let t=e.getInnerSize(),r=e.getContentInsets();t&&=this.inflateForOverflow(t),this.placeComponent(this._currentVisible,r.getLeft(),r.getTop(),t?t.width:0,t?t.height:0,n.BOTH)}},r=t(Card);export{r as t};
|
|
2
|
+
//# sourceMappingURL=Card-P8iUH2-C.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Card-BVwOS8AG.js","names":[],"sources":["../../src/typescript/lib/layout/Card.ts"],"sourcesContent":["// SPDX-License-Identifier: PolyForm-Noncommercial-1.0.0\n\nimport { LayoutManager, LayoutManagerOptions } from \"~/layout/LayoutManager.js\"\nimport { FillType } from \"~/layout/FillType.js\";\nimport { Size } from \"~/primitive/Size.js\";\nimport { Component } from \"~/core/Component.js\";\nimport { callable } from \"~/core/Callable.js\";\n\n/**\n * Construction-time options for {@link Card}.\n *\n * @category Layouts\n */\nexport interface CardOptions extends LayoutManagerOptions {\n visibleComponentId?: string;\n}\n\n/**\n * A layout manager that shows exactly one child component at a time,\n * sizing it to fill the container's inner bounds.\n * The visible child is selected by component ID; all others are hidden.\n *\n * @category Layouts\n */\nclass Card extends LayoutManager {\n\n private _visibleComponentId: string | null = null;\n private _currentVisible: Component | null = null;\n\n constructor(options?: CardOptions) {\n // LayoutManager's constructor takes no options; applied via applyOptions below.\n // eslint-disable-next-line local/forward-super-options\n super();\n\n if (options) {\n this.applyOptions(options);\n }\n }\n\n /**\n * Applies a {@link CardOptions} bag, dispatching the initial visible\n * component id after the inherited LayoutManager defaults.\n *\n * @param options - The options bag carrying the values to apply.\n */\n protected applyOptions(options: CardOptions): void {\n super.applyOptions(options);\n\n if (options.visibleComponentId !== undefined) {\n this.setVisibleComponentId(options.visibleComponentId);\n }\n }\n\n /**\n * Returns the ID of the currently visible child component, or `null` if none is set.\n *\n * @returns The visible component ID, or `null`.\n */\n getVisibleComponentId(): string | null {\n return this._visibleComponentId;\n }\n\n /**\n * Returns the preferred size of the visible child plus the container perimeter.\n *\n * @returns The preferred `{width, height}`, or `null` if there is no container or no visible component.\n */\n getPreferredSize(): Size | null {\n return this.computeSize(component => component.getPreferredSize());\n }\n\n /**\n * Returns the minimum size of the visible child plus the container perimeter.\n *\n * @returns The minimum `{width, height}`, or `null` if there is no container or no visible component.\n */\n getMinSize(): Size | null {\n return this.computeSize(component => component.getMinSize());\n }\n\n /**\n * Returns the maximum size of the visible child plus the container perimeter.\n *\n * @returns The maximum `{width, height}`, or `null` if there is no container or no visible component.\n */\n getMaxSize(): Size | null {\n return this.computeSize(component => component.getMaxSize());\n }\n\n /**\n * Shared core of {@link getPreferredSize} / {@link getMinSize} /\n * {@link getMaxSize}: adds the visible child's size (selected by `sizeOf`)\n * to the container perimeter.\n *\n * @param sizeOf - Selects the child's preferred, minimum, or maximum size.\n * @returns The composed `{width, height}`, or `null` if there is no\n * container, no visible component, or the child reports no size.\n */\n private computeSize(sizeOf: (component: Component) => Size | null): Size | null {\n const container = this.getContainer();\n if (!container) {\n return null;\n }\n\n const perimeterSize = container.getPerimeterSize();\n if (!perimeterSize) {\n return null;\n }\n\n const outerWidth = perimeterSize.left + perimeterSize.right;\n const outerHeight = perimeterSize.top + perimeterSize.bottom;\n\n const visibleComponent = this.getVisibleComponent();\n if (!visibleComponent) {\n return null;\n }\n\n const size = sizeOf(visibleComponent);\n if (!size) {\n return null;\n }\n\n return {\n width: size.width + outerWidth,\n height: size.height + outerHeight\n };\n }\n\n /**\n * Selects which child component is visible. Hides the previously-visible\n * child (if different) and shows the new one. Subsequent `doLayout` calls\n * only re-size the visible child; visibility writes happen here, not on\n * every layout pass.\n *\n * @param id - The ID of the child component to make visible.\n */\n setVisibleComponentId(id: string): this {\n if (this._visibleComponentId === id) {\n return this;\n }\n\n this._visibleComponentId = id;\n this.syncVisible();\n\n // Schedule a layout so a child first shown here gets sized: doLayout only\n // ever lays out the visible child, so a sibling that was hidden during\n // the initial pass has never been laid out and would render blank until\n // an unrelated relayout. No-op before the manager is attached.\n this.getContainer()?.scheduleLayout();\n\n return this;\n }\n\n /**\n * Returns the child component matching `visibleComponentId`, or the first\n * child if no ID is set. Result is cached; the cache is refreshed when\n * `setVisibleComponentId` is called or when `doLayout` runs without a\n * resolved component.\n *\n * @returns The resolved visible component, or `null` if the container is empty.\n */\n getVisibleComponent(): Component | null {\n if (!this._currentVisible) {\n this.syncVisible();\n }\n\n return this._currentVisible;\n }\n\n /**\n * Resolves the visible component from `visibleComponentId` (or first child\n * if unset), and transitions visibility: hides the previous one if\n * different, shows the new one. No-op when the resolved component is the\n * same as the currently-shown one.\n */\n private syncVisible(): void {\n const container = this.getContainer();\n if (!container) {\n return;\n }\n\n const components = container.getComponents();\n let resolved: Component | null = null;\n\n if (this._visibleComponentId) {\n for (const c of components) {\n if (c.getId() == this._visibleComponentId) {\n resolved = c;\n break;\n }\n }\n\n if (!resolved) {\n console.warn(\"Visible component id is specified but no matching component was found.\");\n }\n }\n\n if (!resolved && components.length > 0) {\n resolved = components[0];\n }\n\n if (resolved === this._currentVisible) {\n return;\n }\n\n if (this._currentVisible === null) {\n // First sync: components default to visible, so any sibling that\n // isn't the resolved child needs to be hidden explicitly. Without\n // this, e.g. a Cell's editor (sibling of its renderer) renders on\n // top of the renderer because its setVisible was never called.\n for (const c of components) {\n if (c !== resolved) {\n c.setVisible(false);\n }\n }\n } else {\n this._currentVisible.setVisible(false);\n }\n\n if (resolved) {\n resolved.setVisible(true);\n }\n\n this._currentVisible = resolved;\n }\n\n /**\n * Computes the children's combined minSize along this manager's geometry:\n * the currently-visible child's minSize. Used by `doLayout` to inflate\n * the working size when the host has opted into `setOverflowing`.\n *\n * @returns The visible child's min-size; `{ width: 0, height: 0 }` when\n * no child is visible.\n */\n protected computeTotalMinSize(): Size {\n if (!this._currentVisible) {\n return { width: 0, height: 0 };\n }\n\n const min = this._currentVisible.getMinSize();\n\n return min ?? { width: 0, height: 0 };\n }\n\n /**\n * Sizes the visible component to fill the container's inner bounds.\n * Visibility transitions are handled in `setVisibleComponentId`, not here.\n */\n doLayout(): void {\n const container = this.getContainer();\n if (!container) {\n return;\n }\n\n if (!this._currentVisible) {\n this.syncVisible();\n }\n\n if (!this._currentVisible) {\n return;\n }\n\n let containerSize = container.getInnerSize();\n const containerInsets = container.getContentInsets();\n\n // Universal scroll: see HBox.doLayout for the rationale. When the\n // host has marked the corresponding axis as overflowing, grow the\n // working size past the host's inner rect to the visible child's\n // minSize so the host's CSS `overflow: auto` produces a scrollbar.\n if (containerSize) {\n containerSize = this.inflateForOverflow(containerSize);\n }\n\n this.placeComponent(\n this._currentVisible,\n containerInsets.getLeft(),\n containerInsets.getTop(),\n containerSize ? containerSize.width : 0,\n containerSize ? containerSize.height : 0,\n FillType.BOTH\n );\n }\n}\n\nconst CardCallable = callable(Card);\ntype CardCallable = Card;\nexport {\n Card as _Card,\n CardCallable as Card\n};\n"],"mappings":"0DAwBA,IAAM,KAAN,cAAmB,CAAc,CAE7B,oBAA6C,KAC7C,gBAA4C,KAE5C,YAAY,EAAuB,CAG/B,MAAM,EAEF,GACA,KAAK,aAAa,CAAO,CAEjC,CAQA,aAAuB,EAA4B,CAC/C,MAAM,aAAa,CAAO,EAEtB,EAAQ,qBAAuB,IAAA,IAC/B,KAAK,sBAAsB,EAAQ,kBAAkB,CAE7D,CAOA,uBAAuC,CACnC,OAAO,KAAK,mBAChB,CAOA,kBAAgC,CAC5B,OAAO,KAAK,YAAY,GAAa,EAAU,iBAAiB,CAAC,CACrE,CAOA,YAA0B,CACtB,OAAO,KAAK,YAAY,GAAa,EAAU,WAAW,CAAC,CAC/D,CAOA,YAA0B,CACtB,OAAO,KAAK,YAAY,GAAa,EAAU,WAAW,CAAC,CAC/D,CAWA,YAAoB,EAA4D,CAC5E,IAAM,EAAY,KAAK,aAAa,EACpC,GAAI,CAAC,EACD,OAAO,KAGX,IAAM,EAAgB,EAAU,iBAAiB,EACjD,GAAI,CAAC,EACD,OAAO,KAGX,IAAM,EAAa,EAAc,KAAO,EAAc,MAChD,EAAc,EAAc,IAAM,EAAc,OAEhD,EAAmB,KAAK,oBAAoB,EAClD,GAAI,CAAC,EACD,OAAO,KAGX,IAAM,EAAO,EAAO,CAAgB,EAKpC,OAJK,EAIE,CACH,MAAO,EAAK,MAAQ,EACpB,OAAQ,EAAK,OAAS,CAC1B,EANW,IAOf,CAUA,sBAAsB,EAAkB,CAcpC,OAbI,KAAK,sBAAwB,EACtB,MAGX,KAAK,oBAAsB,EAC3B,KAAK,YAAY,EAMjB,KAAK,aAAa,CAAC,EAAE,eAAe,EAE7B,KACX,CAUA,qBAAwC,CAKpC,OAJK,KAAK,iBACN,KAAK,YAAY,EAGd,KAAK,eAChB,CAQA,aAA4B,CACxB,IAAM,EAAY,KAAK,aAAa,EACpC,GAAI,CAAC,EACD,OAGJ,IAAM,EAAa,EAAU,cAAc,EACvC,EAA6B,KAEjC,GAAI,KAAK,oBAAqB,CAC1B,IAAK,IAAM,KAAK,EACZ,GAAI,EAAE,MAAM,GAAK,KAAK,oBAAqB,CACvC,EAAW,EACX,KACJ,CAGC,GACD,QAAQ,KAAK,wEAAwE,CAE7F,CAEA,GAAI,CAAC,GAAY,EAAW,OAAS,IACjC,EAAW,EAAW,IAGtB,IAAa,KAAK,gBAItB,IAAI,KAAK,kBAAoB,SAKpB,IAAM,KAAK,EACR,IAAM,GACN,EAAE,WAAW,EAAK,OAI1B,KAAK,gBAAgB,WAAW,EAAK,EAGrC,GACA,EAAS,WAAW,EAAI,EAG5B,KAAK,gBAAkB,CAPkB,CAQ7C,CAUA,qBAAsC,CAOlC,OANK,KAAK,gBAIE,KAAK,gBAAgB,WAE1B,GAAO,CAAE,MAAO,EAAG,OAAQ,CAAE,EALzB,CAAE,MAAO,EAAG,OAAQ,CAAE,CAMrC,CAMA,UAAiB,CACb,IAAM,EAAY,KAAK,aAAa,EASpC,GARI,CAAC,IAIA,KAAK,iBACN,KAAK,YAAY,EAGjB,CAAC,KAAK,iBACN,OAGJ,IAAI,EAAgB,EAAU,aAAa,EACrC,EAAkB,EAAU,iBAAiB,EAMnD,AACI,IAAgB,KAAK,mBAAmB,CAAa,EAGzD,KAAK,eACD,KAAK,gBACL,EAAgB,QAAQ,EACxB,EAAgB,OAAO,EACvB,EAAgB,EAAc,MAAQ,EACtC,EAAgB,EAAc,OAAS,EACvC,EAAS,IACb,CACJ,CACJ,EAEM,EAAe,EAAS,IAAI"}
|
|
1
|
+
{"version":3,"file":"Card-P8iUH2-C.js","names":[],"sources":["../../src/typescript/lib/layout/Card.ts"],"sourcesContent":["// SPDX-License-Identifier: PolyForm-Noncommercial-1.0.0\n\nimport { LayoutManager, LayoutManagerOptions } from \"~/layout/LayoutManager.js\"\nimport { FillType } from \"~/layout/FillType.js\";\nimport { Size } from \"~/primitive/Size.js\";\nimport { Component } from \"~/core/Component.js\";\nimport { callable } from \"~/core/Callable.js\";\n\n/**\n * Construction-time options for {@link Card}.\n *\n * @category Layouts\n */\nexport interface CardOptions extends LayoutManagerOptions {\n visibleComponentId?: string;\n}\n\n/**\n * A layout manager that shows exactly one child component at a time,\n * sizing it to fill the container's inner bounds.\n * The visible child is selected by component ID; all others are hidden.\n *\n * @category Layouts\n */\nclass Card extends LayoutManager {\n\n private _visibleComponentId: string | null = null;\n private _currentVisible: Component | null = null;\n\n constructor(options?: CardOptions) {\n // LayoutManager's constructor takes no options; applied via applyOptions below.\n // eslint-disable-next-line local/forward-super-options\n super();\n\n if (options) {\n this.applyOptions(options);\n }\n }\n\n /**\n * Applies a {@link CardOptions} bag, dispatching the initial visible\n * component id after the inherited LayoutManager defaults.\n *\n * @param options - The options bag carrying the values to apply.\n */\n protected applyOptions(options: CardOptions): void {\n super.applyOptions(options);\n\n if (options.visibleComponentId !== undefined) {\n this.setVisibleComponentId(options.visibleComponentId);\n }\n }\n\n /**\n * Returns the ID of the currently visible child component, or `null` if none is set.\n *\n * @returns The visible component ID, or `null`.\n */\n getVisibleComponentId(): string | null {\n return this._visibleComponentId;\n }\n\n /**\n * Returns the preferred size of the visible child plus the container perimeter.\n *\n * @returns The preferred `{width, height}`, or `null` if there is no container or no visible component.\n */\n getPreferredSize(): Size | null {\n return this.computeSize(component => component.getPreferredSize());\n }\n\n /**\n * Returns the minimum size of the visible child plus the container perimeter.\n *\n * @returns The minimum `{width, height}`, or `null` if there is no container or no visible component.\n */\n getMinSize(): Size | null {\n return this.computeSize(component => component.getMinSize());\n }\n\n /**\n * Returns the maximum size of the visible child plus the container perimeter.\n *\n * @returns The maximum `{width, height}`, or `null` if there is no container or no visible component.\n */\n getMaxSize(): Size | null {\n return this.computeSize(component => component.getMaxSize());\n }\n\n /**\n * Shared core of {@link getPreferredSize} / {@link getMinSize} /\n * {@link getMaxSize}: adds the visible child's size (selected by `sizeOf`)\n * to the container perimeter.\n *\n * @param sizeOf - Selects the child's preferred, minimum, or maximum size.\n * @returns The composed `{width, height}`, or `null` if there is no\n * container, no visible component, or the child reports no size.\n */\n private computeSize(sizeOf: (component: Component) => Size | null): Size | null {\n const container = this.getContainer();\n if (!container) {\n return null;\n }\n\n const perimeterSize = container.getPerimeterSize();\n if (!perimeterSize) {\n return null;\n }\n\n const outerWidth = perimeterSize.left + perimeterSize.right;\n const outerHeight = perimeterSize.top + perimeterSize.bottom;\n\n const visibleComponent = this.getVisibleComponent();\n if (!visibleComponent) {\n return null;\n }\n\n const size = sizeOf(visibleComponent);\n if (!size) {\n return null;\n }\n\n return {\n width: size.width + outerWidth,\n height: size.height + outerHeight\n };\n }\n\n /**\n * Selects which child component is visible. Hides the previously-visible\n * child (if different) and shows the new one. Subsequent `doLayout` calls\n * only re-size the visible child; visibility writes happen here, not on\n * every layout pass.\n *\n * @param id - The ID of the child component to make visible.\n */\n setVisibleComponentId(id: string): this {\n if (this._visibleComponentId === id) {\n return this;\n }\n\n this._visibleComponentId = id;\n this.syncVisible();\n\n // Schedule a layout so a child first shown here gets sized: doLayout only\n // ever lays out the visible child, so a sibling that was hidden during\n // the initial pass has never been laid out and would render blank until\n // an unrelated relayout. No-op before the manager is attached.\n this.getContainer()?.scheduleLayout();\n\n return this;\n }\n\n /**\n * Returns the child component matching `visibleComponentId`, or the first\n * child if no ID is set. Result is cached; the cache is refreshed when\n * `setVisibleComponentId` is called or when `doLayout` runs without a\n * resolved component.\n *\n * @returns The resolved visible component, or `null` if the container is empty.\n */\n getVisibleComponent(): Component | null {\n if (!this._currentVisible) {\n this.syncVisible();\n }\n\n return this._currentVisible;\n }\n\n /**\n * Resolves the visible component from `visibleComponentId` (or first child\n * if unset), and transitions visibility: hides the previous one if\n * different, shows the new one. No-op when the resolved component is the\n * same as the currently-shown one.\n */\n private syncVisible(): void {\n const container = this.getContainer();\n if (!container) {\n return;\n }\n\n const components = container.getComponents();\n let resolved: Component | null = null;\n\n if (this._visibleComponentId) {\n for (const c of components) {\n if (c.getId() == this._visibleComponentId) {\n resolved = c;\n break;\n }\n }\n\n if (!resolved) {\n console.warn(\"Visible component id is specified but no matching component was found.\");\n }\n }\n\n if (!resolved && components.length > 0) {\n resolved = components[0];\n }\n\n if (resolved === this._currentVisible) {\n return;\n }\n\n if (this._currentVisible === null) {\n // First sync: components default to visible, so any sibling that\n // isn't the resolved child needs to be hidden explicitly. Without\n // this, e.g. a Cell's editor (sibling of its renderer) renders on\n // top of the renderer because its setVisible was never called.\n for (const c of components) {\n if (c !== resolved) {\n c.setVisible(false);\n }\n }\n } else {\n this._currentVisible.setVisible(false);\n }\n\n if (resolved) {\n resolved.setVisible(true);\n }\n\n this._currentVisible = resolved;\n }\n\n /**\n * Computes the children's combined minSize along this manager's geometry:\n * the currently-visible child's minSize. Used by `doLayout` to inflate\n * the working size when the host has opted into `setOverflowing`.\n *\n * @returns The visible child's min-size; `{ width: 0, height: 0 }` when\n * no child is visible.\n */\n protected computeTotalMinSize(): Size {\n if (!this._currentVisible) {\n return { width: 0, height: 0 };\n }\n\n const min = this._currentVisible.getMinSize();\n\n return min ?? { width: 0, height: 0 };\n }\n\n /**\n * Sizes the visible component to fill the container's inner bounds.\n * Visibility transitions are handled in `setVisibleComponentId`, not here.\n */\n doLayout(): void {\n const container = this.getContainer();\n if (!container) {\n return;\n }\n\n if (!this._currentVisible) {\n this.syncVisible();\n }\n\n if (!this._currentVisible) {\n return;\n }\n\n let containerSize = container.getInnerSize();\n const containerInsets = container.getContentInsets();\n\n // Universal scroll: see HBox.doLayout for the rationale. When the\n // host has marked the corresponding axis as overflowing, grow the\n // working size past the host's inner rect to the visible child's\n // minSize so the host's CSS `overflow: auto` produces a scrollbar.\n if (containerSize) {\n containerSize = this.inflateForOverflow(containerSize);\n }\n\n this.placeComponent(\n this._currentVisible,\n containerInsets.getLeft(),\n containerInsets.getTop(),\n containerSize ? containerSize.width : 0,\n containerSize ? containerSize.height : 0,\n FillType.BOTH\n );\n }\n}\n\nconst CardCallable = callable(Card);\ntype CardCallable = Card;\nexport {\n Card as _Card,\n CardCallable as Card\n};\n"],"mappings":"0DAwBA,IAAM,KAAN,cAAmB,CAAc,CAE7B,oBAA6C,KAC7C,gBAA4C,KAE5C,YAAY,EAAuB,CAG/B,MAAM,EAEF,GACA,KAAK,aAAa,CAAO,CAEjC,CAQA,aAAuB,EAA4B,CAC/C,MAAM,aAAa,CAAO,EAEtB,EAAQ,qBAAuB,IAAA,IAC/B,KAAK,sBAAsB,EAAQ,kBAAkB,CAE7D,CAOA,uBAAuC,CACnC,OAAO,KAAK,mBAChB,CAOA,kBAAgC,CAC5B,OAAO,KAAK,YAAY,GAAa,EAAU,iBAAiB,CAAC,CACrE,CAOA,YAA0B,CACtB,OAAO,KAAK,YAAY,GAAa,EAAU,WAAW,CAAC,CAC/D,CAOA,YAA0B,CACtB,OAAO,KAAK,YAAY,GAAa,EAAU,WAAW,CAAC,CAC/D,CAWA,YAAoB,EAA4D,CAC5E,IAAM,EAAY,KAAK,aAAa,EACpC,GAAI,CAAC,EACD,OAAO,KAGX,IAAM,EAAgB,EAAU,iBAAiB,EACjD,GAAI,CAAC,EACD,OAAO,KAGX,IAAM,EAAa,EAAc,KAAO,EAAc,MAChD,EAAc,EAAc,IAAM,EAAc,OAEhD,EAAmB,KAAK,oBAAoB,EAClD,GAAI,CAAC,EACD,OAAO,KAGX,IAAM,EAAO,EAAO,CAAgB,EAKpC,OAJK,EAIE,CACH,MAAO,EAAK,MAAQ,EACpB,OAAQ,EAAK,OAAS,CAC1B,EANW,IAOf,CAUA,sBAAsB,EAAkB,CAcpC,OAbI,KAAK,sBAAwB,EACtB,MAGX,KAAK,oBAAsB,EAC3B,KAAK,YAAY,EAMjB,KAAK,aAAa,CAAC,EAAE,eAAe,EAE7B,KACX,CAUA,qBAAwC,CAKpC,OAJK,KAAK,iBACN,KAAK,YAAY,EAGd,KAAK,eAChB,CAQA,aAA4B,CACxB,IAAM,EAAY,KAAK,aAAa,EACpC,GAAI,CAAC,EACD,OAGJ,IAAM,EAAa,EAAU,cAAc,EACvC,EAA6B,KAEjC,GAAI,KAAK,oBAAqB,CAC1B,IAAK,IAAM,KAAK,EACZ,GAAI,EAAE,MAAM,GAAK,KAAK,oBAAqB,CACvC,EAAW,EACX,KACJ,CAGC,GACD,QAAQ,KAAK,wEAAwE,CAE7F,CAEA,GAAI,CAAC,GAAY,EAAW,OAAS,IACjC,EAAW,EAAW,IAGtB,IAAa,KAAK,gBAItB,IAAI,KAAK,kBAAoB,SAKpB,IAAM,KAAK,EACR,IAAM,GACN,EAAE,WAAW,EAAK,OAI1B,KAAK,gBAAgB,WAAW,EAAK,EAGrC,GACA,EAAS,WAAW,EAAI,EAG5B,KAAK,gBAAkB,CAPkB,CAQ7C,CAUA,qBAAsC,CAOlC,OANK,KAAK,gBAIE,KAAK,gBAAgB,WAE1B,GAAO,CAAE,MAAO,EAAG,OAAQ,CAAE,EALzB,CAAE,MAAO,EAAG,OAAQ,CAAE,CAMrC,CAMA,UAAiB,CACb,IAAM,EAAY,KAAK,aAAa,EASpC,GARI,CAAC,IAIA,KAAK,iBACN,KAAK,YAAY,EAGjB,CAAC,KAAK,iBACN,OAGJ,IAAI,EAAgB,EAAU,aAAa,EACrC,EAAkB,EAAU,iBAAiB,EAMnD,AACI,IAAgB,KAAK,mBAAmB,CAAa,EAGzD,KAAK,eACD,KAAK,gBACL,EAAgB,QAAQ,EACxB,EAAgB,OAAO,EACvB,EAAgB,EAAc,MAAQ,EACtC,EAAgB,EAAc,OAAS,EACvC,EAAS,IACb,CACJ,CACJ,EAEM,EAAe,EAAS,IAAI"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{t as e}from"./DOM-CGn7xyTw.js";import{l as t,n}from"./Position-A39T7-_1.js";import{_ as r,f as i,h as a,t as o,y as s}from"./Component-DXf5a3g0.js";import{t as c}from"./Glyph-KEf4nIv2.js";import{t as l}from"./Panel-DzWdYwq1.js";import{t as u}from"./AnimatedDropdown-CZQEqQi-.js";import{t as d}from"./Fit-DjRsiwlg.js";import{t as f}from"./Text-gz6qjFfP.js";import{t as p}from"./AbstractInput-BxOtFrER.js";import{t as m}from"./AbstractBooleanInput-BGesvIZy.js";import{t as h}from"./HBox-Ce0GTCJP.js";import{t as g}from"./LayoutConstraints-DkctJZXB.js";import{n as _}from"./VBox-EIqw85Rh.js";import{t as v}from"./Button-U1rsP4v8.js";import{t as y}from"./Grid-DdL9TVeJ.js";import{chevron_left as b}from"./glyphs/solid/chevron_left.es.js";import{chevron_right as x}from"./glyphs/solid/chevron_right.es.js";import{clock as S}from"./glyphs/solid/clock.es.js";import{check as C}from"./glyphs/solid/check.es.js";import{r as w,t as T}from"./List-DtTVTyWW.js";import{chevron_down as ee}from"./glyphs/solid/chevron_down.es.js";var E=`var(--ts-ui-link-color, rgb(21, 101, 192))`;new r({scope:`selector`,name:`.Link`,styles:{textDecoration:`underline`}}),new r({scope:`selector`,name:`.Link:focus-visible`,styles:{outline:`2px solid var(--ts-ui-indicator-focus, rgb(30, 100, 200))`,outlineOffset:`1px`}});var D={tag:`a`,foregroundColor:E,cursor:`pointer`,interactive:!0},Link=class extends f{constructor(e,t){super(e,t,D),s.addListener(this,`keydown`,this.handleKeyDown),this.applyListeners(t?.listeners)}applyOptions(e){return super.applyOptions(e),this.setInteractive(e.interactive??this.isInteractive()),this}isInteractive(){return this._options.interactive??this._defaultOptions.interactive??!0}setInteractive(e){return this._options.interactive=e,e?this.getAria().setRole(`link`).setTabIndex(0):this.getAria().clearRole().setTabIndex(null),this}on(e,t){return s.addListener(this,`click`,t),this}off(e,t){return s.removeListener(this,`click`,t),this}click(){return s.fireEvent(this,`click`),this}destructor(){s.removeListener(this,`keydown`,this.handleKeyDown),super.destructor()}handleKeyDown(e){this.isInteractive()&&e.key===`Enter`&&(e.preventDefault(),this.click())}},O=i(Link);new r({scope:`selector`,name:`.TextField:focus, .TextArea:focus, .PasswordField:focus`,styles:{outline:`none`,boxShadow:`inset 0 0 0 2px var(--ts-ui-indicator-focus, rgb(30, 100, 200))`}});var k={tag:`input`,backgroundColor:`var(--ts-ui-input-bg, rgb(255, 255, 255))`,border:`var(--ts-ui-input-border)`,borderRadius:`var(--ts-ui-border-radius, 4px)`},TextInput=class extends p{constructor(e,t){super(e,{...k,...t??{}}),this.setElementCSSRules({fontFamily:`var(--ts-ui-font-family, sans-serif)`,fontSize:`var(--ts-ui-font-size, 14px)`,lineHeight:`calc(1em + var(--ts-ui-line-padding, 2px))`}),s.addListener(this,`input`,this.onInput)}onInput(){let t=this.getElement();this.setText(t?e.source.getValue(t):``),this.notifyChange(this.getValue())}applyOptions(e){return super.applyOptions(e),e.text!==void 0&&this.setText(e.text),e.textAlign!==void 0&&this.setTextAlign(e.textAlign),e.placeholder!==void 0&&this.setPlaceholder(e.placeholder),e.readOnly!==void 0&&this.setReadOnly(e.readOnly),e.enabled!==void 0&&this.setEnabled(e.enabled),e.maxLength!==void 0&&this.setMaxLength(e.maxLength),e.inputMode!==void 0&&this.setInputMode(e.inputMode),e.autoComplete!==void 0&&this.setAutoComplete(e.autoComplete),this}on(e,t){return e===`action`?(s.addListener(this,`input`,t),this):e===`keydown`?(s.addListener(this,`keydown`,t),this):super.on(e,t)}off(e,t){return e===`action`?(s.removeListener(this,`input`,t),this):e===`keydown`?(s.removeListener(this,`keydown`,t),this):super.off(e,t)}setType(e){return this._options.type=e,this.setElementAttribute(`type`,e),this}setName(e){return super.setName(e),e==null?this.removeElementAttribute(`name`):this.setElementAttribute(`name`,e),this}clearName(){return this._options.name===void 0?this:(this._options.name=void 0,this.removeElementAttribute(`name`),this)}getInputMode(){return this._options.inputMode??null}setInputMode(e){return this._options.inputMode===e?this:(this._options.inputMode=e,this.setElementAttribute(`inputmode`,e),this)}clearInputMode(){return this._options.inputMode===void 0?this:(this._options.inputMode=void 0,this.removeElementAttribute(`inputmode`),this)}getAutoComplete(){return this._options.autoComplete??null}setAutoComplete(e){return this._options.autoComplete===e?this:(this._options.autoComplete=e,this.setElementAttribute(`autocomplete`,e),this)}clearAutoComplete(){return this._options.autoComplete===void 0?this:(this._options.autoComplete=void 0,this.removeElementAttribute(`autocomplete`),this)}getBaseline(){return this.wrapInnerBaseline(t.measureTextBaseline())}getTextAlign(){return this._options.textAlign??null}setTextAlign(e){return this._options.textAlign=e,this.setElementCSSRule(`textAlign`,e),this}clearTextAlign(){return this.setTextAlign(null)}getText(){return this._options.text??``}setText(t){this._options.text=t||``;let n=this.getElement();return n&&e.sink.setValue(n,this._options.text),this}getValue(){return this.getText()}setValue(e){return this.setText(e)}getPlaceholder(){return this._options.placeholder??null}setPlaceholder(e){return this._options.placeholder=e,this.setElementAttribute(`placeholder`,e),this}clearPlaceholder(){return this._options.placeholder===void 0?this:(this._options.placeholder=void 0,this.removeElementAttribute(`placeholder`),this)}getMaxLength(){return this._options.maxLength??null}setMaxLength(e){return this._options.maxLength=e,this.setElementAttribute(`maxlength`,String(e)),this}clearMaxLength(){return this._options.maxLength===void 0?this:(this._options.maxLength=void 0,this.removeElementAttribute(`maxlength`),this)}select(t,n){let r=this.getElement();if(!r)return this;(!t||t<0)&&(t=0);let i=this._options.text??``;return(!n||n>i.length)&&(n=i.length+1),e.sink.setSelectionRange(r,t,n),this}applyEnabled(e){this.setDisabledAttribute(!e)}applyReadOnly(e){e?this.setElementAttribute(`readonly`,``):this.removeElementAttribute(`readonly`)}getElement(e=!1){return super.getElement(e)}init(t){super.init(t);let n=t||this.getElement();return this._options.type!==void 0&&e.sink.apply(n,{setAttr:{type:this._options.type}}),this._options.name!=null&&e.sink.apply(n,{setAttr:{name:this._options.name}}),this._options.placeholder!==void 0&&e.sink.apply(n,{setAttr:{placeholder:this._options.placeholder}}),this._options.readOnly&&e.sink.apply(n,{setAttr:{readonly:``}}),this._options.maxLength!==void 0&&e.sink.apply(n,{setAttr:{maxlength:String(this._options.maxLength)}}),this._options.inputMode!==void 0&&e.sink.apply(n,{setAttr:{inputmode:this._options.inputMode}}),this._options.autoComplete!==void 0&&e.sink.apply(n,{setAttr:{autocomplete:this._options.autoComplete}}),this}render(){let t=super.render();return e.sink.setValue(t,this._options.text??``),t}},A=i(TextInput),j={cursor:`text`,border:`none`,outline:`none`},PickerInput=class extends A{constructor(){super(void 0,j)}},M=i(PickerInput),PickerButton=class extends v{constructor(){super({chromeless:!0,insets:new n(0,4,0,4)})}},N=i(PickerButton),P={content:`''`,position:`absolute`,inset:`0`,border:`2px solid var(--ts-ui-indicator-focus, rgb(30, 100, 200))`,borderRadius:`inherit`,boxSizing:`border-box`,pointerEvents:`none`,zIndex:`1`};function registerFocusWithinRing(e){new r({scope:`selector`,name:e.split(`,`).map(e=>e.trim()+`:focus-within::after`).join(`, `),styles:P})}registerFocusWithinRing(`.DateField, .TimeField, .DateTimeField`);var F=24,I={cursor:`text`,padding:new n(3,3,3,3),backgroundColor:`var(--ts-ui-input-bg, rgb(255, 255, 255))`,foregroundColor:`var(--ts-ui-text-color, black)`,border:`var(--ts-ui-input-border)`,borderRadius:`var(--ts-ui-border-radius, 4px)`},AbstractPickerField=class extends p{_input;_button;_dropdown=null;_value=null;_invalid=!1;_showSeconds=!1;constructor(e){super(e,I),this._input=new M,this._input.setType(`text`),this._input.setInputMode(`none`),this._input.setAutoComplete(`off`),this._input.setPadding(new n(0,3,0,3)),this._button=new N,this.addComponent(this._input),this.addComponent(this._button),this.updateHeight(),this.subscribeTheme(()=>this.updateHeight()),s.addListener(this._input,`input`,()=>this.onInput()),s.addListener(this._input,`blur`,()=>this.onBlur()),s.addListener(this._input,`keydown`,e=>this.onKeyDown(e)),this._button.on(`action`,()=>this.onButtonClick()),this._button.addPointerDownListener(e=>this.onButtonPointerDown(e)),this._options.enabled!==void 0&&this.applyEnabled(this._options.enabled),this._options.readOnly!==void 0&&this.applyReadOnly(this._options.readOnly)}getDefaultBorder(){return I.border}applyOptions(e){return super.applyOptions(e),e.dropdownAnimated!==void 0&&this.setDropdownAnimated(e.dropdownAnimated),this}doLayout(){super.doLayout();let e=this.getWidth(),t=this.getHeight();return this._input.setX(0),this._input.setY(0),this._input.setWidth(Math.max(0,e-F)),this._input.setHeight(t),this._button.setX(e-F),this._button.setY(0),this._button.setWidth(F),this._button.setHeight(t),this._button.doLayout(),this}updateHeight(){let e=t.singleLineBoxHeight(this.getInsets(),this.getPadding(),this.getBorderSize());this.setPreferredSize({width:this.getPreferredWidth(),height:e}),this.setMaxSize({width:2**53-1,height:e}),this.setMinSize({width:0,height:e})}setValue(e){return this._value=e,this._input?.setText(e?this.formatValue(e):``),this}getValue(){return this._value}getBaseline(){return this.wrapInnerBaseline(this._input.getBaseline())}setDropdownAnimated(e){return this._options.dropdownAnimated=e,this._dropdown&&this._dropdown.setAnimated(e),this}isDropdownAnimated(){return this._options.dropdownAnimated??!0}applyEnabled(e){this._input.setEnabled(e)}applyReadOnly(e){this._input.setReadOnly(e)}onButtonClick(){this._dropdown?.isOpen()?this.closeDropdown():(this._input.focus(),this.openDropdown())}onButtonPointerDown(e){e.preventDefault()}onInput(){let e=this._input.getText();if(!e){this._value=null,this.setInvalid(!1),this.notifyChange(null);return}let t=this.parseRaw(e);t===null?this.setInvalid(!0):(this._value=t,this.setInvalid(!1),this.notifyChange(t))}onBlur(){this._invalid&&(this._input.setText(``),this._value=null,this.setInvalid(!1))}setInvalid(e){this._invalid!==e&&(this._invalid=e,e?this.setBorder({border:`1px solid var(--ts-ui-validation-error-border)`}):this.setBorder(this.getDefaultBorder()))}onKeyDown(e){if(this._dropdown&&this._dropdown.isOpen()&&this._dropdown.handleKey(e)){e.preventDefault();return}e.key===`ArrowDown`?(e.preventDefault(),this.openDropdown()):e.key===`Escape`&&this.closeDropdown()}ensureDropdown(){if(!this._dropdown){this._dropdown=this.createDropdown();let e=this._options.dropdownAnimated;e!==void 0&&this._dropdown.setAnimated(e)}return this._dropdown}openDropdown(){let e=this.ensureDropdown();e.isOpen()||(e.setCloseHandler(()=>this.closeDropdown()),e.setAnchorElement(this.getElement(!0)??null),e.showAt(this._input.getElement(!0),this._value))}closeDropdown(){this._dropdown&&this._dropdown.isOpen()&&this._dropdown.hideAnimated()}},L={cursor:`text`,padding:new n(3,3,3,3),backgroundColor:`var(--ts-ui-input-bg, rgb(255, 255, 255))`,foregroundColor:`var(--ts-ui-text-color, black)`},TextField=class extends A{constructor(e){super(e,L),this.updateHeight(),this.subscribeTheme(()=>this.updateHeight()),this.setType(`text`)}updateHeight(){let e=t.singleLineBoxHeight(this.getInsets(),this.getPadding(),this.getBorderSize());this.setPreferredSize({width:200,height:e}),this.setMaxSize({width:2**53-1,height:e}),this.setMinSize({width:0,height:e})}},R=i(TextField);new r({scope:`class`,name:`PickerColumnHeader`,styles:{opacity:`0.7`}}),new r({scope:`class`,name:`PickerCell`,styles:{borderRadius:`3px`}}),new r({scope:`selector`,name:`.PickerCell:hover`,styles:{backgroundColor:`var(--ts-ui-autocomplete-item-hover-bg, rgba(30, 100, 200, 0.08))`}}),new r({scope:`selector`,name:`.PickerCell.disabled`,styles:{pointerEvents:`none`,color:`var(--ts-ui-autocomplete-item-disabled-color, rgb(170, 170, 170))`,backgroundColor:`var(--ts-ui-picker-cell-disabled-bg, transparent)`}});var PickerColumnHeader=class extends f{constructor(e){super(e,{textAlign:`center`,fontSize:12})}},PickerCellList=class extends l{constructor(){super({layoutManager:new _({spacing:0,stretching:!0}),autoScroll:`y`,insets:new n(0,0,0,0)})}getMinSize(){let e=super.getMinSize();return e&&{width:e.width,height:0}}},PickerCell=class extends f{_selected=!1;_disabled=!1;_onClick;constructor(e,t){super(e,{textAlign:`center`,preferredSize:{width:0,height:22}}),this._onClick=t,this.setLineHeight(22),this.setCursor(`pointer`),s.addListener(this,`pointerdown`,this.handlePointerDown),s.addListener(this,`click`,this.handleClick)}handlePointerDown(e){e.preventDefault()}handleClick(){this._disabled||this._onClick()}setSelected(e){return this._selected===e?this:(this._selected=e,e?(this.setBackgroundColor(`var(--ts-ui-autocomplete-item-highlight-bg, rgba(30, 100, 200, 0.18))`),this.setFontWeight(`bold`)):(this.clearBackgroundColor(),this.setFontWeight(`normal`)),this)}isSelected(){return this._selected}setDisabled(t){if(this._disabled===t)return this;this._disabled=t,this.setCursor(t?`default`:`pointer`);let n=this.getElement();return n&&e.sink.apply(n,{toggleClass:{disabled:t}}),this}isDisabled(){return this._disabled}render(){let t=super.render();return this._disabled&&e.sink.apply(t,{addClass:[`disabled`]}),t}},PickerColumn=class extends o{_cellList;constructor(e){if(super(),this.setLayoutManager(new _({spacing:2,stretching:!0})),e!==null){let t=new PickerColumnHeader(e);t.setPreferredSize({width:0,height:18}),this.addComponent(t)}this._cellList=new PickerCellList;let t=new g;t.weight=1,this.addComponent(this._cellList,t)}addCell(e){return this._cellList.addComponent(e),this}clearCells(){return this._cellList.removeAllComponents(),this}getCellList(){return this._cellList}scrollSelectedIntoView(){let n=this._cellList.getElement();if(!n)return this;let r=this._cellList.getComponents(),i=null;for(let e of r)if(e instanceof PickerCell&&e.isSelected()){i=e;break}if(!i)return this;let a=i.getElement();if(!a)return this;let o=e.source.getOffsetSize(a),s=e.source.getScrollMetrics(n),c=o.offsetTop,l=o.offsetHeight,u=s.clientHeight,d=c-(u-l)/2,f=s.scrollHeight-u,p=t.clamp(d,0,f);return e.sink.apply(n,{scrollTop:p}),this}setSelectedValue(e){for(let t of this._cellList.getComponents())t instanceof PickerCell&&t.setSelected(t.getText().valueOf()===e);return this}};c.register(b),c.register(x),new r({scope:`class`,name:`PickerDay`,styles:{borderRadius:`3px`}}),new r({scope:`selector`,name:`.PickerDay:hover`,styles:{backgroundColor:`var(--ts-ui-autocomplete-item-hover-bg, rgba(30, 100, 200, 0.08))`}}),new r({scope:`selector`,name:`.PickerDay.disabled`,styles:{pointerEvents:`none`,color:`var(--ts-ui-autocomplete-item-disabled-color, rgb(170, 170, 170))`,backgroundColor:`var(--ts-ui-picker-cell-disabled-bg, transparent)`}}),new r({scope:`class`,name:`PickerNavButton`,styles:{borderRadius:`3px`,color:`var(--ts-ui-picker-nav-fg, var(--ts-ui-text-color))`}}),new r({scope:`selector`,name:`.PickerNavButton:hover`,styles:{backgroundColor:`var(--ts-ui-picker-nav-hover-bg, rgba(30, 100, 200, 0.08))`}});var PickerDayHeader=class extends f{constructor(e){super(e,{textAlign:`center`,fontSize:12,preferredSize:{width:0,height:20}}),this.setLineHeight(20)}},PickerBlankCell=class extends o{constructor(){super({preferredSize:{width:0,height:24}})}},PickerNavButton=class extends o{constructor(e,t){super({preferredSize:{width:24,height:24}}),this.setLayoutManager(new d),this.setCursor(`pointer`),this.getAria().setRole(`button`);let n=new c(e);n.setPointerEvents(`none`),n.setPreferredSize({width:12,height:12}),this.addComponent(n),s.addListener(this,`pointerdown`,e=>e.preventDefault()),s.addListener(this,`click`,()=>t())}render(){let t=super.render();return e.sink.apply(t,{addClass:[`PickerNavButton`]}),t}},PickerMonthLabel=class extends f{constructor(e){super(``,{textAlign:`center`,fontWeight:`bold`}),this.setLineHeight(24),this.setCursor(`pointer`),this.getAria().setRole(`button`),this.getAria().setExpanded(!1),this.getAria().setTabIndex(0),s.addListener(this,`pointerdown`,e=>e.preventDefault()),s.addListener(this,`click`,()=>e())}render(){let t=super.render();return e.sink.apply(t,{addClass:[`PickerNavButton`]}),t}},PickerDay=class extends f{_date;_selected=!1;_disabled=!1;_onClick;constructor(e,t){super(String(e.getDate()),{textAlign:`center`,preferredSize:{width:0,height:24}}),this._date=e,this._onClick=t,this.setLineHeight(24),this.setCursor(`pointer`),s.addListener(this,`pointerdown`,e=>this.onPointerDown(e)),s.addListener(this,`click`,()=>this.onClick())}getDate(){return this._date}onPointerDown(e){e.preventDefault()}onClick(){this._disabled||this._onClick(this._date)}setSelected(e){return this._selected===e?this:(this._selected=e,e?(this.setBackgroundColor(`var(--ts-ui-autocomplete-item-highlight-bg, rgba(30, 100, 200, 0.18))`),this.setFontWeight(`bold`)):(this.clearBackgroundColor(),this.setFontWeight(`normal`)),this)}isSelected(){return this._selected}setDisabled(t){if(this._disabled===t)return this;this._disabled=t,this.setCursor(t?`default`:`pointer`);let n=this.getElement();return n&&e.sink.apply(n,{toggleClass:{disabled:t}}),this}isDisabled(){return this._disabled}render(){let t=super.render();return e.sink.apply(t,{addClass:[`PickerDay`]}),this._disabled&&e.sink.apply(t,{addClass:[`disabled`]}),t}};function dayStart(e){return new Date(e.getFullYear(),e.getMonth(),e.getDate(),0,0,0,0)}function dayEnd(e){return new Date(e.getFullYear(),e.getMonth(),e.getDate(),23,59,59,999)}var AbstractCalendarDropdown=class extends u{_onSelect;_value=null;_monthAnchor=new Date;_yearScrollOpen=!1;_root;_headerRow;_prevButton;_nextButton;_monthLabel;_weekdayRow;_dayGrid;_yearColumn=null;_highlightedDayIdx=-1;_highlightedYear=-1;_yearTypeBuffer=``;_yearTypeTimer=null;constructor(e,t,r){super(t,{zIndex:10050,layoutManager:new d,backgroundColor:`var(--ts-ui-autocomplete-bg, rgb(255, 255, 255))`,border:`var(--ts-ui-input-border)`,borderRadius:`var(--ts-ui-border-radius, 4px)`,shadow:`var(--ts-ui-autocomplete-shadow, 2px 4px 8px rgba(0,0,0,0.15))`,insets:new n(6,6,6,6),...r??{}}),this._onSelect=e,this.getAria().setRole(`group`),this.setContain(`layout`),this._root=new o,this._root.setLayoutManager(new _({spacing:4,stretching:!0})),this._headerRow=new o({preferredSize:{width:0,height:24}}),this._headerRow.setLayoutManager(new h({spacing:2,stretching:!0})),this._prevButton=new PickerNavButton(`chevron-left`,()=>this.prevMonth()),this._nextButton=new PickerNavButton(`chevron-right`,()=>this.nextMonth()),this._monthLabel=new PickerMonthLabel(()=>this.toggleYearScroller());let i=new g;i.weight=1,this._headerRow.addComponent(this._prevButton),this._headerRow.addComponent(this._monthLabel,i),this._headerRow.addComponent(this._nextButton),this._root.addComponent(this._headerRow),this._weekdayRow=new o({preferredSize:{width:0,height:20}}),this._weekdayRow.setLayoutManager(new y({columns:7,spacing:2}));for(let e of[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`])this._weekdayRow.addComponent(new PickerDayHeader(e));this._root.addComponent(this._weekdayRow),this._dayGrid=new o({preferredSize:{width:0,height:154}}),this._dayGrid.setLayoutManager(new y({columns:7,spacing:2})),this._root.addComponent(this._dayGrid),this.addComponent(this._root),this.buildExtraRootChildren(),s.addSubtreeListener(this,`pointerdown`,e=>this.onPointerDown(e))}applyOptions(e){return super.applyOptions(e),e.minDate!==void 0&&(this._options.minDate=e.minDate),e.maxDate!==void 0&&(this._options.maxDate=e.maxDate),this}onPointerDown(t){e.source.isNode(t.target)&&e.source.getTagName(e.source.intern(t.target))===`INPUT`||t.preventDefault()}showAt(t,n){this._value=n?new Date(n.getTime()):null;let r=this._value??new Date;this._monthAnchor=new Date(r.getFullYear(),r.getMonth(),1),this._highlightedDayIdx=-1,this._highlightedYear=-1,this.resetYearTypeBuffer(),this._yearScrollOpen&&this.closeYearScroller(),this.pauseLayout(),this.rebuild(),this.resumeLayout();let i=this.computePanelHeight();return this.setWidth(this.getPanelWidth()),this.setHeight(i),this.doLayout(),this.placeAnchored(e.source.getElementRect(t)),this.showAnimated(),this}hideAnimated(){return super.hideAnimated(),this.resetYearTypeBuffer(),this}computePanelHeight(){let e=this.getPerimeterSize(),t=206+this.getExtraInnerHeight();return e.top+e.bottom+t}rebuild(){this.buildDayGrid(),this.rebuildExtraRowsAfterValueChange()}buildDayGrid(){this._dayGrid.removeAllComponents(),this._highlightedDayIdx=-1;let e=this._monthAnchor.getFullYear(),t=this._monthAnchor.getMonth();this._monthLabel.setText(this._monthAnchor.toLocaleDateString(void 0,{month:`long`,year:`numeric`}));let n=new Date(e,t,1).getDay(),r=new Date(e,t+1,0).getDate();for(let e=0;e<n;e++)this._dayGrid.addComponent(new PickerBlankCell);for(let n=1;n<=r;n++){let r=new Date(e,t,n),i=new PickerDay(r,e=>this.onDateSelected(e));this.isDateInRange(r)||i.setDisabled(!0),this.isValueOnDay(r)&&i.setSelected(!0),this._dayGrid.addComponent(i)}let i=42-n-r;for(let e=0;e<i;e++)this._dayGrid.addComponent(new PickerBlankCell)}isValueOnDay(e){return this._value?this._value.getFullYear()===e.getFullYear()&&this._value.getMonth()===e.getMonth()&&this._value.getDate()===e.getDate():!1}isDateInRange(e){let t=this._options.minDate??null,n=this._options.maxDate??null;return!(t&&e.getTime()<dayStart(t).getTime()||n&&e.getTime()>dayEnd(n).getTime())}hasAnyInRange(e){let t=e.getFullYear(),n=e.getMonth(),r=new Date(t,n+1,0).getDate(),i=new Date(t,n,1),a=new Date(t,n,r),o=this._options.minDate??null,s=this._options.maxDate??null;return!(o&&dayEnd(a).getTime()<dayStart(o).getTime()||s&&dayStart(i).getTime()>dayEnd(s).getTime())}onDateSelected(e){this.applyDateSelection(e),this._monthAnchor=new Date(e.getFullYear(),e.getMonth(),1),this.notifyValueChanged(),this.rebuild(),this.doLayout()}notifyValueChanged(){this._value&&this._onSelect(new Date(this._value.getTime()))}prevMonth(){let e=new Date(this._monthAnchor.getFullYear(),this._monthAnchor.getMonth()-1,1);this.hasAnyInRange(e)&&(this._monthAnchor=e,this._yearScrollOpen?(this.updateMonthLabel(),this.refreshYearSelection()):(this.buildDayGrid(),this.doLayout()))}nextMonth(){let e=new Date(this._monthAnchor.getFullYear(),this._monthAnchor.getMonth()+1,1);this.hasAnyInRange(e)&&(this._monthAnchor=e,this._yearScrollOpen?(this.updateMonthLabel(),this.refreshYearSelection()):(this.buildDayGrid(),this.doLayout()))}updateMonthLabel(){this._monthLabel.setText(this._monthAnchor.toLocaleDateString(void 0,{month:`long`,year:`numeric`}))}toggleYearScroller(){this._yearScrollOpen?this.closeYearScroller():this.openYearScroller()}openYearScroller(){this._yearColumn||(this._yearColumn=new PickerColumn(null),this._yearColumn.setPreferredSize({width:0,height:154}),this._yearColumn.getAria().setRole(`listbox`)),this.buildYearScroller(),this._root.removeComponent(this._dayGrid),this._root.insertComponent(this._yearColumn,2),this._yearScrollOpen=!0,this._monthLabel.getAria().setExpanded(!0),this.doLayout(),this._yearColumn.scrollSelectedIntoView()}closeYearScroller(){this._yearColumn&&this._root.removeComponent(this._yearColumn),this._root.insertComponent(this._dayGrid,2),this._yearScrollOpen=!1,this._monthLabel.getAria().setExpanded(!1),this.resetYearTypeBuffer(),this.buildDayGrid(),this.doLayout()}buildYearScroller(){if(!this._yearColumn)return;this._yearColumn.clearCells(),this._highlightedYear=-1;let e=new Date,t=this._options.minDate?.getFullYear()??e.getFullYear()-120,n=this._options.maxDate?.getFullYear()??e.getFullYear()+50,r=this._monthAnchor.getFullYear();for(let e=t;e<=n;e++){let t=e,n=new PickerCell(String(t),()=>this.onYearSelected(t));t===r&&n.setSelected(!0),this._yearColumn.addCell(n)}}refreshYearSelection(){if(!this._yearColumn)return;let e=this._monthAnchor.getFullYear();for(let t of this._yearColumn.getCellList().getComponents())t instanceof PickerCell&&t.setSelected(t.getText().valueOf()===String(e))}onYearSelected(e){this._monthAnchor=new Date(e,this._monthAnchor.getMonth(),1),this.applyYearSelection(e),this.closeYearScroller()}resetYearTypeBuffer(){this._yearTypeBuffer=``,this._yearTypeTimer!==null&&(clearTimeout(this._yearTypeTimer),this._yearTypeTimer=null)}handleKey(e){return this.isOpen()?this._yearScrollOpen?this.handleKeyInYearScroller(e):this.handleKeyInDayGrid(e):!1}handleKeyInDayGrid(e){switch(e.key){case`ArrowLeft`:return this.moveHighlightedDay(-1);case`ArrowRight`:return this.moveHighlightedDay(1);case`ArrowUp`:return this.moveHighlightedDay(-7);case`ArrowDown`:return this.moveHighlightedDay(7);case`PageUp`:return this.prevMonth(),!0;case`PageDown`:return this.nextMonth(),!0;case`Home`:return this.highlightFirstDayOfMonth();case`End`:return this.highlightLastDayOfMonth();case`Enter`:case` `:return this.commitHighlightedDay();default:return!1}}getDayGridChildren(){return this._dayGrid.getComponents()}moveHighlightedDay(e){let t=this.getDayGridChildren(),n=[];for(let e=0;e<t.length;e++){let r=t[e];r instanceof PickerDay&&!r.isDisabled()&&n.push({idx:e,cell:r})}if(n.length===0)return!0;let r=-1;for(let e=0;e<n.length;e++)if(n[e].idx===this._highlightedDayIdx){r=e;break}if(r<0){r=0;for(let e=0;e<n.length;e++)if(n[e].cell.isSelected()){r=e;break}}let i=Math.max(0,Math.min(n.length-1,r+e));return this.setHighlightedDay(n[i].idx),!0}setHighlightedDay(e){let t=this.getDayGridChildren();if(this._highlightedDayIdx>=0&&this._highlightedDayIdx<t.length){let e=t[this._highlightedDayIdx];e instanceof PickerDay&&!this.matchesSelection(e)&&e.setSelected(!1)}if(e<0||e>=t.length){this._highlightedDayIdx=-1;return}let n=t[e];n instanceof PickerDay&&(n.setSelected(!0),this._highlightedDayIdx=e)}matchesSelection(e){return this.isValueOnDay(e.getDate())}highlightFirstDayOfMonth(){let e=this.getDayGridChildren();for(let t=0;t<e.length;t++){let n=e[t];if(n instanceof PickerDay&&!n.isDisabled())return this.setHighlightedDay(t),!0}return!0}highlightLastDayOfMonth(){let e=this.getDayGridChildren();for(let t=e.length-1;t>=0;t--){let n=e[t];if(n instanceof PickerDay&&!n.isDisabled())return this.setHighlightedDay(t),!0}return!0}commitHighlightedDay(){if(this._highlightedDayIdx<0)return!1;let e=this.getDayGridChildren()[this._highlightedDayIdx];return e instanceof PickerDay&&!e.isDisabled()?(this.onDateSelected(e.getDate()),!0):!1}handleKeyInYearScroller(e){if(/^[0-9]$/.test(e.key))return this.appendYearDigit(e.key);switch(e.key){case`ArrowLeft`:case`ArrowUp`:return this.moveHighlightedYear(-1);case`ArrowRight`:case`ArrowDown`:return this.moveHighlightedYear(1);case`PageUp`:return this.moveHighlightedYear(-10);case`PageDown`:return this.moveHighlightedYear(10);case`Home`:return this.highlightFirstYear();case`End`:return this.highlightLastYear();case`Enter`:case` `:return this.commitHighlightedYear();case`Escape`:return this.closeYearScroller(),!0;default:return!1}}getYearCells(){if(!this._yearColumn)return[];let e=[];for(let t of this._yearColumn.getCellList().getComponents())t instanceof PickerCell&&e.push(t);return e}moveHighlightedYear(e){let t=this.getYearCells();if(t.length===0)return!0;let n=this.findHighlightedYearPos(t),r=Math.max(0,Math.min(t.length-1,n+e));return this.applyYearHighlight(t,r),!0}findHighlightedYearPos(e){if(this._highlightedYear<0){for(let t=0;t<e.length;t++)if(e[t].isSelected())return t;return 0}for(let t=0;t<e.length;t++)if(e[t].getText().valueOf()===String(this._highlightedYear))return t;return 0}applyYearHighlight(e,t){let n=this._monthAnchor.getFullYear();for(let t of e)t.setSelected(t.getText().valueOf()===String(n));e[t].setSelected(!0),this._highlightedYear=parseInt(e[t].getText().valueOf(),10),this._yearColumn&&this._yearColumn.scrollSelectedIntoView()}highlightFirstYear(){let e=this.getYearCells();return e.length===0||this.applyYearHighlight(e,0),!0}highlightLastYear(){let e=this.getYearCells();return e.length===0||this.applyYearHighlight(e,e.length-1),!0}commitHighlightedYear(){let e=this._highlightedYear>=0?this._highlightedYear:this._monthAnchor.getFullYear();return this.onYearSelected(e),!0}appendYearDigit(e){this._yearTypeBuffer.length>=4&&(this._yearTypeBuffer=``),this._yearTypeBuffer+=e,this._yearTypeTimer!==null&&clearTimeout(this._yearTypeTimer),this._yearTypeTimer=setTimeout(()=>this.resetYearTypeBuffer(),800);let t=this.getYearCells(),n=this._yearTypeBuffer,r=-1;for(let e=0;e<t.length;e++)if(t[e].getText().valueOf().startsWith(n)){r=e;break}return r>=0&&this.applyYearHighlight(t,r),n.length===4&&this.resetYearTypeBuffer(),!0}getExtraInnerHeight(){return 0}buildExtraRootChildren(){}rebuildExtraRowsAfterValueChange(){}applyDateSelection(e){this._value=new Date(e.getFullYear(),e.getMonth(),e.getDate(),0,0,0,0)}applyYearSelection(e){}},z=240,DatePickerDropdown=class extends AbstractCalendarDropdown{constructor(e,t){super(e,t)}getPanelWidth(){return z}onDateSelected(e){this.applyDateSelection(e),this._monthAnchor=new Date(e.getFullYear(),e.getMonth(),1),this.notifyValueChanged()}},B=i(DatePickerDropdown),TimeColumns=class extends o{_onChange;_showSeconds;_hours=-1;_minutes=-1;_seconds=-1;_hourColumn;_minuteColumn;_secondColumn;constructor(e,t){super({preferredSize:{width:0,height:176}}),this._onChange=e,this._showSeconds=t?.showSeconds??!1,this.setLayoutManager(new h({spacing:4,stretching:!0}));let n=new g;n.weight=1,this._hourColumn=this.buildColumn(`Hour`,24,1,e=>this.onUnitSelected(`hours`,e)),this._minuteColumn=this.buildColumn(`Min`,60,5,e=>this.onUnitSelected(`minutes`,e)),this.addComponent(this._hourColumn,n),this.addComponent(this._minuteColumn,n),this._showSeconds?(this._secondColumn=this.buildColumn(`Sec`,60,5,e=>this.onUnitSelected(`seconds`,e)),this.addComponent(this._secondColumn,n)):this._secondColumn=null}setTime(e){return e?(this._hours=e.getHours(),this._minutes=e.getMinutes(),this._seconds=this._showSeconds?e.getSeconds():0):(this._hours=-1,this._minutes=-1,this._seconds=-1),this.refreshColumns(),this}buildColumn(e,t,n,r){let i=new PickerColumn(e);for(let e=0;e<t;e+=n){let t=e,n=new PickerCell(String(t).padStart(2,`0`),()=>r(t));i.addCell(n)}return i}onUnitSelected(e,t){e===`hours`?this._hours=t:e===`minutes`?this._minutes=t:this._seconds=t,this._hours<0&&(this._hours=0),this._minutes<0&&(this._minutes=0),this._seconds<0&&(this._seconds=0),this.refreshColumns(),this._onChange(this._hours,this._minutes,this._showSeconds?this._seconds:0)}refreshColumns(){this._hourColumn.setSelectedValue(this.cellLabel(this._hours)),this._minuteColumn.setSelectedValue(this.cellLabel(this._minutes)),this._secondColumn?.setSelectedValue(this.cellLabel(this._seconds))}cellLabel(e){return e<0?null:String(e).padStart(2,`0`)}},V=140,H=200,U=220,TimePickerDropdown=class extends u{_showSeconds;_timeColumns;constructor(e,t){super(t,{zIndex:10050,layoutManager:new d,backgroundColor:`var(--ts-ui-autocomplete-bg, rgb(255, 255, 255))`,border:`var(--ts-ui-input-border)`,borderRadius:`var(--ts-ui-border-radius, 4px)`,shadow:`var(--ts-ui-autocomplete-shadow, 2px 4px 8px rgba(0,0,0,0.15))`,insets:new n(4,4,4,4)}),this._showSeconds=t?.showSeconds??!1,this.getAria().setRole(`group`),this.setContain(`layout`),this._timeColumns=new TimeColumns(e,{showSeconds:this._showSeconds}),this.addComponent(this._timeColumns),s.addSubtreeListener(this,`pointerdown`,e=>this.onPointerDown(e))}onPointerDown(e){e.preventDefault()}showAt(t,n){return this._timeColumns.setTime(n),this.setWidth(this._showSeconds?H:V),this.setHeight(U),this.placeAnchored(e.source.getElementRect(t)),this.showAnimated(),this.doLayout(),this}},W=i(TimePickerDropdown);c.register(S);var TimeField=class extends AbstractPickerField{constructor(e){super(e),this._button.setGlyph(`clock`),this._options.showSeconds!==void 0&&(this._showSeconds=this._options.showSeconds),this._options.value!==void 0&&this.setValue(this._options.value)}applyOptions(e){return super.applyOptions(e),e.showSeconds!==void 0&&(this._options.showSeconds=e.showSeconds),e.value!==void 0&&(this._options.value=e.value),this}formatValue(e){let t=String(e.getHours()).padStart(2,`0`),n=String(e.getMinutes()).padStart(2,`0`);return this._showSeconds?`${t}:${n}:${String(e.getSeconds()).padStart(2,`0`)}`:`${t}:${n}`}parseRaw(e){let[t,n,r]=e.split(`:`),i=Number(t),a=Number(n),o=r===void 0?0:Number(r);if(!(n!==void 0&&n!==``)||!(!isNaN(i)&&i>=0&&i<24)||!(!isNaN(a)&&a>=0&&a<60)||!(!isNaN(o)&&o>=0&&o<60))return null;let s=new Date;return s.setHours(i,a,o,0),s}createDropdown(){return new W((e,t,n)=>this.onTimeSelected(e,t,n),{showSeconds:this._showSeconds})}onTimeSelected(e,t,n){let r=new Date;r.setHours(e,t,n,0),this.onDropdownSelected(r)}onDropdownSelected(e){this.setValue(e),s.fireEvent(this._input,`input`)}getPreferredWidth(){return 140}},G=i(TimeField),K=240,DateTimePickerDropdown=class extends AbstractCalendarDropdown{constructor(e,t){super(e,t)}applyOptions(e){return super.applyOptions(e),e.showSeconds!==void 0&&(this._options.showSeconds=e.showSeconds),this}buildExtraRootChildren(){this._timeField=new G({showSeconds:this.isShowingSeconds()}),this._timeField.on(`change`,e=>this.onTimeFieldChange(e)),this._root.addComponent(this._timeField)}rebuildExtraRowsAfterValueChange(){this._timeField.setValue(this._value)}onTimeFieldChange(e){if(!e)return;let t=this._value??this.todayMidnight();t.setHours(e.getHours(),e.getMinutes(),this.isShowingSeconds()?e.getSeconds():0,0),this._value=t,this.notifyValueChanged()}applyDateSelection(e){this._value?this._value.setFullYear(e.getFullYear(),e.getMonth(),e.getDate()):this._value=new Date(e.getFullYear(),e.getMonth(),e.getDate(),0,0,0,0)}applyYearSelection(e){this._value&&(this._value.setFullYear(e),this.notifyValueChanged())}getPanelWidth(){return K}getExtraInnerHeight(){return 4+(this._timeField.getPreferredSize()?.height??0)}isShowingSeconds(){return this._options.showSeconds??!1}todayMidnight(){let e=new Date;return new Date(e.getFullYear(),e.getMonth(),e.getDate(),0,0,0,0)}},q=i(DateTimePickerDropdown);c.register(C);var Checkbox=class extends m{_box;_check;_dash;constructor(e){super({...e??{}}),this.setLayoutManager(new h),this._box=new o,this._box.setPreferredSize({width:16,height:16}),this._box.setMinSize({width:16,height:16}),this._box.setMaxSize({width:16,height:16}),this._box.setSize({width:16,height:16}),this._box.setBackgroundColor(`var(--ts-ui-checkbox-bg, var(--ts-ui-form-bg, rgb(255, 255, 255)))`),this._box.setBorder(`1px solid var(--ts-ui-form-border, rgb(160, 160, 160))`),this._box.setBorderRadius(`var(--ts-ui-checkbox-radius, 3px)`),this._box.setCursor(`pointer`),this._check=new c(`check`),this._check.setForegroundColor(`var(--ts-ui-checkbox-check-color, rgb(255, 255, 255))`),this._check.setPreferredSize({width:12,height:12}),this._check.setMaxSize({width:12,height:12}),this._check.setX(1),this._check.setY(1),this._check.setOpacity(0),this._check.setPointerEvents(`none`),this._dash=new o,this._dash.setBackgroundColor(`var(--ts-ui-checkbox-check-color, rgb(255, 255, 255))`),this._dash.setPreferredSize({width:8,height:2}),this._dash.setMaxSize({width:8,height:2}),this._dash.setSize({width:8,height:2}),this._dash.setX(3),this._dash.setY(6),this._dash.setOpacity(0),this._dash.setPointerEvents(`none`),a.isReducedMotion()||(this._check.setTransition(`opacity 120ms ease-out`),this._dash.setTransition(`opacity 120ms ease-out`),this._box.setTransition(`background-color 120ms ease-out, border-color 120ms ease-out`)),this._box.addComponent(this._check),this._box.addComponent(this._dash),super.addComponent(this._box),this.getAria().setRole(`checkbox`),this.getAria().setTabIndex(0),this.getAria().setChecked(!1),this.setOutline(`none`),s.addListener(this._box,`click`,()=>this.activateFromPointer()),this.installKeyboard(),this._options.value!==void 0&&this._options.selected===void 0&&(this._options.selected=this._options.value),this._options.selected!==void 0&&this.applySelected(this._options.selected,this._options.indeterminate??!1),this._options.indeterminate!==void 0&&this.applySelected(this._options.selected??!1,this._options.indeterminate),this._options.label!==void 0&&this.applyLabel(this._options.label),this._options.enabled!==void 0&&this.applyEnabled(this._options.enabled),this._options.readOnly!==void 0&&this.applyReadOnly(this._options.readOnly)}applyOptions(e){return super.applyOptions(e),e.selected!==void 0&&(this._options.selected=e.selected),e.value!==void 0&&(this._options.value=e.value),e.indeterminate!==void 0&&(this._options.indeterminate=e.indeterminate),e.label!==void 0&&(this._options.label=e.label),e.enabled!==void 0&&(this._options.enabled=e.enabled),e.readOnly!==void 0&&(this._options.readOnly=e.readOnly),this}activate(){if(this.isIndeterminate()){this.setSelected(!0);return}this.setSelected(!this.isSelected())}getInteractiveSurface(){return this._box}isSelected(){return this._options.selected??!1}setSelected(e){let t=!!e;return t===this.isSelected()&&!this.isIndeterminate()?this:(this._options.selected=t,this._options.indeterminate=!1,this.applySelected(t,!1),this.notifyChange(t),this.getElement()?s.fireEvent(this,`click`):console.warn(`Checkbox '`+this.getId()+`' setSelected before mount; synthetic 'click' skipped.`),this)}getValue(){return this.isSelected()}setValue(e){return this.setSelected(e)}isIndeterminate(){return this._options.indeterminate??!1}setIndeterminate(e){let t=!!e;return t===this.isIndeterminate()?this:(this._options.indeterminate=t,this.applySelected(this.isSelected(),t),this)}setAnimated(e){let t=e&&!a.isReducedMotion();return this._check.setTransition(t?`opacity 120ms ease-out`:`none`),this._dash.setTransition(t?`opacity 120ms ease-out`:`none`),this._box.setTransition(t?`background-color 120ms ease-out, border-color 120ms ease-out`:`none`),this}on(e,t){return e===`action`?(s.addListener(this,`click`,t),this):super.on(e,t)}off(e,t){return e===`action`?(s.removeListener(this,`click`,t),this):super.off(e,t)}applySelected(e,t){t?this.getAria().setChecked(`mixed`):this.getAria().setChecked(e);let n=t?`var(--ts-ui-checkbox-bg-indeterminate, rgb(160, 160, 160))`:e?`var(--ts-ui-checkbox-bg-selected, rgb(30, 100, 200))`:`var(--ts-ui-checkbox-bg, var(--ts-ui-form-bg, rgb(255, 255, 255)))`,r=e||t?`1px solid `+(t?`var(--ts-ui-checkbox-bg-indeterminate, rgb(160, 160, 160))`:`var(--ts-ui-checkbox-bg-selected, rgb(30, 100, 200))`):`1px solid var(--ts-ui-form-border, rgb(160, 160, 160))`;this._box.setBackgroundColor(n),this._box.setBorder(r),this._check.setOpacity(e&&!t?1:0),this._dash.setOpacity(+!!t)}},J=i(Checkbox);c.register(ee);var Y={tag:`div`,backgroundColor:`var(--ts-ui-input-bg, rgb(255, 255, 255))`,foregroundColor:`var(--ts-ui-text-color, black)`,border:`var(--ts-ui-input-border)`,borderRadius:`var(--ts-ui-border-radius, 4px)`,cursor:`pointer`,insets:new n(3,6,3,6)},X=200,Z=22,Q=16,$=200,ComboBoxDropdown=class extends u{_list;_minWidth=$;constructor(e){super(void 0,{layoutManager:new d,backgroundColor:`var(--ts-ui-autocomplete-bg, rgb(255, 255, 255))`,border:`var(--ts-ui-input-border)`,borderRadius:`var(--ts-ui-border-radius, 4px)`,shadow:`var(--ts-ui-autocomplete-shadow, 2px 4px 8px rgba(0,0,0,0.15))`}),this.setContain(`layout`),this._list=new T,this._list.setBorder(`none`),this._list.setBorderRadius(`0`),this._list.setFocusOnRowClick(!1),this.addComponent(this._list),this._list.on(`action`,()=>e(this._list.getSelectedIndex()))}handleKey(e){return this._list.handleKey(e)}showAt(t,n,r){this.pauseLayout(),this._list.setItemsArray(n),this._list.setSelectedIndex(r,!1),this.resumeLayout();let i=this.getPerimeterSize(),a=i.top+i.bottom,o=i.left+i.right,s=n.length*Z+a,c=Math.min(s,X),l=e.source.getElementRect(t),u=this.measureWidestLabel(n)+Q+o,d=l.width,f=Math.max(l.width,this._minWidth),p=Math.min(Math.max(u,d),f,e.source.getViewportSize().width);return this.setWidth(p),this.setHeight(c),this.placeAnchored(l),this.showAnimated(),this.doLayout(),this}setMinWidth(e){return this._minWidth=e,this}getMinWidth(){return this._minWidth}getList(){return this._list}measureWidestLabel(e){let n=0;for(let r of e){let e=t.measureTextWidth(r.label);e>n&&(n=e)}return n}};new r({scope:`class`,name:`ComboBox`,styles:{userSelect:`none`,whiteSpace:`nowrap`}}),new r({scope:`class`,name:`ComboBoxLabel`,styles:{overflow:`hidden`,textOverflow:`ellipsis`}}),new r({scope:`selector`,name:`.ComboBoxDropdown .List:focus::after`,styles:{content:`none`}});var ComboBoxLabel=class extends o{_lineHeight=null;_renderer;constructor(e){super({tag:`span`}),this.setPointerEvents(`none`),this._renderer=e()}setItem(e,t){return this._renderer.update({item:e,index:t}),this}setRenderer(t){let n=this.getElement();if(n){let t=this._renderer.getElement();t&&e.source.getParentNode(t)===n&&e.sink.removeChild(n,t)}return this._renderer=t,n&&e.sink.appendChild(n,this._renderer.getElement(!0)),this}setLineHeight(e){return this._lineHeight=typeof e==`number`?e+`px`:e,this.setElementCSSRule(`lineHeight`,this._lineHeight),this}getLineHeight(){return this._lineHeight}init(t){super.init(t);let n=t||this.getElement();return n&&e.sink.appendChild(n,this._renderer.getElement(!0)),this}doLayout(){super.doLayout();let e=this.getWidth(),t=this.getHeight();return this._renderer.setAutoCommitStyle(!1),this._renderer.setX(0),this._renderer.setY(0),this._renderer.setWidth(e),this._renderer.setHeight(t),this._renderer.setAutoCommitStyle(!0),this._renderer.layoutChildren(e,t),this}},ComboBoxCaret=class extends o{_glyph=new c(`chevron-down`);_size;constructor(){super({tag:`span`}),this._size=t.lineHeightPx({linePadding:!1}),this.setMinSize({width:this._size,height:this._size}),this.setMaxSize({width:this._size,height:this._size}),this.setPointerEvents(`none`),this._glyph.setPreferredSize({width:this._size,height:this._size}),this._glyph.setPointerEvents(`none`),this.addComponent(this._glyph)}getCaretSize(){return this._size}getGlyph(){return this._glyph}},ComboBox=class extends p{_dropdown;_label;_caret;_pendingValue=null;_boundStore=null;_onStoreRefresh;constructor(e,t){super(e,{...Y,...t??{}}),this.getAria().setRole(`combobox`),this.getAria().setExpanded(!1),this.getAria().setTabIndex(0),this._label=new ComboBoxLabel(this._options.rendererFactory??(()=>new w)),this._caret=new ComboBoxCaret,this.addComponent(this._label),this.addComponent(this._caret),this._dropdown=new ComboBoxDropdown(e=>this.onRowSelected(e)),this._options.dropdownAnimated!==void 0&&this._dropdown.setAnimated(this._options.dropdownAnimated),this._options.dropdownMinWidth!==void 0&&this._dropdown.setMinWidth(this._options.dropdownMinWidth),this._options.rendererFactory!==void 0&&this._dropdown.getList().setRendererFactory(this._options.rendererFactory),this.refreshLabel(),this.updateHeight(),this.subscribeTheme(()=>this.updateHeight()),s.addListener(this,`click`,()=>this.toggleDropdown()),s.addListener(this,`keydown`,e=>this.onKeyDown(e)),this._dropdown.setCloseHandler(()=>this.closeDropdown()),this._onStoreRefresh=()=>this.onStoreRefresh(),this._options.store!==void 0&&this._options.displayField!==void 0&&this.setStore(this._options.store,this._options.displayField,this._options.valueField,this._options.glyphField),this._options.items!==void 0&&this.setItems(this._options.items),this._options.selectedIndex!==void 0&&this.setSelectedIndex(this._options.selectedIndex,!1),this._options.value!==void 0&&this.setValue(this._options.value),this._options.selectedItem!==void 0&&this.setValue(this._options.selectedItem),this._options.enabled!==void 0&&this.applyEnabled(this._options.enabled),this._options.readOnly!==void 0&&this.applyReadOnly(this._options.readOnly)}applyOptions(e){return super.applyOptions(e),e.items!==void 0&&(this._options.items=e.items),e.store!==void 0&&(this._options.store=e.store),e.displayField!==void 0&&(this._options.displayField=e.displayField),e.valueField!==void 0&&(this._options.valueField=e.valueField),e.glyphField!==void 0&&(this._options.glyphField=e.glyphField),e.rendererFactory!==void 0&&(this._options.rendererFactory=e.rendererFactory),e.selectedIndex!==void 0&&(this._options.selectedIndex=e.selectedIndex),e.value!==void 0&&(this._options.value=e.value),e.selectedItem!==void 0&&(this._options.selectedItem=e.selectedItem),e.dropdownAnimated!==void 0&&(this._options.dropdownAnimated=e.dropdownAnimated),e.dropdownMinWidth!==void 0&&this.setDropdownMinWidth(e.dropdownMinWidth),this}updateHeight(){let e=t.singleLineBoxHeight(this.getInsets(),this.getPadding(),this.getBorderSize());this.setPreferredSize({width:200,height:e}),this.setMaxSize({width:2**53-1,height:e}),this.setMinSize({width:0,height:e})}doLayout(){super.doLayout();let e=this.getInnerSize();if(!e)return this;let t=this._caret.getCaretSize(),n=this.getInsets(),r=n.getLeft(),i=n.getTop(),a=Math.max(0,e.width-t-6),o=r+a+6,s=i+Math.max(0,(e.height-t)/2);return this._label.setX(r),this._label.setY(i),this._label.setWidth(a),this._label.setHeight(e.height),this._label.setLineHeight(e.height),this._label.doLayout(),this._caret.setX(o),this._caret.setY(s),this._caret.setWidth(t),this._caret.setHeight(t),this}getBaseline(){return this.wrapInnerBaseline(t.measureTextBaseline())}openDropdown(){return this._dropdown.isOpen()||this.toggleDropdown(),this}toggleDropdown(){if(this._dropdown.isOpen()){this.closeDropdown();return}let e=this.getElement(!0),t=this._dropdown.getList();this._dropdown.setAnchorElement(e),this._dropdown.showAt(e,t.getItems(),t.getSelectedIndex()),this.getAria().setExpanded(!0),this.setCaretOpen(!0)}setCaretOpen(e){let t=this._caret.getGlyph(),n=this._dropdown.isAnimated()?this._dropdown.getDurationMs():0;t.setTransition(`transform ${n}ms ease`),t.setTransform(e?`rotate(180deg)`:`rotate(0deg)`)}closeDropdown(){this._dropdown.isOpen()&&(this._dropdown.hideAnimated(),this.getAria().setExpanded(!1),this.setCaretOpen(!1))}onKeyDown(e){if(this._dropdown.isOpen()){if(this._dropdown.handleKey(e)){e.preventDefault();return}e.key===`Escape`&&(e.preventDefault(),this.closeDropdown());return}switch(e.key){case`ArrowDown`:case`ArrowUp`:case`Enter`:case` `:e.preventDefault(),this.toggleDropdown();break;case`Escape`:break;default:break}}onRowSelected(e){this.setSelectedIndex(e,!0),this.closeDropdown()}computeSelectedItem(){let e=this._dropdown.getList(),t=e.getSelectedIndex(),n=e.getItems();return t>=0&&t<n.length?{item:n[t],index:t}:{item:{key:``,label:``},index:-1}}refreshLabel(){let{item:e,index:t}=this.computeSelectedItem();this._label.setItem(e,t)}on(e,t){return super.on(e===`action`?`change`:e,t)}off(e,t){return super.off(e===`action`?`change`:e,t)}setValue(e){return this._pendingValue=e,this._dropdown.getList().setValue(e),this.refreshLabel(),this}getValue(){return this._dropdown.getList().getValue()||(this._pendingValue??``)}getSelectedIndex(){return this._dropdown.getList().getSelectedIndex()}setSelectedIndex(e,t=!0){return this._dropdown.getList().setSelectedIndex(e,!1),this._pendingValue=null,this.refreshLabel(),t&&this.notifyChange(this.getValue()),this}getItems(){return this._dropdown.getList().getItems()}setItems(e){return this._dropdown.getList().setItems(e),this.reapplyPendingValue(),this.autoSelectFirstIfEmpty(),this.refreshLabel(),this}addItem(e){return this._dropdown.getList().addItem(e),this.reapplyPendingValue(),this.autoSelectFirstIfEmpty(),this.refreshLabel(),this}setStore(e,t,n,r){return this._options.store=e,this._options.displayField=t,this._options.valueField=n,this._options.glyphField=r,this._boundStore&&[`load`,`add`,`remove`,`datachange`].forEach(e=>this._boundStore.off(e,this._onStoreRefresh)),this._dropdown.getList().setStore(e,t,n,r),this._boundStore=e,[`load`,`add`,`remove`,`datachange`].forEach(t=>e.on(t,this._onStoreRefresh)),this.reapplyPendingValue(),this.autoSelectFirstIfEmpty(),this.refreshLabel(),this}getStore(){return this._dropdown.getList().getStore()}setRendererFactory(e){return this._options.rendererFactory=e,this._dropdown.getList().setRendererFactory(e),this._label.setRenderer(e()),this.refreshLabel(),this}getRendererFactory(){return this._dropdown.getList().getRendererFactory()}getSelectedRecord(){return this._dropdown.getList().getSelectedRecord()}reapplyPendingValue(){if(this._pendingValue===null)return;let e=this._dropdown.getList();e.setValue(this._pendingValue),e.getSelectedIndex()>=0&&(this._pendingValue=null)}autoSelectFirstIfEmpty(){let e=this._dropdown.getList();e.getSelectedIndex()<0&&e.getItems().length>0&&e.setSelectedIndex(0,!1)}onStoreRefresh(){this.reapplyPendingValue(),this.autoSelectFirstIfEmpty(),this.refreshLabel()}setDropdownAnimated(e){return this._options.dropdownAnimated=e,this._dropdown.setAnimated(e),this}isDropdownAnimated(){return this._options.dropdownAnimated??!0}setDropdownMinWidth(e){return this._options.dropdownMinWidth=e,this._dropdown.setMinWidth(e),this}getDropdownMinWidth(){return this._options.dropdownMinWidth??$}applyEnabled(e){this.getAria().setDisabled(!e),this.getAria().setTabIndex(e?0:-1),this.setCursor(e?`pointer`:`default`),e||this.closeDropdown()}applyReadOnly(e){this.getAria().setReadOnly(e)}},te=i(ComboBox);export{W as a,PickerCellList as c,AbstractPickerField as d,registerFocusWithinRing as f,O as g,A as h,G as i,PickerColumn as l,M as m,J as n,B as o,N as p,q as r,PickerCell as s,te as t,R as u};
|
|
2
|
-
//# sourceMappingURL=ComboBox-
|
|
1
|
+
import{t as e}from"./DOM-BeR95tE8.js";import{l as t,n}from"./Position-DRSlWn4Z.js";import{_ as r,m as i,t as a,x as o,y as s}from"./Component-CHTzJxEf.js";import{t as c}from"./Glyph-CnNslL95.js";import{t as l}from"./Panel-D9lTLGqP.js";import{t as u}from"./AnimatedDropdown-e9urCXK1.js";import{t as d}from"./Fit-E-EIZv1k.js";import{t as f}from"./Text-Bni4icFY.js";import{t as p}from"./AbstractInput-DFWniHqq.js";import{t as m}from"./AbstractBooleanInput-C3O4kv7_.js";import{n as h}from"./VBox-Dr7Ge9M6.js";import{t as g}from"./HBox-Dm3xgsDE.js";import{t as _}from"./LayoutConstraints-DkctJZXB.js";import{t as v}from"./Button-B36rBMKC.js";import{t as y}from"./Grid-BXS2T8MT.js";import{chevron_left as b}from"./glyphs/solid/chevron_left.es.js";import{chevron_right as x}from"./glyphs/solid/chevron_right.es.js";import{clock as S}from"./glyphs/solid/clock.es.js";import{check as C}from"./glyphs/solid/check.es.js";import{r as w,t as T}from"./List-DHeOPAK2.js";import{chevron_down as ee}from"./glyphs/solid/chevron_down.es.js";var E=`var(--ts-ui-link-color, rgb(21, 101, 192))`;new s({scope:`selector`,name:`.Link`,styles:{textDecoration:`underline`}}),new s({scope:`selector`,name:`.Link:focus-visible`,styles:{outline:`2px solid var(--ts-ui-indicator-focus, rgb(30, 100, 200))`,outlineOffset:`1px`}});var D={tag:`a`,foregroundColor:E,cursor:`pointer`,interactive:!0},Link=class extends f{constructor(e,t){super(e,t,D),o.addListener(this,`keydown`,this.handleKeyDown),this.applyListeners(t?.listeners)}applyOptions(e){return super.applyOptions(e),this.setInteractive(e.interactive??this.isInteractive()),this}isInteractive(){return this._options.interactive??this._defaultOptions.interactive??!0}setInteractive(e){return this._options.interactive=e,e?this.getAria().setRole(`link`).setTabIndex(0):this.getAria().clearRole().setTabIndex(null),this}on(e,t){return o.addListener(this,`click`,t),this}off(e,t){return o.removeListener(this,`click`,t),this}click(){return o.fireEvent(this,`click`),this}destructor(){o.removeListener(this,`keydown`,this.handleKeyDown),super.destructor()}handleKeyDown(e){this.isInteractive()&&e.key===`Enter`&&(e.preventDefault(),this.click())}},O=i(Link);new s({scope:`selector`,name:`.TextField:focus, .TextArea:focus, .PasswordField:focus`,styles:{outline:`none`,boxShadow:`inset 0 0 0 2px var(--ts-ui-indicator-focus, rgb(30, 100, 200))`}});var k={tag:`input`,backgroundColor:`var(--ts-ui-input-bg, rgb(255, 255, 255))`,border:`var(--ts-ui-input-border)`,borderRadius:`var(--ts-ui-border-radius, 4px)`},TextInput=class extends p{constructor(e,t){super(e,{...k,...t??{}}),this.setElementCSSRules({fontFamily:`var(--ts-ui-font-family, sans-serif)`,fontSize:`var(--ts-ui-font-size, 14px)`,lineHeight:`calc(1em + var(--ts-ui-line-padding, 2px))`}),o.addListener(this,`input`,this.onInput)}onInput(){let t=this.getElement();this.setText(t?e.source.getValue(t):``),this.notifyChange(this.getValue())}applyOptions(e){return super.applyOptions(e),e.text!==void 0&&this.setText(e.text),e.textAlign!==void 0&&this.setTextAlign(e.textAlign),e.placeholder!==void 0&&this.setPlaceholder(e.placeholder),e.readOnly!==void 0&&this.setReadOnly(e.readOnly),e.enabled!==void 0&&this.setEnabled(e.enabled),e.maxLength!==void 0&&this.setMaxLength(e.maxLength),e.inputMode!==void 0&&this.setInputMode(e.inputMode),e.autoComplete!==void 0&&this.setAutoComplete(e.autoComplete),this}on(e,t){return e===`action`?(o.addListener(this,`input`,t),this):e===`keydown`?(o.addListener(this,`keydown`,t),this):super.on(e,t)}off(e,t){return e===`action`?(o.removeListener(this,`input`,t),this):e===`keydown`?(o.removeListener(this,`keydown`,t),this):super.off(e,t)}setType(e){return this._options.type=e,this.setElementAttribute(`type`,e),this}setName(e){return super.setName(e),e==null?this.removeElementAttribute(`name`):this.setElementAttribute(`name`,e),this}clearName(){return this._options.name===void 0?this:(this._options.name=void 0,this.removeElementAttribute(`name`),this)}getInputMode(){return this._options.inputMode??null}setInputMode(e){return this._options.inputMode===e?this:(this._options.inputMode=e,this.setElementAttribute(`inputmode`,e),this)}clearInputMode(){return this._options.inputMode===void 0?this:(this._options.inputMode=void 0,this.removeElementAttribute(`inputmode`),this)}getAutoComplete(){return this._options.autoComplete??null}setAutoComplete(e){return this._options.autoComplete===e?this:(this._options.autoComplete=e,this.setElementAttribute(`autocomplete`,e),this)}clearAutoComplete(){return this._options.autoComplete===void 0?this:(this._options.autoComplete=void 0,this.removeElementAttribute(`autocomplete`),this)}getBaseline(){return this.wrapInnerBaseline(t.measureTextBaseline())}getTextAlign(){return this._options.textAlign??null}setTextAlign(e){return this._options.textAlign=e,this.setElementCSSRule(`textAlign`,e),this}clearTextAlign(){return this.setTextAlign(null)}getText(){return this._options.text??``}setText(t){this._options.text=t||``;let n=this.getElement();return n&&e.sink.setValue(n,this._options.text),this}getValue(){return this.getText()}setValue(e){return this.setText(e)}getPlaceholder(){return this._options.placeholder??null}setPlaceholder(e){return this._options.placeholder=e,this.setElementAttribute(`placeholder`,e),this}clearPlaceholder(){return this._options.placeholder===void 0?this:(this._options.placeholder=void 0,this.removeElementAttribute(`placeholder`),this)}getMaxLength(){return this._options.maxLength??null}setMaxLength(e){return this._options.maxLength=e,this.setElementAttribute(`maxlength`,String(e)),this}clearMaxLength(){return this._options.maxLength===void 0?this:(this._options.maxLength=void 0,this.removeElementAttribute(`maxlength`),this)}select(t,n){let r=this.getElement();if(!r)return this;(!t||t<0)&&(t=0);let i=this._options.text??``;return(!n||n>i.length)&&(n=i.length+1),e.sink.setSelectionRange(r,t,n),this}applyEnabled(e){this.setDisabledAttribute(!e)}applyReadOnly(e){e?this.setElementAttribute(`readonly`,``):this.removeElementAttribute(`readonly`)}getElement(e=!1){return super.getElement(e)}init(t){super.init(t);let n=t||this.getElement();return this._options.type!==void 0&&e.sink.apply(n,{setAttr:{type:this._options.type}}),this._options.name!=null&&e.sink.apply(n,{setAttr:{name:this._options.name}}),this._options.placeholder!==void 0&&e.sink.apply(n,{setAttr:{placeholder:this._options.placeholder}}),this._options.readOnly&&e.sink.apply(n,{setAttr:{readonly:``}}),this._options.maxLength!==void 0&&e.sink.apply(n,{setAttr:{maxlength:String(this._options.maxLength)}}),this._options.inputMode!==void 0&&e.sink.apply(n,{setAttr:{inputmode:this._options.inputMode}}),this._options.autoComplete!==void 0&&e.sink.apply(n,{setAttr:{autocomplete:this._options.autoComplete}}),this}render(){let t=super.render();return e.sink.setValue(t,this._options.text??``),t}},A=i(TextInput),j={cursor:`text`,border:`none`,outline:`none`},PickerInput=class extends A{constructor(){super(void 0,j)}},M=i(PickerInput),PickerButton=class extends v{constructor(){super({chromeless:!0,insets:new n(0,4,0,4)})}},N=i(PickerButton),P={content:`''`,position:`absolute`,inset:`0`,border:`2px solid var(--ts-ui-indicator-focus, rgb(30, 100, 200))`,borderRadius:`inherit`,boxSizing:`border-box`,pointerEvents:`none`,zIndex:`1`};function registerFocusWithinRing(e){new s({scope:`selector`,name:e.split(`,`).map(e=>e.trim()+`:focus-within::after`).join(`, `),styles:P})}registerFocusWithinRing(`.DateField, .TimeField, .DateTimeField`);var F=24,I={cursor:`text`,padding:new n(3,3,3,3),backgroundColor:`var(--ts-ui-input-bg, rgb(255, 255, 255))`,foregroundColor:`var(--ts-ui-text-color, black)`,border:`var(--ts-ui-input-border)`,borderRadius:`var(--ts-ui-border-radius, 4px)`},AbstractPickerField=class extends p{_input;_button;_dropdown=null;_value=null;_invalid=!1;_showSeconds=!1;constructor(e){super(e,I),this._input=new M,this._input.setType(`text`),this._input.setInputMode(`none`),this._input.setAutoComplete(`off`),this._input.setPadding(new n(0,3,0,3)),this._button=new N,this.addComponent(this._input),this.addComponent(this._button),this.updateHeight(),this.subscribeTheme(()=>this.updateHeight()),o.addListener(this._input,`input`,()=>this.onInput()),o.addListener(this._input,`blur`,()=>this.onBlur()),o.addListener(this._input,`keydown`,e=>this.onKeyDown(e)),this._button.on(`action`,()=>this.onButtonClick()),this._button.addPointerDownListener(e=>this.onButtonPointerDown(e)),this._options.enabled!==void 0&&this.applyEnabled(this._options.enabled),this._options.readOnly!==void 0&&this.applyReadOnly(this._options.readOnly)}getDefaultBorder(){return I.border}applyOptions(e){return super.applyOptions(e),e.dropdownAnimated!==void 0&&this.setDropdownAnimated(e.dropdownAnimated),this}doLayout(){super.doLayout();let e=this.getWidth(),t=this.getHeight();return this._input.setX(0),this._input.setY(0),this._input.setWidth(Math.max(0,e-F)),this._input.setHeight(t),this._button.setX(e-F),this._button.setY(0),this._button.setWidth(F),this._button.setHeight(t),this._button.doLayout(),this}updateHeight(){let e=t.singleLineBoxHeight(this.getInsets(),this.getPadding(),this.getBorderSize());this.setPreferredSize({width:this.getPreferredWidth(),height:e}),this.setMaxSize({width:2**53-1,height:e}),this.setMinSize({width:0,height:e})}setValue(e){return this._value=e,this._input?.setText(e?this.formatValue(e):``),this}getValue(){return this._value}getBaseline(){return this.wrapInnerBaseline(this._input.getBaseline())}setDropdownAnimated(e){return this._options.dropdownAnimated=e,this._dropdown&&this._dropdown.setAnimated(e),this}isDropdownAnimated(){return this._options.dropdownAnimated??!0}applyEnabled(e){this._input.setEnabled(e)}applyReadOnly(e){this._input.setReadOnly(e)}onButtonClick(){this._dropdown?.isOpen()?this.closeDropdown():(this._input.focus(),this.openDropdown())}onButtonPointerDown(e){e.preventDefault()}onInput(){let e=this._input.getText();if(!e){this._value=null,this.setInvalid(!1),this.notifyChange(null);return}let t=this.parseRaw(e);t===null?this.setInvalid(!0):(this._value=t,this.setInvalid(!1),this.notifyChange(t))}onBlur(){this._invalid&&(this._input.setText(``),this._value=null,this.setInvalid(!1))}setInvalid(e){this._invalid!==e&&(this._invalid=e,e?this.setBorder({border:`1px solid var(--ts-ui-validation-error-border)`}):this.setBorder(this.getDefaultBorder()))}onKeyDown(e){if(this._dropdown&&this._dropdown.isOpen()&&this._dropdown.handleKey(e)){e.preventDefault();return}e.key===`ArrowDown`?(e.preventDefault(),this.openDropdown()):e.key===`Escape`&&this.closeDropdown()}ensureDropdown(){if(!this._dropdown){this._dropdown=this.createDropdown();let e=this._options.dropdownAnimated;e!==void 0&&this._dropdown.setAnimated(e)}return this._dropdown}openDropdown(){let e=this.ensureDropdown();e.isOpen()||(e.setCloseHandler(()=>this.closeDropdown()),e.setAnchorElement(this.getElement(!0)??null),e.showAt(this._input.getElement(!0),this._value))}closeDropdown(){this._dropdown&&this._dropdown.isOpen()&&this._dropdown.hideAnimated()}},L={cursor:`text`,padding:new n(3,3,3,3),backgroundColor:`var(--ts-ui-input-bg, rgb(255, 255, 255))`,foregroundColor:`var(--ts-ui-text-color, black)`},TextField=class extends A{constructor(e){super(e,L),this.updateHeight(),this.subscribeTheme(()=>this.updateHeight()),this.setType(`text`)}updateHeight(){let e=t.singleLineBoxHeight(this.getInsets(),this.getPadding(),this.getBorderSize());this.setPreferredSize({width:200,height:e}),this.setMaxSize({width:2**53-1,height:e}),this.setMinSize({width:0,height:e})}},R=i(TextField);new s({scope:`class`,name:`PickerColumnHeader`,styles:{opacity:`0.7`}}),new s({scope:`class`,name:`PickerCell`,styles:{borderRadius:`3px`}}),new s({scope:`selector`,name:`.PickerCell:hover`,styles:{backgroundColor:`var(--ts-ui-autocomplete-item-hover-bg, rgba(30, 100, 200, 0.08))`}}),new s({scope:`selector`,name:`.PickerCell.disabled`,styles:{pointerEvents:`none`,color:`var(--ts-ui-autocomplete-item-disabled-color, rgb(170, 170, 170))`,backgroundColor:`var(--ts-ui-picker-cell-disabled-bg, transparent)`}});var PickerColumnHeader=class extends f{constructor(e){super(e,{textAlign:`center`,fontSize:12})}},PickerCellList=class extends l{constructor(){super({layoutManager:new h({spacing:0,stretching:!0}),autoScroll:`y`,insets:new n(0,0,0,0)})}getMinSize(){let e=super.getMinSize();return e&&{width:e.width,height:0}}},PickerCell=class extends f{_selected=!1;_disabled=!1;_onClick;constructor(e,t){super(e,{textAlign:`center`,preferredSize:{width:0,height:22}}),this._onClick=t,this.setLineHeight(22),this.setCursor(`pointer`),o.addListener(this,`pointerdown`,this.handlePointerDown),o.addListener(this,`click`,this.handleClick)}handlePointerDown(e){e.preventDefault()}handleClick(){this._disabled||this._onClick()}setSelected(e){return this._selected===e?this:(this._selected=e,e?(this.setBackgroundColor(`var(--ts-ui-autocomplete-item-highlight-bg, rgba(30, 100, 200, 0.18))`),this.setFontWeight(`bold`)):(this.clearBackgroundColor(),this.setFontWeight(`normal`)),this)}isSelected(){return this._selected}setDisabled(t){if(this._disabled===t)return this;this._disabled=t,this.setCursor(t?`default`:`pointer`);let n=this.getElement();return n&&e.sink.apply(n,{toggleClass:{disabled:t}}),this}isDisabled(){return this._disabled}render(){let t=super.render();return this._disabled&&e.sink.apply(t,{addClass:[`disabled`]}),t}},PickerColumn=class extends a{_cellList;constructor(e){if(super(),this.setLayoutManager(new h({spacing:2,stretching:!0})),e!==null){let t=new PickerColumnHeader(e);t.setPreferredSize({width:0,height:18}),this.addComponent(t)}this._cellList=new PickerCellList;let t=new _;t.weight=1,this.addComponent(this._cellList,t)}addCell(e){return this._cellList.addComponent(e),this}clearCells(){return this._cellList.removeAllComponents(),this}getCellList(){return this._cellList}scrollSelectedIntoView(){let n=this._cellList.getElement();if(!n)return this;let r=this._cellList.getComponents(),i=null;for(let e of r)if(e instanceof PickerCell&&e.isSelected()){i=e;break}if(!i)return this;let a=i.getElement();if(!a)return this;let o=e.source.getOffsetSize(a),s=e.source.getScrollMetrics(n),c=o.offsetTop,l=o.offsetHeight,u=s.clientHeight,d=c-(u-l)/2,f=s.scrollHeight-u,p=t.clamp(d,0,f);return e.sink.apply(n,{scrollTop:p}),this}setSelectedValue(e){for(let t of this._cellList.getComponents())t instanceof PickerCell&&t.setSelected(t.getText().valueOf()===e);return this}};c.register(b),c.register(x),new s({scope:`class`,name:`PickerDay`,styles:{borderRadius:`3px`}}),new s({scope:`selector`,name:`.PickerDay:hover`,styles:{backgroundColor:`var(--ts-ui-autocomplete-item-hover-bg, rgba(30, 100, 200, 0.08))`}}),new s({scope:`selector`,name:`.PickerDay.disabled`,styles:{pointerEvents:`none`,color:`var(--ts-ui-autocomplete-item-disabled-color, rgb(170, 170, 170))`,backgroundColor:`var(--ts-ui-picker-cell-disabled-bg, transparent)`}}),new s({scope:`class`,name:`PickerNavButton`,styles:{borderRadius:`3px`,color:`var(--ts-ui-picker-nav-fg, var(--ts-ui-text-color))`}}),new s({scope:`selector`,name:`.PickerNavButton:hover`,styles:{backgroundColor:`var(--ts-ui-picker-nav-hover-bg, rgba(30, 100, 200, 0.08))`}});var PickerDayHeader=class extends f{constructor(e){super(e,{textAlign:`center`,fontSize:12,preferredSize:{width:0,height:20}}),this.setLineHeight(20)}},PickerBlankCell=class extends a{constructor(){super({preferredSize:{width:0,height:24}})}},PickerNavButton=class extends a{constructor(e,t){super({preferredSize:{width:24,height:24}}),this.setLayoutManager(new d),this.setCursor(`pointer`),this.getAria().setRole(`button`);let n=new c(e);n.setPointerEvents(`none`),n.setPreferredSize({width:12,height:12}),this.addComponent(n),o.addListener(this,`pointerdown`,e=>e.preventDefault()),o.addListener(this,`click`,()=>t())}render(){let t=super.render();return e.sink.apply(t,{addClass:[`PickerNavButton`]}),t}},PickerMonthLabel=class extends f{constructor(e){super(``,{textAlign:`center`,fontWeight:`bold`}),this.setLineHeight(24),this.setCursor(`pointer`),this.getAria().setRole(`button`),this.getAria().setExpanded(!1),this.getAria().setTabIndex(0),o.addListener(this,`pointerdown`,e=>e.preventDefault()),o.addListener(this,`click`,()=>e())}render(){let t=super.render();return e.sink.apply(t,{addClass:[`PickerNavButton`]}),t}},PickerDay=class extends f{_date;_selected=!1;_disabled=!1;_onClick;constructor(e,t){super(String(e.getDate()),{textAlign:`center`,preferredSize:{width:0,height:24}}),this._date=e,this._onClick=t,this.setLineHeight(24),this.setCursor(`pointer`),o.addListener(this,`pointerdown`,e=>this.onPointerDown(e)),o.addListener(this,`click`,()=>this.onClick())}getDate(){return this._date}onPointerDown(e){e.preventDefault()}onClick(){this._disabled||this._onClick(this._date)}setSelected(e){return this._selected===e?this:(this._selected=e,e?(this.setBackgroundColor(`var(--ts-ui-autocomplete-item-highlight-bg, rgba(30, 100, 200, 0.18))`),this.setFontWeight(`bold`)):(this.clearBackgroundColor(),this.setFontWeight(`normal`)),this)}isSelected(){return this._selected}setDisabled(t){if(this._disabled===t)return this;this._disabled=t,this.setCursor(t?`default`:`pointer`);let n=this.getElement();return n&&e.sink.apply(n,{toggleClass:{disabled:t}}),this}isDisabled(){return this._disabled}render(){let t=super.render();return e.sink.apply(t,{addClass:[`PickerDay`]}),this._disabled&&e.sink.apply(t,{addClass:[`disabled`]}),t}};function dayStart(e){return new Date(e.getFullYear(),e.getMonth(),e.getDate(),0,0,0,0)}function dayEnd(e){return new Date(e.getFullYear(),e.getMonth(),e.getDate(),23,59,59,999)}var AbstractCalendarDropdown=class extends u{_onSelect;_value=null;_monthAnchor=new Date;_yearScrollOpen=!1;_root;_headerRow;_prevButton;_nextButton;_monthLabel;_weekdayRow;_dayGrid;_yearColumn=null;_highlightedDayIdx=-1;_highlightedYear=-1;_yearTypeBuffer=``;_yearTypeTimer=null;constructor(e,t,r){super(t,{zIndex:10050,layoutManager:new d,backgroundColor:`var(--ts-ui-autocomplete-bg, rgb(255, 255, 255))`,border:`var(--ts-ui-input-border)`,borderRadius:`var(--ts-ui-border-radius, 4px)`,shadow:`var(--ts-ui-autocomplete-shadow, 2px 4px 8px rgba(0,0,0,0.15))`,insets:new n(6,6,6,6),...r??{}}),this._onSelect=e,this.getAria().setRole(`group`),this.setContain(`layout`),this._root=new a,this._root.setLayoutManager(new h({spacing:4,stretching:!0})),this._headerRow=new a({preferredSize:{width:0,height:24}}),this._headerRow.setLayoutManager(new g({spacing:2,stretching:!0})),this._prevButton=new PickerNavButton(`chevron-left`,()=>this.prevMonth()),this._nextButton=new PickerNavButton(`chevron-right`,()=>this.nextMonth()),this._monthLabel=new PickerMonthLabel(()=>this.toggleYearScroller());let i=new _;i.weight=1,this._headerRow.addComponent(this._prevButton),this._headerRow.addComponent(this._monthLabel,i),this._headerRow.addComponent(this._nextButton),this._root.addComponent(this._headerRow),this._weekdayRow=new a({preferredSize:{width:0,height:20}}),this._weekdayRow.setLayoutManager(new y({columns:7,spacing:2}));for(let e of[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`])this._weekdayRow.addComponent(new PickerDayHeader(e));this._root.addComponent(this._weekdayRow),this._dayGrid=new a({preferredSize:{width:0,height:154}}),this._dayGrid.setLayoutManager(new y({columns:7,spacing:2})),this._root.addComponent(this._dayGrid),this.addComponent(this._root),this.buildExtraRootChildren(),o.addSubtreeListener(this,`pointerdown`,e=>this.onPointerDown(e))}applyOptions(e){return super.applyOptions(e),e.minDate!==void 0&&(this._options.minDate=e.minDate),e.maxDate!==void 0&&(this._options.maxDate=e.maxDate),this}onPointerDown(t){e.source.isNode(t.target)&&e.source.getTagName(e.source.intern(t.target))===`INPUT`||t.preventDefault()}showAt(t,n){this._value=n?new Date(n.getTime()):null;let r=this._value??new Date;this._monthAnchor=new Date(r.getFullYear(),r.getMonth(),1),this._highlightedDayIdx=-1,this._highlightedYear=-1,this.resetYearTypeBuffer(),this._yearScrollOpen&&this.closeYearScroller(),this.pauseLayout(),this.rebuild(),this.resumeLayout();let i=this.computePanelHeight();return this.setWidth(this.getPanelWidth()),this.setHeight(i),this.doLayout(),this.placeAnchored(e.source.getElementRect(t)),this.showAnimated(),this}hideAnimated(){return super.hideAnimated(),this.resetYearTypeBuffer(),this}computePanelHeight(){let e=this.getPerimeterSize(),t=206+this.getExtraInnerHeight();return e.top+e.bottom+t}rebuild(){this.buildDayGrid(),this.rebuildExtraRowsAfterValueChange()}buildDayGrid(){this._dayGrid.removeAllComponents(),this._highlightedDayIdx=-1;let e=this._monthAnchor.getFullYear(),t=this._monthAnchor.getMonth();this._monthLabel.setText(this._monthAnchor.toLocaleDateString(void 0,{month:`long`,year:`numeric`}));let n=new Date(e,t,1).getDay(),r=new Date(e,t+1,0).getDate();for(let e=0;e<n;e++)this._dayGrid.addComponent(new PickerBlankCell);for(let n=1;n<=r;n++){let r=new Date(e,t,n),i=new PickerDay(r,e=>this.onDateSelected(e));this.isDateInRange(r)||i.setDisabled(!0),this.isValueOnDay(r)&&i.setSelected(!0),this._dayGrid.addComponent(i)}let i=42-n-r;for(let e=0;e<i;e++)this._dayGrid.addComponent(new PickerBlankCell)}isValueOnDay(e){return this._value?this._value.getFullYear()===e.getFullYear()&&this._value.getMonth()===e.getMonth()&&this._value.getDate()===e.getDate():!1}isDateInRange(e){let t=this._options.minDate??null,n=this._options.maxDate??null;return!(t&&e.getTime()<dayStart(t).getTime()||n&&e.getTime()>dayEnd(n).getTime())}hasAnyInRange(e){let t=e.getFullYear(),n=e.getMonth(),r=new Date(t,n+1,0).getDate(),i=new Date(t,n,1),a=new Date(t,n,r),o=this._options.minDate??null,s=this._options.maxDate??null;return!(o&&dayEnd(a).getTime()<dayStart(o).getTime()||s&&dayStart(i).getTime()>dayEnd(s).getTime())}onDateSelected(e){this.applyDateSelection(e),this._monthAnchor=new Date(e.getFullYear(),e.getMonth(),1),this.notifyValueChanged(),this.rebuild(),this.doLayout()}notifyValueChanged(){this._value&&this._onSelect(new Date(this._value.getTime()))}prevMonth(){let e=new Date(this._monthAnchor.getFullYear(),this._monthAnchor.getMonth()-1,1);this.hasAnyInRange(e)&&(this._monthAnchor=e,this._yearScrollOpen?(this.updateMonthLabel(),this.refreshYearSelection()):(this.buildDayGrid(),this.doLayout()))}nextMonth(){let e=new Date(this._monthAnchor.getFullYear(),this._monthAnchor.getMonth()+1,1);this.hasAnyInRange(e)&&(this._monthAnchor=e,this._yearScrollOpen?(this.updateMonthLabel(),this.refreshYearSelection()):(this.buildDayGrid(),this.doLayout()))}updateMonthLabel(){this._monthLabel.setText(this._monthAnchor.toLocaleDateString(void 0,{month:`long`,year:`numeric`}))}toggleYearScroller(){this._yearScrollOpen?this.closeYearScroller():this.openYearScroller()}openYearScroller(){this._yearColumn||(this._yearColumn=new PickerColumn(null),this._yearColumn.setPreferredSize({width:0,height:154}),this._yearColumn.getAria().setRole(`listbox`)),this.buildYearScroller(),this._root.removeComponent(this._dayGrid),this._root.insertComponent(this._yearColumn,2),this._yearScrollOpen=!0,this._monthLabel.getAria().setExpanded(!0),this.doLayout(),this._yearColumn.scrollSelectedIntoView()}closeYearScroller(){this._yearColumn&&this._root.removeComponent(this._yearColumn),this._root.insertComponent(this._dayGrid,2),this._yearScrollOpen=!1,this._monthLabel.getAria().setExpanded(!1),this.resetYearTypeBuffer(),this.buildDayGrid(),this.doLayout()}buildYearScroller(){if(!this._yearColumn)return;this._yearColumn.clearCells(),this._highlightedYear=-1;let e=new Date,t=this._options.minDate?.getFullYear()??e.getFullYear()-120,n=this._options.maxDate?.getFullYear()??e.getFullYear()+50,r=this._monthAnchor.getFullYear();for(let e=t;e<=n;e++){let t=e,n=new PickerCell(String(t),()=>this.onYearSelected(t));t===r&&n.setSelected(!0),this._yearColumn.addCell(n)}}refreshYearSelection(){if(!this._yearColumn)return;let e=this._monthAnchor.getFullYear();for(let t of this._yearColumn.getCellList().getComponents())t instanceof PickerCell&&t.setSelected(t.getText().valueOf()===String(e))}onYearSelected(e){this._monthAnchor=new Date(e,this._monthAnchor.getMonth(),1),this.applyYearSelection(e),this.closeYearScroller()}resetYearTypeBuffer(){this._yearTypeBuffer=``,this._yearTypeTimer!==null&&(clearTimeout(this._yearTypeTimer),this._yearTypeTimer=null)}handleKey(e){return this.isOpen()?this._yearScrollOpen?this.handleKeyInYearScroller(e):this.handleKeyInDayGrid(e):!1}handleKeyInDayGrid(e){switch(e.key){case`ArrowLeft`:return this.moveHighlightedDay(-1);case`ArrowRight`:return this.moveHighlightedDay(1);case`ArrowUp`:return this.moveHighlightedDay(-7);case`ArrowDown`:return this.moveHighlightedDay(7);case`PageUp`:return this.prevMonth(),!0;case`PageDown`:return this.nextMonth(),!0;case`Home`:return this.highlightFirstDayOfMonth();case`End`:return this.highlightLastDayOfMonth();case`Enter`:case` `:return this.commitHighlightedDay();default:return!1}}getDayGridChildren(){return this._dayGrid.getComponents()}moveHighlightedDay(e){let t=this.getDayGridChildren(),n=[];for(let e=0;e<t.length;e++){let r=t[e];r instanceof PickerDay&&!r.isDisabled()&&n.push({idx:e,cell:r})}if(n.length===0)return!0;let r=-1;for(let e=0;e<n.length;e++)if(n[e].idx===this._highlightedDayIdx){r=e;break}if(r<0){r=0;for(let e=0;e<n.length;e++)if(n[e].cell.isSelected()){r=e;break}}let i=Math.max(0,Math.min(n.length-1,r+e));return this.setHighlightedDay(n[i].idx),!0}setHighlightedDay(e){let t=this.getDayGridChildren();if(this._highlightedDayIdx>=0&&this._highlightedDayIdx<t.length){let e=t[this._highlightedDayIdx];e instanceof PickerDay&&!this.matchesSelection(e)&&e.setSelected(!1)}if(e<0||e>=t.length){this._highlightedDayIdx=-1;return}let n=t[e];n instanceof PickerDay&&(n.setSelected(!0),this._highlightedDayIdx=e)}matchesSelection(e){return this.isValueOnDay(e.getDate())}highlightFirstDayOfMonth(){let e=this.getDayGridChildren();for(let t=0;t<e.length;t++){let n=e[t];if(n instanceof PickerDay&&!n.isDisabled())return this.setHighlightedDay(t),!0}return!0}highlightLastDayOfMonth(){let e=this.getDayGridChildren();for(let t=e.length-1;t>=0;t--){let n=e[t];if(n instanceof PickerDay&&!n.isDisabled())return this.setHighlightedDay(t),!0}return!0}commitHighlightedDay(){if(this._highlightedDayIdx<0)return!1;let e=this.getDayGridChildren()[this._highlightedDayIdx];return e instanceof PickerDay&&!e.isDisabled()?(this.onDateSelected(e.getDate()),!0):!1}handleKeyInYearScroller(e){if(/^[0-9]$/.test(e.key))return this.appendYearDigit(e.key);switch(e.key){case`ArrowLeft`:case`ArrowUp`:return this.moveHighlightedYear(-1);case`ArrowRight`:case`ArrowDown`:return this.moveHighlightedYear(1);case`PageUp`:return this.moveHighlightedYear(-10);case`PageDown`:return this.moveHighlightedYear(10);case`Home`:return this.highlightFirstYear();case`End`:return this.highlightLastYear();case`Enter`:case` `:return this.commitHighlightedYear();case`Escape`:return this.closeYearScroller(),!0;default:return!1}}getYearCells(){if(!this._yearColumn)return[];let e=[];for(let t of this._yearColumn.getCellList().getComponents())t instanceof PickerCell&&e.push(t);return e}moveHighlightedYear(e){let t=this.getYearCells();if(t.length===0)return!0;let n=this.findHighlightedYearPos(t),r=Math.max(0,Math.min(t.length-1,n+e));return this.applyYearHighlight(t,r),!0}findHighlightedYearPos(e){if(this._highlightedYear<0){for(let t=0;t<e.length;t++)if(e[t].isSelected())return t;return 0}for(let t=0;t<e.length;t++)if(e[t].getText().valueOf()===String(this._highlightedYear))return t;return 0}applyYearHighlight(e,t){let n=this._monthAnchor.getFullYear();for(let t of e)t.setSelected(t.getText().valueOf()===String(n));e[t].setSelected(!0),this._highlightedYear=parseInt(e[t].getText().valueOf(),10),this._yearColumn&&this._yearColumn.scrollSelectedIntoView()}highlightFirstYear(){let e=this.getYearCells();return e.length===0||this.applyYearHighlight(e,0),!0}highlightLastYear(){let e=this.getYearCells();return e.length===0||this.applyYearHighlight(e,e.length-1),!0}commitHighlightedYear(){let e=this._highlightedYear>=0?this._highlightedYear:this._monthAnchor.getFullYear();return this.onYearSelected(e),!0}appendYearDigit(e){this._yearTypeBuffer.length>=4&&(this._yearTypeBuffer=``),this._yearTypeBuffer+=e,this._yearTypeTimer!==null&&clearTimeout(this._yearTypeTimer),this._yearTypeTimer=setTimeout(()=>this.resetYearTypeBuffer(),800);let t=this.getYearCells(),n=this._yearTypeBuffer,r=-1;for(let e=0;e<t.length;e++)if(t[e].getText().valueOf().startsWith(n)){r=e;break}return r>=0&&this.applyYearHighlight(t,r),n.length===4&&this.resetYearTypeBuffer(),!0}getExtraInnerHeight(){return 0}buildExtraRootChildren(){}rebuildExtraRowsAfterValueChange(){}applyDateSelection(e){this._value=new Date(e.getFullYear(),e.getMonth(),e.getDate(),0,0,0,0)}applyYearSelection(e){}},z=240,DatePickerDropdown=class extends AbstractCalendarDropdown{constructor(e,t){super(e,t)}getPanelWidth(){return z}onDateSelected(e){this.applyDateSelection(e),this._monthAnchor=new Date(e.getFullYear(),e.getMonth(),1),this.notifyValueChanged()}},B=i(DatePickerDropdown),TimeColumns=class extends a{_onChange;_showSeconds;_hours=-1;_minutes=-1;_seconds=-1;_hourColumn;_minuteColumn;_secondColumn;constructor(e,t){super({preferredSize:{width:0,height:176}}),this._onChange=e,this._showSeconds=t?.showSeconds??!1,this.setLayoutManager(new g({spacing:4,stretching:!0}));let n=new _;n.weight=1,this._hourColumn=this.buildColumn(`Hour`,24,1,e=>this.onUnitSelected(`hours`,e)),this._minuteColumn=this.buildColumn(`Min`,60,5,e=>this.onUnitSelected(`minutes`,e)),this.addComponent(this._hourColumn,n),this.addComponent(this._minuteColumn,n),this._showSeconds?(this._secondColumn=this.buildColumn(`Sec`,60,5,e=>this.onUnitSelected(`seconds`,e)),this.addComponent(this._secondColumn,n)):this._secondColumn=null}setTime(e){return e?(this._hours=e.getHours(),this._minutes=e.getMinutes(),this._seconds=this._showSeconds?e.getSeconds():0):(this._hours=-1,this._minutes=-1,this._seconds=-1),this.refreshColumns(),this}buildColumn(e,t,n,r){let i=new PickerColumn(e);for(let e=0;e<t;e+=n){let t=e,n=new PickerCell(String(t).padStart(2,`0`),()=>r(t));i.addCell(n)}return i}onUnitSelected(e,t){e===`hours`?this._hours=t:e===`minutes`?this._minutes=t:this._seconds=t,this._hours<0&&(this._hours=0),this._minutes<0&&(this._minutes=0),this._seconds<0&&(this._seconds=0),this.refreshColumns(),this._onChange(this._hours,this._minutes,this._showSeconds?this._seconds:0)}refreshColumns(){this._hourColumn.setSelectedValue(this.cellLabel(this._hours)),this._minuteColumn.setSelectedValue(this.cellLabel(this._minutes)),this._secondColumn?.setSelectedValue(this.cellLabel(this._seconds))}cellLabel(e){return e<0?null:String(e).padStart(2,`0`)}},V=140,H=200,U=220,TimePickerDropdown=class extends u{_showSeconds;_timeColumns;constructor(e,t){super(t,{zIndex:10050,layoutManager:new d,backgroundColor:`var(--ts-ui-autocomplete-bg, rgb(255, 255, 255))`,border:`var(--ts-ui-input-border)`,borderRadius:`var(--ts-ui-border-radius, 4px)`,shadow:`var(--ts-ui-autocomplete-shadow, 2px 4px 8px rgba(0,0,0,0.15))`,insets:new n(4,4,4,4)}),this._showSeconds=t?.showSeconds??!1,this.getAria().setRole(`group`),this.setContain(`layout`),this._timeColumns=new TimeColumns(e,{showSeconds:this._showSeconds}),this.addComponent(this._timeColumns),o.addSubtreeListener(this,`pointerdown`,e=>this.onPointerDown(e))}onPointerDown(e){e.preventDefault()}showAt(t,n){return this._timeColumns.setTime(n),this.setWidth(this._showSeconds?H:V),this.setHeight(U),this.placeAnchored(e.source.getElementRect(t)),this.showAnimated(),this.doLayout(),this}},W=i(TimePickerDropdown);c.register(S);var TimeField=class extends AbstractPickerField{constructor(e){super(e),this._button.setGlyph(`clock`),this._options.showSeconds!==void 0&&(this._showSeconds=this._options.showSeconds),this._options.value!==void 0&&this.setValue(this._options.value)}applyOptions(e){return super.applyOptions(e),e.showSeconds!==void 0&&(this._options.showSeconds=e.showSeconds),e.value!==void 0&&(this._options.value=e.value),this}formatValue(e){let t=String(e.getHours()).padStart(2,`0`),n=String(e.getMinutes()).padStart(2,`0`);return this._showSeconds?`${t}:${n}:${String(e.getSeconds()).padStart(2,`0`)}`:`${t}:${n}`}parseRaw(e){let[t,n,r]=e.split(`:`),i=Number(t),a=Number(n),o=r===void 0?0:Number(r);if(!(n!==void 0&&n!==``)||!(!isNaN(i)&&i>=0&&i<24)||!(!isNaN(a)&&a>=0&&a<60)||!(!isNaN(o)&&o>=0&&o<60))return null;let s=new Date;return s.setHours(i,a,o,0),s}createDropdown(){return new W((e,t,n)=>this.onTimeSelected(e,t,n),{showSeconds:this._showSeconds})}onTimeSelected(e,t,n){let r=new Date;r.setHours(e,t,n,0),this.onDropdownSelected(r)}onDropdownSelected(e){this.setValue(e),o.fireEvent(this._input,`input`)}getPreferredWidth(){return 140}},G=i(TimeField),K=240,DateTimePickerDropdown=class extends AbstractCalendarDropdown{constructor(e,t){super(e,t)}applyOptions(e){return super.applyOptions(e),e.showSeconds!==void 0&&(this._options.showSeconds=e.showSeconds),this}buildExtraRootChildren(){this._timeField=new G({showSeconds:this.isShowingSeconds()}),this._timeField.on(`change`,e=>this.onTimeFieldChange(e)),this._root.addComponent(this._timeField)}rebuildExtraRowsAfterValueChange(){this._timeField.setValue(this._value)}onTimeFieldChange(e){if(!e)return;let t=this._value??this.todayMidnight();t.setHours(e.getHours(),e.getMinutes(),this.isShowingSeconds()?e.getSeconds():0,0),this._value=t,this.notifyValueChanged()}applyDateSelection(e){this._value?this._value.setFullYear(e.getFullYear(),e.getMonth(),e.getDate()):this._value=new Date(e.getFullYear(),e.getMonth(),e.getDate(),0,0,0,0)}applyYearSelection(e){this._value&&(this._value.setFullYear(e),this.notifyValueChanged())}getPanelWidth(){return K}getExtraInnerHeight(){return 4+(this._timeField.getPreferredSize()?.height??0)}isShowingSeconds(){return this._options.showSeconds??!1}todayMidnight(){let e=new Date;return new Date(e.getFullYear(),e.getMonth(),e.getDate(),0,0,0,0)}},q=i(DateTimePickerDropdown);c.register(C);var Checkbox=class extends m{_box;_check;_dash;constructor(e){super({...e??{}}),this.setLayoutManager(new g),this._box=new a,this._box.setPreferredSize({width:16,height:16}),this._box.setMinSize({width:16,height:16}),this._box.setMaxSize({width:16,height:16}),this._box.setSize({width:16,height:16}),this._box.setBackgroundColor(`var(--ts-ui-checkbox-bg, var(--ts-ui-form-bg, rgb(255, 255, 255)))`),this._box.setBorder(`1px solid var(--ts-ui-form-border, rgb(160, 160, 160))`),this._box.setBorderRadius(`var(--ts-ui-checkbox-radius, 3px)`),this._box.setCursor(`pointer`),this._check=new c(`check`),this._check.setForegroundColor(`var(--ts-ui-checkbox-check-color, rgb(255, 255, 255))`),this._check.setPreferredSize({width:12,height:12}),this._check.setMaxSize({width:12,height:12}),this._check.setX(1),this._check.setY(1),this._check.setOpacity(0),this._check.setPointerEvents(`none`),this._dash=new a,this._dash.setBackgroundColor(`var(--ts-ui-checkbox-check-color, rgb(255, 255, 255))`),this._dash.setPreferredSize({width:8,height:2}),this._dash.setMaxSize({width:8,height:2}),this._dash.setSize({width:8,height:2}),this._dash.setX(3),this._dash.setY(6),this._dash.setOpacity(0),this._dash.setPointerEvents(`none`),r.isReducedMotion()||(this._check.setTransition(`opacity 120ms ease-out`),this._dash.setTransition(`opacity 120ms ease-out`),this._box.setTransition(`background-color 120ms ease-out, border-color 120ms ease-out`)),this._box.addComponent(this._check),this._box.addComponent(this._dash),super.addComponent(this._box),this.getAria().setRole(`checkbox`),this.getAria().setTabIndex(0),this.getAria().setChecked(!1),this.setOutline(`none`),o.addListener(this._box,`click`,()=>this.activateFromPointer()),this.installKeyboard(),this._options.value!==void 0&&this._options.selected===void 0&&(this._options.selected=this._options.value),this._options.selected!==void 0&&this.applySelected(this._options.selected,this._options.indeterminate??!1),this._options.indeterminate!==void 0&&this.applySelected(this._options.selected??!1,this._options.indeterminate),this._options.label!==void 0&&this.applyLabel(this._options.label),this._options.enabled!==void 0&&this.applyEnabled(this._options.enabled),this._options.readOnly!==void 0&&this.applyReadOnly(this._options.readOnly)}applyOptions(e){return super.applyOptions(e),e.selected!==void 0&&(this._options.selected=e.selected),e.value!==void 0&&(this._options.value=e.value),e.indeterminate!==void 0&&(this._options.indeterminate=e.indeterminate),e.label!==void 0&&(this._options.label=e.label),e.enabled!==void 0&&(this._options.enabled=e.enabled),e.readOnly!==void 0&&(this._options.readOnly=e.readOnly),this}activate(){if(this.isIndeterminate()){this.setSelected(!0);return}this.setSelected(!this.isSelected())}getInteractiveSurface(){return this._box}isSelected(){return this._options.selected??!1}setSelected(e){let t=!!e;return t===this.isSelected()&&!this.isIndeterminate()?this:(this._options.selected=t,this._options.indeterminate=!1,this.applySelected(t,!1),this.notifyChange(t),this.getElement()?o.fireEvent(this,`click`):console.warn(`Checkbox '`+this.getId()+`' setSelected before mount; synthetic 'click' skipped.`),this)}getValue(){return this.isSelected()}setValue(e){return this.setSelected(e)}isIndeterminate(){return this._options.indeterminate??!1}setIndeterminate(e){let t=!!e;return t===this.isIndeterminate()?this:(this._options.indeterminate=t,this.applySelected(this.isSelected(),t),this)}setAnimated(e){let t=e&&!r.isReducedMotion();return this._check.setTransition(t?`opacity 120ms ease-out`:`none`),this._dash.setTransition(t?`opacity 120ms ease-out`:`none`),this._box.setTransition(t?`background-color 120ms ease-out, border-color 120ms ease-out`:`none`),this}on(e,t){return e===`action`?(o.addListener(this,`click`,t),this):super.on(e,t)}off(e,t){return e===`action`?(o.removeListener(this,`click`,t),this):super.off(e,t)}applySelected(e,t){t?this.getAria().setChecked(`mixed`):this.getAria().setChecked(e);let n=t?`var(--ts-ui-checkbox-bg-indeterminate, rgb(160, 160, 160))`:e?`var(--ts-ui-checkbox-bg-selected, rgb(30, 100, 200))`:`var(--ts-ui-checkbox-bg, var(--ts-ui-form-bg, rgb(255, 255, 255)))`,r=e||t?`1px solid `+(t?`var(--ts-ui-checkbox-bg-indeterminate, rgb(160, 160, 160))`:`var(--ts-ui-checkbox-bg-selected, rgb(30, 100, 200))`):`1px solid var(--ts-ui-form-border, rgb(160, 160, 160))`;this._box.setBackgroundColor(n),this._box.setBorder(r),this._check.setOpacity(e&&!t?1:0),this._dash.setOpacity(+!!t)}},J=i(Checkbox);c.register(ee);var Y={tag:`div`,backgroundColor:`var(--ts-ui-input-bg, rgb(255, 255, 255))`,foregroundColor:`var(--ts-ui-text-color, black)`,border:`var(--ts-ui-input-border)`,borderRadius:`var(--ts-ui-border-radius, 4px)`,cursor:`pointer`,insets:new n(3,6,3,6)},X=200,Z=22,Q=16,$=200,ComboBoxDropdown=class extends u{_list;_minWidth=$;constructor(e){super(void 0,{layoutManager:new d,backgroundColor:`var(--ts-ui-autocomplete-bg, rgb(255, 255, 255))`,border:`var(--ts-ui-input-border)`,borderRadius:`var(--ts-ui-border-radius, 4px)`,shadow:`var(--ts-ui-autocomplete-shadow, 2px 4px 8px rgba(0,0,0,0.15))`}),this.setContain(`layout`),this._list=new T,this._list.setBorder(`none`),this._list.setBorderRadius(`0`),this._list.setFocusOnRowClick(!1),this.addComponent(this._list),this._list.on(`action`,()=>e(this._list.getSelectedIndex()))}handleKey(e){return this._list.handleKey(e)}showAt(t,n,r){this.pauseLayout(),this._list.setItemsArray(n),this._list.setSelectedIndex(r,!1),this.resumeLayout();let i=this.getPerimeterSize(),a=i.top+i.bottom,o=i.left+i.right,s=n.length*Z+a,c=Math.min(s,X),l=e.source.getElementRect(t),u=this.measureWidestLabel(n)+Q+o,d=l.width,f=Math.max(l.width,this._minWidth),p=Math.min(Math.max(u,d),f,e.source.getViewportSize().width);return this.setWidth(p),this.setHeight(c),this.placeAnchored(l),this.showAnimated(),this.doLayout(),this}setMinWidth(e){return this._minWidth=e,this}getMinWidth(){return this._minWidth}getList(){return this._list}measureWidestLabel(e){let n=0;for(let r of e){let e=t.measureTextWidth(r.label);e>n&&(n=e)}return n}};new s({scope:`class`,name:`ComboBox`,styles:{userSelect:`none`,whiteSpace:`nowrap`}}),new s({scope:`class`,name:`ComboBoxLabel`,styles:{overflow:`hidden`,textOverflow:`ellipsis`}}),new s({scope:`selector`,name:`.ComboBoxDropdown .List:focus::after`,styles:{content:`none`}});var ComboBoxLabel=class extends a{_lineHeight=null;_renderer;constructor(e){super({tag:`span`}),this.setPointerEvents(`none`),this._renderer=e()}setItem(e,t){return this._renderer.update({item:e,index:t}),this}setRenderer(t){let n=this.getElement();if(n){let t=this._renderer.getElement();t&&e.source.getParentNode(t)===n&&e.sink.removeChild(n,t)}return this._renderer=t,n&&e.sink.appendChild(n,this._renderer.getElement(!0)),this}setLineHeight(e){return this._lineHeight=typeof e==`number`?e+`px`:e,this.setElementCSSRule(`lineHeight`,this._lineHeight),this}getLineHeight(){return this._lineHeight}init(t){super.init(t);let n=t||this.getElement();return n&&e.sink.appendChild(n,this._renderer.getElement(!0)),this}doLayout(){super.doLayout();let e=this.getWidth(),t=this.getHeight();return this._renderer.setAutoCommitStyle(!1),this._renderer.setX(0),this._renderer.setY(0),this._renderer.setWidth(e),this._renderer.setHeight(t),this._renderer.setAutoCommitStyle(!0),this._renderer.layoutChildren(e,t),this}},ComboBoxCaret=class extends a{_glyph=new c(`chevron-down`);_size;constructor(){super({tag:`span`}),this._size=t.lineHeightPx({linePadding:!1}),this.setMinSize({width:this._size,height:this._size}),this.setMaxSize({width:this._size,height:this._size}),this.setPointerEvents(`none`),this._glyph.setPreferredSize({width:this._size,height:this._size}),this._glyph.setPointerEvents(`none`),this.addComponent(this._glyph)}getCaretSize(){return this._size}getGlyph(){return this._glyph}},ComboBox=class extends p{_dropdown;_label;_caret;_pendingValue=null;_boundStore=null;_onStoreRefresh;constructor(e,t){super(e,{...Y,...t??{}}),this.getAria().setRole(`combobox`),this.getAria().setExpanded(!1),this.getAria().setTabIndex(0),this._label=new ComboBoxLabel(this._options.rendererFactory??(()=>new w)),this._caret=new ComboBoxCaret,this.addComponent(this._label),this.addComponent(this._caret),this._dropdown=new ComboBoxDropdown(e=>this.onRowSelected(e)),this._options.dropdownAnimated!==void 0&&this._dropdown.setAnimated(this._options.dropdownAnimated),this._options.dropdownMinWidth!==void 0&&this._dropdown.setMinWidth(this._options.dropdownMinWidth),this._options.rendererFactory!==void 0&&this._dropdown.getList().setRendererFactory(this._options.rendererFactory),this.refreshLabel(),this.updateHeight(),this.subscribeTheme(()=>this.updateHeight()),o.addListener(this,`click`,()=>this.toggleDropdown()),o.addListener(this,`keydown`,e=>this.onKeyDown(e)),this._dropdown.setCloseHandler(()=>this.closeDropdown()),this._onStoreRefresh=()=>this.onStoreRefresh(),this._options.store!==void 0&&this._options.displayField!==void 0&&this.setStore(this._options.store,this._options.displayField,this._options.valueField,this._options.glyphField),this._options.items!==void 0&&this.setItems(this._options.items),this._options.selectedIndex!==void 0&&this.setSelectedIndex(this._options.selectedIndex,!1),this._options.value!==void 0&&this.setValue(this._options.value),this._options.selectedItem!==void 0&&this.setValue(this._options.selectedItem),this._options.enabled!==void 0&&this.applyEnabled(this._options.enabled),this._options.readOnly!==void 0&&this.applyReadOnly(this._options.readOnly)}applyOptions(e){return super.applyOptions(e),e.items!==void 0&&(this._options.items=e.items),e.store!==void 0&&(this._options.store=e.store),e.displayField!==void 0&&(this._options.displayField=e.displayField),e.valueField!==void 0&&(this._options.valueField=e.valueField),e.glyphField!==void 0&&(this._options.glyphField=e.glyphField),e.rendererFactory!==void 0&&(this._options.rendererFactory=e.rendererFactory),e.selectedIndex!==void 0&&(this._options.selectedIndex=e.selectedIndex),e.value!==void 0&&(this._options.value=e.value),e.selectedItem!==void 0&&(this._options.selectedItem=e.selectedItem),e.dropdownAnimated!==void 0&&(this._options.dropdownAnimated=e.dropdownAnimated),e.dropdownMinWidth!==void 0&&this.setDropdownMinWidth(e.dropdownMinWidth),this}updateHeight(){let e=t.singleLineBoxHeight(this.getInsets(),this.getPadding(),this.getBorderSize());this.setPreferredSize({width:200,height:e}),this.setMaxSize({width:2**53-1,height:e}),this.setMinSize({width:0,height:e})}doLayout(){super.doLayout();let e=this.getInnerSize();if(!e)return this;let t=this._caret.getCaretSize(),n=this.getInsets(),r=n.getLeft(),i=n.getTop(),a=Math.max(0,e.width-t-6),o=r+a+6,s=i+Math.max(0,(e.height-t)/2);return this._label.setX(r),this._label.setY(i),this._label.setWidth(a),this._label.setHeight(e.height),this._label.setLineHeight(e.height),this._label.doLayout(),this._caret.setX(o),this._caret.setY(s),this._caret.setWidth(t),this._caret.setHeight(t),this}getBaseline(){return this.wrapInnerBaseline(t.measureTextBaseline())}openDropdown(){return this._dropdown.isOpen()||this.toggleDropdown(),this}toggleDropdown(){if(this._dropdown.isOpen()){this.closeDropdown();return}let e=this.getElement(!0),t=this._dropdown.getList();this._dropdown.setAnchorElement(e),this._dropdown.showAt(e,t.getItems(),t.getSelectedIndex()),this.getAria().setExpanded(!0),this.setCaretOpen(!0)}setCaretOpen(e){let t=this._caret.getGlyph(),n=this._dropdown.isAnimated()?this._dropdown.getDurationMs():0;t.setTransition(`transform ${n}ms ease`),t.setTransform(e?`rotate(180deg)`:`rotate(0deg)`)}closeDropdown(){this._dropdown.isOpen()&&(this._dropdown.hideAnimated(),this.getAria().setExpanded(!1),this.setCaretOpen(!1))}onKeyDown(e){if(this._dropdown.isOpen()){if(this._dropdown.handleKey(e)){e.preventDefault();return}e.key===`Escape`&&(e.preventDefault(),this.closeDropdown());return}switch(e.key){case`ArrowDown`:case`ArrowUp`:case`Enter`:case` `:e.preventDefault(),this.toggleDropdown();break;case`Escape`:break;default:break}}onRowSelected(e){this.setSelectedIndex(e,!0),this.closeDropdown()}computeSelectedItem(){let e=this._dropdown.getList(),t=e.getSelectedIndex(),n=e.getItems();return t>=0&&t<n.length?{item:n[t],index:t}:{item:{key:``,label:``},index:-1}}refreshLabel(){let{item:e,index:t}=this.computeSelectedItem();this._label.setItem(e,t)}on(e,t){return super.on(e===`action`?`change`:e,t)}off(e,t){return super.off(e===`action`?`change`:e,t)}setValue(e){return this._pendingValue=e,this._dropdown.getList().setValue(e),this.refreshLabel(),this}getValue(){return this._dropdown.getList().getValue()||(this._pendingValue??``)}getSelectedIndex(){return this._dropdown.getList().getSelectedIndex()}setSelectedIndex(e,t=!0){return this._dropdown.getList().setSelectedIndex(e,!1),this._pendingValue=null,this.refreshLabel(),t&&this.notifyChange(this.getValue()),this}getItems(){return this._dropdown.getList().getItems()}setItems(e){return this._dropdown.getList().setItems(e),this.reapplyPendingValue(),this.autoSelectFirstIfEmpty(),this.refreshLabel(),this}addItem(e){return this._dropdown.getList().addItem(e),this.reapplyPendingValue(),this.autoSelectFirstIfEmpty(),this.refreshLabel(),this}setStore(e,t,n,r){return this._options.store=e,this._options.displayField=t,this._options.valueField=n,this._options.glyphField=r,this._boundStore&&[`load`,`add`,`remove`,`datachange`].forEach(e=>this._boundStore.off(e,this._onStoreRefresh)),this._dropdown.getList().setStore(e,t,n,r),this._boundStore=e,[`load`,`add`,`remove`,`datachange`].forEach(t=>e.on(t,this._onStoreRefresh)),this.reapplyPendingValue(),this.autoSelectFirstIfEmpty(),this.refreshLabel(),this}getStore(){return this._dropdown.getList().getStore()}setRendererFactory(e){return this._options.rendererFactory=e,this._dropdown.getList().setRendererFactory(e),this._label.setRenderer(e()),this.refreshLabel(),this}getRendererFactory(){return this._dropdown.getList().getRendererFactory()}getSelectedRecord(){return this._dropdown.getList().getSelectedRecord()}reapplyPendingValue(){if(this._pendingValue===null)return;let e=this._dropdown.getList();e.setValue(this._pendingValue),e.getSelectedIndex()>=0&&(this._pendingValue=null)}autoSelectFirstIfEmpty(){let e=this._dropdown.getList();e.getSelectedIndex()<0&&e.getItems().length>0&&e.setSelectedIndex(0,!1)}onStoreRefresh(){this.reapplyPendingValue(),this.autoSelectFirstIfEmpty(),this.refreshLabel()}setDropdownAnimated(e){return this._options.dropdownAnimated=e,this._dropdown.setAnimated(e),this}isDropdownAnimated(){return this._options.dropdownAnimated??!0}setDropdownMinWidth(e){return this._options.dropdownMinWidth=e,this._dropdown.setMinWidth(e),this}getDropdownMinWidth(){return this._options.dropdownMinWidth??$}applyEnabled(e){this.getAria().setDisabled(!e),this.getAria().setTabIndex(e?0:-1),this.setCursor(e?`pointer`:`default`),e||this.closeDropdown()}applyReadOnly(e){this.getAria().setReadOnly(e)}},te=i(ComboBox);export{W as a,PickerCellList as c,AbstractPickerField as d,registerFocusWithinRing as f,O as g,A as h,G as i,PickerColumn as l,M as m,J as n,B as o,N as p,q as r,PickerCell as s,te as t,R as u};
|
|
2
|
+
//# sourceMappingURL=ComboBox-BjAhXXkY.js.map
|