kui-crm 0.0.136 → 0.0.137

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/cjs/index.js CHANGED
@@ -1198,6 +1198,72 @@ var FileStore = /** @class */ (function () {
1198
1198
  return FileStore;
1199
1199
  }());
1200
1200
 
1201
+ var FilesStore = /** @class */ (function () {
1202
+ function FilesStore(variant) {
1203
+ var _this = this;
1204
+ this.addFile = function (newFile) {
1205
+ _this.files = __spreadArray(__spreadArray([], _this.files, true), [newFile], false);
1206
+ _this.files.forEach(function (file, key) {
1207
+ file.setIndex(key);
1208
+ });
1209
+ };
1210
+ this.removeFile = function (index) {
1211
+ _this.files = _this.files.filter(function (file, key) { return key !== index; });
1212
+ _this.files.forEach(function (file, key) {
1213
+ file.setIndex(key);
1214
+ });
1215
+ };
1216
+ this.setFiles = function (files) {
1217
+ _this.files = files.map(function (file) { return FileStore.initFromFileStore(file); });
1218
+ };
1219
+ this.uploadFiles = function () { return __awaiter(_this, void 0, void 0, function () {
1220
+ var _this = this;
1221
+ return __generator(this, function (_a) {
1222
+ switch (_a.label) {
1223
+ case 0: return [4 /*yield*/, Promise.allSettled(this.notUploadedFiles.map(function (file) { return file.uploadFile(_this.variant); }))];
1224
+ case 1:
1225
+ _a.sent();
1226
+ return [2 /*return*/];
1227
+ }
1228
+ });
1229
+ }); };
1230
+ this.files = [];
1231
+ this.variant = variant;
1232
+ mobx.makeAutoObservable(this);
1233
+ }
1234
+ Object.defineProperty(FilesStore.prototype, "uploadedData", {
1235
+ get: function () {
1236
+ return this.files
1237
+ .map(function (file) { return file.uploadedData; })
1238
+ .filter(function (data) { return data; });
1239
+ },
1240
+ enumerable: false,
1241
+ configurable: true
1242
+ });
1243
+ Object.defineProperty(FilesStore.prototype, "uploadedAllFiles", {
1244
+ get: function () {
1245
+ return !this.notUploadedFiles.length;
1246
+ },
1247
+ enumerable: false,
1248
+ configurable: true
1249
+ });
1250
+ Object.defineProperty(FilesStore.prototype, "notUploadedFiles", {
1251
+ get: function () {
1252
+ return this.files.filter(function (file) { return file.uploadStatus !== "success"; });
1253
+ },
1254
+ enumerable: false,
1255
+ configurable: true
1256
+ });
1257
+ Object.defineProperty(FilesStore.prototype, "isUploading", {
1258
+ get: function () {
1259
+ return !!this.files.filter(function (file) { return file.uploadStatus === "loading"; }).length;
1260
+ },
1261
+ enumerable: false,
1262
+ configurable: true
1263
+ });
1264
+ return FilesStore;
1265
+ }());
1266
+
1201
1267
  var ImageStore = /** @class */ (function () {
1202
1268
  function ImageStore(image) {
1203
1269
  var _this = this;
@@ -3981,6 +4047,7 @@ exports.ElectricityValues = ElectricityValues;
3981
4047
  exports.ErrorPopup = ErrorPopup;
3982
4048
  exports.FileStore = FileStore;
3983
4049
  exports.FileUploaderWithPreview = FileUploaderWithPreview;
4050
+ exports.FilesStore = FilesStore;
3984
4051
  exports.FillingTagCreationForm = FillingTagCreationForm;
3985
4052
  exports.FillingTagCreationModal = FillingTagCreationModal$1;
3986
4053
  exports.FillingTagsAgent = FillingTagsAgent;