terrier-engine 4.0.16 → 4.0.17
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/package.json +1 -1
- package/parts.ts +35 -33
package/package.json
CHANGED
package/parts.ts
CHANGED
|
@@ -5,7 +5,7 @@ import Fragments from "./fragments"
|
|
|
5
5
|
import {Dropdown} from "./dropdowns"
|
|
6
6
|
import {TerrierApp} from "./app"
|
|
7
7
|
import Loading from "./loading"
|
|
8
|
-
import Theme, {Action, ThemeType} from "./theme"
|
|
8
|
+
import Theme, {Action, RenderActionOptions, ThemeType} from "./theme"
|
|
9
9
|
import Toasts, {ToastOptions} from "./toasts";
|
|
10
10
|
|
|
11
11
|
const log = new Logger('Parts')
|
|
@@ -335,50 +335,52 @@ export abstract class PagePart<T, TT extends ThemeType> extends ContentPart<T, T
|
|
|
335
335
|
render(parent: PartTag) {
|
|
336
336
|
parent.div(`.tt-page-part.content-width-${this.mainContentWidth}`, page => {
|
|
337
337
|
page.div('.tt-flex.top-row', topRow => {
|
|
338
|
-
|
|
339
|
-
if (this._breadcrumbs.length || this._title?.length) {
|
|
340
|
-
topRow.h1('.breadcrumbs', h1 => {
|
|
341
|
-
const crumbs = Array.from(this._breadcrumbs)
|
|
342
|
-
|
|
343
|
-
// add a breadcrumb for the page title
|
|
344
|
-
const titleCrumb: Action<TT> = {
|
|
345
|
-
title: this._title,
|
|
346
|
-
icon: this._icon || undefined,
|
|
347
|
-
}
|
|
348
|
-
if (this._titleHref) {
|
|
349
|
-
titleCrumb.href = this._titleHref
|
|
350
|
-
}
|
|
351
|
-
if (this._breadcrumbClasses?.length) {
|
|
352
|
-
titleCrumb.classes = this._breadcrumbClasses
|
|
353
|
-
}
|
|
354
|
-
crumbs.push(titleCrumb)
|
|
355
|
-
|
|
356
|
-
this.app.theme.renderActions(h1, crumbs)
|
|
357
|
-
})
|
|
358
|
-
}
|
|
338
|
+
this.renderBreadcrumbs(topRow);
|
|
359
339
|
|
|
360
|
-
// tertiary actions
|
|
361
340
|
if (this.actions.tertiary.length) {
|
|
362
|
-
|
|
363
|
-
this.app.theme.renderActions(actions, this.getActions('tertiary'))
|
|
364
|
-
})
|
|
341
|
+
this.renderActions(topRow, 'tertiary');
|
|
365
342
|
}
|
|
366
|
-
})
|
|
343
|
+
})
|
|
367
344
|
|
|
368
345
|
page.div('.lighting')
|
|
369
346
|
page.div('.page-main', main => {
|
|
370
347
|
this.renderContent(main)
|
|
371
348
|
main.div('.page-actions', actions => {
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
})
|
|
375
|
-
actions.div('.primary-actions', container => {
|
|
376
|
-
this.app.theme.renderActions(container, this.getActions('primary'), {iconColor: 'white', defaultClass: 'primary'})
|
|
377
|
-
})
|
|
349
|
+
this.renderActions(actions, 'secondary', {iconColor: null, defaultClass: 'secondary'})
|
|
350
|
+
this.renderActions(actions, 'primary', {iconColor: null, defaultClass: 'primary'})
|
|
378
351
|
})
|
|
379
352
|
})
|
|
380
353
|
})
|
|
381
354
|
}
|
|
355
|
+
|
|
356
|
+
protected renderActions(parent: PartTag, level: ActionLevel, options?: RenderActionOptions<TT>) {
|
|
357
|
+
parent.div(`.${level}-actions`, actions => {
|
|
358
|
+
this.app.theme.renderActions(actions, this.getActions(level), options)
|
|
359
|
+
})
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
protected renderBreadcrumbs(parent: PartTag) {
|
|
363
|
+
if (!this._breadcrumbs.length && !this._title?.length) return
|
|
364
|
+
|
|
365
|
+
parent.h1('.breadcrumbs', h1 => {
|
|
366
|
+
const crumbs = Array.from(this._breadcrumbs)
|
|
367
|
+
|
|
368
|
+
// add a breadcrumb for the page title
|
|
369
|
+
const titleCrumb: Action<TT> = {
|
|
370
|
+
title: this._title,
|
|
371
|
+
icon: this._icon || undefined,
|
|
372
|
+
}
|
|
373
|
+
if (this._titleHref) {
|
|
374
|
+
titleCrumb.href = this._titleHref
|
|
375
|
+
}
|
|
376
|
+
if (this._breadcrumbClasses?.length) {
|
|
377
|
+
titleCrumb.classes = this._breadcrumbClasses
|
|
378
|
+
}
|
|
379
|
+
crumbs.push(titleCrumb)
|
|
380
|
+
|
|
381
|
+
this.app.theme.renderActions(h1, crumbs)
|
|
382
|
+
})
|
|
383
|
+
}
|
|
382
384
|
}
|
|
383
385
|
|
|
384
386
|
|