fulcrum-core
Advanced tools
Comparing version 0.0.12 to 0.0.13
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.__esModule = true; | ||
@@ -26,25 +24,17 @@ var _choice = require('./elements/choice'); | ||
if (attributes.choices) { | ||
var _iteratorNormalCompletion = true; | ||
var _didIteratorError = false; | ||
var _iteratorError = undefined; | ||
for (var _iterator = attributes.choices, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) { | ||
var _ref; | ||
try { | ||
for (var _iterator = attributes.choices[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { | ||
var choice = _step.value; | ||
if (_isArray) { | ||
if (_i >= _iterator.length) break; | ||
_ref = _iterator[_i++]; | ||
} else { | ||
_i = _iterator.next(); | ||
if (_i.done) break; | ||
_ref = _i.value; | ||
} | ||
this.choices.push(new _choice2.default(choice)); | ||
} | ||
} catch (err) { | ||
_didIteratorError = true; | ||
_iteratorError = err; | ||
} finally { | ||
try { | ||
if (!_iteratorNormalCompletion && _iterator.return) { | ||
_iterator.return(); | ||
} | ||
} finally { | ||
if (_didIteratorError) { | ||
throw _iteratorError; | ||
} | ||
} | ||
var choice = _ref; | ||
this.choices.push(new _choice2.default(choice)); | ||
} | ||
@@ -51,0 +41,0 @@ } |
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.__esModule = true; | ||
@@ -26,25 +24,17 @@ var _classification = require('./elements/classification'); | ||
if (attributes.items) { | ||
var _iteratorNormalCompletion = true; | ||
var _didIteratorError = false; | ||
var _iteratorError = undefined; | ||
for (var _iterator = attributes.items, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) { | ||
var _ref; | ||
try { | ||
for (var _iterator = attributes.items[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { | ||
var item = _step.value; | ||
if (_isArray) { | ||
if (_i >= _iterator.length) break; | ||
_ref = _iterator[_i++]; | ||
} else { | ||
_i = _iterator.next(); | ||
if (_i.done) break; | ||
_ref = _i.value; | ||
} | ||
this.items.push(new _classification2.default(null, item)); | ||
} | ||
} catch (err) { | ||
_didIteratorError = true; | ||
_iteratorError = err; | ||
} finally { | ||
try { | ||
if (!_iteratorNormalCompletion && _iterator.return) { | ||
_iterator.return(); | ||
} | ||
} finally { | ||
if (_didIteratorError) { | ||
throw _iteratorError; | ||
} | ||
} | ||
var item = _ref; | ||
this.items.push(new _classification2.default(null, item)); | ||
} | ||
@@ -51,0 +41,0 @@ } |
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.__esModule = true; | ||
@@ -63,92 +61,92 @@ 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; }; }(); | ||
_createClass(DataSource, [{ | ||
key: 'invoke', | ||
value: function invoke(dataSource, method, params, callback) { | ||
var _this = this; | ||
DataSource.prototype.invoke = function invoke(dataSource, method, params, callback) { | ||
var _this = this; | ||
var invokeCallback = function invokeCallback(err) { | ||
for (var _len = arguments.length, objects = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { | ||
objects[_key - 1] = arguments[_key]; | ||
} | ||
var invokeCallback = function invokeCallback(err) { | ||
for (var _len = arguments.length, objects = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { | ||
objects[_key - 1] = arguments[_key]; | ||
} | ||
if (err) { | ||
return callback(err); | ||
} else if (objects[0]) { | ||
return _this.process(dataSource.previous, method, params, objects, callback); | ||
} else if (dataSource.next) { | ||
return _this.invoke(dataSource.next, method, params, callback); | ||
} | ||
if (err) { | ||
return callback(err); | ||
} else if (objects[0]) { | ||
return _this.process(dataSource.previous, method, params, objects, callback); | ||
} else if (dataSource.next) { | ||
return _this.invoke(dataSource.next, method, params, callback); | ||
} | ||
return callback(new Error('Unhandled request: ' + method)); | ||
}; | ||
return callback(new Error('Unhandled request: ' + method)); | ||
}; | ||
var invokeArguments = params.concat([invokeCallback]); | ||
var invokeArguments = params.concat([invokeCallback]); | ||
(dataSource[method] || noop).apply(dataSource, invokeArguments); | ||
(dataSource[method] || noop).apply(dataSource, invokeArguments); | ||
}; | ||
DataSource.prototype.process = function process(dataSource, method, params, objects, callback) { | ||
var _this2 = this; | ||
if (dataSource == null) { | ||
return callback.apply(null, [null].concat(objects)); | ||
} | ||
}, { | ||
key: 'process', | ||
value: function process(dataSource, method, params, objects, callback) { | ||
var _this2 = this; | ||
if (dataSource == null) { | ||
var processMethod = method + 'Complete'; | ||
var processCallback = function processCallback(err) { | ||
if (err) { | ||
return callback(err); | ||
} else if (dataSource.previous) { | ||
return _this2.process(dataSource.previous, method, params, objects, callback); | ||
} else { | ||
return callback.apply(null, [null].concat(objects)); | ||
} | ||
}; | ||
var processMethod = method + 'Complete'; | ||
var processArguments = params.concat(objects.concat([processCallback])); | ||
var processCallback = function processCallback(err) { | ||
if (err) { | ||
return callback(err); | ||
} else if (dataSource.previous) { | ||
return _this2.process(dataSource.previous, method, params, objects, callback); | ||
} else { | ||
return callback.apply(null, [null].concat(objects)); | ||
} | ||
}; | ||
(dataSource[processMethod] || noop).apply(dataSource, processArguments); | ||
var processArguments = params.concat(objects.concat([processCallback])); | ||
return null; | ||
}; | ||
(dataSource[processMethod] || noop).apply(dataSource, processArguments); | ||
return null; | ||
DataSource.prototype.add = function add(source) { | ||
if (this.sources.length) { | ||
this.sources[this.sources.length - 1].next = source; | ||
source.previous = this.sources[this.sources.length - 1]; | ||
} | ||
}, { | ||
key: 'add', | ||
value: function add(source) { | ||
if (this.sources.length) { | ||
this.sources[this.sources.length - 1].next = source; | ||
source.previous = this.sources[this.sources.length - 1]; | ||
} | ||
this.sources.push(source); | ||
this.sources.push(source); | ||
return this; | ||
} | ||
}, { | ||
key: 'getChoiceList', | ||
value: function getChoiceList(id, callback) { | ||
this.invoke(this.root, 'getChoiceList', [id], callback); | ||
} | ||
}, { | ||
key: 'getClassificationSet', | ||
value: function getClassificationSet(id, callback) { | ||
this.invoke(this.root, 'getClassificationSet', [id], callback); | ||
} | ||
}, { | ||
key: 'getForm', | ||
value: function getForm(id, callback) { | ||
this.invoke(this.root, 'getForm', [id], callback); | ||
} | ||
}, { | ||
key: 'getRecord', | ||
value: function getRecord(id, callback) { | ||
this.invoke(this.root, 'getRecord', [id], callback); | ||
} | ||
}, { | ||
key: 'getRecords', | ||
value: function getRecords(form, params, callback) { | ||
this.invoke(this.root, 'getRecords', [form, params], callback); | ||
} | ||
}, { | ||
return this; | ||
}; | ||
DataSource.prototype.getChoiceList = function getChoiceList(id, callback) { | ||
this.invoke(this.root, 'getChoiceList', [id], callback); | ||
}; | ||
DataSource.prototype.getClassificationSet = function getClassificationSet(id, callback) { | ||
this.invoke(this.root, 'getClassificationSet', [id], callback); | ||
}; | ||
DataSource.prototype.getForm = function getForm(id, callback) { | ||
this.invoke(this.root, 'getForm', [id], callback); | ||
}; | ||
DataSource.prototype.getRecord = function getRecord(id, callback) { | ||
this.invoke(this.root, 'getRecord', [id], callback); | ||
}; | ||
DataSource.prototype.getRecords = function getRecords(form, params, callback) { | ||
this.invoke(this.root, 'getRecords', [form, params], callback); | ||
}; | ||
DataSource.prototype.getUsers = function getUsers(params, callback) { | ||
this.invoke(this.root, 'getUsers', [params], callback); | ||
}; | ||
DataSource.prototype.getProjects = function getProjects(params, callback) { | ||
this.invoke(this.root, 'getProjects', [params], callback); | ||
}; | ||
_createClass(DataSource, [{ | ||
key: 'root', | ||
@@ -155,0 +153,0 @@ get: function get() { |
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.__esModule = true; | ||
@@ -13,2 +11,4 @@ var _element = require('./element'); | ||
function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
@@ -18,3 +18,3 @@ | ||
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; } | ||
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) : _defaults(subClass, superClass); } | ||
@@ -27,3 +27,3 @@ var AddressElement = function (_Element) { | ||
var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(AddressElement).call(this, parent, attributes)); | ||
var _this = _possibleConstructorReturn(this, _Element.call(this, parent, attributes)); | ||
@@ -30,0 +30,0 @@ _this.autoPopulate = !!attributes.auto_populate; |
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.__esModule = true; | ||
@@ -13,2 +11,4 @@ var _mediaElement = require('./media-element'); | ||
function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
@@ -18,3 +18,3 @@ | ||
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; } | ||
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) : _defaults(subClass, superClass); } | ||
@@ -27,3 +27,3 @@ var AudioElement = function (_MediaElement) { | ||
var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(AudioElement).call(this, parent, attributes)); | ||
var _this = _possibleConstructorReturn(this, _MediaElement.call(this, parent, attributes)); | ||
@@ -30,0 +30,0 @@ _this.trackEnabled = !!attributes.track_enabled; |
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.__esModule = true; | ||
@@ -13,2 +11,4 @@ var _element = require('./element'); | ||
function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
@@ -18,3 +18,3 @@ | ||
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; } | ||
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) : _defaults(subClass, superClass); } | ||
@@ -27,3 +27,3 @@ var BarcodeElement = function (_TextualElement) { | ||
return _possibleConstructorReturn(this, Object.getPrototypeOf(BarcodeElement).apply(this, arguments)); | ||
return _possibleConstructorReturn(this, _TextualElement.apply(this, arguments)); | ||
} | ||
@@ -30,0 +30,0 @@ |
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.__esModule = 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 _textualElement = require('./textual-element'); | ||
@@ -19,2 +15,4 @@ | ||
function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
@@ -24,3 +22,3 @@ | ||
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; } | ||
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) : _defaults(subClass, superClass); } | ||
@@ -33,3 +31,3 @@ var CalculatedElement = function (_TextualElement) { | ||
var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(CalculatedElement).call(this, parent, attributes)); | ||
var _this = _possibleConstructorReturn(this, _TextualElement.call(this, parent, attributes)); | ||
@@ -41,52 +39,40 @@ _this.expression = attributes.expression; | ||
_createClass(CalculatedElement, null, [{ | ||
key: 'findCalculatedElementRoot', | ||
value: function findCalculatedElementRoot(form, container) { | ||
if (container.type != null) { | ||
if (container.isSectionElement) { | ||
return CalculatedElement.findCalculatedElementRoot(form, container.parent); | ||
} else if (container.isRepeatableElement) { | ||
return container; | ||
} | ||
CalculatedElement.findCalculatedElementRoot = function findCalculatedElementRoot(form, container) { | ||
if (container.type != null) { | ||
if (container.isSectionElement) { | ||
return CalculatedElement.findCalculatedElementRoot(form, container.parent); | ||
} else if (container.isRepeatableElement) { | ||
return container; | ||
} | ||
return form; | ||
} | ||
}, { | ||
key: 'findCalculatedElementsForContainer', | ||
value: function findCalculatedElementsForContainer(container) { | ||
var elements = []; | ||
return form; | ||
}; | ||
var _iteratorNormalCompletion = true; | ||
var _didIteratorError = false; | ||
var _iteratorError = undefined; | ||
CalculatedElement.findCalculatedElementsForContainer = function findCalculatedElementsForContainer(container) { | ||
var elements = []; | ||
try { | ||
for (var _iterator = container.elements[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { | ||
var element = _step.value; | ||
for (var _iterator = container.elements, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) { | ||
var _ref; | ||
if (element.isCalculatedElement) { | ||
elements.push(element); | ||
} else if (element.isSectionElement) { | ||
elements = elements.concat(CalculatedElement.findCalculatedElementsForContainer(element)); | ||
} | ||
} | ||
} catch (err) { | ||
_didIteratorError = true; | ||
_iteratorError = err; | ||
} finally { | ||
try { | ||
if (!_iteratorNormalCompletion && _iterator.return) { | ||
_iterator.return(); | ||
} | ||
} finally { | ||
if (_didIteratorError) { | ||
throw _iteratorError; | ||
} | ||
} | ||
if (_isArray) { | ||
if (_i >= _iterator.length) break; | ||
_ref = _iterator[_i++]; | ||
} else { | ||
_i = _iterator.next(); | ||
if (_i.done) break; | ||
_ref = _i.value; | ||
} | ||
return elements; | ||
var element = _ref; | ||
if (element.isCalculatedElement) { | ||
elements.push(element); | ||
} else if (element.isSectionElement) { | ||
elements = elements.concat(CalculatedElement.findCalculatedElementsForContainer(element)); | ||
} | ||
} | ||
}]); | ||
return elements; | ||
}; | ||
return CalculatedElement; | ||
@@ -93,0 +79,0 @@ }(_textualElement2.default); |
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.__esModule = true; | ||
@@ -15,2 +13,4 @@ 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; }; }(); | ||
function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
@@ -20,3 +20,3 @@ | ||
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; } | ||
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) : _defaults(subClass, superClass); } | ||
@@ -31,169 +31,125 @@ var ElementFactory = null; | ||
return _possibleConstructorReturn(this, Object.getPrototypeOf(ChildElements).apply(this, arguments)); | ||
return _possibleConstructorReturn(this, _Mixin.apply(this, arguments)); | ||
} | ||
_createClass(ChildElements, [{ | ||
key: 'createChildElements', | ||
value: function createChildElements(elements) { | ||
this.elements = []; | ||
ChildElements.prototype.createChildElements = function createChildElements(elements) { | ||
this.elements = []; | ||
var _iteratorNormalCompletion = true; | ||
var _didIteratorError = false; | ||
var _iteratorError = undefined; | ||
for (var _iterator = elements, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) { | ||
var _ref; | ||
try { | ||
for (var _iterator = elements[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { | ||
var element = _step.value; | ||
if (_isArray) { | ||
if (_i >= _iterator.length) break; | ||
_ref = _iterator[_i++]; | ||
} else { | ||
_i = _iterator.next(); | ||
if (_i.done) break; | ||
_ref = _i.value; | ||
} | ||
// hack for circular dependency, not ideal | ||
ElementFactory = ElementFactory || require('./element-factory').default; | ||
this.elements.push(ElementFactory.create(this, element)); | ||
} | ||
} catch (err) { | ||
_didIteratorError = true; | ||
_iteratorError = err; | ||
} finally { | ||
try { | ||
if (!_iteratorNormalCompletion && _iterator.return) { | ||
_iterator.return(); | ||
} | ||
} finally { | ||
if (_didIteratorError) { | ||
throw _iteratorError; | ||
} | ||
} | ||
} | ||
var element = _ref; | ||
// hack for circular dependency, not ideal | ||
ElementFactory = ElementFactory || require('./element-factory').default; | ||
this.elements.push(ElementFactory.create(this, element)); | ||
} | ||
}, { | ||
key: 'elementsOfType', | ||
value: function elementsOfType(type) { | ||
var result = []; | ||
}; | ||
var _iteratorNormalCompletion2 = true; | ||
var _didIteratorError2 = false; | ||
var _iteratorError2 = undefined; | ||
ChildElements.prototype.elementsOfType = function elementsOfType(type) { | ||
var result = []; | ||
try { | ||
for (var _iterator2 = this.allElements[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) { | ||
var element = _step2.value; | ||
for (var _iterator2 = this.allElements, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator]();;) { | ||
var _ref2; | ||
if (element.type === type) { | ||
result.push(element); | ||
} | ||
} | ||
} catch (err) { | ||
_didIteratorError2 = true; | ||
_iteratorError2 = err; | ||
} finally { | ||
try { | ||
if (!_iteratorNormalCompletion2 && _iterator2.return) { | ||
_iterator2.return(); | ||
} | ||
} finally { | ||
if (_didIteratorError2) { | ||
throw _iteratorError2; | ||
} | ||
} | ||
if (_isArray2) { | ||
if (_i2 >= _iterator2.length) break; | ||
_ref2 = _iterator2[_i2++]; | ||
} else { | ||
_i2 = _iterator2.next(); | ||
if (_i2.done) break; | ||
_ref2 = _i2.value; | ||
} | ||
return result; | ||
var element = _ref2; | ||
if (element.type === type) { | ||
result.push(element); | ||
} | ||
} | ||
}, { | ||
key: '_flattenElements', | ||
value: function _flattenElements(elements) { | ||
var flat = []; | ||
var _iteratorNormalCompletion3 = true; | ||
var _didIteratorError3 = false; | ||
var _iteratorError3 = undefined; | ||
return result; | ||
}; | ||
try { | ||
for (var _iterator3 = elements[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) { | ||
var element = _step3.value; | ||
ChildElements.prototype._flattenElements = function _flattenElements(elements) { | ||
var flat = []; | ||
flat.push(element); | ||
for (var _iterator3 = elements, _isArray3 = Array.isArray(_iterator3), _i3 = 0, _iterator3 = _isArray3 ? _iterator3 : _iterator3[Symbol.iterator]();;) { | ||
var _ref3; | ||
if (element.elements) { | ||
flat = flat.concat(this._flattenElements(element.elements)); | ||
} | ||
} | ||
} catch (err) { | ||
_didIteratorError3 = true; | ||
_iteratorError3 = err; | ||
} finally { | ||
try { | ||
if (!_iteratorNormalCompletion3 && _iterator3.return) { | ||
_iterator3.return(); | ||
} | ||
} finally { | ||
if (_didIteratorError3) { | ||
throw _iteratorError3; | ||
} | ||
} | ||
if (_isArray3) { | ||
if (_i3 >= _iterator3.length) break; | ||
_ref3 = _iterator3[_i3++]; | ||
} else { | ||
_i3 = _iterator3.next(); | ||
if (_i3.done) break; | ||
_ref3 = _i3.value; | ||
} | ||
return flat; | ||
var element = _ref3; | ||
flat.push(element); | ||
if (element.elements) { | ||
flat = flat.concat(this._flattenElements(element.elements)); | ||
} | ||
} | ||
}, { | ||
key: '_flattenElementsByAttribute', | ||
value: function _flattenElementsByAttribute(elements, attr) { | ||
var flat = {}; | ||
var _iteratorNormalCompletion4 = true; | ||
var _didIteratorError4 = false; | ||
var _iteratorError4 = undefined; | ||
return flat; | ||
}; | ||
try { | ||
for (var _iterator4 = elements[Symbol.iterator](), _step4; !(_iteratorNormalCompletion4 = (_step4 = _iterator4.next()).done); _iteratorNormalCompletion4 = true) { | ||
var element = _step4.value; | ||
ChildElements.prototype._flattenElementsByAttribute = function _flattenElementsByAttribute(elements, attr) { | ||
var flat = {}; | ||
flat[element[attr]] = element; | ||
for (var _iterator4 = elements, _isArray4 = Array.isArray(_iterator4), _i4 = 0, _iterator4 = _isArray4 ? _iterator4 : _iterator4[Symbol.iterator]();;) { | ||
var _ref4; | ||
if (element.elements) { | ||
var children = this._flattenElementsByAttribute(element.elements, attr); | ||
if (_isArray4) { | ||
if (_i4 >= _iterator4.length) break; | ||
_ref4 = _iterator4[_i4++]; | ||
} else { | ||
_i4 = _iterator4.next(); | ||
if (_i4.done) break; | ||
_ref4 = _i4.value; | ||
} | ||
var _iteratorNormalCompletion5 = true; | ||
var _didIteratorError5 = false; | ||
var _iteratorError5 = undefined; | ||
var element = _ref4; | ||
try { | ||
for (var _iterator5 = Object.keys(children)[Symbol.iterator](), _step5; !(_iteratorNormalCompletion5 = (_step5 = _iterator5.next()).done); _iteratorNormalCompletion5 = true) { | ||
var key = _step5.value; | ||
flat[element[attr]] = element; | ||
flat[key] = children[key]; | ||
} | ||
} catch (err) { | ||
_didIteratorError5 = true; | ||
_iteratorError5 = err; | ||
} finally { | ||
try { | ||
if (!_iteratorNormalCompletion5 && _iterator5.return) { | ||
_iterator5.return(); | ||
} | ||
} finally { | ||
if (_didIteratorError5) { | ||
throw _iteratorError5; | ||
} | ||
} | ||
} | ||
if (element.elements) { | ||
var children = this._flattenElementsByAttribute(element.elements, attr); | ||
for (var _iterator5 = Object.keys(children), _isArray5 = Array.isArray(_iterator5), _i5 = 0, _iterator5 = _isArray5 ? _iterator5 : _iterator5[Symbol.iterator]();;) { | ||
var _ref5; | ||
if (_isArray5) { | ||
if (_i5 >= _iterator5.length) break; | ||
_ref5 = _iterator5[_i5++]; | ||
} else { | ||
_i5 = _iterator5.next(); | ||
if (_i5.done) break; | ||
_ref5 = _i5.value; | ||
} | ||
var key = _ref5; | ||
flat[key] = children[key]; | ||
} | ||
} catch (err) { | ||
_didIteratorError4 = true; | ||
_iteratorError4 = err; | ||
} finally { | ||
try { | ||
if (!_iteratorNormalCompletion4 && _iterator4.return) { | ||
_iterator4.return(); | ||
} | ||
} finally { | ||
if (_didIteratorError4) { | ||
throw _iteratorError4; | ||
} | ||
} | ||
} | ||
} | ||
return flat; | ||
} | ||
}, { | ||
return flat; | ||
}; | ||
_createClass(ChildElements, [{ | ||
key: 'allElements', | ||
@@ -200,0 +156,0 @@ get: function get() { |
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.__esModule = true; | ||
@@ -19,2 +17,4 @@ 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; }; }(); | ||
function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
@@ -24,3 +24,3 @@ | ||
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; } | ||
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) : _defaults(subClass, superClass); } | ||
@@ -33,3 +33,3 @@ var ChoiceElement = function (_Element) { | ||
var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(ChoiceElement).call(this, parent, attributes)); | ||
var _this = _possibleConstructorReturn(this, _Element.call(this, parent, attributes)); | ||
@@ -46,25 +46,17 @@ _this.multiple = !!attributes.multiple; | ||
if (attributes.choices) { | ||
var _iteratorNormalCompletion = true; | ||
var _didIteratorError = false; | ||
var _iteratorError = undefined; | ||
for (var _iterator = _this.attributes.choices, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) { | ||
var _ref; | ||
try { | ||
for (var _iterator = _this.attributes.choices[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { | ||
var choice = _step.value; | ||
if (_isArray) { | ||
if (_i >= _iterator.length) break; | ||
_ref = _iterator[_i++]; | ||
} else { | ||
_i = _iterator.next(); | ||
if (_i.done) break; | ||
_ref = _i.value; | ||
} | ||
_this._choices.push(new _choice2.default(choice)); | ||
} | ||
} catch (err) { | ||
_didIteratorError = true; | ||
_iteratorError = err; | ||
} finally { | ||
try { | ||
if (!_iteratorNormalCompletion && _iterator.return) { | ||
_iterator.return(); | ||
} | ||
} finally { | ||
if (_didIteratorError) { | ||
throw _iteratorError; | ||
} | ||
} | ||
var choice = _ref; | ||
_this._choices.push(new _choice2.default(choice)); | ||
} | ||
@@ -75,59 +67,49 @@ } | ||
_createClass(ChoiceElement, [{ | ||
key: 'load', | ||
value: function load(dataSource, callback) { | ||
var _this2 = this; | ||
ChoiceElement.prototype.load = function load(dataSource, callback) { | ||
var _this2 = this; | ||
this._choicesByValue = null; | ||
this._choicesByValue = null; | ||
if (this._choiceListID) { | ||
dataSource.getChoiceList(this._choiceListID, function (err, choiceList) { | ||
if (err) { | ||
return callback(err); | ||
} | ||
if (this._choiceListID) { | ||
dataSource.getChoiceList(this._choiceListID, function (err, choiceList) { | ||
if (err) { | ||
return callback(err); | ||
} | ||
_this2.choiceList = choiceList; | ||
_this2._choices = _this2.choiceList.choices.slice(); | ||
_this2.choiceList = choiceList; | ||
_this2._choices = _this2.choiceList.choices.slice(); | ||
return callback(); | ||
}); | ||
} else { | ||
setImmediate(callback); | ||
} | ||
return callback(); | ||
}); | ||
} else { | ||
setImmediate(callback); | ||
} | ||
}, { | ||
key: 'choiceByValue', | ||
value: function choiceByValue(value) { | ||
if (!this._choicesByValue) { | ||
this._choicesByValue = {}; | ||
}; | ||
var _iteratorNormalCompletion2 = true; | ||
var _didIteratorError2 = false; | ||
var _iteratorError2 = undefined; | ||
ChoiceElement.prototype.choiceByValue = function choiceByValue(value) { | ||
if (!this._choicesByValue) { | ||
this._choicesByValue = {}; | ||
try { | ||
for (var _iterator2 = this.choices[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) { | ||
var choice = _step2.value; | ||
for (var _iterator2 = this.choices, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator]();;) { | ||
var _ref2; | ||
this._choicesByValue[choice.value] = choice; | ||
} | ||
} catch (err) { | ||
_didIteratorError2 = true; | ||
_iteratorError2 = err; | ||
} finally { | ||
try { | ||
if (!_iteratorNormalCompletion2 && _iterator2.return) { | ||
_iterator2.return(); | ||
} | ||
} finally { | ||
if (_didIteratorError2) { | ||
throw _iteratorError2; | ||
} | ||
} | ||
if (_isArray2) { | ||
if (_i2 >= _iterator2.length) break; | ||
_ref2 = _iterator2[_i2++]; | ||
} else { | ||
_i2 = _iterator2.next(); | ||
if (_i2.done) break; | ||
_ref2 = _i2.value; | ||
} | ||
var choice = _ref2; | ||
this._choicesByValue[choice.value] = choice; | ||
} | ||
} | ||
return this._choicesByValue[value]; | ||
} | ||
}, { | ||
return this._choicesByValue[value]; | ||
}; | ||
_createClass(ChoiceElement, [{ | ||
key: 'isLengthValidationSupported', | ||
@@ -153,48 +135,33 @@ get: function get() { | ||
var _iteratorNormalCompletion3 = true; | ||
var _didIteratorError3 = false; | ||
var _iteratorError3 = undefined; | ||
for (var _iterator3 = items, _isArray3 = Array.isArray(_iterator3), _i3 = 0, _iterator3 = _isArray3 ? _iterator3 : _iterator3[Symbol.iterator]();;) { | ||
var _ref3; | ||
try { | ||
for (var _iterator3 = items[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) { | ||
var item = _step3.value; | ||
var _iteratorNormalCompletion4 = true; | ||
var _didIteratorError4 = false; | ||
var _iteratorError4 = undefined; | ||
if (_isArray3) { | ||
if (_i3 >= _iterator3.length) break; | ||
_ref3 = _iterator3[_i3++]; | ||
} else { | ||
_i3 = _iterator3.next(); | ||
if (_i3.done) break; | ||
_ref3 = _i3.value; | ||
} | ||
try { | ||
for (var _iterator4 = this.choiceFilter[Symbol.iterator](), _step4; !(_iteratorNormalCompletion4 = (_step4 = _iterator4.next()).done); _iteratorNormalCompletion4 = true) { | ||
var filter = _step4.value; | ||
var item = _ref3; | ||
if (item.value.toLowerCase().indexOf(filter.toLowerCase()) !== -1) { | ||
filteredItems.push(item); | ||
} | ||
} | ||
} catch (err) { | ||
_didIteratorError4 = true; | ||
_iteratorError4 = err; | ||
} finally { | ||
try { | ||
if (!_iteratorNormalCompletion4 && _iterator4.return) { | ||
_iterator4.return(); | ||
} | ||
} finally { | ||
if (_didIteratorError4) { | ||
throw _iteratorError4; | ||
} | ||
} | ||
for (var _iterator4 = this.choiceFilter, _isArray4 = Array.isArray(_iterator4), _i4 = 0, _iterator4 = _isArray4 ? _iterator4 : _iterator4[Symbol.iterator]();;) { | ||
var _ref4; | ||
if (_isArray4) { | ||
if (_i4 >= _iterator4.length) break; | ||
_ref4 = _iterator4[_i4++]; | ||
} else { | ||
_i4 = _iterator4.next(); | ||
if (_i4.done) break; | ||
_ref4 = _i4.value; | ||
} | ||
} | ||
} catch (err) { | ||
_didIteratorError3 = true; | ||
_iteratorError3 = err; | ||
} finally { | ||
try { | ||
if (!_iteratorNormalCompletion3 && _iterator3.return) { | ||
_iterator3.return(); | ||
var filter = _ref4; | ||
if (item.value.toLowerCase().indexOf(filter.toLowerCase()) !== -1) { | ||
filteredItems.push(item); | ||
} | ||
} finally { | ||
if (_didIteratorError3) { | ||
throw _iteratorError3; | ||
} | ||
} | ||
@@ -220,27 +187,19 @@ } | ||
var _iteratorNormalCompletion5 = true; | ||
var _didIteratorError5 = false; | ||
var _iteratorError5 = undefined; | ||
for (var _iterator5 = overrideChoices, _isArray5 = Array.isArray(_iterator5), _i5 = 0, _iterator5 = _isArray5 ? _iterator5 : _iterator5[Symbol.iterator]();;) { | ||
var _ref5; | ||
try { | ||
for (var _iterator5 = overrideChoices[Symbol.iterator](), _step5; !(_iteratorNormalCompletion5 = (_step5 = _iterator5.next()).done); _iteratorNormalCompletion5 = true) { | ||
var choiceAttributes = _step5.value; | ||
if (_isArray5) { | ||
if (_i5 >= _iterator5.length) break; | ||
_ref5 = _iterator5[_i5++]; | ||
} else { | ||
_i5 = _iterator5.next(); | ||
if (_i5.done) break; | ||
_ref5 = _i5.value; | ||
} | ||
var choice = new _choice2.default(choiceAttributes); | ||
var choiceAttributes = _ref5; | ||
choices.push(choice); | ||
} | ||
} catch (err) { | ||
_didIteratorError5 = true; | ||
_iteratorError5 = err; | ||
} finally { | ||
try { | ||
if (!_iteratorNormalCompletion5 && _iterator5.return) { | ||
_iterator5.return(); | ||
} | ||
} finally { | ||
if (_didIteratorError5) { | ||
throw _iteratorError5; | ||
} | ||
} | ||
var choice = new _choice2.default(choiceAttributes); | ||
choices.push(choice); | ||
} | ||
@@ -247,0 +206,0 @@ |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.__esModule = true; | ||
@@ -7,0 +5,0 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } |
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.__esModule = true; | ||
@@ -19,2 +17,4 @@ 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; }; }(); | ||
function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
@@ -24,3 +24,3 @@ | ||
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; } | ||
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) : _defaults(subClass, superClass); } | ||
@@ -33,3 +33,3 @@ var ClassificationElement = function (_Element) { | ||
var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(ClassificationElement).call(this, parent, attributes)); | ||
var _this = _possibleConstructorReturn(this, _Element.call(this, parent, attributes)); | ||
@@ -45,18 +45,17 @@ _this.allowOther = !!attributes.allowOther; | ||
_createClass(ClassificationElement, [{ | ||
key: 'load', | ||
value: function load(dataSource, callback) { | ||
var _this2 = this; | ||
ClassificationElement.prototype.load = function load(dataSource, callback) { | ||
var _this2 = this; | ||
dataSource.getClassificationSet(this._classificationSetID, function (err, classificationSet) { | ||
if (err) { | ||
return callback(err); | ||
} | ||
dataSource.getClassificationSet(this._classificationSetID, function (err, classificationSet) { | ||
if (err) { | ||
return callback(err); | ||
} | ||
_this2.classificationSet = classificationSet; | ||
_this2.classificationSet = classificationSet; | ||
return callback(); | ||
}); | ||
} | ||
}, { | ||
return callback(); | ||
}); | ||
}; | ||
_createClass(ClassificationElement, [{ | ||
key: 'classificationItems', | ||
@@ -76,27 +75,19 @@ get: function get() { | ||
var _iteratorNormalCompletion = true; | ||
var _didIteratorError = false; | ||
var _iteratorError = undefined; | ||
for (var _iterator = overrideClassificationSetItems, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) { | ||
var _ref; | ||
try { | ||
for (var _iterator = overrideClassificationSetItems[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { | ||
var classificationAttributes = _step.value; | ||
if (_isArray) { | ||
if (_i >= _iterator.length) break; | ||
_ref = _iterator[_i++]; | ||
} else { | ||
_i = _iterator.next(); | ||
if (_i.done) break; | ||
_ref = _i.value; | ||
} | ||
var classification = new _classification2.default(null, classificationAttributes); | ||
var classificationAttributes = _ref; | ||
classificationItems.push(classification); | ||
} | ||
} catch (err) { | ||
_didIteratorError = true; | ||
_iteratorError = err; | ||
} finally { | ||
try { | ||
if (!_iteratorNormalCompletion && _iterator.return) { | ||
_iterator.return(); | ||
} | ||
} finally { | ||
if (_didIteratorError) { | ||
throw _iteratorError; | ||
} | ||
} | ||
var classification = new _classification2.default(null, classificationAttributes); | ||
classificationItems.push(classification); | ||
} | ||
@@ -117,48 +108,33 @@ | ||
var _iteratorNormalCompletion2 = true; | ||
var _didIteratorError2 = false; | ||
var _iteratorError2 = undefined; | ||
for (var _iterator2 = items, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator]();;) { | ||
var _ref2; | ||
try { | ||
for (var _iterator2 = items[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) { | ||
var item = _step2.value; | ||
var _iteratorNormalCompletion3 = true; | ||
var _didIteratorError3 = false; | ||
var _iteratorError3 = undefined; | ||
if (_isArray2) { | ||
if (_i2 >= _iterator2.length) break; | ||
_ref2 = _iterator2[_i2++]; | ||
} else { | ||
_i2 = _iterator2.next(); | ||
if (_i2.done) break; | ||
_ref2 = _i2.value; | ||
} | ||
try { | ||
for (var _iterator3 = this.classificationFilter[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) { | ||
var filter = _step3.value; | ||
var item = _ref2; | ||
if (item.value.toLowerCase().indexOf(filter.toLowerCase()) !== -1) { | ||
filteredItems.push(item); | ||
} | ||
} | ||
} catch (err) { | ||
_didIteratorError3 = true; | ||
_iteratorError3 = err; | ||
} finally { | ||
try { | ||
if (!_iteratorNormalCompletion3 && _iterator3.return) { | ||
_iterator3.return(); | ||
} | ||
} finally { | ||
if (_didIteratorError3) { | ||
throw _iteratorError3; | ||
} | ||
} | ||
for (var _iterator3 = this.classificationFilter, _isArray3 = Array.isArray(_iterator3), _i3 = 0, _iterator3 = _isArray3 ? _iterator3 : _iterator3[Symbol.iterator]();;) { | ||
var _ref3; | ||
if (_isArray3) { | ||
if (_i3 >= _iterator3.length) break; | ||
_ref3 = _iterator3[_i3++]; | ||
} else { | ||
_i3 = _iterator3.next(); | ||
if (_i3.done) break; | ||
_ref3 = _i3.value; | ||
} | ||
} | ||
} catch (err) { | ||
_didIteratorError2 = true; | ||
_iteratorError2 = err; | ||
} finally { | ||
try { | ||
if (!_iteratorNormalCompletion2 && _iterator2.return) { | ||
_iterator2.return(); | ||
var filter = _ref3; | ||
if (item.value.toLowerCase().indexOf(filter.toLowerCase()) !== -1) { | ||
filteredItems.push(item); | ||
} | ||
} finally { | ||
if (_didIteratorError2) { | ||
throw _iteratorError2; | ||
} | ||
} | ||
@@ -165,0 +141,0 @@ } |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.__esModule = true; | ||
@@ -21,25 +19,17 @@ 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; }; }(); | ||
if (attributes.child_classifications) { | ||
var _iteratorNormalCompletion = true; | ||
var _didIteratorError = false; | ||
var _iteratorError = undefined; | ||
for (var _iterator = attributes.child_classifications, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) { | ||
var _ref; | ||
try { | ||
for (var _iterator = attributes.child_classifications[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { | ||
var child = _step.value; | ||
if (_isArray) { | ||
if (_i >= _iterator.length) break; | ||
_ref = _iterator[_i++]; | ||
} else { | ||
_i = _iterator.next(); | ||
if (_i.done) break; | ||
_ref = _i.value; | ||
} | ||
this.children.push(new Classification(this, child)); | ||
} | ||
} catch (err) { | ||
_didIteratorError = true; | ||
_iteratorError = err; | ||
} finally { | ||
try { | ||
if (!_iteratorNormalCompletion && _iterator.return) { | ||
_iterator.return(); | ||
} | ||
} finally { | ||
if (_didIteratorError) { | ||
throw _iteratorError; | ||
} | ||
} | ||
var child = _ref; | ||
this.children.push(new Classification(this, child)); | ||
} | ||
@@ -49,37 +39,28 @@ } | ||
_createClass(Classification, [{ | ||
key: "toJSON", | ||
value: function toJSON() { | ||
var values = []; | ||
Classification.prototype.toJSON = function toJSON() { | ||
var values = []; | ||
var _iteratorNormalCompletion2 = true; | ||
var _didIteratorError2 = false; | ||
var _iteratorError2 = undefined; | ||
for (var _iterator2 = this.exploded, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator]();;) { | ||
var _ref2; | ||
try { | ||
for (var _iterator2 = this.exploded[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) { | ||
var item = _step2.value; | ||
if (_isArray2) { | ||
if (_i2 >= _iterator2.length) break; | ||
_ref2 = _iterator2[_i2++]; | ||
} else { | ||
_i2 = _iterator2.next(); | ||
if (_i2.done) break; | ||
_ref2 = _i2.value; | ||
} | ||
if (item.value) { | ||
values.push(item.value); | ||
} | ||
} | ||
} catch (err) { | ||
_didIteratorError2 = true; | ||
_iteratorError2 = err; | ||
} finally { | ||
try { | ||
if (!_iteratorNormalCompletion2 && _iterator2.return) { | ||
_iterator2.return(); | ||
} | ||
} finally { | ||
if (_didIteratorError2) { | ||
throw _iteratorError2; | ||
} | ||
} | ||
var item = _ref2; | ||
if (item.value) { | ||
values.push(item.value); | ||
} | ||
} | ||
return values; | ||
} | ||
}, { | ||
return values; | ||
}; | ||
_createClass(Classification, [{ | ||
key: "exploded", | ||
@@ -86,0 +67,0 @@ get: function get() { |
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.__esModule = 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 _textUtils = require('../utils/text-utils'); | ||
@@ -27,371 +23,316 @@ | ||
_createClass(Condition, [{ | ||
key: 'isSatisfied', | ||
value: function isSatisfied(record, values, cache) { | ||
var referencedElement = Condition.elementForCondition(this, record); | ||
Condition.isEqual = function isEqual(formValue, stringValue) { | ||
if (formValue == null) { | ||
return _textUtils2.default.isEmpty(stringValue); | ||
} | ||
return formValue.isEqual(stringValue); | ||
}; | ||
var isReferencedFieldSatisfied = true; | ||
Condition.isEmpty = function isEmpty(formValue) { | ||
return formValue === null || formValue.isEmpty(); | ||
}; | ||
if (referencedElement != null) { | ||
// If the referenced element or one its parents is explicitly marked as hidden, it's a special | ||
// case and the referenced element should always be considered satisfied so that it's possible | ||
// to put conditions on explicitly hidden values. | ||
Condition.contains = function contains(formValue, stringValue) { | ||
if (formValue == null) { | ||
return _textUtils2.default.isEmpty(stringValue); | ||
} | ||
return formValue.contains(stringValue); | ||
}; | ||
var skipElement = referencedElement.hidden || referencedElement.hasHiddenParent; | ||
Condition.startsWith = function startsWith(formValue, stringValue) { | ||
if (formValue == null) { | ||
return _textUtils2.default.isEmpty(stringValue); | ||
} | ||
return formValue.startsWith(stringValue); | ||
}; | ||
if (!skipElement) { | ||
isReferencedFieldSatisfied = Condition.shouldElementBeVisibleRecursive(referencedElement, record, values, cache); | ||
} | ||
} | ||
Condition.isLessThan = function isLessThan(formValue, stringValue) { | ||
if (formValue == null) { | ||
return _textUtils2.default.isEmpty(stringValue); | ||
} | ||
return formValue.isLessThan(stringValue); | ||
}; | ||
return this._isSatisfied(record, values, isReferencedFieldSatisfied); | ||
Condition.isGreaterThan = function isGreaterThan(formValue, stringValue) { | ||
if (formValue == null) { | ||
return _textUtils2.default.isEmpty(stringValue); | ||
} | ||
}, { | ||
key: '_isSatisfied', | ||
value: function _isSatisfied(record, values, isReferencedFieldSatisfied) { | ||
var formValue = null; | ||
return formValue.isGreaterThan(stringValue); | ||
}; | ||
// if all of this field's conditions aren't also satisfied, treat the value as nil (empty). This has the same | ||
// effect as 'clearing' invisible values by treating them as blank when their conditions aren't met, regardless | ||
// of the actual preserved value in the field. If a field is invisible, its value is always nil with respect | ||
// to condition logic. | ||
Condition.shouldElementBeVisible = function shouldElementBeVisible(element, record, values, cache) { | ||
if (cache != null && cache[element.key] != null) { | ||
return cache[element.key]; | ||
} | ||
if (isReferencedFieldSatisfied) { | ||
formValue = Condition.valueForCondition(this, values, record); | ||
} | ||
cache = cache || {}; | ||
switch (this.operator) { | ||
case 'equal_to': | ||
return Condition.isEqual(formValue, this.value); | ||
var shouldBeVisible = Condition.shouldElementBeVisibleRecursive(element, record, values, cache); | ||
case 'not_equal_to': | ||
return !Condition.isEqual(formValue, this.value); | ||
if (element.isSectionElement) { | ||
var hasVisibleChildren = false; | ||
case 'is_empty': | ||
return Condition.isEmpty(formValue); | ||
for (var _iterator = element.elements, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) { | ||
var _ref; | ||
case 'is_not_empty': | ||
return !Condition.isEmpty(formValue); | ||
if (_isArray) { | ||
if (_i >= _iterator.length) break; | ||
_ref = _iterator[_i++]; | ||
} else { | ||
_i = _iterator.next(); | ||
if (_i.done) break; | ||
_ref = _i.value; | ||
} | ||
case 'contains': | ||
return Condition.contains(formValue, this.value); | ||
var childElement = _ref; | ||
case 'starts_with': | ||
return Condition.startsWith(formValue, this.value); | ||
var visible = Condition.shouldElementBeVisibleRecursive(childElement, record, values, cache); | ||
case 'greater_than': | ||
return Condition.greaterThan(formValue, this.value); | ||
case 'less_than': | ||
return Condition.lessThan(formValue, this.value); | ||
default: | ||
if (visible) { | ||
hasVisibleChildren = true; | ||
break; | ||
} | ||
} | ||
return true; | ||
shouldBeVisible = shouldBeVisible && hasVisibleChildren; | ||
} | ||
}], [{ | ||
key: 'isEqual', | ||
value: function isEqual(formValue, stringValue) { | ||
if (formValue == null) { | ||
return _textUtils2.default.isEmpty(stringValue); | ||
} | ||
return formValue.isEqual(stringValue); | ||
return shouldBeVisible; | ||
}; | ||
Condition.shouldElementBeVisibleRecursive = function shouldElementBeVisibleRecursive(element, record, values, cache) { | ||
if (cache != null && cache[element.key] != null) { | ||
return cache[element.key]; | ||
} | ||
}, { | ||
key: 'isEmpty', | ||
value: function isEmpty(formValue) { | ||
return formValue === null || formValue.isEmpty(); | ||
// break circular conditions by assigning an early `true` value so if this | ||
// method is re-entered again for the same element before the recursion | ||
// ends, it early exits instead of blowing the stack | ||
cache[element.key] = true; | ||
if (element.hidden || element.hasHiddenParent) { | ||
cache[element.key] = false; | ||
return false; | ||
} | ||
}, { | ||
key: 'contains', | ||
value: function contains(formValue, stringValue) { | ||
if (formValue == null) { | ||
return _textUtils2.default.isEmpty(stringValue); | ||
} | ||
return formValue.contains(stringValue); | ||
var shouldBeVisible = false; | ||
if (!element.hasVisibilityConditions) { | ||
shouldBeVisible = true; | ||
} | ||
}, { | ||
key: 'startsWith', | ||
value: function startsWith(formValue, stringValue) { | ||
if (formValue == null) { | ||
return _textUtils2.default.isEmpty(stringValue); | ||
} | ||
return formValue.startsWith(stringValue); | ||
} | ||
}, { | ||
key: 'isLessThan', | ||
value: function isLessThan(formValue, stringValue) { | ||
if (formValue == null) { | ||
return _textUtils2.default.isEmpty(stringValue); | ||
} | ||
return formValue.isLessThan(stringValue); | ||
} | ||
}, { | ||
key: 'isGreaterThan', | ||
value: function isGreaterThan(formValue, stringValue) { | ||
if (formValue == null) { | ||
return _textUtils2.default.isEmpty(stringValue); | ||
} | ||
return formValue.isGreaterThan(stringValue); | ||
} | ||
}, { | ||
key: 'shouldElementBeVisible', | ||
value: function shouldElementBeVisible(element, record, values, cache) { | ||
if (cache != null && cache[element.key] != null) { | ||
return cache[element.key]; | ||
} | ||
cache = cache || {}; | ||
if (element.visibleConditionsType === 'any') { | ||
for (var _iterator2 = element.visibleConditions, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator]();;) { | ||
var _ref2; | ||
var shouldBeVisible = Condition.shouldElementBeVisibleRecursive(element, record, values, cache); | ||
if (_isArray2) { | ||
if (_i2 >= _iterator2.length) break; | ||
_ref2 = _iterator2[_i2++]; | ||
} else { | ||
_i2 = _iterator2.next(); | ||
if (_i2.done) break; | ||
_ref2 = _i2.value; | ||
} | ||
if (element.isSectionElement) { | ||
var hasVisibleChildren = false; | ||
var condition = _ref2; | ||
var _iteratorNormalCompletion = true; | ||
var _didIteratorError = false; | ||
var _iteratorError = undefined; | ||
var isSatisfied = condition.isSatisfied(record, values, cache); | ||
try { | ||
for (var _iterator = element.elements[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { | ||
var childElement = _step.value; | ||
if (isSatisfied) { | ||
shouldBeVisible = true; | ||
break; | ||
} | ||
} | ||
} else if (element.visibleConditionsType === 'all') { | ||
shouldBeVisible = true; | ||
var visible = Condition.shouldElementBeVisibleRecursive(childElement, record, values, cache); | ||
for (var _iterator3 = element.visibleConditions, _isArray3 = Array.isArray(_iterator3), _i3 = 0, _iterator3 = _isArray3 ? _iterator3 : _iterator3[Symbol.iterator]();;) { | ||
var _ref3; | ||
if (visible) { | ||
hasVisibleChildren = true; | ||
break; | ||
} | ||
} | ||
} catch (err) { | ||
_didIteratorError = true; | ||
_iteratorError = err; | ||
} finally { | ||
try { | ||
if (!_iteratorNormalCompletion && _iterator.return) { | ||
_iterator.return(); | ||
} | ||
} finally { | ||
if (_didIteratorError) { | ||
throw _iteratorError; | ||
} | ||
} | ||
if (_isArray3) { | ||
if (_i3 >= _iterator3.length) break; | ||
_ref3 = _iterator3[_i3++]; | ||
} else { | ||
_i3 = _iterator3.next(); | ||
if (_i3.done) break; | ||
_ref3 = _i3.value; | ||
} | ||
shouldBeVisible = shouldBeVisible && hasVisibleChildren; | ||
var condition = _ref3; | ||
var isSatisfied = condition.isSatisfied(record, values, cache); | ||
if (!isSatisfied) { | ||
shouldBeVisible = false; | ||
} | ||
} | ||
return shouldBeVisible; | ||
} | ||
}, { | ||
key: 'shouldElementBeVisibleRecursive', | ||
value: function shouldElementBeVisibleRecursive(element, record, values, cache) { | ||
if (cache != null && cache[element.key] != null) { | ||
return cache[element.key]; | ||
} | ||
// break circular conditions by assigning an early `true` value so if this | ||
// method is re-entered again for the same element before the recursion | ||
// ends, it early exits instead of blowing the stack | ||
cache[element.key] = true; | ||
// Make sure all parent elements are also visible according to these same rules. | ||
// If a section is hidden because of a rule, all child elements are implicitly hidden | ||
// and should return NO from this method. This makes it very easy to determine value relevance | ||
// by looking at only the field values without having to worry about Section elements and | ||
// dependencies. See clearInvisibleValuesWithConditionValues for usage of this method that | ||
// relies on this behavior. | ||
if (element.hidden || element.hasHiddenParent) { | ||
cache[element.key] = false; | ||
return false; | ||
} | ||
var parentsVisible = true; | ||
var shouldBeVisible = false; | ||
var iterator = element.parent; | ||
if (!element.hasVisibilityConditions) { | ||
shouldBeVisible = true; | ||
while (iterator != null) { | ||
var parentVisible = Condition.shouldElementBeVisibleRecursive(iterator, record, values, cache); | ||
if (!parentVisible) { | ||
parentsVisible = false; | ||
break; | ||
} | ||
if (element.visibleConditionsType === 'any') { | ||
var _iteratorNormalCompletion2 = true; | ||
var _didIteratorError2 = false; | ||
var _iteratorError2 = undefined; | ||
iterator = iterator.parent; | ||
} | ||
try { | ||
for (var _iterator2 = element.visibleConditions[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) { | ||
var condition = _step2.value; | ||
var result = parentsVisible && shouldBeVisible; | ||
var isSatisfied = condition.isSatisfied(record, values, cache); | ||
cache[element.key] = result; | ||
if (isSatisfied) { | ||
shouldBeVisible = true; | ||
break; | ||
} | ||
} | ||
} catch (err) { | ||
_didIteratorError2 = true; | ||
_iteratorError2 = err; | ||
} finally { | ||
try { | ||
if (!_iteratorNormalCompletion2 && _iterator2.return) { | ||
_iterator2.return(); | ||
} | ||
} finally { | ||
if (_didIteratorError2) { | ||
throw _iteratorError2; | ||
} | ||
} | ||
} | ||
} else if (element.visibleConditionsType === 'all') { | ||
shouldBeVisible = true; | ||
return result; | ||
}; | ||
var _iteratorNormalCompletion3 = true; | ||
var _didIteratorError3 = false; | ||
var _iteratorError3 = undefined; | ||
Condition.shouldElementBeRequired = function shouldElementBeRequired(element, record, values) { | ||
if (!element.hasRequiredConditions) { | ||
return element.required; | ||
} | ||
try { | ||
for (var _iterator3 = element.visibleConditions[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) { | ||
var condition = _step3.value; | ||
var cache = {}; | ||
var isSatisfied = condition.isSatisfied(record, values, cache); | ||
var shouldBeRequired = false; | ||
if (!isSatisfied) { | ||
shouldBeVisible = false; | ||
} | ||
} | ||
} catch (err) { | ||
_didIteratorError3 = true; | ||
_iteratorError3 = err; | ||
} finally { | ||
try { | ||
if (!_iteratorNormalCompletion3 && _iterator3.return) { | ||
_iterator3.return(); | ||
} | ||
} finally { | ||
if (_didIteratorError3) { | ||
throw _iteratorError3; | ||
} | ||
} | ||
if (element.requiredConditionsType === 'any') { | ||
for (var _iterator4 = element.requiredConditions, _isArray4 = Array.isArray(_iterator4), _i4 = 0, _iterator4 = _isArray4 ? _iterator4 : _iterator4[Symbol.iterator]();;) { | ||
var _ref4; | ||
if (_isArray4) { | ||
if (_i4 >= _iterator4.length) break; | ||
_ref4 = _iterator4[_i4++]; | ||
} else { | ||
_i4 = _iterator4.next(); | ||
if (_i4.done) break; | ||
_ref4 = _i4.value; | ||
} | ||
var condition = _ref4; | ||
var isSatisfied = condition.isSatisfied(record, values, cache); | ||
if (isSatisfied) { | ||
shouldBeRequired = true; | ||
break; | ||
} | ||
} | ||
} else if (element.requiredConditionsType === 'all') { | ||
shouldBeRequired = true; | ||
// Make sure all parent elements are also visible according to these same rules. | ||
// If a section is hidden because of a rule, all child elements are implicitly hidden | ||
// and should return NO from this method. This makes it very easy to determine value relevance | ||
// by looking at only the field values without having to worry about Section elements and | ||
// dependencies. See clearInvisibleValuesWithConditionValues for usage of this method that | ||
// relies on this behavior. | ||
for (var _iterator5 = element.requiredConditions, _isArray5 = Array.isArray(_iterator5), _i5 = 0, _iterator5 = _isArray5 ? _iterator5 : _iterator5[Symbol.iterator]();;) { | ||
var _ref5; | ||
var parentsVisible = true; | ||
if (_isArray5) { | ||
if (_i5 >= _iterator5.length) break; | ||
_ref5 = _iterator5[_i5++]; | ||
} else { | ||
_i5 = _iterator5.next(); | ||
if (_i5.done) break; | ||
_ref5 = _i5.value; | ||
} | ||
var iterator = element.parent; | ||
var condition = _ref5; | ||
while (iterator != null) { | ||
var parentVisible = Condition.shouldElementBeVisibleRecursive(iterator, record, values, cache); | ||
var isSatisfied = condition.isSatisfied(record, values, cache); | ||
if (!parentVisible) { | ||
parentsVisible = false; | ||
if (!isSatisfied) { | ||
shouldBeRequired = false; | ||
break; | ||
} | ||
iterator = iterator.parent; | ||
} | ||
} | ||
var result = parentsVisible && shouldBeVisible; | ||
return shouldBeRequired; | ||
}; | ||
cache[element.key] = result; | ||
Condition.valueForCondition = function valueForCondition(condition, values, record) { | ||
if (condition.fieldKey === '@status') { | ||
return record.statusValue(); | ||
} | ||
return values.get(condition.fieldKey); | ||
}; | ||
return result; | ||
Condition.elementForCondition = function elementForCondition(condition, record) { | ||
if (condition.fieldKey === '@status') { | ||
return record.statusValue().statusElement; | ||
} | ||
}, { | ||
key: 'shouldElementBeRequired', | ||
value: function shouldElementBeRequired(element, record, values) { | ||
if (!element.hasRequiredConditions) { | ||
return element.required; | ||
return record.form.elementsByKey[condition.fieldKey]; | ||
}; | ||
Condition.prototype.isSatisfied = function isSatisfied(record, values, cache) { | ||
var referencedElement = Condition.elementForCondition(this, record); | ||
var isReferencedFieldSatisfied = true; | ||
if (referencedElement != null) { | ||
// If the referenced element or one its parents is explicitly marked as hidden, it's a special | ||
// case and the referenced element should always be considered satisfied so that it's possible | ||
// to put conditions on explicitly hidden values. | ||
var skipElement = referencedElement.hidden || referencedElement.hasHiddenParent; | ||
if (!skipElement) { | ||
isReferencedFieldSatisfied = Condition.shouldElementBeVisibleRecursive(referencedElement, record, values, cache); | ||
} | ||
} | ||
var cache = {}; | ||
return this._isSatisfied(record, values, isReferencedFieldSatisfied); | ||
}; | ||
var shouldBeRequired = false; | ||
Condition.prototype._isSatisfied = function _isSatisfied(record, values, isReferencedFieldSatisfied) { | ||
var formValue = null; | ||
if (element.requiredConditionsType === 'any') { | ||
var _iteratorNormalCompletion4 = true; | ||
var _didIteratorError4 = false; | ||
var _iteratorError4 = undefined; | ||
// if all of this field's conditions aren't also satisfied, treat the value as nil (empty). This has the same | ||
// effect as 'clearing' invisible values by treating them as blank when their conditions aren't met, regardless | ||
// of the actual preserved value in the field. If a field is invisible, its value is always nil with respect | ||
// to condition logic. | ||
try { | ||
for (var _iterator4 = element.requiredConditions[Symbol.iterator](), _step4; !(_iteratorNormalCompletion4 = (_step4 = _iterator4.next()).done); _iteratorNormalCompletion4 = true) { | ||
var condition = _step4.value; | ||
if (isReferencedFieldSatisfied) { | ||
formValue = Condition.valueForCondition(this, values, record); | ||
} | ||
var isSatisfied = condition.isSatisfied(record, values, cache); | ||
switch (this.operator) { | ||
case 'equal_to': | ||
return Condition.isEqual(formValue, this.value); | ||
if (isSatisfied) { | ||
shouldBeRequired = true; | ||
break; | ||
} | ||
} | ||
} catch (err) { | ||
_didIteratorError4 = true; | ||
_iteratorError4 = err; | ||
} finally { | ||
try { | ||
if (!_iteratorNormalCompletion4 && _iterator4.return) { | ||
_iterator4.return(); | ||
} | ||
} finally { | ||
if (_didIteratorError4) { | ||
throw _iteratorError4; | ||
} | ||
} | ||
} | ||
} else if (element.requiredConditionsType === 'all') { | ||
shouldBeRequired = true; | ||
case 'not_equal_to': | ||
return !Condition.isEqual(formValue, this.value); | ||
var _iteratorNormalCompletion5 = true; | ||
var _didIteratorError5 = false; | ||
var _iteratorError5 = undefined; | ||
case 'is_empty': | ||
return Condition.isEmpty(formValue); | ||
try { | ||
for (var _iterator5 = element.requiredConditions[Symbol.iterator](), _step5; !(_iteratorNormalCompletion5 = (_step5 = _iterator5.next()).done); _iteratorNormalCompletion5 = true) { | ||
var condition = _step5.value; | ||
case 'is_not_empty': | ||
return !Condition.isEmpty(formValue); | ||
var isSatisfied = condition.isSatisfied(record, values, cache); | ||
case 'contains': | ||
return Condition.contains(formValue, this.value); | ||
if (!isSatisfied) { | ||
shouldBeRequired = false; | ||
break; | ||
} | ||
} | ||
} catch (err) { | ||
_didIteratorError5 = true; | ||
_iteratorError5 = err; | ||
} finally { | ||
try { | ||
if (!_iteratorNormalCompletion5 && _iterator5.return) { | ||
_iterator5.return(); | ||
} | ||
} finally { | ||
if (_didIteratorError5) { | ||
throw _iteratorError5; | ||
} | ||
} | ||
} | ||
} | ||
case 'starts_with': | ||
return Condition.startsWith(formValue, this.value); | ||
return shouldBeRequired; | ||
case 'greater_than': | ||
return Condition.greaterThan(formValue, this.value); | ||
case 'less_than': | ||
return Condition.lessThan(formValue, this.value); | ||
default: | ||
break; | ||
} | ||
}, { | ||
key: 'valueForCondition', | ||
value: function valueForCondition(condition, values, record) { | ||
if (condition.fieldKey === '@status') { | ||
return record.statusValue(); | ||
} | ||
return values.get(condition.fieldKey); | ||
} | ||
}, { | ||
key: 'elementForCondition', | ||
value: function elementForCondition(condition, record) { | ||
if (condition.fieldKey === '@status') { | ||
return record.statusValue().statusElement; | ||
} | ||
return record.form.elementsByKey[condition.fieldKey]; | ||
} | ||
}]); | ||
return true; | ||
}; | ||
return Condition; | ||
@@ -398,0 +339,0 @@ }(); |
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.__esModule = true; | ||
@@ -17,2 +15,4 @@ var _element = require('./element'); | ||
function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
@@ -22,3 +22,3 @@ | ||
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; } | ||
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) : _defaults(subClass, superClass); } | ||
@@ -31,3 +31,3 @@ var ContainerElement = function (_Element) { | ||
var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(ContainerElement).call(this, parent, attributes)); | ||
var _this = _possibleConstructorReturn(this, _Element.call(this, parent, attributes)); | ||
@@ -34,0 +34,0 @@ _this.createChildElements(attributes.elements); |
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.__esModule = true; | ||
@@ -13,2 +11,4 @@ var _textualElement = require('./textual-element'); | ||
function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
@@ -18,3 +18,3 @@ | ||
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; } | ||
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) : _defaults(subClass, superClass); } | ||
@@ -27,3 +27,3 @@ var DateElement = function (_TextualElement) { | ||
return _possibleConstructorReturn(this, Object.getPrototypeOf(DateElement).apply(this, arguments)); | ||
return _possibleConstructorReturn(this, _TextualElement.apply(this, arguments)); | ||
} | ||
@@ -30,0 +30,0 @@ |
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.__esModule = true; | ||
@@ -33,38 +31,37 @@ 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; }; }(); | ||
_createClass(DisplayOptions, [{ | ||
key: 'format', | ||
value: function format(value) { | ||
if (!_textUtils2.default.isPresent(value)) { | ||
return value; | ||
} | ||
DisplayOptions.prototype.format = function format(value) { | ||
if (!_textUtils2.default.isPresent(value)) { | ||
return value; | ||
} | ||
switch (true) { | ||
case this.isNumber: | ||
{ | ||
return _numberUtils2.default.localizedStringFromMachineString(value, true); | ||
} | ||
switch (true) { | ||
case this.isNumber: | ||
{ | ||
return _numberUtils2.default.localizedStringFromMachineString(value, true); | ||
} | ||
case this.isDate: | ||
{ | ||
var date = _dateUtils2.default.parseDate(value); | ||
case this.isDate: | ||
{ | ||
var date = _dateUtils2.default.parseDate(value); | ||
if (date != null) { | ||
return _dateUtils2.default.formatLocalizedDate(date); | ||
} | ||
break; | ||
if (date != null) { | ||
return _dateUtils2.default.formatLocalizedDate(date); | ||
} | ||
case this.isCurrency: | ||
{ | ||
return _numberUtils2.default.formatCurrency(value, this.currency); | ||
} | ||
default: | ||
break; | ||
} | ||
} | ||
return value; | ||
case this.isCurrency: | ||
{ | ||
return _numberUtils2.default.formatCurrency(value, this.currency); | ||
} | ||
default: | ||
break; | ||
} | ||
}, { | ||
return value; | ||
}; | ||
_createClass(DisplayOptions, [{ | ||
key: 'isCurrency', | ||
@@ -71,0 +68,0 @@ get: function get() { |
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.__esModule = 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 _sectionElement = require('./section-element'); | ||
@@ -112,20 +108,16 @@ | ||
_createClass(ElementFactory, null, [{ | ||
key: 'create', | ||
value: function create(parent, attributes) { | ||
var constructor = Constructors[attributes.type]; | ||
ElementFactory.create = function create(parent, attributes) { | ||
var constructor = Constructors[attributes.type]; | ||
if (constructor == null) { | ||
throw new Error('Unsupported element ' + attributes.type); | ||
} | ||
return new constructor(parent, attributes); | ||
if (constructor == null) { | ||
throw new Error('Unsupported element ' + attributes.type); | ||
} | ||
}, { | ||
key: 'classes', | ||
value: function classes() { | ||
return Constructors; | ||
} | ||
}]); | ||
return new constructor(parent, attributes); | ||
}; | ||
ElementFactory.classes = function classes() { | ||
return Constructors; | ||
}; | ||
return ElementFactory; | ||
@@ -132,0 +124,0 @@ }(); |
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.__esModule = true; | ||
exports.default = { | ||
@@ -7,0 +5,0 @@ SectionElement: 'Section', |
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.__esModule = true; | ||
@@ -54,25 +52,17 @@ 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; }; }(); | ||
if (attributes.visible_conditions) { | ||
var _iteratorNormalCompletion = true; | ||
var _didIteratorError = false; | ||
var _iteratorError = undefined; | ||
for (var _iterator = attributes.visible_conditions, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) { | ||
var _ref; | ||
try { | ||
for (var _iterator = attributes.visible_conditions[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { | ||
var condition = _step.value; | ||
if (_isArray) { | ||
if (_i >= _iterator.length) break; | ||
_ref = _iterator[_i++]; | ||
} else { | ||
_i = _iterator.next(); | ||
if (_i.done) break; | ||
_ref = _i.value; | ||
} | ||
this.visibleConditions.push(new _condition2.default(this, condition)); | ||
} | ||
} catch (err) { | ||
_didIteratorError = true; | ||
_iteratorError = err; | ||
} finally { | ||
try { | ||
if (!_iteratorNormalCompletion && _iterator.return) { | ||
_iterator.return(); | ||
} | ||
} finally { | ||
if (_didIteratorError) { | ||
throw _iteratorError; | ||
} | ||
} | ||
var condition = _ref; | ||
this.visibleConditions.push(new _condition2.default(this, condition)); | ||
} | ||
@@ -86,25 +76,17 @@ } | ||
if (attributes.required_conditions) { | ||
var _iteratorNormalCompletion2 = true; | ||
var _didIteratorError2 = false; | ||
var _iteratorError2 = undefined; | ||
for (var _iterator2 = attributes.required_conditions, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator]();;) { | ||
var _ref2; | ||
try { | ||
for (var _iterator2 = attributes.required_conditions[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) { | ||
var condition = _step2.value; | ||
if (_isArray2) { | ||
if (_i2 >= _iterator2.length) break; | ||
_ref2 = _iterator2[_i2++]; | ||
} else { | ||
_i2 = _iterator2.next(); | ||
if (_i2.done) break; | ||
_ref2 = _i2.value; | ||
} | ||
this.requiredConditions.push(new _condition2.default(this, condition)); | ||
} | ||
} catch (err) { | ||
_didIteratorError2 = true; | ||
_iteratorError2 = err; | ||
} finally { | ||
try { | ||
if (!_iteratorNormalCompletion2 && _iterator2.return) { | ||
_iterator2.return(); | ||
} | ||
} finally { | ||
if (_didIteratorError2) { | ||
throw _iteratorError2; | ||
} | ||
} | ||
var condition = _ref2; | ||
this.requiredConditions.push(new _condition2.default(this, condition)); | ||
} | ||
@@ -125,8 +107,40 @@ } | ||
Element.factory = function factory() { | ||
return ElementFactory = ElementFactory || require('./element-factory').default; | ||
}; | ||
Element.create = function create(parent, attributes) { | ||
return Element.factory().create(parent, attributes); | ||
}; | ||
Element.classes = function classes() { | ||
if (Element._classes == null) { | ||
Element._classes = {}; | ||
for (var _iterator3 = Object.keys(_elementTypes2.default), _isArray3 = Array.isArray(_iterator3), _i3 = 0, _iterator3 = _isArray3 ? _iterator3 : _iterator3[Symbol.iterator]();;) { | ||
var _ref3; | ||
if (_isArray3) { | ||
if (_i3 >= _iterator3.length) break; | ||
_ref3 = _iterator3[_i3++]; | ||
} else { | ||
_i3 = _iterator3.next(); | ||
if (_i3.done) break; | ||
_ref3 = _i3.value; | ||
} | ||
var klass = _ref3; | ||
Element._classes[klass] = Element.factory().classes()[_elementTypes2.default[klass]]; | ||
} | ||
} | ||
return Element._classes; | ||
}; | ||
Element.prototype.isType = function isType(type) { | ||
return this.type === type; | ||
}; | ||
_createClass(Element, [{ | ||
key: 'isType', | ||
value: function isType(type) { | ||
return this.type === type; | ||
} | ||
}, { | ||
key: 'isLengthValidationSupported', | ||
@@ -254,46 +268,2 @@ get: function get() { | ||
} | ||
}], [{ | ||
key: 'factory', | ||
value: function factory() { | ||
return ElementFactory = ElementFactory || require('./element-factory').default; | ||
} | ||
}, { | ||
key: 'create', | ||
value: function create(parent, attributes) { | ||
return Element.factory().create(parent, attributes); | ||
} | ||
}, { | ||
key: 'classes', | ||
value: function classes() { | ||
if (Element._classes == null) { | ||
Element._classes = {}; | ||
var _iteratorNormalCompletion3 = true; | ||
var _didIteratorError3 = false; | ||
var _iteratorError3 = undefined; | ||
try { | ||
for (var _iterator3 = Object.keys(_elementTypes2.default)[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) { | ||
var klass = _step3.value; | ||
Element._classes[klass] = Element.factory().classes()[_elementTypes2.default[klass]]; | ||
} | ||
} catch (err) { | ||
_didIteratorError3 = true; | ||
_iteratorError3 = err; | ||
} finally { | ||
try { | ||
if (!_iteratorNormalCompletion3 && _iterator3.return) { | ||
_iterator3.return(); | ||
} | ||
} finally { | ||
if (_didIteratorError3) { | ||
throw _iteratorError3; | ||
} | ||
} | ||
} | ||
} | ||
return Element._classes; | ||
} | ||
}]); | ||
@@ -300,0 +270,0 @@ |
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.__esModule = true; | ||
@@ -13,2 +11,4 @@ var _textualElement = require('./textual-element'); | ||
function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
@@ -18,3 +18,3 @@ | ||
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; } | ||
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) : _defaults(subClass, superClass); } | ||
@@ -27,3 +27,3 @@ var HyperlinkElement = function (_TextualElement) { | ||
var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(HyperlinkElement).call(this, parent, attributes)); | ||
var _this = _possibleConstructorReturn(this, _TextualElement.call(this, parent, attributes)); | ||
@@ -30,0 +30,0 @@ _this.defaultURL = attributes.default_url; |
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.__esModule = true; | ||
@@ -13,2 +11,4 @@ var _element = require('./element'); | ||
function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
@@ -18,3 +18,3 @@ | ||
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; } | ||
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) : _defaults(subClass, superClass); } | ||
@@ -27,3 +27,3 @@ var LabelElement = function (_Element) { | ||
return _possibleConstructorReturn(this, Object.getPrototypeOf(LabelElement).apply(this, arguments)); | ||
return _possibleConstructorReturn(this, _Element.apply(this, arguments)); | ||
} | ||
@@ -30,0 +30,0 @@ |
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.__esModule = true; | ||
@@ -13,2 +11,4 @@ var _element = require('./element'); | ||
function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
@@ -18,3 +18,3 @@ | ||
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; } | ||
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) : _defaults(subClass, superClass); } | ||
@@ -27,3 +27,3 @@ var MediaElement = function (_Element) { | ||
return _possibleConstructorReturn(this, Object.getPrototypeOf(MediaElement).apply(this, arguments)); | ||
return _possibleConstructorReturn(this, _Element.apply(this, arguments)); | ||
} | ||
@@ -30,0 +30,0 @@ |
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.__esModule = true; | ||
@@ -13,2 +11,4 @@ var _mediaElement = require('./media-element'); | ||
function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
@@ -18,3 +18,3 @@ | ||
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; } | ||
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) : _defaults(subClass, superClass); } | ||
@@ -27,3 +27,3 @@ var PhotoElement = function (_MediaElement) { | ||
return _possibleConstructorReturn(this, Object.getPrototypeOf(PhotoElement).apply(this, arguments)); | ||
return _possibleConstructorReturn(this, _MediaElement.apply(this, arguments)); | ||
} | ||
@@ -30,0 +30,0 @@ |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.__esModule = true; | ||
@@ -7,0 +5,0 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.__esModule = true; | ||
@@ -7,0 +5,0 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } |
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.__esModule = 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 _element = require('./element'); | ||
@@ -23,2 +19,4 @@ | ||
function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
@@ -28,3 +26,3 @@ | ||
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; } | ||
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) : _defaults(subClass, superClass); } | ||
@@ -37,3 +35,3 @@ var RecordLinkElement = function (_Element) { | ||
var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(RecordLinkElement).call(this, parent, attributes)); | ||
var _this = _possibleConstructorReturn(this, _Element.call(this, parent, attributes)); | ||
@@ -53,25 +51,17 @@ _this._formID = attributes.form_id; | ||
if (attributes.record_conditions) { | ||
var _iteratorNormalCompletion = true; | ||
var _didIteratorError = false; | ||
var _iteratorError = undefined; | ||
for (var _iterator = attributes.record_conditions, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) { | ||
var _ref; | ||
try { | ||
for (var _iterator = attributes.record_conditions[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { | ||
var condition = _step.value; | ||
if (_isArray) { | ||
if (_i >= _iterator.length) break; | ||
_ref = _iterator[_i++]; | ||
} else { | ||
_i = _iterator.next(); | ||
if (_i.done) break; | ||
_ref = _i.value; | ||
} | ||
_this.recordConditions.push(new _recordLinkCondition2.default(condition)); | ||
} | ||
} catch (err) { | ||
_didIteratorError = true; | ||
_iteratorError = err; | ||
} finally { | ||
try { | ||
if (!_iteratorNormalCompletion && _iterator.return) { | ||
_iterator.return(); | ||
} | ||
} finally { | ||
if (_didIteratorError) { | ||
throw _iteratorError; | ||
} | ||
} | ||
var condition = _ref; | ||
_this.recordConditions.push(new _recordLinkCondition2.default(condition)); | ||
} | ||
@@ -83,25 +73,17 @@ } | ||
if (attributes.record_defaults) { | ||
var _iteratorNormalCompletion2 = true; | ||
var _didIteratorError2 = false; | ||
var _iteratorError2 = undefined; | ||
for (var _iterator2 = attributes.record_defaults, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator]();;) { | ||
var _ref2; | ||
try { | ||
for (var _iterator2 = attributes.record_defaults[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) { | ||
var def = _step2.value; | ||
if (_isArray2) { | ||
if (_i2 >= _iterator2.length) break; | ||
_ref2 = _iterator2[_i2++]; | ||
} else { | ||
_i2 = _iterator2.next(); | ||
if (_i2.done) break; | ||
_ref2 = _i2.value; | ||
} | ||
_this.recordDefaults.push(new _recordLinkDefault2.default(def)); | ||
} | ||
} catch (err) { | ||
_didIteratorError2 = true; | ||
_iteratorError2 = err; | ||
} finally { | ||
try { | ||
if (!_iteratorNormalCompletion2 && _iterator2.return) { | ||
_iterator2.return(); | ||
} | ||
} finally { | ||
if (_didIteratorError2) { | ||
throw _iteratorError2; | ||
} | ||
} | ||
var def = _ref2; | ||
_this.recordDefaults.push(new _recordLinkDefault2.default(def)); | ||
} | ||
@@ -112,18 +94,15 @@ } | ||
_createClass(RecordLinkElement, [{ | ||
key: 'load', | ||
value: function load(dataSource, callback) { | ||
var _this2 = this; | ||
RecordLinkElement.prototype.load = function load(dataSource, callback) { | ||
var _this2 = this; | ||
dataSource.getForm(this._formID, function (err, form) { | ||
if (err) { | ||
return callback(err); | ||
} | ||
dataSource.getForm(this._formID, function (err, form) { | ||
if (err) { | ||
return callback(err); | ||
} | ||
_this2.form = form; | ||
_this2.form = form; | ||
return callback(); | ||
}); | ||
} | ||
}]); | ||
return callback(); | ||
}); | ||
}; | ||
@@ -130,0 +109,0 @@ return RecordLinkElement; |
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.__esModule = true; | ||
@@ -13,2 +11,4 @@ var _containerElement = require('./container-element'); | ||
function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
@@ -18,3 +18,3 @@ | ||
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; } | ||
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) : _defaults(subClass, superClass); } | ||
@@ -27,3 +27,3 @@ var RepeatableElement = function (_ContainerElement) { | ||
var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(RepeatableElement).call(this, parent, attributes)); | ||
var _this = _possibleConstructorReturn(this, _ContainerElement.call(this, parent, attributes)); | ||
@@ -30,0 +30,0 @@ _this.titleFieldKeys = attributes.title_field_keys; |
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.__esModule = true; | ||
@@ -15,2 +13,4 @@ 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; }; }(); | ||
function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
@@ -20,3 +20,3 @@ | ||
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; } | ||
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) : _defaults(subClass, superClass); } | ||
@@ -29,3 +29,3 @@ var SectionElement = function (_ContainerElement) { | ||
var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(SectionElement).call(this, parent, attributes)); | ||
var _this = _possibleConstructorReturn(this, _ContainerElement.call(this, parent, attributes)); | ||
@@ -32,0 +32,0 @@ _this.display = attributes.display; |
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.__esModule = true; | ||
@@ -13,2 +11,4 @@ var _element = require('./element'); | ||
function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
@@ -18,3 +18,3 @@ | ||
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; } | ||
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) : _defaults(subClass, superClass); } | ||
@@ -27,3 +27,3 @@ var SignatureElement = function (_Element) { | ||
var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(SignatureElement).call(this, parent, attributes)); | ||
var _this = _possibleConstructorReturn(this, _Element.call(this, parent, attributes)); | ||
@@ -30,0 +30,0 @@ _this.agreementText = attributes.agreement_text; |
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.__esModule = true; | ||
@@ -13,2 +11,4 @@ var _choice = require('./choice'); | ||
function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
@@ -18,3 +18,3 @@ | ||
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; } | ||
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) : _defaults(subClass, superClass); } | ||
@@ -27,3 +27,3 @@ var StatusChoice = function (_Choice) { | ||
var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(StatusChoice).call(this, attributes)); | ||
var _this = _possibleConstructorReturn(this, _Choice.call(this, attributes)); | ||
@@ -30,0 +30,0 @@ _this.color = attributes.color; |
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.__esModule = true; | ||
@@ -19,2 +17,4 @@ 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; }; }(); | ||
function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
@@ -24,3 +24,3 @@ | ||
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; } | ||
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) : _defaults(subClass, superClass); } | ||
@@ -33,29 +33,21 @@ var StatusElement = function (_TextualElement) { | ||
var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(StatusElement).call(this, parent, attributes)); | ||
var _this = _possibleConstructorReturn(this, _TextualElement.call(this, parent, attributes)); | ||
_this.choices = []; | ||
var _iteratorNormalCompletion = true; | ||
var _didIteratorError = false; | ||
var _iteratorError = undefined; | ||
for (var _iterator = attributes.choices, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) { | ||
var _ref; | ||
try { | ||
for (var _iterator = attributes.choices[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { | ||
var choice = _step.value; | ||
if (_isArray) { | ||
if (_i >= _iterator.length) break; | ||
_ref = _iterator[_i++]; | ||
} else { | ||
_i = _iterator.next(); | ||
if (_i.done) break; | ||
_ref = _i.value; | ||
} | ||
_this.choices.push(new _statusChoice2.default(choice)); | ||
} | ||
} catch (err) { | ||
_didIteratorError = true; | ||
_iteratorError = err; | ||
} finally { | ||
try { | ||
if (!_iteratorNormalCompletion && _iterator.return) { | ||
_iterator.return(); | ||
} | ||
} finally { | ||
if (_didIteratorError) { | ||
throw _iteratorError; | ||
} | ||
} | ||
var choice = _ref; | ||
_this.choices.push(new _statusChoice2.default(choice)); | ||
} | ||
@@ -68,35 +60,26 @@ | ||
_createClass(StatusElement, [{ | ||
key: 'statusForValue', | ||
value: function statusForValue(value) { | ||
var _iteratorNormalCompletion2 = true; | ||
var _didIteratorError2 = false; | ||
var _iteratorError2 = undefined; | ||
StatusElement.prototype.statusForValue = function statusForValue(value) { | ||
for (var _iterator2 = this.choices, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator]();;) { | ||
var _ref2; | ||
try { | ||
for (var _iterator2 = this.choices[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) { | ||
var choice = _step2.value; | ||
if (_isArray2) { | ||
if (_i2 >= _iterator2.length) break; | ||
_ref2 = _iterator2[_i2++]; | ||
} else { | ||
_i2 = _iterator2.next(); | ||
if (_i2.done) break; | ||
_ref2 = _i2.value; | ||
} | ||
if (choice.value === value) { | ||
return choice; | ||
} | ||
} | ||
} catch (err) { | ||
_didIteratorError2 = true; | ||
_iteratorError2 = err; | ||
} finally { | ||
try { | ||
if (!_iteratorNormalCompletion2 && _iterator2.return) { | ||
_iterator2.return(); | ||
} | ||
} finally { | ||
if (_didIteratorError2) { | ||
throw _iteratorError2; | ||
} | ||
} | ||
var choice = _ref2; | ||
if (choice.value === value) { | ||
return choice; | ||
} | ||
} | ||
return null; | ||
} | ||
}, { | ||
return null; | ||
}; | ||
_createClass(StatusElement, [{ | ||
key: 'isEnabled', | ||
@@ -103,0 +86,0 @@ get: function get() { |
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.__esModule = true; | ||
@@ -15,2 +13,4 @@ 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; }; }(); | ||
function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
@@ -20,3 +20,3 @@ | ||
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; } | ||
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) : _defaults(subClass, superClass); } | ||
@@ -29,3 +29,3 @@ var TextElement = function (_TextualElement) { | ||
var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(TextElement).call(this, parent, attributes)); | ||
var _this = _possibleConstructorReturn(this, _TextualElement.call(this, parent, attributes)); | ||
@@ -32,0 +32,0 @@ _this.numeric = !!attributes.numeric; |
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.__esModule = true; | ||
@@ -13,2 +11,4 @@ var _element = require('./element'); | ||
function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
@@ -18,3 +18,3 @@ | ||
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; } | ||
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) : _defaults(subClass, superClass); } | ||
@@ -27,3 +27,3 @@ var TextualElement = function (_Element) { | ||
return _possibleConstructorReturn(this, Object.getPrototypeOf(TextualElement).apply(this, arguments)); | ||
return _possibleConstructorReturn(this, _Element.apply(this, arguments)); | ||
} | ||
@@ -30,0 +30,0 @@ |
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.__esModule = true; | ||
@@ -13,2 +11,4 @@ var _textualElement = require('./textual-element'); | ||
function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
@@ -18,3 +18,3 @@ | ||
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; } | ||
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) : _defaults(subClass, superClass); } | ||
@@ -27,3 +27,3 @@ var TimeElement = function (_TextualElement) { | ||
return _possibleConstructorReturn(this, Object.getPrototypeOf(TimeElement).apply(this, arguments)); | ||
return _possibleConstructorReturn(this, _TextualElement.apply(this, arguments)); | ||
} | ||
@@ -30,0 +30,0 @@ |
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.__esModule = true; | ||
@@ -13,2 +11,4 @@ var _mediaElement = require('./media-element'); | ||
function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
@@ -18,3 +18,3 @@ | ||
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; } | ||
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) : _defaults(subClass, superClass); } | ||
@@ -27,3 +27,3 @@ var VideoElement = function (_MediaElement) { | ||
var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(VideoElement).call(this, parent, attributes)); | ||
var _this = _possibleConstructorReturn(this, _MediaElement.call(this, parent, attributes)); | ||
@@ -30,0 +30,0 @@ _this.trackEnabled = !!attributes.track_enabled; |
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.__esModule = true; | ||
@@ -13,2 +11,4 @@ var _textualElement = require('./textual-element'); | ||
function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
@@ -18,3 +18,3 @@ | ||
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; } | ||
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) : _defaults(subClass, superClass); } | ||
@@ -27,3 +27,3 @@ var YesNoElement = function (_TextualElement) { | ||
var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(YesNoElement).call(this, parent, attributes)); | ||
var _this = _possibleConstructorReturn(this, _TextualElement.call(this, parent, attributes)); | ||
@@ -30,0 +30,0 @@ _this.positiveChoice = attributes.positive; |
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.__esModule = true; | ||
@@ -20,13 +18,11 @@ 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; }; }(); | ||
Feature.prototype.toJSON = function toJSON() { | ||
notImplemented(); | ||
}; | ||
Feature.prototype.updateTimetamps = function updateTimetamps() { | ||
notImplemented(); | ||
}; | ||
_createClass(Feature, [{ | ||
key: 'toJSON', | ||
value: function toJSON() { | ||
notImplemented(); | ||
} | ||
}, { | ||
key: 'updateTimetamps', | ||
value: function updateTimetamps() { | ||
notImplemented(); | ||
} | ||
}, { | ||
key: 'id', | ||
@@ -33,0 +29,0 @@ get: function get() { |
107
dist/form.js
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.__esModule = true; | ||
@@ -51,68 +49,55 @@ 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; }; }(); | ||
_createClass(Form, [{ | ||
key: 'load', | ||
value: function load(dataSource, callback) { | ||
var loadElements = []; | ||
Form.prototype.load = function load(dataSource, callback) { | ||
var loadElements = []; | ||
var _iteratorNormalCompletion = true; | ||
var _didIteratorError = false; | ||
var _iteratorError = undefined; | ||
for (var _iterator = this.allElements, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) { | ||
var _ref; | ||
try { | ||
for (var _iterator = this.allElements[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { | ||
var element = _step.value; | ||
if (_isArray) { | ||
if (_i >= _iterator.length) break; | ||
_ref = _iterator[_i++]; | ||
} else { | ||
_i = _iterator.next(); | ||
if (_i.done) break; | ||
_ref = _i.value; | ||
} | ||
if (element.load) { | ||
loadElements.push(element); | ||
} | ||
} | ||
} catch (err) { | ||
_didIteratorError = true; | ||
_iteratorError = err; | ||
} finally { | ||
try { | ||
if (!_iteratorNormalCompletion && _iterator.return) { | ||
_iterator.return(); | ||
} | ||
} finally { | ||
if (_didIteratorError) { | ||
throw _iteratorError; | ||
} | ||
} | ||
var element = _ref; | ||
if (element.load) { | ||
loadElements.push(element); | ||
} | ||
_async2.default.each(loadElements, function (element, cb) { | ||
element.load(dataSource, cb); | ||
}, callback); | ||
} | ||
}, { | ||
key: 'createRecord', | ||
value: function createRecord(attributes) { | ||
var record = new _record2.default(attributes); | ||
// TODO(zhm) this might not be final | ||
record._form = this; | ||
record._formValuesJSON = {}; | ||
_async2.default.each(loadElements, function (element, cb) { | ||
element.load(dataSource, cb); | ||
}, callback); | ||
}; | ||
_defaultValues2.default.applyDefaultValuesForElements(this.elements, record.formValues, record); | ||
Form.prototype.createRecord = function createRecord(attributes) { | ||
var record = new _record2.default(attributes); | ||
return record; | ||
} | ||
}, { | ||
key: 'get', | ||
value: function get(key) { | ||
return this.elementsByKey[key]; | ||
} | ||
}, { | ||
key: 'find', | ||
value: function find(dataName) { | ||
return this.elementsByDataName[dataName]; | ||
} | ||
}, { | ||
key: 'toJSON', | ||
value: function toJSON() { | ||
// TODO(zhm) actually implement this so it returns a copy | ||
return this._json; | ||
} | ||
}, { | ||
// TODO(zhm) this might not be final | ||
record._form = this; | ||
record._formValuesJSON = {}; | ||
_defaultValues2.default.applyDefaultValuesForElements(this.elements, record.formValues, record); | ||
return record; | ||
}; | ||
Form.prototype.get = function get(key) { | ||
return this.elementsByKey[key]; | ||
}; | ||
Form.prototype.find = function find(dataName) { | ||
return this.elementsByDataName[dataName]; | ||
}; | ||
Form.prototype.toJSON = function toJSON() { | ||
// TODO(zhm) actually implement this so it returns a copy | ||
return this._json; | ||
}; | ||
_createClass(Form, [{ | ||
key: 'statusField', | ||
@@ -119,0 +104,0 @@ get: function get() { |
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.DefaultValues = exports.MemoryDataSource = exports.DataSource = exports.FeatureValidator = exports.RecordLinkItemValue = exports.RecordLinkValue = exports.RecordLinkElement = exports.SectionElement = exports.TextValue = exports.TextElement = exports.CalculatedValue = exports.CalculatedElement = exports.DateValue = exports.DateElement = exports.ClassificationValue = exports.ClassificationElement = exports.ChoiceValue = exports.ChoiceElement = exports.BarcodeValue = exports.BarcodeElement = exports.AddressValue = exports.AddressElement = exports.VideoValue = exports.VideoItemValue = exports.PhotoValue = exports.PhotoItemValue = exports.AudioValue = exports.AudioItemValue = exports.RepeatableElement = exports.Condition = exports.ChildElements = exports.NumberUtils = exports.DateUtils = exports.TextUtils = exports.FormValues = exports.Feature = exports.RepeatableValue = exports.RepeatableItemValue = exports.ElementFactory = exports.ClassificationSet = exports.Classification = exports.ChoiceList = exports.Choice = exports.FormValue = exports.Element = exports.Record = exports.Form = undefined; | ||
exports.__esModule = true; | ||
exports.Project = exports.User = exports.CustomValidationError = exports.DefaultValues = exports.MemoryDataSource = exports.DataSource = exports.FeatureValidator = exports.RecordLinkItemValue = exports.RecordLinkValue = exports.RecordLinkElement = exports.SectionElement = exports.TextValue = exports.TextElement = exports.CalculatedValue = exports.CalculatedElement = exports.DateValue = exports.DateElement = exports.ClassificationValue = exports.ClassificationElement = exports.ChoiceValue = exports.ChoiceElement = exports.BarcodeValue = exports.BarcodeElement = exports.AddressValue = exports.AddressElement = exports.VideoValue = exports.VideoItemValue = exports.PhotoValue = exports.PhotoItemValue = exports.AudioValue = exports.AudioItemValue = exports.RepeatableElement = exports.Condition = exports.ChildElements = exports.NumberUtils = exports.DateUtils = exports.TextUtils = exports.FormValues = exports.Feature = exports.RepeatableValue = exports.RepeatableItemValue = exports.ElementFactory = exports.ClassificationSet = exports.Classification = exports.ChoiceList = exports.Choice = exports.FormValue = exports.Element = exports.Record = exports.Form = undefined; | ||
@@ -192,2 +190,14 @@ var _form = require('./form'); | ||
var _customValidationError = require('./validation/custom-validation-error'); | ||
var _customValidationError2 = _interopRequireDefault(_customValidationError); | ||
var _user = require('./user'); | ||
var _user2 = _interopRequireDefault(_user); | ||
var _project = require('./project'); | ||
var _project2 = _interopRequireDefault(_project); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
@@ -242,2 +252,5 @@ | ||
exports.DefaultValues = _defaultValues2.default; | ||
exports.CustomValidationError = _customValidationError2.default; | ||
exports.User = _user2.default; | ||
exports.Project = _project2.default; | ||
//# sourceMappingURL=index.js.map |
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.__esModule = true; | ||
@@ -31,2 +29,4 @@ 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; }; }(); | ||
function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
@@ -36,3 +36,3 @@ | ||
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; } | ||
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) : _defaults(subClass, superClass); } | ||
@@ -45,3 +45,3 @@ var Record = function (_Feature) { | ||
return _possibleConstructorReturn(this, Object.getPrototypeOf(Record).call(this)); | ||
return _possibleConstructorReturn(this, _Feature.call(this)); | ||
@@ -56,48 +56,46 @@ // this._id = attributes.id; | ||
_createClass(Record, [{ | ||
key: 'toJSON', | ||
value: function toJSON() { | ||
var json = {}; | ||
Record.prototype.toJSON = function toJSON() { | ||
var json = {}; | ||
// TODO(zhm) this is incomplete | ||
json.id = this.id; | ||
json.client_created_at = _dateUtils2.default.formatTimestamp(this.createdAt); | ||
json.client_updated_at = _dateUtils2.default.formatTimestamp(this.updatedAt); | ||
json.form_values = this.formValues.toJSON(); | ||
json.latitude = this._latitude; | ||
json.longitude = this._longitude; | ||
// TODO(zhm) this is incomplete | ||
json.id = this.id; | ||
json.client_created_at = _dateUtils2.default.formatTimestamp(this.createdAt); | ||
json.client_updated_at = _dateUtils2.default.formatTimestamp(this.updatedAt); | ||
json.form_values = this.formValues.toJSON(); | ||
json.latitude = this._latitude; | ||
json.longitude = this._longitude; | ||
json.project_id = this._projectID; | ||
json.assigned_to_id = this._assignedToID; | ||
return json; | ||
return json; | ||
}; | ||
Record.prototype.updateTimestamps = function updateTimestamps() { | ||
var now = new Date(); | ||
if (this._createdAt == null) { | ||
this.createdAt = now; | ||
} | ||
}, { | ||
key: 'updateTimestamps', | ||
value: function updateTimestamps() { | ||
var now = new Date(); | ||
if (this._createdAt == null) { | ||
this.createdAt = now; | ||
} | ||
this.updatedAt = now; | ||
}; | ||
this.updatedAt = now; | ||
Record.prototype.get = function get(key, formValues) { | ||
if (key === '@status') { | ||
return this.statusValue; | ||
} | ||
}, { | ||
key: 'get', | ||
value: function get(key, formValues) { | ||
if (key === '@status') { | ||
return this.statusValue; | ||
} | ||
return formValues.get(key); | ||
return formValues.get(key); | ||
}; | ||
Record.prototype.set = function set(key, value, formValues) { | ||
if (key === '@status') { | ||
this.status = value.textValue; | ||
return; | ||
} | ||
}, { | ||
key: 'set', | ||
value: function set(key, value, formValues) { | ||
if (key === '@status') { | ||
this.status = value.textValue; | ||
return; | ||
} | ||
formValues.set(key, value); | ||
} | ||
}, { | ||
formValues.set(key, value); | ||
}; | ||
_createClass(Record, [{ | ||
key: 'id', | ||
@@ -153,3 +151,3 @@ get: function get() { | ||
get: function get() { | ||
return new _statusValue2.default(this.status, this.form.statusField); | ||
return new _statusValue2.default(this.form.statusField, this.status); | ||
} | ||
@@ -162,33 +160,25 @@ }, { | ||
var _iteratorNormalCompletion = true; | ||
var _didIteratorError = false; | ||
var _iteratorError = undefined; | ||
for (var _iterator = titleFieldKeys, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) { | ||
var _ref; | ||
try { | ||
for (var _iterator = titleFieldKeys[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { | ||
var fieldKey = _step.value; | ||
if (_isArray) { | ||
if (_i >= _iterator.length) break; | ||
_ref = _iterator[_i++]; | ||
} else { | ||
_i = _iterator.next(); | ||
if (_i.done) break; | ||
_ref = _i.value; | ||
} | ||
var value = this.formValues.get(fieldKey); | ||
var fieldKey = _ref; | ||
if (value) { | ||
var displayValue = value.displayValue; | ||
var value = this.formValues.get(fieldKey); | ||
if (_textUtils2.default.isPresent(displayValue)) { | ||
titles.push(displayValue); | ||
} | ||
if (value) { | ||
var displayValue = value.displayValue; | ||
if (_textUtils2.default.isPresent(displayValue)) { | ||
titles.push(displayValue); | ||
} | ||
} | ||
} catch (err) { | ||
_didIteratorError = true; | ||
_iteratorError = err; | ||
} finally { | ||
try { | ||
if (!_iteratorNormalCompletion && _iterator.return) { | ||
_iterator.return(); | ||
} | ||
} finally { | ||
if (_didIteratorError) { | ||
throw _iteratorError; | ||
} | ||
} | ||
} | ||
@@ -213,2 +203,26 @@ | ||
} | ||
}, { | ||
key: 'projectID', | ||
get: function get() { | ||
return this._projectID; | ||
}, | ||
set: function set(id) { | ||
this._projectID = id; | ||
} | ||
}, { | ||
key: 'assignedToID', | ||
get: function get() { | ||
return this._assignedToID; | ||
}, | ||
set: function set(id) { | ||
this._assignedToID = id; | ||
} | ||
}, { | ||
key: 'status', | ||
get: function get() { | ||
return this._status; | ||
}, | ||
set: function set(status) { | ||
this._status = status; | ||
} | ||
}]); | ||
@@ -215,0 +229,0 @@ |
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.__esModule = 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 _locale = require('./locale'); | ||
@@ -32,72 +28,62 @@ | ||
_createClass(DateUtils, null, [{ | ||
key: 'parseDate', | ||
value: function parseDate(dateString) { | ||
return new Date(dateString.replace(/-/g, '/')); | ||
DateUtils.parseDate = function parseDate(dateString) { | ||
return new Date(dateString.replace(/-/g, '/')); | ||
}; | ||
DateUtils.parseTime = function parseTime(timeString) { | ||
if (!(timeString != null && timeString.length === 5)) { | ||
return null; | ||
} | ||
}, { | ||
key: 'parseTime', | ||
value: function parseTime(timeString) { | ||
if (!(timeString != null && timeString.length === 5)) { | ||
return null; | ||
} | ||
return timeString; | ||
return timeString; | ||
}; | ||
DateUtils.formatTime = function formatTime(date) { | ||
var hours = _lodash2.default.padLeft(date.getHours(), 2, '0'); | ||
var minutes = _lodash2.default.padLeft(date.getMinutes(), 2, '0'); | ||
return hours + ':' + minutes; | ||
}; | ||
DateUtils.parseTimestamp = function parseTimestamp(timestampString) { | ||
return new Date(parseFloat(timestampString) * 1000); | ||
}; | ||
DateUtils.formatTimestamp = function formatTimestamp(date) { | ||
if (date == null) { | ||
return null; | ||
} | ||
}, { | ||
key: 'formatTime', | ||
value: function formatTime(date) { | ||
var hours = _lodash2.default.padLeft(date.getHours(), 2, '0'); | ||
var minutes = _lodash2.default.padLeft(date.getMinutes(), 2, '0'); | ||
return date.getTime().toFixed(3); | ||
}; | ||
return hours + ':' + minutes; | ||
DateUtils.formatDate = function formatDate(date) { | ||
var year = date.getFullYear(); | ||
var month = _lodash2.default.padLeft(date.getMonth() + 1, 2, '0'); | ||
var day = _lodash2.default.padLeft(date.getDate(), 2, '0'); | ||
return year + '-' + month + '-' + day; | ||
}; | ||
DateUtils.formatLocalizedDate = function formatLocalizedDate(date) { | ||
if (date == null) { | ||
return null; | ||
} | ||
}, { | ||
key: 'parseTimestamp', | ||
value: function parseTimestamp(timestampString) { | ||
return new Date(parseFloat(timestampString) * 1000); | ||
} | ||
}, { | ||
key: 'formatTimestamp', | ||
value: function formatTimestamp(date) { | ||
if (date == null) { | ||
return null; | ||
} | ||
return date.getTime().toFixed(3); | ||
} | ||
}, { | ||
key: 'formatDate', | ||
value: function formatDate(date) { | ||
return DateUtils.__formatLocalizedDate(date); | ||
}; | ||
DateUtils.__formatLocalizedDate = function __formatLocalizedDate(date) { | ||
if (!_locale2.default.supportsECMA402()) { | ||
var year = date.getFullYear(); | ||
var month = _lodash2.default.padLeft(date.getMonth() + 1, 2, '0'); | ||
var day = _lodash2.default.padLeft(date.getDate(), 2, '0'); | ||
return year + '-' + month + '-' + day; | ||
} | ||
}, { | ||
key: 'formatLocalizedDate', | ||
value: function formatLocalizedDate(date) { | ||
if (date == null) { | ||
return null; | ||
} | ||
return DateUtils.__formatLocalizedDate(date); | ||
} | ||
}, { | ||
key: '__formatLocalizedDate', | ||
value: function __formatLocalizedDate(date) { | ||
if (!_locale2.default.supportsECMA402()) { | ||
var year = date.getFullYear(); | ||
var month = _lodash2.default.padLeft(date.getMonth() + 1, 2, '0'); | ||
var day = _lodash2.default.padLeft(date.getDate(), 2, '0'); | ||
return year + '-' + month + '-' + day; | ||
} | ||
var options = { | ||
year: 'numeric', | ||
month: 'long', | ||
day: 'numeric' | ||
}; | ||
var options = { | ||
year: 'numeric', | ||
month: 'long', | ||
day: 'numeric' | ||
}; | ||
return new intl.DateTimeFormat(_locale2.default.currentLocale(), options).format(date); | ||
} | ||
}]); | ||
return new intl.DateTimeFormat(_locale2.default.currentLocale(), options).format(date); | ||
}; | ||
@@ -104,0 +90,0 @@ return DateUtils; |
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.__esModule = 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 _fs = require('fs'); | ||
@@ -40,30 +36,32 @@ | ||
_createClass(FileDataSource, [{ | ||
key: 'json', | ||
value: function json(jsonPath) { | ||
return JSON.parse(_fs2.default.readFileSync(jsonPath).toString()); | ||
} | ||
}, { | ||
key: 'getChoiceList', | ||
value: function getChoiceList(id, callback) { | ||
var jsonPath = _path2.default.join(this.root, 'choice_lists', id + '.json'); | ||
FileDataSource.prototype.json = function json(jsonPath) { | ||
return JSON.parse(_fs2.default.readFileSync(jsonPath).toString()); | ||
}; | ||
return callback(null, new _choiceList2.default(this.json(jsonPath).choice_list)); | ||
} | ||
}, { | ||
key: 'getClassificationSet', | ||
value: function getClassificationSet(id, callback) { | ||
var jsonPath = _path2.default.join(this.root, 'classification_sets', id + '.json'); | ||
FileDataSource.prototype.getChoiceList = function getChoiceList(id, callback) { | ||
var jsonPath = _path2.default.join(this.root, 'choice_lists', id + '.json'); | ||
return callback(null, new _classificationSet2.default(this.json(jsonPath).classification_set)); | ||
} | ||
}, { | ||
key: 'getForm', | ||
value: function getForm(id, callback) { | ||
var jsonPath = _path2.default.join(this.root, 'forms', id + '.json'); | ||
return callback(null, new _choiceList2.default(this.json(jsonPath).choice_list)); | ||
}; | ||
return callback(null, new _form2.default(this.json(jsonPath).form)); | ||
} | ||
}]); | ||
FileDataSource.prototype.getClassificationSet = function getClassificationSet(id, callback) { | ||
var jsonPath = _path2.default.join(this.root, 'classification_sets', id + '.json'); | ||
return callback(null, new _classificationSet2.default(this.json(jsonPath).classification_set)); | ||
}; | ||
FileDataSource.prototype.getForm = function getForm(id, callback) { | ||
var jsonPath = _path2.default.join(this.root, 'forms', id + '.json'); | ||
return callback(null, new _form2.default(this.json(jsonPath).form)); | ||
}; | ||
FileDataSource.prototype.getUsers = function getUsers(params, callback) { | ||
return callback(null, []); | ||
}; | ||
FileDataSource.prototype.getProjects = function getProjects(params, callback) { | ||
return callback(null, []); | ||
}; | ||
return FileDataSource; | ||
@@ -70,0 +68,0 @@ }(); |
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.__esModule = 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; }; }(); | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
@@ -16,22 +12,17 @@ | ||
_createClass(Locale, null, [{ | ||
key: 'currentLocale', | ||
value: function currentLocale() { | ||
return Locale.__currentLocale(); | ||
Locale.currentLocale = function currentLocale() { | ||
return Locale.__currentLocale(); | ||
}; | ||
Locale.__currentLocale = function __currentLocale() { | ||
return 'en-US'; | ||
}; | ||
Locale.supportsECMA402 = function supportsECMA402() { | ||
if (typeof Intl !== 'undefined') { | ||
return true; | ||
} else { | ||
return false; | ||
} | ||
}, { | ||
key: '__currentLocale', | ||
value: function __currentLocale() { | ||
return 'en-US'; | ||
} | ||
}, { | ||
key: 'supportsECMA402', | ||
value: function supportsECMA402() { | ||
if (typeof Intl !== 'undefined') { | ||
return true; | ||
} else { | ||
return false; | ||
} | ||
} | ||
}]); | ||
}; | ||
@@ -38,0 +29,0 @@ return Locale; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.__esModule = 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; }; }(); | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
@@ -16,50 +12,60 @@ | ||
this.cache = {}; | ||
this.projects = null; | ||
this.users = null; | ||
} | ||
_createClass(MemoryDataSource, [{ | ||
key: "getChoiceList", | ||
value: function getChoiceList(id, callback) { | ||
return callback(null, this.cache[id]); | ||
} | ||
}, { | ||
key: "getClassificationSet", | ||
value: function getClassificationSet(id, callback) { | ||
return callback(null, this.cache[id]); | ||
} | ||
}, { | ||
key: "getForm", | ||
value: function getForm(id, callback) { | ||
return callback(null, this.cache[id]); | ||
} | ||
}, { | ||
key: "getRecord", | ||
value: function getRecord(id, callback) { | ||
return callback(null, this.cache[id]); | ||
} | ||
}, { | ||
key: "getChoiceListComplete", | ||
value: function getChoiceListComplete(id, object, callback) { | ||
this.cache[id] = object; | ||
callback(); | ||
} | ||
}, { | ||
key: "getClassificationSetComplete", | ||
value: function getClassificationSetComplete(id, object, callback) { | ||
this.cache[id] = object; | ||
callback(); | ||
} | ||
}, { | ||
key: "getFormComplete", | ||
value: function getFormComplete(id, object, callback) { | ||
this.cache[id] = object; | ||
callback(); | ||
} | ||
}, { | ||
key: "getRecordComplete", | ||
value: function getRecordComplete(id, object, callback) { | ||
this.cache[id] = object; | ||
callback(); | ||
} | ||
}]); | ||
MemoryDataSource.prototype.getChoiceList = function getChoiceList(id, callback) { | ||
return callback(null, this.cache[id]); | ||
}; | ||
MemoryDataSource.prototype.getClassificationSet = function getClassificationSet(id, callback) { | ||
return callback(null, this.cache[id]); | ||
}; | ||
MemoryDataSource.prototype.getForm = function getForm(id, callback) { | ||
return callback(null, this.cache[id]); | ||
}; | ||
MemoryDataSource.prototype.getRecord = function getRecord(id, callback) { | ||
return callback(null, this.cache[id]); | ||
}; | ||
MemoryDataSource.prototype.getUsers = function getUsers(params, callback) { | ||
return callback(null, this.users); | ||
}; | ||
MemoryDataSource.prototype.getProjects = function getProjects(params, callback) { | ||
return callback(null, this.projects); | ||
}; | ||
MemoryDataSource.prototype.getChoiceListComplete = function getChoiceListComplete(id, object, callback) { | ||
this.cache[id] = object; | ||
callback(); | ||
}; | ||
MemoryDataSource.prototype.getClassificationSetComplete = function getClassificationSetComplete(id, object, callback) { | ||
this.cache[id] = object; | ||
callback(); | ||
}; | ||
MemoryDataSource.prototype.getFormComplete = function getFormComplete(id, object, callback) { | ||
this.cache[id] = object; | ||
callback(); | ||
}; | ||
MemoryDataSource.prototype.getRecordComplete = function getRecordComplete(id, object, callback) { | ||
this.cache[id] = object; | ||
callback(); | ||
}; | ||
MemoryDataSource.prototype.getUsersComplete = function getUsersComplete(params, object, callback) { | ||
this.users = object; | ||
callback(); | ||
}; | ||
MemoryDataSource.prototype.getProjectsComplete = function getProjectsComplete(params, object, callback) { | ||
this.projects = object; | ||
callback(); | ||
}; | ||
return MemoryDataSource; | ||
@@ -66,0 +72,0 @@ }(); |
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.__esModule = 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 _locale = require('./locale'); | ||
@@ -35,67 +31,59 @@ | ||
_createClass(NumberUtils, null, [{ | ||
key: 'parseDouble', | ||
value: function parseDouble(input) { | ||
return +input; | ||
NumberUtils.parseDouble = function parseDouble(input) { | ||
return +input; | ||
}; | ||
NumberUtils.localizedStringFromMachineString = function localizedStringFromMachineString(machineString, allowDecimals) { | ||
return machineString; | ||
}; | ||
NumberUtils.formatMachine = function formatMachine(number) { | ||
if (intl) { | ||
if (NumberUtils.machineFormatter == null) { | ||
NumberUtils.machineFormatter = new intl.NumberFormat(['en-US'], MachineFormatterOptions); | ||
} | ||
} | ||
}, { | ||
key: 'localizedStringFromMachineString', | ||
value: function localizedStringFromMachineString(machineString, allowDecimals) { | ||
return machineString; | ||
} | ||
}, { | ||
key: 'formatMachine', | ||
value: function formatMachine(number) { | ||
if (intl) { | ||
if (NumberUtils.machineFormatter == null) { | ||
NumberUtils.machineFormatter = new intl.NumberFormat(['en-US'], MachineFormatterOptions); | ||
} | ||
} | ||
return NumberUtils.formatWithFormatter(NumberUtils.machineFormatter, number); | ||
return NumberUtils.formatWithFormatter(NumberUtils.machineFormatter, number); | ||
}; | ||
NumberUtils.formatCurrency = function formatCurrency(number, currency) { | ||
if (number == null) { | ||
return null; | ||
} | ||
}, { | ||
key: 'formatCurrency', | ||
value: function formatCurrency(number, currency) { | ||
if (number == null) { | ||
return null; | ||
} | ||
return NumberUtils.__formatCurrency(number, currency); | ||
return NumberUtils.__formatCurrency(number, currency); | ||
}; | ||
NumberUtils.__formatCurrency = function __formatCurrency(number, currency) { | ||
if (!_locale2.default.supportsECMA402()) { | ||
return number; | ||
} | ||
}, { | ||
key: '__formatCurrency', | ||
value: function __formatCurrency(number, currency) { | ||
if (!_locale2.default.supportsECMA402()) { | ||
return number; | ||
} | ||
var options = { | ||
style: 'currency', | ||
currency: currency, | ||
currencyDisplay: 'symbol', | ||
minimumFractionDigits: 2, | ||
maximumFractionDigits: 2 | ||
}; | ||
var options = { | ||
style: 'currency', | ||
currency: currency, | ||
currencyDisplay: 'symbol', | ||
minimumFractionDigits: 2, | ||
maximumFractionDigits: 2 | ||
}; | ||
var formatter = new global.Intl.NumberFormat(_locale2.default.currentLocale(), options); | ||
var formatter = new global.Intl.NumberFormat(_locale2.default.currentLocale(), options); | ||
return formatter.format(number); | ||
} | ||
}, { | ||
key: 'formatWithFormatter', | ||
value: function formatWithFormatter(formatter, number) { | ||
if (formatter != null) { | ||
var string = formatter.format(number); | ||
return formatter.format(number); | ||
}; | ||
if (string === 'NaN') { | ||
return number; | ||
} else { | ||
return string; | ||
} | ||
NumberUtils.formatWithFormatter = function formatWithFormatter(formatter, number) { | ||
if (formatter != null) { | ||
var string = formatter.format(number); | ||
if (string === 'NaN') { | ||
return number; | ||
} else { | ||
return number.toString(); | ||
return string; | ||
} | ||
} else { | ||
return number.toString(); | ||
} | ||
}]); | ||
}; | ||
@@ -102,0 +90,0 @@ return NumberUtils; |
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.__esModule = 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 _lodash = require('lodash'); | ||
@@ -22,45 +18,38 @@ | ||
_createClass(TextUtils, null, [{ | ||
key: 'isEmpty', | ||
value: function isEmpty(value) { | ||
if (value == null) { | ||
return true; | ||
} | ||
TextUtils.isEmpty = function isEmpty(value) { | ||
if (value == null) { | ||
return true; | ||
} | ||
if (TextUtils.trim(value).length < 1) { | ||
return true; | ||
} | ||
if (TextUtils.trim(value).length < 1) { | ||
return true; | ||
} | ||
return false; | ||
}; | ||
TextUtils.isPresent = function isPresent(value) { | ||
return !TextUtils.isEmpty(value); | ||
}; | ||
TextUtils.contains = function contains(haystack, needle) { | ||
if (needle === null) { | ||
return false; | ||
} | ||
}, { | ||
key: 'isPresent', | ||
value: function isPresent(value) { | ||
return !TextUtils.isEmpty(value); | ||
} | ||
}, { | ||
key: 'contains', | ||
value: function contains(haystack, needle) { | ||
if (needle === null) { | ||
return false; | ||
} | ||
return _lodash2.default.contains(haystack.toLowerCase(), needle.toLowerCase()); | ||
} | ||
}, { | ||
key: 'startsWith', | ||
value: function startsWith(haystack, needle) { | ||
if (needle === null) { | ||
return false; | ||
} | ||
return _lodash2.default.contains(haystack.toLowerCase(), needle.toLowerCase()); | ||
}; | ||
return _lodash2.default.startsWith(haystack, needle); | ||
TextUtils.startsWith = function startsWith(haystack, needle) { | ||
if (needle === null) { | ||
return false; | ||
} | ||
}, { | ||
key: 'trim', | ||
value: function trim(value) { | ||
return _lodash2.default.trim(value); | ||
} | ||
}]); | ||
return _lodash2.default.startsWith(haystack, needle); | ||
}; | ||
TextUtils.trim = function trim(value) { | ||
return _lodash2.default.trim(value); | ||
}; | ||
return TextUtils; | ||
@@ -67,0 +56,0 @@ }(); |
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.__esModule = 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 _form = require('../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"); } } | ||
@@ -26,3 +30,5 @@ | ||
while (iterator) { | ||
parents.push(iterator.label); | ||
if (!(iterator instanceof _form2.default)) { | ||
parents.push(iterator.label); | ||
} | ||
@@ -29,0 +35,0 @@ iterator = iterator.parent; |
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.__esModule = 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 _repeatableItemValue = require('../values/repeatable-item-value'); | ||
@@ -54,281 +50,247 @@ | ||
_createClass(FeatureValidator, null, [{ | ||
key: 'validateFeature', | ||
value: function validateFeature(feature, record, formValues) { | ||
if (feature instanceof _record2.default) { | ||
return FeatureValidator.validateRecord(record, formValues); | ||
} else if (feature instanceof _repeatableItemValue2.default) { | ||
return FeatureValidator.validateRepeatableItem(feature, record, formValues); | ||
} | ||
FeatureValidator.validateFeature = function validateFeature(feature, record, formValues) { | ||
if (feature instanceof _record2.default) { | ||
return FeatureValidator.validateRecord(record, formValues); | ||
} else if (feature instanceof _repeatableItemValue2.default) { | ||
return FeatureValidator.validateRepeatableItem(feature, record, formValues); | ||
} | ||
return []; | ||
}; | ||
FeatureValidator.validateRecord = function validateRecord(record, formValues) { | ||
if (record == null) { | ||
return []; | ||
} | ||
}, { | ||
key: 'validateRecord', | ||
value: function validateRecord(record, formValues) { | ||
if (record == null) { | ||
return []; | ||
} | ||
var errors = []; | ||
var errors = []; | ||
if (record.isStatusFieldEnabled && record.status == null) { | ||
errors.push(new _requiredFieldValidationError2.default(record.form.statusField.label)); | ||
} | ||
if (record.isStatusFieldEnabled && record.status == null) { | ||
errors.push(new _requiredFieldValidationError2.default(record.form.statusField.label)); | ||
} | ||
if (record.form.isGeometryRequired) { | ||
if (!record.hasCoordinate) { | ||
errors.push(new _geometryRequiredValidationError2.default()); | ||
} | ||
if (record.form.isGeometryRequired) { | ||
if (!record.hasCoordinate) { | ||
errors.push(new _geometryRequiredValidationError2.default()); | ||
} | ||
} | ||
var cache = {}; | ||
var cache = {}; | ||
this.validateFieldsInElements(record.form.elements, record, formValues, errors, cache); | ||
this.validateFieldsInElements(record.form.elements, record, formValues, errors, cache); | ||
return errors; | ||
return errors; | ||
}; | ||
FeatureValidator.validateRepeatableItem = function validateRepeatableItem(repeatableItem, record, formValues) { | ||
if (repeatableItem == null) { | ||
return []; | ||
} | ||
}, { | ||
key: 'validateRepeatableItem', | ||
value: function validateRepeatableItem(repeatableItem, record, formValues) { | ||
if (repeatableItem == null) { | ||
return []; | ||
} | ||
var errors = []; | ||
var errors = []; | ||
if (repeatableItem.element.isGeometryRequired) { | ||
if (!repeatableItem.hasCoordinate) { | ||
errors.push(new _geometryRequiredValidationError2.default()); | ||
} | ||
if (repeatableItem.element.isGeometryRequired) { | ||
if (!repeatableItem.hasCoordinate) { | ||
errors.push(new _geometryRequiredValidationError2.default()); | ||
} | ||
} | ||
var cache = {}; | ||
var cache = {}; | ||
FeatureValidator.validateFieldsInElements(repeatableItem.element.elements, record, formValues, errors, cache); | ||
FeatureValidator.validateFieldsInElements(repeatableItem.element.elements, record, formValues, errors, cache); | ||
return errors; | ||
return errors; | ||
}; | ||
FeatureValidator.validateFieldsInElements = function validateFieldsInElements(elements, record, formValues, errors, cache) { | ||
if (!cache) { | ||
cache = {}; | ||
} | ||
}, { | ||
key: 'validateFieldsInElements', | ||
value: function validateFieldsInElements(elements, record, formValues, errors, cache) { | ||
if (!cache) { | ||
cache = {}; | ||
} | ||
var _iteratorNormalCompletion = true; | ||
var _didIteratorError = false; | ||
var _iteratorError = undefined; | ||
for (var _iterator = elements, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) { | ||
var _ref; | ||
try { | ||
for (var _iterator = elements[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { | ||
var element = _step.value; | ||
if (_isArray) { | ||
if (_i >= _iterator.length) break; | ||
_ref = _iterator[_i++]; | ||
} else { | ||
_i = _iterator.next(); | ||
if (_i.done) break; | ||
_ref = _i.value; | ||
} | ||
if (element.isSectionElement) { | ||
var visible = _condition2.default.shouldElementBeVisible(element, record, formValues, cache); | ||
var element = _ref; | ||
if (visible) { | ||
FeatureValidator.validateFieldsInElements(element.elements, record, formValues, errors, cache); | ||
} | ||
} else { | ||
var required = _condition2.default.shouldElementBeRequired(element, record, formValues); | ||
var visible = _condition2.default.shouldElementBeVisible(element, record, formValues, cache); | ||
if (element.isSectionElement) { | ||
var visible = _condition2.default.shouldElementBeVisible(element, record, formValues, cache); | ||
var disabled = element.isDisabled; | ||
if (visible) { | ||
FeatureValidator.validateFieldsInElements(element.elements, record, formValues, errors, cache); | ||
} | ||
} else { | ||
var required = _condition2.default.shouldElementBeRequired(element, record, formValues); | ||
var visible = _condition2.default.shouldElementBeVisible(element, record, formValues, cache); | ||
var validatable = visible && !disabled; | ||
var disabled = element.isDisabled; | ||
if (validatable) { | ||
if (required) { | ||
var fieldValue = formValues.get(element.key); | ||
var validatable = visible && !disabled; | ||
if (fieldValue == null || fieldValue.isEmpty) { | ||
errors.push(new _requiredFieldValidationError2.default(element)); | ||
} | ||
} | ||
if (validatable) { | ||
if (required) { | ||
var fieldValue = formValues.get(element.key); | ||
if (element.isTextElement) { | ||
if (element.isNumeric) { | ||
var textValue = formValues.get(element.key); | ||
if (fieldValue == null || fieldValue.isEmpty) { | ||
errors.push(new _requiredFieldValidationError2.default(element)); | ||
} | ||
} | ||
var error = FeatureValidator.validateNumericField(element, textValue); | ||
if (element.isTextElement) { | ||
if (element.isNumeric) { | ||
var textValue = formValues.get(element.key); | ||
if (error) { | ||
errors.push(error); | ||
} | ||
} else if (element.hasPattern) { | ||
var textValue = formValues.get(element.key); | ||
var error = FeatureValidator.validateNumericField(element, textValue); | ||
var error = FeatureValidator.validatePatternOfElement(element, textValue); | ||
if (error) { | ||
errors.push(error); | ||
} | ||
} | ||
if (error) { | ||
errors.push(error); | ||
} | ||
} else if (element.hasPattern) { | ||
var textValue = formValues.get(element.key); | ||
if (element.isLengthValidationSupported) { | ||
var fieldValue = formValues.get(element.key); | ||
var error = FeatureValidator.validateLengthForElement(element, fieldValue); | ||
var error = FeatureValidator.validatePatternOfElement(element, textValue); | ||
if (error) { | ||
errors.push(error); | ||
} | ||
if (error) { | ||
errors.push(error); | ||
} | ||
} | ||
} | ||
if (element.isRepeatableElement) { | ||
var repeatableValue = formValues.get(element.key); | ||
if (element.isLengthValidationSupported) { | ||
var fieldValue = formValues.get(element.key); | ||
var error = FeatureValidator.validateLengthForElement(element, fieldValue); | ||
if (repeatableValue) { | ||
var _iteratorNormalCompletion2 = true; | ||
var _didIteratorError2 = false; | ||
var _iteratorError2 = undefined; | ||
if (error) { | ||
errors.push(error); | ||
} | ||
} | ||
} | ||
try { | ||
for (var _iterator2 = repeatableValue.items[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) { | ||
var item = _step2.value; | ||
if (element.isRepeatableElement) { | ||
var repeatableValue = formValues.get(element.key); | ||
var itemValues = item.formValues.copy(); | ||
if (repeatableValue) { | ||
for (var _iterator2 = repeatableValue.items, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator]();;) { | ||
var _ref2; | ||
itemValues.merge(formValues); | ||
if (_isArray2) { | ||
if (_i2 >= _iterator2.length) break; | ||
_ref2 = _iterator2[_i2++]; | ||
} else { | ||
_i2 = _iterator2.next(); | ||
if (_i2.done) break; | ||
_ref2 = _i2.value; | ||
} | ||
FeatureValidator.validateFieldsInElements(item.element.elements, record, itemValues, errors, null); | ||
} | ||
} catch (err) { | ||
_didIteratorError2 = true; | ||
_iteratorError2 = err; | ||
} finally { | ||
try { | ||
if (!_iteratorNormalCompletion2 && _iterator2.return) { | ||
_iterator2.return(); | ||
} | ||
} finally { | ||
if (_didIteratorError2) { | ||
throw _iteratorError2; | ||
} | ||
} | ||
} | ||
} | ||
var item = _ref2; | ||
var itemValues = item.formValues.copy(); | ||
itemValues.merge(formValues); | ||
FeatureValidator.validateFieldsInElements(item.element.elements, record, itemValues, errors, null); | ||
} | ||
} | ||
} | ||
} catch (err) { | ||
_didIteratorError = true; | ||
_iteratorError = err; | ||
} finally { | ||
try { | ||
if (!_iteratorNormalCompletion && _iterator.return) { | ||
_iterator.return(); | ||
} | ||
} finally { | ||
if (_didIteratorError) { | ||
throw _iteratorError; | ||
} | ||
} | ||
} | ||
} | ||
}, { | ||
key: 'validatePatternOfElement', | ||
value: function validatePatternOfElement(element, value) { | ||
if (value == null || value.isEmpty) { | ||
return null; | ||
} | ||
}; | ||
var regex = new RegExp(element.pattern); | ||
FeatureValidator.validatePatternOfElement = function validatePatternOfElement(element, value) { | ||
if (value == null || value.isEmpty) { | ||
return null; | ||
} | ||
if (regex) { | ||
if (!regex.test(value.textValue)) { | ||
return new _patternValidationError2.default(element); | ||
} | ||
var regex = new RegExp(element.pattern); | ||
if (regex) { | ||
if (!regex.test(value.textValue)) { | ||
return new _patternValidationError2.default(element); | ||
} | ||
} | ||
return null; | ||
}; | ||
FeatureValidator.validateLengthForElement = function validateLengthForElement(element, value) { | ||
if (value == null || value.isEmpty) { | ||
return null; | ||
} | ||
}, { | ||
key: 'validateLengthForElement', | ||
value: function validateLengthForElement(element, value) { | ||
if (value == null || value.isEmpty) { | ||
return null; | ||
} | ||
var hasMinLengthError = false; | ||
var hasMaxLengthError = false; | ||
var hasMinLengthError = false; | ||
var hasMaxLengthError = false; | ||
if (element.hasMinLength) { | ||
hasMinLengthError = value.length < element.minLength; | ||
} | ||
if (element.hasMinLength) { | ||
hasMinLengthError = value.length < element.minLength; | ||
} | ||
if (element.hasMaxLength) { | ||
hasMaxLengthError = value.length > element.maxLength; | ||
} | ||
if (element.hasMaxLength) { | ||
hasMaxLengthError = value.length > element.maxLength; | ||
} | ||
if (hasMinLengthError || hasMaxLengthError) { | ||
return new _lengthValidationError2.default(element); | ||
} | ||
if (hasMinLengthError || hasMaxLengthError) { | ||
return new _lengthValidationError2.default(element); | ||
} | ||
return null; | ||
}; | ||
FeatureValidator.validateNumericField = function validateNumericField(element, value) { | ||
if (value == null || value.isEmpty) { | ||
return null; | ||
} | ||
}, { | ||
key: 'validateNumericField', | ||
value: function validateNumericField(element, value) { | ||
if (value == null || value.isEmpty) { | ||
return null; | ||
} | ||
if (!value.isNumeric) { | ||
return new _numericFormatValidationError2.default(element); | ||
} | ||
if (!value.isNumeric) { | ||
return new _numericFormatValidationError2.default(element); | ||
} | ||
// since the number is now normalized to en_US, check for the . separator | ||
var decimalSeparator = '.'; | ||
// since the number is now normalized to en_US, check for the . separator | ||
var decimalSeparator = '.'; | ||
if (element.isInteger) { | ||
if (value.indexOf(decimalSeparator) > -1) { | ||
return new _numericFormatValidationError2.default(element); | ||
} | ||
if (element.isInteger) { | ||
if (value.indexOf(decimalSeparator) > -1) { | ||
return new _numericFormatValidationError2.default(element); | ||
} | ||
} | ||
var numberValue = +value.textValue; | ||
var numberValue = +value.textValue; | ||
if (numberValue < element.min || numberValue > element.max) { | ||
return new _numericRangeValidationError2.default(element); | ||
} | ||
return null; | ||
if (numberValue < element.min || numberValue > element.max) { | ||
return new _numericRangeValidationError2.default(element); | ||
} | ||
}, { | ||
key: 'formatErrors', | ||
value: function formatErrors(errors) { | ||
var messages = []; | ||
var _iteratorNormalCompletion3 = true; | ||
var _didIteratorError3 = false; | ||
var _iteratorError3 = undefined; | ||
return null; | ||
}; | ||
try { | ||
for (var _iterator3 = errors[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) { | ||
var error = _step3.value; | ||
FeatureValidator.formatErrors = function formatErrors(errors) { | ||
var messages = []; | ||
messages.push(error.message); | ||
} | ||
} catch (err) { | ||
_didIteratorError3 = true; | ||
_iteratorError3 = err; | ||
} finally { | ||
try { | ||
if (!_iteratorNormalCompletion3 && _iterator3.return) { | ||
_iterator3.return(); | ||
} | ||
} finally { | ||
if (_didIteratorError3) { | ||
throw _iteratorError3; | ||
} | ||
} | ||
for (var _iterator3 = errors, _isArray3 = Array.isArray(_iterator3), _i3 = 0, _iterator3 = _isArray3 ? _iterator3 : _iterator3[Symbol.iterator]();;) { | ||
var _ref3; | ||
if (_isArray3) { | ||
if (_i3 >= _iterator3.length) break; | ||
_ref3 = _iterator3[_i3++]; | ||
} else { | ||
_i3 = _iterator3.next(); | ||
if (_i3.done) break; | ||
_ref3 = _i3.value; | ||
} | ||
messages.join('\n\n'); | ||
var error = _ref3; | ||
messages.push(error.message); | ||
} | ||
}]); | ||
return messages.join('\n\n'); | ||
}; | ||
return FeatureValidator; | ||
@@ -335,0 +297,0 @@ }(); |
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.__esModule = true; | ||
@@ -7,0 +5,0 @@ 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; }; }(); |
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.__esModule = true; | ||
@@ -17,2 +15,4 @@ 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; }; }(); | ||
function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
@@ -22,3 +22,3 @@ | ||
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; } | ||
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) : _defaults(subClass, superClass); } | ||
@@ -36,3 +36,3 @@ var AT_LEAST = 'at-least'; | ||
var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(LengthValidationError).call(this, element)); | ||
var _this = _possibleConstructorReturn(this, _ElementValidationErr.call(this, element)); | ||
@@ -51,12 +51,11 @@ if (element.hasMinLength && element.hasMaxLength && element.minLength === element.maxLength) { | ||
LengthValidationError.prototype.messageWithFormats = function messageWithFormats(singularFormat, pluralFormat, length) { | ||
if (length === 1) { | ||
return (0, _util.format)(singularFormat, this.label, length); | ||
} else { | ||
return (0, _util.format)(pluralFormat, this.label, length); | ||
} | ||
}; | ||
_createClass(LengthValidationError, [{ | ||
key: 'messageWithFormats', | ||
value: function messageWithFormats(singularFormat, pluralFormat, length) { | ||
if (length === 1) { | ||
return (0, _util.format)(singularFormat, this.label, length); | ||
} else { | ||
return (0, _util.format)(pluralFormat, this.label, length); | ||
} | ||
} | ||
}, { | ||
key: 'message', | ||
@@ -63,0 +62,0 @@ get: function get() { |
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.__esModule = true; | ||
@@ -17,2 +15,4 @@ 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; }; }(); | ||
function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
@@ -22,3 +22,3 @@ | ||
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; } | ||
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) : _defaults(subClass, superClass); } | ||
@@ -31,3 +31,3 @@ var NumericFormatValidationError = function (_ElementValidationErr) { | ||
return _possibleConstructorReturn(this, Object.getPrototypeOf(NumericFormatValidationError).apply(this, arguments)); | ||
return _possibleConstructorReturn(this, _ElementValidationErr.apply(this, arguments)); | ||
} | ||
@@ -34,0 +34,0 @@ |
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.__esModule = true; | ||
@@ -17,2 +15,4 @@ 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; }; }(); | ||
function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
@@ -22,3 +22,3 @@ | ||
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; } | ||
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) : _defaults(subClass, superClass); } | ||
@@ -31,3 +31,3 @@ var NumericRangeValidationError = function (_ElementValidationErr) { | ||
return _possibleConstructorReturn(this, Object.getPrototypeOf(NumericRangeValidationError).apply(this, arguments)); | ||
return _possibleConstructorReturn(this, _ElementValidationErr.apply(this, arguments)); | ||
} | ||
@@ -34,0 +34,0 @@ |
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.__esModule = true; | ||
@@ -17,2 +15,4 @@ 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; }; }(); | ||
function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
@@ -22,3 +22,3 @@ | ||
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; } | ||
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) : _defaults(subClass, superClass); } | ||
@@ -31,3 +31,3 @@ var PatternValidationError = function (_ElementValidationErr) { | ||
return _possibleConstructorReturn(this, Object.getPrototypeOf(PatternValidationError).apply(this, arguments)); | ||
return _possibleConstructorReturn(this, _ElementValidationErr.apply(this, arguments)); | ||
} | ||
@@ -34,0 +34,0 @@ |
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.__esModule = true; | ||
@@ -17,2 +15,4 @@ 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; }; }(); | ||
function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
@@ -22,3 +22,3 @@ | ||
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; } | ||
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) : _defaults(subClass, superClass); } | ||
@@ -31,3 +31,3 @@ var RequiredFieldValidationError = function (_ElementValidationErr) { | ||
return _possibleConstructorReturn(this, Object.getPrototypeOf(RequiredFieldValidationError).apply(this, arguments)); | ||
return _possibleConstructorReturn(this, _ElementValidationErr.apply(this, arguments)); | ||
} | ||
@@ -34,0 +34,0 @@ |
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.__esModule = true; | ||
@@ -19,2 +17,4 @@ 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; }; }(); | ||
function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
@@ -24,3 +24,3 @@ | ||
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; } | ||
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) : _defaults(subClass, superClass); } | ||
@@ -33,3 +33,3 @@ var AddressValue = function (_FormValue) { | ||
var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(AddressValue).call(this, element)); | ||
var _this = _possibleConstructorReturn(this, _FormValue.call(this, element)); | ||
@@ -40,36 +40,30 @@ _this.address = new _address2.default(attributes); | ||
// TODO(zhm) implement | ||
// throw new Error('Not implemented'); | ||
AddressValue.prototype.toJSON = function toJSON() { | ||
return this.address.toJSON(); | ||
}; | ||
AddressValue.prototype.isEqual = function isEqual(stringValue) { | ||
return false; | ||
}; | ||
AddressValue.prototype.contains = function contains(stringValue) { | ||
return false; | ||
}; | ||
AddressValue.prototype.startsWith = function startsWith(stringValue) { | ||
return false; | ||
}; | ||
AddressValue.prototype.isLessThan = function isLessThan(stringValue) { | ||
return false; | ||
}; | ||
AddressValue.prototype.isGreaterThan = function isGreaterThan(stringValue) { | ||
return false; | ||
}; | ||
_createClass(AddressValue, [{ | ||
key: 'toJSON', | ||
// TODO(zhm) implement | ||
// throw new Error('Not implemented'); | ||
value: function toJSON() { | ||
return this.address.toJSON(); | ||
} | ||
}, { | ||
key: 'isEqual', | ||
value: function isEqual(stringValue) { | ||
return false; | ||
} | ||
}, { | ||
key: 'contains', | ||
value: function contains(stringValue) { | ||
return false; | ||
} | ||
}, { | ||
key: 'startsWith', | ||
value: function startsWith(stringValue) { | ||
return false; | ||
} | ||
}, { | ||
key: 'isLessThan', | ||
value: function isLessThan(stringValue) { | ||
return false; | ||
} | ||
}, { | ||
key: 'isGreaterThan', | ||
value: function isGreaterThan(stringValue) { | ||
return false; | ||
} | ||
}, { | ||
key: 'isEmpty', | ||
@@ -76,0 +70,0 @@ get: function get() { |
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.__esModule = true; | ||
@@ -33,74 +31,62 @@ 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; }; }(); | ||
_createClass(Address, [{ | ||
key: 'toJSON', | ||
value: function toJSON() { | ||
var json = {}; | ||
Address.prototype.toJSON = function toJSON() { | ||
var json = {}; | ||
json.sub_thoroughfare = this.streetNumber || null; | ||
json.thoroughfare = this.streetName || null; | ||
json.suite = this.suite || null; | ||
json.locality = this.city || null; | ||
json.sub_admin_area = this.county || null; | ||
json.admin_area = this.state || null; | ||
json.postal_code = this.postalCode || null; | ||
json.country = this.country || null; | ||
json.sub_thoroughfare = this.streetNumber || null; | ||
json.thoroughfare = this.streetName || null; | ||
json.suite = this.suite || null; | ||
json.locality = this.city || null; | ||
json.sub_admin_area = this.county || null; | ||
json.admin_area = this.state || null; | ||
json.postal_code = this.postalCode || null; | ||
json.country = this.country || null; | ||
return json; | ||
return json; | ||
}; | ||
Address.prototype.clear = function clear() { | ||
this.streetNumber = null; | ||
this.streetName = null; | ||
this.suite = null; | ||
this.city = null; | ||
this.county = null; | ||
this.state = null; | ||
this.postalCode = null; | ||
this.country = null; | ||
}; | ||
Address.prototype.isEmpty = function isEmpty() { | ||
return !(_textUtils2.default.isPresent(this.streetNumber) || _textUtils2.default.isPresent(this.streetName) || _textUtils2.default.isPresent(this.suite) || _textUtils2.default.isPresent(this.city) || _textUtils2.default.isPresent(this.county) || _textUtils2.default.isPresent(this.state) || _textUtils2.default.isPresent(this.postalCode) || _textUtils2.default.isPresent(this.country)); | ||
}; | ||
Address.prototype.line = function line() { | ||
var result = []; | ||
for (var _len = arguments.length, parts = Array(_len), _key = 0; _key < _len; _key++) { | ||
parts[_key] = arguments[_key]; | ||
} | ||
}, { | ||
key: 'clear', | ||
value: function clear() { | ||
this.streetNumber = null; | ||
this.streetName = null; | ||
this.suite = null; | ||
this.city = null; | ||
this.county = null; | ||
this.state = null; | ||
this.postalCode = null; | ||
this.country = null; | ||
} | ||
}, { | ||
key: 'isEmpty', | ||
value: function isEmpty() { | ||
return !(_textUtils2.default.isPresent(this.streetNumber) || _textUtils2.default.isPresent(this.streetName) || _textUtils2.default.isPresent(this.suite) || _textUtils2.default.isPresent(this.city) || _textUtils2.default.isPresent(this.county) || _textUtils2.default.isPresent(this.state) || _textUtils2.default.isPresent(this.postalCode) || _textUtils2.default.isPresent(this.country)); | ||
} | ||
}, { | ||
key: 'line', | ||
value: function line() { | ||
var result = []; | ||
for (var _len = arguments.length, parts = Array(_len), _key = 0; _key < _len; _key++) { | ||
parts[_key] = arguments[_key]; | ||
for (var _iterator = parts, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) { | ||
var _ref; | ||
if (_isArray) { | ||
if (_i >= _iterator.length) break; | ||
_ref = _iterator[_i++]; | ||
} else { | ||
_i = _iterator.next(); | ||
if (_i.done) break; | ||
_ref = _i.value; | ||
} | ||
var _iteratorNormalCompletion = true; | ||
var _didIteratorError = false; | ||
var _iteratorError = undefined; | ||
var part = _ref; | ||
try { | ||
for (var _iterator = parts[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { | ||
var part = _step.value; | ||
if (_textUtils2.default.isPresent(part)) { | ||
result.push(part); | ||
} | ||
} | ||
} catch (err) { | ||
_didIteratorError = true; | ||
_iteratorError = err; | ||
} finally { | ||
try { | ||
if (!_iteratorNormalCompletion && _iterator.return) { | ||
_iterator.return(); | ||
} | ||
} finally { | ||
if (_didIteratorError) { | ||
throw _iteratorError; | ||
} | ||
} | ||
if (_textUtils2.default.isPresent(part)) { | ||
result.push(part); | ||
} | ||
} | ||
return result.join(' '); | ||
} | ||
}, { | ||
return result.join(' '); | ||
}; | ||
_createClass(Address, [{ | ||
key: 'lines', | ||
@@ -107,0 +93,0 @@ get: function get() { |
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.__esModule = true; | ||
@@ -15,2 +13,4 @@ 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; }; }(); | ||
function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
@@ -20,3 +20,3 @@ | ||
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; } | ||
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) : _defaults(subClass, superClass); } | ||
@@ -29,3 +29,3 @@ var AudioItemValue = function (_MediaItemValue) { | ||
return _possibleConstructorReturn(this, Object.getPrototypeOf(AudioItemValue).apply(this, arguments)); | ||
return _possibleConstructorReturn(this, _MediaItemValue.apply(this, arguments)); | ||
} | ||
@@ -32,0 +32,0 @@ |
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.__esModule = true; | ||
@@ -19,2 +17,4 @@ 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; }; }(); | ||
function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
@@ -24,3 +24,3 @@ | ||
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; } | ||
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) : _defaults(subClass, superClass); } | ||
@@ -33,3 +33,3 @@ var AudioValue = function (_MediaValue) { | ||
return _possibleConstructorReturn(this, Object.getPrototypeOf(AudioValue).apply(this, arguments)); | ||
return _possibleConstructorReturn(this, _MediaValue.apply(this, arguments)); | ||
} | ||
@@ -36,0 +36,0 @@ |
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.__esModule = true; | ||
@@ -13,2 +11,4 @@ var _textualValue = require('./textual-value'); | ||
function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
@@ -18,3 +18,3 @@ | ||
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; } | ||
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) : _defaults(subClass, superClass); } | ||
@@ -27,3 +27,3 @@ var BarcodeValue = function (_TextualValue) { | ||
return _possibleConstructorReturn(this, Object.getPrototypeOf(BarcodeValue).apply(this, arguments)); | ||
return _possibleConstructorReturn(this, _TextualValue.apply(this, arguments)); | ||
} | ||
@@ -30,0 +30,0 @@ |
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.__esModule = true; | ||
@@ -19,2 +17,4 @@ 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; }; }(); | ||
function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
@@ -24,3 +24,3 @@ | ||
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; } | ||
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) : _defaults(subClass, superClass); } | ||
@@ -33,3 +33,3 @@ var CalculatedValue = function (_TextualValue) { | ||
var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(CalculatedValue).call(this, element, value)); | ||
var _this = _possibleConstructorReturn(this, _TextualValue.call(this, element, value)); | ||
@@ -36,0 +36,0 @@ _this.error = null; |
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.__esModule = true; | ||
@@ -23,2 +21,4 @@ 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; }; }(); | ||
function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
@@ -28,3 +28,3 @@ | ||
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; } | ||
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) : _defaults(subClass, superClass); } | ||
@@ -40,3 +40,3 @@ var ChoiceDisplaySeparator = ', '; | ||
var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(ChoiceValue).call(this, element, attributes)); | ||
var _this = _possibleConstructorReturn(this, _FormValue.call(this, element, attributes)); | ||
@@ -48,27 +48,19 @@ _this._choiceValues = []; | ||
if (attributes.choice_values) { | ||
var _iteratorNormalCompletion = true; | ||
var _didIteratorError = false; | ||
var _iteratorError = undefined; | ||
for (var _iterator = attributes.choice_values, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) { | ||
var _ref; | ||
try { | ||
for (var _iterator = attributes.choice_values[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { | ||
var choice = _step.value; | ||
if (_isArray) { | ||
if (_i >= _iterator.length) break; | ||
_ref = _iterator[_i++]; | ||
} else { | ||
_i = _iterator.next(); | ||
if (_i.done) break; | ||
_ref = _i.value; | ||
} | ||
if (_textUtils2.default.isPresent(choice)) { | ||
_this._choiceValues.push(choice); | ||
} | ||
var choice = _ref; | ||
if (_textUtils2.default.isPresent(choice)) { | ||
_this._choiceValues.push(choice); | ||
} | ||
} catch (err) { | ||
_didIteratorError = true; | ||
_iteratorError = err; | ||
} finally { | ||
try { | ||
if (!_iteratorNormalCompletion && _iterator.return) { | ||
_iterator.return(); | ||
} | ||
} finally { | ||
if (_didIteratorError) { | ||
throw _iteratorError; | ||
} | ||
} | ||
} | ||
@@ -78,27 +70,19 @@ } | ||
if (attributes.other_values) { | ||
var _iteratorNormalCompletion2 = true; | ||
var _didIteratorError2 = false; | ||
var _iteratorError2 = undefined; | ||
for (var _iterator2 = attributes.other_values, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator]();;) { | ||
var _ref2; | ||
try { | ||
for (var _iterator2 = attributes.other_values[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) { | ||
var choice = _step2.value; | ||
if (_isArray2) { | ||
if (_i2 >= _iterator2.length) break; | ||
_ref2 = _iterator2[_i2++]; | ||
} else { | ||
_i2 = _iterator2.next(); | ||
if (_i2.done) break; | ||
_ref2 = _i2.value; | ||
} | ||
if (_textUtils2.default.isPresent(choice)) { | ||
_this._otherValues.push(choice); | ||
} | ||
var choice = _ref2; | ||
if (_textUtils2.default.isPresent(choice)) { | ||
_this._otherValues.push(choice); | ||
} | ||
} catch (err) { | ||
_didIteratorError2 = true; | ||
_iteratorError2 = err; | ||
} finally { | ||
try { | ||
if (!_iteratorNormalCompletion2 && _iterator2.return) { | ||
_iterator2.return(); | ||
} | ||
} finally { | ||
if (_didIteratorError2) { | ||
throw _iteratorError2; | ||
} | ||
} | ||
} | ||
@@ -110,96 +94,76 @@ } | ||
_createClass(ChoiceValue, [{ | ||
key: 'toJSON', | ||
value: function toJSON() { | ||
if (this.isEmpty) { | ||
return null; | ||
} | ||
ChoiceValue.prototype.toJSON = function toJSON() { | ||
if (this.isEmpty) { | ||
return null; | ||
} | ||
var choiceValues = []; | ||
var otherValues = []; | ||
var choiceValues = []; | ||
var otherValues = []; | ||
var _iteratorNormalCompletion3 = true; | ||
var _didIteratorError3 = false; | ||
var _iteratorError3 = undefined; | ||
for (var _iterator3 = this._choiceValues, _isArray3 = Array.isArray(_iterator3), _i3 = 0, _iterator3 = _isArray3 ? _iterator3 : _iterator3[Symbol.iterator]();;) { | ||
var _ref3; | ||
try { | ||
for (var _iterator3 = this._choiceValues[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) { | ||
var rawValue = _step3.value; | ||
choiceValues.push(rawValue); | ||
} | ||
} catch (err) { | ||
_didIteratorError3 = true; | ||
_iteratorError3 = err; | ||
} finally { | ||
try { | ||
if (!_iteratorNormalCompletion3 && _iterator3.return) { | ||
_iterator3.return(); | ||
} | ||
} finally { | ||
if (_didIteratorError3) { | ||
throw _iteratorError3; | ||
} | ||
} | ||
if (_isArray3) { | ||
if (_i3 >= _iterator3.length) break; | ||
_ref3 = _iterator3[_i3++]; | ||
} else { | ||
_i3 = _iterator3.next(); | ||
if (_i3.done) break; | ||
_ref3 = _i3.value; | ||
} | ||
var _iteratorNormalCompletion4 = true; | ||
var _didIteratorError4 = false; | ||
var _iteratorError4 = undefined; | ||
var rawValue = _ref3; | ||
try { | ||
for (var _iterator4 = this._otherValues[Symbol.iterator](), _step4; !(_iteratorNormalCompletion4 = (_step4 = _iterator4.next()).done); _iteratorNormalCompletion4 = true) { | ||
var otherValue = _step4.value; | ||
choiceValues.push(rawValue); | ||
} | ||
otherValues.push(otherValue); | ||
} | ||
} catch (err) { | ||
_didIteratorError4 = true; | ||
_iteratorError4 = err; | ||
} finally { | ||
try { | ||
if (!_iteratorNormalCompletion4 && _iterator4.return) { | ||
_iterator4.return(); | ||
} | ||
} finally { | ||
if (_didIteratorError4) { | ||
throw _iteratorError4; | ||
} | ||
} | ||
for (var _iterator4 = this._otherValues, _isArray4 = Array.isArray(_iterator4), _i4 = 0, _iterator4 = _isArray4 ? _iterator4 : _iterator4[Symbol.iterator]();;) { | ||
var _ref4; | ||
if (_isArray4) { | ||
if (_i4 >= _iterator4.length) break; | ||
_ref4 = _iterator4[_i4++]; | ||
} else { | ||
_i4 = _iterator4.next(); | ||
if (_i4.done) break; | ||
_ref4 = _i4.value; | ||
} | ||
return { | ||
choice_values: choiceValues, | ||
other_values: otherValues | ||
}; | ||
var otherValue = _ref4; | ||
otherValues.push(otherValue); | ||
} | ||
}, { | ||
key: 'isEqual', | ||
value: function isEqual(value) { | ||
if (_lodash2.default.includes(this.selectedValues, value)) { | ||
return true; | ||
} | ||
return this.otherValue === value; | ||
return { | ||
choice_values: choiceValues, | ||
other_values: otherValues | ||
}; | ||
}; | ||
ChoiceValue.prototype.isEqual = function isEqual(value) { | ||
if (_lodash2.default.includes(this.selectedValues, value)) { | ||
return true; | ||
} | ||
}, { | ||
key: 'contains', | ||
value: function contains(value) { | ||
return this.isEqual(value); | ||
} | ||
}, { | ||
key: 'startsWith', | ||
value: function startsWith(value) { | ||
return this.contains(value); | ||
} | ||
// isLessThan(value) { | ||
// notImplemented(); | ||
// } | ||
return this.otherValue === value; | ||
}; | ||
// isGreaterThan(value) { | ||
// notImplemented(); | ||
// } | ||
ChoiceValue.prototype.contains = function contains(value) { | ||
return this.isEqual(value); | ||
}; | ||
}, { | ||
ChoiceValue.prototype.startsWith = function startsWith(value) { | ||
return this.contains(value); | ||
}; | ||
// isLessThan(value) { | ||
// notImplemented(); | ||
// } | ||
// isGreaterThan(value) { | ||
// notImplemented(); | ||
// } | ||
_createClass(ChoiceValue, [{ | ||
key: 'isEmpty', | ||
@@ -220,56 +184,40 @@ get: function get() { | ||
var _iteratorNormalCompletion5 = true; | ||
var _didIteratorError5 = false; | ||
var _iteratorError5 = undefined; | ||
for (var _iterator5 = this._choiceValues, _isArray5 = Array.isArray(_iterator5), _i5 = 0, _iterator5 = _isArray5 ? _iterator5 : _iterator5[Symbol.iterator]();;) { | ||
var _ref5; | ||
try { | ||
for (var _iterator5 = this._choiceValues[Symbol.iterator](), _step5; !(_iteratorNormalCompletion5 = (_step5 = _iterator5.next()).done); _iteratorNormalCompletion5 = true) { | ||
var rawValue = _step5.value; | ||
if (_isArray5) { | ||
if (_i5 >= _iterator5.length) break; | ||
_ref5 = _iterator5[_i5++]; | ||
} else { | ||
_i5 = _iterator5.next(); | ||
if (_i5.done) break; | ||
_ref5 = _i5.value; | ||
} | ||
var choice = this.element.choiceByValue(rawValue); | ||
var rawValue = _ref5; | ||
var label = choice != null ? choice.label : rawValue; | ||
var choice = this.element.choiceByValue(rawValue); | ||
if (_textUtils2.default.isPresent(label)) { | ||
labels.push(label); | ||
} | ||
var label = choice != null ? choice.label : rawValue; | ||
if (_textUtils2.default.isPresent(label)) { | ||
labels.push(label); | ||
} | ||
} catch (err) { | ||
_didIteratorError5 = true; | ||
_iteratorError5 = err; | ||
} finally { | ||
try { | ||
if (!_iteratorNormalCompletion5 && _iterator5.return) { | ||
_iterator5.return(); | ||
} | ||
} finally { | ||
if (_didIteratorError5) { | ||
throw _iteratorError5; | ||
} | ||
} | ||
} | ||
var _iteratorNormalCompletion6 = true; | ||
var _didIteratorError6 = false; | ||
var _iteratorError6 = undefined; | ||
for (var _iterator6 = this._otherValues, _isArray6 = Array.isArray(_iterator6), _i6 = 0, _iterator6 = _isArray6 ? _iterator6 : _iterator6[Symbol.iterator]();;) { | ||
var _ref6; | ||
try { | ||
for (var _iterator6 = this._otherValues[Symbol.iterator](), _step6; !(_iteratorNormalCompletion6 = (_step6 = _iterator6.next()).done); _iteratorNormalCompletion6 = true) { | ||
var otherValue = _step6.value; | ||
if (_isArray6) { | ||
if (_i6 >= _iterator6.length) break; | ||
_ref6 = _iterator6[_i6++]; | ||
} else { | ||
_i6 = _iterator6.next(); | ||
if (_i6.done) break; | ||
_ref6 = _i6.value; | ||
} | ||
labels.push(otherValue); | ||
} | ||
} catch (err) { | ||
_didIteratorError6 = true; | ||
_iteratorError6 = err; | ||
} finally { | ||
try { | ||
if (!_iteratorNormalCompletion6 && _iterator6.return) { | ||
_iterator6.return(); | ||
} | ||
} finally { | ||
if (_didIteratorError6) { | ||
throw _iteratorError6; | ||
} | ||
} | ||
var otherValue = _ref6; | ||
labels.push(otherValue); | ||
} | ||
@@ -284,57 +232,41 @@ | ||
var _iteratorNormalCompletion7 = true; | ||
var _didIteratorError7 = false; | ||
var _iteratorError7 = undefined; | ||
for (var _iterator7 = this._choiceValues, _isArray7 = Array.isArray(_iterator7), _i7 = 0, _iterator7 = _isArray7 ? _iterator7 : _iterator7[Symbol.iterator]();;) { | ||
var _ref7; | ||
try { | ||
for (var _iterator7 = this._choiceValues[Symbol.iterator](), _step7; !(_iteratorNormalCompletion7 = (_step7 = _iterator7.next()).done); _iteratorNormalCompletion7 = true) { | ||
var rawValue = _step7.value; | ||
if (_isArray7) { | ||
if (_i7 >= _iterator7.length) break; | ||
_ref7 = _iterator7[_i7++]; | ||
} else { | ||
_i7 = _iterator7.next(); | ||
if (_i7.done) break; | ||
_ref7 = _i7.value; | ||
} | ||
var choice = this.element.choiceByValue(rawValue); | ||
var rawValue = _ref7; | ||
if (choice != null) { | ||
values.push(choice.label); | ||
values.push(choice.value); | ||
} else { | ||
values.push(rawValue); | ||
} | ||
var choice = this.element.choiceByValue(rawValue); | ||
if (choice != null) { | ||
values.push(choice.label); | ||
values.push(choice.value); | ||
} else { | ||
values.push(rawValue); | ||
} | ||
} catch (err) { | ||
_didIteratorError7 = true; | ||
_iteratorError7 = err; | ||
} finally { | ||
try { | ||
if (!_iteratorNormalCompletion7 && _iterator7.return) { | ||
_iterator7.return(); | ||
} | ||
} finally { | ||
if (_didIteratorError7) { | ||
throw _iteratorError7; | ||
} | ||
} | ||
} | ||
var _iteratorNormalCompletion8 = true; | ||
var _didIteratorError8 = false; | ||
var _iteratorError8 = undefined; | ||
for (var _iterator8 = this._otherValues, _isArray8 = Array.isArray(_iterator8), _i8 = 0, _iterator8 = _isArray8 ? _iterator8 : _iterator8[Symbol.iterator]();;) { | ||
var _ref8; | ||
try { | ||
for (var _iterator8 = this._otherValues[Symbol.iterator](), _step8; !(_iteratorNormalCompletion8 = (_step8 = _iterator8.next()).done); _iteratorNormalCompletion8 = true) { | ||
var otherValue = _step8.value; | ||
if (_isArray8) { | ||
if (_i8 >= _iterator8.length) break; | ||
_ref8 = _iterator8[_i8++]; | ||
} else { | ||
_i8 = _iterator8.next(); | ||
if (_i8.done) break; | ||
_ref8 = _i8.value; | ||
} | ||
values.push(otherValue); | ||
} | ||
} catch (err) { | ||
_didIteratorError8 = true; | ||
_iteratorError8 = err; | ||
} finally { | ||
try { | ||
if (!_iteratorNormalCompletion8 && _iterator8.return) { | ||
_iterator8.return(); | ||
} | ||
} finally { | ||
if (_didIteratorError8) { | ||
throw _iteratorError8; | ||
} | ||
} | ||
var otherValue = _ref8; | ||
values.push(otherValue); | ||
} | ||
@@ -354,50 +286,34 @@ | ||
var _iteratorNormalCompletion9 = true; | ||
var _didIteratorError9 = false; | ||
var _iteratorError9 = undefined; | ||
for (var _iterator9 = this._choiceValues, _isArray9 = Array.isArray(_iterator9), _i9 = 0, _iterator9 = _isArray9 ? _iterator9 : _iterator9[Symbol.iterator]();;) { | ||
var _ref9; | ||
try { | ||
for (var _iterator9 = this._choiceValues[Symbol.iterator](), _step9; !(_iteratorNormalCompletion9 = (_step9 = _iterator9.next()).done); _iteratorNormalCompletion9 = true) { | ||
var rawValue = _step9.value; | ||
if (_isArray9) { | ||
if (_i9 >= _iterator9.length) break; | ||
_ref9 = _iterator9[_i9++]; | ||
} else { | ||
_i9 = _iterator9.next(); | ||
if (_i9.done) break; | ||
_ref9 = _i9.value; | ||
} | ||
allValues.push(rawValue); | ||
} | ||
} catch (err) { | ||
_didIteratorError9 = true; | ||
_iteratorError9 = err; | ||
} finally { | ||
try { | ||
if (!_iteratorNormalCompletion9 && _iterator9.return) { | ||
_iterator9.return(); | ||
} | ||
} finally { | ||
if (_didIteratorError9) { | ||
throw _iteratorError9; | ||
} | ||
} | ||
var rawValue = _ref9; | ||
allValues.push(rawValue); | ||
} | ||
var _iteratorNormalCompletion10 = true; | ||
var _didIteratorError10 = false; | ||
var _iteratorError10 = undefined; | ||
for (var _iterator10 = this._otherValues, _isArray10 = Array.isArray(_iterator10), _i10 = 0, _iterator10 = _isArray10 ? _iterator10 : _iterator10[Symbol.iterator]();;) { | ||
var _ref10; | ||
try { | ||
for (var _iterator10 = this._otherValues[Symbol.iterator](), _step10; !(_iteratorNormalCompletion10 = (_step10 = _iterator10.next()).done); _iteratorNormalCompletion10 = true) { | ||
var otherValue = _step10.value; | ||
if (_isArray10) { | ||
if (_i10 >= _iterator10.length) break; | ||
_ref10 = _iterator10[_i10++]; | ||
} else { | ||
_i10 = _iterator10.next(); | ||
if (_i10.done) break; | ||
_ref10 = _i10.value; | ||
} | ||
allValues.push(otherValue); | ||
} | ||
} catch (err) { | ||
_didIteratorError10 = true; | ||
_iteratorError10 = err; | ||
} finally { | ||
try { | ||
if (!_iteratorNormalCompletion10 && _iterator10.return) { | ||
_iterator10.return(); | ||
} | ||
} finally { | ||
if (_didIteratorError10) { | ||
throw _iteratorError10; | ||
} | ||
} | ||
var otherValue = _ref10; | ||
allValues.push(otherValue); | ||
} | ||
@@ -404,0 +320,0 @@ |
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.__esModule = true; | ||
@@ -23,2 +21,4 @@ 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; }; }(); | ||
function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
@@ -28,3 +28,3 @@ | ||
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; } | ||
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) : _defaults(subClass, superClass); } | ||
@@ -41,3 +41,3 @@ var DisplaySeparator = ' ▸ '; | ||
var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(ClassificationValue).call(this, element, attributes)); | ||
var _this = _possibleConstructorReturn(this, _FormValue.call(this, element, attributes)); | ||
@@ -48,54 +48,38 @@ _this._choiceValues = []; | ||
if (attributes) { | ||
var _iteratorNormalCompletion = true; | ||
var _didIteratorError = false; | ||
var _iteratorError = undefined; | ||
for (var _iterator = attributes.choice_values, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) { | ||
var _ref; | ||
try { | ||
for (var _iterator = attributes.choice_values[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { | ||
var choice = _step.value; | ||
if (_isArray) { | ||
if (_i >= _iterator.length) break; | ||
_ref = _iterator[_i++]; | ||
} else { | ||
_i = _iterator.next(); | ||
if (_i.done) break; | ||
_ref = _i.value; | ||
} | ||
if (_textUtils2.default.isPresent(choice)) { | ||
_this._choiceValues.push(choice); | ||
} | ||
var choice = _ref; | ||
if (_textUtils2.default.isPresent(choice)) { | ||
_this._choiceValues.push(choice); | ||
} | ||
} catch (err) { | ||
_didIteratorError = true; | ||
_iteratorError = err; | ||
} finally { | ||
try { | ||
if (!_iteratorNormalCompletion && _iterator.return) { | ||
_iterator.return(); | ||
} | ||
} finally { | ||
if (_didIteratorError) { | ||
throw _iteratorError; | ||
} | ||
} | ||
} | ||
var _iteratorNormalCompletion2 = true; | ||
var _didIteratorError2 = false; | ||
var _iteratorError2 = undefined; | ||
for (var _iterator2 = attributes.other_values, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator]();;) { | ||
var _ref2; | ||
try { | ||
for (var _iterator2 = attributes.other_values[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) { | ||
var choice = _step2.value; | ||
if (_isArray2) { | ||
if (_i2 >= _iterator2.length) break; | ||
_ref2 = _iterator2[_i2++]; | ||
} else { | ||
_i2 = _iterator2.next(); | ||
if (_i2.done) break; | ||
_ref2 = _i2.value; | ||
} | ||
if (_textUtils2.default.isPresent(choice)) { | ||
_this._otherValues.push(choice); | ||
} | ||
var choice = _ref2; | ||
if (_textUtils2.default.isPresent(choice)) { | ||
_this._otherValues.push(choice); | ||
} | ||
} catch (err) { | ||
_didIteratorError2 = true; | ||
_iteratorError2 = err; | ||
} finally { | ||
try { | ||
if (!_iteratorNormalCompletion2 && _iterator2.return) { | ||
_iterator2.return(); | ||
} | ||
} finally { | ||
if (_didIteratorError2) { | ||
throw _iteratorError2; | ||
} | ||
} | ||
} | ||
@@ -106,33 +90,31 @@ } | ||
_createClass(ClassificationValue, [{ | ||
key: 'toJSON', | ||
value: function toJSON() { | ||
if (this.isEmpty) { | ||
return null; | ||
} | ||
ClassificationValue.prototype.toJSON = function toJSON() { | ||
if (this.isEmpty) { | ||
return null; | ||
} | ||
var choiceValues = this._choiceValues.slice(); | ||
var otherValues = this._otherValues.slice(); | ||
var choiceValues = this._choiceValues.slice(); | ||
var otherValues = this._otherValues.slice(); | ||
return { | ||
choice_values: choiceValues, | ||
other_values: otherValues | ||
}; | ||
return { | ||
choice_values: choiceValues, | ||
other_values: otherValues | ||
}; | ||
}; | ||
ClassificationValue.prototype.setSelectedClassification = function setSelectedClassification(classification, otherValue) { | ||
if (classification instanceof _classification2.default) { | ||
this._choiceValues = classification.toJSON(); | ||
} else { | ||
this._choiceValues = []; | ||
} | ||
}, { | ||
key: 'setSelectedClassification', | ||
value: function setSelectedClassification(classification, otherValue) { | ||
if (classification instanceof _classification2.default) { | ||
this._choiceValues = classification.toJSON(); | ||
} else { | ||
this._choiceValues = []; | ||
} | ||
if (otherValue) { | ||
this._otherValues = [otherValue.toString()]; | ||
} else { | ||
this._otherVaues = []; | ||
} | ||
if (otherValue) { | ||
this._otherValues = [otherValue.toString()]; | ||
} else { | ||
this._otherVaues = []; | ||
} | ||
}, { | ||
}; | ||
_createClass(ClassificationValue, [{ | ||
key: 'isEmpty', | ||
@@ -158,27 +140,19 @@ get: function get() { | ||
if (classification) { | ||
var _iteratorNormalCompletion3 = true; | ||
var _didIteratorError3 = false; | ||
var _iteratorError3 = undefined; | ||
for (var _iterator3 = classification.exploded, _isArray3 = Array.isArray(_iterator3), _i3 = 0, _iterator3 = _isArray3 ? _iterator3 : _iterator3[Symbol.iterator]();;) { | ||
var _ref3; | ||
try { | ||
for (var _iterator3 = classification.exploded[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) { | ||
var item = _step3.value; | ||
if (_isArray3) { | ||
if (_i3 >= _iterator3.length) break; | ||
_ref3 = _iterator3[_i3++]; | ||
} else { | ||
_i3 = _iterator3.next(); | ||
if (_i3.done) break; | ||
_ref3 = _i3.value; | ||
} | ||
if (item.label) { | ||
values.push(item.label); | ||
} | ||
var item = _ref3; | ||
if (item.label) { | ||
values.push(item.label); | ||
} | ||
} catch (err) { | ||
_didIteratorError3 = true; | ||
_iteratorError3 = err; | ||
} finally { | ||
try { | ||
if (!_iteratorNormalCompletion3 && _iterator3.return) { | ||
_iterator3.return(); | ||
} | ||
} finally { | ||
if (_didIteratorError3) { | ||
throw _iteratorError3; | ||
} | ||
} | ||
} | ||
@@ -201,30 +175,22 @@ } | ||
if (classification) { | ||
var _iteratorNormalCompletion4 = true; | ||
var _didIteratorError4 = false; | ||
var _iteratorError4 = undefined; | ||
for (var _iterator4 = classification.exploded, _isArray4 = Array.isArray(_iterator4), _i4 = 0, _iterator4 = _isArray4 ? _iterator4 : _iterator4[Symbol.iterator]();;) { | ||
var _ref4; | ||
try { | ||
for (var _iterator4 = classification.exploded[Symbol.iterator](), _step4; !(_iteratorNormalCompletion4 = (_step4 = _iterator4.next()).done); _iteratorNormalCompletion4 = true) { | ||
var item = _step4.value; | ||
if (_isArray4) { | ||
if (_i4 >= _iterator4.length) break; | ||
_ref4 = _iterator4[_i4++]; | ||
} else { | ||
_i4 = _iterator4.next(); | ||
if (_i4.done) break; | ||
_ref4 = _i4.value; | ||
} | ||
if (item.label) { | ||
values.push(item.label); | ||
} | ||
var item = _ref4; | ||
if (item.value) { | ||
values.push(item.value); | ||
} | ||
if (item.label) { | ||
values.push(item.label); | ||
} | ||
} catch (err) { | ||
_didIteratorError4 = true; | ||
_iteratorError4 = err; | ||
} finally { | ||
try { | ||
if (!_iteratorNormalCompletion4 && _iterator4.return) { | ||
_iterator4.return(); | ||
} | ||
} finally { | ||
if (_didIteratorError4) { | ||
throw _iteratorError4; | ||
} | ||
if (item.value) { | ||
values.push(item.value); | ||
} | ||
@@ -250,50 +216,34 @@ } | ||
var _iteratorNormalCompletion5 = true; | ||
var _didIteratorError5 = false; | ||
var _iteratorError5 = undefined; | ||
for (var _iterator5 = this._choiceValues, _isArray5 = Array.isArray(_iterator5), _i5 = 0, _iterator5 = _isArray5 ? _iterator5 : _iterator5[Symbol.iterator]();;) { | ||
var _ref5; | ||
try { | ||
for (var _iterator5 = this._choiceValues[Symbol.iterator](), _step5; !(_iteratorNormalCompletion5 = (_step5 = _iterator5.next()).done); _iteratorNormalCompletion5 = true) { | ||
var value = _step5.value; | ||
if (_isArray5) { | ||
if (_i5 >= _iterator5.length) break; | ||
_ref5 = _iterator5[_i5++]; | ||
} else { | ||
_i5 = _iterator5.next(); | ||
if (_i5.done) break; | ||
_ref5 = _i5.value; | ||
} | ||
allValues.push(value); | ||
} | ||
} catch (err) { | ||
_didIteratorError5 = true; | ||
_iteratorError5 = err; | ||
} finally { | ||
try { | ||
if (!_iteratorNormalCompletion5 && _iterator5.return) { | ||
_iterator5.return(); | ||
} | ||
} finally { | ||
if (_didIteratorError5) { | ||
throw _iteratorError5; | ||
} | ||
} | ||
var value = _ref5; | ||
allValues.push(value); | ||
} | ||
var _iteratorNormalCompletion6 = true; | ||
var _didIteratorError6 = false; | ||
var _iteratorError6 = undefined; | ||
for (var _iterator6 = this._otherValues, _isArray6 = Array.isArray(_iterator6), _i6 = 0, _iterator6 = _isArray6 ? _iterator6 : _iterator6[Symbol.iterator]();;) { | ||
var _ref6; | ||
try { | ||
for (var _iterator6 = this._otherValues[Symbol.iterator](), _step6; !(_iteratorNormalCompletion6 = (_step6 = _iterator6.next()).done); _iteratorNormalCompletion6 = true) { | ||
var value = _step6.value; | ||
if (_isArray6) { | ||
if (_i6 >= _iterator6.length) break; | ||
_ref6 = _iterator6[_i6++]; | ||
} else { | ||
_i6 = _iterator6.next(); | ||
if (_i6.done) break; | ||
_ref6 = _i6.value; | ||
} | ||
allValues.push(value); | ||
} | ||
} catch (err) { | ||
_didIteratorError6 = true; | ||
_iteratorError6 = err; | ||
} finally { | ||
try { | ||
if (!_iteratorNormalCompletion6 && _iterator6.return) { | ||
_iterator6.return(); | ||
} | ||
} finally { | ||
if (_didIteratorError6) { | ||
throw _iteratorError6; | ||
} | ||
} | ||
var value = _ref6; | ||
allValues.push(value); | ||
} | ||
@@ -337,50 +287,35 @@ | ||
var _iteratorNormalCompletion7 = true; | ||
var _didIteratorError7 = false; | ||
var _iteratorError7 = undefined; | ||
for (var _iterator7 = this._choiceValues, _isArray7 = Array.isArray(_iterator7), _i7 = 0, _iterator7 = _isArray7 ? _iterator7 : _iterator7[Symbol.iterator]();;) { | ||
var _ref7; | ||
try { | ||
for (var _iterator7 = this._choiceValues[Symbol.iterator](), _step7; !(_iteratorNormalCompletion7 = (_step7 = _iterator7.next()).done); _iteratorNormalCompletion7 = true) { | ||
var classificationValue = _step7.value; | ||
var _iteratorNormalCompletion8 = true; | ||
var _didIteratorError8 = false; | ||
var _iteratorError8 = undefined; | ||
if (_isArray7) { | ||
if (_i7 >= _iterator7.length) break; | ||
_ref7 = _iterator7[_i7++]; | ||
} else { | ||
_i7 = _iterator7.next(); | ||
if (_i7.done) break; | ||
_ref7 = _i7.value; | ||
} | ||
try { | ||
for (var _iterator8 = currentClassifications[Symbol.iterator](), _step8; !(_iteratorNormalCompletion8 = (_step8 = _iterator8.next()).done); _iteratorNormalCompletion8 = true) { | ||
var classification = _step8.value; | ||
var classificationValue = _ref7; | ||
if (classification.value === classificationValue) { | ||
result = classification; | ||
currentClassifications = classification.children; | ||
break; | ||
} | ||
} | ||
} catch (err) { | ||
_didIteratorError8 = true; | ||
_iteratorError8 = err; | ||
} finally { | ||
try { | ||
if (!_iteratorNormalCompletion8 && _iterator8.return) { | ||
_iterator8.return(); | ||
} | ||
} finally { | ||
if (_didIteratorError8) { | ||
throw _iteratorError8; | ||
} | ||
} | ||
for (var _iterator8 = currentClassifications, _isArray8 = Array.isArray(_iterator8), _i8 = 0, _iterator8 = _isArray8 ? _iterator8 : _iterator8[Symbol.iterator]();;) { | ||
var _ref8; | ||
if (_isArray8) { | ||
if (_i8 >= _iterator8.length) break; | ||
_ref8 = _iterator8[_i8++]; | ||
} else { | ||
_i8 = _iterator8.next(); | ||
if (_i8.done) break; | ||
_ref8 = _i8.value; | ||
} | ||
} | ||
} catch (err) { | ||
_didIteratorError7 = true; | ||
_iteratorError7 = err; | ||
} finally { | ||
try { | ||
if (!_iteratorNormalCompletion7 && _iterator7.return) { | ||
_iterator7.return(); | ||
var classification = _ref8; | ||
if (classification.value === classificationValue) { | ||
result = classification; | ||
currentClassifications = classification.children; | ||
break; | ||
} | ||
} finally { | ||
if (_didIteratorError7) { | ||
throw _iteratorError7; | ||
} | ||
} | ||
@@ -387,0 +322,0 @@ } |
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.__esModule = true; | ||
@@ -23,2 +21,4 @@ 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; }; }(); | ||
function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
@@ -28,3 +28,3 @@ | ||
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; } | ||
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) : _defaults(subClass, superClass); } | ||
@@ -37,38 +37,36 @@ var DateValue = function (_TextualValue) { | ||
return _possibleConstructorReturn(this, Object.getPrototypeOf(DateValue).call(this, element, value)); | ||
return _possibleConstructorReturn(this, _TextualValue.call(this, element, value)); | ||
} | ||
_createClass(DateValue, [{ | ||
key: 'isLessThan', | ||
value: function isLessThan(stringValue) { | ||
if (this.isEmpty) { | ||
return _textUtils2.default.isEmpty(stringValue); | ||
} | ||
DateValue.prototype.isLessThan = function isLessThan(stringValue) { | ||
if (this.isEmpty) { | ||
return _textUtils2.default.isEmpty(stringValue); | ||
} | ||
var thisDate = this.dateValue; | ||
var thatDate = _dateUtils2.default.parseDate(stringValue); | ||
var thisDate = this.dateValue; | ||
var thatDate = _dateUtils2.default.parseDate(stringValue); | ||
if (thisDate == null || thatDate == null) { | ||
return false; | ||
} | ||
if (thisDate == null || thatDate == null) { | ||
return false; | ||
} | ||
return thisDate.getTime() < thatDate.getTime(); | ||
return thisDate.getTime() < thatDate.getTime(); | ||
}; | ||
DateValue.prototype.isGreaterThan = function isGreaterThan(stringValue) { | ||
if (this.isEmpty) { | ||
return _textUtils2.default.isEmpty(stringValue); | ||
} | ||
}, { | ||
key: 'isGreaterThan', | ||
value: function isGreaterThan(stringValue) { | ||
if (this.isEmpty) { | ||
return _textUtils2.default.isEmpty(stringValue); | ||
} | ||
var thisDate = this.dateValue; | ||
var thatDate = _dateUtils2.default.parseDate(stringValue); | ||
var thisDate = this.dateValue; | ||
var thatDate = _dateUtils2.default.parseDate(stringValue); | ||
if (thisDate == null || thatDate == null) { | ||
return false; | ||
} | ||
if (thisDate == null || thatDate == null) { | ||
return false; | ||
} | ||
return thisDate.getTime() > thatDate.getTime(); | ||
} | ||
}, { | ||
return thisDate.getTime() > thatDate.getTime(); | ||
}; | ||
_createClass(DateValue, [{ | ||
key: 'displayValue', | ||
@@ -75,0 +73,0 @@ get: function get() { |
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.__esModule = 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 _dateUtils = require('../utils/date-utils'); | ||
@@ -28,220 +24,179 @@ | ||
_createClass(DefaultValues, null, [{ | ||
key: 'applyDefaultValue', | ||
value: function applyDefaultValue(defaultValue, element, formValues) { | ||
var value = formValues.get(element.key); | ||
DefaultValues.applyDefaultValue = function applyDefaultValue(defaultValue, element, formValues) { | ||
var value = formValues.get(element.key); | ||
var hasValue = value && !value.isEmpty; | ||
var hasValue = value && !value.isEmpty; | ||
if (hasValue || defaultValue == null) { | ||
return; | ||
} | ||
if (hasValue || defaultValue == null) { | ||
return; | ||
} | ||
if (element.isDateElement && defaultValue === NOW) { | ||
defaultValue = _dateUtils2.default.formatDate(new Date()); | ||
} else if (element.isTimeElement && defaultValue === NOW) { | ||
defaultValue = _dateUtils2.default.formatTime(new Date()); | ||
} | ||
if (element.isDateElement && defaultValue === NOW) { | ||
defaultValue = _dateUtils2.default.formatDate(new Date()); | ||
} else if (element.isTimeElement && defaultValue === NOW) { | ||
defaultValue = _dateUtils2.default.formatTime(new Date()); | ||
} | ||
var fieldValue = formValues.createValueFromString(element, defaultValue); | ||
var fieldValue = formValues.createValueFromString(element, defaultValue); | ||
if (fieldValue) { | ||
formValues.set(element.key, fieldValue); | ||
} | ||
if (fieldValue) { | ||
formValues.set(element.key, fieldValue); | ||
} | ||
}, { | ||
key: 'applyPreviousDefaults', | ||
value: function applyPreviousDefaults(defaultValues, formValues, record) { | ||
if (defaultValues == null) { | ||
return; | ||
} | ||
}; | ||
var elements = DefaultValues.elementsWithPreviousDefaultsEnabledWithinElements(formValues.elements, record.form); | ||
DefaultValues.applyPreviousDefaults = function applyPreviousDefaults(defaultValues, formValues, record) { | ||
if (defaultValues == null) { | ||
return; | ||
} | ||
var _iteratorNormalCompletion = true; | ||
var _didIteratorError = false; | ||
var _iteratorError = undefined; | ||
var elements = DefaultValues.elementsWithPreviousDefaultsEnabledWithinElements(formValues.elements, record.form); | ||
try { | ||
for (var _iterator = elements[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { | ||
var element = _step.value; | ||
for (var _iterator = elements, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) { | ||
var _ref; | ||
var previousDefaultAsJSON = defaultValues[element.key]; | ||
if (_isArray) { | ||
if (_i >= _iterator.length) break; | ||
_ref = _iterator[_i++]; | ||
} else { | ||
_i = _iterator.next(); | ||
if (_i.done) break; | ||
_ref = _i.value; | ||
} | ||
if (previousDefaultAsJSON) { | ||
var fieldValue = formValues.createValue(element, previousDefaultAsJSON); | ||
var currentValue = record.get(element.key, formValues); | ||
var element = _ref; | ||
var isCurrentlyEmpty = currentValue == null || currentValue.isEmpty; | ||
var previousDefaultAsJSON = defaultValues[element.key]; | ||
if (fieldValue && isCurrentlyEmpty) { | ||
record.set(element.key, fieldValue, formValues); | ||
if (previousDefaultAsJSON) { | ||
var fieldValue = formValues.createValue(element, previousDefaultAsJSON); | ||
var currentValue = record.get(element.key, formValues); | ||
if (element.isRecordLinkElement) { | ||
DefaultValues.applyDefaultValuesForRecordLinkValue(fieldValue, formValues, record); | ||
} | ||
} | ||
var isCurrentlyEmpty = currentValue == null || currentValue.isEmpty; | ||
if (fieldValue && isCurrentlyEmpty) { | ||
record.set(element.key, fieldValue, formValues); | ||
if (element.isRecordLinkElement) { | ||
DefaultValues.applyDefaultValuesForRecordLinkValue(fieldValue, formValues, record); | ||
} | ||
} | ||
} catch (err) { | ||
_didIteratorError = true; | ||
_iteratorError = err; | ||
} finally { | ||
try { | ||
if (!_iteratorNormalCompletion && _iterator.return) { | ||
_iterator.return(); | ||
} | ||
} finally { | ||
if (_didIteratorError) { | ||
throw _iteratorError; | ||
} | ||
} | ||
} | ||
} | ||
}, { | ||
key: 'applyDefaultValuesForRecordLinkValue', | ||
value: function applyDefaultValuesForRecordLinkValue(recordLinkValue, formValues, record) { | ||
var recordLinkElement = recordLinkValue.element; | ||
}; | ||
var itemValue = recordLinkValue.items[recordLinkValue.length - 1]; | ||
DefaultValues.applyDefaultValuesForRecordLinkValue = function applyDefaultValuesForRecordLinkValue(recordLinkValue, formValues, record) { | ||
var recordLinkElement = recordLinkValue.element; | ||
// TODO(zhm) reload? | ||
// [itemValue.record reload]; | ||
var itemValue = recordLinkValue.items[recordLinkValue.length - 1]; | ||
var otherRecord = itemValue.record; | ||
// TODO(zhm) reload? | ||
// [itemValue.record reload]; | ||
var _iteratorNormalCompletion2 = true; | ||
var _didIteratorError2 = false; | ||
var _iteratorError2 = undefined; | ||
var otherRecord = itemValue.record; | ||
try { | ||
for (var _iterator2 = recordLinkElement.recordDefaults[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) { | ||
var recordDefault = _step2.value; | ||
for (var _iterator2 = recordLinkElement.recordDefaults, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator]();;) { | ||
var _ref2; | ||
var otherValue = otherRecord.get(recordDefault.sourceKey, otherRecord.formValues); | ||
if (_isArray2) { | ||
if (_i2 >= _iterator2.length) break; | ||
_ref2 = _iterator2[_i2++]; | ||
} else { | ||
_i2 = _iterator2.next(); | ||
if (_i2.done) break; | ||
_ref2 = _i2.value; | ||
} | ||
// TODO(zhm) verify container here | ||
// FCMElement *newElement = [record.form elementByKey:recordDefault.destinationKey withinContainer:nil]; | ||
var newElement = record.form.elementsByKey[recordDefault.destinationKey]; | ||
var recordDefault = _ref2; | ||
if (newElement) { | ||
var newValue = formValues.createValueFromOtherValue(newElement, otherValue); | ||
var otherValue = otherRecord.get(recordDefault.sourceKey, otherRecord.formValues); | ||
if (newValue) { | ||
record.set(recordDefault.destinationKey, newValue, formValues); | ||
} | ||
} | ||
// TODO(zhm) verify container here | ||
// FCMElement *newElement = [record.form elementByKey:recordDefault.destinationKey withinContainer:nil]; | ||
var newElement = record.form.elementsByKey[recordDefault.destinationKey]; | ||
if (newElement) { | ||
var newValue = formValues.createValueFromOtherValue(newElement, otherValue); | ||
if (newValue) { | ||
record.set(recordDefault.destinationKey, newValue, formValues); | ||
} | ||
} catch (err) { | ||
_didIteratorError2 = true; | ||
_iteratorError2 = err; | ||
} finally { | ||
try { | ||
if (!_iteratorNormalCompletion2 && _iterator2.return) { | ||
_iterator2.return(); | ||
} | ||
} finally { | ||
if (_didIteratorError2) { | ||
throw _iteratorError2; | ||
} | ||
} | ||
} | ||
} | ||
}, { | ||
key: 'applyDefaultValueForElement', | ||
value: function applyDefaultValueForElement(element, formValues) { | ||
var defaultValue = element.defaultValue; | ||
}; | ||
if (defaultValue == null) { | ||
return; | ||
} | ||
DefaultValues.applyDefaultValueForElement = function applyDefaultValueForElement(element, formValues) { | ||
var defaultValue = element.defaultValue; | ||
DefaultValues.applyDefaultValue(defaultValue, element, formValues); | ||
if (defaultValue == null) { | ||
return; | ||
} | ||
}, { | ||
key: 'applyDefaultValuesForElements', | ||
value: function applyDefaultValuesForElements(elements, formValues, record) { | ||
var hasStatusDefault = record.form.statusField && _textUtils2.default.isPresent(record.form.statusField.defaultValue) && record.form.statusField.isEnabled; | ||
if (hasStatusDefault && _textUtils2.default.isEmpty(record.status)) { | ||
record.status = record.form.statusField.defaultValue; | ||
} | ||
DefaultValues.applyDefaultValue(defaultValue, element, formValues); | ||
}; | ||
DefaultValues.applyDefaultValuesForElementsRecursive(elements, formValues); | ||
DefaultValues.applyDefaultValuesForElements = function applyDefaultValuesForElements(elements, formValues, record) { | ||
var hasStatusDefault = record.form.statusField && _textUtils2.default.isPresent(record.form.statusField.defaultValue) && record.form.statusField.isEnabled; | ||
if (hasStatusDefault && _textUtils2.default.isEmpty(record.status)) { | ||
record.status = record.form.statusField.defaultValue; | ||
} | ||
}, { | ||
key: 'applyDefaultValuesForElementsRecursive', | ||
value: function applyDefaultValuesForElementsRecursive(elements, formValues) { | ||
var _iteratorNormalCompletion3 = true; | ||
var _didIteratorError3 = false; | ||
var _iteratorError3 = undefined; | ||
try { | ||
for (var _iterator3 = elements[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) { | ||
var element = _step3.value; | ||
DefaultValues.applyDefaultValuesForElementsRecursive(elements, formValues); | ||
}; | ||
if (element.isSectionElement) { | ||
DefaultValues.applyDefaultValuesForElementsRecursive(element.elements, formValues); | ||
} else { | ||
DefaultValues.applyDefaultValueForElement(element, formValues); | ||
} | ||
} | ||
} catch (err) { | ||
_didIteratorError3 = true; | ||
_iteratorError3 = err; | ||
} finally { | ||
try { | ||
if (!_iteratorNormalCompletion3 && _iterator3.return) { | ||
_iterator3.return(); | ||
} | ||
} finally { | ||
if (_didIteratorError3) { | ||
throw _iteratorError3; | ||
} | ||
} | ||
DefaultValues.applyDefaultValuesForElementsRecursive = function applyDefaultValuesForElementsRecursive(elements, formValues) { | ||
for (var _iterator3 = elements, _isArray3 = Array.isArray(_iterator3), _i3 = 0, _iterator3 = _isArray3 ? _iterator3 : _iterator3[Symbol.iterator]();;) { | ||
var _ref3; | ||
if (_isArray3) { | ||
if (_i3 >= _iterator3.length) break; | ||
_ref3 = _iterator3[_i3++]; | ||
} else { | ||
_i3 = _iterator3.next(); | ||
if (_i3.done) break; | ||
_ref3 = _i3.value; | ||
} | ||
} | ||
}, { | ||
key: 'elementsWithPreviousDefaultsEnabledWithinElements', | ||
value: function elementsWithPreviousDefaultsEnabledWithinElements(elements, form) { | ||
var results = []; | ||
if (form && form.statusField.isEnabled && form.statusField.isDefaultPreviousValueEnabled) { | ||
results.push(form.statusField); | ||
var element = _ref3; | ||
if (element.isSectionElement) { | ||
DefaultValues.applyDefaultValuesForElementsRecursive(element.elements, formValues); | ||
} else { | ||
DefaultValues.applyDefaultValueForElement(element, formValues); | ||
} | ||
} | ||
}; | ||
var _iteratorNormalCompletion4 = true; | ||
var _didIteratorError4 = false; | ||
var _iteratorError4 = undefined; | ||
DefaultValues.elementsWithPreviousDefaultsEnabledWithinElements = function elementsWithPreviousDefaultsEnabledWithinElements(elements, form) { | ||
var results = []; | ||
try { | ||
for (var _iterator4 = elements[Symbol.iterator](), _step4; !(_iteratorNormalCompletion4 = (_step4 = _iterator4.next()).done); _iteratorNormalCompletion4 = true) { | ||
var element = _step4.value; | ||
if (form && form.statusField.isEnabled && form.statusField.isDefaultPreviousValueEnabled) { | ||
results.push(form.statusField); | ||
} | ||
if (element.isSectionElement) { | ||
// when recursing don't pass in the form, so the status field is only added once | ||
Array.prototype.push.apply(results, DefaultValues.elementsWithPreviousDefaultsEnabledWithinElements(element.elements, null)); | ||
} else if (element.isDefaultPreviousValueEnabled) { | ||
results.push(element); | ||
} | ||
} | ||
} catch (err) { | ||
_didIteratorError4 = true; | ||
_iteratorError4 = err; | ||
} finally { | ||
try { | ||
if (!_iteratorNormalCompletion4 && _iterator4.return) { | ||
_iterator4.return(); | ||
} | ||
} finally { | ||
if (_didIteratorError4) { | ||
throw _iteratorError4; | ||
} | ||
} | ||
for (var _iterator4 = elements, _isArray4 = Array.isArray(_iterator4), _i4 = 0, _iterator4 = _isArray4 ? _iterator4 : _iterator4[Symbol.iterator]();;) { | ||
var _ref4; | ||
if (_isArray4) { | ||
if (_i4 >= _iterator4.length) break; | ||
_ref4 = _iterator4[_i4++]; | ||
} else { | ||
_i4 = _iterator4.next(); | ||
if (_i4.done) break; | ||
_ref4 = _i4.value; | ||
} | ||
return results; | ||
var element = _ref4; | ||
if (element.isSectionElement) { | ||
// when recursing don't pass in the form, so the status field is only added once | ||
Array.prototype.push.apply(results, DefaultValues.elementsWithPreviousDefaultsEnabledWithinElements(element.elements, null)); | ||
} else if (element.isDefaultPreviousValueEnabled) { | ||
results.push(element); | ||
} | ||
} | ||
}]); | ||
return results; | ||
}; | ||
return DefaultValues; | ||
@@ -248,0 +203,0 @@ }(); |
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.__esModule = 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 _choiceValue = require('./choice-value'); | ||
@@ -102,20 +98,16 @@ | ||
_createClass(FormValueFactory, null, [{ | ||
key: 'create', | ||
value: function create(element, attributes) { | ||
var constructor = Constructors[element.type]; | ||
FormValueFactory.create = function create(element, attributes) { | ||
var constructor = Constructors[element.type]; | ||
if (constructor == null) { | ||
throw new Error('Unsupported element ' + element.type); | ||
} | ||
return new constructor(element, attributes); | ||
if (constructor == null) { | ||
throw new Error('Unsupported element ' + element.type); | ||
} | ||
}, { | ||
key: 'classes', | ||
value: function classes() { | ||
return Constructors; | ||
} | ||
}]); | ||
return new constructor(element, attributes); | ||
}; | ||
FormValueFactory.classes = function classes() { | ||
return Constructors; | ||
}; | ||
return FormValueFactory; | ||
@@ -122,0 +114,0 @@ }(); |
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.__esModule = true; | ||
@@ -31,33 +29,64 @@ 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; }; }(); | ||
FormValue.prototype.toJSON = function toJSON() { | ||
notImplemented(); | ||
}; | ||
FormValue.prototype.isEqual = function isEqual(value) { | ||
notImplemented(); | ||
}; | ||
FormValue.prototype.contains = function contains(value) { | ||
notImplemented(); | ||
}; | ||
FormValue.prototype.startsWith = function startsWith(value) { | ||
notImplemented(); | ||
}; | ||
FormValue.prototype.isLessThan = function isLessThan(value) { | ||
notImplemented(); | ||
}; | ||
FormValue.prototype.isGreaterThan = function isGreaterThan(value) { | ||
notImplemented(); | ||
}; | ||
FormValue.factory = function factory() { | ||
return FormValueFactory = FormValueFactory || require('./form-value-factory').default; | ||
}; | ||
FormValue.create = function create(element, attributes) { | ||
return FormValue.factory().create(element, attributes); | ||
}; | ||
FormValue.classes = function classes() { | ||
if (FormValue._classes == null) { | ||
FormValue._classes = {}; | ||
for (var _iterator = Object.keys(_elementTypes2.default), _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) { | ||
var _ref; | ||
if (_isArray) { | ||
if (_i >= _iterator.length) break; | ||
_ref = _iterator[_i++]; | ||
} else { | ||
_i = _iterator.next(); | ||
if (_i.done) break; | ||
_ref = _i.value; | ||
} | ||
var klass = _ref; | ||
var constructor = FormValue.factory().classes()[_elementTypes2.default[klass]]; | ||
if (constructor) { | ||
FormValue._classes[constructor.name] = constructor; | ||
} | ||
} | ||
} | ||
return FormValue._classes; | ||
}; | ||
_createClass(FormValue, [{ | ||
key: 'toJSON', | ||
value: function toJSON() { | ||
notImplemented(); | ||
} | ||
}, { | ||
key: 'isEqual', | ||
value: function isEqual(value) { | ||
notImplemented(); | ||
} | ||
}, { | ||
key: 'contains', | ||
value: function contains(value) { | ||
notImplemented(); | ||
} | ||
}, { | ||
key: 'startsWith', | ||
value: function startsWith(value) { | ||
notImplemented(); | ||
} | ||
}, { | ||
key: 'isLessThan', | ||
value: function isLessThan(value) { | ||
notImplemented(); | ||
} | ||
}, { | ||
key: 'isGreaterThan', | ||
value: function isGreaterThan(value) { | ||
notImplemented(); | ||
} | ||
}, { | ||
key: 'element', | ||
@@ -100,50 +129,2 @@ get: function get() { | ||
} | ||
}], [{ | ||
key: 'factory', | ||
value: function factory() { | ||
return FormValueFactory = FormValueFactory || require('./form-value-factory').default; | ||
} | ||
}, { | ||
key: 'create', | ||
value: function create(element, attributes) { | ||
return FormValue.factory().create(element, attributes); | ||
} | ||
}, { | ||
key: 'classes', | ||
value: function classes() { | ||
if (FormValue._classes == null) { | ||
FormValue._classes = {}; | ||
var _iteratorNormalCompletion = true; | ||
var _didIteratorError = false; | ||
var _iteratorError = undefined; | ||
try { | ||
for (var _iterator = Object.keys(_elementTypes2.default)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { | ||
var klass = _step.value; | ||
var constructor = FormValue.factory().classes()[_elementTypes2.default[klass]]; | ||
if (constructor) { | ||
FormValue._classes[constructor.name] = constructor; | ||
} | ||
} | ||
} catch (err) { | ||
_didIteratorError = true; | ||
_iteratorError = err; | ||
} finally { | ||
try { | ||
if (!_iteratorNormalCompletion && _iterator.return) { | ||
_iterator.return(); | ||
} | ||
} finally { | ||
if (_didIteratorError) { | ||
throw _iteratorError; | ||
} | ||
} | ||
} | ||
} | ||
return FormValue._classes; | ||
} | ||
}]); | ||
@@ -150,0 +131,0 @@ |
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.__esModule = true; | ||
@@ -40,238 +38,203 @@ 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; }; }(); | ||
_createClass(FormValues, [{ | ||
key: 'get', | ||
value: function get(key) { | ||
return this._values[key]; | ||
FormValues.prototype.get = function get(key) { | ||
return this._values[key]; | ||
}; | ||
FormValues.prototype.set = function set(key, value) { | ||
if (value && !(value instanceof _formValue2.default)) { | ||
throw new Error('Invalid value ' + value); | ||
} | ||
}, { | ||
key: 'set', | ||
value: function set(key, value) { | ||
if (value && !(value instanceof _formValue2.default)) { | ||
throw new Error('Invalid value ' + value); | ||
} | ||
if (value != null) { | ||
this._values[key] = value; | ||
} else { | ||
delete this._values[key]; | ||
} | ||
if (value != null) { | ||
this._values[key] = value; | ||
} else { | ||
delete this._values[key]; | ||
} | ||
}, { | ||
key: 'find', | ||
value: function find(dataName) { | ||
var element = this.container.elementsByDataName[dataName]; | ||
}; | ||
if (element) { | ||
return this.get(element.key); | ||
FormValues.prototype.find = function find(dataName) { | ||
var element = this.container.elementsByDataName[dataName]; | ||
if (element) { | ||
return this.get(element.key); | ||
} | ||
return null; | ||
}; | ||
FormValues.prototype.loadValues = function loadValues(elements, attributes) { | ||
for (var _iterator = elements, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) { | ||
var _ref; | ||
if (_isArray) { | ||
if (_i >= _iterator.length) break; | ||
_ref = _iterator[_i++]; | ||
} else { | ||
_i = _iterator.next(); | ||
if (_i.done) break; | ||
_ref = _i.value; | ||
} | ||
return null; | ||
var element = _ref; | ||
this.loadValue(element, attributes); | ||
} | ||
}, { | ||
key: 'loadValues', | ||
value: function loadValues(elements, attributes) { | ||
var _iteratorNormalCompletion = true; | ||
var _didIteratorError = false; | ||
var _iteratorError = undefined; | ||
}; | ||
try { | ||
for (var _iterator = elements[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { | ||
var element = _step.value; | ||
FormValues.prototype.loadValue = function loadValue(element, attributes) { | ||
if (element.isSectionElement) { | ||
this.loadValues(element.elements, attributes); | ||
} else { | ||
var rawValue = attributes[element.key]; | ||
this.loadValue(element, attributes); | ||
} | ||
} catch (err) { | ||
_didIteratorError = true; | ||
_iteratorError = err; | ||
} finally { | ||
try { | ||
if (!_iteratorNormalCompletion && _iterator.return) { | ||
_iterator.return(); | ||
} | ||
} finally { | ||
if (_didIteratorError) { | ||
throw _iteratorError; | ||
} | ||
} | ||
if (rawValue != null) { | ||
var formValue = _formValueFactory2.default.create(element, rawValue); | ||
this.set(element.key, formValue); | ||
} | ||
} | ||
}, { | ||
key: 'loadValue', | ||
value: function loadValue(element, attributes) { | ||
if (element.isSectionElement) { | ||
this.loadValues(element.elements, attributes); | ||
}; | ||
FormValues.prototype.toJSON = function toJSON() { | ||
var json = {}; | ||
for (var _iterator2 = Object.keys(this._values), _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator]();;) { | ||
var _ref2; | ||
if (_isArray2) { | ||
if (_i2 >= _iterator2.length) break; | ||
_ref2 = _iterator2[_i2++]; | ||
} else { | ||
var rawValue = attributes[element.key]; | ||
_i2 = _iterator2.next(); | ||
if (_i2.done) break; | ||
_ref2 = _i2.value; | ||
} | ||
if (rawValue != null) { | ||
var formValue = _formValueFactory2.default.create(element, rawValue); | ||
var key = _ref2; | ||
this.set(element.key, formValue); | ||
var formValue = this._values[key]; | ||
if (formValue) { | ||
var jsonValue = formValue.toJSON(); | ||
if (jsonValue) { | ||
json[key] = jsonValue; | ||
} | ||
} | ||
} | ||
}, { | ||
key: 'toJSON', | ||
value: function toJSON() { | ||
var json = {}; | ||
var _iteratorNormalCompletion2 = true; | ||
var _didIteratorError2 = false; | ||
var _iteratorError2 = undefined; | ||
return json; | ||
}; | ||
try { | ||
for (var _iterator2 = Object.keys(this._values)[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) { | ||
var key = _step2.value; | ||
FormValues.prototype.copy = function copy() { | ||
return new FormValues(this.container, this.toJSON()); | ||
}; | ||
var formValue = this._values[key]; | ||
FormValues.prototype.merge = function merge(formValues) { | ||
if (!(formValues instanceof FormValues)) { | ||
throw new Error('Invalid values'); | ||
} | ||
if (formValue) { | ||
var jsonValue = formValue.toJSON(); | ||
for (var _iterator3 = Object.keys(formValues._values), _isArray3 = Array.isArray(_iterator3), _i3 = 0, _iterator3 = _isArray3 ? _iterator3 : _iterator3[Symbol.iterator]();;) { | ||
var _ref3; | ||
if (jsonValue) { | ||
json[key] = jsonValue; | ||
} | ||
} | ||
} | ||
} catch (err) { | ||
_didIteratorError2 = true; | ||
_iteratorError2 = err; | ||
} finally { | ||
try { | ||
if (!_iteratorNormalCompletion2 && _iterator2.return) { | ||
_iterator2.return(); | ||
} | ||
} finally { | ||
if (_didIteratorError2) { | ||
throw _iteratorError2; | ||
} | ||
} | ||
if (_isArray3) { | ||
if (_i3 >= _iterator3.length) break; | ||
_ref3 = _iterator3[_i3++]; | ||
} else { | ||
_i3 = _iterator3.next(); | ||
if (_i3.done) break; | ||
_ref3 = _i3.value; | ||
} | ||
return json; | ||
var key = _ref3; | ||
var formValue = formValues._values[key]; | ||
this.set(key, formValue); | ||
} | ||
}, { | ||
key: 'copy', | ||
value: function copy() { | ||
return new FormValues(this.container, this.toJSON()); | ||
} | ||
}, { | ||
key: 'merge', | ||
value: function merge(formValues) { | ||
if (!(formValues instanceof FormValues)) { | ||
throw new Error('Invalid values'); | ||
} | ||
}; | ||
var _iteratorNormalCompletion3 = true; | ||
var _didIteratorError3 = false; | ||
var _iteratorError3 = undefined; | ||
FormValues.prototype.createValue = function createValue(element, rawValue) { | ||
return _formValueFactory2.default.create(element, rawValue != null ? rawValue : null); | ||
}; | ||
try { | ||
for (var _iterator3 = Object.keys(this._values)[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) { | ||
var key = _step3.value; | ||
FormValues.prototype.createValueFromString = function createValueFromString(element, string) { | ||
if (element.isTextElement) { | ||
return this.createValue(element, string); | ||
} else if (element.isChoiceElement) { | ||
var choice = element.choiceByValue(string); | ||
var formValue = this._values[key]; | ||
this.set(key, formValue); | ||
} | ||
} catch (err) { | ||
_didIteratorError3 = true; | ||
_iteratorError3 = err; | ||
} finally { | ||
try { | ||
if (!_iteratorNormalCompletion3 && _iterator3.return) { | ||
_iterator3.return(); | ||
} | ||
} finally { | ||
if (_didIteratorError3) { | ||
throw _iteratorError3; | ||
} | ||
} | ||
if (choice) { | ||
return this.createValue(element, { choice_values: [choice.value] }); | ||
} | ||
} else if (element.isYesNoElement) { | ||
return this.createValue(element, string); | ||
} else if (element.isBarcodeElement) { | ||
return this.createValue(element, string); | ||
} else if (element.isClassificationElement) { | ||
return this.createValue(element, { choice_values: [string] }); | ||
} else if (element.isDateElement) { | ||
return this.createValue(element, string); | ||
} else if (element.isTimeElement) { | ||
return this.createValue(element, string); | ||
} else if (element.isHyperlinkElement) { | ||
return this.createValue(element, string); | ||
} | ||
}, { | ||
key: 'createValue', | ||
value: function createValue(element, rawValue) { | ||
return _formValueFactory2.default.create(element, rawValue != null ? rawValue : null); | ||
} | ||
}, { | ||
key: 'createValueFromString', | ||
value: function createValueFromString(element, string) { | ||
if (element.isTextElement) { | ||
return this.createValue(element, string); | ||
} else if (element.isChoiceElement) { | ||
var choice = element.choiceByValue(string); | ||
if (choice) { | ||
return this.createValue(element, { choice_values: [choice.value] }); | ||
} | ||
} else if (element.isYesNoElement) { | ||
return this.createValue(element, string); | ||
} else if (element.isBarcodeElement) { | ||
return this.createValue(element, string); | ||
} else if (element.isClassificationElement) { | ||
return this.createValue(element, { choice_values: [string] }); | ||
} else if (element.isDateElement) { | ||
return this.createValue(element, string); | ||
} else if (element.isTimeElement) { | ||
return this.createValue(element, string); | ||
} else if (element.isHyperlinkElement) { | ||
return this.createValue(element, string); | ||
} | ||
return null; | ||
}; | ||
return null; | ||
FormValues.prototype.createValueFromOtherValue = function createValueFromOtherValue(element, otherValue) { | ||
if (otherValue == null) { | ||
return this.createValue(element, null); | ||
} | ||
}, { | ||
key: 'createValueFromOtherValue', | ||
value: function createValueFromOtherValue(element, otherValue) { | ||
if (otherValue == null) { | ||
return this.createValue(element, null); | ||
} | ||
var destinationIsTextual = element instanceof _textualElement2.default; | ||
var otherIsTextual = otherValue.element instanceof _textualElement2.default; | ||
var destinationIsTextual = element instanceof _textualElement2.default; | ||
var otherIsTextual = otherValue.element instanceof _textualElement2.default; | ||
if (destinationIsTextual && otherIsTextual) { | ||
// converting text -> text | ||
// if the other field is a calculated field and it's being copied to a regular text field, | ||
// use the display value instead of the raw value so it can use the display formatting logic | ||
if (destinationIsTextual && otherIsTextual) { | ||
// converting text -> text | ||
// if the other field is a calculated field and it's being copied to a regular text field, | ||
// use the display value instead of the raw value so it can use the display formatting logic | ||
var stringValue = otherValue.textValue; | ||
var stringValue = otherValue.textValue; | ||
if (otherValue.element.isCalculatedElement && element.isTextElement) { | ||
if (!element.isNumeric) { | ||
stringValue = otherValue.displayValue; | ||
} | ||
if (otherValue.element.isCalculatedElement && element.isTextElement) { | ||
if (!element.isNumeric) { | ||
stringValue = otherValue.displayValue; | ||
} | ||
} | ||
return this.createValue(element, stringValue); | ||
} else if (destinationIsTextual && !otherIsTextual) { | ||
// converting choice -> text | ||
if (otherValue.element.isChoiceElement || otherValue.element.isClassificationElement) { | ||
var displayValue = otherValue.displayValue; | ||
return this.createValue(element, stringValue); | ||
} else if (destinationIsTextual && !otherIsTextual) { | ||
// converting choice -> text | ||
if (otherValue.element.isChoiceElement || otherValue.element.isClassificationElement) { | ||
var displayValue = otherValue.displayValue; | ||
if (_textUtils2.default.isPresent(displayValue)) { | ||
return this.createValue(element, displayValue); | ||
} | ||
if (_textUtils2.default.isPresent(displayValue)) { | ||
return this.createValue(element, displayValue); | ||
} | ||
} else if (!destinationIsTextual && otherIsTextual) { | ||
// converting text -> choice | ||
if (element.isChoiceElement) { | ||
if (!otherValue.isEmpty) { | ||
return this.createValueFromString(element, otherValue.textValue); | ||
} | ||
} | ||
} else if (!destinationIsTextual && otherIsTextual) { | ||
// converting text -> choice | ||
if (element.isChoiceElement) { | ||
if (!otherValue.isEmpty) { | ||
return this.createValueFromString(element, otherValue.textValue); | ||
} | ||
} else if (!destinationIsTextual && !otherIsTextual) { | ||
// choice -> choice | ||
if (element.isChoiceElement && otherValue.element.isChoiceElement || element.isClassificationElement && otherValue.element.isClassificationElement) { | ||
return this.createValue(element, otherValue.toJSON()); | ||
} else if (element.isAddressElement && otherValue.element.isAddressElement) { | ||
// address -> address | ||
return this.createValue(element, otherValue.toJSON()); | ||
} | ||
} | ||
} else if (!destinationIsTextual && !otherIsTextual) { | ||
// choice -> choice | ||
if (element.isChoiceElement && otherValue.element.isChoiceElement || element.isClassificationElement && otherValue.element.isClassificationElement) { | ||
return this.createValue(element, otherValue.toJSON()); | ||
} else if (element.isAddressElement && otherValue.element.isAddressElement) { | ||
// address -> address | ||
return this.createValue(element, otherValue.toJSON()); | ||
} | ||
} | ||
return null; | ||
} | ||
}, { | ||
return null; | ||
}; | ||
_createClass(FormValues, [{ | ||
key: 'all', | ||
@@ -281,25 +244,17 @@ get: function get() { | ||
var _iteratorNormalCompletion4 = true; | ||
var _didIteratorError4 = false; | ||
var _iteratorError4 = undefined; | ||
for (var _iterator4 = Object.keys(this._values), _isArray4 = Array.isArray(_iterator4), _i4 = 0, _iterator4 = _isArray4 ? _iterator4 : _iterator4[Symbol.iterator]();;) { | ||
var _ref4; | ||
try { | ||
for (var _iterator4 = Object.keys(this._values)[Symbol.iterator](), _step4; !(_iteratorNormalCompletion4 = (_step4 = _iterator4.next()).done); _iteratorNormalCompletion4 = true) { | ||
var key = _step4.value; | ||
if (_isArray4) { | ||
if (_i4 >= _iterator4.length) break; | ||
_ref4 = _iterator4[_i4++]; | ||
} else { | ||
_i4 = _iterator4.next(); | ||
if (_i4.done) break; | ||
_ref4 = _i4.value; | ||
} | ||
result.push(this._values[key]); | ||
} | ||
} catch (err) { | ||
_didIteratorError4 = true; | ||
_iteratorError4 = err; | ||
} finally { | ||
try { | ||
if (!_iteratorNormalCompletion4 && _iterator4.return) { | ||
_iterator4.return(); | ||
} | ||
} finally { | ||
if (_didIteratorError4) { | ||
throw _iteratorError4; | ||
} | ||
} | ||
var key = _ref4; | ||
result.push(this._values[key]); | ||
} | ||
@@ -314,33 +269,25 @@ | ||
var _iteratorNormalCompletion5 = true; | ||
var _didIteratorError5 = false; | ||
var _iteratorError5 = undefined; | ||
for (var _iterator5 = Object.keys(this._values), _isArray5 = Array.isArray(_iterator5), _i5 = 0, _iterator5 = _isArray5 ? _iterator5 : _iterator5[Symbol.iterator]();;) { | ||
var _ref5; | ||
try { | ||
for (var _iterator5 = Object.keys(this._values)[Symbol.iterator](), _step5; !(_iteratorNormalCompletion5 = (_step5 = _iterator5.next()).done); _iteratorNormalCompletion5 = true) { | ||
var key = _step5.value; | ||
if (_isArray5) { | ||
if (_i5 >= _iterator5.length) break; | ||
_ref5 = _iterator5[_i5++]; | ||
} else { | ||
_i5 = _iterator5.next(); | ||
if (_i5.done) break; | ||
_ref5 = _i5.value; | ||
} | ||
var formValue = this._values[key]; | ||
var key = _ref5; | ||
if (formValue) { | ||
var searchValue = formValue.searchableValue; | ||
var formValue = this._values[key]; | ||
if (searchValue != null) { | ||
searchValues.push(searchValue); | ||
} | ||
if (formValue) { | ||
var searchValue = formValue.searchableValue; | ||
if (searchValue != null) { | ||
searchValues.push(searchValue); | ||
} | ||
} | ||
} catch (err) { | ||
_didIteratorError5 = true; | ||
_iteratorError5 = err; | ||
} finally { | ||
try { | ||
if (!_iteratorNormalCompletion5 && _iterator5.return) { | ||
_iterator5.return(); | ||
} | ||
} finally { | ||
if (_didIteratorError5) { | ||
throw _iteratorError5; | ||
} | ||
} | ||
} | ||
@@ -347,0 +294,0 @@ |
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.__esModule = true; | ||
@@ -13,2 +11,4 @@ var _textualValue = require('./textual-value'); | ||
function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
@@ -18,3 +18,3 @@ | ||
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; } | ||
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) : _defaults(subClass, superClass); } | ||
@@ -27,3 +27,3 @@ var HyperlinkValue = function (_TextualValue) { | ||
return _possibleConstructorReturn(this, Object.getPrototypeOf(HyperlinkValue).apply(this, arguments)); | ||
return _possibleConstructorReturn(this, _TextualValue.apply(this, arguments)); | ||
} | ||
@@ -30,0 +30,0 @@ |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.__esModule = 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; }; }(); | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
@@ -19,13 +15,10 @@ | ||
_createClass(MediaItemValue, [{ | ||
key: "toJSON", | ||
value: function toJSON() { | ||
var json = {}; | ||
MediaItemValue.prototype.toJSON = function toJSON() { | ||
var json = {}; | ||
json.caption = this.caption || null; | ||
json[this.mediaKey] = this.mediaID || null; | ||
json.caption = this.caption || null; | ||
json[this.mediaKey] = this.mediaID || null; | ||
return json; | ||
} | ||
}]); | ||
return json; | ||
}; | ||
@@ -32,0 +25,0 @@ return MediaItemValue; |
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.__esModule = true; | ||
@@ -27,2 +25,4 @@ 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; }; }(); | ||
function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
@@ -32,3 +32,3 @@ | ||
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; } | ||
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) : _defaults(subClass, superClass); } | ||
@@ -41,3 +41,3 @@ var MediaValue = function (_FormValue) { | ||
var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(MediaValue).call(this, element, items)); | ||
var _this = _possibleConstructorReturn(this, _FormValue.call(this, element, items)); | ||
@@ -47,25 +47,17 @@ _this._items = []; | ||
if (items != null) { | ||
var _iteratorNormalCompletion = true; | ||
var _didIteratorError = false; | ||
var _iteratorError = undefined; | ||
for (var _iterator = items, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) { | ||
var _ref; | ||
try { | ||
for (var _iterator = items[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { | ||
var item = _step.value; | ||
if (_isArray) { | ||
if (_i >= _iterator.length) break; | ||
_ref = _iterator[_i++]; | ||
} else { | ||
_i = _iterator.next(); | ||
if (_i.done) break; | ||
_ref = _i.value; | ||
} | ||
_this._items.push(new _this.ItemClass(item)); | ||
} | ||
} catch (err) { | ||
_didIteratorError = true; | ||
_iteratorError = err; | ||
} finally { | ||
try { | ||
if (!_iteratorNormalCompletion && _iterator.return) { | ||
_iterator.return(); | ||
} | ||
} finally { | ||
if (_didIteratorError) { | ||
throw _iteratorError; | ||
} | ||
} | ||
var item = _ref; | ||
_this._items.push(new _this.ItemClass(item)); | ||
} | ||
@@ -76,108 +68,60 @@ } | ||
_createClass(MediaValue, [{ | ||
key: 'columnValue', | ||
value: function columnValue() { | ||
var ids = []; | ||
MediaValue.prototype.toJSON = function toJSON() { | ||
var items = []; | ||
var _iteratorNormalCompletion2 = true; | ||
var _didIteratorError2 = false; | ||
var _iteratorError2 = undefined; | ||
for (var _iterator2 = this._items, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator]();;) { | ||
var _ref2; | ||
try { | ||
for (var _iterator2 = this._items[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) { | ||
var item = _step2.value; | ||
ids.push(item.mediaID); | ||
} | ||
} catch (err) { | ||
_didIteratorError2 = true; | ||
_iteratorError2 = err; | ||
} finally { | ||
try { | ||
if (!_iteratorNormalCompletion2 && _iterator2.return) { | ||
_iterator2.return(); | ||
} | ||
} finally { | ||
if (_didIteratorError2) { | ||
throw _iteratorError2; | ||
} | ||
} | ||
if (_isArray2) { | ||
if (_i2 >= _iterator2.length) break; | ||
_ref2 = _iterator2[_i2++]; | ||
} else { | ||
_i2 = _iterator2.next(); | ||
if (_i2.done) break; | ||
_ref2 = _i2.value; | ||
} | ||
return ids.join(','); | ||
var item = _ref2; | ||
items.push(item.toJSON()); | ||
} | ||
}, { | ||
key: 'toJSON', | ||
value: function toJSON() { | ||
var items = []; | ||
var _iteratorNormalCompletion3 = true; | ||
var _didIteratorError3 = false; | ||
var _iteratorError3 = undefined; | ||
return items; | ||
}; | ||
try { | ||
for (var _iterator3 = this._items[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) { | ||
var item = _step3.value; | ||
MediaValue.prototype.isEqual = function isEqual(value) { | ||
return false; | ||
}; | ||
items.push(item.toJSON()); | ||
} | ||
} catch (err) { | ||
_didIteratorError3 = true; | ||
_iteratorError3 = err; | ||
} finally { | ||
try { | ||
if (!_iteratorNormalCompletion3 && _iterator3.return) { | ||
_iterator3.return(); | ||
} | ||
} finally { | ||
if (_didIteratorError3) { | ||
throw _iteratorError3; | ||
} | ||
} | ||
} | ||
MediaValue.prototype.contains = function contains(value) { | ||
return false; | ||
}; | ||
return items; | ||
} | ||
}, { | ||
key: 'isEqual', | ||
value: function isEqual(value) { | ||
return false; | ||
} | ||
}, { | ||
key: 'contains', | ||
value: function contains(value) { | ||
return false; | ||
} | ||
}, { | ||
key: 'startsWith', | ||
value: function startsWith(value) { | ||
return false; | ||
} | ||
}, { | ||
key: 'isLessThan', | ||
value: function isLessThan(value) { | ||
return this.length < _numberUtils2.default.parseDouble(value); | ||
} | ||
}, { | ||
key: 'isGreaterThan', | ||
value: function isGreaterThan(value) { | ||
return this.length > _numberUtils2.default.parseDouble(value); | ||
} | ||
}, { | ||
key: 'mapItems', | ||
value: function mapItems(callback) { | ||
return this._items.slice().map(callback); | ||
} | ||
}, { | ||
key: 'addItem', | ||
value: function addItem(id, caption) { | ||
var item = new this.ItemClass({ caption: caption }); | ||
MediaValue.prototype.startsWith = function startsWith(value) { | ||
return false; | ||
}; | ||
item.mediaID = id; | ||
MediaValue.prototype.isLessThan = function isLessThan(value) { | ||
return this.length < _numberUtils2.default.parseDouble(value); | ||
}; | ||
this._items.push(item); | ||
MediaValue.prototype.isGreaterThan = function isGreaterThan(value) { | ||
return this.length > _numberUtils2.default.parseDouble(value); | ||
}; | ||
return item; | ||
} | ||
}, { | ||
MediaValue.prototype.mapItems = function mapItems(callback) { | ||
return this._items.slice().map(callback); | ||
}; | ||
MediaValue.prototype.addItem = function addItem(id, caption) { | ||
var item = new this.ItemClass({ caption: caption }); | ||
item.mediaID = id; | ||
this._items.push(item); | ||
return item; | ||
}; | ||
_createClass(MediaValue, [{ | ||
key: 'isEmpty', | ||
@@ -196,27 +140,19 @@ get: function get() { | ||
var _iteratorNormalCompletion4 = true; | ||
var _didIteratorError4 = false; | ||
var _iteratorError4 = undefined; | ||
for (var _iterator3 = this._items, _isArray3 = Array.isArray(_iterator3), _i3 = 0, _iterator3 = _isArray3 ? _iterator3 : _iterator3[Symbol.iterator]();;) { | ||
var _ref3; | ||
try { | ||
for (var _iterator4 = this._items[Symbol.iterator](), _step4; !(_iteratorNormalCompletion4 = (_step4 = _iterator4.next()).done); _iteratorNormalCompletion4 = true) { | ||
var item = _step4.value; | ||
if (_isArray3) { | ||
if (_i3 >= _iterator3.length) break; | ||
_ref3 = _iterator3[_i3++]; | ||
} else { | ||
_i3 = _iterator3.next(); | ||
if (_i3.done) break; | ||
_ref3 = _i3.value; | ||
} | ||
if (_textUtils2.default.isPresent(item.caption)) { | ||
ids.push(item.caption); | ||
} | ||
var item = _ref3; | ||
if (_textUtils2.default.isPresent(item.caption)) { | ||
ids.push(item.caption); | ||
} | ||
} catch (err) { | ||
_didIteratorError4 = true; | ||
_iteratorError4 = err; | ||
} finally { | ||
try { | ||
if (!_iteratorNormalCompletion4 && _iterator4.return) { | ||
_iterator4.return(); | ||
} | ||
} finally { | ||
if (_didIteratorError4) { | ||
throw _iteratorError4; | ||
} | ||
} | ||
} | ||
@@ -232,2 +168,26 @@ | ||
}, { | ||
key: 'columnValue', | ||
get: function get() { | ||
var ids = []; | ||
for (var _iterator4 = this._items, _isArray4 = Array.isArray(_iterator4), _i4 = 0, _iterator4 = _isArray4 ? _iterator4 : _iterator4[Symbol.iterator]();;) { | ||
var _ref4; | ||
if (_isArray4) { | ||
if (_i4 >= _iterator4.length) break; | ||
_ref4 = _iterator4[_i4++]; | ||
} else { | ||
_i4 = _iterator4.next(); | ||
if (_i4.done) break; | ||
_ref4 = _i4.value; | ||
} | ||
var item = _ref4; | ||
ids.push(item.mediaID); | ||
} | ||
return ids.join(','); | ||
} | ||
}, { | ||
key: 'multipleValues', | ||
@@ -237,25 +197,17 @@ get: function get() { | ||
var _iteratorNormalCompletion5 = true; | ||
var _didIteratorError5 = false; | ||
var _iteratorError5 = undefined; | ||
for (var _iterator5 = this._items, _isArray5 = Array.isArray(_iterator5), _i5 = 0, _iterator5 = _isArray5 ? _iterator5 : _iterator5[Symbol.iterator]();;) { | ||
var _ref5; | ||
try { | ||
for (var _iterator5 = this._items[Symbol.iterator](), _step5; !(_iteratorNormalCompletion5 = (_step5 = _iterator5.next()).done); _iteratorNormalCompletion5 = true) { | ||
var item = _step5.value; | ||
if (_isArray5) { | ||
if (_i5 >= _iterator5.length) break; | ||
_ref5 = _iterator5[_i5++]; | ||
} else { | ||
_i5 = _iterator5.next(); | ||
if (_i5.done) break; | ||
_ref5 = _i5.value; | ||
} | ||
items.push(new _multipleValueItem2.default(this.element, item.mediaID)); | ||
} | ||
} catch (err) { | ||
_didIteratorError5 = true; | ||
_iteratorError5 = err; | ||
} finally { | ||
try { | ||
if (!_iteratorNormalCompletion5 && _iterator5.return) { | ||
_iterator5.return(); | ||
} | ||
} finally { | ||
if (_didIteratorError5) { | ||
throw _iteratorError5; | ||
} | ||
} | ||
var item = _ref5; | ||
items.push(new _multipleValueItem2.default(this.element, item.mediaID)); | ||
} | ||
@@ -262,0 +214,0 @@ |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.__esModule = true; | ||
@@ -7,0 +5,0 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } |
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.__esModule = true; | ||
@@ -15,2 +13,4 @@ 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; }; }(); | ||
function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
@@ -20,3 +20,3 @@ | ||
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; } | ||
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) : _defaults(subClass, superClass); } | ||
@@ -29,3 +29,3 @@ var PhotoItemValue = function (_MediaItemValue) { | ||
return _possibleConstructorReturn(this, Object.getPrototypeOf(PhotoItemValue).apply(this, arguments)); | ||
return _possibleConstructorReturn(this, _MediaItemValue.apply(this, arguments)); | ||
} | ||
@@ -32,0 +32,0 @@ |
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.__esModule = true; | ||
@@ -19,2 +17,4 @@ 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; }; }(); | ||
function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
@@ -24,3 +24,3 @@ | ||
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; } | ||
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) : _defaults(subClass, superClass); } | ||
@@ -33,3 +33,3 @@ var PhotoValue = function (_MediaValue) { | ||
return _possibleConstructorReturn(this, Object.getPrototypeOf(PhotoValue).apply(this, arguments)); | ||
return _possibleConstructorReturn(this, _MediaValue.apply(this, arguments)); | ||
} | ||
@@ -36,0 +36,0 @@ |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.__esModule = true; | ||
@@ -18,15 +16,13 @@ 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; }; }(); | ||
RecordLinkItemValue.prototype.id = function id() { | ||
return this._recordID; | ||
}; | ||
RecordLinkItemValue.prototype.toJSON = function toJSON() { | ||
return { | ||
record_id: this._recordID | ||
}; | ||
}; | ||
_createClass(RecordLinkItemValue, [{ | ||
key: "id", | ||
value: function id() { | ||
return this._recordID; | ||
} | ||
}, { | ||
key: "toJSON", | ||
value: function toJSON() { | ||
return { | ||
record_id: this._recordID | ||
}; | ||
} | ||
}, { | ||
key: "record", | ||
@@ -33,0 +29,0 @@ get: function get() { |
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.__esModule = true; | ||
@@ -27,2 +25,4 @@ 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; }; }(); | ||
function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
@@ -32,3 +32,3 @@ | ||
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; } | ||
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) : _defaults(subClass, superClass); } | ||
@@ -41,3 +41,3 @@ var RecordLinkValue = function (_FormValue) { | ||
var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(RecordLinkValue).call(this, element, items)); | ||
var _this = _possibleConstructorReturn(this, _FormValue.call(this, element, items)); | ||
@@ -47,25 +47,17 @@ _this._items = []; | ||
if (items) { | ||
var _iteratorNormalCompletion = true; | ||
var _didIteratorError = false; | ||
var _iteratorError = undefined; | ||
for (var _iterator = items, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) { | ||
var _ref; | ||
try { | ||
for (var _iterator = items[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { | ||
var item = _step.value; | ||
if (_isArray) { | ||
if (_i >= _iterator.length) break; | ||
_ref = _iterator[_i++]; | ||
} else { | ||
_i = _iterator.next(); | ||
if (_i.done) break; | ||
_ref = _i.value; | ||
} | ||
_this._items.push(new _recordLinkItemValue2.default(item)); | ||
} | ||
} catch (err) { | ||
_didIteratorError = true; | ||
_iteratorError = err; | ||
} finally { | ||
try { | ||
if (!_iteratorNormalCompletion && _iterator.return) { | ||
_iterator.return(); | ||
} | ||
} finally { | ||
if (_didIteratorError) { | ||
throw _iteratorError; | ||
} | ||
} | ||
var item = _ref; | ||
_this._items.push(new _recordLinkItemValue2.default(item)); | ||
} | ||
@@ -76,69 +68,54 @@ } | ||
_createClass(RecordLinkValue, [{ | ||
key: 'toJSON', | ||
value: function toJSON() { | ||
var items = []; | ||
RecordLinkValue.prototype.toJSON = function toJSON() { | ||
var items = []; | ||
var _iteratorNormalCompletion2 = true; | ||
var _didIteratorError2 = false; | ||
var _iteratorError2 = undefined; | ||
for (var _iterator2 = this._items, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator]();;) { | ||
var _ref2; | ||
try { | ||
for (var _iterator2 = this._items[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) { | ||
var item = _step2.value; | ||
items.push(item.toJSON()); | ||
} | ||
} catch (err) { | ||
_didIteratorError2 = true; | ||
_iteratorError2 = err; | ||
} finally { | ||
try { | ||
if (!_iteratorNormalCompletion2 && _iterator2.return) { | ||
_iterator2.return(); | ||
} | ||
} finally { | ||
if (_didIteratorError2) { | ||
throw _iteratorError2; | ||
} | ||
} | ||
if (_isArray2) { | ||
if (_i2 >= _iterator2.length) break; | ||
_ref2 = _iterator2[_i2++]; | ||
} else { | ||
_i2 = _iterator2.next(); | ||
if (_i2.done) break; | ||
_ref2 = _i2.value; | ||
} | ||
return items; | ||
var item = _ref2; | ||
items.push(item.toJSON()); | ||
} | ||
}, { | ||
key: 'isEqual', | ||
value: function isEqual(value) { | ||
return false; | ||
} | ||
}, { | ||
key: 'contains', | ||
value: function contains(value) { | ||
return false; | ||
} | ||
}, { | ||
key: 'startsWith', | ||
value: function startsWith(value) { | ||
return false; | ||
} | ||
}, { | ||
key: 'isLessThan', | ||
value: function isLessThan(value) { | ||
return this.length < _numberUtils2.default.parseDouble(value); | ||
} | ||
}, { | ||
key: 'isGreaterThan', | ||
value: function isGreaterThan(value) { | ||
return this.length > _numberUtils2.default.parseDouble(value); | ||
} | ||
}, { | ||
key: 'addRecord', | ||
value: function addRecord(record) { | ||
var item = new _recordLinkItemValue2.default({ record_id: record.id }); | ||
item._record = record; | ||
return items; | ||
}; | ||
this._items.push(item); | ||
} | ||
}, { | ||
RecordLinkValue.prototype.isEqual = function isEqual(value) { | ||
return false; | ||
}; | ||
RecordLinkValue.prototype.contains = function contains(value) { | ||
return false; | ||
}; | ||
RecordLinkValue.prototype.startsWith = function startsWith(value) { | ||
return false; | ||
}; | ||
RecordLinkValue.prototype.isLessThan = function isLessThan(value) { | ||
return this.length < _numberUtils2.default.parseDouble(value); | ||
}; | ||
RecordLinkValue.prototype.isGreaterThan = function isGreaterThan(value) { | ||
return this.length > _numberUtils2.default.parseDouble(value); | ||
}; | ||
RecordLinkValue.prototype.addRecord = function addRecord(record) { | ||
var item = new _recordLinkItemValue2.default({ record_id: record.id }); | ||
item._record = record; | ||
this._items.push(item); | ||
}; | ||
_createClass(RecordLinkValue, [{ | ||
key: 'isEmpty', | ||
@@ -181,25 +158,17 @@ get: function get() { | ||
var _iteratorNormalCompletion3 = true; | ||
var _didIteratorError3 = false; | ||
var _iteratorError3 = undefined; | ||
for (var _iterator3 = this._items, _isArray3 = Array.isArray(_iterator3), _i3 = 0, _iterator3 = _isArray3 ? _iterator3 : _iterator3[Symbol.iterator]();;) { | ||
var _ref3; | ||
try { | ||
for (var _iterator3 = this._items[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) { | ||
var item = _step3.value; | ||
if (_isArray3) { | ||
if (_i3 >= _iterator3.length) break; | ||
_ref3 = _iterator3[_i3++]; | ||
} else { | ||
_i3 = _iterator3.next(); | ||
if (_i3.done) break; | ||
_ref3 = _i3.value; | ||
} | ||
ids.push(new _multipleValueItem2.default(this.element, item.recordID)); | ||
} | ||
} catch (err) { | ||
_didIteratorError3 = true; | ||
_iteratorError3 = err; | ||
} finally { | ||
try { | ||
if (!_iteratorNormalCompletion3 && _iterator3.return) { | ||
_iterator3.return(); | ||
} | ||
} finally { | ||
if (_didIteratorError3) { | ||
throw _iteratorError3; | ||
} | ||
} | ||
var item = _ref3; | ||
ids.push(new _multipleValueItem2.default(this.element, item.recordID)); | ||
} | ||
@@ -206,0 +175,0 @@ |
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.__esModule = true; | ||
@@ -27,2 +25,4 @@ 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; }; }(); | ||
function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
@@ -32,3 +32,3 @@ | ||
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; } | ||
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) : _defaults(subClass, superClass); } | ||
@@ -41,3 +41,3 @@ var RepeatableItemValue = function (_Feature) { | ||
var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(RepeatableItemValue).call(this)); | ||
var _this = _possibleConstructorReturn(this, _Feature.call(this)); | ||
@@ -61,39 +61,36 @@ _this.index = index; | ||
_createClass(RepeatableItemValue, [{ | ||
key: 'toJSON', | ||
value: function toJSON() { | ||
var json = {}; | ||
RepeatableItemValue.prototype.toJSON = function toJSON() { | ||
var json = {}; | ||
json.id = this.identifier; | ||
json.created_at = _dateUtils2.default.formatTimestamp(this.createdAt); | ||
json.updated_at = _dateUtils2.default.formatTimestamp(this.updatedAt); | ||
json.form_values = this.formValues.toJSON(); | ||
json.geometry = this.geometryAsGeoJSON(); | ||
json.id = this.identifier; | ||
json.created_at = _dateUtils2.default.formatTimestamp(this.createdAt); | ||
json.updated_at = _dateUtils2.default.formatTimestamp(this.updatedAt); | ||
json.form_values = this.formValues.toJSON(); | ||
json.geometry = this.geometryAsGeoJSON(); | ||
return json; | ||
return json; | ||
}; | ||
RepeatableItemValue.prototype.updateTimestamps = function updateTimestamps() { | ||
var now = new Date(); | ||
if (!this._createdAt) { | ||
this._createdAt = now; | ||
} | ||
}, { | ||
key: 'updateTimestamps', | ||
value: function updateTimestamps() { | ||
var now = new Date(); | ||
if (!this._createdAt) { | ||
this._createdAt = now; | ||
} | ||
this._updatedAt = now; | ||
}; | ||
this._updatedAt = now; | ||
RepeatableItemValue.prototype.geometryAsGeoJSON = function geometryAsGeoJSON() { | ||
if (!this.hasCoordinate) { | ||
return null; | ||
} | ||
}, { | ||
key: 'geometryAsGeoJSON', | ||
value: function geometryAsGeoJSON() { | ||
if (!this.hasCoordinate) { | ||
return null; | ||
} | ||
return { | ||
type: 'Point', | ||
coordinates: [this._longitude, this._latitude] | ||
}; | ||
} | ||
}, { | ||
return { | ||
type: 'Point', | ||
coordinates: [this._longitude, this._latitude] | ||
}; | ||
}; | ||
_createClass(RepeatableItemValue, [{ | ||
key: 'element', | ||
@@ -153,33 +150,25 @@ get: function get() { | ||
var _iteratorNormalCompletion = true; | ||
var _didIteratorError = false; | ||
var _iteratorError = undefined; | ||
for (var _iterator = titleFieldKeys, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) { | ||
var _ref; | ||
try { | ||
for (var _iterator = titleFieldKeys[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { | ||
var fieldKey = _step.value; | ||
if (_isArray) { | ||
if (_i >= _iterator.length) break; | ||
_ref = _iterator[_i++]; | ||
} else { | ||
_i = _iterator.next(); | ||
if (_i.done) break; | ||
_ref = _i.value; | ||
} | ||
var formValue = this.formValues.get(fieldKey); | ||
var fieldKey = _ref; | ||
if (formValue) { | ||
var displayValue = formValue.displayValue; | ||
var formValue = this.formValues.get(fieldKey); | ||
if (_textUtils2.default.isPresent(displayValue)) { | ||
titles.push(displayValue); | ||
} | ||
if (formValue) { | ||
var displayValue = formValue.displayValue; | ||
if (_textUtils2.default.isPresent(displayValue)) { | ||
titles.push(displayValue); | ||
} | ||
} | ||
} catch (err) { | ||
_didIteratorError = true; | ||
_iteratorError = err; | ||
} finally { | ||
try { | ||
if (!_iteratorNormalCompletion && _iterator.return) { | ||
_iterator.return(); | ||
} | ||
} finally { | ||
if (_didIteratorError) { | ||
throw _iteratorError; | ||
} | ||
} | ||
} | ||
@@ -186,0 +175,0 @@ |
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.__esModule = true; | ||
@@ -27,2 +25,4 @@ 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; }; }(); | ||
function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
@@ -32,3 +32,3 @@ | ||
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; } | ||
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) : _defaults(subClass, superClass); } | ||
@@ -43,3 +43,3 @@ var SearchSeparator = ' '; | ||
var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(RepeatableValue).call(this, element, items)); | ||
var _this = _possibleConstructorReturn(this, _FormValue.call(this, element, items)); | ||
@@ -49,25 +49,17 @@ _this._items = []; | ||
if (items != null) { | ||
var _iteratorNormalCompletion = true; | ||
var _didIteratorError = false; | ||
var _iteratorError = undefined; | ||
for (var _iterator = items, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) { | ||
var _ref; | ||
try { | ||
for (var _iterator = items[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { | ||
var item = _step.value; | ||
if (_isArray) { | ||
if (_i >= _iterator.length) break; | ||
_ref = _iterator[_i++]; | ||
} else { | ||
_i = _iterator.next(); | ||
if (_i.done) break; | ||
_ref = _i.value; | ||
} | ||
_this._items.push(new _repeatableItemValue2.default(_this.element, item, _this._items.length)); | ||
} | ||
} catch (err) { | ||
_didIteratorError = true; | ||
_iteratorError = err; | ||
} finally { | ||
try { | ||
if (!_iteratorNormalCompletion && _iterator.return) { | ||
_iterator.return(); | ||
} | ||
} finally { | ||
if (_didIteratorError) { | ||
throw _iteratorError; | ||
} | ||
} | ||
var item = _ref; | ||
_this._items.push(new _repeatableItemValue2.default(_this.element, item, _this._items.length)); | ||
} | ||
@@ -78,88 +70,71 @@ } | ||
_createClass(RepeatableValue, [{ | ||
key: 'toJSON', | ||
value: function toJSON() { | ||
if (this.isEmpty) { | ||
return null; | ||
} | ||
RepeatableValue.prototype.toJSON = function toJSON() { | ||
if (this.isEmpty) { | ||
return null; | ||
} | ||
var items = []; | ||
var items = []; | ||
var _iteratorNormalCompletion2 = true; | ||
var _didIteratorError2 = false; | ||
var _iteratorError2 = undefined; | ||
for (var _iterator2 = this._items, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator]();;) { | ||
var _ref2; | ||
try { | ||
for (var _iterator2 = this._items[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) { | ||
var item = _step2.value; | ||
items.push(item.toJSON()); | ||
} | ||
} catch (err) { | ||
_didIteratorError2 = true; | ||
_iteratorError2 = err; | ||
} finally { | ||
try { | ||
if (!_iteratorNormalCompletion2 && _iterator2.return) { | ||
_iterator2.return(); | ||
} | ||
} finally { | ||
if (_didIteratorError2) { | ||
throw _iteratorError2; | ||
} | ||
} | ||
if (_isArray2) { | ||
if (_i2 >= _iterator2.length) break; | ||
_ref2 = _iterator2[_i2++]; | ||
} else { | ||
_i2 = _iterator2.next(); | ||
if (_i2.done) break; | ||
_ref2 = _i2.value; | ||
} | ||
return items; | ||
var item = _ref2; | ||
items.push(item.toJSON()); | ||
} | ||
}, { | ||
key: 'isEqual', | ||
value: function isEqual(value) { | ||
return false; | ||
} | ||
}, { | ||
key: 'contains', | ||
value: function contains(value) { | ||
return false; | ||
} | ||
}, { | ||
key: 'startsWith', | ||
value: function startsWith(value) { | ||
return false; | ||
} | ||
}, { | ||
key: 'isLessThan', | ||
value: function isLessThan(value) { | ||
return false; | ||
} | ||
}, { | ||
key: 'isGreaterThan', | ||
value: function isGreaterThan(value) { | ||
return false; | ||
} | ||
}, { | ||
key: 'mapItems', | ||
value: function mapItems(callback) { | ||
return this._items.slice().map(callback); | ||
} | ||
}, { | ||
key: 'forEachItem', | ||
value: function forEachItem(callback) { | ||
this.mapItems(callback); | ||
} | ||
}, { | ||
key: 'createNewItem', | ||
value: function createNewItem() { | ||
var attributes = { | ||
id: _uuid2.default.v4(), | ||
form_values: {} | ||
}; | ||
var item = new _repeatableItemValue2.default(this.element, attributes, this._items.length); | ||
return items; | ||
}; | ||
this._items.push(item); | ||
RepeatableValue.prototype.isEqual = function isEqual(value) { | ||
return false; | ||
}; | ||
return item; | ||
} | ||
}, { | ||
RepeatableValue.prototype.contains = function contains(value) { | ||
return false; | ||
}; | ||
RepeatableValue.prototype.startsWith = function startsWith(value) { | ||
return false; | ||
}; | ||
RepeatableValue.prototype.isLessThan = function isLessThan(value) { | ||
return false; | ||
}; | ||
RepeatableValue.prototype.isGreaterThan = function isGreaterThan(value) { | ||
return false; | ||
}; | ||
RepeatableValue.prototype.mapItems = function mapItems(callback) { | ||
return this._items.slice().map(callback); | ||
}; | ||
RepeatableValue.prototype.forEachItem = function forEachItem(callback) { | ||
this.mapItems(callback); | ||
}; | ||
RepeatableValue.prototype.createNewItem = function createNewItem() { | ||
var attributes = { | ||
id: _uuid2.default.v4(), | ||
form_values: {} | ||
}; | ||
var item = new _repeatableItemValue2.default(this.element, attributes, this._items.length); | ||
this._items.push(item); | ||
return item; | ||
}; | ||
_createClass(RepeatableValue, [{ | ||
key: 'isEmpty', | ||
@@ -187,29 +162,21 @@ get: function get() { | ||
var _iteratorNormalCompletion3 = true; | ||
var _didIteratorError3 = false; | ||
var _iteratorError3 = undefined; | ||
for (var _iterator3 = this._items, _isArray3 = Array.isArray(_iterator3), _i3 = 0, _iterator3 = _isArray3 ? _iterator3 : _iterator3[Symbol.iterator]();;) { | ||
var _ref3; | ||
try { | ||
for (var _iterator3 = this._items[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) { | ||
var item = _step3.value; | ||
if (_isArray3) { | ||
if (_i3 >= _iterator3.length) break; | ||
_ref3 = _iterator3[_i3++]; | ||
} else { | ||
_i3 = _iterator3.next(); | ||
if (_i3.done) break; | ||
_ref3 = _i3.value; | ||
} | ||
var searchValue = item.searchableValue; | ||
var item = _ref3; | ||
if (_textUtils2.default.isPresent(searchValue)) { | ||
values.push(searchValue); | ||
} | ||
var searchValue = item.searchableValue; | ||
if (_textUtils2.default.isPresent(searchValue)) { | ||
values.push(searchValue); | ||
} | ||
} catch (err) { | ||
_didIteratorError3 = true; | ||
_iteratorError3 = err; | ||
} finally { | ||
try { | ||
if (!_iteratorNormalCompletion3 && _iterator3.return) { | ||
_iterator3.return(); | ||
} | ||
} finally { | ||
if (_didIteratorError3) { | ||
throw _iteratorError3; | ||
} | ||
} | ||
} | ||
@@ -216,0 +183,0 @@ |
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.__esModule = true; | ||
@@ -15,2 +13,4 @@ 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; }; }(); | ||
function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
@@ -20,3 +20,3 @@ | ||
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; } | ||
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) : _defaults(subClass, superClass); } | ||
@@ -29,3 +29,3 @@ var SignatureValue = function (_FormValue) { | ||
var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(SignatureValue).call(this, element, attributes)); | ||
var _this = _possibleConstructorReturn(this, _FormValue.call(this, element, attributes)); | ||
@@ -39,36 +39,30 @@ if (attributes) { | ||
SignatureValue.prototype.toJSON = function toJSON() { | ||
return { | ||
signature_id: this._identifier, | ||
timestamp: this._timestamp | ||
}; | ||
}; | ||
SignatureValue.prototype.isEqual = function isEqual(value) { | ||
return false; | ||
}; | ||
SignatureValue.prototype.contains = function contains(value) { | ||
return false; | ||
}; | ||
SignatureValue.prototype.startsWith = function startsWith(value) { | ||
return false; | ||
}; | ||
SignatureValue.prototype.isLessThan = function isLessThan(value) { | ||
return false; | ||
}; | ||
SignatureValue.prototype.isGreaterThan = function isGreaterThan(value) { | ||
return false; | ||
}; | ||
_createClass(SignatureValue, [{ | ||
key: 'toJSON', | ||
value: function toJSON() { | ||
return { | ||
signature_id: this._identifier, | ||
timestamp: this._timestamp | ||
}; | ||
} | ||
}, { | ||
key: 'isEqual', | ||
value: function isEqual(value) { | ||
return false; | ||
} | ||
}, { | ||
key: 'contains', | ||
value: function contains(value) { | ||
return false; | ||
} | ||
}, { | ||
key: 'startsWith', | ||
value: function startsWith(value) { | ||
return false; | ||
} | ||
}, { | ||
key: 'isLessThan', | ||
value: function isLessThan(value) { | ||
return false; | ||
} | ||
}, { | ||
key: 'isGreaterThan', | ||
value: function isGreaterThan(value) { | ||
return false; | ||
} | ||
}, { | ||
key: 'isEmpty', | ||
@@ -75,0 +69,0 @@ get: function get() { |
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.__esModule = 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 _formValue = require('./form-value'); | ||
@@ -13,2 +13,4 @@ | ||
function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
@@ -18,3 +20,3 @@ | ||
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; } | ||
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) : _defaults(subClass, superClass); } | ||
@@ -27,5 +29,12 @@ var StatusValue = function (_TextualValue) { | ||
return _possibleConstructorReturn(this, Object.getPrototypeOf(StatusValue).apply(this, arguments)); | ||
return _possibleConstructorReturn(this, _TextualValue.apply(this, arguments)); | ||
} | ||
_createClass(StatusValue, [{ | ||
key: 'displayValue', | ||
get: function get() { | ||
return this.textValue || ''; | ||
} | ||
}]); | ||
return StatusValue; | ||
@@ -32,0 +41,0 @@ }(_formValue2.default); |
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.__esModule = 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 _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } }; | ||
var _textualValue = require('./textual-value'); | ||
@@ -17,2 +13,4 @@ | ||
function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
@@ -22,3 +20,3 @@ | ||
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; } | ||
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) : _defaults(subClass, superClass); } | ||
@@ -31,3 +29,3 @@ var TextValue = function (_TextualValue) { | ||
return _possibleConstructorReturn(this, Object.getPrototypeOf(TextValue).apply(this, arguments)); | ||
return _possibleConstructorReturn(this, _TextualValue.apply(this, arguments)); | ||
} | ||
@@ -41,3 +39,5 @@ | ||
} | ||
return _get(Object.getPrototypeOf(TextValue.prototype), 'columnValue', this); | ||
// this does NOT work in loose mode | ||
// return super.columnValue; | ||
return this.textValue || null; | ||
} | ||
@@ -44,0 +44,0 @@ }]); |
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.__esModule = true; | ||
@@ -23,2 +21,4 @@ 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; }; }(); | ||
function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
@@ -28,3 +28,3 @@ | ||
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; } | ||
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) : _defaults(subClass, superClass); } | ||
@@ -37,3 +37,3 @@ var TextualValue = function (_FormValue) { | ||
var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(TextualValue).call(this, element, textValue)); | ||
var _this = _possibleConstructorReturn(this, _FormValue.call(this, element, textValue)); | ||
@@ -44,83 +44,77 @@ _this.textValue = textValue; | ||
_createClass(TextualValue, [{ | ||
key: 'toJSON', | ||
value: function toJSON() { | ||
if (this.isEmpty) { | ||
return null; | ||
} | ||
TextualValue.prototype.toJSON = function toJSON() { | ||
if (this.isEmpty) { | ||
return null; | ||
} | ||
return this.textValue; | ||
return this.textValue; | ||
}; | ||
TextualValue.prototype.isEqual = function isEqual(stringValue) { | ||
if (this.isEmpty) { | ||
return _textUtils2.default.isEmpty(stringValue); | ||
} | ||
}, { | ||
key: 'isEqual', | ||
value: function isEqual(stringValue) { | ||
if (this.isEmpty) { | ||
return _textUtils2.default.isEmpty(stringValue); | ||
} | ||
stringValue = stringValue == null ? '' : stringValue.toString(); | ||
stringValue = stringValue == null ? '' : stringValue.toString(); | ||
return this.textValue.toLowerCase() === stringValue.toLowerCase(); | ||
return this.textValue.toLowerCase() === stringValue.toLowerCase(); | ||
}; | ||
TextualValue.prototype.contains = function contains(stringValue) { | ||
if (this.isEmpty) { | ||
return _textUtils2.default.isEmpty(stringValue); | ||
} | ||
}, { | ||
key: 'contains', | ||
value: function contains(stringValue) { | ||
if (this.isEmpty) { | ||
return _textUtils2.default.isEmpty(stringValue); | ||
} | ||
if (stringValue == null) { | ||
return false; | ||
} | ||
if (stringValue == null) { | ||
return false; | ||
} | ||
stringValue = stringValue.toString(); | ||
stringValue = stringValue.toString(); | ||
return _textUtils2.default.contains(this.textValue, stringValue); | ||
return _textUtils2.default.contains(this.textValue, stringValue); | ||
}; | ||
TextualValue.prototype.startsWith = function startsWith(stringValue) { | ||
if (this.isEmpty) { | ||
return _textUtils2.default.isEmpty(stringValue); | ||
} | ||
}, { | ||
key: 'startsWith', | ||
value: function startsWith(stringValue) { | ||
if (this.isEmpty) { | ||
return _textUtils2.default.isEmpty(stringValue); | ||
} | ||
if (stringValue == null) { | ||
return false; | ||
} | ||
if (stringValue == null) { | ||
return false; | ||
} | ||
stringValue = stringValue.toString(); | ||
stringValue = stringValue.toString(); | ||
return _textUtils2.default.startsWith(this.textValue, stringValue); | ||
return _textUtils2.default.startsWith(this.textValue, stringValue); | ||
}; | ||
TextualValue.prototype.isLessThan = function isLessThan(stringValue) { | ||
if (this.textValue == null || stringValue == null) { | ||
return false; | ||
} | ||
}, { | ||
key: 'isLessThan', | ||
value: function isLessThan(stringValue) { | ||
if (this.textValue == null || stringValue == null) { | ||
return false; | ||
} | ||
if (stringValue != null) { | ||
stringValue = stringValue.toString(); | ||
} | ||
if (stringValue != null) { | ||
stringValue = stringValue.toString(); | ||
} | ||
var thisValue = _numberUtils2.default.parseDouble(this.textValue); | ||
var thatValue = _numberUtils2.default.parseDouble(stringValue); | ||
var thisValue = _numberUtils2.default.parseDouble(this.textValue); | ||
var thatValue = _numberUtils2.default.parseDouble(stringValue); | ||
return thisValue < thatValue; | ||
return thisValue < thatValue; | ||
}; | ||
TextualValue.prototype.isGreaterThan = function isGreaterThan(stringValue) { | ||
if (this.textValue == null || stringValue == null) { | ||
return false; | ||
} | ||
}, { | ||
key: 'isGreaterThan', | ||
value: function isGreaterThan(stringValue) { | ||
if (this.textValue == null || stringValue == null) { | ||
return false; | ||
} | ||
stringValue = stringValue == null ? '' : stringValue.toString(); | ||
stringValue = stringValue == null ? '' : stringValue.toString(); | ||
var thisValue = _numberUtils2.default.parseDouble(this.textValue); | ||
var thatValue = _numberUtils2.default.parseDouble(stringValue); | ||
var thisValue = _numberUtils2.default.parseDouble(this.textValue); | ||
var thatValue = _numberUtils2.default.parseDouble(stringValue); | ||
return thisValue > thatValue; | ||
} | ||
}, { | ||
return thisValue > thatValue; | ||
}; | ||
_createClass(TextualValue, [{ | ||
key: 'isEmpty', | ||
@@ -127,0 +121,0 @@ get: function get() { |
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.__esModule = true; | ||
@@ -23,2 +21,4 @@ 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; }; }(); | ||
function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
@@ -28,3 +28,3 @@ | ||
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; } | ||
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) : _defaults(subClass, superClass); } | ||
@@ -37,43 +37,40 @@ var TimeValue = function (_TextualValue) { | ||
return _possibleConstructorReturn(this, Object.getPrototypeOf(TimeValue).apply(this, arguments)); | ||
return _possibleConstructorReturn(this, _TextualValue.apply(this, arguments)); | ||
} | ||
_createClass(TimeValue, [{ | ||
key: 'isLessThan', | ||
value: function isLessThan(stringValue) { | ||
if (this.isEmpty) { | ||
return _textUtils2.default.isEmpty(stringValue); | ||
} | ||
TimeValue.prototype.isLessThan = function isLessThan(stringValue) { | ||
if (this.isEmpty) { | ||
return _textUtils2.default.isEmpty(stringValue); | ||
} | ||
var thisTime = this.timeValue(); | ||
var thatTime = _dateUtils2.default.parseTime(stringValue); | ||
var thisTime = this.timeValue(); | ||
var thatTime = _dateUtils2.default.parseTime(stringValue); | ||
if (thisTime == null || thatTime == null) { | ||
return false; | ||
} | ||
if (thisTime == null || thatTime == null) { | ||
return false; | ||
} | ||
return thisTime.getTime() < thatTime.getTime(); | ||
return thisTime.getTime() < thatTime.getTime(); | ||
}; | ||
TimeValue.prototype.isGreaterThan = function isGreaterThan(stringValue) { | ||
if (this.isEmpty) { | ||
return _textUtils2.default.isEmpty(stringValue); | ||
} | ||
}, { | ||
key: 'isGreaterThan', | ||
value: function isGreaterThan(stringValue) { | ||
if (this.isEmpty) { | ||
return _textUtils2.default.isEmpty(stringValue); | ||
} | ||
var thisTime = this.timeValue(); | ||
var thatTime = _dateUtils2.default.parseTime(stringValue); | ||
var thisTime = this.timeValue(); | ||
var thatTime = _dateUtils2.default.parseTime(stringValue); | ||
if (thisTime == null || thatTime == null) { | ||
return false; | ||
} | ||
if (thisTime == null || thatTime == null) { | ||
return false; | ||
} | ||
return thisTime.getTime() > thatTime.getTime(); | ||
} | ||
}, { | ||
key: 'timeValue', | ||
value: function timeValue() { | ||
return _dateUtils2.default.parseTime(this.textValue); | ||
} | ||
}, { | ||
return thisTime.getTime() > thatTime.getTime(); | ||
}; | ||
TimeValue.prototype.timeValue = function timeValue() { | ||
return _dateUtils2.default.parseTime(this.textValue); | ||
}; | ||
_createClass(TimeValue, [{ | ||
key: 'displayValue', | ||
@@ -80,0 +77,0 @@ get: function get() { |
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.__esModule = true; | ||
@@ -15,2 +13,4 @@ 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; }; }(); | ||
function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
@@ -20,3 +20,3 @@ | ||
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; } | ||
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) : _defaults(subClass, superClass); } | ||
@@ -29,3 +29,3 @@ var VideoItemValue = function (_MediaItemValue) { | ||
return _possibleConstructorReturn(this, Object.getPrototypeOf(VideoItemValue).apply(this, arguments)); | ||
return _possibleConstructorReturn(this, _MediaItemValue.apply(this, arguments)); | ||
} | ||
@@ -32,0 +32,0 @@ |
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.__esModule = true; | ||
@@ -19,2 +17,4 @@ 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; }; }(); | ||
function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
@@ -24,3 +24,3 @@ | ||
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; } | ||
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) : _defaults(subClass, superClass); } | ||
@@ -33,3 +33,3 @@ var VideoValue = function (_MediaValue) { | ||
return _possibleConstructorReturn(this, Object.getPrototypeOf(VideoValue).apply(this, arguments)); | ||
return _possibleConstructorReturn(this, _MediaValue.apply(this, arguments)); | ||
} | ||
@@ -36,0 +36,0 @@ |
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.__esModule = true; | ||
@@ -15,2 +13,4 @@ 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; }; }(); | ||
function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
@@ -20,3 +20,3 @@ | ||
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; } | ||
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) : _defaults(subClass, superClass); } | ||
@@ -29,3 +29,3 @@ var YesNoValue = function (_TextualValue) { | ||
return _possibleConstructorReturn(this, Object.getPrototypeOf(YesNoValue).apply(this, arguments)); | ||
return _possibleConstructorReturn(this, _TextualValue.apply(this, arguments)); | ||
} | ||
@@ -32,0 +32,0 @@ |
{ | ||
"name": "fulcrum-core", | ||
"version": "0.0.12", | ||
"version": "0.0.13", | ||
"description": "Fulcrum Core", | ||
@@ -26,3 +26,5 @@ "homepage": "http://github.com/fulcrumapp/fulcrum-core", | ||
"babel-eslint": "^5.0.0", | ||
"babel-preset-es2015": "^6.5.0", | ||
"babel-plugin-transform-proto-to-assign": "^6.6.4", | ||
"babel-preset-es2015": "^6.6.0", | ||
"babel-preset-es2015-loose": "^7.0.0", | ||
"babel-preset-es2015-node5": "^1.1.2", | ||
@@ -38,3 +40,3 @@ "babel-preset-stage-3": "^6.5.0", | ||
"async": "^1.5.2", | ||
"lodash": "^3.10.1", | ||
"lodash": "^4.6.1", | ||
"mixmatch": "0.0.2", | ||
@@ -41,0 +43,0 @@ "uuid": "^2.0.1" |
@@ -127,2 +127,10 @@ /* | ||
} | ||
getUsers(params, callback) { | ||
this.invoke(this.root, 'getUsers', [params], callback); | ||
} | ||
getProjects(params, callback) { | ||
this.invoke(this.root, 'getProjects', [params], callback); | ||
} | ||
} |
@@ -48,2 +48,5 @@ import Form from './form'; | ||
import DefaultValues from './values/default-values'; | ||
import CustomValidationError from './validation/custom-validation-error'; | ||
import User from './user'; | ||
import Project from './project'; | ||
@@ -97,1 +100,4 @@ export {Form}; | ||
export {DefaultValues}; | ||
export {CustomValidationError}; | ||
export {User}; | ||
export {Project}; |
@@ -69,2 +69,4 @@ import Feature from './feature'; | ||
json.longitude = this._longitude; | ||
json.project_id = this._projectID; | ||
json.assigned_to_id = this._assignedToID; | ||
@@ -106,3 +108,3 @@ return json; | ||
get statusValue() { | ||
return new StatusValue(this.status, this.form.statusField); | ||
return new StatusValue(this.form.statusField, this.status); | ||
} | ||
@@ -142,2 +144,26 @@ | ||
} | ||
get projectID() { | ||
return this._projectID; | ||
} | ||
set projectID(id) { | ||
this._projectID = id; | ||
} | ||
get assignedToID() { | ||
return this._assignedToID; | ||
} | ||
set assignedToID(id) { | ||
this._assignedToID = id; | ||
} | ||
get status() { | ||
return this._status; | ||
} | ||
set status(status) { | ||
this._status = status; | ||
} | ||
} |
@@ -34,2 +34,10 @@ import fs from 'fs'; | ||
} | ||
getUsers(params, callback) { | ||
return callback(null, []); | ||
} | ||
getProjects(params, callback) { | ||
return callback(null, []); | ||
} | ||
} |
export default class MemoryDataSource { | ||
constructor(name) { | ||
this.cache = {}; | ||
this.projects = null; | ||
this.users = null; | ||
} | ||
@@ -22,2 +24,10 @@ | ||
getUsers(params, callback) { | ||
return callback(null, this.users); | ||
} | ||
getProjects(params, callback) { | ||
return callback(null, this.projects); | ||
} | ||
getChoiceListComplete(id, object, callback) { | ||
@@ -42,2 +52,12 @@ this.cache[id] = object; | ||
} | ||
getUsersComplete(params, object, callback) { | ||
this.users = object; | ||
callback(); | ||
} | ||
getProjectsComplete(params, object, callback) { | ||
this.projects = object; | ||
callback(); | ||
} | ||
} |
@@ -0,1 +1,3 @@ | ||
import Form from '../form'; | ||
export default class ElementValidationError { | ||
@@ -12,3 +14,5 @@ constructor(element) { | ||
while (iterator) { | ||
parents.push(iterator.label); | ||
if (!(iterator instanceof Form)) { | ||
parents.push(iterator.label); | ||
} | ||
@@ -15,0 +19,0 @@ iterator = iterator.parent; |
@@ -215,4 +215,4 @@ import RepeatableItemValue from '../values/repeatable-item-value'; | ||
messages.join('\n\n'); | ||
return messages.join('\n\n'); | ||
} | ||
} |
@@ -98,4 +98,4 @@ import FormValueFactory from './form-value-factory'; | ||
for (let key of Object.keys(this._values)) { | ||
const formValue = this._values[key]; | ||
for (let key of Object.keys(formValues._values)) { | ||
const formValue = formValues._values[key]; | ||
@@ -102,0 +102,0 @@ this.set(key, formValue); |
@@ -43,3 +43,3 @@ import FormValue from './form-value'; | ||
columnValue() { | ||
get columnValue() { | ||
const ids = []; | ||
@@ -46,0 +46,0 @@ |
import TextualValue from './form-value'; | ||
export default class StatusValue extends TextualValue { | ||
get displayValue() { | ||
return this.textValue || ''; | ||
} | ||
} |
@@ -8,4 +8,6 @@ import TextualValue from './textual-value'; | ||
} | ||
return super.columnValue; | ||
// this does NOT work in loose mode | ||
// return super.columnValue; | ||
return this.textValue || null; | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
291
693998
13
10984
+ Addedlodash@4.17.21(transitive)
- Removedlodash@3.10.1(transitive)
Updatedlodash@^4.6.1