| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- <template>
- <c-dialog
- ref="dialog"
- :size="sizeClassName"
- v-bind="$attrs"
- >
- <schema-table
- ref="table"
- :schema="schema"
- v-on="schema.listeners"
- >
- <template
- v-if="hasHeader"
- #header="scope"
- >
- <slot
- name="header"
- v-bind="scope"
- />
- </template>
- </schema-table>
- <slot />
- </c-dialog>
- </template>
- <script>
- export default {
- name: 'TableDialog',
- inheritAttrs: false,
- props: {
- schema: {
- type: Object,
- required: true
- },
- size: {
- type: String,
- default: 'medium'
- }
- },
- computed: {
- hasHeader () {
- return !!this.$scopedSlots.header
- },
- sizeClassName () {
- return `table ${this.size} fixed`
- }
- },
- methods: {
- show (condition) {
- if (condition) {
- this.schema.condition = { ...this.schema.condition, ...condition }
- }
- this.$refs.dialog.show()
- },
- getTable () {
- return this.$refs.table
- }
- }
- }
- </script>
|