@oat-sa/tao-core-ui 1.61.0 → 1.61.1
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/actionbar.js +384 -401
- package/dist/adder.js +34 -47
- package/dist/animable/absorbable/absorbable.js +202 -205
- package/dist/animable/absorbable/css/absorb.css +0 -1
- package/dist/animable/absorbable/css/absorb.css.map +1 -1
- package/dist/animable/pulsable/pulsable.js +169 -169
- package/dist/areaBroker.js +8 -21
- package/dist/autocomplete/css/autocomplete.css +0 -1
- package/dist/autocomplete/css/autocomplete.css.map +1 -1
- package/dist/autocomplete.js +88 -198
- package/dist/autoscroll.js +1 -3
- package/dist/badge/badge.js +195 -193
- package/dist/badge/css/badge.css +0 -1
- package/dist/badge/css/badge.css.map +1 -1
- package/dist/breadcrumbs.js +279 -278
- package/dist/btngrouper.js +19 -31
- package/dist/bulkActionPopup.js +496 -496
- package/dist/button.js +291 -284
- package/dist/calculator.js +8 -21
- package/dist/cascadingComboBox.js +252 -251
- package/dist/ckeditor/ckConfigurator.js +82 -106
- package/dist/ckeditor/dtdHandler.js +195 -235
- package/dist/class/selector.js +429 -462
- package/dist/component/alignable.js +16 -40
- package/dist/component/containable.js +16 -21
- package/dist/component/draggable.js +9 -11
- package/dist/component/placeable.js +14 -32
- package/dist/component/resizable.js +18 -28
- package/dist/component/stackable.js +1 -7
- package/dist/component/windowed.js +278 -291
- package/dist/component.js +422 -450
- package/dist/container.js +3 -22
- package/dist/contextualPopup.js +408 -427
- package/dist/dashboard.js +297 -300
- package/dist/datalist.js +773 -781
- package/dist/datatable/filterStrategy/filterStrategy.js +1 -3
- package/dist/datatable/filterStrategy/multiple.js +1 -20
- package/dist/datatable/filterStrategy/single.js +3 -15
- package/dist/datatable.js +1568 -1626
- package/dist/dateRange/dateRange.js +389 -403
- package/dist/datetime/picker.js +655 -688
- package/dist/deleter.js +374 -389
- package/dist/destination/selector.js +288 -286
- package/dist/dialog/alert.js +4 -6
- package/dist/dialog/confirm.js +2 -5
- package/dist/dialog/confirmDelete.js +219 -217
- package/dist/dialog.js +642 -686
- package/dist/disabler.js +18 -29
- package/dist/documentViewer/providers/pdfViewer/fallback/viewer.js +167 -164
- package/dist/documentViewer/providers/pdfViewer/pdfjs/areaBroker.js +7 -4
- package/dist/documentViewer/providers/pdfViewer/pdfjs/findBar.js +505 -546
- package/dist/documentViewer/providers/pdfViewer/pdfjs/pageView.js +371 -388
- package/dist/documentViewer/providers/pdfViewer/pdfjs/pagesManager.js +1 -16
- package/dist/documentViewer/providers/pdfViewer/pdfjs/searchEngine.js +513 -563
- package/dist/documentViewer/providers/pdfViewer/pdfjs/textManager.js +6 -29
- package/dist/documentViewer/providers/pdfViewer/pdfjs/viewer.js +368 -379
- package/dist/documentViewer/providers/pdfViewer/pdfjs/wrapper.js +14 -41
- package/dist/documentViewer/providers/pdfViewer.js +184 -186
- package/dist/documentViewer/viewerFactory.js +5 -10
- package/dist/documentViewer.js +288 -296
- package/dist/dropdown.js +383 -403
- package/dist/durationer.js +19 -27
- package/dist/dynamicComponent.js +587 -622
- package/dist/feedback.js +358 -368
- package/dist/figure/FigureStateActive.js +150 -182
- package/dist/filesender.js +18 -28
- package/dist/filter.js +238 -234
- package/dist/form/dropdownForm.js +352 -357
- package/dist/form/form.js +685 -966
- package/dist/form/simpleForm.js +3 -6
- package/dist/form/validator/renderer.js +229 -235
- package/dist/form/validator/validator.js +178 -264
- package/dist/form/widget/definitions.js +3 -4
- package/dist/form/widget/providers/checkBox.js +251 -258
- package/dist/form/widget/providers/comboBox.js +188 -187
- package/dist/form/widget/providers/default.js +9 -15
- package/dist/form/widget/providers/hidden.js +172 -169
- package/dist/form/widget/providers/hiddenBox.js +254 -264
- package/dist/form/widget/providers/radioBox.js +216 -217
- package/dist/form/widget/providers/textArea.js +191 -187
- package/dist/form/widget/providers/textBox.js +2 -3
- package/dist/form/widget/widget.js +465 -493
- package/dist/form.js +2 -7
- package/dist/formValidator/formValidator.js +13 -30
- package/dist/formValidator/highlighters/highlighter.js +2 -10
- package/dist/formValidator/highlighters/message.js +2 -3
- package/dist/formValidator/highlighters/tooltip.js +1 -3
- package/dist/generis/form/form.js +316 -324
- package/dist/generis/validator/validator.js +209 -210
- package/dist/generis/widget/checkBox/checkBox.js +224 -222
- package/dist/generis/widget/comboBox/comboBox.js +185 -179
- package/dist/generis/widget/hiddenBox/hiddenBox.js +228 -229
- package/dist/generis/widget/loader.js +1 -3
- package/dist/generis/widget/textBox/textBox.js +174 -168
- package/dist/generis/widget/widget.js +248 -259
- package/dist/groupedComboBox.js +229 -224
- package/dist/groupvalidator.js +11 -15
- package/dist/hider.js +2 -9
- package/dist/highlighter.js +940 -1051
- package/dist/image/ImgStateActive/extractLabel.js +0 -1
- package/dist/image/ImgStateActive/helper.js +5 -9
- package/dist/image/ImgStateActive/initHelper.js +48 -77
- package/dist/image/ImgStateActive/initMediaEditor.js +24 -44
- package/dist/image/ImgStateActive/mediaSizer.js +16 -26
- package/dist/image/ImgStateActive.js +81 -111
- package/dist/incrementer.js +33 -52
- package/dist/inplacer.js +21 -45
- package/dist/interactUtils.js +14 -25
- package/dist/itemButtonList/css/item-button-list.css +0 -1
- package/dist/itemButtonList/css/item-button-list.css.map +1 -1
- package/dist/itemButtonList.js +428 -453
- package/dist/keyNavigation/navigableDomElement.js +47 -81
- package/dist/keyNavigation/navigator.js +76 -153
- package/dist/listbox.js +454 -467
- package/dist/liststyler.js +18 -19
- package/dist/loadingButton/loadingButton.js +214 -213
- package/dist/lock.js +468 -493
- package/dist/login/login.js +466 -481
- package/dist/maths/calculator/basicCalculator.js +244 -239
- package/dist/maths/calculator/calculatorComponent.js +5 -7
- package/dist/maths/calculator/core/areaBroker.js +5 -3
- package/dist/maths/calculator/core/board.js +757 -824
- package/dist/maths/calculator/core/expression.js +481 -499
- package/dist/maths/calculator/core/labels.js +237 -232
- package/dist/maths/calculator/core/plugin.js +1 -1
- package/dist/maths/calculator/core/terms.js +1 -1
- package/dist/maths/calculator/core/tokenizer.js +21 -34
- package/dist/maths/calculator/core/tokens.js +154 -165
- package/dist/maths/calculator/defaultCalculator.js +1 -4
- package/dist/maths/calculator/plugins/core/degrad.js +0 -8
- package/dist/maths/calculator/plugins/core/history.js +10 -22
- package/dist/maths/calculator/plugins/core/remind.js +0 -3
- package/dist/maths/calculator/plugins/core/stepNavigation.js +2 -18
- package/dist/maths/calculator/plugins/keyboard/templateKeyboard/templateKeyboard.js +251 -254
- package/dist/maths/calculator/plugins/modifiers/pow10.js +12 -17
- package/dist/maths/calculator/plugins/modifiers/sign.js +13 -40
- package/dist/maths/calculator/plugins/screen/simpleScreen/simpleScreen.js +279 -284
- package/dist/maths/calculator/pluginsLoader.js +1 -1
- package/dist/maths/calculator/scientificCalculator.js +336 -331
- package/dist/mediaEditor/mediaEditorComponent.js +237 -242
- package/dist/mediaEditor/plugins/mediaAlignment/helper.js +60 -18
- package/dist/mediaEditor/plugins/mediaAlignment/mediaAlignmentComponent.js +222 -231
- package/dist/mediaEditor/plugins/mediaDimension/helper.js +11 -36
- package/dist/mediaEditor/plugins/mediaDimension/mediaDimensionComponent.js +586 -624
- package/dist/mediaplayer/players/html5.js +642 -702
- package/dist/mediaplayer/players/youtube.js +388 -433
- package/dist/mediaplayer/players.js +1 -1
- package/dist/mediaplayer/support.js +11 -24
- package/dist/mediaplayer/utils/reminder.js +17 -28
- package/dist/mediaplayer/utils/timeObserver.js +14 -17
- package/dist/mediaplayer/youtubeManager.js +138 -166
- package/dist/mediaplayer.js +1471 -1761
- package/dist/mediasizer.js +622 -665
- package/dist/modal.js +50 -66
- package/dist/movableComponent.js +2 -2
- package/dist/pageSizeSelector.js +228 -221
- package/dist/pageStatus.js +10 -13
- package/dist/pagination/paginationStrategy.js +1 -2
- package/dist/pagination/providers/pages.js +277 -287
- package/dist/pagination/providers/simple.js +198 -192
- package/dist/pagination.js +4 -27
- package/dist/previewer.js +46 -71
- package/dist/progressbar.js +12 -22
- package/dist/propertySelector/propertySelector.js +433 -477
- package/dist/report.js +344 -347
- package/dist/resource/filters.js +267 -281
- package/dist/resource/list.js +1607 -1372
- package/dist/resource/selectable.js +9 -44
- package/dist/resource/selector.js +850 -909
- package/dist/resource/tree.js +1819 -1618
- package/dist/resourcemgr/fileBrowser.js +536 -583
- package/dist/resourcemgr/filePreview.js +16 -25
- package/dist/resourcemgr/fileSelector.js +516 -543
- package/dist/resourcemgr/util/updatePermissions.js +6 -14
- package/dist/resourcemgr.js +315 -322
- package/dist/scroller.js +3 -7
- package/dist/searchModal/advancedSearch.js +935 -1013
- package/dist/searchModal/css/searchModal.css +0 -1
- package/dist/searchModal/css/searchModal.css.map +1 -1
- package/dist/searchModal.js +257 -345
- package/dist/selecter.js +15 -22
- package/dist/stacker.js +9 -17
- package/dist/switch/switch.js +299 -305
- package/dist/tableModel.js +6 -16
- package/dist/tabs.js +568 -619
- package/dist/taskQueue/status.js +310 -315
- package/dist/taskQueue/table.js +374 -385
- package/dist/taskQueue/taskQueue.js +1 -1
- package/dist/taskQueue/taskQueueModel.js +450 -529
- package/dist/taskQueue.js +2 -20
- package/dist/taskQueueButton/standardButton.js +6 -4
- package/dist/taskQueueButton/taskable.js +260 -265
- package/dist/taskQueueButton/treeButton.js +193 -191
- package/dist/themeLoader.js +34 -54
- package/dist/themes.js +2 -16
- package/dist/toggler.js +19 -31
- package/dist/tooltip.js +289 -304
- package/dist/transformer.js +23 -52
- package/dist/tristateCheckboxGroup.js +310 -316
- package/dist/uploader.js +684 -717
- package/dist/validator/Report.js +1 -2
- package/dist/validator/Validator.js +6 -25
- package/dist/validator/validators.js +18 -32
- package/dist/validator.js +218 -254
- package/dist/waitForMedia.js +14 -20
- package/dist/waitingDialog/waitingDialog.js +5 -23
- package/package.json +1 -1
- package/scss/.DS_Store +0 -0
- package/scss/ckeditor/.DS_Store +0 -0
- package/scss/ckeditor/skins/.DS_Store +0 -0
- package/scss/ckeditor/skins/tao/.DS_Store +0 -0
- package/scss/ckeditor/skins/tao/scss/.DS_Store +0 -0
- package/scss/font/.DS_Store +0 -0
- package/scss/inc/.DS_Store +0 -0
- package/scss/inc/_feedback.scss +4 -0
- package/src/animable/absorbable/css/absorb.css +0 -1
- package/src/animable/absorbable/css/absorb.css.map +1 -1
- package/src/autocomplete/css/autocomplete.css +0 -1
- package/src/autocomplete/css/autocomplete.css.map +1 -1
- package/src/badge/css/badge.css +0 -1
- package/src/badge/css/badge.css.map +1 -1
- package/src/css/basic.css +4 -3
- package/src/css/basic.css.map +1 -1
- package/src/figure/FigureStateActive.js +15 -5
- package/src/itemButtonList/css/item-button-list.css +0 -1
- package/src/itemButtonList/css/item-button-list.css.map +1 -1
- package/src/mediaEditor/plugins/mediaAlignment/helper.js +48 -0
- package/src/searchModal/css/searchModal.css +0 -1
- package/src/searchModal/css/searchModal.css.map +1 -1
package/dist/actionbar.js
CHANGED
|
@@ -1,447 +1,430 @@
|
|
|
1
1
|
define(['jquery', 'lodash', 'ui/component', 'handlebars', 'i18n', 'lib/dompurify/purify'], function ($$1, _, component, Handlebars, __, DOMPurify) { 'use strict';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
3
|
+
$$1 = $$1 && Object.prototype.hasOwnProperty.call($$1, 'default') ? $$1['default'] : $$1;
|
|
4
|
+
_ = _ && Object.prototype.hasOwnProperty.call(_, 'default') ? _['default'] : _;
|
|
5
|
+
component = component && Object.prototype.hasOwnProperty.call(component, 'default') ? component['default'] : component;
|
|
6
|
+
Handlebars = Handlebars && Object.prototype.hasOwnProperty.call(Handlebars, 'default') ? Handlebars['default'] : Handlebars;
|
|
7
|
+
__ = __ && Object.prototype.hasOwnProperty.call(__, 'default') ? __['default'] : __;
|
|
8
|
+
DOMPurify = DOMPurify && Object.prototype.hasOwnProperty.call(DOMPurify, 'default') ? DOMPurify['default'] : DOMPurify;
|
|
9
9
|
|
|
10
|
-
function _typeof(obj) {
|
|
11
|
-
"@babel/helpers - typeof";
|
|
12
|
-
|
|
13
|
-
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
|
|
14
|
-
return typeof obj;
|
|
15
|
-
} : function (obj) {
|
|
16
|
-
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
17
|
-
}, _typeof(obj);
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
function Helpers0 (hb) {
|
|
21
|
-
//register a i18n helper
|
|
22
|
-
hb.registerHelper('__', function (key) {
|
|
23
|
-
return __(key);
|
|
24
|
-
});
|
|
25
10
|
/**
|
|
26
|
-
*
|
|
11
|
+
* This program is free software; you can redistribute it and/or
|
|
12
|
+
* modify it under the terms of the GNU General Public License
|
|
13
|
+
* as published by the Free Software Foundation; under version 2
|
|
14
|
+
* of the License (non-upgradable).
|
|
15
|
+
*
|
|
16
|
+
* This program is distributed in the hope that it will be useful,
|
|
17
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
18
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
19
|
+
* GNU General Public License for more details.
|
|
20
|
+
*
|
|
21
|
+
* You should have received a copy of the GNU General Public License
|
|
22
|
+
* along with this program; if not, write to the Free Software
|
|
23
|
+
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
24
|
+
*
|
|
25
|
+
* Copyright (c) 2013-2019 (original work) Open Assessment Technologies SA (under the project TAO-PRODUCT);
|
|
27
26
|
*
|
|
28
|
-
* https://github.com/cure53/DOMPurify
|
|
29
|
-
* with config SAFE_FOR_TEMPLATES: true
|
|
30
|
-
* to make output safe for template systems
|
|
31
|
-
*/
|
|
32
|
-
|
|
33
|
-
hb.registerHelper('dompurify', function (context) {
|
|
34
|
-
return DOMPurify.sanitize(context);
|
|
35
|
-
});
|
|
36
|
-
/**
|
|
37
|
-
* Register join helper
|
|
38
27
|
*
|
|
39
|
-
* Example :
|
|
40
|
-
* var values = {a:v1, b:v2, c:v3};
|
|
41
|
-
* Using {{{join attributes '=' ' ' '"'}}} will return : a="v1" b="v2" c="v3"
|
|
42
|
-
* Using {{{join values null ' or ' '*'}}} will return : *v1* or *v2* or *v3*
|
|
43
28
|
*/
|
|
29
|
+
function Helpers0 (hb) {
|
|
30
|
+
//register a i18n helper
|
|
31
|
+
hb.registerHelper('__', function (key) {
|
|
32
|
+
return __(key);
|
|
33
|
+
});
|
|
44
34
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
35
|
+
/**
|
|
36
|
+
* Register dompurify helper
|
|
37
|
+
*
|
|
38
|
+
* https://github.com/cure53/DOMPurify
|
|
39
|
+
* with config SAFE_FOR_TEMPLATES: true
|
|
40
|
+
* to make output safe for template systems
|
|
41
|
+
*/
|
|
42
|
+
hb.registerHelper('dompurify', function (context) {
|
|
43
|
+
return DOMPurify.sanitize(context);
|
|
44
|
+
});
|
|
53
45
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
46
|
+
/**
|
|
47
|
+
* Register join helper
|
|
48
|
+
*
|
|
49
|
+
* Example :
|
|
50
|
+
* var values = {a:v1, b:v2, c:v3};
|
|
51
|
+
* Using {{{join attributes '=' ' ' '"'}}} will return : a="v1" b="v2" c="v3"
|
|
52
|
+
* Using {{{join values null ' or ' '*'}}} will return : *v1* or *v2* or *v3*
|
|
53
|
+
*/
|
|
54
|
+
hb.registerHelper('join', function (arr, keyValueGlue, fragmentGlue, wrapper) {
|
|
55
|
+
var fragments = [];
|
|
56
|
+
keyValueGlue = typeof keyValueGlue === 'string' ? keyValueGlue : undefined;
|
|
57
|
+
fragmentGlue = typeof fragmentGlue === 'string' ? fragmentGlue : ' ';
|
|
58
|
+
wrapper = typeof wrapper === 'string' ? wrapper : '"';
|
|
59
|
+
_.forIn(arr, function (value, key) {
|
|
60
|
+
var fragment = '';
|
|
61
|
+
if (value !== null || value !== undefined) {
|
|
62
|
+
if (typeof value === 'boolean') {
|
|
63
|
+
value = value ? 'true' : 'false';
|
|
64
|
+
} else if (typeof value === 'object') {
|
|
65
|
+
value = _.values(value).join(' ');
|
|
66
|
+
}
|
|
67
|
+
} else {
|
|
68
|
+
value = '';
|
|
59
69
|
}
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
70
|
+
if (keyValueGlue !== undefined) {
|
|
71
|
+
fragment += key + keyValueGlue;
|
|
72
|
+
}
|
|
73
|
+
fragment += wrapper + value + wrapper;
|
|
74
|
+
fragments.push(fragment);
|
|
75
|
+
});
|
|
76
|
+
return fragments.join(fragmentGlue);
|
|
77
|
+
});
|
|
63
78
|
|
|
64
|
-
|
|
65
|
-
|
|
79
|
+
//register a classic "for loop" helper
|
|
80
|
+
//it also adds a local variable "i" as the index in each iteration loop
|
|
81
|
+
hb.registerHelper('for', function (startIndex, stopIndex, increment, options) {
|
|
82
|
+
var ret = '';
|
|
83
|
+
startIndex = parseInt(startIndex);
|
|
84
|
+
stopIndex = parseInt(stopIndex);
|
|
85
|
+
increment = parseInt(increment);
|
|
86
|
+
for (var i = startIndex; i < stopIndex; i += increment) {
|
|
87
|
+
ret += options.fn(_.extend({}, this, {
|
|
88
|
+
i: i
|
|
89
|
+
}));
|
|
90
|
+
}
|
|
91
|
+
return ret;
|
|
92
|
+
});
|
|
93
|
+
hb.registerHelper('equal', function (var1, var2, options) {
|
|
94
|
+
if (var1 == var2) {
|
|
95
|
+
return options.fn(this);
|
|
96
|
+
} else {
|
|
97
|
+
return options.inverse(this);
|
|
66
98
|
}
|
|
67
|
-
|
|
68
|
-
fragment += wrapper + value + wrapper;
|
|
69
|
-
fragments.push(fragment);
|
|
70
99
|
});
|
|
71
100
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
var ret = '';
|
|
78
|
-
startIndex = parseInt(startIndex);
|
|
79
|
-
stopIndex = parseInt(stopIndex);
|
|
80
|
-
increment = parseInt(increment);
|
|
81
|
-
|
|
82
|
-
for (var i = startIndex; i < stopIndex; i += increment) {
|
|
83
|
-
ret += options.fn(_.extend({}, this, {
|
|
84
|
-
i: i
|
|
85
|
-
}));
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
return ret;
|
|
89
|
-
});
|
|
90
|
-
hb.registerHelper('equal', function (var1, var2, options) {
|
|
91
|
-
if (var1 == var2) {
|
|
92
|
-
return options.fn(this);
|
|
93
|
-
} else {
|
|
94
|
-
return options.inverse(this);
|
|
95
|
-
}
|
|
96
|
-
}); // register a "get property" helper
|
|
97
|
-
// it gets the named property from the provided context
|
|
98
|
-
|
|
99
|
-
hb.registerHelper('property', function (name, context) {
|
|
100
|
-
return context[name] || '';
|
|
101
|
-
}); // register an 'includes' helper
|
|
102
|
-
// it checks if value is in array
|
|
103
|
-
|
|
104
|
-
hb.registerHelper('includes', function (haystack, needle, options) {
|
|
105
|
-
if (_.contains(haystack, needle)) {
|
|
106
|
-
return options.fn(this);
|
|
107
|
-
}
|
|
108
|
-
});
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
if (!Helpers0.__initialized) {
|
|
112
|
-
Helpers0(Handlebars);
|
|
113
|
-
Helpers0.__initialized = true;
|
|
114
|
-
}
|
|
115
|
-
var Template = Handlebars.template(function (Handlebars,depth0,helpers,partials,data) {
|
|
116
|
-
this.compilerInfo = [4,'>= 1.0.0'];
|
|
117
|
-
helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
|
|
118
|
-
var buffer = "", stack1, functionType="function", escapeExpression=this.escapeExpression, self=this;
|
|
119
|
-
|
|
120
|
-
function program1(depth0,data) {
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
return "vertical-action-bar";
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
function program3(depth0,data) {
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
return "horizontal-action-bar";
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
function program5(depth0,data) {
|
|
133
|
-
|
|
134
|
-
var buffer = "", stack1, helper;
|
|
135
|
-
buffer += "\n <button class=\"btn-info small ";
|
|
136
|
-
stack1 = helpers['if'].call(depth0, (depth0 && depth0.conditional), {hash:{},inverse:self.noop,fn:self.program(6, program6, data),data:data});
|
|
137
|
-
if(stack1 || stack1 === 0) { buffer += stack1; }
|
|
138
|
-
buffer += "\" data-control=\"";
|
|
139
|
-
if (helper = helpers.id) { stack1 = helper.call(depth0, {hash:{},data:data}); }
|
|
140
|
-
else { helper = (depth0 && depth0.id); stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{},data:data}) : helper; }
|
|
141
|
-
buffer += escapeExpression(stack1)
|
|
142
|
-
+ "\" ";
|
|
143
|
-
stack1 = helpers['if'].call(depth0, (depth0 && depth0.title), {hash:{},inverse:self.noop,fn:self.program(8, program8, data),data:data});
|
|
144
|
-
if(stack1 || stack1 === 0) { buffer += stack1; }
|
|
145
|
-
buffer += ">\n ";
|
|
146
|
-
stack1 = helpers['if'].call(depth0, (depth0 && depth0.icon), {hash:{},inverse:self.noop,fn:self.program(10, program10, data),data:data});
|
|
147
|
-
if(stack1 || stack1 === 0) { buffer += stack1; }
|
|
148
|
-
buffer += "\n ";
|
|
149
|
-
if (helper = helpers.label) { stack1 = helper.call(depth0, {hash:{},data:data}); }
|
|
150
|
-
else { helper = (depth0 && depth0.label); stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{},data:data}) : helper; }
|
|
151
|
-
buffer += escapeExpression(stack1)
|
|
152
|
-
+ "\n </button>\n ";
|
|
153
|
-
return buffer;
|
|
154
|
-
}
|
|
155
|
-
function program6(depth0,data) {
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
return " conditional hidden";
|
|
159
|
-
}
|
|
101
|
+
// register a "get property" helper
|
|
102
|
+
// it gets the named property from the provided context
|
|
103
|
+
hb.registerHelper('property', function (name, context) {
|
|
104
|
+
return context[name] || '';
|
|
105
|
+
});
|
|
160
106
|
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
+ "\"";
|
|
169
|
-
return buffer;
|
|
107
|
+
// register an 'includes' helper
|
|
108
|
+
// it checks if value is in array
|
|
109
|
+
hb.registerHelper('includes', function (haystack, needle, options) {
|
|
110
|
+
if (_.contains(haystack, needle)) {
|
|
111
|
+
return options.fn(this);
|
|
112
|
+
}
|
|
113
|
+
});
|
|
170
114
|
}
|
|
171
115
|
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
buffer += "<span class=\"icon icon-";
|
|
176
|
-
if (helper = helpers.icon) { stack1 = helper.call(depth0, {hash:{},data:data}); }
|
|
177
|
-
else { helper = (depth0 && depth0.icon); stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{},data:data}) : helper; }
|
|
178
|
-
buffer += escapeExpression(stack1)
|
|
179
|
-
+ "\"></span>";
|
|
180
|
-
return buffer;
|
|
116
|
+
if (!Helpers0.__initialized) {
|
|
117
|
+
Helpers0(Handlebars);
|
|
118
|
+
Helpers0.__initialized = true;
|
|
181
119
|
}
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
});
|
|
192
|
-
function mainTpl(data, options, asString) {
|
|
193
|
-
var html = Template(data, options);
|
|
194
|
-
return (asString || true) ? html : $(html);
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
/**
|
|
198
|
-
* This program is free software; you can redistribute it and/or
|
|
199
|
-
* modify it under the terms of the GNU General Public License
|
|
200
|
-
* as published by the Free Software Foundation; under version 2
|
|
201
|
-
* of the License (non-upgradable).
|
|
202
|
-
*
|
|
203
|
-
* This program is distributed in the hope that it will be useful,
|
|
204
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
205
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
206
|
-
* GNU General Public License for more details.
|
|
207
|
-
*
|
|
208
|
-
* You should have received a copy of the GNU General Public License
|
|
209
|
-
* along with this program; if not, write to the Free Software
|
|
210
|
-
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
211
|
-
*
|
|
212
|
-
* Copyright (c) 2016 (original work) Open Assessment Technologies SA ;
|
|
213
|
-
*/
|
|
214
|
-
/**
|
|
215
|
-
* Defines an action bar
|
|
216
|
-
* @type {Object}
|
|
217
|
-
*/
|
|
218
|
-
|
|
219
|
-
var actionbar = {
|
|
220
|
-
/**
|
|
221
|
-
* Gets the definition of a button
|
|
222
|
-
* @param {String} id - The identifier of the button
|
|
223
|
-
* @returns {Object|undefined}
|
|
224
|
-
*/
|
|
225
|
-
getButton: function getButton(id) {
|
|
226
|
-
if (this.is('rendered')) {
|
|
227
|
-
return this.buttons[id];
|
|
120
|
+
var Template = Handlebars.template(function (Handlebars,depth0,helpers,partials,data) {
|
|
121
|
+
this.compilerInfo = [4,'>= 1.0.0'];
|
|
122
|
+
helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
|
|
123
|
+
var buffer = "", stack1, functionType="function", escapeExpression=this.escapeExpression, self=this;
|
|
124
|
+
|
|
125
|
+
function program1(depth0,data) {
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
return "vertical-action-bar";
|
|
228
129
|
}
|
|
229
|
-
},
|
|
230
130
|
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
*/
|
|
236
|
-
getButtonElement: function getButtonElement(id) {
|
|
237
|
-
if (this.is('rendered')) {
|
|
238
|
-
return this.controls.$buttons[id];
|
|
131
|
+
function program3(depth0,data) {
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
return "horizontal-action-bar";
|
|
239
135
|
}
|
|
240
|
-
},
|
|
241
136
|
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
137
|
+
function program5(depth0,data) {
|
|
138
|
+
|
|
139
|
+
var buffer = "", stack1, helper;
|
|
140
|
+
buffer += "\n <button class=\"btn-info small ";
|
|
141
|
+
stack1 = helpers['if'].call(depth0, (depth0 && depth0.conditional), {hash:{},inverse:self.noop,fn:self.program(6, program6, data),data:data});
|
|
142
|
+
if(stack1 || stack1 === 0) { buffer += stack1; }
|
|
143
|
+
buffer += "\" data-control=\"";
|
|
144
|
+
if (helper = helpers.id) { stack1 = helper.call(depth0, {hash:{},data:data}); }
|
|
145
|
+
else { helper = (depth0 && depth0.id); stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{},data:data}) : helper; }
|
|
146
|
+
buffer += escapeExpression(stack1)
|
|
147
|
+
+ "\" ";
|
|
148
|
+
stack1 = helpers['if'].call(depth0, (depth0 && depth0.title), {hash:{},inverse:self.noop,fn:self.program(8, program8, data),data:data});
|
|
149
|
+
if(stack1 || stack1 === 0) { buffer += stack1; }
|
|
150
|
+
buffer += ">\n ";
|
|
151
|
+
stack1 = helpers['if'].call(depth0, (depth0 && depth0.icon), {hash:{},inverse:self.noop,fn:self.program(10, program10, data),data:data});
|
|
152
|
+
if(stack1 || stack1 === 0) { buffer += stack1; }
|
|
153
|
+
buffer += "\n ";
|
|
154
|
+
if (helper = helpers.label) { stack1 = helper.call(depth0, {hash:{},data:data}); }
|
|
155
|
+
else { helper = (depth0 && depth0.label); stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{},data:data}) : helper; }
|
|
156
|
+
buffer += escapeExpression(stack1)
|
|
157
|
+
+ "\n </button>\n ";
|
|
158
|
+
return buffer;
|
|
252
159
|
}
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
/**
|
|
258
|
-
* Hides a button
|
|
259
|
-
* @param {String} id - The identifier of the button
|
|
260
|
-
* @returns {actionbar}
|
|
261
|
-
*/
|
|
262
|
-
hideButton: function hideButton(id) {
|
|
263
|
-
var $btn = this.getButtonElement(id);
|
|
264
|
-
|
|
265
|
-
if ($btn) {
|
|
266
|
-
$btn.addClass('hidden');
|
|
160
|
+
function program6(depth0,data) {
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
return " conditional hidden";
|
|
267
164
|
}
|
|
268
165
|
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
toggleButton: function toggleButton(id, condition) {
|
|
279
|
-
var $btn = this.getButtonElement(id);
|
|
280
|
-
|
|
281
|
-
if ($btn) {
|
|
282
|
-
if (undefined !== condition) {
|
|
283
|
-
condition = !condition;
|
|
284
|
-
}
|
|
285
|
-
|
|
286
|
-
$btn.toggleClass('hidden', condition);
|
|
166
|
+
function program8(depth0,data) {
|
|
167
|
+
|
|
168
|
+
var buffer = "", stack1, helper;
|
|
169
|
+
buffer += " title=\"";
|
|
170
|
+
if (helper = helpers.title) { stack1 = helper.call(depth0, {hash:{},data:data}); }
|
|
171
|
+
else { helper = (depth0 && depth0.title); stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{},data:data}) : helper; }
|
|
172
|
+
buffer += escapeExpression(stack1)
|
|
173
|
+
+ "\"";
|
|
174
|
+
return buffer;
|
|
287
175
|
}
|
|
288
176
|
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
this.controls.$conditional.removeClass('hidden');
|
|
177
|
+
function program10(depth0,data) {
|
|
178
|
+
|
|
179
|
+
var buffer = "", stack1, helper;
|
|
180
|
+
buffer += "<span class=\"icon icon-";
|
|
181
|
+
if (helper = helpers.icon) { stack1 = helper.call(depth0, {hash:{},data:data}); }
|
|
182
|
+
else { helper = (depth0 && depth0.icon); stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{},data:data}) : helper; }
|
|
183
|
+
buffer += escapeExpression(stack1)
|
|
184
|
+
+ "\"></span>";
|
|
185
|
+
return buffer;
|
|
299
186
|
}
|
|
300
187
|
|
|
301
|
-
|
|
302
|
-
|
|
188
|
+
buffer += "<aside class=\"action-bar ";
|
|
189
|
+
stack1 = helpers['if'].call(depth0, (depth0 && depth0.vertical), {hash:{},inverse:self.program(3, program3, data),fn:self.program(1, program1, data),data:data});
|
|
190
|
+
if(stack1 || stack1 === 0) { buffer += stack1; }
|
|
191
|
+
buffer += " clearfix\">\n ";
|
|
192
|
+
stack1 = helpers.each.call(depth0, (depth0 && depth0.buttons), {hash:{},inverse:self.noop,fn:self.program(5, program5, data),data:data});
|
|
193
|
+
if(stack1 || stack1 === 0) { buffer += stack1; }
|
|
194
|
+
buffer += "\n</aside>\n";
|
|
195
|
+
return buffer;
|
|
196
|
+
});
|
|
197
|
+
function mainTpl(data, options, asString) {
|
|
198
|
+
var html = Template(data, options);
|
|
199
|
+
return (asString || true) ? html : $(html);
|
|
200
|
+
}
|
|
303
201
|
|
|
304
202
|
/**
|
|
305
|
-
*
|
|
306
|
-
*
|
|
203
|
+
* This program is free software; you can redistribute it and/or
|
|
204
|
+
* modify it under the terms of the GNU General Public License
|
|
205
|
+
* as published by the Free Software Foundation; under version 2
|
|
206
|
+
* of the License (non-upgradable).
|
|
207
|
+
*
|
|
208
|
+
* This program is distributed in the hope that it will be useful,
|
|
209
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
210
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
211
|
+
* GNU General Public License for more details.
|
|
212
|
+
*
|
|
213
|
+
* You should have received a copy of the GNU General Public License
|
|
214
|
+
* along with this program; if not, write to the Free Software
|
|
215
|
+
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
216
|
+
*
|
|
217
|
+
* Copyright (c) 2016 (original work) Open Assessment Technologies SA ;
|
|
307
218
|
*/
|
|
308
|
-
hideConditionals: function hideConditionals() {
|
|
309
|
-
if (this.is('rendered')) {
|
|
310
|
-
this.controls.$conditional.addClass('hidden');
|
|
311
|
-
}
|
|
312
|
-
|
|
313
|
-
return this;
|
|
314
|
-
},
|
|
315
219
|
|
|
316
220
|
/**
|
|
317
|
-
*
|
|
318
|
-
* @
|
|
319
|
-
* @returns {actionbar}
|
|
221
|
+
* Defines an action bar
|
|
222
|
+
* @type {Object}
|
|
320
223
|
*/
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
224
|
+
var actionbar = {
|
|
225
|
+
/**
|
|
226
|
+
* Gets the definition of a button
|
|
227
|
+
* @param {String} id - The identifier of the button
|
|
228
|
+
* @returns {Object|undefined}
|
|
229
|
+
*/
|
|
230
|
+
getButton: function getButton(id) {
|
|
231
|
+
if (this.is('rendered')) {
|
|
232
|
+
return this.buttons[id];
|
|
325
233
|
}
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
234
|
+
},
|
|
235
|
+
/**
|
|
236
|
+
* Gets the DOM element of a button
|
|
237
|
+
* @param {String} id - The identifier of the button
|
|
238
|
+
* @returns {jQuery|undefined}
|
|
239
|
+
*/
|
|
240
|
+
getButtonElement: function getButtonElement(id) {
|
|
241
|
+
if (this.is('rendered')) {
|
|
242
|
+
return this.controls.$buttons[id];
|
|
243
|
+
}
|
|
244
|
+
},
|
|
245
|
+
/**
|
|
246
|
+
* Shows a button
|
|
247
|
+
* @param {String} id - The identifier of the button
|
|
248
|
+
* @returns {actionbar}
|
|
249
|
+
*/
|
|
250
|
+
showButton: function showButton(id) {
|
|
251
|
+
var $btn = this.getButtonElement(id);
|
|
252
|
+
if ($btn) {
|
|
253
|
+
$btn.removeClass('hidden');
|
|
254
|
+
}
|
|
255
|
+
return this;
|
|
256
|
+
},
|
|
257
|
+
/**
|
|
258
|
+
* Hides a button
|
|
259
|
+
* @param {String} id - The identifier of the button
|
|
260
|
+
* @returns {actionbar}
|
|
261
|
+
*/
|
|
262
|
+
hideButton: function hideButton(id) {
|
|
263
|
+
var $btn = this.getButtonElement(id);
|
|
264
|
+
if ($btn) {
|
|
265
|
+
$btn.addClass('hidden');
|
|
266
|
+
}
|
|
267
|
+
return this;
|
|
268
|
+
},
|
|
269
|
+
/**
|
|
270
|
+
* Toggles a button according to a condition
|
|
271
|
+
* @param {String} id - The identifier of the button
|
|
272
|
+
* @param {Boolean} condition - If the condition is `true` the button will be displayed
|
|
273
|
+
* @returns {actionbar}
|
|
274
|
+
*/
|
|
275
|
+
toggleButton: function toggleButton(id, condition) {
|
|
276
|
+
var $btn = this.getButtonElement(id);
|
|
277
|
+
if ($btn) {
|
|
278
|
+
if (undefined !== condition) {
|
|
279
|
+
condition = !condition;
|
|
280
|
+
}
|
|
281
|
+
$btn.toggleClass('hidden', condition);
|
|
282
|
+
}
|
|
283
|
+
return this;
|
|
284
|
+
},
|
|
285
|
+
/**
|
|
286
|
+
* Shows the conditional buttons
|
|
287
|
+
* @returns {actionbar}
|
|
288
|
+
*/
|
|
289
|
+
showConditionals: function showConditionals() {
|
|
290
|
+
if (this.is('rendered')) {
|
|
291
|
+
this.controls.$conditional.removeClass('hidden');
|
|
292
|
+
}
|
|
293
|
+
return this;
|
|
294
|
+
},
|
|
295
|
+
/**
|
|
296
|
+
* Hides the conditional buttons
|
|
297
|
+
* @returns {actionbar}
|
|
298
|
+
*/
|
|
299
|
+
hideConditionals: function hideConditionals() {
|
|
300
|
+
if (this.is('rendered')) {
|
|
301
|
+
this.controls.$conditional.addClass('hidden');
|
|
302
|
+
}
|
|
303
|
+
return this;
|
|
304
|
+
},
|
|
305
|
+
/**
|
|
306
|
+
* Toggles the conditional buttons according to a condition
|
|
307
|
+
* @param {Boolean} condition - If the condition is `true` the conditional buttons will be displayed
|
|
308
|
+
* @returns {actionbar}
|
|
309
|
+
*/
|
|
310
|
+
toggleConditionals: function toggleConditionals(condition) {
|
|
311
|
+
if (this.is('rendered')) {
|
|
312
|
+
if (undefined !== condition) {
|
|
313
|
+
condition = !condition;
|
|
314
|
+
}
|
|
315
|
+
this.controls.$conditional.toggleClass('hidden', condition);
|
|
316
|
+
}
|
|
317
|
+
return this;
|
|
318
|
+
},
|
|
319
|
+
/**
|
|
320
|
+
* Shows all the buttons
|
|
321
|
+
* @returns {actionbar}
|
|
322
|
+
*/
|
|
323
|
+
showAll: function showAll() {
|
|
324
|
+
if (this.is('rendered')) {
|
|
325
|
+
this.controls.$all.removeClass('hidden');
|
|
326
|
+
}
|
|
327
|
+
return this;
|
|
328
|
+
},
|
|
329
|
+
/**
|
|
330
|
+
* Hides all the buttons
|
|
331
|
+
* @returns {actionbar}
|
|
332
|
+
*/
|
|
333
|
+
hideAll: function hideAll() {
|
|
334
|
+
if (this.is('rendered')) {
|
|
335
|
+
this.controls.$all.addClass('hidden');
|
|
336
|
+
}
|
|
337
|
+
return this;
|
|
338
|
+
},
|
|
339
|
+
/**
|
|
340
|
+
* Toggles all the buttons according to a condition
|
|
341
|
+
* @param {Boolean} condition - If the condition is `true` the buttons will be displayed
|
|
342
|
+
* @returns {actionbar}
|
|
343
|
+
*/
|
|
344
|
+
toggleAll: function toggleAll(condition) {
|
|
345
|
+
if (this.is('rendered')) {
|
|
346
|
+
if (undefined !== condition) {
|
|
347
|
+
condition = !condition;
|
|
348
|
+
}
|
|
349
|
+
this.controls.$all.toggleClass('hidden', condition);
|
|
350
|
+
}
|
|
351
|
+
return this;
|
|
352
352
|
}
|
|
353
|
-
|
|
354
|
-
return this;
|
|
355
|
-
},
|
|
353
|
+
};
|
|
356
354
|
|
|
357
355
|
/**
|
|
358
|
-
*
|
|
359
|
-
* @param {
|
|
356
|
+
* Builds an instance of the actionbar component
|
|
357
|
+
* @param {Object} config
|
|
358
|
+
* @param {Array} config.buttons - The list of buttons to display.
|
|
359
|
+
* @param {String} config.buttons.id - The id of the button
|
|
360
|
+
* @param {String} config.buttons.label - The text displayed in the button
|
|
361
|
+
* @param {String} config.buttons.icon - An optional icon displayed in the button
|
|
362
|
+
* @param {String} config.buttons.title - An optional tooltip displayed on the button
|
|
363
|
+
* @param {Boolean} config.buttons.conditional - The button is hidden by default and must be displayed later
|
|
364
|
+
* @param {Function} config.buttons.action - An action called when the button is clicked
|
|
365
|
+
* @param {Boolean} [config.vertical] - Displays the action bar vertically
|
|
360
366
|
* @returns {actionbar}
|
|
367
|
+
*
|
|
368
|
+
* @event init - Emitted when the component is initialized
|
|
369
|
+
* @event destroy - Emitted when the component is destroying
|
|
370
|
+
* @event render - Emitted when the component is rendered
|
|
371
|
+
* @event button - Emitted when a button is clicked
|
|
372
|
+
* @event show - Emitted when the component is shown
|
|
373
|
+
* @event hide - Emitted when the component is hidden
|
|
374
|
+
* @event enable - Emitted when the component is enabled
|
|
375
|
+
* @event disable - Emitted when the component is disabled
|
|
376
|
+
* @event template - Emitted when the template is changed
|
|
361
377
|
*/
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
this.controls
|
|
369
|
-
}
|
|
378
|
+
function actionbarFactory(config) {
|
|
379
|
+
return component(actionbar).setTemplate(mainTpl)
|
|
380
|
+
|
|
381
|
+
// uninstalls the component
|
|
382
|
+
.on('destroy', function () {
|
|
383
|
+
this.buttons = null;
|
|
384
|
+
this.controls = null;
|
|
385
|
+
})
|
|
386
|
+
|
|
387
|
+
// renders the component
|
|
388
|
+
.on('render', function () {
|
|
389
|
+
var self = this;
|
|
390
|
+
var $component = this.getElement();
|
|
391
|
+
|
|
392
|
+
// vertical or horizontal ?
|
|
393
|
+
this.setState('horizontal', $component.hasClass('horizontal-action-bar'));
|
|
394
|
+
this.setState('vertical', $component.hasClass('vertical-action-bar'));
|
|
395
|
+
|
|
396
|
+
// get access to all needed placeholders
|
|
397
|
+
this.buttons = {};
|
|
398
|
+
this.controls = {
|
|
399
|
+
$buttons: {},
|
|
400
|
+
$conditional: $component.find('button.conditional'),
|
|
401
|
+
$all: $component.find('button')
|
|
402
|
+
};
|
|
403
|
+
_.forEach(this.config.buttons, function (button) {
|
|
404
|
+
self.buttons[button.id] = button;
|
|
405
|
+
self.controls.$buttons[button.id] = $component.find('[data-control="' + button.id + '"]');
|
|
406
|
+
});
|
|
407
|
+
|
|
408
|
+
// click on a button
|
|
409
|
+
this.$component.on('click', 'button', function (e) {
|
|
410
|
+
var $this = $$1(this);
|
|
411
|
+
var buttonId = $this.closest('button').data('control');
|
|
412
|
+
var button = self.getButton(buttonId);
|
|
413
|
+
e.preventDefault();
|
|
414
|
+
if (button && button.action) {
|
|
415
|
+
button.action.call(self, buttonId, button);
|
|
416
|
+
}
|
|
370
417
|
|
|
371
|
-
|
|
418
|
+
/**
|
|
419
|
+
* @event actionbar#button
|
|
420
|
+
* @param {String} buttonId
|
|
421
|
+
* @param {Object} button
|
|
422
|
+
*/
|
|
423
|
+
self.trigger('button', buttonId, button);
|
|
424
|
+
});
|
|
425
|
+
}).init(config);
|
|
372
426
|
}
|
|
373
|
-
};
|
|
374
|
-
/**
|
|
375
|
-
* Builds an instance of the actionbar component
|
|
376
|
-
* @param {Object} config
|
|
377
|
-
* @param {Array} config.buttons - The list of buttons to display.
|
|
378
|
-
* @param {String} config.buttons.id - The id of the button
|
|
379
|
-
* @param {String} config.buttons.label - The text displayed in the button
|
|
380
|
-
* @param {String} config.buttons.icon - An optional icon displayed in the button
|
|
381
|
-
* @param {String} config.buttons.title - An optional tooltip displayed on the button
|
|
382
|
-
* @param {Boolean} config.buttons.conditional - The button is hidden by default and must be displayed later
|
|
383
|
-
* @param {Function} config.buttons.action - An action called when the button is clicked
|
|
384
|
-
* @param {Boolean} [config.vertical] - Displays the action bar vertically
|
|
385
|
-
* @returns {actionbar}
|
|
386
|
-
*
|
|
387
|
-
* @event init - Emitted when the component is initialized
|
|
388
|
-
* @event destroy - Emitted when the component is destroying
|
|
389
|
-
* @event render - Emitted when the component is rendered
|
|
390
|
-
* @event button - Emitted when a button is clicked
|
|
391
|
-
* @event show - Emitted when the component is shown
|
|
392
|
-
* @event hide - Emitted when the component is hidden
|
|
393
|
-
* @event enable - Emitted when the component is enabled
|
|
394
|
-
* @event disable - Emitted when the component is disabled
|
|
395
|
-
* @event template - Emitted when the template is changed
|
|
396
|
-
*/
|
|
397
|
-
|
|
398
|
-
function actionbarFactory(config) {
|
|
399
|
-
return component(actionbar).setTemplate(mainTpl) // uninstalls the component
|
|
400
|
-
.on('destroy', function () {
|
|
401
|
-
this.buttons = null;
|
|
402
|
-
this.controls = null;
|
|
403
|
-
}) // renders the component
|
|
404
|
-
.on('render', function () {
|
|
405
|
-
var self = this;
|
|
406
|
-
var $component = this.getElement(); // vertical or horizontal ?
|
|
407
|
-
|
|
408
|
-
this.setState('horizontal', $component.hasClass('horizontal-action-bar'));
|
|
409
|
-
this.setState('vertical', $component.hasClass('vertical-action-bar')); // get access to all needed placeholders
|
|
410
|
-
|
|
411
|
-
this.buttons = {};
|
|
412
|
-
this.controls = {
|
|
413
|
-
$buttons: {},
|
|
414
|
-
$conditional: $component.find('button.conditional'),
|
|
415
|
-
$all: $component.find('button')
|
|
416
|
-
};
|
|
417
|
-
|
|
418
|
-
_.forEach(this.config.buttons, function (button) {
|
|
419
|
-
self.buttons[button.id] = button;
|
|
420
|
-
self.controls.$buttons[button.id] = $component.find('[data-control="' + button.id + '"]');
|
|
421
|
-
}); // click on a button
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
this.$component.on('click', 'button', function (e) {
|
|
425
|
-
var $this = $$1(this);
|
|
426
|
-
var buttonId = $this.closest('button').data('control');
|
|
427
|
-
var button = self.getButton(buttonId);
|
|
428
|
-
e.preventDefault();
|
|
429
|
-
|
|
430
|
-
if (button && button.action) {
|
|
431
|
-
button.action.call(self, buttonId, button);
|
|
432
|
-
}
|
|
433
|
-
/**
|
|
434
|
-
* @event actionbar#button
|
|
435
|
-
* @param {String} buttonId
|
|
436
|
-
* @param {Object} button
|
|
437
|
-
*/
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
self.trigger('button', buttonId, button);
|
|
441
|
-
});
|
|
442
|
-
}).init(config);
|
|
443
|
-
}
|
|
444
427
|
|
|
445
|
-
|
|
428
|
+
return actionbarFactory;
|
|
446
429
|
|
|
447
430
|
});
|