@mutt/forms
Advanced tools
Comparing version 2.2.1 to 2.3.0
{ | ||
"name": "@mutt/forms", | ||
"version": "2.2.1", | ||
"version": "2.3.0", | ||
"license": "MIT", | ||
@@ -9,24 +9,2 @@ "author": { | ||
}, | ||
"contributors": [ | ||
{ | ||
"name": "Nick Snell", | ||
"email": "nick@boughtbymany.com" | ||
}, | ||
{ | ||
"name": "Richard Roth", | ||
"email": "richard@boughtbymany.com" | ||
}, | ||
{ | ||
"name": "Alex Russell", | ||
"email": "me@alexrussell.me.uk" | ||
}, | ||
{ | ||
"name": "Jack Prior", | ||
"email": "jack@boughtbymany.com" | ||
}, | ||
{ | ||
"name": "Andy Pattenden", | ||
"email": "andyp@boughtbymany.com" | ||
} | ||
], | ||
"main": "src/index.js", | ||
@@ -59,19 +37,18 @@ "module": "dist/mutt-forms.es.js", | ||
"devDependencies": { | ||
"babel-core": "^6.26.3", | ||
"babel-eslint": "^10.0.1", | ||
"babel-jest": "^23.6.0", | ||
"babel-plugin-external-helpers": "^6.22.0", | ||
"babel-polyfill": "^6.26.0", | ||
"babel-preset-env": "^1.7.0", | ||
"eslint": "^5.6.1", | ||
"eslint-config-prettier": "^3.3.0", | ||
"eslint-plugin-prettier": "^3.0.0", | ||
"jest": "^23.6.0", | ||
"jsdoc": "^3.4.3", | ||
"@babel/cli": "^7.8.4", | ||
"@babel/core": "^7.8.4", | ||
"@babel/preset-env": "^7.8.4", | ||
"@rollup/plugin-json": "^4.0.2", | ||
"@rollup/plugin-node-resolve": "^7.1.1", | ||
"babel-eslint": "^8.2.6", | ||
"eslint": "^6.8.0", | ||
"eslint-config-prettier": "^6.10.0", | ||
"eslint-plugin-prettier": "^3.1.2", | ||
"jest": "^25.1.0", | ||
"jsdoc": "^3.6.3", | ||
"prettier": "^1.15.2", | ||
"rollup": "^0.57.1", | ||
"rollup-plugin-babel": "^3.0.3", | ||
"rollup-plugin-json": "^4.0.0", | ||
"rollup-plugin-node-resolve": "^3.3.0", | ||
"rollup-plugin-uglify": "^3.0.0" | ||
"release-it": "^12.4.3", | ||
"rollup": "^1.31.0", | ||
"rollup-plugin-babel": "^4.3.3", | ||
"rollup-plugin-terser": "^5.2.0" | ||
}, | ||
@@ -83,3 +60,4 @@ "scripts": { | ||
"lint:fix": "eslint . --fix", | ||
"prepublish": "npm run build" | ||
"prepublish": "npm run build", | ||
"release": "release-it" | ||
}, | ||
@@ -86,0 +64,0 @@ "prettier": { |
@@ -28,7 +28,3 @@ <img src="https://raw.githubusercontent.com/mutt-forms/mutt-forms/master/docs/mutt.svg?sanitize=true" alt="Mutt" width="275"> | ||
or | ||
`yarn add @mutt/forms` | ||
### Getting Started | ||
@@ -67,2 +63,2 @@ | ||
(c) Bought By Many 2019. Credit to Helena Long for the Mutt Logo :) | ||
(c) Bought By Many 2020. Credit to Helena Long for the Mutt Logo :) |
@@ -52,3 +52,2 @@ /** | ||
this.sortOrder = order | ||
this.locked = false | ||
this.parent = parent | ||
@@ -185,30 +184,2 @@ | ||
/** | ||
* Turn the field from an editable elment to a readonly one | ||
*/ | ||
lock() { | ||
if (this.locked) { | ||
return false | ||
} | ||
this.widget.lock() | ||
this.locked = true | ||
return true | ||
} | ||
/* | ||
* Restore a field from a locked state | ||
*/ | ||
unlock() { | ||
if (!this.locked) { | ||
return false | ||
} | ||
this.widget.unlock() | ||
this.locked = false | ||
return true | ||
} | ||
/** | ||
* Refresh the validation state | ||
@@ -215,0 +186,0 @@ */ |
@@ -170,20 +170,2 @@ /** | ||
/** | ||
* Lock all of the fields in the fieldset | ||
*/ | ||
lock() { | ||
for (const field of this.fields) { | ||
field.lock() | ||
} | ||
} | ||
/** | ||
* Unlock all the fields in the fieldset | ||
*/ | ||
unlock() { | ||
for (const field of this.fields) { | ||
field.unlock() | ||
} | ||
} | ||
/** | ||
* Get a field in the form by it's path. Paths should be | ||
@@ -190,0 +172,0 @@ * provided in 'dot' notation - i.e "some.example.path" |
@@ -36,3 +36,2 @@ /** | ||
this.id = null | ||
this.locked = false | ||
@@ -316,25 +315,2 @@ this.form = null | ||
/** | ||
* Lock a form, this changes all of the fields to a read only state | ||
*/ | ||
lock() { | ||
Mutt.logger("Locking form") | ||
for (let fieldset of this.fieldsets) { | ||
fieldset.lock() | ||
} | ||
} | ||
/** | ||
* Unlock a form, this can be used to restore a locked form to it's | ||
* editable state | ||
*/ | ||
unlock() { | ||
Mutt.log("Unlocking form") | ||
for (let fieldset of this.fieldsets) { | ||
fieldset.unlock() | ||
} | ||
} | ||
/** | ||
* Set the callback for the submission | ||
@@ -341,0 +317,0 @@ * @param {function} callback Callback function for form submission |
@@ -43,3 +43,2 @@ /** | ||
this.value = initial | ||
this.locked = false | ||
this.errors = [] | ||
@@ -107,46 +106,2 @@ } | ||
/** | ||
* Lock the widget - this places it in a read only state | ||
* @returns {bool} returns true if lock is successful, false otherwise | ||
*/ | ||
lock() { | ||
if (this.locked) { | ||
return false | ||
} | ||
let wrapper = this.getElementWrapper() | ||
let element = this.getElement() | ||
// Clear the existing field... | ||
wrapper.removeChild(element) | ||
this.locked = true | ||
return true | ||
} | ||
/** | ||
* Unlock the widget - this removes any previous lock and returns | ||
* it to it's default state. | ||
* @returns {bool} returns true if unlock is successful, false otherwise | ||
*/ | ||
unlock() { | ||
if (!this.locked) { | ||
return false | ||
} | ||
let wrapper = this.getElementWrapper() | ||
let element = this.getElement() | ||
// Clear the display field | ||
wrapper.removeChild(element) | ||
let field = this.renderField() | ||
wrapper.appendChild(field) | ||
this.locked = false | ||
return true | ||
} | ||
/** | ||
* Update the ID of the wrapper element | ||
@@ -153,0 +108,0 @@ */ |
@@ -26,3 +26,6 @@ /** | ||
} else { | ||
this.choices = [[true, "Yes"], [false, "No"]] | ||
this.choices = [ | ||
[true, "Yes"], | ||
[false, "No"] | ||
] | ||
} | ||
@@ -29,0 +32,0 @@ } |
@@ -189,3 +189,3 @@ /** | ||
* DisplayWidget - Display only widget, this just shows the field as | ||
* plain text. Typically used by the lock form utility. | ||
* plain text. | ||
*/ | ||
@@ -192,0 +192,0 @@ export function displayReadonlyValue(value) { |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
16
289533
4484
63