@brightspot/ui 3.0.1-cms-ui-migration.2 → 3.0.1-cms-ui-migration.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +56 -37
- package/dist/custom-elements.json +1807 -1807
- package/dist/storybook/assets/{ActionBar.stories-hJ_5cm-P.js → ActionBar.stories-BZAVK1QG.js} +1 -1
- package/dist/storybook/assets/{ActionItem.stories-Bjx2803w.js → ActionItem.stories-BqiWvlWi.js} +1 -1
- package/dist/storybook/assets/{Avatar.stories-Cj0YgZ6f.js → Avatar.stories-DkdB6hd_.js} +1 -1
- package/dist/storybook/assets/{AvatarGroup.stories-Lh_sQFCU.js → AvatarGroup.stories-DODqaIix.js} +1 -1
- package/dist/storybook/assets/{Badge.stories-BL7RUibx.js → Badge.stories-DZoum08S.js} +1 -1
- package/dist/storybook/assets/{Button-BPHNcxqK.js → Button-BkmBgNO-.js} +1 -1
- package/dist/storybook/assets/{Button.stories-CAYO4gdU.js → Button.stories-BFhCL2dp.js} +1 -1
- package/dist/storybook/assets/{ButtonGroup.stories-Cd13Us5K.js → ButtonGroup.stories-DlTGTvkq.js} +1 -1
- package/dist/storybook/assets/{Celebrate.stories-D_KE3Qze.js → Celebrate.stories-m4d4zTEz.js} +1 -1
- package/dist/storybook/assets/{Checkbox.stories-Aj1xgZVn.js → Checkbox.stories-Y253YeU7.js} +1 -1
- package/dist/storybook/assets/{CircularProgress.stories-BecV_v6d.js → CircularProgress.stories-6BD8uV5G.js} +1 -1
- package/dist/storybook/assets/{ClipboardMixin.stories-DU-WiZ2f.js → ClipboardMixin.stories-BkH66rIU.js} +1 -1
- package/dist/storybook/assets/{Color-6BZIO3FS-BYl4KZZn.js → Color-6BZIO3FS-iG0OjPBU.js} +1 -1
- package/dist/storybook/assets/{Colors.stories-BMUVUy2q.js → Colors.stories-BxiyQnEg.js} +1 -1
- package/dist/storybook/assets/{CombinedEffects.stories-FHcPKFm6.js → CombinedEffects.stories-Bs3U7qRl.js} +1 -1
- package/dist/storybook/assets/{ComponentStatesMixin-EMUnfT5y.js → ComponentStatesMixin-DampYb5c.js} +1 -1
- package/dist/storybook/assets/{ComponentStatesMixin.stories-SXq0kzS9.js → ComponentStatesMixin.stories-CZ2OW7as.js} +1 -1
- package/dist/storybook/assets/{CopyToClipboard.stories-u43lhvcI.js → CopyToClipboard.stories-CdlghjaE.js} +1 -1
- package/dist/storybook/assets/{Debounce.stories-BdCn5qgO.js → Debounce.stories-CymT8PnT.js} +1 -1
- package/dist/storybook/assets/{DocsRenderer-LL677BLK-DxiEJ_jx.js → DocsRenderer-LL677BLK-dqHCo-GE.js} +3 -3
- package/dist/storybook/assets/{Dropdown.stories-BWSRwjIF.js → Dropdown.stories-B6JwKg-I.js} +1 -1
- package/dist/storybook/assets/{EmptyState.stories-BpobeZL5.js → EmptyState.stories-Bk229lPH.js} +1 -1
- package/dist/storybook/assets/{Events.stories-CP5kMzpr.js → Events.stories-C8-k9cx8.js} +1 -1
- package/dist/storybook/assets/{Heading.stories-CbJD-oTB.js → Heading.stories-DIdnAQRG.js} +1 -1
- package/dist/storybook/assets/{HueRipple.stories-BOABJ7zw.js → HueRipple.stories-B1gXAEaH.js} +1 -1
- package/dist/storybook/assets/{Icon.stories-CWlUHL4j.js → Icon.stories--1VJ0_yt.js} +1 -1
- package/dist/storybook/assets/{IconButton.stories-BWBs-OLT.js → IconButton.stories-CS2rEIir.js} +1 -1
- package/dist/storybook/assets/{LinearProgress.stories-LZ0GZoxF.js → LinearProgress.stories-Bx0CQQls.js} +1 -1
- package/dist/storybook/assets/{Pagination.stories-CbLaR3P9.js → Pagination.stories-B4AogTXB.js} +1 -1
- package/dist/storybook/assets/{Popover.stories-JHrWqYZw.js → Popover.stories-BR88DPgU.js} +1 -1
- package/dist/storybook/assets/{ReadyMixin-B1H2a9x8.js → ReadyMixin-n6qZO39Y.js} +1 -1
- package/dist/storybook/assets/{RovingTabindexMixin.stories-UMHpYG73.js → RovingTabindexMixin.stories-1xTJSMSv.js} +1 -1
- package/dist/storybook/assets/{Rtc.stories-VQtNSlls.js → Rtc.stories-Rt0A_rUZ.js} +1 -1
- package/dist/storybook/assets/{ScrollShadow.stories-CYdi8Tgp.js → ScrollShadow.stories-CjLdJyYu.js} +1 -1
- package/dist/storybook/assets/{Switch.stories-D8F2hZCf.js → Switch.stories-CF8wO4v2.js} +1 -1
- package/dist/storybook/assets/{Tab.stories-wgBP0lTj.js → Tab.stories-C8XNshog.js} +1 -1
- package/dist/storybook/assets/{Tabs.stories-C00rr5sf.js → Tabs.stories-B01l4rQx.js} +1 -1
- package/dist/storybook/assets/{Throttle.stories-BhQEfJbS.js → Throttle.stories-Bpi0K5j9.js} +1 -1
- package/dist/storybook/assets/{Tooltip.stories-CGoZ5qTn.js → Tooltip.stories-BC4zMiZ1.js} +1 -1
- package/dist/storybook/assets/{Upload.stories-B3K-HAXw.js → Upload.stories-2pWv_fZ1.js} +1 -1
- package/dist/storybook/assets/{UploadItem.stories-71ArSoUh.js → UploadItem.stories-aLeAUM7y.js} +1 -1
- package/dist/storybook/assets/{Welcome.stories-CihlfFXS.js → Welcome.stories-DJV83eb7.js} +1 -1
- package/dist/storybook/assets/{Widget.stories-1u4KbiJM.js → Widget.stories-Cz0i2o6L.js} +1 -1
- package/dist/storybook/assets/{WithTooltip-65CFNBJE-B3Jitxw9.js → WithTooltip-65CFNBJE-D8QwVYG8.js} +1 -1
- package/dist/storybook/assets/{blocks-C1HaXuQB.js → blocks-BFmpEZRy.js} +5 -5
- package/dist/storybook/assets/{formatter-EIJCOSYU-Dy9Lt9fs.js → formatter-EIJCOSYU-CdwdJOPy.js} +1 -1
- package/dist/storybook/assets/if-defined-gbJXriW-.js +1 -0
- package/dist/storybook/assets/{iframe-Dx6IxWXF.js → iframe-CyssRDCd.js} +4 -4
- package/dist/storybook/assets/{index-OrjedSVh.js → index-B82i8dhg.js} +1 -1
- package/dist/storybook/assets/{onFind-YTqjw6W0.js → onFind-BFI1uIxr.js} +1 -1
- package/dist/storybook/assets/{onFind.stories-DEvwTrmx.js → onFind.stories-zZjQs_Gn.js} +1 -1
- package/dist/storybook/assets/{onRemove.stories-D5mO-Lin.js → onRemove.stories-pFBwAIex.js} +1 -1
- package/dist/storybook/assets/{onVisible.stories-C3Rcz0Eb.js → onVisible.stories-5dErOVRq.js} +1 -1
- package/dist/storybook/assets/{style-map-CiMHry7H.js → style-map-D0EcLEWO.js} +1 -1
- package/dist/storybook/assets/{syntaxhighlighter-ED5Y7EFY-DIZnuhb2.js → syntaxhighlighter-ED5Y7EFY--2h_dVga.js} +1 -1
- package/dist/storybook/iframe.html +1 -1
- package/dist/storybook/project.json +1 -1
- package/package.json +16 -2
- package/src/legacy/tool-ui/src/AnalyticsWidget.css +1 -1
- package/src/legacy/tool-ui/src/Board.css +1 -1
- package/src/legacy/tool-ui/src/BulkUpload.css +1 -1
- package/src/legacy/tool-ui/src/ComboInput.css +1 -1
- package/src/legacy/tool-ui/src/Compat.css +5 -5
- package/src/legacy/tool-ui/src/ContentEditDrawer.css +1 -1
- package/src/legacy/tool-ui/src/Dialog.css +1 -1
- package/src/legacy/tool-ui/src/FormFilter.css +1 -1
- package/src/legacy/tool-ui/src/Icon/index.css +1 -1
- package/src/legacy/tool-ui/src/ImageEditor.css +1 -1
- package/src/legacy/tool-ui/src/Incompatible.css +2 -2
- package/src/legacy/tool-ui/src/LinkCarousel.css +1 -1
- package/src/legacy/tool-ui/src/Page.css +1 -1
- package/src/legacy/tool-ui/src/RepeatableContentInputGroup.css +1 -1
- package/src/legacy/tool-ui/src/RichText.css +1 -1
- package/src/legacy/tool-ui/src/SearchWidget.css +2 -2
- package/src/legacy/tool-ui/src/SearchWidgetAdvanced.css +1 -1
- package/src/legacy/tool-ui/src/Widget.css +1 -1
- package/src/legacy/tool-ui/src/main/webapp/dist/v5.5e5d7f655e174ddd85f5.css +5 -0
- package/dist/storybook/assets/if-defined-CA2KmTqA.js +0 -1
- package/docs/adr/0001-retire-cms-ui-package-fold-under-src-legacy.md +0 -78
- package/docs/adr/0002-yarn-workspaces-preserve-cms-ui-deps.md +0 -130
- package/docs/adr/0003-bundle-equivalence-as-fold-acceptance-criterion.md +0 -286
- package/src/legacy/tool-ui/src/main/resources/settings.properties +0 -1
- package/src/legacy/tool-ui/src/main/webapp/WEB-INF/web.xml +0 -81
- package/src/legacy/tool-ui/src/main/webapp/dist/v5.5e3fdf0f0b20b4e3c170.css +0 -5
- package/src/legacy/tool-ui/src/main/webapp/script/bsp-uploader.js +0 -170
- package/src/legacy/tool-ui/src/main/webapp/script/bsp-utils.js +0 -393
- package/src/legacy/tool-ui/src/main/webapp/script/content/layout-element.js +0 -141
- package/src/legacy/tool-ui/src/main/webapp/script/input/query.js +0 -78
- package/src/legacy/tool-ui/src/main/webapp/script/input/workflow.js +0 -718
- package/src/legacy/tool-ui/src/main/webapp/script/jquery.extra.js +0 -633
- package/src/legacy/tool-ui/src/main/webapp/script/v3/Dropbox.js +0 -18
- package/src/legacy/tool-ui/src/main/webapp/script/v3/EditFieldUpdate.js +0 -406
- package/src/legacy/tool-ui/src/main/webapp/script/v3/EditFieldUpdateCache.js +0 -1
- package/src/legacy/tool-ui/src/main/webapp/script/v3/Notification.js +0 -151
- package/src/legacy/tool-ui/src/main/webapp/script/v3/content/edit.js +0 -194
- package/src/legacy/tool-ui/src/main/webapp/script/v3/content/state.js +0 -785
- package/src/legacy/tool-ui/src/main/webapp/script/v3/csrf.js +0 -35
- package/src/legacy/tool-ui/src/main/webapp/script/v3/dashboard.js +0 -65
- package/src/legacy/tool-ui/src/main/webapp/script/v3/input/dataTransfer.js +0 -129
- package/src/legacy/tool-ui/src/main/webapp/script/v3/input/file.js +0 -433
- package/src/legacy/tool-ui/src/main/webapp/script/v3/input/object.js +0 -743
- package/src/legacy/tool-ui/src/main/webapp/script/v3/input/read-only.js +0 -17
- package/src/legacy/tool-ui/src/main/webapp/script/v3/jquery.frame.js +0 -478
- package/src/legacy/tool-ui/src/main/webapp/script/v3/jquery.repeatable.js +0 -2406
- package/src/legacy/tool-ui/src/main/webapp/script/v3/plugin/popup.d.ts +0 -2
- package/src/legacy/tool-ui/src/main/webapp/script/v3/plugin/popup.js +0 -446
- package/src/legacy/tool-ui/src/main/webapp/script/v3/search-filters.js +0 -62
- package/src/legacy/tool-ui/src/main/webapp/script/v3/search.js +0 -53
- package/src/legacy/tool-ui/src/main/webapp/script/v3.js +0 -1049
- package/src/legacy/tool-ui/src/main/webapp/v4/Admin.js +0 -16
- package/src/legacy/tool-ui/src/main/webapp/v4/AutoExpand.js +0 -84
- package/src/legacy/tool-ui/src/main/webapp/v4/AutoSubmit.js +0 -68
- package/src/legacy/tool-ui/src/main/webapp/v4/Bridge.js +0 -536
- package/src/legacy/tool-ui/src/main/webapp/v4/CheckboxInput.js +0 -22
- package/src/legacy/tool-ui/src/main/webapp/v4/ColorInput.js +0 -5
- package/src/legacy/tool-ui/src/main/webapp/v4/ColorInputSpectrum.js +0 -107
- package/src/legacy/tool-ui/src/main/webapp/v4/ComboInput.js +0 -1491
- package/src/legacy/tool-ui/src/main/webapp/v4/CommunityWidget.js +0 -29
- package/src/legacy/tool-ui/src/main/webapp/v4/ContentEdit.js +0 -2427
- package/src/legacy/tool-ui/src/main/webapp/v4/ContentLock.js +0 -470
- package/src/legacy/tool-ui/src/main/webapp/v4/ContentReporting.js +0 -32
- package/src/legacy/tool-ui/src/main/webapp/v4/DataTable.js +0 -31
- package/src/legacy/tool-ui/src/main/webapp/v4/DateStringField.js +0 -485
- package/src/legacy/tool-ui/src/main/webapp/v4/Entry.js +0 -264
- package/src/legacy/tool-ui/src/main/webapp/v4/ExternalItemAuth.js +0 -16
- package/src/legacy/tool-ui/src/main/webapp/v4/Form.js +0 -31
- package/src/legacy/tool-ui/src/main/webapp/v4/Hierarchy.js +0 -100
- package/src/legacy/tool-ui/src/main/webapp/v4/Icon.ts +0 -49
- package/src/legacy/tool-ui/src/main/webapp/v4/ImageEditor.js +0 -2403
- package/src/legacy/tool-ui/src/main/webapp/v4/ImageEditorBundle.js +0 -5
- package/src/legacy/tool-ui/src/main/webapp/v4/LinkCarousel.js +0 -40
- package/src/legacy/tool-ui/src/main/webapp/v4/LinkList.js +0 -14
- package/src/legacy/tool-ui/src/main/webapp/v4/LinkTable.js +0 -123
- package/src/legacy/tool-ui/src/main/webapp/v4/Location.js +0 -19
- package/src/legacy/tool-ui/src/main/webapp/v4/LocationMap.js +0 -148
- package/src/legacy/tool-ui/src/main/webapp/v4/LookingGlass.js +0 -24
- package/src/legacy/tool-ui/src/main/webapp/v4/Message.js +0 -14
- package/src/legacy/tool-ui/src/main/webapp/v4/NumberBar.js +0 -32
- package/src/legacy/tool-ui/src/main/webapp/v4/Page.js +0 -890
- package/src/legacy/tool-ui/src/main/webapp/v4/Preview.js +0 -758
- package/src/legacy/tool-ui/src/main/webapp/v4/PreviewEditor.js +0 -86
- package/src/legacy/tool-ui/src/main/webapp/v4/PreviewOverlay.js +0 -1005
- package/src/legacy/tool-ui/src/main/webapp/v4/PubSub.js +0 -47
- package/src/legacy/tool-ui/src/main/webapp/v4/QueryField.js +0 -211
- package/src/legacy/tool-ui/src/main/webapp/v4/RegionMap.js +0 -215
- package/src/legacy/tool-ui/src/main/webapp/v4/RepeatableContentInputGroup.js +0 -160
- package/src/legacy/tool-ui/src/main/webapp/v4/RichTextEditor.js +0 -154
- package/src/legacy/tool-ui/src/main/webapp/v4/SearchFields.js +0 -281
- package/src/legacy/tool-ui/src/main/webapp/v4/SearchResult.js +0 -255
- package/src/legacy/tool-ui/src/main/webapp/v4/SharePreview.js +0 -56
- package/src/legacy/tool-ui/src/main/webapp/v4/Sortable.js +0 -874
- package/src/legacy/tool-ui/src/main/webapp/v4/StyleEmbeddedContent.js +0 -100
- package/src/legacy/tool-ui/src/main/webapp/v4/StyleguidePresets.js +0 -357
- package/src/legacy/tool-ui/src/main/webapp/v4/TabContainer.js +0 -360
- package/src/legacy/tool-ui/src/main/webapp/v4/Taxonomy.js +0 -27
- package/src/legacy/tool-ui/src/main/webapp/v4/ThemeBundleEditor.js +0 -224
- package/src/legacy/tool-ui/src/main/webapp/v4/TimedContent.js +0 -147
- package/src/legacy/tool-ui/src/main/webapp/v4/TimedContentBundle.js +0 -8
- package/src/legacy/tool-ui/src/main/webapp/v4/VideoEditor.js +0 -2417
- package/src/legacy/tool-ui/src/main/webapp/v4/VideoEditorBundle.js +0 -8
- package/src/legacy/tool-ui/src/main/webapp/v4/ViewMirror.js +0 -52
- package/src/legacy/tool-ui/src/main/webapp/v4/ViewPreview.d.ts +0 -13
- package/src/legacy/tool-ui/src/main/webapp/v4/ViewPreview.js +0 -177
- package/src/legacy/tool-ui/src/main/webapp/v4/Widget.js +0 -90
- package/src/legacy/tool-ui/src/main/webapp/v4/__mocks__/fileMock.js +0 -1
- package/src/legacy/tool-ui/src/main/webapp/v4/__mocks__/styleMock.js +0 -1
- package/src/legacy/tool-ui/src/main/webapp/v4/__mocks__/textArea.mock.js +0 -20
- package/src/legacy/tool-ui/src/main/webapp/v4/__tests__/integration/globals.js +0 -770
- package/src/legacy/tool-ui/src/main/webapp/v4/__tests__/integration/rte/ProseMirror.test.js +0 -16
- package/src/legacy/tool-ui/src/main/webapp/v4/__tests__/integration/rte/index.html +0 -54
- package/src/legacy/tool-ui/src/main/webapp/v4/__tests__/integration/rte/plugins/comment_manager/CommentManager.test.js +0 -29
- package/src/legacy/tool-ui/src/main/webapp/v4/__tests__/integration/rte/plugins/comment_manager/index.html +0 -35
- package/src/legacy/tool-ui/src/main/webapp/v4/__tests__/integration/rte/plugins/custom_keyboard/CustomKeyboard.js +0 -42
- package/src/legacy/tool-ui/src/main/webapp/v4/__tests__/integration/rte/plugins/custom_keyboard/index.html +0 -37
- package/src/legacy/tool-ui/src/main/webapp/v4/__tests__/integration/rte/plugins/enhancement_manager/EnhancementManager.test.js +0 -288
- package/src/legacy/tool-ui/src/main/webapp/v4/__tests__/integration/rte/plugins/enhancement_manager/block.html +0 -38
- package/src/legacy/tool-ui/src/main/webapp/v4/__tests__/integration/rte/plugins/enhancement_manager/inline.html +0 -38
- package/src/legacy/tool-ui/src/main/webapp/v4/__tests__/integration/rte/plugins/enhancement_manager/no-popups.html +0 -38
- package/src/legacy/tool-ui/src/main/webapp/v4/__tests__/integration/rte/plugins/list_manager/ListManager.js +0 -257
- package/src/legacy/tool-ui/src/main/webapp/v4/__tests__/integration/rte/plugins/list_manager/index.html +0 -38
- package/src/legacy/tool-ui/src/main/webapp/v4/__tests__/integration/rte/plugins/menubar/hierarchal.html +0 -33
- package/src/legacy/tool-ui/src/main/webapp/v4/__tests__/integration/rte/plugins/menubar/index.html +0 -33
- package/src/legacy/tool-ui/src/main/webapp/v4/__tests__/integration/rte/plugins/menubar/menubar.test.js +0 -195
- package/src/legacy/tool-ui/src/main/webapp/v4/__tests__/integration/rte/plugins/menubar/small.html +0 -34
- package/src/legacy/tool-ui/src/main/webapp/v4/__tests__/integration/rte/plugins/menubar/tags.html +0 -34
- package/src/legacy/tool-ui/src/main/webapp/v4/__tests__/integration/rte/plugins/placeholder_manager/PlaceholderManager.test.js +0 -134
- package/src/legacy/tool-ui/src/main/webapp/v4/__tests__/integration/rte/plugins/placeholder_manager/has-editable-placeholder.html +0 -32
- package/src/legacy/tool-ui/src/main/webapp/v4/__tests__/integration/rte/plugins/placeholder_manager/has-text.html +0 -34
- package/src/legacy/tool-ui/src/main/webapp/v4/__tests__/integration/rte/plugins/placeholder_manager/index.html +0 -31
- package/src/legacy/tool-ui/src/main/webapp/v4/__tests__/integration/rte/plugins/table_manager/TableManager.test.js +0 -63
- package/src/legacy/tool-ui/src/main/webapp/v4/__tests__/integration/rte/plugins/table_manager/existing.html +0 -48
- package/src/legacy/tool-ui/src/main/webapp/v4/__tests__/integration/rte/plugins/track_manager/TrackManager.test.js +0 -291
- package/src/legacy/tool-ui/src/main/webapp/v4/__tests__/integration/rte/plugins/track_manager/existing.html +0 -39
- package/src/legacy/tool-ui/src/main/webapp/v4/__tests__/integration/rte/plugins/track_manager/insert.html +0 -37
- package/src/legacy/tool-ui/src/main/webapp/v4/__tests__/unit/Sortable.test.js +0 -105
- package/src/legacy/tool-ui/src/main/webapp/v4/__tests__/unit/rte/ProseMirror.test.js +0 -41
- package/src/legacy/tool-ui/src/main/webapp/v4/__tests__/unit/rte/codemirror-shim.test.js +0 -72
- package/src/legacy/tool-ui/src/main/webapp/v4/__tests__/unit/rte/plugins/collab_manager/CollabManager.test.js +0 -46
- package/src/legacy/tool-ui/src/main/webapp/v4/__tests__/unit/rte/plugins/enhancement_manager/EnhancementManager.test.js +0 -84
- package/src/legacy/tool-ui/src/main/webapp/v4/__tests__/unit/rte/plugins/list_manager/ListManager.test.js +0 -54
- package/src/legacy/tool-ui/src/main/webapp/v4/__tests__/unit/rte/plugins/menubar/menubar.test.js +0 -183
- package/src/legacy/tool-ui/src/main/webapp/v4/__tests__/unit/rte/plugins/spellcheck/SpellCheck.test.js +0 -45
- package/src/legacy/tool-ui/src/main/webapp/v4/__tests__/unit/rte/settings/BSSerializer.test.js +0 -346
- package/src/legacy/tool-ui/src/main/webapp/v4/__tests__/unit/rte/settings/menuItemsBuilder.test.js +0 -226
- package/src/legacy/tool-ui/src/main/webapp/v4/__tests__/unit/rte/utilities.test.js +0 -118
- package/src/legacy/tool-ui/src/main/webapp/v4/appetizeio/Appetizeio.js +0 -5
- package/src/legacy/tool-ui/src/main/webapp/v4/appetizeio/AppetizeioEmbedded.js +0 -113
- package/src/legacy/tool-ui/src/main/webapp/v4/compat/Fetch.js +0 -16
- package/src/legacy/tool-ui/src/main/webapp/v4/compat/jquery.js +0 -32
- package/src/legacy/tool-ui/src/main/webapp/v4/compat/requirejs.js +0 -13
- package/src/legacy/tool-ui/src/main/webapp/v4/dom/Tether.js +0 -1
- package/src/legacy/tool-ui/src/main/webapp/v4/dom/TetherLayout.js +0 -1
- package/src/legacy/tool-ui/src/main/webapp/v4/dom/closest.js +0 -1
- package/src/legacy/tool-ui/src/main/webapp/v4/dom/create.js +0 -1
- package/src/legacy/tool-ui/src/main/webapp/v4/dom/find.js +0 -1
- package/src/legacy/tool-ui/src/main/webapp/v4/dom/findAll.js +0 -1
- package/src/legacy/tool-ui/src/main/webapp/v4/dom/ifClick.js +0 -1
- package/src/legacy/tool-ui/src/main/webapp/v4/dom/ifMatches.js +0 -1
- package/src/legacy/tool-ui/src/main/webapp/v4/dom/ifUnmodified.js +0 -1
- package/src/legacy/tool-ui/src/main/webapp/v4/dom/index.js +0 -5
- package/src/legacy/tool-ui/src/main/webapp/v4/dom/insertBefore.js +0 -1
- package/src/legacy/tool-ui/src/main/webapp/v4/dom/insertFirst.js +0 -1
- package/src/legacy/tool-ui/src/main/webapp/v4/dom/insertLast.js +0 -1
- package/src/legacy/tool-ui/src/main/webapp/v4/dom/onFind.js +0 -1
- package/src/legacy/tool-ui/src/main/webapp/v4/dom/onFindOnce.js +0 -1
- package/src/legacy/tool-ui/src/main/webapp/v4/dom/onRTEReady.js +0 -1
- package/src/legacy/tool-ui/src/main/webapp/v4/dom/onRemove.js +0 -1
- package/src/legacy/tool-ui/src/main/webapp/v4/dom/onVisible.js +0 -1
- package/src/legacy/tool-ui/src/main/webapp/v4/dom/previousUntil.js +0 -1
- package/src/legacy/tool-ui/src/main/webapp/v4/dom/resolveIconCompat.js +0 -40
- package/src/legacy/tool-ui/src/main/webapp/v4/rtc/Socket.js +0 -1
- package/src/legacy/tool-ui/src/main/webapp/v4/rtc/index.js +0 -1
- package/src/legacy/tool-ui/src/main/webapp/v4/rte/ProseMirror.js +0 -909
- package/src/legacy/tool-ui/src/main/webapp/v4/rte/README.md +0 -68
- package/src/legacy/tool-ui/src/main/webapp/v4/rte/codemirror-shim.d.ts +0 -8
- package/src/legacy/tool-ui/src/main/webapp/v4/rte/codemirror-shim.js +0 -274
- package/src/legacy/tool-ui/src/main/webapp/v4/rte/collab-workflow.jpeg +0 -0
- package/src/legacy/tool-ui/src/main/webapp/v4/rte/interchangeable.ts +0 -250
- package/src/legacy/tool-ui/src/main/webapp/v4/rte/mention.js +0 -90
- package/src/legacy/tool-ui/src/main/webapp/v4/rte/plugins/PluginProvider.js +0 -124
- package/src/legacy/tool-ui/src/main/webapp/v4/rte/plugins/README.md +0 -46
- package/src/legacy/tool-ui/src/main/webapp/v4/rte/plugins/ai_inline_manager/AIInlineManager.ts +0 -124
- package/src/legacy/tool-ui/src/main/webapp/v4/rte/plugins/ai_inline_manager/views/AIInlineView.ts +0 -1019
- package/src/legacy/tool-ui/src/main/webapp/v4/rte/plugins/ai_manager/AiManager.ts +0 -199
- package/src/legacy/tool-ui/src/main/webapp/v4/rte/plugins/collab_manager/CollabManager.js +0 -339
- package/src/legacy/tool-ui/src/main/webapp/v4/rte/plugins/collab_manager/views/AvatarView.js +0 -96
- package/src/legacy/tool-ui/src/main/webapp/v4/rte/plugins/comment_manager/CommentManager.js +0 -348
- package/src/legacy/tool-ui/src/main/webapp/v4/rte/plugins/custom_keyboard/CustomKeyboard.js +0 -110
- package/src/legacy/tool-ui/src/main/webapp/v4/rte/plugins/custom_keyboard/README.md +0 -29
- package/src/legacy/tool-ui/src/main/webapp/v4/rte/plugins/enhancement_manager/EnhancementManager.js +0 -428
- package/src/legacy/tool-ui/src/main/webapp/v4/rte/plugins/enhancement_manager/README.md +0 -63
- package/src/legacy/tool-ui/src/main/webapp/v4/rte/plugins/enhancement_manager/commands.js +0 -690
- package/src/legacy/tool-ui/src/main/webapp/v4/rte/plugins/enhancement_manager/constants.js +0 -12
- package/src/legacy/tool-ui/src/main/webapp/v4/rte/plugins/enhancement_manager/enhancement-creation.jpeg +0 -0
- package/src/legacy/tool-ui/src/main/webapp/v4/rte/plugins/enhancement_manager/index.js +0 -15
- package/src/legacy/tool-ui/src/main/webapp/v4/rte/plugins/enhancement_manager/rte-flow.jpeg +0 -0
- package/src/legacy/tool-ui/src/main/webapp/v4/rte/plugins/enhancement_manager/views/ActionButtonView.js +0 -86
- package/src/legacy/tool-ui/src/main/webapp/v4/rte/plugins/enhancement_manager/views/BlockSubmenuView.js +0 -60
- package/src/legacy/tool-ui/src/main/webapp/v4/rte/plugins/enhancement_manager/views/EnhancementView.js +0 -208
- package/src/legacy/tool-ui/src/main/webapp/v4/rte/plugins/enhancement_manager/views/PreviewView.js +0 -102
- package/src/legacy/tool-ui/src/main/webapp/v4/rte/plugins/enhancement_manager/views/SubmenuView.js +0 -365
- package/src/legacy/tool-ui/src/main/webapp/v4/rte/plugins/find_replace_manager/FindReplaceManager.js +0 -239
- package/src/legacy/tool-ui/src/main/webapp/v4/rte/plugins/find_replace_manager/views/FindView.js +0 -604
- package/src/legacy/tool-ui/src/main/webapp/v4/rte/plugins/fullscreen_manager/FullscreenManager.js +0 -57
- package/src/legacy/tool-ui/src/main/webapp/v4/rte/plugins/fullscreen_manager/README.md +0 -26
- package/src/legacy/tool-ui/src/main/webapp/v4/rte/plugins/fullscreen_manager/commands.js +0 -16
- package/src/legacy/tool-ui/src/main/webapp/v4/rte/plugins/fullscreen_manager/index.js +0 -4
- package/src/legacy/tool-ui/src/main/webapp/v4/rte/plugins/fullscreen_manager/views/FullscreenView.js +0 -474
- package/src/legacy/tool-ui/src/main/webapp/v4/rte/plugins/html_editor_manager/htmlEditorManager.js +0 -66
- package/src/legacy/tool-ui/src/main/webapp/v4/rte/plugins/html_editor_manager/views/HtmlEditorView.js +0 -97
- package/src/legacy/tool-ui/src/main/webapp/v4/rte/plugins/list_manager/ListManager.js +0 -342
- package/src/legacy/tool-ui/src/main/webapp/v4/rte/plugins/list_manager/README.md +0 -50
- package/src/legacy/tool-ui/src/main/webapp/v4/rte/plugins/list_manager/commands.js +0 -207
- package/src/legacy/tool-ui/src/main/webapp/v4/rte/plugins/list_manager/constants.js +0 -26
- package/src/legacy/tool-ui/src/main/webapp/v4/rte/plugins/list_manager/index.js +0 -4
- package/src/legacy/tool-ui/src/main/webapp/v4/rte/plugins/menubar/Menubar.js +0 -485
- package/src/legacy/tool-ui/src/main/webapp/v4/rte/plugins/menubar/README.md +0 -40
- package/src/legacy/tool-ui/src/main/webapp/v4/rte/plugins/menubar/views/MenuView.js +0 -842
- package/src/legacy/tool-ui/src/main/webapp/v4/rte/plugins/paste_manager/PasteManager.js +0 -368
- package/src/legacy/tool-ui/src/main/webapp/v4/rte/plugins/placeholder_manager/PlaceHolderManager.js +0 -128
- package/src/legacy/tool-ui/src/main/webapp/v4/rte/plugins/raw_text_manager/README.md +0 -13
- package/src/legacy/tool-ui/src/main/webapp/v4/rte/plugins/raw_text_manager/RawTextManager.js +0 -96
- package/src/legacy/tool-ui/src/main/webapp/v4/rte/plugins/spellcheck/index.js +0 -3
- package/src/legacy/tool-ui/src/main/webapp/v4/rte/plugins/spellcheck/spellcheck-plugin.js +0 -280
- package/src/legacy/tool-ui/src/main/webapp/v4/rte/plugins/spellcheck/spellcheck-service.js +0 -94
- package/src/legacy/tool-ui/src/main/webapp/v4/rte/plugins/table_manager/TableManager.js +0 -57
- package/src/legacy/tool-ui/src/main/webapp/v4/rte/plugins/table_manager/commands.js +0 -97
- package/src/legacy/tool-ui/src/main/webapp/v4/rte/plugins/table_manager/views/TableSizerView.js +0 -88
- package/src/legacy/tool-ui/src/main/webapp/v4/rte/plugins/table_manager/views/TableView.js +0 -613
- package/src/legacy/tool-ui/src/main/webapp/v4/rte/plugins/track_manager/README.md +0 -13
- package/src/legacy/tool-ui/src/main/webapp/v4/rte/plugins/track_manager/TrackManager.js +0 -905
- package/src/legacy/tool-ui/src/main/webapp/v4/rte/settings/BSSerializer.js +0 -819
- package/src/legacy/tool-ui/src/main/webapp/v4/rte/settings/README.md +0 -80
- package/src/legacy/tool-ui/src/main/webapp/v4/rte/settings/commands.js +0 -98
- package/src/legacy/tool-ui/src/main/webapp/v4/rte/settings/constants.d.ts +0 -84
- package/src/legacy/tool-ui/src/main/webapp/v4/rte/settings/constants.js +0 -87
- package/src/legacy/tool-ui/src/main/webapp/v4/rte/settings/index.js +0 -13
- package/src/legacy/tool-ui/src/main/webapp/v4/rte/settings/keymapBuilder.js +0 -223
- package/src/legacy/tool-ui/src/main/webapp/v4/rte/settings/menuItemsBuilder.js +0 -559
- package/src/legacy/tool-ui/src/main/webapp/v4/rte/settings/schemaBuilder.js +0 -1281
- package/src/legacy/tool-ui/src/main/webapp/v4/rte/utilities.d.ts +0 -4
- package/src/legacy/tool-ui/src/main/webapp/v4/rte/utilities.js +0 -359
- package/src/legacy/tool-ui/src/main/webapp/v4/theme/ColorRotator.js +0 -1
- package/src/legacy/tool-ui/src/main/webapp/v4/util/debounce.js +0 -1
- package/src/legacy/tool-ui/src/main/webapp/v4/util/getComponentKey.js +0 -1
- package/src/legacy/tool-ui/src/main/webapp/v4/util/noise.js +0 -1
- package/src/legacy/tool-ui/src/main/webapp/v4/util/repaint.js +0 -1
- package/src/legacy/tool-ui/src/main/webapp/v4/util/storage.js +0 -1
- package/src/legacy/tool-ui/src/main/webapp/v4/util/throttle.js +0 -1
- package/src/legacy/tool-ui/src/main/webapp/v4/widget/AssignmentContent.js +0 -33
- package/src/legacy/tool-ui/src/main/webapp/v4/widget/AssignmentDeskDashboard.js +0 -217
- package/src/legacy/tool-ui/src/main/webapp/v4/widget/AssociatedContentWidget.js +0 -7
- package/src/legacy/tool-ui/src/main/webapp/v4/widget/BulkUpload.js +0 -19
- package/src/legacy/tool-ui/src/main/webapp/v4/widget/Calendar.js +0 -7
- package/src/legacy/tool-ui/src/main/webapp/v4/widget/ClosableWindow.js +0 -13
- package/src/legacy/tool-ui/src/main/webapp/v4/widget/PitchAssignments.js +0 -25
- package/src/legacy/tool-ui/src/main/webapp/v4/widget/PitchContent.js +0 -33
- package/src/legacy/tool-ui/src/main/webapp/v4/widget/Revisions.js +0 -61
|
@@ -1,1491 +0,0 @@
|
|
|
1
|
-
import create from './dom/create'
|
|
2
|
-
import find from './dom/find'
|
|
3
|
-
import findAll from './dom/findAll'
|
|
4
|
-
import ifClick from './dom/ifClick'
|
|
5
|
-
import Tether from './dom/Tether'
|
|
6
|
-
import Cookies from 'js.cookie'
|
|
7
|
-
|
|
8
|
-
let idIndex = 0
|
|
9
|
-
let current
|
|
10
|
-
const tooltips = window.BRIGHTSPOT?.ui?.tooltips
|
|
11
|
-
|
|
12
|
-
export default class ComboInput {
|
|
13
|
-
constructor(select, settings) {
|
|
14
|
-
this._select = select
|
|
15
|
-
this._reorderSelectOptions()
|
|
16
|
-
this._getOptionsIndex = 0
|
|
17
|
-
this._getOptionsUrl =
|
|
18
|
-
typeof settings.getOptionsUrl === 'function' && settings.getOptionsUrl
|
|
19
|
-
this._modifier = settings.modifier
|
|
20
|
-
this._duplicates = new Map()
|
|
21
|
-
this._createNewListItem = null
|
|
22
|
-
this._createNewList = null
|
|
23
|
-
this._fetchOnce = this._select.hasAttribute('data-fetch-once')
|
|
24
|
-
this._optionsLoaded = false
|
|
25
|
-
|
|
26
|
-
this._list = create('ul', {
|
|
27
|
-
id: '_cb' + idIndex++,
|
|
28
|
-
className: 'ComboInput-list',
|
|
29
|
-
'aria-label': select.getAttribute('aria-label') || undefined,
|
|
30
|
-
role: 'listbox',
|
|
31
|
-
'aria-multiselectable': select.hasAttribute('multiple') || undefined,
|
|
32
|
-
|
|
33
|
-
onclick: (e) => {
|
|
34
|
-
if (!e.target.getAttribute('data-create')) {
|
|
35
|
-
e.preventDefault()
|
|
36
|
-
e.stopPropagation()
|
|
37
|
-
|
|
38
|
-
const target = e.target.classList.contains('ComboInput-check')
|
|
39
|
-
? e.target.parentElement
|
|
40
|
-
: e.target
|
|
41
|
-
|
|
42
|
-
if (target.classList.contains('ComboInput-option')) {
|
|
43
|
-
this.updateValue(
|
|
44
|
-
target.getAttribute('data-value'),
|
|
45
|
-
target.getAttribute('data-missing-option'),
|
|
46
|
-
)
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
},
|
|
50
|
-
|
|
51
|
-
onmouseover: (e) => {
|
|
52
|
-
const option = e.target.getAttribute('data-create')
|
|
53
|
-
? e.target.closest('.ComboInput-option')
|
|
54
|
-
: e.target
|
|
55
|
-
|
|
56
|
-
if (option.classList.contains('ComboInput-option')) {
|
|
57
|
-
this._highlightOption(option, 0)
|
|
58
|
-
}
|
|
59
|
-
},
|
|
60
|
-
})
|
|
61
|
-
|
|
62
|
-
this._label = create('div', {
|
|
63
|
-
className: 'ComboInput-label',
|
|
64
|
-
dataset: {
|
|
65
|
-
placeholder:
|
|
66
|
-
select.getAttribute('data-placeholder') ||
|
|
67
|
-
select.getAttribute('placeholder') ||
|
|
68
|
-
'',
|
|
69
|
-
},
|
|
70
|
-
})
|
|
71
|
-
|
|
72
|
-
let searchWidgetFilter = select.closest('.SearchWidget-filter')
|
|
73
|
-
if (searchWidgetFilter) {
|
|
74
|
-
let missing = find(searchWidgetFilter, 'input[type="checkbox"]')
|
|
75
|
-
if (
|
|
76
|
-
missing &&
|
|
77
|
-
missing.closest('.SearchWidget-filter') === searchWidgetFilter
|
|
78
|
-
) {
|
|
79
|
-
this._missing = missing
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
this.updateList()
|
|
84
|
-
const groups = findAll(this._list, '.ComboInput-heading')
|
|
85
|
-
for (let key = 0; key < groups.length; key++) {
|
|
86
|
-
if (groups[key].getAttribute('data-value')) {
|
|
87
|
-
this.updateSelection(groups[key])
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
this.updateLabel()
|
|
91
|
-
|
|
92
|
-
this._filter = create('input', {
|
|
93
|
-
type: 'text',
|
|
94
|
-
className: 'ComboInput-filter',
|
|
95
|
-
'aria-autocomplete': 'list',
|
|
96
|
-
'aria-controls': this._list.id,
|
|
97
|
-
placeholder: window.CONTENT_SELECT_PLACEHOLDER
|
|
98
|
-
? window.CONTENT_SELECT_PLACEHOLDER
|
|
99
|
-
: 'Search',
|
|
100
|
-
oninput: this.filterList.bind(this),
|
|
101
|
-
})
|
|
102
|
-
|
|
103
|
-
this._container = create(
|
|
104
|
-
'div',
|
|
105
|
-
{
|
|
106
|
-
id: select.id || undefined,
|
|
107
|
-
className: 'ComboInput',
|
|
108
|
-
tabIndex: select.tabIndex || 0,
|
|
109
|
-
role: 'combobox',
|
|
110
|
-
'aria-label': select.getAttribute('aria-label') || undefined,
|
|
111
|
-
'aria-haspopup': 'listbox',
|
|
112
|
-
'aria-owns': this._list.id,
|
|
113
|
-
'aria-expanded': 'false',
|
|
114
|
-
'aria-required': select.getAttribute('aria-required') || undefined,
|
|
115
|
-
|
|
116
|
-
onclick: (e) => {
|
|
117
|
-
e.preventDefault()
|
|
118
|
-
this.toggleList()
|
|
119
|
-
},
|
|
120
|
-
|
|
121
|
-
onkeydown: (e) => {
|
|
122
|
-
// allows shiftKey + Tab events & checks for remaining keys in ifUnmodified
|
|
123
|
-
if (e.ctrlKey || e.altKey || e.metaKey) return
|
|
124
|
-
const activeOption = this._getActiveOption()
|
|
125
|
-
const isExpanded =
|
|
126
|
-
this._container.getAttribute('aria-expanded') === 'true'
|
|
127
|
-
|
|
128
|
-
switch (e.key) {
|
|
129
|
-
case 'Enter':
|
|
130
|
-
if (this._select.classList.contains('is-readOnly')) {
|
|
131
|
-
e.preventDefault()
|
|
132
|
-
e.stopPropagation()
|
|
133
|
-
return
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
if (!isExpanded) {
|
|
137
|
-
this.showList()
|
|
138
|
-
e.preventDefault()
|
|
139
|
-
return
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
if (activeOption) {
|
|
143
|
-
if (activeOption.classList.contains('nested')) {
|
|
144
|
-
e.preventDefault()
|
|
145
|
-
this.toggleCreateNewList()
|
|
146
|
-
return
|
|
147
|
-
} else if (
|
|
148
|
-
activeOption.dataset.sublist ||
|
|
149
|
-
activeOption.dataset.create
|
|
150
|
-
) {
|
|
151
|
-
const createLink =
|
|
152
|
-
activeOption.querySelector('a.objectId-create')
|
|
153
|
-
|
|
154
|
-
if (createLink) {
|
|
155
|
-
createLink.click()
|
|
156
|
-
this.hideList()
|
|
157
|
-
}
|
|
158
|
-
} else {
|
|
159
|
-
this.updateValue(
|
|
160
|
-
activeOption.getAttribute('data-value'),
|
|
161
|
-
activeOption.getAttribute('data-missing-option'),
|
|
162
|
-
)
|
|
163
|
-
this.hideList()
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
if (!this._select.multiple) this._container.focus()
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
e.preventDefault()
|
|
170
|
-
e.stopPropagation()
|
|
171
|
-
return
|
|
172
|
-
|
|
173
|
-
case 'Escape':
|
|
174
|
-
if (this._container.matches('[aria-expanded="true"]')) {
|
|
175
|
-
this.hideList()
|
|
176
|
-
this._container.focus()
|
|
177
|
-
e.preventDefault()
|
|
178
|
-
e.stopPropagation()
|
|
179
|
-
}
|
|
180
|
-
return
|
|
181
|
-
|
|
182
|
-
case 'ArrowUp':
|
|
183
|
-
this.showList()
|
|
184
|
-
this._highlightOption(activeOption || this._list.firstChild, -1)
|
|
185
|
-
this.scrollList()
|
|
186
|
-
e.preventDefault()
|
|
187
|
-
e.stopPropagation()
|
|
188
|
-
return
|
|
189
|
-
|
|
190
|
-
case 'ArrowDown':
|
|
191
|
-
this.showList()
|
|
192
|
-
this._highlightOption(activeOption || this._list.lastChild, 1)
|
|
193
|
-
this.scrollList()
|
|
194
|
-
e.preventDefault()
|
|
195
|
-
e.stopPropagation()
|
|
196
|
-
return
|
|
197
|
-
case 'ArrowRight':
|
|
198
|
-
this.focusFavorite()
|
|
199
|
-
return
|
|
200
|
-
|
|
201
|
-
case 'Tab':
|
|
202
|
-
this.hideList()
|
|
203
|
-
return
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
if (this !== current && !e.shiftKey) {
|
|
207
|
-
this.showList()
|
|
208
|
-
}
|
|
209
|
-
},
|
|
210
|
-
},
|
|
211
|
-
this._label,
|
|
212
|
-
this._filter,
|
|
213
|
-
this._list,
|
|
214
|
-
create('span', { class: 'ComboInput-icon', 'aria-hidden': true }),
|
|
215
|
-
)
|
|
216
|
-
|
|
217
|
-
if (
|
|
218
|
-
!this._container.getAttribute('aria-label') ||
|
|
219
|
-
this._container.getAttribute('aria-label').toLowerCase() === 'type'
|
|
220
|
-
) {
|
|
221
|
-
const parentEl =
|
|
222
|
-
select.closest('.CIG-small') || select.closest('.CIG-large')
|
|
223
|
-
if (parentEl) {
|
|
224
|
-
let sibling = parentEl.previousElementSibling
|
|
225
|
-
if (
|
|
226
|
-
sibling &&
|
|
227
|
-
!sibling.classList.contains('CIG-label') &&
|
|
228
|
-
sibling.classList.contains('CIG-note')
|
|
229
|
-
) {
|
|
230
|
-
sibling = sibling.previousElementSibling
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
if (sibling && sibling.classList.contains('CIG-label')) {
|
|
234
|
-
const label = sibling.querySelector('label')
|
|
235
|
-
if (label) {
|
|
236
|
-
const labelText = label.innerText
|
|
237
|
-
if (labelText) {
|
|
238
|
-
this._container.setAttribute('aria-label', labelText)
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
select.removeAttribute('id')
|
|
246
|
-
|
|
247
|
-
if (this._select.multiple) {
|
|
248
|
-
this._container.classList.add('is-multiple')
|
|
249
|
-
this._container.setAttribute(
|
|
250
|
-
'aria-label',
|
|
251
|
-
`${this._container.getAttribute('aria-label')}, ${
|
|
252
|
-
window?.BRIGHTSPOT?.ui?.tooltips?.combo?.multi
|
|
253
|
-
}`,
|
|
254
|
-
)
|
|
255
|
-
} else {
|
|
256
|
-
// Handles syncing with the underlying select for compatibility with v3 js
|
|
257
|
-
this._select.addEventListener('change', (event) => {
|
|
258
|
-
this.updateValue(event.target.value)
|
|
259
|
-
})
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
const observer = new MutationObserver((mutations) => {
|
|
263
|
-
let placeholderChanged
|
|
264
|
-
|
|
265
|
-
for (const mutation of mutations) {
|
|
266
|
-
for (const node of mutation.removedNodes) {
|
|
267
|
-
if (node === select) {
|
|
268
|
-
observer.disconnect()
|
|
269
|
-
return
|
|
270
|
-
}
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
if (
|
|
274
|
-
mutation.attributeName === 'data-placeholder' ||
|
|
275
|
-
mutation.attributeName === 'placeholder'
|
|
276
|
-
) {
|
|
277
|
-
placeholderChanged = true
|
|
278
|
-
}
|
|
279
|
-
}
|
|
280
|
-
|
|
281
|
-
if (placeholderChanged) {
|
|
282
|
-
this._label.dataset.placeholder =
|
|
283
|
-
this._select.dataset.placeholder ||
|
|
284
|
-
this._select.getAttribute('placeholder')
|
|
285
|
-
}
|
|
286
|
-
|
|
287
|
-
if (this._select.value && this._missing) {
|
|
288
|
-
this._missing.checked = false
|
|
289
|
-
this._missing.dispatchEvent(
|
|
290
|
-
new CustomEvent('change', { bubbles: true }),
|
|
291
|
-
)
|
|
292
|
-
}
|
|
293
|
-
this.updateList()
|
|
294
|
-
this._setFocus()
|
|
295
|
-
this.updateLabel()
|
|
296
|
-
}).observe(select, {
|
|
297
|
-
childList: true,
|
|
298
|
-
subtree: true,
|
|
299
|
-
attributeFilter: ['data-placeholder', 'placeholder'],
|
|
300
|
-
})
|
|
301
|
-
|
|
302
|
-
if (!select.isConnected) return
|
|
303
|
-
|
|
304
|
-
select.hidden = true
|
|
305
|
-
select.parentNode.insertBefore(this._container, select.nextSibling)
|
|
306
|
-
}
|
|
307
|
-
|
|
308
|
-
destroy() {
|
|
309
|
-
this._container.remove()
|
|
310
|
-
this._list.remove()
|
|
311
|
-
this._select.hidden = false
|
|
312
|
-
|
|
313
|
-
for (const c of [...this._select.classList]) {
|
|
314
|
-
if (c.startsWith('_')) {
|
|
315
|
-
this._select.classList.remove(c)
|
|
316
|
-
}
|
|
317
|
-
}
|
|
318
|
-
}
|
|
319
|
-
|
|
320
|
-
_reorderSelectOptions() {
|
|
321
|
-
const first = this._select.firstChild
|
|
322
|
-
|
|
323
|
-
for (const option of Array.from(
|
|
324
|
-
findAll(this._select, 'option'),
|
|
325
|
-
).reverse()) {
|
|
326
|
-
if (option.selected) {
|
|
327
|
-
const parent = option.closest('optgroup') || this._select
|
|
328
|
-
parent.insertBefore(option, parent.firstChild)
|
|
329
|
-
}
|
|
330
|
-
}
|
|
331
|
-
}
|
|
332
|
-
|
|
333
|
-
handleIntersect = (entries, observer) => {
|
|
334
|
-
for (let entry of entries) {
|
|
335
|
-
if (entry.isIntersecting === false) {
|
|
336
|
-
this._list.style.display = 'none'
|
|
337
|
-
} else {
|
|
338
|
-
this._list.style.display = 'block'
|
|
339
|
-
}
|
|
340
|
-
}
|
|
341
|
-
}
|
|
342
|
-
|
|
343
|
-
scrollList() {
|
|
344
|
-
const active = this._getActiveOption()
|
|
345
|
-
if (!active) return
|
|
346
|
-
const listRect = this._list.getBoundingClientRect()
|
|
347
|
-
const optionRect = active.getBoundingClientRect()
|
|
348
|
-
|
|
349
|
-
// ensures the list scrolls only when the option is not in view
|
|
350
|
-
if (optionRect.bottom > listRect.bottom) {
|
|
351
|
-
active.scrollIntoView(false)
|
|
352
|
-
} else if (optionRect.top < listRect.top) {
|
|
353
|
-
active.scrollIntoView(true)
|
|
354
|
-
}
|
|
355
|
-
}
|
|
356
|
-
|
|
357
|
-
toggleSelection(checkbox, group) {
|
|
358
|
-
checkbox.classList.toggle('is-checked')
|
|
359
|
-
const id = group.getAttribute('data-value')
|
|
360
|
-
const options = findAll(
|
|
361
|
-
this._list,
|
|
362
|
-
`.ComboInput-option[data-source="${CSS.escape(id)}"]`,
|
|
363
|
-
)
|
|
364
|
-
for (let key = 0; key < options.length; key++) {
|
|
365
|
-
options[key].setAttribute(
|
|
366
|
-
'aria-selected',
|
|
367
|
-
checkbox.classList.contains('is-checked'),
|
|
368
|
-
)
|
|
369
|
-
}
|
|
370
|
-
this.updateLabel()
|
|
371
|
-
}
|
|
372
|
-
|
|
373
|
-
updateSelection(group) {
|
|
374
|
-
if (group) {
|
|
375
|
-
const id = group.getAttribute('data-value')
|
|
376
|
-
const escapedId = CSS.escape(id)
|
|
377
|
-
let options = findAll(
|
|
378
|
-
this._list,
|
|
379
|
-
`.ComboInput-option[data-source="${escapedId}"]:not([data-is-hidden])`,
|
|
380
|
-
)
|
|
381
|
-
if (options.length === 0) {
|
|
382
|
-
group.setAttribute('data-hidden', true)
|
|
383
|
-
return
|
|
384
|
-
}
|
|
385
|
-
const selectedOptions = findAll(
|
|
386
|
-
this._list,
|
|
387
|
-
`.ComboInput-option[data-source="${escapedId}"][aria-selected="true"]`,
|
|
388
|
-
)
|
|
389
|
-
const checkbox = find(group, '.ComboInput-selectOption')
|
|
390
|
-
checkbox.classList.toggle(
|
|
391
|
-
'is-checked',
|
|
392
|
-
options.length > 0 && options.length === selectedOptions.length,
|
|
393
|
-
)
|
|
394
|
-
}
|
|
395
|
-
}
|
|
396
|
-
|
|
397
|
-
updateList() {
|
|
398
|
-
if (this._select.dataset.collapseDuplicateOptions) {
|
|
399
|
-
// Only collapse if underlying select supports multiples.
|
|
400
|
-
if (this._select.hasAttribute('multiple')) {
|
|
401
|
-
const children = Array.from(this._select.childNodes)
|
|
402
|
-
|
|
403
|
-
for (const child of children) {
|
|
404
|
-
if (this._duplicates.has(child.value)) {
|
|
405
|
-
continue
|
|
406
|
-
}
|
|
407
|
-
|
|
408
|
-
const duplicates = children.filter(
|
|
409
|
-
(c) => c.textContent === child.textContent,
|
|
410
|
-
)
|
|
411
|
-
|
|
412
|
-
if (duplicates.length > 1) {
|
|
413
|
-
duplicates.forEach((option, i) => {
|
|
414
|
-
if (i === 0) {
|
|
415
|
-
this._duplicates.set(option.value, {
|
|
416
|
-
display: true,
|
|
417
|
-
text: option.textContent,
|
|
418
|
-
})
|
|
419
|
-
} else {
|
|
420
|
-
this._duplicates.set(option.value, {
|
|
421
|
-
display: false,
|
|
422
|
-
text: option.textContent,
|
|
423
|
-
})
|
|
424
|
-
}
|
|
425
|
-
})
|
|
426
|
-
}
|
|
427
|
-
}
|
|
428
|
-
} else {
|
|
429
|
-
console.warn(
|
|
430
|
-
'Select element has "data-collapse-duplicate-options" without a "multiple" attribute.',
|
|
431
|
-
this._select,
|
|
432
|
-
)
|
|
433
|
-
}
|
|
434
|
-
}
|
|
435
|
-
|
|
436
|
-
this._list.innerHTML = ''
|
|
437
|
-
this._createOptions(this._select, 0)
|
|
438
|
-
}
|
|
439
|
-
|
|
440
|
-
_createOptions(select, index, group, grpIdx) {
|
|
441
|
-
if (!grpIdx) {
|
|
442
|
-
grpIdx = 0
|
|
443
|
-
}
|
|
444
|
-
for (const child of select.childNodes) {
|
|
445
|
-
switch (child.tagName) {
|
|
446
|
-
case 'OPTGROUP': {
|
|
447
|
-
const grpId = `${this._list.id}-g${grpIdx++}`
|
|
448
|
-
const optionGroup = create('ul', {
|
|
449
|
-
className: 'ComboInput-optionGroup',
|
|
450
|
-
role: 'group',
|
|
451
|
-
'aria-labelledby': grpId,
|
|
452
|
-
})
|
|
453
|
-
const sectionHeading = create(
|
|
454
|
-
'div',
|
|
455
|
-
{ id: grpId, className: 'ComboInput-heading' },
|
|
456
|
-
child.label,
|
|
457
|
-
)
|
|
458
|
-
const option = create('li', sectionHeading, optionGroup)
|
|
459
|
-
if (child.getAttribute('data-select-option')) {
|
|
460
|
-
optionGroup.dataset.selectOption = child.dataset.selectOption
|
|
461
|
-
sectionHeading.dataset.value = child.getAttribute('value')
|
|
462
|
-
sectionHeading.appendChild(
|
|
463
|
-
create('span', {
|
|
464
|
-
className: 'ComboInput-selectOption',
|
|
465
|
-
onclick: (e) => {
|
|
466
|
-
this.toggleSelection(e.target, sectionHeading)
|
|
467
|
-
},
|
|
468
|
-
}),
|
|
469
|
-
)
|
|
470
|
-
}
|
|
471
|
-
this._list.appendChild(option)
|
|
472
|
-
index = this._createOptions(child, index, optionGroup, grpIdx)
|
|
473
|
-
break
|
|
474
|
-
}
|
|
475
|
-
|
|
476
|
-
case 'OPTION': {
|
|
477
|
-
let htmlString = child.dataset.dropDownHtml || child.dataset.labelHtml
|
|
478
|
-
if (!child.getAttribute('data-create')) {
|
|
479
|
-
const opt = create(
|
|
480
|
-
'li',
|
|
481
|
-
{
|
|
482
|
-
id: `${this._list.id}-o${index++}`,
|
|
483
|
-
className: 'ComboInput-option',
|
|
484
|
-
role: 'option',
|
|
485
|
-
'aria-selected':
|
|
486
|
-
!(this._missing && this._missing.checked) &&
|
|
487
|
-
(child.selected || child.value === select.value),
|
|
488
|
-
'data-value': child.value,
|
|
489
|
-
},
|
|
490
|
-
create('span', {
|
|
491
|
-
class: 'ComboInput-check',
|
|
492
|
-
'aria-hidden': true,
|
|
493
|
-
}),
|
|
494
|
-
htmlString
|
|
495
|
-
? create('div', {
|
|
496
|
-
className: 'ComboInput-option-iframe',
|
|
497
|
-
innerHTML: htmlString,
|
|
498
|
-
})
|
|
499
|
-
: child.label || '',
|
|
500
|
-
)
|
|
501
|
-
if (
|
|
502
|
-
!opt.textContent &&
|
|
503
|
-
(select.dataset.placeholder || select.getAttribute('placeholder'))
|
|
504
|
-
) {
|
|
505
|
-
opt.appendChild(
|
|
506
|
-
create(
|
|
507
|
-
'div',
|
|
508
|
-
{ className: 'ComboInput-option-iframe' },
|
|
509
|
-
create(
|
|
510
|
-
'span',
|
|
511
|
-
{ className: 'ContentSelector-placeholder' },
|
|
512
|
-
select.dataset.placeholder ||
|
|
513
|
-
select.getAttribute('placeholder'),
|
|
514
|
-
),
|
|
515
|
-
),
|
|
516
|
-
)
|
|
517
|
-
}
|
|
518
|
-
if (
|
|
519
|
-
this._duplicates.has(child.value) &&
|
|
520
|
-
!this._duplicates.get(child.value).display
|
|
521
|
-
) {
|
|
522
|
-
opt.classList.add('is-hidden')
|
|
523
|
-
}
|
|
524
|
-
if (!child.label && opt.children.length <= 1) {
|
|
525
|
-
opt.classList.add('is-empty')
|
|
526
|
-
opt.setAttribute('aria-label', tooltips?.combo?.empty)
|
|
527
|
-
}
|
|
528
|
-
|
|
529
|
-
if (this._modifier === 'is-hidePlaceholder') {
|
|
530
|
-
// hide placeholder option from screen reader
|
|
531
|
-
const placeholderElm =
|
|
532
|
-
child.value === '' &&
|
|
533
|
-
opt.querySelector('.ContentSelector-placeholder')
|
|
534
|
-
if (
|
|
535
|
-
opt.classList.contains('is-empty') ||
|
|
536
|
-
placeholderElm ||
|
|
537
|
-
child.dataset.allTypes === 'true'
|
|
538
|
-
) {
|
|
539
|
-
opt.role = 'presentation'
|
|
540
|
-
opt.setAttribute('aria-selected', 'false')
|
|
541
|
-
opt.classList.add('ComboInput-placeholder-option')
|
|
542
|
-
opt.classList.remove('ComboInput-option')
|
|
543
|
-
}
|
|
544
|
-
}
|
|
545
|
-
|
|
546
|
-
if (
|
|
547
|
-
this._duplicates.has(child.value) &&
|
|
548
|
-
!this._duplicates.get(child.value).display
|
|
549
|
-
) {
|
|
550
|
-
opt.classList.add('is-hidden')
|
|
551
|
-
}
|
|
552
|
-
if (child.getAttribute('data-can-favorite')) {
|
|
553
|
-
let favButtonClassName = 'ComboInput-option-favorite'
|
|
554
|
-
let favTitle = tooltips?.action?.unfavorite
|
|
555
|
-
if (!child.parentElement.getAttribute('data-favorites')) {
|
|
556
|
-
const favOptGroup = this._select.querySelector(
|
|
557
|
-
'optgroup[data-favorites]',
|
|
558
|
-
)
|
|
559
|
-
if (favOptGroup) {
|
|
560
|
-
const existingFav = favOptGroup.querySelector(
|
|
561
|
-
`option[value="${CSS.escape(child.value)}"]`,
|
|
562
|
-
)
|
|
563
|
-
if (!existingFav) {
|
|
564
|
-
favButtonClassName = favButtonClassName + ' is-unstarred'
|
|
565
|
-
favTitle = tooltips?.action?.favorite
|
|
566
|
-
}
|
|
567
|
-
} else {
|
|
568
|
-
favButtonClassName = favButtonClassName + ' is-unstarred'
|
|
569
|
-
favTitle = tooltips?.action?.favorite
|
|
570
|
-
}
|
|
571
|
-
}
|
|
572
|
-
const favButton = create(
|
|
573
|
-
'button',
|
|
574
|
-
{
|
|
575
|
-
className: favButtonClassName,
|
|
576
|
-
type: 'button',
|
|
577
|
-
'data-id': child.value,
|
|
578
|
-
title: favTitle,
|
|
579
|
-
'aria-label': favTitle,
|
|
580
|
-
onkeydown: async (e) => {
|
|
581
|
-
switch (e.code) {
|
|
582
|
-
case 'ArrowLeft':
|
|
583
|
-
this._filter.focus()
|
|
584
|
-
return
|
|
585
|
-
case 'ArrowUp':
|
|
586
|
-
case 'ArrowDown':
|
|
587
|
-
this._filter.focus()
|
|
588
|
-
this.showList()
|
|
589
|
-
this._highlightOption(
|
|
590
|
-
this._getActiveOption(),
|
|
591
|
-
e.code === 'ArrowUp' ? -1 : 1,
|
|
592
|
-
)
|
|
593
|
-
this.scrollList()
|
|
594
|
-
return
|
|
595
|
-
case 'Escape':
|
|
596
|
-
this.hideList()
|
|
597
|
-
this._container.focus()
|
|
598
|
-
e.stopPropagation()
|
|
599
|
-
return
|
|
600
|
-
case 'Tab':
|
|
601
|
-
this._filter.focus()
|
|
602
|
-
this.hideList()
|
|
603
|
-
return
|
|
604
|
-
}
|
|
605
|
-
},
|
|
606
|
-
onclick: async (evt) => {
|
|
607
|
-
const connectedFavorites = this._list.querySelectorAll(`
|
|
608
|
-
.ComboInput-option-favorite[data-id="${CSS.escape(child.value)}"]`)
|
|
609
|
-
connectedFavorites.forEach((favorite) => {
|
|
610
|
-
const status = favorite.classList.contains('is-unstarred')
|
|
611
|
-
? tooltips?.action?.unfavorite
|
|
612
|
-
: tooltips?.action?.favorite
|
|
613
|
-
favorite.title = status
|
|
614
|
-
favorite.nextElementSibling.textContent = status
|
|
615
|
-
favorite.classList.toggle('is-unstarred')
|
|
616
|
-
favorite.setAttribute('aria-label', status)
|
|
617
|
-
})
|
|
618
|
-
let url
|
|
619
|
-
let typeIds = child.getAttribute('data-typeids')
|
|
620
|
-
if (typeIds) {
|
|
621
|
-
let typeIdsParam = typeIds.split(',').join('&typeIds=')
|
|
622
|
-
url =
|
|
623
|
-
CONTEXT_PATH +
|
|
624
|
-
'update-dropdown-favorites?action=update&typeIds=' +
|
|
625
|
-
typeIdsParam +
|
|
626
|
-
'&id=' +
|
|
627
|
-
child.value
|
|
628
|
-
} else {
|
|
629
|
-
url =
|
|
630
|
-
CONTEXT_PATH +
|
|
631
|
-
'update-dropdown-favorites?action=update&typeIds=' +
|
|
632
|
-
child.value
|
|
633
|
-
}
|
|
634
|
-
const headers = new Headers()
|
|
635
|
-
headers.append('Brightspot-CSRF', Cookies.get('bsp.csrf'))
|
|
636
|
-
try {
|
|
637
|
-
const response = await fetch(url, {
|
|
638
|
-
method: 'POST',
|
|
639
|
-
headers: headers,
|
|
640
|
-
})
|
|
641
|
-
if (
|
|
642
|
-
response.redirected &&
|
|
643
|
-
response.url.includes(
|
|
644
|
-
window.BRIGHTSPOT.web.pagePaths[
|
|
645
|
-
'com.psddev.cms.auth.LogInPage'
|
|
646
|
-
],
|
|
647
|
-
)
|
|
648
|
-
) {
|
|
649
|
-
throw new Error(
|
|
650
|
-
'ComboInput: Redirected response received for click.',
|
|
651
|
-
)
|
|
652
|
-
}
|
|
653
|
-
} catch (error) {
|
|
654
|
-
console.error(error)
|
|
655
|
-
}
|
|
656
|
-
},
|
|
657
|
-
},
|
|
658
|
-
create('span', {
|
|
659
|
-
class: 'ComboInput-option-favorite-icon',
|
|
660
|
-
'aria-hidden': true,
|
|
661
|
-
}),
|
|
662
|
-
)
|
|
663
|
-
opt.appendChild(favButton)
|
|
664
|
-
opt.appendChild(
|
|
665
|
-
create('span', {
|
|
666
|
-
'aria-live': 'polite',
|
|
667
|
-
class: 'screen-reader-only',
|
|
668
|
-
}),
|
|
669
|
-
)
|
|
670
|
-
}
|
|
671
|
-
if (child.getAttribute('data-source')) {
|
|
672
|
-
opt.setAttribute('data-source', child.getAttribute('data-source'))
|
|
673
|
-
}
|
|
674
|
-
if (group) {
|
|
675
|
-
group.appendChild(opt)
|
|
676
|
-
} else {
|
|
677
|
-
this._list.appendChild(opt)
|
|
678
|
-
}
|
|
679
|
-
} else if (
|
|
680
|
-
child.getAttribute('data-create-types') &&
|
|
681
|
-
!child.closest('.SearchWidget-filter')
|
|
682
|
-
) {
|
|
683
|
-
const createTypes = JSON.parse(child.dataset.createTypes)
|
|
684
|
-
this._createNewList = create(
|
|
685
|
-
'ul',
|
|
686
|
-
{
|
|
687
|
-
role: 'listbox',
|
|
688
|
-
hidden: 'true',
|
|
689
|
-
},
|
|
690
|
-
createTypes.map((c) =>
|
|
691
|
-
create(
|
|
692
|
-
'li',
|
|
693
|
-
{
|
|
694
|
-
className: 'ComboInput-option',
|
|
695
|
-
'data-sublist': true,
|
|
696
|
-
role: 'none', // Set role to none until list expanded to ensure screen reader does not count this item in total list count.
|
|
697
|
-
id: `${this._list.id}-o${index++}`,
|
|
698
|
-
},
|
|
699
|
-
create('a', {
|
|
700
|
-
className: 'objectId-create nested',
|
|
701
|
-
tabIndex: '-1', // Prevent default tabbing behavior for items in list.
|
|
702
|
-
href: c.href,
|
|
703
|
-
target: `create-new-object-${this._list.id}`,
|
|
704
|
-
'data-create': true,
|
|
705
|
-
'data-popup-mode': 'noGap fromBottom',
|
|
706
|
-
innerHTML: c.label || '',
|
|
707
|
-
}),
|
|
708
|
-
),
|
|
709
|
-
),
|
|
710
|
-
)
|
|
711
|
-
this._createNewListItem = create(
|
|
712
|
-
'li',
|
|
713
|
-
{
|
|
714
|
-
className: 'ComboInput-option nested',
|
|
715
|
-
'data-create': true,
|
|
716
|
-
role: 'button',
|
|
717
|
-
'aria-expanded': false,
|
|
718
|
-
'aria-label': child.label,
|
|
719
|
-
id: `${this._list.id}-o${index++}`,
|
|
720
|
-
onclick: (e) => {
|
|
721
|
-
if (e.target.tagName !== 'A') {
|
|
722
|
-
e.preventDefault()
|
|
723
|
-
e.stopPropagation()
|
|
724
|
-
this.toggleCreateNewList()
|
|
725
|
-
this._filter.focus()
|
|
726
|
-
}
|
|
727
|
-
},
|
|
728
|
-
},
|
|
729
|
-
create(
|
|
730
|
-
'span',
|
|
731
|
-
{
|
|
732
|
-
innerHTML: child.label || '',
|
|
733
|
-
className: 'ComboInput-option-nestedLabel',
|
|
734
|
-
'data-create': true,
|
|
735
|
-
},
|
|
736
|
-
create(
|
|
737
|
-
'span',
|
|
738
|
-
{
|
|
739
|
-
className: 'ComboInput-option-arrow',
|
|
740
|
-
},
|
|
741
|
-
create('span', {
|
|
742
|
-
class: 'ComboInput-option-arrow-icon',
|
|
743
|
-
'aria-hidden': true,
|
|
744
|
-
}),
|
|
745
|
-
),
|
|
746
|
-
),
|
|
747
|
-
this._createNewList,
|
|
748
|
-
)
|
|
749
|
-
|
|
750
|
-
this._list.insertBefore(
|
|
751
|
-
this._createNewListItem,
|
|
752
|
-
this._list.firstElementChild,
|
|
753
|
-
)
|
|
754
|
-
} else if (
|
|
755
|
-
child.getAttribute('data-create') &&
|
|
756
|
-
!child.closest('.SearchWidget-filter')
|
|
757
|
-
) {
|
|
758
|
-
this._list.insertBefore(
|
|
759
|
-
create(
|
|
760
|
-
'li',
|
|
761
|
-
{
|
|
762
|
-
id: `${this._list.id}-o${index++}`,
|
|
763
|
-
className: 'ComboInput-option',
|
|
764
|
-
role: 'option',
|
|
765
|
-
'aria-selected': false,
|
|
766
|
-
'data-create': true,
|
|
767
|
-
},
|
|
768
|
-
create('span', {
|
|
769
|
-
class: 'ComboInput-check',
|
|
770
|
-
'aria-hidden': true,
|
|
771
|
-
}),
|
|
772
|
-
create('a', {
|
|
773
|
-
className: 'objectId-create',
|
|
774
|
-
href: child.getAttribute('data-href'),
|
|
775
|
-
target: `create-new-object-${this._list.id}`,
|
|
776
|
-
'data-create': true,
|
|
777
|
-
'data-popup-mode': 'noGap fromBottom',
|
|
778
|
-
innerHTML: child.label || '',
|
|
779
|
-
}),
|
|
780
|
-
),
|
|
781
|
-
this._list.firstElementChild,
|
|
782
|
-
)
|
|
783
|
-
}
|
|
784
|
-
break
|
|
785
|
-
}
|
|
786
|
-
}
|
|
787
|
-
}
|
|
788
|
-
|
|
789
|
-
if (this._missing && !find(this._list, '[data-missing-option=true]')) {
|
|
790
|
-
const missing = create(
|
|
791
|
-
'li',
|
|
792
|
-
{
|
|
793
|
-
id: `${this._list.id}-o${index++}`,
|
|
794
|
-
className: 'ComboInput-option',
|
|
795
|
-
role: 'option',
|
|
796
|
-
'data-missing-option': true,
|
|
797
|
-
'aria-selected': this._missing.checked,
|
|
798
|
-
},
|
|
799
|
-
create('span', {
|
|
800
|
-
class: 'ComboInput-check',
|
|
801
|
-
'aria-hidden': true,
|
|
802
|
-
}),
|
|
803
|
-
window.SEARCH_FILTER_IS_MISSING
|
|
804
|
-
? window.SEARCH_FILTER_IS_MISSING
|
|
805
|
-
: 'Is Missing',
|
|
806
|
-
)
|
|
807
|
-
|
|
808
|
-
if (this._list.firstElementChild.getAttribute('data-value')) {
|
|
809
|
-
this._list.insertBefore(missing, this._list.firstElementChild)
|
|
810
|
-
} else {
|
|
811
|
-
this._list.insertBefore(
|
|
812
|
-
missing,
|
|
813
|
-
this._list.firstElementChild.nextElementSibling,
|
|
814
|
-
)
|
|
815
|
-
}
|
|
816
|
-
}
|
|
817
|
-
|
|
818
|
-
if (
|
|
819
|
-
this._select.multiple &&
|
|
820
|
-
this._select.getAttribute('data-allow-select-all')
|
|
821
|
-
) {
|
|
822
|
-
const selectAll = create(
|
|
823
|
-
'li',
|
|
824
|
-
{
|
|
825
|
-
id: `${this._list.id}-o${index++}`,
|
|
826
|
-
className: 'ComboInput-option',
|
|
827
|
-
role: 'option',
|
|
828
|
-
'data-select-all': true,
|
|
829
|
-
'aria-selected':
|
|
830
|
-
findAll(this._list, '[aria-selected=true]').length ===
|
|
831
|
-
this._getOptions().length,
|
|
832
|
-
},
|
|
833
|
-
create('span', {
|
|
834
|
-
class: 'ComboInput-check',
|
|
835
|
-
'aria-hidden': true,
|
|
836
|
-
}),
|
|
837
|
-
this._select.getAttribute('data-select-all-label'),
|
|
838
|
-
)
|
|
839
|
-
this._list.insertBefore(selectAll, this._list.firstElementChild)
|
|
840
|
-
}
|
|
841
|
-
|
|
842
|
-
return index
|
|
843
|
-
}
|
|
844
|
-
|
|
845
|
-
_getOptions() {
|
|
846
|
-
return findAll(this._list, '.ComboInput-option')
|
|
847
|
-
}
|
|
848
|
-
|
|
849
|
-
_highlightOption(option, move) {
|
|
850
|
-
if (!option) {
|
|
851
|
-
return
|
|
852
|
-
}
|
|
853
|
-
|
|
854
|
-
const options = []
|
|
855
|
-
|
|
856
|
-
for (const o of this._getOptions()) {
|
|
857
|
-
o.classList.remove('is-active')
|
|
858
|
-
|
|
859
|
-
if (!o.hidden && !o.parentElement.hidden) {
|
|
860
|
-
options.push(o)
|
|
861
|
-
}
|
|
862
|
-
}
|
|
863
|
-
|
|
864
|
-
const length = options.length
|
|
865
|
-
let index
|
|
866
|
-
|
|
867
|
-
for (let i = 0; i < length; ++i) {
|
|
868
|
-
if (option === options[i]) {
|
|
869
|
-
index = i
|
|
870
|
-
break
|
|
871
|
-
}
|
|
872
|
-
}
|
|
873
|
-
|
|
874
|
-
index = (index + move) % length
|
|
875
|
-
|
|
876
|
-
while (index < 0) {
|
|
877
|
-
index += length
|
|
878
|
-
}
|
|
879
|
-
|
|
880
|
-
const highlight = options[index]
|
|
881
|
-
|
|
882
|
-
if (highlight) {
|
|
883
|
-
this._filter.setAttribute('aria-activedescendant', highlight.id)
|
|
884
|
-
highlight.classList.add('is-active')
|
|
885
|
-
}
|
|
886
|
-
}
|
|
887
|
-
|
|
888
|
-
_getActiveOption() {
|
|
889
|
-
return find(this._list, '.ComboInput-option.is-active')
|
|
890
|
-
}
|
|
891
|
-
|
|
892
|
-
/**
|
|
893
|
-
* 1. If no options are selected before listbox receives focus, the first option in the list receives focus
|
|
894
|
-
* 2. If options are selected before listbox receives focus:
|
|
895
|
-
* - If it's a single-select listbox, the selected option receives focus
|
|
896
|
-
* - If it's multi-select listbox, focus is set on the first option from the selected list of options
|
|
897
|
-
*/
|
|
898
|
-
_setFocus() {
|
|
899
|
-
let itemIndex = 0
|
|
900
|
-
if (this._list.querySelector('li[aria-selected="true"]')) {
|
|
901
|
-
const options = this._getOptions()
|
|
902
|
-
while (
|
|
903
|
-
itemIndex < options.length &&
|
|
904
|
-
options[itemIndex].matches('[aria-selected="false"]')
|
|
905
|
-
) {
|
|
906
|
-
itemIndex++
|
|
907
|
-
}
|
|
908
|
-
}
|
|
909
|
-
this._highlightOption(find(this._list, '.ComboInput-option'), itemIndex)
|
|
910
|
-
}
|
|
911
|
-
|
|
912
|
-
updateLabel() {
|
|
913
|
-
this._label.innerHTML = ''
|
|
914
|
-
this._selectParent = this._select.parentElement
|
|
915
|
-
this._actionCreateEl = this._selectParent
|
|
916
|
-
? this._selectParent.querySelector('.action.action-create')
|
|
917
|
-
: null
|
|
918
|
-
|
|
919
|
-
const selectAll = find(
|
|
920
|
-
this._list,
|
|
921
|
-
'[data-select-all=true][aria-selected=true]',
|
|
922
|
-
)
|
|
923
|
-
if (selectAll) {
|
|
924
|
-
this._label.appendChild(
|
|
925
|
-
create(
|
|
926
|
-
'div',
|
|
927
|
-
{ className: 'ComboInput-selected' },
|
|
928
|
-
selectAll.textContent || '',
|
|
929
|
-
),
|
|
930
|
-
)
|
|
931
|
-
} else {
|
|
932
|
-
const selected = Array.prototype.filter.call(
|
|
933
|
-
this._getOptions(),
|
|
934
|
-
(child) =>
|
|
935
|
-
child.getAttribute('aria-selected') === 'true' &&
|
|
936
|
-
!child.getAttribute('data-no-permission'),
|
|
937
|
-
)
|
|
938
|
-
|
|
939
|
-
const displays = []
|
|
940
|
-
|
|
941
|
-
for (const child of selected) {
|
|
942
|
-
const childCopy = child.cloneNode(true)
|
|
943
|
-
const selection = this._select.closest('.SearchWidget-filterItem')
|
|
944
|
-
|
|
945
|
-
if (selection) {
|
|
946
|
-
this._select.classList.toggle(
|
|
947
|
-
'is-readOnly',
|
|
948
|
-
selection.parentNode.classList.contains('is-multiple') &&
|
|
949
|
-
childCopy.getAttribute('data-value'),
|
|
950
|
-
)
|
|
951
|
-
}
|
|
952
|
-
|
|
953
|
-
// Remove any markup used for Favorites display.
|
|
954
|
-
childCopy.querySelector('[data-id]')?.remove()
|
|
955
|
-
|
|
956
|
-
let display
|
|
957
|
-
if (childCopy.getAttribute('data-missing-option')) {
|
|
958
|
-
let placeholderOption = find(
|
|
959
|
-
this._list,
|
|
960
|
-
'.ComboInput-option[data-value=""]',
|
|
961
|
-
)
|
|
962
|
-
if (!placeholderOption) {
|
|
963
|
-
placeholderOption = find(
|
|
964
|
-
this._list,
|
|
965
|
-
'.ComboInput-placeholder-option',
|
|
966
|
-
)
|
|
967
|
-
}
|
|
968
|
-
display = childCopy.textContent + ': ' + placeholderOption?.innerHTML
|
|
969
|
-
} else {
|
|
970
|
-
display = childCopy.innerHTML
|
|
971
|
-
}
|
|
972
|
-
|
|
973
|
-
if (display && !displays.some((d) => d === display)) {
|
|
974
|
-
displays.push(display)
|
|
975
|
-
}
|
|
976
|
-
}
|
|
977
|
-
|
|
978
|
-
let display
|
|
979
|
-
const displaysLength = displays.length
|
|
980
|
-
|
|
981
|
-
if (displaysLength > 0) {
|
|
982
|
-
if (this._select.closest('.CIG-row')) {
|
|
983
|
-
display = displays.join(', ')
|
|
984
|
-
} else {
|
|
985
|
-
display = displays[0]
|
|
986
|
-
|
|
987
|
-
if (displaysLength > 1) {
|
|
988
|
-
display += ` +${displaysLength - 1}`
|
|
989
|
-
}
|
|
990
|
-
}
|
|
991
|
-
}
|
|
992
|
-
|
|
993
|
-
if (display) {
|
|
994
|
-
this._label.appendChild(
|
|
995
|
-
create('div', {
|
|
996
|
-
className: 'ComboInput-selected',
|
|
997
|
-
innerHTML: display,
|
|
998
|
-
}),
|
|
999
|
-
)
|
|
1000
|
-
if (this._actionCreateEl) {
|
|
1001
|
-
this._actionCreateEl.setAttribute(
|
|
1002
|
-
'aria-label',
|
|
1003
|
-
`${this._actionCreateEl.innerText.toLowerCase()} ${
|
|
1004
|
-
this._label.innerText
|
|
1005
|
-
}`,
|
|
1006
|
-
)
|
|
1007
|
-
}
|
|
1008
|
-
}
|
|
1009
|
-
}
|
|
1010
|
-
}
|
|
1011
|
-
|
|
1012
|
-
async populateFavorites() {
|
|
1013
|
-
if (this._select.querySelector('option[data-can-favorite]')) {
|
|
1014
|
-
// If the select has a sibling input element, that will have data-typeIds attr and this is a content dropdown;
|
|
1015
|
-
// else, this is a type dropdown. If it is an ObjectType, the typeIds will populate in typesArrayOption instead
|
|
1016
|
-
// of validTypeIds.
|
|
1017
|
-
const input = this._select.parentNode.querySelector('input[data-typeids]')
|
|
1018
|
-
const validTypeIds = this._select.getAttribute('data-typeIds')
|
|
1019
|
-
var options = this._select.options
|
|
1020
|
-
const typesArrayOptions = Array.from(options).map(
|
|
1021
|
-
(option) => option.value,
|
|
1022
|
-
)
|
|
1023
|
-
const hasDataTypeids = Array.from(options).some((option) =>
|
|
1024
|
-
option.hasAttribute('data-typeids'),
|
|
1025
|
-
)
|
|
1026
|
-
let url
|
|
1027
|
-
let data = new FormData()
|
|
1028
|
-
if (input && hasDataTypeids) {
|
|
1029
|
-
const validTypeIdsParam = input.getAttribute('data-typeIds').split(',')
|
|
1030
|
-
url =
|
|
1031
|
-
CONTEXT_PATH +
|
|
1032
|
-
'update-dropdown-favorites?action=getExisting&isFavoritedType=false'
|
|
1033
|
-
validTypeIdsParam.forEach((id) => {
|
|
1034
|
-
data.append('validTypeIds', id)
|
|
1035
|
-
})
|
|
1036
|
-
} else if (validTypeIds || typesArrayOptions) {
|
|
1037
|
-
url =
|
|
1038
|
-
CONTEXT_PATH +
|
|
1039
|
-
'update-dropdown-favorites?action=getExisting&isFavoritedType=true'
|
|
1040
|
-
const typeIds = validTypeIds
|
|
1041
|
-
? validTypeIds.split(',')
|
|
1042
|
-
: typesArrayOptions
|
|
1043
|
-
typeIds.forEach((id) => {
|
|
1044
|
-
data.append('validTypeIds', id)
|
|
1045
|
-
})
|
|
1046
|
-
} else {
|
|
1047
|
-
url =
|
|
1048
|
-
CONTEXT_PATH +
|
|
1049
|
-
'update-dropdown-favorites?action=getExisting&isFavoritedType=true'
|
|
1050
|
-
}
|
|
1051
|
-
const headers = new Headers()
|
|
1052
|
-
headers.append('Brightspot-CSRF', Cookies.get('bsp.csrf'))
|
|
1053
|
-
try {
|
|
1054
|
-
const response = await fetch(url, {
|
|
1055
|
-
method: 'POST',
|
|
1056
|
-
headers: headers,
|
|
1057
|
-
body: data,
|
|
1058
|
-
})
|
|
1059
|
-
if (
|
|
1060
|
-
response.redirected &&
|
|
1061
|
-
response.url.includes(
|
|
1062
|
-
window.BRIGHTSPOT.web.pagePaths['com.psddev.cms.auth.LogInPage'],
|
|
1063
|
-
)
|
|
1064
|
-
) {
|
|
1065
|
-
throw new Error(
|
|
1066
|
-
'ComboInput: Redirected response received for favorites.',
|
|
1067
|
-
)
|
|
1068
|
-
}
|
|
1069
|
-
const responseText = await response.text()
|
|
1070
|
-
const favOptGroup = new DOMParser()
|
|
1071
|
-
.parseFromString(responseText, 'text/html')
|
|
1072
|
-
.body.querySelector('optgroup')
|
|
1073
|
-
const oldFavorites = this._select.querySelector(
|
|
1074
|
-
'optgroup[data-favorites]',
|
|
1075
|
-
)
|
|
1076
|
-
if (oldFavorites) {
|
|
1077
|
-
const selectedOptions = Array.from(
|
|
1078
|
-
this._list.querySelectorAll('li[aria-selected="true"]'),
|
|
1079
|
-
)
|
|
1080
|
-
|
|
1081
|
-
const selectedValues = new Set(
|
|
1082
|
-
selectedOptions.map((li) => li.dataset.value),
|
|
1083
|
-
)
|
|
1084
|
-
|
|
1085
|
-
for (const option of this._select.querySelectorAll('option')) {
|
|
1086
|
-
if (selectedValues.has(option.value)) {
|
|
1087
|
-
option.selected = true
|
|
1088
|
-
}
|
|
1089
|
-
}
|
|
1090
|
-
|
|
1091
|
-
oldFavorites.remove()
|
|
1092
|
-
}
|
|
1093
|
-
if (favOptGroup && favOptGroup.hasChildNodes()) {
|
|
1094
|
-
const allTypesOption = this._select.querySelector(
|
|
1095
|
-
'option[data-all-types]',
|
|
1096
|
-
)
|
|
1097
|
-
const dataMirror = this._select.querySelector('option[data-mirror]')
|
|
1098
|
-
if (allTypesOption) {
|
|
1099
|
-
allTypesOption.after(favOptGroup)
|
|
1100
|
-
} else if (dataMirror) {
|
|
1101
|
-
dataMirror.after(favOptGroup)
|
|
1102
|
-
} else {
|
|
1103
|
-
this._select.prepend(favOptGroup)
|
|
1104
|
-
}
|
|
1105
|
-
}
|
|
1106
|
-
} catch (error) {
|
|
1107
|
-
console.error(error)
|
|
1108
|
-
}
|
|
1109
|
-
}
|
|
1110
|
-
}
|
|
1111
|
-
|
|
1112
|
-
focusFavorite() {
|
|
1113
|
-
const highlight = this._getActiveOption() || this._list.lastChild
|
|
1114
|
-
const fav = highlight.querySelector('.ComboInput-option-favorite')
|
|
1115
|
-
if (fav) {
|
|
1116
|
-
fav.focus()
|
|
1117
|
-
}
|
|
1118
|
-
}
|
|
1119
|
-
|
|
1120
|
-
showList() {
|
|
1121
|
-
if (this._container.getAttribute('aria-expanded') === 'true') {
|
|
1122
|
-
return true
|
|
1123
|
-
}
|
|
1124
|
-
|
|
1125
|
-
if (this._select.classList.contains('is-readOnly')) {
|
|
1126
|
-
return
|
|
1127
|
-
}
|
|
1128
|
-
|
|
1129
|
-
if (current) {
|
|
1130
|
-
current.hideList()
|
|
1131
|
-
}
|
|
1132
|
-
|
|
1133
|
-
this._container.style.width = `${
|
|
1134
|
-
this._container.getBoundingClientRect().width
|
|
1135
|
-
}px`
|
|
1136
|
-
|
|
1137
|
-
this._container.setAttribute('aria-expanded', 'true')
|
|
1138
|
-
this._filter.value = ''
|
|
1139
|
-
this._filter.focus()
|
|
1140
|
-
this.filterList()
|
|
1141
|
-
|
|
1142
|
-
this._setFocus()
|
|
1143
|
-
|
|
1144
|
-
for (const group of findAll(this._list, '.ComboInput-heading')) {
|
|
1145
|
-
if (group.getAttribute('data-value')) {
|
|
1146
|
-
this.updateSelection(group)
|
|
1147
|
-
}
|
|
1148
|
-
}
|
|
1149
|
-
|
|
1150
|
-
current = this
|
|
1151
|
-
|
|
1152
|
-
this._list.classList.add('is-expanded')
|
|
1153
|
-
this._tether = new Tether(this._container, this._list)
|
|
1154
|
-
|
|
1155
|
-
const options = {
|
|
1156
|
-
root: null,
|
|
1157
|
-
rootMargin: '0px',
|
|
1158
|
-
threshold: 0,
|
|
1159
|
-
}
|
|
1160
|
-
if (!this._observer) {
|
|
1161
|
-
this._observer = new IntersectionObserver(this.handleIntersect, options)
|
|
1162
|
-
}
|
|
1163
|
-
this._observer.observe(this._container)
|
|
1164
|
-
}
|
|
1165
|
-
|
|
1166
|
-
hideList() {
|
|
1167
|
-
if (this._container.getAttribute('aria-expanded') === 'false') {
|
|
1168
|
-
return true
|
|
1169
|
-
}
|
|
1170
|
-
|
|
1171
|
-
if (this._observer) {
|
|
1172
|
-
this._observer.unobserve(this._container)
|
|
1173
|
-
}
|
|
1174
|
-
if (this._tether) {
|
|
1175
|
-
this._tether.destroy()
|
|
1176
|
-
}
|
|
1177
|
-
// Reset filter value as dynamic values are updated by content state handler, and trigger input event so that contentState can update values
|
|
1178
|
-
this._filter.value = ''
|
|
1179
|
-
this._filter.dispatchEvent(new Event('input', { bubbles: true }))
|
|
1180
|
-
|
|
1181
|
-
current = null
|
|
1182
|
-
|
|
1183
|
-
this._container.style.width = ''
|
|
1184
|
-
|
|
1185
|
-
if (this._createNewListItem?.getAttribute('aria-expanded') === 'true') {
|
|
1186
|
-
this.toggleCreateNewList()
|
|
1187
|
-
}
|
|
1188
|
-
|
|
1189
|
-
this._container.setAttribute('aria-expanded', 'false')
|
|
1190
|
-
this._list.classList.remove('is-expanded')
|
|
1191
|
-
|
|
1192
|
-
if (this._select.multiple) {
|
|
1193
|
-
const values = new Set()
|
|
1194
|
-
|
|
1195
|
-
for (const child of this._getOptions()) {
|
|
1196
|
-
if (
|
|
1197
|
-
child.getAttribute('aria-selected') === 'true' &&
|
|
1198
|
-
!child.getAttribute('data-select-all')
|
|
1199
|
-
) {
|
|
1200
|
-
values.add(child.getAttribute('data-value'))
|
|
1201
|
-
}
|
|
1202
|
-
}
|
|
1203
|
-
|
|
1204
|
-
let changed = false
|
|
1205
|
-
|
|
1206
|
-
for (const option of findAll(this._select, 'option')) {
|
|
1207
|
-
const newSelected = values.has(option.value)
|
|
1208
|
-
|
|
1209
|
-
if (option.selected !== newSelected) {
|
|
1210
|
-
changed = true
|
|
1211
|
-
}
|
|
1212
|
-
|
|
1213
|
-
option.selected = newSelected
|
|
1214
|
-
}
|
|
1215
|
-
|
|
1216
|
-
this._reorderSelectOptions()
|
|
1217
|
-
|
|
1218
|
-
if (changed) {
|
|
1219
|
-
this._select.dispatchEvent(new CustomEvent('change', { bubbles: true }))
|
|
1220
|
-
}
|
|
1221
|
-
}
|
|
1222
|
-
|
|
1223
|
-
this._select.dispatchEvent(
|
|
1224
|
-
new CustomEvent('combo-input:hide', { bubbles: true }),
|
|
1225
|
-
)
|
|
1226
|
-
}
|
|
1227
|
-
|
|
1228
|
-
toggleList() {
|
|
1229
|
-
if (this._container.getAttribute('aria-expanded') === 'true') {
|
|
1230
|
-
this.hideList()
|
|
1231
|
-
} else {
|
|
1232
|
-
this.showList()
|
|
1233
|
-
}
|
|
1234
|
-
}
|
|
1235
|
-
|
|
1236
|
-
toggleCreateNewList() {
|
|
1237
|
-
if (
|
|
1238
|
-
this._container.getAttribute('aria-expanded') === 'true' &&
|
|
1239
|
-
this._createNewListItem.getAttribute('aria-expanded') === 'true'
|
|
1240
|
-
) {
|
|
1241
|
-
this._createNewList.setAttribute('hidden', '')
|
|
1242
|
-
this._createNewListItem.setAttribute('aria-expanded', 'false')
|
|
1243
|
-
for (const item of this._createNewList.children) {
|
|
1244
|
-
item?.setAttribute('role', 'none')
|
|
1245
|
-
}
|
|
1246
|
-
} else if (
|
|
1247
|
-
this._createNewListItem.getAttribute('aria-expanded') === 'false'
|
|
1248
|
-
) {
|
|
1249
|
-
this._createNewList.removeAttribute('hidden')
|
|
1250
|
-
this._createNewListItem.setAttribute('aria-expanded', 'true')
|
|
1251
|
-
|
|
1252
|
-
for (const item of this._createNewList.children) {
|
|
1253
|
-
item?.setAttribute('role', 'option')
|
|
1254
|
-
}
|
|
1255
|
-
}
|
|
1256
|
-
}
|
|
1257
|
-
|
|
1258
|
-
async filterList() {
|
|
1259
|
-
const value = this._filter.value
|
|
1260
|
-
const optionsUrl = this._getOptionsUrl
|
|
1261
|
-
? this._getOptionsUrl(this._filter.value)
|
|
1262
|
-
: null
|
|
1263
|
-
|
|
1264
|
-
if (optionsUrl && !(this._fetchOnce && this._optionsLoaded)) {
|
|
1265
|
-
try {
|
|
1266
|
-
++this._getOptionsIndex
|
|
1267
|
-
const index = this._getOptionsIndex
|
|
1268
|
-
|
|
1269
|
-
// In fetch-once mode, always fetch with empty query to get all options
|
|
1270
|
-
const fetchUrl = this._fetchOnce ? this._getOptionsUrl('') : optionsUrl
|
|
1271
|
-
|
|
1272
|
-
const response = await fetch(fetchUrl, {
|
|
1273
|
-
credentials: 'include',
|
|
1274
|
-
})
|
|
1275
|
-
if (
|
|
1276
|
-
response.redirected &&
|
|
1277
|
-
response.url.includes(
|
|
1278
|
-
window.BRIGHTSPOT.web.pagePaths['com.psddev.cms.auth.LogInPage'],
|
|
1279
|
-
)
|
|
1280
|
-
) {
|
|
1281
|
-
throw new Error(
|
|
1282
|
-
'ComboInput: Redirected response received for options update.',
|
|
1283
|
-
)
|
|
1284
|
-
}
|
|
1285
|
-
const optionsHtml = await response.text()
|
|
1286
|
-
|
|
1287
|
-
if (this._getOptionsIndex === index) {
|
|
1288
|
-
const selectedOptions = []
|
|
1289
|
-
const selectedValues = new Set()
|
|
1290
|
-
if (!this._select.value && this._select.firstChild) {
|
|
1291
|
-
this._select.firstChild.selected = true
|
|
1292
|
-
}
|
|
1293
|
-
for (const o of findAll(this._select, 'option')) {
|
|
1294
|
-
if (o.selected) {
|
|
1295
|
-
selectedOptions.push(o)
|
|
1296
|
-
selectedValues.add(o.value)
|
|
1297
|
-
}
|
|
1298
|
-
}
|
|
1299
|
-
|
|
1300
|
-
this._select.innerHTML = optionsHtml
|
|
1301
|
-
|
|
1302
|
-
for (const o of findAll(this._select, 'option')) {
|
|
1303
|
-
if (selectedValues.has(o.value)) {
|
|
1304
|
-
o.remove()
|
|
1305
|
-
}
|
|
1306
|
-
}
|
|
1307
|
-
|
|
1308
|
-
const first = this._select.firstChild
|
|
1309
|
-
|
|
1310
|
-
for (const o of selectedOptions) {
|
|
1311
|
-
this._select.insertBefore(o, first)
|
|
1312
|
-
}
|
|
1313
|
-
|
|
1314
|
-
// If fetch-once mode, mark as loaded for client-side filtering on subsequent calls
|
|
1315
|
-
if (this._fetchOnce) {
|
|
1316
|
-
this._optionsLoaded = true
|
|
1317
|
-
}
|
|
1318
|
-
}
|
|
1319
|
-
} catch (error) {
|
|
1320
|
-
console.error(error)
|
|
1321
|
-
}
|
|
1322
|
-
if (!value || value.trim().length === 0) {
|
|
1323
|
-
this.populateFavorites()
|
|
1324
|
-
}
|
|
1325
|
-
} else {
|
|
1326
|
-
if (value && !this._select.getAttribute('data-dynamic-value-generator')) {
|
|
1327
|
-
const re = new RegExp(
|
|
1328
|
-
value.replace(/\s/, '').split('').join('(?:.*\\W)?'),
|
|
1329
|
-
'i',
|
|
1330
|
-
)
|
|
1331
|
-
|
|
1332
|
-
let highlighted
|
|
1333
|
-
|
|
1334
|
-
for (const child of this._getOptions()) {
|
|
1335
|
-
if (re.test(child.textContent)) {
|
|
1336
|
-
child.hidden = false
|
|
1337
|
-
|
|
1338
|
-
if (!highlighted) {
|
|
1339
|
-
highlighted = true
|
|
1340
|
-
this._highlightOption(child, 0)
|
|
1341
|
-
}
|
|
1342
|
-
} else {
|
|
1343
|
-
child.hidden = true
|
|
1344
|
-
}
|
|
1345
|
-
}
|
|
1346
|
-
} else {
|
|
1347
|
-
for (const child of this._getOptions()) {
|
|
1348
|
-
child.hidden = false
|
|
1349
|
-
}
|
|
1350
|
-
this.populateFavorites()
|
|
1351
|
-
}
|
|
1352
|
-
}
|
|
1353
|
-
}
|
|
1354
|
-
|
|
1355
|
-
updateValue(value, missing) {
|
|
1356
|
-
const selectAllOption = find(this._list, '[data-select-all=true]')
|
|
1357
|
-
if (this._select.multiple) {
|
|
1358
|
-
if (
|
|
1359
|
-
selectAllOption &&
|
|
1360
|
-
value === selectAllOption.getAttribute('data-value')
|
|
1361
|
-
) {
|
|
1362
|
-
selectAllOption.setAttribute(
|
|
1363
|
-
'aria-selected',
|
|
1364
|
-
selectAllOption.getAttribute('aria-selected') !== 'true',
|
|
1365
|
-
)
|
|
1366
|
-
findAll(
|
|
1367
|
-
this._list,
|
|
1368
|
-
'.ComboInput-option:not([data-select-all])',
|
|
1369
|
-
).forEach((child) => {
|
|
1370
|
-
child.setAttribute(
|
|
1371
|
-
'aria-selected',
|
|
1372
|
-
selectAllOption.getAttribute('aria-selected'),
|
|
1373
|
-
)
|
|
1374
|
-
})
|
|
1375
|
-
} else {
|
|
1376
|
-
const escapedValue = CSS.escape(value)
|
|
1377
|
-
const selectedOption = find(
|
|
1378
|
-
this._list,
|
|
1379
|
-
`.ComboInput-option[data-value="${escapedValue}"]`,
|
|
1380
|
-
)
|
|
1381
|
-
if (!selectedOption) {
|
|
1382
|
-
return
|
|
1383
|
-
}
|
|
1384
|
-
if (this._duplicates.has(value)) {
|
|
1385
|
-
for (const key of this._duplicates.keys()) {
|
|
1386
|
-
if (this._duplicates.get(key).text === selectedOption.textContent) {
|
|
1387
|
-
const duplicate = find(
|
|
1388
|
-
this._list,
|
|
1389
|
-
`.ComboInput-option[data-value="${CSS.escape(key)}"]`,
|
|
1390
|
-
)
|
|
1391
|
-
duplicate.setAttribute(
|
|
1392
|
-
'aria-selected',
|
|
1393
|
-
duplicate.getAttribute('aria-selected') !== 'true',
|
|
1394
|
-
)
|
|
1395
|
-
}
|
|
1396
|
-
}
|
|
1397
|
-
} else {
|
|
1398
|
-
selectedOption.setAttribute(
|
|
1399
|
-
'aria-selected',
|
|
1400
|
-
selectedOption.getAttribute('aria-selected') !== 'true',
|
|
1401
|
-
)
|
|
1402
|
-
}
|
|
1403
|
-
if (selectAllOption) {
|
|
1404
|
-
selectAllOption.setAttribute(
|
|
1405
|
-
'aria-selected',
|
|
1406
|
-
findAll(this._list, '[aria-selected=true]').length ===
|
|
1407
|
-
this._getOptions().length,
|
|
1408
|
-
)
|
|
1409
|
-
}
|
|
1410
|
-
|
|
1411
|
-
const source = selectedOption.getAttribute('data-source')
|
|
1412
|
-
if (source != null) {
|
|
1413
|
-
this.updateSelection(
|
|
1414
|
-
find(
|
|
1415
|
-
this._list,
|
|
1416
|
-
`.ComboInput-heading[data-value="${CSS.escape(source)}"]`,
|
|
1417
|
-
),
|
|
1418
|
-
)
|
|
1419
|
-
}
|
|
1420
|
-
}
|
|
1421
|
-
|
|
1422
|
-
this._filter.focus()
|
|
1423
|
-
this._filter.select()
|
|
1424
|
-
} else {
|
|
1425
|
-
if (missing) {
|
|
1426
|
-
find(this._list, '[data-missing-option=true]').setAttribute(
|
|
1427
|
-
'aria-selected',
|
|
1428
|
-
!this._missing.checked,
|
|
1429
|
-
)
|
|
1430
|
-
const selectedOption = Array.from(this._getOptions()).find(
|
|
1431
|
-
(option) =>
|
|
1432
|
-
option.getAttribute('role') === 'option' &&
|
|
1433
|
-
option.getAttribute('aria-selected') === 'true' &&
|
|
1434
|
-
option.getAttribute('data-missing-option') !== 'true',
|
|
1435
|
-
)
|
|
1436
|
-
if (selectedOption) {
|
|
1437
|
-
selectedOption.setAttribute('aria-selected', 'false')
|
|
1438
|
-
}
|
|
1439
|
-
} else {
|
|
1440
|
-
for (const child of this._getOptions()) {
|
|
1441
|
-
if (child.getAttribute('role') === 'option') {
|
|
1442
|
-
if (value === child.getAttribute('data-value')) {
|
|
1443
|
-
child.setAttribute('aria-selected', 'true')
|
|
1444
|
-
} else {
|
|
1445
|
-
child.setAttribute('aria-selected', 'false')
|
|
1446
|
-
}
|
|
1447
|
-
}
|
|
1448
|
-
}
|
|
1449
|
-
}
|
|
1450
|
-
|
|
1451
|
-
this.hideList()
|
|
1452
|
-
if (missing) {
|
|
1453
|
-
if (this._missing.checked) {
|
|
1454
|
-
this._missing.checked = false
|
|
1455
|
-
} else {
|
|
1456
|
-
this._missing.checked = true
|
|
1457
|
-
this._select.value = value
|
|
1458
|
-
}
|
|
1459
|
-
this._missing.dispatchEvent(
|
|
1460
|
-
new CustomEvent('change', { bubbles: true }),
|
|
1461
|
-
)
|
|
1462
|
-
} else if (this._select.value !== value) {
|
|
1463
|
-
this._select.value = value
|
|
1464
|
-
this._select.dispatchEvent(new CustomEvent('change', { bubbles: true }))
|
|
1465
|
-
if (this._missing) {
|
|
1466
|
-
this._missing.checked = false
|
|
1467
|
-
this._missing.dispatchEvent(
|
|
1468
|
-
new CustomEvent('change', { bubbles: true }),
|
|
1469
|
-
)
|
|
1470
|
-
}
|
|
1471
|
-
} else if (this._missing && this._missing.checked) {
|
|
1472
|
-
this._missing.checked = false
|
|
1473
|
-
this._missing.dispatchEvent(
|
|
1474
|
-
new CustomEvent('change', { bubbles: true }),
|
|
1475
|
-
)
|
|
1476
|
-
}
|
|
1477
|
-
}
|
|
1478
|
-
|
|
1479
|
-
this.updateLabel()
|
|
1480
|
-
}
|
|
1481
|
-
}
|
|
1482
|
-
|
|
1483
|
-
// Hide list when clicked outside.
|
|
1484
|
-
window.addEventListener(
|
|
1485
|
-
'click',
|
|
1486
|
-
ifClick((event) => {
|
|
1487
|
-
if (current && !current._container.contains(event.target)) {
|
|
1488
|
-
current.hideList()
|
|
1489
|
-
}
|
|
1490
|
-
}),
|
|
1491
|
-
)
|