@oat-sa/tao-core-ui 1.49.3 → 1.49.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,8 +1,7 @@
1
- define(['jquery', 'lodash', 'context', 'handlebars', 'i18n', 'lib/dompurify/purify', 'css!ui/searchModal/css/advancedSearch.css', 'ui/component', 'ui/modal', 'ui/datatable', 'select2', 'util/url', 'core/dataProvider/request'], function ($$1, _, context, Handlebars, __, DOMPurify, advancedSearch_css, component, modal, datatable, select2, urlUtil, request) { 'use strict';
1
+ define(['jquery', 'lodash', 'handlebars', 'i18n', 'lib/dompurify/purify', 'css!ui/searchModal/css/advancedSearch.css', 'ui/component', 'ui/modal', 'ui/datatable', 'select2', 'util/url', 'core/dataProvider/request'], function ($$1, _, Handlebars, __, DOMPurify, advancedSearch_css, component, modal, datatable, select2, urlUtil, request) { 'use strict';
2
2
 
3
3
  $$1 = $$1 && Object.prototype.hasOwnProperty.call($$1, 'default') ? $$1['default'] : $$1;
4
4
  _ = _ && Object.prototype.hasOwnProperty.call(_, 'default') ? _['default'] : _;
5
- context = context && Object.prototype.hasOwnProperty.call(context, 'default') ? context['default'] : context;
6
5
  Handlebars = Handlebars && Object.prototype.hasOwnProperty.call(Handlebars, 'default') ? Handlebars['default'] : Handlebars;
7
6
  __ = __ && Object.prototype.hasOwnProperty.call(__, 'default') ? __['default'] : __;
8
7
  DOMPurify = DOMPurify && Object.prototype.hasOwnProperty.call(DOMPurify, 'default') ? DOMPurify['default'] : DOMPurify;
@@ -339,6 +338,7 @@ define(['jquery', 'lodash', 'context', 'handlebars', 'i18n', 'lib/dompurify/puri
339
338
  * @param {object} config
340
339
  * @param {object} config.renderTo - DOM element where component will be rendered to
341
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
342
  * @returns {advancedSearch}
343
343
  */
344
344
 
@@ -478,7 +478,7 @@ define(['jquery', 'lodash', 'context', 'handlebars', 'i18n', 'lib/dompurify/puri
478
478
  function initAddCriteriaSelector() {
479
479
  var route = urlUtil.route('status', 'AdvancedSearch', 'tao');
480
480
  return request(route).then(function (response) {
481
- if (!response.enabled || context.shownStructure === 'results') {
481
+ if (!response.enabled || response.whitelist.includes(config.rootClassUri)) {
482
482
  isAdvancedSearchStatusEnabled = false;
483
483
  return;
484
484
  }
@@ -246,6 +246,7 @@ define(['jquery', 'lodash', 'i18n', 'context', 'handlebars', 'lib/dompurify/puri
246
246
  var rootClassUri = config.rootClassUri;
247
247
  /**
248
248
  * Creates search modal, inits template selectors, inits search store, and once is created triggers initial search
249
+ * rootClassUri is sent to advancedSearch factory for disabling in whitelisted sections
249
250
  */
250
251
 
251
252
  function renderModal() {
@@ -254,7 +255,8 @@ define(['jquery', 'lodash', 'i18n', 'context', 'handlebars', 'lib/dompurify/puri
254
255
  initUiSelectors();
255
256
  advancedSearch = advancedSearchFactory({
256
257
  renderTo: $$1('.filters-container', $container),
257
- advancedCriteria: instance.config.criterias.advancedCriteria
258
+ advancedCriteria: instance.config.criterias.advancedCriteria,
259
+ rootClassUri: rootClassUri
258
260
  });
259
261
  promises.push(initClassFilter());
260
262
  promises.push(initSearchStore());
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oat-sa/tao-core-ui",
3
- "version": "1.49.3",
3
+ "version": "1.49.4",
4
4
  "displayName": "TAO Core UI",
5
5
  "description": "UI libraries of TAO",
6
6
  "scripts": {
@@ -18,7 +18,6 @@
18
18
 
19
19
  import $ from 'jquery';
20
20
  import _ from 'lodash';
21
- import context from 'context';
22
21
  import advancedSearchTpl from 'ui/searchModal/tpl/advanced-search';
23
22
  import textCriterionTpl from 'ui/searchModal/tpl/text-criterion';
24
23
  import invalidCriteriaWarningTpl from 'ui/searchModal/tpl/invalid-criteria-warning';
@@ -38,6 +37,7 @@ import request from 'core/dataProvider/request';
38
37
  * @param {object} config
39
38
  * @param {object} config.renderTo - DOM element where component will be rendered to
40
39
  * @param {string} config.advancedCriteria - advanced criteria to be set on component creation
40
+ * @param {string} config.rootClassUri - rootClassUri to check for whitelist sections
41
41
  * @returns {advancedSearch}
42
42
  */
43
43
  export default function advancedSearchFactory(config) {
@@ -171,7 +171,7 @@ export default function advancedSearchFactory(config) {
171
171
  const route = urlUtil.route('status', 'AdvancedSearch', 'tao');
172
172
  return request(route)
173
173
  .then(function (response) {
174
- if (!response.enabled || context.shownStructure === 'results') {
174
+ if (!response.enabled || response.whitelist.includes(config.rootClassUri)) {
175
175
  isAdvancedSearchStatusEnabled = false;
176
176
  return;
177
177
  }
@@ -73,6 +73,7 @@ export default function searchModalFactory(config) {
73
73
 
74
74
  /**
75
75
  * Creates search modal, inits template selectors, inits search store, and once is created triggers initial search
76
+ * rootClassUri is sent to advancedSearch factory for disabling in whitelisted sections
76
77
  */
77
78
  function renderModal() {
78
79
  const promises = [];
@@ -80,7 +81,8 @@ export default function searchModalFactory(config) {
80
81
  initUiSelectors();
81
82
  advancedSearch = advancedSearchFactory({
82
83
  renderTo: $('.filters-container', $container),
83
- advancedCriteria: instance.config.criterias.advancedCriteria
84
+ advancedCriteria: instance.config.criterias.advancedCriteria,
85
+ rootClassUri: rootClassUri
84
86
  });
85
87
  promises.push(initClassFilter());
86
88
  promises.push(initSearchStore());