diff --git a/package-lock.json b/package-lock.json index 1384a5c..fab8802 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@processmaker/vue-form-elements", - "version": "0.49.4", + "version": "0.50.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@processmaker/vue-form-elements", - "version": "0.49.4", + "version": "0.50.0", "license": "MIT", "dependencies": { "@tinymce/tinymce-vue": "2.0.0", diff --git a/package.json b/package.json index 91054cc..b34c829 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@processmaker/vue-form-elements", - "version": "0.49.4", + "version": "0.50.0", "description": "Reusable VueJS Based Form Elements styled with Bootstrap 4", "scripts": { "serve": "NODE_ENV=standalone vue-cli-service serve", diff --git a/src/components/FormBootstrapVueComponents/index.js b/src/components/FormBootstrapVueComponents/index.js new file mode 100644 index 0000000..552878d --- /dev/null +++ b/src/components/FormBootstrapVueComponents/index.js @@ -0,0 +1,4 @@ +import BFormComponent from "./BFormComponent.vue"; +import BWrapperComponent from "./BWrapperComponent.vue"; + +export { BFormComponent, BWrapperComponent }; diff --git a/src/components/FormDatePicker.vue b/src/components/FormDatePicker.vue index fc23486..645a0ec 100644 --- a/src/components/FormDatePicker.vue +++ b/src/components/FormDatePicker.vue @@ -114,15 +114,6 @@ export default { return { validatorErrors: [], date: "", - inputAttributes: { - class: `${this.inputClass}`, - placeholder: this.placeholder, - name: this.name, - "aria-label": this.ariaLabel, - "tab-index": this.tabIndex, - disabled: this.disabled, - readonly: this.isReadOnly - }, onChangeDate: "" }; }, @@ -138,6 +129,17 @@ export default { isDateDisabled: this.checkMinMaxDateDisabled }; }, + inputAttributes() { + return { + class: `${this.inputClass}`, + placeholder: this.placeholder, + name: this.name, + "aria-label": this.ariaLabel, + "tab-index": this.tabIndex, + disabled: this.disabled, + readonly: this.isReadOnly + }; + }, datepicker() { return this.dataFormat === "datetime"; }, diff --git a/src/components/FormSelectList/index.js b/src/components/FormSelectList/index.js new file mode 100644 index 0000000..e4cc8c9 --- /dev/null +++ b/src/components/FormSelectList/index.js @@ -0,0 +1,5 @@ +import CheckboxView from "./CheckboxView.vue"; +import MultiSelectView from "./MultiSelectView.vue"; +import OptionboxView from "./OptionboxView.vue"; + +export { CheckboxView, MultiSelectView, OptionboxView }; diff --git a/src/components/common/index.js b/src/components/common/index.js new file mode 100644 index 0000000..4060ac8 --- /dev/null +++ b/src/components/common/index.js @@ -0,0 +1,4 @@ +import DisplayErrors from "./DisplayErrors.vue"; +import RequiredAsterisk from "./RequiredAsterisk.vue"; + +export { DisplayErrors, RequiredAsterisk }; diff --git a/src/components/index.js b/src/components/index.js index aa19d60..18a6fdf 100644 --- a/src/components/index.js +++ b/src/components/index.js @@ -1,77 +1,58 @@ -// Import our components -import FormInput from './FormInput' -import FormCheckbox from './FormCheckbox' -import FormRadioButtonGroup from './FormRadioButtonGroup' -import FormSelect from './FormSelect' -import FormSelectList from './FormSelectList' -import FormTextArea from './FormTextArea' -import FormDatePicker from './FormDatePicker' -import FormAccordion from './FormAccordion' -import FormHtmlEditor from './FormHtmlEditor' -import FormHtmlViewer from './FormHtmlViewer' -import FormDelayTimeControl from './FormDelayTimeControl' -import FormMultiSelect from './FormMultiSelect'; -import FormPlainMultiSelect from './FormPlainMultiSelect'; -import RequiredAsterisk from './common/RequiredAsterisk'; -import * as dateUtils from '../dateUtils'; +import * as dateUtils from "../dateUtils"; -import BFormComponent from './FormBootstrapVueComponents/BFormComponent' -import BWrapperComponent from './FormBootstrapVueComponents/BWrapperComponent' +export { default as FormAccordion } from "./FormAccordion.vue"; +export { default as FormCheckbox } from "./FormCheckbox.vue"; +export { default as FormDatePicker } from "./FormDatePicker.vue"; +export { default as FormDelayTimeControl } from "./FormDelayTimeControl.vue"; +export { default as FormHtmlEditor } from "./FormHtmlEditor.vue"; +export { default as FormHtmlViewer } from "./FormHtmlViewer.vue"; +export { default as FormInput } from "./FormInput.vue"; +export { default as FormMultiSelect } from "./FormMultiSelect.vue"; +export { default as FormPlainMultiSelect } from "./FormPlainMultiSelect.vue"; +export { default as FormRadioButtonGroup } from "./FormRadioButtonGroup.vue"; +export { default as FormSelect } from "./FormSelect.vue"; +export { default as FormSelectList } from "./FormSelectList.vue"; +export { default as FormTextArea } from "./FormTextArea.vue"; +export * from "./common"; +export * from "./FormBootstrapVueComponents"; +export * from "./FormSelectList"; +export * from "./mixins"; +export { dateUtils }; -// Export our components -let components = { - FormInput, - FormCheckbox, - FormRadioButtonGroup, - FormSelect, - FormSelectList, - FormTextArea, - FormDatePicker, - FormAccordion, - FormHtmlEditor, - FormHtmlViewer, - FormDelayTimeControl, - FormMultiSelect, - FormPlainMultiSelect, - BFormComponent, - BWrapperComponent, -} +// Export our Vue plugin as our default +export default function install(Vue) { + // First check to see if we're already installed + if (Vue._processMakerVueFormElementsInstalled) { + return; + } -// Export our named exports -export { - FormInput, - FormCheckbox, - FormRadioButtonGroup, - FormSelect, - FormSelectList, - FormTextArea, - FormDatePicker, - FormAccordion, - FormHtmlEditor, - FormHtmlViewer, - FormDelayTimeControl, - FormMultiSelect, - FormPlainMultiSelect, - dateUtils, - RequiredAsterisk, - BFormComponent, - BWrapperComponent, -} + // Boolean flag to see if we're already installed + Vue._processMakerVueFormElementsInstalled = true; -// Export our Vue plugin as our default -export default { - install: function (Vue) { - // First check to see if we're already installed - if (Vue._processMakerVueFormElementsInstalled) { - return - } + // Register each of our components + const vueComponents = require.context("./", true, /\.(vue)$/); + + vueComponents.keys().forEach((key) => { + const component = vueComponents(key).default; - // Boolean flag to see if we're already installed - Vue._processMakerVueFormElementsInstalled = true + // if a component has a name defined use the name, else use the path as the component name + const name = component.name ? component.name : key.replace(/^.*[\\\/]/, "").replace(/\.[^/.]+$/, ""); - // Register each of our components - for (let component in components) { - Vue.component(component, components[component]) - } - } + Vue.component(name, component); + }); +} + +const plugin = { + install +}; + +// Auto-install when vue is found (eg. in browser via