choerodon-ui
Version:
An enterprise-class UI design language and React-based implementation
66 lines (46 loc) • 1.79 kB
JavaScript
import _extends from "@babel/runtime/helpers/extends";
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
import _createClass from "@babel/runtime/helpers/createClass";
import { __decorate } from "tslib";
import { action, observable } from 'mobx';
var extReg = /(.*)\.([^.]*)$/;
var AttachmentFile =
/*#__PURE__*/
function () {
function AttachmentFile(file) {
_classCallCheck(this, AttachmentFile);
this.load(file);
}
_createClass(AttachmentFile, [{
key: "load",
value: function load(file) {
_extends(this, file);
this.uid = String(file.uid);
var name = file.name;
if (name) {
var matches = name.match(extReg);
if (matches && matches.length > 2) {
this.ext = matches[2];
this.filename = matches[1];
} else {
this.ext = '';
this.filename = name;
}
}
}
}]);
return AttachmentFile;
}();
export { AttachmentFile as default };
__decorate([observable], AttachmentFile.prototype, "name", void 0);
__decorate([observable], AttachmentFile.prototype, "size", void 0);
__decorate([observable], AttachmentFile.prototype, "url", void 0);
__decorate([observable], AttachmentFile.prototype, "filename", void 0);
__decorate([observable], AttachmentFile.prototype, "ext", void 0);
__decorate([observable], AttachmentFile.prototype, "status", void 0);
__decorate([observable], AttachmentFile.prototype, "percent", void 0);
__decorate([observable], AttachmentFile.prototype, "error", void 0);
__decorate([observable], AttachmentFile.prototype, "errorMessage", void 0);
__decorate([observable], AttachmentFile.prototype, "invalid", void 0);
__decorate([action], AttachmentFile.prototype, "load", null);
//# sourceMappingURL=AttachmentFile.js.map