terrier-engine 4.52.0 → 4.52.3
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.
|
@@ -82,6 +82,7 @@ export default class DiveEditor extends ContentPart<DiveEditorState> {
|
|
|
82
82
|
this.queries = new Map()
|
|
83
83
|
for (const query of this.state.dive.query_data?.queries || []) {
|
|
84
84
|
this.queries.set(query.id, query)
|
|
85
|
+
this.queryOrder.push(query.id)
|
|
85
86
|
this.addQueryTab(query)
|
|
86
87
|
}
|
|
87
88
|
|
|
@@ -92,7 +93,7 @@ export default class DiveEditor extends ContentPart<DiveEditorState> {
|
|
|
92
93
|
})
|
|
93
94
|
|
|
94
95
|
// Reorder queries in the list when the tab sort order is updated.
|
|
95
|
-
this.listenMessage(this.queryTabs.
|
|
96
|
+
this.listenMessage(this.queryTabs.tabsModifiedKey, m => {
|
|
96
97
|
const { newOrder } = m.data
|
|
97
98
|
this.queryOrder = newOrder
|
|
98
99
|
})
|
package/package.json
CHANGED
package/terrier/tabs.ts
CHANGED
|
@@ -41,10 +41,10 @@ export class TabContainerPart extends TerrierPart<TabContainerState> {
|
|
|
41
41
|
private tabs = {} as Record<string, TabDefinition>
|
|
42
42
|
changeTabKey = Messages.typedKey<{ tabKey: string }>()
|
|
43
43
|
changeSideKey = Messages.typedKey<{ side: TabSide }>()
|
|
44
|
-
|
|
44
|
+
tabsModifiedKey = Messages.typedKey<{ newOrder: string[] }>()
|
|
45
45
|
|
|
46
46
|
async init() {
|
|
47
|
-
Object.assign(
|
|
47
|
+
this.state = Object.assign({ reorderable: false }, this.state)
|
|
48
48
|
|
|
49
49
|
this.onClick(this.changeTabKey, m => {
|
|
50
50
|
log.info(`Clicked on tab ${m.data.tabKey}`)
|
|
@@ -62,17 +62,17 @@ export class TabContainerPart extends TerrierPart<TabContainerState> {
|
|
|
62
62
|
zoneClass: 'tt-tab-list',
|
|
63
63
|
targetClass: 'tab',
|
|
64
64
|
onSorted: (_, evt) => {
|
|
65
|
-
this.
|
|
65
|
+
this.onTabsModified(evt.toChildren)
|
|
66
66
|
}
|
|
67
67
|
})
|
|
68
68
|
}
|
|
69
69
|
}
|
|
70
70
|
|
|
71
|
-
|
|
71
|
+
onTabsModified(tabElementsMaybe?: HTMLElement[]) {
|
|
72
72
|
const tabElements = tabElementsMaybe ??
|
|
73
73
|
Array.from(this.element?.querySelectorAll('.tt-tab-list') ?? [])
|
|
74
74
|
const newOrder = tabElements.map(tabElement => tabElement.dataset.key)
|
|
75
|
-
this.emitMessage(this.
|
|
75
|
+
this.emitMessage(this.tabsModifiedKey, { newOrder })
|
|
76
76
|
}
|
|
77
77
|
|
|
78
78
|
/**
|
|
@@ -90,7 +90,7 @@ export class TabContainerPart extends TerrierPart<TabContainerState> {
|
|
|
90
90
|
this.tabs[tab.key] = Object.assign(existingTab, {
|
|
91
91
|
state: 'enabled',
|
|
92
92
|
}, tab)
|
|
93
|
-
this.
|
|
93
|
+
this.onTabsModified()
|
|
94
94
|
const part = this.makePart(constructor, state)
|
|
95
95
|
existingTab.part = part
|
|
96
96
|
this.dirty()
|
|
@@ -118,8 +118,8 @@ export class TabContainerPart extends TerrierPart<TabContainerState> {
|
|
|
118
118
|
|
|
119
119
|
log.info(`Removing tab ${key}`, tab)
|
|
120
120
|
delete this.tabs[key]
|
|
121
|
-
this.renumberTabs()
|
|
122
121
|
this.removeChild(tab.part)
|
|
122
|
+
this.onTabsModified()
|
|
123
123
|
this.state.currentTab = undefined
|
|
124
124
|
this.dirty()
|
|
125
125
|
}
|