You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1 line
17 KiB
JavaScript

"use strict";function _get(a,b,c){return _get="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(a,b,c){var d=_superPropBase(a,b);if(d){var e=Object.getOwnPropertyDescriptor(d,b);return e.get?e.get.call(c):e.value}},_get(a,b,c||a)}function _superPropBase(a,b){for(;!Object.prototype.hasOwnProperty.call(a,b)&&(a=_getPrototypeOf(a),null!==a););return a}function _typeof(a){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},_typeof(a)}function _possibleConstructorReturn(a,b){return b&&("object"===_typeof(b)||"function"==typeof b)?b:_assertThisInitialized(a)}function _assertThisInitialized(a){if(void 0===a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return a}function _getPrototypeOf(a){return _getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function(a){return a.__proto__||Object.getPrototypeOf(a)},_getPrototypeOf(a)}function _inherits(a,b){if("function"!=typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function");a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,writable:!0,configurable:!0}}),b&&_setPrototypeOf(a,b)}function _setPrototypeOf(a,b){return _setPrototypeOf=Object.setPrototypeOf||function(a,b){return a.__proto__=b,a},_setPrototypeOf(a,b)}function _classCallCheck(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function _defineProperties(a,b){for(var c,d=0;d<b.length;d++)c=b[d],c.enumerable=c.enumerable||!1,c.configurable=!0,"value"in c&&(c.writable=!0),Object.defineProperty(a,c.key,c)}function _createClass(a,b,c){return b&&_defineProperties(a.prototype,b),c&&_defineProperties(a,c),a}var AbstractSmartDatePart=function(){function a(b,c){_classCallCheck(this,a),this._state=a.STATE_NONE,this._cleanedValue="",this._parsedValue="",this._scanned="",this._placeholder=b,this._static=c}return _createClass(a,[{key:"state",value:function(){return this._state}},{key:"isNoState",value:function(){return this._state===a.STATE_NONE}},{key:"isIncomplete",value:function(){return this._state===a.STATE_INCOMPLETE}},{key:"isComplete",value:function(){return this._state===a.STATE_COMPLETE}},{key:"resetState",value:function(){this._state=a.STATE_NONE}},{key:"cleanedValue",value:function(){return this._cleanedValue}},{key:"parsedValue",value:function(){return this._parsedValue}},{key:"placeHolder",value:function(){return this._placeholder}},{key:"isStatic",value:function(){return this._static}},{key:"_isNumericSymbol",value:function(a){return"0"<=a&&"9">=a}},{key:"check",value:function(){return!1}}]),a}();AbstractSmartDatePart.STATE_NONE=0,AbstractSmartDatePart.STATE_INCOMPLETE=1,AbstractSmartDatePart.STATE_COMPLETE=2;var SmartDateStaticPart=function(a){function b(a){var c;return _classCallCheck(this,b),c=_possibleConstructorReturn(this,_getPrototypeOf(b).call(this,a,!0)),c._cleanedValue=a,c}return _inherits(b,a),_createClass(b,[{key:"parse",value:function(a){for(var b=a.value(),c=a.valueIndex();c<b.length&&!this._isNumericSymbol(b[c]);)c++;return this._parsedValue=b.substring(a.valueIndex(),c),this._state=AbstractSmartDatePart.STATE_COMPLETE,a.setValueIndex(c),!0}}]),b}(AbstractSmartDatePart),AbstractSmartDateNumericPart=function(a){function b(a,c){var d;return _classCallCheck(this,b),d=_possibleConstructorReturn(this,_getPrototypeOf(b).call(this,a,!1)),d._numericValue=0,d._size=c,d}return _inherits(b,a),_createClass(b,[{key:"numericValue",value:function(){return this._numericValue}},{key:"formatDate",value:function(){return""}},{key:"formatValue",value:function(a){var b=this._correctValue(a)+"";return"0"==b?b:b.length>this._size?b.substring(0,this._size):b.length<this._size?b.padStart(this._size,"0"):b}},{key:"_correctValue",value:function(a){var b=Math.round;return b(a)}},{key:"scanStringNumber",value:function(a){for(var b=a.valueIndex(),c=a.value();b<c.length&&this._isNumericSymbol(c[b]);)b++;var d=c.subst