1 | exports["framework"] =
|
2 | (function(modules) {
|
3 |
|
4 | var installedModules = {};
|
5 |
|
6 |
|
7 | function __webpack_require__(moduleId) {
|
8 |
|
9 |
|
10 | if(installedModules[moduleId]) {
|
11 | return installedModules[moduleId].exports;
|
12 | }
|
13 |
|
14 | var module = installedModules[moduleId] = {
|
15 | i: moduleId,
|
16 | l: false,
|
17 | exports: {}
|
18 | };
|
19 |
|
20 |
|
21 | modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
22 |
|
23 |
|
24 | module.l = true;
|
25 |
|
26 |
|
27 | return module.exports;
|
28 | }
|
29 |
|
30 |
|
31 |
|
32 | __webpack_require__.m = modules;
|
33 |
|
34 |
|
35 | __webpack_require__.c = installedModules;
|
36 |
|
37 |
|
38 | __webpack_require__.i = function(value) { return value; };
|
39 |
|
40 |
|
41 | __webpack_require__.d = function(exports, name, getter) {
|
42 | if(!__webpack_require__.o(exports, name)) {
|
43 | Object.defineProperty(exports, name, {
|
44 | configurable: false,
|
45 | enumerable: true,
|
46 | get: getter
|
47 | /******/ });
|
48 | /******/ }
|
49 | /******/ };
|
50 | /******/
|
51 | /******/ // getDefaultExport function for compatibility with non-harmony modules
|
52 | /******/ __webpack_require__.n = function(module) {
|
53 | var getter = module && module.__esModule ?
|
54 | function getDefault() { return module['default']; } :
|
55 | function getModuleExports() { return module; };
|
56 | __webpack_require__.d(getter, 'a', getter);
|
57 | return getter;
|
58 | };
|
59 |
|
60 |
|
61 | __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
|
62 |
|
63 |
|
64 | __webpack_require__.p = "";
|
65 |
|
66 |
|
67 | return __webpack_require__(__webpack_require__.s = 16);
|
68 | })
|
69 |
|
70 | ([
|
71 |
|
72 | (function(module, exports, __webpack_require__) {
|
73 |
|
74 | "use strict";
|
75 |
|
76 |
|
77 | Object.defineProperty(exports, "__esModule", {
|
78 | value: true
|
79 | });
|
80 |
|
81 | 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; }; }();
|
82 |
|
83 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
84 |
|
85 | var Validator = function () {
|
86 | function Validator() {
|
87 | _classCallCheck(this, Validator);
|
88 | }
|
89 |
|
90 | _createClass(Validator, [{
|
91 | key: "apply",
|
92 | value: function apply(value) {}
|
93 | }, {
|
94 | key: "configure",
|
95 | value: function configure(option) {}
|
96 | }]);
|
97 |
|
98 | return Validator;
|
99 | }();
|
100 |
|
101 | exports.default = Validator;
|
102 | module.exports = exports["default"];
|
103 |
|
104 | }),
|
105 |
|
106 | (function(module, exports) {
|
107 |
|
108 | module.exports = require("moment");
|
109 |
|
110 | }),
|
111 |
|
112 | (function(module, exports, __webpack_require__) {
|
113 |
|
114 | "use strict";
|
115 |
|
116 |
|
117 | Object.defineProperty(exports, "__esModule", {
|
118 | value: true
|
119 | });
|
120 | exports.default = {
|
121 | HttpMethod: {
|
122 | POST: 'POST',
|
123 | GET: 'DELETE',
|
124 | PUT: 'PUT',
|
125 | DELETE: 'DELETE'
|
126 | },
|
127 | Protocol: {
|
128 | HTTP: 'HTTP'
|
129 | }
|
130 | };
|
131 | module.exports = exports['default'];
|
132 |
|
133 | }),
|
134 |
|
135 | (function(module, exports) {
|
136 |
|
137 | var g;
|
138 |
|
139 |
|
140 | g = (function() {
|
141 | return this;
|
142 | })();
|
143 |
|
144 | try {
|
145 |
|
146 | g = g || Function("return this")() || (1,eval)("this");
|
147 | } catch(e) {
|
148 |
|
149 | if(typeof window === "object")
|
150 | g = window;
|
151 | }
|
152 |
|
153 |
|
154 |
|
155 |
|
156 |
|
157 | module.exports = g;
|
158 |
|
159 |
|
160 | }),
|
161 |
|
162 | (function(module, exports, __webpack_require__) {
|
163 |
|
164 | "use strict";
|
165 |
|
166 |
|
167 | Object.defineProperty(exports, "__esModule", {
|
168 | value: true
|
169 | });
|
170 |
|
171 | 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; }; }();
|
172 |
|
173 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
174 |
|
175 | var DataFetch = function () {
|
176 | function DataFetch() {
|
177 | _classCallCheck(this, DataFetch);
|
178 | }
|
179 |
|
180 | _createClass(DataFetch, [{
|
181 | key: "fetch",
|
182 | value: function fetch(store, context, callback) {}
|
183 | }]);
|
184 |
|
185 | return DataFetch;
|
186 | }();
|
187 |
|
188 | exports.default = DataFetch;
|
189 | module.exports = exports["default"];
|
190 |
|
191 | }),
|
192 |
|
193 | (function(module, exports, __webpack_require__) {
|
194 |
|
195 | "use strict";
|
196 | (function(global) {
|
197 |
|
198 | Object.defineProperty(exports, "__esModule", {
|
199 | value: true
|
200 | });
|
201 |
|
202 | 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; }; }();
|
203 |
|
204 | var _ModelProperty = __webpack_require__(6);
|
205 |
|
206 | var _ModelProperty2 = _interopRequireDefault(_ModelProperty);
|
207 |
|
208 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
209 |
|
210 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
211 |
|
212 | if (global.__MODEL_REGISTRY__ == null || typeof global.__MODEL_REGISTRY__ === 'undefined') {
|
213 | global.__MODEL_SPEC_REGISTRY__ = {};
|
214 | }
|
215 |
|
216 | var Model = function () {
|
217 | function Model(spec) {
|
218 | _classCallCheck(this, Model);
|
219 |
|
220 | this.props = {};
|
221 | this._initFromSpec(spec);
|
222 | }
|
223 |
|
224 | _createClass(Model, [{
|
225 | key: '_initFromSpec',
|
226 | value: function _initFromSpec(spec) {
|
227 | var _this = this;
|
228 |
|
229 | this._key = '' + spec.key;
|
230 | this._option = spec.option || {};
|
231 | Object.keys(spec.props).forEach(function (k) {
|
232 | var field = spec.props[k];
|
233 | var defaultValue = null;
|
234 | if (field.defaultValue != null && typeof field.defaultValue !== 'undefined') {
|
235 | defaultValue = field.defaultValue;
|
236 | }
|
237 | _this.props[k] = new _ModelProperty2.default(_this, k, field.display, field.validators, defaultValue);
|
238 | if (field.defaultValue != null && typeof field.defaultValue !== 'undefined') {
|
239 | _this.props[k].setValue(field.defaultValue);
|
240 | _this.props[k].defaultValidation();
|
241 | }
|
242 | _this[k] = _this.props[k];
|
243 | });
|
244 | }
|
245 | }, {
|
246 | key: 'set',
|
247 | value: function set(data) {
|
248 | var _this2 = this;
|
249 |
|
250 | Object.keys(this.props).forEach(function (pk) {
|
251 | if (typeof data[pk] === 'undefined') {
|
252 | throw new Error('[CATELA_MODEL] [' + pk + '] property is not found in data.');
|
253 | } else {
|
254 | _this2.props[pk].setValue(data[pk].value);
|
255 | }
|
256 | });
|
257 | return this;
|
258 | }
|
259 | }, {
|
260 | key: 'bind',
|
261 | value: function bind(data) {
|
262 | var _this3 = this;
|
263 |
|
264 | Object.keys(this.props).forEach(function (pk) {
|
265 | if (typeof data[pk] === 'undefined') {
|
266 | throw new Error('[CATELA_MODEL] [' + pk + '] property is not found in data.');
|
267 | } else {
|
268 | if (data[pk] != null && typeof data[pk] !== 'undefined') {
|
269 |
|
270 | _this3.props[pk].set(data[pk]);
|
271 | }
|
272 | }
|
273 | });
|
274 | return this;
|
275 | }
|
276 | }, {
|
277 | key: 'get',
|
278 | value: function get() {
|
279 | var _this4 = this;
|
280 |
|
281 | var data = {};
|
282 | Object.keys(this.props).forEach(function (pk) {
|
283 | var props = _this4.props[pk];
|
284 | data[pk] = {
|
285 | value: props.getValue(),
|
286 | validation: props.getValidation()
|
287 | };
|
288 | });
|
289 | data.__MODEL_KEY__ = this._key;
|
290 | return data;
|
291 | }
|
292 | }, {
|
293 | key: 'getValue',
|
294 | value: function getValue() {
|
295 | var _this5 = this;
|
296 |
|
297 | var data = {};
|
298 | Object.keys(this.props).forEach(function (pk) {
|
299 | var props = _this5.props[pk];
|
300 | data[pk] = props.getValue();
|
301 | });
|
302 | return data;
|
303 | }
|
304 | }, {
|
305 | key: 'value',
|
306 | value: function value(field) {
|
307 | if (this.props[field] == null || typeof this.props[field] === 'undefined') {
|
308 | throw new Error('[CATELA_MODEL] [' + field + '] property is not found in data.');
|
309 | } else {
|
310 | return this.props[field].getValue();
|
311 | }
|
312 | }
|
313 | }, {
|
314 | key: 'clearValidation',
|
315 | value: function clearValidation() {
|
316 | var _this6 = this;
|
317 |
|
318 | Object.keys(this.props).forEach(function (pk) {
|
319 | var props = _this6.props[pk];
|
320 | props.defaultValidation();
|
321 | });
|
322 | return this;
|
323 | }
|
324 | }, {
|
325 | key: 'default',
|
326 | value: function _default() {
|
327 | var _this7 = this;
|
328 |
|
329 | Object.keys(this.props).forEach(function (pk) {
|
330 | var props = _this7.props[pk];
|
331 | props.default();
|
332 | });
|
333 | return this;
|
334 | }
|
335 | }, {
|
336 | key: 'validate',
|
337 | value: function validate() {
|
338 | var _this8 = this;
|
339 |
|
340 | var valid = true;
|
341 | var validations = {};
|
342 | Object.keys(this.props).forEach(function (pk) {
|
343 | var propsValidationResult = _this8.props[pk].validate(_this8.props[pk].getValue());
|
344 | valid = valid && propsValidationResult.valid;
|
345 | validations[pk] = propsValidationResult;
|
346 | });
|
347 | return {
|
348 | valid: valid,
|
349 | validations: validations
|
350 | };
|
351 | }
|
352 | }], [{
|
353 | key: 'fromSpec',
|
354 | value: function fromSpec(spec) {
|
355 | if (global.__MODEL_SPEC_REGISTRY__[spec.key] == null || typeof global.__MODEL_SPEC_REGISTRY__[spec.key] === 'undefined') {
|
356 | global.__MODEL_SPEC_REGISTRY__[spec.key] = spec;
|
357 | }
|
358 | return new Model(global.__MODEL_SPEC_REGISTRY__[spec.key]);
|
359 | }
|
360 | }, {
|
361 | key: 'fromData',
|
362 | value: function fromData(modelData) {
|
363 | if (modelData.__MODEL_KEY__ != null && typeof modelData.__MODEL_KEY__ !== 'undefined') {
|
364 | var spec = global.__MODEL_SPEC_REGISTRY__[modelData.__MODEL_KEY__];
|
365 | var model = new Model(spec);
|
366 | model.bind(Model.dataOf(modelData));
|
367 | return model;
|
368 | } else {
|
369 | throw new Error('[CATELA_MODEL] Model is not properly constructed (no __MODEL_KEY__ property in the object). You may need to specify get() when getting the model data.');
|
370 | }
|
371 | }
|
372 | }, {
|
373 | key: 'valueOf',
|
374 | value: function valueOf(data) {
|
375 | var dataValue = {};
|
376 | Object.keys(data).forEach(function (pk) {
|
377 | dataValue[pk] = {
|
378 | value: data[pk]
|
379 | };
|
380 | });
|
381 | return dataValue;
|
382 | }
|
383 | }, {
|
384 | key: 'dataOf',
|
385 | value: function dataOf(modelData) {
|
386 | var dataValue = {};
|
387 | Object.keys(modelData).forEach(function (pk) {
|
388 | if (typeof modelData[pk].value !== 'undefined') {
|
389 | dataValue[pk] = modelData[pk].value;
|
390 | }
|
391 | });
|
392 | return dataValue;
|
393 | }
|
394 | }]);
|
395 |
|
396 | return Model;
|
397 | }();
|
398 |
|
399 | exports.default = Model;
|
400 | module.exports = exports['default'];
|
401 | }.call(exports, __webpack_require__(3)))
|
402 |
|
403 | }),
|
404 |
|
405 | (function(module, exports, __webpack_require__) {
|
406 |
|
407 | "use strict";
|
408 |
|
409 |
|
410 | Object.defineProperty(exports, "__esModule", {
|
411 | value: true
|
412 | });
|
413 |
|
414 | 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; }; }();
|
415 |
|
416 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
417 |
|
418 | var ModelProperty = function () {
|
419 | function ModelProperty(model, key, display, validators, defaultValue) {
|
420 | _classCallCheck(this, ModelProperty);
|
421 |
|
422 | this._model = model;
|
423 | this._key = key;
|
424 | this._display = display;
|
425 | this._validators = validators;
|
426 | this._defaultValue = defaultValue;
|
427 | this.validation = {
|
428 | message: '',
|
429 | messages: [],
|
430 | valid: true,
|
431 | dirty: false
|
432 | };
|
433 | this.value = null;
|
434 | }
|
435 |
|
436 | _createClass(ModelProperty, [{
|
437 | key: 'check',
|
438 | value: function check() {
|
439 | return this.validate(this.value);
|
440 | }
|
441 | }, {
|
442 | key: 'validate',
|
443 | value: function validate(value) {
|
444 | var _this = this;
|
445 |
|
446 | var validators = this._validators;
|
447 | var messages = [];
|
448 | var allValid = true;
|
449 | if (validators != null && typeof validators !== 'undefined') {
|
450 | validators.forEach(function (v) {
|
451 | var validatorResult = v.apply(_this, value);
|
452 | if (!validatorResult.valid) {
|
453 | allValid = false;
|
454 | messages.push(validatorResult.message);
|
455 | }
|
456 | });
|
457 | }
|
458 | this.validation = {
|
459 | valid: allValid,
|
460 | messages: messages,
|
461 | message: messages[0] || '',
|
462 | dirty: true
|
463 | };
|
464 | return this.validation;
|
465 | }
|
466 | }, {
|
467 | key: 'default',
|
468 | value: function _default() {
|
469 | this.value = this._defaultValue;
|
470 | this.validation = {
|
471 | message: '',
|
472 | messages: [],
|
473 | valid: true,
|
474 | dirty: false
|
475 | };
|
476 | }
|
477 | }, {
|
478 | key: 'defaultValidation',
|
479 | value: function defaultValidation() {
|
480 | this.validation = {
|
481 | message: '',
|
482 | messages: [],
|
483 | valid: true,
|
484 | dirty: false
|
485 | };
|
486 | }
|
487 | }, {
|
488 | key: 'getValidation',
|
489 | value: function getValidation() {
|
490 | return this.validation;
|
491 | }
|
492 | }, {
|
493 | key: 'setValidation',
|
494 | value: function setValidation(validation) {
|
495 | this.validation = validation;
|
496 | }
|
497 | }, {
|
498 | key: 'getModel',
|
499 | value: function getModel() {
|
500 | return this._model;
|
501 | }
|
502 | }, {
|
503 | key: 'getValue',
|
504 | value: function getValue() {
|
505 | return this.value;
|
506 | }
|
507 | }, {
|
508 | key: 'setValue',
|
509 | value: function setValue(value) {
|
510 | var validationResult = this.validate(value);
|
511 | this.value = value;
|
512 | this.validation = validationResult;
|
513 | this.dirty = true;
|
514 | }
|
515 | }, {
|
516 | key: 'set',
|
517 | value: function set(value) {
|
518 | this.value = value;
|
519 | }
|
520 | }, {
|
521 | key: 'getDisplay',
|
522 | value: function getDisplay() {
|
523 | return this._display;
|
524 | }
|
525 | }, {
|
526 | key: 'getKey',
|
527 | value: function getKey() {
|
528 | return this._key;
|
529 | }
|
530 | }]);
|
531 |
|
532 | return ModelProperty;
|
533 | }();
|
534 |
|
535 | exports.default = ModelProperty;
|
536 | module.exports = exports['default'];
|
537 |
|
538 | }),
|
539 |
|
540 | (function(module, exports) {
|
541 |
|
542 | module.exports = require("async");
|
543 |
|
544 | }),
|
545 |
|
546 | (function(module, exports, __webpack_require__) {
|
547 |
|
548 | "use strict";
|
549 | (function(global) {
|
550 |
|
551 | Object.defineProperty(exports, "__esModule", {
|
552 | value: true
|
553 | });
|
554 |
|
555 | 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; }; }();
|
556 |
|
557 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
558 |
|
559 | var DependencyInjection = {};
|
560 |
|
561 | var Injectable = function () {
|
562 | function Injectable(name, container) {
|
563 | _classCallCheck(this, Injectable);
|
564 |
|
565 | this._name = name;
|
566 | this._getter = null;
|
567 | this._scope = null;
|
568 | this._by = null;
|
569 | this._container = container;
|
570 | this._singletonInstance = null;
|
571 | }
|
572 |
|
573 | _createClass(Injectable, [{
|
574 | key: 'toInstance',
|
575 | value: function toInstance(instance) {
|
576 | this._by = 'INSTANCE';
|
577 | this._getter = function () {
|
578 | return instance;
|
579 | };
|
580 | return this;
|
581 | }
|
582 | }, {
|
583 | key: 'to',
|
584 | value: function to(clazz) {
|
585 | this._by = 'CLASS';
|
586 | this._getter = clazz;
|
587 | return this;
|
588 | }
|
589 | }, {
|
590 | key: 'in',
|
591 | value: function _in(scope) {
|
592 | this._scope = scope;
|
593 | }
|
594 | }, {
|
595 | key: '_resolveAndRetrieveInstance',
|
596 | value: function _resolveAndRetrieveInstance(dependencies) {
|
597 | var _this = this;
|
598 |
|
599 | if (dependencies != null && typeof dependencies !== 'undefined') {
|
600 | var instanceDependencies = [null];
|
601 | dependencies.forEach(function (dependency) {
|
602 | var instanceDependency = _this._container.get(dependency);
|
603 | instanceDependencies.push(instanceDependency);
|
604 | });
|
605 | switch (this._by) {
|
606 | case 'INSTANCE':
|
607 | return this._getter();
|
608 | case 'CLASS':
|
609 | if (this._scope === DependencyInjection.Scope.SINGLETON) {
|
610 | if (this._singletonInstance == null || typeof this._singletonInstance === 'undefined') {
|
611 | this._singletonInstance = new (Function.prototype.bind.apply(this._getter, instanceDependencies))();
|
612 | }
|
613 | return this._singletonInstance;
|
614 | } else if (this._scope === DependencyInjection.Scope.LOCAL) {
|
615 | return new (Function.prototype.bind.apply(this._getter, instanceDependencies))();
|
616 | } else {
|
617 | return null;
|
618 | }
|
619 | return null;
|
620 | default:
|
621 | return null;
|
622 | }
|
623 | } else {
|
624 | switch (this._by) {
|
625 | case 'INSTANCE':
|
626 | return this._getter();
|
627 | case 'CLASS':
|
628 | if (this._scope === DependencyInjection.Scope.SINGLETON) {
|
629 | if (this._singletonInstance == null || typeof this._singletonInstance === 'undefined') {
|
630 | this._singletonInstance = new this._getter();
|
631 | }
|
632 | return this._singletonInstance;
|
633 | } else if (this._scope === DependencyInjection.Scope.LOCAL) {
|
634 | return new this._getter();
|
635 | } else {
|
636 | return null;
|
637 | }
|
638 | return null;
|
639 | default:
|
640 | return null;
|
641 | }
|
642 | }
|
643 | }
|
644 | }, {
|
645 | key: 'get',
|
646 | value: function get() {
|
647 | if (this._getter != null && typeof this._getter !== 'undefined') {
|
648 | var injections = this._getter.__INJECTION__;
|
649 | return this._resolveAndRetrieveInstance(injections);
|
650 | }
|
651 | return null;
|
652 | }
|
653 | }]);
|
654 |
|
655 | return Injectable;
|
656 | }();
|
657 |
|
658 | var Module = function () {
|
659 | function Module() {
|
660 | _classCallCheck(this, Module);
|
661 | }
|
662 |
|
663 | _createClass(Module, [{
|
664 | key: 'configure',
|
665 | value: function configure(binder) {}
|
666 | }]);
|
667 |
|
668 | return Module;
|
669 | }();
|
670 |
|
671 | var DependencyInjectionBinder = function () {
|
672 | function DependencyInjectionBinder(container) {
|
673 | _classCallCheck(this, DependencyInjectionBinder);
|
674 |
|
675 | this._container = container;
|
676 | }
|
677 |
|
678 | _createClass(DependencyInjectionBinder, [{
|
679 | key: 'bind',
|
680 | value: function bind(name) {
|
681 | return this._container._bind(name);
|
682 | }
|
683 | }]);
|
684 |
|
685 | return DependencyInjectionBinder;
|
686 | }();
|
687 |
|
688 | var DependencyInjectionContainer = function () {
|
689 | function DependencyInjectionContainer() {
|
690 | _classCallCheck(this, DependencyInjectionContainer);
|
691 |
|
692 | this._bindables = {};
|
693 | this._binder = new DependencyInjectionBinder(this);
|
694 | }
|
695 |
|
696 | _createClass(DependencyInjectionContainer, [{
|
697 | key: '_bind',
|
698 | value: function _bind(name) {
|
699 | this._bindables[name] = new Injectable(name, this);
|
700 | return this._bindables[name];
|
701 | }
|
702 | }, {
|
703 | key: 'get',
|
704 | value: function get(name) {
|
705 | if (this._bindables[name] != null && typeof this._bindables[name] !== 'undefined') {
|
706 | return this._bindables[name].get();
|
707 | } else {
|
708 | throw new Error('[Ncuz] Dependency configuration not found for NAME -> ' + name);
|
709 | }
|
710 | }
|
711 | }, {
|
712 | key: 'install',
|
713 | value: function install(module) {
|
714 | if (module instanceof Module) {
|
715 | module.install(this._binder);
|
716 | }
|
717 | }
|
718 | }]);
|
719 |
|
720 | return DependencyInjectionContainer;
|
721 | }();
|
722 |
|
723 | if (global.__CONTAINER_REGISTRY__ == null || typeof global.__CONTAINER_REGISTRY__ === 'undefined') {
|
724 | global.__CONTAINER_REGISTRY__ = {};
|
725 | }
|
726 |
|
727 | DependencyInjection.createContainer = function (containerName) {
|
728 | if (global.__CONTAINER_REGISTRY__[containerName] == null || typeof global.__CONTAINER_REGISTRY__[containerName] === 'undefined') {
|
729 | global.__CONTAINER_REGISTRY__[containerName] = new DependencyInjectionContainer();
|
730 | }
|
731 | return DependencyInjection.getContainer(containerName);
|
732 | };
|
733 |
|
734 | DependencyInjection.getContainer = function (containerName) {
|
735 | return global.__CONTAINER_REGISTRY__[containerName];
|
736 | };
|
737 |
|
738 | DependencyInjection.Scope = {
|
739 | SINGLETON: 'SINGLETON',
|
740 | LOCAL: 'LOCAL'
|
741 | };
|
742 |
|
743 | var inject = function inject() {
|
744 | var _arguments = arguments;
|
745 |
|
746 | var FORBIDDEN_KEYS = ['length'];
|
747 | var args = [];
|
748 | Object.keys(arguments).forEach(function (i) {
|
749 | var isKeyForbidden = FORBIDDEN_KEYS.indexOf(i) >= 0;
|
750 | if (!isKeyForbidden) {
|
751 | args.push(_arguments[i]);
|
752 | }
|
753 | });
|
754 | return function wrapWithInject(WrappedClass) {
|
755 | WrappedClass.__INJECTION__ = args;
|
756 | return WrappedClass;
|
757 | };
|
758 | };
|
759 |
|
760 | exports.default = {
|
761 | DI: DependencyInjection,
|
762 | inject: inject,
|
763 | Module: Module
|
764 | };
|
765 | module.exports = exports['default'];
|
766 | }.call(exports, __webpack_require__(3)))
|
767 |
|
768 | }),
|
769 |
|
770 | (function(module, exports, __webpack_require__) {
|
771 |
|
772 | "use strict";
|
773 | (function(global) {
|
774 |
|
775 | Object.defineProperty(exports, "__esModule", {
|
776 | value: true
|
777 | });
|
778 |
|
779 | var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
|
780 |
|
781 | 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; }; }();
|
782 |
|
783 | var _PromiseHttpResourceExecutor = __webpack_require__(15);
|
784 |
|
785 | var _PromiseHttpResourceExecutor2 = _interopRequireDefault(_PromiseHttpResourceExecutor);
|
786 |
|
787 | var _const = __webpack_require__(2);
|
788 |
|
789 | var _async = __webpack_require__(7);
|
790 |
|
791 | var _async2 = _interopRequireDefault(_async);
|
792 |
|
793 | var _querystring = __webpack_require__(39);
|
794 |
|
795 | var _querystring2 = _interopRequireDefault(_querystring);
|
796 |
|
797 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
798 |
|
799 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
800 |
|
801 | if (global.__RESOURCE_GROUP_REGISTRY__ == null || typeof global.__RESOURCE_GROUP_REGISTRY__ === 'undefined') {
|
802 | global.__RESOURCE_GROUP_REGISTRY__ = {};
|
803 | }
|
804 |
|
805 | var RemoteResourceExecution = function () {
|
806 | function RemoteResourceExecution(resource, resourceGroup, apiCaller) {
|
807 | _classCallCheck(this, RemoteResourceExecution);
|
808 |
|
809 | this._resource = resource;
|
810 | this._resourceGroup = resourceGroup;
|
811 | this._data = null;
|
812 | this._onProgressListener = null;
|
813 | this._attachments = null;
|
814 | this._configuration = {
|
815 | context: {},
|
816 | trackingContext: {},
|
817 | http: {
|
818 | headers: {},
|
819 | method: _const.HttpMethod.POST,
|
820 | contentType: 'application/json'
|
821 | },
|
822 | protocol: _const.Protocol.HTTP
|
823 | };
|
824 | this._apiCaller = apiCaller;
|
825 | this._successHandler = null;
|
826 | this._errorHandler = null;
|
827 | this._offlineHandler = null;
|
828 | }
|
829 |
|
830 | _createClass(RemoteResourceExecution, [{
|
831 | key: 'data',
|
832 | value: function data(_data) {
|
833 | this._data = _data;
|
834 | return this;
|
835 | }
|
836 | }, {
|
837 | key: 'onProgress',
|
838 | value: function onProgress(fn) {
|
839 | this._onProgressListener = fn;
|
840 | return this;
|
841 | }
|
842 | }, {
|
843 | key: 'attach',
|
844 | value: function attach(attachments) {
|
845 | this._attachments = attachments;
|
846 | return this;
|
847 | }
|
848 | }, {
|
849 | key: 'contentType',
|
850 | value: function contentType(_contentType) {
|
851 | this._configuration.http.contentType = _contentType;
|
852 | return this;
|
853 | }
|
854 | }, {
|
855 | key: 'context',
|
856 | value: function context(key, value) {
|
857 | this._configuration.context[key] = value;
|
858 | return this;
|
859 | }
|
860 | }, {
|
861 | key: 'trackingContext',
|
862 | value: function trackingContext(key, value) {
|
863 | this._configuration.trackingContext[key] = value;
|
864 | return this;
|
865 | }
|
866 | }, {
|
867 | key: 'setTrackingContext',
|
868 | value: function setTrackingContext(trackingContext) {
|
869 | var combinedTrackingContext = _extends({}, this._configuration.trackingContext, trackingContext);
|
870 | try {
|
871 |
|
872 | var fiz = global.__CONFIG__.fiz;
|
873 | combinedTrackingContext['ipAddress'] = fiz.ip('https://concierge-api.airyrooms.com/getIp');
|
874 | } catch (e) {}
|
875 |
|
876 | this._configuration.trackingContext = combinedTrackingContext;
|
877 | return this;
|
878 | }
|
879 | }, {
|
880 | key: 'method',
|
881 | value: function method(_method) {
|
882 | this._configuration.http.method = _method;
|
883 | return this;
|
884 | }
|
885 | }, {
|
886 | key: 'header',
|
887 | value: function header(key, value) {
|
888 | this._configuration.http.headers[key] = value;
|
889 | return this;
|
890 | }
|
891 | }, {
|
892 | key: 'protocol',
|
893 | value: function protocol(_protocol) {
|
894 | this._configuration.protocol = _protocol;
|
895 | return this;
|
896 | }
|
897 | }, {
|
898 | key: 'timeout',
|
899 | value: function timeout(_timeout) {
|
900 | this._configuration.http.timeout = _timeout;
|
901 | return this;
|
902 | }
|
903 | }, {
|
904 | key: '_createHttpAPIExecutionSpec',
|
905 | value: function _createHttpAPIExecutionSpec(data, context, trackingContext) {
|
906 | var url = this._resource.getUrl();
|
907 | if (this._resource._query) {
|
908 | url += this._resource._query;
|
909 | }
|
910 | return {
|
911 | uri: url,
|
912 | body: {
|
913 | data: data,
|
914 | context: context,
|
915 | trackingContext: trackingContext
|
916 | },
|
917 | headers: this._configuration.http.headers,
|
918 | method: this._configuration.http.method,
|
919 | contentType: this._configuration.http.contentType,
|
920 | timeout: this._configuration.http.timeout
|
921 | };
|
922 | }
|
923 | }, {
|
924 | key: '_executeHttpAPI',
|
925 | value: function _executeHttpAPI() {
|
926 | var resourceGroupContext = this._resourceGroup.getContext();
|
927 | var resourceContext = this._resource.getContext();
|
928 | var resourceExecutionContext = this._configuration.context;
|
929 | var resourceExecutionTrackingContext = this._configuration.trackingContext;
|
930 |
|
931 | var finalContext = {};
|
932 | var finalTrackingContext = {};
|
933 |
|
934 | finalTrackingContext = _extends({}, finalTrackingContext, resourceExecutionTrackingContext);
|
935 | finalContext = _extends({}, finalContext, resourceGroupContext);
|
936 |
|
937 | finalContext = _extends({}, finalContext, resourceContext);
|
938 |
|
939 | finalContext = _extends({}, finalContext, resourceExecutionContext);
|
940 |
|
941 | var apiSpec = this._createHttpAPIExecutionSpec(this._data, finalContext, finalTrackingContext);
|
942 | this._apiCaller.execute(apiSpec, this._offlineHandler, this._errorHandler, this._successHandler, this._attachments, this._onProgressListener);
|
943 | }
|
944 | }, {
|
945 | key: 'execute',
|
946 | value: function execute() {
|
947 | var _this = this,
|
948 | _arguments = arguments;
|
949 |
|
950 | var beforeExecuteFilterFn = [];
|
951 | if (this._resourceGroup.getOnBeforeExecuteFilters() != null) {
|
952 | if (this._resourceGroup.getOnBeforeExecuteFilters().length > 0) {
|
953 | this._resourceGroup.getOnBeforeExecuteFilters().forEach(function (f) {
|
954 | beforeExecuteFilterFn.push(f);
|
955 | });
|
956 | }
|
957 | }
|
958 |
|
959 | if (this._resource.getOnBeforeExecuteFilters() != null) {
|
960 | if (this._resource.getOnBeforeExecuteFilters().length > 0) {
|
961 | this._resource.getOnBeforeExecuteFilters().forEach(function (f) {
|
962 | beforeExecuteFilterFn.push(f);
|
963 | });
|
964 | }
|
965 | }
|
966 |
|
967 | if (beforeExecuteFilterFn.length > 0) {
|
968 | var beforeExecuteFilterFnCallQueue = [];
|
969 | var idx = 0;
|
970 | beforeExecuteFilterFn.forEach(function (beff) {
|
971 | if (idx === 0) {
|
972 | beforeExecuteFilterFnCallQueue.push(function (callback) {
|
973 |
|
974 | return beff(_this, callback);
|
975 | });
|
976 | } else {
|
977 | beforeExecuteFilterFnCallQueue.push(function (result, callback) {
|
978 |
|
979 | console.log(_arguments, result);
|
980 | return beff(_this, callback);
|
981 | });
|
982 | }
|
983 | idx += 1;
|
984 | });
|
985 |
|
986 | _async2.default.waterfall(beforeExecuteFilterFnCallQueue, function (err, results) {
|
987 | if (err) {
|
988 |
|
989 | } else {
|
990 | if (_this._configuration.protocol === _const.Protocol.HTTP) {
|
991 | _this._executeHttpAPI();
|
992 | } else {
|
993 |
|
994 | }
|
995 | }
|
996 | });
|
997 | } else {
|
998 | if (this._configuration.protocol === _const.Protocol.HTTP) {
|
999 | this._executeHttpAPI();
|
1000 | } else {
|
1001 |
|
1002 | }
|
1003 | }
|
1004 | }
|
1005 | }, {
|
1006 | key: 'success',
|
1007 | value: function success(fn) {
|
1008 | this._successHandler = fn;
|
1009 | return this;
|
1010 | }
|
1011 | }, {
|
1012 | key: 'error',
|
1013 | value: function error(fn) {
|
1014 | this._errorHandler = fn;
|
1015 | return this;
|
1016 | }
|
1017 | }, {
|
1018 | key: 'offline',
|
1019 | value: function offline(fn) {
|
1020 | this._offlineHandler = fn;
|
1021 | return this;
|
1022 | }
|
1023 | }]);
|
1024 |
|
1025 | return RemoteResourceExecution;
|
1026 | }();
|
1027 |
|
1028 | var RemoteResource = function () {
|
1029 | function RemoteResource(resourceGroup, url) {
|
1030 | _classCallCheck(this, RemoteResource);
|
1031 |
|
1032 | this._resourceGroup = resourceGroup;
|
1033 | this._url = url;
|
1034 | this._originalUrl = url;
|
1035 | this._query = '';
|
1036 | this._configuration = {
|
1037 | context: {}
|
1038 | };
|
1039 | this._onBeforeExecuteFilters = [];
|
1040 | this._onAfterExecuteFilters = [];
|
1041 | this._resourceExecutor = resourceGroup.getResourceExecutor();
|
1042 | }
|
1043 |
|
1044 | _createClass(RemoteResource, [{
|
1045 | key: 'onBeforeExecute',
|
1046 | value: function onBeforeExecute(filterFn) {
|
1047 | this._onBeforeExecuteFilters.push(filterFn);
|
1048 | }
|
1049 | }, {
|
1050 | key: 'onAfterExecute',
|
1051 | value: function onAfterExecute(filterFn) {
|
1052 | this._onAfterExecuteFilters.push(filterFn);
|
1053 | }
|
1054 | }, {
|
1055 | key: 'context',
|
1056 | value: function context(key, value) {
|
1057 | this._configuration.context[key] = value;
|
1058 | }
|
1059 | }, {
|
1060 | key: 'prepare',
|
1061 | value: function prepare() {
|
1062 | return new RemoteResourceExecution(this, this._resourceGroup, this._resourceExecutor);
|
1063 | }
|
1064 | }, {
|
1065 | key: 'param',
|
1066 | value: function param(_param) {
|
1067 | var _this2 = this;
|
1068 |
|
1069 | if (_param) {
|
1070 | Object.keys(_param).forEach(function (key) {
|
1071 | var value = _param[key];
|
1072 | _this2._url = _this2._originalUrl.replace(':' + key, value);
|
1073 | });
|
1074 | }
|
1075 | return this;
|
1076 | }
|
1077 | }, {
|
1078 | key: 'use',
|
1079 | value: function use(resourceExecutor) {
|
1080 | this._resourceExecutor = resourceExecutor;
|
1081 | }
|
1082 | }, {
|
1083 | key: 'getContext',
|
1084 | value: function getContext() {
|
1085 | return this._configuration.context;
|
1086 | }
|
1087 | }, {
|
1088 | key: 'getOnBeforeExecuteFilters',
|
1089 | value: function getOnBeforeExecuteFilters() {
|
1090 | return this._onBeforeExecuteFilters;
|
1091 | }
|
1092 | }, {
|
1093 | key: 'getOnAfterExecuteFilters',
|
1094 | value: function getOnAfterExecuteFilters() {
|
1095 | return this._onAfterExecuteFilters;
|
1096 | }
|
1097 | }, {
|
1098 | key: 'getUrl',
|
1099 | value: function getUrl() {
|
1100 | return this._url;
|
1101 | }
|
1102 | }, {
|
1103 | key: 'getQuery',
|
1104 | value: function getQuery() {
|
1105 | return this._query;
|
1106 | }
|
1107 | }, {
|
1108 | key: 'setQuery',
|
1109 | value: function setQuery(q) {
|
1110 | this._query = q;
|
1111 | }
|
1112 | }]);
|
1113 |
|
1114 | return RemoteResource;
|
1115 | }();
|
1116 |
|
1117 | var RemoteResourceGroup = function () {
|
1118 | function RemoteResourceGroup(name) {
|
1119 | _classCallCheck(this, RemoteResourceGroup);
|
1120 |
|
1121 | this._name = name;
|
1122 | this._configuration = {
|
1123 | context: {}
|
1124 | };
|
1125 | this._onBeforeExecuteFilters = [];
|
1126 | this._onAfterExecuteFilters = [];
|
1127 | this._resourceExecutor = new _PromiseHttpResourceExecutor2.default();
|
1128 | }
|
1129 |
|
1130 | _createClass(RemoteResourceGroup, [{
|
1131 | key: 'use',
|
1132 | value: function use(resourceExecutor) {
|
1133 | this._resourceExecutor = resourceExecutor;
|
1134 | }
|
1135 | }, {
|
1136 | key: 'create',
|
1137 | value: function create(url) {
|
1138 | return new RemoteResource(this, url);
|
1139 | }
|
1140 | }, {
|
1141 | key: 'createWithQuery',
|
1142 | value: function createWithQuery(url, query) {
|
1143 | var q = "?" + _querystring2.default.stringify(query);
|
1144 | this._query = q;
|
1145 | var remoteResource = new RemoteResource(this, url);
|
1146 | remoteResource.setQuery(q);
|
1147 | return remoteResource;
|
1148 | }
|
1149 | }, {
|
1150 | key: 'context',
|
1151 | value: function context(key, value) {
|
1152 | this._configuration.context[key] = value;
|
1153 | }
|
1154 | }, {
|
1155 | key: 'onBeforeExecute',
|
1156 | value: function onBeforeExecute(filterFn) {
|
1157 | this._onBeforeExecuteFilters.push(filterFn);
|
1158 | }
|
1159 | }, {
|
1160 | key: 'onAfterExecute',
|
1161 | value: function onAfterExecute(filterFn) {
|
1162 | this._onAfterExecuteFilters.push(filterFn);
|
1163 | }
|
1164 | }, {
|
1165 | key: 'getContext',
|
1166 | value: function getContext() {
|
1167 | return this._configuration.context;
|
1168 | }
|
1169 | }, {
|
1170 | key: 'getOnBeforeExecuteFilters',
|
1171 | value: function getOnBeforeExecuteFilters() {
|
1172 | return this._onBeforeExecuteFilters;
|
1173 | }
|
1174 | }, {
|
1175 | key: 'getOnAfterExecuteFilters',
|
1176 | value: function getOnAfterExecuteFilters() {
|
1177 | return this._onAfterExecuteFilters;
|
1178 | }
|
1179 | }, {
|
1180 | key: 'getResourceExecutor',
|
1181 | value: function getResourceExecutor() {
|
1182 | return this._resourceExecutor;
|
1183 | }
|
1184 | }]);
|
1185 |
|
1186 | return RemoteResourceGroup;
|
1187 | }();
|
1188 |
|
1189 | RemoteResource.group = function (groupName) {
|
1190 | if (global.__RESOURCE_GROUP_REGISTRY__[groupName] == null || typeof global.__RESOURCE_GROUP_REGISTRY__[groupName] === 'undefined') {
|
1191 | global.__RESOURCE_GROUP_REGISTRY__[groupName] = new RemoteResourceGroup(groupName);
|
1192 | }
|
1193 | return global.__RESOURCE_GROUP_REGISTRY__[groupName];
|
1194 | };
|
1195 |
|
1196 | exports.default = {
|
1197 | RemoteResource: RemoteResource
|
1198 | };
|
1199 | module.exports = exports['default'];
|
1200 | }.call(exports, __webpack_require__(3)))
|
1201 |
|
1202 | }),
|
1203 |
|
1204 | (function(module, exports, __webpack_require__) {
|
1205 |
|
1206 | "use strict";
|
1207 |
|
1208 |
|
1209 | Object.defineProperty(exports, "__esModule", {
|
1210 | value: true
|
1211 | });
|
1212 |
|
1213 | var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
|
1214 |
|
1215 | 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; }; }();
|
1216 |
|
1217 | var _async = __webpack_require__(7);
|
1218 |
|
1219 | var _async2 = _interopRequireDefault(_async);
|
1220 |
|
1221 | var _FetchableInstanceFactory = __webpack_require__(18);
|
1222 |
|
1223 | var _FetchableInstanceFactory2 = _interopRequireDefault(_FetchableInstanceFactory);
|
1224 |
|
1225 | var _hoistNonReactStatics = __webpack_require__(38);
|
1226 |
|
1227 | var _hoistNonReactStatics2 = _interopRequireDefault(_hoistNonReactStatics);
|
1228 |
|
1229 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
1230 |
|
1231 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
1232 |
|
1233 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
1234 |
|
1235 | 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; }
|
1236 |
|
1237 | var fetchableInstanceFactory = new _FetchableInstanceFactory2.default();
|
1238 |
|
1239 | function getDisplayName(WrappedComponent) {
|
1240 | return WrappedComponent.displayName || WrappedComponent.name || 'Component';
|
1241 | }
|
1242 |
|
1243 | function fetch(fetchClasses) {
|
1244 | return function wrapWithFetch(WrappedComponent) {
|
1245 | var fetchableDisplayName = 'Fetchable(' + getDisplayName(WrappedComponent) + ')';
|
1246 |
|
1247 | var FetchableWrappedComponent = function (_WrappedComponent) {
|
1248 | _inherits(FetchableWrappedComponent, _WrappedComponent);
|
1249 |
|
1250 | function FetchableWrappedComponent(props, context) {
|
1251 | _classCallCheck(this, FetchableWrappedComponent);
|
1252 |
|
1253 | var _this = _possibleConstructorReturn(this, (FetchableWrappedComponent.__proto__ || Object.getPrototypeOf(FetchableWrappedComponent)).call(this, props, context));
|
1254 |
|
1255 | _this.fetch = {};
|
1256 | _this.model = _this.context.model;
|
1257 | return _this;
|
1258 | }
|
1259 |
|
1260 | _createClass(FetchableWrappedComponent, [{
|
1261 | key: 'render',
|
1262 | value: function render() {
|
1263 | return this.__innerRender();
|
1264 | }
|
1265 | }]);
|
1266 |
|
1267 | return FetchableWrappedComponent;
|
1268 | }(WrappedComponent);
|
1269 |
|
1270 | FetchableWrappedComponent.displayName = fetchableDisplayName;
|
1271 | FetchableWrappedComponent.prototype.__innerRender = WrappedComponent.prototype.render;
|
1272 | FetchableWrappedComponent.__fetchData = function (store, context, callback) {
|
1273 | if (typeof fetchClasses !== 'undefined' && fetchClasses != null) {
|
1274 | var asyncCalls = {};
|
1275 | Object.keys(fetchClasses).forEach(function (kc) {
|
1276 | asyncCalls[kc] = function (callback) {
|
1277 | var fetchDataInstance = fetchableInstanceFactory.getFetchableInstance(fetchClasses[kc]);
|
1278 | if (fetchDataInstance.disableClient() && !context.server) {
|
1279 | callback(null, []);
|
1280 | } else {
|
1281 | fetchDataInstance.fetch(store, context, function (err, results) {
|
1282 | if (err) {
|
1283 | console.log('[' + kc + '] Unknown error occurred when trying to fetch data. ', err);
|
1284 | callback(err, null);
|
1285 | } else {
|
1286 | store[kc] = results;
|
1287 | callback(null, results);
|
1288 | }
|
1289 | });
|
1290 | }
|
1291 | };
|
1292 | });
|
1293 | _async2.default.series(asyncCalls, function (err, results) {
|
1294 | if (err) {
|
1295 | callback(err, null);
|
1296 | } else {
|
1297 | callback(null, results);
|
1298 | }
|
1299 | });
|
1300 | } else {
|
1301 | callback(null, store);
|
1302 | }
|
1303 | };
|
1304 | return (0, _hoistNonReactStatics2.default)(FetchableWrappedComponent, WrappedComponent);
|
1305 | };
|
1306 | }
|
1307 |
|
1308 | function simpleReducer() {
|
1309 | var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
1310 | var action = arguments[1];
|
1311 |
|
1312 | switch (action.type) {
|
1313 | case '__SET_VIEW_STATE__':
|
1314 | var newState = _extends({}, state, action.data);
|
1315 | return newState;
|
1316 | default:
|
1317 | return state;
|
1318 | }
|
1319 | return state;
|
1320 | }
|
1321 |
|
1322 | exports.default = {
|
1323 | fetch: fetch,
|
1324 | serverFetchReducer: simpleReducer
|
1325 | };
|
1326 | module.exports = exports['default'];
|
1327 |
|
1328 | }),
|
1329 |
|
1330 | (function(module, exports, __webpack_require__) {
|
1331 |
|
1332 | "use strict";
|
1333 |
|
1334 |
|
1335 | Object.defineProperty(exports, "__esModule", {
|
1336 | value: true
|
1337 | });
|
1338 | function preFetch(filterFunction) {
|
1339 | return function wrapWithFilter(WrappedComponent) {
|
1340 | if (WrappedComponent.__preFetchFilter == null || typeof WrappedComponent.__preFetchFilter === 'undefined') {
|
1341 | WrappedComponent.__preFetchFilter = [];
|
1342 | }
|
1343 | WrappedComponent.__preFetchFilter.push(function (filterContext) {
|
1344 | filterFunction(filterContext);
|
1345 | });
|
1346 | return WrappedComponent;
|
1347 | };
|
1348 | }
|
1349 |
|
1350 | function postFetch(filterFunction) {
|
1351 | return function wrapWithFilter(WrappedComponent) {
|
1352 | if (WrappedComponent.__postFetchFilter == null || typeof WrappedComponent.__postFetchFilter === 'undefined') {
|
1353 | WrappedComponent.__postFetchFilter = [];
|
1354 | }
|
1355 | WrappedComponent.__postFetchFilter.push(function (filterContext) {
|
1356 | filterFunction(filterContext);
|
1357 | });
|
1358 | return WrappedComponent;
|
1359 | };
|
1360 | }
|
1361 |
|
1362 | exports.default = {
|
1363 | preFetch: preFetch,
|
1364 | postFetch: postFetch
|
1365 | };
|
1366 | module.exports = exports['default'];
|
1367 |
|
1368 | }),
|
1369 |
|
1370 | (function(module, exports, __webpack_require__) {
|
1371 |
|
1372 | "use strict";
|
1373 |
|
1374 |
|
1375 | Object.defineProperty(exports, "__esModule", {
|
1376 | value: true
|
1377 | });
|
1378 |
|
1379 | 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; }; }();
|
1380 |
|
1381 | var _Model = __webpack_require__(5);
|
1382 |
|
1383 | var _Model2 = _interopRequireDefault(_Model);
|
1384 |
|
1385 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
1386 |
|
1387 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
1388 |
|
1389 | var ModelFunction = function () {
|
1390 | function ModelFunction(model, onChangeListener, onCollectListener) {
|
1391 | _classCallCheck(this, ModelFunction);
|
1392 |
|
1393 | this._model = _Model2.default.fromSpec(model);
|
1394 | this._onChangeListener = onChangeListener;
|
1395 | this._onCollectListener = onCollectListener;
|
1396 | }
|
1397 |
|
1398 | _createClass(ModelFunction, [{
|
1399 | key: 'getModel',
|
1400 | value: function getModel() {
|
1401 | return this._model;
|
1402 | }
|
1403 | }, {
|
1404 | key: 'listenInput',
|
1405 | value: function listenInput(field) {
|
1406 | var _this = this;
|
1407 |
|
1408 | var self = this;
|
1409 | return function (e) {
|
1410 | self._model[field].setValue(e.target.value);
|
1411 | if (self._onChangeListener != null && typeof self._onChangeListener !== 'undefined') {
|
1412 | self._onChangeListener(self._model, field, e.target.value, _this);
|
1413 | }
|
1414 | };
|
1415 | }
|
1416 | }, {
|
1417 | key: 'listenInputOnly',
|
1418 | value: function listenInputOnly(field) {
|
1419 | var _this2 = this;
|
1420 |
|
1421 | var self = this;
|
1422 | return function (e) {
|
1423 | if (self._onChangeListener != null && typeof self._onChangeListener !== 'undefined') {
|
1424 | self._onChangeListener(self._model, field, e.target.value, _this2);
|
1425 | }
|
1426 | };
|
1427 | }
|
1428 | }, {
|
1429 | key: 'listen',
|
1430 | value: function listen(field) {
|
1431 | var _this3 = this;
|
1432 |
|
1433 | var self = this;
|
1434 | return function (value) {
|
1435 | self._model[field].setValue(value);
|
1436 | if (self._onChangeListener != null && typeof self._onChangeListener !== 'undefined') {
|
1437 | self._onChangeListener(self._model, field, value, _this3);
|
1438 | }
|
1439 | };
|
1440 | }
|
1441 | }, {
|
1442 | key: 'listenOnly',
|
1443 | value: function listenOnly(field) {
|
1444 | var _this4 = this;
|
1445 |
|
1446 | var self = this;
|
1447 | return function (value) {
|
1448 | if (self._onChangeListener != null && typeof self._onChangeListener !== 'undefined') {
|
1449 | self._onChangeListener(self._model, field, value, _this4);
|
1450 | }
|
1451 | };
|
1452 | }
|
1453 | }, {
|
1454 | key: 'value',
|
1455 | value: function value(field) {
|
1456 | if (this._model[field] != null && typeof this._model[field] !== 'undefined') {
|
1457 | return this._model[field].value;
|
1458 | } else {
|
1459 | return null;
|
1460 | }
|
1461 | }
|
1462 | }, {
|
1463 | key: 'set',
|
1464 | value: function set(field, value) {
|
1465 | if (this._model[field] != null && typeof this._model[field] !== 'undefined') {
|
1466 | this._model[field].set(value);
|
1467 | }
|
1468 | }
|
1469 | }, {
|
1470 | key: 'validation',
|
1471 | value: function validation(field) {
|
1472 | if (this._model[field] != null && typeof this._model[field] !== 'undefined') {
|
1473 | return this._model[field].validation;
|
1474 | } else {
|
1475 | return {
|
1476 | message: ''
|
1477 | };
|
1478 | }
|
1479 | }
|
1480 | }, {
|
1481 | key: 'bind',
|
1482 | value: function bind(value) {
|
1483 | this._model.bind(value);
|
1484 | }
|
1485 | }, {
|
1486 | key: 'updateAction',
|
1487 | value: function updateAction() {
|
1488 | return {
|
1489 | type: '__MODEL_UPDATE__',
|
1490 | data: this._model.getValue()
|
1491 | };
|
1492 | }
|
1493 | }, {
|
1494 | key: 'collect',
|
1495 | value: function collect() {
|
1496 | var self = this;
|
1497 | return function () {
|
1498 | self._onCollectListener(self._model);
|
1499 | };
|
1500 | }
|
1501 | }], [{
|
1502 | key: 'setup',
|
1503 | value: function setup(model, onChange, onCollect) {
|
1504 | return new ModelFunction(model, onChange, onCollect);
|
1505 | }
|
1506 | }]);
|
1507 |
|
1508 | return ModelFunction;
|
1509 | }();
|
1510 |
|
1511 | exports.default = ModelFunction;
|
1512 | module.exports = exports['default'];
|
1513 |
|
1514 | }),
|
1515 |
|
1516 | (function(module, exports, __webpack_require__) {
|
1517 |
|
1518 | "use strict";
|
1519 |
|
1520 |
|
1521 | Object.defineProperty(exports, "__esModule", {
|
1522 | value: true
|
1523 | });
|
1524 |
|
1525 | var _EmailValidator = __webpack_require__(23);
|
1526 |
|
1527 | var _EmailValidator2 = _interopRequireDefault(_EmailValidator);
|
1528 |
|
1529 | var _LengthRangeValidator = __webpack_require__(24);
|
1530 |
|
1531 | var _LengthRangeValidator2 = _interopRequireDefault(_LengthRangeValidator);
|
1532 |
|
1533 | var _NumberValidator = __webpack_require__(28);
|
1534 |
|
1535 | var _NumberValidator2 = _interopRequireDefault(_NumberValidator);
|
1536 |
|
1537 | var _PhoneNumberValidator = __webpack_require__(30);
|
1538 |
|
1539 | var _PhoneNumberValidator2 = _interopRequireDefault(_PhoneNumberValidator);
|
1540 |
|
1541 | var _RequiredValidator = __webpack_require__(31);
|
1542 |
|
1543 | var _RequiredValidator2 = _interopRequireDefault(_RequiredValidator);
|
1544 |
|
1545 | var _ValueRangeValidator = __webpack_require__(37);
|
1546 |
|
1547 | var _ValueRangeValidator2 = _interopRequireDefault(_ValueRangeValidator);
|
1548 |
|
1549 | var _AlphanumericValidator = __webpack_require__(19);
|
1550 |
|
1551 | var _AlphanumericValidator2 = _interopRequireDefault(_AlphanumericValidator);
|
1552 |
|
1553 | var _StrongPasswordValidator = __webpack_require__(32);
|
1554 |
|
1555 | var _StrongPasswordValidator2 = _interopRequireDefault(_StrongPasswordValidator);
|
1556 |
|
1557 | var _MatchValidator = __webpack_require__(25);
|
1558 |
|
1559 | var _MatchValidator2 = _interopRequireDefault(_MatchValidator);
|
1560 |
|
1561 | var _DateValidator = __webpack_require__(22);
|
1562 |
|
1563 | var _DateValidator2 = _interopRequireDefault(_DateValidator);
|
1564 |
|
1565 | var _DateGreaterThanValidator = __webpack_require__(20);
|
1566 |
|
1567 | var _DateGreaterThanValidator2 = _interopRequireDefault(_DateGreaterThanValidator);
|
1568 |
|
1569 | var _DateLesserThanValidator = __webpack_require__(21);
|
1570 |
|
1571 | var _DateLesserThanValidator2 = _interopRequireDefault(_DateLesserThanValidator);
|
1572 |
|
1573 | var _NumberGreaterThanValidator = __webpack_require__(26);
|
1574 |
|
1575 | var _NumberGreaterThanValidator2 = _interopRequireDefault(_NumberGreaterThanValidator);
|
1576 |
|
1577 | var _NumberLesserThanValidator = __webpack_require__(27);
|
1578 |
|
1579 | var _NumberLesserThanValidator2 = _interopRequireDefault(_NumberLesserThanValidator);
|
1580 |
|
1581 | var _ObjectRequiredValidator = __webpack_require__(29);
|
1582 |
|
1583 | var _ObjectRequiredValidator2 = _interopRequireDefault(_ObjectRequiredValidator);
|
1584 |
|
1585 | var _TimeGreaterThanOrEqualToValidator = __webpack_require__(33);
|
1586 |
|
1587 | var _TimeGreaterThanOrEqualToValidator2 = _interopRequireDefault(_TimeGreaterThanOrEqualToValidator);
|
1588 |
|
1589 | var _TimeGreaterThanValidator = __webpack_require__(34);
|
1590 |
|
1591 | var _TimeGreaterThanValidator2 = _interopRequireDefault(_TimeGreaterThanValidator);
|
1592 |
|
1593 | var _TimeLessThanOrEqualToValidator = __webpack_require__(35);
|
1594 |
|
1595 | var _TimeLessThanOrEqualToValidator2 = _interopRequireDefault(_TimeLessThanOrEqualToValidator);
|
1596 |
|
1597 | var _TimeLessThanValidator = __webpack_require__(36);
|
1598 |
|
1599 | var _TimeLessThanValidator2 = _interopRequireDefault(_TimeLessThanValidator);
|
1600 |
|
1601 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
1602 |
|
1603 | exports.default = {
|
1604 | EmailValidator: _EmailValidator2.default,
|
1605 | LengthRangeValidator: _LengthRangeValidator2.default,
|
1606 | NumberValidator: _NumberValidator2.default,
|
1607 | PhoneNumberValidator: _PhoneNumberValidator2.default,
|
1608 | RequiredValidator: _RequiredValidator2.default,
|
1609 | ValueRangeValidator: _ValueRangeValidator2.default,
|
1610 | AlphanumericValidator: _AlphanumericValidator2.default,
|
1611 | StrongPasswordValidator: _StrongPasswordValidator2.default,
|
1612 | MatchValidator: _MatchValidator2.default,
|
1613 | DateValidator: _DateValidator2.default,
|
1614 | DateGreaterThanValidator: _DateGreaterThanValidator2.default,
|
1615 | DateLesserThanValidator: _DateLesserThanValidator2.default,
|
1616 | NumberGreaterThanValidator: _NumberGreaterThanValidator2.default,
|
1617 | NumberLesserThanValidator: _NumberLesserThanValidator2.default,
|
1618 | ObjectRequiredValidator: _ObjectRequiredValidator2.default,
|
1619 | TimeGreaterThanOrEqualToValidator: _TimeGreaterThanOrEqualToValidator2.default,
|
1620 | TimeGreaterThanValidator: _TimeGreaterThanValidator2.default,
|
1621 | TimeLessThanOrEqualToValidator: _TimeLessThanOrEqualToValidator2.default,
|
1622 | TimeLessThanValidator: _TimeLessThanValidator2.default
|
1623 | };
|
1624 | module.exports = exports['default'];
|
1625 |
|
1626 | }),
|
1627 |
|
1628 | (function(module, exports, __webpack_require__) {
|
1629 |
|
1630 | "use strict";
|
1631 |
|
1632 |
|
1633 | Object.defineProperty(exports, "__esModule", {
|
1634 | value: true
|
1635 | });
|
1636 | function render(renderHtmlPath, bindFn) {
|
1637 | return function (WrappedComponent) {
|
1638 | WrappedComponent.__renderPage = renderHtmlPath;
|
1639 | if (bindFn != null && typeof bindFn !== 'undefined') {
|
1640 | WrappedComponent.__renderBindFn = bindFn;
|
1641 | }
|
1642 | return WrappedComponent;
|
1643 | };
|
1644 | }
|
1645 |
|
1646 | exports.default = {
|
1647 | render: render
|
1648 | };
|
1649 | module.exports = exports['default'];
|
1650 |
|
1651 | }),
|
1652 |
|
1653 | (function(module, exports, __webpack_require__) {
|
1654 |
|
1655 | "use strict";
|
1656 |
|
1657 |
|
1658 | Object.defineProperty(exports, "__esModule", {
|
1659 | value: true
|
1660 | });
|
1661 |
|
1662 | 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; }; }();
|
1663 |
|
1664 | var _superagentBluebirdPromise = __webpack_require__(40);
|
1665 |
|
1666 | var _superagentBluebirdPromise2 = _interopRequireDefault(_superagentBluebirdPromise);
|
1667 |
|
1668 | var _const = __webpack_require__(2);
|
1669 |
|
1670 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
1671 |
|
1672 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
1673 |
|
1674 | var PromiseHttpResourceExecutor = function () {
|
1675 | function PromiseHttpResourceExecutor() {
|
1676 | _classCallCheck(this, PromiseHttpResourceExecutor);
|
1677 |
|
1678 | this._forbiddenHeadersInClient = ['cookie'];
|
1679 | }
|
1680 |
|
1681 | _createClass(PromiseHttpResourceExecutor, [{
|
1682 | key: 'validate',
|
1683 | value: function validate(resourceExecutionSpec) {
|
1684 | return true;
|
1685 | }
|
1686 | }, {
|
1687 | key: 'execute',
|
1688 | value: function execute(resourceExecutionSpec, offlineCallback, errorCallback, successCallback, attachments, onProgressListener) {
|
1689 | switch (resourceExecutionSpec.method) {
|
1690 | case _const.HttpMethod.POST:
|
1691 | return this._executePOSTResourceExecution(resourceExecutionSpec, offlineCallback, errorCallback, successCallback, attachments, onProgressListener);
|
1692 | case _const.HttpMethod.GET:
|
1693 | return this._executeGETResourceExecution(resourceExecutionSpec, offlineCallback, errorCallback, successCallback);
|
1694 | }
|
1695 | }
|
1696 | }, {
|
1697 | key: '_handleBadGateway',
|
1698 | value: function _handleBadGateway(err, result, offlineCallback, errorCallback, successCallback) {
|
1699 | if (err) {
|
1700 | errorCallback(err, null);
|
1701 | } else {
|
1702 | errorCallback(new Error('[ERROR_CODE_502] An error occurred when trying to execute resource. Error code: 502 - Bad Gateway.', null));
|
1703 | }
|
1704 | }
|
1705 | }, {
|
1706 | key: '_handleServerError',
|
1707 | value: function _handleServerError(err, result, offlineCallback, errorCallback, successCallback) {
|
1708 | if (err) {
|
1709 | errorCallback(err, null);
|
1710 | } else {
|
1711 | errorCallback(new Error('[ERROR_CODE_500] An error occurred when trying to execute resource. Error code: 500 - Internal server error.', null));
|
1712 | }
|
1713 | }
|
1714 | }, {
|
1715 | key: '_handleServerUnavailable',
|
1716 | value: function _handleServerUnavailable(err, result, offlineCallback, errorCallback, successCallback) {
|
1717 | if (err) {
|
1718 | errorCallback(err, null);
|
1719 | } else {
|
1720 | errorCallback(new Error('[ERROR_CODE_503] An error occurred when trying to execute resource. Error code: 503 - Server Unavailable.', null));
|
1721 | }
|
1722 | }
|
1723 | }, {
|
1724 | key: '_handleBadRequest',
|
1725 | value: function _handleBadRequest(err, result, offlineCallback, errorCallback, successCallback) {
|
1726 | if (err) {
|
1727 | errorCallback(err, null);
|
1728 | } else {
|
1729 | errorCallback(new Error('[ERROR_CODE_400] An error occurred when trying to execute resource. Error code: 400 - Bad Request.', null));
|
1730 | }
|
1731 | }
|
1732 | }, {
|
1733 | key: '_handleUnauthorized',
|
1734 | value: function _handleUnauthorized(err, result, offlineCallback, errorCallback, successCallback) {
|
1735 | if (err) {
|
1736 | errorCallback(err, null);
|
1737 | } else {
|
1738 | errorCallback(new Error('[ERROR_CODE_401] An error occurred when trying to execute resource. Error code: 401 - Bad Gateway.', null));
|
1739 | }
|
1740 | }
|
1741 | }, {
|
1742 | key: '_handleForbidden',
|
1743 | value: function _handleForbidden(err, result, offlineCallback, errorCallback, successCallback) {
|
1744 | if (err) {
|
1745 | errorCallback(err, null);
|
1746 | } else {
|
1747 | errorCallback(new Error('[ERROR_CODE_403] An error occurred when trying to execute resource. Error code: 403 - Forbidden.', null));
|
1748 | }
|
1749 | }
|
1750 | }, {
|
1751 | key: '_handleSuccess',
|
1752 | value: function _handleSuccess(err, result, offlineCallback, errorCallback, successCallback) {
|
1753 | if (err) {
|
1754 | errorCallback(err, null);
|
1755 | } else {
|
1756 | var resourceExecutionResult = {
|
1757 | status: result.status,
|
1758 | body: result.body,
|
1759 | headers: result.headers
|
1760 | };
|
1761 | successCallback(null, resourceExecutionResult);
|
1762 | }
|
1763 | }
|
1764 | }, {
|
1765 | key: '_handleNoContent',
|
1766 | value: function _handleNoContent(err, result, offlineCallback, errorCallback, successCallback) {
|
1767 | if (err) {
|
1768 | errorCallback(err, null);
|
1769 | } else {
|
1770 | var resourceExecutionResult = {
|
1771 | status: result.status,
|
1772 | data: null,
|
1773 | headers: result.headers
|
1774 | };
|
1775 | successCallback(null, resourceExecutionResult);
|
1776 | }
|
1777 | }
|
1778 | }, {
|
1779 | key: '_handleUnprocessableEntity',
|
1780 | value: function _handleUnprocessableEntity(err, result, offlineCallback, errorCallback, successCallback) {
|
1781 | if (err) {
|
1782 | errorCallback(err, null);
|
1783 | } else {
|
1784 | errorCallback(new Error('[ERROR_CODE_422] An error occurred when trying to execute resource. Error code: 422 - Unprocessable entity.', null));
|
1785 | }
|
1786 | }
|
1787 | }, {
|
1788 | key: '_handleUnsupportedMediaType',
|
1789 | value: function _handleUnsupportedMediaType(err, result, offlineCallback, errorCallback, successCallback) {
|
1790 | if (err) {
|
1791 | errorCallback(err, null);
|
1792 | } else {
|
1793 | errorCallback(new Error('[ERROR_CODE_415] An error occurred when trying to execute resource. Error code: 415 - Unsupported media type.', null));
|
1794 | }
|
1795 | }
|
1796 | }, {
|
1797 | key: '_executeGETResourceExecution',
|
1798 | value: function _executeGETResourceExecution(resourceExecutionSpec, offlineCallback, errorCallback, successCallback) {
|
1799 | var _this = this;
|
1800 |
|
1801 | var getRequest = _superagentBluebirdPromise2.default.get(resourceExecutionSpec.uri).withCredentials();
|
1802 |
|
1803 | if (resourceExecutionSpec.headers != null && typeof resourceExecutionSpec !== 'undefined') {
|
1804 | if (__SERVER__) {
|
1805 | Object.keys(resourceExecutionSpec.headers).forEach(function (h) {
|
1806 | getRequest.set(h, resourceExecutionSpec.headers[h]);
|
1807 | });
|
1808 | } else {
|
1809 | Object.keys(resourceExecutionSpec.headers).forEach(function (h) {
|
1810 | if (_this._forbiddenHeadersInClient.indexOf(h.toLowerCase()) < 0) {
|
1811 | getRequest.set(h, resourceExecutionSpec.headers[h]);
|
1812 | }
|
1813 | });
|
1814 | }
|
1815 | }
|
1816 |
|
1817 | if (resourceExecutionSpec.timeout != null && typeof resourceExecutionSpec.timeout !== 'undefined') {
|
1818 | getRequest.timeout(resourceExecutionSpec.timeout);
|
1819 | }
|
1820 |
|
1821 | getRequest.end(function (err, result) {
|
1822 | if (err) {
|
1823 | return _this._handleServerError(err, result, offlineCallback, errorCallback, successCallback);
|
1824 | } else {
|
1825 | switch (result.status) {
|
1826 | case 502:
|
1827 | return _this._handleBadGateway(err, result, offlineCallback, errorCallback, successCallback);
|
1828 | case 500:
|
1829 | return _this._handleServerError(err, result, offlineCallback, errorCallback, successCallback);
|
1830 | case 503:
|
1831 | return _this._handleServerUnavailable(err, result, offlineCallback, errorCallback, successCallback);
|
1832 | case 400:
|
1833 | return _this._handleBadRequest(err, result, offlineCallback, errorCallback, successCallback);
|
1834 | case 401:
|
1835 | return _this._handleUnauthorized(err, result, offlineCallback, errorCallback, successCallback);
|
1836 | case 403:
|
1837 | return _this._handleForbidden(err, result, offlineCallback, errorCallback, successCallback);
|
1838 | case 200:
|
1839 | return _this._handleSuccess(null, result, offlineCallback, errorCallback, successCallback);
|
1840 | case 204:
|
1841 | return _this._handleNoContent(err, result, offlineCallback, errorCallback, successCallback);
|
1842 | case 422:
|
1843 | return _this._handleUnprocessableEntity(err, result, offlineCallback, errorCallback, successCallback);
|
1844 | case 415:
|
1845 | return _this._handleUnsupportedMediaType(err, result, offlineCallback, errorCallback, successCallback);
|
1846 | }
|
1847 | }
|
1848 | });
|
1849 | }
|
1850 | }, {
|
1851 | key: '_executePOSTResourceExecution',
|
1852 | value: function _executePOSTResourceExecution(resourceExecutionSpec, offlineCallback, errorCallback, successCallback, attachments, onProgressListener) {
|
1853 | var _this2 = this;
|
1854 |
|
1855 | var postRequest = _superagentBluebirdPromise2.default.post(resourceExecutionSpec.uri).withCredentials();
|
1856 |
|
1857 | if (attachments) {
|
1858 | Object.keys(attachments).forEach(function (key) {
|
1859 | postRequest.attach(key, attachments[key]);
|
1860 | });
|
1861 | }
|
1862 |
|
1863 | if (onProgressListener) {
|
1864 | postRequest.on('progress', onProgressListener);
|
1865 | }
|
1866 |
|
1867 | if (resourceExecutionSpec.body != null && typeof resourceExecutionSpec.body !== 'undefined') {
|
1868 | if (!attachments) {
|
1869 | postRequest.send(JSON.stringify(resourceExecutionSpec.body));
|
1870 | }
|
1871 | }
|
1872 | if (resourceExecutionSpec.contentType != null && typeof resourceExecutionSpec.contentType !== 'undefined') {
|
1873 | postRequest.set('Content-Type', resourceExecutionSpec.contentType);
|
1874 | }
|
1875 | if (resourceExecutionSpec.timeout != null && typeof resourceExecutionSpec.timeout !== 'undefined') {
|
1876 | postRequest.timeout(resourceExecutionSpec.timeout);
|
1877 | }
|
1878 |
|
1879 | if (resourceExecutionSpec.headers != null && typeof resourceExecutionSpec !== 'undefined') {
|
1880 | if (__SERVER__) {
|
1881 | Object.keys(resourceExecutionSpec.headers).forEach(function (h) {
|
1882 | postRequest.set(h, resourceExecutionSpec.headers[h]);
|
1883 | });
|
1884 | } else {
|
1885 | Object.keys(resourceExecutionSpec.headers).forEach(function (h) {
|
1886 | if (_this2._forbiddenHeadersInClient.indexOf(h.toLowerCase()) < 0) {
|
1887 | postRequest.set(h, resourceExecutionSpec.headers[h]);
|
1888 | }
|
1889 | });
|
1890 | }
|
1891 | }
|
1892 |
|
1893 | postRequest.end(function (err, result) {
|
1894 | if (err) {
|
1895 | return _this2._handleServerError(err, result, offlineCallback, errorCallback, successCallback);
|
1896 | } else {
|
1897 | switch (result.status) {
|
1898 | case 502:
|
1899 | return _this2._handleBadGateway(err, result, offlineCallback, errorCallback, successCallback);
|
1900 | case 500:
|
1901 | return _this2._handleServerError(err, result, offlineCallback, errorCallback, successCallback);
|
1902 | case 503:
|
1903 | return _this2._handleServerUnavailable(err, result, offlineCallback, errorCallback, successCallback);
|
1904 | case 400:
|
1905 | return _this2._handleBadRequest(err, result, offlineCallback, errorCallback, successCallback);
|
1906 | case 401:
|
1907 | return _this2._handleUnauthorized(err, result, offlineCallback, errorCallback, successCallback);
|
1908 | case 403:
|
1909 | return _this2._handleForbidden(err, result, offlineCallback, errorCallback, successCallback);
|
1910 | case 200:
|
1911 | return _this2._handleSuccess(null, result, offlineCallback, errorCallback, successCallback);
|
1912 | case 204:
|
1913 | return _this2._handleNoContent(err, result, offlineCallback, errorCallback, successCallback);
|
1914 | case 422:
|
1915 | return _this2._handleUnprocessableEntity(err, result, offlineCallback, errorCallback, successCallback);
|
1916 | case 415:
|
1917 | return _this2._handleUnsupportedMediaType(err, result, offlineCallback, errorCallback, successCallback);
|
1918 | }
|
1919 | }
|
1920 | });
|
1921 | }
|
1922 | }]);
|
1923 |
|
1924 | return PromiseHttpResourceExecutor;
|
1925 | }();
|
1926 |
|
1927 | exports.default = PromiseHttpResourceExecutor;
|
1928 | module.exports = exports['default'];
|
1929 |
|
1930 | }),
|
1931 |
|
1932 | (function(module, exports, __webpack_require__) {
|
1933 |
|
1934 | "use strict";
|
1935 |
|
1936 |
|
1937 | Object.defineProperty(exports, "__esModule", {
|
1938 | value: true
|
1939 | });
|
1940 |
|
1941 | var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
|
1942 |
|
1943 | var _core = __webpack_require__(10);
|
1944 |
|
1945 | var _DataFetch = __webpack_require__(4);
|
1946 |
|
1947 | var _DataFetch2 = _interopRequireDefault(_DataFetch);
|
1948 |
|
1949 | var _Model = __webpack_require__(5);
|
1950 |
|
1951 | var _Model2 = _interopRequireDefault(_Model);
|
1952 |
|
1953 | var _ModelProperty = __webpack_require__(6);
|
1954 |
|
1955 | var _ModelProperty2 = _interopRequireDefault(_ModelProperty);
|
1956 |
|
1957 | var _ModelFunction = __webpack_require__(12);
|
1958 |
|
1959 | var _ModelFunction2 = _interopRequireDefault(_ModelFunction);
|
1960 |
|
1961 | var _validation = __webpack_require__(13);
|
1962 |
|
1963 | var _validation2 = _interopRequireDefault(_validation);
|
1964 |
|
1965 | var _Resource = __webpack_require__(9);
|
1966 |
|
1967 | var _filter = __webpack_require__(11);
|
1968 |
|
1969 | var _Ncuz = __webpack_require__(8);
|
1970 |
|
1971 | var _render = __webpack_require__(14);
|
1972 |
|
1973 | var _const = __webpack_require__(2);
|
1974 |
|
1975 | var _const2 = _interopRequireDefault(_const);
|
1976 |
|
1977 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
1978 |
|
1979 | exports.default = {
|
1980 | HttpMethod: _const2.default.HttpMethod,
|
1981 | Protocol: _const2.default.Protocol,
|
1982 | render: _render.render,
|
1983 | fetch: _core.fetch,
|
1984 | preFetch: _filter.preFetch,
|
1985 | postFetch: _filter.postFetch,
|
1986 | DataFetch: _DataFetch2.default,
|
1987 | model: {
|
1988 | Model: _Model2.default,
|
1989 | ModelProperty: _ModelProperty2.default,
|
1990 | ModelFunction: _ModelFunction2.default,
|
1991 | validation: _extends({}, _validation2.default)
|
1992 | },
|
1993 | resource: {
|
1994 | RemoteResource: _Resource.RemoteResource
|
1995 | },
|
1996 | ncuz: {
|
1997 | DI: _Ncuz.DI,
|
1998 | inject: _Ncuz.inject,
|
1999 | Module: _Ncuz.Module
|
2000 | }
|
2001 | };
|
2002 | module.exports = exports['default'];
|
2003 |
|
2004 | }),
|
2005 |
|
2006 | (function(module, exports, __webpack_require__) {
|
2007 |
|
2008 | "use strict";
|
2009 |
|
2010 |
|
2011 | Object.defineProperty(exports, "__esModule", {
|
2012 | value: true
|
2013 | });
|
2014 |
|
2015 | 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; }; }();
|
2016 |
|
2017 | var _DataFetch2 = __webpack_require__(4);
|
2018 |
|
2019 | var _DataFetch3 = _interopRequireDefault(_DataFetch2);
|
2020 |
|
2021 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
2022 |
|
2023 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
2024 |
|
2025 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
2026 |
|
2027 | 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; }
|
2028 |
|
2029 | var FetchableInstance = function (_DataFetch) {
|
2030 | _inherits(FetchableInstance, _DataFetch);
|
2031 |
|
2032 | function FetchableInstance(FetchClass) {
|
2033 | _classCallCheck(this, FetchableInstance);
|
2034 |
|
2035 | var _this = _possibleConstructorReturn(this, (FetchableInstance.__proto__ || Object.getPrototypeOf(FetchableInstance)).call(this));
|
2036 |
|
2037 | _this._innerFetchInstance = new FetchClass();
|
2038 | _this._innerFetchInstance.disableClient = FetchClass.disableClient;
|
2039 | return _this;
|
2040 | }
|
2041 |
|
2042 | _createClass(FetchableInstance, [{
|
2043 | key: 'fetch',
|
2044 | value: function fetch(store, context, callback) {
|
2045 | this._innerFetchInstance.fetch(store, context, function (err, results) {
|
2046 | callback(err, results);
|
2047 | });
|
2048 | }
|
2049 | }, {
|
2050 | key: 'disableClient',
|
2051 | value: function disableClient() {
|
2052 | return this._innerFetchInstance.disableClient;
|
2053 | }
|
2054 | }]);
|
2055 |
|
2056 | return FetchableInstance;
|
2057 | }(_DataFetch3.default);
|
2058 |
|
2059 | exports.default = FetchableInstance;
|
2060 | module.exports = exports['default'];
|
2061 |
|
2062 | }),
|
2063 |
|
2064 | (function(module, exports, __webpack_require__) {
|
2065 |
|
2066 | "use strict";
|
2067 |
|
2068 |
|
2069 | Object.defineProperty(exports, "__esModule", {
|
2070 | value: true
|
2071 | });
|
2072 |
|
2073 | 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; }; }();
|
2074 |
|
2075 | var _FetchableInstance = __webpack_require__(17);
|
2076 |
|
2077 | var _FetchableInstance2 = _interopRequireDefault(_FetchableInstance);
|
2078 |
|
2079 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
2080 |
|
2081 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
2082 |
|
2083 | var FetchableInstanceFactory = function () {
|
2084 | function FetchableInstanceFactory() {
|
2085 | _classCallCheck(this, FetchableInstanceFactory);
|
2086 |
|
2087 | this._dataFetchInstanceCache = new Map();
|
2088 | }
|
2089 |
|
2090 | _createClass(FetchableInstanceFactory, [{
|
2091 | key: 'getFetchableInstance',
|
2092 | value: function getFetchableInstance(FetchClass) {
|
2093 | var construct = true;
|
2094 | if (FetchClass.KeyProperty != null && typeof FetchClass.KeyProperty !== 'undefined') {
|
2095 | if (FetchClass.EnableCache === true) {
|
2096 | if (this._dataFetchInstanceCache.get(FetchClass.Key) != null && typeof FetchClass.Key !== 'undefined') {
|
2097 | construct = false;
|
2098 | }
|
2099 | }
|
2100 | }
|
2101 | if (construct) {
|
2102 | var fetchableInstance = new _FetchableInstance2.default(FetchClass);
|
2103 | this._dataFetchInstanceCache.set(FetchClass.KeyProperty, fetchableInstance);
|
2104 | return fetchableInstance;
|
2105 | } else {
|
2106 | return this._dataFetchInstanceCache.get(FetchClass.Key);
|
2107 | }
|
2108 | }
|
2109 | }]);
|
2110 |
|
2111 | return FetchableInstanceFactory;
|
2112 | }();
|
2113 |
|
2114 | exports.default = FetchableInstanceFactory;
|
2115 | module.exports = exports['default'];
|
2116 |
|
2117 | }),
|
2118 |
|
2119 | (function(module, exports, __webpack_require__) {
|
2120 |
|
2121 | "use strict";
|
2122 |
|
2123 |
|
2124 | Object.defineProperty(exports, "__esModule", {
|
2125 | value: true
|
2126 | });
|
2127 |
|
2128 | 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; }; }();
|
2129 |
|
2130 | var _Validator2 = __webpack_require__(0);
|
2131 |
|
2132 | var _Validator3 = _interopRequireDefault(_Validator2);
|
2133 |
|
2134 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
2135 |
|
2136 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
2137 |
|
2138 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
2139 |
|
2140 | 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; }
|
2141 |
|
2142 | var AlphanumericValidator = function (_Validator) {
|
2143 | _inherits(AlphanumericValidator, _Validator);
|
2144 |
|
2145 | function AlphanumericValidator(field, display, option) {
|
2146 | _classCallCheck(this, AlphanumericValidator);
|
2147 |
|
2148 | var _this = _possibleConstructorReturn(this, (AlphanumericValidator.__proto__ || Object.getPrototypeOf(AlphanumericValidator)).call(this));
|
2149 |
|
2150 | _this._alphaNumericRegex = /^\w+$/;
|
2151 | return _this;
|
2152 | }
|
2153 |
|
2154 | _createClass(AlphanumericValidator, [{
|
2155 | key: 'apply',
|
2156 | value: function apply(field, value) {
|
2157 | var valid = this._alphaNumericRegex.test(value);
|
2158 | if (valid) {
|
2159 | return {
|
2160 | valid: true,
|
2161 | message: ''
|
2162 | };
|
2163 | } else {
|
2164 | return {
|
2165 | valid: false,
|
2166 | message: field.getDisplay() + ' hanya bisa berisikan angka, huruf, dan _.'
|
2167 | };
|
2168 | }
|
2169 | }
|
2170 | }, {
|
2171 | key: 'configure',
|
2172 | value: function configure(option) {}
|
2173 | }], [{
|
2174 | key: 'create',
|
2175 | value: function create(option) {
|
2176 | var instance = new AlphanumericValidator();
|
2177 | instance.configure(option);
|
2178 | return instance;
|
2179 | }
|
2180 | }]);
|
2181 |
|
2182 | return AlphanumericValidator;
|
2183 | }(_Validator3.default);
|
2184 |
|
2185 | exports.default = AlphanumericValidator;
|
2186 | module.exports = exports['default'];
|
2187 |
|
2188 | }),
|
2189 |
|
2190 | (function(module, exports, __webpack_require__) {
|
2191 |
|
2192 | "use strict";
|
2193 |
|
2194 |
|
2195 | Object.defineProperty(exports, "__esModule", {
|
2196 | value: true
|
2197 | });
|
2198 |
|
2199 | 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; }; }();
|
2200 |
|
2201 | var _Validator2 = __webpack_require__(0);
|
2202 |
|
2203 | var _Validator3 = _interopRequireDefault(_Validator2);
|
2204 |
|
2205 | var _moment = __webpack_require__(1);
|
2206 |
|
2207 | var _moment2 = _interopRequireDefault(_moment);
|
2208 |
|
2209 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
2210 |
|
2211 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
2212 |
|
2213 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
2214 |
|
2215 | 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; }
|
2216 |
|
2217 | var DateGreaterThanValidator = function (_Validator) {
|
2218 | _inherits(DateGreaterThanValidator, _Validator);
|
2219 |
|
2220 | function DateGreaterThanValidator() {
|
2221 | _classCallCheck(this, DateGreaterThanValidator);
|
2222 |
|
2223 | var _this = _possibleConstructorReturn(this, (DateGreaterThanValidator.__proto__ || Object.getPrototypeOf(DateGreaterThanValidator)).call(this));
|
2224 |
|
2225 | _this._target = null;
|
2226 | return _this;
|
2227 | }
|
2228 |
|
2229 | _createClass(DateGreaterThanValidator, [{
|
2230 | key: 'apply',
|
2231 | value: function apply(field, value) {
|
2232 | var model = field.getModel();
|
2233 | var targetField = model[this._target];
|
2234 | if (value == null || targetField.getValue() == null) {
|
2235 | return {
|
2236 | valid: false,
|
2237 | message: 'Tanggal ' + field.getDisplay() + ' harus lebih besar dari tanggal ' + targetField.getDisplay() + ' dan kedua tanggal tidak boleh kosong.'
|
2238 | };
|
2239 | } else {
|
2240 | var fieldMomentValue = (0, _moment2.default)(value);
|
2241 | var targetFieldMomentValue = (0, _moment2.default)(targetField.getValue());
|
2242 | var diff = targetFieldMomentValue.diff(fieldMomentValue, 'days');
|
2243 | if (diff < 0) {
|
2244 | return {
|
2245 | valid: true,
|
2246 | message: ''
|
2247 | };
|
2248 | } else {
|
2249 | return {
|
2250 | valid: false,
|
2251 | message: 'Tanggal ' + field.getDisplay() + ' harus lebih besar dari tanggal ' + targetField.getDisplay() + '.'
|
2252 | };
|
2253 | }
|
2254 | }
|
2255 | }
|
2256 | }, {
|
2257 | key: 'configure',
|
2258 | value: function configure(option) {
|
2259 | if (option != null && typeof option !== 'undefined') {
|
2260 | this._target = option.target;
|
2261 | }
|
2262 | }
|
2263 | }], [{
|
2264 | key: 'create',
|
2265 | value: function create(option) {
|
2266 | var instance = new DateGreaterThanValidator();
|
2267 | instance.configure(option);
|
2268 | return instance;
|
2269 | }
|
2270 | }]);
|
2271 |
|
2272 | return DateGreaterThanValidator;
|
2273 | }(_Validator3.default);
|
2274 |
|
2275 | exports.default = DateGreaterThanValidator;
|
2276 | module.exports = exports['default'];
|
2277 |
|
2278 | }),
|
2279 |
|
2280 | (function(module, exports, __webpack_require__) {
|
2281 |
|
2282 | "use strict";
|
2283 |
|
2284 |
|
2285 | Object.defineProperty(exports, "__esModule", {
|
2286 | value: true
|
2287 | });
|
2288 |
|
2289 | 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; }; }();
|
2290 |
|
2291 | var _Validator2 = __webpack_require__(0);
|
2292 |
|
2293 | var _Validator3 = _interopRequireDefault(_Validator2);
|
2294 |
|
2295 | var _moment = __webpack_require__(1);
|
2296 |
|
2297 | var _moment2 = _interopRequireDefault(_moment);
|
2298 |
|
2299 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
2300 |
|
2301 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
2302 |
|
2303 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
2304 |
|
2305 | 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; }
|
2306 |
|
2307 | var DateLesserThanValidator = function (_Validator) {
|
2308 | _inherits(DateLesserThanValidator, _Validator);
|
2309 |
|
2310 | function DateLesserThanValidator() {
|
2311 | _classCallCheck(this, DateLesserThanValidator);
|
2312 |
|
2313 | var _this = _possibleConstructorReturn(this, (DateLesserThanValidator.__proto__ || Object.getPrototypeOf(DateLesserThanValidator)).call(this));
|
2314 |
|
2315 | _this._target = null;
|
2316 | return _this;
|
2317 | }
|
2318 |
|
2319 | _createClass(DateLesserThanValidator, [{
|
2320 | key: 'apply',
|
2321 | value: function apply(field, value) {
|
2322 | var model = field.getModel();
|
2323 | var targetField = model[this._target];
|
2324 | if (value == null || targetField.getValue() == null) {
|
2325 | return {
|
2326 | valid: false,
|
2327 | message: 'Tanggal ' + field.getDisplay() + ' harus lebih kecil dari tanggal ' + targetField.getDisplay() + ' dan kedua tanggal tidak boleh kosong.'
|
2328 | };
|
2329 | } else {
|
2330 | var fieldMomentValue = (0, _moment2.default)(value);
|
2331 | var targetFieldMomentValue = (0, _moment2.default)(targetField.getValue());
|
2332 | var diff = fieldMomentValue.diff(targetFieldMomentValue, 'days');
|
2333 | if (diff < 0) {
|
2334 | return {
|
2335 | valid: true,
|
2336 | message: ''
|
2337 | };
|
2338 | } else {
|
2339 | return {
|
2340 | valid: false,
|
2341 | message: 'Tanggal ' + field.getDisplay() + ' harus lebih kecil dari tanggal ' + targetField.getDisplay() + '.'
|
2342 | };
|
2343 | }
|
2344 | }
|
2345 | }
|
2346 | }, {
|
2347 | key: 'configure',
|
2348 | value: function configure(option) {
|
2349 | if (option != null && typeof option !== 'undefined') {
|
2350 | this._target = option.target;
|
2351 | }
|
2352 | }
|
2353 | }], [{
|
2354 | key: 'create',
|
2355 | value: function create(option) {
|
2356 | var instance = new DateLesserThanValidator();
|
2357 | instance.configure(option);
|
2358 | return instance;
|
2359 | }
|
2360 | }]);
|
2361 |
|
2362 | return DateLesserThanValidator;
|
2363 | }(_Validator3.default);
|
2364 |
|
2365 | exports.default = DateLesserThanValidator;
|
2366 | module.exports = exports['default'];
|
2367 |
|
2368 | }),
|
2369 |
|
2370 | (function(module, exports, __webpack_require__) {
|
2371 |
|
2372 | "use strict";
|
2373 |
|
2374 |
|
2375 | Object.defineProperty(exports, "__esModule", {
|
2376 | value: true
|
2377 | });
|
2378 |
|
2379 | 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; }; }();
|
2380 |
|
2381 | var _Validator2 = __webpack_require__(0);
|
2382 |
|
2383 | var _Validator3 = _interopRequireDefault(_Validator2);
|
2384 |
|
2385 | var _moment = __webpack_require__(1);
|
2386 |
|
2387 | var _moment2 = _interopRequireDefault(_moment);
|
2388 |
|
2389 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
2390 |
|
2391 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
2392 |
|
2393 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
2394 |
|
2395 | 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; }
|
2396 |
|
2397 | var DateValidator = function (_Validator) {
|
2398 | _inherits(DateValidator, _Validator);
|
2399 |
|
2400 | function DateValidator(field, display, option) {
|
2401 | _classCallCheck(this, DateValidator);
|
2402 |
|
2403 | var _this = _possibleConstructorReturn(this, (DateValidator.__proto__ || Object.getPrototypeOf(DateValidator)).call(this));
|
2404 |
|
2405 | _this._dateFormatRegex = /^\d{4}-\d{2}-\d{2}$/;
|
2406 | return _this;
|
2407 | }
|
2408 |
|
2409 | _createClass(DateValidator, [{
|
2410 | key: 'apply',
|
2411 | value: function apply(field, value) {
|
2412 | if (value == null) {
|
2413 | return {
|
2414 | valid: false,
|
2415 | message: field.getDisplay() + ' bukan merupakan tanggal yang valid.'
|
2416 | };
|
2417 | } else {
|
2418 | var momentValue = (0, _moment2.default)(value).format('YYYY-MM-DD');
|
2419 | var valid = this._dateFormatRegex.test(momentValue);
|
2420 | if (valid) {
|
2421 | return {
|
2422 | valid: true,
|
2423 | message: ''
|
2424 | };
|
2425 | } else {
|
2426 | return {
|
2427 | valid: false,
|
2428 | message: field.getDisplay() + ' bukan merupakan tanggal yang valid.'
|
2429 | };
|
2430 | }
|
2431 | }
|
2432 | }
|
2433 | }, {
|
2434 | key: 'configure',
|
2435 | value: function configure(option) {}
|
2436 | }], [{
|
2437 | key: 'create',
|
2438 | value: function create(option) {
|
2439 | var instance = new DateValidator();
|
2440 | instance.configure(option);
|
2441 | return instance;
|
2442 | }
|
2443 | }]);
|
2444 |
|
2445 | return DateValidator;
|
2446 | }(_Validator3.default);
|
2447 |
|
2448 | exports.default = DateValidator;
|
2449 | module.exports = exports['default'];
|
2450 |
|
2451 | }),
|
2452 |
|
2453 | (function(module, exports, __webpack_require__) {
|
2454 |
|
2455 | "use strict";
|
2456 |
|
2457 |
|
2458 | Object.defineProperty(exports, "__esModule", {
|
2459 | value: true
|
2460 | });
|
2461 |
|
2462 | 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; }; }();
|
2463 |
|
2464 | var _Validator2 = __webpack_require__(0);
|
2465 |
|
2466 | var _Validator3 = _interopRequireDefault(_Validator2);
|
2467 |
|
2468 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
2469 |
|
2470 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
2471 |
|
2472 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
2473 |
|
2474 | 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; }
|
2475 |
|
2476 | var EmailValidator = function (_Validator) {
|
2477 | _inherits(EmailValidator, _Validator);
|
2478 |
|
2479 | function EmailValidator() {
|
2480 | _classCallCheck(this, EmailValidator);
|
2481 |
|
2482 | var _this = _possibleConstructorReturn(this, (EmailValidator.__proto__ || Object.getPrototypeOf(EmailValidator)).call(this));
|
2483 |
|
2484 | _this._emailRegex = /^(([^<>()\[\]\.,;:\s@\"]+(\.[^<>()\[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})$/i;
|
2485 | return _this;
|
2486 | }
|
2487 |
|
2488 | _createClass(EmailValidator, [{
|
2489 | key: 'apply',
|
2490 | value: function apply(field, value) {
|
2491 | var valid = this._emailRegex.test(value);
|
2492 | if (valid) {
|
2493 | return {
|
2494 | valid: true,
|
2495 | message: ''
|
2496 | };
|
2497 | } else {
|
2498 | return {
|
2499 | valid: false,
|
2500 | message: field.getDisplay() + ' bukan merupakan email yang valid.'
|
2501 | };
|
2502 | }
|
2503 | }
|
2504 | }, {
|
2505 | key: 'configure',
|
2506 | value: function configure(option) {}
|
2507 | }], [{
|
2508 | key: 'create',
|
2509 | value: function create(option) {
|
2510 | var instance = new EmailValidator();
|
2511 | instance.configure(option);
|
2512 | return instance;
|
2513 | }
|
2514 | }]);
|
2515 |
|
2516 | return EmailValidator;
|
2517 | }(_Validator3.default);
|
2518 |
|
2519 | exports.default = EmailValidator;
|
2520 | module.exports = exports['default'];
|
2521 |
|
2522 | }),
|
2523 |
|
2524 | (function(module, exports, __webpack_require__) {
|
2525 |
|
2526 | "use strict";
|
2527 |
|
2528 |
|
2529 | Object.defineProperty(exports, "__esModule", {
|
2530 | value: true
|
2531 | });
|
2532 |
|
2533 | 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; }; }();
|
2534 |
|
2535 | var _Validator2 = __webpack_require__(0);
|
2536 |
|
2537 | var _Validator3 = _interopRequireDefault(_Validator2);
|
2538 |
|
2539 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
2540 |
|
2541 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
2542 |
|
2543 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
2544 |
|
2545 | 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; }
|
2546 |
|
2547 | var LengthRangeValidator = function (_Validator) {
|
2548 | _inherits(LengthRangeValidator, _Validator);
|
2549 |
|
2550 | function LengthRangeValidator() {
|
2551 | _classCallCheck(this, LengthRangeValidator);
|
2552 |
|
2553 | var _this = _possibleConstructorReturn(this, (LengthRangeValidator.__proto__ || Object.getPrototypeOf(LengthRangeValidator)).call(this));
|
2554 |
|
2555 | _this._min = 0;
|
2556 | _this._max = 1024;
|
2557 | return _this;
|
2558 | }
|
2559 |
|
2560 | _createClass(LengthRangeValidator, [{
|
2561 | key: 'apply',
|
2562 | value: function apply(field, value) {
|
2563 | if (value != null && typeof value !== 'undefined') {
|
2564 | if (value.length >= this._min && value.length <= this._max) {
|
2565 | return {
|
2566 | valid: true,
|
2567 | message: ''
|
2568 | };
|
2569 | } else {
|
2570 | return {
|
2571 | valid: false,
|
2572 | message: field.getDisplay() + ' harus memiliki panjang ' + this._min + '-' + this._max + ' karakter.'
|
2573 | };
|
2574 | }
|
2575 | } else {
|
2576 | return {
|
2577 | valid: false,
|
2578 | message: field.getDisplay() + ' harus memiliki panjang ' + this._min + '-' + this._max + ' karakter.'
|
2579 | };
|
2580 | }
|
2581 | }
|
2582 | }, {
|
2583 | key: 'configure',
|
2584 | value: function configure(option) {
|
2585 | if (option != null && typeof option !== 'undefined') {
|
2586 | this._max = option.max;
|
2587 | this._min = option.min;
|
2588 | }
|
2589 | }
|
2590 | }], [{
|
2591 | key: 'create',
|
2592 | value: function create(option) {
|
2593 | var instance = new LengthRangeValidator();
|
2594 | instance.configure(option);
|
2595 | return instance;
|
2596 | }
|
2597 | }]);
|
2598 |
|
2599 | return LengthRangeValidator;
|
2600 | }(_Validator3.default);
|
2601 |
|
2602 | exports.default = LengthRangeValidator;
|
2603 | module.exports = exports['default'];
|
2604 |
|
2605 | }),
|
2606 |
|
2607 | (function(module, exports, __webpack_require__) {
|
2608 |
|
2609 | "use strict";
|
2610 |
|
2611 |
|
2612 | Object.defineProperty(exports, "__esModule", {
|
2613 | value: true
|
2614 | });
|
2615 |
|
2616 | 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; }; }();
|
2617 |
|
2618 | var _Validator2 = __webpack_require__(0);
|
2619 |
|
2620 | var _Validator3 = _interopRequireDefault(_Validator2);
|
2621 |
|
2622 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
2623 |
|
2624 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
2625 |
|
2626 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
2627 |
|
2628 | 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; }
|
2629 |
|
2630 | var MatchValidator = function (_Validator) {
|
2631 | _inherits(MatchValidator, _Validator);
|
2632 |
|
2633 | function MatchValidator() {
|
2634 | _classCallCheck(this, MatchValidator);
|
2635 |
|
2636 | var _this = _possibleConstructorReturn(this, (MatchValidator.__proto__ || Object.getPrototypeOf(MatchValidator)).call(this));
|
2637 |
|
2638 | _this._target = null;
|
2639 | return _this;
|
2640 | }
|
2641 |
|
2642 | _createClass(MatchValidator, [{
|
2643 | key: 'apply',
|
2644 | value: function apply(field, value) {
|
2645 | var model = field.getModel();
|
2646 | var targetField = model[this._target];
|
2647 | if (targetField.getValue() === value) {
|
2648 | return {
|
2649 | valid: true,
|
2650 | message: ''
|
2651 | };
|
2652 | } else {
|
2653 | return {
|
2654 | valid: false,
|
2655 | message: field.getDisplay() + ' harus memiliki nilai yang sama dengan ' + targetField.getDisplay() + '.'
|
2656 | };
|
2657 | }
|
2658 | }
|
2659 | }, {
|
2660 | key: 'configure',
|
2661 | value: function configure(option) {
|
2662 | if (option != null && typeof option !== 'undefined') {
|
2663 | this._target = option.target;
|
2664 | }
|
2665 | }
|
2666 | }], [{
|
2667 | key: 'create',
|
2668 | value: function create(option) {
|
2669 | var instance = new MatchValidator();
|
2670 | instance.configure(option);
|
2671 | return instance;
|
2672 | }
|
2673 | }]);
|
2674 |
|
2675 | return MatchValidator;
|
2676 | }(_Validator3.default);
|
2677 |
|
2678 | exports.default = MatchValidator;
|
2679 | module.exports = exports['default'];
|
2680 |
|
2681 | }),
|
2682 |
|
2683 | (function(module, exports, __webpack_require__) {
|
2684 |
|
2685 | "use strict";
|
2686 |
|
2687 |
|
2688 | Object.defineProperty(exports, "__esModule", {
|
2689 | value: true
|
2690 | });
|
2691 |
|
2692 | 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; }; }();
|
2693 |
|
2694 | var _Validator2 = __webpack_require__(0);
|
2695 |
|
2696 | var _Validator3 = _interopRequireDefault(_Validator2);
|
2697 |
|
2698 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
2699 |
|
2700 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
2701 |
|
2702 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
2703 |
|
2704 | 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; }
|
2705 |
|
2706 | var NumberGreaterThanValidator = function (_Validator) {
|
2707 | _inherits(NumberGreaterThanValidator, _Validator);
|
2708 |
|
2709 | function NumberGreaterThanValidator() {
|
2710 | _classCallCheck(this, NumberGreaterThanValidator);
|
2711 |
|
2712 | var _this = _possibleConstructorReturn(this, (NumberGreaterThanValidator.__proto__ || Object.getPrototypeOf(NumberGreaterThanValidator)).call(this));
|
2713 |
|
2714 | _this._minValue = -2147483645;
|
2715 | return _this;
|
2716 | }
|
2717 |
|
2718 | _createClass(NumberGreaterThanValidator, [{
|
2719 | key: 'apply',
|
2720 | value: function apply(field, value) {
|
2721 | if (value == null || value === '') {
|
2722 | return {
|
2723 | valid: false,
|
2724 | message: field.getDisplay() + ' harus berisikan angka dan tidak boleh kosong.'
|
2725 | };
|
2726 | } else {
|
2727 | if (value > this._minValue) {
|
2728 | return {
|
2729 | valid: true,
|
2730 | message: ''
|
2731 | };
|
2732 | } else {
|
2733 | return {
|
2734 | valid: false,
|
2735 | message: field.getDisplay() + ' harus lebih besar dari ' + this._minValue + '.'
|
2736 | };
|
2737 | }
|
2738 | }
|
2739 | }
|
2740 | }, {
|
2741 | key: 'configure',
|
2742 | value: function configure(option) {
|
2743 | if (option != null && typeof option !== 'undefined') {
|
2744 | this._minValue = option.minValue;
|
2745 | }
|
2746 | }
|
2747 | }], [{
|
2748 | key: 'create',
|
2749 | value: function create(option) {
|
2750 | var instance = new NumberGreaterThanValidator();
|
2751 | instance.configure(option);
|
2752 | return instance;
|
2753 | }
|
2754 | }]);
|
2755 |
|
2756 | return NumberGreaterThanValidator;
|
2757 | }(_Validator3.default);
|
2758 |
|
2759 | exports.default = NumberGreaterThanValidator;
|
2760 | module.exports = exports['default'];
|
2761 |
|
2762 | }),
|
2763 |
|
2764 | (function(module, exports, __webpack_require__) {
|
2765 |
|
2766 | "use strict";
|
2767 |
|
2768 |
|
2769 | Object.defineProperty(exports, "__esModule", {
|
2770 | value: true
|
2771 | });
|
2772 |
|
2773 | 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; }; }();
|
2774 |
|
2775 | var _Validator2 = __webpack_require__(0);
|
2776 |
|
2777 | var _Validator3 = _interopRequireDefault(_Validator2);
|
2778 |
|
2779 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
2780 |
|
2781 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
2782 |
|
2783 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
2784 |
|
2785 | 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; }
|
2786 |
|
2787 | var NumberLesserThanValidator = function (_Validator) {
|
2788 | _inherits(NumberLesserThanValidator, _Validator);
|
2789 |
|
2790 | function NumberLesserThanValidator() {
|
2791 | _classCallCheck(this, NumberLesserThanValidator);
|
2792 |
|
2793 | var _this = _possibleConstructorReturn(this, (NumberLesserThanValidator.__proto__ || Object.getPrototypeOf(NumberLesserThanValidator)).call(this));
|
2794 |
|
2795 | _this._maxValue = 2147483645;
|
2796 | return _this;
|
2797 | }
|
2798 |
|
2799 | _createClass(NumberLesserThanValidator, [{
|
2800 | key: 'apply',
|
2801 | value: function apply(field, value) {
|
2802 | if (value == null || value === '') {
|
2803 | return {
|
2804 | valid: false,
|
2805 | message: field.getDisplay() + ' harus berisikan angka dan tidak boleh kosong.'
|
2806 | };
|
2807 | } else {
|
2808 | if (value < this._maxValue) {
|
2809 | return {
|
2810 | valid: true,
|
2811 | message: ''
|
2812 | };
|
2813 | } else {
|
2814 | return {
|
2815 | valid: false,
|
2816 | message: field.getDisplay() + ' harus lebih kecil dari ' + this._maxValue + '.'
|
2817 | };
|
2818 | }
|
2819 | }
|
2820 | }
|
2821 | }, {
|
2822 | key: 'configure',
|
2823 | value: function configure(option) {
|
2824 | if (option != null && typeof option !== 'undefined') {
|
2825 | this._maxValue = option.maxValue;
|
2826 | }
|
2827 | }
|
2828 | }], [{
|
2829 | key: 'create',
|
2830 | value: function create(option) {
|
2831 | var instance = new NumberLesserThanValidator();
|
2832 | instance.configure(option);
|
2833 | return instance;
|
2834 | }
|
2835 | }]);
|
2836 |
|
2837 | return NumberLesserThanValidator;
|
2838 | }(_Validator3.default);
|
2839 |
|
2840 | exports.default = NumberLesserThanValidator;
|
2841 | module.exports = exports['default'];
|
2842 |
|
2843 | }),
|
2844 |
|
2845 | (function(module, exports, __webpack_require__) {
|
2846 |
|
2847 | "use strict";
|
2848 |
|
2849 |
|
2850 | Object.defineProperty(exports, "__esModule", {
|
2851 | value: true
|
2852 | });
|
2853 |
|
2854 | 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; }; }();
|
2855 |
|
2856 | var _Validator2 = __webpack_require__(0);
|
2857 |
|
2858 | var _Validator3 = _interopRequireDefault(_Validator2);
|
2859 |
|
2860 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
2861 |
|
2862 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
2863 |
|
2864 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
2865 |
|
2866 | 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; }
|
2867 |
|
2868 | var NumberValidator = function (_Validator) {
|
2869 | _inherits(NumberValidator, _Validator);
|
2870 |
|
2871 | function NumberValidator() {
|
2872 | _classCallCheck(this, NumberValidator);
|
2873 |
|
2874 | var _this = _possibleConstructorReturn(this, (NumberValidator.__proto__ || Object.getPrototypeOf(NumberValidator)).call(this));
|
2875 |
|
2876 | _this._numberRegex = /^-?[0-9]\d*(\.\d+)?$/i;
|
2877 | return _this;
|
2878 | }
|
2879 |
|
2880 | _createClass(NumberValidator, [{
|
2881 | key: 'apply',
|
2882 | value: function apply(field, value) {
|
2883 | var valid = this._numberRegex.test(value);
|
2884 | if (valid) {
|
2885 | return {
|
2886 | valid: true,
|
2887 | message: ''
|
2888 | };
|
2889 | } else {
|
2890 | return {
|
2891 | valid: false,
|
2892 | message: field.getDisplay() + ' hanya bisa berisikan angka.'
|
2893 | };
|
2894 | }
|
2895 | }
|
2896 | }, {
|
2897 | key: 'configure',
|
2898 | value: function configure(option) {}
|
2899 | }], [{
|
2900 | key: 'create',
|
2901 | value: function create(option) {
|
2902 | var instance = new NumberValidator();
|
2903 | instance.configure(option);
|
2904 | return instance;
|
2905 | }
|
2906 | }]);
|
2907 |
|
2908 | return NumberValidator;
|
2909 | }(_Validator3.default);
|
2910 |
|
2911 | exports.default = NumberValidator;
|
2912 | module.exports = exports['default'];
|
2913 |
|
2914 | }),
|
2915 |
|
2916 | (function(module, exports, __webpack_require__) {
|
2917 |
|
2918 | "use strict";
|
2919 |
|
2920 |
|
2921 | Object.defineProperty(exports, "__esModule", {
|
2922 | value: true
|
2923 | });
|
2924 |
|
2925 | 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; }; }();
|
2926 |
|
2927 | var _Validator2 = __webpack_require__(0);
|
2928 |
|
2929 | var _Validator3 = _interopRequireDefault(_Validator2);
|
2930 |
|
2931 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
2932 |
|
2933 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
2934 |
|
2935 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
2936 |
|
2937 | 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; }
|
2938 |
|
2939 | var ObjectRequiredValidator = function (_Validator) {
|
2940 | _inherits(ObjectRequiredValidator, _Validator);
|
2941 |
|
2942 | function ObjectRequiredValidator() {
|
2943 | _classCallCheck(this, ObjectRequiredValidator);
|
2944 |
|
2945 | return _possibleConstructorReturn(this, (ObjectRequiredValidator.__proto__ || Object.getPrototypeOf(ObjectRequiredValidator)).apply(this, arguments));
|
2946 | }
|
2947 |
|
2948 | _createClass(ObjectRequiredValidator, [{
|
2949 | key: 'apply',
|
2950 | value: function apply(field, value) {
|
2951 | if (value === null || typeof value === 'undefined') {
|
2952 | return {
|
2953 | valid: false,
|
2954 | message: field.getDisplay() + ' dibutuhkan'
|
2955 | };
|
2956 | } else {
|
2957 | if (value === '' || value.length === 0) {
|
2958 | return {
|
2959 | valid: false,
|
2960 | message: field.getDisplay() + ' dibutuhkan'
|
2961 | };
|
2962 | } else {
|
2963 | if (Object.keys(value).length > 0) {
|
2964 | return {
|
2965 | valid: true,
|
2966 | message: ''
|
2967 | };
|
2968 | } else {
|
2969 | return {
|
2970 | valid: false,
|
2971 | message: field.getDisplay() + ' dibutuhkan'
|
2972 | };
|
2973 | }
|
2974 | }
|
2975 | }
|
2976 | }
|
2977 | }, {
|
2978 | key: 'configure',
|
2979 | value: function configure(option) {}
|
2980 | }], [{
|
2981 | key: 'create',
|
2982 | value: function create(option) {
|
2983 | var instance = new ObjectRequiredValidator();
|
2984 | instance.configure(option);
|
2985 | return instance;
|
2986 | }
|
2987 | }]);
|
2988 |
|
2989 | return ObjectRequiredValidator;
|
2990 | }(_Validator3.default);
|
2991 |
|
2992 | exports.default = ObjectRequiredValidator;
|
2993 | module.exports = exports['default'];
|
2994 |
|
2995 | }),
|
2996 |
|
2997 | (function(module, exports, __webpack_require__) {
|
2998 |
|
2999 | "use strict";
|
3000 |
|
3001 |
|
3002 | Object.defineProperty(exports, "__esModule", {
|
3003 | value: true
|
3004 | });
|
3005 |
|
3006 | 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; }; }();
|
3007 |
|
3008 | var _Validator2 = __webpack_require__(0);
|
3009 |
|
3010 | var _Validator3 = _interopRequireDefault(_Validator2);
|
3011 |
|
3012 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
3013 |
|
3014 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
3015 |
|
3016 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
3017 |
|
3018 | 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; }
|
3019 |
|
3020 | var PhoneNumberValidator = function (_Validator) {
|
3021 | _inherits(PhoneNumberValidator, _Validator);
|
3022 |
|
3023 | function PhoneNumberValidator() {
|
3024 | _classCallCheck(this, PhoneNumberValidator);
|
3025 |
|
3026 | var _this = _possibleConstructorReturn(this, (PhoneNumberValidator.__proto__ || Object.getPrototypeOf(PhoneNumberValidator)).call(this));
|
3027 |
|
3028 | _this._phoneRegex = /^(?:(?:\(?(?:00|\+)([1-4]\d\d|[1-9]\d?)\)?)?[\-\.\ \\\/]?)?((?:\(?\d{1,}\)?[\-\.\ \\\/]?){0,})(?:[\-\.\ \\\/]?(?:#|ext\.?|extension|x)[\-\.\ \\\/]?(\d+))?$/i;
|
3029 | return _this;
|
3030 | }
|
3031 |
|
3032 | _createClass(PhoneNumberValidator, [{
|
3033 | key: 'apply',
|
3034 | value: function apply(field, value) {
|
3035 | var valid = this._phoneRegex.test(value);
|
3036 | if (valid) {
|
3037 | return {
|
3038 | valid: true,
|
3039 | message: ''
|
3040 | };
|
3041 | } else {
|
3042 | return {
|
3043 | valid: false,
|
3044 | message: field.getDisplay() + ' tidak berisikan nomor telepon yang valid.'
|
3045 | };
|
3046 | }
|
3047 | }
|
3048 | }, {
|
3049 | key: 'configure',
|
3050 | value: function configure(option) {}
|
3051 | }], [{
|
3052 | key: 'create',
|
3053 | value: function create(option) {
|
3054 | var instance = new PhoneNumberValidator();
|
3055 | instance.configure(option);
|
3056 | return instance;
|
3057 | }
|
3058 | }]);
|
3059 |
|
3060 | return PhoneNumberValidator;
|
3061 | }(_Validator3.default);
|
3062 |
|
3063 | exports.default = PhoneNumberValidator;
|
3064 | module.exports = exports['default'];
|
3065 |
|
3066 | }),
|
3067 |
|
3068 | (function(module, exports, __webpack_require__) {
|
3069 |
|
3070 | "use strict";
|
3071 |
|
3072 |
|
3073 | Object.defineProperty(exports, "__esModule", {
|
3074 | value: true
|
3075 | });
|
3076 |
|
3077 | 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; }; }();
|
3078 |
|
3079 | var _Validator2 = __webpack_require__(0);
|
3080 |
|
3081 | var _Validator3 = _interopRequireDefault(_Validator2);
|
3082 |
|
3083 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
3084 |
|
3085 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
3086 |
|
3087 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
3088 |
|
3089 | 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; }
|
3090 |
|
3091 | var RequiredValidator = function (_Validator) {
|
3092 | _inherits(RequiredValidator, _Validator);
|
3093 |
|
3094 | function RequiredValidator() {
|
3095 | _classCallCheck(this, RequiredValidator);
|
3096 |
|
3097 | return _possibleConstructorReturn(this, (RequiredValidator.__proto__ || Object.getPrototypeOf(RequiredValidator)).apply(this, arguments));
|
3098 | }
|
3099 |
|
3100 | _createClass(RequiredValidator, [{
|
3101 | key: 'apply',
|
3102 | value: function apply(field, value) {
|
3103 | if (value === null || typeof value === 'undefined') {
|
3104 | return {
|
3105 | valid: false,
|
3106 | message: field.getDisplay() + ' dibutuhkan'
|
3107 | };
|
3108 | } else {
|
3109 | if (value === '' || value.length === 0) {
|
3110 | return {
|
3111 | valid: false,
|
3112 | message: field.getDisplay() + ' dibutuhkan'
|
3113 | };
|
3114 | } else {
|
3115 | return {
|
3116 | valid: true,
|
3117 | message: ''
|
3118 | };
|
3119 | }
|
3120 | }
|
3121 | }
|
3122 | }, {
|
3123 | key: 'configure',
|
3124 | value: function configure(option) {}
|
3125 | }], [{
|
3126 | key: 'create',
|
3127 | value: function create(option) {
|
3128 | var instance = new RequiredValidator();
|
3129 | instance.configure(option);
|
3130 | return instance;
|
3131 | }
|
3132 | }]);
|
3133 |
|
3134 | return RequiredValidator;
|
3135 | }(_Validator3.default);
|
3136 |
|
3137 | exports.default = RequiredValidator;
|
3138 | module.exports = exports['default'];
|
3139 |
|
3140 | }),
|
3141 |
|
3142 | (function(module, exports, __webpack_require__) {
|
3143 |
|
3144 | "use strict";
|
3145 |
|
3146 |
|
3147 | Object.defineProperty(exports, "__esModule", {
|
3148 | value: true
|
3149 | });
|
3150 |
|
3151 | 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; }; }();
|
3152 |
|
3153 | var _Validator2 = __webpack_require__(0);
|
3154 |
|
3155 | var _Validator3 = _interopRequireDefault(_Validator2);
|
3156 |
|
3157 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
3158 |
|
3159 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
3160 |
|
3161 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
3162 |
|
3163 | 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; }
|
3164 |
|
3165 | var StrongPasswordValidator = function (_Validator) {
|
3166 | _inherits(StrongPasswordValidator, _Validator);
|
3167 |
|
3168 | function StrongPasswordValidator() {
|
3169 | _classCallCheck(this, StrongPasswordValidator);
|
3170 |
|
3171 | return _possibleConstructorReturn(this, (StrongPasswordValidator.__proto__ || Object.getPrototypeOf(StrongPasswordValidator)).apply(this, arguments));
|
3172 | }
|
3173 |
|
3174 | _createClass(StrongPasswordValidator, [{
|
3175 | key: 'apply',
|
3176 | value: function apply(value) {
|
3177 | return {
|
3178 | valid: false,
|
3179 | message: ''
|
3180 | };
|
3181 | }
|
3182 | }, {
|
3183 | key: 'configure',
|
3184 | value: function configure(option) {}
|
3185 | }], [{
|
3186 | key: 'create',
|
3187 | value: function create(option) {
|
3188 | var instance = new StrongPasswordValidator();
|
3189 | instance.configure(option);
|
3190 | return instance;
|
3191 | }
|
3192 | }]);
|
3193 |
|
3194 | return StrongPasswordValidator;
|
3195 | }(_Validator3.default);
|
3196 |
|
3197 | exports.default = StrongPasswordValidator;
|
3198 | module.exports = exports['default'];
|
3199 |
|
3200 | }),
|
3201 |
|
3202 | (function(module, exports, __webpack_require__) {
|
3203 |
|
3204 | "use strict";
|
3205 |
|
3206 |
|
3207 | Object.defineProperty(exports, "__esModule", {
|
3208 | value: true
|
3209 | });
|
3210 |
|
3211 | 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; }; }();
|
3212 |
|
3213 | var _Validator2 = __webpack_require__(0);
|
3214 |
|
3215 | var _Validator3 = _interopRequireDefault(_Validator2);
|
3216 |
|
3217 | var _moment = __webpack_require__(1);
|
3218 |
|
3219 | var _moment2 = _interopRequireDefault(_moment);
|
3220 |
|
3221 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
3222 |
|
3223 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
3224 |
|
3225 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
3226 |
|
3227 | 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; }
|
3228 |
|
3229 | var TimeGreaterThanOrEqualToValidator = function (_Validator) {
|
3230 | _inherits(TimeGreaterThanOrEqualToValidator, _Validator);
|
3231 |
|
3232 | function TimeGreaterThanOrEqualToValidator() {
|
3233 | _classCallCheck(this, TimeGreaterThanOrEqualToValidator);
|
3234 |
|
3235 | var _this = _possibleConstructorReturn(this, (TimeGreaterThanOrEqualToValidator.__proto__ || Object.getPrototypeOf(TimeGreaterThanOrEqualToValidator)).call(this));
|
3236 |
|
3237 | _this._target = null;
|
3238 | return _this;
|
3239 | }
|
3240 |
|
3241 | _createClass(TimeGreaterThanOrEqualToValidator, [{
|
3242 | key: 'apply',
|
3243 | value: function apply(field, value) {
|
3244 | var model = field.getModel();
|
3245 | var targetField = model[this._target];
|
3246 | if (value == null || targetField.getValue() == null) {
|
3247 | return {
|
3248 | valid: true,
|
3249 | message: ''
|
3250 | };
|
3251 | }
|
3252 | var fieldMomentValue = (0, _moment2.default)(value);
|
3253 | var targetFieldMomentValue = (0, _moment2.default)(targetField.getValue());
|
3254 | var diff = fieldMomentValue.diff(targetFieldMomentValue, 'milliseconds');
|
3255 | if (diff >= 0) {
|
3256 | return {
|
3257 | valid: true,
|
3258 | message: ''
|
3259 | };
|
3260 | }
|
3261 | return {
|
3262 | valid: false,
|
3263 | message: 'Waktu ' + field.getDisplay() + ' harus lebih besar atau sama dengan waktu ' + targetField.getDisplay() + '.'
|
3264 | };
|
3265 | }
|
3266 | }, {
|
3267 | key: 'configure',
|
3268 | value: function configure(option) {
|
3269 | if (option != null && typeof option !== 'undefined') {
|
3270 | this._target = option.target;
|
3271 | }
|
3272 | }
|
3273 | }], [{
|
3274 | key: 'create',
|
3275 | value: function create(option) {
|
3276 | var instance = new TimeGreaterThanOrEqualToValidator();
|
3277 | instance.configure(option);
|
3278 | return instance;
|
3279 | }
|
3280 | }]);
|
3281 |
|
3282 | return TimeGreaterThanOrEqualToValidator;
|
3283 | }(_Validator3.default);
|
3284 |
|
3285 | exports.default = TimeGreaterThanOrEqualToValidator;
|
3286 | module.exports = exports['default'];
|
3287 |
|
3288 | }),
|
3289 |
|
3290 | (function(module, exports, __webpack_require__) {
|
3291 |
|
3292 | "use strict";
|
3293 |
|
3294 |
|
3295 | Object.defineProperty(exports, "__esModule", {
|
3296 | value: true
|
3297 | });
|
3298 |
|
3299 | 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; }; }();
|
3300 |
|
3301 | var _Validator2 = __webpack_require__(0);
|
3302 |
|
3303 | var _Validator3 = _interopRequireDefault(_Validator2);
|
3304 |
|
3305 | var _moment = __webpack_require__(1);
|
3306 |
|
3307 | var _moment2 = _interopRequireDefault(_moment);
|
3308 |
|
3309 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
3310 |
|
3311 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
3312 |
|
3313 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
3314 |
|
3315 | 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; }
|
3316 |
|
3317 | var TimeGreaterThanValidator = function (_Validator) {
|
3318 | _inherits(TimeGreaterThanValidator, _Validator);
|
3319 |
|
3320 | function TimeGreaterThanValidator() {
|
3321 | _classCallCheck(this, TimeGreaterThanValidator);
|
3322 |
|
3323 | var _this = _possibleConstructorReturn(this, (TimeGreaterThanValidator.__proto__ || Object.getPrototypeOf(TimeGreaterThanValidator)).call(this));
|
3324 |
|
3325 | _this._target = null;
|
3326 | return _this;
|
3327 | }
|
3328 |
|
3329 | _createClass(TimeGreaterThanValidator, [{
|
3330 | key: 'apply',
|
3331 | value: function apply(field, value) {
|
3332 | var model = field.getModel();
|
3333 | var targetField = model[this._target];
|
3334 | if (value == null || targetField.getValue() == null) {
|
3335 | return {
|
3336 | valid: true,
|
3337 | message: ''
|
3338 | };
|
3339 | }
|
3340 | var fieldMomentValue = (0, _moment2.default)(value);
|
3341 | var targetFieldMomentValue = (0, _moment2.default)(targetField.getValue());
|
3342 | var diff = fieldMomentValue.diff(targetFieldMomentValue, 'milliseconds');
|
3343 | if (diff > 0) {
|
3344 | return {
|
3345 | valid: true,
|
3346 | message: ''
|
3347 | };
|
3348 | }
|
3349 | return {
|
3350 | valid: false,
|
3351 | message: 'Waktu ' + field.getDisplay() + ' harus lebih besar dari waktu ' + targetField.getDisplay() + '.'
|
3352 | };
|
3353 | }
|
3354 | }, {
|
3355 | key: 'configure',
|
3356 | value: function configure(option) {
|
3357 | if (option != null && typeof option !== 'undefined') {
|
3358 | this._target = option.target;
|
3359 | }
|
3360 | }
|
3361 | }], [{
|
3362 | key: 'create',
|
3363 | value: function create(option) {
|
3364 | var instance = new TimeGreaterThanValidator();
|
3365 | instance.configure(option);
|
3366 | return instance;
|
3367 | }
|
3368 | }]);
|
3369 |
|
3370 | return TimeGreaterThanValidator;
|
3371 | }(_Validator3.default);
|
3372 |
|
3373 | exports.default = TimeGreaterThanValidator;
|
3374 | module.exports = exports['default'];
|
3375 |
|
3376 | }),
|
3377 |
|
3378 | (function(module, exports, __webpack_require__) {
|
3379 |
|
3380 | "use strict";
|
3381 |
|
3382 |
|
3383 | Object.defineProperty(exports, "__esModule", {
|
3384 | value: true
|
3385 | });
|
3386 |
|
3387 | 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; }; }();
|
3388 |
|
3389 | var _Validator2 = __webpack_require__(0);
|
3390 |
|
3391 | var _Validator3 = _interopRequireDefault(_Validator2);
|
3392 |
|
3393 | var _moment = __webpack_require__(1);
|
3394 |
|
3395 | var _moment2 = _interopRequireDefault(_moment);
|
3396 |
|
3397 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
3398 |
|
3399 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
3400 |
|
3401 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
3402 |
|
3403 | 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; }
|
3404 |
|
3405 | var TimeLessThanOrEqualToValidator = function (_Validator) {
|
3406 | _inherits(TimeLessThanOrEqualToValidator, _Validator);
|
3407 |
|
3408 | function TimeLessThanOrEqualToValidator() {
|
3409 | _classCallCheck(this, TimeLessThanOrEqualToValidator);
|
3410 |
|
3411 | var _this = _possibleConstructorReturn(this, (TimeLessThanOrEqualToValidator.__proto__ || Object.getPrototypeOf(TimeLessThanOrEqualToValidator)).call(this));
|
3412 |
|
3413 | _this._target = null;
|
3414 | return _this;
|
3415 | }
|
3416 |
|
3417 | _createClass(TimeLessThanOrEqualToValidator, [{
|
3418 | key: 'apply',
|
3419 | value: function apply(field, value) {
|
3420 | var model = field.getModel();
|
3421 | var targetField = model[this._target];
|
3422 | if (value == null || targetField.getValue() == null) {
|
3423 | return {
|
3424 | valid: true,
|
3425 | message: ''
|
3426 | };
|
3427 | }
|
3428 | var fieldMomentValue = (0, _moment2.default)(value);
|
3429 | var targetFieldMomentValue = (0, _moment2.default)(targetField.getValue());
|
3430 | var diff = fieldMomentValue.diff(targetFieldMomentValue, 'milliseconds');
|
3431 | if (diff <= 0) {
|
3432 | return {
|
3433 | valid: true,
|
3434 | message: ''
|
3435 | };
|
3436 | }
|
3437 | return {
|
3438 | valid: false,
|
3439 | message: 'Waktu ' + field.getDisplay() + ' harus lebih kecil dari atau sama dengan waktu ' + targetField.getDisplay() + '.'
|
3440 | };
|
3441 | }
|
3442 | }, {
|
3443 | key: 'configure',
|
3444 | value: function configure(option) {
|
3445 | if (option != null && typeof option !== 'undefined') {
|
3446 | this._target = option.target;
|
3447 | }
|
3448 | }
|
3449 | }], [{
|
3450 | key: 'create',
|
3451 | value: function create(option) {
|
3452 | var instance = new TimeLessThanOrEqualToValidator();
|
3453 | instance.configure(option);
|
3454 | return instance;
|
3455 | }
|
3456 | }]);
|
3457 |
|
3458 | return TimeLessThanOrEqualToValidator;
|
3459 | }(_Validator3.default);
|
3460 |
|
3461 | exports.default = TimeLessThanOrEqualToValidator;
|
3462 | module.exports = exports['default'];
|
3463 |
|
3464 | }),
|
3465 |
|
3466 | (function(module, exports, __webpack_require__) {
|
3467 |
|
3468 | "use strict";
|
3469 |
|
3470 |
|
3471 | Object.defineProperty(exports, "__esModule", {
|
3472 | value: true
|
3473 | });
|
3474 |
|
3475 | 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; }; }();
|
3476 |
|
3477 | var _Validator2 = __webpack_require__(0);
|
3478 |
|
3479 | var _Validator3 = _interopRequireDefault(_Validator2);
|
3480 |
|
3481 | var _moment = __webpack_require__(1);
|
3482 |
|
3483 | var _moment2 = _interopRequireDefault(_moment);
|
3484 |
|
3485 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
3486 |
|
3487 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
3488 |
|
3489 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
3490 |
|
3491 | 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; }
|
3492 |
|
3493 | var TimeLessThanValidator = function (_Validator) {
|
3494 | _inherits(TimeLessThanValidator, _Validator);
|
3495 |
|
3496 | function TimeLessThanValidator() {
|
3497 | _classCallCheck(this, TimeLessThanValidator);
|
3498 |
|
3499 | var _this = _possibleConstructorReturn(this, (TimeLessThanValidator.__proto__ || Object.getPrototypeOf(TimeLessThanValidator)).call(this));
|
3500 |
|
3501 | _this._target = null;
|
3502 | return _this;
|
3503 | }
|
3504 |
|
3505 | _createClass(TimeLessThanValidator, [{
|
3506 | key: 'apply',
|
3507 | value: function apply(field, value) {
|
3508 | var model = field.getModel();
|
3509 | var targetField = model[this._target];
|
3510 | if (value == null || targetField.getValue() == null) {
|
3511 | return {
|
3512 | valid: true,
|
3513 | message: ''
|
3514 | };
|
3515 | }
|
3516 | var fieldMomentValue = (0, _moment2.default)(value);
|
3517 | var targetFieldMomentValue = (0, _moment2.default)(targetField.getValue());
|
3518 | var diff = fieldMomentValue.diff(targetFieldMomentValue, 'milliseconds');
|
3519 | if (diff < 0) {
|
3520 | return {
|
3521 | valid: true,
|
3522 | message: ''
|
3523 | };
|
3524 | }
|
3525 | return {
|
3526 | valid: false,
|
3527 | message: 'Waktu ' + field.getDisplay() + ' harus lebih kecil dari waktu ' + targetField.getDisplay() + '.'
|
3528 | };
|
3529 | }
|
3530 | }, {
|
3531 | key: 'configure',
|
3532 | value: function configure(option) {
|
3533 | if (option != null && typeof option !== 'undefined') {
|
3534 | this._target = option.target;
|
3535 | }
|
3536 | }
|
3537 | }], [{
|
3538 | key: 'create',
|
3539 | value: function create(option) {
|
3540 | var instance = new TimeLessThanValidator();
|
3541 | instance.configure(option);
|
3542 | return instance;
|
3543 | }
|
3544 | }]);
|
3545 |
|
3546 | return TimeLessThanValidator;
|
3547 | }(_Validator3.default);
|
3548 |
|
3549 | exports.default = TimeLessThanValidator;
|
3550 | module.exports = exports['default'];
|
3551 |
|
3552 | }),
|
3553 |
|
3554 | (function(module, exports, __webpack_require__) {
|
3555 |
|
3556 | "use strict";
|
3557 |
|
3558 |
|
3559 | Object.defineProperty(exports, "__esModule", {
|
3560 | value: true
|
3561 | });
|
3562 |
|
3563 | 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; }; }();
|
3564 |
|
3565 | var _Validator2 = __webpack_require__(0);
|
3566 |
|
3567 | var _Validator3 = _interopRequireDefault(_Validator2);
|
3568 |
|
3569 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
3570 |
|
3571 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
3572 |
|
3573 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
3574 |
|
3575 | 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; }
|
3576 |
|
3577 | var ValueRangeValidator = function (_Validator) {
|
3578 | _inherits(ValueRangeValidator, _Validator);
|
3579 |
|
3580 | function ValueRangeValidator() {
|
3581 | _classCallCheck(this, ValueRangeValidator);
|
3582 |
|
3583 | return _possibleConstructorReturn(this, (ValueRangeValidator.__proto__ || Object.getPrototypeOf(ValueRangeValidator)).apply(this, arguments));
|
3584 | }
|
3585 |
|
3586 | _createClass(ValueRangeValidator, [{
|
3587 | key: 'apply',
|
3588 | value: function apply(value) {
|
3589 | return {
|
3590 | valid: false,
|
3591 | message: ''
|
3592 | };
|
3593 | }
|
3594 | }, {
|
3595 | key: 'configure',
|
3596 | value: function configure(option) {}
|
3597 | }], [{
|
3598 | key: 'create',
|
3599 | value: function create(option) {
|
3600 | var instance = new ValueRangeValidator();
|
3601 | instance.configure(option);
|
3602 | return instance;
|
3603 | }
|
3604 | }]);
|
3605 |
|
3606 | return ValueRangeValidator;
|
3607 | }(_Validator3.default);
|
3608 |
|
3609 | exports.default = ValueRangeValidator;
|
3610 | module.exports = exports['default'];
|
3611 |
|
3612 | }),
|
3613 |
|
3614 | (function(module, exports) {
|
3615 |
|
3616 | module.exports = require("hoist-non-react-statics");
|
3617 |
|
3618 | }),
|
3619 |
|
3620 | (function(module, exports) {
|
3621 |
|
3622 | module.exports = require("querystring");
|
3623 |
|
3624 | }),
|
3625 |
|
3626 | (function(module, exports) {
|
3627 |
|
3628 | module.exports = require("superagent-bluebird-promise");
|
3629 |
|
3630 | })
|
3631 | ]);
|
3632 |
|
\ | No newline at end of file |