@tylertech/forge 3.0.0-next.7 → 3.0.0-next.9
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/custom-elements.json +7530 -4847
- package/dist/button/forge-button.css +1 -1
- package/dist/esm/accordion/index.js +1 -1
- package/dist/esm/app-bar/help-button/index.js +1 -1
- package/dist/esm/app-bar/index.js +1 -1
- package/dist/esm/app-bar/menu-button/index.js +1 -1
- package/dist/esm/app-bar/notification-button/index.js +1 -1
- package/dist/esm/app-bar/profile-button/index.js +1 -1
- package/dist/esm/app-bar/search/index.js +1 -1
- package/dist/esm/autocomplete/index.js +1 -1
- package/dist/esm/banner/index.js +1 -1
- package/dist/esm/bottom-sheet/index.js +1 -1
- package/dist/esm/busy-indicator/index.js +1 -1
- package/dist/esm/button/index.js +1 -1
- package/dist/esm/button-toggle/button-toggle/index.js +1 -1
- package/dist/esm/button-toggle/button-toggle-group/index.js +1 -1
- package/dist/esm/button-toggle/index.js +1 -1
- package/dist/esm/calendar/calendar-dropdown/index.js +1 -1
- package/dist/esm/calendar/calendar-menu/index.js +1 -1
- package/dist/esm/calendar/index.js +1 -1
- package/dist/esm/card/index.js +1 -1
- package/dist/esm/checkbox/index.js +1 -1
- package/dist/esm/chip-field/index.js +1 -1
- package/dist/esm/chips/chip/index.js +1 -1
- package/dist/esm/chips/chip-set/index.js +1 -1
- package/dist/esm/chips/index.js +1 -1
- package/dist/esm/chunks/{chunk.PPPTT3SM.js → chunk.2VP57RZO.js} +2 -2
- package/dist/esm/chunks/{chunk.PPPTT3SM.js.map → chunk.2VP57RZO.js.map} +2 -2
- package/dist/esm/chunks/{chunk.TXFYS6EU.js → chunk.33EJTOVA.js} +2 -2
- package/dist/esm/chunks/{chunk.OTVT3XM2.js → chunk.3JDFBEF7.js} +2 -2
- package/dist/esm/chunks/chunk.3ME47JIX.js +7 -0
- package/dist/esm/chunks/chunk.3ME47JIX.js.map +7 -0
- package/dist/esm/chunks/{chunk.V6JVHYVW.js → chunk.44UCSD46.js} +2 -2
- package/dist/esm/chunks/{chunk.EUE3OVC7.js → chunk.4WVHON6T.js} +2 -2
- package/dist/esm/chunks/chunk.4WVHON6T.js.map +7 -0
- package/dist/esm/chunks/{chunk.6SBTLXLH.js → chunk.5IQGVS6U.js} +2 -2
- package/dist/esm/chunks/{chunk.6SBTLXLH.js.map → chunk.5IQGVS6U.js.map} +1 -1
- package/dist/esm/chunks/{chunk.7JQHQKXN.js → chunk.6MPXRRMB.js} +2 -2
- package/dist/esm/chunks/{chunk.MXNLCQRB.js → chunk.6VDF54LZ.js} +2 -2
- package/dist/esm/chunks/{chunk.GF2GUVYS.js → chunk.7TGGJGTG.js} +2 -2
- package/dist/esm/chunks/{chunk.GF2GUVYS.js.map → chunk.7TGGJGTG.js.map} +1 -1
- package/dist/esm/chunks/{chunk.4EB5NVCK.js → chunk.AHHNJSZK.js} +2 -2
- package/dist/esm/chunks/chunk.BBKRPL6R.js +7 -0
- package/dist/esm/chunks/chunk.BBKRPL6R.js.map +7 -0
- package/dist/esm/chunks/{chunk.BSTIDYQJ.js → chunk.BBWMSCVG.js} +2 -2
- package/dist/esm/chunks/{chunk.BKCEVPKW.js → chunk.BDCJIRNK.js} +2 -2
- package/dist/esm/chunks/chunk.BSVFCJCQ.js +7 -0
- package/dist/esm/chunks/chunk.BSVFCJCQ.js.map +7 -0
- package/dist/esm/chunks/chunk.CAUWWFF4.js +7 -0
- package/dist/esm/chunks/chunk.CAUWWFF4.js.map +7 -0
- package/dist/esm/chunks/{chunk.SYZB7B4F.js → chunk.CL65KLH7.js} +2 -2
- package/dist/esm/chunks/{chunk.4LVS2EYJ.js → chunk.DFGBVJBE.js} +2 -2
- package/dist/esm/chunks/chunk.DXZ5LVFJ.js +7 -0
- package/dist/esm/chunks/chunk.DXZ5LVFJ.js.map +7 -0
- package/dist/esm/chunks/{chunk.YUAU5IWT.js → chunk.F776DWXU.js} +2 -2
- package/dist/esm/chunks/{chunk.HKJEGD6C.js → chunk.FIBGOPNP.js} +2 -2
- package/dist/esm/chunks/{chunk.HKJEGD6C.js.map → chunk.FIBGOPNP.js.map} +1 -1
- package/dist/esm/chunks/{chunk.OHNPVHPF.js → chunk.GEGK55XX.js} +2 -2
- package/dist/esm/chunks/{chunk.OHNPVHPF.js.map → chunk.GEGK55XX.js.map} +2 -2
- package/dist/esm/chunks/{chunk.2QFIMTVP.js → chunk.GT3XBPZY.js} +2 -2
- package/dist/esm/chunks/{chunk.OT6H5NHX.js → chunk.HUGRRRQA.js} +2 -2
- package/dist/esm/chunks/{chunk.GJW4WS4I.js → chunk.HXJCTE47.js} +2 -2
- package/dist/esm/chunks/{chunk.RHYRMQS7.js → chunk.IPGZ24EH.js} +2 -2
- package/dist/esm/chunks/{chunk.RHYRMQS7.js.map → chunk.IPGZ24EH.js.map} +1 -1
- package/dist/esm/chunks/chunk.ISC7SZSP.js +7 -0
- package/dist/esm/chunks/chunk.ISC7SZSP.js.map +7 -0
- package/dist/esm/chunks/{chunk.RUSHOL23.js → chunk.JAAJDT5E.js} +2 -2
- package/dist/esm/chunks/{chunk.SIJGKRYS.js → chunk.JCRC2VEI.js} +2 -2
- package/dist/esm/chunks/{chunk.SIJGKRYS.js.map → chunk.JCRC2VEI.js.map} +1 -1
- package/dist/esm/chunks/{chunk.STGRPD2L.js → chunk.JFKSREWG.js} +2 -2
- package/dist/esm/chunks/{chunk.STGRPD2L.js.map → chunk.JFKSREWG.js.map} +1 -1
- package/dist/esm/chunks/{chunk.FAANPQES.js → chunk.JL4XB4RI.js} +2 -2
- package/dist/esm/chunks/{chunk.24L5GDD2.js → chunk.JTIPXKV6.js} +2 -2
- package/dist/esm/chunks/{chunk.24L5GDD2.js.map → chunk.JTIPXKV6.js.map} +2 -2
- package/dist/esm/chunks/chunk.KO45GDOA.js +7 -0
- package/dist/esm/chunks/{chunk.2CTK5R37.js.map → chunk.KO45GDOA.js.map} +2 -2
- package/dist/esm/chunks/chunk.KSCUIS5C.js +7 -0
- package/dist/esm/chunks/chunk.KSCUIS5C.js.map +7 -0
- package/dist/esm/chunks/{chunk.2LRDPTHK.js → chunk.M2M47T4L.js} +2 -2
- package/dist/esm/chunks/{chunk.JVW6JGV3.js → chunk.MGWY7YIL.js} +2 -2
- package/dist/esm/chunks/{chunk.JVW6JGV3.js.map → chunk.MGWY7YIL.js.map} +2 -2
- package/dist/esm/chunks/{chunk.3CBVRCKM.js → chunk.MJSLXZBM.js} +2 -2
- package/dist/esm/chunks/{chunk.3CBVRCKM.js.map → chunk.MJSLXZBM.js.map} +1 -1
- package/dist/esm/chunks/{chunk.2YAU7AXH.js → chunk.N7PQ2MUQ.js} +2 -2
- package/dist/esm/chunks/{chunk.2YAU7AXH.js.map → chunk.N7PQ2MUQ.js.map} +1 -1
- package/dist/esm/chunks/{chunk.XMFQFFKR.js → chunk.NE4NCRRZ.js} +2 -2
- package/dist/esm/chunks/chunk.NF4J3Q5X.js +7 -0
- package/dist/esm/chunks/chunk.NF4J3Q5X.js.map +7 -0
- package/dist/esm/chunks/chunk.OEYALYRM.js +7 -0
- package/dist/esm/chunks/chunk.OEYALYRM.js.map +7 -0
- package/dist/esm/chunks/{chunk.GHSAKRYH.js → chunk.OKKH7F7M.js} +2 -2
- package/dist/esm/chunks/{chunk.AGMPIMJV.js → chunk.QL45FKVJ.js} +2 -2
- package/dist/esm/chunks/{chunk.AGMPIMJV.js.map → chunk.QL45FKVJ.js.map} +2 -2
- package/dist/esm/chunks/chunk.QU76MOCS.js +12 -0
- package/dist/esm/chunks/chunk.QU76MOCS.js.map +7 -0
- package/dist/esm/chunks/{chunk.5PHLKON3.js → chunk.R5HZFOUK.js} +2 -2
- package/dist/esm/chunks/{chunk.5PHLKON3.js.map → chunk.R5HZFOUK.js.map} +2 -2
- package/dist/esm/chunks/chunk.SAXRW6GB.js +7 -0
- package/dist/esm/chunks/chunk.SAXRW6GB.js.map +7 -0
- package/dist/esm/chunks/{chunk.2IQGDFQS.js → chunk.SEP3L4QL.js} +2 -2
- package/dist/esm/chunks/{chunk.2IQGDFQS.js.map → chunk.SEP3L4QL.js.map} +1 -1
- package/dist/esm/chunks/{chunk.Z5TWWM7I.js → chunk.SN5LPTHH.js} +2 -2
- package/dist/esm/chunks/{chunk.Z5TWWM7I.js.map → chunk.SN5LPTHH.js.map} +1 -1
- package/dist/esm/chunks/{chunk.CNQESSA3.js → chunk.UKFJHDO7.js} +2 -2
- package/dist/esm/chunks/{chunk.IGK3VYZG.js → chunk.VI2GRQO3.js} +2 -2
- package/dist/esm/chunks/{chunk.A5MBSCSQ.js → chunk.VNOJO2PF.js} +2 -2
- package/dist/esm/chunks/chunk.W7PZTNZ4.js +7 -0
- package/dist/esm/chunks/chunk.W7PZTNZ4.js.map +7 -0
- package/dist/esm/chunks/chunk.WH6C36MO.js +7 -0
- package/dist/esm/chunks/chunk.WH6C36MO.js.map +7 -0
- package/dist/esm/chunks/{chunk.2YX7ASSX.js → chunk.WXN4S7CN.js} +2 -2
- package/dist/esm/chunks/{chunk.ER52NFXX.js → chunk.X5BG35YX.js} +2 -2
- package/dist/esm/chunks/{chunk.THPU5KBV.js → chunk.XRESQBNE.js} +2 -2
- package/dist/esm/chunks/{chunk.632OMHHN.js → chunk.YDY2IGBF.js} +2 -2
- package/dist/esm/chunks/{chunk.632OMHHN.js.map → chunk.YDY2IGBF.js.map} +1 -1
- package/dist/esm/chunks/{chunk.QYKO543K.js → chunk.YWCLKUK7.js} +2 -2
- package/dist/esm/chunks/{chunk.QA3NU7EN.js → chunk.Z4J4D5FD.js} +2 -2
- package/dist/esm/chunks/{chunk.QA3NU7EN.js.map → chunk.Z4J4D5FD.js.map} +1 -1
- package/dist/esm/chunks/{chunk.V4RBOYNH.js → chunk.ZTGPXIC2.js} +2 -2
- package/dist/esm/chunks/{chunk.V4RBOYNH.js.map → chunk.ZTGPXIC2.js.map} +1 -1
- package/dist/esm/circular-progress/index.js +1 -1
- package/dist/esm/color-picker/index.js +1 -1
- package/dist/esm/core/index.js +1 -1
- package/dist/esm/core/utils/index.js +1 -1
- package/dist/esm/date-picker/index.js +1 -1
- package/dist/esm/date-range-picker/index.js +1 -1
- package/dist/esm/expansion-panel/index.js +1 -1
- package/dist/esm/file-picker/index.js +1 -1
- package/dist/esm/focus-indicator/index.js +7 -0
- package/dist/esm/focus-indicator/index.js.map +7 -0
- package/dist/esm/icon/index.js +1 -1
- package/dist/esm/icon-button/index.js +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/list/index.js +1 -1
- package/dist/esm/list/list/index.js +1 -1
- package/dist/esm/list/list-item/index.js +1 -1
- package/dist/esm/list-dropdown/index.js +1 -1
- package/dist/esm/menu/index.js +1 -1
- package/dist/esm/open-icon/index.js +1 -1
- package/dist/esm/paginator/index.js +1 -1
- package/dist/esm/profile-card/index.js +1 -1
- package/dist/esm/quantity-field/index.js +1 -1
- package/dist/esm/radio/index.js +1 -1
- package/dist/esm/select/core/index.js +1 -1
- package/dist/esm/select/index.js +1 -1
- package/dist/esm/select/select/index.js +1 -1
- package/dist/esm/select/select-dropdown/index.js +1 -1
- package/dist/esm/slider/index.js +1 -1
- package/dist/esm/split-view/index.js +1 -1
- package/dist/esm/split-view/split-view/index.js +1 -1
- package/dist/esm/split-view/split-view-panel/index.js +1 -1
- package/dist/esm/state-layer/index.js +7 -0
- package/dist/esm/state-layer/index.js.map +7 -0
- package/dist/esm/stepper/index.js +1 -1
- package/dist/esm/stepper/step/index.js +1 -1
- package/dist/esm/stepper/stepper/index.js +1 -1
- package/dist/esm/switch/index.js +1 -1
- package/dist/esm/table/index.js +1 -1
- package/dist/esm/tabs/index.js +1 -1
- package/dist/esm/tabs/tab/index.js +1 -1
- package/dist/esm/tabs/tab-bar/index.js +1 -1
- package/dist/esm/text-field/index.js +1 -1
- package/dist/esm/time-picker/index.js +1 -1
- package/dist/esm/toast/index.js +1 -1
- package/dist/forge-dark.css +1 -1
- package/dist/forge.css +1 -1
- package/dist/icon-button/forge-icon-button.css +1 -1
- package/dist/table/forge-table.css +1 -1
- package/dist/theme/forge-theme.css +1 -1
- package/esm/app-bar/app-bar.js +1 -1
- package/esm/banner/banner.js +1 -1
- package/esm/bottom-sheet/bottom-sheet.js +1 -1
- package/esm/busy-indicator/busy-indicator.js +1 -1
- package/esm/button/button.d.ts +1 -0
- package/esm/button/button.js +8 -2
- package/esm/button-toggle/button-toggle/button-toggle.js +1 -1
- package/esm/calendar/calendar-menu/calendar-menu.js +1 -1
- package/esm/calendar/calendar.js +1 -1
- package/esm/card/card-constants.d.ts +2 -2
- package/esm/card/card-constants.js +2 -2
- package/esm/card/card.d.ts +19 -8
- package/esm/card/card.js +30 -21
- package/esm/checkbox/checkbox-adapter.d.ts +1 -0
- package/esm/checkbox/checkbox-adapter.js +9 -2
- package/esm/checkbox/checkbox.js +1 -1
- package/esm/chip-field/chip-field.js +1 -1
- package/esm/chips/chip/chip.js +1 -1
- package/esm/circular-progress/circular-progress.d.ts +3 -3
- package/esm/circular-progress/circular-progress.js +4 -4
- package/esm/color-picker/color-picker.js +1 -1
- package/esm/core/testing/pointer.d.ts +13 -0
- package/esm/core/testing/pointer.js +42 -0
- package/esm/core/utils/utils.d.ts +16 -2
- package/esm/core/utils/utils.js +47 -6
- package/esm/file-picker/file-picker.js +1 -1
- package/esm/focus-indicator/focus-indicator-adapter.d.ts +29 -0
- package/esm/focus-indicator/focus-indicator-adapter.js +39 -0
- package/esm/focus-indicator/focus-indicator-constants.d.ts +15 -0
- package/esm/focus-indicator/focus-indicator-constants.js +19 -0
- package/esm/focus-indicator/focus-indicator-foundation.d.ts +43 -0
- package/esm/focus-indicator/focus-indicator-foundation.js +110 -0
- package/esm/focus-indicator/focus-indicator.d.ts +67 -0
- package/esm/focus-indicator/focus-indicator.js +112 -0
- package/esm/focus-indicator/index.d.ts +10 -0
- package/esm/focus-indicator/index.js +14 -0
- package/esm/icon-button/icon-button.d.ts +1 -0
- package/esm/icon-button/icon-button.js +9 -2
- package/esm/index.d.ts +2 -0
- package/esm/index.js +6 -0
- package/esm/list/list-item/list-item-adapter.d.ts +3 -3
- package/esm/list/list-item/list-item-adapter.js +2 -2
- package/esm/list/list-item/list-item-foundation.d.ts +1 -0
- package/esm/list/list-item/list-item-foundation.js +8 -1
- package/esm/list/list-item/list-item.js +1 -1
- package/esm/paginator/paginator.js +1 -1
- package/esm/profile-card/profile-card.js +1 -1
- package/esm/radio/radio-adapter.d.ts +1 -0
- package/esm/radio/radio-adapter.js +9 -2
- package/esm/select/select/select.js +1 -1
- package/esm/slider/slider-adapter.d.ts +0 -16
- package/esm/slider/slider-adapter.js +11 -71
- package/esm/slider/slider-constants.d.ts +0 -3
- package/esm/slider/slider-constants.js +0 -3
- package/esm/slider/slider-foundation.d.ts +0 -1
- package/esm/slider/slider-foundation.js +0 -6
- package/esm/slider/slider-utils.js +6 -3
- package/esm/slider/slider.d.ts +0 -2
- package/esm/slider/slider.js +9 -7
- package/esm/split-view/split-view-panel/split-view-panel.js +1 -1
- package/esm/state-layer/index.d.ts +10 -0
- package/esm/state-layer/index.js +14 -0
- package/esm/state-layer/state-layer-adapter.d.ts +41 -0
- package/esm/state-layer/state-layer-adapter.js +101 -0
- package/esm/state-layer/state-layer-constants.d.ts +79 -0
- package/esm/state-layer/state-layer-constants.js +89 -0
- package/esm/state-layer/state-layer-foundation.d.ts +57 -0
- package/esm/state-layer/state-layer-foundation.js +237 -0
- package/esm/state-layer/state-layer-utils.d.ts +26 -0
- package/esm/state-layer/state-layer-utils.js +54 -0
- package/esm/state-layer/state-layer.d.ts +66 -0
- package/esm/state-layer/state-layer.js +96 -0
- package/esm/stepper/step/step.js +1 -1
- package/esm/switch/switch.js +10 -3
- package/esm/tabs/tab/tab-adapter.d.ts +4 -6
- package/esm/tabs/tab/tab-adapter.js +9 -18
- package/esm/tabs/tab/tab-constants.d.ts +0 -1
- package/esm/tabs/tab/tab-constants.js +0 -1
- package/esm/tabs/tab/tab-foundation.d.ts +0 -1
- package/esm/tabs/tab/tab-foundation.js +1 -3
- package/esm/tabs/tab/tab.d.ts +0 -1
- package/esm/tabs/tab/tab.js +9 -6
- package/esm/tabs/tab-bar/tab-bar.d.ts +2 -2
- package/esm/tabs/tab-bar/tab-bar.js +3 -3
- package/esm/text-field/text-field.js +1 -1
- package/esm/toast/toast.js +1 -1
- package/package.json +1 -1
- package/styles/app-bar/_mixins.scss +9 -1
- package/styles/card/_mixins.scss +8 -7
- package/styles/circular-progress/_mixins.scss +3 -10
- package/styles/core/{style-layer → styles}/circular-progress/_core.scss +5 -8
- package/styles/core/styles/focus-indicator/_core.scss +5 -0
- package/styles/core/styles/focus-indicator/_variables.scss +8 -0
- package/styles/core/styles/focus-indicator/index.scss +7 -0
- package/styles/core/{style-layer → styles}/slider/_core.scss +13 -31
- package/styles/core/styles/state-layer/_core.scss +144 -0
- package/styles/core/styles/state-layer/_variables.scss +8 -0
- package/styles/core/{style-layer/tabs/tab → styles/state-layer}/index.scss +0 -4
- package/styles/core/{style-layer → styles}/tabs/tab/_core.scss +36 -40
- package/styles/core/{style-layer → styles}/tabs/tab-bar/_core.scss +2 -2
- package/styles/core/{style-layer → styles}/tabs/tab-bar/_variables.scss +1 -1
- package/styles/core/styles/tabs/tab-bar/index.scss +7 -0
- package/styles/core/styles/tokens/_color-palette.scss +299 -0
- package/styles/core/styles/tokens/circular-progress/_tokens.scss +14 -0
- package/styles/core/styles/tokens/focus-indicator/_tokens.scss +24 -0
- package/styles/core/styles/tokens/index.scss +58 -0
- package/styles/core/styles/tokens/state-layer/_tokens.scss +17 -0
- package/styles/core/styles/tokens/theme/_tokens.scss +185 -0
- package/styles/core/styles/tokens/typography/_tokens.scss +47 -0
- package/styles/core/styles/utils/_elevation.scss +5 -0
- package/styles/focus-indicator/_mixins.scss +138 -0
- package/styles/focus-indicator/_variables.scss +5 -0
- package/styles/focus-indicator/focus-indicator.scss +32 -0
- package/styles/linear-progress/_mixins.scss +1 -1
- package/styles/linear-progress/_variables.scss +1 -1
- package/styles/slider/_mixins.scss +17 -1
- package/styles/state-layer/_mixins.scss +23 -0
- package/styles/state-layer/state-layer.scss +20 -0
- package/styles/tabs/tab/_mixins.scss +20 -1
- package/styles/tabs/tab/_variables.scss +2 -0
- package/styles/tabs/tab-bar/_mixins.scss +2 -1
- package/styles/tabs/tab-bar/_variables.scss +2 -2
- package/styles/theme/_theme-dark.scss +5 -3
- package/styles/theme/_theme.scss +3 -36
- package/dist/esm/chunks/chunk.246JM2YT.js +0 -7
- package/dist/esm/chunks/chunk.246JM2YT.js.map +0 -7
- package/dist/esm/chunks/chunk.2CTK5R37.js +0 -7
- package/dist/esm/chunks/chunk.2XFVFZ3P.js +0 -7
- package/dist/esm/chunks/chunk.2XFVFZ3P.js.map +0 -7
- package/dist/esm/chunks/chunk.5IVB5L5Z.js +0 -7
- package/dist/esm/chunks/chunk.5IVB5L5Z.js.map +0 -7
- package/dist/esm/chunks/chunk.A5R7KUIP.js +0 -7
- package/dist/esm/chunks/chunk.A5R7KUIP.js.map +0 -7
- package/dist/esm/chunks/chunk.BWZKQ6WX.js +0 -7
- package/dist/esm/chunks/chunk.BWZKQ6WX.js.map +0 -7
- package/dist/esm/chunks/chunk.EUE3OVC7.js.map +0 -7
- package/dist/esm/chunks/chunk.GUYPITGA.js +0 -7
- package/dist/esm/chunks/chunk.GUYPITGA.js.map +0 -7
- package/dist/esm/chunks/chunk.GWIVOPRO.js +0 -7
- package/dist/esm/chunks/chunk.GWIVOPRO.js.map +0 -7
- package/dist/esm/chunks/chunk.JHXNEHWR.js +0 -12
- package/dist/esm/chunks/chunk.JHXNEHWR.js.map +0 -7
- package/dist/esm/chunks/chunk.NVMILGC2.js +0 -7
- package/dist/esm/chunks/chunk.NVMILGC2.js.map +0 -7
- package/dist/esm/chunks/chunk.WFDIA7R6.js +0 -7
- package/dist/esm/chunks/chunk.WFDIA7R6.js.map +0 -7
- package/esm/slider/slider-handle-ripple.d.ts +0 -18
- package/esm/slider/slider-handle-ripple.js +0 -37
- package/esm/tabs/tab/tab-ripple.d.ts +0 -17
- package/esm/tabs/tab/tab-ripple.js +0 -33
- package/styles/circular-progress/_variables.scss +0 -12
- /package/dist/esm/chunks/{chunk.TXFYS6EU.js.map → chunk.33EJTOVA.js.map} +0 -0
- /package/dist/esm/chunks/{chunk.OTVT3XM2.js.map → chunk.3JDFBEF7.js.map} +0 -0
- /package/dist/esm/chunks/{chunk.V6JVHYVW.js.map → chunk.44UCSD46.js.map} +0 -0
- /package/dist/esm/chunks/{chunk.7JQHQKXN.js.map → chunk.6MPXRRMB.js.map} +0 -0
- /package/dist/esm/chunks/{chunk.MXNLCQRB.js.map → chunk.6VDF54LZ.js.map} +0 -0
- /package/dist/esm/chunks/{chunk.4EB5NVCK.js.map → chunk.AHHNJSZK.js.map} +0 -0
- /package/dist/esm/chunks/{chunk.BSTIDYQJ.js.map → chunk.BBWMSCVG.js.map} +0 -0
- /package/dist/esm/chunks/{chunk.BKCEVPKW.js.map → chunk.BDCJIRNK.js.map} +0 -0
- /package/dist/esm/chunks/{chunk.SYZB7B4F.js.map → chunk.CL65KLH7.js.map} +0 -0
- /package/dist/esm/chunks/{chunk.4LVS2EYJ.js.map → chunk.DFGBVJBE.js.map} +0 -0
- /package/dist/esm/chunks/{chunk.YUAU5IWT.js.map → chunk.F776DWXU.js.map} +0 -0
- /package/dist/esm/chunks/{chunk.2QFIMTVP.js.map → chunk.GT3XBPZY.js.map} +0 -0
- /package/dist/esm/chunks/{chunk.OT6H5NHX.js.map → chunk.HUGRRRQA.js.map} +0 -0
- /package/dist/esm/chunks/{chunk.GJW4WS4I.js.map → chunk.HXJCTE47.js.map} +0 -0
- /package/dist/esm/chunks/{chunk.RUSHOL23.js.map → chunk.JAAJDT5E.js.map} +0 -0
- /package/dist/esm/chunks/{chunk.FAANPQES.js.map → chunk.JL4XB4RI.js.map} +0 -0
- /package/dist/esm/chunks/{chunk.2LRDPTHK.js.map → chunk.M2M47T4L.js.map} +0 -0
- /package/dist/esm/chunks/{chunk.XMFQFFKR.js.map → chunk.NE4NCRRZ.js.map} +0 -0
- /package/dist/esm/chunks/{chunk.GHSAKRYH.js.map → chunk.OKKH7F7M.js.map} +0 -0
- /package/dist/esm/chunks/{chunk.CNQESSA3.js.map → chunk.UKFJHDO7.js.map} +0 -0
- /package/dist/esm/chunks/{chunk.IGK3VYZG.js.map → chunk.VI2GRQO3.js.map} +0 -0
- /package/dist/esm/chunks/{chunk.A5MBSCSQ.js.map → chunk.VNOJO2PF.js.map} +0 -0
- /package/dist/esm/chunks/{chunk.2YX7ASSX.js.map → chunk.WXN4S7CN.js.map} +0 -0
- /package/dist/esm/chunks/{chunk.ER52NFXX.js.map → chunk.X5BG35YX.js.map} +0 -0
- /package/dist/esm/chunks/{chunk.THPU5KBV.js.map → chunk.XRESQBNE.js.map} +0 -0
- /package/dist/esm/chunks/{chunk.QYKO543K.js.map → chunk.YWCLKUK7.js.map} +0 -0
- /package/styles/core/{style-layer → styles}/circular-progress/_animations.scss +0 -0
- /package/styles/core/{style-layer → styles}/circular-progress/_variables.scss +0 -0
- /package/styles/core/{style-layer → styles}/circular-progress/index.scss +0 -0
- /package/styles/core/{style-layer → styles}/core/_config.scss +0 -0
- /package/styles/core/{style-layer → styles}/linear-progress/_animations.scss +0 -0
- /package/styles/core/{style-layer → styles}/linear-progress/_core.scss +0 -0
- /package/styles/core/{style-layer → styles}/linear-progress/_variables.scss +0 -0
- /package/styles/core/{style-layer → styles}/linear-progress/index.scss +0 -0
- /package/styles/core/{style-layer → styles}/slider/_functions.scss +0 -0
- /package/styles/core/{style-layer → styles}/slider/_variables.scss +0 -0
- /package/styles/core/{style-layer → styles}/slider/index.scss +0 -0
- /package/styles/core/{style-layer → styles}/tabs/tab/_variables.scss +0 -0
- /package/styles/core/{style-layer/tabs/tab-bar → styles/tabs/tab}/index.scss +0 -0
|
@@ -3,5 +3,5 @@
|
|
|
3
3
|
* Copyright 2023 Tyler Technologies, Inc.
|
|
4
4
|
* License: Apache-2.0
|
|
5
5
|
*/
|
|
6
|
-
import{c as re,f as ce}from"./chunk.2XFVFZ3P.js";import{a as M,d as ae}from"./chunk.ECRL6O3V.js";import{a as ne}from"./chunk.WO7KEM5K.js";import{a as $,b as x,c as v,d as K}from"./chunk.UV3WIHCM.js";import{a as H}from"./chunk.LEVFMI2Q.js";import{b as te}from"./chunk.FYWPZFLJ.js";import{a as ie,d as se,l as oe}from"./chunk.H5D54EHO.js";import{a as X}from"./chunk.G4IN6Y46.js";import{a as le}from"./chunk.RFLASSCI.js";import{a as T}from"./chunk.NVUMRW44.js";import{a as Q}from"./chunk.5V5ABSHI.js";import{a as j,b as ee}from"./chunk.DTZFWZPB.js";import{a as q,k as J}from"./chunk.NK7H3MMM.js";import{d as R,e as F,f as p,g as D,i as W,j as U,t as Z}from"./chunk.CFDK4RCW.js";import{b as f,c as Y,d as I,h as y,j as g,k as L,l as G,o as V}from"./chunk.J2M2MXP2.js";import{a as h,d as _}from"./chunk.M3QDAYD2.js";var w=class{constructor(e){this._key=e,this._items=[]}getItems(){return[...this._items]}count(){return this._items.length}setKey(e){this._key=e}add(e){return e instanceof Array||(e=[e]),e.forEach(t=>{this.exists(t)||this._items.push(t)}),this}remove(e){e instanceof Array||(e=[e]);for(let t=e.length-1;t>=0;t--)this.exists(e[t])&&this._items.splice(this._items.indexOf(this._getItem(e[t])),1);return this}clear(){return this._items=[],this}exists(e){return this._getItem(e)!==null}_getItem(e){return this._key?x(this._items,v(this._key,e))||null:this._items.find(t=>t===e)||null}};var S=`${ee}table`,de={TABLE:"forge-table",TABLE_DENSE:"forge-table--dense",TABLE_ROOMY:"forge-table--roomy",TABLE_RESIZABLE:"forge-table--resizable",TABLE_RESIZING:"forge-table--resizing",TABLE_RESIZE_HANDLE:"forge-table__resize-handle",TABLE_NO_WRAP_CONTENT:"forge-table--no-wrap-content",TABLE_LAYOUT_FIXED:"forge-table--layout-fixed",TABLE_FILTER_VISIBLE:"forge-table--filter-visible",TABLE_FIXED:"forge-table--fixed",TABLE_HEAD:"forge-table-head",TABLE_HEAD_ROW:"forge-table-head__row",TABLE_HEAD_ROW_FILTER:"forge-table-head__row__filter",TABLE_HEAD_CELL:"forge-table-head__cell",TABLE_HEAD_CELL_CONTAINER:"forge-table-head__cell-container",TABLE_HEAD_CELL_SORTABLE:"forge-table-head__cell--sortable",TABLE_HEAD_CELL_SORT_ICON:"forge-table-head__cell-sort-icon",TABLE_HEAD_CELL_TEXT:"forge-table-head__cell-text",TABLE_HEAD_CELL_SORT_ICON_ACTIVE:"forge-table-head__cell-sort-icon--active",TABLE_HEAD_CELL_SORTED_ASCENDING:"forge-table-head__cell--sorted-ascending",TABLE_HEAD_CELL_SORTED_DESCENDING:"forge-table-head__cell--sorted-descending",TABLE_HEAD_CELL_SORT_ORDER:"forge-table-head__cell__sort-order",TABLE_HEAD_CELL_SORT_ORDER_HIDDEN:"forge-table-head__cell__sort-order--hidden",TABLE_BODY:"forge-table-body",TABLE_BODY_ROW:"forge-table-body__row",TABLE_BODY_ROW_SELECTED:"forge-table-body__row--selected",TABLE_BODY_ROW_CLICKABLE:"forge-table-body__row--clickable",TABLE_BODY_CELL:"forge-table-body__cell",TABLE_ROW:"forge-table-row",TABLE_ROW_EXPANDED:"forge-table-row--expanded",TABLE_ROW_EXPANDABLE_CONTENT:"forge-table-row__expandable-content",TABLE_ROW_EXPANDABLE_CONTENT_CELL:"forge-table-row__expandable-content-cell",TABLE_CELL:"forge-table-cell",TABLE_CELL_SELECT:"forge-table-cell__select",TABLE_CELL_SELECT_CHECKBOX:"forge-table-cell__select-checkbox",TABLE_CELL_SELECT_CHECKBOX_CONTAINER:"forge-table-cell__select-checkbox-container",TABLE_CELL_SELECT_CHECKBOX_CONTAINER_ALIGN_RIGHT:"forge-table-cell__select-checkbox-container--align-right",TABLE_CELL_SELECT_CHECKBOX_CONTAINER_ALIGN_LEFT:"forge-table-cell__select-checkbox-container--align-left",TABLE_CELL_SELECT_CHECKBOX_CONTAINER_ALIGN_CENTER:"forge-table-cell__select-checkbox-container--align-center",TABLE_CELL_CONTAINER:"forge-table-cell__container",TABLE_CELL_CONTAINER_TEXT:"forge-table-cell__container-text",TABLE_CELL_CENTER:"forge-table-cell--center",TABLE_CELL_RIGHT:"forge-table-cell--right",TABLE_CELL_RESIZABLE:"forge-table-cell--resizing"},Ee={TABLE:".forge-table",CHECKBOX_INPUT:"forge-checkbox > input[type=checkbox]:not([forge-ignore])",SELECT_ALL_TEMPLATE_CHECKBOX_INPUT:"input[type=checkbox]:not([forge-ignore])",ROW_SELECTED:`.${de.TABLE_BODY_ROW_SELECTED}`},_e={SELECT:"select",MULTISELECT:"multiselect",SELECT_KEY:"select-key",DENSE:"dense",ROOMY:"roomy",FILTER:"filter",FIXED_HEADERS:"fixed-headers",LAYOUT_TYPE:"layout-type",WRAP_CONTENT:"wrap-content",RESIZABLE:"resizable",MIN_RESIZE_WIDTH:"min-resize-width",ALLOW_ROW_CLICK:"allow-row-click",MULTI_COLUMN_SORT:"multi-column-sort",SELECT_CHECKBOX_ALIGNMENT:"select-checkbox-alignment",TOOLTIP_SELECT:"tooltip-select",TOOLTIP_SELECT_ALL:"tooltip-select-all",CHECKBOX_TYPE:"forge-checkbox-type",CUSTOM_CELL_TEMPLATE:"data-cell-template",CUSTOM_CELL_TEMPLATE_STOP_PROPAGATION:"data-cell-template-stop-propagation"},Te={ROW_CLICK:`${S}-row-click`,SELECT:`${S}-select`,SELECT_DOUBLE:`${S}-select-double`,SELECT_ALL:`${S}-select-all`,SORT:`${S}-sort`,FILTER:`${S}-filter`,INITIALIZED:`${S}-initialized`,COLUMN_RESIZE:`${S}-column-resize`},pe={SELECT_ALL:"select-all",SELECT_ROW:"select-row",DEFAULT_LAYOUT_TYPE:"auto"},Ce={SORT_DOWN:"arrow_downward"},he={DEFAULT_FILTER_DEBOUNCE_TIME:750,MIN_RESIZE_WIDTH:100,RESIZE_HOVER_DURATION:150},s={elementName:S,classes:de,selectors:Ee,attributes:_e,events:Te,strings:pe,icons:Ce,numbers:he};var B=(l=>(l.Left="left",l.Right="right",l.Center="center",l))(B||{}),O=(l=>(l.Ascending="ASC",l.Descending="DESC",l.Unset="UNSET",l))(O||{}),Le=(a=>(a.InputText="text",a.InputNumber="number",a.Select="select",a.SelectMultiple="select-multiple",a.Date="date",a.DateRange="date-range",a))(Le||{});function me(n){return n&&typeof n=="object"&&"content"in n}var b=class n{static createTable(e){n._resetTable(e.tableElement);let t=n._createTableHead(e),l=n._createTableBody(e);e.clickListener&&(n._attachRowClickListeners(l,e.clickListener,e.doubleClickListener),n._addRowClickAttributes(l)),e.fixedHeaders&&n.setFixedHeaders(e),e.resizable&&n.setResizable(e),e.dense&&n.setDenseState(e.tableElement,e.dense),e.wrapContent&&n.setWrapContentState(e.tableElement,e.wrapContent),e.selectListener&&n._addSelectColumn(t,l,e.selectListener,e.selectAllListener,e.selectAllTemplate,e.selectCheckboxAlignment,e.data,e.tooltipSelect,e.tooltipSelectAll),(e.resizable||e.columnConfigurations.some(i=>!!i.sortable))&&(n._attachHeadRowMouseDownListener(t,e.headRowMouseDownListener),n._isMac()&&n._attachHeadRowContextMenuListener(t,e.headRowContextMenuListener)),n.setLayoutType(e),n._setTableHead(e.tableElement,t),e.filter&&n.setFilterRow(e),n._setTableBody(e.tableElement,l)}static _setTableHead(e,t){e.tHead?F(t,e.tHead):e.appendChild(t)}static _setTableBody(e,t){e.tBodies.length?F(t,e.tBodies[0]):e.appendChild(t)}static recreateTableBody(e){let t=n._createTableBody(e);e.clickListener&&(n._attachRowClickListeners(t,e.clickListener,e.doubleClickListener),n._addRowClickAttributes(t)),e.selectListener&&(n._createBodySelectColumn(t,e.selectCheckboxAlignment,e.data,e.tooltipSelect,e.tooltipSelectAll),n._attachRowSelectListeners(t,e.selectListener)),n._setTableBody(e.tableElement,t)}static _resetTable(e){R(e)}static _createMultisortTooltip(){let e=document.createElement(ne.elementName);return e.textContent="Ctrl + click to sort multiple columns",e.position="bottom",e.delay=0,e}static _createTableHead(e){let t=document.createElement("thead"),l=t.insertRow();p([s.classes.TABLE_ROW,s.classes.TABLE_HEAD_ROW],l);let i=!1;for(let o=0;o<e.columnConfigurations.length;o++){let a=e.columnConfigurations[o],r=document.createElement("th");r.scope="col",p([s.classes.TABLE_CELL,s.classes.TABLE_HEAD_CELL],r);let c=document.createElement("div");if(c.classList.add(s.classes.TABLE_HEAD_CELL_CONTAINER),e.multiColumnSort){let d=n._createMultisortTooltip();c.appendChild(d)}if(a.align&&n._setCellAlignmentClass(c,a.align),f(a.width)){let d=U(a.width);d&&(r.style.width=d)}if(e.resizable&&a.resizable!==!1){let d=document.createElement("div");d.classList.add(s.classes.TABLE_RESIZE_HANDLE),r.appendChild(d)}f(a.headerCellStyle)&&g(a.headerCellStyle)&&(Object.assign(r.style,a.headerCellStyle),Object.assign(c.style,a.headerCellStyle));let m=document.createElement("span");if(m.classList.add(s.classes.TABLE_HEAD_CELL_TEXT),m.textContent=a.header&&typeof a.header=="string"?a.header.trim():"",a.sortable){r.classList.add(s.classes.TABLE_HEAD_CELL_SORTABLE);let d=document.createElement("span");p([s.classes.TABLE_HEAD_CELL_SORT_ORDER_HIDDEN,s.classes.TABLE_HEAD_CELL_SORT_ORDER],d);let u=document.createElement(ie.elementName);u.name=s.icons.SORT_DOWN,p([s.classes.TABLE_HEAD_CELL_SORT_ICON],u),e.multiColumnSort?typeof a.initialSort=="object"&&a.initialSort.sortOrder&&(d.textContent=a.initialSort.sortOrder.toString(),e.columnConfigurations.filter(C=>typeof C.initialSort=="object").length>1&&D(s.classes.TABLE_HEAD_CELL_SORT_ORDER_HIDDEN,d),r.classList.add(s.classes.TABLE_HEAD_CELL_SORTED_DESCENDING),u.classList.add(s.classes.TABLE_HEAD_CELL_SORT_ICON_ACTIVE),n._setColumnSortDirection(r,a.initialSort.direction)):e.sortedColumn===o&&!i&&!e.multiColumnSort&&(r.classList.add(s.classes.TABLE_HEAD_CELL_SORTED_DESCENDING),u.classList.add(s.classes.TABLE_HEAD_CELL_SORT_ICON_ACTIVE),n._setColumnSortDirection(r,e.sortDirection),i=!0),c.appendChild(u),c.appendChild(d)}typeof a.headerTemplate=="function"?Promise.resolve(a.headerTemplate(o,c,a)).then(d=>{if(d){let u=document.createElement("div");p(s.classes.TABLE_CELL_CONTAINER,u),typeof d=="string"?u.innerHTML=d:n._prepend(d,u),u.setAttribute(s.attributes.CUSTOM_CELL_TEMPLATE,""),n._prepend(u,c)}}):n._prepend(m,c),r.appendChild(c),l.appendChild(r)}return t}static setSortDirection(e,t,l){let i=n._getHeaderCellByIndex(e,t);n._setColumnSortDirection(i,l)}static _setColumnSortDirection(e,t){e.classList.contains(s.classes.TABLE_HEAD_CELL_SORTED_ASCENDING)&&e.classList.remove(s.classes.TABLE_HEAD_CELL_SORTED_ASCENDING),e.classList.contains(s.classes.TABLE_HEAD_CELL_SORTED_DESCENDING)&&e.classList.remove(s.classes.TABLE_HEAD_CELL_SORTED_DESCENDING),!t||t==="DESC"?e.classList.add(s.classes.TABLE_HEAD_CELL_SORTED_DESCENDING):e.classList.add(s.classes.TABLE_HEAD_CELL_SORTED_ASCENDING)}static _createTableBody(e){let t=document.createElement("tbody");return n._getOrderedRowData(e.columnConfigurations,e.data).forEach((i,o)=>{let a=t.insertRow();p([s.classes.TABLE_ROW,s.classes.TABLE_BODY_ROW],a),n._populateRowCells(e,a,i,o),typeof e.rowCreatedCallback=="function"&&e.rowCreatedCallback(a,o,h({},e.data[o].data))}),t}static _populateRowCells(e,t,l,i){for(let o=0;o<l.length;o++){let a=e.columnConfigurations[o],r=t.insertCell();if(p([s.classes.TABLE_CELL,s.classes.TABLE_BODY_CELL],r),f(a.width)){let m=U(a.width);m&&(r.style.width=m)}let c=document.createElement("div");if(c.classList.add(s.classes.TABLE_CELL_CONTAINER),f(a.cellStyle)&&g(a.cellStyle)&&(Object.assign(r.style,a.cellStyle),Object.assign(c.style,a.cellStyle)),a.template&&typeof a.template=="function"){let m=e.data[i]?e.data[i].data:void 0;Promise.resolve(a.template(i,c,m,o)).then(d=>{let u=me(d)?d:{content:d,stopClickPropagation:a.stopCellTemplateClickPropagation};u.content&&(typeof u.content=="string"?c.innerHTML=u.content:c.appendChild(u.content),c.setAttribute(s.attributes.CUSTOM_CELL_TEMPLATE,""),u.stopClickPropagation&&c.setAttribute(s.attributes.CUSTOM_CELL_TEMPLATE_STOP_PROPAGATION,""))})}else if(a.property){let m=document.createElement("span");m.classList.add(s.classes.TABLE_CELL_CONTAINER_TEXT),c.appendChild(m),a.transform&&typeof a.transform=="function"?Promise.resolve(a.transform(l[o])).then(d=>m.textContent=d):l[o]==null?m.textContent="":m.textContent=l[o].toString()}if(a.align&&n._setCellAlignmentClass(c,a.align),r.appendChild(c),f(a.columnSpan)){if(a.columnSpan==="all"){r.colSpan=l.length-o;break}else if(typeof a.columnSpan=="number"&&a.columnSpan>0){let m=a.columnSpan;a.columnSpan>l.length-o&&(m=l.length),r.colSpan=m,o=o+(m-1)}}typeof e.cellCreatedCallback=="function"&&e.cellCreatedCallback(r,i,o)}}static _setCellAlignmentClass(e,t){switch(t){case"center":e.classList.add(s.classes.TABLE_CELL_CENTER);break;case"right":e.classList.add(s.classes.TABLE_CELL_RIGHT);break}}static _getNonExpandedRows(e){return Array.from(e).filter(t=>!t.classList.contains(s.classes.TABLE_ROW_EXPANDABLE_CONTENT))}static _getExpandedRows(e){return Array.from(e).filter(t=>t.classList.contains(s.classes.TABLE_ROW_EXPANDABLE_CONTENT))}static _createColumnDataMap(e,t){return e.map(l=>({config:l,data:t.map(i=>{if(l.property){let o=$(i.data,l.property);return f(o)?o:null}return null})}))}static _getOrderedRowData(e,t){let l=n._createColumnDataMap(e,t),i=[];for(let o of l)for(let a=0;a<o.data.length;a++)i[a]||(i[a]=[]),i[a].push(o.data[a]);return i}static _attachRowClickListeners(e,t,l){n._getNonExpandedRows(e.rows).forEach(o=>{o.addEventListener("click",t),l&&o.addEventListener("dblclick",l)})}static _addRowClickAttributes(e){n._getNonExpandedRows(e.rows).forEach(l=>{l.classList.add(s.classes.TABLE_BODY_ROW_CLICKABLE)})}static _removeRowClickAttributes(e){n._getNonExpandedRows(e.rows).forEach(l=>{l.classList.remove(s.classes.TABLE_BODY_ROW_CLICKABLE)})}static _attachRowSelectListeners(e,t){n._getNonExpandedRows(e.rows).forEach(i=>n._attachRowSelectListener(i,t))}static _attachRowSelectListener(e,t){let l=n._getCheckboxElement(e);l==null||l.addEventListener("click",t)}static _detachRowSelectListeners(e,t){Array.from(e.rows).forEach(l=>{let i=n._getCheckboxElement(l);i==null||i.removeEventListener("click",t)})}static _detachRowClickListeners(e,t,l){Array.from(e.rows).forEach(i=>{i.removeEventListener("click",t),i.removeEventListener("dblclick",l)})}static _attachSelectAllListener(e,t){let l=e.rows[e.rows.length-1],i=n._getCheckboxElement(l);if(!i)throw new Error("Checkbox element not found.");i.addEventListener("change",t)}static _tryAttachSelectAllTemplateListener(e,t){let l=e.rows[e.rows.length-1],i=n._tryGetSelectAllCheckboxElement(l);i&&i.addEventListener("change",t)}static _detachSelectAllListener(e,t){let l=e.rows[e.rows.length-1],i=n._tryGetSelectAllCheckboxElement(l);i&&i.removeEventListener("change",t)}static _attachHeadRowMouseDownListener(e,t){let l=e.rows[0];if(!l)throw new Error("Missing table header row. Unable to attach sort listener.");l.addEventListener("mousedown",t)}static _attachHeadRowContextMenuListener(e,t){let l=e.rows[0];if(!l)throw new Error("Missing table header row. Unable to attach sort listener.");l.addEventListener("contextmenu",t)}static _createSelectColumn(e,t,l,i,o,a,r,c,m){e&&n._createHeadSelectColumn(e,l,i,o,a,m),t&&n._createBodySelectColumn(t,a,r,c,m)}static _createHeadSelectColumn(e,t,l,i,o,a){var r;if(Array.from(e.rows).forEach(c=>{let m=document.createElement("th");p([s.classes.TABLE_CELL,s.classes.TABLE_HEAD_CELL],m),c.insertBefore(m,c.cells.item(0))}),t){let c=(r=e.rows.item(e.rows.length-1))==null?void 0:r.cells.item(0);c.classList.add(s.classes.TABLE_CELL_SELECT),typeof l=="function"?n._renderSelectAllTemplate(l,e).then(()=>{typeof i=="function"&&i()}):c==null||c.appendChild(n._createCheckboxElement(!0,o,null,null,null,a))}}static _createBodySelectColumn(e,t,l,i,o){if(n._getNonExpandedRows(e.rows).forEach((r,c)=>n._addRowSelectColumn(r,t,c,l[c],i,o)),e.rows.length){let r=e.rows.item(0);r&&n._updateExpandedRowColspan(e.rows,r.cells.length)}}static _addRowSelectColumn(e,t,l,i,o,a){let r=e.insertCell(0);p([s.classes.TABLE_CELL,s.classes.TABLE_BODY_CELL,s.classes.TABLE_CELL_SELECT],r),r.appendChild(n._createCheckboxElement(!1,t,l,i,o,a))}static _destroySelectColumn(e,t){let l=n._getNonExpandedRows(t.rows);if(Array.from(e.rows).forEach(i=>i.removeChild(i.cells.item(0))),Array.from(l).forEach(i=>i.removeChild(i.cells.item(0))),t.rows.length){let i=t.rows.item(0);i&&n._updateExpandedRowColspan(t.rows,i.cells.length)}}static _hasSelectColumn(e,t){return[...Array.from(e.rows),...Array.from(t.rows)].some(i=>i.cells.item(0).classList.contains(s.classes.TABLE_CELL_SELECT))}static _createCheckboxElement(e,t,l,i,o,a){let r=document.createElement("div");if(r.classList.add(s.classes.TABLE_CELL_SELECT_CHECKBOX_CONTAINER),t)switch(t){case"center":r.classList.add(s.classes.TABLE_CELL_SELECT_CHECKBOX_CONTAINER_ALIGN_CENTER);break;case"left":r.classList.add(s.classes.TABLE_CELL_SELECT_CHECKBOX_CONTAINER_ALIGN_LEFT);break;case"right":r.classList.add(s.classes.TABLE_CELL_SELECT_CHECKBOX_CONTAINER_ALIGN_RIGHT);break}let c=document.createElement(re.elementName),m=document.createElement("input");m.type="checkbox";let d=o||"";i&&typeof o=="function"&&(d=o.call(null,l,i.data));let u=document.createElement("forge-tooltip");return u.position="left",e?u.textContent=a||"":u.textContent=d,m.setAttribute("aria-label","Select row"),c.appendChild(m),r.appendChild(u),r.appendChild(c),r}static _getCheckboxElement(e){let t=e.querySelector(`.${s.classes.TABLE_CELL_SELECT}`);return t?t.querySelector(s.selectors.CHECKBOX_INPUT):null}static _tryGetSelectAllCheckboxElement(e){let t=e.querySelector(`.${s.classes.TABLE_CELL_SELECT}`);return t?t.querySelector(s.selectors.CHECKBOX_INPUT)||t.querySelector(s.selectors.SELECT_ALL_TEMPLATE_CHECKBOX_INPUT):null}static _setSelectedCheckboxState(e,t){e&&(e.checked=t)}static _setIndeterminateCheckboxState(e,t){e&&(e.indeterminate=t)}static _setRowSelectedState(e,t){t?e.classList.contains(s.classes.TABLE_BODY_ROW_SELECTED)||e.classList.add(s.classes.TABLE_BODY_ROW_SELECTED):e.classList.remove(s.classes.TABLE_BODY_ROW_SELECTED)}static _updateExpandedRowColspan(e,t){n._getExpandedRows(e).forEach(i=>{let o=i.cells.item(0);o&&(o.colSpan=t)})}static updateSelectedState(e,t){n._setRowSelectedState(e,t);let l=n._getCheckboxElement(e);l&&n._setSelectedCheckboxState(l,t)}static getRowByIndex(e,t){return n._getNonExpandedRows(e.tBodies[0].rows)[t]}static updateSelectAllState(e,t,l){if(!e.tHead)return;let i=e.tHead.rows[e.tHead.rows.length-1],o=n._tryGetSelectAllCheckboxElement(i);o&&(n._setSelectedCheckboxState(o,t),n._setIndeterminateCheckboxState(o,!!l))}static setSelectedRows(e,t,l,i,o=!1){if(!e.tBodies.length)return;o||n.clearSelectedRows(e);let a=e.tBodies[0].rows,r=0;i.length&&Array.from(a).forEach((c,m)=>{let d=l[m];if(x(i,v(t,d))){n._setRowSelectedState(c,!0);let C=n._getCheckboxElement(c);C&&n._setSelectedCheckboxState(C,!0),r++}}),n.updateSelectAllState(e,r>0&&a.length===r)}static clearSelectedRows(e){if(!e.tBodies.length)return;n._getNonExpandedRows(e.tBodies[0].rows).forEach(l=>{n._setRowSelectedState(l,!1);let i=n._getCheckboxElement(l);i&&n._setSelectedCheckboxState(i,!1)})}static setSortedColumn(e,t,l){let i=n._getHeaderCellByIndex(e,t);n._getSortIconElementFromHeaderCell(i).classList.add(s.classes.TABLE_HEAD_CELL_SORT_ICON_ACTIVE),n._setColumnSortDirection(i,l)}static setMultiSortColumnSortNumber(e,t,l,i){let r=n._getHeaderCellByIndex(e,l).querySelector(`.${s.classes.TABLE_HEAD_CELL_CONTAINER}`).querySelector(`.${s.classes.TABLE_HEAD_CELL_SORT_ORDER}`);r&&(Z(r,typeof i!="number"||!t,s.classes.TABLE_HEAD_CELL_SORT_ORDER_HIDDEN),i&&(r.textContent=i.toString()))}static removeColumnSort(e,t){let l=n._getHeaderCellByIndex(e,t);l.classList.contains(s.classes.TABLE_HEAD_CELL_SORTED_ASCENDING)&&l.classList.remove(s.classes.TABLE_HEAD_CELL_SORTED_ASCENDING),l.classList.contains(s.classes.TABLE_HEAD_CELL_SORTED_DESCENDING)&&l.classList.remove(s.classes.TABLE_HEAD_CELL_SORTED_DESCENDING);let i=n._getSortIconElementFromHeaderCell(l);i&&i.classList.contains(s.classes.TABLE_HEAD_CELL_SORT_ICON_ACTIVE)&&i.classList.remove(s.classes.TABLE_HEAD_CELL_SORT_ICON_ACTIVE)}static _getHeaderCellByIndex(e,t){if(!e.tHead)throw new Error("Table head element cannot be null.");return e.tHead.rows.item(0).cells.item(t)}static _getSortIconElementFromHeaderCell(e){return e.querySelector(`.${s.classes.TABLE_HEAD_CELL_SORT_ICON}`)}static setSelectColumnVisibility(e,t,l,i,o,a,r,c,m){let d=e.tHead,u=e.tBodies[0];!d||!u||(t?n._addSelectColumn(d,u,l,i,o,a,r,c,m):n._hasSelectColumn(d,u)&&(l&&n._detachRowSelectListeners(u,l),i&&n._detachSelectAllListener(d,i),n._destroySelectColumn(d,u)))}static _addSelectColumn(e,t,l,i,o,a,r,c,m){n._createSelectColumn(e,t,!!i,o,()=>{i&&n._tryAttachSelectAllTemplateListener(e,i)},a,r,c,m),l&&n._attachRowSelectListeners(t,l),i&&!o&&n._tryAttachSelectAllTemplateListener(e,i)}static setDenseState(e,t){e.classList.contains(s.classes.TABLE_DENSE)&&e.classList.remove(s.classes.TABLE_DENSE),t&&e.classList.add(s.classes.TABLE_DENSE)}static setRoomyState(e,t){e.classList.contains(s.classes.TABLE_ROOMY)&&e.classList.remove(s.classes.TABLE_ROOMY),t&&e.classList.add(s.classes.TABLE_ROOMY)}static setResizable(e){let t=e.tableElement.tHead;e.resizable?(e.tableElement.classList.add(s.classes.TABLE_RESIZABLE),n._addResizeHandles(t,e)):(e.tableElement.classList.remove(s.classes.TABLE_RESIZABLE),n._removeResizeHandles(t,e))}static _addResizeHandles(e,t){if(!e)return;let l=e.rows.item(0);if(l){let i=Array.from(l.cells);t.selectListener&&(i=i.slice(1));for(let o of i){let a=i.indexOf(o);if(t.columnConfigurations[a].resizable!==!1){let c=document.createElement("div");c.classList.add(s.classes.TABLE_RESIZE_HANDLE),o.appendChild(c)}}}}static _removeResizeHandles(e,t){if(!e)return;let l=e.rows.item(0);if(l){let i=Array.from(l.cells);t.selectListener&&(i=i.slice(1));for(let o of i){let a=document.querySelector(`.${s.classes.TABLE_RESIZE_HANDLE}`);a&&o.removeChild(a)}}}static setWrapContentState(e,t){t?e.classList.remove(s.classes.TABLE_NO_WRAP_CONTENT):e.classList.add(s.classes.TABLE_NO_WRAP_CONTENT)}static setSelectAllVisibility(e,t,l,i,o,a){let r=e.tHead;if(!r)return;!t&&l&&n._detachSelectAllListener(r,l);let m=r.rows[r.rows.length-1].cells.item(0);t?m.childElementCount||(m.classList.add(s.classes.TABLE_CELL_SELECT),i?n._renderSelectAllTemplate(i,r).then(()=>{l&&n._tryAttachSelectAllTemplateListener(r,l)}):m.appendChild(n._createCheckboxElement(!0,o||null,null,null,null,a)),l&&!i&&n._attachSelectAllListener(r,l)):(l&&n._detachSelectAllListener(r,l),R(m))}static setFilterRow(e){if(!e.tableElement.tHead)return;let t=n._getFilterRowElement(e.tableElement.tHead),l;if(e.filter?e.tableElement.classList.add(s.classes.TABLE_FILTER_VISIBLE):e.tableElement.classList.remove(s.classes.TABLE_FILTER_VISIBLE),e.filter&&!t){if(e.columnConfigurations.every(o=>!o.filter))return;e.selectListener&&e.selectAllListener&&(l=e.tableElement.tHead.rows[e.tableElement.tHead.rows.length-1].cells.item(0));let i=n._createFilterRowElement(e);i&&l&&Array.from(l.children).forEach(o=>{var a;(a=i.cells.item(0))==null||a.appendChild(o)})}else if(!e.filter&&t){if(e.selectListener&&e.selectAllListener){l=t.cells.item(0);let i=Array.from(e.tableElement.tHead.rows).indexOf(t)-1,o=e.tableElement.tHead.rows.item(i);o&&Array.from(l.children).forEach(a=>{var r;(r=o.cells.item(0))==null||r.appendChild(a)})}W(t)}}static _createFilterRowElement(e){if(!e.tableElement.tHead)throw new Error("Table head element cannot be null.");let t=e.tableElement.tHead.insertRow();if(p([s.classes.TABLE_ROW,s.classes.TABLE_HEAD_ROW_FILTER],t),e.selectListener){let l=document.createElement("th");p([s.classes.TABLE_CELL,s.classes.TABLE_HEAD_CELL],l),t.insertBefore(l,t.cells[0]),l.classList.add(s.classes.TABLE_CELL_SELECT)}return e.columnConfigurations.forEach((l,i)=>{let o=document.createElement("th");if(p([s.classes.TABLE_CELL,s.classes.TABLE_HEAD_CELL],o),l.filter&&f(l.filterDelegate)){let a=document.createElement("div");a.classList.add(s.classes.TABLE_HEAD_CELL_CONTAINER),l.align&&n._setCellAlignmentClass(a,l.align);let r=n._createFilterElement(l,i,e.filterListener);a.appendChild(r),o.appendChild(a)}t.appendChild(o)}),t}static _createFilterElement(e,t,l){let i;if(y(e.filterDelegate))i=e.filterDelegate();else if(e.filterDelegate instanceof X||e.filterDelegate instanceof le)i=e.filterDelegate;else throw new Error("Invalid filter delegate.");if(l&&i instanceof X&&y(i.onChange))if(!f(e.filterDebounceTime)||I(e.filterDebounceTime)){let o=f(e.filterDebounceTime)?e.filterDebounceTime:s.numbers.DEFAULT_FILTER_DEBOUNCE_TIME;i.onChange(V(a=>l(a,t),o))}else i.onChange(o=>l(o,t));return i.element}static _getFilterRowElement(e){if(e)return Array.from(e.rows).find(t=>t.classList.contains(s.classes.TABLE_HEAD_ROW_FILTER))}static async expandRow(e,t,l){let i=e.tableElement.tBodies[0],a=n._getNonExpandedRows(i.rows)[t];a.classList.add(s.classes.TABLE_ROW_EXPANDED);let r=Array.from(i.rows).indexOf(a),c=i.insertRow(r+1);p([s.classes.TABLE_ROW,s.classes.TABLE_BODY_ROW,s.classes.TABLE_ROW_EXPANDABLE_CONTENT],c);let m=c.insertCell();m.setAttribute("colspan",a.cells.length.toString()),m.classList.add(s.classes.TABLE_ROW_EXPANDABLE_CONTENT_CELL);let d=document.createElement("div"),u=document.createElement(M.elementName);u.appendChild(d),m.appendChild(u);let C=l;if(y(l)){let ue=e.data[t]?e.data[t].data:void 0,be=l(t,d,ue);try{let A=await Promise.resolve(be);C=me(A)?A.content:A}catch(A){console.error("Failed to load row template "+A.message),C=""}}C&&n._setRowTemplate(d,C),window.requestAnimationFrame(()=>u.open=!0)}static _setRowTemplate(e,t){Y(t)?e.innerHTML=t:e.appendChild(t)}static collapseRow(e,t){if(!e.tableElement||!e.tableElement.tBodies.length||!e.tableElement.tBodies[0].rows.length)return Promise.resolve();let l=e.tableElement.tBodies[0],o=n._getNonExpandedRows(l.rows)[t],a=Array.from(l.rows).indexOf(o);if(o&&o.classList.contains(s.classes.TABLE_ROW_EXPANDED)){let r=l.rows[a+1],c=r.querySelector(M.elementName);if(c&&c.open)return c.open=!1,new Promise(m=>{setTimeout(()=>{o.classList.remove(s.classes.TABLE_ROW_EXPANDED),W(r),m()},M.numbers.COLLAPSE_ANIMATION_DURATION)})}return Promise.resolve()}static isRowExpanded(e,t){let l=e.tableElement.tBodies[0],o=n._getNonExpandedRows(l.rows)[t];return o&&o.classList.contains(s.classes.TABLE_ROW_EXPANDED)}static setFixedHeaders(e){e.fixedHeaders?e.tableElement.classList.add(s.classes.TABLE_FIXED):e.tableElement.classList.remove(s.classes.TABLE_FIXED)}static setLayoutType(e){e.layoutType==="fixed"?e.tableElement.classList.add(s.classes.TABLE_LAYOUT_FIXED):e.tableElement.classList.remove(s.classes.TABLE_LAYOUT_FIXED)}static normalizeColumnWidths(e){let t=e.tableElement;if(t.tHead&&t.tHead.rows.length){let l=Array.from(t.tHead.rows[0].cells);for(let i of l){let o=getComputedStyle(i).width;i.style.width&&i.style.width!==o&&(i.style.width=o)}}}static setColumnResizeIndicatorVisibility(e,t,l){let i=e.tableElement;if(i.tHead&&i.tHead.rows.length){let o=Array.from(i.tHead.rows);for(let a of o){let r=a.cells[t];r&&(l?r.classList.add(s.classes.TABLE_CELL_RESIZABLE):r.classList.remove(s.classes.TABLE_CELL_RESIZABLE))}}if(i.tBodies.length){let o=Array.from(i.tBodies[0].rows);for(let a of o){let r=a.cells[t];r&&(l?r.classList.add(s.classes.TABLE_CELL_RESIZABLE):r.classList.remove(s.classes.TABLE_CELL_RESIZABLE))}}}static setRowClickListeners(e,t,l,i){let o=e.tBodies[0];o&&(t?n._attachRowClickListeners(o,l,i):n._detachRowClickListeners(o,l,i))}static setRowClickAttributes(e,t){let l=e.tBodies[0];l&&(t?n._addRowClickAttributes(l):n._removeRowClickAttributes(l))}static getOwnerDocument(e){return e.ownerDocument||document}static _prepend(e,t){let l=t.childNodes.item(0);l?t.insertBefore(e,l):t.appendChild(e)}static _isMac(){return!!(navigator&&navigator.platform&&navigator.platform.substr(0,3)==="Mac")}static _renderSelectAllTemplate(e,t){return Promise.resolve(e()).then(l=>{let i=t.rows.item(t.rows.length-1);if(!i)return;let o=i.cells.item(0);l&&o&&(typeof l=="string"?o.innerHTML=l:l instanceof HTMLElement&&o.appendChild(l),o.setAttribute(s.attributes.CUSTOM_CELL_TEMPLATE,""))})}};var N=class extends Q{constructor(t){super(t)}initialize(){this._tableElement||(this._tableElement=document.createElement("table"),this._tableElement.classList.add(s.classes.TABLE),this._component.children.length&&R(this._component),this._component.appendChild(this._tableElement))}getTableElement(){return this._tableElement||this.initialize(),this._tableElement}createTable(t){return b.createTable(t)}recreateTableBody(t){b.recreateTableBody(t)}setSelectedRows(t,l,i,o,a=!1){b.setSelectedRows(t,l,i,o,a)}clearSelectedRows(t){b.clearSelectedRows(t)}updateSelectedState(t,l){b.updateSelectedState(t,l)}updateSelectAllState(t,l,i){b.updateSelectAllState(t,l,i)}setSortedColumn(t,l,i){b.setSortedColumn(t,l,i)}removeColumnSort(t,l){b.removeColumnSort(t,l)}setSortDirection(t,l,i){b.setSortDirection(t,l,i)}setSelectColumnVisibility(t,l,i,o,a,r,c,m,d){b.setSelectColumnVisibility(t,l,i,o||null,a||null,r||null,c||[],m||null,d||null)}setDense(t,l){b.setDenseState(t,l)}setRoomy(t,l){b.setRoomyState(t,l)}setResizable(t){b.setResizable(t)}setSelectAllVisibility(t,l,i,o,a,r=null){b.setSelectAllVisibility(t,l,i,o,a||null,r||null)}setFilterRow(t){b.setFilterRow(t)}expandRow(t,l,i){return b.expandRow(t,l,i)}collapseRow(t,l){return b.collapseRow(t,l)}isRowExpanded(t,l){return b.isRowExpanded(t,l)}setFixedHeaders(t){b.setFixedHeaders(t)}setTableLayoutType(t){b.setLayoutType(t)}setWrapContentState(t){b.setWrapContentState(t.tableElement,t.wrapContent)}addDocumentListener(t,l){b.getOwnerDocument(this._component).addEventListener(t,l)}removeDocumentListener(t,l){b.getOwnerDocument(this._component).removeEventListener(t,l)}normalizeColumnWidths(t){b.normalizeColumnWidths(t)}setResizeColumnVisibility(t,l,i){b.setColumnResizeIndicatorVisibility(t,l,i)}addTableClass(t){p(t,this._tableElement)}removeTableClass(t){D(t,this._tableElement)}setRowClickListeners(t,l,i,o){b.setRowClickListeners(t,l,i,o)}setRowClickAttributes(t,l){b.setRowClickAttributes(t,l)}};var k=class{constructor(){this._sortedColumns=[]}get sortedColumns(){return[...this._sortedColumns.map(e=>h({},e))]}addSortColumn(e){this._sortedColumns.push(h({},e)),this._updateSortNumbers()}updateSortColumn(e){let t=this._sortedColumns.find(l=>l.columnIndex===e.columnIndex);if(t)switch(t.direction){case"ASC":this.removeSortColumn(e);break;case"DESC":t.direction="ASC";break;case"UNSET":t.direction="DESC";break}}setSortColumns(e){this._sortedColumns=[...e.map(t=>h({},t))]}removeSortColumn(e){typeof e=="number"?this._sortedColumns.splice(e,1):this._sortedColumns.splice(this._sortedColumns.indexOf(e),1),this._updateSortNumbers()}isSortColumn(e){return typeof e=="number"?this._sortedColumns.some(t=>t.columnIndex===e):this._sortedColumns.includes(e)}clearMultiSort(){this._sortedColumns=[]}getSortColumn(e){return this._sortedColumns.find(t=>t.columnIndex===e)}_updateSortNumbers(){this._sortedColumns.every(e=>typeof e.sortOrder=="number")&&this._sortedColumns.sort((e,t)=>e.sortOrder-t.sortOrder),this._sortedColumns.forEach((e,t)=>e.sortOrder=t+1)}};var P=class{constructor(e,t=!1){this.data=e;this.selected=t}};var z=class{constructor(e){this._adapter=e;this._tableRows=[];this._data=[];this._columnConfigurations=[];this._select=!1;this._multiselect=!0;this._dense=!1;this._roomy=!1;this._filter=!1;this._fixedHeaders=!1;this._layoutType=s.strings.DEFAULT_LAYOUT_TYPE;this._wrapContent=!0;this._resizable=!1;this._minResizeWidth=s.numbers.MIN_RESIZE_WIDTH;this._multiColumnSort=!1;this._selectCheckboxAlignment="center";this._isAllSelected=!1;this._sortedColumnIndex=-1;this._rendered=!1;this._allowRowClick=!1;this._multiSortManager=new k;this._rowClickListener=t=>this._onRowClick(t),this._rowDoubleClickListener=t=>this._onRowDoubleClick(t),this._selectRowListener=t=>this._onRowSelected(t),this._selectAllListener=t=>this._onSelectAll(t),this._headRowMouseDownListener=t=>this._onHeadRowMouseDown(t),this._headRowContextMenuListener=t=>this._onHeadRowContextMenu(t),this._documentMouseMoveListener=t=>this._onMouseMove(t),this._documentMouseUpListener=t=>this._onMouseUp(t),this._filterListener=(t,l)=>this._onFilter(t,l),this._selectionManager=new w(this._selectKey),this._hiddenColumnManager=new w}initialize(){this.connect(),this._adapter.setHostAttribute(s.attributes.SELECT,this._select.toString()),this._adapter.setHostAttribute(s.attributes.MULTISELECT,this._multiselect.toString()),this._adapter.setHostAttribute(s.attributes.DENSE,this._dense.toString()),this._adapter.setHostAttribute(s.attributes.ROOMY,this._roomy.toString()),this._adapter.setHostAttribute(s.attributes.FILTER,this._filter.toString()),this._adapter.emitHostEvent(s.events.INITIALIZED,void 0,!1)}connect(){this._adapter.initialize()}disconnect(){this._resizeDescriptor=void 0,this._adapter.removeDocumentListener("mousemove",this._documentMouseMoveListener),this._adapter.removeDocumentListener("mouseup",this._documentMouseUpListener)}set data(e){Array.isArray(e)&&e.length>0?g(e[0])?this._data=e.map(t=>h({},t)):this._data=[...e]:this._data=[],this._tableRows=this._data.map(t=>new P(t,this._selectionManager.exists(t))),this._renderBody()}get data(){return JSON.parse(JSON.stringify(this._data))}set columnConfigurations(e){this._columnConfigurations=e.map(t=>h({},t)),this._hiddenColumnManager.clear(),this._columnConfigurations.forEach(t=>{t.hidden&&this._hiddenColumnManager.add(t)}),this._refreshTableSort(),this.render()}get columnConfigurations(){return this._columnConfigurations.map(e=>h({},e))}get _visibleColumnConfigurations(){return this._columnConfigurations.filter(e=>!this._hiddenColumnManager.exists(e))}get _tableConfiguration(){return{tableElement:this._adapter.getTableElement(),columnConfigurations:this._visibleColumnConfigurations,data:this._tableRows,clickListener:this._allowRowClick?this._rowClickListener:null,doubleClickListener:this._allowRowClick?this._rowDoubleClickListener:null,selectListener:this._select?this._selectRowListener:null,selectAllListener:this._multiselect?this._selectAllListener:null,headRowMouseDownListener:this._headRowMouseDownListener,headRowContextMenuListener:this._headRowContextMenuListener,filterListener:this._filter?this._filterListener:null,sortDirection:this._sortDirection,sortedColumn:this._sortedColumnIndex,multiColumnSort:this._multiColumnSort,filter:this._filter,wrapContent:this._wrapContent,fixedHeaders:this._fixedHeaders,layoutType:this._layoutType,dense:this._dense,resizable:this._resizable,rowCreatedCallback:this._rowCreatedCallback,cellCreatedCallback:this._cellCreatedCallback,selectAllTemplate:this._selectAllTemplate,selectCheckboxAlignment:this._selectCheckboxAlignment,tooltipSelect:this._tooltipSelect,tooltipSelectAll:this._tooltipSelectAll}}set select(e){this._select!==e&&(this._select=e,this._adapter.setSelectColumnVisibility(this._adapter.getTableElement(),this._select,this._selectRowListener,this._multiselect?this._selectAllListener:void 0,this._multiselect?this._selectAllTemplate:null,this._selectCheckboxAlignment,this._tableRows,this._tooltipSelect,this._tooltipSelectAll),this._updateSelections(!0),this._select?this._adapter.setHostAttribute(s.attributes.SELECT,this._select.toString()):this._adapter.removeHostAttribute(s.attributes.SELECT))}get select(){return this._select}set multiselect(e){this._multiselect!==e&&(this._multiselect=e,this._select&&(this._adapter.setSelectAllVisibility(this._adapter.getTableElement(),this._multiselect,this._multiselect?this._selectAllListener:null,this._multiselect?this.selectAllTemplate:null,this._selectCheckboxAlignment,this._tooltipSelectAll),this._updateSelections(!0)),this._adapter.setHostAttribute(s.attributes.MULTISELECT,this._multiselect.toString()))}get multiselect(){return this._multiselect}get selectKey(){return Array.isArray(this._selectKey)?[...this._selectKey]:this._selectKey}set selectKey(e){this._originalSelectKey!==e&&(Array.isArray(e)?(this._originalSelectKey=[...e],this._selectKey=[...e]):(this._originalSelectKey=e,this._selectKey=[e]),this._selectionManager.setKey(this._selectKey),this._updateSelections(!1))}get dense(){return this._dense}set dense(e){this._dense!==e&&(this._dense=e,this._adapter.setDense(this._adapter.getTableElement(),this._dense),this._adapter.setHostAttribute(s.attributes.DENSE,this._dense.toString()))}get roomy(){return this._roomy}set roomy(e){e!==this._roomy&&(this._roomy=e,this._applyRoomy())}set filter(e){this._filter!==e&&(this._filter=e,this._adapter.setFilterRow(this._tableConfiguration),this._adapter.setHostAttribute(s.attributes.FILTER,this._filter.toString()))}get filter(){return this._filter}set fixedHeaders(e){this._fixedHeaders!==e&&(this._fixedHeaders=e,this._adapter.setFixedHeaders(this._tableConfiguration))}get fixedHeaders(){return this._fixedHeaders}get layoutType(){return this._layoutType}set layoutType(e){this._layoutType!==e&&(this._layoutType=e,this._adapter.setTableLayoutType(this._tableConfiguration))}get wrapContent(){return this._wrapContent}set wrapContent(e){this._wrapContent!==e&&(this._wrapContent=e,this._adapter.setWrapContentState(this._tableConfiguration))}get resizable(){return this._resizable}set resizable(e){this._resizable!==e&&(this._resizable=e,this._adapter.setResizable(this._tableConfiguration))}get minResizeWidth(){return this._minResizeWidth}set minResizeWidth(e){this._minResizeWidth!==e&&(this._minResizeWidth=e,I(this._minResizeWidth)?this._minResizeWidth<0&&(this._minResizeWidth=0):this._minResizeWidth=s.numbers.MIN_RESIZE_WIDTH)}get allowRowClick(){return this._allowRowClick}set allowRowClick(e){this._allowRowClick!==e&&(this._allowRowClick=e,this._rendered&&(this._adapter.setRowClickListeners(this._adapter.getTableElement(),this._allowRowClick,this._rowClickListener,this._rowDoubleClickListener),this._adapter.setRowClickAttributes(this._adapter.getTableElement(),this._allowRowClick)))}get multiColumnSort(){return this._multiColumnSort}set multiColumnSort(e){e!==this._multiColumnSort&&(this._multiColumnSort=e,this._refreshTableSort(),this.render())}get selectCheckboxAlignment(){return this._selectCheckboxAlignment}set selectCheckboxAlignment(e){e!==this._selectCheckboxAlignment&&(this._selectCheckboxAlignment=e,this._adapter.setHostAttribute(s.attributes.SELECT_CHECKBOX_ALIGNMENT,e),this.render())}get tooltipSelect(){return this._tooltipSelect}set tooltipSelect(e){e!==this._tooltipSelect&&(this._tooltipSelect=e,typeof e=="string"&&this._adapter.setHostAttribute(s.attributes.TOOLTIP_SELECT,e),this.render())}get tooltipSelectAll(){return this._tooltipSelectAll}set tooltipSelectAll(e){e!==this._tooltipSelectAll&&(this._tooltipSelectAll=e,this._adapter.setHostAttribute(s.attributes.TOOLTIP_SELECT_ALL,e),this.render())}get selectAllTemplate(){return this._selectAllTemplate}set selectAllTemplate(e){e!==this._selectAllTemplate&&(this._selectAllTemplate=e,this.render())}get rowCreated(){return this._rowCreatedCallback}set rowCreated(e){this._rowCreatedCallback=e}get cellCreated(){return this._cellCreatedCallback}set cellCreated(e){this._cellCreatedCallback=e}isRowSelected(e){let t=v(Array.isArray(this._selectKey)?this._selectKey:[this._selectKey],e);return this.selectKey?!!this._selectionManager.getItems().find(l=>K(l,t)):this._selectionManager.exists(e)}getSelectedRows(){return this._selectionManager.getItems()}selectRows(e,t){if(!this._selectKey)throw new Error("You must set a selectKey to select rows.");(!this._multiselect||t)&&this.clearSelections(),e&&e.length&&(this._selectionManager.add(e),this._updateSelections(!t))}deselectRows(e){e&&e.length&&(this._selectionManager.remove(e),this._updateSelections(!1))}clearSelections(){let e=this._adapter.getTableElement();this._selectionManager.clear(),this._tableRows.forEach(t=>t.selected=!1),this._isAllSelected=!1,this._adapter.clearSelectedRows(e),this._select&&this._multiselect&&this._adapter.updateSelectAllState(e,!1)}hideColumn(e){let t=this._columnConfigurations[e];this._sortedColumnIndex===e&&(this._sortedColumnIndex=-1),this._hiddenColumnManager.exists(t)||(this._hiddenColumnManager.add(t),this.render())}showColumn(e){let t=this._columnConfigurations[e];this._hiddenColumnManager.exists(t)&&(this._hiddenColumnManager.remove(t),this.render())}isColumnHidden(e){let t=this._columnConfigurations[e];return!!t&&this._hiddenColumnManager.exists(t)}render(){this._adapter.createTable(this._tableConfiguration),this._renderSelections(),this._rendered=!0}_renderBody(){this._rendered&&(this._adapter.recreateTableBody(this._tableConfiguration),this._renderSelections())}_renderSelections(){this.select&&(this._isAllSelected=this._getSelectAllState(),this._multiselect&&this._adapter.updateSelectAllState(this._adapter.getTableElement(),this._isAllSelected,this._isIndeterminate(this._isAllSelected)));let e=this._selectionManager.getItems();e.length&&this._adapter.setSelectedRows(this._adapter.getTableElement(),this._selectKey,this._data,e,!1)}expandRow(e,t){if(!this._rendered)throw new Error("Cannot expand a row before the table has rendered.");if(e<0||e>this._tableRows.length)throw new Error(`Invalid row index: ${e}.`);return this._adapter.expandRow(this._tableConfiguration,e,t)}collapseRow(e){return!this._rendered||e<0||e>this._tableRows.length?Promise.resolve():this._adapter.collapseRow(this._tableConfiguration,e)}isRowExpanded(e){return this._adapter.isRowExpanded(this._tableConfiguration,e)}selectRowsByIndex(e,t){let l=e.map(i=>this._data[i]).filter(i=>!!i);this.selectRows(l,!t)}deselectRowsByIndex(e){let t=e.map(l=>this._data[l]).filter(l=>!!l);this.deselectRows(t)}_getSelectAllState(){return this._tableRows.length>0&&this._tableRows.every(e=>e.selected)}_updateSelections(e){this._tableRows.forEach(l=>l.selected=this._selectionManager.exists(l.data));let t=this._getSelectAllState();this._adapter.setSelectedRows(this._adapter.getTableElement(),this._selectKey,this._data,this._selectionManager.getItems(),e),(t!==this._isAllSelected||this._isIndeterminate(t))&&(this._isAllSelected=t,this._multiselect&&this._adapter.updateSelectAllState(this._adapter.getTableElement(),this._isAllSelected,this._isIndeterminate(this._isAllSelected)))}_onRowClick(e){if(e.stopImmediatePropagation(),e.target.tagName==="INPUT"&&e.target.type==="checkbox")return;let i=H(e).filter(m=>m.nodeType===1).find(m=>m.hasAttribute(s.attributes.CUSTOM_CELL_TEMPLATE));if(i&&i.hasAttribute(s.attributes.CUSTOM_CELL_TEMPLATE_STOP_PROPAGATION))return;let{index:a,data:r}=this._getSelectedRowFromEvent(e),c={index:a,data:r};this._adapter.emitHostEvent(s.events.ROW_CLICK,c,!0,!1)}_onRowDoubleClick(e){if(e.stopPropagation(),e.target.tagName==="INPUT"&&e.target.type==="checkbox")return;let t=this._getSelectedRowFromEvent(e),l={index:t.index,data:t.data};this._adapter.emitHostEvent(s.events.SELECT_DOUBLE,l,!0,!1)}_onRowSelected(e){let t=this._getSelectedRowFromEvent(e);this._multiselect||this._tableRows.filter(r=>r.selected).forEach(r=>{K(r.data,v(this._selectKey,t.data))||this.deselectRows([r.data])});let l=!this._selectionManager.exists(t.data);this._adapter.updateSelectedState(t.rowElement,l),l?this._selectionManager.add(t.data):this._selectionManager.remove(t.data),this._tableRows[t.index].selected=l;let i=[t.index],o=!1;if(this._multiselect){if(e.shiftKey&&this._previouslyClickedRow&&(i=this._shiftSelectRows(t),i.includes(this._previouslyClickedRow.index))){let r=i.indexOf(this._previouslyClickedRow.index);i.splice(r,1)}o=this._getSelectAllState(),this._adapter.updateSelectAllState(this._adapter.getTableElement(),o,this._isIndeterminate(o))}for(let a of i){let r=this._tableRows[a].data,m={selected:this._selectionManager.exists(r),index:a,data:r};this._adapter.emitHostEvent(s.events.SELECT,m,!0,!1)}if(this._isAllSelected!==o){this._isAllSelected=o;let a={status:this._isAllSelected,count:this._tableRows.filter(r=>r.selected).length,data:[...this._data],targetType:"row"};this._adapter.emitHostEvent(s.events.SELECT_ALL,a,!0,!1)}this._previouslyClickedRow=h({},t)}_getSelectedRowFromEvent(e){let l=H(e).find(r=>r.tagName==="TR"),i=l.parentElement,o=this._getNonExpandedRows(i).findIndex(r=>r===l),a=this._tableRows[o].data;return{rowElement:l,index:o,data:a}}_getNonExpandedRows(e){return Array.from(e.rows).filter(t=>!t.classList.contains(s.classes.TABLE_ROW_EXPANDABLE_CONTENT))}_onSelectAll(e){e.stopPropagation(),this._isAllSelected=!this._isAllSelected;let t=this._adapter.getTableElement();this._adapter.updateSelectAllState(t,this._isAllSelected),this._tableRows.forEach((i,o)=>{i.selected=this._isAllSelected,this._isAllSelected?this._selectionManager.add(i.data):this._selectionManager.remove(i.data);let a=b.getRowByIndex(t,o);a&&this._adapter.updateSelectedState(a,this._isAllSelected)});let l={status:this._isAllSelected,count:this._tableRows.filter(i=>i.selected).length,data:[...this._data],targetType:"select-all"};this._adapter.emitHostEvent(s.events.SELECT_ALL,l,!0,!1)}_onHeadRowContextMenu(e){e.preventDefault()}_onHeadRowMouseDown(e){if(e.button!==0)return;let t=H(e),l=e.target,i=t.find(r=>r.tagName==="TR"),o=t.find(r=>r.tagName==="TH"),a=Array.from(i.cells).findIndex(r=>r===o);this._headCellMouseDownIndex=a,l!==o&&l.classList.contains(s.classes.TABLE_RESIZE_HANDLE)&&(this._resizeDescriptor={element:o,startWidth:o.offsetWidth,startX:e.pageX,width:o.offsetWidth,index:this._select?a-1:a},this._adapter.addDocumentListener("mousemove",this._documentMouseMoveListener),this._adapter.setResizeColumnVisibility(this._tableConfiguration,a,!0)),this._adapter.addDocumentListener("mouseup",this._documentMouseUpListener)}_onMouseMove(e){if(this._resizeDescriptor){let t=this._resizeDescriptor.startWidth+(e.pageX-this._resizeDescriptor.startX);t<this._minResizeWidth&&(t=this._minResizeWidth),this._resizeDescriptor.width=t,this._resizeDescriptor.element.style.width=`${t}px`,this._adapter.addTableClass(s.classes.TABLE_RESIZING)}}_onMouseUp(e){if(this._adapter.removeDocumentListener("mousemove",this._documentMouseMoveListener),this._adapter.removeDocumentListener("mouseup",this._documentMouseUpListener),this._adapter.removeTableClass(s.classes.TABLE_RESIZING),this._headCellMouseDownIndex!==void 0){if(this._resizeDescriptor){this._adapter.normalizeColumnWidths(this._tableConfiguration),this._adapter.setResizeColumnVisibility(this._tableConfiguration,this._headCellMouseDownIndex,!1);let t={index:this._resizeDescriptor.index,width:this._resizeDescriptor.width};this._adapter.emitHostEvent(s.events.COLUMN_RESIZE,t),this._resizeDescriptor=void 0}else this._tableConfiguration.tableElement.tHead.contains(e.target)&&(this._multiColumnSort?this._onMultiSort(this._headCellMouseDownIndex,e.ctrlKey):this._onSort(this._headCellMouseDownIndex));this._headCellMouseDownIndex=void 0}}_onSort(e){let t=this._select?e-1:e,l=t>=0?this._visibleColumnConfigurations[t]:null;if(!l||!l.sortable)return;let i="ASC",o=t===this._sortedColumnIndex,a=this._sortDirection==="ASC"||this._sortDirection===void 0,r=o&&this._sortDirection==="DESC";o&&a&&(i="DESC"),r&&!l.preventUnsort&&(i="UNSET");let c={direction:i,columnIndex:t};if(this._adapter.emitHostEvent(s.events.SORT,c,!0,!0)){if(o&&this._sortDirection==="DESC"&&!l.preventUnsort){this._adapter.removeColumnSort(this._adapter.getTableElement(),this._select?this._sortedColumnIndex+1:this._sortedColumnIndex),this._sortedColumnIndex=-1;return}this._sortDirection=i,t===this._sortedColumnIndex?this._adapter.setSortDirection(this._adapter.getTableElement(),e,this._sortDirection):(this._sortedColumnIndex>=0&&this._adapter.removeColumnSort(this._adapter.getTableElement(),this._select?this._sortedColumnIndex+1:this._sortedColumnIndex),this._sortedColumnIndex=t,this._adapter.setSortedColumn(this._adapter.getTableElement(),e,this._sortDirection))}}_onMultiSort(e,t){let l=this._select?e-1:e,i=l>=0?this._visibleColumnConfigurations[l]:null;if(!i||!i.sortable)return;let o=this._multiSortManager.sortedColumns,a=this._multiSortManager.getSortColumn(l);a?this._multiSortManager.updateSortColumn(a):t?this._multiSortManager.addSortColumn({direction:"DESC",columnIndex:l,propertyName:i.property}):(this._multiSortManager.clearMultiSort(),this._multiSortManager.addSortColumn({direction:"DESC",columnIndex:l,propertyName:i.property}));let r=this._multiSortManager.sortedColumns.map(d=>h({},d));if(!this._adapter.emitHostEvent(s.events.SORT,r,!0,!0)){this._multiSortManager.setSortColumns(o);return}let m=this._multiSortManager.sortedColumns.length>1;for(let d=0;d<this._visibleColumnConfigurations.length;d++){let u=this._select?d+1:d;if(!this._multiSortManager.isSortColumn(d))this._adapter.removeColumnSort(this._adapter.getTableElement(),u),b.setMultiSortColumnSortNumber(this._adapter.getTableElement(),m,u,null);else{let C=this._multiSortManager.getSortColumn(d);C&&(this._adapter.setSortedColumn(this._adapter.getTableElement(),u,C.direction),b.setMultiSortColumnSortNumber(this._adapter.getTableElement(),m,u,C.sortOrder||null))}}}_onFilter(e,t){let l={value:e,columnIndex:t};this._adapter.emitHostEvent(s.events.FILTER,l,!0,!1)}_shiftSelectRows(e){let t=[];if(this._previouslyClickedRow){let l=this._previouslyClickedRow.index,i=e.index,o=i>=l?l:i,a=i>=l?i:l;a+=a>o?1:0,o+=o>a?1:0;let r=d=>this.selectRows(d,!1),c=this._tableRows.find(d=>d.selected&&d.data===e.data),m=this._tableRows.find(d=>{var u;return d.data===((u=this._previouslyClickedRow)==null?void 0:u.data)&&!d.selected});(!c||m)&&(r=d=>this.deselectRows(d));for(let d=o;d<a;d++)t.push(d);r(this.data.filter((d,u)=>t.includes(u)))}return t}_isIndeterminate(e){return!e&&this.getSelectedRows().length>0&&this._data.length!==this.getSelectedRows().length}_applyRoomy(){this._adapter.setRoomy(this._adapter.getTableElement(),this._roomy),this._adapter.setHostAttribute(s.attributes.ROOMY,this._roomy.toString())}_refreshTableSort(){if(this._sortedColumnIndex=this._visibleColumnConfigurations.findIndex(e=>e.initialSort),this._sortDirection=this._sortedColumnIndex>=0?this._visibleColumnConfigurations[this._sortedColumnIndex].sortDirection:void 0,this._multiColumnSort){let e=[];this._visibleColumnConfigurations.forEach((t,l)=>{typeof t.initialSort=="object"&&e.push({columnIndex:l,direction:t.initialSort.direction,sortOrder:t.initialSort.sortOrder,propertyName:t.property})}),this._multiSortManager.setSortColumns(e)}}};var E=class extends J{constructor(){super();se.define(te),this._foundation=new z(new N(this))}static get observedAttributes(){return[s.attributes.SELECT,s.attributes.MULTISELECT,s.attributes.SELECT_KEY,s.attributes.DENSE,s.attributes.ROOMY,s.attributes.FILTER,s.attributes.FIXED_HEADERS,s.attributes.LAYOUT_TYPE,s.attributes.WRAP_CONTENT,s.attributes.RESIZABLE,s.attributes.MIN_RESIZE_WIDTH,s.attributes.ALLOW_ROW_CLICK,s.attributes.MULTI_COLUMN_SORT,s.attributes.SELECT_CHECKBOX_ALIGNMENT,s.attributes.TOOLTIP_SELECT,s.attributes.TOOLTIP_SELECT_ALL]}initializedCallback(){this._foundation.initialize()}connectedCallback(){this._foundation.connect()}disconnectedCallback(){this._foundation.disconnect()}attributeChangedCallback(t,l,i){switch(t){case s.attributes.SELECT:this.select=L(i);break;case s.attributes.MULTISELECT:this.multiselect=L(i);break;case s.attributes.SELECT_KEY:this.selectKey=i;break;case s.attributes.DENSE:this.dense=L(i);break;case s.attributes.ROOMY:this.roomy=L(i);break;case s.attributes.FILTER:this.filter=L(i);break;case s.attributes.FIXED_HEADERS:this.fixedHeaders=L(i);break;case s.attributes.LAYOUT_TYPE:this.layoutType=i;break;case s.attributes.WRAP_CONTENT:this.wrapContent=L(i);break;case s.attributes.RESIZABLE:this.resizable=L(i);break;case s.attributes.MIN_RESIZE_WIDTH:this.minResizeWidth=G(i);break;case s.attributes.ALLOW_ROW_CLICK:this.allowRowClick=L(i);break;case s.attributes.MULTI_COLUMN_SORT:this.multiColumnSort=L(i);break;case s.attributes.SELECT_CHECKBOX_ALIGNMENT:this.selectCheckboxAlignment=this.getAttribute(s.attributes.SELECT_CHECKBOX_ALIGNMENT)||"center";break;case s.attributes.TOOLTIP_SELECT:this.tooltipSelect=i;break;case s.attributes.TOOLTIP_SELECT_ALL:this.tooltipSelectAll=i;break}}hideColumn(t){this._foundation.hideColumn(t)}showColumn(t){this._foundation.showColumn(t)}isColumnHidden(t){return this._foundation.isColumnHidden(t)}getSelectedRows(){return this._foundation.getSelectedRows()}selectRow(t){this._foundation.selectRows([t],!1)}selectRows(t,l=!1){this._foundation.selectRows(t,!l)}deselectRow(t){this._foundation.deselectRows([t])}deselectRows(t){this._foundation.deselectRows(t)}clearSelections(){this._foundation.clearSelections()}render(){this._foundation.render()}expandRow(t,l){return this._foundation.expandRow(t,l)}collapseRow(t){return this._foundation.collapseRow(t)}isRowExpanded(t){return this._foundation.isRowExpanded(t)}selectRowsByIndex(t,l){typeof t=="number"?this._foundation.selectRowsByIndex([t],l):Array.isArray(t)&&this._foundation.selectRowsByIndex(t,l)}deselectRowsByIndex(t){typeof t=="number"?this._foundation.deselectRowsByIndex([t]):Array.isArray(t)&&this._foundation.deselectRowsByIndex(t)}isRowSelected(t){return this._foundation.isRowSelected(t)}};_([T()],E.prototype,"data",2),_([T()],E.prototype,"columnConfigurations",2),_([T()],E.prototype,"select",2),_([T()],E.prototype,"multiselect",2),_([T()],E.prototype,"selectKey",2),_([T()],E.prototype,"tooltipSelect",2),_([T()],E.prototype,"tooltipSelectAll",2),_([T()],E.prototype,"dense",2),_([T()],E.prototype,"roomy",2),_([T()],E.prototype,"filter",2),_([T()],E.prototype,"fixedHeaders",2),_([T()],E.prototype,"layoutType",2),_([T()],E.prototype,"wrapContent",2),_([T()],E.prototype,"resizable",2),_([T()],E.prototype,"minResizeWidth",2),_([T()],E.prototype,"allowRowClick",2),_([T()],E.prototype,"multiColumnSort",2),_([T()],E.prototype,"rowCreated",2),_([T()],E.prototype,"cellCreated",2),_([T()],E.prototype,"selectAllTemplate",2),_([T()],E.prototype,"selectCheckboxAlignment",2),E=_([j({name:s.elementName,dependencies:[ae,oe,ce]})],E);function pl(){q(E)}export{s as a,B as b,O as c,Le as d,N as e,P as f,z as g,E as h,pl as i};
|
|
7
|
-
//# sourceMappingURL=chunk.
|
|
6
|
+
import{c as re,f as ce}from"./chunk.NF4J3Q5X.js";import{a as M,d as ae}from"./chunk.ECRL6O3V.js";import{a as ne}from"./chunk.WO7KEM5K.js";import{a as $,b as x,c as v,d as K}from"./chunk.UV3WIHCM.js";import{a as H}from"./chunk.LEVFMI2Q.js";import{b as te}from"./chunk.FYWPZFLJ.js";import{a as ie,d as se,l as oe}from"./chunk.H5D54EHO.js";import{a as X}from"./chunk.G4IN6Y46.js";import{a as le}from"./chunk.RFLASSCI.js";import{a as T}from"./chunk.NVUMRW44.js";import{a as Q}from"./chunk.5V5ABSHI.js";import{a as j,b as ee}from"./chunk.DTZFWZPB.js";import{a as q,k as J}from"./chunk.NK7H3MMM.js";import{d as R,e as F,f as p,g as D,i as W,j as U,t as Z}from"./chunk.CFDK4RCW.js";import{b as f,c as Y,d as I,h as y,j as g,k as L,l as G,o as V}from"./chunk.J2M2MXP2.js";import{a as h,d as _}from"./chunk.M3QDAYD2.js";var w=class{constructor(e){this._key=e,this._items=[]}getItems(){return[...this._items]}count(){return this._items.length}setKey(e){this._key=e}add(e){return e instanceof Array||(e=[e]),e.forEach(t=>{this.exists(t)||this._items.push(t)}),this}remove(e){e instanceof Array||(e=[e]);for(let t=e.length-1;t>=0;t--)this.exists(e[t])&&this._items.splice(this._items.indexOf(this._getItem(e[t])),1);return this}clear(){return this._items=[],this}exists(e){return this._getItem(e)!==null}_getItem(e){return this._key?x(this._items,v(this._key,e))||null:this._items.find(t=>t===e)||null}};var S=`${ee}table`,de={TABLE:"forge-table",TABLE_DENSE:"forge-table--dense",TABLE_ROOMY:"forge-table--roomy",TABLE_RESIZABLE:"forge-table--resizable",TABLE_RESIZING:"forge-table--resizing",TABLE_RESIZE_HANDLE:"forge-table__resize-handle",TABLE_NO_WRAP_CONTENT:"forge-table--no-wrap-content",TABLE_LAYOUT_FIXED:"forge-table--layout-fixed",TABLE_FILTER_VISIBLE:"forge-table--filter-visible",TABLE_FIXED:"forge-table--fixed",TABLE_HEAD:"forge-table-head",TABLE_HEAD_ROW:"forge-table-head__row",TABLE_HEAD_ROW_FILTER:"forge-table-head__row__filter",TABLE_HEAD_CELL:"forge-table-head__cell",TABLE_HEAD_CELL_CONTAINER:"forge-table-head__cell-container",TABLE_HEAD_CELL_SORTABLE:"forge-table-head__cell--sortable",TABLE_HEAD_CELL_SORT_ICON:"forge-table-head__cell-sort-icon",TABLE_HEAD_CELL_TEXT:"forge-table-head__cell-text",TABLE_HEAD_CELL_SORT_ICON_ACTIVE:"forge-table-head__cell-sort-icon--active",TABLE_HEAD_CELL_SORTED_ASCENDING:"forge-table-head__cell--sorted-ascending",TABLE_HEAD_CELL_SORTED_DESCENDING:"forge-table-head__cell--sorted-descending",TABLE_HEAD_CELL_SORT_ORDER:"forge-table-head__cell__sort-order",TABLE_HEAD_CELL_SORT_ORDER_HIDDEN:"forge-table-head__cell__sort-order--hidden",TABLE_BODY:"forge-table-body",TABLE_BODY_ROW:"forge-table-body__row",TABLE_BODY_ROW_SELECTED:"forge-table-body__row--selected",TABLE_BODY_ROW_CLICKABLE:"forge-table-body__row--clickable",TABLE_BODY_CELL:"forge-table-body__cell",TABLE_ROW:"forge-table-row",TABLE_ROW_EXPANDED:"forge-table-row--expanded",TABLE_ROW_EXPANDABLE_CONTENT:"forge-table-row__expandable-content",TABLE_ROW_EXPANDABLE_CONTENT_CELL:"forge-table-row__expandable-content-cell",TABLE_CELL:"forge-table-cell",TABLE_CELL_SELECT:"forge-table-cell__select",TABLE_CELL_SELECT_CHECKBOX:"forge-table-cell__select-checkbox",TABLE_CELL_SELECT_CHECKBOX_CONTAINER:"forge-table-cell__select-checkbox-container",TABLE_CELL_SELECT_CHECKBOX_CONTAINER_ALIGN_RIGHT:"forge-table-cell__select-checkbox-container--align-right",TABLE_CELL_SELECT_CHECKBOX_CONTAINER_ALIGN_LEFT:"forge-table-cell__select-checkbox-container--align-left",TABLE_CELL_SELECT_CHECKBOX_CONTAINER_ALIGN_CENTER:"forge-table-cell__select-checkbox-container--align-center",TABLE_CELL_CONTAINER:"forge-table-cell__container",TABLE_CELL_CONTAINER_TEXT:"forge-table-cell__container-text",TABLE_CELL_CENTER:"forge-table-cell--center",TABLE_CELL_RIGHT:"forge-table-cell--right",TABLE_CELL_RESIZABLE:"forge-table-cell--resizing"},Ee={TABLE:".forge-table",CHECKBOX_INPUT:"forge-checkbox > input[type=checkbox]:not([forge-ignore])",SELECT_ALL_TEMPLATE_CHECKBOX_INPUT:"input[type=checkbox]:not([forge-ignore])",ROW_SELECTED:`.${de.TABLE_BODY_ROW_SELECTED}`},_e={SELECT:"select",MULTISELECT:"multiselect",SELECT_KEY:"select-key",DENSE:"dense",ROOMY:"roomy",FILTER:"filter",FIXED_HEADERS:"fixed-headers",LAYOUT_TYPE:"layout-type",WRAP_CONTENT:"wrap-content",RESIZABLE:"resizable",MIN_RESIZE_WIDTH:"min-resize-width",ALLOW_ROW_CLICK:"allow-row-click",MULTI_COLUMN_SORT:"multi-column-sort",SELECT_CHECKBOX_ALIGNMENT:"select-checkbox-alignment",TOOLTIP_SELECT:"tooltip-select",TOOLTIP_SELECT_ALL:"tooltip-select-all",CHECKBOX_TYPE:"forge-checkbox-type",CUSTOM_CELL_TEMPLATE:"data-cell-template",CUSTOM_CELL_TEMPLATE_STOP_PROPAGATION:"data-cell-template-stop-propagation"},Te={ROW_CLICK:`${S}-row-click`,SELECT:`${S}-select`,SELECT_DOUBLE:`${S}-select-double`,SELECT_ALL:`${S}-select-all`,SORT:`${S}-sort`,FILTER:`${S}-filter`,INITIALIZED:`${S}-initialized`,COLUMN_RESIZE:`${S}-column-resize`},pe={SELECT_ALL:"select-all",SELECT_ROW:"select-row",DEFAULT_LAYOUT_TYPE:"auto"},Ce={SORT_DOWN:"arrow_downward"},he={DEFAULT_FILTER_DEBOUNCE_TIME:750,MIN_RESIZE_WIDTH:100,RESIZE_HOVER_DURATION:150},s={elementName:S,classes:de,selectors:Ee,attributes:_e,events:Te,strings:pe,icons:Ce,numbers:he};var B=(l=>(l.Left="left",l.Right="right",l.Center="center",l))(B||{}),O=(l=>(l.Ascending="ASC",l.Descending="DESC",l.Unset="UNSET",l))(O||{}),Le=(a=>(a.InputText="text",a.InputNumber="number",a.Select="select",a.SelectMultiple="select-multiple",a.Date="date",a.DateRange="date-range",a))(Le||{});function me(n){return n&&typeof n=="object"&&"content"in n}var b=class n{static createTable(e){n._resetTable(e.tableElement);let t=n._createTableHead(e),l=n._createTableBody(e);e.clickListener&&(n._attachRowClickListeners(l,e.clickListener,e.doubleClickListener),n._addRowClickAttributes(l)),e.fixedHeaders&&n.setFixedHeaders(e),e.resizable&&n.setResizable(e),e.dense&&n.setDenseState(e.tableElement,e.dense),e.wrapContent&&n.setWrapContentState(e.tableElement,e.wrapContent),e.selectListener&&n._addSelectColumn(t,l,e.selectListener,e.selectAllListener,e.selectAllTemplate,e.selectCheckboxAlignment,e.data,e.tooltipSelect,e.tooltipSelectAll),(e.resizable||e.columnConfigurations.some(i=>!!i.sortable))&&(n._attachHeadRowMouseDownListener(t,e.headRowMouseDownListener),n._isMac()&&n._attachHeadRowContextMenuListener(t,e.headRowContextMenuListener)),n.setLayoutType(e),n._setTableHead(e.tableElement,t),e.filter&&n.setFilterRow(e),n._setTableBody(e.tableElement,l)}static _setTableHead(e,t){e.tHead?F(t,e.tHead):e.appendChild(t)}static _setTableBody(e,t){e.tBodies.length?F(t,e.tBodies[0]):e.appendChild(t)}static recreateTableBody(e){let t=n._createTableBody(e);e.clickListener&&(n._attachRowClickListeners(t,e.clickListener,e.doubleClickListener),n._addRowClickAttributes(t)),e.selectListener&&(n._createBodySelectColumn(t,e.selectCheckboxAlignment,e.data,e.tooltipSelect,e.tooltipSelectAll),n._attachRowSelectListeners(t,e.selectListener)),n._setTableBody(e.tableElement,t)}static _resetTable(e){R(e)}static _createMultisortTooltip(){let e=document.createElement(ne.elementName);return e.textContent="Ctrl + click to sort multiple columns",e.position="bottom",e.delay=0,e}static _createTableHead(e){let t=document.createElement("thead"),l=t.insertRow();p([s.classes.TABLE_ROW,s.classes.TABLE_HEAD_ROW],l);let i=!1;for(let o=0;o<e.columnConfigurations.length;o++){let a=e.columnConfigurations[o],r=document.createElement("th");r.scope="col",p([s.classes.TABLE_CELL,s.classes.TABLE_HEAD_CELL],r);let c=document.createElement("div");if(c.classList.add(s.classes.TABLE_HEAD_CELL_CONTAINER),e.multiColumnSort){let d=n._createMultisortTooltip();c.appendChild(d)}if(a.align&&n._setCellAlignmentClass(c,a.align),f(a.width)){let d=U(a.width);d&&(r.style.width=d)}if(e.resizable&&a.resizable!==!1){let d=document.createElement("div");d.classList.add(s.classes.TABLE_RESIZE_HANDLE),r.appendChild(d)}f(a.headerCellStyle)&&g(a.headerCellStyle)&&(Object.assign(r.style,a.headerCellStyle),Object.assign(c.style,a.headerCellStyle));let m=document.createElement("span");if(m.classList.add(s.classes.TABLE_HEAD_CELL_TEXT),m.textContent=a.header&&typeof a.header=="string"?a.header.trim():"",a.sortable){r.classList.add(s.classes.TABLE_HEAD_CELL_SORTABLE);let d=document.createElement("span");p([s.classes.TABLE_HEAD_CELL_SORT_ORDER_HIDDEN,s.classes.TABLE_HEAD_CELL_SORT_ORDER],d);let u=document.createElement(ie.elementName);u.name=s.icons.SORT_DOWN,p([s.classes.TABLE_HEAD_CELL_SORT_ICON],u),e.multiColumnSort?typeof a.initialSort=="object"&&a.initialSort.sortOrder&&(d.textContent=a.initialSort.sortOrder.toString(),e.columnConfigurations.filter(C=>typeof C.initialSort=="object").length>1&&D(s.classes.TABLE_HEAD_CELL_SORT_ORDER_HIDDEN,d),r.classList.add(s.classes.TABLE_HEAD_CELL_SORTED_DESCENDING),u.classList.add(s.classes.TABLE_HEAD_CELL_SORT_ICON_ACTIVE),n._setColumnSortDirection(r,a.initialSort.direction)):e.sortedColumn===o&&!i&&!e.multiColumnSort&&(r.classList.add(s.classes.TABLE_HEAD_CELL_SORTED_DESCENDING),u.classList.add(s.classes.TABLE_HEAD_CELL_SORT_ICON_ACTIVE),n._setColumnSortDirection(r,e.sortDirection),i=!0),c.appendChild(u),c.appendChild(d)}typeof a.headerTemplate=="function"?Promise.resolve(a.headerTemplate(o,c,a)).then(d=>{if(d){let u=document.createElement("div");p(s.classes.TABLE_CELL_CONTAINER,u),typeof d=="string"?u.innerHTML=d:n._prepend(d,u),u.setAttribute(s.attributes.CUSTOM_CELL_TEMPLATE,""),n._prepend(u,c)}}):n._prepend(m,c),r.appendChild(c),l.appendChild(r)}return t}static setSortDirection(e,t,l){let i=n._getHeaderCellByIndex(e,t);n._setColumnSortDirection(i,l)}static _setColumnSortDirection(e,t){e.classList.contains(s.classes.TABLE_HEAD_CELL_SORTED_ASCENDING)&&e.classList.remove(s.classes.TABLE_HEAD_CELL_SORTED_ASCENDING),e.classList.contains(s.classes.TABLE_HEAD_CELL_SORTED_DESCENDING)&&e.classList.remove(s.classes.TABLE_HEAD_CELL_SORTED_DESCENDING),!t||t==="DESC"?e.classList.add(s.classes.TABLE_HEAD_CELL_SORTED_DESCENDING):e.classList.add(s.classes.TABLE_HEAD_CELL_SORTED_ASCENDING)}static _createTableBody(e){let t=document.createElement("tbody");return n._getOrderedRowData(e.columnConfigurations,e.data).forEach((i,o)=>{let a=t.insertRow();p([s.classes.TABLE_ROW,s.classes.TABLE_BODY_ROW],a),n._populateRowCells(e,a,i,o),typeof e.rowCreatedCallback=="function"&&e.rowCreatedCallback(a,o,h({},e.data[o].data))}),t}static _populateRowCells(e,t,l,i){for(let o=0;o<l.length;o++){let a=e.columnConfigurations[o],r=t.insertCell();if(p([s.classes.TABLE_CELL,s.classes.TABLE_BODY_CELL],r),f(a.width)){let m=U(a.width);m&&(r.style.width=m)}let c=document.createElement("div");if(c.classList.add(s.classes.TABLE_CELL_CONTAINER),f(a.cellStyle)&&g(a.cellStyle)&&(Object.assign(r.style,a.cellStyle),Object.assign(c.style,a.cellStyle)),a.template&&typeof a.template=="function"){let m=e.data[i]?e.data[i].data:void 0;Promise.resolve(a.template(i,c,m,o)).then(d=>{let u=me(d)?d:{content:d,stopClickPropagation:a.stopCellTemplateClickPropagation};u.content&&(typeof u.content=="string"?c.innerHTML=u.content:c.appendChild(u.content),c.setAttribute(s.attributes.CUSTOM_CELL_TEMPLATE,""),u.stopClickPropagation&&c.setAttribute(s.attributes.CUSTOM_CELL_TEMPLATE_STOP_PROPAGATION,""))})}else if(a.property){let m=document.createElement("span");m.classList.add(s.classes.TABLE_CELL_CONTAINER_TEXT),c.appendChild(m),a.transform&&typeof a.transform=="function"?Promise.resolve(a.transform(l[o])).then(d=>m.textContent=d):l[o]==null?m.textContent="":m.textContent=l[o].toString()}if(a.align&&n._setCellAlignmentClass(c,a.align),r.appendChild(c),f(a.columnSpan)){if(a.columnSpan==="all"){r.colSpan=l.length-o;break}else if(typeof a.columnSpan=="number"&&a.columnSpan>0){let m=a.columnSpan;a.columnSpan>l.length-o&&(m=l.length),r.colSpan=m,o=o+(m-1)}}typeof e.cellCreatedCallback=="function"&&e.cellCreatedCallback(r,i,o)}}static _setCellAlignmentClass(e,t){switch(t){case"center":e.classList.add(s.classes.TABLE_CELL_CENTER);break;case"right":e.classList.add(s.classes.TABLE_CELL_RIGHT);break}}static _getNonExpandedRows(e){return Array.from(e).filter(t=>!t.classList.contains(s.classes.TABLE_ROW_EXPANDABLE_CONTENT))}static _getExpandedRows(e){return Array.from(e).filter(t=>t.classList.contains(s.classes.TABLE_ROW_EXPANDABLE_CONTENT))}static _createColumnDataMap(e,t){return e.map(l=>({config:l,data:t.map(i=>{if(l.property){let o=$(i.data,l.property);return f(o)?o:null}return null})}))}static _getOrderedRowData(e,t){let l=n._createColumnDataMap(e,t),i=[];for(let o of l)for(let a=0;a<o.data.length;a++)i[a]||(i[a]=[]),i[a].push(o.data[a]);return i}static _attachRowClickListeners(e,t,l){n._getNonExpandedRows(e.rows).forEach(o=>{o.addEventListener("click",t),l&&o.addEventListener("dblclick",l)})}static _addRowClickAttributes(e){n._getNonExpandedRows(e.rows).forEach(l=>{l.classList.add(s.classes.TABLE_BODY_ROW_CLICKABLE)})}static _removeRowClickAttributes(e){n._getNonExpandedRows(e.rows).forEach(l=>{l.classList.remove(s.classes.TABLE_BODY_ROW_CLICKABLE)})}static _attachRowSelectListeners(e,t){n._getNonExpandedRows(e.rows).forEach(i=>n._attachRowSelectListener(i,t))}static _attachRowSelectListener(e,t){let l=n._getCheckboxElement(e);l==null||l.addEventListener("click",t)}static _detachRowSelectListeners(e,t){Array.from(e.rows).forEach(l=>{let i=n._getCheckboxElement(l);i==null||i.removeEventListener("click",t)})}static _detachRowClickListeners(e,t,l){Array.from(e.rows).forEach(i=>{i.removeEventListener("click",t),i.removeEventListener("dblclick",l)})}static _attachSelectAllListener(e,t){let l=e.rows[e.rows.length-1],i=n._getCheckboxElement(l);if(!i)throw new Error("Checkbox element not found.");i.addEventListener("change",t)}static _tryAttachSelectAllTemplateListener(e,t){let l=e.rows[e.rows.length-1],i=n._tryGetSelectAllCheckboxElement(l);i&&i.addEventListener("change",t)}static _detachSelectAllListener(e,t){let l=e.rows[e.rows.length-1],i=n._tryGetSelectAllCheckboxElement(l);i&&i.removeEventListener("change",t)}static _attachHeadRowMouseDownListener(e,t){let l=e.rows[0];if(!l)throw new Error("Missing table header row. Unable to attach sort listener.");l.addEventListener("mousedown",t)}static _attachHeadRowContextMenuListener(e,t){let l=e.rows[0];if(!l)throw new Error("Missing table header row. Unable to attach sort listener.");l.addEventListener("contextmenu",t)}static _createSelectColumn(e,t,l,i,o,a,r,c,m){e&&n._createHeadSelectColumn(e,l,i,o,a,m),t&&n._createBodySelectColumn(t,a,r,c,m)}static _createHeadSelectColumn(e,t,l,i,o,a){var r;if(Array.from(e.rows).forEach(c=>{let m=document.createElement("th");p([s.classes.TABLE_CELL,s.classes.TABLE_HEAD_CELL],m),c.insertBefore(m,c.cells.item(0))}),t){let c=(r=e.rows.item(e.rows.length-1))==null?void 0:r.cells.item(0);c.classList.add(s.classes.TABLE_CELL_SELECT),typeof l=="function"?n._renderSelectAllTemplate(l,e).then(()=>{typeof i=="function"&&i()}):c==null||c.appendChild(n._createCheckboxElement(!0,o,null,null,null,a))}}static _createBodySelectColumn(e,t,l,i,o){if(n._getNonExpandedRows(e.rows).forEach((r,c)=>n._addRowSelectColumn(r,t,c,l[c],i,o)),e.rows.length){let r=e.rows.item(0);r&&n._updateExpandedRowColspan(e.rows,r.cells.length)}}static _addRowSelectColumn(e,t,l,i,o,a){let r=e.insertCell(0);p([s.classes.TABLE_CELL,s.classes.TABLE_BODY_CELL,s.classes.TABLE_CELL_SELECT],r),r.appendChild(n._createCheckboxElement(!1,t,l,i,o,a))}static _destroySelectColumn(e,t){let l=n._getNonExpandedRows(t.rows);if(Array.from(e.rows).forEach(i=>i.removeChild(i.cells.item(0))),Array.from(l).forEach(i=>i.removeChild(i.cells.item(0))),t.rows.length){let i=t.rows.item(0);i&&n._updateExpandedRowColspan(t.rows,i.cells.length)}}static _hasSelectColumn(e,t){return[...Array.from(e.rows),...Array.from(t.rows)].some(i=>i.cells.item(0).classList.contains(s.classes.TABLE_CELL_SELECT))}static _createCheckboxElement(e,t,l,i,o,a){let r=document.createElement("div");if(r.classList.add(s.classes.TABLE_CELL_SELECT_CHECKBOX_CONTAINER),t)switch(t){case"center":r.classList.add(s.classes.TABLE_CELL_SELECT_CHECKBOX_CONTAINER_ALIGN_CENTER);break;case"left":r.classList.add(s.classes.TABLE_CELL_SELECT_CHECKBOX_CONTAINER_ALIGN_LEFT);break;case"right":r.classList.add(s.classes.TABLE_CELL_SELECT_CHECKBOX_CONTAINER_ALIGN_RIGHT);break}let c=document.createElement(re.elementName),m=document.createElement("input");m.type="checkbox";let d=o||"";i&&typeof o=="function"&&(d=o.call(null,l,i.data));let u=document.createElement("forge-tooltip");return u.position="left",e?u.textContent=a||"":u.textContent=d,m.setAttribute("aria-label","Select row"),c.appendChild(m),r.appendChild(u),r.appendChild(c),r}static _getCheckboxElement(e){let t=e.querySelector(`.${s.classes.TABLE_CELL_SELECT}`);return t?t.querySelector(s.selectors.CHECKBOX_INPUT):null}static _tryGetSelectAllCheckboxElement(e){let t=e.querySelector(`.${s.classes.TABLE_CELL_SELECT}`);return t?t.querySelector(s.selectors.CHECKBOX_INPUT)||t.querySelector(s.selectors.SELECT_ALL_TEMPLATE_CHECKBOX_INPUT):null}static _setSelectedCheckboxState(e,t){e&&(e.checked=t)}static _setIndeterminateCheckboxState(e,t){e&&(e.indeterminate=t)}static _setRowSelectedState(e,t){t?e.classList.contains(s.classes.TABLE_BODY_ROW_SELECTED)||e.classList.add(s.classes.TABLE_BODY_ROW_SELECTED):e.classList.remove(s.classes.TABLE_BODY_ROW_SELECTED)}static _updateExpandedRowColspan(e,t){n._getExpandedRows(e).forEach(i=>{let o=i.cells.item(0);o&&(o.colSpan=t)})}static updateSelectedState(e,t){n._setRowSelectedState(e,t);let l=n._getCheckboxElement(e);l&&n._setSelectedCheckboxState(l,t)}static getRowByIndex(e,t){return n._getNonExpandedRows(e.tBodies[0].rows)[t]}static updateSelectAllState(e,t,l){if(!e.tHead)return;let i=e.tHead.rows[e.tHead.rows.length-1],o=n._tryGetSelectAllCheckboxElement(i);o&&(n._setSelectedCheckboxState(o,t),n._setIndeterminateCheckboxState(o,!!l))}static setSelectedRows(e,t,l,i,o=!1){if(!e.tBodies.length)return;o||n.clearSelectedRows(e);let a=e.tBodies[0].rows,r=0;i.length&&Array.from(a).forEach((c,m)=>{let d=l[m];if(x(i,v(t,d))){n._setRowSelectedState(c,!0);let C=n._getCheckboxElement(c);C&&n._setSelectedCheckboxState(C,!0),r++}}),n.updateSelectAllState(e,r>0&&a.length===r)}static clearSelectedRows(e){if(!e.tBodies.length)return;n._getNonExpandedRows(e.tBodies[0].rows).forEach(l=>{n._setRowSelectedState(l,!1);let i=n._getCheckboxElement(l);i&&n._setSelectedCheckboxState(i,!1)})}static setSortedColumn(e,t,l){let i=n._getHeaderCellByIndex(e,t);n._getSortIconElementFromHeaderCell(i).classList.add(s.classes.TABLE_HEAD_CELL_SORT_ICON_ACTIVE),n._setColumnSortDirection(i,l)}static setMultiSortColumnSortNumber(e,t,l,i){let r=n._getHeaderCellByIndex(e,l).querySelector(`.${s.classes.TABLE_HEAD_CELL_CONTAINER}`).querySelector(`.${s.classes.TABLE_HEAD_CELL_SORT_ORDER}`);r&&(Z(r,typeof i!="number"||!t,s.classes.TABLE_HEAD_CELL_SORT_ORDER_HIDDEN),i&&(r.textContent=i.toString()))}static removeColumnSort(e,t){let l=n._getHeaderCellByIndex(e,t);l.classList.contains(s.classes.TABLE_HEAD_CELL_SORTED_ASCENDING)&&l.classList.remove(s.classes.TABLE_HEAD_CELL_SORTED_ASCENDING),l.classList.contains(s.classes.TABLE_HEAD_CELL_SORTED_DESCENDING)&&l.classList.remove(s.classes.TABLE_HEAD_CELL_SORTED_DESCENDING);let i=n._getSortIconElementFromHeaderCell(l);i&&i.classList.contains(s.classes.TABLE_HEAD_CELL_SORT_ICON_ACTIVE)&&i.classList.remove(s.classes.TABLE_HEAD_CELL_SORT_ICON_ACTIVE)}static _getHeaderCellByIndex(e,t){if(!e.tHead)throw new Error("Table head element cannot be null.");return e.tHead.rows.item(0).cells.item(t)}static _getSortIconElementFromHeaderCell(e){return e.querySelector(`.${s.classes.TABLE_HEAD_CELL_SORT_ICON}`)}static setSelectColumnVisibility(e,t,l,i,o,a,r,c,m){let d=e.tHead,u=e.tBodies[0];!d||!u||(t?n._addSelectColumn(d,u,l,i,o,a,r,c,m):n._hasSelectColumn(d,u)&&(l&&n._detachRowSelectListeners(u,l),i&&n._detachSelectAllListener(d,i),n._destroySelectColumn(d,u)))}static _addSelectColumn(e,t,l,i,o,a,r,c,m){n._createSelectColumn(e,t,!!i,o,()=>{i&&n._tryAttachSelectAllTemplateListener(e,i)},a,r,c,m),l&&n._attachRowSelectListeners(t,l),i&&!o&&n._tryAttachSelectAllTemplateListener(e,i)}static setDenseState(e,t){e.classList.contains(s.classes.TABLE_DENSE)&&e.classList.remove(s.classes.TABLE_DENSE),t&&e.classList.add(s.classes.TABLE_DENSE)}static setRoomyState(e,t){e.classList.contains(s.classes.TABLE_ROOMY)&&e.classList.remove(s.classes.TABLE_ROOMY),t&&e.classList.add(s.classes.TABLE_ROOMY)}static setResizable(e){let t=e.tableElement.tHead;e.resizable?(e.tableElement.classList.add(s.classes.TABLE_RESIZABLE),n._addResizeHandles(t,e)):(e.tableElement.classList.remove(s.classes.TABLE_RESIZABLE),n._removeResizeHandles(t,e))}static _addResizeHandles(e,t){if(!e)return;let l=e.rows.item(0);if(l){let i=Array.from(l.cells);t.selectListener&&(i=i.slice(1));for(let o of i){let a=i.indexOf(o);if(t.columnConfigurations[a].resizable!==!1){let c=document.createElement("div");c.classList.add(s.classes.TABLE_RESIZE_HANDLE),o.appendChild(c)}}}}static _removeResizeHandles(e,t){if(!e)return;let l=e.rows.item(0);if(l){let i=Array.from(l.cells);t.selectListener&&(i=i.slice(1));for(let o of i){let a=document.querySelector(`.${s.classes.TABLE_RESIZE_HANDLE}`);a&&o.removeChild(a)}}}static setWrapContentState(e,t){t?e.classList.remove(s.classes.TABLE_NO_WRAP_CONTENT):e.classList.add(s.classes.TABLE_NO_WRAP_CONTENT)}static setSelectAllVisibility(e,t,l,i,o,a){let r=e.tHead;if(!r)return;!t&&l&&n._detachSelectAllListener(r,l);let m=r.rows[r.rows.length-1].cells.item(0);t?m.childElementCount||(m.classList.add(s.classes.TABLE_CELL_SELECT),i?n._renderSelectAllTemplate(i,r).then(()=>{l&&n._tryAttachSelectAllTemplateListener(r,l)}):m.appendChild(n._createCheckboxElement(!0,o||null,null,null,null,a)),l&&!i&&n._attachSelectAllListener(r,l)):(l&&n._detachSelectAllListener(r,l),R(m))}static setFilterRow(e){if(!e.tableElement.tHead)return;let t=n._getFilterRowElement(e.tableElement.tHead),l;if(e.filter?e.tableElement.classList.add(s.classes.TABLE_FILTER_VISIBLE):e.tableElement.classList.remove(s.classes.TABLE_FILTER_VISIBLE),e.filter&&!t){if(e.columnConfigurations.every(o=>!o.filter))return;e.selectListener&&e.selectAllListener&&(l=e.tableElement.tHead.rows[e.tableElement.tHead.rows.length-1].cells.item(0));let i=n._createFilterRowElement(e);i&&l&&Array.from(l.children).forEach(o=>{var a;(a=i.cells.item(0))==null||a.appendChild(o)})}else if(!e.filter&&t){if(e.selectListener&&e.selectAllListener){l=t.cells.item(0);let i=Array.from(e.tableElement.tHead.rows).indexOf(t)-1,o=e.tableElement.tHead.rows.item(i);o&&Array.from(l.children).forEach(a=>{var r;(r=o.cells.item(0))==null||r.appendChild(a)})}W(t)}}static _createFilterRowElement(e){if(!e.tableElement.tHead)throw new Error("Table head element cannot be null.");let t=e.tableElement.tHead.insertRow();if(p([s.classes.TABLE_ROW,s.classes.TABLE_HEAD_ROW_FILTER],t),e.selectListener){let l=document.createElement("th");p([s.classes.TABLE_CELL,s.classes.TABLE_HEAD_CELL],l),t.insertBefore(l,t.cells[0]),l.classList.add(s.classes.TABLE_CELL_SELECT)}return e.columnConfigurations.forEach((l,i)=>{let o=document.createElement("th");if(p([s.classes.TABLE_CELL,s.classes.TABLE_HEAD_CELL],o),l.filter&&f(l.filterDelegate)){let a=document.createElement("div");a.classList.add(s.classes.TABLE_HEAD_CELL_CONTAINER),l.align&&n._setCellAlignmentClass(a,l.align);let r=n._createFilterElement(l,i,e.filterListener);a.appendChild(r),o.appendChild(a)}t.appendChild(o)}),t}static _createFilterElement(e,t,l){let i;if(y(e.filterDelegate))i=e.filterDelegate();else if(e.filterDelegate instanceof X||e.filterDelegate instanceof le)i=e.filterDelegate;else throw new Error("Invalid filter delegate.");if(l&&i instanceof X&&y(i.onChange))if(!f(e.filterDebounceTime)||I(e.filterDebounceTime)){let o=f(e.filterDebounceTime)?e.filterDebounceTime:s.numbers.DEFAULT_FILTER_DEBOUNCE_TIME;i.onChange(V(a=>l(a,t),o))}else i.onChange(o=>l(o,t));return i.element}static _getFilterRowElement(e){if(e)return Array.from(e.rows).find(t=>t.classList.contains(s.classes.TABLE_HEAD_ROW_FILTER))}static async expandRow(e,t,l){let i=e.tableElement.tBodies[0],a=n._getNonExpandedRows(i.rows)[t];a.classList.add(s.classes.TABLE_ROW_EXPANDED);let r=Array.from(i.rows).indexOf(a),c=i.insertRow(r+1);p([s.classes.TABLE_ROW,s.classes.TABLE_BODY_ROW,s.classes.TABLE_ROW_EXPANDABLE_CONTENT],c);let m=c.insertCell();m.setAttribute("colspan",a.cells.length.toString()),m.classList.add(s.classes.TABLE_ROW_EXPANDABLE_CONTENT_CELL);let d=document.createElement("div"),u=document.createElement(M.elementName);u.appendChild(d),m.appendChild(u);let C=l;if(y(l)){let ue=e.data[t]?e.data[t].data:void 0,be=l(t,d,ue);try{let A=await Promise.resolve(be);C=me(A)?A.content:A}catch(A){console.error("Failed to load row template "+A.message),C=""}}C&&n._setRowTemplate(d,C),window.requestAnimationFrame(()=>u.open=!0)}static _setRowTemplate(e,t){Y(t)?e.innerHTML=t:e.appendChild(t)}static collapseRow(e,t){if(!e.tableElement||!e.tableElement.tBodies.length||!e.tableElement.tBodies[0].rows.length)return Promise.resolve();let l=e.tableElement.tBodies[0],o=n._getNonExpandedRows(l.rows)[t],a=Array.from(l.rows).indexOf(o);if(o&&o.classList.contains(s.classes.TABLE_ROW_EXPANDED)){let r=l.rows[a+1],c=r.querySelector(M.elementName);if(c&&c.open)return c.open=!1,new Promise(m=>{setTimeout(()=>{o.classList.remove(s.classes.TABLE_ROW_EXPANDED),W(r),m()},M.numbers.COLLAPSE_ANIMATION_DURATION)})}return Promise.resolve()}static isRowExpanded(e,t){let l=e.tableElement.tBodies[0],o=n._getNonExpandedRows(l.rows)[t];return o&&o.classList.contains(s.classes.TABLE_ROW_EXPANDED)}static setFixedHeaders(e){e.fixedHeaders?e.tableElement.classList.add(s.classes.TABLE_FIXED):e.tableElement.classList.remove(s.classes.TABLE_FIXED)}static setLayoutType(e){e.layoutType==="fixed"?e.tableElement.classList.add(s.classes.TABLE_LAYOUT_FIXED):e.tableElement.classList.remove(s.classes.TABLE_LAYOUT_FIXED)}static normalizeColumnWidths(e){let t=e.tableElement;if(t.tHead&&t.tHead.rows.length){let l=Array.from(t.tHead.rows[0].cells);for(let i of l){let o=getComputedStyle(i).width;i.style.width&&i.style.width!==o&&(i.style.width=o)}}}static setColumnResizeIndicatorVisibility(e,t,l){let i=e.tableElement;if(i.tHead&&i.tHead.rows.length){let o=Array.from(i.tHead.rows);for(let a of o){let r=a.cells[t];r&&(l?r.classList.add(s.classes.TABLE_CELL_RESIZABLE):r.classList.remove(s.classes.TABLE_CELL_RESIZABLE))}}if(i.tBodies.length){let o=Array.from(i.tBodies[0].rows);for(let a of o){let r=a.cells[t];r&&(l?r.classList.add(s.classes.TABLE_CELL_RESIZABLE):r.classList.remove(s.classes.TABLE_CELL_RESIZABLE))}}}static setRowClickListeners(e,t,l,i){let o=e.tBodies[0];o&&(t?n._attachRowClickListeners(o,l,i):n._detachRowClickListeners(o,l,i))}static setRowClickAttributes(e,t){let l=e.tBodies[0];l&&(t?n._addRowClickAttributes(l):n._removeRowClickAttributes(l))}static getOwnerDocument(e){return e.ownerDocument||document}static _prepend(e,t){let l=t.childNodes.item(0);l?t.insertBefore(e,l):t.appendChild(e)}static _isMac(){return!!(navigator&&navigator.platform&&navigator.platform.substr(0,3)==="Mac")}static _renderSelectAllTemplate(e,t){return Promise.resolve(e()).then(l=>{let i=t.rows.item(t.rows.length-1);if(!i)return;let o=i.cells.item(0);l&&o&&(typeof l=="string"?o.innerHTML=l:l instanceof HTMLElement&&o.appendChild(l),o.setAttribute(s.attributes.CUSTOM_CELL_TEMPLATE,""))})}};var N=class extends Q{constructor(t){super(t)}initialize(){this._tableElement||(this._tableElement=document.createElement("table"),this._tableElement.classList.add(s.classes.TABLE),this._component.children.length&&R(this._component),this._component.appendChild(this._tableElement))}getTableElement(){return this._tableElement||this.initialize(),this._tableElement}createTable(t){return b.createTable(t)}recreateTableBody(t){b.recreateTableBody(t)}setSelectedRows(t,l,i,o,a=!1){b.setSelectedRows(t,l,i,o,a)}clearSelectedRows(t){b.clearSelectedRows(t)}updateSelectedState(t,l){b.updateSelectedState(t,l)}updateSelectAllState(t,l,i){b.updateSelectAllState(t,l,i)}setSortedColumn(t,l,i){b.setSortedColumn(t,l,i)}removeColumnSort(t,l){b.removeColumnSort(t,l)}setSortDirection(t,l,i){b.setSortDirection(t,l,i)}setSelectColumnVisibility(t,l,i,o,a,r,c,m,d){b.setSelectColumnVisibility(t,l,i,o||null,a||null,r||null,c||[],m||null,d||null)}setDense(t,l){b.setDenseState(t,l)}setRoomy(t,l){b.setRoomyState(t,l)}setResizable(t){b.setResizable(t)}setSelectAllVisibility(t,l,i,o,a,r=null){b.setSelectAllVisibility(t,l,i,o,a||null,r||null)}setFilterRow(t){b.setFilterRow(t)}expandRow(t,l,i){return b.expandRow(t,l,i)}collapseRow(t,l){return b.collapseRow(t,l)}isRowExpanded(t,l){return b.isRowExpanded(t,l)}setFixedHeaders(t){b.setFixedHeaders(t)}setTableLayoutType(t){b.setLayoutType(t)}setWrapContentState(t){b.setWrapContentState(t.tableElement,t.wrapContent)}addDocumentListener(t,l){b.getOwnerDocument(this._component).addEventListener(t,l)}removeDocumentListener(t,l){b.getOwnerDocument(this._component).removeEventListener(t,l)}normalizeColumnWidths(t){b.normalizeColumnWidths(t)}setResizeColumnVisibility(t,l,i){b.setColumnResizeIndicatorVisibility(t,l,i)}addTableClass(t){p(t,this._tableElement)}removeTableClass(t){D(t,this._tableElement)}setRowClickListeners(t,l,i,o){b.setRowClickListeners(t,l,i,o)}setRowClickAttributes(t,l){b.setRowClickAttributes(t,l)}};var k=class{constructor(){this._sortedColumns=[]}get sortedColumns(){return[...this._sortedColumns.map(e=>h({},e))]}addSortColumn(e){this._sortedColumns.push(h({},e)),this._updateSortNumbers()}updateSortColumn(e){let t=this._sortedColumns.find(l=>l.columnIndex===e.columnIndex);if(t)switch(t.direction){case"ASC":this.removeSortColumn(e);break;case"DESC":t.direction="ASC";break;case"UNSET":t.direction="DESC";break}}setSortColumns(e){this._sortedColumns=[...e.map(t=>h({},t))]}removeSortColumn(e){typeof e=="number"?this._sortedColumns.splice(e,1):this._sortedColumns.splice(this._sortedColumns.indexOf(e),1),this._updateSortNumbers()}isSortColumn(e){return typeof e=="number"?this._sortedColumns.some(t=>t.columnIndex===e):this._sortedColumns.includes(e)}clearMultiSort(){this._sortedColumns=[]}getSortColumn(e){return this._sortedColumns.find(t=>t.columnIndex===e)}_updateSortNumbers(){this._sortedColumns.every(e=>typeof e.sortOrder=="number")&&this._sortedColumns.sort((e,t)=>e.sortOrder-t.sortOrder),this._sortedColumns.forEach((e,t)=>e.sortOrder=t+1)}};var P=class{constructor(e,t=!1){this.data=e;this.selected=t}};var z=class{constructor(e){this._adapter=e;this._tableRows=[];this._data=[];this._columnConfigurations=[];this._select=!1;this._multiselect=!0;this._dense=!1;this._roomy=!1;this._filter=!1;this._fixedHeaders=!1;this._layoutType=s.strings.DEFAULT_LAYOUT_TYPE;this._wrapContent=!0;this._resizable=!1;this._minResizeWidth=s.numbers.MIN_RESIZE_WIDTH;this._multiColumnSort=!1;this._selectCheckboxAlignment="center";this._isAllSelected=!1;this._sortedColumnIndex=-1;this._rendered=!1;this._allowRowClick=!1;this._multiSortManager=new k;this._rowClickListener=t=>this._onRowClick(t),this._rowDoubleClickListener=t=>this._onRowDoubleClick(t),this._selectRowListener=t=>this._onRowSelected(t),this._selectAllListener=t=>this._onSelectAll(t),this._headRowMouseDownListener=t=>this._onHeadRowMouseDown(t),this._headRowContextMenuListener=t=>this._onHeadRowContextMenu(t),this._documentMouseMoveListener=t=>this._onMouseMove(t),this._documentMouseUpListener=t=>this._onMouseUp(t),this._filterListener=(t,l)=>this._onFilter(t,l),this._selectionManager=new w(this._selectKey),this._hiddenColumnManager=new w}initialize(){this.connect(),this._adapter.setHostAttribute(s.attributes.SELECT,this._select.toString()),this._adapter.setHostAttribute(s.attributes.MULTISELECT,this._multiselect.toString()),this._adapter.setHostAttribute(s.attributes.DENSE,this._dense.toString()),this._adapter.setHostAttribute(s.attributes.ROOMY,this._roomy.toString()),this._adapter.setHostAttribute(s.attributes.FILTER,this._filter.toString()),this._adapter.emitHostEvent(s.events.INITIALIZED,void 0,!1)}connect(){this._adapter.initialize()}disconnect(){this._resizeDescriptor=void 0,this._adapter.removeDocumentListener("mousemove",this._documentMouseMoveListener),this._adapter.removeDocumentListener("mouseup",this._documentMouseUpListener)}set data(e){Array.isArray(e)&&e.length>0?g(e[0])?this._data=e.map(t=>h({},t)):this._data=[...e]:this._data=[],this._tableRows=this._data.map(t=>new P(t,this._selectionManager.exists(t))),this._renderBody()}get data(){return JSON.parse(JSON.stringify(this._data))}set columnConfigurations(e){this._columnConfigurations=e.map(t=>h({},t)),this._hiddenColumnManager.clear(),this._columnConfigurations.forEach(t=>{t.hidden&&this._hiddenColumnManager.add(t)}),this._refreshTableSort(),this.render()}get columnConfigurations(){return this._columnConfigurations.map(e=>h({},e))}get _visibleColumnConfigurations(){return this._columnConfigurations.filter(e=>!this._hiddenColumnManager.exists(e))}get _tableConfiguration(){return{tableElement:this._adapter.getTableElement(),columnConfigurations:this._visibleColumnConfigurations,data:this._tableRows,clickListener:this._allowRowClick?this._rowClickListener:null,doubleClickListener:this._allowRowClick?this._rowDoubleClickListener:null,selectListener:this._select?this._selectRowListener:null,selectAllListener:this._multiselect?this._selectAllListener:null,headRowMouseDownListener:this._headRowMouseDownListener,headRowContextMenuListener:this._headRowContextMenuListener,filterListener:this._filter?this._filterListener:null,sortDirection:this._sortDirection,sortedColumn:this._sortedColumnIndex,multiColumnSort:this._multiColumnSort,filter:this._filter,wrapContent:this._wrapContent,fixedHeaders:this._fixedHeaders,layoutType:this._layoutType,dense:this._dense,resizable:this._resizable,rowCreatedCallback:this._rowCreatedCallback,cellCreatedCallback:this._cellCreatedCallback,selectAllTemplate:this._selectAllTemplate,selectCheckboxAlignment:this._selectCheckboxAlignment,tooltipSelect:this._tooltipSelect,tooltipSelectAll:this._tooltipSelectAll}}set select(e){this._select!==e&&(this._select=e,this._adapter.setSelectColumnVisibility(this._adapter.getTableElement(),this._select,this._selectRowListener,this._multiselect?this._selectAllListener:void 0,this._multiselect?this._selectAllTemplate:null,this._selectCheckboxAlignment,this._tableRows,this._tooltipSelect,this._tooltipSelectAll),this._updateSelections(!0),this._select?this._adapter.setHostAttribute(s.attributes.SELECT,this._select.toString()):this._adapter.removeHostAttribute(s.attributes.SELECT))}get select(){return this._select}set multiselect(e){this._multiselect!==e&&(this._multiselect=e,this._select&&(this._adapter.setSelectAllVisibility(this._adapter.getTableElement(),this._multiselect,this._multiselect?this._selectAllListener:null,this._multiselect?this.selectAllTemplate:null,this._selectCheckboxAlignment,this._tooltipSelectAll),this._updateSelections(!0)),this._adapter.setHostAttribute(s.attributes.MULTISELECT,this._multiselect.toString()))}get multiselect(){return this._multiselect}get selectKey(){return Array.isArray(this._selectKey)?[...this._selectKey]:this._selectKey}set selectKey(e){this._originalSelectKey!==e&&(Array.isArray(e)?(this._originalSelectKey=[...e],this._selectKey=[...e]):(this._originalSelectKey=e,this._selectKey=[e]),this._selectionManager.setKey(this._selectKey),this._updateSelections(!1))}get dense(){return this._dense}set dense(e){this._dense!==e&&(this._dense=e,this._adapter.setDense(this._adapter.getTableElement(),this._dense),this._adapter.setHostAttribute(s.attributes.DENSE,this._dense.toString()))}get roomy(){return this._roomy}set roomy(e){e!==this._roomy&&(this._roomy=e,this._applyRoomy())}set filter(e){this._filter!==e&&(this._filter=e,this._adapter.setFilterRow(this._tableConfiguration),this._adapter.setHostAttribute(s.attributes.FILTER,this._filter.toString()))}get filter(){return this._filter}set fixedHeaders(e){this._fixedHeaders!==e&&(this._fixedHeaders=e,this._adapter.setFixedHeaders(this._tableConfiguration))}get fixedHeaders(){return this._fixedHeaders}get layoutType(){return this._layoutType}set layoutType(e){this._layoutType!==e&&(this._layoutType=e,this._adapter.setTableLayoutType(this._tableConfiguration))}get wrapContent(){return this._wrapContent}set wrapContent(e){this._wrapContent!==e&&(this._wrapContent=e,this._adapter.setWrapContentState(this._tableConfiguration))}get resizable(){return this._resizable}set resizable(e){this._resizable!==e&&(this._resizable=e,this._adapter.setResizable(this._tableConfiguration))}get minResizeWidth(){return this._minResizeWidth}set minResizeWidth(e){this._minResizeWidth!==e&&(this._minResizeWidth=e,I(this._minResizeWidth)?this._minResizeWidth<0&&(this._minResizeWidth=0):this._minResizeWidth=s.numbers.MIN_RESIZE_WIDTH)}get allowRowClick(){return this._allowRowClick}set allowRowClick(e){this._allowRowClick!==e&&(this._allowRowClick=e,this._rendered&&(this._adapter.setRowClickListeners(this._adapter.getTableElement(),this._allowRowClick,this._rowClickListener,this._rowDoubleClickListener),this._adapter.setRowClickAttributes(this._adapter.getTableElement(),this._allowRowClick)))}get multiColumnSort(){return this._multiColumnSort}set multiColumnSort(e){e!==this._multiColumnSort&&(this._multiColumnSort=e,this._refreshTableSort(),this.render())}get selectCheckboxAlignment(){return this._selectCheckboxAlignment}set selectCheckboxAlignment(e){e!==this._selectCheckboxAlignment&&(this._selectCheckboxAlignment=e,this._adapter.setHostAttribute(s.attributes.SELECT_CHECKBOX_ALIGNMENT,e),this.render())}get tooltipSelect(){return this._tooltipSelect}set tooltipSelect(e){e!==this._tooltipSelect&&(this._tooltipSelect=e,typeof e=="string"&&this._adapter.setHostAttribute(s.attributes.TOOLTIP_SELECT,e),this.render())}get tooltipSelectAll(){return this._tooltipSelectAll}set tooltipSelectAll(e){e!==this._tooltipSelectAll&&(this._tooltipSelectAll=e,this._adapter.setHostAttribute(s.attributes.TOOLTIP_SELECT_ALL,e),this.render())}get selectAllTemplate(){return this._selectAllTemplate}set selectAllTemplate(e){e!==this._selectAllTemplate&&(this._selectAllTemplate=e,this.render())}get rowCreated(){return this._rowCreatedCallback}set rowCreated(e){this._rowCreatedCallback=e}get cellCreated(){return this._cellCreatedCallback}set cellCreated(e){this._cellCreatedCallback=e}isRowSelected(e){let t=v(Array.isArray(this._selectKey)?this._selectKey:[this._selectKey],e);return this.selectKey?!!this._selectionManager.getItems().find(l=>K(l,t)):this._selectionManager.exists(e)}getSelectedRows(){return this._selectionManager.getItems()}selectRows(e,t){if(!this._selectKey)throw new Error("You must set a selectKey to select rows.");(!this._multiselect||t)&&this.clearSelections(),e&&e.length&&(this._selectionManager.add(e),this._updateSelections(!t))}deselectRows(e){e&&e.length&&(this._selectionManager.remove(e),this._updateSelections(!1))}clearSelections(){let e=this._adapter.getTableElement();this._selectionManager.clear(),this._tableRows.forEach(t=>t.selected=!1),this._isAllSelected=!1,this._adapter.clearSelectedRows(e),this._select&&this._multiselect&&this._adapter.updateSelectAllState(e,!1)}hideColumn(e){let t=this._columnConfigurations[e];this._sortedColumnIndex===e&&(this._sortedColumnIndex=-1),this._hiddenColumnManager.exists(t)||(this._hiddenColumnManager.add(t),this.render())}showColumn(e){let t=this._columnConfigurations[e];this._hiddenColumnManager.exists(t)&&(this._hiddenColumnManager.remove(t),this.render())}isColumnHidden(e){let t=this._columnConfigurations[e];return!!t&&this._hiddenColumnManager.exists(t)}render(){this._adapter.createTable(this._tableConfiguration),this._renderSelections(),this._rendered=!0}_renderBody(){this._rendered&&(this._adapter.recreateTableBody(this._tableConfiguration),this._renderSelections())}_renderSelections(){this.select&&(this._isAllSelected=this._getSelectAllState(),this._multiselect&&this._adapter.updateSelectAllState(this._adapter.getTableElement(),this._isAllSelected,this._isIndeterminate(this._isAllSelected)));let e=this._selectionManager.getItems();e.length&&this._adapter.setSelectedRows(this._adapter.getTableElement(),this._selectKey,this._data,e,!1)}expandRow(e,t){if(!this._rendered)throw new Error("Cannot expand a row before the table has rendered.");if(e<0||e>this._tableRows.length)throw new Error(`Invalid row index: ${e}.`);return this._adapter.expandRow(this._tableConfiguration,e,t)}collapseRow(e){return!this._rendered||e<0||e>this._tableRows.length?Promise.resolve():this._adapter.collapseRow(this._tableConfiguration,e)}isRowExpanded(e){return this._adapter.isRowExpanded(this._tableConfiguration,e)}selectRowsByIndex(e,t){let l=e.map(i=>this._data[i]).filter(i=>!!i);this.selectRows(l,!t)}deselectRowsByIndex(e){let t=e.map(l=>this._data[l]).filter(l=>!!l);this.deselectRows(t)}_getSelectAllState(){return this._tableRows.length>0&&this._tableRows.every(e=>e.selected)}_updateSelections(e){this._tableRows.forEach(l=>l.selected=this._selectionManager.exists(l.data));let t=this._getSelectAllState();this._adapter.setSelectedRows(this._adapter.getTableElement(),this._selectKey,this._data,this._selectionManager.getItems(),e),(t!==this._isAllSelected||this._isIndeterminate(t))&&(this._isAllSelected=t,this._multiselect&&this._adapter.updateSelectAllState(this._adapter.getTableElement(),this._isAllSelected,this._isIndeterminate(this._isAllSelected)))}_onRowClick(e){if(e.stopImmediatePropagation(),e.target.tagName==="INPUT"&&e.target.type==="checkbox")return;let i=H(e).filter(m=>m.nodeType===1).find(m=>m.hasAttribute(s.attributes.CUSTOM_CELL_TEMPLATE));if(i&&i.hasAttribute(s.attributes.CUSTOM_CELL_TEMPLATE_STOP_PROPAGATION))return;let{index:a,data:r}=this._getSelectedRowFromEvent(e),c={index:a,data:r};this._adapter.emitHostEvent(s.events.ROW_CLICK,c,!0,!1)}_onRowDoubleClick(e){if(e.stopPropagation(),e.target.tagName==="INPUT"&&e.target.type==="checkbox")return;let t=this._getSelectedRowFromEvent(e),l={index:t.index,data:t.data};this._adapter.emitHostEvent(s.events.SELECT_DOUBLE,l,!0,!1)}_onRowSelected(e){let t=this._getSelectedRowFromEvent(e);this._multiselect||this._tableRows.filter(r=>r.selected).forEach(r=>{K(r.data,v(this._selectKey,t.data))||this.deselectRows([r.data])});let l=!this._selectionManager.exists(t.data);this._adapter.updateSelectedState(t.rowElement,l),l?this._selectionManager.add(t.data):this._selectionManager.remove(t.data),this._tableRows[t.index].selected=l;let i=[t.index],o=!1;if(this._multiselect){if(e.shiftKey&&this._previouslyClickedRow&&(i=this._shiftSelectRows(t),i.includes(this._previouslyClickedRow.index))){let r=i.indexOf(this._previouslyClickedRow.index);i.splice(r,1)}o=this._getSelectAllState(),this._adapter.updateSelectAllState(this._adapter.getTableElement(),o,this._isIndeterminate(o))}for(let a of i){let r=this._tableRows[a].data,m={selected:this._selectionManager.exists(r),index:a,data:r};this._adapter.emitHostEvent(s.events.SELECT,m,!0,!1)}if(this._isAllSelected!==o){this._isAllSelected=o;let a={status:this._isAllSelected,count:this._tableRows.filter(r=>r.selected).length,data:[...this._data],targetType:"row"};this._adapter.emitHostEvent(s.events.SELECT_ALL,a,!0,!1)}this._previouslyClickedRow=h({},t)}_getSelectedRowFromEvent(e){let l=H(e).find(r=>r.tagName==="TR"),i=l.parentElement,o=this._getNonExpandedRows(i).findIndex(r=>r===l),a=this._tableRows[o].data;return{rowElement:l,index:o,data:a}}_getNonExpandedRows(e){return Array.from(e.rows).filter(t=>!t.classList.contains(s.classes.TABLE_ROW_EXPANDABLE_CONTENT))}_onSelectAll(e){e.stopPropagation(),this._isAllSelected=!this._isAllSelected;let t=this._adapter.getTableElement();this._adapter.updateSelectAllState(t,this._isAllSelected),this._tableRows.forEach((i,o)=>{i.selected=this._isAllSelected,this._isAllSelected?this._selectionManager.add(i.data):this._selectionManager.remove(i.data);let a=b.getRowByIndex(t,o);a&&this._adapter.updateSelectedState(a,this._isAllSelected)});let l={status:this._isAllSelected,count:this._tableRows.filter(i=>i.selected).length,data:[...this._data],targetType:"select-all"};this._adapter.emitHostEvent(s.events.SELECT_ALL,l,!0,!1)}_onHeadRowContextMenu(e){e.preventDefault()}_onHeadRowMouseDown(e){if(e.button!==0)return;let t=H(e),l=e.target,i=t.find(r=>r.tagName==="TR"),o=t.find(r=>r.tagName==="TH"),a=Array.from(i.cells).findIndex(r=>r===o);this._headCellMouseDownIndex=a,l!==o&&l.classList.contains(s.classes.TABLE_RESIZE_HANDLE)&&(this._resizeDescriptor={element:o,startWidth:o.offsetWidth,startX:e.pageX,width:o.offsetWidth,index:this._select?a-1:a},this._adapter.addDocumentListener("mousemove",this._documentMouseMoveListener),this._adapter.setResizeColumnVisibility(this._tableConfiguration,a,!0)),this._adapter.addDocumentListener("mouseup",this._documentMouseUpListener)}_onMouseMove(e){if(this._resizeDescriptor){let t=this._resizeDescriptor.startWidth+(e.pageX-this._resizeDescriptor.startX);t<this._minResizeWidth&&(t=this._minResizeWidth),this._resizeDescriptor.width=t,this._resizeDescriptor.element.style.width=`${t}px`,this._adapter.addTableClass(s.classes.TABLE_RESIZING)}}_onMouseUp(e){if(this._adapter.removeDocumentListener("mousemove",this._documentMouseMoveListener),this._adapter.removeDocumentListener("mouseup",this._documentMouseUpListener),this._adapter.removeTableClass(s.classes.TABLE_RESIZING),this._headCellMouseDownIndex!==void 0){if(this._resizeDescriptor){this._adapter.normalizeColumnWidths(this._tableConfiguration),this._adapter.setResizeColumnVisibility(this._tableConfiguration,this._headCellMouseDownIndex,!1);let t={index:this._resizeDescriptor.index,width:this._resizeDescriptor.width};this._adapter.emitHostEvent(s.events.COLUMN_RESIZE,t),this._resizeDescriptor=void 0}else this._tableConfiguration.tableElement.tHead.contains(e.target)&&(this._multiColumnSort?this._onMultiSort(this._headCellMouseDownIndex,e.ctrlKey):this._onSort(this._headCellMouseDownIndex));this._headCellMouseDownIndex=void 0}}_onSort(e){let t=this._select?e-1:e,l=t>=0?this._visibleColumnConfigurations[t]:null;if(!l||!l.sortable)return;let i="ASC",o=t===this._sortedColumnIndex,a=this._sortDirection==="ASC"||this._sortDirection===void 0,r=o&&this._sortDirection==="DESC";o&&a&&(i="DESC"),r&&!l.preventUnsort&&(i="UNSET");let c={direction:i,columnIndex:t};if(this._adapter.emitHostEvent(s.events.SORT,c,!0,!0)){if(o&&this._sortDirection==="DESC"&&!l.preventUnsort){this._adapter.removeColumnSort(this._adapter.getTableElement(),this._select?this._sortedColumnIndex+1:this._sortedColumnIndex),this._sortedColumnIndex=-1;return}this._sortDirection=i,t===this._sortedColumnIndex?this._adapter.setSortDirection(this._adapter.getTableElement(),e,this._sortDirection):(this._sortedColumnIndex>=0&&this._adapter.removeColumnSort(this._adapter.getTableElement(),this._select?this._sortedColumnIndex+1:this._sortedColumnIndex),this._sortedColumnIndex=t,this._adapter.setSortedColumn(this._adapter.getTableElement(),e,this._sortDirection))}}_onMultiSort(e,t){let l=this._select?e-1:e,i=l>=0?this._visibleColumnConfigurations[l]:null;if(!i||!i.sortable)return;let o=this._multiSortManager.sortedColumns,a=this._multiSortManager.getSortColumn(l);a?this._multiSortManager.updateSortColumn(a):t?this._multiSortManager.addSortColumn({direction:"DESC",columnIndex:l,propertyName:i.property}):(this._multiSortManager.clearMultiSort(),this._multiSortManager.addSortColumn({direction:"DESC",columnIndex:l,propertyName:i.property}));let r=this._multiSortManager.sortedColumns.map(d=>h({},d));if(!this._adapter.emitHostEvent(s.events.SORT,r,!0,!0)){this._multiSortManager.setSortColumns(o);return}let m=this._multiSortManager.sortedColumns.length>1;for(let d=0;d<this._visibleColumnConfigurations.length;d++){let u=this._select?d+1:d;if(!this._multiSortManager.isSortColumn(d))this._adapter.removeColumnSort(this._adapter.getTableElement(),u),b.setMultiSortColumnSortNumber(this._adapter.getTableElement(),m,u,null);else{let C=this._multiSortManager.getSortColumn(d);C&&(this._adapter.setSortedColumn(this._adapter.getTableElement(),u,C.direction),b.setMultiSortColumnSortNumber(this._adapter.getTableElement(),m,u,C.sortOrder||null))}}}_onFilter(e,t){let l={value:e,columnIndex:t};this._adapter.emitHostEvent(s.events.FILTER,l,!0,!1)}_shiftSelectRows(e){let t=[];if(this._previouslyClickedRow){let l=this._previouslyClickedRow.index,i=e.index,o=i>=l?l:i,a=i>=l?i:l;a+=a>o?1:0,o+=o>a?1:0;let r=d=>this.selectRows(d,!1),c=this._tableRows.find(d=>d.selected&&d.data===e.data),m=this._tableRows.find(d=>{var u;return d.data===((u=this._previouslyClickedRow)==null?void 0:u.data)&&!d.selected});(!c||m)&&(r=d=>this.deselectRows(d));for(let d=o;d<a;d++)t.push(d);r(this.data.filter((d,u)=>t.includes(u)))}return t}_isIndeterminate(e){return!e&&this.getSelectedRows().length>0&&this._data.length!==this.getSelectedRows().length}_applyRoomy(){this._adapter.setRoomy(this._adapter.getTableElement(),this._roomy),this._adapter.setHostAttribute(s.attributes.ROOMY,this._roomy.toString())}_refreshTableSort(){if(this._sortedColumnIndex=this._visibleColumnConfigurations.findIndex(e=>e.initialSort),this._sortDirection=this._sortedColumnIndex>=0?this._visibleColumnConfigurations[this._sortedColumnIndex].sortDirection:void 0,this._multiColumnSort){let e=[];this._visibleColumnConfigurations.forEach((t,l)=>{typeof t.initialSort=="object"&&e.push({columnIndex:l,direction:t.initialSort.direction,sortOrder:t.initialSort.sortOrder,propertyName:t.property})}),this._multiSortManager.setSortColumns(e)}}};var E=class extends J{constructor(){super();se.define(te),this._foundation=new z(new N(this))}static get observedAttributes(){return[s.attributes.SELECT,s.attributes.MULTISELECT,s.attributes.SELECT_KEY,s.attributes.DENSE,s.attributes.ROOMY,s.attributes.FILTER,s.attributes.FIXED_HEADERS,s.attributes.LAYOUT_TYPE,s.attributes.WRAP_CONTENT,s.attributes.RESIZABLE,s.attributes.MIN_RESIZE_WIDTH,s.attributes.ALLOW_ROW_CLICK,s.attributes.MULTI_COLUMN_SORT,s.attributes.SELECT_CHECKBOX_ALIGNMENT,s.attributes.TOOLTIP_SELECT,s.attributes.TOOLTIP_SELECT_ALL]}initializedCallback(){this._foundation.initialize()}connectedCallback(){this._foundation.connect()}disconnectedCallback(){this._foundation.disconnect()}attributeChangedCallback(t,l,i){switch(t){case s.attributes.SELECT:this.select=L(i);break;case s.attributes.MULTISELECT:this.multiselect=L(i);break;case s.attributes.SELECT_KEY:this.selectKey=i;break;case s.attributes.DENSE:this.dense=L(i);break;case s.attributes.ROOMY:this.roomy=L(i);break;case s.attributes.FILTER:this.filter=L(i);break;case s.attributes.FIXED_HEADERS:this.fixedHeaders=L(i);break;case s.attributes.LAYOUT_TYPE:this.layoutType=i;break;case s.attributes.WRAP_CONTENT:this.wrapContent=L(i);break;case s.attributes.RESIZABLE:this.resizable=L(i);break;case s.attributes.MIN_RESIZE_WIDTH:this.minResizeWidth=G(i);break;case s.attributes.ALLOW_ROW_CLICK:this.allowRowClick=L(i);break;case s.attributes.MULTI_COLUMN_SORT:this.multiColumnSort=L(i);break;case s.attributes.SELECT_CHECKBOX_ALIGNMENT:this.selectCheckboxAlignment=this.getAttribute(s.attributes.SELECT_CHECKBOX_ALIGNMENT)||"center";break;case s.attributes.TOOLTIP_SELECT:this.tooltipSelect=i;break;case s.attributes.TOOLTIP_SELECT_ALL:this.tooltipSelectAll=i;break}}hideColumn(t){this._foundation.hideColumn(t)}showColumn(t){this._foundation.showColumn(t)}isColumnHidden(t){return this._foundation.isColumnHidden(t)}getSelectedRows(){return this._foundation.getSelectedRows()}selectRow(t){this._foundation.selectRows([t],!1)}selectRows(t,l=!1){this._foundation.selectRows(t,!l)}deselectRow(t){this._foundation.deselectRows([t])}deselectRows(t){this._foundation.deselectRows(t)}clearSelections(){this._foundation.clearSelections()}render(){this._foundation.render()}expandRow(t,l){return this._foundation.expandRow(t,l)}collapseRow(t){return this._foundation.collapseRow(t)}isRowExpanded(t){return this._foundation.isRowExpanded(t)}selectRowsByIndex(t,l){typeof t=="number"?this._foundation.selectRowsByIndex([t],l):Array.isArray(t)&&this._foundation.selectRowsByIndex(t,l)}deselectRowsByIndex(t){typeof t=="number"?this._foundation.deselectRowsByIndex([t]):Array.isArray(t)&&this._foundation.deselectRowsByIndex(t)}isRowSelected(t){return this._foundation.isRowSelected(t)}};_([T()],E.prototype,"data",2),_([T()],E.prototype,"columnConfigurations",2),_([T()],E.prototype,"select",2),_([T()],E.prototype,"multiselect",2),_([T()],E.prototype,"selectKey",2),_([T()],E.prototype,"tooltipSelect",2),_([T()],E.prototype,"tooltipSelectAll",2),_([T()],E.prototype,"dense",2),_([T()],E.prototype,"roomy",2),_([T()],E.prototype,"filter",2),_([T()],E.prototype,"fixedHeaders",2),_([T()],E.prototype,"layoutType",2),_([T()],E.prototype,"wrapContent",2),_([T()],E.prototype,"resizable",2),_([T()],E.prototype,"minResizeWidth",2),_([T()],E.prototype,"allowRowClick",2),_([T()],E.prototype,"multiColumnSort",2),_([T()],E.prototype,"rowCreated",2),_([T()],E.prototype,"cellCreated",2),_([T()],E.prototype,"selectAllTemplate",2),_([T()],E.prototype,"selectCheckboxAlignment",2),E=_([j({name:s.elementName,dependencies:[ae,oe,ce]})],E);function pl(){q(E)}export{s as a,B as b,O as c,Le as d,N as e,P as f,z as g,E as h,pl as i};
|
|
7
|
+
//# sourceMappingURL=chunk.UKFJHDO7.js.map
|
|
@@ -3,5 +3,5 @@
|
|
|
3
3
|
* Copyright 2023 Tyler Technologies, Inc.
|
|
4
4
|
* License: Apache-2.0
|
|
5
5
|
*/
|
|
6
|
-
import{a as F}from"./chunk.HKJEGD6C.js";import{b as j}from"./chunk.U4GYQOPY.js";import{a as te}from"./chunk.GHSAKRYH.js";import{h as pe,i as ae}from"./chunk.SYZB7B4F.js";import{b as Q}from"./chunk.ZIB7L7DZ.js";import{a as C,e as ie}from"./chunk.7G72CBOJ.js";import{c as ee}from"./chunk.2QFIMTVP.js";import{e as Z}from"./chunk.5IVB5L5Z.js";import{b as oe}from"./chunk.IDD54B5P.js";import{c as re}from"./chunk.632OMHHN.js";import{a as se,b as le}from"./chunk.PHTOULRR.js";import{a as ne}from"./chunk.GO5A4GKZ.js";import{a as A}from"./chunk.MGLWXAZO.js";import{c as W,g as K,h as q}from"./chunk.FYWPZFLJ.js";import{d as Y,l as X,m as J}from"./chunk.H5D54EHO.js";import{a as $}from"./chunk.NVMILGC2.js";import{a as z}from"./chunk.G4IN6Y46.js";import{a}from"./chunk.NVUMRW44.js";import{a as R}from"./chunk.5V5ABSHI.js";import{a as H,b as G,c as V}from"./chunk.DTZFWZPB.js";import{a as k,e as U,f as L}from"./chunk.NK7H3MMM.js";import{m as B,r as N,s as M,u as D}from"./chunk.CFDK4RCW.js";import{a as y,b as h,c as x,j as T,k as f,l as S,n as w,o as P}from"./chunk.J2M2MXP2.js";import{a as E,d as p}from"./chunk.M3QDAYD2.js";var g=`${G}autocomplete`,me={MODE:"mode",MULTIPLE:"multiple",DEBOUNCE:"debounce",FILTER_ON_FOCUS:"filter-on-focus",FILTER_FOCUS_FIRST:"filter-focus-first",ALLOW_UNMATCHED:"allow-unmatched",POPUP_TARGET:"popup-target",POPUP_CLASSES:"popup-classes",OPTION_LIMIT:"option-limit",OBSERVE_SCROLL:"observe-scroll",OBSERVE_SCROLL_THRESHOLD:"observe-scroll-threshold",SYNC_POPUP_WIDTH:"sync-popup-width",OPEN:"open",MATCH_KEY:"match-key",FILTER_TEXT:"filter-text",DROPDOWN_ICON_OPEN:"data-forge-dropdown-icon-open"},fe={INPUT:ne.selectors.INPUT,DROPDOWN_ICON:"[data-forge-dropdown-icon],[data-forge-dropdown-icon],[forge-dropdown-icon],.forge-dropdown-icon",CLEAR_BUTTON:"[data-forge-autocomplete-clear],[forge-autocomplete-clear]"},ve={DEFAULT_DEBOUNCE_TIME:500,NUM_SKELETON_ITEMS:3},be={CHANGE:`${g}-change`,SELECT:`${g}-select`,SCROLLED_BOTTOM:`${g}-scrolled-bottom`},o={elementName:g,attributes:me,selectors:fe,numbers:ve,events:be},ue=(e=>(e.Default="default",e.Stateless="stateless",e))(ue||{});var O=class extends R{constructor(e){super(e);this.setInputElement()}setInputElement(){let e=N(this._component,o.selectors.INPUT,!1);return e.length&&(this._inputElement=e[0]),this._inputElement}setInputAttribute(e,t){this._inputElement.setAttribute(e,t)}addInputListener(e,t){this._inputElement.addEventListener(e,t)}removeInputListener(e,t){this._inputElement.removeEventListener(e,t)}initializeInputAccessibility(e){this._inputElement.setAttribute("autocomplete","off"),this._inputElement.setAttribute("role","combobox"),this._inputElement.setAttribute("aria-live","polite"),this._inputElement.setAttribute("aria-atomic","true"),this._inputElement.setAttribute("aria-haspopup","true"),this._inputElement.setAttribute("aria-expanded","false"),this._inputElement.setAttribute("aria-autocomplete","list")}isWrappingChipField(){return!!this._component.querySelector(F.elementName)}show(e,t){this._targetElement=this._getTargetElement(t),this._targetElement&&(this._listDropdown=new pe(this._targetElement,e),this._listDropdown.open(),this._inputElement.setAttribute("aria-expanded","true"),this._inputElement.setAttribute("aria-controls",`list-dropdown-popup-${e.id}`),this._tryToggleDropdownIconRotation(!0))}hide(e){if(!this._listDropdown)return;let{targetElement:t}=this._listDropdown.dropdownElement;t.removeEventListener(C.events.BLUR,e),this.setBusyVisibility(!1),this._tryToggleDropdownIconRotation(!1),this._inputElement.removeAttribute("aria-activedescendant"),this._inputElement.removeAttribute("aria-controls"),this._inputElement.setAttribute("aria-expanded","false"),this._listDropdown.close(),this._listDropdown=void 0}setBusyVisibility(e){var t;(t=this._listDropdown)==null||t.setBusyVisibility(e)}setDismissListener(e){if(!this._listDropdown||!this._listDropdown.dropdownElement)return;let t=this._listDropdown.dropdownElement;t.targetElement&&t.targetElement.addEventListener(C.events.BLUR,e)}focus(){window.requestAnimationFrame(()=>this._inputElement.focus())}setOptions(e){var t;(t=this._listDropdown)==null||t.setOptions(e)}appendOptions(e){var t;(t=this._listDropdown)==null||t.appendOptions(e)}setSelectedText(e){this._inputElement.value=e}getInputValue(){return this._inputElement.value}setInputValue(e){this._inputElement.value=e}selectInputValue(){window.requestAnimationFrame(()=>this._inputElement.select())}isFocusWithinPopup(e){return!this._listDropdown||!this._listDropdown.dropdownElement?!1:this._listDropdown.dropdownElement.contains(e)}hasFocus(){let e=M();return e===this._inputElement||this.isFocusWithinPopup(e)}hasInputElement(){return!!this._inputElement}setDropdownIconListener(e,t){window.requestAnimationFrame(()=>{let i=this._component.querySelector(o.selectors.DROPDOWN_ICON);i&&i.addEventListener(e,t)})}removeDropdownIconListener(e,t){let i=this._component.querySelector(o.selectors.DROPDOWN_ICON);i&&i.removeEventListener(e,t)}setClearButtonListener(e,t){window.requestAnimationFrame(()=>{let i=this._component.querySelector(o.selectors.CLEAR_BUTTON);i&&i.addEventListener(e,t)})}removeClearButtonListener(e,t){let i=this._component.querySelector(o.selectors.CLEAR_BUTTON);i&&i.removeEventListener(e,t)}propagateKey(e){var t;(t=this._listDropdown)==null||t.handleKey(e)}updateActiveDescendant(e){this._targetElement&&D(this._inputElement,!!e,"aria-activedescendant",e)}getTargetElementWidth(e){return this._targetElement||(this._targetElement=this._getTargetElement(e)),this._targetElement.getBoundingClientRect().width}getPopupElement(){var e,t;return(t=(e=this._listDropdown)==null?void 0:e.dropdownElement)!=null?t:null}activateFirstOption(){var e;(e=this._listDropdown)==null||e.activateFirstOption()}activateSelectedOption(){var e;(e=this._listDropdown)==null||e.activateSelectedOption()}activateOptionByIndex(e){var t;(t=this._listDropdown)==null||t.activateOption(e)}getActiveOptionIndex(){var e,t;return(t=(e=this._listDropdown)==null?void 0:e.getActiveOptionIndex())!=null?t:null}clearActiveOption(){var e;(e=this._listDropdown)==null||e.clearActiveOption()}setSelectedOptions(e){if(this._listDropdown){let t=e.map(i=>i.value);this._listDropdown.setSelectedValues(t)}}queueDropdownPositionUpdate(){this.getPopupElement()&&window.requestAnimationFrame(()=>{let e=this.getPopupElement();e==null||e.position()})}_getTargetElement(e){return e?this._component.querySelector(e)||this._getDefaultTargetElement():this._getDefaultTargetElement()}_getDefaultTargetElement(){let e=this._component.querySelector("forge-text-field");if(e&&e.shadowRoot){let i=L(e,se.selectors.ROOT);if(i)return i}let t=this._component.querySelector("forge-chip-field");if(t&&t.shadowRoot){let i=L(t,F.selectors.ROOT);if(i)return i}return this._component.querySelector("input")||this._component}_tryToggleDropdownIconRotation(e){let t=this._component.querySelector(o.selectors.DROPDOWN_ICON);t&&D(t,e,o.attributes.DROPDOWN_ICON_OPEN)}};var de=(e=>(e[e.Option=0]="Option",e[e.Group=1]="Group",e))(de||{});function v(u,d){let e=u.some(i=>h(i)&&T(i)&&i.hasOwnProperty("options")&&(i.hasOwnProperty("text")||i.hasOwnProperty("builder"))),t=u.some(i=>h(i)&&T(i)&&i.hasOwnProperty("label")&&i.hasOwnProperty("value"));return e&&d===1||t&&d===0}function ce(u,d){return u.find(e=>e.value===d)}function b(u,d,e=null){return e?!(e in u.value)||!(e in d)?!1:w(u.value[e],d[e]):w(u.value,d)}var I=class extends ae{constructor(e){super();this._adapter=e;this._isInitialized=!1;this._isDropdownOpen=!1;this._mode="default";this._multiple=!1;this._debounce=o.numbers.DEFAULT_DEBOUNCE_TIME;this._allowUnmatched=!1;this._filterOnFocus=!0;this._filterFocusFirst=!0;this._options=[];this._filterText="";this._selectedOptions=[];this._values=[];this._pendingFilterPromises=[];this._matchKey=null;this._clickListener=t=>this._onClick(t),this._focusListener=()=>this._onFocus(),this._blurListener=t=>this._onBlur(t),this._keydownListener=t=>this._onKeydown(t),this._dropdownIconClickListener=t=>this._onDropdownIconClick(t),this._dropdownScrollEndListener=()=>this._onDropdownScrollEnd(),this._dropdownIconMouseDownListener=t=>this._onDropdownIconMouseDown(t),this._clearButtonListener=t=>this._onClear(t),this._dismissListener=()=>this._onDismiss(),this._activeChangeListener=t=>this._adapter.updateActiveDescendant(t),this._targetWidthCallback=()=>this._adapter.getTargetElementWidth(this._popupTarget),this._identifier=y()}async initialize(){if(!this._adapter.hasInputElement()&&!this._adapter.setInputElement())throw new Error("An input element is required as a child of the autocomplete component.");if(this._setInputListener(),this._setFilterCallback(),this._attachListeners(),this._initializeAccessibility(),this._values.length){if(!this._selectedOptions.length){try{await this._executeFilter()}catch(e){console.error(e)}this._updateSelectedOptions(this._values)}this._adapter.setSelectedText(this._getSelectedText())}this._isInitialized=!0}disconnect(){this._isInitialized&&(this._detachListeners(),this._isInitialized=!1),this._isDropdownOpen&&this._closeDropdown()}_attachListeners(){this._adapter.addInputListener("click",this._clickListener),this._adapter.addInputListener("focus",this._focusListener),this._adapter.addInputListener("blur",this._blurListener),this._adapter.addInputListener("input",this._inputListener),this._adapter.addInputListener("keydown",this._keydownListener),this._adapter.setDropdownIconListener("click",this._dropdownIconClickListener),this._adapter.setDropdownIconListener("mousedown",this._dropdownIconMouseDownListener),this._adapter.setClearButtonListener("click",this._clearButtonListener)}_detachListeners(){this._adapter.removeInputListener("click",this._clickListener),this._adapter.removeInputListener("focus",this._focusListener),this._adapter.removeInputListener("blur",this._blurListener),this._adapter.removeInputListener("input",this._inputListener),this._adapter.removeInputListener("keydown",this._keydownListener),this._adapter.removeDropdownIconListener("click",this._dropdownIconClickListener),this._adapter.removeDropdownIconListener("mousedown",this._dropdownIconMouseDownListener),this._adapter.removeClearButtonListener("click",this._clearButtonListener)}_setInputListener(){this._inputListener=e=>this._onInput(e)}_setFilterCallback(){this._filterFn=h(this._debounce)&&this._debounce>0?P(this._debounceFilter,this._debounce,!1):this._debounceFilter}_initializeAccessibility(){this._adapter.initializeInputAccessibility(this._identifier)}get _flatOptions(){return v(this._options,1)?this._options.reduce((e,t)=>e.concat(t.options),[]):this._options}_onClick(e){!this._isDropdownOpen&&this._filterOnFocus&&this._showDropdown()}_onDropdownIconMouseDown(e){e.preventDefault()}_onDropdownIconClick(e){this._isDropdownOpen?this._closeDropdown():(this._adapter.focus(),window.requestAnimationFrame(()=>this._showDropdown()))}_onClear(e){this._clearValue(),this._adapter.setSelectedText(this._getSelectedText())}_onDropdownScrollEnd(){this._adapter.emitHostEvent(o.events.SCROLLED_BOTTOM)}_onFocus(){!this._isDropdownOpen&&this._adapter.getInputValue()&&!A.isMobile&&this._adapter.selectInputValue()}_onBlur(e){this._adapter.isFocusWithinPopup(e.relatedTarget)||this._applyBlur()}_applyBlur(){this._isDropdownOpen&&this._closeDropdown(),this._mode!=="stateless"&&(this._selectedOptions.length?this._adapter.setSelectedText(this._getSelectedText()):this._allowUnmatched||(this._filterText="",this._adapter.setSelectedText("")))}_onInput(e){this._selectedOptions.length&&!this._multiple&&(!this._adapter.getInputValue()||this._allowUnmatched)&&!this._adapter.isWrappingChipField()&&(this._selectedOptions=[],this._values=[],this._emitChangeEvent()),this._filterText=this._adapter.getInputValue(),this._filterFn()}async _debounceFilter({checkFocus:e=!0}={}){if(!e&&!this._adapter.hasFocus()){this._pendingFilterPromises=[],this._isDropdownOpen&&this._closeDropdown();return}let t=this._filterText,i=this._executeFilter();this._pendingFilterPromises.push(i),this._isDropdownOpen?this._adapter.setBusyVisibility(!0):this._showDropdown({filter:!1});try{await i}catch(n){this._pendingFilterPromises=[],this._isDropdownOpen&&this._closeDropdown();return}if(t===this._filterText)this._pendingFilterPromises=[],this._onFilterComplete();else{let n=this._pendingFilterPromises.indexOf(i);n!==-1&&this._pendingFilterPromises.splice(n,1)}}_onKeydown(e){switch(e.key){case"Tab":this._isDropdownOpen&&!this._multiple&&this._selectActiveOption(!1);break;case"Esc":case"Escape":this._isDropdownOpen&&(e.preventDefault(),e.stopPropagation(),this._closeDropdown());break;case"Down":case"ArrowDown":e.preventDefault(),this._isDropdownOpen?this._adapter.propagateKey(e.key):this._showDropdown({activateFirst:!0,activateSelected:!0});break;case"Up":case"ArrowUp":e.preventDefault(),this._isDropdownOpen&&this._adapter.propagateKey(e.key);break;case"Enter":case"Home":case"End":this._isDropdownOpen&&(e.key==="Enter"&&e.stopPropagation(),e.preventDefault(),this._adapter.propagateKey(e.key));break;case"Backspace":case"Delete":let t=e.target,i=this._adapter.getInputValue(),n=t.value.substring(t.selectionStart,t.selectionEnd)===t.value,l=i.length===1&&t.selectionEnd===1,c=i.length===1&&t.selectionEnd===0,_=!i||n||l||c;!this._adapter.isWrappingChipField()&&_&&!this._multiple&&this._values.length&&this._clearValue();break}}_executeFilter(e=!0,t=!1){if(!this._filter||typeof this._filter!="function")throw new Error('A filter callback must be provided. Did you set the "filter" property?');let i=this._filter,n=e?this._filterText:"",l=t?this._getValue():null;return new Promise((c,_)=>Promise.resolve(i(n,l)).then(r=>{this._options=r,c(this._options)}).catch(r=>_(`An unexpected error occurred while filtering: ${r}`)))}_onFilterComplete(){if(!this._adapter.hasFocus()){this._isDropdownOpen&&this._closeDropdown();return}if(this._options.length){let e=this._allowUnmatched&&!this._selectedOptions.length;this._dropdownReady({userTriggered:e}),this._filterFocusFirst&&this._filterText&&this._adapter.activateFirstOption()}else this._closeDropdown()}_clearValue(){this._selectedOptions=[],this._values=[],this._isDropdownOpen&&(this._adapter.setSelectedOptions([]),this._adapter.clearActiveOption()),this._emitChangeEvent()}async _showDropdown({filter:e=!0,userTriggered:t=!0,activateFirst:i=!1,activateSelected:n=!1}={}){let l=this._allowUnmatched&&!this._selectedOptions.length;this._isDropdownOpen=!0;let c;if(this._optionBuilder){let r=this._optionBuilder;c=(m,_e)=>r(m,this._filterText,_e)}let _={options:this._options,multiple:this._multiple,selectedValues:[...this._values],id:`forge-autocomplete-${this._identifier}`,asyncStyle:"skeleton",optionLimit:this._optionLimit,popupClasses:this._popupClasses,headerBuilder:this._popupHeaderBuilder,footerBuilder:this._popupFooterBuilder,transform:r=>{if(this._filterText){let m=$(r,this._filterText);if(m)return m}return r},allowBusy:!0,optionBuilder:c,syncWidth:this._syncPopupWidth,observeScroll:this._observeScroll,observeScrollThreshold:this._observeScrollThreshold,scrollEndListener:this._dropdownScrollEndListener,activeChangeCallback:this._activeChangeListener,targetWidthCallback:this._targetWidthCallback,selectCallback:r=>this._onSelect(r),closeCallback:()=>this._closeDropdown()};if(this._adapter.show(_,this._popupTarget),this._adapter.toggleHostAttribute(o.attributes.OPEN,this._isDropdownOpen),e){this._options.length&&this._adapter.setBusyVisibility(!0);try{await this._executeFilter(l)}catch(r){console.error(r)}this._updateSelectedOptions(this._values)}this._pendingFilterPromises.length||this._dropdownReady({userTriggered:t,activateFirst:i,activateSelected:n})}_dropdownReady({userTriggered:e=!0,activateFirst:t=!1,activateSelected:i=!1}={}){if(!this._isDropdownOpen||!this._options.length||e&&!this._adapter.hasFocus()){this._closeDropdown();return}this._sortSelectedOptions(),this._adapter.setBusyVisibility(!1),this._adapter.setOptions(this._options),this._adapter.setSelectedOptions(this._selectedOptions),this._adapter.setDismissListener(this._dismissListener),i&&this._selectedOptions.length?this._adapter.activateSelectedOption():t&&this._adapter.activateFirstOption()}_closeDropdown(){this._multiple&&(this._filterText=""),this._isDropdownOpen=!1,this._adapter.hide(this._dismissListener),this._sortSelectedOptions(),this._adapter.toggleHostAttribute(o.attributes.OPEN,this._isDropdownOpen)}_sortSelectedOptions(){if(this._multiple&&this._selectedOptions.length&&v(this._options,0)){let e=[],t=[];this._options.forEach(i=>{this._selectedOptions.find(n=>b(n,i.value,this._matchKey))?e.push(i):t.push(i)}),this._options=[...e,...t]}}async _onSelect(e,t=!0){if(this._valueChanging)return;if(this._mode==="stateless"){let n={value:e};this._adapter.emitHostEvent(o.events.SELECT,n,!0,!0)&&(this._filterText="",this._multiple||this._closeDropdown());return}let i=()=>{let l=this._flatOptions.find(r=>b(r,e,this._matchKey)),c=l?l.value:"",_=l?l.label:"";if(this._multiple){let r=ce(this._selectedOptions,c);if(r){let m=this._selectedOptions.indexOf(r);this._selectedOptions.splice(m,1)}else this._selectedOptions.push(l)}else h(c)?(this._selectedOptions[0]=l,this._filterText=_):(this._selectedOptions=[],this._filterText="");this._isDropdownOpen&&this._adapter.setSelectedOptions(this._selectedOptions),this._values=this._selectedOptions.map(r=>r.value),this._adapter.setSelectedText(this._getSelectedText()),!A.isMobile&&t&&this._adapter.selectInputValue(),this._emitChangeEvent(),this._tryUpdateDropdownPosition()};this._isDropdownOpen&&!this._multiple&&this._closeDropdown(),typeof this._beforeValueChange=="function"?(this._valueChanging=Promise.resolve(this._beforeValueChange.call(null,e,this._matchKey)),await this._valueChanging?i():this._tryUpdateDropdownPosition(),this._valueChanging=void 0):i()}_selectActiveOption(e=!0){let t=this._adapter.getActiveOptionIndex();if(typeof t=="number"&&t>=0){let i=this._flatOptions[t];i&&this._onSelect(i.value,e)}}_emitChangeEvent(){this._adapter.emitHostEvent(o.events.CHANGE,this._getValue(),!0)}_tryUpdateDropdownPosition(){this._isDropdownOpen&&this._adapter.queueDropdownPositionUpdate()}_getValue(){return this._values?this._values.length?this._multiple?[...this._values]:this._values[0]:this._multiple?[]:null:null}_getSelectedText(){var e,t;return this._adapter.isWrappingChipField()?"":this._selectedTextBuilder?this._selectedTextBuilder(this._selectedOptions):this._multiple?this._values.length?this._values.length===1?(t=(e=this._selectedOptions[0])==null?void 0:e.label)!=null?t:"":`${this._values.length} options selected`:"":this._selectedOptions.filter(i=>i&&i.label).map(i=>i.label).join(" ").trim()}_onDismiss(){this._closeDropdown()}async _applyValue(e){let t=[];this._selectedOptions=[],Array.isArray(e)?t=e:t=h(e)?[e]:[],!this._multiple&&t.length>1&&(t=[t[0]]),v(t,0)?(this._values=t.map(n=>n.value),this._selectedOptions=t):this._values=t;let i=this._flatOptions;if(t.length&&i.length&&this._updateSelectedOptions(t),this._values.length&&!this._selectedOptions.length&&this._filter&&this._isInitialized){try{await this._executeFilter(!1,!0)}catch(n){console.error(n)}this._updateSelectedOptions(this._values)}this._multiple?this._filterText="":this._filterText=this._selectedOptions.length?this._selectedOptions[0].label:"",this._isInitialized&&this._adapter.setSelectedText(this._getSelectedText()),this._isDropdownOpen&&this._adapter.setSelectedOptions(this._selectedOptions)}_updateSelectedOptions(e){let t=[...this._flatOptions,...this._selectedOptions];if(this._selectedOptions.length&&(this._selectedOptions=[]),v(e,0))for(let i of e){let n=t.find(l=>b(l,i.value,this._matchKey));n?this._selectedOptions.push(n):this._selectedOptions.push(i)}else for(let i of e){let n=t.find(l=>b(l,i,this._matchKey));n?this._selectedOptions.push(n):this._allowUnmatched&&this._selectedOptions.push({label:i,value:i})}}get mode(){return this._mode}set mode(e){this._mode!==e&&(this._mode=e,this._mode==="stateless"&&(this._selectedOptions=[],this._isDropdownOpen&&this._closeDropdown()),this._adapter.setHostAttribute(o.attributes.MODE,this._mode))}get multiple(){return this._multiple}set multiple(e){this._multiple!==e&&(this._multiple=e,this._adapter.setHostAttribute(o.attributes.MULTIPLE,h(this._multiple)?this._multiple.toString():""))}get value(){return this._getValue()}set value(e){let t=[];e==null?t=[]:Array.isArray(e)?t=JSON.parse(JSON.stringify(e)):x(e)?t=[e]:t=[JSON.parse(JSON.stringify(e))],(t.length!==this._values.length||t.some(n=>!this._values.includes(n)))&&this._applyValue(e)}get filterOnFocus(){return this._filterOnFocus}set filterOnFocus(e){this._filterOnFocus!==e&&(this._filterOnFocus=e,this._adapter.setHostAttribute(o.attributes.FILTER_ON_FOCUS,h(this._filterOnFocus)?this._filterOnFocus.toString():""))}get filterFocusFirst(){return this._filterFocusFirst}set filterFocusFirst(e){this._filterFocusFirst!==e&&(this._filterFocusFirst=e,this._adapter.toggleHostAttribute(o.attributes.FILTER_FOCUS_FIRST,this._filterFocusFirst))}get allowUnmatched(){return this._allowUnmatched}set allowUnmatched(e){this._allowUnmatched!==e&&(this._allowUnmatched=e,h(this._allowUnmatched)&&this._adapter.setHostAttribute(o.attributes.ALLOW_UNMATCHED,this._allowUnmatched.toString()))}get matchKey(){return this._matchKey}set matchKey(e){this._matchKey!==e&&(this._matchKey=e)}get popupTarget(){return this._popupTarget}set popupTarget(e){this._popupTarget!==e&&(this._popupTarget=e)}get filterText(){return this._filterText}set filterText(e){this._filterText!==e&&(this._filterText=this._allowUnmatched?e:"",this._isInitialized&&this._allowUnmatched&&(this._adapter.setInputValue(this._filterText),this._isDropdownOpen&&this._debounceFilter({checkFocus:!1})))}get popupClasses(){return Array.isArray(this._popupClasses)?[...this._popupClasses]:[this._popupClasses]}set popupClasses(e){this._popupClasses!==e&&(this._popupClasses=Array.isArray(e)?[...e]:[e])}set popupHeaderBuilder(e){this._popupHeaderBuilder=e}set popupFooterBuilder(e){this._popupFooterBuilder=e}get syncPopupWidth(){return this._syncPopupWidth}set syncPopupWidth(e){this._syncPopupWidth!==e&&(this._syncPopupWidth=e)}get optionLimit(){return this._optionLimit}set optionLimit(e){this._optionLimit!==e&&(this._optionLimit=e)}get debounce(){return this._debounce}set debounce(e){this._debounce!==e&&(this._debounce=e,this._isInitialized&&this._setFilterCallback(),this._adapter.setHostAttribute(o.attributes.DEBOUNCE,h(this._debounce)?this._debounce.toString():""))}get optionBuilder(){return this._optionBuilder}set optionBuilder(e){this._optionBuilder=e}get filter(){return this._filter}set filter(e){this._filter!==e&&(this._filter=e,this._isInitialized&&this._values.length&&!this._flatOptions.length&&this._filter&&this._executeFilter().then(()=>{this._updateSelectedOptions(this._values),this._adapter.setSelectedText(this._getSelectedText())}))}get selectedTextBuilder(){return this._selectedTextBuilder}set selectedTextBuilder(e){this._selectedTextBuilder=e,this._selectedOptions.length&&this._adapter.setSelectedText(this._getSelectedText())}get observeScroll(){return this._observeScroll}set observeScroll(e){this._observeScroll=e}get observeScrollThreshold(){return this._observeScrollThreshold}set observeScrollThreshold(e){this._observeScrollThreshold=e}appendOptions(e){this._isDropdownOpen&&(this._options=[...this._options,...e],this._adapter.appendOptions(e))}get isInitialized(){return this._isInitialized}get open(){return this._isDropdownOpen}set open(e){this._isDropdownOpen!==e&&(e?this._showDropdown({userTriggered:!1}):this._closeDropdown())}get beforeValueChange(){return this._beforeValueChange}set beforeValueChange(e){e!==this._beforeValueChange&&(this._beforeValueChange=e)}get popupElement(){return this._adapter.getPopupElement()}};var ge="<template><slot></slot></template>",Oe=":host{display:block}:host([hidden]){display:none}",s=class extends te{constructor(){super();Y.define([W,q,K]),U(this,ge,Oe),this._foundation=new I(new O(this))}static get observedAttributes(){return[o.attributes.MODE,o.attributes.MULTIPLE,o.attributes.DEBOUNCE,o.attributes.FILTER_ON_FOCUS,o.attributes.FILTER_FOCUS_FIRST,o.attributes.ALLOW_UNMATCHED,o.attributes.POPUP_TARGET,o.attributes.POPUP_CLASSES,o.attributes.OBSERVE_SCROLL,o.attributes.OBSERVE_SCROLL_THRESHOLD,o.attributes.OPTION_LIMIT,o.attributes.SYNC_POPUP_WIDTH,o.attributes.OPEN,o.attributes.MATCH_KEY,o.attributes.FILTER_TEXT]}connectedCallback(){this.querySelector(o.selectors.INPUT)?this._foundation.initialize():B(this,o.selectors.INPUT).then(()=>this._foundation.initialize())}disconnectedCallback(){this._foundation.disconnect()}attributeChangedCallback(e,t,i){switch(super.attributeChangedCallback(e,t,i),e){case o.attributes.MODE:this.mode=i;break;case o.attributes.MULTIPLE:this.multiple=f(i);break;case o.attributes.DEBOUNCE:this.debounce=S(i);break;case o.attributes.FILTER_ON_FOCUS:this.filterOnFocus=f(i);break;case o.attributes.FILTER_FOCUS_FIRST:this.filterFocusFirst=f(i);break;case o.attributes.ALLOW_UNMATCHED:this.allowUnmatched=f(i);break;case o.attributes.POPUP_TARGET:this.popupTarget=i;break;case o.attributes.OPEN:this.open=f(i);break;case o.attributes.MATCH_KEY:this.matchKey=i;break;case o.attributes.FILTER_TEXT:this.filterText=i;break}}appendOptions(e){this._foundation.appendOptions(e)}openDropdown(){this.open=!0}closeDropdown(){this.open=!1}};p([a()],s.prototype,"mode",2),p([a()],s.prototype,"multiple",2),p([a()],s.prototype,"value",2),p([a()],s.prototype,"debounce",2),p([a()],s.prototype,"filterOnFocus",2),p([a()],s.prototype,"filterFocusFirst",2),p([a()],s.prototype,"allowUnmatched",2),p([a()],s.prototype,"popupTarget",2),p([a()],s.prototype,"filterText",2),p([a()],s.prototype,"optionBuilder",2),p([a()],s.prototype,"filter",2),p([a()],s.prototype,"selectedTextBuilder",2),p([a()],s.prototype,"open",2),p([a()],s.prototype,"matchKey",2),p([a({set:!1})],s.prototype,"isInitialized",2),p([a({set:!1})],s.prototype,"popupElement",2),p([a()],s.prototype,"beforeValueChange",2),s=p([H({name:o.elementName,dependencies:[re,ie,ee,Z,j,oe,Q,X]})],s);var he=class extends z{constructor(e){super(e)}_build(){let e=document.createElement(o.elementName);return this._attachTextField(e),e}get textFieldDelegate(){return this._textFieldDelegate}get value(){return this._element.value}set value(e){this._element.value=e}get disabled(){return this._textFieldDelegate.inputElement.disabled}set disabled(e){this._textFieldDelegate.inputElement.disabled=e}get invalid(){return this._textFieldDelegate.invalid||!1}set invalid(e){this._textFieldDelegate.invalid=e}onChange(e){this._element.addEventListener(o.events.CHANGE,t=>e(t.detail))}onFocus(e){this._textFieldDelegate.inputElement.addEventListener("focus",t=>e(t))}onBlur(e){this._textFieldDelegate.inputElement.addEventListener("blur",t=>e(t))}_attachTextField(e){var i,n,l,c,_,r;let t={props:E({},(n=(i=this._config.options)==null?void 0:i.textFieldDelegateConfig)==null?void 0:n.props),options:E({},(c=(l=this._config.options)==null?void 0:l.textFieldDelegateConfig)==null?void 0:c.options)};t.options||(t.options={}),((_=this._config.options)==null?void 0:_.useDropdownIcon)!==!1&&!((r=t.options)!=null&&r.trailingElement)&&(t.options.trailingElement=this._createDropdownIconElement()),this._textFieldDelegate=new le(t),e.appendChild(this._textFieldDelegate.element)}_createDropdownIconElement(){let e={props:{slot:"trailing",name:"arrow_drop_down"},options:{attributes:{"forge-dropdown-icon":""}}};return new J(e).element}};function Gt(){k(s)}export{o as a,ue as b,O as c,de as d,v as e,ce as f,b as g,I as h,s as i,he as j,Gt as k};
|
|
7
|
-
//# sourceMappingURL=chunk.
|
|
6
|
+
import{a as F}from"./chunk.FIBGOPNP.js";import{b as j}from"./chunk.U4GYQOPY.js";import{a as te}from"./chunk.OKKH7F7M.js";import{h as pe,i as ae}from"./chunk.CL65KLH7.js";import{c as ee}from"./chunk.GT3XBPZY.js";import{e as Z}from"./chunk.SAXRW6GB.js";import{b as Q}from"./chunk.ZIB7L7DZ.js";import{a as C,e as ie}from"./chunk.7G72CBOJ.js";import{b as oe}from"./chunk.IDD54B5P.js";import{c as re}from"./chunk.YDY2IGBF.js";import{a as se,b as le}from"./chunk.PHTOULRR.js";import{a as ne}from"./chunk.GO5A4GKZ.js";import{a as A}from"./chunk.MGLWXAZO.js";import{c as W,g as K,h as q}from"./chunk.FYWPZFLJ.js";import{d as Y,l as X,m as J}from"./chunk.H5D54EHO.js";import{a as z}from"./chunk.G4IN6Y46.js";import{a as $}from"./chunk.ISC7SZSP.js";import{a}from"./chunk.NVUMRW44.js";import{a as R}from"./chunk.5V5ABSHI.js";import{a as H,b as G,c as V}from"./chunk.DTZFWZPB.js";import{a as k,e as U,f as L}from"./chunk.NK7H3MMM.js";import{m as B,r as N,s as M,u as D}from"./chunk.CFDK4RCW.js";import{a as y,b as h,c as x,j as T,k as f,l as S,n as w,o as P}from"./chunk.J2M2MXP2.js";import{a as E,d as p}from"./chunk.M3QDAYD2.js";var g=`${G}autocomplete`,me={MODE:"mode",MULTIPLE:"multiple",DEBOUNCE:"debounce",FILTER_ON_FOCUS:"filter-on-focus",FILTER_FOCUS_FIRST:"filter-focus-first",ALLOW_UNMATCHED:"allow-unmatched",POPUP_TARGET:"popup-target",POPUP_CLASSES:"popup-classes",OPTION_LIMIT:"option-limit",OBSERVE_SCROLL:"observe-scroll",OBSERVE_SCROLL_THRESHOLD:"observe-scroll-threshold",SYNC_POPUP_WIDTH:"sync-popup-width",OPEN:"open",MATCH_KEY:"match-key",FILTER_TEXT:"filter-text",DROPDOWN_ICON_OPEN:"data-forge-dropdown-icon-open"},fe={INPUT:ne.selectors.INPUT,DROPDOWN_ICON:"[data-forge-dropdown-icon],[data-forge-dropdown-icon],[forge-dropdown-icon],.forge-dropdown-icon",CLEAR_BUTTON:"[data-forge-autocomplete-clear],[forge-autocomplete-clear]"},ve={DEFAULT_DEBOUNCE_TIME:500,NUM_SKELETON_ITEMS:3},be={CHANGE:`${g}-change`,SELECT:`${g}-select`,SCROLLED_BOTTOM:`${g}-scrolled-bottom`},o={elementName:g,attributes:me,selectors:fe,numbers:ve,events:be},ue=(e=>(e.Default="default",e.Stateless="stateless",e))(ue||{});var O=class extends R{constructor(e){super(e);this.setInputElement()}setInputElement(){let e=N(this._component,o.selectors.INPUT,!1);return e.length&&(this._inputElement=e[0]),this._inputElement}setInputAttribute(e,t){this._inputElement.setAttribute(e,t)}addInputListener(e,t){this._inputElement.addEventListener(e,t)}removeInputListener(e,t){this._inputElement.removeEventListener(e,t)}initializeInputAccessibility(e){this._inputElement.setAttribute("autocomplete","off"),this._inputElement.setAttribute("role","combobox"),this._inputElement.setAttribute("aria-live","polite"),this._inputElement.setAttribute("aria-atomic","true"),this._inputElement.setAttribute("aria-haspopup","true"),this._inputElement.setAttribute("aria-expanded","false"),this._inputElement.setAttribute("aria-autocomplete","list")}isWrappingChipField(){return!!this._component.querySelector(F.elementName)}show(e,t){this._targetElement=this._getTargetElement(t),this._targetElement&&(this._listDropdown=new pe(this._targetElement,e),this._listDropdown.open(),this._inputElement.setAttribute("aria-expanded","true"),this._inputElement.setAttribute("aria-controls",`list-dropdown-popup-${e.id}`),this._tryToggleDropdownIconRotation(!0))}hide(e){if(!this._listDropdown)return;let{targetElement:t}=this._listDropdown.dropdownElement;t.removeEventListener(C.events.BLUR,e),this.setBusyVisibility(!1),this._tryToggleDropdownIconRotation(!1),this._inputElement.removeAttribute("aria-activedescendant"),this._inputElement.removeAttribute("aria-controls"),this._inputElement.setAttribute("aria-expanded","false"),this._listDropdown.close(),this._listDropdown=void 0}setBusyVisibility(e){var t;(t=this._listDropdown)==null||t.setBusyVisibility(e)}setDismissListener(e){if(!this._listDropdown||!this._listDropdown.dropdownElement)return;let t=this._listDropdown.dropdownElement;t.targetElement&&t.targetElement.addEventListener(C.events.BLUR,e)}focus(){window.requestAnimationFrame(()=>this._inputElement.focus())}setOptions(e){var t;(t=this._listDropdown)==null||t.setOptions(e)}appendOptions(e){var t;(t=this._listDropdown)==null||t.appendOptions(e)}setSelectedText(e){this._inputElement.value=e}getInputValue(){return this._inputElement.value}setInputValue(e){this._inputElement.value=e}selectInputValue(){window.requestAnimationFrame(()=>this._inputElement.select())}isFocusWithinPopup(e){return!this._listDropdown||!this._listDropdown.dropdownElement?!1:this._listDropdown.dropdownElement.contains(e)}hasFocus(){let e=M();return e===this._inputElement||this.isFocusWithinPopup(e)}hasInputElement(){return!!this._inputElement}setDropdownIconListener(e,t){window.requestAnimationFrame(()=>{let i=this._component.querySelector(o.selectors.DROPDOWN_ICON);i&&i.addEventListener(e,t)})}removeDropdownIconListener(e,t){let i=this._component.querySelector(o.selectors.DROPDOWN_ICON);i&&i.removeEventListener(e,t)}setClearButtonListener(e,t){window.requestAnimationFrame(()=>{let i=this._component.querySelector(o.selectors.CLEAR_BUTTON);i&&i.addEventListener(e,t)})}removeClearButtonListener(e,t){let i=this._component.querySelector(o.selectors.CLEAR_BUTTON);i&&i.removeEventListener(e,t)}propagateKey(e){var t;(t=this._listDropdown)==null||t.handleKey(e)}updateActiveDescendant(e){this._targetElement&&D(this._inputElement,!!e,"aria-activedescendant",e)}getTargetElementWidth(e){return this._targetElement||(this._targetElement=this._getTargetElement(e)),this._targetElement.getBoundingClientRect().width}getPopupElement(){var e,t;return(t=(e=this._listDropdown)==null?void 0:e.dropdownElement)!=null?t:null}activateFirstOption(){var e;(e=this._listDropdown)==null||e.activateFirstOption()}activateSelectedOption(){var e;(e=this._listDropdown)==null||e.activateSelectedOption()}activateOptionByIndex(e){var t;(t=this._listDropdown)==null||t.activateOption(e)}getActiveOptionIndex(){var e,t;return(t=(e=this._listDropdown)==null?void 0:e.getActiveOptionIndex())!=null?t:null}clearActiveOption(){var e;(e=this._listDropdown)==null||e.clearActiveOption()}setSelectedOptions(e){if(this._listDropdown){let t=e.map(i=>i.value);this._listDropdown.setSelectedValues(t)}}queueDropdownPositionUpdate(){this.getPopupElement()&&window.requestAnimationFrame(()=>{let e=this.getPopupElement();e==null||e.position()})}_getTargetElement(e){return e?this._component.querySelector(e)||this._getDefaultTargetElement():this._getDefaultTargetElement()}_getDefaultTargetElement(){let e=this._component.querySelector("forge-text-field");if(e&&e.shadowRoot){let i=L(e,se.selectors.ROOT);if(i)return i}let t=this._component.querySelector("forge-chip-field");if(t&&t.shadowRoot){let i=L(t,F.selectors.ROOT);if(i)return i}return this._component.querySelector("input")||this._component}_tryToggleDropdownIconRotation(e){let t=this._component.querySelector(o.selectors.DROPDOWN_ICON);t&&D(t,e,o.attributes.DROPDOWN_ICON_OPEN)}};var de=(e=>(e[e.Option=0]="Option",e[e.Group=1]="Group",e))(de||{});function v(u,d){let e=u.some(i=>h(i)&&T(i)&&i.hasOwnProperty("options")&&(i.hasOwnProperty("text")||i.hasOwnProperty("builder"))),t=u.some(i=>h(i)&&T(i)&&i.hasOwnProperty("label")&&i.hasOwnProperty("value"));return e&&d===1||t&&d===0}function ce(u,d){return u.find(e=>e.value===d)}function b(u,d,e=null){return e?!(e in u.value)||!(e in d)?!1:w(u.value[e],d[e]):w(u.value,d)}var I=class extends ae{constructor(e){super();this._adapter=e;this._isInitialized=!1;this._isDropdownOpen=!1;this._mode="default";this._multiple=!1;this._debounce=o.numbers.DEFAULT_DEBOUNCE_TIME;this._allowUnmatched=!1;this._filterOnFocus=!0;this._filterFocusFirst=!0;this._options=[];this._filterText="";this._selectedOptions=[];this._values=[];this._pendingFilterPromises=[];this._matchKey=null;this._clickListener=t=>this._onClick(t),this._focusListener=()=>this._onFocus(),this._blurListener=t=>this._onBlur(t),this._keydownListener=t=>this._onKeydown(t),this._dropdownIconClickListener=t=>this._onDropdownIconClick(t),this._dropdownScrollEndListener=()=>this._onDropdownScrollEnd(),this._dropdownIconMouseDownListener=t=>this._onDropdownIconMouseDown(t),this._clearButtonListener=t=>this._onClear(t),this._dismissListener=()=>this._onDismiss(),this._activeChangeListener=t=>this._adapter.updateActiveDescendant(t),this._targetWidthCallback=()=>this._adapter.getTargetElementWidth(this._popupTarget),this._identifier=y()}async initialize(){if(!this._adapter.hasInputElement()&&!this._adapter.setInputElement())throw new Error("An input element is required as a child of the autocomplete component.");if(this._setInputListener(),this._setFilterCallback(),this._attachListeners(),this._initializeAccessibility(),this._values.length){if(!this._selectedOptions.length){try{await this._executeFilter()}catch(e){console.error(e)}this._updateSelectedOptions(this._values)}this._adapter.setSelectedText(this._getSelectedText())}this._isInitialized=!0}disconnect(){this._isInitialized&&(this._detachListeners(),this._isInitialized=!1),this._isDropdownOpen&&this._closeDropdown()}_attachListeners(){this._adapter.addInputListener("click",this._clickListener),this._adapter.addInputListener("focus",this._focusListener),this._adapter.addInputListener("blur",this._blurListener),this._adapter.addInputListener("input",this._inputListener),this._adapter.addInputListener("keydown",this._keydownListener),this._adapter.setDropdownIconListener("click",this._dropdownIconClickListener),this._adapter.setDropdownIconListener("mousedown",this._dropdownIconMouseDownListener),this._adapter.setClearButtonListener("click",this._clearButtonListener)}_detachListeners(){this._adapter.removeInputListener("click",this._clickListener),this._adapter.removeInputListener("focus",this._focusListener),this._adapter.removeInputListener("blur",this._blurListener),this._adapter.removeInputListener("input",this._inputListener),this._adapter.removeInputListener("keydown",this._keydownListener),this._adapter.removeDropdownIconListener("click",this._dropdownIconClickListener),this._adapter.removeDropdownIconListener("mousedown",this._dropdownIconMouseDownListener),this._adapter.removeClearButtonListener("click",this._clearButtonListener)}_setInputListener(){this._inputListener=e=>this._onInput(e)}_setFilterCallback(){this._filterFn=h(this._debounce)&&this._debounce>0?P(this._debounceFilter,this._debounce,!1):this._debounceFilter}_initializeAccessibility(){this._adapter.initializeInputAccessibility(this._identifier)}get _flatOptions(){return v(this._options,1)?this._options.reduce((e,t)=>e.concat(t.options),[]):this._options}_onClick(e){!this._isDropdownOpen&&this._filterOnFocus&&this._showDropdown()}_onDropdownIconMouseDown(e){e.preventDefault()}_onDropdownIconClick(e){this._isDropdownOpen?this._closeDropdown():(this._adapter.focus(),window.requestAnimationFrame(()=>this._showDropdown()))}_onClear(e){this._clearValue(),this._adapter.setSelectedText(this._getSelectedText())}_onDropdownScrollEnd(){this._adapter.emitHostEvent(o.events.SCROLLED_BOTTOM)}_onFocus(){!this._isDropdownOpen&&this._adapter.getInputValue()&&!A.isMobile&&this._adapter.selectInputValue()}_onBlur(e){this._adapter.isFocusWithinPopup(e.relatedTarget)||this._applyBlur()}_applyBlur(){this._isDropdownOpen&&this._closeDropdown(),this._mode!=="stateless"&&(this._selectedOptions.length?this._adapter.setSelectedText(this._getSelectedText()):this._allowUnmatched||(this._filterText="",this._adapter.setSelectedText("")))}_onInput(e){this._selectedOptions.length&&!this._multiple&&(!this._adapter.getInputValue()||this._allowUnmatched)&&!this._adapter.isWrappingChipField()&&(this._selectedOptions=[],this._values=[],this._emitChangeEvent()),this._filterText=this._adapter.getInputValue(),this._filterFn()}async _debounceFilter({checkFocus:e=!0}={}){if(!e&&!this._adapter.hasFocus()){this._pendingFilterPromises=[],this._isDropdownOpen&&this._closeDropdown();return}let t=this._filterText,i=this._executeFilter();this._pendingFilterPromises.push(i),this._isDropdownOpen?this._adapter.setBusyVisibility(!0):this._showDropdown({filter:!1});try{await i}catch(n){this._pendingFilterPromises=[],this._isDropdownOpen&&this._closeDropdown();return}if(t===this._filterText)this._pendingFilterPromises=[],this._onFilterComplete();else{let n=this._pendingFilterPromises.indexOf(i);n!==-1&&this._pendingFilterPromises.splice(n,1)}}_onKeydown(e){switch(e.key){case"Tab":this._isDropdownOpen&&!this._multiple&&this._selectActiveOption(!1);break;case"Esc":case"Escape":this._isDropdownOpen&&(e.preventDefault(),e.stopPropagation(),this._closeDropdown());break;case"Down":case"ArrowDown":e.preventDefault(),this._isDropdownOpen?this._adapter.propagateKey(e.key):this._showDropdown({activateFirst:!0,activateSelected:!0});break;case"Up":case"ArrowUp":e.preventDefault(),this._isDropdownOpen&&this._adapter.propagateKey(e.key);break;case"Enter":case"Home":case"End":this._isDropdownOpen&&(e.key==="Enter"&&e.stopPropagation(),e.preventDefault(),this._adapter.propagateKey(e.key));break;case"Backspace":case"Delete":let t=e.target,i=this._adapter.getInputValue(),n=t.value.substring(t.selectionStart,t.selectionEnd)===t.value,l=i.length===1&&t.selectionEnd===1,c=i.length===1&&t.selectionEnd===0,_=!i||n||l||c;!this._adapter.isWrappingChipField()&&_&&!this._multiple&&this._values.length&&this._clearValue();break}}_executeFilter(e=!0,t=!1){if(!this._filter||typeof this._filter!="function")throw new Error('A filter callback must be provided. Did you set the "filter" property?');let i=this._filter,n=e?this._filterText:"",l=t?this._getValue():null;return new Promise((c,_)=>Promise.resolve(i(n,l)).then(r=>{this._options=r,c(this._options)}).catch(r=>_(`An unexpected error occurred while filtering: ${r}`)))}_onFilterComplete(){if(!this._adapter.hasFocus()){this._isDropdownOpen&&this._closeDropdown();return}if(this._options.length){let e=this._allowUnmatched&&!this._selectedOptions.length;this._dropdownReady({userTriggered:e}),this._filterFocusFirst&&this._filterText&&this._adapter.activateFirstOption()}else this._closeDropdown()}_clearValue(){this._selectedOptions=[],this._values=[],this._isDropdownOpen&&(this._adapter.setSelectedOptions([]),this._adapter.clearActiveOption()),this._emitChangeEvent()}async _showDropdown({filter:e=!0,userTriggered:t=!0,activateFirst:i=!1,activateSelected:n=!1}={}){let l=this._allowUnmatched&&!this._selectedOptions.length;this._isDropdownOpen=!0;let c;if(this._optionBuilder){let r=this._optionBuilder;c=(m,_e)=>r(m,this._filterText,_e)}let _={options:this._options,multiple:this._multiple,selectedValues:[...this._values],id:`forge-autocomplete-${this._identifier}`,asyncStyle:"skeleton",optionLimit:this._optionLimit,popupClasses:this._popupClasses,headerBuilder:this._popupHeaderBuilder,footerBuilder:this._popupFooterBuilder,transform:r=>{if(this._filterText){let m=$(r,this._filterText);if(m)return m}return r},allowBusy:!0,optionBuilder:c,syncWidth:this._syncPopupWidth,observeScroll:this._observeScroll,observeScrollThreshold:this._observeScrollThreshold,scrollEndListener:this._dropdownScrollEndListener,activeChangeCallback:this._activeChangeListener,targetWidthCallback:this._targetWidthCallback,selectCallback:r=>this._onSelect(r),closeCallback:()=>this._closeDropdown()};if(this._adapter.show(_,this._popupTarget),this._adapter.toggleHostAttribute(o.attributes.OPEN,this._isDropdownOpen),e){this._options.length&&this._adapter.setBusyVisibility(!0);try{await this._executeFilter(l)}catch(r){console.error(r)}this._updateSelectedOptions(this._values)}this._pendingFilterPromises.length||this._dropdownReady({userTriggered:t,activateFirst:i,activateSelected:n})}_dropdownReady({userTriggered:e=!0,activateFirst:t=!1,activateSelected:i=!1}={}){if(!this._isDropdownOpen||!this._options.length||e&&!this._adapter.hasFocus()){this._closeDropdown();return}this._sortSelectedOptions(),this._adapter.setBusyVisibility(!1),this._adapter.setOptions(this._options),this._adapter.setSelectedOptions(this._selectedOptions),this._adapter.setDismissListener(this._dismissListener),i&&this._selectedOptions.length?this._adapter.activateSelectedOption():t&&this._adapter.activateFirstOption()}_closeDropdown(){this._multiple&&(this._filterText=""),this._isDropdownOpen=!1,this._adapter.hide(this._dismissListener),this._sortSelectedOptions(),this._adapter.toggleHostAttribute(o.attributes.OPEN,this._isDropdownOpen)}_sortSelectedOptions(){if(this._multiple&&this._selectedOptions.length&&v(this._options,0)){let e=[],t=[];this._options.forEach(i=>{this._selectedOptions.find(n=>b(n,i.value,this._matchKey))?e.push(i):t.push(i)}),this._options=[...e,...t]}}async _onSelect(e,t=!0){if(this._valueChanging)return;if(this._mode==="stateless"){let n={value:e};this._adapter.emitHostEvent(o.events.SELECT,n,!0,!0)&&(this._filterText="",this._multiple||this._closeDropdown());return}let i=()=>{let l=this._flatOptions.find(r=>b(r,e,this._matchKey)),c=l?l.value:"",_=l?l.label:"";if(this._multiple){let r=ce(this._selectedOptions,c);if(r){let m=this._selectedOptions.indexOf(r);this._selectedOptions.splice(m,1)}else this._selectedOptions.push(l)}else h(c)?(this._selectedOptions[0]=l,this._filterText=_):(this._selectedOptions=[],this._filterText="");this._isDropdownOpen&&this._adapter.setSelectedOptions(this._selectedOptions),this._values=this._selectedOptions.map(r=>r.value),this._adapter.setSelectedText(this._getSelectedText()),!A.isMobile&&t&&this._adapter.selectInputValue(),this._emitChangeEvent(),this._tryUpdateDropdownPosition()};this._isDropdownOpen&&!this._multiple&&this._closeDropdown(),typeof this._beforeValueChange=="function"?(this._valueChanging=Promise.resolve(this._beforeValueChange.call(null,e,this._matchKey)),await this._valueChanging?i():this._tryUpdateDropdownPosition(),this._valueChanging=void 0):i()}_selectActiveOption(e=!0){let t=this._adapter.getActiveOptionIndex();if(typeof t=="number"&&t>=0){let i=this._flatOptions[t];i&&this._onSelect(i.value,e)}}_emitChangeEvent(){this._adapter.emitHostEvent(o.events.CHANGE,this._getValue(),!0)}_tryUpdateDropdownPosition(){this._isDropdownOpen&&this._adapter.queueDropdownPositionUpdate()}_getValue(){return this._values?this._values.length?this._multiple?[...this._values]:this._values[0]:this._multiple?[]:null:null}_getSelectedText(){var e,t;return this._adapter.isWrappingChipField()?"":this._selectedTextBuilder?this._selectedTextBuilder(this._selectedOptions):this._multiple?this._values.length?this._values.length===1?(t=(e=this._selectedOptions[0])==null?void 0:e.label)!=null?t:"":`${this._values.length} options selected`:"":this._selectedOptions.filter(i=>i&&i.label).map(i=>i.label).join(" ").trim()}_onDismiss(){this._closeDropdown()}async _applyValue(e){let t=[];this._selectedOptions=[],Array.isArray(e)?t=e:t=h(e)?[e]:[],!this._multiple&&t.length>1&&(t=[t[0]]),v(t,0)?(this._values=t.map(n=>n.value),this._selectedOptions=t):this._values=t;let i=this._flatOptions;if(t.length&&i.length&&this._updateSelectedOptions(t),this._values.length&&!this._selectedOptions.length&&this._filter&&this._isInitialized){try{await this._executeFilter(!1,!0)}catch(n){console.error(n)}this._updateSelectedOptions(this._values)}this._multiple?this._filterText="":this._filterText=this._selectedOptions.length?this._selectedOptions[0].label:"",this._isInitialized&&this._adapter.setSelectedText(this._getSelectedText()),this._isDropdownOpen&&this._adapter.setSelectedOptions(this._selectedOptions)}_updateSelectedOptions(e){let t=[...this._flatOptions,...this._selectedOptions];if(this._selectedOptions.length&&(this._selectedOptions=[]),v(e,0))for(let i of e){let n=t.find(l=>b(l,i.value,this._matchKey));n?this._selectedOptions.push(n):this._selectedOptions.push(i)}else for(let i of e){let n=t.find(l=>b(l,i,this._matchKey));n?this._selectedOptions.push(n):this._allowUnmatched&&this._selectedOptions.push({label:i,value:i})}}get mode(){return this._mode}set mode(e){this._mode!==e&&(this._mode=e,this._mode==="stateless"&&(this._selectedOptions=[],this._isDropdownOpen&&this._closeDropdown()),this._adapter.setHostAttribute(o.attributes.MODE,this._mode))}get multiple(){return this._multiple}set multiple(e){this._multiple!==e&&(this._multiple=e,this._adapter.setHostAttribute(o.attributes.MULTIPLE,h(this._multiple)?this._multiple.toString():""))}get value(){return this._getValue()}set value(e){let t=[];e==null?t=[]:Array.isArray(e)?t=JSON.parse(JSON.stringify(e)):x(e)?t=[e]:t=[JSON.parse(JSON.stringify(e))],(t.length!==this._values.length||t.some(n=>!this._values.includes(n)))&&this._applyValue(e)}get filterOnFocus(){return this._filterOnFocus}set filterOnFocus(e){this._filterOnFocus!==e&&(this._filterOnFocus=e,this._adapter.setHostAttribute(o.attributes.FILTER_ON_FOCUS,h(this._filterOnFocus)?this._filterOnFocus.toString():""))}get filterFocusFirst(){return this._filterFocusFirst}set filterFocusFirst(e){this._filterFocusFirst!==e&&(this._filterFocusFirst=e,this._adapter.toggleHostAttribute(o.attributes.FILTER_FOCUS_FIRST,this._filterFocusFirst))}get allowUnmatched(){return this._allowUnmatched}set allowUnmatched(e){this._allowUnmatched!==e&&(this._allowUnmatched=e,h(this._allowUnmatched)&&this._adapter.setHostAttribute(o.attributes.ALLOW_UNMATCHED,this._allowUnmatched.toString()))}get matchKey(){return this._matchKey}set matchKey(e){this._matchKey!==e&&(this._matchKey=e)}get popupTarget(){return this._popupTarget}set popupTarget(e){this._popupTarget!==e&&(this._popupTarget=e)}get filterText(){return this._filterText}set filterText(e){this._filterText!==e&&(this._filterText=this._allowUnmatched?e:"",this._isInitialized&&this._allowUnmatched&&(this._adapter.setInputValue(this._filterText),this._isDropdownOpen&&this._debounceFilter({checkFocus:!1})))}get popupClasses(){return Array.isArray(this._popupClasses)?[...this._popupClasses]:[this._popupClasses]}set popupClasses(e){this._popupClasses!==e&&(this._popupClasses=Array.isArray(e)?[...e]:[e])}set popupHeaderBuilder(e){this._popupHeaderBuilder=e}set popupFooterBuilder(e){this._popupFooterBuilder=e}get syncPopupWidth(){return this._syncPopupWidth}set syncPopupWidth(e){this._syncPopupWidth!==e&&(this._syncPopupWidth=e)}get optionLimit(){return this._optionLimit}set optionLimit(e){this._optionLimit!==e&&(this._optionLimit=e)}get debounce(){return this._debounce}set debounce(e){this._debounce!==e&&(this._debounce=e,this._isInitialized&&this._setFilterCallback(),this._adapter.setHostAttribute(o.attributes.DEBOUNCE,h(this._debounce)?this._debounce.toString():""))}get optionBuilder(){return this._optionBuilder}set optionBuilder(e){this._optionBuilder=e}get filter(){return this._filter}set filter(e){this._filter!==e&&(this._filter=e,this._isInitialized&&this._values.length&&!this._flatOptions.length&&this._filter&&this._executeFilter().then(()=>{this._updateSelectedOptions(this._values),this._adapter.setSelectedText(this._getSelectedText())}))}get selectedTextBuilder(){return this._selectedTextBuilder}set selectedTextBuilder(e){this._selectedTextBuilder=e,this._selectedOptions.length&&this._adapter.setSelectedText(this._getSelectedText())}get observeScroll(){return this._observeScroll}set observeScroll(e){this._observeScroll=e}get observeScrollThreshold(){return this._observeScrollThreshold}set observeScrollThreshold(e){this._observeScrollThreshold=e}appendOptions(e){this._isDropdownOpen&&(this._options=[...this._options,...e],this._adapter.appendOptions(e))}get isInitialized(){return this._isInitialized}get open(){return this._isDropdownOpen}set open(e){this._isDropdownOpen!==e&&(e?this._showDropdown({userTriggered:!1}):this._closeDropdown())}get beforeValueChange(){return this._beforeValueChange}set beforeValueChange(e){e!==this._beforeValueChange&&(this._beforeValueChange=e)}get popupElement(){return this._adapter.getPopupElement()}};var ge="<template><slot></slot></template>",Oe=":host{display:block}:host([hidden]){display:none}",s=class extends te{constructor(){super();Y.define([W,q,K]),U(this,ge,Oe),this._foundation=new I(new O(this))}static get observedAttributes(){return[o.attributes.MODE,o.attributes.MULTIPLE,o.attributes.DEBOUNCE,o.attributes.FILTER_ON_FOCUS,o.attributes.FILTER_FOCUS_FIRST,o.attributes.ALLOW_UNMATCHED,o.attributes.POPUP_TARGET,o.attributes.POPUP_CLASSES,o.attributes.OBSERVE_SCROLL,o.attributes.OBSERVE_SCROLL_THRESHOLD,o.attributes.OPTION_LIMIT,o.attributes.SYNC_POPUP_WIDTH,o.attributes.OPEN,o.attributes.MATCH_KEY,o.attributes.FILTER_TEXT]}connectedCallback(){this.querySelector(o.selectors.INPUT)?this._foundation.initialize():B(this,o.selectors.INPUT).then(()=>this._foundation.initialize())}disconnectedCallback(){this._foundation.disconnect()}attributeChangedCallback(e,t,i){switch(super.attributeChangedCallback(e,t,i),e){case o.attributes.MODE:this.mode=i;break;case o.attributes.MULTIPLE:this.multiple=f(i);break;case o.attributes.DEBOUNCE:this.debounce=S(i);break;case o.attributes.FILTER_ON_FOCUS:this.filterOnFocus=f(i);break;case o.attributes.FILTER_FOCUS_FIRST:this.filterFocusFirst=f(i);break;case o.attributes.ALLOW_UNMATCHED:this.allowUnmatched=f(i);break;case o.attributes.POPUP_TARGET:this.popupTarget=i;break;case o.attributes.OPEN:this.open=f(i);break;case o.attributes.MATCH_KEY:this.matchKey=i;break;case o.attributes.FILTER_TEXT:this.filterText=i;break}}appendOptions(e){this._foundation.appendOptions(e)}openDropdown(){this.open=!0}closeDropdown(){this.open=!1}};p([a()],s.prototype,"mode",2),p([a()],s.prototype,"multiple",2),p([a()],s.prototype,"value",2),p([a()],s.prototype,"debounce",2),p([a()],s.prototype,"filterOnFocus",2),p([a()],s.prototype,"filterFocusFirst",2),p([a()],s.prototype,"allowUnmatched",2),p([a()],s.prototype,"popupTarget",2),p([a()],s.prototype,"filterText",2),p([a()],s.prototype,"optionBuilder",2),p([a()],s.prototype,"filter",2),p([a()],s.prototype,"selectedTextBuilder",2),p([a()],s.prototype,"open",2),p([a()],s.prototype,"matchKey",2),p([a({set:!1})],s.prototype,"isInitialized",2),p([a({set:!1})],s.prototype,"popupElement",2),p([a()],s.prototype,"beforeValueChange",2),s=p([H({name:o.elementName,dependencies:[re,ie,ee,Z,j,oe,Q,X]})],s);var he=class extends z{constructor(e){super(e)}_build(){let e=document.createElement(o.elementName);return this._attachTextField(e),e}get textFieldDelegate(){return this._textFieldDelegate}get value(){return this._element.value}set value(e){this._element.value=e}get disabled(){return this._textFieldDelegate.inputElement.disabled}set disabled(e){this._textFieldDelegate.inputElement.disabled=e}get invalid(){return this._textFieldDelegate.invalid||!1}set invalid(e){this._textFieldDelegate.invalid=e}onChange(e){this._element.addEventListener(o.events.CHANGE,t=>e(t.detail))}onFocus(e){this._textFieldDelegate.inputElement.addEventListener("focus",t=>e(t))}onBlur(e){this._textFieldDelegate.inputElement.addEventListener("blur",t=>e(t))}_attachTextField(e){var i,n,l,c,_,r;let t={props:E({},(n=(i=this._config.options)==null?void 0:i.textFieldDelegateConfig)==null?void 0:n.props),options:E({},(c=(l=this._config.options)==null?void 0:l.textFieldDelegateConfig)==null?void 0:c.options)};t.options||(t.options={}),((_=this._config.options)==null?void 0:_.useDropdownIcon)!==!1&&!((r=t.options)!=null&&r.trailingElement)&&(t.options.trailingElement=this._createDropdownIconElement()),this._textFieldDelegate=new le(t),e.appendChild(this._textFieldDelegate.element)}_createDropdownIconElement(){let e={props:{slot:"trailing",name:"arrow_drop_down"},options:{attributes:{"forge-dropdown-icon":""}}};return new J(e).element}};function Gt(){k(s)}export{o as a,ue as b,O as c,de as d,v as e,ce as f,b as g,I as h,s as i,he as j,Gt as k};
|
|
7
|
+
//# sourceMappingURL=chunk.VI2GRQO3.js.map
|
|
@@ -3,5 +3,5 @@
|
|
|
3
3
|
* Copyright 2023 Tyler Technologies, Inc.
|
|
4
4
|
* License: Apache-2.0
|
|
5
5
|
*/
|
|
6
|
-
import{b as N}from"./chunk.PHTOULRR.js";import{b as F,c as S}from"./chunk.A5R7KUIP.js";import{A as m,k as d}from"./chunk.FYWPZFLJ.js";import{d as h}from"./chunk.H5D54EHO.js";import{a as A}from"./chunk.G4IN6Y46.js";import{a as E}from"./chunk.NVUMRW44.js";import{a as C}from"./chunk.5V5ABSHI.js";import{a as B,b as L}from"./chunk.DTZFWZPB.js";import{a as I,e as T,f as c,k as D}from"./chunk.NK7H3MMM.js";import{k as f}from"./chunk.J2M2MXP2.js";import{a as _,b as x,d as p}from"./chunk.M3QDAYD2.js";var R=`${L}quantity-field`,q={INVALID:"invalid",REQUIRED:"required",DISABLED:"disabled"},O={ROOT:"forge-quantity-field",INVALID:"forge-quantity-field--invalid",REQUIRED:"forge-quantity-field--required"},a={INCREMENT_BUTTON:"increment-button",DECREMENT_BUTTON:"decrement-button",LABEL:"label",HELPER_TEXT:"helper-text"},w={ROOT:`.${O.ROOT}`,INCREMENT_BUTTON_SLOT:`slot[name=${a.INCREMENT_BUTTON}]`,DECREMENT_BUTTON_SLOT:`slot[name=${a.DECREMENT_BUTTON}]`,INCREMENT_BUTTON:`[slot=${a.INCREMENT_BUTTON}] button, button[slot=${a.INCREMENT_BUTTON}]`,DECREMENT_BUTTON:`[slot=${a.DECREMENT_BUTTON}] button, button[slot=${a.DECREMENT_BUTTON}]`,TEXT_FIELD:"forge-text-field",INPUT:"input[type=number]",LABEL:`[slot=${a.LABEL}]`,HELPER_TEXT:`[slot=${a.HELPER_TEXT}]`},i={elementName:R,classes:O,slots:a,selectors:w,attributes:q};var v=class extends C{constructor(t){super(t);this._rootElement=c(t,i.selectors.ROOT),this._incrementButtonSlot=c(this._component,i.selectors.INCREMENT_BUTTON_SLOT),this._decrementButtonSlot=c(this._component,i.selectors.DECREMENT_BUTTON_SLOT)}initializeButtons(){this._incrementButton&&!this._incrementButton.hasAttribute("tabindex")&&(this._incrementButton.tabIndex=-1),this._decrementButton&&!this._decrementButton.hasAttribute("tabindex")&&(this._decrementButton.tabIndex=-1)}addRootClass(t){this._rootElement.classList.add(t)}removeRootClass(t){this._rootElement.classList.remove(t)}inputHasAttribute(t){return this.inputElement?this.inputElement.hasAttribute(t):!1}addIncrementButtonSlotListener(t){this._incrementButtonSlot.addEventListener("slotchange",t)}removeIncrementButtonSlotListener(t){this._incrementButtonSlot&&this._incrementButtonSlot.removeEventListener("slotchange",t)}addDecrementButtonSlotListener(t){this._decrementButtonSlot.addEventListener("slotchange",t)}removeDecrementButtonSlotListener(t){this._decrementButtonSlot&&this._decrementButtonSlot.removeEventListener("slotchange",t)}addTextFieldAttribute(t,e=""){this._textFieldComponent&&this._textFieldComponent.setAttribute(t,e)}removeTextFieldAttribute(t){this._textFieldComponent&&this._textFieldComponent.removeAttribute(t)}addIncrementEventListener(t,e){this._incrementButtonElement.addEventListener(t,e)}removeIncrementEventListener(t,e){this._incrementButtonElement&&this._incrementButtonElement.removeEventListener(t,e)}addDecrementEventListener(t,e){this._decrementButtonElement.addEventListener(t,e)}removeDecrementEventListener(t,e){this._decrementButtonElement&&this._decrementButtonElement.removeEventListener(t,e)}addIncrementButtonAttribute(t,e=""){this._incrementButtonElement.setAttribute(t,e)}removeIncrementButtonAttribute(t){this._incrementButtonElement.removeAttribute(t)}addDecrementButtonAttribute(t,e=""){this._decrementButtonElement.setAttribute(t,e)}removeDecrementButtonAttribute(t){this._decrementButtonElement.removeAttribute(t)}increment(){let t=this.inputElement;if(!t)return;let e=+t.value,n=this._calcPrecision(this._inputStep),o=parseFloat((e+this._inputStep).toFixed(n));this._inputMax&&this._inputMax<o&&(o=this._inputMax),this._setInputValue(o)}decrement(){let t=this.inputElement;if(!t)return;let e=+t.value,n=this._calcPrecision(this._inputStep),o=parseFloat((e-this._inputStep).toFixed(n));this._inputMin&&this._inputMin>o&&(o=this._inputMin),this._setInputValue(o)}addInputDisabledAttributeChangeListener(t){this._setupInputDisabledAttributeMutationObserver(t)}removeInputDisabledAttributeChangeListener(){this._cleanupInputDisabledAttributeMutationObserver()}_setInputValue(t){this.inputElement&&(this.inputElement.value=`${t}`,this.inputElement.dispatchEvent(new Event("input")),this.inputElement.dispatchEvent(new Event("change")))}_isNullOrUndefinedOrEmpty(t){return t==null||t===""}_setupInputDisabledAttributeMutationObserver(t){if(!this.inputElement)return;this._cleanupInputDisabledAttributeMutationObserver();let e=o=>this._inputDisabledAttributeMutationCallback(o,t);this._inputAttributeMutationObserver=new MutationObserver(e);let n={attributes:!0,attributeOldValue:!0,attributeFilter:[i.attributes.DISABLED]};this._inputAttributeMutationObserver.observe(this.inputElement,n)}_cleanupInputDisabledAttributeMutationObserver(){this._inputAttributeMutationObserver&&(this._inputAttributeMutationObserver.disconnect(),delete this._inputAttributeMutationObserver)}_inputDisabledAttributeMutationCallback(t,e){for(let n of t)n.type!=="attributes"||!n.attributeName||n.attributeName!==i.attributes.DISABLED||n.target[n.attributeName]===n.oldValue||e()}get _incrementButtonElement(){return this._incrementButton||(this._incrementButton=this._component.querySelector(i.selectors.INCREMENT_BUTTON)),this._incrementButton}get _decrementButtonElement(){return this._decrementButton||(this._decrementButton=this._component.querySelector(i.selectors.DECREMENT_BUTTON)),this._decrementButton}get _textFieldComponent(){return this._textField||(this._textField=this._component.querySelector(i.selectors.TEXT_FIELD)),this._textField}get inputElement(){return this._inputElement||(this._inputElement=this._component.querySelector(i.selectors.INPUT)),this._inputElement}get _inputStep(){let t=this.inputElement;return!t||this._isNullOrUndefinedOrEmpty(t.step)?1:+t.step}get _inputMax(){let t=this.inputElement;return!t||this._isNullOrUndefinedOrEmpty(t.max)?null:+t.max}get _inputMin(){let t=this.inputElement;return!t||this._isNullOrUndefinedOrEmpty(t.min)?null:+t.min}_calcPrecision(t){let e=String(t);return e.includes(".")?e.split(".")[1].length:0}};var b=class{constructor(r){this._adapter=r;this._incrementValue=()=>this._adapter.increment(),this._decrementValue=()=>this._adapter.decrement(),this._incrementButtonSlotChanged=()=>this._onIncrementButtonSlotChanged(),this._decrementButtonSlotChanged=()=>this._onDecrementButtonSlotChanged(),this._adapter.addIncrementButtonSlotListener(this._incrementButtonSlotChanged),this._adapter.addDecrementButtonSlotListener(this._decrementButtonSlotChanged)}connect(){this._adapter.addInputDisabledAttributeChangeListener(()=>this._syncDisabledStateOfButtons()),this._syncDisabledStateOfButtons(),this._adapter.initializeButtons()}disconnect(){this._removeIncrementEventListener(),this._removeDecrementEventListener(),this._removeIncrementButtonSlotListener(),this._removeDecrementButtonSlotListener(),this._adapter.removeInputDisabledAttributeChangeListener()}_onIncrementButtonSlotChanged(){this._addIncrementEventListener()}_onDecrementButtonSlotChanged(){this._addDecrementEventListener()}_addIncrementEventListener(){this._adapter.addIncrementEventListener("click",this._incrementValue)}_addDecrementEventListener(){this._adapter.addDecrementEventListener("click",this._decrementValue)}_removeIncrementEventListener(){this._adapter.removeIncrementEventListener("click",this._incrementValue)}_removeDecrementEventListener(){this._adapter.removeDecrementEventListener("click",this._decrementValue)}_removeIncrementButtonSlotListener(){this._adapter.removeIncrementButtonSlotListener(this._incrementButtonSlotChanged)}_removeDecrementButtonSlotListener(){this._adapter.removeDecrementButtonSlotListener(this._decrementButtonSlotChanged)}_syncDisabledStateOfButtons(){this._adapter.inputHasAttribute(i.attributes.DISABLED)?(this._adapter.addDecrementButtonAttribute(i.attributes.DISABLED),this._adapter.addIncrementButtonAttribute(i.attributes.DISABLED)):(this._adapter.removeIncrementButtonAttribute(i.attributes.DISABLED),this._adapter.removeDecrementButtonAttribute(i.attributes.DISABLED))}get required(){return this._required}set required(r){this._required!==r&&(this._required=r,this._required?(this._adapter.setHostAttribute(i.attributes.REQUIRED),this._adapter.addRootClass(i.classes.REQUIRED)):(this._adapter.removeHostAttribute(i.attributes.REQUIRED),this._adapter.removeRootClass(i.classes.REQUIRED)))}get invalid(){return this._invalid}set invalid(r){this._invalid!==r&&(this._invalid=r,this._invalid?(this._adapter.setHostAttribute(i.attributes.INVALID),this._adapter.addRootClass(i.classes.INVALID),this._adapter.addTextFieldAttribute(i.attributes.INVALID)):(this._adapter.removeHostAttribute(i.attributes.INVALID),this._adapter.removeRootClass(i.classes.INVALID),this._adapter.removeTextFieldAttribute(i.attributes.INVALID)))}};var U='<template><div class="forge-quantity-field" part="root"><slot name="label"></slot><div class="forge-quantity-field__row" part="row"><slot name="decrement-button"></slot><slot></slot><slot name="increment-button"></slot></div><slot name="helper-text"></slot></div></template>',k='.forge-quantity-field ::slotted([slot=label]){-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;font-family:Roboto,sans-serif;font-family:var(--mdc-typography-caption-font-family, var(--mdc-typography-font-family, Roboto, sans-serif));font-size:.75rem;font-size:var(--mdc-typography-caption-font-size, .75rem);line-height:1.25rem;line-height:var(--mdc-typography-caption-line-height, 1.25rem);font-weight:400;font-weight:var(--mdc-typography-caption-font-weight,400);letter-spacing:.0333333333em;letter-spacing:var(--mdc-typography-caption-letter-spacing, .0333333333em);text-decoration:inherit;-webkit-text-decoration:var(--mdc-typography-caption-text-decoration,inherit);text-decoration:var(--mdc-typography-caption-text-decoration,inherit);text-transform:inherit;text-transform:var(--mdc-typography-caption-text-transform,inherit);color:rgba(0,0,0,.54);color:var(--mdc-theme-text-secondary-on-background,rgba(0,0,0,.54))}.forge-quantity-field ::slotted([slot=helper-text]){-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;font-family:Roboto,sans-serif;font-family:var(--mdc-typography-caption-font-family, var(--mdc-typography-font-family, Roboto, sans-serif));font-size:.75rem;font-size:var(--mdc-typography-caption-font-size, .75rem);line-height:1.25rem;line-height:var(--mdc-typography-caption-line-height, 1.25rem);font-weight:400;font-weight:var(--mdc-typography-caption-font-weight,400);letter-spacing:.0333333333em;letter-spacing:var(--mdc-typography-caption-letter-spacing, .0333333333em);text-decoration:inherit;-webkit-text-decoration:var(--mdc-typography-caption-text-decoration,inherit);text-decoration:var(--mdc-typography-caption-text-decoration,inherit);text-transform:inherit;text-transform:var(--mdc-typography-caption-text-transform,inherit);height:1rem;color:rgba(0,0,0,.54);color:var(--mdc-theme-text-secondary-on-background,rgba(0,0,0,.54))}.forge-quantity-field ::slotted([slot=helper-text])::before{display:inline-block;width:0;height:16px;content:"";vertical-align:0}.forge-quantity-field__row{display:-webkit-box;display:flex;-webkit-box-orient:horizontal;-webkit-box-direction:normal;flex-direction:row;-webkit-box-align:center;align-items:center}.forge-quantity-field ::slotted(forge-icon-button:first-of-type){color:var(--mdc-theme-text-secondary-on-light);margin-right:4px}.forge-quantity-field ::slotted(forge-icon-button:last-of-type){color:var(--mdc-theme-text-secondary-on-light);margin-left:4px}.forge-quantity-field ::slotted(forge-text-field){--forge-text-field-margin-top:0;--forge-text-field-margin-bottom:0}.forge-quantity-field--required ::slotted([slot=label])::before{color:#b00020;color:var(--mdc-theme-error,#b00020);content:"*";margin-right:4px}.forge-quantity-field--invalid ::slotted([slot=label]){-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;font-family:Roboto,sans-serif;font-family:var(--mdc-typography-caption-font-family, var(--mdc-typography-font-family, Roboto, sans-serif));font-size:.75rem;font-size:var(--mdc-typography-caption-font-size, .75rem);line-height:1.25rem;line-height:var(--mdc-typography-caption-line-height, 1.25rem);font-weight:400;font-weight:var(--mdc-typography-caption-font-weight,400);letter-spacing:.0333333333em;letter-spacing:var(--mdc-typography-caption-letter-spacing, .0333333333em);text-decoration:inherit;-webkit-text-decoration:var(--mdc-typography-caption-text-decoration,inherit);text-decoration:var(--mdc-typography-caption-text-decoration,inherit);text-transform:inherit;text-transform:var(--mdc-typography-caption-text-transform,inherit);color:#b00020;color:var(--mdc-theme-error,#b00020)}.forge-quantity-field--invalid ::slotted([slot=helper-text]){-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;font-family:Roboto,sans-serif;font-family:var(--mdc-typography-caption-font-family, var(--mdc-typography-font-family, Roboto, sans-serif));font-size:.75rem;font-size:var(--mdc-typography-caption-font-size, .75rem);line-height:1.25rem;line-height:var(--mdc-typography-caption-line-height, 1.25rem);font-weight:400;font-weight:var(--mdc-typography-caption-font-weight,400);letter-spacing:.0333333333em;letter-spacing:var(--mdc-typography-caption-letter-spacing, .0333333333em);text-decoration:inherit;-webkit-text-decoration:var(--mdc-typography-caption-text-decoration,inherit);text-decoration:var(--mdc-typography-caption-text-decoration,inherit);text-transform:inherit;text-transform:var(--mdc-typography-caption-text-transform,inherit);height:1rem;color:#b00020;color:var(--mdc-theme-error,#b00020)}.forge-quantity-field--invalid ::slotted([slot=helper-text])::before{display:inline-block;width:0;height:16px;content:"";vertical-align:0}:host{display:inline-block}:host([hidden]){display:none}',s=class extends D{constructor(){super();T(this,U,k),this._foundation=new b(new v(this)),h.define([m,d])}static get observedAttributes(){return[i.attributes.INVALID,i.attributes.REQUIRED]}connectedCallback(){this._requiredElementsPresent()?this._foundation.connect():this._ensureElementsPresent().then(()=>{this._foundation.connect()})}disconnectedCallback(){this._foundation.disconnect()}attributeChangedCallback(t,e,n){switch(t){case i.attributes.INVALID:this.invalid=f(n);break;case i.attributes.REQUIRED:this.required=f(n);break}}_ensureElementsPresent(){return new Promise(t=>{if(this._requiredElementsPresent()){t();return}let e=new MutationObserver(n=>{n.reduce((l,u)=>l+u.addedNodes.length,0)>0&&this._requiredElementsPresent()&&(e.disconnect(),t())});e.observe(this,{childList:!0,subtree:!0})})}_requiredElementsPresent(){let t=this.querySelector(i.selectors.INPUT),e=this.querySelector(i.selectors.DECREMENT_BUTTON),n=this.querySelector(i.selectors.INCREMENT_BUTTON);return!!t&&!!e&&!!n}};p([E()],s.prototype,"invalid",2),p([E()],s.prototype,"required",2),s=p([B({name:i.elementName,dependencies:[F]})],s);var M=class extends A{constructor(t){super(t);h.define([m,d])}_build(){let t=document.createElement(i.elementName);return this._attachButton(t,m.name,"decrement-button"),this._attachTextField(t),this._attachButton(t,d.name,"increment-button"),t}_configure(){var t,e,n,o,l;this.inputElement.value=(e=(t=this._config.options)==null?void 0:t.value)!=null?e:"0",this.inputElement.style.textAlign="center",this.inputElement.style.width="64px",(n=this._config.options)!=null&&n.helperText&&this.setHelperText(this._config.options.helperText),typeof((o=this._config.options)==null?void 0:o.label)=="string"&&this._createLabel(this._config.options.label),((l=this._config.options)==null?void 0:l.step)!==void 0&&(this.inputElement.step=this._config.options.step)}get value(){return this._textFieldDelegate.inputElement.value}set value(t){this._textFieldDelegate.inputElement.value=t}get disabled(){return this._textFieldDelegate.inputElement.disabled}set disabled(t){this._textFieldDelegate.inputElement.disabled=t}get invalid(){return this._element.invalid||!1}set invalid(t){this._element.invalid=t}get inputElement(){return this._textFieldDelegate.inputElement}get labelElement(){return this._labelElement}onChange(t){this._textFieldDelegate.inputElement.addEventListener("input",e=>t(e.target.value))}onFocus(t){this._textFieldDelegate.inputElement.addEventListener("focus",e=>t(e))}onBlur(t){this._textFieldDelegate.inputElement.addEventListener("blur",e=>t(e))}_attachTextField(t){var n,o,l,u,y;let e={props:_({},(o=(n=this._config.options)==null?void 0:n.textFieldDelegateConfig)==null?void 0:o.props),options:x(_({},(u=(l=this._config.options)==null?void 0:l.textFieldDelegateConfig)==null?void 0:u.options),{id:(y=this._config.options)==null?void 0:y.id,type:"number"})};this._textFieldDelegate=new N(e),t.appendChild(this._textFieldDelegate.element)}setLabel(t){t?this._labelElement?this._labelElement.textContent=t:this._createLabel(t):this._labelElement&&(this._element.removeChild(this._labelElement),this._labelElement=void 0)}setHelperText(t){t?(this._helperTextElement||(this._helperTextElement=document.createElement("span"),this._helperTextElement.slot="helper-text",this._element.appendChild(this._helperTextElement)),this._helperTextElement.textContent=t):this._helperTextElement&&(this._element.removeChild(this._helperTextElement),this._helperTextElement=void 0)}_createLabel(t){var e;this._labelElement=document.createElement("label"),this._labelElement.textContent=t,this._labelElement.slot="label",(e=this._config.options)!=null&&e.id&&this._labelElement.setAttribute("for",this._config.options.id),this._element.appendChild(this._labelElement)}_attachButton(t,e,n){return new S({options:{iconName:e,parent:t,attributes:{slot:n}}})}};function ft(){I(s)}export{i as a,v as b,b as c,s as d,M as e,ft as f};
|
|
7
|
-
//# sourceMappingURL=chunk.
|
|
6
|
+
import{b as N}from"./chunk.PHTOULRR.js";import{b as F,c as S}from"./chunk.KSCUIS5C.js";import{A as m,k as d}from"./chunk.FYWPZFLJ.js";import{d as h}from"./chunk.H5D54EHO.js";import{a as A}from"./chunk.G4IN6Y46.js";import{a as E}from"./chunk.NVUMRW44.js";import{a as C}from"./chunk.5V5ABSHI.js";import{a as B,b as L}from"./chunk.DTZFWZPB.js";import{a as I,e as T,f as c,k as D}from"./chunk.NK7H3MMM.js";import{k as f}from"./chunk.J2M2MXP2.js";import{a as _,b as x,d as p}from"./chunk.M3QDAYD2.js";var R=`${L}quantity-field`,q={INVALID:"invalid",REQUIRED:"required",DISABLED:"disabled"},O={ROOT:"forge-quantity-field",INVALID:"forge-quantity-field--invalid",REQUIRED:"forge-quantity-field--required"},a={INCREMENT_BUTTON:"increment-button",DECREMENT_BUTTON:"decrement-button",LABEL:"label",HELPER_TEXT:"helper-text"},w={ROOT:`.${O.ROOT}`,INCREMENT_BUTTON_SLOT:`slot[name=${a.INCREMENT_BUTTON}]`,DECREMENT_BUTTON_SLOT:`slot[name=${a.DECREMENT_BUTTON}]`,INCREMENT_BUTTON:`[slot=${a.INCREMENT_BUTTON}] button, button[slot=${a.INCREMENT_BUTTON}]`,DECREMENT_BUTTON:`[slot=${a.DECREMENT_BUTTON}] button, button[slot=${a.DECREMENT_BUTTON}]`,TEXT_FIELD:"forge-text-field",INPUT:"input[type=number]",LABEL:`[slot=${a.LABEL}]`,HELPER_TEXT:`[slot=${a.HELPER_TEXT}]`},i={elementName:R,classes:O,slots:a,selectors:w,attributes:q};var v=class extends C{constructor(t){super(t);this._rootElement=c(t,i.selectors.ROOT),this._incrementButtonSlot=c(this._component,i.selectors.INCREMENT_BUTTON_SLOT),this._decrementButtonSlot=c(this._component,i.selectors.DECREMENT_BUTTON_SLOT)}initializeButtons(){this._incrementButton&&!this._incrementButton.hasAttribute("tabindex")&&(this._incrementButton.tabIndex=-1),this._decrementButton&&!this._decrementButton.hasAttribute("tabindex")&&(this._decrementButton.tabIndex=-1)}addRootClass(t){this._rootElement.classList.add(t)}removeRootClass(t){this._rootElement.classList.remove(t)}inputHasAttribute(t){return this.inputElement?this.inputElement.hasAttribute(t):!1}addIncrementButtonSlotListener(t){this._incrementButtonSlot.addEventListener("slotchange",t)}removeIncrementButtonSlotListener(t){this._incrementButtonSlot&&this._incrementButtonSlot.removeEventListener("slotchange",t)}addDecrementButtonSlotListener(t){this._decrementButtonSlot.addEventListener("slotchange",t)}removeDecrementButtonSlotListener(t){this._decrementButtonSlot&&this._decrementButtonSlot.removeEventListener("slotchange",t)}addTextFieldAttribute(t,e=""){this._textFieldComponent&&this._textFieldComponent.setAttribute(t,e)}removeTextFieldAttribute(t){this._textFieldComponent&&this._textFieldComponent.removeAttribute(t)}addIncrementEventListener(t,e){this._incrementButtonElement.addEventListener(t,e)}removeIncrementEventListener(t,e){this._incrementButtonElement&&this._incrementButtonElement.removeEventListener(t,e)}addDecrementEventListener(t,e){this._decrementButtonElement.addEventListener(t,e)}removeDecrementEventListener(t,e){this._decrementButtonElement&&this._decrementButtonElement.removeEventListener(t,e)}addIncrementButtonAttribute(t,e=""){this._incrementButtonElement.setAttribute(t,e)}removeIncrementButtonAttribute(t){this._incrementButtonElement.removeAttribute(t)}addDecrementButtonAttribute(t,e=""){this._decrementButtonElement.setAttribute(t,e)}removeDecrementButtonAttribute(t){this._decrementButtonElement.removeAttribute(t)}increment(){let t=this.inputElement;if(!t)return;let e=+t.value,n=this._calcPrecision(this._inputStep),o=parseFloat((e+this._inputStep).toFixed(n));this._inputMax&&this._inputMax<o&&(o=this._inputMax),this._setInputValue(o)}decrement(){let t=this.inputElement;if(!t)return;let e=+t.value,n=this._calcPrecision(this._inputStep),o=parseFloat((e-this._inputStep).toFixed(n));this._inputMin&&this._inputMin>o&&(o=this._inputMin),this._setInputValue(o)}addInputDisabledAttributeChangeListener(t){this._setupInputDisabledAttributeMutationObserver(t)}removeInputDisabledAttributeChangeListener(){this._cleanupInputDisabledAttributeMutationObserver()}_setInputValue(t){this.inputElement&&(this.inputElement.value=`${t}`,this.inputElement.dispatchEvent(new Event("input")),this.inputElement.dispatchEvent(new Event("change")))}_isNullOrUndefinedOrEmpty(t){return t==null||t===""}_setupInputDisabledAttributeMutationObserver(t){if(!this.inputElement)return;this._cleanupInputDisabledAttributeMutationObserver();let e=o=>this._inputDisabledAttributeMutationCallback(o,t);this._inputAttributeMutationObserver=new MutationObserver(e);let n={attributes:!0,attributeOldValue:!0,attributeFilter:[i.attributes.DISABLED]};this._inputAttributeMutationObserver.observe(this.inputElement,n)}_cleanupInputDisabledAttributeMutationObserver(){this._inputAttributeMutationObserver&&(this._inputAttributeMutationObserver.disconnect(),delete this._inputAttributeMutationObserver)}_inputDisabledAttributeMutationCallback(t,e){for(let n of t)n.type!=="attributes"||!n.attributeName||n.attributeName!==i.attributes.DISABLED||n.target[n.attributeName]===n.oldValue||e()}get _incrementButtonElement(){return this._incrementButton||(this._incrementButton=this._component.querySelector(i.selectors.INCREMENT_BUTTON)),this._incrementButton}get _decrementButtonElement(){return this._decrementButton||(this._decrementButton=this._component.querySelector(i.selectors.DECREMENT_BUTTON)),this._decrementButton}get _textFieldComponent(){return this._textField||(this._textField=this._component.querySelector(i.selectors.TEXT_FIELD)),this._textField}get inputElement(){return this._inputElement||(this._inputElement=this._component.querySelector(i.selectors.INPUT)),this._inputElement}get _inputStep(){let t=this.inputElement;return!t||this._isNullOrUndefinedOrEmpty(t.step)?1:+t.step}get _inputMax(){let t=this.inputElement;return!t||this._isNullOrUndefinedOrEmpty(t.max)?null:+t.max}get _inputMin(){let t=this.inputElement;return!t||this._isNullOrUndefinedOrEmpty(t.min)?null:+t.min}_calcPrecision(t){let e=String(t);return e.includes(".")?e.split(".")[1].length:0}};var b=class{constructor(r){this._adapter=r;this._incrementValue=()=>this._adapter.increment(),this._decrementValue=()=>this._adapter.decrement(),this._incrementButtonSlotChanged=()=>this._onIncrementButtonSlotChanged(),this._decrementButtonSlotChanged=()=>this._onDecrementButtonSlotChanged(),this._adapter.addIncrementButtonSlotListener(this._incrementButtonSlotChanged),this._adapter.addDecrementButtonSlotListener(this._decrementButtonSlotChanged)}connect(){this._adapter.addInputDisabledAttributeChangeListener(()=>this._syncDisabledStateOfButtons()),this._syncDisabledStateOfButtons(),this._adapter.initializeButtons()}disconnect(){this._removeIncrementEventListener(),this._removeDecrementEventListener(),this._removeIncrementButtonSlotListener(),this._removeDecrementButtonSlotListener(),this._adapter.removeInputDisabledAttributeChangeListener()}_onIncrementButtonSlotChanged(){this._addIncrementEventListener()}_onDecrementButtonSlotChanged(){this._addDecrementEventListener()}_addIncrementEventListener(){this._adapter.addIncrementEventListener("click",this._incrementValue)}_addDecrementEventListener(){this._adapter.addDecrementEventListener("click",this._decrementValue)}_removeIncrementEventListener(){this._adapter.removeIncrementEventListener("click",this._incrementValue)}_removeDecrementEventListener(){this._adapter.removeDecrementEventListener("click",this._decrementValue)}_removeIncrementButtonSlotListener(){this._adapter.removeIncrementButtonSlotListener(this._incrementButtonSlotChanged)}_removeDecrementButtonSlotListener(){this._adapter.removeDecrementButtonSlotListener(this._decrementButtonSlotChanged)}_syncDisabledStateOfButtons(){this._adapter.inputHasAttribute(i.attributes.DISABLED)?(this._adapter.addDecrementButtonAttribute(i.attributes.DISABLED),this._adapter.addIncrementButtonAttribute(i.attributes.DISABLED)):(this._adapter.removeIncrementButtonAttribute(i.attributes.DISABLED),this._adapter.removeDecrementButtonAttribute(i.attributes.DISABLED))}get required(){return this._required}set required(r){this._required!==r&&(this._required=r,this._required?(this._adapter.setHostAttribute(i.attributes.REQUIRED),this._adapter.addRootClass(i.classes.REQUIRED)):(this._adapter.removeHostAttribute(i.attributes.REQUIRED),this._adapter.removeRootClass(i.classes.REQUIRED)))}get invalid(){return this._invalid}set invalid(r){this._invalid!==r&&(this._invalid=r,this._invalid?(this._adapter.setHostAttribute(i.attributes.INVALID),this._adapter.addRootClass(i.classes.INVALID),this._adapter.addTextFieldAttribute(i.attributes.INVALID)):(this._adapter.removeHostAttribute(i.attributes.INVALID),this._adapter.removeRootClass(i.classes.INVALID),this._adapter.removeTextFieldAttribute(i.attributes.INVALID)))}};var U='<template><div class="forge-quantity-field" part="root"><slot name="label"></slot><div class="forge-quantity-field__row" part="row"><slot name="decrement-button"></slot><slot></slot><slot name="increment-button"></slot></div><slot name="helper-text"></slot></div></template>',k='.forge-quantity-field ::slotted([slot=label]){-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;font-family:Roboto,sans-serif;font-family:var(--mdc-typography-caption-font-family, var(--mdc-typography-font-family, Roboto, sans-serif));font-size:.75rem;font-size:var(--mdc-typography-caption-font-size, .75rem);line-height:1.25rem;line-height:var(--mdc-typography-caption-line-height, 1.25rem);font-weight:400;font-weight:var(--mdc-typography-caption-font-weight,400);letter-spacing:.0333333333em;letter-spacing:var(--mdc-typography-caption-letter-spacing, .0333333333em);text-decoration:inherit;-webkit-text-decoration:var(--mdc-typography-caption-text-decoration,inherit);text-decoration:var(--mdc-typography-caption-text-decoration,inherit);text-transform:inherit;text-transform:var(--mdc-typography-caption-text-transform,inherit);color:rgba(0,0,0,.54);color:var(--mdc-theme-text-secondary-on-background,rgba(0,0,0,.54))}.forge-quantity-field ::slotted([slot=helper-text]){-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;font-family:Roboto,sans-serif;font-family:var(--mdc-typography-caption-font-family, var(--mdc-typography-font-family, Roboto, sans-serif));font-size:.75rem;font-size:var(--mdc-typography-caption-font-size, .75rem);line-height:1.25rem;line-height:var(--mdc-typography-caption-line-height, 1.25rem);font-weight:400;font-weight:var(--mdc-typography-caption-font-weight,400);letter-spacing:.0333333333em;letter-spacing:var(--mdc-typography-caption-letter-spacing, .0333333333em);text-decoration:inherit;-webkit-text-decoration:var(--mdc-typography-caption-text-decoration,inherit);text-decoration:var(--mdc-typography-caption-text-decoration,inherit);text-transform:inherit;text-transform:var(--mdc-typography-caption-text-transform,inherit);height:1rem;color:rgba(0,0,0,.54);color:var(--mdc-theme-text-secondary-on-background,rgba(0,0,0,.54))}.forge-quantity-field ::slotted([slot=helper-text])::before{display:inline-block;width:0;height:16px;content:"";vertical-align:0}.forge-quantity-field__row{display:-webkit-box;display:flex;-webkit-box-orient:horizontal;-webkit-box-direction:normal;flex-direction:row;-webkit-box-align:center;align-items:center}.forge-quantity-field ::slotted(forge-icon-button:first-of-type){color:var(--mdc-theme-text-secondary-on-light);margin-right:4px}.forge-quantity-field ::slotted(forge-icon-button:last-of-type){color:var(--mdc-theme-text-secondary-on-light);margin-left:4px}.forge-quantity-field ::slotted(forge-text-field){--forge-text-field-margin-top:0;--forge-text-field-margin-bottom:0}.forge-quantity-field--required ::slotted([slot=label])::before{color:#b00020;color:var(--mdc-theme-error,#b00020);content:"*";margin-right:4px}.forge-quantity-field--invalid ::slotted([slot=label]){-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;font-family:Roboto,sans-serif;font-family:var(--mdc-typography-caption-font-family, var(--mdc-typography-font-family, Roboto, sans-serif));font-size:.75rem;font-size:var(--mdc-typography-caption-font-size, .75rem);line-height:1.25rem;line-height:var(--mdc-typography-caption-line-height, 1.25rem);font-weight:400;font-weight:var(--mdc-typography-caption-font-weight,400);letter-spacing:.0333333333em;letter-spacing:var(--mdc-typography-caption-letter-spacing, .0333333333em);text-decoration:inherit;-webkit-text-decoration:var(--mdc-typography-caption-text-decoration,inherit);text-decoration:var(--mdc-typography-caption-text-decoration,inherit);text-transform:inherit;text-transform:var(--mdc-typography-caption-text-transform,inherit);color:#b00020;color:var(--mdc-theme-error,#b00020)}.forge-quantity-field--invalid ::slotted([slot=helper-text]){-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;font-family:Roboto,sans-serif;font-family:var(--mdc-typography-caption-font-family, var(--mdc-typography-font-family, Roboto, sans-serif));font-size:.75rem;font-size:var(--mdc-typography-caption-font-size, .75rem);line-height:1.25rem;line-height:var(--mdc-typography-caption-line-height, 1.25rem);font-weight:400;font-weight:var(--mdc-typography-caption-font-weight,400);letter-spacing:.0333333333em;letter-spacing:var(--mdc-typography-caption-letter-spacing, .0333333333em);text-decoration:inherit;-webkit-text-decoration:var(--mdc-typography-caption-text-decoration,inherit);text-decoration:var(--mdc-typography-caption-text-decoration,inherit);text-transform:inherit;text-transform:var(--mdc-typography-caption-text-transform,inherit);height:1rem;color:#b00020;color:var(--mdc-theme-error,#b00020)}.forge-quantity-field--invalid ::slotted([slot=helper-text])::before{display:inline-block;width:0;height:16px;content:"";vertical-align:0}:host{display:inline-block}:host([hidden]){display:none}',s=class extends D{constructor(){super();T(this,U,k),this._foundation=new b(new v(this)),h.define([m,d])}static get observedAttributes(){return[i.attributes.INVALID,i.attributes.REQUIRED]}connectedCallback(){this._requiredElementsPresent()?this._foundation.connect():this._ensureElementsPresent().then(()=>{this._foundation.connect()})}disconnectedCallback(){this._foundation.disconnect()}attributeChangedCallback(t,e,n){switch(t){case i.attributes.INVALID:this.invalid=f(n);break;case i.attributes.REQUIRED:this.required=f(n);break}}_ensureElementsPresent(){return new Promise(t=>{if(this._requiredElementsPresent()){t();return}let e=new MutationObserver(n=>{n.reduce((l,u)=>l+u.addedNodes.length,0)>0&&this._requiredElementsPresent()&&(e.disconnect(),t())});e.observe(this,{childList:!0,subtree:!0})})}_requiredElementsPresent(){let t=this.querySelector(i.selectors.INPUT),e=this.querySelector(i.selectors.DECREMENT_BUTTON),n=this.querySelector(i.selectors.INCREMENT_BUTTON);return!!t&&!!e&&!!n}};p([E()],s.prototype,"invalid",2),p([E()],s.prototype,"required",2),s=p([B({name:i.elementName,dependencies:[F]})],s);var M=class extends A{constructor(t){super(t);h.define([m,d])}_build(){let t=document.createElement(i.elementName);return this._attachButton(t,m.name,"decrement-button"),this._attachTextField(t),this._attachButton(t,d.name,"increment-button"),t}_configure(){var t,e,n,o,l;this.inputElement.value=(e=(t=this._config.options)==null?void 0:t.value)!=null?e:"0",this.inputElement.style.textAlign="center",this.inputElement.style.width="64px",(n=this._config.options)!=null&&n.helperText&&this.setHelperText(this._config.options.helperText),typeof((o=this._config.options)==null?void 0:o.label)=="string"&&this._createLabel(this._config.options.label),((l=this._config.options)==null?void 0:l.step)!==void 0&&(this.inputElement.step=this._config.options.step)}get value(){return this._textFieldDelegate.inputElement.value}set value(t){this._textFieldDelegate.inputElement.value=t}get disabled(){return this._textFieldDelegate.inputElement.disabled}set disabled(t){this._textFieldDelegate.inputElement.disabled=t}get invalid(){return this._element.invalid||!1}set invalid(t){this._element.invalid=t}get inputElement(){return this._textFieldDelegate.inputElement}get labelElement(){return this._labelElement}onChange(t){this._textFieldDelegate.inputElement.addEventListener("input",e=>t(e.target.value))}onFocus(t){this._textFieldDelegate.inputElement.addEventListener("focus",e=>t(e))}onBlur(t){this._textFieldDelegate.inputElement.addEventListener("blur",e=>t(e))}_attachTextField(t){var n,o,l,u,y;let e={props:_({},(o=(n=this._config.options)==null?void 0:n.textFieldDelegateConfig)==null?void 0:o.props),options:x(_({},(u=(l=this._config.options)==null?void 0:l.textFieldDelegateConfig)==null?void 0:u.options),{id:(y=this._config.options)==null?void 0:y.id,type:"number"})};this._textFieldDelegate=new N(e),t.appendChild(this._textFieldDelegate.element)}setLabel(t){t?this._labelElement?this._labelElement.textContent=t:this._createLabel(t):this._labelElement&&(this._element.removeChild(this._labelElement),this._labelElement=void 0)}setHelperText(t){t?(this._helperTextElement||(this._helperTextElement=document.createElement("span"),this._helperTextElement.slot="helper-text",this._element.appendChild(this._helperTextElement)),this._helperTextElement.textContent=t):this._helperTextElement&&(this._element.removeChild(this._helperTextElement),this._helperTextElement=void 0)}_createLabel(t){var e;this._labelElement=document.createElement("label"),this._labelElement.textContent=t,this._labelElement.slot="label",(e=this._config.options)!=null&&e.id&&this._labelElement.setAttribute("for",this._config.options.id),this._element.appendChild(this._labelElement)}_attachButton(t,e,n){return new S({options:{iconName:e,parent:t,attributes:{slot:n}}})}};function ft(){I(s)}export{i as a,v as b,b as c,s as d,M as e,ft as f};
|
|
7
|
+
//# sourceMappingURL=chunk.VNOJO2PF.js.map
|