@oat-sa/tao-core-ui 1.58.1 → 1.58.2
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 +386 -395
- package/dist/adder.js +21 -19
- package/dist/animable/absorbable/absorbable.js +204 -213
- package/dist/animable/absorbable/css/absorb.css +1 -0
- package/dist/animable/absorbable/css/absorb.css.map +1 -1
- package/dist/animable/pulsable/pulsable.js +168 -177
- package/dist/autocomplete/css/autocomplete.css +1 -0
- package/dist/autocomplete/css/autocomplete.css.map +1 -1
- package/dist/autocomplete.js +68 -66
- package/dist/badge/badge.js +188 -197
- package/dist/badge/css/badge.css +1 -0
- package/dist/badge/css/badge.css.map +1 -1
- package/dist/breadcrumbs.js +275 -284
- package/dist/btngrouper.js +5 -5
- package/dist/bulkActionPopup.js +490 -495
- package/dist/button.js +283 -291
- package/dist/cascadingComboBox.js +249 -258
- package/dist/ckeditor/ckConfigurator.js +26 -19
- package/dist/ckeditor/dtdHandler.js +11 -9
- package/dist/class/selector.js +441 -450
- package/dist/component/resizable.js +1 -1
- package/dist/component/windowed.js +285 -294
- package/dist/component.js +419 -428
- package/dist/contextualPopup.js +417 -426
- package/dist/dashboard.js +300 -309
- package/dist/datalist.js +753 -762
- package/dist/datatable/filterStrategy/multiple.js +1 -1
- package/dist/datatable/filterStrategy/single.js +1 -1
- package/dist/datatable.js +1527 -1550
- package/dist/dateRange/dateRange.js +393 -402
- package/dist/datetime/picker.js +665 -672
- package/dist/deleter.js +368 -377
- package/dist/destination/selector.js +286 -295
- package/dist/dialog/alert.js +3 -3
- package/dist/dialog/confirm.js +1 -1
- package/dist/dialog/confirmDelete.js +216 -225
- package/dist/dialog.js +650 -654
- package/dist/disabler.js +8 -8
- package/dist/documentViewer/providers/pdfViewer/fallback/viewer.js +166 -175
- package/dist/documentViewer/providers/pdfViewer/pdfjs/findBar.js +518 -527
- package/dist/documentViewer/providers/pdfViewer/pdfjs/pageView.js +380 -389
- package/dist/documentViewer/providers/pdfViewer/pdfjs/searchEngine.js +539 -548
- package/dist/documentViewer/providers/pdfViewer/pdfjs/viewer.js +369 -378
- package/dist/documentViewer/providers/pdfViewer.js +184 -193
- package/dist/documentViewer.js +292 -301
- package/dist/dropdown.js +383 -392
- package/dist/durationer.js +5 -5
- package/dist/dynamicComponent.js +597 -598
- package/dist/feedback.js +356 -362
- package/dist/figure/FigureStateActive.js +117 -108
- package/dist/filesender.js +2 -2
- package/dist/filter.js +230 -239
- package/dist/form/dropdownForm.js +355 -357
- package/dist/form/form.js +919 -690
- package/dist/form/simpleForm.js +1 -1
- package/dist/form/validator/renderer.js +233 -235
- package/dist/form/validator/validator.js +257 -189
- package/dist/form/widget/definitions.js +1 -1
- package/dist/form/widget/providers/checkBox.js +254 -259
- package/dist/form/widget/providers/comboBox.js +187 -192
- package/dist/form/widget/providers/default.js +8 -9
- package/dist/form/widget/providers/hidden.js +170 -179
- package/dist/form/widget/providers/hiddenBox.js +262 -267
- package/dist/form/widget/providers/radioBox.js +216 -225
- package/dist/form/widget/providers/textArea.js +187 -196
- package/dist/form/widget/providers/textBox.js +2 -3
- package/dist/form/widget/widget.js +473 -475
- package/dist/formValidator/formValidator.js +1 -1
- package/dist/formValidator/highlighters/message.js +1 -1
- package/dist/generis/form/form.js +314 -323
- package/dist/generis/validator/validator.js +209 -218
- package/dist/generis/widget/checkBox/checkBox.js +218 -227
- package/dist/generis/widget/comboBox/comboBox.js +179 -188
- package/dist/generis/widget/hiddenBox/hiddenBox.js +220 -229
- package/dist/generis/widget/textBox/textBox.js +169 -178
- package/dist/generis/widget/widget.js +246 -255
- package/dist/groupedComboBox.js +222 -231
- package/dist/groupvalidator.js +2 -2
- package/dist/highlighter.js +967 -958
- package/dist/image/ImgStateActive/helper.js +7 -5
- package/dist/image/ImgStateActive/initHelper.js +49 -43
- package/dist/image/ImgStateActive/initMediaEditor.js +24 -20
- package/dist/image/ImgStateActive/mediaSizer.js +14 -12
- package/dist/image/ImgStateActive.js +72 -70
- package/dist/incrementer.js +6 -6
- package/dist/inplacer.js +6 -6
- package/dist/itemButtonList/css/item-button-list.css +1 -0
- package/dist/itemButtonList/css/item-button-list.css.map +1 -1
- package/dist/itemButtonList.js +439 -435
- package/dist/keyNavigation/navigableDomElement.js +51 -38
- package/dist/keyNavigation/navigator.js +85 -70
- package/dist/listbox.js +460 -469
- package/dist/liststyler.js +8 -8
- package/dist/loadingButton/loadingButton.js +209 -218
- package/dist/lock.js +476 -485
- package/dist/login/login.js +475 -484
- package/dist/maths/calculator/basicCalculator.js +235 -244
- package/dist/maths/calculator/calculatorComponent.js +3 -3
- package/dist/maths/calculator/core/board.js +772 -781
- package/dist/maths/calculator/core/expression.js +476 -485
- package/dist/maths/calculator/core/labels.js +228 -237
- package/dist/maths/calculator/core/tokenizer.js +1 -1
- package/dist/maths/calculator/core/tokens.js +163 -170
- package/dist/maths/calculator/plugins/keyboard/templateKeyboard/templateKeyboard.js +244 -253
- package/dist/maths/calculator/plugins/screen/simpleScreen/simpleScreen.js +279 -288
- package/dist/maths/calculator/scientificCalculator.js +327 -336
- package/dist/mediaEditor/mediaEditorComponent.js +238 -245
- package/dist/mediaEditor/plugins/mediaAlignment/helper.js +7 -7
- package/dist/mediaEditor/plugins/mediaAlignment/mediaAlignmentComponent.js +229 -235
- package/dist/mediaEditor/plugins/mediaDimension/mediaDimensionComponent.js +580 -589
- package/dist/mediaplayer/players/html5.js +666 -675
- package/dist/mediaplayer/players/youtube.js +419 -424
- package/dist/mediaplayer/support.js +11 -10
- package/dist/mediaplayer/utils/reminder.js +14 -13
- package/dist/mediaplayer/utils/timeObserver.js +10 -11
- package/dist/mediaplayer/youtubeManager.js +164 -145
- package/dist/mediaplayer.js +1565 -1520
- package/dist/mediasizer.js +669 -678
- package/dist/modal.js +10 -17
- package/dist/pageSizeSelector.js +219 -228
- package/dist/pagination/providers/pages.js +280 -289
- package/dist/pagination/providers/simple.js +192 -201
- package/dist/previewer.js +30 -30
- package/dist/progressbar.js +4 -4
- package/dist/report.js +347 -356
- package/dist/resource/filters.js +271 -280
- package/dist/resource/list.js +1264 -1273
- package/dist/resource/selector.js +865 -874
- package/dist/resource/tree.js +1483 -1492
- package/dist/resourcemgr/fileBrowser.js +564 -569
- package/dist/resourcemgr/filePreview.js +16 -16
- package/dist/resourcemgr/fileSelector.js +515 -524
- package/dist/resourcemgr/util/updatePermissions.js +2 -2
- package/dist/resourcemgr.js +306 -315
- package/dist/searchModal/advancedSearch.js +796 -767
- package/dist/searchModal.js +114 -91
- package/dist/switch/switch.js +298 -307
- package/dist/tabs.js +598 -575
- package/dist/taskQueue/status.js +312 -321
- package/dist/taskQueue/table.js +375 -384
- package/dist/taskQueue/taskQueueModel.js +488 -472
- package/dist/taskQueueButton/taskable.js +264 -273
- package/dist/taskQueueButton/treeButton.js +189 -198
- package/dist/themeLoader.js +24 -23
- package/dist/themes.js +1 -1
- package/dist/toggler.js +3 -3
- package/dist/tooltip.js +295 -304
- package/dist/transformer.js +2 -2
- package/dist/tristateCheckboxGroup.js +311 -320
- package/dist/uploader.js +687 -696
- package/dist/validator/Report.js +1 -1
- package/dist/validator/Validator.js +3 -3
- package/dist/validator/validators.js +9 -9
- package/dist/validator.js +240 -230
- package/dist/waitForMedia.js +1 -1
- package/package.json +3 -3
- package/src/animable/absorbable/css/absorb.css +1 -0
- package/src/animable/absorbable/css/absorb.css.map +1 -1
- package/src/autocomplete/css/autocomplete.css +1 -0
- package/src/autocomplete/css/autocomplete.css.map +1 -1
- package/src/badge/css/badge.css +1 -0
- package/src/badge/css/badge.css.map +1 -1
- package/src/ckeditor/ckConfigurator.js +4 -0
- package/src/itemButtonList/css/item-button-list.css +1 -0
- package/src/itemButtonList/css/item-button-list.css.map +1 -1
- package/src/.DS_Store +0 -0
- package/src/css/basic.css +0 -7826
- package/src/css/basic.css.map +0 -1
- package/src/css/ckeditor/skins/tao/css/dialog.css +0 -950
- package/src/css/ckeditor/skins/tao/css/dialog.css.map +0 -1
- package/src/css/ckeditor/skins/tao/css/editor.css +0 -1850
- package/src/css/ckeditor/skins/tao/css/editor.css.map +0 -1
- package/src/scss/.DS_Store +0 -0
- package/src/scss/basic.scss +0 -16
- package/src/scss/ckeditor/skins/tao/scss/dialog.scss +0 -763
- package/src/scss/ckeditor/skins/tao/scss/editor.scss +0 -111
- package/src/scss/ckeditor/skins/tao/scss/inc/_ck-icons.scss +0 -59
- package/src/scss/ckeditor/skins/tao/scss/inc/_colorpanel.scss +0 -118
- package/src/scss/ckeditor/skins/tao/scss/inc/_elementspath.scss +0 -69
- package/src/scss/ckeditor/skins/tao/scss/inc/_mainui.scss +0 -194
- package/src/scss/ckeditor/skins/tao/scss/inc/_menu.scss +0 -181
- package/src/scss/ckeditor/skins/tao/scss/inc/_panel.scss +0 -200
- package/src/scss/ckeditor/skins/tao/scss/inc/_presets.scss +0 -32
- package/src/scss/ckeditor/skins/tao/scss/inc/_reset.scss +0 -101
- package/src/scss/ckeditor/skins/tao/scss/inc/_richcombo.scss +0 -213
- package/src/scss/ckeditor/skins/tao/scss/inc/_tao.scss +0 -59
- package/src/scss/ckeditor/skins/tao/scss/inc/_toolbar.scss +0 -301
- package/src/scss/font/source-sans-pro/source-sans-pro-italic.eot +0 -0
- package/src/scss/font/source-sans-pro/source-sans-pro-italic.eot.b64 +0 -1
- package/src/scss/font/source-sans-pro/source-sans-pro-italic.woff +0 -0
- package/src/scss/font/source-sans-pro/source-sans-pro-italic.woff.b64 +0 -1
- package/src/scss/font/source-sans-pro/source-sans-pro-regular.eot +0 -0
- package/src/scss/font/source-sans-pro/source-sans-pro-regular.eot.b64 +0 -1
- package/src/scss/font/source-sans-pro/source-sans-pro-regular.woff +0 -0
- package/src/scss/font/source-sans-pro/source-sans-pro-regular.woff.b64 +0 -1
- package/src/scss/font/source-sans-pro/source-sans-pro-semibold-italic.eot +0 -0
- package/src/scss/font/source-sans-pro/source-sans-pro-semibold-italic.eot.b64 +0 -1
- package/src/scss/font/source-sans-pro/source-sans-pro-semibold-italic.woff +0 -0
- package/src/scss/font/source-sans-pro/source-sans-pro-semibold-italic.woff.b64 +0 -1
- package/src/scss/font/source-sans-pro/source-sans-pro-semibold.eot +0 -0
- package/src/scss/font/source-sans-pro/source-sans-pro-semibold.eot.b64 +0 -1
- package/src/scss/font/source-sans-pro/source-sans-pro-semibold.woff +0 -0
- package/src/scss/font/source-sans-pro/source-sans-pro-semibold.woff.b64 +0 -1
- package/src/scss/font/tao/tao.eot +0 -0
- package/src/scss/font/tao/tao.svg +0 -235
- package/src/scss/font/tao/tao.ttf +0 -0
- package/src/scss/font/tao/tao.woff +0 -0
- package/src/scss/inc/_base.scss +0 -496
- package/src/scss/inc/_bootstrap.scss +0 -6
- package/src/scss/inc/_buttons.scss +0 -114
- package/src/scss/inc/_colors.scss +0 -88
- package/src/scss/inc/_feedback.scss +0 -150
- package/src/scss/inc/_flex-grid.scss +0 -15
- package/src/scss/inc/_fonts.scss +0 -4
- package/src/scss/inc/_forms.scss +0 -827
- package/src/scss/inc/_functions.scss +0 -283
- package/src/scss/inc/_grid.scss +0 -66
- package/src/scss/inc/_jquery.nouislider.scss +0 -254
- package/src/scss/inc/_normalize.scss +0 -528
- package/src/scss/inc/_report.scss +0 -68
- package/src/scss/inc/_secondary-properties.scss +0 -89
- package/src/scss/inc/_select2.scss +0 -634
- package/src/scss/inc/_toolbars.scss +0 -155
- package/src/scss/inc/_tooltip.scss +0 -312
- package/src/scss/inc/_variables.scss +0 -21
- package/src/scss/inc/base/_highlight.scss +0 -5
- package/src/scss/inc/base/_list-style.scss +0 -59
- package/src/scss/inc/base/_svg.scss +0 -3
- package/src/scss/inc/base/_table.scss +0 -63
- package/src/scss/inc/fonts/_source-sans-pro.scss +0 -29
- package/src/scss/inc/fonts/_tao-icon-classes.scss +0 -226
- package/src/scss/inc/fonts/_tao-icon-def.scss +0 -12
- package/src/scss/inc/fonts/_tao-icon-vars.scss +0 -240
package/dist/datalist.js
CHANGED
|
@@ -1,875 +1,866 @@
|
|
|
1
1
|
define(['jquery', 'lodash', 'i18n', 'ui/component', 'handlebars', 'lib/dompurify/purify', 'css!ui/datalist/css/datalist.css'], function ($$1, _, __, component, Handlebars, DOMPurify, datalist_css) { 'use strict';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
3
|
+
$$1 = $$1 && Object.prototype.hasOwnProperty.call($$1, 'default') ? $$1['default'] : $$1;
|
|
4
|
+
_ = _ && Object.prototype.hasOwnProperty.call(_, 'default') ? _['default'] : _;
|
|
5
|
+
__ = __ && Object.prototype.hasOwnProperty.call(__, 'default') ? __['default'] : __;
|
|
6
|
+
component = component && Object.prototype.hasOwnProperty.call(component, 'default') ? component['default'] : component;
|
|
7
|
+
Handlebars = Handlebars && Object.prototype.hasOwnProperty.call(Handlebars, 'default') ? Handlebars['default'] : Handlebars;
|
|
8
|
+
DOMPurify = DOMPurify && Object.prototype.hasOwnProperty.call(DOMPurify, 'default') ? DOMPurify['default'] : DOMPurify;
|
|
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
|
+
});
|
|
10
25
|
/**
|
|
11
|
-
*
|
|
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);
|
|
26
|
-
*
|
|
26
|
+
* Register dompurify helper
|
|
27
27
|
*
|
|
28
|
+
* https://github.com/cure53/DOMPurify
|
|
29
|
+
* with config SAFE_FOR_TEMPLATES: true
|
|
30
|
+
* to make output safe for template systems
|
|
28
31
|
*/
|
|
29
|
-
function Helpers0 (hb) {
|
|
30
|
-
//register a i18n helper
|
|
31
|
-
hb.registerHelper('__', function (key) {
|
|
32
|
-
return __(key);
|
|
33
|
-
});
|
|
34
|
-
/**
|
|
35
|
-
* Register dompurify helper
|
|
36
|
-
*
|
|
37
|
-
* https://github.com/cure53/DOMPurify
|
|
38
|
-
* with config SAFE_FOR_TEMPLATES: true
|
|
39
|
-
* to make output safe for template systems
|
|
40
|
-
*/
|
|
41
|
-
|
|
42
|
-
hb.registerHelper('dompurify', function (context) {
|
|
43
|
-
return DOMPurify.sanitize(context);
|
|
44
|
-
});
|
|
45
|
-
/**
|
|
46
|
-
* Register join helper
|
|
47
|
-
*
|
|
48
|
-
* Example :
|
|
49
|
-
* var values = {a:v1, b:v2, c:v3};
|
|
50
|
-
* Using {{{join attributes '=' ' ' '"'}}} will return : a="v1" b="v2" c="v3"
|
|
51
|
-
* Using {{{join values null ' or ' '*'}}} will return : *v1* or *v2* or *v3*
|
|
52
|
-
*/
|
|
53
32
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
33
|
+
hb.registerHelper('dompurify', function (context) {
|
|
34
|
+
return DOMPurify.sanitize(context);
|
|
35
|
+
});
|
|
36
|
+
/**
|
|
37
|
+
* Register join helper
|
|
38
|
+
*
|
|
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
|
+
*/
|
|
59
44
|
|
|
60
|
-
|
|
61
|
-
|
|
45
|
+
hb.registerHelper('join', function (arr, keyValueGlue, fragmentGlue, wrapper) {
|
|
46
|
+
var fragments = [];
|
|
47
|
+
keyValueGlue = typeof keyValueGlue === 'string' ? keyValueGlue : undefined;
|
|
48
|
+
fragmentGlue = typeof fragmentGlue === 'string' ? fragmentGlue : ' ';
|
|
49
|
+
wrapper = typeof wrapper === 'string' ? wrapper : '"';
|
|
62
50
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
value = value ? 'true' : 'false';
|
|
66
|
-
} else if (typeof value === 'object') {
|
|
67
|
-
value = _.values(value).join(' ');
|
|
68
|
-
}
|
|
69
|
-
} else {
|
|
70
|
-
value = '';
|
|
71
|
-
}
|
|
51
|
+
_.forIn(arr, function (value, key) {
|
|
52
|
+
var fragment = '';
|
|
72
53
|
|
|
73
|
-
|
|
74
|
-
|
|
54
|
+
if (value !== null || value !== undefined) {
|
|
55
|
+
if (typeof value === 'boolean') {
|
|
56
|
+
value = value ? 'true' : 'false';
|
|
57
|
+
} else if (_typeof(value) === 'object') {
|
|
58
|
+
value = _.values(value).join(' ');
|
|
75
59
|
}
|
|
60
|
+
} else {
|
|
61
|
+
value = '';
|
|
62
|
+
}
|
|
76
63
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
});
|
|
80
|
-
|
|
81
|
-
return fragments.join(fragmentGlue);
|
|
82
|
-
}); //register a classic "for loop" helper
|
|
83
|
-
//it also adds a local variable "i" as the index in each iteration loop
|
|
84
|
-
|
|
85
|
-
hb.registerHelper('for', function (startIndex, stopIndex, increment, options) {
|
|
86
|
-
var ret = '';
|
|
87
|
-
startIndex = parseInt(startIndex);
|
|
88
|
-
stopIndex = parseInt(stopIndex);
|
|
89
|
-
increment = parseInt(increment);
|
|
90
|
-
|
|
91
|
-
for (var i = startIndex; i < stopIndex; i += increment) {
|
|
92
|
-
ret += options.fn(_.extend({}, this, {
|
|
93
|
-
i: i
|
|
94
|
-
}));
|
|
64
|
+
if (keyValueGlue !== undefined) {
|
|
65
|
+
fragment += key + keyValueGlue;
|
|
95
66
|
}
|
|
96
67
|
|
|
97
|
-
|
|
68
|
+
fragment += wrapper + value + wrapper;
|
|
69
|
+
fragments.push(fragment);
|
|
98
70
|
});
|
|
99
|
-
hb.registerHelper('equal', function (var1, var2, options) {
|
|
100
|
-
if (var1 == var2) {
|
|
101
|
-
return options.fn(this);
|
|
102
|
-
} else {
|
|
103
|
-
return options.inverse(this);
|
|
104
|
-
}
|
|
105
|
-
}); // register a "get property" helper
|
|
106
|
-
// it gets the named property from the provided context
|
|
107
71
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
// it checks if value is in array
|
|
72
|
+
return fragments.join(fragmentGlue);
|
|
73
|
+
}); //register a classic "for loop" helper
|
|
74
|
+
//it also adds a local variable "i" as the index in each iteration loop
|
|
112
75
|
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
}
|
|
76
|
+
hb.registerHelper('for', function (startIndex, stopIndex, increment, options) {
|
|
77
|
+
var ret = '';
|
|
78
|
+
startIndex = parseInt(startIndex);
|
|
79
|
+
stopIndex = parseInt(stopIndex);
|
|
80
|
+
increment = parseInt(increment);
|
|
119
81
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
var Template = Handlebars.template(function (Handlebars,depth0,helpers,partials,data) {
|
|
125
|
-
this.compilerInfo = [4,'>= 1.0.0'];
|
|
126
|
-
helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
|
|
127
|
-
var buffer = "", stack1, helper, functionType="function", escapeExpression=this.escapeExpression, self=this, helperMissing=helpers.helperMissing;
|
|
128
|
-
|
|
129
|
-
function program1(depth0,data) {
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
return "class=\"hidden\"";
|
|
82
|
+
for (var i = startIndex; i < stopIndex; i += increment) {
|
|
83
|
+
ret += options.fn(_.extend({}, this, {
|
|
84
|
+
i: i
|
|
85
|
+
}));
|
|
133
86
|
}
|
|
134
87
|
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
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);
|
|
139
95
|
}
|
|
96
|
+
}); // register a "get property" helper
|
|
97
|
+
// it gets the named property from the provided context
|
|
140
98
|
|
|
141
|
-
function
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
stack1 = helpers.each.call(depth0, (depth0 && depth0.tools), {hash:{},inverse:self.noop,fn:self.program(6, program6, data),data:data});
|
|
146
|
-
if(stack1 || stack1 === 0) { buffer += stack1; }
|
|
147
|
-
buffer += "\n </aside>\n ";
|
|
148
|
-
return buffer;
|
|
149
|
-
}
|
|
150
|
-
function program6(depth0,data) {
|
|
151
|
-
|
|
152
|
-
var buffer = "", stack1, helper;
|
|
153
|
-
buffer += "\n <button class=\"btn-info small ";
|
|
154
|
-
stack1 = helpers['if'].call(depth0, (depth0 && depth0.massAction), {hash:{},inverse:self.noop,fn:self.program(7, program7, data),data:data});
|
|
155
|
-
if(stack1 || stack1 === 0) { buffer += stack1; }
|
|
156
|
-
buffer += "\" data-control=\"";
|
|
157
|
-
if (helper = helpers.id) { stack1 = helper.call(depth0, {hash:{},data:data}); }
|
|
158
|
-
else { helper = (depth0 && depth0.id); stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{},data:data}) : helper; }
|
|
159
|
-
buffer += escapeExpression(stack1)
|
|
160
|
-
+ "\" ";
|
|
161
|
-
stack1 = helpers['if'].call(depth0, (depth0 && depth0.title), {hash:{},inverse:self.noop,fn:self.program(9, program9, data),data:data});
|
|
162
|
-
if(stack1 || stack1 === 0) { buffer += stack1; }
|
|
163
|
-
buffer += ">\n ";
|
|
164
|
-
stack1 = helpers['if'].call(depth0, (depth0 && depth0.icon), {hash:{},inverse:self.noop,fn:self.program(11, program11, data),data:data});
|
|
165
|
-
if(stack1 || stack1 === 0) { buffer += stack1; }
|
|
166
|
-
buffer += "\n ";
|
|
167
|
-
if (helper = helpers.label) { stack1 = helper.call(depth0, {hash:{},data:data}); }
|
|
168
|
-
else { helper = (depth0 && depth0.label); stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{},data:data}) : helper; }
|
|
169
|
-
buffer += escapeExpression(stack1)
|
|
170
|
-
+ "\n </button>\n ";
|
|
171
|
-
return buffer;
|
|
172
|
-
}
|
|
173
|
-
function program7(depth0,data) {
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
return " mass-action hidden";
|
|
177
|
-
}
|
|
99
|
+
hb.registerHelper('property', function (name, context) {
|
|
100
|
+
return context[name] || '';
|
|
101
|
+
}); // register an 'includes' helper
|
|
102
|
+
// it checks if value is in array
|
|
178
103
|
|
|
179
|
-
function
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
buffer += " title=\"";
|
|
183
|
-
if (helper = helpers.title) { stack1 = helper.call(depth0, {hash:{},data:data}); }
|
|
184
|
-
else { helper = (depth0 && depth0.title); stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{},data:data}) : helper; }
|
|
185
|
-
buffer += escapeExpression(stack1)
|
|
186
|
-
+ "\"";
|
|
187
|
-
return buffer;
|
|
104
|
+
hb.registerHelper('includes', function (haystack, needle, options) {
|
|
105
|
+
if (_.contains(haystack, needle)) {
|
|
106
|
+
return options.fn(this);
|
|
188
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, helper, functionType="function", escapeExpression=this.escapeExpression, self=this, helperMissing=helpers.helperMissing;
|
|
119
|
+
|
|
120
|
+
function program1(depth0,data) {
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
return "class=\"hidden\"";
|
|
124
|
+
}
|
|
189
125
|
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
else { helper = (depth0 && depth0.icon); stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{},data:data}) : helper; }
|
|
196
|
-
buffer += escapeExpression(stack1)
|
|
197
|
-
+ "\"></span>";
|
|
198
|
-
return buffer;
|
|
199
|
-
}
|
|
126
|
+
function program3(depth0,data) {
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
return " hidden";
|
|
130
|
+
}
|
|
200
131
|
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
132
|
+
function program5(depth0,data) {
|
|
133
|
+
|
|
134
|
+
var buffer = "", stack1;
|
|
135
|
+
buffer += "\n <aside class=\"action-bar clearfix\">\n ";
|
|
136
|
+
stack1 = helpers.each.call(depth0, (depth0 && depth0.tools), {hash:{},inverse:self.noop,fn:self.program(6, program6, data),data:data});
|
|
137
|
+
if(stack1 || stack1 === 0) { buffer += stack1; }
|
|
138
|
+
buffer += "\n </aside>\n ";
|
|
139
|
+
return buffer;
|
|
140
|
+
}
|
|
141
|
+
function program6(depth0,data) {
|
|
142
|
+
|
|
143
|
+
var buffer = "", stack1, helper;
|
|
144
|
+
buffer += "\n <button class=\"btn-info small ";
|
|
145
|
+
stack1 = helpers['if'].call(depth0, (depth0 && depth0.massAction), {hash:{},inverse:self.noop,fn:self.program(7, program7, data),data:data});
|
|
146
|
+
if(stack1 || stack1 === 0) { buffer += stack1; }
|
|
147
|
+
buffer += "\" data-control=\"";
|
|
148
|
+
if (helper = helpers.id) { stack1 = helper.call(depth0, {hash:{},data:data}); }
|
|
149
|
+
else { helper = (depth0 && depth0.id); stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{},data:data}) : helper; }
|
|
150
|
+
buffer += escapeExpression(stack1)
|
|
151
|
+
+ "\" ";
|
|
152
|
+
stack1 = helpers['if'].call(depth0, (depth0 && depth0.title), {hash:{},inverse:self.noop,fn:self.program(9, program9, data),data:data});
|
|
153
|
+
if(stack1 || stack1 === 0) { buffer += stack1; }
|
|
154
|
+
buffer += ">\n ";
|
|
155
|
+
stack1 = helpers['if'].call(depth0, (depth0 && depth0.icon), {hash:{},inverse:self.noop,fn:self.program(11, program11, data),data:data});
|
|
156
|
+
if(stack1 || stack1 === 0) { buffer += stack1; }
|
|
157
|
+
buffer += "\n ";
|
|
158
|
+
if (helper = helpers.label) { stack1 = helper.call(depth0, {hash:{},data:data}); }
|
|
159
|
+
else { helper = (depth0 && depth0.label); stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{},data:data}) : helper; }
|
|
160
|
+
buffer += escapeExpression(stack1)
|
|
161
|
+
+ "\n </button>\n ";
|
|
162
|
+
return buffer;
|
|
163
|
+
}
|
|
164
|
+
function program7(depth0,data) {
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
return " mass-action hidden";
|
|
168
|
+
}
|
|
206
169
|
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
170
|
+
function program9(depth0,data) {
|
|
171
|
+
|
|
172
|
+
var buffer = "", stack1, helper;
|
|
173
|
+
buffer += " title=\"";
|
|
174
|
+
if (helper = helpers.title) { stack1 = helper.call(depth0, {hash:{},data:data}); }
|
|
175
|
+
else { helper = (depth0 && depth0.title); stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{},data:data}) : helper; }
|
|
176
|
+
buffer += escapeExpression(stack1)
|
|
177
|
+
+ "\"";
|
|
178
|
+
return buffer;
|
|
179
|
+
}
|
|
212
180
|
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
181
|
+
function program11(depth0,data) {
|
|
182
|
+
|
|
183
|
+
var buffer = "", stack1, helper;
|
|
184
|
+
buffer += "<span class=\"icon icon-";
|
|
185
|
+
if (helper = helpers.icon) { stack1 = helper.call(depth0, {hash:{},data:data}); }
|
|
186
|
+
else { helper = (depth0 && depth0.icon); stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{},data:data}) : helper; }
|
|
187
|
+
buffer += escapeExpression(stack1)
|
|
188
|
+
+ "\"></span>";
|
|
189
|
+
return buffer;
|
|
190
|
+
}
|
|
221
191
|
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
if (helper = helpers.title) { stack1 = helper.call(depth0, {hash:{},data:data}); }
|
|
227
|
-
else { helper = (depth0 && depth0.title); stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{},data:data}) : helper; }
|
|
228
|
-
buffer += escapeExpression(stack1)
|
|
229
|
-
+ "</h1>\n <h2>\n <span class=\"empty-list";
|
|
230
|
-
stack1 = helpers.unless.call(depth0, (depth0 && depth0.textEmpty), {hash:{},inverse:self.noop,fn:self.program(3, program3, data),data:data});
|
|
231
|
-
if(stack1 || stack1 === 0) { buffer += stack1; }
|
|
232
|
-
buffer += "\">";
|
|
233
|
-
if (helper = helpers.textEmpty) { stack1 = helper.call(depth0, {hash:{},data:data}); }
|
|
234
|
-
else { helper = (depth0 && depth0.textEmpty); stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{},data:data}) : helper; }
|
|
235
|
-
buffer += escapeExpression(stack1)
|
|
236
|
-
+ "</span>\n <span class=\"available-list";
|
|
237
|
-
stack1 = helpers.unless.call(depth0, (depth0 && depth0.textNumber), {hash:{},inverse:self.noop,fn:self.program(3, program3, data),data:data});
|
|
238
|
-
if(stack1 || stack1 === 0) { buffer += stack1; }
|
|
239
|
-
buffer += "\"><span class=\"label\">";
|
|
240
|
-
if (helper = helpers.textNumber) { stack1 = helper.call(depth0, {hash:{},data:data}); }
|
|
241
|
-
else { helper = (depth0 && depth0.textNumber); stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{},data:data}) : helper; }
|
|
242
|
-
buffer += escapeExpression(stack1)
|
|
243
|
-
+ "</span>: <span class=\"count\"></span></span>\n <span class=\"loading";
|
|
244
|
-
stack1 = helpers.unless.call(depth0, (depth0 && depth0.textLoading), {hash:{},inverse:self.noop,fn:self.program(3, program3, data),data:data});
|
|
245
|
-
if(stack1 || stack1 === 0) { buffer += stack1; }
|
|
246
|
-
buffer += "\"><span>";
|
|
247
|
-
if (helper = helpers.textLoading) { stack1 = helper.call(depth0, {hash:{},data:data}); }
|
|
248
|
-
else { helper = (depth0 && depth0.textLoading); stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{},data:data}) : helper; }
|
|
249
|
-
buffer += escapeExpression(stack1)
|
|
250
|
-
+ "</span>...</span>\n </h2>\n <div class=\"list\">\n ";
|
|
251
|
-
stack1 = helpers['if'].call(depth0, (depth0 && depth0.tools), {hash:{},inverse:self.noop,fn:self.program(5, program5, data),data:data});
|
|
252
|
-
if(stack1 || stack1 === 0) { buffer += stack1; }
|
|
253
|
-
buffer += "\n\n <table class=\"matrix\">\n <colgroup>\n ";
|
|
254
|
-
stack1 = helpers['if'].call(depth0, (depth0 && depth0.selectable), {hash:{},inverse:self.noop,fn:self.program(13, program13, data),data:data});
|
|
255
|
-
if(stack1 || stack1 === 0) { buffer += stack1; }
|
|
256
|
-
buffer += "\n <col/>\n ";
|
|
257
|
-
stack1 = helpers['if'].call(depth0, (depth0 && depth0.actions), {hash:{},inverse:self.noop,fn:self.program(13, program13, data),data:data});
|
|
258
|
-
if(stack1 || stack1 === 0) { buffer += stack1; }
|
|
259
|
-
buffer += "\n </colgroup>\n <thead>\n <tr>\n ";
|
|
260
|
-
stack1 = helpers['if'].call(depth0, (depth0 && depth0.selectable), {hash:{},inverse:self.noop,fn:self.program(15, program15, data),data:data});
|
|
261
|
-
if(stack1 || stack1 === 0) { buffer += stack1; }
|
|
262
|
-
buffer += "\n <th class=\"label\">";
|
|
263
|
-
if (helper = helpers.labelText) { stack1 = helper.call(depth0, {hash:{},data:data}); }
|
|
264
|
-
else { helper = (depth0 && depth0.labelText); stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{},data:data}) : helper; }
|
|
265
|
-
buffer += escapeExpression(stack1)
|
|
266
|
-
+ "</th>\n ";
|
|
267
|
-
stack1 = helpers['if'].call(depth0, (depth0 && depth0.actions), {hash:{},inverse:self.noop,fn:self.program(17, program17, data),data:data});
|
|
268
|
-
if(stack1 || stack1 === 0) { buffer += stack1; }
|
|
269
|
-
buffer += "\n </tr>\n </thead>\n <tbody></tbody>\n </table>\n </div>\n</div>\n";
|
|
270
|
-
return buffer;
|
|
271
|
-
});
|
|
272
|
-
function mainTpl(data, options, asString) {
|
|
273
|
-
var html = Template(data, options);
|
|
274
|
-
return (asString || true) ? html : $(html);
|
|
192
|
+
function program13(depth0,data) {
|
|
193
|
+
|
|
194
|
+
|
|
195
|
+
return "\n <col/>\n ";
|
|
275
196
|
}
|
|
276
197
|
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
198
|
+
function program15(depth0,data) {
|
|
199
|
+
|
|
200
|
+
|
|
201
|
+
return "\n <th class=\"checkboxes\"><input type=\"checkbox\" name=\"checkall\" value=\"1\" /></th>\n ";
|
|
280
202
|
}
|
|
281
|
-
var Template$1 = Handlebars.template(function (Handlebars,depth0,helpers,partials,data) {
|
|
282
|
-
this.compilerInfo = [4,'>= 1.0.0'];
|
|
283
|
-
helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
|
|
284
|
-
var buffer = "", stack1, functionType="function", escapeExpression=this.escapeExpression, self=this;
|
|
285
|
-
|
|
286
|
-
function program1(depth0,data,depth1) {
|
|
287
|
-
|
|
288
|
-
var buffer = "", stack1, helper;
|
|
289
|
-
buffer += "\n<tr data-id=\"";
|
|
290
|
-
if (helper = helpers.id) { stack1 = helper.call(depth0, {hash:{},data:data}); }
|
|
291
|
-
else { helper = (depth0 && depth0.id); stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{},data:data}) : helper; }
|
|
292
|
-
buffer += escapeExpression(stack1)
|
|
293
|
-
+ "\">\n ";
|
|
294
|
-
stack1 = helpers['if'].call(depth0, (depth1 && depth1.selectable), {hash:{},inverse:self.noop,fn:self.program(2, program2, data),data:data});
|
|
295
|
-
if(stack1 || stack1 === 0) { buffer += stack1; }
|
|
296
|
-
buffer += "\n <td class=\"label\">";
|
|
297
|
-
if (helper = helpers.label) { stack1 = helper.call(depth0, {hash:{},data:data}); }
|
|
298
|
-
else { helper = (depth0 && depth0.label); stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{},data:data}) : helper; }
|
|
299
|
-
buffer += escapeExpression(stack1)
|
|
300
|
-
+ "</td>\n ";
|
|
301
|
-
stack1 = helpers['if'].call(depth0, (depth1 && depth1.actions), {hash:{},inverse:self.noop,fn:self.programWithDepth(4, program4, data, depth0, depth1),data:data});
|
|
302
|
-
if(stack1 || stack1 === 0) { buffer += stack1; }
|
|
303
|
-
buffer += "\n</tr>\n";
|
|
304
|
-
return buffer;
|
|
305
|
-
}
|
|
306
|
-
function program2(depth0,data) {
|
|
307
|
-
|
|
308
|
-
var buffer = "", stack1, helper;
|
|
309
|
-
buffer += "\n <td class=\"checkboxes\"><input type=\"checkbox\" name=\"cb[";
|
|
310
|
-
if (helper = helpers.id) { stack1 = helper.call(depth0, {hash:{},data:data}); }
|
|
311
|
-
else { helper = (depth0 && depth0.id); stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{},data:data}) : helper; }
|
|
312
|
-
buffer += escapeExpression(stack1)
|
|
313
|
-
+ "]\" value=\"1\" /></td>\n ";
|
|
314
|
-
return buffer;
|
|
315
|
-
}
|
|
316
203
|
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
}
|
|
326
|
-
function program5(depth0,data,depth2) {
|
|
327
|
-
|
|
328
|
-
var buffer = "", stack1;
|
|
329
|
-
buffer += "\n ";
|
|
330
|
-
stack1 = helpers['with'].call(depth0, (depth2 && depth2.line), {hash:{},inverse:self.noop,fn:self.programWithDepth(6, program6, data, depth0),data:data});
|
|
331
|
-
if(stack1 || stack1 === 0) { buffer += stack1; }
|
|
332
|
-
buffer += "\n ";
|
|
333
|
-
return buffer;
|
|
334
|
-
}
|
|
335
|
-
function program6(depth0,data,depth1) {
|
|
336
|
-
|
|
337
|
-
var buffer = "", stack1;
|
|
338
|
-
buffer += "\n ";
|
|
339
|
-
stack1 = helpers.unless.call(depth0, (depth1 && depth1.hidden), {hash:{},inverse:self.noop,fn:self.programWithDepth(7, program7, data, depth1),data:data});
|
|
340
|
-
if(stack1 || stack1 === 0) { buffer += stack1; }
|
|
341
|
-
buffer += "\n ";
|
|
342
|
-
return buffer;
|
|
343
|
-
}
|
|
344
|
-
function program7(depth0,data,depth2) {
|
|
345
|
-
|
|
346
|
-
var buffer = "", stack1;
|
|
347
|
-
buffer += "\n ";
|
|
348
|
-
stack1 = helpers['with'].call(depth0, depth2, {hash:{},inverse:self.noop,fn:self.program(8, program8, data),data:data});
|
|
349
|
-
if(stack1 || stack1 === 0) { buffer += stack1; }
|
|
350
|
-
buffer += "\n ";
|
|
351
|
-
return buffer;
|
|
352
|
-
}
|
|
353
|
-
function program8(depth0,data) {
|
|
354
|
-
|
|
355
|
-
var buffer = "", stack1, helper;
|
|
356
|
-
buffer += "\n <button class=\"btn-info small\" data-control=\"";
|
|
357
|
-
if (helper = helpers.id) { stack1 = helper.call(depth0, {hash:{},data:data}); }
|
|
358
|
-
else { helper = (depth0 && depth0.id); stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{},data:data}) : helper; }
|
|
359
|
-
buffer += escapeExpression(stack1)
|
|
360
|
-
+ "\"";
|
|
361
|
-
stack1 = helpers['if'].call(depth0, (depth0 && depth0.title), {hash:{},inverse:self.noop,fn:self.program(9, program9, data),data:data});
|
|
362
|
-
if(stack1 || stack1 === 0) { buffer += stack1; }
|
|
363
|
-
buffer += ">\n ";
|
|
364
|
-
stack1 = helpers['if'].call(depth0, (depth0 && depth0.icon), {hash:{},inverse:self.noop,fn:self.program(11, program11, data),data:data});
|
|
365
|
-
if(stack1 || stack1 === 0) { buffer += stack1; }
|
|
366
|
-
buffer += "\n ";
|
|
367
|
-
if (helper = helpers.label) { stack1 = helper.call(depth0, {hash:{},data:data}); }
|
|
368
|
-
else { helper = (depth0 && depth0.label); stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{},data:data}) : helper; }
|
|
369
|
-
buffer += escapeExpression(stack1)
|
|
370
|
-
+ "\n </button>\n ";
|
|
371
|
-
return buffer;
|
|
372
|
-
}
|
|
373
|
-
function program9(depth0,data) {
|
|
374
|
-
|
|
375
|
-
var buffer = "", stack1, helper;
|
|
376
|
-
buffer += " title=\"";
|
|
377
|
-
if (helper = helpers.title) { stack1 = helper.call(depth0, {hash:{},data:data}); }
|
|
378
|
-
else { helper = (depth0 && depth0.title); stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{},data:data}) : helper; }
|
|
379
|
-
buffer += escapeExpression(stack1)
|
|
380
|
-
+ "\"";
|
|
381
|
-
return buffer;
|
|
382
|
-
}
|
|
204
|
+
function program17(depth0,data) {
|
|
205
|
+
|
|
206
|
+
var buffer = "", helper, options;
|
|
207
|
+
buffer += "\n <th class=\"actions\">"
|
|
208
|
+
+ escapeExpression((helper = helpers.__ || (depth0 && depth0.__),options={hash:{},data:data},helper ? helper.call(depth0, "Actions", options) : helperMissing.call(depth0, "__", "Actions", options)))
|
|
209
|
+
+ "</th>\n ";
|
|
210
|
+
return buffer;
|
|
211
|
+
}
|
|
383
212
|
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
213
|
+
buffer += "<div class=\"datalist\">\n <h1 ";
|
|
214
|
+
stack1 = helpers.unless.call(depth0, (depth0 && depth0.title), {hash:{},inverse:self.noop,fn:self.program(1, program1, data),data:data});
|
|
215
|
+
if(stack1 || stack1 === 0) { buffer += stack1; }
|
|
216
|
+
buffer += ">";
|
|
217
|
+
if (helper = helpers.title) { stack1 = helper.call(depth0, {hash:{},data:data}); }
|
|
218
|
+
else { helper = (depth0 && depth0.title); stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{},data:data}) : helper; }
|
|
219
|
+
buffer += escapeExpression(stack1)
|
|
220
|
+
+ "</h1>\n <h2>\n <span class=\"empty-list";
|
|
221
|
+
stack1 = helpers.unless.call(depth0, (depth0 && depth0.textEmpty), {hash:{},inverse:self.noop,fn:self.program(3, program3, data),data:data});
|
|
222
|
+
if(stack1 || stack1 === 0) { buffer += stack1; }
|
|
223
|
+
buffer += "\">";
|
|
224
|
+
if (helper = helpers.textEmpty) { stack1 = helper.call(depth0, {hash:{},data:data}); }
|
|
225
|
+
else { helper = (depth0 && depth0.textEmpty); stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{},data:data}) : helper; }
|
|
226
|
+
buffer += escapeExpression(stack1)
|
|
227
|
+
+ "</span>\n <span class=\"available-list";
|
|
228
|
+
stack1 = helpers.unless.call(depth0, (depth0 && depth0.textNumber), {hash:{},inverse:self.noop,fn:self.program(3, program3, data),data:data});
|
|
229
|
+
if(stack1 || stack1 === 0) { buffer += stack1; }
|
|
230
|
+
buffer += "\"><span class=\"label\">";
|
|
231
|
+
if (helper = helpers.textNumber) { stack1 = helper.call(depth0, {hash:{},data:data}); }
|
|
232
|
+
else { helper = (depth0 && depth0.textNumber); stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{},data:data}) : helper; }
|
|
233
|
+
buffer += escapeExpression(stack1)
|
|
234
|
+
+ "</span>: <span class=\"count\"></span></span>\n <span class=\"loading";
|
|
235
|
+
stack1 = helpers.unless.call(depth0, (depth0 && depth0.textLoading), {hash:{},inverse:self.noop,fn:self.program(3, program3, data),data:data});
|
|
236
|
+
if(stack1 || stack1 === 0) { buffer += stack1; }
|
|
237
|
+
buffer += "\"><span>";
|
|
238
|
+
if (helper = helpers.textLoading) { stack1 = helper.call(depth0, {hash:{},data:data}); }
|
|
239
|
+
else { helper = (depth0 && depth0.textLoading); stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{},data:data}) : helper; }
|
|
240
|
+
buffer += escapeExpression(stack1)
|
|
241
|
+
+ "</span>...</span>\n </h2>\n <div class=\"list\">\n ";
|
|
242
|
+
stack1 = helpers['if'].call(depth0, (depth0 && depth0.tools), {hash:{},inverse:self.noop,fn:self.program(5, program5, data),data:data});
|
|
243
|
+
if(stack1 || stack1 === 0) { buffer += stack1; }
|
|
244
|
+
buffer += "\n\n <table class=\"matrix\">\n <colgroup>\n ";
|
|
245
|
+
stack1 = helpers['if'].call(depth0, (depth0 && depth0.selectable), {hash:{},inverse:self.noop,fn:self.program(13, program13, data),data:data});
|
|
246
|
+
if(stack1 || stack1 === 0) { buffer += stack1; }
|
|
247
|
+
buffer += "\n <col/>\n ";
|
|
248
|
+
stack1 = helpers['if'].call(depth0, (depth0 && depth0.actions), {hash:{},inverse:self.noop,fn:self.program(13, program13, data),data:data});
|
|
249
|
+
if(stack1 || stack1 === 0) { buffer += stack1; }
|
|
250
|
+
buffer += "\n </colgroup>\n <thead>\n <tr>\n ";
|
|
251
|
+
stack1 = helpers['if'].call(depth0, (depth0 && depth0.selectable), {hash:{},inverse:self.noop,fn:self.program(15, program15, data),data:data});
|
|
252
|
+
if(stack1 || stack1 === 0) { buffer += stack1; }
|
|
253
|
+
buffer += "\n <th class=\"label\">";
|
|
254
|
+
if (helper = helpers.labelText) { stack1 = helper.call(depth0, {hash:{},data:data}); }
|
|
255
|
+
else { helper = (depth0 && depth0.labelText); stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{},data:data}) : helper; }
|
|
256
|
+
buffer += escapeExpression(stack1)
|
|
257
|
+
+ "</th>\n ";
|
|
258
|
+
stack1 = helpers['if'].call(depth0, (depth0 && depth0.actions), {hash:{},inverse:self.noop,fn:self.program(17, program17, data),data:data});
|
|
259
|
+
if(stack1 || stack1 === 0) { buffer += stack1; }
|
|
260
|
+
buffer += "\n </tr>\n </thead>\n <tbody></tbody>\n </table>\n </div>\n</div>\n";
|
|
261
|
+
return buffer;
|
|
262
|
+
});
|
|
263
|
+
function mainTpl(data, options, asString) {
|
|
264
|
+
var html = Template(data, options);
|
|
265
|
+
return (asString || true) ? html : $(html);
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
if (!Helpers0.__initialized) {
|
|
269
|
+
Helpers0(Handlebars);
|
|
270
|
+
Helpers0.__initialized = true;
|
|
271
|
+
}
|
|
272
|
+
var Template$1 = Handlebars.template(function (Handlebars,depth0,helpers,partials,data) {
|
|
273
|
+
this.compilerInfo = [4,'>= 1.0.0'];
|
|
274
|
+
helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
|
|
275
|
+
var buffer = "", stack1, functionType="function", escapeExpression=this.escapeExpression, self=this;
|
|
276
|
+
|
|
277
|
+
function program1(depth0,data,depth1) {
|
|
278
|
+
|
|
279
|
+
var buffer = "", stack1, helper;
|
|
280
|
+
buffer += "\n<tr data-id=\"";
|
|
281
|
+
if (helper = helpers.id) { stack1 = helper.call(depth0, {hash:{},data:data}); }
|
|
282
|
+
else { helper = (depth0 && depth0.id); stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{},data:data}) : helper; }
|
|
283
|
+
buffer += escapeExpression(stack1)
|
|
284
|
+
+ "\">\n ";
|
|
285
|
+
stack1 = helpers['if'].call(depth0, (depth1 && depth1.selectable), {hash:{},inverse:self.noop,fn:self.program(2, program2, data),data:data});
|
|
286
|
+
if(stack1 || stack1 === 0) { buffer += stack1; }
|
|
287
|
+
buffer += "\n <td class=\"label\">";
|
|
288
|
+
if (helper = helpers.label) { stack1 = helper.call(depth0, {hash:{},data:data}); }
|
|
289
|
+
else { helper = (depth0 && depth0.label); stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{},data:data}) : helper; }
|
|
290
|
+
buffer += escapeExpression(stack1)
|
|
291
|
+
+ "</td>\n ";
|
|
292
|
+
stack1 = helpers['if'].call(depth0, (depth1 && depth1.actions), {hash:{},inverse:self.noop,fn:self.programWithDepth(4, program4, data, depth0, depth1),data:data});
|
|
293
|
+
if(stack1 || stack1 === 0) { buffer += stack1; }
|
|
294
|
+
buffer += "\n</tr>\n";
|
|
295
|
+
return buffer;
|
|
296
|
+
}
|
|
297
|
+
function program2(depth0,data) {
|
|
298
|
+
|
|
299
|
+
var buffer = "", stack1, helper;
|
|
300
|
+
buffer += "\n <td class=\"checkboxes\"><input type=\"checkbox\" name=\"cb[";
|
|
301
|
+
if (helper = helpers.id) { stack1 = helper.call(depth0, {hash:{},data:data}); }
|
|
302
|
+
else { helper = (depth0 && depth0.id); stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{},data:data}) : helper; }
|
|
303
|
+
buffer += escapeExpression(stack1)
|
|
304
|
+
+ "]\" value=\"1\" /></td>\n ";
|
|
305
|
+
return buffer;
|
|
306
|
+
}
|
|
394
307
|
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
308
|
+
function program4(depth0,data,depth1,depth2) {
|
|
309
|
+
|
|
310
|
+
var buffer = "", stack1;
|
|
311
|
+
buffer += "\n <td class=\"actions\">\n ";
|
|
312
|
+
stack1 = helpers.each.call(depth0, (depth2 && depth2.actions), {hash:{},inverse:self.noop,fn:self.programWithDepth(5, program5, data, depth1),data:data});
|
|
313
|
+
if(stack1 || stack1 === 0) { buffer += stack1; }
|
|
314
|
+
buffer += "\n </td>\n ";
|
|
315
|
+
return buffer;
|
|
316
|
+
}
|
|
317
|
+
function program5(depth0,data,depth2) {
|
|
318
|
+
|
|
319
|
+
var buffer = "", stack1;
|
|
320
|
+
buffer += "\n ";
|
|
321
|
+
stack1 = helpers['with'].call(depth0, (depth2 && depth2.line), {hash:{},inverse:self.noop,fn:self.programWithDepth(6, program6, data, depth0),data:data});
|
|
322
|
+
if(stack1 || stack1 === 0) { buffer += stack1; }
|
|
323
|
+
buffer += "\n ";
|
|
324
|
+
return buffer;
|
|
325
|
+
}
|
|
326
|
+
function program6(depth0,data,depth1) {
|
|
327
|
+
|
|
328
|
+
var buffer = "", stack1;
|
|
329
|
+
buffer += "\n ";
|
|
330
|
+
stack1 = helpers.unless.call(depth0, (depth1 && depth1.hidden), {hash:{},inverse:self.noop,fn:self.programWithDepth(7, program7, data, depth1),data:data});
|
|
331
|
+
if(stack1 || stack1 === 0) { buffer += stack1; }
|
|
332
|
+
buffer += "\n ";
|
|
333
|
+
return buffer;
|
|
334
|
+
}
|
|
335
|
+
function program7(depth0,data,depth2) {
|
|
336
|
+
|
|
337
|
+
var buffer = "", stack1;
|
|
338
|
+
buffer += "\n ";
|
|
339
|
+
stack1 = helpers['with'].call(depth0, depth2, {hash:{},inverse:self.noop,fn:self.program(8, program8, data),data:data});
|
|
340
|
+
if(stack1 || stack1 === 0) { buffer += stack1; }
|
|
341
|
+
buffer += "\n ";
|
|
342
|
+
return buffer;
|
|
343
|
+
}
|
|
344
|
+
function program8(depth0,data) {
|
|
345
|
+
|
|
346
|
+
var buffer = "", stack1, helper;
|
|
347
|
+
buffer += "\n <button class=\"btn-info small\" data-control=\"";
|
|
348
|
+
if (helper = helpers.id) { stack1 = helper.call(depth0, {hash:{},data:data}); }
|
|
349
|
+
else { helper = (depth0 && depth0.id); stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{},data:data}) : helper; }
|
|
350
|
+
buffer += escapeExpression(stack1)
|
|
351
|
+
+ "\"";
|
|
352
|
+
stack1 = helpers['if'].call(depth0, (depth0 && depth0.title), {hash:{},inverse:self.noop,fn:self.program(9, program9, data),data:data});
|
|
353
|
+
if(stack1 || stack1 === 0) { buffer += stack1; }
|
|
354
|
+
buffer += ">\n ";
|
|
355
|
+
stack1 = helpers['if'].call(depth0, (depth0 && depth0.icon), {hash:{},inverse:self.noop,fn:self.program(11, program11, data),data:data});
|
|
356
|
+
if(stack1 || stack1 === 0) { buffer += stack1; }
|
|
357
|
+
buffer += "\n ";
|
|
358
|
+
if (helper = helpers.label) { stack1 = helper.call(depth0, {hash:{},data:data}); }
|
|
359
|
+
else { helper = (depth0 && depth0.label); stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{},data:data}) : helper; }
|
|
360
|
+
buffer += escapeExpression(stack1)
|
|
361
|
+
+ "\n </button>\n ";
|
|
362
|
+
return buffer;
|
|
363
|
+
}
|
|
364
|
+
function program9(depth0,data) {
|
|
365
|
+
|
|
366
|
+
var buffer = "", stack1, helper;
|
|
367
|
+
buffer += " title=\"";
|
|
368
|
+
if (helper = helpers.title) { stack1 = helper.call(depth0, {hash:{},data:data}); }
|
|
369
|
+
else { helper = (depth0 && depth0.title); stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{},data:data}) : helper; }
|
|
370
|
+
buffer += escapeExpression(stack1)
|
|
371
|
+
+ "\"";
|
|
372
|
+
return buffer;
|
|
403
373
|
}
|
|
404
374
|
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
*
|
|
416
|
-
* You should have received a copy of the GNU General Public License
|
|
417
|
-
* along with this program; if not, write to the Free Software
|
|
418
|
-
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
419
|
-
*
|
|
420
|
-
* Copyright (c) 2015 (original work) Open Assessment Technologies SA ;
|
|
421
|
-
*/
|
|
422
|
-
/**
|
|
423
|
-
* Some default values
|
|
424
|
-
* @type {Object}
|
|
425
|
-
* @private
|
|
426
|
-
*/
|
|
375
|
+
function program11(depth0,data) {
|
|
376
|
+
|
|
377
|
+
var buffer = "", stack1, helper;
|
|
378
|
+
buffer += "<span class=\"icon icon-";
|
|
379
|
+
if (helper = helpers.icon) { stack1 = helper.call(depth0, {hash:{},data:data}); }
|
|
380
|
+
else { helper = (depth0 && depth0.icon); stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{},data:data}) : helper; }
|
|
381
|
+
buffer += escapeExpression(stack1)
|
|
382
|
+
+ "\"></span>";
|
|
383
|
+
return buffer;
|
|
384
|
+
}
|
|
427
385
|
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
386
|
+
stack1 = helpers.each.call(depth0, (depth0 && depth0.list), {hash:{},inverse:self.noop,fn:self.programWithDepth(1, program1, data, depth0),data:data});
|
|
387
|
+
if(stack1 || stack1 === 0) { buffer += stack1; }
|
|
388
|
+
buffer += "\n";
|
|
389
|
+
return buffer;
|
|
390
|
+
});
|
|
391
|
+
function listTpl(data, options, asString) {
|
|
392
|
+
var html = Template$1(data, options);
|
|
393
|
+
return (asString || true) ? html : $(html);
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
/**
|
|
397
|
+
* This program is free software; you can redistribute it and/or
|
|
398
|
+
* modify it under the terms of the GNU General Public License
|
|
399
|
+
* as published by the Free Software Foundation; under version 2
|
|
400
|
+
* of the License (non-upgradable).
|
|
401
|
+
*
|
|
402
|
+
* This program is distributed in the hope that it will be useful,
|
|
403
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
404
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
405
|
+
* GNU General Public License for more details.
|
|
406
|
+
*
|
|
407
|
+
* You should have received a copy of the GNU General Public License
|
|
408
|
+
* along with this program; if not, write to the Free Software
|
|
409
|
+
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
410
|
+
*
|
|
411
|
+
* Copyright (c) 2015 (original work) Open Assessment Technologies SA ;
|
|
412
|
+
*/
|
|
413
|
+
/**
|
|
414
|
+
* Some default values
|
|
415
|
+
* @type {Object}
|
|
416
|
+
* @private
|
|
417
|
+
*/
|
|
418
|
+
|
|
419
|
+
var _defaults = {
|
|
420
|
+
keyName: 'id',
|
|
421
|
+
labelName: 'label',
|
|
422
|
+
labelText: __('Label'),
|
|
423
|
+
title: false,
|
|
424
|
+
textNumber: __('Available'),
|
|
425
|
+
textEmpty: __('There is nothing to list!'),
|
|
426
|
+
textLoading: __('Loading'),
|
|
427
|
+
selectable: false
|
|
428
|
+
};
|
|
429
|
+
/**
|
|
430
|
+
* Defines a data list
|
|
431
|
+
* @type {Object}
|
|
432
|
+
*/
|
|
433
|
+
|
|
434
|
+
var datalist = {
|
|
438
435
|
/**
|
|
439
|
-
*
|
|
440
|
-
* @
|
|
436
|
+
* Updates the list
|
|
437
|
+
* @param {Array} data
|
|
438
|
+
* @returns {listBox}
|
|
439
|
+
* @fires datalist#update
|
|
441
440
|
*/
|
|
441
|
+
update: function update(data) {
|
|
442
|
+
var self = this;
|
|
443
|
+
var controls = this.controls || {};
|
|
444
|
+
var config = this.config || {};
|
|
445
|
+
var $list = controls.$list;
|
|
446
|
+
var $numberValue = controls.$numberValue;
|
|
447
|
+
var renderData = {
|
|
448
|
+
selectable: config.selectable,
|
|
449
|
+
actions: config.actions,
|
|
450
|
+
list: []
|
|
451
|
+
};
|
|
452
|
+
var list = renderData.list;
|
|
453
|
+
var count; // disable the list while updating it
|
|
454
|
+
|
|
455
|
+
this.setLoading(true); // if the update method is called before rendering, or on a destroyed component, there is no placeholder to fill...
|
|
456
|
+
|
|
457
|
+
if ($list) {
|
|
458
|
+
// be sure to remove previous list before render the new data
|
|
459
|
+
$list.empty();
|
|
460
|
+
|
|
461
|
+
if (data && data.length) {
|
|
462
|
+
// format the data to render
|
|
463
|
+
_.forEach(data, function (line) {
|
|
464
|
+
// extract the identifier and the label according to the config
|
|
465
|
+
var id = line[config.keyName];
|
|
466
|
+
var label = line[config.labelName]; // optional custom renderer for the label
|
|
467
|
+
|
|
468
|
+
if (_.isFunction(config.labelTransform)) {
|
|
469
|
+
label = config.labelTransform.call(self, label, line);
|
|
470
|
+
} // the data to render only refer to id and identifier
|
|
471
|
+
|
|
472
|
+
|
|
473
|
+
list.push({
|
|
474
|
+
id: id,
|
|
475
|
+
label: label,
|
|
476
|
+
line: line // provide the original data for dynamic behavior like hidden actions
|
|
442
477
|
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
* Updates the list
|
|
446
|
-
* @param {Array} data
|
|
447
|
-
* @returns {listBox}
|
|
448
|
-
* @fires datalist#update
|
|
449
|
-
*/
|
|
450
|
-
update: function update(data) {
|
|
451
|
-
var self = this;
|
|
452
|
-
var controls = this.controls || {};
|
|
453
|
-
var config = this.config || {};
|
|
454
|
-
var $list = controls.$list;
|
|
455
|
-
var $numberValue = controls.$numberValue;
|
|
456
|
-
var renderData = {
|
|
457
|
-
selectable: config.selectable,
|
|
458
|
-
actions: config.actions,
|
|
459
|
-
list: []
|
|
460
|
-
};
|
|
461
|
-
var list = renderData.list;
|
|
462
|
-
var count; // disable the list while updating it
|
|
463
|
-
|
|
464
|
-
this.setLoading(true); // if the update method is called before rendering, or on a destroyed component, there is no placeholder to fill...
|
|
465
|
-
|
|
466
|
-
if ($list) {
|
|
467
|
-
// be sure to remove previous list before render the new data
|
|
468
|
-
$list.empty();
|
|
469
|
-
|
|
470
|
-
if (data && data.length) {
|
|
471
|
-
// format the data to render
|
|
472
|
-
_.forEach(data, function (line) {
|
|
473
|
-
// extract the identifier and the label according to the config
|
|
474
|
-
var id = line[config.keyName];
|
|
475
|
-
var label = line[config.labelName]; // optional custom renderer for the label
|
|
476
|
-
|
|
477
|
-
if (_.isFunction(config.labelTransform)) {
|
|
478
|
-
label = config.labelTransform.call(self, label, line);
|
|
479
|
-
} // the data to render only refer to id and identifier
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
list.push({
|
|
483
|
-
id: id,
|
|
484
|
-
label: label,
|
|
485
|
-
line: line // provide the original data for dynamic behavior like hidden actions
|
|
486
|
-
|
|
487
|
-
});
|
|
488
|
-
}); // render the data at the right placeholder
|
|
478
|
+
});
|
|
479
|
+
}); // render the data at the right placeholder
|
|
489
480
|
|
|
490
481
|
|
|
491
|
-
|
|
482
|
+
$list.append(listTpl(renderData)); // update the displayed counter
|
|
492
483
|
|
|
493
|
-
|
|
494
|
-
|
|
484
|
+
if ($numberValue) {
|
|
485
|
+
count = data.length; // optional custom renderer for the counter
|
|
495
486
|
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
487
|
+
if (_.isFunction(config.countRenderer)) {
|
|
488
|
+
count = config.countRenderer.call(self, count);
|
|
489
|
+
}
|
|
499
490
|
|
|
500
|
-
|
|
501
|
-
|
|
491
|
+
$numberValue.text(count);
|
|
492
|
+
} // update the display status
|
|
502
493
|
|
|
503
494
|
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
495
|
+
this.setState('empty', false);
|
|
496
|
+
this.setState('loaded', true);
|
|
497
|
+
} else {
|
|
498
|
+
// nothing to display
|
|
499
|
+
this.setState('empty', true);
|
|
500
|
+
this.setState('loaded', false);
|
|
501
|
+
} // update the selection of existing checkboxes
|
|
511
502
|
|
|
512
503
|
|
|
513
|
-
|
|
514
|
-
|
|
504
|
+
controls.$checkboxes = this.controls.$list.find('td.checkboxes input');
|
|
505
|
+
controls.$massAction.toggleClass('hidden', true);
|
|
515
506
|
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
}
|
|
507
|
+
if (this.pendingSelection) {
|
|
508
|
+
this.setSelection(this.pendingSelection);
|
|
519
509
|
}
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
510
|
+
}
|
|
511
|
+
/**
|
|
512
|
+
* @event datalist#update
|
|
513
|
+
* @param {Array} data
|
|
514
|
+
*/
|
|
524
515
|
|
|
525
516
|
|
|
526
|
-
|
|
517
|
+
self.trigger('update', data); // ok, the list is now ready, enable it
|
|
527
518
|
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
519
|
+
this.setLoading(false);
|
|
520
|
+
return this;
|
|
521
|
+
},
|
|
531
522
|
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
523
|
+
/**
|
|
524
|
+
* Gets the current selection
|
|
525
|
+
* @returns {Array}
|
|
526
|
+
*/
|
|
527
|
+
getSelection: function getSelection() {
|
|
528
|
+
var $checkboxes = this.controls && this.controls.$checkboxes;
|
|
529
|
+
var selection = [];
|
|
539
530
|
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
531
|
+
if ($checkboxes) {
|
|
532
|
+
// extract the selection from the selected checkboxes
|
|
533
|
+
$checkboxes.filter(':checked').each(function () {
|
|
534
|
+
var id = $$1(this).closest('tr').data('id');
|
|
544
535
|
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
}
|
|
548
|
-
});
|
|
549
|
-
} else {
|
|
550
|
-
// the list may not already be rendered, but a selection may exist in pending state
|
|
551
|
-
if (this.pendingSelection) {
|
|
552
|
-
selection = this.pendingSelection;
|
|
536
|
+
if (id) {
|
|
537
|
+
selection.push(id);
|
|
553
538
|
}
|
|
539
|
+
});
|
|
540
|
+
} else {
|
|
541
|
+
// the list may not already be rendered, but a selection may exist in pending state
|
|
542
|
+
if (this.pendingSelection) {
|
|
543
|
+
selection = this.pendingSelection;
|
|
554
544
|
}
|
|
545
|
+
}
|
|
555
546
|
|
|
556
|
-
|
|
557
|
-
|
|
547
|
+
return selection;
|
|
548
|
+
},
|
|
558
549
|
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
550
|
+
/**
|
|
551
|
+
* Sets the current selection
|
|
552
|
+
* @param {Array} selection
|
|
553
|
+
* @returns {datalist}
|
|
554
|
+
* @fires datalist#select
|
|
555
|
+
*/
|
|
556
|
+
setSelection: function setSelection(selection) {
|
|
557
|
+
var controls = this.controls || {};
|
|
558
|
+
var $list = controls.$list;
|
|
559
|
+
|
|
560
|
+
if ($list) {
|
|
561
|
+
// be sure to discard existing selection
|
|
562
|
+
controls.$checkboxes.prop('checked', false);
|
|
563
|
+
|
|
564
|
+
if (selection) {
|
|
565
|
+
// find each line and check it according to the provided selection
|
|
566
|
+
_.forEach(selection, function (id) {
|
|
567
|
+
$list.find('[data-id="' + id + '"] input[type="checkbox"]').prop('checked', true);
|
|
568
|
+
});
|
|
569
|
+
} // takes care of the new selection
|
|
579
570
|
|
|
580
571
|
|
|
581
|
-
|
|
572
|
+
this._onSelection(); // remove pending selection to avoid overwrite on next update
|
|
582
573
|
|
|
583
574
|
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
return this;
|
|
591
|
-
},
|
|
575
|
+
this.pendingSelection = null;
|
|
576
|
+
} else {
|
|
577
|
+
// keep selection ready for the next update
|
|
578
|
+
this.pendingSelection = selection;
|
|
579
|
+
}
|
|
592
580
|
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
* @fires datalist#select
|
|
596
|
-
* @private
|
|
597
|
-
*/
|
|
598
|
-
_onSelection: function _onSelection() {
|
|
599
|
-
var controls = this.controls || {};
|
|
600
|
-
var $checkboxes = controls.$checkboxes;
|
|
601
|
-
var $checkAll = controls.$checkAll;
|
|
602
|
-
var $checked = $checkboxes.filter(':checked'); // update the checkAll button
|
|
603
|
-
|
|
604
|
-
if ($checked.length === $checkboxes.length) {
|
|
605
|
-
$checkAll.prop('checked', true);
|
|
606
|
-
} else {
|
|
607
|
-
$checkAll.prop('checked', false);
|
|
608
|
-
} // show/hide the mass actions tools
|
|
581
|
+
return this;
|
|
582
|
+
},
|
|
609
583
|
|
|
584
|
+
/**
|
|
585
|
+
* Called when a selection has been made
|
|
586
|
+
* @fires datalist#select
|
|
587
|
+
* @private
|
|
588
|
+
*/
|
|
589
|
+
_onSelection: function _onSelection() {
|
|
590
|
+
var controls = this.controls || {};
|
|
591
|
+
var $checkboxes = controls.$checkboxes;
|
|
592
|
+
var $checkAll = controls.$checkAll;
|
|
593
|
+
var $checked = $checkboxes.filter(':checked'); // update the checkAll button
|
|
610
594
|
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
595
|
+
if ($checked.length === $checkboxes.length) {
|
|
596
|
+
$checkAll.prop('checked', true);
|
|
597
|
+
} else {
|
|
598
|
+
$checkAll.prop('checked', false);
|
|
599
|
+
} // show/hide the mass actions tools
|
|
616
600
|
|
|
617
|
-
this.trigger('select', this.getSelection());
|
|
618
|
-
},
|
|
619
601
|
|
|
602
|
+
controls.$massAction.toggleClass('hidden', !$checked.length);
|
|
620
603
|
/**
|
|
621
|
-
*
|
|
622
|
-
* @param {
|
|
623
|
-
* @returns {listBox}
|
|
604
|
+
* @event datalist#select
|
|
605
|
+
* @param {Array} selection
|
|
624
606
|
*/
|
|
625
|
-
setLoading: function setLoading(flag) {
|
|
626
|
-
if (flag) {
|
|
627
|
-
this.setState('loaded', false);
|
|
628
|
-
}
|
|
629
607
|
|
|
630
|
-
|
|
631
|
-
|
|
608
|
+
this.trigger('select', this.getSelection());
|
|
609
|
+
},
|
|
632
610
|
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
this.
|
|
611
|
+
/**
|
|
612
|
+
* Sets the loading state
|
|
613
|
+
* @param {Boolean} flag
|
|
614
|
+
* @returns {listBox}
|
|
615
|
+
*/
|
|
616
|
+
setLoading: function setLoading(flag) {
|
|
617
|
+
if (flag) {
|
|
618
|
+
this.setState('loaded', false);
|
|
619
|
+
}
|
|
641
620
|
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
$title.addClass('hidden');
|
|
645
|
-
} else {
|
|
646
|
-
$title.html(title).removeClass('hidden');
|
|
647
|
-
}
|
|
648
|
-
}
|
|
621
|
+
return this.setState('loading', flag);
|
|
622
|
+
},
|
|
649
623
|
|
|
650
|
-
|
|
651
|
-
|
|
624
|
+
/**
|
|
625
|
+
* Sets the title of the list.
|
|
626
|
+
* @param {String|Boolean} title - The text to set. If the value is false no title is displayed
|
|
627
|
+
* @returns {listBox}
|
|
628
|
+
*/
|
|
629
|
+
setTitle: function setTitle(title) {
|
|
630
|
+
var $title = this.controls && this.controls.$title;
|
|
631
|
+
this.config.title = title;
|
|
652
632
|
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
setTextNumber: function setTextNumber(text) {
|
|
659
|
-
var $numberLabel = this.controls && this.controls.$numberLabel;
|
|
660
|
-
var $textAvailable = this.controls && this.controls.$textAvailable;
|
|
661
|
-
this.config.textNumber = text;
|
|
662
|
-
|
|
663
|
-
if ($numberLabel) {
|
|
664
|
-
if (text !== false) {
|
|
665
|
-
$numberLabel.html(text).removeClass('hidden');
|
|
666
|
-
} else if ($textAvailable) {
|
|
667
|
-
$textAvailable.addClass('hidden');
|
|
668
|
-
}
|
|
633
|
+
if ($title) {
|
|
634
|
+
if (false === title) {
|
|
635
|
+
$title.addClass('hidden');
|
|
636
|
+
} else {
|
|
637
|
+
$title.html(title).removeClass('hidden');
|
|
669
638
|
}
|
|
639
|
+
}
|
|
670
640
|
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
/**
|
|
675
|
-
* Sets the label displayed when there no data available.
|
|
676
|
-
* @param {String|Boolean} text - The text to set. If the value is false no label is displayed
|
|
677
|
-
* @returns {listBox}
|
|
678
|
-
*/
|
|
679
|
-
setTextEmpty: function setTextEmpty(text) {
|
|
680
|
-
var $textEmpty = this.controls && this.controls.$textEmpty;
|
|
681
|
-
this.config.textEmpty = text;
|
|
641
|
+
return this;
|
|
642
|
+
},
|
|
682
643
|
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
644
|
+
/**
|
|
645
|
+
* Sets the label of the number of lines.
|
|
646
|
+
* @param {String|Boolean} text - The text to set. If the value is false no label is displayed
|
|
647
|
+
* @returns {listBox}
|
|
648
|
+
*/
|
|
649
|
+
setTextNumber: function setTextNumber(text) {
|
|
650
|
+
var $numberLabel = this.controls && this.controls.$numberLabel;
|
|
651
|
+
var $textAvailable = this.controls && this.controls.$textAvailable;
|
|
652
|
+
this.config.textNumber = text;
|
|
653
|
+
|
|
654
|
+
if ($numberLabel) {
|
|
655
|
+
if (text !== false) {
|
|
656
|
+
$numberLabel.html(text).removeClass('hidden');
|
|
657
|
+
} else if ($textAvailable) {
|
|
658
|
+
$textAvailable.addClass('hidden');
|
|
689
659
|
}
|
|
660
|
+
}
|
|
690
661
|
|
|
691
|
-
|
|
692
|
-
|
|
662
|
+
return this;
|
|
663
|
+
},
|
|
693
664
|
|
|
694
|
-
/**
|
|
695
|
-
* Sets the label displayed when the list is loading.
|
|
696
|
-
* @param {String|Boolean} text - The text to set. If the value is false no label is displayed
|
|
697
|
-
* @returns {listBox}
|
|
698
|
-
*/
|
|
699
|
-
setTextLoading: function setTextLoading(text) {
|
|
700
|
-
var $textLoading = this.controls && this.controls.$textLoading;
|
|
701
|
-
this.config.textLoading = text;
|
|
702
|
-
|
|
703
|
-
if ($textLoading) {
|
|
704
|
-
if (false === text) {
|
|
705
|
-
$textLoading.addClass('hidden');
|
|
706
|
-
} else {
|
|
707
|
-
$textLoading.html(text).removeClass('hidden');
|
|
708
|
-
}
|
|
709
|
-
}
|
|
710
|
-
|
|
711
|
-
return this;
|
|
712
|
-
}
|
|
713
|
-
};
|
|
714
665
|
/**
|
|
715
|
-
*
|
|
716
|
-
* @param {
|
|
717
|
-
* @
|
|
718
|
-
* @param {String} [config.labelName] - Sets the name of the attribute containing the label for each data line (default: 'label')
|
|
719
|
-
* @param {String|Boolean} [config.labelText] - Sets the displayed title for the column containing the labels. If the value is false no title is displayed (default: 'Label')
|
|
720
|
-
* @param {String|Boolean} [config.title] - Sets the title of the list. If the value is false no title is displayed (default: false)
|
|
721
|
-
* @param {String|Boolean} [config.textNumber] - Sets the label of the number of data lines. If the value is false no label is displayed (default: 'Available')
|
|
722
|
-
* @param {String|Boolean} [config.textEmpty] - Sets the label displayed when there no data available. If the value is false no label is displayed (default: 'There is nothing to list!')
|
|
723
|
-
* @param {String|Boolean} [config.textLoading] - Sets the label displayed when the list is loading. If the value is false no label is displayed (default: 'Loading')
|
|
724
|
-
* @param {jQuery|HTMLElement|String} [config.renderTo] - An optional container in which renders the component
|
|
725
|
-
* @param {Boolean} [config.selectable] - Append a checkbox on each displayed line to allow selection (default: false)
|
|
726
|
-
* @param {Boolean} [config.replace] - When the component is appended to its container, clears the place before
|
|
727
|
-
* @param {Function} [config.labelTransform] - Optional renderer applied on each displayed label.
|
|
728
|
-
* @param {Function} [config.countRenderer] - An optional callback applied on the list count before display
|
|
729
|
-
* @param {Array} [config.tools] - An optional list of buttons to add on top of the list. Each buttons provides a mass action on the selected lines. If selectable is not enabled, all lines are selected.
|
|
730
|
-
* @param {Array} [config.actions] - An optional list of buttons to add on each line.
|
|
731
|
-
* @param {Array} [data] - The data to display
|
|
732
|
-
* @returns {datalist}
|
|
733
|
-
*
|
|
734
|
-
* @event init - Emitted when the component is initialized
|
|
735
|
-
* @event destroy - Emitted when the component is destroying
|
|
736
|
-
* @event render - Emitted when the component is rendered
|
|
737
|
-
* @event update - Emitted when the component is updated
|
|
738
|
-
* @event tool - Emitted when a tool button is clicked
|
|
739
|
-
* @event action - Emitted when an action button is clicked
|
|
740
|
-
* @event select - Emitted when a selection is made
|
|
741
|
-
* @event show - Emitted when the component is shown
|
|
742
|
-
* @event hide - Emitted when the component is hidden
|
|
743
|
-
* @event enable - Emitted when the component is enabled
|
|
744
|
-
* @event disable - Emitted when the component is disabled
|
|
745
|
-
* @event template - Emitted when the template is changed
|
|
666
|
+
* Sets the label displayed when there no data available.
|
|
667
|
+
* @param {String|Boolean} text - The text to set. If the value is false no label is displayed
|
|
668
|
+
* @returns {listBox}
|
|
746
669
|
*/
|
|
670
|
+
setTextEmpty: function setTextEmpty(text) {
|
|
671
|
+
var $textEmpty = this.controls && this.controls.$textEmpty;
|
|
672
|
+
this.config.textEmpty = text;
|
|
747
673
|
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
674
|
+
if ($textEmpty) {
|
|
675
|
+
if (false === text) {
|
|
676
|
+
$textEmpty.addClass('hidden');
|
|
677
|
+
} else {
|
|
678
|
+
$textEmpty.html(text).removeClass('hidden');
|
|
679
|
+
}
|
|
680
|
+
}
|
|
752
681
|
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
tools[tool.id] = tool;
|
|
756
|
-
});
|
|
757
|
-
} // build a map of the lines actions if any
|
|
682
|
+
return this;
|
|
683
|
+
},
|
|
758
684
|
|
|
685
|
+
/**
|
|
686
|
+
* Sets the label displayed when the list is loading.
|
|
687
|
+
* @param {String|Boolean} text - The text to set. If the value is false no label is displayed
|
|
688
|
+
* @returns {listBox}
|
|
689
|
+
*/
|
|
690
|
+
setTextLoading: function setTextLoading(text) {
|
|
691
|
+
var $textLoading = this.controls && this.controls.$textLoading;
|
|
692
|
+
this.config.textLoading = text;
|
|
759
693
|
|
|
760
|
-
if (
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
}
|
|
694
|
+
if ($textLoading) {
|
|
695
|
+
if (false === text) {
|
|
696
|
+
$textLoading.addClass('hidden');
|
|
697
|
+
} else {
|
|
698
|
+
$textLoading.html(text).removeClass('hidden');
|
|
699
|
+
}
|
|
764
700
|
}
|
|
765
701
|
|
|
766
|
-
return
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
702
|
+
return this;
|
|
703
|
+
}
|
|
704
|
+
};
|
|
705
|
+
/**
|
|
706
|
+
* Builds an instance of the datalist component
|
|
707
|
+
* @param {Object} config
|
|
708
|
+
* @param {String} [config.keyName] - Sets the name of the attribute containing the identifier for each data line (default: 'id')
|
|
709
|
+
* @param {String} [config.labelName] - Sets the name of the attribute containing the label for each data line (default: 'label')
|
|
710
|
+
* @param {String|Boolean} [config.labelText] - Sets the displayed title for the column containing the labels. If the value is false no title is displayed (default: 'Label')
|
|
711
|
+
* @param {String|Boolean} [config.title] - Sets the title of the list. If the value is false no title is displayed (default: false)
|
|
712
|
+
* @param {String|Boolean} [config.textNumber] - Sets the label of the number of data lines. If the value is false no label is displayed (default: 'Available')
|
|
713
|
+
* @param {String|Boolean} [config.textEmpty] - Sets the label displayed when there no data available. If the value is false no label is displayed (default: 'There is nothing to list!')
|
|
714
|
+
* @param {String|Boolean} [config.textLoading] - Sets the label displayed when the list is loading. If the value is false no label is displayed (default: 'Loading')
|
|
715
|
+
* @param {jQuery|HTMLElement|String} [config.renderTo] - An optional container in which renders the component
|
|
716
|
+
* @param {Boolean} [config.selectable] - Append a checkbox on each displayed line to allow selection (default: false)
|
|
717
|
+
* @param {Boolean} [config.replace] - When the component is appended to its container, clears the place before
|
|
718
|
+
* @param {Function} [config.labelTransform] - Optional renderer applied on each displayed label.
|
|
719
|
+
* @param {Function} [config.countRenderer] - An optional callback applied on the list count before display
|
|
720
|
+
* @param {Array} [config.tools] - An optional list of buttons to add on top of the list. Each buttons provides a mass action on the selected lines. If selectable is not enabled, all lines are selected.
|
|
721
|
+
* @param {Array} [config.actions] - An optional list of buttons to add on each line.
|
|
722
|
+
* @param {Array} [data] - The data to display
|
|
723
|
+
* @returns {datalist}
|
|
724
|
+
*
|
|
725
|
+
* @event init - Emitted when the component is initialized
|
|
726
|
+
* @event destroy - Emitted when the component is destroying
|
|
727
|
+
* @event render - Emitted when the component is rendered
|
|
728
|
+
* @event update - Emitted when the component is updated
|
|
729
|
+
* @event tool - Emitted when a tool button is clicked
|
|
730
|
+
* @event action - Emitted when an action button is clicked
|
|
731
|
+
* @event select - Emitted when a selection is made
|
|
732
|
+
* @event show - Emitted when the component is shown
|
|
733
|
+
* @event hide - Emitted when the component is hidden
|
|
734
|
+
* @event enable - Emitted when the component is enabled
|
|
735
|
+
* @event disable - Emitted when the component is disabled
|
|
736
|
+
* @event template - Emitted when the template is changed
|
|
737
|
+
*/
|
|
738
|
+
|
|
739
|
+
function datalistFactory(config, data) {
|
|
740
|
+
var initConfig = config || {};
|
|
741
|
+
var actions = {};
|
|
742
|
+
var tools = {}; // build a map of the tools if any
|
|
743
|
+
|
|
744
|
+
if (initConfig.tools) {
|
|
745
|
+
_.forEach(initConfig.tools, function (tool) {
|
|
746
|
+
tools[tool.id] = tool;
|
|
747
|
+
});
|
|
748
|
+
} // build a map of the lines actions if any
|
|
807
749
|
|
|
808
|
-
this.controls.$list.on('click', 'button', function (e) {
|
|
809
|
-
var $this = $$1(this);
|
|
810
|
-
var lineId = $this.closest('tr').data('id');
|
|
811
|
-
var buttonId = $this.closest('button').data('control');
|
|
812
|
-
var button = actions[buttonId];
|
|
813
|
-
e.preventDefault();
|
|
814
750
|
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
* @param {String} lineId
|
|
821
|
-
* @param {String} buttonId
|
|
822
|
-
*/
|
|
751
|
+
if (initConfig.actions) {
|
|
752
|
+
_.forEach(initConfig.actions, function (action) {
|
|
753
|
+
actions[action.id] = action;
|
|
754
|
+
});
|
|
755
|
+
}
|
|
823
756
|
|
|
757
|
+
return component(datalist, _defaults).setTemplate(mainTpl) // uninstalls the component
|
|
758
|
+
.on('destroy', function () {
|
|
759
|
+
this.controls = null;
|
|
760
|
+
this.pendingSelection = null;
|
|
761
|
+
}) // renders the component
|
|
762
|
+
.on('render', function () {
|
|
763
|
+
var self = this; // get access to all needed placeholders
|
|
764
|
+
|
|
765
|
+
this.controls = {
|
|
766
|
+
$title: this.$component.find('h1'),
|
|
767
|
+
$textEmpty: this.$component.find('.empty-list'),
|
|
768
|
+
$textAvailable: this.$component.find('.available-list'),
|
|
769
|
+
$textLoading: this.$component.find('.loading span'),
|
|
770
|
+
$numberLabel: this.$component.find('.available-list .label'),
|
|
771
|
+
$numberValue: this.$component.find('.available-list .count'),
|
|
772
|
+
$actionBar: this.$component.find('.list .action-bar'),
|
|
773
|
+
$massAction: this.$component.find('.list .mass-action'),
|
|
774
|
+
$checkAll: this.$component.find('.list th.checkboxes input'),
|
|
775
|
+
$checkboxes: this.$component.find('.list td.checkboxes input'),
|
|
776
|
+
$list: this.$component.find('.list tbody')
|
|
777
|
+
}; // take care of tools buttons
|
|
778
|
+
|
|
779
|
+
this.controls.$actionBar.on('click', 'button', function (e) {
|
|
780
|
+
var $this = $$1(this);
|
|
781
|
+
var buttonId = $this.closest('button').data('control');
|
|
782
|
+
var button = tools[buttonId];
|
|
783
|
+
var selection = self.getSelection();
|
|
784
|
+
e.preventDefault();
|
|
785
|
+
|
|
786
|
+
if (button && button.action) {
|
|
787
|
+
button.action.call(self, selection, buttonId);
|
|
788
|
+
}
|
|
789
|
+
/**
|
|
790
|
+
* @event datalist#tool
|
|
791
|
+
* @param {Array} selection
|
|
792
|
+
* @param {String} buttonId
|
|
793
|
+
*/
|
|
824
794
|
|
|
825
|
-
self.trigger('action', lineId, buttonId);
|
|
826
|
-
}); // take care of clicks on labels
|
|
827
795
|
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
var $checkbox;
|
|
796
|
+
self.trigger('tool', selection, buttonId);
|
|
797
|
+
}); // take care of actions buttons
|
|
831
798
|
|
|
832
|
-
|
|
833
|
-
|
|
799
|
+
this.controls.$list.on('click', 'button', function (e) {
|
|
800
|
+
var $this = $$1(this);
|
|
801
|
+
var lineId = $this.closest('tr').data('id');
|
|
802
|
+
var buttonId = $this.closest('button').data('control');
|
|
803
|
+
var button = actions[buttonId];
|
|
804
|
+
e.preventDefault();
|
|
834
805
|
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
806
|
+
if (button && button.action) {
|
|
807
|
+
button.action.call(self, lineId, buttonId);
|
|
808
|
+
}
|
|
809
|
+
/**
|
|
810
|
+
* @event datalist#action
|
|
811
|
+
* @param {String} lineId
|
|
812
|
+
* @param {String} buttonId
|
|
813
|
+
*/
|
|
840
814
|
|
|
841
815
|
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
}); // take care of clicks on checkboxes
|
|
816
|
+
self.trigger('action', lineId, buttonId);
|
|
817
|
+
}); // take care of clicks on labels
|
|
845
818
|
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
}); // check/uncheck all checkboxes
|
|
819
|
+
this.setState('selectable', this.config.selectable);
|
|
820
|
+
this.controls.$list.on('click', 'td.label', function () {
|
|
821
|
+
var $checkbox;
|
|
850
822
|
|
|
851
|
-
|
|
852
|
-
|
|
823
|
+
if (self.config.selectable) {
|
|
824
|
+
$checkbox = $$1(this).closest('tr').find('input[type="checkbox"]'); // toggle the line selection
|
|
853
825
|
|
|
854
|
-
if (
|
|
855
|
-
$
|
|
826
|
+
if ($checkbox.prop('checked')) {
|
|
827
|
+
$checkbox.prop('checked', false);
|
|
856
828
|
} else {
|
|
857
|
-
$
|
|
829
|
+
$checkbox.prop('checked', true);
|
|
858
830
|
} // takes care of the new selection
|
|
859
831
|
|
|
860
832
|
|
|
861
833
|
self._onSelection();
|
|
862
|
-
}
|
|
834
|
+
}
|
|
835
|
+
}); // take care of clicks on checkboxes
|
|
836
|
+
|
|
837
|
+
this.controls.$list.on('click', 'input[type="checkbox"]', function () {
|
|
838
|
+
// just takes care of the new selection
|
|
839
|
+
self._onSelection();
|
|
840
|
+
}); // check/uncheck all checkboxes
|
|
863
841
|
|
|
864
|
-
|
|
865
|
-
|
|
842
|
+
this.controls.$checkAll.on('click', function () {
|
|
843
|
+
var $checkboxes = self.controls.$checkboxes; // select/unselect all lines
|
|
844
|
+
|
|
845
|
+
if (this.checked) {
|
|
846
|
+
$checkboxes.prop('checked', true);
|
|
866
847
|
} else {
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
848
|
+
$checkboxes.prop('checked', false);
|
|
849
|
+
} // takes care of the new selection
|
|
850
|
+
|
|
851
|
+
|
|
852
|
+
self._onSelection();
|
|
853
|
+
}); // data already available ?
|
|
854
|
+
|
|
855
|
+
if (data) {
|
|
856
|
+
this.update(data);
|
|
857
|
+
} else {
|
|
858
|
+
this.setState('empty', true);
|
|
859
|
+
this.setState('loaded', false);
|
|
860
|
+
}
|
|
861
|
+
}).init(initConfig);
|
|
862
|
+
}
|
|
872
863
|
|
|
873
|
-
|
|
864
|
+
return datalistFactory;
|
|
874
865
|
|
|
875
866
|
});
|