Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Devex/jsdoc migration #5601

Merged
merged 76 commits into from
May 16, 2024
Merged
Changes from 1 commit
Commits
Show all changes
76 commits
Select commit Hold shift + click to select a range
fa7bf41
wip: add linting jsdoc etc
brendanbond Apr 19, 2024
eef5b02
merge master and fix conflicts
brendanbond Apr 25, 2024
a7039a2
replace esdoc with jsdoc
brendanbond Apr 25, 2024
06404e8
remove esdoc config file
brendanbond Apr 25, 2024
1d1efe4
lint a bunch of files and add lint yarn script
brendanbond Apr 25, 2024
b2bb269
Adding esdocs to src/Element.js
travist Apr 25, 2024
5cff9ad
jsdoc for Providers.js
Apr 25, 2024
167d9b9
update webform jsdoc types
brendanbond Apr 25, 2024
ace3ef0
minor
brendanbond Apr 25, 2024
b4777bf
fix linting errors
brendanbond Apr 25, 2024
b33f306
update types for nested component
brendanbond Apr 25, 2024
913986b
breadCrumbSettings -> breadcrumbSettings at line 142
ryanformio Apr 25, 2024
24e2e10
breadCrumbSettings -> breadcrumbSettings at line 142, resolve conflicts
ryanformio Apr 25, 2024
002fbc3
update formio.form.js jsdoc
brendanbond Apr 25, 2024
d099ec7
Merge branch 'devex/jsdoc-migration' of github.com:formio/formio.js i…
brendanbond Apr 25, 2024
e94e31e
Adding some jsdocs to src/components/_classes/component/Component.js
travist Apr 25, 2024
3f81d9b
jsdoc for address provider base class and azure address
Apr 25, 2024
24298a6
Merge branch 'devex/jsdoc-migration' of https://github.com/formio/for…
Apr 25, 2024
a158cb8
one warning left at line 16, did not want to alter constructor logic …
ryanformio Apr 25, 2024
942c165
Merge branch 'devex/jsdoc-migration' of github.com:formio/formio.js i…
ryanformio Apr 25, 2024
818de22
address provider jsdoc
May 2, 2024
b3e19b6
Adding component class docs.
travist May 2, 2024
b8d7303
Merge branch 'devex/jsdoc-migration' of github.com:formio/formio.js i…
travist May 2, 2024
8d515f8
Working on utils eslint.
travist May 2, 2024
308aa2a
WIP: update jsdoc
brendanbond May 3, 2024
2a36250
update types to parent Form class; add builder options type
brendanbond May 6, 2024
1b5b070
minor update
brendanbond May 7, 2024
3982848
merge conflicts
brendanbond May 9, 2024
2c840c4
Re-export methods from @formio/core for the utils functions.
travist Apr 23, 2024
fcaf8bd
Re-adding findComponents.
travist Apr 23, 2024
f45dbd4
Merge remote-tracking branch 'refs/remotes/origin/devex/jsdoc-migrati…
brendanbond May 9, 2024
3e0998c
JSDoc: Field.js
edwinanciani May 9, 2024
17ce188
update formbuilder options; type listcomponent and child classes
brendanbond May 9, 2024
85da5ab
Merge remote-tracking branch 'refs/remotes/origin/devex/jsdoc-migrati…
brendanbond May 9, 2024
b7cf90f
type definitions for file providers
May 9, 2024
1cc96c1
Merge branch 'devex/jsdoc-migration' of https://github.com/formio/for…
May 9, 2024
c83a783
resolve FormBuilder eslint warnings
brendanbond May 9, 2024
2dc946e
Merge remote-tracking branch 'refs/remotes/origin/devex/jsdoc-migrati…
brendanbond May 9, 2024
fd4b5e0
fix password strength linting warnings and fileProcessor lints
brendanbond May 9, 2024
3e6a8fa
whoopsie - minor typo
brendanbond May 9, 2024
ee5fe59
Updated utils docs.
travist May 9, 2024
6f7c968
Merge branch 'devex/jsdoc-migration' of github.com:formio/formio.js i…
travist May 9, 2024
ded3f65
cleaned up lint errors
May 9, 2024
f6bc550
Merge branch 'devex/jsdoc-migration' of https://github.com/formio/for…
May 9, 2024
6358b85
jsDoc added to Multvalue.js
ryanformio May 9, 2024
688c6b5
JSDoc-Update: NestedComponent.js
edwinanciani May 9, 2024
8530c59
fix linter warnings for Input, ListComponent, and Multivalue
brendanbond May 9, 2024
124fa12
fix merge conflicts
brendanbond May 9, 2024
51c69c0
lint fixes for Form, CalendarWidget, ListComponent.form.js
brendanbond May 16, 2024
5622ef9
jsdoc updates for Well.form and ListComponent.form
brendanbond May 16, 2024
3d5120d
updates to edit forms for list, time, unknown, url, and well
brendanbond May 16, 2024
f48befa
Adding types to utils.
travist May 16, 2024
83e85fe
jsdoc updates to textfield and textfield.form
brendanbond May 16, 2024
4f5bde9
Fixing typedocs on edit forms.
travist May 16, 2024
a3cd395
use generic edit form function definition
brendanbond May 16, 2024
ee500d9
Merge branch 'devex/jsdoc-migration' of github.com:formio/formio.js i…
travist May 16, 2024
e406d73
Merge branch 'devex/jsdoc-migration' of github.com:formio/formio.js i…
travist May 16, 2024
b4b6cee
jsdoc updates to Tabs and TextArea
brendanbond May 16, 2024
a21a907
Merge remote-tracking branch 'refs/remotes/origin/devex/jsdoc-migrati…
brendanbond May 16, 2024
3dc0ec3
jsdoc updates to SelectBoxes, Select, Number, Hidden
brendanbond May 16, 2024
b39cc90
Adding lint for Form.
travist May 16, 2024
032580a
jsdoc updates to day and editgrid
brendanbond May 16, 2024
a3d2bbc
jsdoc updates to DataGrid
brendanbond May 16, 2024
a7285e3
Fixing lint for pdf, wizard, and webform builder.
travist May 16, 2024
c6ccf8f
Merge remote-tracking branch 'refs/remotes/origin/devex/jsdoc-migrati…
brendanbond May 16, 2024
a336380
Merge remote-tracking branch 'refs/remotes/origin/devex/jsdoc-migrati…
brendanbond May 16, 2024
2553eb8
address through currency
Dmeeks512 May 16, 2024
9bad491
Adding docs to edit forms in _classes.
travist May 16, 2024
0f43e6f
Updated componments.
travist May 16, 2024
28b4d38
jsdoc updates to nested form
brendanbond May 16, 2024
7923c4c
Merge remote-tracking branch 'refs/remotes/origin/devex/jsdoc-migrati…
brendanbond May 16, 2024
d9a09b1
Merge remote-tracking branch 'refs/remotes/origin/devex/jsdoc-migrati…
Dmeeks512 May 16, 2024
060c2cc
Merge remote-tracking branch 'refs/remotes/origin/devex/jsdoc-migrati…
Dmeeks512 May 16, 2024
4b4e59f
fix merge conflicts
brendanbond May 16, 2024
725be6c
delete accidental addition
brendanbond May 16, 2024
5548477
update package json script and lockfile
brendanbond May 16, 2024
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
Prev Previous commit
Next Next commit
WIP: update jsdoc
brendanbond committed May 3, 2024

Verified

This commit was signed with the committer’s verified signature.
commit 308aa2a353529415e75fd677a8b752d577f50726
13 changes: 0 additions & 13 deletions jsdoc.json

This file was deleted.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -34,7 +34,7 @@
"lint"
],
"scripts": {
"build": "yarn doc && yarn lib && yarn dist",
"build": "yarn lib && yarn dist",
"doc": "esdoc",
"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",
@@ -143,7 +143,6 @@
"gulp-sync": "^0.1.4",
"gulp-watch": "^5.0.1",
"hoek": "^6.1.3",
"jsdoc": "^4.0.2",
"jsdom": "22.1.0",
"jsdom-global": "^3.0.2",
"karma": "^6.4.3",
@@ -167,6 +166,7 @@
"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",
100 changes: 95 additions & 5 deletions src/Form.js
Original file line number Diff line number Diff line change
@@ -5,22 +5,110 @@ import templates from './templates';
import * as FormioUtils from './utils/utils';

export default class Form extends Element {
/**
* Represents a JSON value.
* @typedef {(string | number | boolean | null | JSONArray | JSONObject)} JSON
*/

/**
* Represents a JSON array.
* @typedef {Array<JSON>} JSONArray
*/

/**
* Represents a JSON object.
* @typedef {{[key: string]: JSON}} JSONObject
*/

/**
* @typedef {object} FormioHooks
* @property {Function} [beforeSubmit] - A function that is called before the form is submitted.
* @property {Function} [beforeCancel] - A function that is called before the form is canceled.
* @property {Function} [beforeNext] - A function that is called before moving to the next page in a multi-page form.
* @property {Function} [beforePrev] - A function that is called before moving to the previous page in a multi-page form.
* @property {Function} [attachComponent] - A function that is called when a component is attached to the form.
* @property {Function} [setDataValue] - A function that is called when setting the value of a data component.
* @property {Function} [addComponents] - A function that is called when adding multiple components to the form.
* @property {Function} [addComponent] - A function that is called when adding a single component to the form.
* @property {Function} [customValidation] - A function that is called for custom validation of the form.
* @property {Function} [attachWebform] - A function that is called when attaching a webform to the form.
*/

/**
* @typedef {object} SanitizeConfig
* @property {string[]} [addAttr] - The attributes to add.
* @property {string[]} [addTags] - The tags to add.
* @property {string[]} [allowedAttrs] - The allowed attributes.
* @property {string[]} [allowedTags] - The allowed tags.
* @property {string[]} [allowedUriRegex] - The allowed URI regex.
* @property {string[]} [addUriSafeAttr] - The URI safe attributes.
*/

/**
* @typedef {object} ButtonSettings
* @property {boolean} [showPrevious] - Show the "Previous" button.
* @property {boolean} [showNext] - Show the "Next" button.
* @property {boolean} [showCancel] - Show the "Cancel" button.
* @property {boolean} [showSubmit] - Show the "Submit" button.
*/

/**
* @typedef {object} FormOptions
* @property {boolean} [saveDraft] - Enable the save draft feature.
* @property {number} [saveDraftThrottle] - The throttle for the save draft feature.
* @property {boolean} [readOnly] - Set this form to readOnly.
* @property {boolean} [noAlerts] - Disable the alerts dialog.
* @property {{[key: string]: string}} [i18n] - The translation file for this rendering.
* @property {string} [template] - Custom logic for creation of elements.
* @property {boolean} [noDefaults] - Exclude default values from the settings.
* @property {any} [fileService] - The file service for this form.
* @property {EventEmitter} [events] - The EventEmitter for this form.
* @property {string} [language] - The language to render this form in.
* @property {Object<string, string>} [i18next] - The i18next configuration for this form.
* @property {boolean} [viewAsHtml] - View the form as raw HTML.
* @property {'form' | 'html' | 'flat' | 'builder' | 'pdf'} [renderMode] - The render mode for this form.
* @property {boolean} [highlightErrors] - Highlight any errors on the form.
* @property {string} [componentErrorClass] - The error class for components.
* @property {any} [templates] - The templates for this form.
* @property {string} [iconset] - The iconset for this form.
* @property {import('@formio/core').Component[]} [components] - The components for this form.
* @property {{[key: string]: boolean}} [disabled] - Disabled components for this form.
* @property {boolean} [showHiddenFields] - Show hidden fields.
* @property {{[key: string]: boolean}} [hide] - Hidden components for this form.
* @property {{[key: string]: boolean}} [show] - Components to show for this form.
* @property {Formio} [formio] - The Formio instance for this form.
* @property {string} [decimalSeparator] - The decimal separator for this form.
* @property {string} [thousandsSeparator] - The thousands separator for this form.
* @property {FormioHooks} [hooks] - The hooks for this form.
* @property {boolean} [alwaysDirty] - Always be dirty.
* @property {boolean} [skipDraftRestore] - Skip restoring a draft.
* @property {'form' | 'wizard' | 'pdf'} [display] - The display for this form.
* @property {string} [cdnUrl] - The CDN url for this form.
* @property {boolean} [flatten] - Flatten the form.
* @property {boolean} [sanitize] - Sanitize the form.
* @property {SanitizeConfig} [sanitizeConfig] - The sanitize configuration for this form.
* @property {ButtonSettings} [buttonSettings] - The button settings for this form.
* @property {object} [breadcrumbSettings] - The breadcrumb settings for this form.
* @property {boolean} [allowPrevious] - Allow the previous button (for Wizard forms).
* @property {string[]} [wizardButtonOrder] - The order of the buttons (for Wizard forms).
* @property {boolean} [showCheckboxBackground] - Show the checkbox background.
* @property {number} [zoom] - The zoom for PDF forms.
*/

/**
* Creates an easy to use interface for embedding webforms, pdfs, and wizards into your application.
* @param {object} element - The DOM element you wish to render this form within.
* @param {object | string} form - Either a Form JSON schema or the URL of a hosted form via. form.io.
* @param {object} options - The options to create a new form instance.
* @param {object | string} elementOrForm - The DOM element you wish to render this form within OR the Form JSON Schema or URL of a form.io hosted form.
* @param {object} formOrOptions - The options to create a new form instance.
* @param {boolean} options.readOnly - Set this form to readOnly
* @param {boolean} options.noAlerts - Set to true to disable the alerts dialog.
* @param {boolean} options.i18n - The translation file for this rendering. @see https://github.com/formio/formio.js/blob/master/i18n.js
* @param {boolean} options.template - Provides a way to inject custom logic into the creation of every element rendered within the form.
* @param {...any} args
* @example
* import Form from '@formio/js/Form';
* const form = new Form(document.getElementById('formio'), 'https://examples.form.io/example');
* form.build();
*/
constructor(...args) {
constructor(elementOrForm, formOrOptions, options) {
let options = args[0] instanceof HTMLElement ? args[2] : args[1];
if (Formio.options && Formio.options.form) {
options = Object.assign(options, Formio.options.form);
@@ -407,3 +495,5 @@ Formio.createForm = (...args) => {
};

Formio.Form = Form;

export { FormOptions };
95 changes: 3 additions & 92 deletions src/Webform.js
Original file line number Diff line number Diff line change
@@ -57,109 +57,20 @@ function getOptions(options) {
return options;
}

/**
* Represents a JSON value.
* @typedef {(string | number | boolean | null | JSONArray | JSONObject)} JSON
*/

/**
* Represents a JSON array.
* @typedef {Array<JSON>} JSONArray
*/

/**
* Represents a JSON object.
* @typedef {{[key: string]: JSON}} JSONObject
*/

/**
* @typedef {object} FormioHooks
* @property {Function} [beforeSubmit] - A function that is called before the form is submitted.
* @property {Function} [beforeCancel] - A function that is called before the form is canceled.
* @property {Function} [beforeNext] - A function that is called before moving to the next page in a multi-page form.
* @property {Function} [beforePrev] - A function that is called before moving to the previous page in a multi-page form.
* @property {Function} [attachComponent] - A function that is called when a component is attached to the form.
* @property {Function} [setDataValue] - A function that is called when setting the value of a data component.
* @property {Function} [addComponents] - A function that is called when adding multiple components to the form.
* @property {Function} [addComponent] - A function that is called when adding a single component to the form.
* @property {Function} [customValidation] - A function that is called for custom validation of the form.
* @property {Function} [attachWebform] - A function that is called when attaching a webform to the form.
*/

/**
* @typedef {object} SanitizeConfig
* @property {string[]} [addAttr] - The attributes to add.
* @property {string[]} [addTags] - The tags to add.
* @property {string[]} [allowedAttrs] - The allowed attributes.
* @property {string[]} [allowedTags] - The allowed tags.
* @property {string[]} [allowedUriRegex] - The allowed URI regex.
* @property {string[]} [addUriSafeAttr] - The URI safe attributes.
*/

/**
* @typedef {object} ButtonSettings
* @property {boolean} [showPrevious] - Show the "Previous" button.
* @property {boolean} [showNext] - Show the "Next" button.
* @property {boolean} [showCancel] - Show the "Cancel" button.
* @property {boolean} [showSubmit] - Show the "Submit" button.
*/

/**
* @typedef {object} FormOptions
* @property {boolean} [saveDraft] - Enable the save draft feature.
* @property {number} [saveDraftThrottle] - The throttle for the save draft feature.
* @property {boolean} [readOnly] - Set this form to readOnly.
* @property {boolean} [noAlerts] - Disable the alerts dialog.
* @property {{[key: string]: string}} [i18n] - The translation file for this rendering.
* @property {string} [template] - Custom logic for creation of elements.
* @property {boolean} [noDefaults] - Exclude default values from the settings.
* @property {any} [fileService] - The file service for this form.
* @property {EventEmitter} [events] - The EventEmitter for this form.
* @property {string} [language] - The language to render this form in.
* @property {{[key: string]: string}} [i18next] - The i18next configuration for this form.
* @property {boolean} [viewAsHtml] - View the form as raw HTML.
* @property {'form' | 'html' | 'flat' | 'builder' | 'pdf'} [renderMode] - The render mode for this form.
* @property {boolean} [highlightErrors] - Highlight any errors on the form.
* @property {string} [componentErrorClass] - The error class for components.
* @property {any} [templates] - The templates for this form.
* @property {string} [iconset] - The iconset for this form.
* @property {import('@formio/core').Component[]} [components] - The components for this form.
* @property {{[key: string]: boolean}} [disabled] - Disabled components for this form.
* @property {boolean} [showHiddenFields] - Show hidden fields.
* @property {{[key: string]: boolean}} [hide] - Hidden components for this form.
* @property {{[key: string]: boolean}} [show] - Components to show for this form.
* @property {Formio} [formio] - The Formio instance for this form.
* @property {string} [decimalSeparator] - The decimal separator for this form.
* @property {string} [thousandsSeparator] - The thousands separator for this form.
* @property {FormioHooks} [hooks] - The hooks for this form.
* @property {boolean} [alwaysDirty] - Always be dirty.
* @property {boolean} [skipDraftRestore] - Skip restoring a draft.
* @property {'form' | 'wizard' | 'pdf'} [display] - The display for this form.
* @property {string} [cdnUrl] - The CDN url for this form.
* @property {boolean} [flatten] - Flatten the form.
* @property {boolean} [sanitize] - Sanitize the form.
* @property {SanitizeConfig} [sanitizeConfig] - The sanitize configuration for this form.
* @property {ButtonSettings} [buttonSettings] - The button settings for this form.
* @property {object} [breadcrumbSettings] - The breadcrumb settings for this form.
* @property {boolean} [allowPrevious] - Allow the previous button (for Wizard forms).
* @property {string[]} [wizardButtonOrder] - The order of the buttons (for Wizard forms).
* @property {boolean} [showCheckboxBackground] - Show the checkbox background.
* @property {number} [zoom] - The zoom for PDF forms.
*/

/**
* Renders a Form.io form within the webpage.
*/
export default class Webform extends NestedDataComponent {
/**
* @type {FormOptions} - the options for this Webform.
* @type {import('Form').FormOptions} - the options for this Webform.
*/
options;

/**
* Creates a new Form instance.
* @param {HTMLElement | object | FormOptions} [elementOrOptions] - The DOM element to render this form within or the options to create this form instance.
* @param {FormOptions} [options] - The options to create a new form instance.
* @param {HTMLElement | object | import('Form').FormOptions} [elementOrOptions] - The DOM element to render this form within or the options to create this form instance.
* @param {import('Form').FormOptions} [options] - The options to create a new form instance.
*/
constructor(elementOrOptions, options) {
let element, formOptions;
Loading