@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.
- package/dist/resourcemgr/fileBrowser.js +10 -7
- package/dist/uploader.js +15 -18
- package/package.json +1 -1
- package/scss/inc/_base.scss +0 -1
- package/scss/inc/_forms.scss +4 -0
- package/src/resourcemgr/fileBrowser.js +42 -31
- package/src/uploader.js +68 -87
- package/dist/animable/absorbable/css/absorb.css.map +0 -1
- package/dist/animable/pulsable/css/pulse.css.map +0 -1
- package/dist/autocomplete/css/autocomplete.css.map +0 -1
- package/dist/badge/css/badge.css.map +0 -1
- package/dist/breadcrumbs/css/breadcrumbs.css.map +0 -1
- package/dist/bulkActionPopup/css/bulkActionPopup.css.map +0 -1
- package/dist/calculator/css/calculator.css.map +0 -1
- package/dist/class/css/selector.css.map +0 -1
- package/dist/component/css/components.css.map +0 -1
- package/dist/component/css/windowComponent.css.map +0 -1
- package/dist/contextualPopup/css/contextualPopup.css.map +0 -1
- package/dist/dashboard/css/dashboard.css.map +0 -1
- package/dist/datalist/css/datalist.css.map +0 -1
- package/dist/datatable/css/datatable.css.map +0 -1
- package/dist/dateRange/css/dateRange.css.map +0 -1
- package/dist/datetime/css/picker.css.map +0 -1
- package/dist/destination/css/selector.css.map +0 -1
- package/dist/documentViewer/css/documentViewer.css.map +0 -1
- package/dist/dropdown/css/dropdown.css.map +0 -1
- package/dist/dynamicComponent/css/dynamicComponent.css.map +0 -1
- package/dist/form/css/dropdownForm.css.map +0 -1
- package/dist/form/css/form.css.map +0 -1
- package/dist/form/validator/css/validator.css.map +0 -1
- package/dist/form/widget/css/widget.css.map +0 -1
- package/dist/generis/form/css/form.css.map +0 -1
- package/dist/generis/validator/css/validator.css.map +0 -1
- package/dist/generis/widget/css/widget.css.map +0 -1
- package/dist/itemButtonList/css/item-button-list.css.map +0 -1
- package/dist/listbox/css/listbox.css.map +0 -1
- package/dist/loadingButton/css/button.css.map +0 -1
- package/dist/maths/calculator/css/calculator.css.map +0 -1
- package/dist/mediaplayer/css/player.css.map +0 -1
- package/dist/pagination/css/pagination.css.map +0 -1
- package/dist/resource/css/selector.css.map +0 -1
- package/dist/resourcemgr/css/resourcemgr.css.map +0 -1
- package/dist/searchModal/css/advancedSearch.css.map +0 -1
- package/dist/searchModal/css/searchModal.css.map +0 -1
- package/dist/switch/css/switch.css.map +0 -1
- package/dist/tabs/css/tabs.css.map +0 -1
- package/dist/taskQueue/css/taskQueue.css.map +0 -1
- package/dist/taskQueueButton/css/taskable.css.map +0 -1
- package/dist/taskQueueButton/css/treeButton.css.map +0 -1
- package/dist/tristateCheckboxGroup/css/tristateCheckboxGroup.css.map +0 -1
- package/dist/waitingDialog/css/waitingDialog.css.map +0 -1
- package/src/animable/absorbable/css/absorb.css.map +0 -1
- package/src/animable/pulsable/css/pulse.css.map +0 -1
- package/src/autocomplete/css/autocomplete.css.map +0 -1
- package/src/badge/css/badge.css.map +0 -1
- package/src/breadcrumbs/css/breadcrumbs.css.map +0 -1
- package/src/bulkActionPopup/css/bulkActionPopup.css.map +0 -1
- package/src/calculator/css/calculator.css.map +0 -1
- package/src/class/css/selector.css.map +0 -1
- package/src/component/css/components.css.map +0 -1
- package/src/component/css/windowComponent.css.map +0 -1
- package/src/contextualPopup/css/contextualPopup.css.map +0 -1
- package/src/dashboard/css/dashboard.css.map +0 -1
- package/src/datalist/css/datalist.css.map +0 -1
- package/src/datatable/css/datatable.css.map +0 -1
- package/src/dateRange/css/dateRange.css.map +0 -1
- package/src/datetime/css/picker.css.map +0 -1
- package/src/destination/css/selector.css.map +0 -1
- package/src/documentViewer/css/documentViewer.css.map +0 -1
- package/src/dropdown/css/dropdown.css.map +0 -1
- package/src/dynamicComponent/css/dynamicComponent.css.map +0 -1
- package/src/form/css/dropdownForm.css.map +0 -1
- package/src/form/css/form.css.map +0 -1
- package/src/form/validator/css/validator.css.map +0 -1
- package/src/form/widget/css/widget.css.map +0 -1
- package/src/generis/form/css/form.css.map +0 -1
- package/src/generis/validator/css/validator.css.map +0 -1
- package/src/generis/widget/css/widget.css.map +0 -1
- package/src/itemButtonList/css/item-button-list.css.map +0 -1
- package/src/listbox/css/listbox.css.map +0 -1
- package/src/loadingButton/css/button.css.map +0 -1
- package/src/maths/calculator/css/calculator.css.map +0 -1
- package/src/mediaplayer/css/player.css.map +0 -1
- package/src/pagination/css/pagination.css.map +0 -1
- package/src/resource/css/selector.css.map +0 -1
- package/src/resourcemgr/css/resourcemgr.css.map +0 -1
- package/src/searchModal/css/advancedSearch.css.map +0 -1
- package/src/searchModal/css/searchModal.css.map +0 -1
- package/src/switch/css/switch.css.map +0 -1
- package/src/tabs/css/tabs.css.map +0 -1
- package/src/taskQueue/css/taskQueue.css.map +0 -1
- package/src/taskQueueButton/css/taskable.css.map +0 -1
- package/src/taskQueueButton/css/treeButton.css.map +0 -1
- package/src/tristateCheckboxGroup/css/tristateCheckboxGroup.css.map +0 -1
- 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(
|
|
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
|
-
|
|
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
|
-
|
|
310
|
-
|
|
309
|
+
//get options using default
|
|
311
310
|
options = _.defaults(options || {}, defaults);
|
|
312
311
|
return this.each(function () {
|
|
313
|
-
var $elt = $$1(this)
|
|
314
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
438
|
+
uploader._upload($elt, options.files);
|
|
438
439
|
}).removeProp('disabled');
|
|
439
440
|
}
|
|
440
441
|
|
|
441
442
|
if (options.read) {
|
|
442
|
-
|
|
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
|
-
|
|
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
|
|
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
|
-
//
|
|
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 (
|
|
738
|
+
reader.onloadstart = function () {
|
|
742
739
|
options.$progressBar.progressbar('value', 0);
|
|
743
740
|
/**
|
|
744
741
|
* The reading starts
|
package/package.json
CHANGED
package/scss/inc/_base.scss
CHANGED
package/scss/inc/_forms.scss
CHANGED
|
@@ -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
|
|
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
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
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
|
-
|
|
64
|
-
|
|
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}`, [
|
|
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.
|
|
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 (
|
|
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
|
-
|
|
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, {
|
|
284
|
-
|
|
293
|
+
data: _.merge(parameters, options.params, {
|
|
294
|
+
childrenOffset: (selectedClass.page - 1) * selectedClass.childrenLimit
|
|
295
|
+
}),
|
|
296
|
+
noToken: true
|
|
285
297
|
})
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
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));
|