@inboxsdk/core 0.2.28-alpha.4 → 0.2.28-alpha.5
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/inboxsdk.js +1 -1
- package/package.json +5 -1
- package/src/inboxsdk-js/check-requirements.js +7 -3
- package/src/inboxsdk-js/header.js +1 -0
- package/src/inboxsdk-js/inboxsdk-NONREMOTE-INTEGRATED-PAGEWORLD.js +5 -6
- package/src/inboxsdk-js/inboxsdk-NONREMOTE.js +4 -3
- package/src/inboxsdk-js/inboxsdk-REMOTE.js +3 -1
- package/src/inboxsdk-js/inboxsdk-TEST.js +4 -3
- package/src/inboxsdk-js/inboxsdk.js +33 -39
- package/src/inboxsdk-js/loading/load-platform-implementation-DEV.js +15 -18
- package/src/injected-js/gmail/modify-suggestions.test.js +8 -9
- package/src/injected-js/gmail/setup-gmail-interceptor.js +340 -579
- package/src/injected-js/gmail/sync-compose-request-processor.test.js +39 -49
- package/src/injected-js/gmail/thread-identifier/click-and-get-popup-url.js +20 -33
- package/src/injected-js/gmail/thread-identifier/index.js +57 -93
- package/src/injected-js/gmail/thread-identifier/thread-row-parser.js +22 -31
- package/src/injected-js/gmail/thread-identifier/thread-row-parser.test.js +12 -28
- package/src/injected-js/inbox/setupAjaxInterceptor.js +64 -121
- package/src/injected-js/inbox/setupClickAndGetNewIframeSrc.js +53 -66
- package/src/injected-js/inbox/setupComposeViewDraftIDFinder.js +20 -36
- package/src/injected-js/inbox/setupInboxFakeWindowResizeListener.js +13 -13
- package/src/injected-js/main.js +11 -24
- package/src/injected-js/message-metadata-holder.js +52 -82
- package/src/injected-js/setup-data-exposer.js +89 -148
- package/src/injected-js/setup-error-silencer.js +21 -21
- package/src/injected-js/setup-event-reemitter.js +30 -22
- package/src/injected-js/setupInboxCustomViewLinkFixer.js +24 -29
- package/src/injected-js/setupPushStateListener.js +18 -11
- package/src/injected-js/xhr-helper.js +62 -65
- package/src/injected-js/xhr-proxy-factory.js +195 -445
- package/src/injected-js/xhr-proxy-factory.test.js +824 -991
- package/src/platform-implementation-js/constants/router.js +14 -9
- package/src/platform-implementation-js/constants/toolbars.js +8 -3
- package/src/platform-implementation-js/dom-driver/gmail/custom-style.js +13 -13
- package/src/platform-implementation-js/dom-driver/gmail/gmail-butter-bar-driver.js +115 -136
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/add-toolbar-button-for-app.js +13 -14
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/create-link.js +27 -48
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/get-draft-id-for-message-id.js +31 -42
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/get-native-nav-item.js +30 -40
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/get-url-object.js +10 -18
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/getSyncThreadForOldGmailThreadId.js +21 -28
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/getSyncThreadFromSyncThreadId.js +33 -45
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/gmail-load-event.js +31 -49
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/goto-view.js +58 -65
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/keyboard-shortcut-help-modifier.js +40 -124
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/open-compose-window.js +17 -22
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/open-draft-by-message-id.test.js +10 -11
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/override-gmail-back-button.js +44 -80
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/register-search-query-rewriter.js +19 -26
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/register-search-suggestions-provider.js +71 -147
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/setup-compose-view-driver-stream.js +91 -148
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/setup-route-view-driver-stream.js +150 -166
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/setup-route-view-driver-stream.test.js +70 -120
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/show-app-id-warning.js +15 -15
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/show-custom-route-view.js +44 -67
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/show-custom-thread-list.js +230 -379
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/show-custom-thread-list.test.js +121 -307
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/show-native-route-view.js +17 -24
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/suppressAddon.js +41 -49
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/temporary-track-download-url-validity.js +30 -40
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/thread-row-identifier.js +28 -60
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/track-events.js +61 -133
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/user-info.js +30 -42
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/user-info.test.js +52 -46
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver.js +354 -694
- package/src/platform-implementation-js/dom-driver/gmail/make-xhr-interceptor.js +77 -93
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-app-sidebar-view/index.js +35 -82
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-app-sidebar-view/index.test.js +44 -94
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-app-sidebar-view/primary/add-companion-global-icon-area.js +12 -19
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-app-sidebar-view/primary/add-companion-thread-icon-area.js +17 -29
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-app-sidebar-view/primary/add-to-icon-area.js +26 -26
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-app-sidebar-view/primary/index.js +391 -797
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-app-toolbar-button-view/monitor-top-banner-size-and-react.js +7 -9
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-app-toolbar-button-view.js +60 -109
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-attachment-area-view.js +95 -135
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-attachment-card-view.js +103 -211
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-attachment-card-view.test.js +61 -61
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-backdrop.js +17 -17
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-collapsible-section-view.js +188 -541
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/add-button.js +67 -135
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/add-compose-notice.js +27 -49
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/add-inner-sidebar.js +7 -13
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/add-outer-sidebar.js +9 -22
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/add-recipient-row.js +36 -63
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/add-tooltip-to-button.js +38 -113
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/ensure-app-button-toolbars-are-closed.js +11 -16
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/ensure-grouping-is-open.js +11 -17
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/focus.js +8 -11
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/from-manager.js +27 -47
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/get-additional-action-toolbar.js +11 -24
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/get-address-changes-stream.js +59 -111
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/get-body-changes-stream.js +15 -14
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/get-formatting-area-offset-left.js +11 -17
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/get-minimized-stream.js +18 -24
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/get-response-type-changes-stream.js +19 -23
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/insert-link-into-body.js +11 -19
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/manage-button-grouping.js +141 -376
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/monitor-selection-range.js +17 -28
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/override-edit-subject.js +34 -70
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/position-formatting-toolbar.js +10 -17
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/size-fixer.js +83 -137
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/update-insert-more-area-left.js +10 -19
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view.js +632 -1190
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-message-view/get-updated-contact.js +29 -38
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-message-view.js +327 -617
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-route-view/gmail-route-processor.js +26 -49
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-route-view/gmail-route-view.js +188 -380
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-row-list-view.js +104 -194
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-thread-row-view.js +382 -811
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-thread-sidebar-view/add-icon-area.js +34 -58
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-thread-sidebar-view.js +330 -581
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-thread-sidebar-view.test.js +123 -277
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-thread-view/width-manager.js +15 -35
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-thread-view.js +216 -571
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-toolbar-view.js +152 -336
- package/src/platform-implementation-js/dom-driver/gmail/views/native-gmail-nav-item-view.js +87 -211
- package/src/platform-implementation-js/dom-driver/gmail/widgets/buttons/inbox-dropdown-button-view.js +10 -11
- package/src/platform-implementation-js/dom-driver/gmail/widgets/gmail-action-button-view.js +20 -29
- package/src/platform-implementation-js/dom-driver/gmail/widgets/gmail-label-view.js +41 -76
- package/src/platform-implementation-js/dom-driver/gmail/widgets/gmail-modal-view-driver.js +45 -99
- package/src/platform-implementation-js/dom-driver/gmail/widgets/gmail-mole-view-driver.js +76 -128
- package/src/platform-implementation-js/dom-driver/gmail/widgets/gmail-tooltip-view.js +128 -319
- package/src/platform-implementation-js/dom-driver/gmail/widgets/gmail-top-message-bar-driver.js +45 -78
- package/src/platform-implementation-js/dom-driver/inbox/__mocks__/getSidebarClassnames.js +8 -4
- package/src/platform-implementation-js/dom-driver/inbox/addNavItem.js +36 -54
- package/src/platform-implementation-js/dom-driver/inbox/addRecipientRow.js +35 -53
- package/src/platform-implementation-js/dom-driver/inbox/createLink.js +13 -15
- package/src/platform-implementation-js/dom-driver/inbox/createLink.test.js +15 -18
- package/src/platform-implementation-js/dom-driver/inbox/custom-style.js +14 -13
- package/src/platform-implementation-js/dom-driver/inbox/detection/appToolbarLocation/parser.js +14 -20
- package/src/platform-implementation-js/dom-driver/inbox/detection/attachmentCard/parser.js +14 -13
- package/src/platform-implementation-js/dom-driver/inbox/detection/attachmentOverlay/parser.js +35 -67
- package/src/platform-implementation-js/dom-driver/inbox/detection/chatSidebar/parser.js +16 -18
- package/src/platform-implementation-js/dom-driver/inbox/detection/compose/parser.js +68 -185
- package/src/platform-implementation-js/dom-driver/inbox/detection/message/parser.js +28 -56
- package/src/platform-implementation-js/dom-driver/inbox/detection/nativeDrawer/parser.js +12 -10
- package/src/platform-implementation-js/dom-driver/inbox/detection/searchBar/parser.js +16 -16
- package/src/platform-implementation-js/dom-driver/inbox/detection/thread/parser.js +24 -35
- package/src/platform-implementation-js/dom-driver/inbox/detection/thread-row/parser.js +37 -89
- package/src/platform-implementation-js/dom-driver/inbox/getComposeViewDriverLiveSet.js +56 -78
- package/src/platform-implementation-js/dom-driver/inbox/getInboxMessageIdForInboxThreadId.js +26 -32
- package/src/platform-implementation-js/dom-driver/inbox/getSidebarClassnames.js +52 -109
- package/src/platform-implementation-js/dom-driver/inbox/getSidebarClassnames.test.js +7 -8
- package/src/platform-implementation-js/dom-driver/inbox/gotoView.js +16 -20
- package/src/platform-implementation-js/dom-driver/inbox/gotoView.test.js +15 -16
- package/src/platform-implementation-js/dom-driver/inbox/inbox-butter-bar-driver.js +75 -83
- package/src/platform-implementation-js/dom-driver/inbox/inbox-driver.js +530 -822
- package/src/platform-implementation-js/dom-driver/inbox/inbox-page-communicator.js +48 -61
- package/src/platform-implementation-js/dom-driver/inbox/inboxResponseProcessor.js +9 -12
- package/src/platform-implementation-js/dom-driver/inbox/inboxResponseProcessor.test.js +12 -19
- package/src/platform-implementation-js/dom-driver/inbox/makePageParserTree.js +24 -33
- package/src/platform-implementation-js/dom-driver/inbox/pageParserOptions.js +201 -388
- package/src/platform-implementation-js/dom-driver/inbox/registerSearchSuggestionsProvider.js +249 -265
- package/src/platform-implementation-js/dom-driver/inbox/setupCustomAutocompleteSelectionHandling.js +84 -152
- package/src/platform-implementation-js/dom-driver/inbox/setupRouteViewDriverStream.js +55 -67
- package/src/platform-implementation-js/dom-driver/inbox/setupRouteViewDriverStream.test.js +43 -65
- package/src/platform-implementation-js/dom-driver/inbox/views/InboxLabelView.js +31 -56
- package/src/platform-implementation-js/dom-driver/inbox/views/InboxMoleViewDriver.js +191 -294
- package/src/platform-implementation-js/dom-driver/inbox/views/InboxToolbarButtonView.js +32 -45
- package/src/platform-implementation-js/dom-driver/inbox/views/InboxToolbarView.js +21 -39
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-app-sidebar-view.js +153 -240
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-app-toolbar-button-view.js +75 -150
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-app-toolbar-tooltip-view.js +20 -37
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-attachment-card-view.js +60 -114
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-attachment-overlay-view.js +47 -65
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-backdrop.js +41 -52
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-chat-sidebar-view.js +27 -36
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-compose-button-view.js +52 -80
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-compose-view.js +465 -649
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-custom-route-view.js +37 -58
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-custom-route-view.test.js +14 -26
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-drawer-view.js +118 -235
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-dropdown-view.js +10 -11
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-dummy-route-view.js +28 -46
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-message-view.js +131 -202
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-modal-view.js +40 -80
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-route-view.js +35 -61
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-thread-row-view.js +124 -221
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-thread-view.js +125 -213
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-thread-view.test.js +104 -126
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-tooltip-view.js +36 -51
- package/src/platform-implementation-js/dom-driver/inbox/views/inboxNavItemView.js +158 -297
- package/src/platform-implementation-js/dom-driver/inbox/waitForAnimationClickBlockerGone.js +21 -35
- package/src/platform-implementation-js/driver-common/compose/getDiscardStream.js +24 -43
- package/src/platform-implementation-js/driver-common/compose/getPresendingStream.js +39 -68
- package/src/platform-implementation-js/driver-common/getGmailMessageIdForSyncMessageId.js +14 -19
- package/src/platform-implementation-js/driver-common/getGmailThreadIdForRfcMessageId.js +27 -35
- package/src/platform-implementation-js/driver-common/getRfcMessageIdForSyncMessageId.js +16 -22
- package/src/platform-implementation-js/driver-common/getThreadIdFromMessageId.js +14 -14
- package/src/platform-implementation-js/driver-common/inboxAjax.js +12 -7
- package/src/platform-implementation-js/driver-common/requestGmailThread.js +19 -20
- package/src/platform-implementation-js/driver-common/sidebar/AppSidebar.js +197 -306
- package/src/platform-implementation-js/driver-common/sidebar/ContentPanelViewDriver.js +113 -161
- package/src/platform-implementation-js/driver-interfaces/compose-view-driver.js +1 -114
- package/src/platform-implementation-js/driver-interfaces/driver.js +1 -131
- package/src/platform-implementation-js/driver-interfaces/message-view-driver.js +4 -48
- package/src/platform-implementation-js/driver-interfaces/mole-view-driver.js +1 -29
- package/src/platform-implementation-js/driver-interfaces/route-view-driver.js +1 -32
- package/src/platform-implementation-js/driver-interfaces/thread-row-view-driver.js +1 -11
- package/src/platform-implementation-js/lib/array-to-lifetimes.js +43 -41
- package/src/platform-implementation-js/lib/array-to-lifetimes.test.js +139 -155
- package/src/platform-implementation-js/lib/copyAndValidateAutocompleteResults.js +19 -38
- package/src/platform-implementation-js/lib/css-selector-escape.js +7 -3
- package/src/platform-implementation-js/lib/dom/element-view-mapper.js +8 -11
- package/src/platform-implementation-js/lib/dom/get-selection.js +23 -52
- package/src/platform-implementation-js/lib/dom/insert-html-at-cursor.js +69 -101
- package/src/platform-implementation-js/lib/dom/is-node-in-range.js +8 -10
- package/src/platform-implementation-js/lib/dom/on-mouse-down-and-up.js +15 -17
- package/src/platform-implementation-js/lib/dom/querySelectorOne.js +8 -11
- package/src/platform-implementation-js/lib/dom/set-css.js +7 -3
- package/src/platform-implementation-js/lib/dom/set-value-and-dispatch-event.js +9 -11
- package/src/platform-implementation-js/lib/dom/simulate-drag-and-drop.js +32 -33
- package/src/platform-implementation-js/lib/extract-contact-from-email-contact-string.test.js +23 -26
- package/src/platform-implementation-js/lib/handle-compose-link-chips.js +86 -149
- package/src/platform-implementation-js/lib/insert-link-chip-into-body.js +42 -57
- package/src/platform-implementation-js/lib/make-revocable-function.js +19 -21
- package/src/platform-implementation-js/lib/make-revocable-function.test.js +20 -22
- package/src/platform-implementation-js/lib/parseParamsFromRouteID.js +15 -17
- package/src/platform-implementation-js/lib/parseParamsFromRouteID.test.js +9 -18
- package/src/platform-implementation-js/lib/populateRouteID.js +8 -9
- package/src/platform-implementation-js/lib/populateRouteID.test.js +20 -19
- package/src/platform-implementation-js/lib/react/ElementContainer.js +23 -20
- package/src/platform-implementation-js/lib/rewriteCssWithIdMap.js +10 -9
- package/src/platform-implementation-js/lib/rewriteCssWithIdMap.test.js +13 -20
- package/src/platform-implementation-js/lib/routeIDmatchesHash.js +13 -18
- package/src/platform-implementation-js/lib/routeIDmatchesHash.test.js +11 -17
- package/src/platform-implementation-js/lib/shared-style.js +14 -13
- package/src/platform-implementation-js/lib/toItemWithLifetimeStream.js +18 -17
- package/src/platform-implementation-js/lib/toLiveSet.js +17 -15
- package/src/platform-implementation-js/main-INTEGRATED-PAGEWORLD.js +6 -5
- package/src/platform-implementation-js/main.js +9 -24
- package/src/platform-implementation-js/namespaces/compose.js +37 -60
- package/src/platform-implementation-js/namespaces/conversations.js +52 -124
- package/src/platform-implementation-js/namespaces/global.js +27 -39
- package/src/platform-implementation-js/namespaces/keyboard.js +29 -33
- package/src/platform-implementation-js/namespaces/lists.js +25 -31
- package/src/platform-implementation-js/namespaces/modal.js +34 -28
- package/src/platform-implementation-js/namespaces/nav-menu.js +30 -45
- package/src/platform-implementation-js/namespaces/router.js +70 -137
- package/src/platform-implementation-js/namespaces/search.js +19 -17
- package/src/platform-implementation-js/namespaces/toolbars.js +71 -117
- package/src/platform-implementation-js/namespaces/user.js +36 -37
- package/src/platform-implementation-js/namespaces/widgets.js +54 -61
- package/src/platform-implementation-js/platform-implementation.js +98 -229
- package/src/platform-implementation-js/views/app-toolbar-button-view.js +26 -47
- package/src/platform-implementation-js/views/collapsible-section-view.js +66 -63
- package/src/platform-implementation-js/views/content-panel-view.js +28 -30
- package/src/platform-implementation-js/views/conversations/attachment-card-view.js +21 -44
- package/src/platform-implementation-js/views/conversations/custom-message-view.js +44 -104
- package/src/platform-implementation-js/views/conversations/message-view.js +131 -202
- package/src/platform-implementation-js/views/conversations/thread-view.js +75 -127
- package/src/platform-implementation-js/views/native-nav-item-view.js +32 -65
- package/src/platform-implementation-js/views/nav-item-view.js +51 -115
- package/src/platform-implementation-js/views/route-view/custom-route-view.js +25 -20
- package/src/platform-implementation-js/views/route-view/dummy-route-view-driver.js +18 -18
- package/src/platform-implementation-js/views/route-view/list-route-view.js +30 -52
- package/src/platform-implementation-js/views/route-view/route-view.js +24 -35
- package/src/platform-implementation-js/views/section-view.js +60 -52
- package/src/platform-implementation-js/views/thread-row-view.js +49 -74
- package/src/platform-implementation-js/widgets/drawer-view.js +29 -36
- package/src/platform-implementation-js/widgets/modal-view.js +39 -68
- package/src/platform-implementation-js/widgets/mole-view.js +22 -22
- package/src/platform-implementation-js/widgets/top-message-bar-view.js +13 -10
package/src/platform-implementation-js/dom-driver/gmail/views/gmail-collapsible-section-view.js
CHANGED
|
@@ -1,56 +1,43 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
|
+
var _ud = require("ud");
|
|
10
|
+
var _escape = _interopRequireDefault(require("lodash/escape"));
|
|
11
|
+
var _kefir = _interopRequireDefault(require("kefir"));
|
|
12
|
+
var _kefirBus = _interopRequireDefault(require("kefir-bus"));
|
|
13
|
+
var _defer = _interopRequireDefault(require("../../../../common/defer"));
|
|
14
|
+
var _autoHtml = _interopRequireDefault(require("auto-html"));
|
|
15
|
+
var _querySelectorOrFail = _interopRequireDefault(require("../../../lib/dom/querySelectorOrFail"));
|
|
16
|
+
var _inboxDropdownButtonView = _interopRequireDefault(require("../widgets/buttons/inbox-dropdown-button-view"));
|
|
17
|
+
var _gmailDropdownView = _interopRequireDefault(require("../widgets/gmail-dropdown-view"));
|
|
18
|
+
var _dropdownButtonViewController = _interopRequireDefault(require("../../../widgets/buttons/dropdown-button-view-controller"));
|
|
18
19
|
class GmailCollapsibleSectionView {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
_footerElement: ?HTMLElement = null;
|
|
34
|
-
_eventStream: Bus<any>;
|
|
35
|
-
_isCollapsed: boolean = false;
|
|
36
|
-
_inboxDropdownButtonView: ?Object = null;
|
|
37
|
-
_dropdownViewController: ?Object = null;
|
|
38
|
-
|
|
39
|
-
constructor(
|
|
40
|
-
driver: GmailDriver,
|
|
41
|
-
groupOrderHint: number,
|
|
42
|
-
isSearch: boolean,
|
|
43
|
-
isCollapsible: boolean
|
|
44
|
-
) {
|
|
20
|
+
constructor(driver, groupOrderHint, isSearch, isCollapsible) {
|
|
21
|
+
(0, _defineProperty2.default)(this, "_collapsibleSectionDescriptor", {});
|
|
22
|
+
(0, _defineProperty2.default)(this, "_element", null);
|
|
23
|
+
(0, _defineProperty2.default)(this, "_headerElement", null);
|
|
24
|
+
(0, _defineProperty2.default)(this, "_titleElement", null);
|
|
25
|
+
(0, _defineProperty2.default)(this, "_bodyElement", null);
|
|
26
|
+
(0, _defineProperty2.default)(this, "_contentElement", null);
|
|
27
|
+
(0, _defineProperty2.default)(this, "_tableBodyElement", null);
|
|
28
|
+
(0, _defineProperty2.default)(this, "_collapsedContainer", null);
|
|
29
|
+
(0, _defineProperty2.default)(this, "_messageElement", null);
|
|
30
|
+
(0, _defineProperty2.default)(this, "_footerElement", null);
|
|
31
|
+
(0, _defineProperty2.default)(this, "_isCollapsed", false);
|
|
32
|
+
(0, _defineProperty2.default)(this, "_inboxDropdownButtonView", null);
|
|
33
|
+
(0, _defineProperty2.default)(this, "_dropdownViewController", null);
|
|
45
34
|
this._driver = driver;
|
|
46
35
|
this._isSearch = isSearch;
|
|
47
36
|
this._groupOrderHint = groupOrderHint;
|
|
48
37
|
this._isCollapsible = isCollapsible;
|
|
49
|
-
this._eventStream =
|
|
50
|
-
|
|
51
|
-
this._isReadyDeferred = new defer();
|
|
38
|
+
this._eventStream = (0, _kefirBus.default)();
|
|
39
|
+
this._isReadyDeferred = new _defer.default();
|
|
52
40
|
}
|
|
53
|
-
|
|
54
41
|
destroy() {
|
|
55
42
|
if (this._element) this._element.remove();
|
|
56
43
|
if (this._eventStream) this._eventStream.end();
|
|
@@ -64,59 +51,43 @@ class GmailCollapsibleSectionView {
|
|
|
64
51
|
if (this._inboxDropdownButtonView) this._inboxDropdownButtonView.destroy();
|
|
65
52
|
if (this._dropdownViewController) this._dropdownViewController.destroy();
|
|
66
53
|
}
|
|
67
|
-
|
|
68
|
-
getElement(): HTMLElement {
|
|
54
|
+
getElement() {
|
|
69
55
|
const element = this._element;
|
|
70
|
-
if (!element)
|
|
71
|
-
throw new Error('tried to access element that does not exist');
|
|
56
|
+
if (!element) throw new Error('tried to access element that does not exist');
|
|
72
57
|
return element;
|
|
73
58
|
}
|
|
74
|
-
|
|
75
|
-
getEventStream(): Kefir.Observable<any> {
|
|
59
|
+
getEventStream() {
|
|
76
60
|
return this._eventStream;
|
|
77
61
|
}
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
const stoppedProperty = collapsibleSectionDescriptorProperty.takeUntilBy(
|
|
83
|
-
this._eventStream.filter(() => false).beforeEnd(() => null)
|
|
84
|
-
);
|
|
85
|
-
|
|
86
|
-
stoppedProperty.onValue((x) => this._updateValues(x));
|
|
87
|
-
stoppedProperty.take(1).onValue((x) => this._isReadyDeferred.resolve(this));
|
|
62
|
+
setCollapsibleSectionDescriptorProperty(collapsibleSectionDescriptorProperty) {
|
|
63
|
+
const stoppedProperty = collapsibleSectionDescriptorProperty.takeUntilBy(this._eventStream.filter(() => false).beforeEnd(() => null));
|
|
64
|
+
stoppedProperty.onValue(x => this._updateValues(x));
|
|
65
|
+
stoppedProperty.take(1).onValue(x => this._isReadyDeferred.resolve(this));
|
|
88
66
|
}
|
|
89
|
-
|
|
90
|
-
setCollapsed(value: boolean) {
|
|
67
|
+
setCollapsed(value) {
|
|
91
68
|
if (!this._isCollapsible) {
|
|
92
69
|
return;
|
|
93
70
|
}
|
|
94
|
-
|
|
95
71
|
this._isReadyDeferred.promise.then(() => {
|
|
96
|
-
if (value) this._collapse();
|
|
97
|
-
else this._expand();
|
|
72
|
+
if (value) this._collapse();else this._expand();
|
|
98
73
|
});
|
|
99
74
|
}
|
|
100
|
-
|
|
101
|
-
_updateValues(collapsibleSectionDescriptor: ?Object) {
|
|
75
|
+
_updateValues(collapsibleSectionDescriptor) {
|
|
102
76
|
const element = this._element;
|
|
103
77
|
if (!collapsibleSectionDescriptor) {
|
|
104
78
|
if (element) {
|
|
105
79
|
element.style.display = 'none';
|
|
106
80
|
}
|
|
107
|
-
|
|
108
81
|
return;
|
|
109
82
|
} else if (element) {
|
|
110
83
|
element.style.display = '';
|
|
111
84
|
}
|
|
112
|
-
|
|
113
85
|
if (!element) {
|
|
114
86
|
this._setupElement(collapsibleSectionDescriptor);
|
|
115
87
|
this._showLoadingMessage();
|
|
116
88
|
} else {
|
|
117
89
|
this._updateElement(collapsibleSectionDescriptor);
|
|
118
90
|
}
|
|
119
|
-
|
|
120
91
|
this._updateHeader(collapsibleSectionDescriptor);
|
|
121
92
|
this._updateTitle(collapsibleSectionDescriptor);
|
|
122
93
|
this._updateSubtitle(collapsibleSectionDescriptor);
|
|
@@ -126,301 +97,163 @@ class GmailCollapsibleSectionView {
|
|
|
126
97
|
this._updateTableRows(collapsibleSectionDescriptor);
|
|
127
98
|
this._updateMessageElement(collapsibleSectionDescriptor);
|
|
128
99
|
this._updateFooter(collapsibleSectionDescriptor);
|
|
129
|
-
|
|
130
100
|
this._collapsibleSectionDescriptor = collapsibleSectionDescriptor;
|
|
131
101
|
}
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
const element = (this._element = document.createElement('div'));
|
|
102
|
+
_setupElement(collapsibleSectionDescriptor) {
|
|
103
|
+
const element = this._element = document.createElement('div');
|
|
135
104
|
element.setAttribute('class', 'inboxsdk__resultsSection');
|
|
136
105
|
element.setAttribute('data-group-order-hint', String(this._groupOrderHint));
|
|
137
|
-
element.setAttribute(
|
|
138
|
-
|
|
139
|
-
String(
|
|
140
|
-
typeof collapsibleSectionDescriptor.orderHint === 'number'
|
|
141
|
-
? collapsibleSectionDescriptor.orderHint
|
|
142
|
-
: 0
|
|
143
|
-
)
|
|
144
|
-
);
|
|
145
|
-
if (!this._isCollapsible)
|
|
146
|
-
element.classList.add('inboxsdk__resultsSection_nonCollapsible');
|
|
147
|
-
|
|
106
|
+
element.setAttribute('data-order-hint', String(typeof collapsibleSectionDescriptor.orderHint === 'number' ? collapsibleSectionDescriptor.orderHint : 0));
|
|
107
|
+
if (!this._isCollapsible) element.classList.add('inboxsdk__resultsSection_nonCollapsible');
|
|
148
108
|
this._setupHeader(collapsibleSectionDescriptor);
|
|
149
|
-
|
|
150
|
-
const bodyElement = (this._bodyElement = document.createElement('div'));
|
|
109
|
+
const bodyElement = this._bodyElement = document.createElement('div');
|
|
151
110
|
const bodyContentsElement = document.createElement('div');
|
|
152
111
|
bodyContentsElement.classList.add('zE');
|
|
153
112
|
bodyElement.appendChild(bodyContentsElement);
|
|
154
|
-
|
|
155
113
|
element.appendChild(bodyElement);
|
|
156
|
-
|
|
157
|
-
const contentElement = (this._contentElement =
|
|
158
|
-
document.createElement('div'));
|
|
114
|
+
const contentElement = this._contentElement = document.createElement('div');
|
|
159
115
|
bodyContentsElement.appendChild(contentElement);
|
|
160
|
-
|
|
161
|
-
const messageElement = (this._messageElement =
|
|
162
|
-
document.createElement('div'));
|
|
116
|
+
const messageElement = this._messageElement = document.createElement('div');
|
|
163
117
|
bodyContentsElement.appendChild(messageElement);
|
|
164
|
-
|
|
165
|
-
const tableBodyElement = (this._tableBodyElement =
|
|
166
|
-
document.createElement('div'));
|
|
118
|
+
const tableBodyElement = this._tableBodyElement = document.createElement('div');
|
|
167
119
|
bodyContentsElement.appendChild(tableBodyElement);
|
|
168
|
-
|
|
169
120
|
this._setupFooter(collapsibleSectionDescriptor);
|
|
170
|
-
|
|
171
121
|
if (this._isCollapsible && this._titleElement) {
|
|
172
|
-
|
|
173
|
-
this._toggleCollapseState()
|
|
174
|
-
);
|
|
122
|
+
_kefir.default.fromEvents(this._titleElement, 'click').onValue(() => this._toggleCollapseState());
|
|
175
123
|
}
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
this._destroyCollapsedContainer()
|
|
179
|
-
);
|
|
180
|
-
Kefir.fromEvents(element, 'readdToCollapsedContainer').onValue(() =>
|
|
181
|
-
this._addToCollapsedContainer()
|
|
182
|
-
);
|
|
183
|
-
|
|
124
|
+
_kefir.default.fromEvents(element, 'removeCollapsedContainer').onValue(() => this._destroyCollapsedContainer());
|
|
125
|
+
_kefir.default.fromEvents(element, 'readdToCollapsedContainer').onValue(() => this._addToCollapsedContainer());
|
|
184
126
|
this._eventStream.emit({
|
|
185
127
|
type: 'update',
|
|
186
128
|
property: 'orderHint',
|
|
187
|
-
sectionDescriptor: collapsibleSectionDescriptor
|
|
129
|
+
sectionDescriptor: collapsibleSectionDescriptor
|
|
188
130
|
});
|
|
189
131
|
}
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
const headerElement = (this._headerElement = document.createElement('div'));
|
|
132
|
+
_setupHeader(collapsibleSectionDescriptor) {
|
|
133
|
+
const headerElement = this._headerElement = document.createElement('div');
|
|
193
134
|
headerElement.classList.add('inboxsdk__resultsSection_header', 'Wg');
|
|
194
|
-
|
|
195
135
|
this._setupGmailv2Header(headerElement, collapsibleSectionDescriptor);
|
|
196
|
-
|
|
197
136
|
if (this._element) this._element.appendChild(headerElement);
|
|
198
137
|
}
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
headerElement: HTMLElement,
|
|
202
|
-
collapsibleSectionDescriptor: Object
|
|
203
|
-
) {
|
|
204
|
-
const titleElement = (this._titleElement = document.createElement('div'));
|
|
138
|
+
_setupGmailv2Header(headerElement, collapsibleSectionDescriptor) {
|
|
139
|
+
const titleElement = this._titleElement = document.createElement('div');
|
|
205
140
|
titleElement.setAttribute('class', 'inboxsdk__resultsSection_title');
|
|
206
|
-
|
|
207
|
-
titleElement.innerHTML = [
|
|
208
|
-
'<h3 class="Wr iR">',
|
|
209
|
-
'<img alt="" src="//ssl.gstatic.com/ui/v1/icons/mail/images/cleardot.gif" class="qi Wp Wq">',
|
|
210
|
-
'<div class="Wn">',
|
|
211
|
-
escape(collapsibleSectionDescriptor.title),
|
|
212
|
-
'</div>',
|
|
213
|
-
'</h3>',
|
|
214
|
-
].join('');
|
|
215
|
-
|
|
141
|
+
titleElement.innerHTML = ['<h3 class="Wr iR">', '<img alt="" src="//ssl.gstatic.com/ui/v1/icons/mail/images/cleardot.gif" class="qi Wp Wq">', '<div class="Wn">', (0, _escape.default)(collapsibleSectionDescriptor.title), '</div>', '</h3>'].join('');
|
|
216
142
|
const floatRightElement = document.createElement('div');
|
|
217
143
|
floatRightElement.classList.add('Cr');
|
|
218
144
|
if (this._isSearch) floatRightElement.classList.add('Wg');
|
|
219
|
-
|
|
220
145
|
headerElement.appendChild(titleElement);
|
|
221
146
|
headerElement.appendChild(floatRightElement);
|
|
222
147
|
}
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
const footerElement = (this._footerElement = document.createElement('div'));
|
|
148
|
+
_setupFooter(collapsibleSectionDescriptor) {
|
|
149
|
+
const footerElement = this._footerElement = document.createElement('div');
|
|
226
150
|
footerElement.classList.add('inboxsdk__resultsSection_footer');
|
|
227
|
-
|
|
228
151
|
if (this._bodyElement) this._bodyElement.appendChild(footerElement);
|
|
229
152
|
}
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
if (
|
|
233
|
-
this._collapsibleSectionDescriptor.orderHint !==
|
|
234
|
-
collapsibleSectionDescriptor.orderHint
|
|
235
|
-
) {
|
|
153
|
+
_updateElement(collapsibleSectionDescriptor) {
|
|
154
|
+
if (this._collapsibleSectionDescriptor.orderHint !== collapsibleSectionDescriptor.orderHint) {
|
|
236
155
|
const element = this._element;
|
|
237
|
-
if (element)
|
|
238
|
-
element.setAttribute(
|
|
239
|
-
'data-order-hint',
|
|
240
|
-
'' +
|
|
241
|
-
(typeof collapsibleSectionDescriptor.orderHint === 'number'
|
|
242
|
-
? collapsibleSectionDescriptor.orderHint
|
|
243
|
-
: 0)
|
|
244
|
-
);
|
|
245
|
-
|
|
156
|
+
if (element) element.setAttribute('data-order-hint', '' + (typeof collapsibleSectionDescriptor.orderHint === 'number' ? collapsibleSectionDescriptor.orderHint : 0));
|
|
246
157
|
this._eventStream.emit({
|
|
247
158
|
type: 'update',
|
|
248
|
-
property: 'orderHint'
|
|
159
|
+
property: 'orderHint'
|
|
249
160
|
});
|
|
250
161
|
}
|
|
251
162
|
}
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
if (
|
|
255
|
-
this._isCollapsible ||
|
|
256
|
-
collapsibleSectionDescriptor.title ||
|
|
257
|
-
collapsibleSectionDescriptor.subtitle ||
|
|
258
|
-
collapsibleSectionDescriptor.titleLinkText ||
|
|
259
|
-
collapsibleSectionDescriptor.hasDropdown
|
|
260
|
-
) {
|
|
163
|
+
_updateHeader(collapsibleSectionDescriptor) {
|
|
164
|
+
if (this._isCollapsible || collapsibleSectionDescriptor.title || collapsibleSectionDescriptor.subtitle || collapsibleSectionDescriptor.titleLinkText || collapsibleSectionDescriptor.hasDropdown) {
|
|
261
165
|
if (this._headerElement) this._headerElement.style.display = '';
|
|
262
166
|
} else {
|
|
263
167
|
if (this._headerElement) this._headerElement.style.display = 'none';
|
|
264
168
|
}
|
|
265
169
|
}
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
if (
|
|
269
|
-
this._collapsibleSectionDescriptor.title !==
|
|
270
|
-
collapsibleSectionDescriptor.title
|
|
271
|
-
) {
|
|
170
|
+
_updateTitle(collapsibleSectionDescriptor) {
|
|
171
|
+
if (this._collapsibleSectionDescriptor.title !== collapsibleSectionDescriptor.title) {
|
|
272
172
|
const selector = 'h3 > .Wn';
|
|
273
|
-
|
|
274
173
|
if (this._titleElement) {
|
|
275
|
-
|
|
276
|
-
collapsibleSectionDescriptor.title;
|
|
174
|
+
(0, _querySelectorOrFail.default)(this._titleElement, selector).textContent = collapsibleSectionDescriptor.title;
|
|
277
175
|
}
|
|
278
176
|
}
|
|
279
177
|
}
|
|
280
|
-
|
|
281
|
-
_updateSubtitle(collapsibleSectionDescriptor: Object) {
|
|
178
|
+
_updateSubtitle(collapsibleSectionDescriptor) {
|
|
282
179
|
const titleElement = this._titleElement;
|
|
283
180
|
if (!titleElement) return;
|
|
284
|
-
|
|
285
|
-
let subtitleElement = titleElement.querySelector(
|
|
286
|
-
'.inboxsdk__resultsSection_title_subtitle'
|
|
287
|
-
);
|
|
181
|
+
let subtitleElement = titleElement.querySelector('.inboxsdk__resultsSection_title_subtitle');
|
|
288
182
|
if (!collapsibleSectionDescriptor.subtitle) {
|
|
289
183
|
if (subtitleElement) {
|
|
290
184
|
subtitleElement.remove();
|
|
291
185
|
}
|
|
292
|
-
} else if (
|
|
293
|
-
this._collapsibleSectionDescriptor.subtitle !==
|
|
294
|
-
collapsibleSectionDescriptor.subtitle
|
|
295
|
-
) {
|
|
186
|
+
} else if (this._collapsibleSectionDescriptor.subtitle !== collapsibleSectionDescriptor.subtitle) {
|
|
296
187
|
if (!subtitleElement) {
|
|
297
188
|
subtitleElement = document.createElement('span');
|
|
298
189
|
if (subtitleElement && titleElement) {
|
|
299
|
-
subtitleElement.classList.add(
|
|
300
|
-
'inboxsdk__resultsSection_title_subtitle'
|
|
301
|
-
);
|
|
302
|
-
|
|
190
|
+
subtitleElement.classList.add('inboxsdk__resultsSection_title_subtitle');
|
|
303
191
|
const insertionPoint = titleElement.querySelector('.Wn');
|
|
304
|
-
|
|
305
192
|
if (insertionPoint) {
|
|
306
193
|
subtitleElement.classList.add('aw5');
|
|
307
|
-
|
|
194
|
+
insertionPoint.appendChild(subtitleElement);
|
|
308
195
|
}
|
|
309
196
|
}
|
|
310
197
|
}
|
|
311
|
-
|
|
312
|
-
subtitleElement.textContent =
|
|
313
|
-
'(' + collapsibleSectionDescriptor.subtitle + ')';
|
|
198
|
+
subtitleElement.textContent = '(' + collapsibleSectionDescriptor.subtitle + ')';
|
|
314
199
|
}
|
|
315
200
|
}
|
|
316
|
-
|
|
317
|
-
_updateSummaryText(collapsibleSectionDescriptor: Object) {
|
|
201
|
+
_updateSummaryText(collapsibleSectionDescriptor) {
|
|
318
202
|
const headerElement = this._headerElement;
|
|
319
203
|
if (!headerElement) return;
|
|
320
|
-
|
|
321
|
-
let summaryTextElement = headerElement.querySelector(
|
|
322
|
-
'.inboxsdk__resultsSection_header_summaryText'
|
|
323
|
-
);
|
|
204
|
+
let summaryTextElement = headerElement.querySelector('.inboxsdk__resultsSection_header_summaryText');
|
|
324
205
|
if (!collapsibleSectionDescriptor.titleLinkText) {
|
|
325
206
|
if (summaryTextElement) {
|
|
326
207
|
summaryTextElement.remove();
|
|
327
208
|
}
|
|
328
|
-
} else if (
|
|
329
|
-
collapsibleSectionDescriptor.titleLinkText !==
|
|
330
|
-
this._collapsibleSectionDescriptor.titleLinkText
|
|
331
|
-
) {
|
|
209
|
+
} else if (collapsibleSectionDescriptor.titleLinkText !== this._collapsibleSectionDescriptor.titleLinkText) {
|
|
332
210
|
if (!summaryTextElement) {
|
|
333
211
|
summaryTextElement = document.createElement('div');
|
|
334
|
-
summaryTextElement.setAttribute(
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
'<span class="Di"> ',
|
|
341
|
-
'<div class="J-J5-Ji amH">',
|
|
342
|
-
'<span class="Dj">',
|
|
343
|
-
'<span></span>',
|
|
344
|
-
'</span>',
|
|
345
|
-
' ',
|
|
346
|
-
'</div>',
|
|
347
|
-
'</span>',
|
|
348
|
-
].join('');
|
|
349
|
-
|
|
350
|
-
this._eventStream.plug(
|
|
351
|
-
Kefir.fromEvents(summaryTextElement, 'click').map(() => ({
|
|
352
|
-
eventName: 'titleLinkClicked',
|
|
353
|
-
sectionDescriptor: this._collapsibleSectionDescriptor,
|
|
354
|
-
}))
|
|
355
|
-
);
|
|
356
|
-
|
|
212
|
+
summaryTextElement.setAttribute('class', 'inboxsdk__resultsSection_header_summaryText Wm');
|
|
213
|
+
summaryTextElement.innerHTML = ['<span class="Di"> ', '<div class="J-J5-Ji amH">', '<span class="Dj">', '<span></span>', '</span>', ' ', '</div>', '</span>'].join('');
|
|
214
|
+
this._eventStream.plug(_kefir.default.fromEvents(summaryTextElement, 'click').map(() => ({
|
|
215
|
+
eventName: 'titleLinkClicked',
|
|
216
|
+
sectionDescriptor: this._collapsibleSectionDescriptor
|
|
217
|
+
})));
|
|
357
218
|
const _summaryTextElement = summaryTextElement;
|
|
358
219
|
summaryTextElement.addEventListener('mouseenter', function () {
|
|
359
220
|
_summaryTextElement.classList.add('aqi');
|
|
360
221
|
});
|
|
361
|
-
|
|
362
222
|
summaryTextElement.addEventListener('mouseleave', function () {
|
|
363
223
|
_summaryTextElement.classList.remove('aqi');
|
|
364
224
|
});
|
|
365
|
-
|
|
366
225
|
const insertionPoint = headerElement.querySelector('.Cr');
|
|
367
|
-
if (insertionPoint)
|
|
368
|
-
(insertionPoint: any).insertAdjacentElement(
|
|
369
|
-
'afterbegin',
|
|
370
|
-
summaryTextElement
|
|
371
|
-
);
|
|
226
|
+
if (insertionPoint) insertionPoint.insertAdjacentElement('afterbegin', summaryTextElement);
|
|
372
227
|
}
|
|
373
|
-
|
|
374
|
-
querySelector(summaryTextElement, '.Dj > *').textContent =
|
|
375
|
-
collapsibleSectionDescriptor.titleLinkText;
|
|
228
|
+
(0, _querySelectorOrFail.default)(summaryTextElement, '.Dj > *').textContent = collapsibleSectionDescriptor.titleLinkText;
|
|
376
229
|
}
|
|
377
230
|
}
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
!collapsibleSectionDescriptor.hasDropdown ||
|
|
382
|
-
!collapsibleSectionDescriptor.onDropdownClick
|
|
383
|
-
) {
|
|
384
|
-
if (this._inboxDropdownButtonView)
|
|
385
|
-
this._inboxDropdownButtonView.destroy();
|
|
231
|
+
_updateDropdown(collapsibleSectionDescriptor) {
|
|
232
|
+
if (!collapsibleSectionDescriptor.hasDropdown || !collapsibleSectionDescriptor.onDropdownClick) {
|
|
233
|
+
if (this._inboxDropdownButtonView) this._inboxDropdownButtonView.destroy();
|
|
386
234
|
if (this._dropdownViewController) this._dropdownViewController.destroy();
|
|
387
|
-
} else if (
|
|
388
|
-
collapsibleSectionDescriptor.hasDropdown &&
|
|
389
|
-
collapsibleSectionDescriptor.onDropdownClick
|
|
390
|
-
) {
|
|
235
|
+
} else if (collapsibleSectionDescriptor.hasDropdown && collapsibleSectionDescriptor.onDropdownClick) {
|
|
391
236
|
if (!this._inboxDropdownButtonView || !this._dropdownViewController) {
|
|
392
|
-
const inboxDropdownButtonView =
|
|
393
|
-
|
|
394
|
-
this._dropdownViewController = new DropdownButtonViewController({
|
|
237
|
+
const inboxDropdownButtonView = this._inboxDropdownButtonView = new _inboxDropdownButtonView.default();
|
|
238
|
+
this._dropdownViewController = new _dropdownButtonViewController.default({
|
|
395
239
|
buttonView: inboxDropdownButtonView,
|
|
396
|
-
dropdownViewDriverClass:
|
|
397
|
-
dropdownShowFunction: collapsibleSectionDescriptor.onDropdownClick
|
|
240
|
+
dropdownViewDriverClass: _gmailDropdownView.default,
|
|
241
|
+
dropdownShowFunction: collapsibleSectionDescriptor.onDropdownClick
|
|
398
242
|
});
|
|
399
|
-
|
|
400
243
|
const headerElement = this._headerElement;
|
|
401
244
|
if (headerElement) {
|
|
402
245
|
const childElement = headerElement.querySelector('.Cr');
|
|
403
|
-
if (childElement)
|
|
404
|
-
childElement.appendChild(inboxDropdownButtonView.getElement());
|
|
246
|
+
if (childElement) childElement.appendChild(inboxDropdownButtonView.getElement());
|
|
405
247
|
}
|
|
406
|
-
} else if (
|
|
407
|
-
collapsibleSectionDescriptor.onDropdownClick
|
|
408
|
-
this._collapsibleSectionDescriptor.onDropdownClick
|
|
409
|
-
) {
|
|
410
|
-
if (this._dropdownViewController)
|
|
411
|
-
this._dropdownViewController.setDropdownShowFunction(
|
|
412
|
-
collapsibleSectionDescriptor.onDropdownClick
|
|
413
|
-
);
|
|
248
|
+
} else if (collapsibleSectionDescriptor.onDropdownClick !== this._collapsibleSectionDescriptor.onDropdownClick) {
|
|
249
|
+
if (this._dropdownViewController) this._dropdownViewController.setDropdownShowFunction(collapsibleSectionDescriptor.onDropdownClick);
|
|
414
250
|
}
|
|
415
251
|
}
|
|
416
252
|
}
|
|
417
|
-
|
|
418
|
-
_updateContentElement(collapsibleSectionDescriptor: Object) {
|
|
253
|
+
_updateContentElement(collapsibleSectionDescriptor) {
|
|
419
254
|
const contentElement = this._contentElement;
|
|
420
255
|
if (!contentElement) return;
|
|
421
|
-
|
|
422
256
|
contentElement.innerHTML = '';
|
|
423
|
-
|
|
424
257
|
if (collapsibleSectionDescriptor.contentElement) {
|
|
425
258
|
contentElement.style.display = '';
|
|
426
259
|
contentElement.appendChild(collapsibleSectionDescriptor.contentElement);
|
|
@@ -428,14 +261,13 @@ class GmailCollapsibleSectionView {
|
|
|
428
261
|
contentElement.style.display = 'none';
|
|
429
262
|
}
|
|
430
263
|
}
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
264
|
+
_updateTableRows(collapsibleSectionDescriptor) {
|
|
265
|
+
const {
|
|
266
|
+
tableRows
|
|
267
|
+
} = collapsibleSectionDescriptor;
|
|
434
268
|
const tableBodyElement = this._tableBodyElement;
|
|
435
269
|
if (!tableBodyElement) return;
|
|
436
|
-
|
|
437
270
|
tableBodyElement.innerHTML = '';
|
|
438
|
-
|
|
439
271
|
if (!tableRows || tableRows.length === 0) {
|
|
440
272
|
tableBodyElement.style.display = 'none';
|
|
441
273
|
} else {
|
|
@@ -443,70 +275,44 @@ class GmailCollapsibleSectionView {
|
|
|
443
275
|
this._renderTable(tableRows);
|
|
444
276
|
}
|
|
445
277
|
}
|
|
446
|
-
|
|
447
|
-
_renderTable(tableRows: Array<Object>) {
|
|
278
|
+
_renderTable(tableRows) {
|
|
448
279
|
const tableElement = document.createElement('table');
|
|
449
280
|
tableElement.setAttribute('class', 'F cf zt');
|
|
450
281
|
tableElement.innerHTML = _getTableHTML();
|
|
451
|
-
|
|
452
|
-
if (this._tableBodyElement)
|
|
453
|
-
this._tableBodyElement.appendChild(tableElement);
|
|
454
|
-
|
|
282
|
+
if (this._tableBodyElement) this._tableBodyElement.appendChild(tableElement);
|
|
455
283
|
const tbody = tableElement.querySelector('tbody');
|
|
456
284
|
const eventStream = this._eventStream;
|
|
457
|
-
|
|
458
|
-
tableRows.forEach((result) => {
|
|
285
|
+
tableRows.forEach(result => {
|
|
459
286
|
const rowElement = document.createElement('tr');
|
|
460
|
-
rowElement.setAttribute(
|
|
461
|
-
'class',
|
|
462
|
-
'inboxsdk__resultsSection_tableRow zA ' + (result.isRead ? 'yO' : 'zE')
|
|
463
|
-
);
|
|
287
|
+
rowElement.setAttribute('class', 'inboxsdk__resultsSection_tableRow zA ' + (result.isRead ? 'yO' : 'zE'));
|
|
464
288
|
rowElement.innerHTML = _getRowHTML(result);
|
|
465
|
-
|
|
466
289
|
if (!tbody) throw new Error('should not happen');
|
|
467
290
|
tbody.appendChild(rowElement);
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
rowDescriptor: result,
|
|
473
|
-
}))
|
|
474
|
-
);
|
|
291
|
+
eventStream.plug(_kefir.default.fromEvents(rowElement, 'click').map(() => ({
|
|
292
|
+
eventName: 'rowClicked',
|
|
293
|
+
rowDescriptor: result
|
|
294
|
+
})));
|
|
475
295
|
});
|
|
476
296
|
}
|
|
477
|
-
|
|
478
|
-
_updateMessageElement(collapsibleSectionDescriptor: Object) {
|
|
297
|
+
_updateMessageElement(collapsibleSectionDescriptor) {
|
|
479
298
|
const messageElement = this._messageElement;
|
|
480
|
-
if (
|
|
481
|
-
(collapsibleSectionDescriptor.tableRows &&
|
|
482
|
-
collapsibleSectionDescriptor.tableRows.length > 0) ||
|
|
483
|
-
collapsibleSectionDescriptor.contentElement
|
|
484
|
-
) {
|
|
299
|
+
if (collapsibleSectionDescriptor.tableRows && collapsibleSectionDescriptor.tableRows.length > 0 || collapsibleSectionDescriptor.contentElement) {
|
|
485
300
|
if (messageElement) {
|
|
486
301
|
messageElement.innerHTML = '';
|
|
487
302
|
messageElement.style.display = 'none';
|
|
488
303
|
}
|
|
489
|
-
} else if (
|
|
490
|
-
collapsibleSectionDescriptor.tableRows &&
|
|
491
|
-
collapsibleSectionDescriptor.tableRows.length === 0 &&
|
|
492
|
-
!collapsibleSectionDescriptor.contentElement
|
|
493
|
-
) {
|
|
304
|
+
} else if (collapsibleSectionDescriptor.tableRows && collapsibleSectionDescriptor.tableRows.length === 0 && !collapsibleSectionDescriptor.contentElement) {
|
|
494
305
|
this._showEmptyMessage();
|
|
495
306
|
}
|
|
496
307
|
}
|
|
497
|
-
|
|
498
308
|
_showLoadingMessage() {
|
|
499
309
|
const messageElement = this._messageElement;
|
|
500
310
|
if (messageElement) {
|
|
501
|
-
messageElement.setAttribute(
|
|
502
|
-
'class',
|
|
503
|
-
'TB TC inboxsdk__resultsSection_loading'
|
|
504
|
-
);
|
|
311
|
+
messageElement.setAttribute('class', 'TB TC inboxsdk__resultsSection_loading');
|
|
505
312
|
messageElement.innerHTML = 'loading...'; //TODO: localize
|
|
506
313
|
messageElement.style.display = '';
|
|
507
314
|
}
|
|
508
315
|
}
|
|
509
|
-
|
|
510
316
|
_showEmptyMessage() {
|
|
511
317
|
const messageElement = this._messageElement;
|
|
512
318
|
if (messageElement) {
|
|
@@ -515,41 +321,27 @@ class GmailCollapsibleSectionView {
|
|
|
515
321
|
messageElement.style.display = '';
|
|
516
322
|
}
|
|
517
323
|
}
|
|
518
|
-
|
|
519
|
-
_updateFooter(collapsibleSectionDescriptor: Object) {
|
|
324
|
+
_updateFooter(collapsibleSectionDescriptor) {
|
|
520
325
|
const footerElement = this._footerElement;
|
|
521
326
|
if (!footerElement) return;
|
|
522
|
-
|
|
523
327
|
footerElement.innerHTML = '';
|
|
524
|
-
|
|
525
|
-
if (
|
|
526
|
-
!collapsibleSectionDescriptor.footerLinkText &&
|
|
527
|
-
!collapsibleSectionDescriptor.footerLinkIconUrl &&
|
|
528
|
-
!collapsibleSectionDescriptor.footerLinkIconClass
|
|
529
|
-
) {
|
|
328
|
+
if (!collapsibleSectionDescriptor.footerLinkText && !collapsibleSectionDescriptor.footerLinkIconUrl && !collapsibleSectionDescriptor.footerLinkIconClass) {
|
|
530
329
|
footerElement.style.display = 'none';
|
|
531
330
|
} else {
|
|
532
331
|
footerElement.style.display = '';
|
|
533
|
-
|
|
534
332
|
const footerLinkElement = document.createElement('span');
|
|
535
333
|
footerLinkElement.setAttribute('class', 'e Wb');
|
|
536
|
-
footerLinkElement.textContent =
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
sectionDescriptor: this._collapsibleSectionDescriptor,
|
|
544
|
-
};
|
|
545
|
-
})
|
|
546
|
-
);
|
|
547
|
-
|
|
334
|
+
footerLinkElement.textContent = collapsibleSectionDescriptor.footerLinkText;
|
|
335
|
+
this._eventStream.plug(_kefir.default.fromEvents(footerLinkElement, 'click').map(() => {
|
|
336
|
+
return {
|
|
337
|
+
eventName: 'footerClicked',
|
|
338
|
+
sectionDescriptor: this._collapsibleSectionDescriptor
|
|
339
|
+
};
|
|
340
|
+
}));
|
|
548
341
|
footerElement.appendChild(footerLinkElement);
|
|
549
342
|
footerElement.insertAdjacentHTML('beforeend', '<br style="clear:both;">');
|
|
550
343
|
}
|
|
551
344
|
}
|
|
552
|
-
|
|
553
345
|
_toggleCollapseState() {
|
|
554
346
|
if (this._isCollapsed) {
|
|
555
347
|
this._expand();
|
|
@@ -557,154 +349,103 @@ class GmailCollapsibleSectionView {
|
|
|
557
349
|
this._collapse();
|
|
558
350
|
}
|
|
559
351
|
}
|
|
560
|
-
|
|
561
352
|
_collapse() {
|
|
562
353
|
const element = this._element;
|
|
563
354
|
if (!element) {
|
|
564
355
|
return;
|
|
565
356
|
}
|
|
566
|
-
|
|
567
357
|
element.classList.add('inboxsdk__resultsSection_collapsed');
|
|
568
|
-
|
|
569
358
|
if (!this._isSearch) {
|
|
570
359
|
this._addToCollapsedContainer();
|
|
571
360
|
}
|
|
572
|
-
|
|
573
361
|
const selector = 'h3 > img.Wp';
|
|
574
362
|
if (this._titleElement) {
|
|
575
|
-
const arrowSpan =
|
|
363
|
+
const arrowSpan = (0, _querySelectorOrFail.default)(this._titleElement, selector);
|
|
576
364
|
if (arrowSpan) {
|
|
577
365
|
arrowSpan.classList.remove('Wq');
|
|
578
366
|
arrowSpan.classList.add('Wo');
|
|
579
367
|
}
|
|
580
368
|
}
|
|
581
|
-
|
|
582
369
|
if (this._bodyElement) this._bodyElement.style.display = 'none';
|
|
583
370
|
this._isCollapsed = true;
|
|
584
|
-
|
|
585
371
|
this._eventStream.emit({
|
|
586
|
-
eventName: 'collapsed'
|
|
372
|
+
eventName: 'collapsed'
|
|
587
373
|
});
|
|
588
374
|
}
|
|
589
|
-
|
|
590
375
|
_expand() {
|
|
591
376
|
const element = this._element;
|
|
592
377
|
if (!element) {
|
|
593
378
|
return;
|
|
594
379
|
}
|
|
595
|
-
|
|
596
380
|
element.classList.remove('inboxsdk__resultsSection_collapsed');
|
|
597
|
-
|
|
598
381
|
if (!this._isSearch) {
|
|
599
382
|
this._removeFromCollapsedContainer();
|
|
600
383
|
}
|
|
601
|
-
|
|
602
384
|
const selector = 'h3 > img.Wp';
|
|
603
385
|
if (this._titleElement) {
|
|
604
|
-
const arrowSpan =
|
|
386
|
+
const arrowSpan = (0, _querySelectorOrFail.default)(this._titleElement, selector);
|
|
605
387
|
if (arrowSpan) {
|
|
606
388
|
arrowSpan.classList.remove('Wo');
|
|
607
389
|
arrowSpan.classList.add('Wq');
|
|
608
390
|
}
|
|
609
391
|
}
|
|
610
|
-
|
|
611
392
|
if (this._bodyElement) this._bodyElement.style.display = '';
|
|
612
393
|
this._isCollapsed = false;
|
|
613
|
-
|
|
614
394
|
this._eventStream.emit({
|
|
615
|
-
eventName: 'expanded'
|
|
395
|
+
eventName: 'expanded'
|
|
616
396
|
});
|
|
617
397
|
}
|
|
618
|
-
|
|
619
398
|
_addToCollapsedContainer() {
|
|
620
399
|
const element = this._element;
|
|
621
400
|
if (!element) return;
|
|
622
401
|
if (this._headerElement) this._headerElement.classList.remove('Wg');
|
|
623
|
-
|
|
624
|
-
if (
|
|
625
|
-
this._isCollapsedContainer(element.previousElementSibling) &&
|
|
626
|
-
this._isCollapsedContainer(element.nextElementSibling)
|
|
627
|
-
) {
|
|
402
|
+
if (this._isCollapsedContainer(element.previousElementSibling) && this._isCollapsedContainer(element.nextElementSibling)) {
|
|
628
403
|
//we are surrounded by collapse containers, let's favor our previous sibling
|
|
629
404
|
const otherCollapseContainer = element.nextElementSibling;
|
|
630
405
|
const previousSibling = element.previousElementSibling;
|
|
631
406
|
if (!previousSibling) throw new Error('previousSibling does not exist');
|
|
632
|
-
if (!otherCollapseContainer)
|
|
633
|
-
throw new Error('otherCollapseContainer does not exist');
|
|
634
|
-
|
|
407
|
+
if (!otherCollapseContainer) throw new Error('otherCollapseContainer does not exist');
|
|
635
408
|
const anchor = previousSibling.children[0].appendChild(element);
|
|
636
409
|
|
|
637
410
|
//now we need to "merge" the two collapse containers. This can be done by taking all the result sections out of the collapsed container
|
|
638
411
|
//and calling our "recollapse" helper function on them
|
|
639
|
-
const elementsToRecollapse = Array.from(
|
|
640
|
-
|
|
641
|
-
).concat(Array.from(otherCollapseContainer.children[1].children));
|
|
642
|
-
|
|
643
|
-
if (otherCollapseContainer)
|
|
644
|
-
this._pulloutSectionsFromCollapsedContainer(
|
|
645
|
-
(otherCollapseContainer: any)
|
|
646
|
-
);
|
|
412
|
+
const elementsToRecollapse = Array.from(otherCollapseContainer.children[0].children).concat(Array.from(otherCollapseContainer.children[1].children));
|
|
413
|
+
if (otherCollapseContainer) this._pulloutSectionsFromCollapsedContainer(otherCollapseContainer);
|
|
647
414
|
this._recollapse(elementsToRecollapse);
|
|
648
415
|
} else {
|
|
649
416
|
this._readdToCollapsedContainer();
|
|
650
417
|
}
|
|
651
418
|
}
|
|
652
|
-
|
|
653
419
|
_removeFromCollapsedContainer() {
|
|
654
420
|
if (this._headerElement) this._headerElement.classList.add('Wg');
|
|
655
421
|
const element = this._element;
|
|
656
422
|
if (!element) return;
|
|
657
|
-
|
|
658
423
|
const parentElement = element.parentElement;
|
|
659
424
|
if (!parentElement) return;
|
|
660
|
-
|
|
661
425
|
const container = parentElement.parentElement;
|
|
662
|
-
|
|
663
|
-
if (
|
|
664
|
-
!container ||
|
|
665
|
-
!container.classList.contains('inboxsdk__results_collapsedContainer')
|
|
666
|
-
) {
|
|
426
|
+
if (!container || !container.classList.contains('inboxsdk__results_collapsedContainer')) {
|
|
667
427
|
return;
|
|
668
428
|
}
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
container.children[0].children
|
|
672
|
-
).concat(Array.from(container.children[1].children));
|
|
673
|
-
this._pulloutSectionsFromCollapsedContainer((container: any));
|
|
429
|
+
const elementsToRecollapse = Array.from(container.children[0].children).concat(Array.from(container.children[1].children));
|
|
430
|
+
this._pulloutSectionsFromCollapsedContainer(container);
|
|
674
431
|
this._destroyCollapsedContainer();
|
|
675
|
-
|
|
676
|
-
this._recollapse(elementsToRecollapse.filter((child) => child !== element));
|
|
432
|
+
this._recollapse(elementsToRecollapse.filter(child => child !== element));
|
|
677
433
|
}
|
|
678
|
-
|
|
679
|
-
_pulloutSectionsFromCollapsedContainer(container: HTMLElement) {
|
|
434
|
+
_pulloutSectionsFromCollapsedContainer(container) {
|
|
680
435
|
const prependedChildren = Array.from(container.children[0].children);
|
|
681
|
-
prependedChildren.forEach((child)
|
|
682
|
-
|
|
683
|
-
);
|
|
684
|
-
|
|
685
|
-
const appendedChildren = Array.from(
|
|
686
|
-
container.children[1].children
|
|
687
|
-
).reverse();
|
|
688
|
-
appendedChildren.forEach((child) =>
|
|
689
|
-
(container: any).insertAdjacentElement('afterend', child)
|
|
690
|
-
);
|
|
436
|
+
prependedChildren.forEach(child => container.insertAdjacentElement('beforebegin', child));
|
|
437
|
+
const appendedChildren = Array.from(container.children[1].children).reverse();
|
|
438
|
+
appendedChildren.forEach(child => container.insertAdjacentElement('afterend', child));
|
|
691
439
|
}
|
|
692
|
-
|
|
693
440
|
_readdToCollapsedContainer() {
|
|
694
441
|
const element = this._element;
|
|
695
442
|
if (!element) return;
|
|
696
|
-
|
|
697
443
|
if (this._collapsedContainer) {
|
|
698
|
-
this._collapsedContainer.children[0].insertBefore(
|
|
699
|
-
element,
|
|
700
|
-
this._collapsedContainer.children[1].firstElementChild
|
|
701
|
-
);
|
|
444
|
+
this._collapsedContainer.children[0].insertBefore(element, this._collapsedContainer.children[1].firstElementChild);
|
|
702
445
|
return;
|
|
703
446
|
}
|
|
704
|
-
|
|
705
447
|
let collapsedContainer;
|
|
706
448
|
let isPrepend;
|
|
707
|
-
|
|
708
449
|
if (this._isCollapsedContainer(element.previousElementSibling)) {
|
|
709
450
|
isPrepend = false;
|
|
710
451
|
collapsedContainer = element.previousElementSibling;
|
|
@@ -716,61 +457,32 @@ class GmailCollapsibleSectionView {
|
|
|
716
457
|
this._createCollapsedContainer();
|
|
717
458
|
collapsedContainer = this._collapsedContainer;
|
|
718
459
|
}
|
|
719
|
-
|
|
720
460
|
if (isPrepend && collapsedContainer) {
|
|
721
|
-
collapsedContainer.children[0].insertBefore(
|
|
722
|
-
element,
|
|
723
|
-
collapsedContainer.children[0].firstElementChild
|
|
724
|
-
);
|
|
461
|
+
collapsedContainer.children[0].insertBefore(element, collapsedContainer.children[0].firstElementChild);
|
|
725
462
|
} else if (collapsedContainer) {
|
|
726
463
|
collapsedContainer.children[0].appendChild(element);
|
|
727
464
|
}
|
|
728
465
|
}
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
return (
|
|
732
|
-
element &&
|
|
733
|
-
element.classList.contains('inboxsdk__results_collapsedContainer')
|
|
734
|
-
);
|
|
466
|
+
_isCollapsedContainer(element) {
|
|
467
|
+
return element && element.classList.contains('inboxsdk__results_collapsedContainer');
|
|
735
468
|
}
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
children.forEach((child) => {
|
|
469
|
+
_recollapse(children) {
|
|
470
|
+
children.forEach(child => {
|
|
739
471
|
const removeEvent = document.createEvent('CustomEvent');
|
|
740
|
-
|
|
741
|
-
'removeCollapsedContainer',
|
|
742
|
-
false,
|
|
743
|
-
false,
|
|
744
|
-
null
|
|
745
|
-
);
|
|
472
|
+
removeEvent.initCustomEvent('removeCollapsedContainer', false, false, null);
|
|
746
473
|
child.dispatchEvent(removeEvent);
|
|
747
|
-
|
|
748
474
|
const readdEvent = document.createEvent('CustomEvent');
|
|
749
|
-
|
|
750
|
-
'readdToCollapsedContainer',
|
|
751
|
-
false,
|
|
752
|
-
false,
|
|
753
|
-
null
|
|
754
|
-
);
|
|
475
|
+
readdEvent.initCustomEvent('readdToCollapsedContainer', false, false, null);
|
|
755
476
|
child.dispatchEvent(readdEvent);
|
|
756
477
|
});
|
|
757
478
|
}
|
|
758
|
-
|
|
759
479
|
_createCollapsedContainer() {
|
|
760
|
-
const collapsedContainer =
|
|
761
|
-
|
|
762
|
-
collapsedContainer.
|
|
763
|
-
'class',
|
|
764
|
-
'inboxsdk__results_collapsedContainer Wg'
|
|
765
|
-
);
|
|
766
|
-
collapsedContainer.innerHTML =
|
|
767
|
-
'<div class="inboxsdk__results_collapsedContainer_prepend"></div><div class="inboxsdk__results_collapsedContainer_append"></div>';
|
|
768
|
-
|
|
480
|
+
const collapsedContainer = this._collapsedContainer = document.createElement('div');
|
|
481
|
+
collapsedContainer.setAttribute('class', 'inboxsdk__results_collapsedContainer Wg');
|
|
482
|
+
collapsedContainer.innerHTML = '<div class="inboxsdk__results_collapsedContainer_prepend"></div><div class="inboxsdk__results_collapsedContainer_append"></div>';
|
|
769
483
|
const element = this._element;
|
|
770
|
-
if (element)
|
|
771
|
-
(element: any).insertAdjacentElement('afterend', collapsedContainer);
|
|
484
|
+
if (element) element.insertAdjacentElement('afterend', collapsedContainer);
|
|
772
485
|
}
|
|
773
|
-
|
|
774
486
|
_destroyCollapsedContainer() {
|
|
775
487
|
if (this._collapsedContainer) {
|
|
776
488
|
this._collapsedContainer.remove();
|
|
@@ -778,132 +490,67 @@ class GmailCollapsibleSectionView {
|
|
|
778
490
|
}
|
|
779
491
|
}
|
|
780
492
|
}
|
|
781
|
-
|
|
782
493
|
function _getTableHTML() {
|
|
783
|
-
return [
|
|
784
|
-
'<colgroup>',
|
|
785
|
-
'<col class="k0vOLb">',
|
|
786
|
-
'<col class="Ci">',
|
|
787
|
-
'<col class="y5">',
|
|
788
|
-
'<col class="WA">',
|
|
789
|
-
'<col class="yY">',
|
|
790
|
-
'<col>',
|
|
791
|
-
'<col class="xX">',
|
|
792
|
-
'</colgroup>',
|
|
793
|
-
'<tbody>',
|
|
794
|
-
'</tbody>',
|
|
795
|
-
].join('');
|
|
494
|
+
return ['<colgroup>', '<col class="k0vOLb">', '<col class="Ci">', '<col class="y5">', '<col class="WA">', '<col class="yY">', '<col>', '<col class="xX">', '</colgroup>', '<tbody>', '</tbody>'].join('');
|
|
796
495
|
}
|
|
797
|
-
|
|
798
496
|
function _getRowHTML(result) {
|
|
799
497
|
let iconHtml = '';
|
|
800
498
|
if (result.iconHtml != null) {
|
|
801
|
-
iconHtml =
|
|
802
|
-
${{
|
|
499
|
+
iconHtml = (0, _autoHtml.default)`<div class="inboxsdk__resultsSection_result_icon inboxsdk__resultsSection_result_iconHtml">
|
|
500
|
+
${{
|
|
501
|
+
__html: result.iconHtml
|
|
502
|
+
}}
|
|
803
503
|
</div>`;
|
|
804
504
|
} else if (result.iconUrl) {
|
|
805
|
-
iconHtml =
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
iconHtml = autoHtml`<div class="${result.iconClass}"></div>`;
|
|
810
|
-
|
|
811
|
-
const labelsHtml = Array.isArray(result.labels)
|
|
812
|
-
? result.labels.map(_getLabelHTML).join('')
|
|
813
|
-
: '';
|
|
814
|
-
|
|
815
|
-
const rowArr = [
|
|
816
|
-
'<td class="xY PF"></td>',
|
|
817
|
-
'<td class="xY oZ-x3"></td>',
|
|
818
|
-
'<td class="xY WA">',
|
|
819
|
-
iconHtml,
|
|
820
|
-
'</td>',
|
|
821
|
-
'<td class="xY WA"></td>',
|
|
822
|
-
'<td class="xY yX inboxsdk__resultsSection_result_title">',
|
|
823
|
-
'<div class="yW">',
|
|
824
|
-
'<span ' + (result.isRead ? '' : 'class="zF"') + '>',
|
|
825
|
-
escape(result.title),
|
|
826
|
-
'</span>',
|
|
827
|
-
'</div>',
|
|
828
|
-
'</td>',
|
|
829
|
-
'<td class="xY a4W">',
|
|
830
|
-
'<div class="xS">',
|
|
831
|
-
'<div class="xT">',
|
|
832
|
-
'<div class="yi">',
|
|
833
|
-
labelsHtml,
|
|
834
|
-
'</div>',
|
|
835
|
-
'<div class="y6">',
|
|
836
|
-
'<span class="bog">',
|
|
837
|
-
result.isRead ? '' : '<b>',
|
|
838
|
-
escape(result.body || ''),
|
|
839
|
-
result.isRead ? '' : '</b>',
|
|
840
|
-
'</span>',
|
|
841
|
-
'</div>',
|
|
842
|
-
'</div>',
|
|
843
|
-
'</div>',
|
|
844
|
-
'</td>',
|
|
845
|
-
'<td class="xY xW">',
|
|
846
|
-
'<span' + (result.isRead ? '' : ' class="bq3"') + '>',
|
|
847
|
-
escape(result.shortDetailText || ''),
|
|
848
|
-
'</span>',
|
|
849
|
-
'</td>',
|
|
850
|
-
];
|
|
851
|
-
|
|
505
|
+
iconHtml = (0, _autoHtml.default)`<img class="inboxsdk__resultsSection_result_icon ${result.iconClass || ''}" src="${result.iconUrl}">`;
|
|
506
|
+
} else if (result.iconClass) iconHtml = (0, _autoHtml.default)`<div class="${result.iconClass}"></div>`;
|
|
507
|
+
const labelsHtml = Array.isArray(result.labels) ? result.labels.map(_getLabelHTML).join('') : '';
|
|
508
|
+
const rowArr = ['<td class="xY PF"></td>', '<td class="xY oZ-x3"></td>', '<td class="xY WA">', iconHtml, '</td>', '<td class="xY WA"></td>', '<td class="xY yX inboxsdk__resultsSection_result_title">', '<div class="yW">', '<span ' + (result.isRead ? '' : 'class="zF"') + '>', (0, _escape.default)(result.title), '</span>', '</div>', '</td>', '<td class="xY a4W">', '<div class="xS">', '<div class="xT">', '<div class="yi">', labelsHtml, '</div>', '<div class="y6">', '<span class="bog">', result.isRead ? '' : '<b>', (0, _escape.default)(result.body || ''), result.isRead ? '' : '</b>', '</span>', '</div>', '</div>', '</div>', '</td>', '<td class="xY xW">', '<span' + (result.isRead ? '' : ' class="bq3"') + '>', (0, _escape.default)(result.shortDetailText || ''), '</span>', '</td>'];
|
|
852
509
|
return rowArr.join('');
|
|
853
510
|
}
|
|
854
|
-
|
|
855
511
|
function _getLabelHTML(label) {
|
|
856
512
|
const backgroundColor = label.backgroundColor || 'rgb(194, 194, 194)'; //grey
|
|
857
513
|
const foregroundColor = label.foregroundColor || 'rgb(255, 255, 255)'; //white
|
|
858
514
|
const maxWidth = label.maxWidth || '90px';
|
|
859
|
-
|
|
860
|
-
const retArray = [
|
|
861
|
-
autoHtml`<div class="ar as" data-tooltip="${label.title}">
|
|
515
|
+
const retArray = [(0, _autoHtml.default)`<div class="ar as" data-tooltip="${label.title}">
|
|
862
516
|
<div class="at" style="background-color: ${backgroundColor}; border-color: ${backgroundColor};">
|
|
863
|
-
<div class="au" style="border-color: ${backgroundColor};"
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
const styleHtml = label.iconBackgroundColor
|
|
867
|
-
? autoHtml`style="background-color: ${label.iconBackgroundColor}"`
|
|
868
|
-
: '';
|
|
869
|
-
|
|
517
|
+
<div class="au" style="border-color: ${backgroundColor};">`];
|
|
518
|
+
const styleHtml = label.iconBackgroundColor ? (0, _autoHtml.default)`style="background-color: ${label.iconBackgroundColor}"` : '';
|
|
870
519
|
if (label.iconHtml != null) {
|
|
871
|
-
retArray.push(
|
|
872
|
-
|
|
873
|
-
|
|
520
|
+
retArray.push((0, _autoHtml.default)`<div class="inboxsdk__resultsSection_label_icon inboxsdk__resultsSection_label_iconHtml"
|
|
521
|
+
${{
|
|
522
|
+
__html: styleHtml
|
|
523
|
+
}}
|
|
874
524
|
>
|
|
875
|
-
${{
|
|
876
|
-
|
|
877
|
-
|
|
525
|
+
${{
|
|
526
|
+
__html: label.iconHtml
|
|
527
|
+
}}
|
|
528
|
+
</div>`);
|
|
878
529
|
} else if (label.iconClass) {
|
|
879
|
-
retArray.push(
|
|
880
|
-
autoHtml`<div
|
|
530
|
+
retArray.push((0, _autoHtml.default)`<div
|
|
881
531
|
class="inboxsdk__resultsSection_label_icon ${label.iconClass || ''}"
|
|
882
|
-
${{
|
|
532
|
+
${{
|
|
533
|
+
__html: styleHtml
|
|
534
|
+
}}
|
|
883
535
|
>
|
|
884
|
-
</div>`
|
|
885
|
-
);
|
|
536
|
+
</div>`);
|
|
886
537
|
} else if (label.iconUrl) {
|
|
887
|
-
retArray.push(
|
|
888
|
-
autoHtml`<img
|
|
538
|
+
retArray.push((0, _autoHtml.default)`<img
|
|
889
539
|
class="inboxsdk__resultsSection_label_icon"
|
|
890
|
-
${{
|
|
891
|
-
|
|
892
|
-
|
|
540
|
+
${{
|
|
541
|
+
__html: styleHtml
|
|
542
|
+
}}
|
|
543
|
+
src="${label.iconUrl}" />`);
|
|
893
544
|
}
|
|
894
|
-
|
|
895
|
-
retArray.push(
|
|
896
|
-
autoHtml`
|
|
545
|
+
retArray.push((0, _autoHtml.default)`
|
|
897
546
|
<div class="av" style="color: ${foregroundColor}; max-width: ${maxWidth}">
|
|
898
547
|
${label.title}
|
|
899
548
|
</div>
|
|
900
549
|
</div>
|
|
901
550
|
</div>
|
|
902
551
|
</div>
|
|
903
|
-
`
|
|
904
|
-
);
|
|
905
|
-
|
|
552
|
+
`);
|
|
906
553
|
return retArray.join('');
|
|
907
554
|
}
|
|
908
|
-
|
|
909
|
-
|
|
555
|
+
var _default = (0, _ud.defn)(module, GmailCollapsibleSectionView);
|
|
556
|
+
exports.default = _default;
|