Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: formio/react
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: master
Choose a base ref
...
head repository: Casecommons/react-formio
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
Can’t automatically merge. Don’t worry, you can still create the pull request.

Commits on Jan 23, 2020

  1. updates

    luisDPM committed Jan 23, 2020
    Copy the full SHA
    75535dd View commit details

Commits on Jan 24, 2020

  1. using forked formiojs

    luisDPM committed Jan 24, 2020
    Copy the full SHA
    82cf121 View commit details
  2. adding lib folder

    luisDPM committed Jan 24, 2020
    Copy the full SHA
    841e909 View commit details

Commits on Apr 27, 2020

  1. updating dependencies

    LuisPadillaM committed Apr 27, 2020
    Copy the full SHA
    b5c29ab View commit details
  2. Merge pull request #1 from Casecommons/ldpm_react-formio_updates

    updating dependencies
    ldpmcasebook authored Apr 27, 2020
    Copy the full SHA
    1aa2c56 View commit details

Commits on May 14, 2020

  1. use updated formiojs

    realbisoye committed May 14, 2020
    Copy the full SHA
    024acbd View commit details
  2. Merge pull request #2 from Casecommons/update-formiojs

    use updated formiojs
    realbisoye authored May 14, 2020
    Copy the full SHA
    4ea5265 View commit details

Commits on Jul 23, 2020

  1. Copy the full SHA
    5fd6f04 View commit details
  2. updating package-lock

    ldpmcasebook committed Jul 23, 2020
    Copy the full SHA
    5ac15ac View commit details
  3. updating lock file

    ldpmcasebook committed Jul 23, 2020
    Copy the full SHA
    4ca3bd8 View commit details
  4. updates

    ldpmcasebook committed Jul 23, 2020
    Copy the full SHA
    3ed6998 View commit details

Commits on Oct 27, 2020

  1. Copy the full SHA
    ff65cd2 View commit details
  2. updating library

    ldpmcasebook committed Oct 27, 2020
    Copy the full SHA
    f08e29e View commit details
  3. Merge pull request #3 from Casecommons/ldpm_formio_library_updates

    Ldpm formio library updates
    ldpmcasebook authored Oct 27, 2020
    Copy the full SHA
    5c94f3a View commit details
  4. Copy the full SHA
    5000de9 View commit details
  5. Merge pull request #4 from Casecommons/revert-3-ldpm_formio_library_u…

    …pdates
    
    Revert "Ldpm formio library updates"
    ldpmcasebook authored Oct 27, 2020
    Copy the full SHA
    dd2ebd6 View commit details

Commits on Oct 28, 2020

  1. Copy the full SHA
    704d0c2 View commit details
  2. Copy the full SHA
    5d47c80 View commit details
  3. merging with master

    ldpmcasebook committed Oct 28, 2020
    Copy the full SHA
    86f655d View commit details
  4. Merge pull request #5 from Casecommons/ldpm_formio_to_v4.3.0

    Ldpm formio to v4.3.0
    ldpmcasebook authored Oct 28, 2020
    Copy the full SHA
    c671c36 View commit details
  5. Copy the full SHA
    1daa586 View commit details
  6. Merge pull request #6 from Casecommons/ldpm_formio_to_v4.3.0

    resolving missing conflict
    ldpmcasebook authored Oct 28, 2020
    Copy the full SHA
    e69702c View commit details
  7. Copy the full SHA
    443700c View commit details
  8. Merge pull request #7 from Casecommons/ldpm_formio_to_v4.3.0

    updating package.json and regenerating package-lock
    ldpmcasebook authored Oct 28, 2020
    Copy the full SHA
    bac81b7 View commit details

Commits on Jan 29, 2021

  1. updating formiojs

    ldpmcasebook committed Jan 29, 2021
    Copy the full SHA
    301cb92 View commit details
  2. Merge pull request #8 from Casecommons/feature/ldpm_176015136_formio_…

    …conditional_display
    
    updating formiojs
    ldpmcasebook authored Jan 29, 2021
    Copy the full SHA
    5f7e784 View commit details
Showing with 7,823 additions and 4,877 deletions.
  1. +0 −1 .gitignore
  2. +0 −21 Changelog.md
  3. +1 −2 README.md
  4. +125 −0 lib/components/Errors.js
  5. +215 −0 lib/components/Form.js
  6. +150 −0 lib/components/FormBuilder.js
  7. +333 −0 lib/components/FormEdit.js
  8. +291 −0 lib/components/FormGrid.js
  9. +332 −0 lib/components/Grid.js
  10. +182 −0 lib/components/Pagination.js
  11. +236 −0 lib/components/ReactComponent.js
  12. +260 −0 lib/components/SubmissionGrid.js
  13. +79 −0 lib/components/index.js
  14. +10 −0 lib/constants.js
  15. +118 −0 lib/index.js
  16. +145 −0 lib/modules/auth/actions.js
  17. +13 −0 lib/modules/auth/constants.js
  18. +53 −0 lib/modules/auth/index.js
  19. +103 −0 lib/modules/auth/reducers.js
  20. +6 −0 lib/modules/auth/selectors.js
  21. +132 −0 lib/modules/form/actions.js
  22. +11 −0 lib/modules/form/constants.js
  23. +53 −0 lib/modules/form/index.js
  24. +72 −0 lib/modules/form/reducers.js
  25. +12 −0 lib/modules/form/selectors.js
  26. +105 −0 lib/modules/forms/actions.js
  27. +9 −0 lib/modules/forms/constants.js
  28. +53 −0 lib/modules/forms/index.js
  29. +92 −0 lib/modules/forms/reducers.js
  30. +12 −0 lib/modules/forms/selectors.js
  31. +77 −0 lib/modules/index.js
  32. +17 −0 lib/modules/root/index.js
  33. +14 −0 lib/modules/root/selectors.js
  34. +124 −0 lib/modules/submission/actions.js
  35. +11 −0 lib/modules/submission/constants.js
  36. +53 −0 lib/modules/submission/index.js
  37. +76 −0 lib/modules/submission/reducers.js
  38. +12 −0 lib/modules/submission/selectors.js
  39. +107 −0 lib/modules/submissions/actions.js
  40. +9 −0 lib/modules/submissions/constants.js
  41. +53 −0 lib/modules/submissions/index.js
  42. +94 −0 lib/modules/submissions/reducers.js
  43. +12 −0 lib/modules/submissions/selectors.js
  44. +41 −0 lib/types.js
  45. +65 −0 lib/utils.js
  46. +3,026 −4,016 package-lock.json
  47. +5 −6 package.json
  48. +25 −27 src/components/Errors.jsx
  49. +106 −99 src/components/Form.jsx
  50. +74 −64 src/components/FormBuilder.jsx
  51. +160 −140 src/components/FormEdit.jsx
  52. +172 −189 src/components/FormGrid.jsx
  53. +134 −142 src/components/Grid.jsx
  54. +9 −6 src/components/Pagination.jsx
  55. +2 −2 src/components/ReactComponent.jsx
  56. +129 −149 src/components/SubmissionGrid.jsx
  57. +6 −6 src/index.js
  58. +2 −2 src/modules/auth/actions.js
  59. +1 −1 src/modules/form/actions.js
  60. +1 −1 src/modules/forms/actions.js
  61. +1 −1 src/modules/submission/actions.js
  62. +1 −1 src/modules/submissions/actions.js
  63. +1 −1 src/utils.js
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -2,5 +2,4 @@
*.log
node_modules
bower_components
lib
.idea
21 changes: 0 additions & 21 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -4,27 +4,6 @@ All notable changes to this project will be documented in this file
The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).

## 5.0.0-alpha.1
### Changed
- Refactored to work with latest React version.

## 4.3.0
### Changed
- Upgrade formio.js to 4.9.0.

## 4.2.6
### Changed
- Update dependencies for security updates.

## 4.2.5
### Fixed
- Check validity return correct value.

## 4.2.4
### Fixed
- Empty wizard change event.
- Project access not setting correctly in auth state.

## 4.2.3
### Fixed
- Change event on builder.
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -15,7 +15,6 @@ npm-compatible packaging system such as [Browserify](http://browserify.org/) or

```
npm install react-formio --save
npm install formiojs --save // Install formiojs since it is a peerDependency
```

## Components
@@ -87,7 +86,7 @@ Please note that the FormBuilder component does not load and save from/to a url.
| ```onSaveComponent``` | ```component```: object | Triggered when the component settings dialog is saved and closed |
| ```onCancelComponent``` | ```component```: object | Triggered when the component settings dialog is cancelled |
| ```onDeleteComponent``` | ```component```: object | Triggered when a component is removed from the form |
| ```onUpdateComponent``` | ```component```: object | Triggered when a component is added or moved in the form |
| ```updateComponent``` | ```component```: object | Triggered when a component is added or moved in the form |


#### Example
125 changes: 125 additions & 0 deletions lib/components/Errors.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
'use strict';

Object.defineProperty(exports, "__esModule", {
value: true
});

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

var _react = require('react');

var _react2 = _interopRequireDefault(_react);

var _propTypes = require('prop-types');

var _propTypes2 = _interopRequireDefault(_propTypes);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }

var Errors = function (_Component) {
_inherits(Errors, _Component);

function Errors() {
_classCallCheck(this, Errors);

return _possibleConstructorReturn(this, (Errors.__proto__ || Object.getPrototypeOf(Errors)).apply(this, arguments));
}

_createClass(Errors, [{
key: 'hasErrors',
value: function hasErrors(error) {
if (Array.isArray(error)) {
return error.filter(function (item) {
return !!item;
}).length !== 0;
}

return !!error;
}
}, {
key: 'formatError',
value: function formatError(error) {
if (typeof error === 'string') {
return error;
}

if (Array.isArray(error)) {
return error.map(this.formatError);
}

if (error.hasOwnProperty('errors')) {
return Object.keys(error.errors).map(function (key, index) {
var item = error.errors[key];
return _react2.default.createElement(
'div',
{ key: index },
_react2.default.createElement(
'strong',
null,
item.name,
' (',
item.path,
')'
),
' - ',
item.message
);
});
}

// If this is a standard error.
if (error.hasOwnProperty('message')) {
return error.message;
}

// If this is a joy validation error.
if (error.hasOwnProperty('name') && error.name === 'ValidationError') {
return error.details.map(function (item, index) {
return _react2.default.createElement(
'div',
{ key: index },
item.message
);
});
}

// If a conflict error occurs on a form, the form is returned.
if (error.hasOwnProperty('_id') && error.hasOwnProperty('display')) {
return 'Another user has saved this form already. Please reload and re-apply your changes.';
}

return 'An error occurred. See console logs for details.';
}
}, {
key: 'render',
value: function render() {
// If there are no errors, don't render anything.
if (!this.hasErrors(this.props.errors)) {
return null;
}

return _react2.default.createElement(
'div',
{ className: 'alert alert-' + this.props.type, role: 'alert' },
this.formatError(this.props.errors)
);
}
}]);

return Errors;
}(_react.Component);

Errors.propTypes = {
errors: _propTypes2.default.any,
type: _propTypes2.default.string
};
Errors.defaultProps = {
type: 'danger'
};
exports.default = Errors;
215 changes: 215 additions & 0 deletions lib/components/Form.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,215 @@
'use strict';

Object.defineProperty(exports, "__esModule", {
value: true
});

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

var _react = require('react');

var _react2 = _interopRequireDefault(_react);

var _propTypes = require('prop-types');

var _propTypes2 = _interopRequireDefault(_propTypes);

var _eventemitter = require('eventemitter2');

var _eventemitter2 = _interopRequireDefault(_eventemitter);

var _components = require('formiojs/lib/components');

var _components2 = _interopRequireDefault(_components);

var _Components = require('formiojs/lib/components/Components');

var _Components2 = _interopRequireDefault(_Components);

var _Form = require('formiojs/lib/Form');

var _Form2 = _interopRequireDefault(_Form);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }

_Components2.default.setComponents(_components2.default);

var Form = function (_Component) {
_inherits(Form, _Component);

function Form() {
var _ref;

var _temp, _this, _ret;

_classCallCheck(this, Form);

for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}

return _ret = (_temp = (_this = _possibleConstructorReturn(this, (_ref = Form.__proto__ || Object.getPrototypeOf(Form)).call.apply(_ref, [this].concat(args))), _this), _initialiseProps.call(_this), _temp), _possibleConstructorReturn(_this, _ret);
}

_createClass(Form, null, [{
key: 'getDefaultEmitter',
value: function getDefaultEmitter() {
return new _eventemitter2.default({
wildcard: false,
maxListeners: 0
});
}
}]);

return Form;
}(_react.Component);

Form.propTypes = {
src: _propTypes2.default.string,
url: _propTypes2.default.string,
form: _propTypes2.default.object,
submission: _propTypes2.default.object,
options: _propTypes2.default.shape({
readOnly: _propTypes2.default.boolean,
noAlerts: _propTypes2.default.boolean,
i18n: _propTypes2.default.object,
template: _propTypes2.default.string,
saveDraft: _propTypes2.default.boolean
}),
onPrevPage: _propTypes2.default.func,
onNextPage: _propTypes2.default.func,
onCancel: _propTypes2.default.func,
onChange: _propTypes2.default.func,
onCustomEvent: _propTypes2.default.func,
onComponentChange: _propTypes2.default.func,
onSubmit: _propTypes2.default.func,
onSubmitDone: _propTypes2.default.func,
onFormLoad: _propTypes2.default.func,
onError: _propTypes2.default.func,
onRender: _propTypes2.default.func,
onAttach: _propTypes2.default.func,
onBuild: _propTypes2.default.func,
onFocus: _propTypes2.default.func,
onBlur: _propTypes2.default.func,
onInitialized: _propTypes2.default.func,
formioform: _propTypes2.default.any
};

var _initialiseProps = function _initialiseProps() {
var _this2 = this;

this.componentDidMount = function () {
var _props = _this2.props,
_props$options = _props.options,
options = _props$options === undefined ? {} : _props$options,
src = _props.src,
url = _props.url,
form = _props.form;


if (!options.events) {
options.events = Form.getDefaultEmitter();
}

if (src) {
_this2.instance = new (_this2.props.formioform || _Form2.default)(_this2.element, src, options);
_this2.createPromise = _this2.instance.ready.then(function (formio) {
_this2.formio = formio;
_this2.formio.src = src;
});
}
if (form) {
_this2.instance = new (_this2.props.formioform || _Form2.default)(_this2.element, form, options);
_this2.createPromise = _this2.instance.ready.then(function (formio) {
_this2.formio = formio;
_this2.formio.form = form;
if (url) {
_this2.formio.url = url;
}

return _this2.formio;
});
}

_this2.initializeFormio();
};

this.componentWillUnmount = function () {
if (_this2.formio !== undefined) {
_this2.formio.destroy(true);
}
};

this.initializeFormio = function () {
if (_this2.createPromise) {
_this2.instance.onAny(function (event) {
for (var _len2 = arguments.length, args = Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
args[_key2 - 1] = arguments[_key2];
}

if (event.startsWith('formio.')) {
var funcName = 'on' + event.charAt(7).toUpperCase() + event.slice(8);
if (_this2.props.hasOwnProperty(funcName) && typeof _this2.props[funcName] === 'function') {
var _props2;

(_props2 = _this2.props)[funcName].apply(_props2, args);
}
}
});
_this2.createPromise.then(function () {
if (_this2.props.submission) {
_this2.formio.submission = _this2.props.submission;
}
});
}
};

this.componentWillReceiveProps = function (nextProps) {
var _props3 = _this2.props,
_props3$options = _props3.options,
options = _props3$options === undefined ? {} : _props3$options,
src = _props3.src,
form = _props3.form,
submission = _props3.submission;


if (!options.events) {
options.events = Form.getDefaultEmitter();
}

if (src !== nextProps.src) {
_this2.instance = new (_this2.props.formioform || _Form2.default)(_this2.element, nextProps.src, options);
_this2.createPromise = _this2.instance.ready.then(function (formio) {
_this2.formio = formio;
_this2.formio.src = nextProps.src;
});
_this2.initializeFormio();
}
if (form !== nextProps.form) {
_this2.instance = new (_this2.props.formioform || _Form2.default)(_this2.element, nextProps.form, options);
_this2.createPromise = _this2.instance.ready.then(function (formio) {
_this2.formio = formio;
_this2.formio.form = nextProps.form;
});
_this2.initializeFormio();
}

if (submission !== nextProps.submission && _this2.formio) {
_this2.formio.submission = nextProps.submission;
}
};

this.render = function () {
return _react2.default.createElement('div', { ref: function ref(element) {
return _this2.element = element;
} });
};
};

exports.default = Form;
Loading