Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix oh- components cannot be configured in action modals #2094

Merged
merged 2 commits into from
Sep 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default {
'oh-plan-page': () => import('@/components/widgets/plan/oh-plan-page.vue'),
'oh-chart-page': () => import('@/components/widgets/chart/oh-chart-page.vue')
},
props: ['uid', 'el', 'modalParams'],
props: ['uid', 'el', 'modalConfig'],
data () {
return {
currentTab: 0,
Expand All @@ -22,8 +22,9 @@ export default {
component: component,
root: component,
store: this.$store.getters.trackedItems,
props: this.modalParams,
vars: this.vars
props: this.modalConfig,
vars: this.vars,
modalConfig: this.modalConfig // For configuration of oh- components
}
},
modalStyle () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ export const actionsMixin = {
const actionModal = actionConfig[prefix + 'actionModal']
const actionModalConfig = actionConfig[prefix + 'actionModalConfig']
if (actionModal.indexOf('page:') !== 0 && actionModal.indexOf('widget:') !== 0 && actionModal.indexOf('oh-') !== 0) {
console.log('Action target is not of the format page:uid or widget:uid')
console.log('Action target is not of the format page:uid or widget:uid or oh-')
return
}

Expand All @@ -196,7 +196,7 @@ export const actionsMixin = {
props: {
uid: actionModal,
el: (evt && evt.target && evt.target._icon) ? evt.target._icon : (evt) ? evt.target : null,
modalParams: actionModalConfig || {}
modalConfig: actionModalConfig || {}
}
}
this.$f7.views.main.router.navigate(modalRoute, modalProps)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,9 @@ export default {
config () {
if (!this.context || !this.context.component) return null
let evalConfig = {}
if (this.context.component.config) {
const sourceConfig = this.context.component.config
// Fallback to modelConfig for oh- components to allow configuring them in modals
const sourceConfig = this.context.component.config || (this.componentType.startsWith('oh-') ? this.context.modalConfig : {})
if (sourceConfig) {
if (typeof sourceConfig !== 'object') return {}
for (const key in sourceConfig) {
if (key === 'visible' || key === 'visibleTo' || key === 'stylesheet') continue
Expand Down