From 73baaaf6acf9f12c48fbb57620495909f16c0b39 Mon Sep 17 00:00:00 2001 From: Gilvan Date: Tue, 26 Dec 2017 23:41:17 -0300 Subject: [PATCH 1/9] renomeando arquivos e aplicando classe FORM --- components/@mixins/MixinNavigationTabs.js | 6 ------ components/@mixins/MixinNavigationWizard.js | 13 ------------ components/crud/{Form.vue => AppCrudForm.vue} | 8 ++----- components/crud/{Grid.vue => AppCrudGrid.vue} | 6 ++++-- .../crud/{Index.vue => AppCrudIndex.vue} | 0 components/form/AppForm.vue | 14 +------------ components/form/AppFormTabs.vue | 21 ++++++++----------- .../form/{AppWizard.vue => AppFormWizard.vue} | 13 +++++++----- 8 files changed, 24 insertions(+), 57 deletions(-) delete mode 100644 components/@mixins/MixinNavigationTabs.js delete mode 100644 components/@mixins/MixinNavigationWizard.js rename components/crud/{Form.vue => AppCrudForm.vue} (85%) rename components/crud/{Grid.vue => AppCrudGrid.vue} (93%) rename components/crud/{Index.vue => AppCrudIndex.vue} (100%) rename components/form/{AppWizard.vue => AppFormWizard.vue} (80%) diff --git a/components/@mixins/MixinNavigationTabs.js b/components/@mixins/MixinNavigationTabs.js deleted file mode 100644 index 57fd72b..0000000 --- a/components/@mixins/MixinNavigationTabs.js +++ /dev/null @@ -1,6 +0,0 @@ -import { uniqid } from 'genesis/support/utils' - -export default { - props: {}, - methods: {} -} diff --git a/components/@mixins/MixinNavigationWizard.js b/components/@mixins/MixinNavigationWizard.js deleted file mode 100644 index 7c9a5ac..0000000 --- a/components/@mixins/MixinNavigationWizard.js +++ /dev/null @@ -1,13 +0,0 @@ -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/AppCrudForm.vue similarity index 85% rename from components/crud/Form.vue rename to components/crud/AppCrudForm.vue index a688e73..13f0bef 100644 --- a/components/crud/Form.vue +++ b/components/crud/AppCrudForm.vue @@ -34,12 +34,10 @@ diff --git a/components/form/AppFormWizard.vue b/components/form/AppFormWizard.vue index 8dd7d11..b3aaf4f 100644 --- a/components/form/AppFormWizard.vue +++ b/components/form/AppFormWizard.vue @@ -47,6 +47,21 @@ if (this.$route.query.step) { this.currentStep = this.$route.query.step } + }, + methods: { + arrayToObject (accumulate, item) { + accumulate[item.field] = item + return accumulate + }, + updateComponents () { + const components = {} + if (this.steps.length) { + this.steps.forEach(step => { + components[step.name] = this.fields.filter(field => field.step === step.name).reduce(this.arrayToObject, {}) + }) + } + this.components = components + } } } diff --git a/components/form/model/mixins/MixinData.js b/components/form/model/mixins/MixinData.js index be966c0..4c676f0 100644 --- a/components/form/model/mixins/MixinData.js +++ b/components/form/model/mixins/MixinData.js @@ -1,6 +1,9 @@ export default { data: () => ({ - components: {}, + components: { + steps: {}, + tabs: {} + }, schemas: {}, record: {}, tabSeletecd: '', From c6e0d5c15f64e4eec26a48ccf24171f222d2e07b Mon Sep 17 00:00:00 2001 From: Gilvan Date: Tue, 23 Jan 2018 21:04:34 -0200 Subject: [PATCH 6/9] separate methods for components AppFormWizard and AppFormTabs --- components/form/AppFormTabs.vue | 2 +- components/form/AppFormWizard.vue | 2 +- components/form/model/mixins/MixinData.js | 3 ++- components/form/model/mixins/MixinMethods.js | 12 ++++++++---- 4 files changed, 12 insertions(+), 7 deletions(-) diff --git a/components/form/AppFormTabs.vue b/components/form/AppFormTabs.vue index a33c7c2..c4a4618 100644 --- a/components/form/AppFormTabs.vue +++ b/components/form/AppFormTabs.vue @@ -4,7 +4,7 @@
-
diff --git a/components/form/AppFormWizard.vue b/components/form/AppFormWizard.vue index 8dd7d11..09af754 100644 --- a/components/form/AppFormWizard.vue +++ b/components/form/AppFormWizard.vue @@ -4,7 +4,7 @@
-
diff --git a/components/form/model/mixins/MixinData.js b/components/form/model/mixins/MixinData.js index be966c0..c1b2971 100644 --- a/components/form/model/mixins/MixinData.js +++ b/components/form/model/mixins/MixinData.js @@ -1,6 +1,7 @@ export default { data: () => ({ - components: {}, + componentsForWizard: {}, + componentsForTabs: {}, schemas: {}, record: {}, tabSeletecd: '', diff --git a/components/form/model/mixins/MixinMethods.js b/components/form/model/mixins/MixinMethods.js index f52d073..520e3e4 100644 --- a/components/form/model/mixins/MixinMethods.js +++ b/components/form/model/mixins/MixinMethods.js @@ -52,18 +52,22 @@ export default { /** */ updateComponents () { - const components = {} + const componentsForTabs = {} if (this.tabs.length) { this.tabs.forEach(tab => { - components[tab.name] = this.fields.filter(field => field.tab === tab.name).reduce(arrayToObject, {}) + componentsForTabs[tab.name] = this.fields + .filter(field => field.tab === tab.name).reduce(arrayToObject, {}) }) } + const componentsForWizard = {} if (this.steps.length) { this.steps.forEach(step => { - components[step.name] = this.fields.filter(field => field.step === step.name).reduce(arrayToObject, {}) + componentsForWizard[step.name] = this.fields + .filter(field => field.step === step.name).reduce(arrayToObject, {}) }) } - this.components = components + this.componentsForTabs = componentsForTabs + this.componentsForWizard = componentsForWizard }, /** */ From e5abeb372adf72dd9949f0f6444212180109ca6f Mon Sep 17 00:00:00 2001 From: Gilvan Date: Tue, 23 Jan 2018 21:48:01 -0200 Subject: [PATCH 7/9] Revert "Merge remote-tracking branch 'origin/master'" This reverts commit 956d8957c4f2dbde931d8469c630c83533d22a65. --- components/form/AppFormTabs.vue | 15 --------------- components/form/AppFormWizard.vue | 15 --------------- 2 files changed, 30 deletions(-) diff --git a/components/form/AppFormTabs.vue b/components/form/AppFormTabs.vue index fa20510..c4a4618 100644 --- a/components/form/AppFormTabs.vue +++ b/components/form/AppFormTabs.vue @@ -25,21 +25,6 @@ if (this.$route.query.tab) { this.tabSeletecd = this.$route.query.tab } - }, - methods: { - arrayToObject (accumulate, item) { - accumulate[item.field] = item - return accumulate - }, - updateComponents () { - const components = {} - if (this.tabs.length) { - this.tabs.forEach(tab => { - components[tab.name] = this.fields.filter(field => field.tab === tab.name).reduce(this.arrayToObject, {}) - }) - } - this.components = components - } } } diff --git a/components/form/AppFormWizard.vue b/components/form/AppFormWizard.vue index 29ec4b7..09af754 100644 --- a/components/form/AppFormWizard.vue +++ b/components/form/AppFormWizard.vue @@ -47,21 +47,6 @@ if (this.$route.query.step) { this.currentStep = this.$route.query.step } - }, - methods: { - arrayToObject (accumulate, item) { - accumulate[item.field] = item - return accumulate - }, - updateComponents () { - const components = {} - if (this.steps.length) { - this.steps.forEach(step => { - components[step.name] = this.fields.filter(field => field.step === step.name).reduce(this.arrayToObject, {}) - }) - } - this.components = components - } } } From 7e6c0e70bdec3822baaf60717e4f92f01d980ccd Mon Sep 17 00:00:00 2001 From: Gilvan Date: Fri, 2 Feb 2018 13:55:52 -0200 Subject: [PATCH 8/9] factory para service http --- infra/services/http/index.js | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/infra/services/http/index.js b/infra/services/http/index.js index ed3c4b5..4c5234e 100644 --- a/infra/services/http/index.js +++ b/infra/services/http/index.js @@ -6,16 +6,30 @@ import { loading } from 'genesis/support/message' import configure from './configure' +/** + * @type {Object} + */ +const HEADERS = { + 'Accept': 'application/json', + 'Content-Type': 'application/json' +} + +/** + * @param {string} baseURL + * @param {Object} headers + * @return {AxiosInstance} + */ +export const create = (baseURL = '', headers = {}) => { + return axios.create({ + baseURL: baseURL || URL_API, + headers: Object.assign({}, HEADERS, headers) + }) +} + /** * @type {Axios} */ -export const http = axios.create({ - baseURL: URL_API, - headers: { - 'Accept': 'application/json', - 'Content-Type': 'application/json' - } -}) +export const http = create() /** * @returns {Axios} From 73464ef76c4d45bf8d08f890bac398a612beb4da Mon Sep 17 00:00:00 2001 From: Gilvan Date: Thu, 22 Feb 2018 19:53:20 -0300 Subject: [PATCH 9/9] =?UTF-8?q?mesclando=20classes=20ao=20componente=20pas?= =?UTF-8?q?sadas=20pelo=20model=20field=20setando=20utf8=20como=20default?= =?UTF-8?q?=20para=20requisi=C3=A7=C3=B5es?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/fields/abstract.js | 6 ++++++ infra/services/http/index.js | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/components/fields/abstract.js b/components/fields/abstract.js index 3965c25..2e1e8db 100644 --- a/components/fields/abstract.js +++ b/components/fields/abstract.js @@ -87,6 +87,12 @@ export default { */ classNames () { const classNames = [] + if (this.className.length) { + classNames.push(this.className) + } + if (this.inline) { + classNames.push('field-inline') + } const width = 'field has-' + String(this.inline ? '100' : this.width) classNames.push(width) classNames.push(this.$options.name) diff --git a/infra/services/http/index.js b/infra/services/http/index.js index 4c5234e..5ca4c31 100644 --- a/infra/services/http/index.js +++ b/infra/services/http/index.js @@ -11,7 +11,7 @@ import configure from './configure' */ const HEADERS = { 'Accept': 'application/json', - 'Content-Type': 'application/json' + 'Content-Type': 'application/json;charset=UTF-8' } /**