@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.
@@ -92,6 +92,7 @@
92
92
  height: 32px !important;
93
93
  line-height: 32px !important;
94
94
  background-position: center !important;
95
+ background-size: 100% !important;
95
96
  margin-right: 4px;
96
97
  }
97
98
 
@@ -471,3 +471,7 @@
471
471
  position: unset !important;
472
472
  }
473
473
 
474
+ :global(.vitro-file-icon) {
475
+ width: 24px;
476
+ height: 24px;
477
+ }
@@ -31,6 +31,7 @@ export declare class TelerikUploaderContextImpl implements TelerikUploaderContex
31
31
  private getProgressInfo;
32
32
  addFile(): void;
33
33
  setAthorizationToken(token: string): void;
34
+ private setFileImage;
34
35
  private setProgressBar;
35
36
  private setFileProgress;
36
37
  private initOnDrop;
@@ -10,4 +10,5 @@ export interface TelerikUploaderSettings {
10
10
  isDirectoryDrop: boolean;
11
11
  isAutoReset?: boolean;
12
12
  resetDurationMs?: number;
13
+ getFileImage?: (name: string) => string;
13
14
  }
package/dist/index.css CHANGED
@@ -434,6 +434,7 @@
434
434
  height: 32px !important;
435
435
  line-height: 32px !important;
436
436
  background-position: center !important;
437
+ background-size: 100% !important;
437
438
  margin-right: 4px;
438
439
  }
439
440
 
@@ -971,7 +972,10 @@
971
972
  position: unset !important;
972
973
  }
973
974
 
974
-
975
+ .vitro-file-icon {
976
+ width: 24px;
977
+ height: 24px;
978
+ }
975
979
  .vitro-display-none {
976
980
  display: none;
977
981
  }
package/dist/index.js CHANGED
@@ -21124,9 +21124,15 @@ var TelerikUploaderContextImpl = /*#__PURE__*/function () {
21124
21124
  });
21125
21125
  };
21126
21126
  _proto.upload = function upload(e) {
21127
+ var _this = this;
21127
21128
  this.initAuthorization(e, this.token);
21128
21129
  this.fileList = [].concat(this.fileList, e.files);
21129
21130
  this.toggleButtons(true);
21131
+ if (this.settings.async.isAutoUpload && this.settings.getFileImage) {
21132
+ e.files.forEach(function (file) {
21133
+ _this.setFileImage(file);
21134
+ });
21135
+ }
21130
21136
  if (this.settings.upload) {
21131
21137
  this.settings.upload(e);
21132
21138
  }
@@ -21166,7 +21172,7 @@ var TelerikUploaderContextImpl = /*#__PURE__*/function () {
21166
21172
  this.setProgressBar(info.percent);
21167
21173
  };
21168
21174
  _proto.complete = function complete(e) {
21169
- var _this = this;
21175
+ var _this2 = this;
21170
21176
  this.progressInfo.addClass('vitro-upload-complete');
21171
21177
  this.subtitle.empty();
21172
21178
  this.title.text(this.localeService.create(LOCALE.SUCCESS, {
@@ -21180,14 +21186,20 @@ var TelerikUploaderContextImpl = /*#__PURE__*/function () {
21180
21186
  this.setProgressBar(100);
21181
21187
  if (this.settings.isAutoReset) {
21182
21188
  window.setTimeout(function () {
21183
- _this.clearAllFiles();
21184
- _this.toggleButtons(false);
21189
+ _this2.clearAllFiles();
21190
+ _this2.toggleButtons(false);
21185
21191
  }, this.settings.resetDurationMs || 5000);
21186
21192
  }
21187
21193
  };
21188
21194
  _proto.select = function select(e) {
21195
+ var _this3 = this;
21189
21196
  this.container.classList.remove('vitro-dropzone-active');
21190
21197
  this.container.classList.add('vitro-upload-active');
21198
+ if (!this.settings.async.isAutoUpload && this.settings.getFileImage) {
21199
+ e.files.forEach(function (file) {
21200
+ _this3.setFileImage(file);
21201
+ });
21202
+ }
21191
21203
  };
21192
21204
  _proto.clear = function clear(e) {
21193
21205
  this.container.classList.remove('vitro-upload-active');
@@ -21211,6 +21223,13 @@ var TelerikUploaderContextImpl = /*#__PURE__*/function () {
21211
21223
  _proto.setAthorizationToken = function setAthorizationToken(token) {
21212
21224
  this.token = token;
21213
21225
  };
21226
+ _proto.setFileImage = function setFileImage(file) {
21227
+ if (this.settings.getFileImage) {
21228
+ var image = this.settings.getFileImage(file.name);
21229
+ var fileImage = $$1("<img class='vitro-file-icon'>").attr('src', image);
21230
+ $$1(this.container).find(".k-file[data-uid='" + file.uid + "'] .k-file-group-wrapper").replaceWith(fileImage);
21231
+ }
21232
+ };
21214
21233
  _proto.setProgressBar = function setProgressBar(percent) {
21215
21234
  this.progressBar.style.width = percent + CTRL.PERCENT;
21216
21235
  if (percent == 100) {
@@ -57662,10 +57681,10 @@ DropdownMenu.defaultProps = defaultProps;
57662
57681
  // SSR case multiple copies of React Aria is not supported.
57663
57682
  const $b5e257d569688ac6$var$defaultContext = {
57664
57683
  prefix: String(Math.round(Math.random() * 10000000000)),
57665
- current: 0,
57666
- isSSR: false
57684
+ current: 0
57667
57685
  };
57668
57686
  const $b5e257d569688ac6$var$SSRContext = /*#__PURE__*/ (React__default).createContext($b5e257d569688ac6$var$defaultContext);
57687
+ const $b5e257d569688ac6$var$IsSSRContext = /*#__PURE__*/ (React__default).createContext(false);
57669
57688
  let $b5e257d569688ac6$var$canUseDOM = Boolean(typeof window !== "undefined" && window.document && window.document.createElement);
57670
57689
  let $b5e257d569688ac6$var$componentIds = new WeakMap();
57671
57690
  function $b5e257d569688ac6$var$useCounter(isDisabled = false) {
@@ -57738,8 +57757,7 @@ function $b5e257d569688ac6$export$535bd6ca7f90a273() {
57738
57757
  // In React 18, we can use useSyncExternalStore to detect if we're server rendering or hydrating.
57739
57758
  if (typeof (React__default)["useSyncExternalStore"] === "function") return (React__default)["useSyncExternalStore"]($b5e257d569688ac6$var$subscribe, $b5e257d569688ac6$var$getSnapshot, $b5e257d569688ac6$var$getServerSnapshot);
57740
57759
  // eslint-disable-next-line react-hooks/rules-of-hooks
57741
- let cur = (React.useContext)($b5e257d569688ac6$var$SSRContext);
57742
- return cur.isSSR;
57760
+ return (React.useContext)($b5e257d569688ac6$var$IsSSRContext);
57743
57761
  }
57744
57762
 
57745
57763
  const isRoleMenu = el => {