@blaze-cms/react-page-builder 0.146.0-alpha.4 → 0.146.0-alpha.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (76) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/lib/components/Card/helpers/index.js +6 -6
  3. package/lib/components/Card/helpers/index.js.map +1 -1
  4. package/lib/components/MenuItem/MenuEntitiesItem.js +203 -0
  5. package/lib/components/MenuItem/MenuEntitiesItem.js.map +1 -0
  6. package/lib/components/MenuItem/MenuItem.js +25 -68
  7. package/lib/components/MenuItem/MenuItem.js.map +1 -1
  8. package/lib/components/MenuItem/MenuItemRender.js +103 -0
  9. package/lib/components/MenuItem/MenuItemRender.js.map +1 -0
  10. package/lib/{components/Card/helpers → helpers}/filter-query-setup.js +10 -7
  11. package/lib/helpers/filter-query-setup.js.map +1 -0
  12. package/lib/{components/Card/helpers → helpers}/filters-setup.js +8 -5
  13. package/lib/helpers/filters-setup.js.map +1 -0
  14. package/lib/helpers/get-updated-items-to-display.js.map +1 -0
  15. package/lib/helpers/get-updated-sort-properties.js.map +1 -0
  16. package/lib/helpers/index.js +42 -0
  17. package/lib/helpers/index.js.map +1 -1
  18. package/lib/helpers/should-return.js.map +1 -0
  19. package/lib/{components/Card/helpers → helpers}/should-skip-single-query.js +1 -1
  20. package/lib/helpers/should-skip-single-query.js.map +1 -0
  21. package/lib-es/components/Card/helpers/index.js +6 -6
  22. package/lib-es/components/Card/helpers/index.js.map +1 -1
  23. package/lib-es/components/MenuItem/MenuEntitiesItem.js +177 -0
  24. package/lib-es/components/MenuItem/MenuEntitiesItem.js.map +1 -0
  25. package/lib-es/components/MenuItem/MenuItem.js +28 -57
  26. package/lib-es/components/MenuItem/MenuItem.js.map +1 -1
  27. package/lib-es/components/MenuItem/MenuItemRender.js +83 -0
  28. package/lib-es/components/MenuItem/MenuItemRender.js.map +1 -0
  29. package/lib-es/{components/Card/helpers → helpers}/filter-query-setup.js +5 -3
  30. package/lib-es/helpers/filter-query-setup.js.map +1 -0
  31. package/lib-es/{components/Card/helpers → helpers}/filters-setup.js +4 -2
  32. package/lib-es/helpers/filters-setup.js.map +1 -0
  33. package/lib-es/helpers/get-updated-items-to-display.js.map +1 -0
  34. package/lib-es/helpers/get-updated-sort-properties.js.map +1 -0
  35. package/lib-es/helpers/index.js +6 -0
  36. package/lib-es/helpers/index.js.map +1 -1
  37. package/lib-es/helpers/should-return.js.map +1 -0
  38. package/lib-es/{components/Card/helpers → helpers}/should-skip-single-query.js +1 -1
  39. package/lib-es/helpers/should-skip-single-query.js.map +1 -0
  40. package/package.json +2 -2
  41. package/src/components/Card/helpers/index.js +6 -6
  42. package/src/components/MenuItem/MenuEntitiesItem.js +202 -0
  43. package/src/components/MenuItem/MenuItem.js +15 -58
  44. package/src/components/MenuItem/MenuItemRender.js +91 -0
  45. package/src/{components/Card/helpers → helpers}/filter-query-setup.js +5 -3
  46. package/src/{components/Card/helpers → helpers}/filters-setup.js +5 -2
  47. package/src/helpers/index.js +6 -0
  48. package/src/{components/Card/helpers → helpers}/should-skip-single-query.js +1 -1
  49. package/tests/unit/src/components/Card/helpers/get-updated-items-to-display.test.js +1 -1
  50. package/tests/unit/src/components/MenuItem/MenuEntitiesItem.test.js +23 -0
  51. package/tests/unit/src/components/MenuItem/MenuItem.test.js +30 -11
  52. package/tests/unit/src/components/MenuItem/MenuItemRender.test.js +55 -0
  53. package/tests/unit/src/components/MenuItem/__snapshots__/MenuEntitiesItem.test.js.snap +3 -0
  54. package/tests/unit/src/components/MenuItem/__snapshots__/MenuItem.test.js.snap +5 -51
  55. package/tests/unit/src/components/MenuItem/mocks.js +71 -0
  56. package/lib/components/Card/helpers/filter-query-setup.js.map +0 -1
  57. package/lib/components/Card/helpers/filters-setup.js.map +0 -1
  58. package/lib/components/Card/helpers/get-updated-items-to-display.js.map +0 -1
  59. package/lib/components/Card/helpers/get-updated-sort-properties.js.map +0 -1
  60. package/lib/components/Card/helpers/should-return.js.map +0 -1
  61. package/lib/components/Card/helpers/should-skip-single-query.js.map +0 -1
  62. package/lib-es/components/Card/helpers/filter-query-setup.js.map +0 -1
  63. package/lib-es/components/Card/helpers/filters-setup.js.map +0 -1
  64. package/lib-es/components/Card/helpers/get-updated-items-to-display.js.map +0 -1
  65. package/lib-es/components/Card/helpers/get-updated-sort-properties.js.map +0 -1
  66. package/lib-es/components/Card/helpers/should-return.js.map +0 -1
  67. package/lib-es/components/Card/helpers/should-skip-single-query.js.map +0 -1
  68. /package/lib/{components/Card/helpers → helpers}/get-updated-items-to-display.js +0 -0
  69. /package/lib/{components/Card/helpers → helpers}/get-updated-sort-properties.js +0 -0
  70. /package/lib/{components/Card/helpers → helpers}/should-return.js +0 -0
  71. /package/lib-es/{components/Card/helpers → helpers}/get-updated-items-to-display.js +0 -0
  72. /package/lib-es/{components/Card/helpers → helpers}/get-updated-sort-properties.js +0 -0
  73. /package/lib-es/{components/Card/helpers → helpers}/should-return.js +0 -0
  74. /package/src/{components/Card/helpers → helpers}/get-updated-items-to-display.js +0 -0
  75. /package/src/{components/Card/helpers → helpers}/get-updated-sort-properties.js +0 -0
  76. /package/src/{components/Card/helpers → helpers}/should-return.js +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"filter-query-setup.js","names":["_helpers","require","_getGenericRenderVariables","_interopRequireDefault","_buildRawQueryBase","_buildSetFilters","_constants","ownKeys","e","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty2","getOwnPropertyDescriptors","defineProperties","defineProperty","filterQuerySetup","_ref","getEntitySchemas","entity","updatedFilterBy","variableProps","docType","filterOperator","filterEntityRelations","itemsToDisplay","entitySameAsCurrentItemEntity","entitySchema","_ref$useRandomSort","useRandomSort","stringProps","getStringTypeProps","filterValues","buildSetFilters","filterBy","rawQuery","bool","buildRawQueryBase","relations","addListFiltersToQuery","settingsLimit","limit","DEFAULT_LIMIT","requestLimit","Number","variables","getGenericRenderVariables","filterProps","_default","exports"],"sources":["../../src/helpers/filter-query-setup.js"],"sourcesContent":["import { getStringTypeProps } from '@blaze-cms/utils/src/helpers';\nimport getGenericRenderVariables from './get-generic-render-variables';\nimport buildRawQueryBase from './build-raw-query-base';\nimport buildSetFilters from './build-set-filters';\nimport { DEFAULT_LIMIT } from '../constants';\n\nconst filterQuerySetup = ({\n getEntitySchemas,\n entity,\n updatedFilterBy,\n variableProps,\n docType,\n filterOperator,\n filterEntityRelations,\n itemsToDisplay,\n entitySameAsCurrentItemEntity,\n entitySchema,\n useRandomSort = false\n}) => {\n const stringProps = getStringTypeProps(entity, filterEntityRelations, getEntitySchemas);\n const filterValues =\n updatedFilterBy && updatedFilterBy.length\n ? buildSetFilters({ ...variableProps, filterBy: updatedFilterBy })\n : buildSetFilters(variableProps);\n\n const rawQuery = {\n bool: buildRawQueryBase({\n docType,\n filterValues,\n filterOperator,\n relations: filterEntityRelations,\n stringProps,\n itemsToDisplay,\n addListFiltersToQuery: true,\n entity,\n entitySchema\n })\n };\n\n // increase limit to get extra item in case results contain current parent\n const { limit: settingsLimit } = variableProps;\n const limit = settingsLimit || DEFAULT_LIMIT; // all falsey should use default\n const requestLimit = entitySameAsCurrentItemEntity ? Number(limit) + 1 : limit;\n const variables = getGenericRenderVariables({\n relations: filterEntityRelations,\n filterProps: { ...variableProps, limit: requestLimit },\n stringProps,\n rawQuery,\n useRandomSort\n });\n\n return { variables, limit };\n};\n\nexport default filterQuerySetup;\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,0BAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,kBAAA,GAAAD,sBAAA,CAAAF,OAAA;AACA,IAAAI,gBAAA,GAAAF,sBAAA,CAAAF,OAAA;AACA,IAAAK,UAAA,GAAAL,OAAA;AAA6C,SAAAM,QAAAC,CAAA,EAAAC,CAAA,QAAAC,CAAA,GAAAC,MAAA,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MAAEoB,KAAK,EAAEE;IAAY,EAAE;IACtDb,WAAW,EAAXA,WAAW;IACXK,QAAQ,EAARA,QAAQ;IACRN,aAAa,EAAbA;EACF,CAAC,CAAC;EAEF,OAAO;IAAEgB,SAAS,EAATA,SAAS;IAAEJ,KAAK,EAALA;EAAM,CAAC;AAC7B,CAAC;AAAC,IAAAO,QAAA,GAAAC,OAAA,cAEajC,gBAAgB"}
@@ -1,14 +1,17 @@
1
1
  "use strict";
2
2
 
3
3
  require("core-js/modules/es.object.define-property.js");
4
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
5
  Object.defineProperty(exports, "__esModule", {
5
6
  value: true
6
7
  });
7
8
  exports["default"] = void 0;
8
9
  require("core-js/modules/es.array.includes.js");
9
10
  require("core-js/modules/es.string.includes.js");
10
- var _helpers = require("../../../helpers");
11
- var _query = require("../../../application/query");
11
+ var _buildQueryFields = _interopRequireDefault(require("./build-query-fields"));
12
+ var _getInheritedFilters = _interopRequireDefault(require("./get-inherited-filters"));
13
+ var _getQueryProps = _interopRequireDefault(require("./get-query-props"));
14
+ var _query = require("../application/query");
12
15
  var filtersSetup = function filtersSetup(_ref) {
13
16
  var entityFields = _ref.entityFields,
14
17
  entityTypes = _ref.entityTypes,
@@ -20,13 +23,13 @@ var filtersSetup = function filtersSetup(_ref) {
20
23
  isPreview = _ref.isPreview,
21
24
  itemEntityUpdated = _ref.itemEntityUpdated,
22
25
  isFull = _ref.isFull;
23
- var fields = (0, _helpers.buildQueryFields)(entityFields, entityTypes, isFull);
26
+ var fields = (0, _buildQueryFields["default"])(entityFields, entityTypes, isFull);
24
27
  var action = (0, _query.getSearchPublishedContent)(fields);
25
- var inheritedFilters = (0, _helpers.getInheritedFilters)(filterBy, filterByProperty);
28
+ var inheritedFilters = (0, _getInheritedFilters["default"])(filterBy, filterByProperty);
26
29
  var entitySameAsCurrentItemEntity = entities.includes(itemEntityUpdated);
27
30
  var _filterEntitySchema$r = filterEntitySchema.relations,
28
31
  filterEntityRelations = _filterEntitySchema$r === void 0 ? [] : _filterEntitySchema$r;
29
- var queryProps = (0, _helpers.getQueryProps)(inheritedFilters, currentSchema, filterEntitySchema);
32
+ var queryProps = (0, _getQueryProps["default"])(inheritedFilters, currentSchema, filterEntitySchema);
30
33
  var _ref2 = currentSchema || {},
31
34
  _ref2$actions = _ref2.actions,
32
35
  actions = _ref2$actions === void 0 ? {} : _ref2$actions;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"filters-setup.js","names":["_buildQueryFields","_interopRequireDefault","require","_getInheritedFilters","_getQueryProps","_query","filtersSetup","_ref","entityFields","entityTypes","filterBy","filterByProperty","entities","currentSchema","filterEntitySchema","isPreview","itemEntityUpdated","isFull","fields","buildQueryFields","action","getSearchPublishedContent","inheritedFilters","getInheritedFilters","entitySameAsCurrentItemEntity","includes","_filterEntitySchema$r","relations","filterEntityRelations","queryProps","getQueryProps","_ref2","_ref2$actions","actions","getAction","get","getPublished","_default","exports"],"sources":["../../src/helpers/filters-setup.js"],"sourcesContent":["import buildQueryFields from './build-query-fields';\nimport getInheritedFilters from './get-inherited-filters';\nimport getQueryProps from './get-query-props';\nimport { getSearchPublishedContent } from '../application/query';\n\nconst filtersSetup = ({\n entityFields,\n entityTypes,\n filterBy,\n filterByProperty,\n entities,\n currentSchema,\n filterEntitySchema,\n isPreview,\n itemEntityUpdated,\n isFull\n}) => {\n const fields = buildQueryFields(entityFields, entityTypes, isFull);\n const action = getSearchPublishedContent(fields);\n const inheritedFilters = getInheritedFilters(filterBy, filterByProperty);\n\n const entitySameAsCurrentItemEntity = entities.includes(itemEntityUpdated);\n const { relations: filterEntityRelations = [] } = filterEntitySchema;\n const queryProps = getQueryProps(inheritedFilters, currentSchema, filterEntitySchema);\n const { actions = {} } = currentSchema || {};\n const getAction = isPreview ? actions.get : actions.getPublished;\n\n return {\n getAction,\n queryProps,\n inheritedFilters,\n currentSchema,\n filterEntitySchema,\n entitySameAsCurrentItemEntity,\n action,\n filterEntityRelations\n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AC,CAAC;IAAAmB,aAAA,GAAAD,KAAA,CAApCE,OAAO;IAAPA,OAAO,GAAAD,aAAA,cAAG,CAAC,CAAC,GAAAA,aAAA;EACpB,IAAME,SAAS,GAAGnB,SAAS,GAAGkB,OAAO,CAACE,GAAG,GAAGF,OAAO,CAACG,YAAY;EAEhE,OAAO;IACLF,SAAS,EAATA,SAAS;IACTL,UAAU,EAAVA,UAAU;IACVP,gBAAgB,EAAhBA,gBAAgB;IAChBT,aAAa,EAAbA,aAAa;IACbC,kBAAkB,EAAlBA,kBAAkB;IAClBU,6BAA6B,EAA7BA,6BAA6B;IAC7BJ,MAAM,EAANA,MAAM;IACNQ,qBAAqB,EAArBA;EACF,CAAC;AACH,CAAC;AAAC,IAAAS,QAAA,GAAAC,OAAA,cAEahC,YAAY"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-updated-items-to-display.js","names":["getUpdatedItemsToDisplay","_ref","parentSchema","parentEntityData","_ref$itemsToDisplay","itemsToDisplay","_ref$inheritedFilters","inheritedFilters","idProp","find","filter","indexOf","properties","_idProp$split","split","_idProp$split2","_slicedToArray2","entityKey","queryValue","Object","keys","propKey","relation","entityIdentifier","parentValues","updatedItemsToDisplay","_toConsumableArray2","Array","isArray","forEach","value","push","displayItems","_default","exports"],"sources":["../../src/helpers/get-updated-items-to-display.js"],"sourcesContent":["const getUpdatedItemsToDisplay = ({\n parentSchema,\n parentEntityData,\n itemsToDisplay = [],\n inheritedFilters = []\n}) => {\n const idProp = inheritedFilters.find(filter => filter.indexOf('id/') === 0);\n\n if (!idProp || !parentSchema || !parentEntityData) return itemsToDisplay;\n const { properties } = parentSchema;\n const [, entityKey] = idProp.split('/');\n if (!properties || !entityKey) return itemsToDisplay;\n const queryValue = Object.keys(properties).find(\n propKey =>\n properties[propKey] &&\n properties[propKey].relation &&\n properties[propKey].relation.entityIdentifier === entityKey\n );\n const parentValues = parentEntityData[queryValue];\n if (!parentValues) return itemsToDisplay;\n const updatedItemsToDisplay = [...itemsToDisplay];\n if (Array.isArray(parentValues)) {\n parentValues.forEach(value => {\n updatedItemsToDisplay.push({ displayItems: [value] });\n });\n } else {\n updatedItemsToDisplay.push({ displayItems: [parentValues] });\n }\n return updatedItemsToDisplay;\n};\n\nexport default getUpdatedItemsToDisplay;\n"],"mappings":";;;;;;;;;;;;;;;;;AAAA,IAAMA,wBAAwB,GAAG,SAA3BA,wBAAwBA,CAAAC,IAAA,EAKxB;EAAA,IAJJC,YAAY,GAAAD,IAAA,CAAZC,YAAY;IACZC,gBAAgB,GAAAF,IAAA,CAAhBE,gBAAgB;IAAAC,mBAAA,GAAAH,IAAA,CAChBI,cAAc;IAAdA,cAAc,GAAAD,mBAAA,cAAG,EAAE,GAAAA,mBAAA;IAAAE,qBAAA,GAAAL,IAAA,CACnBM,gBAAgB;IAAhBA,gBAAgB,GAAAD,qBAAA,cAAG,EAAE,GAAAA,qBAAA;EAErB,IAAME,MAAM,GAAGD,gBAAgB,CAACE,IAAI,CAAC,UAAAC,MAAM;IAAA,OAAIA,MAAM,CAACC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC;EAAA,EAAC;EAE3E,IAAI,CAACH,MAAM,IAAI,CAACN,YAAY,IAAI,CAACC,gBAAgB,EAAE,OAAOE,cAAc;EACxE,IAAQO,UAAU,GAAKV,YAAY,CAA3BU,UAAU;EAClB,IAAAC,aAAA,GAAsBL,MAAM,CAACM,KAAK,CAAC,GAAG,CAAC;IAAAC,cAAA,OAAAC,eAAA,aAAAH,aAAA;IAA9BI,SAAS,GAAAF,cAAA;EAClB,IAAI,CAACH,UAAU,IAAI,CAACK,SAAS,EAAE,OAAOZ,cAAc;EACpD,IAAMa,UAAU,GAAGC,MAAM,CAACC,IAAI,CAACR,UAAU,CAAC,CAACH,IAAI,CAC7C,UAAAY,OAAO;IAAA,OACLT,UAAU,CAACS,OAAO,CAAC,IACnBT,UAAU,CAACS,OAAO,CAAC,CAACC,QAAQ,IAC5BV,UAAU,CAACS,OAAO,CAAC,CAACC,QAAQ,CAACC,gBAAgB,KAAKN,SAAS;EAAA,CAC/D,CAAC;EACD,IAAMO,YAAY,GAAGrB,gBAAgB,CAACe,UAAU,CAAC;EACjD,IAAI,CAACM,YAAY,EAAE,OAAOnB,cAAc;EACxC,IAAMoB,qBAAqB,OAAAC,mBAAA,aAAOrB,cAAc,CAAC;EACjD,IAAIsB,KAAK,CAACC,OAAO,CAACJ,YAAY,CAAC,EAAE;IAC/BA,YAAY,CAACK,OAAO,CAAC,UAAAC,KAAK,EAAI;MAC5BL,qBAAqB,CAACM,IAAI,CAAC;QAAEC,YAAY,EAAE,CAACF,KAAK;MAAE,CAAC,CAAC;IACvD,CAAC,CAAC;EACJ,CAAC,MAAM;IACLL,qBAAqB,CAACM,IAAI,CAAC;MAAEC,YAAY,EAAE,CAACR,YAAY;IAAE,CAAC,CAAC;EAC9D;EACA,OAAOC,qBAAqB;AAC9B,CAAC;AAAC,IAAAQ,QAAA,GAAAC,OAAA,cAEalC,wBAAwB"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-updated-sort-properties.js","names":["getUpdatedSortProperties","sort","sortby","sortProperties","arguments","length","undefined","updatedSortProperties","_toConsumableArray2","unshift","propsToDisplay","sortbyFilters","map","_ref","filter","Boolean","flat","_default","exports"],"sources":["../../src/helpers/get-updated-sort-properties.js"],"sourcesContent":["const getUpdatedSortProperties = (sort, sortby, sortProperties = []) => {\n const updatedSortProperties = [...sortProperties];\n if (!updatedSortProperties.length && sort) {\n updatedSortProperties.unshift({ sort, propsToDisplay: sortby });\n }\n\n const sortbyFilters = updatedSortProperties\n .map(({ propsToDisplay }) => propsToDisplay)\n .filter(Boolean)\n .flat();\n return [updatedSortProperties, sortbyFilters];\n};\n\nexport default getUpdatedSortProperties;\n"],"mappings":";;;;;;;;;;;;;;AAAA,IAAMA,wBAAwB,GAAG,SAA3BA,wBAAwBA,CAAIC,IAAI,EAAEC,MAAM,EAA0B;EAAA,IAAxBC,cAAc,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,EAAE;EACjE,IAAMG,qBAAqB,OAAAC,mBAAA,aAAOL,cAAc,CAAC;EACjD,IAAI,CAACI,qBAAqB,CAACF,MAAM,IAAIJ,IAAI,EAAE;IACzCM,qBAAqB,CAACE,OAAO,CAAC;MAAER,IAAI,EAAJA,IAAI;MAAES,cAAc,EAAER;IAAO,CAAC,CAAC;EACjE;EAEA,IAAMS,aAAa,GAAGJ,qBAAqB,CACxCK,GAAG,CAAC,UAAAC,IAAA;IAAA,IAAGH,cAAc,GAAAG,IAAA,CAAdH,cAAc;IAAA,OAAOA,cAAc;EAAA,EAAC,CAC3CI,MAAM,CAACC,OAAO,CAAC,CACfC,IAAI,CAAC,CAAC;EACT,OAAO,CAACT,qBAAqB,EAAEI,aAAa,CAAC;AAC/C,CAAC;AAAC,IAAAM,QAAA,GAAAC,OAAA,cAEalB,wBAAwB"}
@@ -101,6 +101,18 @@ Object.defineProperty(exports, "checkPropsToUse", {
101
101
  return _checkPropsToUse["default"];
102
102
  }
103
103
  });
104
+ Object.defineProperty(exports, "filterQuerySetup", {
105
+ enumerable: true,
106
+ get: function get() {
107
+ return _filterQuerySetup["default"];
108
+ }
109
+ });
110
+ Object.defineProperty(exports, "filtersSetup", {
111
+ enumerable: true,
112
+ get: function get() {
113
+ return _filtersSetup["default"];
114
+ }
115
+ });
104
116
  Object.defineProperty(exports, "getClickWrapperOptions", {
105
117
  enumerable: true,
106
118
  get: function get() {
@@ -245,6 +257,18 @@ Object.defineProperty(exports, "getUpdatedFilterBy", {
245
257
  return _getUpdatedFilterBy["default"];
246
258
  }
247
259
  });
260
+ Object.defineProperty(exports, "getUpdatedItemsToDisplay", {
261
+ enumerable: true,
262
+ get: function get() {
263
+ return _getUpdatedItemsToDisplay["default"];
264
+ }
265
+ });
266
+ Object.defineProperty(exports, "getUpdatedSortProperties", {
267
+ enumerable: true,
268
+ get: function get() {
269
+ return _getUpdatedSortProperties["default"];
270
+ }
271
+ });
248
272
  Object.defineProperty(exports, "getWrappedValueWithLink", {
249
273
  enumerable: true,
250
274
  get: function get() {
@@ -323,12 +347,24 @@ Object.defineProperty(exports, "shouldRenderWaypoint", {
323
347
  return _shouldRenderWaypoint["default"];
324
348
  }
325
349
  });
350
+ Object.defineProperty(exports, "shouldReturn", {
351
+ enumerable: true,
352
+ get: function get() {
353
+ return _shouldReturn["default"];
354
+ }
355
+ });
326
356
  Object.defineProperty(exports, "shouldShowProperty", {
327
357
  enumerable: true,
328
358
  get: function get() {
329
359
  return _shouldShowProperty["default"];
330
360
  }
331
361
  });
362
+ Object.defineProperty(exports, "shouldSkipSingleQuery", {
363
+ enumerable: true,
364
+ get: function get() {
365
+ return _shouldSkipSingleQuery["default"];
366
+ }
367
+ });
332
368
  Object.defineProperty(exports, "sortResponseData", {
333
369
  enumerable: true,
334
370
  get: function get() {
@@ -402,6 +438,12 @@ var _appendImages = _interopRequireDefault(require("./append-images"));
402
438
  var _parseTextBlock = _interopRequireDefault(require("./parse-TextBlock"));
403
439
  var _processDataSummaryValue = _interopRequireDefault(require("./process-data-summary-value"));
404
440
  var _buildQueryKey = _interopRequireDefault(require("./build-query-key"));
441
+ var _filterQuerySetup = _interopRequireDefault(require("./filter-query-setup"));
442
+ var _filtersSetup = _interopRequireDefault(require("./filters-setup"));
443
+ var _getUpdatedItemsToDisplay = _interopRequireDefault(require("./get-updated-items-to-display"));
444
+ var _getUpdatedSortProperties = _interopRequireDefault(require("./get-updated-sort-properties"));
445
+ var _shouldReturn = _interopRequireDefault(require("./should-return"));
446
+ var _shouldSkipSingleQuery = _interopRequireDefault(require("./should-skip-single-query"));
405
447
  var _buildRawQueryStringified = _interopRequireDefault(require("./build-raw-query-stringified"));
406
448
  var _buildFiltersQuery = _interopRequireDefault(require("./build-filters-query"));
407
449
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["_buildInheritedFilters","_interopRequireDefault","require","_buildLinkExtraProps","_buildPropsQuery","_buildQueryFields","_buildRawQuery","_buildRawQueryBase","_buildSearchValuesCheckboxSelect","_buildSearchValuesText","_buildSetFilters","_checkPropsToUse","_getElasticsearchOperator","_getClickWrapperOptions","_getEntitiesWithBanner","_getEntityData","_getEntityRenderProps","_getGenericProps","_getGenericRenderVariables","_getImageIds","_getInheritedFilters","_getModifiers","_getNotEqualQuery","_getPaginationIndex","_getParsedSummaryValue","_getQueryFilters","_getQueryProps","_getRequiredSchemas","_getSearchFilterType","_getUnpublishedEntityName","_getWrappedValueWithLink","_getItemsToDisplayIds","_isBrowser","_isFilterEntitysId","_isObject","_isUsingRelationImage","_parsePropsToDisplay","_renderChildren","_shouldRenderWaypoint","_shouldShowProperty","_sortResponseData","_splitChildren","_getCurrentOffset","_updateChildrensParent","_getDisplayCountData","_buildImageProperties","_getUpdatedFilterBy","_checkForError","_removeUnwantedCharacters","_hasChildren","_removeExtraItems","_getParsedPropValues","_getSanitizedPropValues","_appendImages","_parseTextBlock","_processDataSummaryValue","_buildQueryKey","_buildRawQueryStringified","_buildFiltersQuery"],"sources":["../../src/helpers/index.js"],"sourcesContent":["export { default as buildInheritedFilters } from './build-inherited-filters';\nexport { default as buildLinkExtraProps } from './build-link-extra-props';\nexport { default as buildPropsQuery } from './build-props-query';\nexport { default as buildQueryFields } from './build-query-fields';\nexport { default as buildRawQuery } from './build-raw-query';\nexport { default as buildRawQueryBase } from './build-raw-query-base';\nexport { default as buildSearchValuesCheckboxSelect } from './build-search-values-checkbox-select';\nexport { default as buildSearchValuesText } from './build-search-values-text';\nexport { default as buildSetFilters } from './build-set-filters';\nexport { default as checkPropsToUse } from './check-props-to-use';\nexport { default as getElasticsearchOperator } from './get-elasticsearch-operator';\nexport { default as getClickWrapperOptions } from './get-click-wrapper-options';\nexport { default as getEntitiesWithBanner } from './get-entities-with-banner';\nexport { default as getEntityData } from './get-entity-data';\nexport { default as getEntityRenderProps } from './get-entity-render-props';\nexport { default as getGenericProps } from './get-generic-props';\nexport { default as getGenericRenderVariables } from './get-generic-render-variables';\nexport { default as getImageIds } from './get-image-ids';\nexport { default as getInheritedFilters } from './get-inherited-filters';\nexport { default as getModifiers } from './get-modifiers';\nexport { default as getNotEqualQuery } from './get-not-equal-query';\nexport { default as getPaginationIndex } from './get-pagination-index';\nexport { default as getParsedSummaryValue } from './get-parsed-summary-value';\nexport { default as getQueryFilters } from './get-query-filters';\nexport { default as getQueryProps } from './get-query-props';\nexport { default as getRequiredSchemas } from './get-required-schemas';\nexport { default as getSearchFilterType } from './get-search-filter-type';\nexport { default as getUnpublishedEntityName } from './get-unpublished-entity-name';\nexport { default as getWrappedValueWithLink } from './get-wrapped-value-with-link';\nexport { default as getItemsToDisplayIds } from './get-items-to-display-ids';\nexport { default as isBrowser } from './is-browser';\nexport { default as isFilterEntitysId } from './is-filter-entitys-id';\nexport { default as isObject } from './is-object';\nexport { default as isUsingRelationImage } from './is-using-relation-image';\nexport { default as parsePropsToDisplay } from './parse-props-to-display';\nexport { default as renderChildren } from './render-children';\nexport { default as shouldRenderWaypoint } from './should-render-waypoint';\nexport { default as shouldShowProperty } from './should-show-property';\nexport { default as sortResponseData } from './sort-response-data';\nexport { default as splitChildren } from './split-children';\nexport { default as getCurrentOffset } from './get-current-offset';\nexport { default as updateChildrensParent } from './update-childrens-parent';\nexport { default as getDisplayCountData } from './get-display-count-data';\nexport { default as buildImageProperties } from './build-image-properties';\nexport { default as getUpdatedFilterBy } from './get-updated-filter-by';\nexport { default as checkForError } from './check-for-error';\nexport { default as removeUnwantedCharacters } from './remove-unwanted-characters';\nexport { default as hasChildren } from './has-children';\nexport { default as removeExtraItems } from './remove-extra-items';\nexport { default as getParsedPropValues } from './get-parsed-prop-values';\nexport { default as getSanitizedPropValues } from './get-sanitized-prop-values';\nexport { default as appendImages } from './append-images';\nexport { default as parseTextBlock } from './parse-TextBlock';\nexport { default as processDataSummaryValue } from './process-data-summary-value';\nexport { default as buildQueryKey } from './build-query-key';\nexport { default as buildRawQueryStringified }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,sBAAA,GAAA1C,sBAAA,CAAAC,OAAA;AACA,IAAA0C,oBAAA,GAAA3C,sBAAA,CAAAC,OAAA;AACA,IAAA2C,qBAAA,GAAA5C,sBAAA,CAAAC,OAAA;AACA,IAAA4C,mBAAA,GAAA7C,sBAAA,CAAAC,OAAA;AACA,IAAA6C,cAAA,GAAA9C,sBAAA,CAAAC,OAAA;AACA,IAAA8C,yBAAA,GAAA/C,sBAAA,CAAAC,OAAA;AACA,IAAA+C,YAAA,GAAAhD,sBAAA,CAAAC,OAAA;AACA,IAAAgD,iBAAA,GAAAjD,sBAAA,CAAAC,OAAA;AACA,IAAAiD,oBAAA,GAAAlD,sBAAA,CAAAC,OAAA;AACA,IAAAkD,uBAAA,GAAAnD,sBAAA,CAAAC,OAAA;AACA,IAAAmD,aAAA,GAAApD,sBAAA,CAAAC,OAAA;AACA,IAAAoD,eAAA,GAAArD,sBAAA,CAAAC,OAAA;AACA,IAAAqD,wBAAA,GAAAtD,sBAAA,CAAAC,OAAA;AACA,IAAAsD,cAAA,GAAAvD,sBAAA,CAAAC,OAAA;AACA,IAAAuD,yBAAA,GAAAxD,sBAAA,CAAAC,OAAA;AACA,IAAAwD,kBAAA,GAAAzD,sBAAA,CAAAC,OAAA"}
1
+ {"version":3,"file":"index.js","names":["_buildInheritedFilters","_interopRequireDefault","require","_buildLinkExtraProps","_buildPropsQuery","_buildQueryFields","_buildRawQuery","_buildRawQueryBase","_buildSearchValuesCheckboxSelect","_buildSearchValuesText","_buildSetFilters","_checkPropsToUse","_getElasticsearchOperator","_getClickWrapperOptions","_getEntitiesWithBanner","_getEntityData","_getEntityRenderProps","_getGenericProps","_getGenericRenderVariables","_getImageIds","_getInheritedFilters","_getModifiers","_getNotEqualQuery","_getPaginationIndex","_getParsedSummaryValue","_getQueryFilters","_getQueryProps","_getRequiredSchemas","_getSearchFilterType","_getUnpublishedEntityName","_getWrappedValueWithLink","_getItemsToDisplayIds","_isBrowser","_isFilterEntitysId","_isObject","_isUsingRelationImage","_parsePropsToDisplay","_renderChildren","_shouldRenderWaypoint","_shouldShowProperty","_sortResponseData","_splitChildren","_getCurrentOffset","_updateChildrensParent","_getDisplayCountData","_buildImageProperties","_getUpdatedFilterBy","_checkForError","_removeUnwantedCharacters","_hasChildren","_removeExtraItems","_getParsedPropValues","_getSanitizedPropValues","_appendImages","_parseTextBlock","_processDataSummaryValue","_buildQueryKey","_filterQuerySetup","_filtersSetup","_getUpdatedItemsToDisplay","_getUpdatedSortProperties","_shouldReturn","_shouldSkipSingleQuery","_buildRawQueryStringified","_buildFiltersQuery"],"sources":["../../src/helpers/index.js"],"sourcesContent":["export { default as buildInheritedFilters } from './build-inherited-filters';\nexport { default as buildLinkExtraProps } from './build-link-extra-props';\nexport { default as buildPropsQuery } from './build-props-query';\nexport { default as buildQueryFields } from './build-query-fields';\nexport { default as buildRawQuery } from './build-raw-query';\nexport { default as buildRawQueryBase } from './build-raw-query-base';\nexport { default as buildSearchValuesCheckboxSelect } from './build-search-values-checkbox-select';\nexport { default as buildSearchValuesText } from './build-search-values-text';\nexport { default as buildSetFilters } from './build-set-filters';\nexport { default as checkPropsToUse } from './check-props-to-use';\nexport { default as getElasticsearchOperator } from './get-elasticsearch-operator';\nexport { default as getClickWrapperOptions } from './get-click-wrapper-options';\nexport { default as getEntitiesWithBanner } from './get-entities-with-banner';\nexport { default as getEntityData } from './get-entity-data';\nexport { default as getEntityRenderProps } from './get-entity-render-props';\nexport { default as getGenericProps } from './get-generic-props';\nexport { default as getGenericRenderVariables } from './get-generic-render-variables';\nexport { default as getImageIds } from './get-image-ids';\nexport { default as getInheritedFilters } from './get-inherited-filters';\nexport { default as getModifiers } from './get-modifiers';\nexport { default as getNotEqualQuery } from './get-not-equal-query';\nexport { default as getPaginationIndex } from './get-pagination-index';\nexport { default as getParsedSummaryValue } from './get-parsed-summary-value';\nexport { default as getQueryFilters } from './get-query-filters';\nexport { default as getQueryProps } from './get-query-props';\nexport { default as getRequiredSchemas } from './get-required-schemas';\nexport { default as getSearchFilterType } from './get-search-filter-type';\nexport { default as getUnpublishedEntityName } from './get-unpublished-entity-name';\nexport { default as getWrappedValueWithLink } from './get-wrapped-value-with-link';\nexport { default as getItemsToDisplayIds } from './get-items-to-display-ids';\nexport { default as isBrowser } from './is-browser';\nexport { default as isFilterEntitysId } from './is-filter-entitys-id';\nexport { default as isObject } from './is-object';\nexport { default as isUsingRelationImage } from './is-using-relation-image';\nexport { default as parsePropsToDisplay } from './parse-props-to-display';\nexport { default as renderChildren } from './render-children';\nexport { default as shouldRenderWaypoint } from './should-render-waypoint';\nexport { default as shouldShowProperty } from './should-show-property';\nexport { default as sortResponseData } from './sort-response-data';\nexport { default as splitChildren } from './split-children';\nexport { default as getCurrentOffset } from './get-current-offset';\nexport { default as updateChildrensParent } from './update-childrens-parent';\nexport { default as getDisplayCountData } from './get-display-count-data';\nexport { default as buildImageProperties } from './build-image-properties';\nexport { default as getUpdatedFilterBy } from './get-updated-filter-by';\nexport { default as checkForError } from './check-for-error';\nexport { default as removeUnwantedCharacters } from './remove-unwanted-characters';\nexport { default as hasChildren } from './has-children';\nexport { default as removeExtraItems } from './remove-extra-items';\nexport { default as getParsedPropValues } from './get-parsed-prop-values';\nexport { default as getSanitizedPropValues } from './get-sanitized-prop-values';\nexport { default as appendImages } from './append-images';\nexport { default as parseTextBlock } from './parse-TextBlock';\nexport { default as processDataSummaryValue } from './process-data-summary-value';\nexport { default as buildQueryKey } from './build-query-key';\nexport { default as filterQuerySetup } from './filter-query-setup';\nexport { default as filtersSetup } from './filters-setup';\nexport { default as getUpdatedItemsToDisplay } from './get-updated-items-to-display';\nexport { default as getUpdatedSortProperties } from './get-updated-sort-properties';\nexport { default as shouldReturn } from './should-return';\nexport { default as shouldSkipSingleQuery } from './should-skip-single-query';\nexport { default as buildRawQueryStringified } from './build-raw-query-stringified';\nexport { default as buildFiltersQuery } from './build-filters-query';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AA,CAAAC,OAAA;AACA,IAAA2C,qBAAA,GAAA5C,sBAAA,CAAAC,OAAA;AACA,IAAA4C,mBAAA,GAAA7C,sBAAA,CAAAC,OAAA;AACA,IAAA6C,cAAA,GAAA9C,sBAAA,CAAAC,OAAA;AACA,IAAA8C,yBAAA,GAAA/C,sBAAA,CAAAC,OAAA;AACA,IAAA+C,YAAA,GAAAhD,sBAAA,CAAAC,OAAA;AACA,IAAAgD,iBAAA,GAAAjD,sBAAA,CAAAC,OAAA;AACA,IAAAiD,oBAAA,GAAAlD,sBAAA,CAAAC,OAAA;AACA,IAAAkD,uBAAA,GAAAnD,sBAAA,CAAAC,OAAA;AACA,IAAAmD,aAAA,GAAApD,sBAAA,CAAAC,OAAA;AACA,IAAAoD,eAAA,GAAArD,sBAAA,CAAAC,OAAA;AACA,IAAAqD,wBAAA,GAAAtD,sBAAA,CAAAC,OAAA;AACA,IAAAsD,cAAA,GAAAvD,sBAAA,CAAAC,OAAA;AACA,IAAAuD,iBAAA,GAAAxD,sBAAA,CAAAC,OAAA;AACA,IAAAwD,aAAA,GAAAzD,sBAAA,CAAAC,OAAA;AACA,IAAAyD,yBAAA,GAAA1D,sBAAA,CAAAC,OAAA;AACA,IAAA0D,yBAAA,GAAA3D,sBAAA,CAAAC,OAAA;AACA,IAAA2D,aAAA,GAAA5D,sBAAA,CAAAC,OAAA;AACA,IAAA4D,sBAAA,GAAA7D,sBAAA,CAAAC,OAAA;AACA,IAAA6D,yBAAA,GAAA9D,sBAAA,CAAAC,OAAA;AACA,IAAA8D,kBAAA,GAAA/D,sBAAA,CAAAC,OAAA"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"should-return.js","names":["shouldReturn","_len","arguments","length","args","Array","_key","filter","Boolean","_default","exports"],"sources":["../../src/helpers/should-return.js"],"sourcesContent":["const shouldReturn = (...args) => !!args.filter(Boolean).length;\n\nexport default shouldReturn;\n"],"mappings":";;;;;;;;;AAAA,IAAMA,YAAY,GAAG,SAAfA,YAAYA,CAAA;EAAA,SAAAC,IAAA,GAAAC,SAAA,CAAAC,MAAA,EAAOC,IAAI,OAAAC,KAAA,CAAAJ,IAAA,GAAAK,IAAA,MAAAA,IAAA,GAAAL,IAAA,EAAAK,IAAA;IAAJF,IAAI,CAAAE,IAAA,IAAAJ,SAAA,CAAAI,IAAA;EAAA;EAAA,OAAK,CAAC,CAACF,IAAI,CAACG,MAAM,CAACC,OAAO,CAAC,CAACL,MAAM;AAAA;AAAC,IAAAM,QAAA,GAAAC,OAAA,cAEjDV,YAAY"}
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports["default"] = void 0;
8
- var _constants = require("../../../constants");
8
+ var _constants = require("../constants");
9
9
  var shouldSkipSingleQuery = function shouldSkipSingleQuery(loading, getAction, queryProps) {
10
10
  return loading || !getAction || queryProps === _constants.ID;
11
11
  };
@@ -0,0 +1 @@
1
+ {"version":3,"file":"should-skip-single-query.js","names":["_constants","require","shouldSkipSingleQuery","loading","getAction","queryProps","ID","_default","exports"],"sources":["../../src/helpers/should-skip-single-query.js"],"sourcesContent":["import { ID } from '../constants';\n\nconst shouldSkipSingleQuery = (loading, getAction, queryProps) =>\n loading || !getAction || queryProps === ID;\n\nexport default shouldSkipSingleQuery;\n"],"mappings":";;;;;;;AAAA,IAAAA,UAAA,GAAAC,OAAA;AAEA,IAAMC,qBAAqB,GAAG,SAAxBA,qBAAqBA,CAAIC,OAAO,EAAEC,SAAS,EAAEC,UAAU;EAAA,OAC3DF,OAAO,IAAI,CAACC,SAAS,IAAIC,UAAU,KAAKC,aAAE;AAAA;AAAC,IAAAC,QAAA,GAAAC,OAAA,cAE9BN,qBAAqB"}
@@ -1,10 +1,10 @@
1
1
  export { default as getPublishedListingUrl } from './get-published-listing-url';
2
2
  export { default as useDynamicSizeKey } from './use-dynamic-size-key';
3
3
  export { default as getDynamicGridClasses } from './get-dynamic-grid-classes';
4
- export { default as filtersSetup } from './filters-setup';
5
- export { default as filterQuerySetup } from './filter-query-setup';
6
- export { default as shouldReturn } from './should-return';
7
- export { default as shouldSkipSingleQuery } from './should-skip-single-query';
8
- export { default as getUpdatedSortProperties } from './get-updated-sort-properties';
9
- export { default as getUpdatedItemsToDisplay } from './get-updated-items-to-display';
4
+ export { default as filtersSetup } from '../../../helpers/filters-setup';
5
+ export { default as filterQuerySetup } from '../../../helpers/filter-query-setup';
6
+ export { default as shouldReturn } from '../../../helpers/should-return';
7
+ export { default as shouldSkipSingleQuery } from '../../../helpers/should-skip-single-query';
8
+ export { default as getUpdatedSortProperties } from '../../../helpers/get-updated-sort-properties';
9
+ export { default as getUpdatedItemsToDisplay } from '../../../helpers/get-updated-items-to-display';
10
10
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["default","getPublishedListingUrl","useDynamicSizeKey","getDynamicGridClasses","filtersSetup","filterQuerySetup","shouldReturn","shouldSkipSingleQuery","getUpdatedSortProperties","getUpdatedItemsToDisplay"],"sources":["../../../../src/components/Card/helpers/index.js"],"sourcesContent":["export { default as getPublishedListingUrl } from './get-published-listing-url';\nexport { default as useDynamicSizeKey } from './use-dynamic-size-key';\nexport { default as getDynamicGridClasses } from './get-dynamic-grid-classes';\nexport { default as filtersSetup } from './filters-setup';\nexport { default as filterQuerySetup } from './filter-query-setup';\nexport { default as shouldReturn } from './should-return';\nexport { default as shouldSkipSingleQuery } from './should-skip-single-query';\nexport { default as getUpdatedSortProperties } from './get-updated-sort-properties';\nexport { default as getUpdatedItemsToDisplay } from './get-updated-items-to-display';\n"],"mappings":"AAAA,SAASA,OAAO,IAAIC,sBAAsB,QAAQ,6BAA6B;AAC/E,SAASD,OAAO,IAAIE,iBAAiB,QAAQ,wBAAwB;AACrE,SAASF,OAAO,IAAIG,qBAAqB,QAAQ,4BAA4B;AAC7E,SAASH,OAAO,IAAII,YAAY,QAAQ,iBAAiB;AACzD,SAASJ,OAAO,IAAIK,gBAAgB,QAAQ,sBAAsB;AAClE,SAASL,OAAO,IAAIM,YAAY,QAAQ,iBAAiB;AACzD,SAASN,OAAO,IAAIO,qBAAqB,QAAQ,4BAA4B;AAC7E,SAASP,OAAO,IAAIQ,wBAAwB,QAAQ,+BAA+B;AACnF,SAASR,OAAO,IAAIS,wBAAwB,QAAQ,gCAAgC"}
1
+ {"version":3,"file":"index.js","names":["default","getPublishedListingUrl","useDynamicSizeKey","getDynamicGridClasses","filtersSetup","filterQuerySetup","shouldReturn","shouldSkipSingleQuery","getUpdatedSortProperties","getUpdatedItemsToDisplay"],"sources":["../../../../src/components/Card/helpers/index.js"],"sourcesContent":["export { default as getPublishedListingUrl } from './get-published-listing-url';\nexport { default as useDynamicSizeKey } from './use-dynamic-size-key';\nexport { default as getDynamicGridClasses } from './get-dynamic-grid-classes';\nexport { default as filtersSetup } from '../../../helpers/filters-setup';\nexport { default as filterQuerySetup } from '../../../helpers/filter-query-setup';\nexport { default as shouldReturn } from '../../../helpers/should-return';\nexport { default as shouldSkipSingleQuery } from '../../../helpers/should-skip-single-query';\nexport { default as getUpdatedSortProperties } from '../../../helpers/get-updated-sort-properties';\nexport { default as getUpdatedItemsToDisplay } from '../../../helpers/get-updated-items-to-display';\n"],"mappings":"AAAA,SAASA,OAAO,IAAIC,sBAAsB,QAAQ,6BAA6B;AAC/E,SAASD,OAAO,IAAIE,iBAAiB,QAAQ,wBAAwB;AACrE,SAASF,OAAO,IAAIG,qBAAqB,QAAQ,4BAA4B;AAC7E,SAASH,OAAO,IAAII,YAAY,QAAQ,gCAAgC;AACxE,SAASJ,OAAO,IAAIK,gBAAgB,QAAQ,qCAAqC;AACjF,SAASL,OAAO,IAAIM,YAAY,QAAQ,gCAAgC;AACxE,SAASN,OAAO,IAAIO,qBAAqB,QAAQ,2CAA2C;AAC5F,SAASP,OAAO,IAAIQ,wBAAwB,QAAQ,8CAA8C;AAClG,SAASR,OAAO,IAAIS,wBAAwB,QAAQ,+CAA+C"}
@@ -0,0 +1,177 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
+ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
4
+ const _excluded = ["entities", "parent"];
5
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
6
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
7
+ import React from 'react';
8
+ import PropTypes from 'prop-types';
9
+ import { useQuery } from '@apollo/client';
10
+ import MenuItemRender from './MenuItemRender';
11
+ import { buildPropsQuery, getEntityData, getRequiredSchemas, getUnpublishedEntityName, getUpdatedFilterBy, filterQuerySetup, filtersSetup, getUpdatedItemsToDisplay, getUpdatedSortProperties, shouldReturn, shouldSkipSingleQuery } from '../../helpers';
12
+ import { useGetEntitySchemasAsObj } from '../../hooks';
13
+ import { generateSingleItemQuery } from '../../application/query';
14
+ import { AND, SEARCH_PUBLISHED_CONTENT } from '../../constants';
15
+ const MenuEntitiesItem = _ref => {
16
+ let {
17
+ entities,
18
+ parent
19
+ } = _ref,
20
+ props = _objectWithoutProperties(_ref, _excluded);
21
+ const {
22
+ itemEntity: parentEntity,
23
+ itemId: parentId
24
+ } = parent;
25
+ const {
26
+ operator: filterOperator = AND,
27
+ filterByProperty = [],
28
+ sortProperties = [],
29
+ itemsToDisplay,
30
+ filterBy = [],
31
+ sortby,
32
+ sort
33
+ } = props;
34
+ const unpublishedEntityName = getUnpublishedEntityName(parentEntity);
35
+ const [updatedSortProperties, sortbyFilters] = getUpdatedSortProperties(sort, sortby, sortProperties);
36
+ const {
37
+ data: mainSchemas = {},
38
+ loading: entityObjloading,
39
+ error: entityObjError
40
+ } = useGetEntitySchemasAsObj([unpublishedEntityName, ...entities]);
41
+ const [filterEntity] = entities;
42
+ const {
43
+ [filterEntity]: filterEntitySchema = {}
44
+ } = mainSchemas;
45
+ const entitiesTypes = entities.map(entity => getEntityData(entity, mainSchemas[entity]));
46
+ const graphqlEntityMap = entitiesTypes.reduce((acc, entityType) => _objectSpread(_objectSpread({}, acc), {}, {
47
+ [entityType.entityType]: entityType.entity
48
+ }), {});
49
+ const docTypes = entitiesTypes.map(({
50
+ docType
51
+ }) => docType);
52
+ const entityTypes = entitiesTypes.map(({
53
+ entityType
54
+ }) => entityType);
55
+ const entityFields = buildPropsQuery(filterEntitySchema, ['name', 'url']) || '';
56
+ const parentSchema = mainSchemas[unpublishedEntityName] || {};
57
+ const {
58
+ entitySameAsCurrentItemEntity,
59
+ filterEntityRelations,
60
+ inheritedFilters,
61
+ queryProps,
62
+ getAction,
63
+ action
64
+ } = filtersSetup({
65
+ itemEntityUpdated: unpublishedEntityName,
66
+ currentSchema: parentSchema,
67
+ filterEntitySchema,
68
+ filterByProperty,
69
+ entityFields,
70
+ entityTypes,
71
+ filterBy,
72
+ entities
73
+ });
74
+ const {
75
+ data: {
76
+ entityData: parentEntityData = {}
77
+ } = {},
78
+ error: singleItemQueryError,
79
+ loading: singleItemQueryLoading
80
+ } = useQuery(generateSingleItemQuery(getAction, queryProps), {
81
+ variables: {
82
+ id: parentId
83
+ },
84
+ skip: shouldSkipSingleQuery(entityObjloading, getAction, queryProps)
85
+ });
86
+ const {
87
+ data: requiredSchema = {},
88
+ loading: schemaLoading,
89
+ error: schemaError
90
+ } = useGetEntitySchemasAsObj(getRequiredSchemas([...filterByProperty, ...sortbyFilters], filterEntitySchema), entityObjloading);
91
+ const getEntitySchemas = Object.values(requiredSchema);
92
+ const updatedItemsToDisplay = getUpdatedItemsToDisplay({
93
+ inheritedFilters,
94
+ parentEntityData,
95
+ itemsToDisplay,
96
+ parentSchema
97
+ });
98
+ const variableProps = {
99
+ sortProperties: updatedSortProperties,
100
+ filterByProperty,
101
+ sortby: null,
102
+ sort: null,
103
+ filterBy
104
+ };
105
+ const updatedFilterBy = getUpdatedFilterBy(inheritedFilters, parentEntityData, filterEntitySchema, parentSchema, parentId, variableProps);
106
+ const {
107
+ variables
108
+ } = filterQuerySetup({
109
+ itemsToDisplay: updatedItemsToDisplay,
110
+ entitySameAsCurrentItemEntity,
111
+ filterEntityRelations,
112
+ entity: filterEntity,
113
+ docType: docTypes,
114
+ getEntitySchemas,
115
+ updatedFilterBy,
116
+ variableProps,
117
+ filterOperator
118
+ });
119
+ const hasNoItemsToDisplayOrFilter = !updatedItemsToDisplay.length && !updatedFilterBy;
120
+ const {
121
+ data = {}
122
+ } = useQuery(action, {
123
+ variables,
124
+ skip: shouldReturn(hasNoItemsToDisplayOrFilter, singleItemQueryLoading, singleItemQueryError, entityObjloading, entityObjError, schemaLoading, schemaError)
125
+ });
126
+ const {
127
+ results
128
+ } = data[SEARCH_PUBLISHED_CONTENT] || {};
129
+ if (!results) return null;
130
+ return results.map(item => {
131
+ const itemParent = {
132
+ itemId: item.id,
133
+ itemEntity: graphqlEntityMap[item.__typename]
134
+ };
135
+ return /*#__PURE__*/React.createElement(MenuItemRender, _extends({}, props, {
136
+ parent: itemParent,
137
+ url: item.url || props.url
138
+ }));
139
+ });
140
+ };
141
+ MenuEntitiesItem.propTypes = {
142
+ children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]),
143
+ eventType: PropTypes.string.isRequired,
144
+ modifier: PropTypes.string,
145
+ parent: PropTypes.object,
146
+ text: PropTypes.string,
147
+ url: PropTypes.string,
148
+ entities: PropTypes.array,
149
+ limit: PropTypes.number,
150
+ offset: PropTypes.number,
151
+ sortby: PropTypes.array,
152
+ filterBy: PropTypes.array,
153
+ sort: PropTypes.string,
154
+ operator: PropTypes.string.isRequired,
155
+ filterOperator: PropTypes.string.isRequired,
156
+ sortProperties: PropTypes.array,
157
+ filterByProperty: PropTypes.array,
158
+ itemsToDisplay: PropTypes.array
159
+ };
160
+ MenuEntitiesItem.defaultProps = {
161
+ children: null,
162
+ modifier: '',
163
+ limit: 0,
164
+ offset: 0,
165
+ itemsToDisplay: [],
166
+ sort: '',
167
+ sortby: [],
168
+ sortProperties: [],
169
+ filterByProperty: [],
170
+ parent: {},
171
+ filterBy: [],
172
+ text: '',
173
+ url: '',
174
+ entities: []
175
+ };
176
+ export default MenuEntitiesItem;
177
+ //# sourceMappingURL=MenuEntitiesItem.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MenuEntitiesItem.js","names":["React","PropTypes","useQuery","MenuItemRender","buildPropsQuery","getEntityData","getRequiredSchemas","getUnpublishedEntityName","getUpdatedFilterBy","filterQuerySetup","filtersSetup","getUpdatedItemsToDisplay","getUpdatedSortProperties","shouldReturn","shouldSkipSingleQuery","useGetEntitySchemasAsObj","generateSingleItemQuery","AND","SEARCH_PUBLISHED_CONTENT","MenuEntitiesItem","_ref","entities","parent","props","_objectWithoutProperties","_excluded","itemEntity","parentEntity","itemId","parentId","operator","filterOperator","filterByProperty","sortProperties","itemsToDisplay","filterBy","sortby","sort","unpublishedEntityName","updatedSortProperties","sortbyFilters","data","mainSchemas","loading","entityObjloading","error","entityObjError","filterEntity","filterEntitySchema","entitiesTypes","map","entity","graphqlEntityMap","reduce","acc","entityType","_objectSpread","docTypes","docType","entityTypes","entityFields","parentSchema","entitySameAsCurrentItemEntity","filterEntityRelations","inheritedFilters","queryProps","getAction","action","itemEntityUpdated","currentSchema","entityData","parentEntityData","singleItemQueryError","singleItemQueryLoading","variables","id","skip","requiredSchema","schemaLoading","schemaError","getEntitySchemas","Object","values","updatedItemsToDisplay","variableProps","updatedFilterBy","hasNoItemsToDisplayOrFilter","length","results","item","itemParent","__typename","createElement","_extends","url","propTypes","children","oneOfType","arrayOf","node","eventType","string","isRequired","modifier","object","text","array","limit","number","offset","defaultProps"],"sources":["../../../src/components/MenuItem/MenuEntitiesItem.js"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { useQuery } from '@apollo/client';\nimport MenuItemRender from './MenuItemRender';\nimport {\n buildPropsQuery,\n getEntityData,\n getRequiredSchemas,\n getUnpublishedEntityName,\n getUpdatedFilterBy,\n filterQuerySetup,\n filtersSetup,\n getUpdatedItemsToDisplay,\n getUpdatedSortProperties,\n shouldReturn,\n shouldSkipSingleQuery\n} from '../../helpers';\nimport { useGetEntitySchemasAsObj } from '../../hooks';\nimport { generateSingleItemQuery } from '../../application/query';\nimport { AND, SEARCH_PUBLISHED_CONTENT } from '../../constants';\n\nconst MenuEntitiesItem = ({ entities, parent, ...props }) => {\n const { itemEntity: parentEntity, itemId: parentId } = parent;\n const {\n operator: filterOperator = AND,\n filterByProperty = [],\n sortProperties = [],\n itemsToDisplay,\n filterBy = [],\n sortby,\n sort\n } = props;\n\n const unpublishedEntityName = getUnpublishedEntityName(parentEntity);\n\n const [updatedSortProperties, sortbyFilters] = getUpdatedSortProperties(\n sort,\n sortby,\n sortProperties\n );\n\n const {\n data: mainSchemas = {},\n loading: entityObjloading,\n error: entityObjError\n } = useGetEntitySchemasAsObj([unpublishedEntityName, ...entities]);\n\n const [filterEntity] = entities;\n\n const { [filterEntity]: filterEntitySchema = {} } = mainSchemas;\n\n const entitiesTypes = entities.map(entity => getEntityData(entity, mainSchemas[entity]));\n const graphqlEntityMap = entitiesTypes.reduce(\n (acc, entityType) => ({ ...acc, [entityType.entityType]: entityType.entity }),\n {}\n );\n const docTypes = entitiesTypes.map(({ docType }) => docType);\n const entityTypes = entitiesTypes.map(({ entityType }) => entityType);\n\n const entityFields = buildPropsQuery(filterEntitySchema, ['name', 'url']) || '';\n const parentSchema = mainSchemas[unpublishedEntityName] || {};\n\n const {\n entitySameAsCurrentItemEntity,\n filterEntityRelations,\n inheritedFilters,\n queryProps,\n getAction,\n action\n } = filtersSetup({\n itemEntityUpdated: unpublishedEntityName,\n currentSchema: parentSchema,\n filterEntitySchema,\n filterByProperty,\n entityFields,\n entityTypes,\n filterBy,\n entities\n });\n\n const {\n data: { entityData: parentEntityData = {} } = {},\n error: singleItemQueryError,\n loading: singleItemQueryLoading\n } = useQuery(generateSingleItemQuery(getAction, queryProps), {\n variables: { id: parentId },\n skip: shouldSkipSingleQuery(entityObjloading, getAction, queryProps)\n });\n\n const {\n data: requiredSchema = {},\n loading: schemaLoading,\n error: schemaError\n } = useGetEntitySchemasAsObj(\n getRequiredSchemas([...filterByProperty, ...sortbyFilters], filterEntitySchema),\n entityObjloading\n );\n\n const getEntitySchemas = Object.values(requiredSchema);\n\n const updatedItemsToDisplay = getUpdatedItemsToDisplay({\n inheritedFilters,\n parentEntityData,\n itemsToDisplay,\n parentSchema\n });\n\n const variableProps = {\n sortProperties: updatedSortProperties,\n filterByProperty,\n sortby: null,\n sort: null,\n filterBy\n };\n\n const updatedFilterBy = getUpdatedFilterBy(\n inheritedFilters,\n parentEntityData,\n filterEntitySchema,\n parentSchema,\n parentId,\n variableProps\n );\n\n const { variables } = filterQuerySetup({\n itemsToDisplay: updatedItemsToDisplay,\n entitySameAsCurrentItemEntity,\n filterEntityRelations,\n entity: filterEntity,\n docType: docTypes,\n getEntitySchemas,\n updatedFilterBy,\n variableProps,\n filterOperator\n });\n\n const hasNoItemsToDisplayOrFilter = !updatedItemsToDisplay.length && !updatedFilterBy;\n\n const { data = {} } = useQuery(action, {\n variables,\n skip: shouldReturn(\n hasNoItemsToDisplayOrFilter,\n singleItemQueryLoading,\n singleItemQueryError,\n entityObjloading,\n entityObjError,\n schemaLoading,\n schemaError\n )\n });\n\n const { results } = data[SEARCH_PUBLISHED_CONTENT] || {};\n\n if (!results) return null;\n\n return results.map(item => {\n const itemParent = {\n itemId: item.id,\n itemEntity: graphqlEntityMap[item.__typename]\n };\n return <MenuItemRender {...props} parent={itemParent} url={item.url || props.url} />;\n });\n};\n\nMenuEntitiesItem.propTypes = {\n children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]),\n eventType: PropTypes.string.isRequired,\n modifier: PropTypes.string,\n parent: PropTypes.object,\n text: PropTypes.string,\n url: PropTypes.string,\n entities: PropTypes.array,\n limit: PropTypes.number,\n offset: PropTypes.number,\n sortby: PropTypes.array,\n filterBy: PropTypes.array,\n sort: PropTypes.string,\n operator: PropTypes.string.isRequired,\n filterOperator: PropTypes.string.isRequired,\n sortProperties: PropTypes.array,\n filterByProperty: PropTypes.array,\n itemsToDisplay: PropTypes.array\n};\n\nMenuEntitiesItem.defaultProps = {\n children: null,\n modifier: '',\n limit: 0,\n offset: 0,\n itemsToDisplay: [],\n sort: '',\n sortby: [],\n sortProperties: [],\n filterByProperty: [],\n parent: {},\n filterBy: [],\n text: '',\n url: '',\n entities: []\n};\n\nexport default MenuEntitiesItem;\n"],"mappings":";;;;;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,SAAS,MAAM,YAAY;AAClC,SAASC,QAAQ,QAAQ,gBAAgB;AACzC,OAAOC,cAAc,MAAM,kBAAkB;AAC7C,SACEC,eAAe,EACfC,aAAa,EACbC,kBAAkB,EAClBC,wBAAwB,EACxBC,kBAAkB,EAClBC,gBAAgB,EAChBC,YAAY,EACZC,wBAAwB,EACxBC,wBAAwB,EACxBC,YAAY,EACZC,qBAAqB,QAChB,eAAe;AACtB,SAASC,wBAAwB,QAAQ,aAAa;AACtD,SAASC,uBAAuB,QAAQ,yBAAyB;AACjE,SAASC,GAAG,EAAEC,wBAAwB,QAAQ,iBAAiB;AAE/D,MAAMC,gBAAgB,GAAGC,IAAA,IAAoC;EAAA,IAAnC;MAAEC,QAAQ;MAAEC;IAAiB,CAAC,GAAAF,IAAA;IAAPG,KAAK,GAAAC,wBAAA,CAAAJ,IAAA,EAAAK,SAAA;EACpD,MAAM;IAAEC,UAAU,EAAEC,YAAY;IAAEC,MAAM,EAAEC;EAAS,C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;EAClBG,IAAI,EAAE,EAAE;EACRD,MAAM,EAAE,EAAE;EACVH,cAAc,EAAE,EAAE;EAClBD,gBAAgB,EAAE,EAAE;EACpBV,MAAM,EAAE,CAAC,CAAC;EACVa,QAAQ,EAAE,EAAE;EACZsE,IAAI,EAAE,EAAE;EACRX,GAAG,EAAE,EAAE;EACPzE,QAAQ,EAAE;AACZ,CAAC;AAED,eAAeF,gBAAgB"}
@@ -1,70 +1,41 @@
1
- import React, { useState, useContext, useEffect } from 'react';
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
+ const _excluded = ["entities", "parent"];
4
+ import React from 'react';
2
5
  import PropTypes from 'prop-types';
3
- import { FaChevronDown, FaChevronUp } from 'react-icons/fa';
4
- import { HOVER, MOUSE_ENTER, MOUSE_LEAVE, HIDDEN } from '../../constants';
5
- import { hasChildren } from '../../helpers';
6
- import BlazeLink from '../BlazeLink';
7
- import MenuContext from '../Menu/MenuContext';
8
- const MenuItem = ({
9
- children,
10
- eventType,
11
- text,
12
- modifier,
13
- url
14
- }) => {
15
- const [displayChildren, setDisplayChildren] = useState(false);
16
- const {
17
- showMobileMenu
18
- } = useContext(MenuContext);
19
- useEffect(() => {
20
- if (!showMobileMenu) setDisplayChildren(false);
21
- }, [showMobileMenu]);
22
- const isHoverEvent = eventType === HOVER;
23
- const childrenDisplayClass = displayChildren ? '' : HIDDEN;
24
- const handleItemEvent = ({
25
- type
26
- }) => {
27
- if (isHoverEvent) {
28
- if (type === MOUSE_ENTER) {
29
- setDisplayChildren(true);
30
- }
31
- if (type === MOUSE_LEAVE) {
32
- setDisplayChildren(false);
33
- }
34
- }
35
- };
36
- const hasValidChildren = hasChildren(children);
37
- return /*#__PURE__*/React.createElement("li", {
38
- className: modifier,
39
- onMouseEnter: handleItemEvent,
40
- onMouseLeave: handleItemEvent
41
- }, /*#__PURE__*/React.createElement("div", {
42
- className: "menu--item--link"
43
- }, url ? /*#__PURE__*/React.createElement(BlazeLink, {
44
- href: url
45
- }, text) : /*#__PURE__*/React.createElement("span", {
46
- role: "button",
47
- onClick: handleItemEvent
48
- }, text), hasValidChildren && /*#__PURE__*/React.createElement("i", {
49
- role: "button",
50
- className: "menu--item--link--icon",
51
- onClick: () => setDisplayChildren(!displayChildren)
52
- }, displayChildren ? /*#__PURE__*/React.createElement(FaChevronUp, null) : /*#__PURE__*/React.createElement(FaChevronDown, null))), hasValidChildren && /*#__PURE__*/React.createElement("div", {
53
- className: `menu--item-children ${childrenDisplayClass}`
54
- }, children));
6
+ import MenuItemRender from './MenuItemRender';
7
+ import MenuEntitiesItem from './MenuEntitiesItem';
8
+ const MenuItem = _ref => {
9
+ let {
10
+ entities,
11
+ parent
12
+ } = _ref,
13
+ props = _objectWithoutProperties(_ref, _excluded);
14
+ const hasEntities = entities && entities.length;
15
+ if (!hasEntities) return /*#__PURE__*/React.createElement(MenuItemRender, _extends({
16
+ parent: parent
17
+ }, props));
18
+ return /*#__PURE__*/React.createElement(MenuEntitiesItem, _extends({
19
+ entities: entities,
20
+ parent: parent
21
+ }, props));
55
22
  };
56
23
  MenuItem.propTypes = {
24
+ children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]),
25
+ eventType: PropTypes.string.isRequired,
57
26
  modifier: PropTypes.string,
27
+ parent: PropTypes.object,
58
28
  text: PropTypes.string,
59
29
  url: PropTypes.string,
60
- eventType: PropTypes.string.isRequired,
61
- children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node])
30
+ entities: PropTypes.array
62
31
  };
63
32
  MenuItem.defaultProps = {
64
- url: '',
33
+ children: null,
65
34
  modifier: '',
35
+ parent: {},
66
36
  text: '',
67
- children: null
37
+ url: '',
38
+ entities: []
68
39
  };
69
40
  export default MenuItem;
70
41
  //# sourceMappingURL=MenuItem.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"MenuItem.js","names":["React","useState","useContext","useEffect","PropTypes","FaChevronDown","FaChevronUp","HOVER","MOUSE_ENTER","MOUSE_LEAVE","HIDDEN","hasChildren","BlazeLink","MenuContext","MenuItem","children","eventType","text","modifier","url","displayChildren","setDisplayChildren","showMobileMenu","isHoverEvent","childrenDisplayClass","handleItemEvent","type","hasValidChildren","createElement","className","onMouseEnter","onMouseLeave","href","role","onClick","propTypes","string","isRequired","oneOfType","arrayOf","node","defaultProps"],"sources":["../../../src/components/MenuItem/MenuItem.js"],"sourcesContent":["import React, { useState, useContext, useEffect } from 'react';\nimport PropTypes from 'prop-types';\nimport { FaChevronDown, FaChevronUp } from 'react-icons/fa';\nimport { HOVER, MOUSE_ENTER, MOUSE_LEAVE, HIDDEN } from '../../constants';\nimport { hasChildren } from '../../helpers';\nimport BlazeLink from '../BlazeLink';\nimport MenuContext from '../Menu/MenuContext';\n\nconst MenuItem = ({ children, eventType, text, modifier, url }) => {\n const [displayChildren, setDisplayChildren] = useState(false);\n const { showMobileMenu } = useContext(MenuContext);\n\n useEffect(\n () => {\n if (!showMobileMenu) setDisplayChildren(false);\n },\n [showMobileMenu]\n );\n\n const isHoverEvent = eventType === HOVER;\n const childrenDisplayClass = displayChildren ? '' : HIDDEN;\n\n const handleItemEvent = ({ type }) => {\n if (isHoverEvent) {\n if (type === MOUSE_ENTER) {\n setDisplayChildren(true);\n }\n if (type === MOUSE_LEAVE) {\n setDisplayChildren(false);\n }\n }\n };\n const hasValidChildren = hasChildren(children);\n\n return (\n <li className={modifier} onMouseEnter={handleItemEvent} onMouseLeave={handleItemEvent}>\n <div className=\"menu--item--link\">\n {url ? (\n <BlazeLink href={url}>{text}</BlazeLink>\n ) : (\n <span role=\"button\" onClick={handleItemEvent}>\n {text}\n </span>\n )}\n {hasValidChildren && (\n <i\n role=\"button\"\n className=\"menu--item--link--icon\"\n onClick={() => setDisplayChildren(!displayChildren)}>\n {displayChildren ? <FaChevronUp /> : <FaChevronDown />}\n </i>\n )}\n </div>\n {hasValidChildren && (\n <div className={`menu--item-children ${childrenDisplayClass}`}>{children}</div>\n )}\n </li>\n );\n};\n\nMenuItem.propTypes = {\n modifier: PropTypes.string,\n text: PropTypes.string,\n url: PropTypes.string,\n eventType: PropTypes.string.isRequired,\n children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node])\n};\n\nMenuItem.defaultProps = {\n url: '',\n modifier: '',\n text: '',\n children: null\n};\n\nexport default MenuItem;\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,QAAQ,EAAEC,UAAU,EAAEC,SAAS,QAAQ,OAAO;AAC9D,OAAOC,SAAS,MAAM,YAAY;AAClC,SAASC,aAAa,EAAEC,WAAW,QAAQ,gBAAgB;AAC3D,SAASC,KAAK,EAAEC,WAAW,EAAEC,WAAW,EAAEC,MAAM,QAAQ,iBAAiB;AACzE,SAASC,WAAW,QAAQ,eAAe;AAC3C,OAAOC,SAAS,MAAM,cAAc;AACpC,OAAOC,WAAW,MAAM,qBAAqB;AAE7C,MAAMC,QAAQ,GAAGA,CAAC;EAAEC,QAAQ;EAAEC,SAAS;EAAEC,IAAI;EAAEC,QAAQ;EAAEC;AAAI,CAAC,KAAK;EACjE,MAAM,CAACC,eAAe,EAAEC,kBAAkB,CAAC,GAAGpB,QAAQ,CAAC,KAAK,CAAC;EAC7D,MAAM;IAAEqB;EAAe,CAAC,GAAGpB,UAAU,CAACW,WAAW,CAAC;EAElDV,SAAS,CACP,MAAM;IACJ,IAAI,CAACmB,cAAc,EAAED,kBAAkB,CAAC,KAAK,CAAC;EAChD,CAAC,EACD,CAACC,cAAc,CACjB,CAAC;EAED,MAAMC,YAAY,GAAGP,SAAS,KAAKT,KAAK;EACxC,MAAMiB,oBAAoB,GAAGJ,eAAe,GAAG,EAAE,GAAGV,MAAM;EAE1D,MAAMe,eAAe,GAAGA,CAAC;IAAEC;EAAK,CAAC,KAAK;IACpC,IAAIH,YAAY,EAAE;MAChB,IAAIG,IAAI,KAAKlB,WAAW,EAAE;QACxBa,kBAAkB,CAAC,IAAI,CAAC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C,OAAO,CAACnC,SAAS,CAACoC,IAAI,CAAC,EAAEpC,SAAS,CAACoC,IAAI,CAAC;AACnF,CAAC;AAED1B,QAAQ,CAAC2B,YAAY,GAAG;EACtBtB,GAAG,EAAE,EAAE;EACPD,QAAQ,EAAE,EAAE;EACZD,IAAI,EAAE,EAAE;EACRF,QAAQ,EAAE;AACZ,CAAC;AAED,eAAeD,QAAQ"}
1
+ {"version":3,"file":"MenuItem.js","names":["React","PropTypes","MenuItemRender","MenuEntitiesItem","MenuItem","_ref","entities","parent","props","_objectWithoutProperties","_excluded","hasEntities","length","createElement","_extends","propTypes","children","oneOfType","arrayOf","node","eventType","string","isRequired","modifier","object","text","url","array","defaultProps"],"sources":["../../../src/components/MenuItem/MenuItem.js"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport MenuItemRender from './MenuItemRender';\nimport MenuEntitiesItem from './MenuEntitiesItem';\n\nconst MenuItem = ({ entities, parent, ...props }) => {\n const hasEntities = entities && entities.length;\n\n if (!hasEntities) return <MenuItemRender parent={parent} {...props} />;\n\n return <MenuEntitiesItem entities={entities} parent={parent} {...props} />;\n};\n\nMenuItem.propTypes = {\n children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]),\n eventType: PropTypes.string.isRequired,\n modifier: PropTypes.string,\n parent: PropTypes.object,\n text: PropTypes.string,\n url: PropTypes.string,\n entities: PropTypes.array\n};\n\nMenuItem.defaultProps = {\n children: null,\n modifier: '',\n parent: {},\n text: '',\n url: '',\n entities: []\n};\n\nexport default MenuItem;\n"],"mappings":";;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,SAAS,MAAM,YAAY;AAClC,OAAOC,cAAc,MAAM,kBAAkB;AAC7C,OAAOC,gBAAgB,MAAM,oBAAoB;AAEjD,MAAMC,QAAQ,GAAGC,IAAA,IAAoC;EAAA,IAAnC;MAAEC,QAAQ;MAAEC;IAAiB,CAAC,GAAAF,IAAA;IAAPG,KAAK,G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