strapi-plugin-navigation 3.0.4 → 3.0.5

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/README.md CHANGED
@@ -113,7 +113,7 @@ Complete installation requirements are exact same as for Strapi itself and can b
113
113
 
114
114
  **Supported Strapi versions**:
115
115
 
116
- - Strapi v5.6.0 (recently tested)
116
+ - Strapi v5.7.0 (recently tested)
117
117
  - Strapi v5.x
118
118
 
119
119
  > This plugin is designed for **Strapi v5** and is not working with v4.x. To get version for **Strapi v4** install version [v4.x](https://github.com/VirtusLab-Open-Source/strapi-plugin-navigation/tree/strapi-v4).
@@ -2519,7 +2519,7 @@ function isTopLayer(element) {
2519
2519
  function isContainingBlock(elementOrCss) {
2520
2520
  const webkit2 = isWebKit();
2521
2521
  const css = isElement(elementOrCss) ? getComputedStyle$1(elementOrCss) : elementOrCss;
2522
- return css.transform !== "none" || css.perspective !== "none" || (css.containerType ? css.containerType !== "normal" : false) || !webkit2 && (css.backdropFilter ? css.backdropFilter !== "none" : false) || !webkit2 && (css.filter ? css.filter !== "none" : false) || ["transform", "perspective", "filter"].some((value) => (css.willChange || "").includes(value)) || ["paint", "layout", "strict", "content"].some((value) => (css.contain || "").includes(value));
2522
+ return ["transform", "translate", "scale", "rotate", "perspective"].some((value) => css[value] ? css[value] !== "none" : false) || (css.containerType ? css.containerType !== "normal" : false) || !webkit2 && (css.backdropFilter ? css.backdropFilter !== "none" : false) || !webkit2 && (css.filter ? css.filter !== "none" : false) || ["transform", "translate", "scale", "rotate", "perspective", "filter"].some((value) => (css.willChange || "").includes(value)) || ["paint", "layout", "strict", "content"].some((value) => (css.contain || "").includes(value));
2523
2523
  }
2524
2524
  function getContainingBlock(element) {
2525
2525
  let currentNode = getParentNode(element);
@@ -3025,6 +3025,9 @@ const platform = {
3025
3025
  isElement,
3026
3026
  isRTL
3027
3027
  };
3028
+ function rectsAreEqual(a, b) {
3029
+ return a.x === b.x && a.y === b.y && a.width === b.width && a.height === b.height;
3030
+ }
3028
3031
  function observeMove(element, onMove) {
3029
3032
  let io = null;
3030
3033
  let timeoutId;
@@ -3043,12 +3046,13 @@ function observeMove(element, onMove) {
3043
3046
  threshold = 1;
3044
3047
  }
3045
3048
  cleanup();
3049
+ const elementRectForRootMargin = element.getBoundingClientRect();
3046
3050
  const {
3047
3051
  left,
3048
3052
  top: top2,
3049
3053
  width,
3050
3054
  height
3051
- } = element.getBoundingClientRect();
3055
+ } = elementRectForRootMargin;
3052
3056
  if (!skip) {
3053
3057
  onMove();
3054
3058
  }
@@ -3079,6 +3083,9 @@ function observeMove(element, onMove) {
3079
3083
  refresh(false, ratio);
3080
3084
  }
3081
3085
  }
3086
+ if (ratio === 1 && !rectsAreEqual(elementRectForRootMargin, element.getBoundingClientRect())) {
3087
+ refresh();
3088
+ }
3082
3089
  isFirstUpdate = false;
3083
3090
  }
3084
3091
  try {
@@ -3142,7 +3149,7 @@ function autoUpdate(reference, floating, update, options) {
3142
3149
  }
3143
3150
  function frameLoop() {
3144
3151
  const nextRefRect = getBoundingClientRect(reference);
3145
- if (prevRefRect && (nextRefRect.x !== prevRefRect.x || nextRefRect.y !== prevRefRect.y || nextRefRect.width !== prevRefRect.width || nextRefRect.height !== prevRefRect.height)) {
3152
+ if (prevRefRect && !rectsAreEqual(prevRefRect, nextRefRect)) {
3146
3153
  update();
3147
3154
  }
3148
3155
  prevRefRect = nextRefRect;
@@ -20173,7 +20180,7 @@ function findMinIndex(value, array) {
20173
20180
  }
20174
20181
  function countColumn(string2, tabSize, to = string2.length) {
20175
20182
  let n = 0;
20176
- for (let i = 0; i < to; ) {
20183
+ for (let i = 0; i < to && i < string2.length; ) {
20177
20184
  if (string2.charCodeAt(i) == 9) {
20178
20185
  n += tabSize - n % tabSize;
20179
20186
  i++;
@@ -24021,16 +24028,16 @@ function applyDOMChange(view, domChange) {
24021
24028
  return false;
24022
24029
  if (!change && domChange.typeOver && !sel.empty && newSel && newSel.main.empty) {
24023
24030
  change = { from: sel.from, to: sel.to, insert: view.state.doc.slice(sel.from, sel.to) };
24031
+ } else if ((browser.mac || browser.android) && change && change.from == change.to && change.from == sel.head - 1 && /^\. ?$/.test(change.insert.toString()) && view.contentDOM.getAttribute("autocorrect") == "off") {
24032
+ if (newSel && change.insert.length == 2)
24033
+ newSel = EditorSelection.single(newSel.main.anchor - 1, newSel.main.head - 1);
24034
+ change = { from: change.from, to: change.to, insert: Text.of([change.insert.toString().replace(".", " ")]) };
24024
24035
  } else if (change && change.from >= sel.from && change.to <= sel.to && (change.from != sel.from || change.to != sel.to) && sel.to - sel.from - (change.to - change.from) <= 4) {
24025
24036
  change = {
24026
24037
  from: sel.from,
24027
24038
  to: sel.to,
24028
24039
  insert: view.state.doc.slice(sel.from, change.from).append(change.insert).append(view.state.doc.slice(change.to, sel.to))
24029
24040
  };
24030
- } else if ((browser.mac || browser.android) && change && change.from == change.to && change.from == sel.head - 1 && /^\. ?$/.test(change.insert.toString()) && view.contentDOM.getAttribute("autocorrect") == "off") {
24031
- if (newSel && change.insert.length == 2)
24032
- newSel = EditorSelection.single(newSel.main.anchor - 1, newSel.main.head - 1);
24033
- change = { from: sel.from, to: sel.to, insert: Text.of([" "]) };
24034
24041
  } else if (browser.chrome && change && change.from == change.to && change.from == sel.head && change.insert.toString() == "\n " && view.lineWrapping) {
24035
24042
  if (newSel)
24036
24043
  newSel = EditorSelection.single(newSel.main.anchor - 1, newSel.main.head - 1);
@@ -25666,6 +25673,10 @@ function visiblePixelRange(dom, paddingTop) {
25666
25673
  bottom: Math.max(top2, bottom) - (rect.top + paddingTop)
25667
25674
  };
25668
25675
  }
25676
+ function inWindow(elt) {
25677
+ let rect = elt.getBoundingClientRect(), win = elt.ownerDocument.defaultView || window;
25678
+ return rect.left < win.innerWidth && rect.right > 0 && rect.top < win.innerHeight && rect.bottom > 0;
25679
+ }
25669
25680
  function fullPixelRange(dom, paddingTop) {
25670
25681
  let rect = dom.getBoundingClientRect();
25671
25682
  return {
@@ -25866,7 +25877,7 @@ class ViewState {
25866
25877
  if (inView)
25867
25878
  measureContent = true;
25868
25879
  }
25869
- if (!this.inView && !this.scrollTarget)
25880
+ if (!this.inView && !this.scrollTarget && !inWindow(view.dom))
25870
25881
  return 0;
25871
25882
  let contentWidth = domRect.width;
25872
25883
  if (this.contentDOMWidth != contentWidth || this.editorHeight != view.scrollDOM.clientHeight) {
@@ -26983,7 +26994,7 @@ class EditContextManager {
26983
26994
  selectionEnd: this.toContextPos(view.state.selection.main.head)
26984
26995
  });
26985
26996
  this.handlers.textupdate = (e) => {
26986
- let { anchor } = view.state.selection.main;
26997
+ let main = view.state.selection.main, { anchor, head } = main;
26987
26998
  let from = this.toEditorPos(e.updateRangeStart), to = this.toEditorPos(e.updateRangeEnd);
26988
26999
  if (view.inputState.composing >= 0 && !this.composing)
26989
27000
  this.composing = { contextBase: e.updateRangeStart, editorBase: from, drifted: false };
@@ -26992,8 +27003,14 @@ class EditContextManager {
26992
27003
  change.from = anchor;
26993
27004
  else if (change.to == this.to && anchor > this.to)
26994
27005
  change.to = anchor;
26995
- if (change.from == change.to && !change.insert.length)
27006
+ if (change.from == change.to && !change.insert.length) {
27007
+ let newSel = EditorSelection.single(this.toEditorPos(e.selectionStart), this.toEditorPos(e.selectionEnd));
27008
+ if (!newSel.main.eq(main))
27009
+ view.dispatch({ selection: newSel, userEvent: "select" });
26996
27010
  return;
27011
+ }
27012
+ if ((browser.mac || browser.android) && change.from == head - 1 && /^\. ?$/.test(e.text) && view.contentDOM.getAttribute("autocorrect") == "off")
27013
+ change = { from, to, insert: Text.of([e.text.replace(".", " ")]) };
26997
27014
  this.pendingContextChange = change;
26998
27015
  if (!view.state.readOnly) {
26999
27016
  let newLen = this.to - this.from + (change.to - change.from + change.insert.length);
@@ -53492,12 +53509,8 @@ const NavigationItemForm = ({
53492
53509
  );
53493
53510
  }
53494
53511
  };
53495
- const renderError = (error) => {
53496
- const errorOccurence = lodash$1.get(formError, error);
53497
- if (errorOccurence) {
53498
- return formatMessage(getTrad(error));
53499
- }
53500
- return void 0;
53512
+ const renderError = (field, messageKey) => {
53513
+ return lodash$1.get(formError, field) ? formatMessage(getTrad(messageKey ?? field)) : void 0;
53501
53514
  };
53502
53515
  const initialRelatedTypeSelected = current.type === "INTERNAL" ? current.relatedType : void 0;
53503
53516
  const {
@@ -53839,7 +53852,7 @@ const NavigationItemForm = ({
53839
53852
  label: formatMessage(
53840
53853
  getTrad(`popup.item.form.${pathSourceName}.label`, "Path")
53841
53854
  ),
53842
- error: renderError(pathSourceName),
53855
+ error: renderError(pathSourceName, `popup.item.form.${pathSourceName}.validation.type`),
53843
53856
  hint: [
53844
53857
  formatMessage(
53845
53858
  getTrad(`popup.item.form.${pathSourceName}.placeholder`, "e.g. Blog")
@@ -54603,10 +54616,10 @@ const TextArrayInput = ({ onChange, initialValue, ...props }) => {
54603
54616
  const [value, setValue] = React.useState(
54604
54617
  lodash$1.isArray(initialValue) ? initialValue.reduce((acc, cur2) => `${acc}${cur2}; `, "") : ""
54605
54618
  );
54606
- const handleOnChange = (value2) => {
54607
- const newValue = value2;
54608
- const valuesArray = newValue.split(";").map((v) => v.trim()).filter((v) => !!v.length);
54609
- setValue(value2);
54619
+ const handleOnChange = (event) => {
54620
+ const newValue = event?.target.value ?? "";
54621
+ const valuesArray = newValue.split(";").map((value2) => value2.trim()).filter((value2) => !!value2.length);
54622
+ setValue(newValue ?? "");
54610
54623
  onChange(valuesArray);
54611
54624
  };
54612
54625
  return /* @__PURE__ */ jsxRuntime.jsx(TextInput, { ...props, onChange: handleOnChange, value });
@@ -2499,7 +2499,7 @@ function isTopLayer(element) {
2499
2499
  function isContainingBlock(elementOrCss) {
2500
2500
  const webkit2 = isWebKit();
2501
2501
  const css2 = isElement(elementOrCss) ? getComputedStyle$1(elementOrCss) : elementOrCss;
2502
- return css2.transform !== "none" || css2.perspective !== "none" || (css2.containerType ? css2.containerType !== "normal" : false) || !webkit2 && (css2.backdropFilter ? css2.backdropFilter !== "none" : false) || !webkit2 && (css2.filter ? css2.filter !== "none" : false) || ["transform", "perspective", "filter"].some((value) => (css2.willChange || "").includes(value)) || ["paint", "layout", "strict", "content"].some((value) => (css2.contain || "").includes(value));
2502
+ return ["transform", "translate", "scale", "rotate", "perspective"].some((value) => css2[value] ? css2[value] !== "none" : false) || (css2.containerType ? css2.containerType !== "normal" : false) || !webkit2 && (css2.backdropFilter ? css2.backdropFilter !== "none" : false) || !webkit2 && (css2.filter ? css2.filter !== "none" : false) || ["transform", "translate", "scale", "rotate", "perspective", "filter"].some((value) => (css2.willChange || "").includes(value)) || ["paint", "layout", "strict", "content"].some((value) => (css2.contain || "").includes(value));
2503
2503
  }
2504
2504
  function getContainingBlock(element) {
2505
2505
  let currentNode = getParentNode(element);
@@ -3005,6 +3005,9 @@ const platform = {
3005
3005
  isElement,
3006
3006
  isRTL
3007
3007
  };
3008
+ function rectsAreEqual(a, b) {
3009
+ return a.x === b.x && a.y === b.y && a.width === b.width && a.height === b.height;
3010
+ }
3008
3011
  function observeMove(element, onMove) {
3009
3012
  let io = null;
3010
3013
  let timeoutId;
@@ -3023,12 +3026,13 @@ function observeMove(element, onMove) {
3023
3026
  threshold = 1;
3024
3027
  }
3025
3028
  cleanup();
3029
+ const elementRectForRootMargin = element.getBoundingClientRect();
3026
3030
  const {
3027
3031
  left,
3028
3032
  top: top2,
3029
3033
  width,
3030
3034
  height
3031
- } = element.getBoundingClientRect();
3035
+ } = elementRectForRootMargin;
3032
3036
  if (!skip) {
3033
3037
  onMove();
3034
3038
  }
@@ -3059,6 +3063,9 @@ function observeMove(element, onMove) {
3059
3063
  refresh(false, ratio);
3060
3064
  }
3061
3065
  }
3066
+ if (ratio === 1 && !rectsAreEqual(elementRectForRootMargin, element.getBoundingClientRect())) {
3067
+ refresh();
3068
+ }
3062
3069
  isFirstUpdate = false;
3063
3070
  }
3064
3071
  try {
@@ -3122,7 +3129,7 @@ function autoUpdate(reference, floating, update, options) {
3122
3129
  }
3123
3130
  function frameLoop() {
3124
3131
  const nextRefRect = getBoundingClientRect(reference);
3125
- if (prevRefRect && (nextRefRect.x !== prevRefRect.x || nextRefRect.y !== prevRefRect.y || nextRefRect.width !== prevRefRect.width || nextRefRect.height !== prevRefRect.height)) {
3132
+ if (prevRefRect && !rectsAreEqual(prevRefRect, nextRefRect)) {
3126
3133
  update();
3127
3134
  }
3128
3135
  prevRefRect = nextRefRect;
@@ -20153,7 +20160,7 @@ function findMinIndex(value, array) {
20153
20160
  }
20154
20161
  function countColumn(string2, tabSize, to = string2.length) {
20155
20162
  let n = 0;
20156
- for (let i = 0; i < to; ) {
20163
+ for (let i = 0; i < to && i < string2.length; ) {
20157
20164
  if (string2.charCodeAt(i) == 9) {
20158
20165
  n += tabSize - n % tabSize;
20159
20166
  i++;
@@ -24001,16 +24008,16 @@ function applyDOMChange(view, domChange) {
24001
24008
  return false;
24002
24009
  if (!change && domChange.typeOver && !sel.empty && newSel && newSel.main.empty) {
24003
24010
  change = { from: sel.from, to: sel.to, insert: view.state.doc.slice(sel.from, sel.to) };
24011
+ } else if ((browser.mac || browser.android) && change && change.from == change.to && change.from == sel.head - 1 && /^\. ?$/.test(change.insert.toString()) && view.contentDOM.getAttribute("autocorrect") == "off") {
24012
+ if (newSel && change.insert.length == 2)
24013
+ newSel = EditorSelection.single(newSel.main.anchor - 1, newSel.main.head - 1);
24014
+ change = { from: change.from, to: change.to, insert: Text.of([change.insert.toString().replace(".", " ")]) };
24004
24015
  } else if (change && change.from >= sel.from && change.to <= sel.to && (change.from != sel.from || change.to != sel.to) && sel.to - sel.from - (change.to - change.from) <= 4) {
24005
24016
  change = {
24006
24017
  from: sel.from,
24007
24018
  to: sel.to,
24008
24019
  insert: view.state.doc.slice(sel.from, change.from).append(change.insert).append(view.state.doc.slice(change.to, sel.to))
24009
24020
  };
24010
- } else if ((browser.mac || browser.android) && change && change.from == change.to && change.from == sel.head - 1 && /^\. ?$/.test(change.insert.toString()) && view.contentDOM.getAttribute("autocorrect") == "off") {
24011
- if (newSel && change.insert.length == 2)
24012
- newSel = EditorSelection.single(newSel.main.anchor - 1, newSel.main.head - 1);
24013
- change = { from: sel.from, to: sel.to, insert: Text.of([" "]) };
24014
24021
  } else if (browser.chrome && change && change.from == change.to && change.from == sel.head && change.insert.toString() == "\n " && view.lineWrapping) {
24015
24022
  if (newSel)
24016
24023
  newSel = EditorSelection.single(newSel.main.anchor - 1, newSel.main.head - 1);
@@ -25646,6 +25653,10 @@ function visiblePixelRange(dom, paddingTop) {
25646
25653
  bottom: Math.max(top2, bottom) - (rect.top + paddingTop)
25647
25654
  };
25648
25655
  }
25656
+ function inWindow(elt) {
25657
+ let rect = elt.getBoundingClientRect(), win = elt.ownerDocument.defaultView || window;
25658
+ return rect.left < win.innerWidth && rect.right > 0 && rect.top < win.innerHeight && rect.bottom > 0;
25659
+ }
25649
25660
  function fullPixelRange(dom, paddingTop) {
25650
25661
  let rect = dom.getBoundingClientRect();
25651
25662
  return {
@@ -25846,7 +25857,7 @@ class ViewState {
25846
25857
  if (inView)
25847
25858
  measureContent = true;
25848
25859
  }
25849
- if (!this.inView && !this.scrollTarget)
25860
+ if (!this.inView && !this.scrollTarget && !inWindow(view.dom))
25850
25861
  return 0;
25851
25862
  let contentWidth = domRect.width;
25852
25863
  if (this.contentDOMWidth != contentWidth || this.editorHeight != view.scrollDOM.clientHeight) {
@@ -26963,7 +26974,7 @@ class EditContextManager {
26963
26974
  selectionEnd: this.toContextPos(view.state.selection.main.head)
26964
26975
  });
26965
26976
  this.handlers.textupdate = (e) => {
26966
- let { anchor } = view.state.selection.main;
26977
+ let main = view.state.selection.main, { anchor, head } = main;
26967
26978
  let from = this.toEditorPos(e.updateRangeStart), to = this.toEditorPos(e.updateRangeEnd);
26968
26979
  if (view.inputState.composing >= 0 && !this.composing)
26969
26980
  this.composing = { contextBase: e.updateRangeStart, editorBase: from, drifted: false };
@@ -26972,8 +26983,14 @@ class EditContextManager {
26972
26983
  change.from = anchor;
26973
26984
  else if (change.to == this.to && anchor > this.to)
26974
26985
  change.to = anchor;
26975
- if (change.from == change.to && !change.insert.length)
26986
+ if (change.from == change.to && !change.insert.length) {
26987
+ let newSel = EditorSelection.single(this.toEditorPos(e.selectionStart), this.toEditorPos(e.selectionEnd));
26988
+ if (!newSel.main.eq(main))
26989
+ view.dispatch({ selection: newSel, userEvent: "select" });
26976
26990
  return;
26991
+ }
26992
+ if ((browser.mac || browser.android) && change.from == head - 1 && /^\. ?$/.test(e.text) && view.contentDOM.getAttribute("autocorrect") == "off")
26993
+ change = { from, to, insert: Text.of([e.text.replace(".", " ")]) };
26977
26994
  this.pendingContextChange = change;
26978
26995
  if (!view.state.readOnly) {
26979
26996
  let newLen = this.to - this.from + (change.to - change.from + change.insert.length);
@@ -53472,12 +53489,8 @@ const NavigationItemForm = ({
53472
53489
  );
53473
53490
  }
53474
53491
  };
53475
- const renderError = (error) => {
53476
- const errorOccurence = get(formError, error);
53477
- if (errorOccurence) {
53478
- return formatMessage(getTrad(error));
53479
- }
53480
- return void 0;
53492
+ const renderError = (field, messageKey) => {
53493
+ return get(formError, field) ? formatMessage(getTrad(messageKey ?? field)) : void 0;
53481
53494
  };
53482
53495
  const initialRelatedTypeSelected = current.type === "INTERNAL" ? current.relatedType : void 0;
53483
53496
  const {
@@ -53819,7 +53832,7 @@ const NavigationItemForm = ({
53819
53832
  label: formatMessage(
53820
53833
  getTrad(`popup.item.form.${pathSourceName}.label`, "Path")
53821
53834
  ),
53822
- error: renderError(pathSourceName),
53835
+ error: renderError(pathSourceName, `popup.item.form.${pathSourceName}.validation.type`),
53823
53836
  hint: [
53824
53837
  formatMessage(
53825
53838
  getTrad(`popup.item.form.${pathSourceName}.placeholder`, "e.g. Blog")
@@ -54583,10 +54596,10 @@ const TextArrayInput = ({ onChange, initialValue, ...props }) => {
54583
54596
  const [value, setValue] = useState(
54584
54597
  isArray(initialValue) ? initialValue.reduce((acc, cur2) => `${acc}${cur2}; `, "") : ""
54585
54598
  );
54586
- const handleOnChange = (value2) => {
54587
- const newValue = value2;
54588
- const valuesArray = newValue.split(";").map((v) => v.trim()).filter((v) => !!v.length);
54589
- setValue(value2);
54599
+ const handleOnChange = (event) => {
54600
+ const newValue = event?.target.value ?? "";
54601
+ const valuesArray = newValue.split(";").map((value2) => value2.trim()).filter((value2) => !!value2.length);
54602
+ setValue(newValue ?? "");
54590
54603
  onChange(valuesArray);
54591
54604
  };
54592
54605
  return /* @__PURE__ */ jsx(TextInput, { ...props, onChange: handleOnChange, value });
@@ -15521,11 +15521,12 @@ const clientService = (context) => ({
15521
15521
  return navigations;
15522
15522
  },
15523
15523
  renderRFRNavigationItem({ item }) {
15524
- const { uiRouterKey, title, path: path2, type: type2, audience: audience2 } = item;
15524
+ const { uiRouterKey, title, path: path2, type: type2, audience: audience2, additionalFields } = item;
15525
15525
  const itemCommon = {
15526
15526
  label: title,
15527
15527
  type: type2,
15528
- audience: audience2?.map(({ key }) => key)
15528
+ audience: audience2?.map(({ key }) => key),
15529
+ additionalFields
15529
15530
  };
15530
15531
  if (type2 === "WRAPPER") {
15531
15532
  return { ...itemCommon };
@@ -15554,7 +15555,11 @@ const clientService = (context) => ({
15554
15555
  throw new NavigationError("Unknown item type", item);
15555
15556
  },
15556
15557
  renderRFRPage({ item, parent, enabledCustomFieldsNames }) {
15557
- const { documentId, uiRouterKey, title, path: path2, related, type: type2, audience: audience2, menuAttached } = item;
15558
+ const { documentId, uiRouterKey, title, path: path2, related, type: type2, audience: audience2, menuAttached, additionalFields } = item;
15559
+ const additionalFieldsRendered = enabledCustomFieldsNames.reduce(
15560
+ (acc, field) => ({ ...acc, [field]: additionalFields?.[field] }),
15561
+ {}
15562
+ );
15558
15563
  return {
15559
15564
  id: uiRouterKey,
15560
15565
  documentId,
@@ -15567,10 +15572,7 @@ const clientService = (context) => ({
15567
15572
  parent,
15568
15573
  audience: audience2,
15569
15574
  menuAttached,
15570
- ...enabledCustomFieldsNames.reduce(
15571
- (acc, field) => ({ ...acc, [field]: ___default.get(item, field) }),
15572
- {}
15573
- )
15575
+ additionalFields: additionalFieldsRendered
15574
15576
  };
15575
15577
  },
15576
15578
  renderRFR({
@@ -15746,7 +15748,7 @@ const clientService = (context) => ({
15746
15748
  );
15747
15749
  const additionalFieldsMapper = (item) => (acc, field) => {
15748
15750
  const fieldDefinition = customFieldsDefinitions.find(({ name }) => name === field);
15749
- let content = ___default.get(item, `additionalFields.${field}`);
15751
+ let content = item.additionalFields?.[field];
15750
15752
  if (content) {
15751
15753
  switch (fieldDefinition?.type) {
15752
15754
  case "media":
@@ -15827,22 +15829,18 @@ const clientService = (context) => ({
15827
15829
  cache.set(documentId, nestedOrders);
15828
15830
  return nestedOrders;
15829
15831
  };
15830
- return result.map(({ additionalFields: additionalFields2, ...item }) => {
15831
- const customFields = enabledCustomFieldsNames.reduce(
15832
+ return result.map((item) => {
15833
+ const additionalFieldsMapped = enabledCustomFieldsNames.reduce(
15832
15834
  additionalFieldsMapper(item),
15833
15835
  {}
15834
15836
  );
15835
15837
  return {
15836
15838
  ...item,
15837
15839
  audience: item.audience?.map((_) => _.key),
15838
- title: composeItemTitle(
15839
- { ...item, additionalFields: additionalFields2 },
15840
- contentTypesNameFields2,
15841
- contentTypes2
15842
- ) || "",
15840
+ title: composeItemTitle(item, contentTypesNameFields2, contentTypes2) || "",
15843
15841
  related: wrapContentType(item.related),
15844
15842
  items: null,
15845
- ...customFields
15843
+ additionalFields: additionalFieldsMapped
15846
15844
  };
15847
15845
  }).sort(
15848
15846
  (a, b) => compareArraysOfNumbers(getNestedOrders(a.documentId), getNestedOrders(b.documentId))
@@ -15483,11 +15483,12 @@ const clientService = (context) => ({
15483
15483
  return navigations;
15484
15484
  },
15485
15485
  renderRFRNavigationItem({ item }) {
15486
- const { uiRouterKey, title, path: path2, type: type2, audience: audience2 } = item;
15486
+ const { uiRouterKey, title, path: path2, type: type2, audience: audience2, additionalFields } = item;
15487
15487
  const itemCommon = {
15488
15488
  label: title,
15489
15489
  type: type2,
15490
- audience: audience2?.map(({ key }) => key)
15490
+ audience: audience2?.map(({ key }) => key),
15491
+ additionalFields
15491
15492
  };
15492
15493
  if (type2 === "WRAPPER") {
15493
15494
  return { ...itemCommon };
@@ -15516,7 +15517,11 @@ const clientService = (context) => ({
15516
15517
  throw new NavigationError("Unknown item type", item);
15517
15518
  },
15518
15519
  renderRFRPage({ item, parent, enabledCustomFieldsNames }) {
15519
- const { documentId, uiRouterKey, title, path: path2, related, type: type2, audience: audience2, menuAttached } = item;
15520
+ const { documentId, uiRouterKey, title, path: path2, related, type: type2, audience: audience2, menuAttached, additionalFields } = item;
15521
+ const additionalFieldsRendered = enabledCustomFieldsNames.reduce(
15522
+ (acc, field) => ({ ...acc, [field]: additionalFields?.[field] }),
15523
+ {}
15524
+ );
15520
15525
  return {
15521
15526
  id: uiRouterKey,
15522
15527
  documentId,
@@ -15529,10 +15534,7 @@ const clientService = (context) => ({
15529
15534
  parent,
15530
15535
  audience: audience2,
15531
15536
  menuAttached,
15532
- ...enabledCustomFieldsNames.reduce(
15533
- (acc, field) => ({ ...acc, [field]: get$1(item, field) }),
15534
- {}
15535
- )
15537
+ additionalFields: additionalFieldsRendered
15536
15538
  };
15537
15539
  },
15538
15540
  renderRFR({
@@ -15708,7 +15710,7 @@ const clientService = (context) => ({
15708
15710
  );
15709
15711
  const additionalFieldsMapper = (item) => (acc, field) => {
15710
15712
  const fieldDefinition = customFieldsDefinitions.find(({ name }) => name === field);
15711
- let content = get$1(item, `additionalFields.${field}`);
15713
+ let content = item.additionalFields?.[field];
15712
15714
  if (content) {
15713
15715
  switch (fieldDefinition?.type) {
15714
15716
  case "media":
@@ -15789,22 +15791,18 @@ const clientService = (context) => ({
15789
15791
  cache.set(documentId, nestedOrders);
15790
15792
  return nestedOrders;
15791
15793
  };
15792
- return result.map(({ additionalFields: additionalFields2, ...item }) => {
15793
- const customFields = enabledCustomFieldsNames.reduce(
15794
+ return result.map((item) => {
15795
+ const additionalFieldsMapped = enabledCustomFieldsNames.reduce(
15794
15796
  additionalFieldsMapper(item),
15795
15797
  {}
15796
15798
  );
15797
15799
  return {
15798
15800
  ...item,
15799
15801
  audience: item.audience?.map((_) => _.key),
15800
- title: composeItemTitle(
15801
- { ...item, additionalFields: additionalFields2 },
15802
- contentTypesNameFields2,
15803
- contentTypes2
15804
- ) || "",
15802
+ title: composeItemTitle(item, contentTypesNameFields2, contentTypes2) || "",
15805
15803
  related: wrapContentType(item.related),
15806
15804
  items: null,
15807
- ...customFields
15805
+ additionalFields: additionalFieldsMapped
15808
15806
  };
15809
15807
  }).sort(
15810
15808
  (a, b) => compareArraysOfNumbers(getNestedOrders(a.documentId), getNestedOrders(b.documentId))
@@ -77,6 +77,7 @@ export default function clientController(context: {
77
77
  title: string;
78
78
  related: any;
79
79
  items: null;
80
+ additionalFields: {};
80
81
  path?: string | null | undefined;
81
82
  type: "INTERNAL" | "EXTERNAL" | "WRAPPER";
82
83
  id: number;
@@ -99,6 +100,7 @@ export default function clientController(context: {
99
100
  title: string;
100
101
  related: any;
101
102
  items: null;
103
+ additionalFields: {};
102
104
  path?: string | null | undefined;
103
105
  type: "INTERNAL" | "EXTERNAL" | "WRAPPER";
104
106
  id: number;
@@ -121,6 +123,7 @@ export default function clientController(context: {
121
123
  title: string;
122
124
  related: any;
123
125
  items: null;
126
+ additionalFields: {};
124
127
  path?: string | null | undefined;
125
128
  type: "INTERNAL" | "EXTERNAL" | "WRAPPER";
126
129
  id: number;
@@ -153,6 +156,7 @@ export default function clientController(context: {
153
156
  title: string;
154
157
  related: any;
155
158
  items: null;
159
+ additionalFields: {};
156
160
  path?: string | null | undefined;
157
161
  type: "INTERNAL" | "EXTERNAL" | "WRAPPER";
158
162
  id: number;
@@ -175,6 +179,7 @@ export default function clientController(context: {
175
179
  title: string;
176
180
  related: any;
177
181
  items: null;
182
+ additionalFields: {};
178
183
  path?: string | null | undefined;
179
184
  type: "INTERNAL" | "EXTERNAL" | "WRAPPER";
180
185
  id: number;
@@ -14,6 +14,7 @@ export declare const renderNavigationChild: ({ strapi, nexus }: any) => {
14
14
  title: string;
15
15
  related: any;
16
16
  items: null;
17
+ additionalFields: {};
17
18
  path?: string | null | undefined;
18
19
  type: "INTERNAL" | "EXTERNAL" | "WRAPPER";
19
20
  id: number;
@@ -15,6 +15,7 @@ export declare const renderNavigation: ({ strapi, nexus }: any) => {
15
15
  title: string;
16
16
  related: any;
17
17
  items: null;
18
+ additionalFields: {};
18
19
  path?: string | null | undefined;
19
20
  type: "INTERNAL" | "EXTERNAL" | "WRAPPER";
20
21
  id: number;
@@ -511,6 +511,7 @@ declare const _default: {
511
511
  title: string;
512
512
  related: any;
513
513
  items: null;
514
+ additionalFields: {};
514
515
  path?: string | null | undefined;
515
516
  type: "INTERNAL" | "EXTERNAL" | "WRAPPER";
516
517
  id: number;
@@ -533,6 +534,7 @@ declare const _default: {
533
534
  title: string;
534
535
  related: any;
535
536
  items: null;
537
+ additionalFields: {};
536
538
  path?: string | null | undefined;
537
539
  type: "INTERNAL" | "EXTERNAL" | "WRAPPER";
538
540
  id: number;
@@ -555,6 +557,7 @@ declare const _default: {
555
557
  title: string;
556
558
  related: any;
557
559
  items: null;
560
+ additionalFields: {};
558
561
  path?: string | null | undefined;
559
562
  type: "INTERNAL" | "EXTERNAL" | "WRAPPER";
560
563
  id: number;
@@ -31,6 +31,7 @@ declare const clientService: (context: {
31
31
  title: string;
32
32
  related: any;
33
33
  items: null;
34
+ additionalFields: {};
34
35
  path?: string | null | undefined;
35
36
  type: "INTERNAL" | "EXTERNAL" | "WRAPPER";
36
37
  id: number;
@@ -53,6 +54,7 @@ declare const clientService: (context: {
53
54
  title: string;
54
55
  related: any;
55
56
  items: null;
57
+ additionalFields: {};
56
58
  path?: string | null | undefined;
57
59
  type: "INTERNAL" | "EXTERNAL" | "WRAPPER";
58
60
  id: number;
@@ -75,6 +77,7 @@ declare const clientService: (context: {
75
77
  title: string;
76
78
  related: any;
77
79
  items: null;
80
+ additionalFields: {};
78
81
  path?: string | null | undefined;
79
82
  type: "INTERNAL" | "EXTERNAL" | "WRAPPER";
80
83
  id: number;
@@ -24,7 +24,7 @@ export interface RenderRFRInput {
24
24
  enabledCustomFieldsNames: string[];
25
25
  }
26
26
  export interface RenderRFRNavInput {
27
- item: Pick<NavigationItemDTO, 'uiRouterKey' | 'title' | 'path' | 'type' | 'audience'>;
27
+ item: Pick<NavigationItemDTO, 'uiRouterKey' | 'title' | 'path' | 'type' | 'audience' | 'additionalFields'>;
28
28
  }
29
29
  export interface RenderRFRPageInput {
30
30
  item: Omit<NavigationItemDTO, 'items' | 'parent' | 'master'>;
@@ -252,6 +252,7 @@ declare const _default: {
252
252
  title: string;
253
253
  related: any;
254
254
  items: null;
255
+ additionalFields: {};
255
256
  path?: string | null | undefined;
256
257
  type: "INTERNAL" | "EXTERNAL" | "WRAPPER";
257
258
  id: number;
@@ -274,6 +275,7 @@ declare const _default: {
274
275
  title: string;
275
276
  related: any;
276
277
  items: null;
278
+ additionalFields: {};
277
279
  path?: string | null | undefined;
278
280
  type: "INTERNAL" | "EXTERNAL" | "WRAPPER";
279
281
  id: number;
@@ -296,6 +298,7 @@ declare const _default: {
296
298
  title: string;
297
299
  related: any;
298
300
  items: null;
301
+ additionalFields: {};
299
302
  path?: string | null | undefined;
300
303
  type: "INTERNAL" | "EXTERNAL" | "WRAPPER";
301
304
  id: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "strapi-plugin-navigation",
3
- "version": "3.0.4",
3
+ "version": "3.0.5",
4
4
  "description": "Strapi - Navigation plugin",
5
5
  "strapi": {
6
6
  "name": "navigation",
@@ -60,11 +60,11 @@
60
60
  "@sensinum/strapi-utils": "^1.0.4",
61
61
  "@strapi/design-system": "2.0.0-rc.14",
62
62
  "@strapi/icons": "2.0.0-rc.14",
63
- "@strapi/plugin-graphql": "^5.6.0",
63
+ "@strapi/plugin-graphql": "^5.7.0",
64
64
  "@strapi/sdk-plugin": "^5.2.8",
65
- "@strapi/strapi": "^5.6.0",
66
- "@strapi/types": "^5.6.0",
67
- "@strapi/typescript-utils": "^5.6.0",
65
+ "@strapi/strapi": "^5.7.0",
66
+ "@strapi/types": "^5.7.0",
67
+ "@strapi/typescript-utils": "^5.7.0",
68
68
  "@types/jest": "^29.5.12",
69
69
  "@types/koa": "^2.15.0",
70
70
  "@types/koa-bodyparser": "^4.3.12",
@@ -101,7 +101,7 @@
101
101
  },
102
102
  "peerDependencies": {
103
103
  "@strapi/sdk-plugin": "^5.2.8",
104
- "@strapi/strapi": "^5.6.0",
104
+ "@strapi/strapi": "^5.7.0",
105
105
  "react": "^18.3.1",
106
106
  "react-dom": "^18.3.1",
107
107
  "react-router-dom": "^6.26.2",