Skip to content
This repository has been archived by the owner on Jul 14, 2020. It is now read-only.

Add data to CForm and saveData functionality nsftx/chameleon-builder#515 #239

Draft
wants to merge 6 commits into
base: master
Choose a base branch
from
Draft
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
1,505 changes: 769 additions & 736 deletions package-lock.json

Large diffs are not rendered by default.

18 changes: 9 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
],
"scripts": {
"serve": "vue-cli-service serve",
"lint": "vue-cli-service lint",
"lint": "vue-cli-service lint --no-fix",
"test:e2e": "vue-cli-service test:e2e",
"test:unit": "vue-cli-service test:unit",
"build": "CHM_TARGET=lib vue-cli-service build --target lib --name bundle --entry src/index.js",
Expand All @@ -24,9 +24,9 @@
},
"dependencies": {
"@nsoft/chameleon-notation": "^1.0.16",
"@nsoft/chameleon-sdk": "^1.0.97",
"axios": "^0.18.0",
"lodash": "^4.17.11",
"@nsoft/chameleon-sdk": "^1.0.102-beta.4",
"axios": "^0.19.0",
"lodash": "^4.17.14",
"moment": "^2.24.0",
"quill": "^1.3.6",
"uuid": "^3.3.2",
Expand All @@ -36,11 +36,11 @@
"vuetify": "^1.5.14"
},
"devDependencies": {
"@vue/cli-plugin-babel": "^3.8.0",
"@vue/cli-plugin-eslint": "^3.8.0",
"@vue/cli-plugin-unit-jest": "^3.8.0",
"@vue/cli-service": "^3.8.0",
"@vue/eslint-config-airbnb": "^4.0.0",
"@vue/cli-plugin-babel": "^3.9.2",
"@vue/cli-plugin-eslint": "^3.9.2",
"@vue/cli-plugin-unit-jest": "^3.9.0",
"@vue/cli-service": "^3.9.3",
"@vue/eslint-config-airbnb": "^4.0.1",
"@vue/test-utils": "1.0.0-beta.29",
"babel-core": "7.0.0-bridge.0",
"babel-eslint": "^10.0.1",
Expand Down
7 changes: 5 additions & 2 deletions src/components/CForm/CForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,9 @@ export default {
return filter(this.config.elements, n => isNil(n.actions));
},
validateForm() {
this.form.validate();
this.getForm().validate();
let valid = true;
map(this.form.$children, (input) => {
map(this.getForm().$children, (input) => {
// We need to remove submit & clear from validation
if (!input.$attrs.action) {
if (!input.validate()) {
Expand All @@ -121,6 +121,9 @@ export default {
this.form.reset();
this.sendToEventBus('Cleared', {});
},
saveData(data) {
this.saveConnectorData(data);
},
submit() {
this.errors = [];
this.entity = {};
Expand Down
18 changes: 18 additions & 0 deletions src/components/CForm/index.meta.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ export default {
name: 'clear',
help: 'Clear Form',
},
{
name: 'saveData',
help: 'Save Submitted data',
},
],
events: [
{
Expand All @@ -33,6 +37,12 @@ export default {
{
name: 'Errored',
},
{
name: 'DataSaveSucceded',
},
{
name: 'DataSaveErrored',
},
],
options: {
color: true,
Expand All @@ -43,6 +53,14 @@ export default {
priority: 1,
},
theme: true,
dataSource: {
type: 'dataSource',
group: 'data',
name: 'Data Source',
value: null,
schema: '=$activePageElement.elements',
priority: 6,
},
submit: {
type: 'group',
group: 'submit',
Expand Down
2 changes: 1 addition & 1 deletion src/components/CRating/CRating.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { isNil, isObject } from 'lodash';
import { fieldable, validatable } from '@/mixins';
import { validator } from '@/validators';
import { isNil, isObject } from 'lodash';
import Element from '../Element';

require('../../style/components/_rating.styl');
Expand Down
2 changes: 1 addition & 1 deletion src/components/CSlider/CSlider.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { isNil, isNaN } from 'lodash';
import { fieldable, validatable } from '@/mixins';
import { validator } from '@/validators';
import { isNil, isNaN } from 'lodash';
import Element from '../Element';

const getAttrs = (context) => {
Expand Down
2 changes: 1 addition & 1 deletion src/components/CTextArea/CTextArea.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { isNil, isObject } from 'lodash';
import { fieldable, validatable } from '@/mixins';
import { validator } from '@/validators';
import { isNil, isObject } from 'lodash';
import Element from '../Element';

const getPropRequired = (config) => {
Expand Down
8 changes: 4 additions & 4 deletions src/components/Element/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
import {
cloneDeep, merge, isNil, isObject,
} from 'lodash';

import {
bindable,
dependable,
Expand All @@ -8,10 +12,6 @@ import {
reactionable,
themable,
} from '@/mixins';

import {
cloneDeep, merge, isNil, isObject,
} from 'lodash';
/*
This is a base element for all componets.
This element applies elementable mixin from sdk, and
Expand Down