-
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Extend the original filter component instead of replacing it (#7)
- Loading branch information
Showing
6 changed files
with
56 additions
and
49 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,47 @@ | ||
import FilterMenu from './components/FilterMenu.vue' | ||
import { registerMixin } from './components/ColumToggler' | ||
import Index from '@/views/Index' | ||
import ColumnToggler from './components/ColumnToggler.vue' | ||
import { registerMixin } from './components/ColumnToggler' | ||
import { createVNode, render } from 'vue' | ||
|
||
Nova.booting(app => { | ||
|
||
registerMixin(Index) | ||
const componentFn = app.component | ||
|
||
app.component('ResourceIndex', Index) | ||
app.component('FilterMenu', FilterMenu) | ||
app.component = function (name, component) { | ||
|
||
if (name === 'ResourceIndex') { | ||
registerMixin(component) | ||
} | ||
|
||
return componentFn.call(this, name, component) | ||
|
||
} | ||
|
||
app.mixin({ | ||
mounted() { | ||
|
||
if (this._.type?.__file?.endsWith('ResourceTableToolbar.vue')) { | ||
|
||
const toolbarTarget = '[dusk$="-index-component"] div.h-9.ml-auto.flex.items-center.pr-2.md\\:pr-3 > div.hidden.md\\:flex.px-2' | ||
|
||
const container = document.createElement('div') | ||
container.id = 'column-toggler' | ||
|
||
const element = this._.vnode.el.querySelector(toolbarTarget) | ||
|
||
if (element) { | ||
|
||
element.insertAdjacentElement('afterend', container) | ||
|
||
const vnode = createVNode(ColumnToggler, { resourceName: this._.props.resourceName }) | ||
vnode.appContext = app._context | ||
|
||
render(vnode, container) | ||
|
||
} | ||
|
||
} | ||
|
||
}, | ||
}) | ||
|
||
}) |