// Copyright 2021 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. import '../../ui/components/adorners/adorners.js'; import * as i18n from '../../core/i18n/i18n.js'; import * as IssuesManager from '../../models/issues_manager/issues_manager.js'; import * as Buttons from '../../ui/components/buttons/buttons.js'; import * as UI from '../../ui/legacy/legacy.js'; import {html, render} from '../../ui/lit/lit.js'; import * as VisualLogging from '../../ui/visual_logging/visual_logging.js'; const UIStrings = { /** * @description Title for the hidden issues row */ hiddenIssues: 'Hidden issues', /** * @description Label for the button to unhide all hidden issues */ unhideAll: 'Unhide all', } as const; const str_ = i18n.i18n.registerUIStrings('panels/issues/HiddenIssuesRow.ts', UIStrings); const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_); interface ViewInput { count: number; onUnhideAllIssues: () => void; } type ViewOutput = unknown; type View = (input: ViewInput, output: ViewOutput, target: HTMLElement) => void; const DEFAULT_VIEW: View = (input: ViewInput, _output: ViewOutput, target: HTMLElement): void => { const stopPropagationForEnter = (event: KeyboardEvent): void => { if (event.key === 'Enter') { // Make sure we don't propagate 'Enter' key events to parents, // so that these get turned into 'click' events properly. If we // don't stop the propagation here, the 'Enter' key down event // will be consumed by the tree element and it'll be expanded // or collapsed instead of the "Unhide all" action being taken. event.stopImmediatePropagation(); } }; // clang-format off render(html`