@oat-sa/tao-core-ui 1.54.1 → 1.54.4

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.
Files changed (95) hide show
  1. package/dist/resourcemgr/fileBrowser.js +10 -7
  2. package/dist/uploader.js +15 -18
  3. package/package.json +1 -1
  4. package/scss/inc/_base.scss +0 -1
  5. package/scss/inc/_forms.scss +4 -0
  6. package/src/resourcemgr/fileBrowser.js +42 -31
  7. package/src/uploader.js +68 -87
  8. package/dist/animable/absorbable/css/absorb.css.map +0 -1
  9. package/dist/animable/pulsable/css/pulse.css.map +0 -1
  10. package/dist/autocomplete/css/autocomplete.css.map +0 -1
  11. package/dist/badge/css/badge.css.map +0 -1
  12. package/dist/breadcrumbs/css/breadcrumbs.css.map +0 -1
  13. package/dist/bulkActionPopup/css/bulkActionPopup.css.map +0 -1
  14. package/dist/calculator/css/calculator.css.map +0 -1
  15. package/dist/class/css/selector.css.map +0 -1
  16. package/dist/component/css/components.css.map +0 -1
  17. package/dist/component/css/windowComponent.css.map +0 -1
  18. package/dist/contextualPopup/css/contextualPopup.css.map +0 -1
  19. package/dist/dashboard/css/dashboard.css.map +0 -1
  20. package/dist/datalist/css/datalist.css.map +0 -1
  21. package/dist/datatable/css/datatable.css.map +0 -1
  22. package/dist/dateRange/css/dateRange.css.map +0 -1
  23. package/dist/datetime/css/picker.css.map +0 -1
  24. package/dist/destination/css/selector.css.map +0 -1
  25. package/dist/documentViewer/css/documentViewer.css.map +0 -1
  26. package/dist/dropdown/css/dropdown.css.map +0 -1
  27. package/dist/dynamicComponent/css/dynamicComponent.css.map +0 -1
  28. package/dist/form/css/dropdownForm.css.map +0 -1
  29. package/dist/form/css/form.css.map +0 -1
  30. package/dist/form/validator/css/validator.css.map +0 -1
  31. package/dist/form/widget/css/widget.css.map +0 -1
  32. package/dist/generis/form/css/form.css.map +0 -1
  33. package/dist/generis/validator/css/validator.css.map +0 -1
  34. package/dist/generis/widget/css/widget.css.map +0 -1
  35. package/dist/itemButtonList/css/item-button-list.css.map +0 -1
  36. package/dist/listbox/css/listbox.css.map +0 -1
  37. package/dist/loadingButton/css/button.css.map +0 -1
  38. package/dist/maths/calculator/css/calculator.css.map +0 -1
  39. package/dist/mediaplayer/css/player.css.map +0 -1
  40. package/dist/pagination/css/pagination.css.map +0 -1
  41. package/dist/resource/css/selector.css.map +0 -1
  42. package/dist/resourcemgr/css/resourcemgr.css.map +0 -1
  43. package/dist/searchModal/css/advancedSearch.css.map +0 -1
  44. package/dist/searchModal/css/searchModal.css.map +0 -1
  45. package/dist/switch/css/switch.css.map +0 -1
  46. package/dist/tabs/css/tabs.css.map +0 -1
  47. package/dist/taskQueue/css/taskQueue.css.map +0 -1
  48. package/dist/taskQueueButton/css/taskable.css.map +0 -1
  49. package/dist/taskQueueButton/css/treeButton.css.map +0 -1
  50. package/dist/tristateCheckboxGroup/css/tristateCheckboxGroup.css.map +0 -1
  51. package/dist/waitingDialog/css/waitingDialog.css.map +0 -1
  52. package/src/animable/absorbable/css/absorb.css.map +0 -1
  53. package/src/animable/pulsable/css/pulse.css.map +0 -1
  54. package/src/autocomplete/css/autocomplete.css.map +0 -1
  55. package/src/badge/css/badge.css.map +0 -1
  56. package/src/breadcrumbs/css/breadcrumbs.css.map +0 -1
  57. package/src/bulkActionPopup/css/bulkActionPopup.css.map +0 -1
  58. package/src/calculator/css/calculator.css.map +0 -1
  59. package/src/class/css/selector.css.map +0 -1
  60. package/src/component/css/components.css.map +0 -1
  61. package/src/component/css/windowComponent.css.map +0 -1
  62. package/src/contextualPopup/css/contextualPopup.css.map +0 -1
  63. package/src/dashboard/css/dashboard.css.map +0 -1
  64. package/src/datalist/css/datalist.css.map +0 -1
  65. package/src/datatable/css/datatable.css.map +0 -1
  66. package/src/dateRange/css/dateRange.css.map +0 -1
  67. package/src/datetime/css/picker.css.map +0 -1
  68. package/src/destination/css/selector.css.map +0 -1
  69. package/src/documentViewer/css/documentViewer.css.map +0 -1
  70. package/src/dropdown/css/dropdown.css.map +0 -1
  71. package/src/dynamicComponent/css/dynamicComponent.css.map +0 -1
  72. package/src/form/css/dropdownForm.css.map +0 -1
  73. package/src/form/css/form.css.map +0 -1
  74. package/src/form/validator/css/validator.css.map +0 -1
  75. package/src/form/widget/css/widget.css.map +0 -1
  76. package/src/generis/form/css/form.css.map +0 -1
  77. package/src/generis/validator/css/validator.css.map +0 -1
  78. package/src/generis/widget/css/widget.css.map +0 -1
  79. package/src/itemButtonList/css/item-button-list.css.map +0 -1
  80. package/src/listbox/css/listbox.css.map +0 -1
  81. package/src/loadingButton/css/button.css.map +0 -1
  82. package/src/maths/calculator/css/calculator.css.map +0 -1
  83. package/src/mediaplayer/css/player.css.map +0 -1
  84. package/src/pagination/css/pagination.css.map +0 -1
  85. package/src/resource/css/selector.css.map +0 -1
  86. package/src/resourcemgr/css/resourcemgr.css.map +0 -1
  87. package/src/searchModal/css/advancedSearch.css.map +0 -1
  88. package/src/searchModal/css/searchModal.css.map +0 -1
  89. package/src/switch/css/switch.css.map +0 -1
  90. package/src/tabs/css/tabs.css.map +0 -1
  91. package/src/taskQueue/css/taskQueue.css.map +0 -1
  92. package/src/taskQueueButton/css/taskable.css.map +0 -1
  93. package/src/taskQueueButton/css/treeButton.css.map +0 -1
  94. package/src/tristateCheckboxGroup/css/tristateCheckboxGroup.css.map +0 -1
  95. package/src/waitingDialog/css/waitingDialog.css.map +0 -1
@@ -303,7 +303,7 @@ define(['jquery', 'lodash', 'core/request', 'ui/pagination', 'handlebars', 'i18n
303
303
  if (content.permissions.read && !options.hasAlreadySelected) {
304
304
  $$1('.file-browser').find('li.active').removeClass('active');
305
305
  updateSelectedClass(content.path, content.total, content.childrenLimit);
306
- $container.trigger("folderselect.".concat(ns), [content.label, getPage(content.children), content.path, content]);
306
+ $container.trigger('folderselect.'.concat(ns), [content.label, getPage(content.children), content.path, content]);
307
307
  renderPagination();
308
308
 
309
309
  if (root !== 'local') {
@@ -360,7 +360,13 @@ define(['jquery', 'lodash', 'core/request', 'ui/pagination', 'handlebars', 'i18n
360
360
  name: file.name
361
361
  })) {
362
362
  updatePermissions(file);
363
- subTree.children.push(file);
363
+
364
+ if (subTree.children.length === subTree.total) {
365
+ // all children loaded new file can be pushed to the end of tree
366
+ // if not all, new file will be loaded with next page
367
+ subTree.children.push(file);
368
+ }
369
+
364
370
  subTree.total++;
365
371
  selectedClass.total++;
366
372
  $container.trigger("folderselect.".concat(ns), [subTree.label, getPage(subTree.children), path]);
@@ -486,10 +492,7 @@ define(['jquery', 'lodash', 'core/request', 'ui/pagination', 'handlebars', 'i18n
486
492
  if (tree) {
487
493
  if (tree.path === path) {
488
494
  tree.children = tree.children ? tree.children.concat(data.children) : data.children;
489
-
490
- if (data.total) {
491
- tree.total = data.total;
492
- }
495
+ tree.total = data.total;
493
496
  } else if (tree.children) {
494
497
  _.forEach(tree.children, function (child) {
495
498
  done = setToPath(child, path, data);
@@ -577,7 +580,7 @@ define(['jquery', 'lodash', 'core/request', 'ui/pagination', 'handlebars', 'i18n
577
580
 
578
581
  function updateFolders(data, $parent, recurse) {
579
582
  if (recurse && data && data.path) {
580
- if (data.relPath === undefined) {
583
+ if (typeof data.relPath === 'undefined') {
581
584
  data.relPath = data.path;
582
585
  }
583
586
 
package/dist/uploader.js CHANGED
@@ -306,12 +306,11 @@ define(['jquery', 'lodash', 'i18n', 'async', 'core/pluginifier', 'util/bytes', '
306
306
  * @returns {jQueryElement} for chainingV
307
307
  */
308
308
  init: function init(options) {
309
- var self = uploader; //get options using default
310
-
309
+ //get options using default
311
310
  options = _.defaults(options || {}, defaults);
312
311
  return this.each(function () {
313
- var $elt = $$1(this),
314
- $builtInForm;
312
+ var $elt = $$1(this);
313
+ var $builtInForm;
315
314
 
316
315
  if (!$elt.data(dataNs)) {
317
316
  $elt.html(uploaderTpl(options)); // form could be inside $elt ...
@@ -343,7 +342,7 @@ define(['jquery', 'lodash', 'i18n', 'async', 'core/pluginifier', 'util/bytes', '
343
342
  options.files = [];
344
343
  $elt.data(dataNs, options);
345
344
 
346
- self._reset($elt);
345
+ uploader._reset($elt);
347
346
 
348
347
  var inputHandler = function inputHandler(e) {
349
348
  // _.values also get the length property of the FileList object,
@@ -354,7 +353,9 @@ define(['jquery', 'lodash', 'i18n', 'async', 'core/pluginifier', 'util/bytes', '
354
353
  finalFiles.push(file);
355
354
  });
356
355
 
357
- self._selectFiles($elt, finalFiles);
356
+ uploader._selectFiles($elt, finalFiles);
357
+
358
+ options.$input.val('');
358
359
  };
359
360
 
360
361
  var dragOverHandler = function dragOverHandler(e) {
@@ -415,7 +416,7 @@ define(['jquery', 'lodash', 'i18n', 'async', 'core/pluginifier', 'util/bytes', '
415
416
  append = false;
416
417
  }
417
418
 
418
- self._selectFiles($elt, files, append);
419
+ uploader._selectFiles($elt, files, append);
419
420
  }
420
421
 
421
422
  return false;
@@ -427,25 +428,25 @@ define(['jquery', 'lodash', 'i18n', 'async', 'core/pluginifier', 'util/bytes', '
427
428
 
428
429
  $elt.on('fileselect.' + ns, function () {
429
430
  if (options.files.length === 0) {
430
- self._reset($elt);
431
+ uploader._reset($elt);
431
432
  }
432
433
 
433
434
  if (options.upload) {
434
435
  options.$uploadBtn.off('click').on('click', function (e) {
435
436
  e.preventDefault();
436
437
 
437
- self._upload($elt, options.files);
438
+ uploader._upload($elt, options.files);
438
439
  }).removeProp('disabled');
439
440
  }
440
441
 
441
442
  if (options.read) {
442
- self._read($elt, options.files);
443
+ uploader._read($elt, options.files);
443
444
  }
444
445
 
445
446
  options.$resetBtn.off('click').on('click', function (e) {
446
447
  e.preventDefault();
447
448
 
448
- self._reset($elt);
449
+ uploader._reset($elt);
449
450
  }).removeProp('disabled');
450
451
  });
451
452
  /**
@@ -548,7 +549,7 @@ define(['jquery', 'lodash', 'i18n', 'async', 'core/pluginifier', 'util/bytes', '
548
549
  * Get the selected files.
549
550
  *
550
551
  * Called the jQuery way once registered by the Pluginifier:
551
- * @example var files = $('selector').uploader('files');
552
+ * @example const files = $('selector').uploader('files');
552
553
  *
553
554
  * @param {jQueryElement} $elt - plugin's element
554
555
  * @returns {Array<File>} the selected files
@@ -719,11 +720,7 @@ define(['jquery', 'lodash', 'i18n', 'async', 'core/pluginifier', 'util/bytes', '
719
720
 
720
721
  if (options && options.files.length) {
721
722
  _.forEach(options.files, function (file) {
722
- // Show information about the processed file to the candidate.
723
- var filename = file.name;
724
- var filesize = file.size;
725
- var filetype = file.type; // Let's read the file to get its base64 encoded content.
726
-
723
+ // Let's read the file to get its base64 encoded content.
727
724
  var reader = new FileReader();
728
725
 
729
726
  reader.onload = function (e) {
@@ -738,7 +735,7 @@ define(['jquery', 'lodash', 'i18n', 'async', 'core/pluginifier', 'util/bytes', '
738
735
  $elt.trigger('readend.' + ns, [file, e.target.result]);
739
736
  };
740
737
 
741
- reader.onloadstart = function (e) {
738
+ reader.onloadstart = function () {
742
739
  options.$progressBar.progressbar('value', 0);
743
740
  /**
744
741
  * The reading starts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oat-sa/tao-core-ui",
3
- "version": "1.54.1",
3
+ "version": "1.54.4",
4
4
  "displayName": "TAO Core UI",
5
5
  "description": "UI libraries of TAO",
6
6
  "scripts": {
@@ -211,7 +211,6 @@ body {
211
211
  sub,
212
212
  sup {
213
213
  font-size: .75em;
214
- line-height: 0;
215
214
  position: relative;
216
215
  vertical-align: baseline;
217
216
  }
@@ -715,6 +715,10 @@ label {
715
715
  @include simple-border();
716
716
  }
717
717
  }
718
+ & ~.form-error{
719
+ color: $error;
720
+ text-align: right;
721
+ }
718
722
 
719
723
  [dir="rtl"] & {
720
724
  padding: 0 0 0 10px;
@@ -21,7 +21,7 @@ import request from 'core/request';
21
21
  import paginationComponent from 'ui/pagination';
22
22
  import rootFolderTpl from 'ui/resourcemgr/tpl/rootFolder';
23
23
  import folderTpl from 'ui/resourcemgr/tpl/folder';
24
- import updatePermissions from './util/updatePermissions';
24
+ import updatePermissions from './util/updatePermissions';
25
25
 
26
26
  const ns = 'resourcemgr';
27
27
 
@@ -54,16 +54,21 @@ export default function (options) {
54
54
  }
55
55
  updateFolders(content, $innerList);
56
56
 
57
- if (content.permissions.read && !options.hasAlreadySelected) {
58
- $('.file-browser').find('li.active').removeClass('active');
59
- updateSelectedClass(content.path, content.total, content.childrenLimit);
60
- $container.trigger("folderselect.".concat(ns), [content.label, getPage(content.children), content.path, content]);
61
- renderPagination();
57
+ if (content.permissions.read && !options.hasAlreadySelected) {
58
+ $('.file-browser').find('li.active').removeClass('active');
59
+ updateSelectedClass(content.path, content.total, content.childrenLimit);
60
+ $container.trigger('folderselect.'.concat(ns), [
61
+ content.label,
62
+ getPage(content.children),
63
+ content.path,
64
+ content
65
+ ]);
66
+ renderPagination();
62
67
 
63
- if (root !== 'local') {
64
- options.hasAlreadySelected = true;
65
- }
66
- }
68
+ if (root !== 'local') {
69
+ options.hasAlreadySelected = true;
70
+ }
71
+ }
67
72
  });
68
73
 
69
74
  // by clicking on the tree (using a live binding because content is not complete yet)
@@ -99,7 +104,12 @@ export default function (options) {
99
104
 
100
105
  //internal event to set the file-selector content
101
106
  updateSelectedClass(fullPath, subTree.total, $selected.data('children-limit'));
102
- $container.trigger(`folderselect.${ns}`, [content.label, getPage(content.children), content.path, content]);
107
+ $container.trigger(`folderselect.${ns}`, [
108
+ content.label,
109
+ getPage(content.children),
110
+ content.path,
111
+ content
112
+ ]);
103
113
  renderPagination();
104
114
  }
105
115
  });
@@ -113,7 +123,11 @@ export default function (options) {
113
123
  }
114
124
  if (root !== 'local' || !_.find(subTree.children, { name: file.name })) {
115
125
  updatePermissions(file);
116
- subTree.children.push(file);
126
+ if (subTree.children.length === subTree.total) {
127
+ // all children loaded new file can be pushed to the end of tree
128
+ // if not all, new file will be loaded with next page
129
+ subTree.children.push(file);
130
+ }
117
131
  subTree.total++;
118
132
  selectedClass.total++;
119
133
  $container.trigger(`folderselect.${ns}`, [subTree.label, getPage(subTree.children), path]);
@@ -173,14 +187,12 @@ export default function (options) {
173
187
  return !!item.uri;
174
188
  });
175
189
  // if files less then total and need toload this page
176
- if ((files.length < selectedClass.total) &&
177
- (files.length < selectedClass.page * selectedClass.childrenLimit)
178
- ) {
190
+ if (files.length < selectedClass.total && files.length < selectedClass.page * selectedClass.childrenLimit) {
179
191
  loadContent(path).then(function (data) {
180
192
  const loadedFiles = _.filter(data.children, function (item) {
181
193
  return !!item.uri;
182
194
  });
183
- setToPath(tree, path, {children: loadedFiles});
195
+ setToPath(tree, path, { children: loadedFiles });
184
196
  content = getByPath(tree, path);
185
197
  cb(content);
186
198
  });
@@ -227,9 +239,7 @@ export default function (options) {
227
239
  if (tree) {
228
240
  if (tree.path === path) {
229
241
  tree.children = tree.children ? tree.children.concat(data.children) : data.children;
230
- if (data.total) {
231
- tree.total = data.total;
232
- }
242
+ tree.total = data.total;
233
243
  } else if (tree.children) {
234
244
  _.forEach(tree.children, function (child) {
235
245
  done = setToPath(child, path, data);
@@ -280,18 +290,19 @@ export default function (options) {
280
290
  url: options.browseUrl,
281
291
  method: 'GET',
282
292
  dataType: 'json',
283
- data: _.merge(parameters, options.params, { childrenOffset: (selectedClass.page - 1) * selectedClass.childrenLimit }),
284
- noToken: true,
293
+ data: _.merge(parameters, options.params, {
294
+ childrenOffset: (selectedClass.page - 1) * selectedClass.childrenLimit
295
+ }),
296
+ noToken: true
285
297
  })
286
- .then(response => response.data)
287
- .then(response => {
288
- response = updatePermissions(response);
289
- if (response.children && response.children.length > 0) {
290
- response.children.map(responseChildren => updatePermissions(responseChildren));
291
- }
292
- return response;
293
- });
294
-
298
+ .then(response => response.data)
299
+ .then(response => {
300
+ response = updatePermissions(response);
301
+ if (response.children && response.children.length > 0) {
302
+ response.children.map(responseChildren => updatePermissions(responseChildren));
303
+ }
304
+ return response;
305
+ });
295
306
  }
296
307
 
297
308
  /**
@@ -302,7 +313,7 @@ export default function (options) {
302
313
  */
303
314
  function updateFolders(data, $parent, recurse) {
304
315
  if (recurse && data && data.path) {
305
- if (data.relPath === undefined) {
316
+ if (typeof data.relPath === 'undefined') {
306
317
  data.relPath = data.path;
307
318
  }
308
319
  $parent.append(folderTpl(data));