diff --git a/src/componentconfig/edit-config.js b/src/componentconfig/edit-config.js index f1e3860..78e35d6 100644 --- a/src/componentconfig/edit-config.js +++ b/src/componentconfig/edit-config.js @@ -23,61 +23,9 @@ import { Multiselect } from 'multiselect-react-dropdown' import Dialog from '../common/dialogs/dialog'; import ParametersEditor from '../common/parameters-editor'; -const template0 = { - id: 0, - name: "No Template" -} - -const templateA = { - id: 1, - name: "Template A", - type: "object", - required: ["name"], - properties: { - name: { type: "string", title: "Name", default: "Template A" }, - paramB: { - title: "MyParam", - enum: [ - "option1", - "option2" - ], - enumNames: [ - "Option 1", - "Option 2" - ] - } - } -}; - -const templateB = { - id: 2, - name: "Template B", - type: "object", - definitions: { - uint: { - type: "integer", - minimum: 0 - }, - }, - properties: { - name: { type: "string", title: "Name", default: "Template B" }, - description: { type: "string", title: "Description", default: "Description for Template B" }, - paramB: { - title: "MyParam B", - enum: [ - "option1", - "option2", - "option3" - ], - enumNames: [ - "Option 1", - "Option 2", - "Option 3" - ] - }, - minLength: { type: "integer", title: "Minimum Length", minimum: 0, default: 0 } - } -}; +import template0 from './paramtemplates/template0' +import templateA from './paramtemplates/templateA' +import templateB from './paramtemplates/templateB' const templates = [template0, templateA, templateB]; diff --git a/src/componentconfig/paramtemplates/template0.js b/src/componentconfig/paramtemplates/template0.js new file mode 100644 index 0000000..0b9fa19 --- /dev/null +++ b/src/componentconfig/paramtemplates/template0.js @@ -0,0 +1,23 @@ +/** + * This file is part of VILLASweb. + * + * VILLASweb is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * VILLASweb is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with VILLASweb. If not, see . + ******************************************************************************/ + +const template0 = { + id: 0, + name: "No Template" +} + +export default template0; \ No newline at end of file diff --git a/src/componentconfig/paramtemplates/templateA.js b/src/componentconfig/paramtemplates/templateA.js new file mode 100644 index 0000000..304e8fb --- /dev/null +++ b/src/componentconfig/paramtemplates/templateA.js @@ -0,0 +1,39 @@ +/** + * This file is part of VILLASweb. + * + * VILLASweb is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * VILLASweb is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with VILLASweb. If not, see . + ******************************************************************************/ + +const templateA = { + id: 1, + name: "Template A", + type: "object", + required: ["name"], + properties: { + name: { type: "string", title: "Name", default: "Template A" }, + paramB: { + title: "MyParam", + enum: [ + "option1", + "option2" + ], + enumNames: [ + "Option 1", + "Option 2" + ] + } + } +}; + +export default templateA; \ No newline at end of file diff --git a/src/componentconfig/paramtemplates/templateB.js b/src/componentconfig/paramtemplates/templateB.js new file mode 100644 index 0000000..7aa4b21 --- /dev/null +++ b/src/componentconfig/paramtemplates/templateB.js @@ -0,0 +1,48 @@ +/** + * This file is part of VILLASweb. + * + * VILLASweb is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * VILLASweb is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with VILLASweb. If not, see . + ******************************************************************************/ + +const templateB = { + id: 2, + name: "Template B", + type: "object", + definitions: { + uint: { + type: "integer", + minimum: 0 + }, + }, + properties: { + name: { type: "string", title: "Name", default: "Template B" }, + description: { type: "string", title: "Description", default: "Description for Template B" }, + paramB: { + title: "MyParam B", + enum: [ + "option1", + "option2", + "option3" + ], + enumNames: [ + "Option 1", + "Option 2", + "Option 3" + ] + }, + minLength: { type: "integer", title: "Minimum Length", minimum: 0, default: 0 } + } + }; + + export default templateB; \ No newline at end of file