Skip to content

Commit

Permalink
Merge branch 'master' into FIO-8496-Google-Maps-JavaScript-API-has-be…
Browse files Browse the repository at this point in the history
…en-loaded-directly-without-loading=async
  • Loading branch information
KatrinKhilko authored Jun 20, 2024
2 parents a930364 + 0b97298 commit ebc09cb
Show file tree
Hide file tree
Showing 172 changed files with 4,712 additions and 5,088 deletions.
8 changes: 0 additions & 8 deletions .esdoc.json

This file was deleted.

10 changes: 10 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
node_modules
lib
dist
app
test
types
*.spec.js
*.unit.js
_site
docs
17 changes: 17 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
module.exports = {
"env": {
"browser": true,
"es2021": true,
"node": true
},
"extends": ["eslint:recommended", "plugin:jsdoc/recommended-typescript-flavor"],
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module"
},
"plugins": ["jsdoc"],
"rules": {
"no-prototype-builtins": "off",
"no-unused-vars": ["error", { "argsIgnorePattern": "^_" }],
}
}
38 changes: 0 additions & 38 deletions .eslintrc.json

This file was deleted.

38 changes: 38 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,48 @@ import bootstrap4 from '@formio/bootstrap/bootstrap4';
Formio.use(bootstrap4);
```

It should also be noted, that the Bootstrap templates are no longer part of this library, but rather imported in from the external dependency and bundled along with this library. Because of this, if you wish to make a change to the default Bootstrap template, you will need to make that pull request at the Github repo @ https://github.com/formio/bootstrap

This is a **Breaking Change** so please see the section below for more information about this change.

#### New Validation Engine
The 5.x renderer incorporates our new Core validation engine found @ https://github.com/formio/core/tree/master/src/process. This process can be briefly described within the pull request notes @ https://github.com/formio/formio.js/pull/5317. This will also improve our Iso-morphic behavior for our renderer validation and significantly improve memory and processor consumption for server-side form validations. This feature does have a **Breaking Change** which is described below.

#### Core SDK
With the 5.x renderer, the Formio SDK is now part of our Core library found @ https://github.com/formio/core/tree/master/src/sdk. It is now imported directly into the @formio/js library and is re-exported to support reverse compatability. Because of this, there should not be any code upgrade involved.

For example, the following code still works.

```js
import { Formio } from '@formio/js/sdk';
const formio = new Formio('https://examples.form.io');
formio.loadForm().then((form) => {
console.log(form);
});
```

#### Core Utilities
Now, instead of the Form Utilities being defined within the renderer code, they are now maintained within our Core library found @ https://github.com/formio/core/tree/master/src/utils. These libraries, however, are re-exported from the renderer to maintain reverse compatability. For example, the following code still works.

```js
import { eachComponent } from '@formio/js/utils';
import { Formio } from '@formio/js/sdk';
const formio = new Formio('https://examples.form.io/example');
formio.loadForm().then((form) => {
eachComponent(form.components, (component) => {
// Called for every component in this form.
console.log(component);
});
});
```

#### Improved type definitions with JSDoc
5.x officially deprecates our previous "manual" type definitions found in the "types" folder. These type definitions are now automatically generated using an concerted effort to introduce JSDocs into all of our javascript classes and interfaces. The types can be imported using the following.

```js
import { Component } from '@formio/js/types';
```

#### Improved render build sizes
With the 5.x version of the renderer/builder, there has been much effort into reducing the size of the build for the renderer. While the full renderer is still "large" and over the 1mb goal, we still have been able to trim a lot of size from the renderer/builder as follows.

Expand Down Expand Up @@ -261,6 +298,7 @@ Formio.createForm(document.getElementById('formio'), 'https://examples.form.io/e
- made Formio available globally
- FIO-8027 added new Captcha provider
- FIO-8281: fixed selectData property for multiple select component
- FIO-8420: file component no defaults causes error

## 5.0.0-rc.37
### Fixed
Expand Down
2 changes: 1 addition & 1 deletion embed.d.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export * from './types/Embed';
export * from './lib/cjs/InlineEmbed';
1 change: 1 addition & 0 deletions form.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './lib/cjs/formio.form';
9 changes: 0 additions & 9 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ const concat = require('gulp-concat');
const replace = require('gulp-replace');
const rename = require('gulp-rename');
const cleanCSS = require('gulp-clean-css');
const eslint = require('gulp-eslint');
const clean = require('gulp-clean');

// Clean lib folder.
Expand All @@ -18,14 +17,6 @@ gulp.task('clean:lib', () => {
});
gulp.task('clean', gulp.parallel('clean:dist', 'clean:lib'));

// ESLint
gulp.task('eslint', function eslintTask() {
return gulp.src(['./src/**/*.js', '!./src/**/*.spec.js'])
.pipe(eslint())
.pipe(eslint.format())
.pipe(eslint.failAfterError());
});

// Move font-awesome fonts into dist folder.
gulp.task('builder-fonts', function builderFonts() {
return gulp.src('./node_modules/bootstrap-icons/font/fonts/*').pipe(gulp.dest('dist/fonts'));
Expand Down
44 changes: 22 additions & 22 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@formio/js",
"version": "5.0.0-rc.43",
"version": "5.0.0-rc.59",
"description": "JavaScript powered Forms with JSON Form Builder",
"main": "lib/cjs/index.js",
"exports": {
Expand All @@ -21,21 +21,25 @@
"require": "./lib/cjs/formio.form.js"
},
"./embed": {
"import": "./lib/cjs/Embed.js",
"require": "./lib/cjs/Embed.js"
"import": "./lib/cjs/InlineEmbed.js",
"require": "./lib/cjs/InlineEmbed.js"
},
"./dist/*": "./dist/*"
},
"files": [
"dist",
"lib"
"lib",
"embed.d.ts",
"form.d.ts",
"sdk.d.ts",
"utils.d.ts"
],
"pre-commit": [
"lint"
],
"scripts": {
"build": "yarn doc && yarn lib && yarn dist",
"doc": "esdoc",
"doc": "typedoc",
"dist": "gulp clean:dist && webpack --config webpack.config.js && webpack --config webpack.prod.js && gulp build",
"lib": "gulp clean:lib && tsc --project tsconfig.cjs.json && tsc --project tsconfig.mjs.json && yarn lib:package",
"lib:package": "node ./libpackage.js",
Expand All @@ -50,7 +54,7 @@
"release": "yarn build-app && yarn deploy-s3",
"tag": "VERSION=$(yarn version);git add -A; git commit -m \"Build $Version\";git push origin master;git tag v$VERSION;git push origin --tags;",
"dopublish": "npm run build && npm run tag && npm publish",
"lint": "gulp eslint",
"lint": "eslint ./src --fix",
"serve": "jekyll serve --config _config.yml,_config.dev.yml",
"test": "mocha 'src/**/*.unit.js'",
"test:updateRenders": "npm run lib && TZ=UTC node --require jsdom-global/register test/updateRenders.js",
Expand All @@ -75,9 +79,9 @@
},
"homepage": "https://github.com/formio/formio.js#readme",
"dependencies": {
"@formio/bootstrap": "^3.0.0-rc.22",
"@formio/bootstrap": "3.0.0-dev.98.17ba6ea",
"@formio/choices.js": "^10.2.1",
"@formio/core": "2.0.0-dev.102.df37631",
"@formio/core": "2.1.0-dev.104.42720ba",
"@formio/text-mask-addons": "^3.8.0-formio.2",
"@formio/vanilla-text-mask": "^5.1.1-formio.1",
"abortcontroller-polyfill": "^1.7.5",
Expand All @@ -86,10 +90,10 @@
"browser-cookies": "^1.2.0",
"browser-md5-file": "^1.1.1",
"compare-versions": "^6.0.0-rc.2",
"core-js": "^3.37.0",
"core-js": "^3.37.1",
"dialog-polyfill": "^0.5.6",
"dom-autoscroller": "^2.3.4",
"dompurify": "^3.1.1",
"dompurify": "^3.1.3",
"downloadjs": "^1.4.7",
"dragula": "^3.7.3",
"eventemitter3": "^5.0.1",
Expand All @@ -105,17 +109,17 @@
"lodash": "^4.17.21",
"moment": "^2.29.4",
"moment-timezone": "^0.5.44",
"quill": "^2.0.0-rc.4",
"quill": "^2.0.2",
"signature_pad": "^4.2.0",
"string-hash": "^1.1.3",
"tippy.js": "^6.3.7",
"uuid": "^9.0.0",
"vanilla-picker": "^2.12.3"
},
"devDependencies": {
"@typescript-eslint/eslint-plugin": "^7.6.0",
"@typescript-eslint/parser": "^7.6.0",
"ace-builds": "1.33.0",
"@typescript-eslint/eslint-plugin": "^7.9.0",
"@typescript-eslint/parser": "^7.9.0",
"ace-builds": "1.34.2",
"async-limiter": "^2.0.0",
"bootstrap-icons": "^1.10.5",
"bootswatch": "^5.3.3",
Expand All @@ -124,11 +128,8 @@
"chance": "^1.1.9",
"ejs-loader": "^0.5.0",
"escape-string-regexp": "^5.0.0",
"esdoc": "^1.1.0",
"esdoc-ecmascript-proposal-plugin": "^1.0.0",
"esdoc-standard-plugin": "^1.0.0",
"eslint": "^8.57.0",
"eslint-config-formio": "^1.1.4",
"eslint-plugin-jsdoc": "^48.2.5",
"fetch-mock": "^9.11.0",
"file-loader": "^6.2.0",
"flatpickr": "^4.6.13",
Expand All @@ -137,7 +138,6 @@
"gulp-clean": "^0.4.0",
"gulp-clean-css": "^4.3.0",
"gulp-concat": "^2.6.1",
"gulp-eslint": "^6.0.0",
"gulp-filter": "^7.0.0",
"gulp-rename": "^2.0.0",
"gulp-replace": "^1.1.3",
Expand All @@ -161,19 +161,19 @@
"pretty": "^2.0.0",
"pygments-css": "^1.0.0",
"raw-loader": "^4.0.2",
"sass": "^1.74.1",
"sass": "^1.77.1",
"shortcut-buttons-flatpickr": "^0.4.0",
"sinon": "^17.0.1",
"string-replace-loader": "^3.1.0",
"ts-loader": "^9.4.4",
"ts-node": "^10.9.1",
"tsc": "^2.0.4",
"typedoc": "^0.25.13",
"typescript": "5.3.2",
"webpack": "^5.90.3",
"webpack-bundle-analyzer": "^4.10.2",
"webpack-cli": "^5.1.1",
"webpack-node-externals": "^3.0.0",
"webpack-stream": "^7.0.0",
"written-number": "^0.11.1"
"webpack-stream": "^7.0.0"
}
}
1 change: 1 addition & 0 deletions sdk.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './lib/cjs/Formio';
11 changes: 8 additions & 3 deletions src/CDN.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@ class CDN {
this.libs = {
'js': '',
'ace': '1.4.12',
'bootstrap': '5.3.2',
'bootstrap': '5.3.3',
'bootstrap4': '4.6.2',
'bootstrap5': '5.3.2',
'bootstrap5': '5.3.3',
'bootswatch': '5.3.3',
'bootstrap-icons': '1.11.1',
'ckeditor': '19.0.0',
'flatpickr': '4.6.8',
Expand Down Expand Up @@ -67,7 +68,11 @@ class CDN {
if (lib) {
url += `/${lib}`;
}
if (version && version !== 'latest') {
// Only attach the version if this is the hosted cdn.
if (
cdnUrl.includes('form.io') &&
version && version !== 'latest'
) {
url += `/${version}`;
}
return url;
Expand Down
Loading

0 comments on commit ebc09cb

Please sign in to comment.