diff --git a/components/@mixins/MixinNavigationTabs.js b/components/@mixins/MixinNavigationTabs.js new file mode 100644 index 0000000..57fd72b --- /dev/null +++ b/components/@mixins/MixinNavigationTabs.js @@ -0,0 +1,6 @@ +import { uniqid } from 'genesis/support/utils' + +export default { + props: {}, + methods: {} +} diff --git a/components/@mixins/MixinNavigationWizard.js b/components/@mixins/MixinNavigationWizard.js new file mode 100644 index 0000000..7c9a5ac --- /dev/null +++ b/components/@mixins/MixinNavigationWizard.js @@ -0,0 +1,13 @@ +import { uniqid } from 'genesis/support/utils' + +export default { + props: {}, + methods: { + nextStep () { + this.$refs.form.$refs.stepper.next() + }, + previousStep () { + this.$refs.form.$refs.stepper.previous() + } + } +} diff --git a/components/crud/Form.vue b/components/crud/Form.vue index 5593e0c..a688e73 100644 --- a/components/crud/Form.vue +++ b/components/crud/Form.vue @@ -9,13 +9,13 @@
-
- + @@ -34,8 +34,12 @@ diff --git a/components/crud/model/form/MixinForm.js b/components/crud/model/form/MixinForm.js index d47e6e8..425df81 100644 --- a/components/crud/model/form/MixinForm.js +++ b/components/crud/model/form/MixinForm.js @@ -60,6 +60,14 @@ export default { type: String, default: () => '' }, + steps: { + type: Array, + default: () => ([]) + }, + step: { + type: String, + default: () => '' + }, change: { type: Function }, @@ -177,6 +185,12 @@ export default { if (this.scopes[this.scope]) { this.readonly = this.scopes[this.scope].readonly } + if (this.tabs.length) { + this.$g.emit('app-crud-enviroment', 'tabs') + } + if (this.steps.length) { + this.$g.emit('app-crud-enviroment', 'steps') + } this.renderAll() }, mounted () { diff --git a/components/form/AppForm.vue b/components/form/AppForm.vue index 2a03a4d..001bd41 100644 --- a/components/form/AppForm.vue +++ b/components/form/AppForm.vue @@ -11,6 +11,7 @@ @input="formInput(schema.field, arguments)" @event="formEvent"> +
@@ -51,7 +44,4 @@ diff --git a/components/form/AppFormTabs.vue b/components/form/AppFormTabs.vue new file mode 100644 index 0000000..ee2345f --- /dev/null +++ b/components/form/AppFormTabs.vue @@ -0,0 +1,40 @@ + + + + + diff --git a/components/form/AppWizard.vue b/components/form/AppWizard.vue new file mode 100644 index 0000000..c9b4fd8 --- /dev/null +++ b/components/form/AppWizard.vue @@ -0,0 +1,50 @@ + + + + + diff --git a/components/form/model/mixins/MixinData.js b/components/form/model/mixins/MixinData.js index 2cdb7e4..be966c0 100644 --- a/components/form/model/mixins/MixinData.js +++ b/components/form/model/mixins/MixinData.js @@ -4,6 +4,7 @@ export default { schemas: {}, record: {}, tabSeletecd: '', + currentStep: '', modified: false }) } diff --git a/components/form/model/mixins/MixinMethods.js b/components/form/model/mixins/MixinMethods.js index f93edcc..f52d073 100644 --- a/components/form/model/mixins/MixinMethods.js +++ b/components/form/model/mixins/MixinMethods.js @@ -58,6 +58,11 @@ export default { components[tab.name] = this.fields.filter(field => field.tab === tab.name).reduce(arrayToObject, {}) }) } + if (this.steps.length) { + this.steps.forEach(step => { + components[step.name] = this.fields.filter(field => field.step === step.name).reduce(arrayToObject, {}) + }) + } this.components = components }, /** diff --git a/components/form/model/mixins/MixinProps.js b/components/form/model/mixins/MixinProps.js index 0f6aecf..25ee3e7 100644 --- a/components/form/model/mixins/MixinProps.js +++ b/components/form/model/mixins/MixinProps.js @@ -8,6 +8,14 @@ export default { type: String, default: () => '' }, + steps: { + type: Array, + default: () => ([]) + }, + step: { + type: String, + default: () => '' + }, fields: { type: Array, default: () => ([]) diff --git a/components/layout/AppLayout.vue b/components/layout/AppLayout.vue index 81766d6..fc61355 100644 --- a/components/layout/AppLayout.vue +++ b/components/layout/AppLayout.vue @@ -21,7 +21,7 @@ - + diff --git a/plugin/index.js b/plugin/index.js index e6f861c..636420a 100644 --- a/plugin/index.js +++ b/plugin/index.js @@ -1,3 +1,4 @@ +import { Events } from 'quasar-framework' import { get, set } from 'lodash' import { uniqid } from 'genesis/support/utils' import router from 'genesis/infra/router' @@ -28,8 +29,12 @@ const browse = (path, query = {}, changer = '~') => { window.setTimeout(() => router.push({path, query}), 100) } +const on = (name, callback) => Events.$on(name, callback) +const off = (name) => Events.$off(name) +const emit = (name, parameters) => Events.$emit(name, parameters) + const genesis = { - get, set, browse + get, set, browse, on, off, emit } /** diff --git a/support/model/fields.js b/support/model/fields.js index c79c891..ed92484 100644 --- a/support/model/fields.js +++ b/support/model/fields.js @@ -70,6 +70,10 @@ export const standard = { this.form.tab = name return this }, + $step (name) { + this.form.step = name + return this + }, $disabled () { this.form.disabled = true return this