Add a continious modal navigation flow for all page block
This commit is contained in:
parent
55fed4a550
commit
eaa337c598
@ -355,7 +355,12 @@ export default {
|
|||||||
|
|
||||||
const route = { name: 'page.record', params: { recordID, pageID: page.pageID } }
|
const route = { name: 'page.record', params: { recordID, pageID: page.pageID } }
|
||||||
|
|
||||||
if (this.options.eventDisplayOption === 'newTab') {
|
if (this.inModal) {
|
||||||
|
this.$root.$emit('show-record-modal', {
|
||||||
|
recordID,
|
||||||
|
recordPageID: page.pageID,
|
||||||
|
})
|
||||||
|
} else if (this.options.eventDisplayOption === 'newTab') {
|
||||||
window.open(this.$router.resolve(route).href)
|
window.open(this.$router.resolve(route).href)
|
||||||
} else if (this.options.eventDisplayOption === 'modal') {
|
} else if (this.options.eventDisplayOption === 'modal') {
|
||||||
this.$root.$emit('show-record-modal', {
|
this.$root.$emit('show-record-modal', {
|
||||||
|
|||||||
@ -296,7 +296,12 @@ export default {
|
|||||||
|
|
||||||
const route = { name: 'page.record', params: { recordID, pageID: page.pageID } }
|
const route = { name: 'page.record', params: { recordID, pageID: page.pageID } }
|
||||||
|
|
||||||
if (this.options.displayOption === 'newTab') {
|
if (this.inModal) {
|
||||||
|
this.$root.$emit('show-record-modal', {
|
||||||
|
recordID,
|
||||||
|
recordPageID: page.pageID,
|
||||||
|
})
|
||||||
|
} else if (this.options.displayOption === 'newTab') {
|
||||||
window.open(this.$router.resolve(route).href)
|
window.open(this.$router.resolve(route).href)
|
||||||
} else if (this.options.displayOption === 'modal') {
|
} else if (this.options.displayOption === 'modal') {
|
||||||
this.$root.$emit('show-record-modal', {
|
this.$root.$emit('show-record-modal', {
|
||||||
|
|||||||
@ -47,6 +47,10 @@ import { NoID, compose } from '@cortezaproject/corteza-js'
|
|||||||
import { evaluatePrefilter } from 'corteza-webapp-compose/src/lib/record-filter'
|
import { evaluatePrefilter } from 'corteza-webapp-compose/src/lib/record-filter'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
i18nOptions: {
|
||||||
|
namespaces: 'block',
|
||||||
|
},
|
||||||
|
|
||||||
components: {
|
components: {
|
||||||
MetricItem,
|
MetricItem,
|
||||||
},
|
},
|
||||||
@ -194,7 +198,7 @@ export default {
|
|||||||
const metricID = `${this.block.blockID}-${name.replace(/\s+/g, '-').toLowerCase()}-${moduleID}-${metricIndex}`
|
const metricID = `${this.block.blockID}-${name.replace(/\s+/g, '-').toLowerCase()}-${moduleID}-${metricIndex}`
|
||||||
|
|
||||||
const block = new compose.PageBlockRecordList({
|
const block = new compose.PageBlockRecordList({
|
||||||
title: name,
|
title: name || this.$t('metric.metricDrillDown'),
|
||||||
blockID: `drillDown-${metricID}`,
|
blockID: `drillDown-${metricID}`,
|
||||||
options: {
|
options: {
|
||||||
moduleID,
|
moduleID,
|
||||||
|
|||||||
@ -497,7 +497,7 @@
|
|||||||
|
|
||||||
<b-dropdown-item
|
<b-dropdown-item
|
||||||
v-if="isEditRecordActionVisible(item.r)"
|
v-if="isEditRecordActionVisible(item.r)"
|
||||||
:to="{ name: options.rowEditUrl || 'page.record.edit', params: { pageID: recordPageID, recordID: item.r.recordID }, query: null }"
|
@click="handleEditRecordAction(item.r.recordID)"
|
||||||
>
|
>
|
||||||
<font-awesome-icon
|
<font-awesome-icon
|
||||||
:icon="['far', 'edit']"
|
:icon="['far', 'edit']"
|
||||||
@ -508,7 +508,7 @@
|
|||||||
|
|
||||||
<b-dropdown-item
|
<b-dropdown-item
|
||||||
v-if="isCloneRecordActionVisible"
|
v-if="isCloneRecordActionVisible"
|
||||||
:to="{ name: options.rowCreateUrl || 'page.record.create', params: { pageID: recordPageID, values: item.r.values }, query: null }"
|
@click="handleCloneRecordAction(item.r.recordID, item.r.values)"
|
||||||
>
|
>
|
||||||
<font-awesome-icon
|
<font-awesome-icon
|
||||||
:icon="['far', 'clone']"
|
:icon="['far', 'clone']"
|
||||||
@ -1941,6 +1941,39 @@ export default {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
handleEditRecordAction (recordID) {
|
||||||
|
if (this.inModal) {
|
||||||
|
this.$root.$emit('show-record-modal', {
|
||||||
|
recordID: recordID,
|
||||||
|
recordPageID: this.recordPageID,
|
||||||
|
edit: true,
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
this.$router.push({
|
||||||
|
name: this.options.rowCreateUrl || 'page.record.edit',
|
||||||
|
params: { pageID: this.recordPageID, recordID },
|
||||||
|
query: null,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
handleCloneRecordAction (recordID, values) {
|
||||||
|
if (this.inModal) {
|
||||||
|
this.$root.$emit('show-record-modal', {
|
||||||
|
recordID: recordID,
|
||||||
|
recordPageID: this.recordPageID,
|
||||||
|
values,
|
||||||
|
edit: true,
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
this.$router.push({
|
||||||
|
name: this.options.rowCreateUrl || 'page.record.create',
|
||||||
|
params: { pageID: this.recordPageID, values },
|
||||||
|
query: null,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@ -40,7 +40,7 @@
|
|||||||
</b-button>
|
</b-button>
|
||||||
|
|
||||||
<b-button
|
<b-button
|
||||||
v-if="block.options.magnifyOption"
|
v-if="block.options.magnifyOption || isBlockMagnified"
|
||||||
:title="isBlockMagnified ? '' : $t('general.label.magnify')"
|
:title="isBlockMagnified ? '' : $t('general.label.magnify')"
|
||||||
variant="outline-light"
|
variant="outline-light"
|
||||||
class="d-flex align-items-center text-secondary d-print-none border-0"
|
class="d-flex align-items-center text-secondary d-print-none border-0"
|
||||||
|
|||||||
@ -38,7 +38,7 @@
|
|||||||
</b-button>
|
</b-button>
|
||||||
|
|
||||||
<b-button
|
<b-button
|
||||||
v-if="block.options.magnifyOption"
|
v-if="block.options.magnifyOption || isBlockMagnified"
|
||||||
:title="isBlockMagnified ? '' : $t('general.label.magnify')"
|
:title="isBlockMagnified ? '' : $t('general.label.magnify')"
|
||||||
variant="outline-light"
|
variant="outline-light"
|
||||||
class="d-flex align-items-center text-secondary d-print-none border-0"
|
class="d-flex align-items-center text-secondary d-print-none border-0"
|
||||||
|
|||||||
@ -71,6 +71,7 @@ export default {
|
|||||||
return [
|
return [
|
||||||
this.block.options.magnifyOption,
|
this.block.options.magnifyOption,
|
||||||
this.block.options.showRefresh,
|
this.block.options.showRefresh,
|
||||||
|
this.isBlockMagnified
|
||||||
].some(c => !!c)
|
].some(c => !!c)
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@ -24,6 +24,7 @@
|
|||||||
:record-i-d="recordID"
|
:record-i-d="recordID"
|
||||||
:values="values"
|
:values="values"
|
||||||
:ref-record="refRecord"
|
:ref-record="refRecord"
|
||||||
|
:edit="edit"
|
||||||
show-record-modal
|
show-record-modal
|
||||||
@handle-record-redirect="loadRecord"
|
@handle-record-redirect="loadRecord"
|
||||||
@on-modal-back="loadRecord"
|
@on-modal-back="loadRecord"
|
||||||
@ -74,6 +75,7 @@ export default {
|
|||||||
page: undefined,
|
page: undefined,
|
||||||
values: undefined,
|
values: undefined,
|
||||||
refRecord: undefined,
|
refRecord: undefined,
|
||||||
|
edit: false,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -131,10 +133,11 @@ export default {
|
|||||||
clearModalPreviousPage: 'ui/clearModalPreviousPage',
|
clearModalPreviousPage: 'ui/clearModalPreviousPage',
|
||||||
}),
|
}),
|
||||||
|
|
||||||
loadRecord ({ recordID, recordPageID, values, refRecord, pushModalPreviousPage = true }) {
|
loadRecord ({ recordID, recordPageID, values, refRecord, edit, pushModalPreviousPage = true }) {
|
||||||
this.recordID = recordID
|
this.recordID = recordID
|
||||||
this.values = values
|
this.values = values
|
||||||
this.refRecord = refRecord
|
this.refRecord = refRecord
|
||||||
|
this.edit = edit
|
||||||
|
|
||||||
this.loadModal({ recordID, recordPageID })
|
this.loadModal({ recordID, recordPageID })
|
||||||
|
|
||||||
|
|||||||
@ -177,6 +177,11 @@ export default {
|
|||||||
type: Boolean,
|
type: Boolean,
|
||||||
required: false,
|
required: false,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
edit: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
data () {
|
data () {
|
||||||
@ -320,6 +325,16 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
edit: {
|
||||||
|
immediate: true,
|
||||||
|
handler (value) {
|
||||||
|
if (value) {
|
||||||
|
this.inEditing = true
|
||||||
|
this.inCreating = true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
mounted () {
|
mounted () {
|
||||||
|
|||||||
@ -186,6 +186,7 @@ iframe:
|
|||||||
srcFieldLabel: Field (URL) from record to use for the iframe
|
srcFieldLabel: Field (URL) from record to use for the iframe
|
||||||
srcLabel: URL to show in the iframe
|
srcLabel: URL to show in the iframe
|
||||||
metric:
|
metric:
|
||||||
|
metricDrillDown: Metric drill down
|
||||||
defaultMetricLabel: Unnamed metric
|
defaultMetricLabel: Unnamed metric
|
||||||
drillDown:
|
drillDown:
|
||||||
label: Drill down
|
label: Drill down
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user