@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.
Files changed (233) hide show
  1. package/dist/actionbar.js +386 -395
  2. package/dist/adder.js +21 -19
  3. package/dist/animable/absorbable/absorbable.js +204 -213
  4. package/dist/animable/absorbable/css/absorb.css +1 -0
  5. package/dist/animable/absorbable/css/absorb.css.map +1 -1
  6. package/dist/animable/pulsable/pulsable.js +168 -177
  7. package/dist/autocomplete/css/autocomplete.css +1 -0
  8. package/dist/autocomplete/css/autocomplete.css.map +1 -1
  9. package/dist/autocomplete.js +68 -66
  10. package/dist/badge/badge.js +188 -197
  11. package/dist/badge/css/badge.css +1 -0
  12. package/dist/badge/css/badge.css.map +1 -1
  13. package/dist/breadcrumbs.js +275 -284
  14. package/dist/btngrouper.js +5 -5
  15. package/dist/bulkActionPopup.js +490 -495
  16. package/dist/button.js +283 -291
  17. package/dist/cascadingComboBox.js +249 -258
  18. package/dist/ckeditor/ckConfigurator.js +26 -19
  19. package/dist/ckeditor/dtdHandler.js +11 -9
  20. package/dist/class/selector.js +441 -450
  21. package/dist/component/resizable.js +1 -1
  22. package/dist/component/windowed.js +285 -294
  23. package/dist/component.js +419 -428
  24. package/dist/contextualPopup.js +417 -426
  25. package/dist/dashboard.js +300 -309
  26. package/dist/datalist.js +753 -762
  27. package/dist/datatable/filterStrategy/multiple.js +1 -1
  28. package/dist/datatable/filterStrategy/single.js +1 -1
  29. package/dist/datatable.js +1527 -1550
  30. package/dist/dateRange/dateRange.js +393 -402
  31. package/dist/datetime/picker.js +665 -672
  32. package/dist/deleter.js +368 -377
  33. package/dist/destination/selector.js +286 -295
  34. package/dist/dialog/alert.js +3 -3
  35. package/dist/dialog/confirm.js +1 -1
  36. package/dist/dialog/confirmDelete.js +216 -225
  37. package/dist/dialog.js +650 -654
  38. package/dist/disabler.js +8 -8
  39. package/dist/documentViewer/providers/pdfViewer/fallback/viewer.js +166 -175
  40. package/dist/documentViewer/providers/pdfViewer/pdfjs/findBar.js +518 -527
  41. package/dist/documentViewer/providers/pdfViewer/pdfjs/pageView.js +380 -389
  42. package/dist/documentViewer/providers/pdfViewer/pdfjs/searchEngine.js +539 -548
  43. package/dist/documentViewer/providers/pdfViewer/pdfjs/viewer.js +369 -378
  44. package/dist/documentViewer/providers/pdfViewer.js +184 -193
  45. package/dist/documentViewer.js +292 -301
  46. package/dist/dropdown.js +383 -392
  47. package/dist/durationer.js +5 -5
  48. package/dist/dynamicComponent.js +597 -598
  49. package/dist/feedback.js +356 -362
  50. package/dist/figure/FigureStateActive.js +117 -108
  51. package/dist/filesender.js +2 -2
  52. package/dist/filter.js +230 -239
  53. package/dist/form/dropdownForm.js +355 -357
  54. package/dist/form/form.js +919 -690
  55. package/dist/form/simpleForm.js +1 -1
  56. package/dist/form/validator/renderer.js +233 -235
  57. package/dist/form/validator/validator.js +257 -189
  58. package/dist/form/widget/definitions.js +1 -1
  59. package/dist/form/widget/providers/checkBox.js +254 -259
  60. package/dist/form/widget/providers/comboBox.js +187 -192
  61. package/dist/form/widget/providers/default.js +8 -9
  62. package/dist/form/widget/providers/hidden.js +170 -179
  63. package/dist/form/widget/providers/hiddenBox.js +262 -267
  64. package/dist/form/widget/providers/radioBox.js +216 -225
  65. package/dist/form/widget/providers/textArea.js +187 -196
  66. package/dist/form/widget/providers/textBox.js +2 -3
  67. package/dist/form/widget/widget.js +473 -475
  68. package/dist/formValidator/formValidator.js +1 -1
  69. package/dist/formValidator/highlighters/message.js +1 -1
  70. package/dist/generis/form/form.js +314 -323
  71. package/dist/generis/validator/validator.js +209 -218
  72. package/dist/generis/widget/checkBox/checkBox.js +218 -227
  73. package/dist/generis/widget/comboBox/comboBox.js +179 -188
  74. package/dist/generis/widget/hiddenBox/hiddenBox.js +220 -229
  75. package/dist/generis/widget/textBox/textBox.js +169 -178
  76. package/dist/generis/widget/widget.js +246 -255
  77. package/dist/groupedComboBox.js +222 -231
  78. package/dist/groupvalidator.js +2 -2
  79. package/dist/highlighter.js +967 -958
  80. package/dist/image/ImgStateActive/helper.js +7 -5
  81. package/dist/image/ImgStateActive/initHelper.js +49 -43
  82. package/dist/image/ImgStateActive/initMediaEditor.js +24 -20
  83. package/dist/image/ImgStateActive/mediaSizer.js +14 -12
  84. package/dist/image/ImgStateActive.js +72 -70
  85. package/dist/incrementer.js +6 -6
  86. package/dist/inplacer.js +6 -6
  87. package/dist/itemButtonList/css/item-button-list.css +1 -0
  88. package/dist/itemButtonList/css/item-button-list.css.map +1 -1
  89. package/dist/itemButtonList.js +439 -435
  90. package/dist/keyNavigation/navigableDomElement.js +51 -38
  91. package/dist/keyNavigation/navigator.js +85 -70
  92. package/dist/listbox.js +460 -469
  93. package/dist/liststyler.js +8 -8
  94. package/dist/loadingButton/loadingButton.js +209 -218
  95. package/dist/lock.js +476 -485
  96. package/dist/login/login.js +475 -484
  97. package/dist/maths/calculator/basicCalculator.js +235 -244
  98. package/dist/maths/calculator/calculatorComponent.js +3 -3
  99. package/dist/maths/calculator/core/board.js +772 -781
  100. package/dist/maths/calculator/core/expression.js +476 -485
  101. package/dist/maths/calculator/core/labels.js +228 -237
  102. package/dist/maths/calculator/core/tokenizer.js +1 -1
  103. package/dist/maths/calculator/core/tokens.js +163 -170
  104. package/dist/maths/calculator/plugins/keyboard/templateKeyboard/templateKeyboard.js +244 -253
  105. package/dist/maths/calculator/plugins/screen/simpleScreen/simpleScreen.js +279 -288
  106. package/dist/maths/calculator/scientificCalculator.js +327 -336
  107. package/dist/mediaEditor/mediaEditorComponent.js +238 -245
  108. package/dist/mediaEditor/plugins/mediaAlignment/helper.js +7 -7
  109. package/dist/mediaEditor/plugins/mediaAlignment/mediaAlignmentComponent.js +229 -235
  110. package/dist/mediaEditor/plugins/mediaDimension/mediaDimensionComponent.js +580 -589
  111. package/dist/mediaplayer/players/html5.js +666 -675
  112. package/dist/mediaplayer/players/youtube.js +419 -424
  113. package/dist/mediaplayer/support.js +11 -10
  114. package/dist/mediaplayer/utils/reminder.js +14 -13
  115. package/dist/mediaplayer/utils/timeObserver.js +10 -11
  116. package/dist/mediaplayer/youtubeManager.js +164 -145
  117. package/dist/mediaplayer.js +1565 -1520
  118. package/dist/mediasizer.js +669 -678
  119. package/dist/modal.js +10 -17
  120. package/dist/pageSizeSelector.js +219 -228
  121. package/dist/pagination/providers/pages.js +280 -289
  122. package/dist/pagination/providers/simple.js +192 -201
  123. package/dist/previewer.js +30 -30
  124. package/dist/progressbar.js +4 -4
  125. package/dist/report.js +347 -356
  126. package/dist/resource/filters.js +271 -280
  127. package/dist/resource/list.js +1264 -1273
  128. package/dist/resource/selector.js +865 -874
  129. package/dist/resource/tree.js +1483 -1492
  130. package/dist/resourcemgr/fileBrowser.js +564 -569
  131. package/dist/resourcemgr/filePreview.js +16 -16
  132. package/dist/resourcemgr/fileSelector.js +515 -524
  133. package/dist/resourcemgr/util/updatePermissions.js +2 -2
  134. package/dist/resourcemgr.js +306 -315
  135. package/dist/searchModal/advancedSearch.js +796 -767
  136. package/dist/searchModal.js +114 -91
  137. package/dist/switch/switch.js +298 -307
  138. package/dist/tabs.js +598 -575
  139. package/dist/taskQueue/status.js +312 -321
  140. package/dist/taskQueue/table.js +375 -384
  141. package/dist/taskQueue/taskQueueModel.js +488 -472
  142. package/dist/taskQueueButton/taskable.js +264 -273
  143. package/dist/taskQueueButton/treeButton.js +189 -198
  144. package/dist/themeLoader.js +24 -23
  145. package/dist/themes.js +1 -1
  146. package/dist/toggler.js +3 -3
  147. package/dist/tooltip.js +295 -304
  148. package/dist/transformer.js +2 -2
  149. package/dist/tristateCheckboxGroup.js +311 -320
  150. package/dist/uploader.js +687 -696
  151. package/dist/validator/Report.js +1 -1
  152. package/dist/validator/Validator.js +3 -3
  153. package/dist/validator/validators.js +9 -9
  154. package/dist/validator.js +240 -230
  155. package/dist/waitForMedia.js +1 -1
  156. package/package.json +3 -3
  157. package/src/animable/absorbable/css/absorb.css +1 -0
  158. package/src/animable/absorbable/css/absorb.css.map +1 -1
  159. package/src/autocomplete/css/autocomplete.css +1 -0
  160. package/src/autocomplete/css/autocomplete.css.map +1 -1
  161. package/src/badge/css/badge.css +1 -0
  162. package/src/badge/css/badge.css.map +1 -1
  163. package/src/ckeditor/ckConfigurator.js +4 -0
  164. package/src/itemButtonList/css/item-button-list.css +1 -0
  165. package/src/itemButtonList/css/item-button-list.css.map +1 -1
  166. package/src/.DS_Store +0 -0
  167. package/src/css/basic.css +0 -7826
  168. package/src/css/basic.css.map +0 -1
  169. package/src/css/ckeditor/skins/tao/css/dialog.css +0 -950
  170. package/src/css/ckeditor/skins/tao/css/dialog.css.map +0 -1
  171. package/src/css/ckeditor/skins/tao/css/editor.css +0 -1850
  172. package/src/css/ckeditor/skins/tao/css/editor.css.map +0 -1
  173. package/src/scss/.DS_Store +0 -0
  174. package/src/scss/basic.scss +0 -16
  175. package/src/scss/ckeditor/skins/tao/scss/dialog.scss +0 -763
  176. package/src/scss/ckeditor/skins/tao/scss/editor.scss +0 -111
  177. package/src/scss/ckeditor/skins/tao/scss/inc/_ck-icons.scss +0 -59
  178. package/src/scss/ckeditor/skins/tao/scss/inc/_colorpanel.scss +0 -118
  179. package/src/scss/ckeditor/skins/tao/scss/inc/_elementspath.scss +0 -69
  180. package/src/scss/ckeditor/skins/tao/scss/inc/_mainui.scss +0 -194
  181. package/src/scss/ckeditor/skins/tao/scss/inc/_menu.scss +0 -181
  182. package/src/scss/ckeditor/skins/tao/scss/inc/_panel.scss +0 -200
  183. package/src/scss/ckeditor/skins/tao/scss/inc/_presets.scss +0 -32
  184. package/src/scss/ckeditor/skins/tao/scss/inc/_reset.scss +0 -101
  185. package/src/scss/ckeditor/skins/tao/scss/inc/_richcombo.scss +0 -213
  186. package/src/scss/ckeditor/skins/tao/scss/inc/_tao.scss +0 -59
  187. package/src/scss/ckeditor/skins/tao/scss/inc/_toolbar.scss +0 -301
  188. package/src/scss/font/source-sans-pro/source-sans-pro-italic.eot +0 -0
  189. package/src/scss/font/source-sans-pro/source-sans-pro-italic.eot.b64 +0 -1
  190. package/src/scss/font/source-sans-pro/source-sans-pro-italic.woff +0 -0
  191. package/src/scss/font/source-sans-pro/source-sans-pro-italic.woff.b64 +0 -1
  192. package/src/scss/font/source-sans-pro/source-sans-pro-regular.eot +0 -0
  193. package/src/scss/font/source-sans-pro/source-sans-pro-regular.eot.b64 +0 -1
  194. package/src/scss/font/source-sans-pro/source-sans-pro-regular.woff +0 -0
  195. package/src/scss/font/source-sans-pro/source-sans-pro-regular.woff.b64 +0 -1
  196. package/src/scss/font/source-sans-pro/source-sans-pro-semibold-italic.eot +0 -0
  197. package/src/scss/font/source-sans-pro/source-sans-pro-semibold-italic.eot.b64 +0 -1
  198. package/src/scss/font/source-sans-pro/source-sans-pro-semibold-italic.woff +0 -0
  199. package/src/scss/font/source-sans-pro/source-sans-pro-semibold-italic.woff.b64 +0 -1
  200. package/src/scss/font/source-sans-pro/source-sans-pro-semibold.eot +0 -0
  201. package/src/scss/font/source-sans-pro/source-sans-pro-semibold.eot.b64 +0 -1
  202. package/src/scss/font/source-sans-pro/source-sans-pro-semibold.woff +0 -0
  203. package/src/scss/font/source-sans-pro/source-sans-pro-semibold.woff.b64 +0 -1
  204. package/src/scss/font/tao/tao.eot +0 -0
  205. package/src/scss/font/tao/tao.svg +0 -235
  206. package/src/scss/font/tao/tao.ttf +0 -0
  207. package/src/scss/font/tao/tao.woff +0 -0
  208. package/src/scss/inc/_base.scss +0 -496
  209. package/src/scss/inc/_bootstrap.scss +0 -6
  210. package/src/scss/inc/_buttons.scss +0 -114
  211. package/src/scss/inc/_colors.scss +0 -88
  212. package/src/scss/inc/_feedback.scss +0 -150
  213. package/src/scss/inc/_flex-grid.scss +0 -15
  214. package/src/scss/inc/_fonts.scss +0 -4
  215. package/src/scss/inc/_forms.scss +0 -827
  216. package/src/scss/inc/_functions.scss +0 -283
  217. package/src/scss/inc/_grid.scss +0 -66
  218. package/src/scss/inc/_jquery.nouislider.scss +0 -254
  219. package/src/scss/inc/_normalize.scss +0 -528
  220. package/src/scss/inc/_report.scss +0 -68
  221. package/src/scss/inc/_secondary-properties.scss +0 -89
  222. package/src/scss/inc/_select2.scss +0 -634
  223. package/src/scss/inc/_toolbars.scss +0 -155
  224. package/src/scss/inc/_tooltip.scss +0 -312
  225. package/src/scss/inc/_variables.scss +0 -21
  226. package/src/scss/inc/base/_highlight.scss +0 -5
  227. package/src/scss/inc/base/_list-style.scss +0 -59
  228. package/src/scss/inc/base/_svg.scss +0 -3
  229. package/src/scss/inc/base/_table.scss +0 -63
  230. package/src/scss/inc/fonts/_source-sans-pro.scss +0 -29
  231. package/src/scss/inc/fonts/_tao-icon-classes.scss +0 -226
  232. package/src/scss/inc/fonts/_tao-icon-def.scss +0 -12
  233. package/src/scss/inc/fonts/_tao-icon-vars.scss +0 -240
@@ -1,907 +1,936 @@
1
1
  define(['jquery', 'lodash', 'handlebars', 'i18n', 'lib/dompurify/purify', 'css!ui/searchModal/css/advancedSearch.css', 'ui/component', 'ui/modal', 'ui/datatable', 'select2', 'util/url', 'core/dataProvider/request'], function ($$1, _, Handlebars, __, DOMPurify, advancedSearch_css, component, modal, datatable, select2, urlUtil, request) { 'use strict';
2
2
 
3
- $$1 = $$1 && Object.prototype.hasOwnProperty.call($$1, 'default') ? $$1['default'] : $$1;
4
- _ = _ && Object.prototype.hasOwnProperty.call(_, 'default') ? _['default'] : _;
5
- Handlebars = Handlebars && Object.prototype.hasOwnProperty.call(Handlebars, 'default') ? Handlebars['default'] : Handlebars;
6
- __ = __ && Object.prototype.hasOwnProperty.call(__, 'default') ? __['default'] : __;
7
- DOMPurify = DOMPurify && Object.prototype.hasOwnProperty.call(DOMPurify, 'default') ? DOMPurify['default'] : DOMPurify;
8
- component = component && Object.prototype.hasOwnProperty.call(component, 'default') ? component['default'] : component;
9
- urlUtil = urlUtil && Object.prototype.hasOwnProperty.call(urlUtil, 'default') ? urlUtil['default'] : urlUtil;
10
- request = request && Object.prototype.hasOwnProperty.call(request, 'default') ? request['default'] : request;
11
-
3
+ $$1 = $$1 && Object.prototype.hasOwnProperty.call($$1, 'default') ? $$1['default'] : $$1;
4
+ _ = _ && Object.prototype.hasOwnProperty.call(_, 'default') ? _['default'] : _;
5
+ Handlebars = Handlebars && Object.prototype.hasOwnProperty.call(Handlebars, 'default') ? Handlebars['default'] : Handlebars;
6
+ __ = __ && Object.prototype.hasOwnProperty.call(__, 'default') ? __['default'] : __;
7
+ DOMPurify = DOMPurify && Object.prototype.hasOwnProperty.call(DOMPurify, 'default') ? DOMPurify['default'] : DOMPurify;
8
+ component = component && Object.prototype.hasOwnProperty.call(component, 'default') ? component['default'] : component;
9
+ urlUtil = urlUtil && Object.prototype.hasOwnProperty.call(urlUtil, 'default') ? urlUtil['default'] : urlUtil;
10
+ request = request && Object.prototype.hasOwnProperty.call(request, 'default') ? request['default'] : request;
11
+
12
+ function _typeof(obj) {
13
+ "@babel/helpers - typeof";
14
+
15
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
16
+ return typeof obj;
17
+ } : function (obj) {
18
+ return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
19
+ }, _typeof(obj);
20
+ }
21
+
22
+ function _toConsumableArray(arr) {
23
+ return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
24
+ }
25
+
26
+ function _arrayWithoutHoles(arr) {
27
+ if (Array.isArray(arr)) return _arrayLikeToArray(arr);
28
+ }
29
+
30
+ function _iterableToArray(iter) {
31
+ if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
32
+ }
33
+
34
+ function _unsupportedIterableToArray(o, minLen) {
35
+ if (!o) return;
36
+ if (typeof o === "string") return _arrayLikeToArray(o, minLen);
37
+ var n = Object.prototype.toString.call(o).slice(8, -1);
38
+ if (n === "Object" && o.constructor) n = o.constructor.name;
39
+ if (n === "Map" || n === "Set") return Array.from(o);
40
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
41
+ }
42
+
43
+ function _arrayLikeToArray(arr, len) {
44
+ if (len == null || len > arr.length) len = arr.length;
45
+
46
+ for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
47
+
48
+ return arr2;
49
+ }
50
+
51
+ function _nonIterableSpread() {
52
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
53
+ }
54
+
55
+ function Helpers0 (hb) {
56
+ //register a i18n helper
57
+ hb.registerHelper('__', function (key) {
58
+ return __(key);
59
+ });
12
60
  /**
13
- * This program is free software; you can redistribute it and/or
14
- * modify it under the terms of the GNU General Public License
15
- * as published by the Free Software Foundation; under version 2
16
- * of the License (non-upgradable).
17
- *
18
- * This program is distributed in the hope that it will be useful,
19
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
20
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
- * GNU General Public License for more details.
22
- *
23
- * You should have received a copy of the GNU General Public License
24
- * along with this program; if not, write to the Free Software
25
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
26
- *
27
- * Copyright (c) 2013-2019 (original work) Open Assessment Technologies SA (under the project TAO-PRODUCT);
28
- *
61
+ * Register dompurify helper
29
62
  *
63
+ * https://github.com/cure53/DOMPurify
64
+ * with config SAFE_FOR_TEMPLATES: true
65
+ * to make output safe for template systems
30
66
  */
31
- function Helpers0 (hb) {
32
- //register a i18n helper
33
- hb.registerHelper('__', function (key) {
34
- return __(key);
35
- });
36
- /**
37
- * Register dompurify helper
38
- *
39
- * https://github.com/cure53/DOMPurify
40
- * with config SAFE_FOR_TEMPLATES: true
41
- * to make output safe for template systems
42
- */
43
67
 
44
- hb.registerHelper('dompurify', function (context) {
45
- return DOMPurify.sanitize(context);
46
- });
47
- /**
48
- * Register join helper
49
- *
50
- * Example :
51
- * var values = {a:v1, b:v2, c:v3};
52
- * Using {{{join attributes '=' ' ' '"'}}} will return : a="v1" b="v2" c="v3"
53
- * Using {{{join values null ' or ' '*'}}} will return : *v1* or *v2* or *v3*
54
- */
55
-
56
- hb.registerHelper('join', function (arr, keyValueGlue, fragmentGlue, wrapper) {
57
- var fragments = [];
58
- keyValueGlue = typeof keyValueGlue === 'string' ? keyValueGlue : undefined;
59
- fragmentGlue = typeof fragmentGlue === 'string' ? fragmentGlue : ' ';
60
- wrapper = typeof wrapper === 'string' ? wrapper : '"';
68
+ hb.registerHelper('dompurify', function (context) {
69
+ return DOMPurify.sanitize(context);
70
+ });
71
+ /**
72
+ * Register join helper
73
+ *
74
+ * Example :
75
+ * var values = {a:v1, b:v2, c:v3};
76
+ * Using {{{join attributes '=' ' ' '"'}}} will return : a="v1" b="v2" c="v3"
77
+ * Using {{{join values null ' or ' '*'}}} will return : *v1* or *v2* or *v3*
78
+ */
61
79
 
62
- _.forIn(arr, function (value, key) {
63
- var fragment = '';
80
+ hb.registerHelper('join', function (arr, keyValueGlue, fragmentGlue, wrapper) {
81
+ var fragments = [];
82
+ keyValueGlue = typeof keyValueGlue === 'string' ? keyValueGlue : undefined;
83
+ fragmentGlue = typeof fragmentGlue === 'string' ? fragmentGlue : ' ';
84
+ wrapper = typeof wrapper === 'string' ? wrapper : '"';
64
85
 
65
- if (value !== null || value !== undefined) {
66
- if (typeof value === 'boolean') {
67
- value = value ? 'true' : 'false';
68
- } else if (typeof value === 'object') {
69
- value = _.values(value).join(' ');
70
- }
71
- } else {
72
- value = '';
73
- }
86
+ _.forIn(arr, function (value, key) {
87
+ var fragment = '';
74
88
 
75
- if (keyValueGlue !== undefined) {
76
- fragment += key + keyValueGlue;
89
+ if (value !== null || value !== undefined) {
90
+ if (typeof value === 'boolean') {
91
+ value = value ? 'true' : 'false';
92
+ } else if (_typeof(value) === 'object') {
93
+ value = _.values(value).join(' ');
77
94
  }
78
-
79
- fragment += wrapper + value + wrapper;
80
- fragments.push(fragment);
81
- });
82
-
83
- return fragments.join(fragmentGlue);
84
- }); //register a classic "for loop" helper
85
- //it also adds a local variable "i" as the index in each iteration loop
86
-
87
- hb.registerHelper('for', function (startIndex, stopIndex, increment, options) {
88
- var ret = '';
89
- startIndex = parseInt(startIndex);
90
- stopIndex = parseInt(stopIndex);
91
- increment = parseInt(increment);
92
-
93
- for (var i = startIndex; i < stopIndex; i += increment) {
94
- ret += options.fn(_.extend({}, this, {
95
- i: i
96
- }));
97
- }
98
-
99
- return ret;
100
- });
101
- hb.registerHelper('equal', function (var1, var2, options) {
102
- if (var1 == var2) {
103
- return options.fn(this);
104
95
  } else {
105
- return options.inverse(this);
96
+ value = '';
106
97
  }
107
- }); // register a "get property" helper
108
- // it gets the named property from the provided context
109
98
 
110
- hb.registerHelper('property', function (name, context) {
111
- return context[name] || '';
112
- }); // register an 'includes' helper
113
- // it checks if value is in array
114
-
115
- hb.registerHelper('includes', function (haystack, needle, options) {
116
- if (_.contains(haystack, needle)) {
117
- return options.fn(this);
99
+ if (keyValueGlue !== undefined) {
100
+ fragment += key + keyValueGlue;
118
101
  }
102
+
103
+ fragment += wrapper + value + wrapper;
104
+ fragments.push(fragment);
119
105
  });
120
- }
121
106
 
122
- if (!Helpers0.__initialized) {
123
- Helpers0(Handlebars);
124
- Helpers0.__initialized = true;
125
- }
126
- var Template = Handlebars.template(function (Handlebars,depth0,helpers,partials,data) {
127
- this.compilerInfo = [4,'>= 1.0.0'];
128
- helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
129
- var buffer = "", helper, options, helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
107
+ return fragments.join(fragmentGlue);
108
+ }); //register a classic "for loop" helper
109
+ //it also adds a local variable "i" as the index in each iteration loop
130
110
 
111
+ hb.registerHelper('for', function (startIndex, stopIndex, increment, options) {
112
+ var ret = '';
113
+ startIndex = parseInt(startIndex);
114
+ stopIndex = parseInt(stopIndex);
115
+ increment = parseInt(increment);
131
116
 
132
- buffer += "<div class=\"advanced-search-container\">\n <div class=\"advanced-criteria-container\"></div>\n <div class=\"add-criteria-container\">\n <a><span class=\"icon-add\"></span>"
133
- + escapeExpression((helper = helpers.__ || (depth0 && depth0.__),options={hash:{},data:data},helper ? helper.call(depth0, "add criteria", options) : helperMissing.call(depth0, "__", "add criteria", options)))
134
- + "</a>\n <select name=\"criteria-select\">\n <option></option>\n </select>\n </div>\n</div>\n";
135
- return buffer;
136
- });
137
- function advancedSearchTpl(data, options, asString) {
138
- var html = Template(data, options);
139
- return (asString || true) ? html : $(html);
140
- }
117
+ for (var i = startIndex; i < stopIndex; i += increment) {
118
+ ret += options.fn(_.extend({}, this, {
119
+ i: i
120
+ }));
121
+ }
141
122
 
142
- if (!Helpers0.__initialized) {
143
- Helpers0(Handlebars);
144
- Helpers0.__initialized = true;
145
- }
146
- var Template$1 = Handlebars.template(function (Handlebars,depth0,helpers,partials,data) {
147
- this.compilerInfo = [4,'>= 1.0.0'];
148
- helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
149
- var buffer = "", stack1, helper, options, functionType="function", escapeExpression=this.escapeExpression, helperMissing=helpers.helperMissing, self=this;
150
-
151
- function program1(depth0,data) {
152
-
153
- var buffer = "", stack1;
154
- buffer += " <span class=\"class-path\">/"
155
- + escapeExpression(((stack1 = ((stack1 = ((stack1 = (depth0 && depth0.criterion)),stack1 == null || stack1 === false ? stack1 : stack1['class'])),stack1 == null || stack1 === false ? stack1 : stack1.label)),typeof stack1 === functionType ? stack1.apply(depth0) : stack1))
156
- + "</span>";
157
- return buffer;
123
+ return ret;
124
+ });
125
+ hb.registerHelper('equal', function (var1, var2, options) {
126
+ if (var1 == var2) {
127
+ return options.fn(this);
128
+ } else {
129
+ return options.inverse(this);
158
130
  }
131
+ }); // register a "get property" helper
132
+ // it gets the named property from the provided context
159
133
 
160
- buffer += "<div class=\"filter-container "
161
- + escapeExpression(((stack1 = ((stack1 = (depth0 && depth0.criterion)),stack1 == null || stack1 === false ? stack1 : stack1.id)),typeof stack1 === functionType ? stack1.apply(depth0) : stack1))
162
- + "-filter\" data-criteria=\""
163
- + escapeExpression(((stack1 = ((stack1 = (depth0 && depth0.criterion)),stack1 == null || stack1 === false ? stack1 : stack1.label)),typeof stack1 === functionType ? stack1.apply(depth0) : stack1))
164
- + "\" data-type=\""
165
- + escapeExpression(((stack1 = ((stack1 = (depth0 && depth0.criterion)),stack1 == null || stack1 === false ? stack1 : stack1.type)),typeof stack1 === functionType ? stack1.apply(depth0) : stack1))
166
- + "\">\n <button class=\"icon-result-nok\" aria-label=\""
167
- + escapeExpression((helper = helpers.__ || (depth0 && depth0.__),options={hash:{},data:data},helper ? helper.call(depth0, "Remove criteria", options) : helperMissing.call(depth0, "__", "Remove criteria", options)))
168
- + "\"></button>\n <label>\n <span class=\"filter-label-text\">"
169
- + escapeExpression(((stack1 = ((stack1 = (depth0 && depth0.criterion)),stack1 == null || stack1 === false ? stack1 : stack1.label)),typeof stack1 === functionType ? stack1.apply(depth0) : stack1));
170
- stack1 = helpers['if'].call(depth0, ((stack1 = (depth0 && depth0.criterion)),stack1 == null || stack1 === false ? stack1 : stack1.isDuplicated), {hash:{},inverse:self.noop,fn:self.program(1, program1, data),data:data});
171
- if(stack1 || stack1 === 0) { buffer += stack1; }
172
- buffer += "</span>\n <input type=\"text\">\n </label>\n</div>";
173
- return buffer;
174
- });
175
- function textCriterionTpl(data, options, asString) {
176
- var html = Template$1(data, options);
177
- return (asString || true) ? html : $(html);
178
- }
134
+ hb.registerHelper('property', function (name, context) {
135
+ return context[name] || '';
136
+ }); // register an 'includes' helper
137
+ // it checks if value is in array
179
138
 
180
- if (!Helpers0.__initialized) {
181
- Helpers0(Handlebars);
182
- Helpers0.__initialized = true;
183
- }
184
- var Template$2 = Handlebars.template(function (Handlebars,depth0,helpers,partials,data) {
185
- this.compilerInfo = [4,'>= 1.0.0'];
186
- helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
187
- var buffer = "", stack1, helper, options, functionType="function", escapeExpression=this.escapeExpression, helperMissing=helpers.helperMissing, self=this;
188
-
189
- function program1(depth0,data) {
190
-
191
- var buffer = "";
192
- buffer += "\n <li>"
193
- + escapeExpression((typeof depth0 === functionType ? depth0.apply(depth0) : depth0))
194
- + "</li>\n ";
195
- return buffer;
139
+ hb.registerHelper('includes', function (haystack, needle, options) {
140
+ if (_.contains(haystack, needle)) {
141
+ return options.fn(this);
196
142
  }
197
-
198
- buffer += "<div class=\"filter-container invalid-criteria-warning-container\">\n<span class=\"select2-search-choice-close\"></span>\n <p>\n "
199
- + escapeExpression((helper = helpers.__ || (depth0 && depth0.__),options={hash:{},data:data},helper ? helper.call(depth0, "The following criteria are not applicable to the selected class and have been removed from the search", options) : helperMissing.call(depth0, "__", "The following criteria are not applicable to the selected class and have been removed from the search", options)))
200
- + ":\n </p>\n <ul>\n ";
201
- stack1 = helpers.each.call(depth0, (depth0 && depth0.invalidCriteria), {hash:{},inverse:self.noop,fn:self.program(1, program1, data),data:data});
202
- if(stack1 || stack1 === 0) { buffer += stack1; }
203
- buffer += "\n </ul>\n</div>";
204
- return buffer;
205
- });
206
- function invalidCriteriaWarningTpl(data, options, asString) {
207
- var html = Template$2(data, options);
208
- return (asString || true) ? html : $(html);
143
+ });
144
+ }
145
+
146
+ if (!Helpers0.__initialized) {
147
+ Helpers0(Handlebars);
148
+ Helpers0.__initialized = true;
149
+ }
150
+ var Template = Handlebars.template(function (Handlebars,depth0,helpers,partials,data) {
151
+ this.compilerInfo = [4,'>= 1.0.0'];
152
+ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
153
+ var buffer = "", helper, options, helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
154
+
155
+
156
+ buffer += "<div class=\"advanced-search-container\">\n <div class=\"advanced-criteria-container\"></div>\n <div class=\"add-criteria-container\">\n <a><span class=\"icon-add\"></span>"
157
+ + escapeExpression((helper = helpers.__ || (depth0 && depth0.__),options={hash:{},data:data},helper ? helper.call(depth0, "add criteria", options) : helperMissing.call(depth0, "__", "add criteria", options)))
158
+ + "</a>\n <select name=\"criteria-select\">\n <option></option>\n </select>\n </div>\n</div>\n";
159
+ return buffer;
160
+ });
161
+ function advancedSearchTpl(data, options, asString) {
162
+ var html = Template(data, options);
163
+ return (asString || true) ? html : $(html);
164
+ }
165
+
166
+ if (!Helpers0.__initialized) {
167
+ Helpers0(Handlebars);
168
+ Helpers0.__initialized = true;
169
+ }
170
+ var Template$1 = Handlebars.template(function (Handlebars,depth0,helpers,partials,data) {
171
+ this.compilerInfo = [4,'>= 1.0.0'];
172
+ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
173
+ var buffer = "", stack1, helper, options, functionType="function", escapeExpression=this.escapeExpression, helperMissing=helpers.helperMissing, self=this;
174
+
175
+ function program1(depth0,data) {
176
+
177
+ var buffer = "", stack1;
178
+ buffer += " <span class=\"class-path\">/"
179
+ + escapeExpression(((stack1 = ((stack1 = ((stack1 = (depth0 && depth0.criterion)),stack1 == null || stack1 === false ? stack1 : stack1['class'])),stack1 == null || stack1 === false ? stack1 : stack1.label)),typeof stack1 === functionType ? stack1.apply(depth0) : stack1))
180
+ + "</span>";
181
+ return buffer;
209
182
  }
210
183
 
211
- if (!Helpers0.__initialized) {
212
- Helpers0(Handlebars);
213
- Helpers0.__initialized = true;
184
+ buffer += "<div class=\"filter-container "
185
+ + escapeExpression(((stack1 = ((stack1 = (depth0 && depth0.criterion)),stack1 == null || stack1 === false ? stack1 : stack1.id)),typeof stack1 === functionType ? stack1.apply(depth0) : stack1))
186
+ + "-filter\" data-criteria=\""
187
+ + escapeExpression(((stack1 = ((stack1 = (depth0 && depth0.criterion)),stack1 == null || stack1 === false ? stack1 : stack1.label)),typeof stack1 === functionType ? stack1.apply(depth0) : stack1))
188
+ + "\" data-type=\""
189
+ + escapeExpression(((stack1 = ((stack1 = (depth0 && depth0.criterion)),stack1 == null || stack1 === false ? stack1 : stack1.type)),typeof stack1 === functionType ? stack1.apply(depth0) : stack1))
190
+ + "\">\n <button class=\"icon-result-nok\" aria-label=\""
191
+ + escapeExpression((helper = helpers.__ || (depth0 && depth0.__),options={hash:{},data:data},helper ? helper.call(depth0, "Remove criteria", options) : helperMissing.call(depth0, "__", "Remove criteria", options)))
192
+ + "\"></button>\n <label>\n <span class=\"filter-label-text\">"
193
+ + escapeExpression(((stack1 = ((stack1 = (depth0 && depth0.criterion)),stack1 == null || stack1 === false ? stack1 : stack1.label)),typeof stack1 === functionType ? stack1.apply(depth0) : stack1));
194
+ stack1 = helpers['if'].call(depth0, ((stack1 = (depth0 && depth0.criterion)),stack1 == null || stack1 === false ? stack1 : stack1.isDuplicated), {hash:{},inverse:self.noop,fn:self.program(1, program1, data),data:data});
195
+ if(stack1 || stack1 === 0) { buffer += stack1; }
196
+ buffer += "</span>\n <input type=\"text\">\n </label>\n</div>";
197
+ return buffer;
198
+ });
199
+ function textCriterionTpl(data, options, asString) {
200
+ var html = Template$1(data, options);
201
+ return (asString || true) ? html : $(html);
202
+ }
203
+
204
+ if (!Helpers0.__initialized) {
205
+ Helpers0(Handlebars);
206
+ Helpers0.__initialized = true;
207
+ }
208
+ var Template$2 = Handlebars.template(function (Handlebars,depth0,helpers,partials,data) {
209
+ this.compilerInfo = [4,'>= 1.0.0'];
210
+ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
211
+ var buffer = "", stack1, helper, options, functionType="function", escapeExpression=this.escapeExpression, helperMissing=helpers.helperMissing, self=this;
212
+
213
+ function program1(depth0,data) {
214
+
215
+ var buffer = "";
216
+ buffer += "\n <li>"
217
+ + escapeExpression((typeof depth0 === functionType ? depth0.apply(depth0) : depth0))
218
+ + "</li>\n ";
219
+ return buffer;
214
220
  }
215
- var Template$3 = Handlebars.template(function (Handlebars,depth0,helpers,partials,data) {
216
- this.compilerInfo = [4,'>= 1.0.0'];
217
- helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
218
- var buffer = "", stack1, helper, options, functionType="function", escapeExpression=this.escapeExpression, helperMissing=helpers.helperMissing, self=this;
219
-
220
- function program1(depth0,data) {
221
-
222
- var buffer = "", stack1;
223
- buffer += " <span class=\"class-path\">/"
224
- + escapeExpression(((stack1 = ((stack1 = ((stack1 = (depth0 && depth0.criterion)),stack1 == null || stack1 === false ? stack1 : stack1['class'])),stack1 == null || stack1 === false ? stack1 : stack1.label)),typeof stack1 === functionType ? stack1.apply(depth0) : stack1))
225
- + "</span>";
226
- return buffer;
227
- }
228
-
229
- function program3(depth0,data) {
230
-
231
- var buffer = "", stack1;
232
- buffer += "\n <div>\n <input type=\"checkbox\" value=\""
233
- + escapeExpression((typeof depth0 === functionType ? depth0.apply(depth0) : depth0))
234
- + "\" id=\""
235
- + escapeExpression(((stack1 = ((stack1 = (depth0 && depth0.criterion)),stack1 == null || stack1 === false ? stack1 : stack1.id)),typeof stack1 === functionType ? stack1.apply(depth0) : stack1))
236
- + "-"
237
- + escapeExpression((typeof depth0 === functionType ? depth0.apply(depth0) : depth0))
238
- + "\">\n <label class=\"filter-label-text\" for=\""
239
- + escapeExpression(((stack1 = ((stack1 = (depth0 && depth0.criterion)),stack1 == null || stack1 === false ? stack1 : stack1.id)),typeof stack1 === functionType ? stack1.apply(depth0) : stack1))
240
- + "-"
241
- + escapeExpression((typeof depth0 === functionType ? depth0.apply(depth0) : depth0))
242
- + "\">"
243
- + escapeExpression((typeof depth0 === functionType ? depth0.apply(depth0) : depth0))
244
- + "</label>\n </div>\n ";
245
- return buffer;
246
- }
247
221
 
248
- buffer += "<div class=\"filter-container "
249
- + escapeExpression(((stack1 = ((stack1 = (depth0 && depth0.criterion)),stack1 == null || stack1 === false ? stack1 : stack1.id)),typeof stack1 === functionType ? stack1.apply(depth0) : stack1))
250
- + "-filter\" data-criteria=\""
251
- + escapeExpression(((stack1 = ((stack1 = (depth0 && depth0.criterion)),stack1 == null || stack1 === false ? stack1 : stack1.label)),typeof stack1 === functionType ? stack1.apply(depth0) : stack1))
252
- + "\"\n data-type=\""
253
- + escapeExpression(((stack1 = ((stack1 = (depth0 && depth0.criterion)),stack1 == null || stack1 === false ? stack1 : stack1.type)),typeof stack1 === functionType ? stack1.apply(depth0) : stack1))
254
- + "\">\n <button class=\"icon-result-nok\" aria-label=\""
255
- + escapeExpression((helper = helpers.__ || (depth0 && depth0.__),options={hash:{},data:data},helper ? helper.call(depth0, " Remove criteria", options) : helperMissing.call(depth0, "__", " Remove criteria", options)))
256
- + "\"></button>\n <fieldset class=\"filter-bool-group\">\n <legend>"
257
- + escapeExpression(((stack1 = ((stack1 = (depth0 && depth0.criterion)),stack1 == null || stack1 === false ? stack1 : stack1.label)),typeof stack1 === functionType ? stack1.apply(depth0) : stack1));
258
- stack1 = helpers['if'].call(depth0, ((stack1 = (depth0 && depth0.criterion)),stack1 == null || stack1 === false ? stack1 : stack1.isDuplicated), {hash:{},inverse:self.noop,fn:self.program(1, program1, data),data:data});
259
- if(stack1 || stack1 === 0) { buffer += stack1; }
260
- buffer += "</legend>\n ";
261
- stack1 = helpers.each.call(depth0, ((stack1 = (depth0 && depth0.criterion)),stack1 == null || stack1 === false ? stack1 : stack1.values), {hash:{},inverse:self.noop,fn:self.program(3, program3, data),data:data});
262
- if(stack1 || stack1 === 0) { buffer += stack1; }
263
- buffer += "\n </fieldset>\n</div>";
264
- return buffer;
265
- });
266
- function listCheckboxCriterionTpl(data, options, asString) {
267
- var html = Template$3(data, options);
268
- return (asString || true) ? html : $(html);
222
+ buffer += "<div class=\"filter-container invalid-criteria-warning-container\">\n<span class=\"select2-search-choice-close\"></span>\n <p>\n "
223
+ + escapeExpression((helper = helpers.__ || (depth0 && depth0.__),options={hash:{},data:data},helper ? helper.call(depth0, "The following criteria are not applicable to the selected class and have been removed from the search", options) : helperMissing.call(depth0, "__", "The following criteria are not applicable to the selected class and have been removed from the search", options)))
224
+ + ":\n </p>\n <ul>\n ";
225
+ stack1 = helpers.each.call(depth0, (depth0 && depth0.invalidCriteria), {hash:{},inverse:self.noop,fn:self.program(1, program1, data),data:data});
226
+ if(stack1 || stack1 === 0) { buffer += stack1; }
227
+ buffer += "\n </ul>\n</div>";
228
+ return buffer;
229
+ });
230
+ function invalidCriteriaWarningTpl(data, options, asString) {
231
+ var html = Template$2(data, options);
232
+ return (asString || true) ? html : $(html);
233
+ }
234
+
235
+ if (!Helpers0.__initialized) {
236
+ Helpers0(Handlebars);
237
+ Helpers0.__initialized = true;
238
+ }
239
+ var Template$3 = Handlebars.template(function (Handlebars,depth0,helpers,partials,data) {
240
+ this.compilerInfo = [4,'>= 1.0.0'];
241
+ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
242
+ var buffer = "", stack1, helper, options, functionType="function", escapeExpression=this.escapeExpression, helperMissing=helpers.helperMissing, self=this;
243
+
244
+ function program1(depth0,data) {
245
+
246
+ var buffer = "", stack1;
247
+ buffer += " <span class=\"class-path\">/"
248
+ + escapeExpression(((stack1 = ((stack1 = ((stack1 = (depth0 && depth0.criterion)),stack1 == null || stack1 === false ? stack1 : stack1['class'])),stack1 == null || stack1 === false ? stack1 : stack1.label)),typeof stack1 === functionType ? stack1.apply(depth0) : stack1))
249
+ + "</span>";
250
+ return buffer;
269
251
  }
270
252
 
271
- if (!Helpers0.__initialized) {
272
- Helpers0(Handlebars);
273
- Helpers0.__initialized = true;
253
+ function program3(depth0,data) {
254
+
255
+ var buffer = "", stack1;
256
+ buffer += "\n <div>\n <input type=\"checkbox\" value=\""
257
+ + escapeExpression((typeof depth0 === functionType ? depth0.apply(depth0) : depth0))
258
+ + "\" id=\""
259
+ + escapeExpression(((stack1 = ((stack1 = (depth0 && depth0.criterion)),stack1 == null || stack1 === false ? stack1 : stack1.id)),typeof stack1 === functionType ? stack1.apply(depth0) : stack1))
260
+ + "-"
261
+ + escapeExpression((typeof depth0 === functionType ? depth0.apply(depth0) : depth0))
262
+ + "\">\n <label class=\"filter-label-text\" for=\""
263
+ + escapeExpression(((stack1 = ((stack1 = (depth0 && depth0.criterion)),stack1 == null || stack1 === false ? stack1 : stack1.id)),typeof stack1 === functionType ? stack1.apply(depth0) : stack1))
264
+ + "-"
265
+ + escapeExpression((typeof depth0 === functionType ? depth0.apply(depth0) : depth0))
266
+ + "\">"
267
+ + escapeExpression((typeof depth0 === functionType ? depth0.apply(depth0) : depth0))
268
+ + "</label>\n </div>\n ";
269
+ return buffer;
274
270
  }
275
- var Template$4 = Handlebars.template(function (Handlebars,depth0,helpers,partials,data) {
276
- this.compilerInfo = [4,'>= 1.0.0'];
277
- helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
278
- var buffer = "", stack1, helper, options, functionType="function", escapeExpression=this.escapeExpression, helperMissing=helpers.helperMissing, self=this;
279
-
280
- function program1(depth0,data) {
281
-
282
- var buffer = "", stack1;
283
- buffer += " <span class=\"class-path\">/"
284
- + escapeExpression(((stack1 = ((stack1 = ((stack1 = (depth0 && depth0.criterion)),stack1 == null || stack1 === false ? stack1 : stack1['class'])),stack1 == null || stack1 === false ? stack1 : stack1.label)),typeof stack1 === functionType ? stack1.apply(depth0) : stack1))
285
- + "</span>";
286
- return buffer;
287
- }
288
271
 
289
- buffer += "<div class=\"filter-container "
290
- + escapeExpression(((stack1 = ((stack1 = (depth0 && depth0.criterion)),stack1 == null || stack1 === false ? stack1 : stack1.id)),typeof stack1 === functionType ? stack1.apply(depth0) : stack1))
291
- + "-filter\" data-criteria=\""
292
- + escapeExpression(((stack1 = ((stack1 = (depth0 && depth0.criterion)),stack1 == null || stack1 === false ? stack1 : stack1.label)),typeof stack1 === functionType ? stack1.apply(depth0) : stack1))
293
- + "\" data-type=\""
294
- + escapeExpression(((stack1 = ((stack1 = (depth0 && depth0.criterion)),stack1 == null || stack1 === false ? stack1 : stack1.type)),typeof stack1 === functionType ? stack1.apply(depth0) : stack1))
295
- + "\">\n <button class=\"icon-result-nok\" aria-label=\""
296
- + escapeExpression((helper = helpers.__ || (depth0 && depth0.__),options={hash:{},data:data},helper ? helper.call(depth0, "Remove criteria", options) : helperMissing.call(depth0, "__", "Remove criteria", options)))
297
- + "\"></button> <label>\n <span class=\"filter-label-text\">"
298
- + escapeExpression(((stack1 = ((stack1 = (depth0 && depth0.criterion)),stack1 == null || stack1 === false ? stack1 : stack1.label)),typeof stack1 === functionType ? stack1.apply(depth0) : stack1));
299
- stack1 = helpers['if'].call(depth0, ((stack1 = (depth0 && depth0.criterion)),stack1 == null || stack1 === false ? stack1 : stack1.isDuplicated), {hash:{},inverse:self.noop,fn:self.program(1, program1, data),data:data});
300
- if(stack1 || stack1 === 0) { buffer += stack1; }
301
- buffer += "</span>\n <input type='text' name=\""
302
- + escapeExpression(((stack1 = ((stack1 = (depth0 && depth0.criterion)),stack1 == null || stack1 === false ? stack1 : stack1.id)),typeof stack1 === functionType ? stack1.apply(depth0) : stack1))
303
- + "-select\">\n </label>\n</div>\n";
304
- return buffer;
305
- });
306
- function listSelectCriterionTpl(data, options, asString) {
307
- var html = Template$4(data, options);
308
- return (asString || true) ? html : $(html);
272
+ buffer += "<div class=\"filter-container "
273
+ + escapeExpression(((stack1 = ((stack1 = (depth0 && depth0.criterion)),stack1 == null || stack1 === false ? stack1 : stack1.id)),typeof stack1 === functionType ? stack1.apply(depth0) : stack1))
274
+ + "-filter\" data-criteria=\""
275
+ + escapeExpression(((stack1 = ((stack1 = (depth0 && depth0.criterion)),stack1 == null || stack1 === false ? stack1 : stack1.label)),typeof stack1 === functionType ? stack1.apply(depth0) : stack1))
276
+ + "\"\n data-type=\""
277
+ + escapeExpression(((stack1 = ((stack1 = (depth0 && depth0.criterion)),stack1 == null || stack1 === false ? stack1 : stack1.type)),typeof stack1 === functionType ? stack1.apply(depth0) : stack1))
278
+ + "\">\n <button class=\"icon-result-nok\" aria-label=\""
279
+ + escapeExpression((helper = helpers.__ || (depth0 && depth0.__),options={hash:{},data:data},helper ? helper.call(depth0, " Remove criteria", options) : helperMissing.call(depth0, "__", " Remove criteria", options)))
280
+ + "\"></button>\n <fieldset class=\"filter-bool-group\">\n <legend>"
281
+ + escapeExpression(((stack1 = ((stack1 = (depth0 && depth0.criterion)),stack1 == null || stack1 === false ? stack1 : stack1.label)),typeof stack1 === functionType ? stack1.apply(depth0) : stack1));
282
+ stack1 = helpers['if'].call(depth0, ((stack1 = (depth0 && depth0.criterion)),stack1 == null || stack1 === false ? stack1 : stack1.isDuplicated), {hash:{},inverse:self.noop,fn:self.program(1, program1, data),data:data});
283
+ if(stack1 || stack1 === 0) { buffer += stack1; }
284
+ buffer += "</legend>\n ";
285
+ stack1 = helpers.each.call(depth0, ((stack1 = (depth0 && depth0.criterion)),stack1 == null || stack1 === false ? stack1 : stack1.values), {hash:{},inverse:self.noop,fn:self.program(3, program3, data),data:data});
286
+ if(stack1 || stack1 === 0) { buffer += stack1; }
287
+ buffer += "\n </fieldset>\n</div>";
288
+ return buffer;
289
+ });
290
+ function listCheckboxCriterionTpl(data, options, asString) {
291
+ var html = Template$3(data, options);
292
+ return (asString || true) ? html : $(html);
293
+ }
294
+
295
+ if (!Helpers0.__initialized) {
296
+ Helpers0(Handlebars);
297
+ Helpers0.__initialized = true;
298
+ }
299
+ var Template$4 = Handlebars.template(function (Handlebars,depth0,helpers,partials,data) {
300
+ this.compilerInfo = [4,'>= 1.0.0'];
301
+ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
302
+ var buffer = "", stack1, helper, options, functionType="function", escapeExpression=this.escapeExpression, helperMissing=helpers.helperMissing, self=this;
303
+
304
+ function program1(depth0,data) {
305
+
306
+ var buffer = "", stack1;
307
+ buffer += " <span class=\"class-path\">/"
308
+ + escapeExpression(((stack1 = ((stack1 = ((stack1 = (depth0 && depth0.criterion)),stack1 == null || stack1 === false ? stack1 : stack1['class'])),stack1 == null || stack1 === false ? stack1 : stack1.label)),typeof stack1 === functionType ? stack1.apply(depth0) : stack1))
309
+ + "</span>";
310
+ return buffer;
309
311
  }
310
312
 
311
- /**
312
- * This program is free software; you can redistribute it and/or
313
- * modify it under the terms of the GNU General Public License
314
- * as published by the Free Software Foundation; under version 2
315
- * of the License (non-upgradable).
316
- *
317
- * This program is distributed in the hope that it will be useful,
318
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
319
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
320
- * GNU General Public License for more details.
321
- *
322
- * You should have received a copy of the GNU General Public License
323
- * along with this program; if not, write to the Free Software
324
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
325
- *
326
- * Copyright (c) 2021 (original work) Open Assessment Technologies SA ;
327
- */
328
- /**
329
- * Creates advanced search component
330
- *
331
- * @param {object} config
332
- * @param {object} config.renderTo - DOM element where component will be rendered to
333
- * @param {string} config.advancedCriteria - advanced criteria to be set on component creation
334
- * @param {string} config.rootClassUri - rootClassUri to check for whitelist sections
335
- * @returns {advancedSearch}
336
- */
337
-
338
- function advancedSearchFactory(config) {
339
- // Private properties to be easily accessible by instance methods
340
- let $container = null;
341
- let $addCriteria = null;
342
- let $addCriteriaInput = null;
343
- let $criteriaSelect = null;
344
- let $advancedCriteriaContainer = null;
345
- let criteriaState = null;
346
- let criteriaMapping = {};
347
- const criteriaTypes = {
348
- text: 'text',
349
- list: 'list'
350
- };
351
- let isAdvancedSearchStatusEnabled;
352
- let isCriteriaListUpdated = false; // Creates new component
353
-
354
- const instance = component({
355
- /**
356
- * Request metadata (criteria) for the given uri
357
- * @param {string} classUri - url to make the reques to
358
- * @returns {Promise} - Request promise
359
- */
360
- updateCriteria: function (route) {
361
- if (!isAdvancedSearchStatusEnabled) {
362
- return Promise.resolve();
363
- }
364
-
365
- const $criteriaIcon = $$1('.add-criteria-container a span').eq(0);
366
- $criteriaIcon.toggleClass('icon-add').toggleClass('icon-loop');
367
- return request(route).then(response => {
368
- criteriaMapping = response.criteriaMapping || {};
369
- const classTree = response.classDefinition ? response.classDefinition : response;
370
- const criteria = formatCriteria(classTree);
371
- updateCriteria(criteria);
372
- isCriteriaListUpdated = true;
373
- $criteriaIcon.toggleClass('icon-add').toggleClass('icon-loop');
374
- }).catch(e => instance.trigger('error', e));
375
- },
376
-
377
- /**
378
- * Access to component state
379
- * @returns {Object} - criteria state
380
- */
381
- getState: function () {
382
- return criteriaState;
383
- },
384
-
385
- /**
386
- * Removes every rendered criterion, updates criteria state accordingly
387
- * and removes classes applied to scrollable list of criteria
388
- */
389
- clear: function () {
390
- $advancedCriteriaContainer.removeClass(['scrollable', 'scroll-separator-top', 'scroll-separator-bottom']);
391
- $advancedCriteriaContainer.empty();
392
-
393
- _.forEach(criteriaState, criterion => {
394
- criterion.rendered = false;
395
- criterion.value = null;
396
- });
397
- },
313
+ buffer += "<div class=\"filter-container "
314
+ + escapeExpression(((stack1 = ((stack1 = (depth0 && depth0.criterion)),stack1 == null || stack1 === false ? stack1 : stack1.id)),typeof stack1 === functionType ? stack1.apply(depth0) : stack1))
315
+ + "-filter\" data-criteria=\""
316
+ + escapeExpression(((stack1 = ((stack1 = (depth0 && depth0.criterion)),stack1 == null || stack1 === false ? stack1 : stack1.label)),typeof stack1 === functionType ? stack1.apply(depth0) : stack1))
317
+ + "\" data-type=\""
318
+ + escapeExpression(((stack1 = ((stack1 = (depth0 && depth0.criterion)),stack1 == null || stack1 === false ? stack1 : stack1.type)),typeof stack1 === functionType ? stack1.apply(depth0) : stack1))
319
+ + "\">\n <button class=\"icon-result-nok\" aria-label=\""
320
+ + escapeExpression((helper = helpers.__ || (depth0 && depth0.__),options={hash:{},data:data},helper ? helper.call(depth0, "Remove criteria", options) : helperMissing.call(depth0, "__", "Remove criteria", options)))
321
+ + "\"></button> <label>\n <span class=\"filter-label-text\">"
322
+ + escapeExpression(((stack1 = ((stack1 = (depth0 && depth0.criterion)),stack1 == null || stack1 === false ? stack1 : stack1.label)),typeof stack1 === functionType ? stack1.apply(depth0) : stack1));
323
+ stack1 = helpers['if'].call(depth0, ((stack1 = (depth0 && depth0.criterion)),stack1 == null || stack1 === false ? stack1 : stack1.isDuplicated), {hash:{},inverse:self.noop,fn:self.program(1, program1, data),data:data});
324
+ if(stack1 || stack1 === 0) { buffer += stack1; }
325
+ buffer += "</span>\n <input type='text' name=\""
326
+ + escapeExpression(((stack1 = ((stack1 = (depth0 && depth0.criterion)),stack1 == null || stack1 === false ? stack1 : stack1.id)),typeof stack1 === functionType ? stack1.apply(depth0) : stack1))
327
+ + "-select\">\n </label>\n</div>\n";
328
+ return buffer;
329
+ });
330
+ function listSelectCriterionTpl(data, options, asString) {
331
+ var html = Template$4(data, options);
332
+ return (asString || true) ? html : $(html);
333
+ }
334
+
335
+ /**
336
+ * Creates advanced search component
337
+ *
338
+ * @param {object} config
339
+ * @param {object} config.renderTo - DOM element where component will be rendered to
340
+ * @param {string} config.advancedCriteria - advanced criteria to be set on component creation
341
+ * @param {string} config.rootClassUri - rootClassUri to check for whitelist sections
342
+ * @returns {advancedSearch}
343
+ */
344
+
345
+ function advancedSearchFactory(config) {
346
+ // Private properties to be easily accessible by instance methods
347
+ var $container = null;
348
+ var $addCriteria = null;
349
+ var $addCriteriaInput = null;
350
+ var $criteriaSelect = null;
351
+ var $advancedCriteriaContainer = null;
352
+ var criteriaState = null;
353
+ var criteriaMapping = {};
354
+ var criteriaTypes = {
355
+ text: 'text',
356
+ list: 'list'
357
+ };
358
+ var isAdvancedSearchStatusEnabled;
359
+ var isCriteriaListUpdated = false; // Creates new component
360
+
361
+ var instance = component({
362
+ /**
363
+ * Request metadata (criteria) for the given uri
364
+ * @param {string} classUri - url to make the reques to
365
+ * @returns {Promise} - Request promise
366
+ */
367
+ updateCriteria: function updateCriteria(route) {
368
+ if (!isAdvancedSearchStatusEnabled) {
369
+ return Promise.resolve();
370
+ }
398
371
 
399
- /**
400
- * Builds substring of search query with the advanced criteria conditions
401
- */
402
- getAdvancedCriteriaQuery: function (hasSearchInput) {
403
- const advancedSearchCriteria = _.filter(criteriaState, criterion => criterion.rendered === true);
372
+ var $criteriaIcon = $$1('.add-criteria-container a span').eq(0);
373
+ $criteriaIcon.toggleClass('icon-add').toggleClass('icon-loop');
374
+ return request(route).then(function (response) {
375
+ criteriaMapping = response.criteriaMapping || {};
376
+ var classTree = response.classDefinition ? response.classDefinition : response;
377
+ var criteria = formatCriteria(classTree);
404
378
 
405
- let query = '';
406
- advancedSearchCriteria.forEach(renderedCriterion => {
407
- const queryParam = renderedCriterion.propertyUri;
379
+ _updateCriteria(criteria);
408
380
 
409
- if ((hasSearchInput || query.trim().length !== 0) && renderedCriterion.value) {
410
- query += ' AND ';
411
- }
381
+ isCriteriaListUpdated = true;
382
+ $criteriaIcon.toggleClass('icon-add').toggleClass('icon-loop');
383
+ }).catch(function (e) {
384
+ return instance.trigger('error', e);
385
+ });
386
+ },
412
387
 
413
- if (renderedCriterion.type === criteriaTypes.text) {
414
- if (renderedCriterion.value && renderedCriterion.value.trim() !== '') {
415
- query += `${queryParam}:${renderedCriterion.value.trim()}`;
416
- }
417
- } else if (renderedCriterion.type === criteriaTypes.list) {
418
- if (renderedCriterion.value && renderedCriterion.value.length > 0) {
419
- /* Temp replaced OR with AND. See ADF-7 for details */
420
- query += `${queryParam}:${renderedCriterion.value.join(' AND ')}`;
421
- }
422
- }
423
- });
424
- return query;
425
- }
426
- }).setTemplate(advancedSearchTpl).on('render', () => {
427
- initUiSelectors();
428
- initAddCriteriaSelector().then(() => {
429
- initCriteriaState();
430
- instance.trigger('ready');
431
- }).catch(e => instance.trigger('error', e));
432
- });
433
388
  /**
434
- * Inits template selectors and scroll animation
389
+ * Access to component state
390
+ * @returns {Object} - criteria state
435
391
  */
392
+ getState: function getState() {
393
+ return criteriaState;
394
+ },
436
395
 
437
- function initUiSelectors() {
438
- $container = instance.getElement();
439
- $addCriteria = $$1('.add-criteria-container', $container);
440
- $addCriteria.addClass('disabled');
441
- $addCriteriaInput = $$1('.add-criteria-container a', $container);
442
- $criteriaSelect = $$1('.add-criteria-container select', $container);
443
- $advancedCriteriaContainer = $$1('.advanced-criteria-container', $container);
444
- $advancedCriteriaContainer.on('scroll', _.throttle(animateScroll, 100));
445
- }
446
396
  /**
447
- * Lookup for characters in text to highlight
448
- * @param {String} text - text to lookup
449
- * @param {String} highlight - character(s) to be highlighted
450
- * @param {regExp|String} match - match to be applied in the text
451
- * @returns {String} - highlighted text
397
+ * Removes every rendered criterion, updates criteria state accordingly
398
+ * and removes classes applied to scrollable list of criteria
452
399
  */
400
+ clear: function clear() {
401
+ $advancedCriteriaContainer.removeClass(['scrollable', 'scroll-separator-top', 'scroll-separator-bottom']);
402
+ $advancedCriteriaContainer.empty();
453
403
 
404
+ _.forEach(criteriaState, function (criterion) {
405
+ criterion.rendered = false;
406
+ criterion.value = null;
407
+ });
408
+ },
454
409
 
455
- function highlightCharacter(text, highlight, match) {
456
- return text.replace(match, `<b>${highlight}</b>`);
457
- }
458
410
  /**
459
- * Inits select2 on criteria select and its UX logic
411
+ * Builds substring of search query with the advanced criteria conditions
460
412
  */
413
+ getAdvancedCriteriaQuery: function getAdvancedCriteriaQuery(hasSearchInput) {
414
+ var advancedSearchCriteria = _.filter(criteriaState, function (criterion) {
415
+ return criterion.rendered === true;
416
+ });
461
417
 
418
+ var query = '';
419
+ advancedSearchCriteria.forEach(function (renderedCriterion) {
420
+ var queryParam = renderedCriterion.propertyUri;
462
421
 
463
- function initAddCriteriaSelector() {
464
- const route = urlUtil.route('status', 'AdvancedSearch', 'tao');
465
- return request(route).then(function (response) {
466
- if (!response.enabled || response.whitelist && response.whitelist.includes(config.rootClassUri)) {
467
- isAdvancedSearchStatusEnabled = false;
468
- return;
422
+ if ((hasSearchInput || query.trim().length !== 0) && renderedCriterion.value) {
423
+ query += ' AND ';
469
424
  }
470
425
 
471
- isAdvancedSearchStatusEnabled = true;
472
- $addCriteria.removeClass('disabled');
473
- $criteriaSelect.select2({
474
- containerCssClass: 'criteria-select2',
475
- dropdownCssClass: 'criteria-dropdown-select2',
476
- sortResults: results => _.sortBy(results, ['text']),
477
- escapeMarkup: function (markup) {
478
- return markup;
479
- },
480
- formatResult: function formatResult(result, container, query) {
481
- const label = result.element[0].getAttribute('label');
482
- const sublabel = result.element[0].getAttribute('sublabel');
483
- const match = new RegExp(query.term, 'ig');
484
- let template = highlightCharacter(label, query.term, match); // Add sublabel
426
+ if (renderedCriterion.type === criteriaTypes.text) {
427
+ if (renderedCriterion.value && renderedCriterion.value.trim() !== '') {
428
+ query += "".concat(queryParam, ":").concat(renderedCriterion.value.trim());
429
+ }
430
+ } else if (renderedCriterion.type === criteriaTypes.list) {
431
+ if (renderedCriterion.value && renderedCriterion.value.length > 0) {
432
+ /* Temp replaced OR with AND. See ADF-7 for details */
433
+ query += "".concat(queryParam, ":").concat(renderedCriterion.value.join(' AND '));
434
+ }
435
+ }
436
+ });
437
+ return query;
438
+ }
439
+ }).setTemplate(advancedSearchTpl).on('render', function () {
440
+ initUiSelectors();
441
+ initAddCriteriaSelector().then(function () {
442
+ initCriteriaState();
443
+ instance.trigger('ready');
444
+ }).catch(function (e) {
445
+ return instance.trigger('error', e);
446
+ });
447
+ });
448
+ /**
449
+ * Inits template selectors and scroll animation
450
+ */
451
+
452
+ function initUiSelectors() {
453
+ $container = instance.getElement();
454
+ $addCriteria = $$1('.add-criteria-container', $container);
455
+ $addCriteria.addClass('disabled');
456
+ $addCriteriaInput = $$1('.add-criteria-container a', $container);
457
+ $criteriaSelect = $$1('.add-criteria-container select', $container);
458
+ $advancedCriteriaContainer = $$1('.advanced-criteria-container', $container);
459
+ $advancedCriteriaContainer.on('scroll', _.throttle(animateScroll, 100));
460
+ }
461
+ /**
462
+ * Lookup for characters in text to highlight
463
+ * @param {String} text - text to lookup
464
+ * @param {String} highlight - character(s) to be highlighted
465
+ * @param {regExp|String} match - match to be applied in the text
466
+ * @returns {String} - highlighted text
467
+ */
485
468
 
486
- if (sublabel && sublabel.length) {
487
- template = template + `<span class="class-path"> / ${highlightCharacter(sublabel, query.term, match)}</span>`;
488
- }
489
469
 
490
- return template;
491
- }
492
- }); // open dropdown when user clicks on add criteria input
470
+ function highlightCharacter(text, highlight, match) {
471
+ return text.replace(match, "<b>".concat(highlight, "</b>"));
472
+ }
473
+ /**
474
+ * Inits select2 on criteria select and its UX logic
475
+ */
476
+
493
477
 
494
- $addCriteriaInput.on('click', () => {
495
- if (isCriteriaListUpdated) {
496
- $criteriaSelect.select2('open'); // if dropdown is opened above addCriteria input, top property is slightly decreased to avoid overlapping with addCriteria icon
478
+ function initAddCriteriaSelector() {
479
+ var route = urlUtil.route('status', 'AdvancedSearch', 'tao');
480
+ return request(route).then(function (response) {
481
+ if (!response.enabled || response.whitelist && response.whitelist.includes(config.rootClassUri)) {
482
+ isAdvancedSearchStatusEnabled = false;
483
+ return;
484
+ }
497
485
 
498
- if ($$1('.criteria-dropdown-select2').hasClass('select2-drop-above')) {
499
- $$1('.criteria-dropdown-select2').css('top', $$1('.criteria-dropdown-select2').css('top').split('px')[0] - 10 + 'px');
500
- }
486
+ isAdvancedSearchStatusEnabled = true;
487
+ $addCriteria.removeClass('disabled');
488
+ $criteriaSelect.select2({
489
+ containerCssClass: 'criteria-select2',
490
+ dropdownCssClass: 'criteria-dropdown-select2',
491
+ sortResults: function sortResults(results) {
492
+ return _.sortBy(results, ['text']);
493
+ },
494
+ escapeMarkup: function escapeMarkup(markup) {
495
+ return markup;
496
+ },
497
+ formatResult: function formatResult(result, container, query) {
498
+ var label = result.element[0].getAttribute('label');
499
+ var sublabel = result.element[0].getAttribute('sublabel');
500
+ var match = new RegExp(query.term, 'ig');
501
+ var template = highlightCharacter(label, query.term, match); // Add sublabel
502
+
503
+ if (sublabel && sublabel.length) {
504
+ template = template + "<span class=\"class-path\"> / ".concat(highlightCharacter(sublabel, query.term, match), "</span>");
501
505
  }
502
- }); // when a criterion is selected add it to criteria container, remove it from dropdown options and reset select
503
506
 
504
- $criteriaSelect.on('change', () => {
505
- const criterionToAdd = $criteriaSelect.children('option:selected').val();
506
- addNewCriterion(criterionToAdd);
507
- $criteriaSelect.children('option:selected').remove();
508
- $criteriaSelect.select2('val', '');
509
- });
510
- }).catch(function (e) {
511
- return instance.trigger('error', e);
512
- });
513
- }
514
- /**
515
- * inits criteriaState loading it from the store (if present) or empty object.
516
- * If there is a stored criteriaState, those criteria that were rendered
517
- * but with null value are updated to not being rendered
518
- */
507
+ return template;
508
+ }
509
+ }); // open dropdown when user clicks on add criteria input
519
510
 
511
+ $addCriteriaInput.on('click', function () {
512
+ if (isCriteriaListUpdated) {
513
+ $criteriaSelect.select2('open'); // if dropdown is opened above addCriteria input, top property is slightly decreased to avoid overlapping with addCriteria icon
520
514
 
521
- function initCriteriaState() {
522
- if (instance.config.advancedCriteria) {
523
- _.forEach(instance.config.advancedCriteria, criterion => {
524
- if (criterion.rendered === true && criterion.value === null) {
525
- criterion.rendered = false;
515
+ if ($$1('.criteria-dropdown-select2').hasClass('select2-drop-above')) {
516
+ $$1('.criteria-dropdown-select2').css('top', $$1('.criteria-dropdown-select2').css('top').split('px')[0] - 10 + 'px');
526
517
  }
527
- });
528
- }
518
+ }
519
+ }); // when a criterion is selected add it to criteria container, remove it from dropdown options and reset select
529
520
 
530
- criteriaState = instance.config.advancedCriteria || {};
521
+ $criteriaSelect.on('change', function () {
522
+ var criterionToAdd = $criteriaSelect.children('option:selected').val();
523
+ addNewCriterion(criterionToAdd);
524
+ $criteriaSelect.children('option:selected').remove();
525
+ $criteriaSelect.select2('val', '');
526
+ });
527
+ }).catch(function (e) {
528
+ return instance.trigger('error', e);
529
+ });
530
+ }
531
+ /**
532
+ * inits criteriaState loading it from the store (if present) or empty object.
533
+ * If there is a stored criteriaState, those criteria that were rendered
534
+ * but with null value are updated to not being rendered
535
+ */
536
+
537
+
538
+ function initCriteriaState() {
539
+ if (instance.config.advancedCriteria) {
540
+ _.forEach(instance.config.advancedCriteria, function (criterion) {
541
+ if (criterion.rendered === true && criterion.value === null) {
542
+ criterion.rendered = false;
543
+ }
544
+ });
531
545
  }
532
- /**
533
- * Styles scrolling on $advancedCriteriaContainer
534
- */
535
546
 
547
+ criteriaState = instance.config.advancedCriteria || {};
548
+ }
549
+ /**
550
+ * Styles scrolling on $advancedCriteriaContainer
551
+ */
536
552
 
537
- function animateScroll() {
538
- const scrollPercentage = $advancedCriteriaContainer.get(0).scrollTop / ($advancedCriteriaContainer.get(0).scrollHeight - $advancedCriteriaContainer.get(0).clientHeight);
539
553
 
540
- if (scrollPercentage > 0.1) {
541
- $advancedCriteriaContainer.addClass('scroll-separator-top');
542
- } else {
543
- $advancedCriteriaContainer.removeClass('scroll-separator-top');
544
- }
554
+ function animateScroll() {
555
+ var scrollPercentage = $advancedCriteriaContainer.get(0).scrollTop / ($advancedCriteriaContainer.get(0).scrollHeight - $advancedCriteriaContainer.get(0).clientHeight);
545
556
 
546
- if (scrollPercentage < 0.9) {
547
- $advancedCriteriaContainer.addClass('scroll-separator-bottom');
548
- } else {
549
- $advancedCriteriaContainer.removeClass('scroll-separator-bottom');
550
- }
557
+ if (scrollPercentage > 0.1) {
558
+ $advancedCriteriaContainer.addClass('scroll-separator-top');
559
+ } else {
560
+ $advancedCriteriaContainer.removeClass('scroll-separator-top');
551
561
  }
552
- /**
553
- * Renders new criterion to criteria container so it can be used on advanced search filtering
554
- * @param {string} criterionToAdd - new criterion to be added
555
- */
556
562
 
563
+ if (scrollPercentage < 0.9) {
564
+ $advancedCriteriaContainer.addClass('scroll-separator-bottom');
565
+ } else {
566
+ $advancedCriteriaContainer.removeClass('scroll-separator-bottom');
567
+ }
568
+ }
569
+ /**
570
+ * Renders new criterion to criteria container so it can be used on advanced search filtering
571
+ * @param {string} criterionToAdd - new criterion to be added
572
+ */
557
573
 
558
- function addNewCriterion(criterionToAdd) {
559
- // remove deprecated warning message
560
- $$1('.invalid-criteria-warning-container').remove(); // render new criterion
561
574
 
562
- const criterion = criteriaState[criterionToAdd];
563
- const $criterionContainer = renderCriterion(criterion); // set logic to remove criterion
575
+ function addNewCriterion(criterionToAdd) {
576
+ // remove deprecated warning message
577
+ $$1('.invalid-criteria-warning-container').remove(); // render new criterion
564
578
 
565
- $$1('.icon-result-nok', $criterionContainer).on('click', {
566
- criterion
567
- }, removeCriterion); // set initial value and manage value changes
579
+ var criterion = criteriaState[criterionToAdd];
580
+ var $criterionContainer = renderCriterion(criterion); // set logic to remove criterion
568
581
 
569
- bindCriterionValue(criterion, $criterionContainer); // update styles if scroll is enabled
582
+ $$1('.icon-result-nok', $criterionContainer).on('click', {
583
+ criterion: criterion
584
+ }, removeCriterion); // set initial value and manage value changes
570
585
 
571
- if ($advancedCriteriaContainer.get(0).scrollHeight > $advancedCriteriaContainer.outerHeight()) {
572
- $advancedCriteriaContainer.addClass('scrollable');
573
- }
586
+ bindCriterionValue(criterion, $criterionContainer); // update styles if scroll is enabled
574
587
 
575
- criterion.rendered = true;
588
+ if ($advancedCriteriaContainer.get(0).scrollHeight > $advancedCriteriaContainer.outerHeight()) {
589
+ $advancedCriteriaContainer.addClass('scrollable');
576
590
  }
577
- /**
578
- * Renders the new criterion selecting the appropiate handlebars template and prepending to advanced criteria container.
579
- * If criterion is of type list with a uri endpoint to request the options, select2 is also init
580
- * @param {object} criterion - criterion to render
581
- * @returns - the rendered container
582
- */
583
591
 
592
+ criterion.rendered = true;
593
+ }
594
+ /**
595
+ * Renders the new criterion selecting the appropiate handlebars template and prepending to advanced criteria container.
596
+ * If criterion is of type list with a uri endpoint to request the options, select2 is also init
597
+ * @param {object} criterion - criterion to render
598
+ * @returns - the rendered container
599
+ */
584
600
 
585
- function renderCriterion(criterion) {
586
- let templateToUse = null;
587
601
 
588
- if (criterion.type === criteriaTypes.text) {
589
- templateToUse = textCriterionTpl;
590
- } else if (criterion.type === criteriaTypes.list && criterion.uri) {
591
- templateToUse = listSelectCriterionTpl;
592
- } else {
593
- templateToUse = listCheckboxCriterionTpl;
594
- }
595
-
596
- $advancedCriteriaContainer.append(templateToUse({
597
- criterion
598
- }));
599
- const $criterionContainer = $$1(`.${criterion.id}-filter`, $container);
600
- const valueMapping = criteriaMapping[criterion.type];
601
- /**
602
- * On criterion of type list with a uri endpoint to retrieve options, template includes a select
603
- * that is managed with select2, so we init it here
604
- */
605
-
606
- if (criterion.type === criteriaTypes.list && criterion.uri) {
607
- $$1(`input[name=${criterion.id}-select]`, $criterionContainer).select2({
608
- multiple: true,
609
- ajax: {
610
- url: criterion.uri,
611
- dataType: 'json',
612
- data: function (term) {
613
- return {
614
- subject: term
615
- };
616
- },
617
- results: response => ({
618
- results: response.data.map(option => ({
619
- id: valueMapping === 'uri' ? option.uri : option.label,
620
- text: option.label
621
- }))
622
- })
623
- },
624
- initSelection: function (element, callback) {
625
- const data = [];
626
- $$1(element.val().split(',')).each(function () {
627
- data.push({
628
- id: this,
629
- text: this
630
- });
631
- });
632
- callback(data);
633
- }
634
- });
635
- }
602
+ function renderCriterion(criterion) {
603
+ var templateToUse = null;
636
604
 
637
- return $criterionContainer;
605
+ if (criterion.type === criteriaTypes.text) {
606
+ templateToUse = textCriterionTpl;
607
+ } else if (criterion.type === criteriaTypes.list && criterion.uri) {
608
+ templateToUse = listSelectCriterionTpl;
609
+ } else {
610
+ templateToUse = listCheckboxCriterionTpl;
638
611
  }
612
+
613
+ $advancedCriteriaContainer.append(templateToUse({
614
+ criterion: criterion
615
+ }));
616
+ var $criterionContainer = $$1(".".concat(criterion.id, "-filter"), $container);
617
+ var valueMapping = criteriaMapping[criterion.type];
639
618
  /**
640
- * Fetches initial criterion label from api in case the value mapping is uri
641
- * @param {object} criterion - criterion to be managed
619
+ * On criterion of type list with a uri endpoint to retrieve options, template includes a select
620
+ * that is managed with select2, so we init it here
642
621
  */
643
622
 
623
+ if (criterion.type === criteriaTypes.list && criterion.uri) {
624
+ $$1("input[name=".concat(criterion.id, "-select]"), $criterionContainer).select2({
625
+ multiple: true,
626
+ ajax: {
627
+ url: criterion.uri,
628
+ dataType: 'json',
629
+ data: function data(term) {
630
+ return {
631
+ subject: term
632
+ };
633
+ },
634
+ results: function results(response) {
635
+ return {
636
+ results: response.data.map(function (option) {
637
+ return {
638
+ id: valueMapping === 'uri' ? option.uri : option.label,
639
+ text: option.label
640
+ };
641
+ })
642
+ };
643
+ }
644
+ },
645
+ initSelection: function initSelection(element, callback) {
646
+ var data = [];
647
+ $$1(element.val().split(',')).each(function () {
648
+ data.push({
649
+ id: this,
650
+ text: this
651
+ });
652
+ });
653
+ callback(data);
654
+ }
655
+ });
656
+ }
644
657
 
645
- function getInitialCriterionLabel(criterion) {
646
- const valueMapping = criteriaMapping[criterion.type];
658
+ return $criterionContainer;
659
+ }
660
+ /**
661
+ * Fetches initial criterion label from api in case the value mapping is uri
662
+ * @param {object} criterion - criterion to be managed
663
+ */
647
664
 
648
- if (valueMapping !== 'uri' || !criterion.value) {
649
- return Promise.resolve({
650
- id: criterion.value,
651
- text: criterion.value
652
- });
653
- }
654
665
 
655
- return $$1.ajax({
656
- type: 'GET',
657
- url: criterion.uri,
658
- dataType: 'json'
659
- }).then(_ref => {
660
- let {
661
- data
662
- } = _ref;
663
-
664
- if (Array.isArray(criterion.value)) {
665
- return criterion.value.map(v => ({
666
- id: v,
667
- text: (data.find(d => d.uri === v) || {}).label
668
- }));
669
- }
666
+ function getInitialCriterionLabel(criterion) {
667
+ var valueMapping = criteriaMapping[criterion.type];
670
668
 
671
- let c = data.find(d => d.uri === criterion.value) || {};
672
- return {
673
- text: c.label,
674
- id: criterion.value
675
- };
669
+ if (valueMapping !== 'uri' || !criterion.value) {
670
+ return Promise.resolve({
671
+ id: criterion.value,
672
+ text: criterion.value
676
673
  });
677
674
  }
678
- /**
679
- * Sets initial value for rendered criterion and sets binding between view and state
680
- * @param {object} criterion - criterion to be managed
681
- * @param {object} $criterionContainer - rendered criterion
682
- */
683
675
 
676
+ return $$1.ajax({
677
+ type: 'GET',
678
+ url: criterion.uri,
679
+ dataType: 'json'
680
+ }).then(function (_ref) {
681
+ var data = _ref.data;
684
682
 
685
- function bindCriterionValue(criterion, $criterionContainer) {
686
- getInitialCriterionLabel(criterion).then(initialCriterion => {
687
- if (criterion.type === criteriaTypes.text) {
688
- // set initial value
689
- $$1('input', $criterionContainer).val(criterion.value); // set event to bind input value to critariaState
683
+ if (Array.isArray(criterion.value)) {
684
+ return criterion.value.map(function (v) {
685
+ return {
686
+ id: v,
687
+ text: (data.find(function (d) {
688
+ return d.uri === v;
689
+ }) || {}).label
690
+ };
691
+ });
692
+ }
690
693
 
691
- $$1('input', $criterionContainer).on('change', function () {
692
- criterion.value = $$1(this).val() || null;
693
- });
694
- } else if (criterion.type === criteriaTypes.list && criterion.uri) {
695
- // set initial value
696
- if (criterion.value) {
697
- $$1(`input[name=${criterion.id}-select]`, $criterionContainer).select2('data', initialCriterion);
698
- } // set event to bind input value to critariaState
694
+ var c = data.find(function (d) {
695
+ return d.uri === criterion.value;
696
+ }) || {};
697
+ return {
698
+ text: c.label,
699
+ id: criterion.value
700
+ };
701
+ });
702
+ }
703
+ /**
704
+ * Sets initial value for rendered criterion and sets binding between view and state
705
+ * @param {object} criterion - criterion to be managed
706
+ * @param {object} $criterionContainer - rendered criterion
707
+ */
699
708
 
700
709
 
701
- $$1(`input[name=${criterion.id}-select]`, $criterionContainer).on('change', event => {
702
- criterion.value = event.val;
710
+ function bindCriterionValue(criterion, $criterionContainer) {
711
+ getInitialCriterionLabel(criterion).then(function (initialCriterion) {
712
+ if (criterion.type === criteriaTypes.text) {
713
+ // set initial value
714
+ $$1('input', $criterionContainer).val(criterion.value); // set event to bind input value to critariaState
715
+
716
+ $$1('input', $criterionContainer).on('change', function () {
717
+ criterion.value = $$1(this).val() || null;
718
+ });
719
+ } else if (criterion.type === criteriaTypes.list && criterion.uri) {
720
+ // set initial value
721
+ if (criterion.value) {
722
+ $$1("input[name=".concat(criterion.id, "-select]"), $criterionContainer).select2('data', initialCriterion);
723
+ } // set event to bind input value to critariaState
724
+
725
+
726
+ $$1("input[name=".concat(criterion.id, "-select]"), $criterionContainer).on('change', function (event) {
727
+ criterion.value = event.val;
728
+ });
729
+ } else {
730
+ // set initial value
731
+ if (criterion.value) {
732
+ criterion.value.forEach(function (selectedValue) {
733
+ $$1("input[value=".concat(selectedValue, "]"), $criterionContainer).prop('checked', true);
703
734
  });
704
- } else {
705
- // set initial value
706
- if (criterion.value) {
707
- criterion.value.forEach(selectedValue => {
708
- $$1(`input[value=${selectedValue}]`, $criterionContainer).prop('checked', true);
709
- });
710
- } // set event to bind input value to critariaState
735
+ } // set event to bind input value to critariaState
711
736
 
712
737
 
713
- $$1('input[type="checkbox"]', $criterionContainer).on('change', function () {
714
- criterion.value = $$1(this).closest('.filter-container').find('input[type=checkbox]:checked').get().map(element => element.value);
738
+ $$1('input[type="checkbox"]', $criterionContainer).on('change', function () {
739
+ criterion.value = $$1(this).closest('.filter-container').find('input[type=checkbox]:checked').get().map(function (element) {
740
+ return element.value;
715
741
  });
716
- }
717
- });
718
- }
719
- /**
720
- * Removes a criterion from advanced criteria container when user clicks on the criterion close icon.
721
- * It also adds the option element to criteria select so removed criterion can be rendered again
722
- * @param {object} event - click event triggered on closing icon
723
- */
742
+ });
743
+ }
744
+ });
745
+ }
746
+ /**
747
+ * Removes a criterion from advanced criteria container when user clicks on the criterion close icon.
748
+ * It also adds the option element to criteria select so removed criterion can be rendered again
749
+ * @param {object} event - click event triggered on closing icon
750
+ */
724
751
 
725
752
 
726
- function removeCriterion(event) {
727
- const criterion = event.data.criterion;
728
- const newOption = createCriteriaOption(criterion);
729
- const criterionKey = getCriterionStateId(criterion); // remove criterion and append new criterion to select options
753
+ function removeCriterion(event) {
754
+ var criterion = event.data.criterion;
755
+ var newOption = createCriteriaOption(criterion);
756
+ var criterionKey = getCriterionStateId(criterion); // remove criterion and append new criterion to select options
730
757
 
731
- $$1(this).parent().remove();
732
- $criteriaSelect.append(newOption); // reset criterion values on criteriaState
758
+ $$1(this).parent().remove();
759
+ $criteriaSelect.append(newOption); // reset criterion values on criteriaState
733
760
 
734
- criteriaState[criterionKey].rendered = false;
735
- criteriaState[criterionKey].value = null; // check if advanced criteria container is no longer scrollable
761
+ criteriaState[criterionKey].rendered = false;
762
+ criteriaState[criterionKey].value = null; // check if advanced criteria container is no longer scrollable
736
763
 
737
- if ($advancedCriteriaContainer.get(0).scrollHeight <= $advancedCriteriaContainer.outerHeight()) {
738
- $advancedCriteriaContainer.removeClass('scrollable');
739
- }
764
+ if ($advancedCriteriaContainer.get(0).scrollHeight <= $advancedCriteriaContainer.outerHeight()) {
765
+ $advancedCriteriaContainer.removeClass('scrollable');
740
766
  }
741
- /**
742
- * Parses received criteria from BE to the data structure required for criteria selector. To do so,
743
- * appends every criterion into criteria array and then returns a duplicate-free version of it
744
- * considering label property as uniqueness criterion
745
- * @param {Array} classes - array of classes with the metadata (aka criteria) for each one of them
746
- * @returns {Array} - criteria array
747
- */
767
+ }
768
+ /**
769
+ * Parses received criteria from BE to the data structure required for criteria selector. To do so,
770
+ * appends every criterion into criteria array and then returns a duplicate-free version of it
771
+ * considering label property as uniqueness criterion
772
+ * @param {Array} classes - array of classes with the metadata (aka criteria) for each one of them
773
+ * @returns {Array} - criteria array
774
+ */
748
775
 
749
776
 
750
- function formatCriteria(classTree) {
751
- let criteria = [];
777
+ function formatCriteria(classTree) {
778
+ var criteria = [];
752
779
 
753
- _.forEach(classTree, classInstance => {
754
- criteria.push(...classInstance.metadata);
755
- }); // extends each criterion with an id that can be use as a valid css class
780
+ _.forEach(classTree, function (classInstance) {
781
+ criteria.push.apply(criteria, _toConsumableArray(classInstance.metadata));
782
+ }); // extends each criterion with an id that can be use as a valid css class
756
783
 
757
784
 
758
- _.forEach(criteria, criterion => {
759
- criterion.label = getCriterionLabel(criterion);
760
- criterion.id = criterion.propertyUri.replace(/^[^a-zA-Z]*|[^a-zA-Z0-9]*/g, '');
761
- });
785
+ _.forEach(criteria, function (criterion) {
786
+ criterion.label = getCriterionLabel(criterion);
787
+ criterion.id = criterion.propertyUri.replace(/^[^a-zA-Z]*|[^a-zA-Z0-9]*/g, '');
788
+ });
762
789
 
763
- return criteria;
764
- }
765
- /**
766
- * Manages the new set of available criteria. To do so, removes warning container and every
767
- * selectable criterion. Then removes from criteriaState and view every deprecated criterion,
768
- * updates criteriaState with the new available criteria set, and renders new warning
769
- * message if required
770
- * @param {array} criteria - array of class properties
771
- */
790
+ return criteria;
791
+ }
792
+ /**
793
+ * Manages the new set of available criteria. To do so, removes warning container and every
794
+ * selectable criterion. Then removes from criteriaState and view every deprecated criterion,
795
+ * updates criteriaState with the new available criteria set, and renders new warning
796
+ * message if required
797
+ * @param {array} criteria - array of class properties
798
+ */
772
799
 
773
800
 
774
- function updateCriteria(criteria) {
775
- $$1('.invalid-criteria-warning-container').remove();
776
- $criteriaSelect.find('option:not(:first-child)').remove();
777
- const invalidCriteria = deleteDeprecatedCriteria(criteria);
778
- extendCriteria(criteria);
779
- renderWarningMessage(invalidCriteria);
780
- }
781
- /**
782
- * If there is any invalid criterion, renders an explanatory warning message
783
- * @param {array} invalidCriteria - array of string containing the label of every invalid criterion (those that were rendered but are no longer available)
784
- */
801
+ function _updateCriteria(criteria) {
802
+ $$1('.invalid-criteria-warning-container').remove();
803
+ $criteriaSelect.find('option:not(:first-child)').remove();
804
+ var invalidCriteria = deleteDeprecatedCriteria(criteria);
805
+ extendCriteria(criteria);
806
+ renderWarningMessage(invalidCriteria);
807
+ }
808
+ /**
809
+ * If there is any invalid criterion, renders an explanatory warning message
810
+ * @param {array} invalidCriteria - array of string containing the label of every invalid criterion (those that were rendered but are no longer available)
811
+ */
785
812
 
786
813
 
787
- function renderWarningMessage(invalidCriteria) {
788
- if (invalidCriteria.length > 0) {
789
- const invalidCriteriaWarning = invalidCriteriaWarningTpl({
790
- invalidCriteria
791
- });
792
- $advancedCriteriaContainer.prepend(invalidCriteriaWarning);
793
- $$1('.invalid-criteria-warning-container .select2-search-choice-close', $advancedCriteriaContainer).on('click', function () {
794
- $$1(this).parent().remove();
795
- });
796
- }
814
+ function renderWarningMessage(invalidCriteria) {
815
+ if (invalidCriteria.length > 0) {
816
+ var invalidCriteriaWarning = invalidCriteriaWarningTpl({
817
+ invalidCriteria: invalidCriteria
818
+ });
819
+ $advancedCriteriaContainer.prepend(invalidCriteriaWarning);
820
+ $$1('.invalid-criteria-warning-container .select2-search-choice-close', $advancedCriteriaContainer).on('click', function () {
821
+ $$1(this).parent().remove();
822
+ });
797
823
  }
798
- /**
799
- * Loops through current criteriaState so every criterion that is no longer available in the new
800
- * available criteria set is removed from criteriaState and from view, in case it had been
801
- * rendered. In that case it is also pushed into invalidCriteria array to be latter
802
- * included in the warning message
803
- * @param {array} criteria - array containing new set of criteria for current class
804
- * @returns {array} - array of strings with each deprecated criterion that was being displayed
805
- */
806
-
807
-
808
- function deleteDeprecatedCriteria(criteria) {
809
- const invalidCriteria = [];
824
+ }
825
+ /**
826
+ * Loops through current criteriaState so every criterion that is no longer available in the new
827
+ * available criteria set is removed from criteriaState and from view, in case it had been
828
+ * rendered. In that case it is also pushed into invalidCriteria array to be latter
829
+ * included in the warning message
830
+ * @param {array} criteria - array containing new set of criteria for current class
831
+ * @returns {array} - array of strings with each deprecated criterion that was being displayed
832
+ */
810
833
 
811
- _.forEach(criteriaState, oldCriterion => {
812
- const deprecatedCriterion = !criteria.find(newCriterion => newCriterion.label === oldCriterion.label);
813
- const oldCriterionKey = getCriterionStateId(oldCriterion);
814
834
 
815
- if (deprecatedCriterion) {
816
- if (criteriaState[oldCriterionKey].rendered) {
817
- $advancedCriteriaContainer.find(`.${oldCriterion.id}-filter`).remove();
818
- invalidCriteria.push(oldCriterion.label);
819
- }
835
+ function deleteDeprecatedCriteria(criteria) {
836
+ var invalidCriteria = [];
820
837
 
821
- delete criteriaState[oldCriterionKey];
822
- }
838
+ _.forEach(criteriaState, function (oldCriterion) {
839
+ var deprecatedCriterion = !criteria.find(function (newCriterion) {
840
+ return newCriterion.label === oldCriterion.label;
823
841
  });
842
+ var oldCriterionKey = getCriterionStateId(oldCriterion);
824
843
 
825
- return invalidCriteria;
826
- }
827
- /**
828
- * Loops through new criteria set and checks if each new criterion was already present or not on criteriaState
829
- * and updates view and selectable criteria list accordingly
830
- * @param {array} criteria - array containing new set of criteria for current class
831
- */
844
+ if (deprecatedCriterion) {
845
+ if (criteriaState[oldCriterionKey].rendered) {
846
+ $advancedCriteriaContainer.find(".".concat(oldCriterion.id, "-filter")).remove();
847
+ invalidCriteria.push(oldCriterion.label);
848
+ }
832
849
 
850
+ delete criteriaState[oldCriterionKey];
851
+ }
852
+ });
833
853
 
834
- function extendCriteria(criteria) {
835
- criteria.forEach(criterion => {
836
- let createOption = true;
837
- const criteriaStateId = getCriterionStateId(criterion); // if new criterion was already on criteriaState and had to be rendered, we avoid creating an option for it and render it if it was not
854
+ return invalidCriteria;
855
+ }
856
+ /**
857
+ * Loops through new criteria set and checks if each new criterion was already present or not on criteriaState
858
+ * and updates view and selectable criteria list accordingly
859
+ * @param {array} criteria - array containing new set of criteria for current class
860
+ */
838
861
 
839
- if (criteriaState[criteriaStateId] && criteriaState[criteriaStateId].rendered === true) {
840
- createOption = false;
841
862
 
842
- if ($advancedCriteriaContainer.find(`.${criterion.id}-filter`).length === 0) {
843
- addNewCriterion(criteriaStateId);
844
- }
845
- } else {
846
- // if new criterion was not on criteriaState we add it
847
- criteriaState[criteriaStateId] = criterion;
848
- criteriaState[criteriaStateId].rendered = false;
849
- criteriaState[criteriaStateId].value = null;
850
- } // create new option element to criteria select
863
+ function extendCriteria(criteria) {
864
+ criteria.forEach(function (criterion) {
865
+ var createOption = true;
866
+ var criteriaStateId = getCriterionStateId(criterion); // if new criterion was already on criteriaState and had to be rendered, we avoid creating an option for it and render it if it was not
851
867
 
868
+ if (criteriaState[criteriaStateId] && criteriaState[criteriaStateId].rendered === true) {
869
+ createOption = false;
852
870
 
853
- if (createOption) {
854
- $criteriaSelect.append(createCriteriaOption(criterion));
871
+ if ($advancedCriteriaContainer.find(".".concat(criterion.id, "-filter")).length === 0) {
872
+ addNewCriterion(criteriaStateId);
855
873
  }
856
- });
857
- }
858
- /**
859
- * Creates a new option element
860
- * with attributes to use in select2 markup
861
- * @param {Object} criterion
862
- * @returns {HTMLOptionElement} Single option criteria
863
- */
864
-
874
+ } else {
875
+ // if new criterion was not on criteriaState we add it
876
+ criteriaState[criteriaStateId] = criterion;
877
+ criteriaState[criteriaStateId].rendered = false;
878
+ criteriaState[criteriaStateId].value = null;
879
+ } // create new option element to criteria select
865
880
 
866
- function createCriteriaOption(criterion) {
867
- let label = criterion.label;
868
- let sublabel = '';
869
- let option;
870
- let optionText = label;
871
881
 
872
- if (criterion.isDuplicated) {
873
- sublabel = criterion.class.label;
874
- optionText = `${label} (${criterion.alias}) /`;
882
+ if (createOption) {
883
+ $criteriaSelect.append(createCriteriaOption(criterion));
875
884
  }
885
+ });
886
+ }
887
+ /**
888
+ * Creates a new option element
889
+ * with attributes to use in select2 markup
890
+ * @param {Object} criterion
891
+ * @returns {HTMLOptionElement} Single option criteria
892
+ */
876
893
 
877
- option = new Option(label, getCriterionStateId(criterion), false, false);
878
- option.setAttribute('label', optionText);
879
- option.setAttribute('sublabel', sublabel);
880
- return option;
881
- }
882
- /**
883
- * @param {Object} criterion
884
- * @returns String
885
- */
886
894
 
895
+ function createCriteriaOption(criterion) {
896
+ var label = criterion.label;
897
+ var sublabel = '';
898
+ var option;
899
+ var optionText = label;
887
900
 
888
- function getCriterionStateId(criterion) {
889
- return criterion.propertyUri;
901
+ if (criterion.isDuplicated) {
902
+ sublabel = criterion.class.label;
903
+ optionText = "".concat(label, " (").concat(criterion.alias, ") /");
890
904
  }
891
- /**
892
- * @param {Object} criterion
893
- * @returns String
894
- */
895
905
 
896
-
897
- function getCriterionLabel(criterion) {
898
- return criterion.label;
899
- } // return initialized instance of searchModal
906
+ option = new Option(label, getCriterionStateId(criterion), false, false);
907
+ option.setAttribute('label', optionText);
908
+ option.setAttribute('sublabel', sublabel);
909
+ return option;
910
+ }
911
+ /**
912
+ * @param {Object} criterion
913
+ * @returns String
914
+ */
900
915
 
901
916
 
902
- return instance.init(config);
917
+ function getCriterionStateId(criterion) {
918
+ return criterion.propertyUri;
903
919
  }
920
+ /**
921
+ * @param {Object} criterion
922
+ * @returns String
923
+ */
924
+
925
+
926
+ function getCriterionLabel(criterion) {
927
+ return criterion.label;
928
+ } // return initialized instance of searchModal
929
+
930
+
931
+ return instance.init(config);
932
+ }
904
933
 
905
- return advancedSearchFactory;
934
+ return advancedSearchFactory;
906
935
 
907
936
  });