chrome-devtools-frontend 1.0.951410 → 1.0.952713
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/config/gni/devtools_grd_files.gni +3 -0
- package/extension-api/ExtensionAPI.d.ts +1 -1
- package/front_end/.eslintrc.js +6 -0
- package/front_end/Tests.js +10 -0
- package/front_end/core/common/App.ts +0 -3
- package/front_end/core/common/AppProvider.ts +0 -3
- package/front_end/core/common/JavaScriptMetaData.ts +0 -3
- package/front_end/core/common/QueryParamHandler.ts +0 -3
- package/front_end/core/common/Runnable.ts +0 -3
- package/front_end/core/common/SimpleHistoryManager.ts +0 -3
- package/front_end/core/host/UserMetrics.ts +2 -1
- package/front_end/core/i18n/locales/en-US.json +3 -0
- package/front_end/core/i18n/locales/en-XL.json +3 -0
- package/front_end/core/root/Runtime.ts +4 -12
- package/front_end/core/sdk/OverlayPersistentHighlighter.ts +0 -12
- package/front_end/core/sdk/PageResourceLoader.ts +2 -1
- package/front_end/core/sdk/TracingManager.ts +0 -3
- package/front_end/entrypoints/formatter_worker/AcornTokenizer.ts +39 -39
- package/front_end/entrypoints/formatter_worker/CSSFormatter.ts +54 -54
- package/front_end/entrypoints/formatter_worker/ESTreeWalker.ts +20 -20
- package/front_end/entrypoints/formatter_worker/FormattedContentBuilder.ts +54 -54
- package/front_end/entrypoints/formatter_worker/HTMLFormatter.ts +145 -144
- package/front_end/entrypoints/formatter_worker/JavaScriptFormatter.ts +40 -40
- package/front_end/entrypoints/heap_snapshot_worker/AllocationProfile.ts +64 -69
- package/front_end/entrypoints/heap_snapshot_worker/HeapSnapshot.ts +203 -203
- package/front_end/entrypoints/heap_snapshot_worker/HeapSnapshotLoader.ts +109 -108
- package/front_end/entrypoints/heap_snapshot_worker/HeapSnapshotWorkerDispatcher.ts +17 -17
- package/front_end/entrypoints/inspector_main/InspectorMain.ts +30 -30
- package/front_end/entrypoints/inspector_main/RenderingOptions.ts +25 -25
- package/front_end/entrypoints/main/ExecutionContextSelector.ts +52 -55
- package/front_end/entrypoints/main/MainImpl.ts +49 -49
- package/front_end/entrypoints/node_app/NodeConnectionsPanel.ts +43 -43
- package/front_end/entrypoints/node_app/NodeMain.ts +38 -38
- package/front_end/generated/InspectorBackendCommands.js +5 -1
- package/front_end/generated/protocol.d.ts +16 -0
- package/front_end/legacy/legacy-defs.d.ts +0 -21
- package/front_end/models/bindings/CSSWorkspaceBinding.ts +0 -3
- package/front_end/models/bindings/DebuggerWorkspaceBinding.ts +0 -3
- package/front_end/models/bindings/FileUtils.ts +0 -3
- package/front_end/models/extensions/ExtensionAPI.ts +2 -1
- package/front_end/models/extensions/ExtensionTraceProvider.ts +0 -3
- package/front_end/models/heap_snapshot_model/HeapSnapshotModel.ts +1 -1
- package/front_end/models/issues_manager/ClientHintIssue.ts +95 -0
- package/front_end/models/issues_manager/ContentSecurityPolicyIssue.ts +6 -6
- package/front_end/models/issues_manager/ContrastCheckTrigger.ts +15 -15
- package/front_end/models/issues_manager/CorsIssue.ts +9 -9
- package/front_end/models/issues_manager/CrossOriginEmbedderPolicyIssue.ts +5 -5
- package/front_end/models/issues_manager/DeprecationIssue.ts +7 -7
- package/front_end/models/issues_manager/GenericIssue.ts +5 -5
- package/front_end/models/issues_manager/HeavyAdIssue.ts +5 -5
- package/front_end/models/issues_manager/Issue.ts +10 -10
- package/front_end/models/issues_manager/IssueResolver.ts +11 -10
- package/front_end/models/issues_manager/IssuesManager.ts +61 -56
- package/front_end/models/issues_manager/LowTextContrastIssue.ts +4 -4
- package/front_end/models/issues_manager/MixedContentIssue.ts +7 -7
- package/front_end/models/issues_manager/NavigatorUserAgentIssue.ts +7 -7
- package/front_end/models/issues_manager/QuirksModeIssue.ts +4 -4
- package/front_end/models/issues_manager/SameSiteCookieIssue.ts +16 -16
- package/front_end/models/issues_manager/SharedArrayBufferIssue.ts +5 -5
- package/front_end/models/issues_manager/SourceFrameIssuesManager.ts +32 -31
- package/front_end/models/issues_manager/TrustedWebActivityIssue.ts +5 -5
- package/front_end/models/issues_manager/WasmCrossOriginModuleSharingIssue.ts +5 -5
- package/front_end/models/issues_manager/descriptions/clientHintMetaTagAllowListInvalidOrigin.md +4 -0
- package/front_end/models/issues_manager/descriptions/clientHintMetaTagModifiedHTML.md +4 -0
- package/front_end/models/issues_manager/issues_manager.ts +2 -0
- package/front_end/models/timeline_model/TimelineModel.ts +1 -1
- package/front_end/panels/application/components/BackForwardCacheView.ts +33 -33
- package/front_end/panels/application/components/EndpointsGrid.ts +12 -12
- package/front_end/panels/application/components/FrameDetailsView.ts +108 -110
- package/front_end/panels/application/components/OriginTrialTreeView.ts +45 -45
- package/front_end/panels/application/components/PermissionsPolicySection.ts +19 -19
- package/front_end/panels/application/components/ReportsGrid.ts +30 -30
- package/front_end/panels/application/components/StackTrace.ts +48 -47
- package/front_end/panels/application/components/TrustTokensView.ts +31 -31
- package/front_end/panels/console/ConsoleView.ts +1 -1
- package/front_end/panels/console/ConsoleViewMessage.ts +1 -25
- package/front_end/panels/console/consoleView.css +5 -0
- package/front_end/panels/css_overview/CSSOverviewCompletedView.ts +41 -52
- package/front_end/panels/css_overview/CSSOverviewController.ts +2 -2
- package/front_end/panels/css_overview/CSSOverviewPanel.ts +18 -27
- package/front_end/panels/css_overview/CSSOverviewProcessingView.ts +2 -2
- package/front_end/panels/css_overview/CSSOverviewSidebarPanel.ts +6 -6
- package/front_end/panels/css_overview/components/CSSOverviewStartView.ts +4 -4
- package/front_end/panels/elements/ElementsTreeElement.ts +2 -6
- package/front_end/panels/elements/components/AccessibilityTreeNode.ts +17 -17
- package/front_end/panels/elements/components/AdornerManager.ts +21 -21
- package/front_end/panels/elements/components/AdornerSettingsPane.ts +14 -14
- package/front_end/panels/elements/components/CSSQuery.ts +16 -16
- package/front_end/panels/elements/components/ComputedStyleProperty.ts +14 -14
- package/front_end/panels/elements/components/ComputedStyleTrace.ts +15 -15
- package/front_end/panels/elements/components/ElementsBreadcrumbs.ts +78 -78
- package/front_end/panels/elements/components/ElementsPanelLink.ts +16 -16
- package/front_end/panels/elements/components/LayoutPane.ts +47 -47
- package/front_end/panels/elements/components/NodeText.ts +18 -18
- package/front_end/panels/elements/components/QueryContainer.ts +40 -40
- package/front_end/panels/elements/components/StylePropertyEditor.ts +18 -18
- package/front_end/panels/emulation/components/DeviceSizeInputElement.ts +4 -4
- package/front_end/panels/event_listeners/EventListenersUtils.ts +2 -1
- package/front_end/panels/issues/AffectedBlockedByResponseView.ts +4 -4
- package/front_end/panels/issues/AffectedCookiesView.ts +4 -5
- package/front_end/panels/issues/AffectedDirectivesView.ts +19 -19
- package/front_end/panels/issues/AffectedDocumentsInQuirksModeView.ts +7 -8
- package/front_end/panels/issues/AffectedElementsView.ts +4 -4
- package/front_end/panels/issues/AffectedElementsWithLowContrastView.ts +7 -8
- package/front_end/panels/issues/AffectedHeavyAdView.ts +8 -8
- package/front_end/panels/issues/AffectedResourcesView.ts +25 -26
- package/front_end/panels/issues/AffectedSharedArrayBufferIssueDetailsView.ts +8 -8
- package/front_end/panels/issues/AffectedSourcesView.ts +4 -4
- package/front_end/panels/issues/AffectedTrustedWebActivityIssueDetailsView.ts +4 -4
- package/front_end/panels/issues/AttributionReportingIssueDetailsView.ts +17 -17
- package/front_end/panels/issues/CSPViolationsListView.ts +22 -23
- package/front_end/panels/issues/CSPViolationsView.ts +17 -17
- package/front_end/panels/issues/ComboBoxOfCheckBoxes.ts +13 -13
- package/front_end/panels/issues/CorsIssueDetailsView.ts +23 -23
- package/front_end/panels/issues/GenericIssueDetailsView.ts +4 -4
- package/front_end/panels/issues/HiddenIssuesRow.ts +7 -7
- package/front_end/panels/issues/IssueAggregator.ts +95 -95
- package/front_end/panels/issues/IssueKindView.ts +14 -14
- package/front_end/panels/issues/IssueView.ts +98 -98
- package/front_end/panels/issues/IssuesPane.ts +102 -102
- package/front_end/panels/issues/WasmCrossOriginModuleSharingAffectedResourcesView.ts +5 -5
- package/front_end/panels/issues/components/HideIssuesMenu.ts +10 -10
- package/front_end/panels/media/PlayerListView.ts +160 -97
- package/front_end/panels/media/PlayerMessagesView.ts +1 -0
- package/front_end/panels/media/playerListView.css +58 -0
- package/front_end/panels/network/NetworkLogView.ts +2 -6
- package/front_end/panels/network/NetworkWaterfallColumn.ts +2 -4
- package/front_end/panels/network/components/RequestTrustTokensView.ts +40 -40
- package/front_end/panels/network/components/WebBundleInfoView.ts +9 -9
- package/front_end/panels/performance_monitor/PerformanceMonitor.ts +92 -37
- package/front_end/panels/performance_monitor/performanceMonitor.css +32 -0
- package/front_end/panels/protocol_monitor/ProtocolMonitor.ts +2 -2
- package/front_end/panels/search/SearchConfig.ts +0 -6
- package/front_end/panels/settings/KeybindsSettingsTab.ts +4 -0
- package/front_end/panels/settings/components/SyncSection.ts +14 -14
- package/front_end/panels/settings/emulation/components/UserAgentClientHintsForm.ts +96 -96
- package/front_end/panels/sources/BreakpointEditDialog.ts +4 -3
- package/front_end/panels/sources/NavigatorView.ts +3 -9
- package/front_end/panels/sources/SourceMapNamesResolver.ts +3 -3
- package/front_end/panels/sources/SourcesPanel.ts +1 -3
- package/front_end/panels/sources/SourcesView.ts +0 -3
- package/front_end/panels/sources/TabbedEditorContainer.ts +0 -3
- package/front_end/panels/timeline/TimelineFlameChartView.ts +1 -1
- package/front_end/panels/timeline/TimelineLoader.ts +0 -3
- package/front_end/panels/timeline/TimelineTreeView.ts +1 -1
- package/front_end/panels/timeline/components/WebVitalsLane.ts +77 -76
- package/front_end/panels/timeline/components/WebVitalsTimeline.ts +133 -133
- package/front_end/panels/timeline/components/WebVitalsTooltip.ts +9 -9
- package/front_end/panels/webauthn/WebauthnPane.ts +203 -205
- package/front_end/third_party/codemirror.next/bundle.ts +3 -3
- package/front_end/third_party/codemirror.next/chunk/codemirror.js +1 -1
- package/front_end/third_party/codemirror.next/chunk/markdown.js +2 -1
- package/front_end/third_party/codemirror.next/codemirror.next.d.ts +10 -1
- package/front_end/third_party/codemirror.next/codemirror.next.js +2 -1
- package/front_end/third_party/codemirror.next/package.json +3 -3
- package/front_end/third_party/diff/DiffWrapper.ts +7 -0
- package/front_end/ui/components/adorners/Adorner.ts +2 -2
- package/front_end/ui/components/buttons/Button.ts +9 -9
- package/front_end/ui/components/data_grid/DataGrid.ts +64 -64
- package/front_end/ui/components/data_grid/DataGridController.ts +22 -22
- package/front_end/ui/components/data_grid/DataGridUtils.ts +3 -0
- package/front_end/ui/components/diff_view/DiffView.ts +6 -6
- package/front_end/ui/components/expandable_list/ExpandableList.ts +5 -5
- package/front_end/ui/components/icon_button/Icon.ts +4 -4
- package/front_end/ui/components/icon_button/IconButton.ts +4 -4
- package/front_end/ui/components/issue_counter/IssueCounter.ts +3 -3
- package/front_end/ui/components/issue_counter/IssueLinkIcon.ts +11 -11
- package/front_end/ui/components/linear_memory_inspector/LinearMemoryInspector.ts +50 -50
- package/front_end/ui/components/linear_memory_inspector/LinearMemoryInspectorController.ts +6 -6
- package/front_end/ui/components/linear_memory_inspector/LinearMemoryInspectorPane.ts +4 -4
- package/front_end/ui/components/linear_memory_inspector/LinearMemoryNavigator.ts +12 -12
- package/front_end/ui/components/linear_memory_inspector/LinearMemoryValueInterpreter.ts +11 -11
- package/front_end/ui/components/linear_memory_inspector/LinearMemoryViewer.ts +40 -39
- package/front_end/ui/components/linear_memory_inspector/ValueInterpreterDisplay.ts +18 -18
- package/front_end/ui/components/linear_memory_inspector/ValueInterpreterSettings.ts +6 -6
- package/front_end/ui/components/linkifier/LinkifierImpl.ts +4 -4
- package/front_end/ui/components/markdown_view/MarkdownImage.ts +5 -5
- package/front_end/ui/components/markdown_view/MarkdownLink.ts +2 -2
- package/front_end/ui/components/markdown_view/MarkdownView.ts +4 -4
- package/front_end/ui/components/panel_feedback/FeedbackButton.ts +2 -2
- package/front_end/ui/components/panel_feedback/PanelFeedback.ts +2 -2
- package/front_end/ui/components/panel_feedback/PreviewToggle.ts +4 -4
- package/front_end/ui/components/render_coordinator/RenderCoordinator.ts +22 -22
- package/front_end/ui/components/report_view/ReportView.ts +16 -16
- package/front_end/ui/components/request_link_icon/RequestLinkIcon.ts +14 -14
- package/front_end/ui/components/settings/SettingCheckbox.ts +5 -5
- package/front_end/ui/components/survey_link/SurveyLink.ts +8 -8
- package/front_end/ui/components/text_editor/TextEditor.ts +9 -9
- package/front_end/ui/components/text_editor/cursor_tooltip.ts +7 -1
- package/front_end/ui/components/text_prompt/TextPrompt.ts +18 -18
- package/front_end/ui/components/tree_outline/TreeOutline.ts +69 -70
- package/front_end/ui/legacy/ContextFlavorListener.ts +0 -4
- package/front_end/ui/legacy/SearchableView.ts +13 -4
- package/front_end/ui/legacy/SuggestBox.ts +0 -3
- package/front_end/ui/legacy/components/data_grid/DataGrid.ts +6 -6
- package/front_end/ui/legacy/components/perf_ui/FlameChart.ts +0 -3
- package/front_end/ui/legacy/components/source_frame/JSONView.ts +1 -1
- package/front_end/ui/legacy/components/source_frame/SourceFrame.ts +13 -12
- package/front_end/ui/legacy/components/source_frame/XMLView.ts +2 -2
- package/front_end/ui/legacy/themeColors.css +2 -0
- package/front_end/ui/legacy/theme_support/theme_support_impl.ts +34 -7
- package/package.json +1 -1
- package/scripts/eslint_rules/lib/use_private_class_members.js +41 -0
- package/scripts/eslint_rules/tests/use_private_class_members_test.js +62 -0
- package/scripts/migration/class-fields/migrate.js +2 -3
- package/scripts/migration/class-fields/migrate.sh +1 -3
- package/scripts/migration/class-fields/package.json +1 -1
- package/config/gni/all_devtools_files.gni +0 -255
- package/scripts/build/devtools_file_hashes.py +0 -82
- package/scripts/devtools_run/devtools_run_cli +0 -49
- package/scripts/devtools_run/package.json +0 -13
- package/scripts/unzip.py +0 -20
- package/scripts/visualize_deps/jquery_svg.html +0 -57
- package/scripts/visualize_deps/run_visualize.js +0 -119
|
@@ -16,7 +16,7 @@ const coordinator = Coordinator.RenderCoordinator.RenderCoordinator.instance();
|
|
|
16
16
|
|
|
17
17
|
import {addColumnVisibilityCheckboxes, addSortableColumnItems} from './DataGridContextMenuUtils.js';
|
|
18
18
|
import type {CellPosition, Column, Row, SortState} from './DataGridUtils.js';
|
|
19
|
-
import {calculateColumnWidthPercentageFromWeighting, calculateFirstFocusableCell, getRowEntryForColumnId, handleArrowKeyNavigation, renderCellValue, SortDirection} from './DataGridUtils.js';
|
|
19
|
+
import {calculateColumnWidthPercentageFromWeighting, calculateFirstFocusableCell, getCellTitleFromCellContent, getRowEntryForColumnId, handleArrowKeyNavigation, renderCellValue, SortDirection} from './DataGridUtils.js';
|
|
20
20
|
|
|
21
21
|
import * as i18n from '../../../core/i18n/i18n.js';
|
|
22
22
|
const UIStrings = {
|
|
@@ -85,14 +85,14 @@ export class DataGrid extends HTMLElement {
|
|
|
85
85
|
// lookup constant.
|
|
86
86
|
readonly #rowIndexMap = new WeakMap<Row, number>();
|
|
87
87
|
readonly #resizeObserver = new ResizeObserver(() => {
|
|
88
|
-
this
|
|
88
|
+
this.#alignScrollHandlers();
|
|
89
89
|
});
|
|
90
90
|
|
|
91
91
|
// These have to be bound as they are put onto the global document, not onto
|
|
92
92
|
// this element, so LitHtml does not bind them for us.
|
|
93
|
-
#boundOnResizePointerUp = this
|
|
94
|
-
#boundOnResizePointerMove = this
|
|
95
|
-
#boundOnResizePointerDown = this
|
|
93
|
+
#boundOnResizePointerUp = this.#onResizePointerUp.bind(this);
|
|
94
|
+
#boundOnResizePointerMove = this.#onResizePointerMove.bind(this);
|
|
95
|
+
#boundOnResizePointerDown = this.#onResizePointerDown.bind(this);
|
|
96
96
|
|
|
97
97
|
/**
|
|
98
98
|
* Following guidance from
|
|
@@ -157,8 +157,8 @@ export class DataGrid extends HTMLElement {
|
|
|
157
157
|
this.#cellToFocusIfUserTabsIn = calculateFirstFocusableCell({columns: this.#columns, rows: this.#rows});
|
|
158
158
|
}
|
|
159
159
|
|
|
160
|
-
if (this.#hasRenderedAtLeastOnce && this
|
|
161
|
-
const [selectedColIndex, selectedRowIndex] = this
|
|
160
|
+
if (this.#hasRenderedAtLeastOnce && this.#userHasCellFocused()) {
|
|
161
|
+
const [selectedColIndex, selectedRowIndex] = this.#tabbableCell();
|
|
162
162
|
const columnOutOfBounds = selectedColIndex > this.#columns.length;
|
|
163
163
|
const rowOutOfBounds = selectedRowIndex > this.#rows.length;
|
|
164
164
|
|
|
@@ -173,10 +173,10 @@ export class DataGrid extends HTMLElement {
|
|
|
173
173
|
}
|
|
174
174
|
}
|
|
175
175
|
|
|
176
|
-
this
|
|
176
|
+
this.#render();
|
|
177
177
|
}
|
|
178
178
|
|
|
179
|
-
|
|
179
|
+
#shouldAutoScrollToBottom(): boolean {
|
|
180
180
|
/**
|
|
181
181
|
* If the user's last scroll took them to the bottom, then we assume they
|
|
182
182
|
* want to automatically scroll.
|
|
@@ -201,8 +201,8 @@ export class DataGrid extends HTMLElement {
|
|
|
201
201
|
return false;
|
|
202
202
|
}
|
|
203
203
|
|
|
204
|
-
|
|
205
|
-
if (this.#hasRenderedAtLeastOnce === false || !this
|
|
204
|
+
#scrollToBottomIfRequired(): void {
|
|
205
|
+
if (this.#hasRenderedAtLeastOnce === false || !this.#shouldAutoScrollToBottom()) {
|
|
206
206
|
return;
|
|
207
207
|
}
|
|
208
208
|
|
|
@@ -218,17 +218,17 @@ export class DataGrid extends HTMLElement {
|
|
|
218
218
|
});
|
|
219
219
|
}
|
|
220
220
|
|
|
221
|
-
|
|
221
|
+
#engageResizeObserver(): void {
|
|
222
222
|
if (!this.#hasRenderedAtLeastOnce) {
|
|
223
223
|
this.#resizeObserver.observe(this.#shadow.host);
|
|
224
224
|
}
|
|
225
225
|
}
|
|
226
226
|
|
|
227
|
-
|
|
227
|
+
#userHasCellFocused(): boolean {
|
|
228
228
|
return this.#cellUserHasFocused !== null;
|
|
229
229
|
}
|
|
230
230
|
|
|
231
|
-
|
|
231
|
+
#getTableElementForCellUserHasFocused(): HTMLTableCellElement|null {
|
|
232
232
|
if (!this.#cellUserHasFocused) {
|
|
233
233
|
return null;
|
|
234
234
|
}
|
|
@@ -238,13 +238,13 @@ export class DataGrid extends HTMLElement {
|
|
|
238
238
|
return cell;
|
|
239
239
|
}
|
|
240
240
|
|
|
241
|
-
|
|
241
|
+
async #focusTableCellInDOM(cell: HTMLTableCellElement): Promise<void> {
|
|
242
242
|
await coordinator.write(() => {
|
|
243
243
|
cell.focus();
|
|
244
244
|
});
|
|
245
245
|
}
|
|
246
246
|
|
|
247
|
-
|
|
247
|
+
#focusCellIfRequired([newColumnIndex, newRowIndex]: CellPosition): void {
|
|
248
248
|
this.#userHasFocusInDataGrid = true;
|
|
249
249
|
|
|
250
250
|
if (this.#cellUserHasFocused && this.#cellUserHasFocused[0] === newColumnIndex &&
|
|
@@ -254,8 +254,8 @@ export class DataGrid extends HTMLElement {
|
|
|
254
254
|
}
|
|
255
255
|
|
|
256
256
|
this.#cellUserHasFocused = [newColumnIndex, newRowIndex];
|
|
257
|
-
this
|
|
258
|
-
const tableCell = this
|
|
257
|
+
this.#render();
|
|
258
|
+
const tableCell = this.#getTableElementForCellUserHasFocused();
|
|
259
259
|
if (!tableCell) {
|
|
260
260
|
// Return in case the cell is out of bounds and we do nothing
|
|
261
261
|
return;
|
|
@@ -264,10 +264,10 @@ export class DataGrid extends HTMLElement {
|
|
|
264
264
|
* add arrow key support, so in the case where we're programatically moving the
|
|
265
265
|
* focus, ensure we actually focus the cell.
|
|
266
266
|
*/
|
|
267
|
-
this
|
|
267
|
+
this.#focusTableCellInDOM(tableCell);
|
|
268
268
|
}
|
|
269
269
|
|
|
270
|
-
|
|
270
|
+
#onTableKeyDown(event: KeyboardEvent): void {
|
|
271
271
|
const key = event.key;
|
|
272
272
|
|
|
273
273
|
if (!this.#cellUserHasFocused) {
|
|
@@ -278,7 +278,7 @@ export class DataGrid extends HTMLElement {
|
|
|
278
278
|
const [focusedColumnIndex, focusedRowIndex] = this.#cellUserHasFocused;
|
|
279
279
|
const activeColumn = this.#columns[focusedColumnIndex];
|
|
280
280
|
if (focusedRowIndex === 0 && activeColumn && activeColumn.sortable) {
|
|
281
|
-
this
|
|
281
|
+
this.#onColumnHeaderClick(activeColumn, focusedColumnIndex);
|
|
282
282
|
}
|
|
283
283
|
}
|
|
284
284
|
|
|
@@ -293,10 +293,10 @@ export class DataGrid extends HTMLElement {
|
|
|
293
293
|
rows: this.#rows,
|
|
294
294
|
});
|
|
295
295
|
event.preventDefault();
|
|
296
|
-
this
|
|
296
|
+
this.#focusCellIfRequired(nextFocusedCell);
|
|
297
297
|
}
|
|
298
298
|
|
|
299
|
-
|
|
299
|
+
#onColumnHeaderClick(col: Column, index: number): void {
|
|
300
300
|
this.dispatchEvent(new ColumnHeaderClickEvent(col, index));
|
|
301
301
|
}
|
|
302
302
|
|
|
@@ -305,7 +305,7 @@ export class DataGrid extends HTMLElement {
|
|
|
305
305
|
* Guidance on values of attribute taken from
|
|
306
306
|
* https://www.w3.org/TR/wai-aria-practices/examples/grid/dataGrids.html.
|
|
307
307
|
*/
|
|
308
|
-
|
|
308
|
+
#ariaSortForHeader(col: Column): string|undefined {
|
|
309
309
|
if (col.sortable && (!this.#sortState || this.#sortState.columnId !== col.id)) {
|
|
310
310
|
// Column is sortable but is not currently sorted
|
|
311
311
|
return 'none';
|
|
@@ -319,7 +319,7 @@ export class DataGrid extends HTMLElement {
|
|
|
319
319
|
return undefined;
|
|
320
320
|
}
|
|
321
321
|
|
|
322
|
-
|
|
322
|
+
#renderEmptyFillerRow(numberOfVisibleRows: number): LitHtml.TemplateResult {
|
|
323
323
|
const emptyCells = this.#columns.map((col, colIndex) => {
|
|
324
324
|
if (!col.visible) {
|
|
325
325
|
return LitHtml.nothing;
|
|
@@ -337,17 +337,17 @@ export class DataGrid extends HTMLElement {
|
|
|
337
337
|
return LitHtml.html`<tr tabindex="-1" class=${emptyRowClasses}>${emptyCells}</tr>`;
|
|
338
338
|
}
|
|
339
339
|
|
|
340
|
-
|
|
340
|
+
#cleanUpAfterResizeColumnComplete(): void {
|
|
341
341
|
if (!this.#currentResize) {
|
|
342
342
|
return;
|
|
343
343
|
}
|
|
344
344
|
this.#currentResize.documentForCursorChange.body.style.cursor = this.#currentResize.cursorToRestore;
|
|
345
345
|
this.#currentResize = null;
|
|
346
346
|
// Realign the scroll handlers now the table columns have been resized.
|
|
347
|
-
this
|
|
347
|
+
this.#alignScrollHandlers();
|
|
348
348
|
}
|
|
349
349
|
|
|
350
|
-
|
|
350
|
+
#onResizePointerDown(event: PointerEvent): void {
|
|
351
351
|
if (event.buttons !== 1 || (Host.Platform.isMac() && event.ctrlKey)) {
|
|
352
352
|
// Ensure we only react to a left click drag mouse down event.
|
|
353
353
|
// On Mac we ignore Ctrl-click which can be used to bring up context menus, etc.
|
|
@@ -406,7 +406,7 @@ export class DataGrid extends HTMLElement {
|
|
|
406
406
|
resizerElement.addEventListener('pointermove', this.#boundOnResizePointerMove);
|
|
407
407
|
}
|
|
408
408
|
|
|
409
|
-
|
|
409
|
+
#onResizePointerMove(event: PointerEvent): void {
|
|
410
410
|
event.preventDefault();
|
|
411
411
|
if (!this.#currentResize) {
|
|
412
412
|
return;
|
|
@@ -460,7 +460,7 @@ export class DataGrid extends HTMLElement {
|
|
|
460
460
|
this.#currentResize.rightCellCol.style.width = newRightColumnPercentage.toFixed(2) + '%';
|
|
461
461
|
}
|
|
462
462
|
|
|
463
|
-
|
|
463
|
+
#onResizePointerUp(event: PointerEvent): void {
|
|
464
464
|
event.preventDefault();
|
|
465
465
|
const resizer = event.target as HTMLElement;
|
|
466
466
|
if (!resizer) {
|
|
@@ -468,10 +468,10 @@ export class DataGrid extends HTMLElement {
|
|
|
468
468
|
}
|
|
469
469
|
resizer.releasePointerCapture(event.pointerId);
|
|
470
470
|
resizer.removeEventListener('pointermove', this.#boundOnResizePointerMove);
|
|
471
|
-
this
|
|
471
|
+
this.#cleanUpAfterResizeColumnComplete();
|
|
472
472
|
}
|
|
473
473
|
|
|
474
|
-
|
|
474
|
+
#renderResizeForCell(column: Column, position: CellPosition): LitHtml.TemplateResult|typeof LitHtml.nothing {
|
|
475
475
|
/**
|
|
476
476
|
* A resizer for a column is placed at the far right of the _previous column
|
|
477
477
|
* cell_. So when we get called with [1, 0] that means this dragger is
|
|
@@ -480,7 +480,7 @@ export class DataGrid extends HTMLElement {
|
|
|
480
480
|
* only resizing it but also the column to its left.
|
|
481
481
|
*/
|
|
482
482
|
const [columnIndex] = position;
|
|
483
|
-
const lastVisibleColumnIndex = this
|
|
483
|
+
const lastVisibleColumnIndex = this.#getIndexOfLastVisibleColumn();
|
|
484
484
|
// If we are in the very last column, there is no column to the right to resize, so don't render a resizer.
|
|
485
485
|
if (columnIndex === lastVisibleColumnIndex || !column.visible) {
|
|
486
486
|
return LitHtml.nothing;
|
|
@@ -493,7 +493,7 @@ export class DataGrid extends HTMLElement {
|
|
|
493
493
|
></span>`;
|
|
494
494
|
}
|
|
495
495
|
|
|
496
|
-
|
|
496
|
+
#getIndexOfLastVisibleColumn(): number {
|
|
497
497
|
let index = this.#columns.length - 1;
|
|
498
498
|
for (; index > -1; index--) {
|
|
499
499
|
const col = this.#columns[index];
|
|
@@ -508,7 +508,7 @@ export class DataGrid extends HTMLElement {
|
|
|
508
508
|
* This function is called when the user right clicks on the header row of the
|
|
509
509
|
* data grid.
|
|
510
510
|
*/
|
|
511
|
-
|
|
511
|
+
#onHeaderContextMenu(event: MouseEvent): void {
|
|
512
512
|
if (event.button !== 2) {
|
|
513
513
|
// 2 = secondary button = right click. We only show context menus if the
|
|
514
514
|
// user has right clicked.
|
|
@@ -531,7 +531,7 @@ export class DataGrid extends HTMLElement {
|
|
|
531
531
|
menu.show();
|
|
532
532
|
}
|
|
533
533
|
|
|
534
|
-
|
|
534
|
+
#onBodyRowContextMenu(event: MouseEvent): void {
|
|
535
535
|
if (event.button !== 2) {
|
|
536
536
|
// 2 = secondary button = right click. We only show context menus if the
|
|
537
537
|
// user has right clicked.
|
|
@@ -569,7 +569,7 @@ export class DataGrid extends HTMLElement {
|
|
|
569
569
|
menu.show();
|
|
570
570
|
}
|
|
571
571
|
|
|
572
|
-
|
|
572
|
+
#onScroll(event: Event): void {
|
|
573
573
|
const wrapper = event.target as HTMLElement;
|
|
574
574
|
if (!wrapper) {
|
|
575
575
|
return;
|
|
@@ -581,10 +581,10 @@ export class DataGrid extends HTMLElement {
|
|
|
581
581
|
this.#userScrollState =
|
|
582
582
|
userIsAtBottom ? UserScrollState.SCROLLED_TO_BOTTOM : UserScrollState.MANUAL_SCROLL_NOT_BOTTOM;
|
|
583
583
|
|
|
584
|
-
this
|
|
584
|
+
this.#render();
|
|
585
585
|
}
|
|
586
586
|
|
|
587
|
-
|
|
587
|
+
#alignScrollHandlers(): Promise<void> {
|
|
588
588
|
return coordinator.read(() => {
|
|
589
589
|
const columnHeaders = this.#shadow.querySelectorAll<HTMLElement>('th:not(.hidden)');
|
|
590
590
|
const handlers = this.#shadow.querySelectorAll<HTMLElement>('.cell-resize-handle');
|
|
@@ -614,7 +614,7 @@ export class DataGrid extends HTMLElement {
|
|
|
614
614
|
* Calculates the index of the first row we want to render, and the last row we want to render.
|
|
615
615
|
* Pads in each direction by PADDING_ROWS_COUNT so we render some rows that are off scren.
|
|
616
616
|
*/
|
|
617
|
-
|
|
617
|
+
#calculateTopAndBottomRowIndexes(): Promise<{topVisibleRow: number, bottomVisibleRow: number}> {
|
|
618
618
|
return coordinator.read(() => {
|
|
619
619
|
const wrapper = this.#shadow.querySelector('.wrapping-container');
|
|
620
620
|
|
|
@@ -642,7 +642,7 @@ export class DataGrid extends HTMLElement {
|
|
|
642
642
|
});
|
|
643
643
|
}
|
|
644
644
|
|
|
645
|
-
|
|
645
|
+
#onFocusOut(): void {
|
|
646
646
|
/**
|
|
647
647
|
* When any element in the data-grid loses focus, we set this to false. If
|
|
648
648
|
* the user then focuses another cell, that code will set the focus to true.
|
|
@@ -655,7 +655,7 @@ export class DataGrid extends HTMLElement {
|
|
|
655
655
|
this.#userHasFocusInDataGrid = false;
|
|
656
656
|
}
|
|
657
657
|
|
|
658
|
-
|
|
658
|
+
#tabbableCell(): CellPosition {
|
|
659
659
|
/**
|
|
660
660
|
* If the user has selected a cell, this is the cell that should be
|
|
661
661
|
* "tabbable" if the user tabs out and into the data-grid. If the user
|
|
@@ -672,7 +672,7 @@ export class DataGrid extends HTMLElement {
|
|
|
672
672
|
* render only the rows required to fill that table (plus a bit extra for
|
|
673
673
|
* padding).
|
|
674
674
|
*/
|
|
675
|
-
|
|
675
|
+
async #render(): Promise<void> {
|
|
676
676
|
if (this.#isRendering) {
|
|
677
677
|
// If we receive a request to render during a previous render call, we block
|
|
678
678
|
// the newly requested render (since we could receive a lot of them in quick
|
|
@@ -683,7 +683,7 @@ export class DataGrid extends HTMLElement {
|
|
|
683
683
|
}
|
|
684
684
|
this.#isRendering = true;
|
|
685
685
|
|
|
686
|
-
const {topVisibleRow, bottomVisibleRow} = await this
|
|
686
|
+
const {topVisibleRow, bottomVisibleRow} = await this.#calculateTopAndBottomRowIndexes();
|
|
687
687
|
const nonHiddenRows = this.#rows.filter(row => !row.hidden);
|
|
688
688
|
const renderableRows = nonHiddenRows.filter((_, idx) => idx >= topVisibleRow && idx <= bottomVisibleRow);
|
|
689
689
|
const indexOfFirstVisibleColumn = this.#columns.findIndex(col => col.visible);
|
|
@@ -700,13 +700,13 @@ export class DataGrid extends HTMLElement {
|
|
|
700
700
|
* have 100% height so they sit over the entire table and can be grabbed
|
|
701
701
|
* by the user.
|
|
702
702
|
*/
|
|
703
|
-
return this
|
|
703
|
+
return this.#renderResizeForCell(col, [columnIndex, 0]);
|
|
704
704
|
})}
|
|
705
|
-
<div class="wrapping-container" @scroll=${this
|
|
705
|
+
<div class="wrapping-container" @scroll=${this.#onScroll} @focusout=${this.#onFocusOut}>
|
|
706
706
|
<table
|
|
707
707
|
aria-rowcount=${this.#rows.length}
|
|
708
708
|
aria-colcount=${this.#columns.length}
|
|
709
|
-
@keydown=${this
|
|
709
|
+
@keydown=${this.#onTableKeyDown}
|
|
710
710
|
>
|
|
711
711
|
<colgroup>
|
|
712
712
|
${this.#columns.map((col, colIndex) => {
|
|
@@ -719,20 +719,20 @@ export class DataGrid extends HTMLElement {
|
|
|
719
719
|
})}
|
|
720
720
|
</colgroup>
|
|
721
721
|
<thead>
|
|
722
|
-
<tr @contextmenu=${this
|
|
722
|
+
<tr @contextmenu=${this.#onHeaderContextMenu}>
|
|
723
723
|
${this.#columns.map((col, columnIndex) => {
|
|
724
724
|
const thClasses = LitHtml.Directives.classMap({
|
|
725
725
|
hidden: !col.visible,
|
|
726
726
|
firstVisibleColumn: columnIndex === indexOfFirstVisibleColumn,
|
|
727
727
|
});
|
|
728
|
-
const tabbableCell = this
|
|
728
|
+
const tabbableCell = this.#tabbableCell();
|
|
729
729
|
const cellIsFocusableCell = anyColumnsSortable && columnIndex === tabbableCell[0] && tabbableCell[1] === 0;
|
|
730
730
|
|
|
731
731
|
return LitHtml.html`<th class=${thClasses}
|
|
732
732
|
style=${LitHtml.Directives.ifDefined(col.styles ? LitHtml.Directives.styleMap(col.styles) : undefined)}
|
|
733
733
|
data-grid-header-cell=${col.id}
|
|
734
734
|
@focus=${(): void => {
|
|
735
|
-
this
|
|
735
|
+
this.#focusCellIfRequired([columnIndex, 0]);
|
|
736
736
|
}}
|
|
737
737
|
@click=${(): void => {
|
|
738
738
|
/**
|
|
@@ -742,10 +742,10 @@ export class DataGrid extends HTMLElement {
|
|
|
742
742
|
* doesn't emit a focus event as the cell is already
|
|
743
743
|
* focused.
|
|
744
744
|
*/
|
|
745
|
-
this
|
|
745
|
+
this.#onColumnHeaderClick(col, columnIndex);
|
|
746
746
|
}}
|
|
747
747
|
title=${col.title}
|
|
748
|
-
aria-sort=${LitHtml.Directives.ifDefined(this
|
|
748
|
+
aria-sort=${LitHtml.Directives.ifDefined(this.#ariaSortForHeader(col))}
|
|
749
749
|
aria-colindex=${columnIndex + 1}
|
|
750
750
|
data-row-index='0'
|
|
751
751
|
data-col-index=${columnIndex}
|
|
@@ -763,7 +763,7 @@ export class DataGrid extends HTMLElement {
|
|
|
763
763
|
if (rowIndex === undefined) {
|
|
764
764
|
throw new Error('Trying to render a row that has no index in the rowIndexMap');
|
|
765
765
|
}
|
|
766
|
-
const tabbableCell = this
|
|
766
|
+
const tabbableCell = this.#tabbableCell();
|
|
767
767
|
// Remember that row 0 is considered the header row, so the first tbody row is row 1.
|
|
768
768
|
const tableRowIndex = rowIndex + 1;
|
|
769
769
|
|
|
@@ -780,7 +780,7 @@ export class DataGrid extends HTMLElement {
|
|
|
780
780
|
aria-rowindex=${rowIndex + 1}
|
|
781
781
|
class=${rowClasses}
|
|
782
782
|
style=${LitHtml.Directives.ifDefined(row.styles ? LitHtml.Directives.styleMap(row.styles) : undefined)}
|
|
783
|
-
@contextmenu=${this
|
|
783
|
+
@contextmenu=${this.#onBodyRowContextMenu}
|
|
784
784
|
>${this.#columns.map((col, columnIndex) => {
|
|
785
785
|
const cell = getRowEntryForColumnId(row, col.id);
|
|
786
786
|
const cellClasses = LitHtml.Directives.classMap({
|
|
@@ -794,19 +794,19 @@ export class DataGrid extends HTMLElement {
|
|
|
794
794
|
style=${LitHtml.Directives.ifDefined(col.styles ? LitHtml.Directives.styleMap(col.styles) : undefined)}
|
|
795
795
|
tabindex=${cellIsFocusableCell ? '0' : '-1'}
|
|
796
796
|
aria-colindex=${columnIndex + 1}
|
|
797
|
-
title=${cell.title || String(cell.value)
|
|
797
|
+
title=${cell.title || getCellTitleFromCellContent(String(cell.value))}
|
|
798
798
|
data-row-index=${tableRowIndex}
|
|
799
799
|
data-col-index=${columnIndex}
|
|
800
800
|
data-grid-value-cell-for-column=${col.id}
|
|
801
801
|
@focus=${(): void => {
|
|
802
|
-
this
|
|
802
|
+
this.#focusCellIfRequired([columnIndex, tableRowIndex]);
|
|
803
803
|
this.dispatchEvent(new BodyCellFocusedEvent(cell, row));
|
|
804
804
|
}}
|
|
805
805
|
>${cellOutput}</td>`;
|
|
806
806
|
})}
|
|
807
807
|
`;
|
|
808
808
|
})}
|
|
809
|
-
${this
|
|
809
|
+
${this.#renderEmptyFillerRow(renderableRows.length)}
|
|
810
810
|
<tr class="filler-row-bottom padding-row" style=${LitHtml.Directives.styleMap({
|
|
811
811
|
height: `${Math.max(0, nonHiddenRows.length - bottomVisibleRow) * ROW_HEIGHT_PIXELS}px`,
|
|
812
812
|
})}></tr>
|
|
@@ -824,21 +824,21 @@ export class DataGrid extends HTMLElement {
|
|
|
824
824
|
// back in, that it becomes rendered.
|
|
825
825
|
// However, if the cell is a column header, we don't do this, as that
|
|
826
826
|
// can never be not-rendered.
|
|
827
|
-
const tabbableCell = this
|
|
827
|
+
const tabbableCell = this.#tabbableCell();
|
|
828
828
|
const currentlyFocusedRowIndex = tabbableCell[1];
|
|
829
|
-
const tabbableCellElement = this
|
|
829
|
+
const tabbableCellElement = this.#getTableElementForCellUserHasFocused();
|
|
830
830
|
if (this.#userHasFocusInDataGrid && currentlyFocusedRowIndex > 0 && tabbableCellElement) {
|
|
831
|
-
this
|
|
831
|
+
this.#focusTableCellInDOM(tabbableCellElement);
|
|
832
832
|
}
|
|
833
|
-
this
|
|
834
|
-
this
|
|
833
|
+
this.#scrollToBottomIfRequired();
|
|
834
|
+
this.#engageResizeObserver();
|
|
835
835
|
if (this.#hasRenderedAtLeastOnce) {
|
|
836
836
|
// We may have had a cell's width change on a re-render, or it may have
|
|
837
837
|
// been hidden entirely, so we need to ensure that the resize handlers are
|
|
838
838
|
// re-positioned correctly if so.
|
|
839
839
|
|
|
840
840
|
// We don't have to do this on first render as it will fire when the resize observer is engaged.
|
|
841
|
-
this
|
|
841
|
+
this.#alignScrollHandlers();
|
|
842
842
|
}
|
|
843
843
|
|
|
844
844
|
this.#isRendering = false;
|
|
@@ -848,7 +848,7 @@ export class DataGrid extends HTMLElement {
|
|
|
848
848
|
// the end with the most recent data.
|
|
849
849
|
if (this.#scheduleRender) {
|
|
850
850
|
this.#scheduleRender = false;
|
|
851
|
-
this
|
|
851
|
+
this.#render();
|
|
852
852
|
}
|
|
853
853
|
}
|
|
854
854
|
}
|
|
@@ -67,20 +67,20 @@ export class DataGridController extends HTMLElement {
|
|
|
67
67
|
this.#contextMenus = data.contextMenus;
|
|
68
68
|
|
|
69
69
|
this.#columns = [...this.#originalColumns];
|
|
70
|
-
this.#rows = this
|
|
70
|
+
this.#rows = this.#cloneAndFilterRows(data.rows, this.#filters);
|
|
71
71
|
|
|
72
72
|
if (!this.#hasRenderedAtLeastOnce && data.initialSort) {
|
|
73
73
|
this.#sortState = data.initialSort;
|
|
74
74
|
}
|
|
75
75
|
|
|
76
76
|
if (this.#sortState) {
|
|
77
|
-
this
|
|
77
|
+
this.#sortRows(this.#sortState);
|
|
78
78
|
}
|
|
79
79
|
|
|
80
|
-
this
|
|
80
|
+
this.#render();
|
|
81
81
|
}
|
|
82
82
|
|
|
83
|
-
|
|
83
|
+
#testRowWithFilter(row: Row, filter: TextUtils.TextUtils.ParsedFilter): boolean {
|
|
84
84
|
let rowMatchesFilter = false;
|
|
85
85
|
|
|
86
86
|
const {key, text, negative, regex} = filter;
|
|
@@ -107,7 +107,7 @@ export class DataGridController extends HTMLElement {
|
|
|
107
107
|
return negative ? !rowMatchesFilter : rowMatchesFilter;
|
|
108
108
|
}
|
|
109
109
|
|
|
110
|
-
|
|
110
|
+
#cloneAndFilterRows(rows: Row[], filters: readonly TextUtils.TextUtils.ParsedFilter[]): Row[] {
|
|
111
111
|
if (filters.length === 0) {
|
|
112
112
|
return [...rows];
|
|
113
113
|
}
|
|
@@ -116,7 +116,7 @@ export class DataGridController extends HTMLElement {
|
|
|
116
116
|
// We assume that the row should be visible by default.
|
|
117
117
|
let rowShouldBeVisible = true;
|
|
118
118
|
for (const filter of filters) {
|
|
119
|
-
const rowMatchesFilter = this
|
|
119
|
+
const rowMatchesFilter = this.#testRowWithFilter(row, filter);
|
|
120
120
|
// If there are multiple filters, if any return false we hide the row.
|
|
121
121
|
// So if we get a false from testRowWithFilter, we can break early and return false.
|
|
122
122
|
if (!rowMatchesFilter) {
|
|
@@ -131,7 +131,7 @@ export class DataGridController extends HTMLElement {
|
|
|
131
131
|
});
|
|
132
132
|
}
|
|
133
133
|
|
|
134
|
-
|
|
134
|
+
#sortRows(state: SortState): void {
|
|
135
135
|
const {columnId, direction} = state;
|
|
136
136
|
|
|
137
137
|
this.#rows.sort((row1, row2) => {
|
|
@@ -148,15 +148,15 @@ export class DataGridController extends HTMLElement {
|
|
|
148
148
|
}
|
|
149
149
|
return 0;
|
|
150
150
|
});
|
|
151
|
-
this
|
|
151
|
+
this.#render();
|
|
152
152
|
}
|
|
153
153
|
|
|
154
|
-
|
|
154
|
+
#onColumnHeaderClick(event: ColumnHeaderClickEvent): void {
|
|
155
155
|
const {column} = event.data;
|
|
156
|
-
this
|
|
156
|
+
this.#applySortOnColumn(column);
|
|
157
157
|
}
|
|
158
158
|
|
|
159
|
-
|
|
159
|
+
#applySortOnColumn(column: Column): void {
|
|
160
160
|
if (this.#sortState && this.#sortState.columnId === column.id) {
|
|
161
161
|
const {columnId, direction} = this.#sortState;
|
|
162
162
|
|
|
@@ -181,25 +181,25 @@ export class DataGridController extends HTMLElement {
|
|
|
181
181
|
}
|
|
182
182
|
|
|
183
183
|
if (this.#sortState) {
|
|
184
|
-
this
|
|
184
|
+
this.#sortRows(this.#sortState);
|
|
185
185
|
} else {
|
|
186
186
|
// No sortstate = render the original rows.
|
|
187
|
-
this.#rows = this
|
|
188
|
-
this
|
|
187
|
+
this.#rows = this.#cloneAndFilterRows(this.#originalRows, this.#filters);
|
|
188
|
+
this.#render();
|
|
189
189
|
}
|
|
190
190
|
}
|
|
191
191
|
|
|
192
|
-
|
|
193
|
-
this
|
|
192
|
+
#onContextMenuColumnSortClick(event: ContextMenuColumnSortClickEvent): void {
|
|
193
|
+
this.#applySortOnColumn(event.data.column);
|
|
194
194
|
}
|
|
195
195
|
|
|
196
|
-
|
|
196
|
+
#onContextMenuHeaderResetClick(): void {
|
|
197
197
|
this.#sortState = null;
|
|
198
198
|
this.#rows = [...this.#originalRows];
|
|
199
|
-
this
|
|
199
|
+
this.#render();
|
|
200
200
|
}
|
|
201
201
|
|
|
202
|
-
|
|
202
|
+
#render(): void {
|
|
203
203
|
// Disabled until https://crbug.com/1079231 is fixed.
|
|
204
204
|
// clang-format off
|
|
205
205
|
LitHtml.render(LitHtml.html`
|
|
@@ -209,9 +209,9 @@ export class DataGridController extends HTMLElement {
|
|
|
209
209
|
activeSort: this.#sortState,
|
|
210
210
|
contextMenus: this.#contextMenus,
|
|
211
211
|
} as DataGridData}
|
|
212
|
-
@columnheaderclick=${this
|
|
213
|
-
@contextmenucolumnsortclick=${this
|
|
214
|
-
@contextmenuheaderresetclick=${this
|
|
212
|
+
@columnheaderclick=${this.#onColumnHeaderClick}
|
|
213
|
+
@contextmenucolumnsortclick=${this.#onContextMenuColumnSortClick}
|
|
214
|
+
@contextmenuheaderresetclick=${this.#onContextMenuHeaderResetClick}
|
|
215
215
|
></${DataGrid.litTagName}>
|
|
216
216
|
`, this.#shadow, {
|
|
217
217
|
host: this,
|
|
@@ -189,14 +189,14 @@ class DiffRenderer {
|
|
|
189
189
|
) {
|
|
190
190
|
}
|
|
191
191
|
|
|
192
|
-
|
|
192
|
+
#render(rows: readonly Row[]): LitHtml.TemplateResult {
|
|
193
193
|
return LitHtml.html`
|
|
194
194
|
<div class="diff-listing" aria-label=${i18nString(UIStrings.changesDiffViewer)}>
|
|
195
|
-
${rows.map(row => this
|
|
195
|
+
${rows.map(row => this.#renderRow(row))}
|
|
196
196
|
</div>`;
|
|
197
197
|
}
|
|
198
198
|
|
|
199
|
-
|
|
199
|
+
#renderRow(row: Row): LitHtml.TemplateResult {
|
|
200
200
|
const baseNumber =
|
|
201
201
|
row.type === RowType.Equal || row.type === RowType.Deletion ? String(row.originalLineNumber) : '';
|
|
202
202
|
const curNumber = row.type === RowType.Equal || row.type === RowType.Addition ? String(row.currentLineNumber) : '';
|
|
@@ -215,10 +215,10 @@ class DiffRenderer {
|
|
|
215
215
|
<div class="diff-line-number" aria-hidden="true">${curNumber}</div>
|
|
216
216
|
<div class=${markerClass} aria-hidden="true">${marker}</div>
|
|
217
217
|
<div class="diff-line-content diff-line-${row.type}" data-line-number=${curNumber}>${screenReaderText}${
|
|
218
|
-
this
|
|
218
|
+
this.#renderRowContent(row)}</div>`;
|
|
219
219
|
}
|
|
220
220
|
|
|
221
|
-
|
|
221
|
+
#renderRowContent(row: Row): LitHtml.TemplateResult[] {
|
|
222
222
|
if (row.type === RowType.Spacer) {
|
|
223
223
|
return row.tokens.map(tok => LitHtml.html`${tok.text}`);
|
|
224
224
|
}
|
|
@@ -249,7 +249,7 @@ class DiffRenderer {
|
|
|
249
249
|
await CodeHighlighter.CodeHighlighter.create(currentLines.join('\n'), mimeType),
|
|
250
250
|
documentMap(currentLines),
|
|
251
251
|
);
|
|
252
|
-
LitHtml.render(renderer
|
|
252
|
+
LitHtml.render(renderer.#render(rows), parent, {host: this});
|
|
253
253
|
}
|
|
254
254
|
}
|
|
255
255
|
|
|
@@ -19,19 +19,19 @@ export class ExpandableList extends HTMLElement {
|
|
|
19
19
|
|
|
20
20
|
set data(data: ExpandableListData) {
|
|
21
21
|
this.#rows = data.rows;
|
|
22
|
-
this
|
|
22
|
+
this.#render();
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
#onArrowClick(): void {
|
|
26
26
|
this.#expanded = !this.#expanded;
|
|
27
|
-
this
|
|
27
|
+
this.#render();
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
connectedCallback(): void {
|
|
31
31
|
this.#shadow.adoptedStyleSheets = [expandableListStyles];
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
|
|
34
|
+
#render(): void {
|
|
35
35
|
if (this.#rows.length < 1) {
|
|
36
36
|
return;
|
|
37
37
|
}
|
|
@@ -44,7 +44,7 @@ export class ExpandableList extends HTMLElement {
|
|
|
44
44
|
<div>
|
|
45
45
|
${this.#rows.length > 1 ?
|
|
46
46
|
LitHtml.html`
|
|
47
|
-
<button @click=${(): void => this
|
|
47
|
+
<button @click=${(): void => this.#onArrowClick()} class="arrow-icon-button">
|
|
48
48
|
<span class="arrow-icon ${this.#expanded ? 'expanded' : ''}"></span>
|
|
49
49
|
</button>
|
|
50
50
|
`
|
|
@@ -52,7 +52,7 @@ export class Icon extends HTMLElement {
|
|
|
52
52
|
this.#iconPath = new URL(`../../../Images/${data.iconName}.svg`, import.meta.url).toString();
|
|
53
53
|
this.#iconName = data.iconName;
|
|
54
54
|
}
|
|
55
|
-
this
|
|
55
|
+
this.#render();
|
|
56
56
|
}
|
|
57
57
|
|
|
58
58
|
get data(): IconData {
|
|
@@ -73,7 +73,7 @@ export class Icon extends HTMLElement {
|
|
|
73
73
|
};
|
|
74
74
|
}
|
|
75
75
|
|
|
76
|
-
|
|
76
|
+
#getStyles(): {[key: string]: string} {
|
|
77
77
|
const iconPath = this.#iconPath;
|
|
78
78
|
const width = this.#width;
|
|
79
79
|
const height = this.#height;
|
|
@@ -104,11 +104,11 @@ export class Icon extends HTMLElement {
|
|
|
104
104
|
};
|
|
105
105
|
}
|
|
106
106
|
|
|
107
|
-
|
|
107
|
+
#render(): void {
|
|
108
108
|
coordinator.write(() => {
|
|
109
109
|
// clang-format off
|
|
110
110
|
LitHtml.render(LitHtml.html`
|
|
111
|
-
<div class="icon-basic" style=${LitHtml.Directives.styleMap(this
|
|
111
|
+
<div class="icon-basic" style=${LitHtml.Directives.styleMap(this.#getStyles())}></div>
|
|
112
112
|
`, this.#shadow, {host: this});
|
|
113
113
|
// clang-format on
|
|
114
114
|
});
|