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