@vitrosoftware/common-ui-ts 1.1.22 → 1.1.24

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.
@@ -21122,9 +21122,15 @@ var TelerikUploaderContextImpl = /*#__PURE__*/function () {
21122
21122
  });
21123
21123
  };
21124
21124
  _proto.upload = function upload(e) {
21125
+ var _this = this;
21125
21126
  this.initAuthorization(e, this.token);
21126
21127
  this.fileList = [].concat(this.fileList, e.files);
21127
21128
  this.toggleButtons(true);
21129
+ if (this.settings.async.isAutoUpload && this.settings.getFileImage) {
21130
+ e.files.forEach(function (file) {
21131
+ _this.setFileImage(file);
21132
+ });
21133
+ }
21128
21134
  if (this.settings.upload) {
21129
21135
  this.settings.upload(e);
21130
21136
  }
@@ -21164,7 +21170,7 @@ var TelerikUploaderContextImpl = /*#__PURE__*/function () {
21164
21170
  this.setProgressBar(info.percent);
21165
21171
  };
21166
21172
  _proto.complete = function complete(e) {
21167
- var _this = this;
21173
+ var _this2 = this;
21168
21174
  this.progressInfo.addClass('vitro-upload-complete');
21169
21175
  this.subtitle.empty();
21170
21176
  this.title.text(this.localeService.create(LOCALE.SUCCESS, {
@@ -21178,14 +21184,20 @@ var TelerikUploaderContextImpl = /*#__PURE__*/function () {
21178
21184
  this.setProgressBar(100);
21179
21185
  if (this.settings.isAutoReset) {
21180
21186
  window.setTimeout(function () {
21181
- _this.clearAllFiles();
21182
- _this.toggleButtons(false);
21187
+ _this2.clearAllFiles();
21188
+ _this2.toggleButtons(false);
21183
21189
  }, this.settings.resetDurationMs || 5000);
21184
21190
  }
21185
21191
  };
21186
21192
  _proto.select = function select(e) {
21193
+ var _this3 = this;
21187
21194
  this.container.classList.remove('vitro-dropzone-active');
21188
21195
  this.container.classList.add('vitro-upload-active');
21196
+ if (!this.settings.async.isAutoUpload && this.settings.getFileImage) {
21197
+ e.files.forEach(function (file) {
21198
+ _this3.setFileImage(file);
21199
+ });
21200
+ }
21189
21201
  };
21190
21202
  _proto.clear = function clear(e) {
21191
21203
  this.container.classList.remove('vitro-upload-active');
@@ -21209,6 +21221,13 @@ var TelerikUploaderContextImpl = /*#__PURE__*/function () {
21209
21221
  _proto.setAthorizationToken = function setAthorizationToken(token) {
21210
21222
  this.token = token;
21211
21223
  };
21224
+ _proto.setFileImage = function setFileImage(file) {
21225
+ if (this.settings.getFileImage) {
21226
+ var image = this.settings.getFileImage(file.name);
21227
+ var fileImage = $$1("<img class='vitro-file-icon'>").attr('src', image);
21228
+ $$1(this.container).find(".k-file[data-uid='" + file.uid + "'] .k-file-group-wrapper").replaceWith(fileImage);
21229
+ }
21230
+ };
21212
21231
  _proto.setProgressBar = function setProgressBar(percent) {
21213
21232
  this.progressBar.style.width = percent + CTRL.PERCENT;
21214
21233
  if (percent == 100) {
@@ -57660,10 +57679,10 @@ DropdownMenu.defaultProps = defaultProps;
57660
57679
  // SSR case multiple copies of React Aria is not supported.
57661
57680
  const $b5e257d569688ac6$var$defaultContext = {
57662
57681
  prefix: String(Math.round(Math.random() * 10000000000)),
57663
- current: 0,
57664
- isSSR: false
57682
+ current: 0
57665
57683
  };
57666
57684
  const $b5e257d569688ac6$var$SSRContext = /*#__PURE__*/ (React__default).createContext($b5e257d569688ac6$var$defaultContext);
57685
+ const $b5e257d569688ac6$var$IsSSRContext = /*#__PURE__*/ (React__default).createContext(false);
57667
57686
  let $b5e257d569688ac6$var$canUseDOM = Boolean(typeof window !== "undefined" && window.document && window.document.createElement);
57668
57687
  let $b5e257d569688ac6$var$componentIds = new WeakMap();
57669
57688
  function $b5e257d569688ac6$var$useCounter(isDisabled = false) {
@@ -57736,8 +57755,7 @@ function $b5e257d569688ac6$export$535bd6ca7f90a273() {
57736
57755
  // In React 18, we can use useSyncExternalStore to detect if we're server rendering or hydrating.
57737
57756
  if (typeof (React__default)["useSyncExternalStore"] === "function") return (React__default)["useSyncExternalStore"]($b5e257d569688ac6$var$subscribe, $b5e257d569688ac6$var$getSnapshot, $b5e257d569688ac6$var$getServerSnapshot);
57738
57757
  // eslint-disable-next-line react-hooks/rules-of-hooks
57739
- let cur = (useContext)($b5e257d569688ac6$var$SSRContext);
57740
- return cur.isSSR;
57758
+ return (useContext)($b5e257d569688ac6$var$IsSSRContext);
57741
57759
  }
57742
57760
  //# sourceMappingURL=module.js.map
57743
57761