Skip to content

Commit

Permalink
Merge pull request #413 from ProcessMaker/vite-2
Browse files Browse the repository at this point in the history
Introducing Vite πŸš€ πŸš€
  • Loading branch information
ryancooley authored Jan 26, 2024
2 parents ba780ac + af561e1 commit 988a051
Show file tree
Hide file tree
Showing 16 changed files with 6,825 additions and 32,113 deletions.
5 changes: 0 additions & 5 deletions babel.config.js

This file was deleted.

12 changes: 12 additions & 0 deletions babel.config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"presets": [
[
"@babel/preset-env",
{
"targets": {
"node": "current"
}
}
]
]
}
File renamed without changes.
3 changes: 2 additions & 1 deletion public/index.html β†’ index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,15 @@
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
<link rel="icon" href="favicon.ico">
<title>vue-form-elements</title>
</head>
<body>
<noscript>
<strong>We're sorry but vue-form-elements doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
</noscript>
<div id="app"></div>
<script type="module" src="/src/main.js"></script>
<!-- built files will be auto injected -->
</body>
</html>
38,008 changes: 6,246 additions & 31,762 deletions package-lock.json

Large diffs are not rendered by default.

58 changes: 31 additions & 27 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,50 +3,57 @@
"version": "0.50.2",
"description": "Reusable VueJS Based Form Elements styled with Bootstrap 4",
"scripts": {
"dev": "vite",
"serve": "NODE_ENV=standalone vue-cli-service serve",
"build": "vue-cli-service build",
"build": "vite build",
"preview": "vite preview",
"bundle-analyzer": "vite-bundle-visualizer",
"test:unit": "vue-cli-service test:unit",
"lint": "vue-cli-service lint",
"build-bundle": "vue-cli-service build --target lib --name vue-form-elements ./src/components/index.js",
"build-bundle": "npm run build",
"build-watch": "vue-cli-service build --target lib --name vue-form-elements --watch ./src/components/index.js"
},
"main": "./dist/vue-form-elements.common.js",
"main": "./dist/vue-form-elements.umd.js",
"module": "./dist/vue-form-elements.es.js",
"exports": {
".": {
"import": "./dist/vue-form-elements.es.js",
"require": "./dist/vue-form-elements.umd.js"
},
"./dist/vue-form-elements.css": {
"import": "./dist/vue-form-elements.css",
"require": "./dist/vue-form-elements.css"
}
},
"files": [
"dist/*",
"src/*",
"public/*",
"*.json",
"*.js"
"src/*"
],
"dependencies": {
"@tinymce/tinymce-vue": "^2.0.0",
"@chantouchsek/validatorjs": "1.2.3",
"@tinymce/tinymce-vue": "2.0.0",
"bootstrap": "^4.5.3",
"bootstrap-vue": "^2.23.1",
"core-js": "^3.8.3",
"jquery": "^3.5.1",
"lodash": "^4.17.21",
"moment": "^2.29.1",
"moment-timezone": "^0.5.26",
"popper.js": "^1.14.4",
"sass": "^1.51.0",
"tinymce": "^5.10.0",
"v-calendar": "^0.9.7",
"validatorjs": "^3.22.1",
"tinymce": "5.10.0",
"vue": "^2.6.12",
"vue-date-pick": "^1.5.1",
"vue-uniq-ids": "^1.0.0",
"weekstart": "^1.0.0"
},
"devDependencies": {
"@babel/core": "^7.12.16",
"@babel/core": "^7.21.4",
"@babel/eslint-parser": "^7.12.16",
"@babel/preset-env": "^7.21.4",
"@panter/vue-i18next": "^0.15.0",
"@processmaker/vue-multiselect": "2.2.0",
"@types/jest": "^24.0.18",
"@vue/cli-plugin-babel": "~5.0.0",
"@vue/cli-plugin-eslint": "~5.0.0",
"@vue/cli-plugin-unit-jest": "~5.0.8",
"@vue/cli-service": "~5.0.8",
"@vue/eslint-config-airbnb": "^6.0.0",
"@vitejs/plugin-vue2": "^2.3.1",
"@vue/test-utils": "1.0.0-beta.29",
"@vue/vue2-jest": "^27.0.0-alpha.3",
"babel-core": "7.0.0-bridge.0",
Expand All @@ -62,7 +69,10 @@
"jest": "^27.1.0",
"mustache": "^3.0.1",
"prettier": "2.7.1",
"sass-loader": "^10.2.0",
"sass": "^1.62.0",
"vite": "^4.3.3",
"vite-bundle-visualizer": "^0.6.0",
"vite-plugin-commonjs": "^0.10.1",
"vue-template-compiler": "^2.6.12"
},
"peerDependencies": {
Expand Down Expand Up @@ -94,15 +104,9 @@
}
]
},
"postcss": {
"plugins": {
"autoprefixer": {}
}
},
"browserslist": [
"> 1%",
"last 2 versions",
"not ie <= 8"
"defaults",
"> 0.2% and not dead"
],
"bugs": {
"url": "https://github.com/processmaker/vue-form-elements/issues"
Expand Down
2 changes: 1 addition & 1 deletion src/components/FormDatePicker.vue
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ import { getUserDateFormat, getUserDateTimeFormat, getTimezone } from "../dateUt
import "vue-date-pick/dist/vueDatePick.css";
import RequiredAsterisk from './common/RequiredAsterisk';
const Validator = require("validatorjs");
import Validator from "@chantouchsek/validatorjs";
const uniqIdsMixin = createUniqIdsMixin();
const checkFormats = ["YYYY-MM-DD", "MM/DD/YYYY", moment.ISO_8601];
Expand Down
120 changes: 70 additions & 50 deletions src/components/index.js
Original file line number Diff line number Diff line change
@@ -1,58 +1,78 @@
// Import our components
import FormInput from "./FormInput.vue";
import FormCheckbox from "./FormCheckbox.vue";
import FormRadioButtonGroup from "./FormRadioButtonGroup.vue";
import FormSelect from "./FormSelect.vue";
import FormSelectList from "./FormSelectList.vue";
import FormTextArea from "./FormTextArea.vue";
import FormDatePicker from "./FormDatePicker.vue";
import FormAccordion from "./FormAccordion.vue";
import FormHtmlEditor from "./FormHtmlEditor.vue";
import FormHtmlViewer from "./FormHtmlViewer.vue";
import FormDelayTimeControl from "./FormDelayTimeControl.vue";
import FormMultiSelect from "./FormMultiSelect.vue";
import FormPlainMultiSelect from "./FormPlainMultiSelect.vue";
import RequiredAsterisk from "./common/RequiredAsterisk.vue";
import * as dateUtils from "../dateUtils";

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 };
import BFormComponent from "./FormBootstrapVueComponents/BFormComponent.vue";
import BWrapperComponent from "./FormBootstrapVueComponents/BWrapperComponent.vue";

// 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;
}

// Boolean flag to see if we're already installed
Vue._processMakerVueFormElementsInstalled = true;

// Register each of our components
const vueComponents = require.context("./", true, /\.(vue)$/);
// Export our components
let components = {
FormInput,
FormCheckbox,
FormRadioButtonGroup,
FormSelect,
FormSelectList,
FormTextArea,
FormDatePicker,
FormAccordion,
FormHtmlEditor,
FormHtmlViewer,
FormDelayTimeControl,
FormMultiSelect,
FormPlainMultiSelect,
RequiredAsterisk,
BFormComponent,
BWrapperComponent
};

vueComponents.keys().forEach((key) => {
const component = vueComponents(key).default;
// Export our named exports
export {
FormInput,
FormCheckbox,
FormRadioButtonGroup,
FormSelect,
FormSelectList,
FormTextArea,
FormDatePicker,
FormAccordion,
FormHtmlEditor,
FormHtmlViewer,
FormDelayTimeControl,
FormMultiSelect,
FormPlainMultiSelect,
dateUtils,
RequiredAsterisk,
BFormComponent,
BWrapperComponent
};

// 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(/\.[^/.]+$/, "");
// 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;
}

Vue.component(name, component);
});
}
// Boolean flag to see if we're already installed
Vue._processMakerVueFormElementsInstalled = true;

const plugin = {
install
// Register each of our components
for (let component in components) {
Vue.component(component, components[component]);
}
}
};

// Auto-install when vue is found (eg. in browser via <script> tag)
let GlobalVue = null;
if (typeof window !== "undefined") {
GlobalVue = window.Vue;
} else if (typeof global !== "undefined") {
GlobalVue = global.Vue;
}
if (GlobalVue) {
GlobalVue.use(plugin);
}
7 changes: 4 additions & 3 deletions src/components/mixins/DataFormat.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Validator from 'validatorjs';
import Validator from "@chantouchsek/validatorjs";
import moment from 'moment-timezone';
import { getUserDateFormat, getUserDateTimeFormat } from '../../dateUtils';

Expand All @@ -7,7 +7,7 @@ let globalObject = typeof window === 'undefined'
? global
: window;

if (globalObject.ProcessMaker && globalObject.ProcessMaker.user && globalObject.ProcessMaker.user.lang) {
if (globalObject.ProcessMaker?.user?.lang) {
Validator.useLang(globalObject.ProcessMaker.user.lang);
}

Expand All @@ -22,6 +22,7 @@ Validator.register('custom-datetime', function(date) {
}, 'The :attribute must be a valid date and time.');

export default {
name: "DataFormatMixin",
props: {
dataFormat: {
type: String,
Expand Down Expand Up @@ -88,7 +89,7 @@ export default {
return true;
}

this.dataTypeValidator = new Validator( {[this.name]: value}, {[this.name]: rules[this.dataFormat]}, null);
this.dataTypeValidator = new Validator( {[this.name]: value}, {[this.name]: rules[this.dataFormat]});
return this.dataTypeValidator.passes();
},
formatFloatValue() {
Expand Down
1 change: 1 addition & 0 deletions src/components/mixins/ProxyData.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ function findScreenOwner(control) {
}

export default {
name: "ProxyDataMixin",
methods: {
/**
* Create a proxy for an empty object in order to avoid unexpected refresh
Expand Down
1 change: 1 addition & 0 deletions src/components/mixins/hasDefaultOptionKey.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
export default {
name: 'hasDefaultOptionKeyMixin',
computed: {
valueOrDefault() {
return this.value || this.options.defaultOptionKey;
Expand Down
2 changes: 1 addition & 1 deletion src/components/mixins/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export { default as DataFormatMixin } from "./DataFormat";
export { default as HasDefaultOptionKeyMixin } from "./hasDefaultOptionKey";
export { default as hasDefaultOptionKeyMixin } from "./hasDefaultOptionKey";
export { default as ProxyDataMixin } from "./ProxyData";
export { default as ValidationMixin } from "./validation";
Loading

0 comments on commit 988a051

Please sign in to comment.