ode-explorer 1.4.0 → 1.4.1

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/dist/index.html CHANGED
@@ -15,16 +15,22 @@
15
15
  <div id="portal"></div>
16
16
  <!-- SET INITIALISATION CONFIG -->
17
17
  <script>
18
- var WORFLOW_ACCESS = "org.entcore.blog.controllers.BlogController|blog";
18
+ var WORFLOW_ACCESS =
19
+ "net.atos.entng.mindmap.controllers.MindmapController|view";
19
20
  var WORKFLOW_CREATE =
20
- "org.entcore.blog.controllers.BlogController|create";
21
+ "net.atos.entng.mindmap.controllers.MindmapController|create";
22
+ var WORKFLOW_PRINT =
23
+ "net.atos.entng.mindmap.controllers.MindmapController|printView";
24
+ var WORKFLOW_EXPORT_PNG =
25
+ "net.atos.entng.mindmap.controllers.MindmapController|exportPngMindmap";
26
+ var WORKFLOW_EXPORT_SVG =
27
+ "net.atos.entng.mindmap.controllers.MindmapController|exportSvgMindmap";
21
28
  var WORKFLOW_PUBLISH =
22
- "org.entcore.blog.controllers.BlogController|publish";
23
- var WORKFLOW_PRINT = "org.entcore.blog.controllers.BlogController|print";
24
- ///////////
29
+ "net.atos.entng.mindmap.controllers.MindmapController|publish";
25
30
  var explorerConfig = {
26
- app: "blog",
27
- types: ["blog"],
31
+ app: "mindmap",
32
+ types: ["mindmap"],
33
+ libraryAppFilter: "MindMap",
28
34
  filters: [
29
35
  { id: "owner", defaultValue: true },
30
36
  { id: "public", defaultValue: false },
@@ -59,10 +65,10 @@
59
65
  target: "tree",
60
66
  },
61
67
  {
62
- id: "createPublic",
63
- workflow:
64
- "org.entcore.blog.controllers.BlogController|createPublicBlog",
65
- target: "tree",
68
+ id: "copy",
69
+ workflow: WORFLOW_ACCESS,
70
+ target: "actionbar",
71
+ right: "read",
66
72
  },
67
73
  {
68
74
  id: "move",
package/dist/index.js CHANGED
@@ -39588,10 +39588,13 @@ var defaultFormat = formats$2["default"];
39588
39588
  var defaults$2 = {
39589
39589
  addQueryPrefix: false,
39590
39590
  allowDots: false,
39591
+ allowEmptyArrays: false,
39592
+ arrayFormat: "indices",
39591
39593
  charset: "utf-8",
39592
39594
  charsetSentinel: false,
39593
39595
  delimiter: "&",
39594
39596
  encode: true,
39597
+ encodeDotInKeys: false,
39595
39598
  encoder: utils$1.encode,
39596
39599
  encodeValuesOnly: false,
39597
39600
  format: defaultFormat,
@@ -39608,7 +39611,7 @@ var isNonNullishPrimitive = function isNonNullishPrimitive2(v2) {
39608
39611
  return typeof v2 === "string" || typeof v2 === "number" || typeof v2 === "boolean" || typeof v2 === "symbol" || typeof v2 === "bigint";
39609
39612
  };
39610
39613
  var sentinel = {};
39611
- var stringify$1 = function stringify(object, prefix2, generateArrayPrefix, commaRoundTrip, strictNullHandling, skipNulls, encoder, filter, sort, allowDots, serializeDate2, format, formatter, encodeValuesOnly, charset, sideChannel2) {
39614
+ var stringify$1 = function stringify(object, prefix2, generateArrayPrefix, commaRoundTrip, allowEmptyArrays, strictNullHandling, skipNulls, encodeDotInKeys, encoder, filter, sort, allowDots, serializeDate2, format, formatter, encodeValuesOnly, charset, sideChannel2) {
39612
39615
  var obj = object;
39613
39616
  var tmpSc = sideChannel2;
39614
39617
  var step = 0;
@@ -39668,14 +39671,19 @@ var stringify$1 = function stringify(object, prefix2, generateArrayPrefix, comma
39668
39671
  var keys = Object.keys(obj);
39669
39672
  objKeys = sort ? keys.sort(sort) : keys;
39670
39673
  }
39671
- var adjustedPrefix = commaRoundTrip && isArray$1(obj) && obj.length === 1 ? prefix2 + "[]" : prefix2;
39674
+ var encodedPrefix = encodeDotInKeys ? prefix2.replace(/\./g, "%2E") : prefix2;
39675
+ var adjustedPrefix = commaRoundTrip && isArray$1(obj) && obj.length === 1 ? encodedPrefix + "[]" : encodedPrefix;
39676
+ if (allowEmptyArrays && isArray$1(obj) && obj.length === 0) {
39677
+ return adjustedPrefix + "[]";
39678
+ }
39672
39679
  for (var j2 = 0; j2 < objKeys.length; ++j2) {
39673
39680
  var key = objKeys[j2];
39674
39681
  var value = typeof key === "object" && typeof key.value !== "undefined" ? key.value : obj[key];
39675
39682
  if (skipNulls && value === null) {
39676
39683
  continue;
39677
39684
  }
39678
- var keyPrefix = isArray$1(obj) ? typeof generateArrayPrefix === "function" ? generateArrayPrefix(adjustedPrefix, key) : adjustedPrefix : adjustedPrefix + (allowDots ? "." + key : "[" + key + "]");
39685
+ var encodedKey = allowDots && encodeDotInKeys ? key.replace(/\./g, "%2E") : key;
39686
+ var keyPrefix = isArray$1(obj) ? typeof generateArrayPrefix === "function" ? generateArrayPrefix(adjustedPrefix, encodedKey) : adjustedPrefix : adjustedPrefix + (allowDots ? "." + encodedKey : "[" + encodedKey + "]");
39679
39687
  sideChannel2.set(object, step);
39680
39688
  var valueSideChannel = getSideChannel2();
39681
39689
  valueSideChannel.set(sentinel, sideChannel2);
@@ -39684,8 +39692,10 @@ var stringify$1 = function stringify(object, prefix2, generateArrayPrefix, comma
39684
39692
  keyPrefix,
39685
39693
  generateArrayPrefix,
39686
39694
  commaRoundTrip,
39695
+ allowEmptyArrays,
39687
39696
  strictNullHandling,
39688
39697
  skipNulls,
39698
+ encodeDotInKeys,
39689
39699
  generateArrayPrefix === "comma" && encodeValuesOnly && isArray$1(obj) ? null : encoder,
39690
39700
  filter,
39691
39701
  sort,
@@ -39704,6 +39714,12 @@ var normalizeStringifyOptions = function normalizeStringifyOptions2(opts) {
39704
39714
  if (!opts) {
39705
39715
  return defaults$2;
39706
39716
  }
39717
+ if (typeof opts.allowEmptyArrays !== "undefined" && typeof opts.allowEmptyArrays !== "boolean") {
39718
+ throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");
39719
+ }
39720
+ if (typeof opts.encodeDotInKeys !== "undefined" && typeof opts.encodeDotInKeys !== "boolean") {
39721
+ throw new TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");
39722
+ }
39707
39723
  if (opts.encoder !== null && typeof opts.encoder !== "undefined" && typeof opts.encoder !== "function") {
39708
39724
  throw new TypeError("Encoder has to be a function.");
39709
39725
  }
@@ -39723,13 +39739,29 @@ var normalizeStringifyOptions = function normalizeStringifyOptions2(opts) {
39723
39739
  if (typeof opts.filter === "function" || isArray$1(opts.filter)) {
39724
39740
  filter = opts.filter;
39725
39741
  }
39742
+ var arrayFormat;
39743
+ if (opts.arrayFormat in arrayPrefixGenerators) {
39744
+ arrayFormat = opts.arrayFormat;
39745
+ } else if ("indices" in opts) {
39746
+ arrayFormat = opts.indices ? "indices" : "repeat";
39747
+ } else {
39748
+ arrayFormat = defaults$2.arrayFormat;
39749
+ }
39750
+ if ("commaRoundTrip" in opts && typeof opts.commaRoundTrip !== "boolean") {
39751
+ throw new TypeError("`commaRoundTrip` must be a boolean, or absent");
39752
+ }
39753
+ var allowDots = typeof opts.allowDots === "undefined" ? opts.encodeDotInKeys === true ? true : defaults$2.allowDots : !!opts.allowDots;
39726
39754
  return {
39727
39755
  addQueryPrefix: typeof opts.addQueryPrefix === "boolean" ? opts.addQueryPrefix : defaults$2.addQueryPrefix,
39728
- allowDots: typeof opts.allowDots === "undefined" ? defaults$2.allowDots : !!opts.allowDots,
39756
+ allowDots,
39757
+ allowEmptyArrays: typeof opts.allowEmptyArrays === "boolean" ? !!opts.allowEmptyArrays : defaults$2.allowEmptyArrays,
39758
+ arrayFormat,
39729
39759
  charset,
39730
39760
  charsetSentinel: typeof opts.charsetSentinel === "boolean" ? opts.charsetSentinel : defaults$2.charsetSentinel,
39761
+ commaRoundTrip: opts.commaRoundTrip,
39731
39762
  delimiter: typeof opts.delimiter === "undefined" ? defaults$2.delimiter : opts.delimiter,
39732
39763
  encode: typeof opts.encode === "boolean" ? opts.encode : defaults$2.encode,
39764
+ encodeDotInKeys: typeof opts.encodeDotInKeys === "boolean" ? opts.encodeDotInKeys : defaults$2.encodeDotInKeys,
39733
39765
  encoder: typeof opts.encoder === "function" ? opts.encoder : defaults$2.encoder,
39734
39766
  encodeValuesOnly: typeof opts.encodeValuesOnly === "boolean" ? opts.encodeValuesOnly : defaults$2.encodeValuesOnly,
39735
39767
  filter,
@@ -39757,19 +39789,8 @@ var stringify_1 = function(object, opts) {
39757
39789
  if (typeof obj !== "object" || obj === null) {
39758
39790
  return "";
39759
39791
  }
39760
- var arrayFormat;
39761
- if (opts && opts.arrayFormat in arrayPrefixGenerators) {
39762
- arrayFormat = opts.arrayFormat;
39763
- } else if (opts && "indices" in opts) {
39764
- arrayFormat = opts.indices ? "indices" : "repeat";
39765
- } else {
39766
- arrayFormat = "indices";
39767
- }
39768
- var generateArrayPrefix = arrayPrefixGenerators[arrayFormat];
39769
- if (opts && "commaRoundTrip" in opts && typeof opts.commaRoundTrip !== "boolean") {
39770
- throw new TypeError("`commaRoundTrip` must be a boolean, or absent");
39771
- }
39772
- var commaRoundTrip = generateArrayPrefix === "comma" && opts && opts.commaRoundTrip;
39792
+ var generateArrayPrefix = arrayPrefixGenerators[options.arrayFormat];
39793
+ var commaRoundTrip = generateArrayPrefix === "comma" && options.commaRoundTrip;
39773
39794
  if (!objKeys) {
39774
39795
  objKeys = Object.keys(obj);
39775
39796
  }
@@ -39787,8 +39808,10 @@ var stringify_1 = function(object, opts) {
39787
39808
  key,
39788
39809
  generateArrayPrefix,
39789
39810
  commaRoundTrip,
39811
+ options.allowEmptyArrays,
39790
39812
  options.strictNullHandling,
39791
39813
  options.skipNulls,
39814
+ options.encodeDotInKeys,
39792
39815
  options.encode ? options.encoder : null,
39793
39816
  options.filter,
39794
39817
  options.sort,
@@ -39817,15 +39840,18 @@ var has = Object.prototype.hasOwnProperty;
39817
39840
  var isArray = Array.isArray;
39818
39841
  var defaults$1 = {
39819
39842
  allowDots: false,
39843
+ allowEmptyArrays: false,
39820
39844
  allowPrototypes: false,
39821
39845
  allowSparse: false,
39822
39846
  arrayLimit: 20,
39823
39847
  charset: "utf-8",
39824
39848
  charsetSentinel: false,
39825
39849
  comma: false,
39850
+ decodeDotInKeys: true,
39826
39851
  decoder: utils.decode,
39827
39852
  delimiter: "&",
39828
39853
  depth: 5,
39854
+ duplicates: "combine",
39829
39855
  ignoreQueryPrefix: false,
39830
39856
  interpretNumericEntities: false,
39831
39857
  parameterLimit: 1e3,
@@ -39893,9 +39919,10 @@ var parseValues = function parseQueryStringValues(str, options) {
39893
39919
  if (part.indexOf("[]=") > -1) {
39894
39920
  val = isArray(val) ? [val] : val;
39895
39921
  }
39896
- if (has.call(obj, key)) {
39922
+ var existing = has.call(obj, key);
39923
+ if (existing && options.duplicates === "combine") {
39897
39924
  obj[key] = utils.combine(obj[key], val);
39898
- } else {
39925
+ } else if (!existing || options.duplicates === "last") {
39899
39926
  obj[key] = val;
39900
39927
  }
39901
39928
  }
@@ -39907,18 +39934,19 @@ var parseObject = function(chain, val, options, valuesParsed) {
39907
39934
  var obj;
39908
39935
  var root2 = chain[i2];
39909
39936
  if (root2 === "[]" && options.parseArrays) {
39910
- obj = [].concat(leaf);
39937
+ obj = options.allowEmptyArrays && leaf === "" ? [] : [].concat(leaf);
39911
39938
  } else {
39912
39939
  obj = options.plainObjects ? /* @__PURE__ */ Object.create(null) : {};
39913
39940
  var cleanRoot = root2.charAt(0) === "[" && root2.charAt(root2.length - 1) === "]" ? root2.slice(1, -1) : root2;
39914
- var index2 = parseInt(cleanRoot, 10);
39915
- if (!options.parseArrays && cleanRoot === "") {
39941
+ var decodedRoot = options.decodeDotInKeys ? cleanRoot.replace(/%2E/g, ".") : cleanRoot;
39942
+ var index2 = parseInt(decodedRoot, 10);
39943
+ if (!options.parseArrays && decodedRoot === "") {
39916
39944
  obj = { 0: leaf };
39917
- } else if (!isNaN(index2) && root2 !== cleanRoot && String(index2) === cleanRoot && index2 >= 0 && (options.parseArrays && index2 <= options.arrayLimit)) {
39945
+ } else if (!isNaN(index2) && root2 !== decodedRoot && String(index2) === decodedRoot && index2 >= 0 && (options.parseArrays && index2 <= options.arrayLimit)) {
39918
39946
  obj = [];
39919
39947
  obj[index2] = leaf;
39920
- } else if (cleanRoot !== "__proto__") {
39921
- obj[cleanRoot] = leaf;
39948
+ } else if (decodedRoot !== "__proto__") {
39949
+ obj[decodedRoot] = leaf;
39922
39950
  }
39923
39951
  }
39924
39952
  leaf = obj;
@@ -39962,25 +39990,39 @@ var normalizeParseOptions = function normalizeParseOptions2(opts) {
39962
39990
  if (!opts) {
39963
39991
  return defaults$1;
39964
39992
  }
39965
- if (opts.decoder !== null && opts.decoder !== void 0 && typeof opts.decoder !== "function") {
39993
+ if (typeof opts.allowEmptyArrays !== "undefined" && typeof opts.allowEmptyArrays !== "boolean") {
39994
+ throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");
39995
+ }
39996
+ if (typeof opts.decodeDotInKeys !== "undefined" && typeof opts.decodeDotInKeys !== "boolean") {
39997
+ throw new TypeError("`decodeDotInKeys` option can only be `true` or `false`, when provided");
39998
+ }
39999
+ if (opts.decoder !== null && typeof opts.decoder !== "undefined" && typeof opts.decoder !== "function") {
39966
40000
  throw new TypeError("Decoder has to be a function.");
39967
40001
  }
39968
40002
  if (typeof opts.charset !== "undefined" && opts.charset !== "utf-8" && opts.charset !== "iso-8859-1") {
39969
40003
  throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");
39970
40004
  }
39971
40005
  var charset = typeof opts.charset === "undefined" ? defaults$1.charset : opts.charset;
40006
+ var duplicates = typeof opts.duplicates === "undefined" ? defaults$1.duplicates : opts.duplicates;
40007
+ if (duplicates !== "combine" && duplicates !== "first" && duplicates !== "last") {
40008
+ throw new TypeError("The duplicates option must be either combine, first, or last");
40009
+ }
40010
+ var allowDots = typeof opts.allowDots === "undefined" ? opts.decodeDotInKeys === true ? true : defaults$1.allowDots : !!opts.allowDots;
39972
40011
  return {
39973
- allowDots: typeof opts.allowDots === "undefined" ? defaults$1.allowDots : !!opts.allowDots,
40012
+ allowDots,
40013
+ allowEmptyArrays: typeof opts.allowEmptyArrays === "boolean" ? !!opts.allowEmptyArrays : defaults$1.allowEmptyArrays,
39974
40014
  allowPrototypes: typeof opts.allowPrototypes === "boolean" ? opts.allowPrototypes : defaults$1.allowPrototypes,
39975
40015
  allowSparse: typeof opts.allowSparse === "boolean" ? opts.allowSparse : defaults$1.allowSparse,
39976
40016
  arrayLimit: typeof opts.arrayLimit === "number" ? opts.arrayLimit : defaults$1.arrayLimit,
39977
40017
  charset,
39978
40018
  charsetSentinel: typeof opts.charsetSentinel === "boolean" ? opts.charsetSentinel : defaults$1.charsetSentinel,
39979
40019
  comma: typeof opts.comma === "boolean" ? opts.comma : defaults$1.comma,
40020
+ decodeDotInKeys: typeof opts.decodeDotInKeys === "boolean" ? opts.decodeDotInKeys : defaults$1.decodeDotInKeys,
39980
40021
  decoder: typeof opts.decoder === "function" ? opts.decoder : defaults$1.decoder,
39981
40022
  delimiter: typeof opts.delimiter === "string" || utils.isRegExp(opts.delimiter) ? opts.delimiter : defaults$1.delimiter,
39982
40023
  // eslint-disable-next-line no-implicit-coercion, no-extra-parens
39983
40024
  depth: typeof opts.depth === "number" || opts.depth === false ? +opts.depth : defaults$1.depth,
40025
+ duplicates,
39984
40026
  ignoreQueryPrefix: opts.ignoreQueryPrefix === true,
39985
40027
  interpretNumericEntities: typeof opts.interpretNumericEntities === "boolean" ? opts.interpretNumericEntities : defaults$1.interpretNumericEntities,
39986
40028
  parameterLimit: typeof opts.parameterLimit === "number" ? opts.parameterLimit : defaults$1.parameterLimit,
@@ -62272,7 +62314,7 @@ const ActionBar$1 = /* @__PURE__ */ reactExports.forwardRef(({
62272
62314
  const classes2 = clsx("d-flex flex-wrap p-16 gap-8 border-bottom bg-white", {
62273
62315
  "justify-content-between": render,
62274
62316
  "mx-n16": !isFullscreen,
62275
- "z-2000 top-0 start-0 end-0": isFullscreen
62317
+ "z-3 top-0 start-0 end-0": isFullscreen
62276
62318
  });
62277
62319
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { ref: ref2, className: classes2, ...restProps, children: [
62278
62320
  children,
@@ -62553,7 +62595,7 @@ const useDropdown = (placement, extraTriggerKeyDownHandler) => {
62553
62595
  rects,
62554
62596
  elements
62555
62597
  }) {
62556
- elements.floating.style, `${rects.reference.width}`;
62598
+ elements.floating.style.minWidth = `${rects.reference.width}px`;
62557
62599
  }
62558
62600
  }), flip$2({
62559
62601
  padding: 0
@@ -62720,22 +62762,28 @@ const useDropdown = (placement, extraTriggerKeyDownHandler) => {
62720
62762
  function useToast() {
62721
62763
  return {
62722
62764
  success: (message, options) => _t.custom(/* @__PURE__ */ jsxRuntimeExports.jsx(Alert$1, { type: "success", isToast: true, isDismissible: options == null ? void 0 : options.isDismissible, className: "mb-12", children: message }), {
62765
+ id: options == null ? void 0 : options.id,
62723
62766
  duration: options == null ? void 0 : options.duration,
62724
62767
  position: (options == null ? void 0 : options.position) ?? DEFAULT_POSITION
62725
62768
  }),
62726
62769
  error: (message, options) => _t.custom(/* @__PURE__ */ jsxRuntimeExports.jsx(Alert$1, { type: "danger", isToast: true, isDismissible: options == null ? void 0 : options.isDismissible, className: "mb-12", children: message }), {
62770
+ id: options == null ? void 0 : options.id,
62727
62771
  duration: options == null ? void 0 : options.duration,
62728
62772
  position: (options == null ? void 0 : options.position) ?? DEFAULT_POSITION
62729
62773
  }),
62730
62774
  info: (message, options) => _t.custom(/* @__PURE__ */ jsxRuntimeExports.jsx(Alert$1, { type: "info", isToast: true, isDismissible: options == null ? void 0 : options.isDismissible, className: "mb-12", children: message }), {
62775
+ id: options == null ? void 0 : options.id,
62731
62776
  duration: options == null ? void 0 : options.duration,
62732
62777
  position: (options == null ? void 0 : options.position) ?? DEFAULT_POSITION
62733
62778
  }),
62734
62779
  warning: (message, options) => _t.custom(/* @__PURE__ */ jsxRuntimeExports.jsx(Alert$1, { type: "warning", isToast: true, isDismissible: options == null ? void 0 : options.isDismissible, className: "mb-12", children: message }), {
62780
+ id: options == null ? void 0 : options.id,
62735
62781
  duration: options == null ? void 0 : options.duration,
62736
62782
  position: (options == null ? void 0 : options.position) ?? DEFAULT_POSITION
62737
62783
  }),
62738
- loading: _t.loading
62784
+ loading: _t.loading,
62785
+ dismiss: (id2) => _t.dismiss(id2),
62786
+ remove: (id2) => _t.remove(id2)
62739
62787
  };
62740
62788
  }
62741
62789
  function useHover() {
@@ -62855,13 +62903,16 @@ const useLibraryUrl = () => {
62855
62903
  const {
62856
62904
  user,
62857
62905
  appCode
62858
- } = useOdeClient(), appName = libraryMaps[appCode], libraryUrlSplitted = (_a2 = user.apps.find((app) => app.isExternal && app.address.includes("library") && app.name.includes("library"))) == null ? void 0 : _a2.address.split("?");
62859
- let libraryHost = libraryUrlSplitted == null ? void 0 : libraryUrlSplitted[0];
62860
- libraryHost != null && libraryHost.endsWith("/") || (libraryHost = `${libraryHost}/`);
62861
- const platformParam = libraryUrlSplitted == null ? void 0 : libraryUrlSplitted[1], searchParams = `application%5B0%5D=${appName}&page=1&sort_field=views&sort_order=desc`;
62862
- return {
62863
- libraryUrl: `${libraryHost}search/?${platformParam}&${searchParams}`
62864
- };
62906
+ } = useOdeClient(), appName = libraryMaps[appCode], libraryApp = user.apps.find((app) => app.isExternal && app.address.includes("library"));
62907
+ if (!libraryApp)
62908
+ return null;
62909
+ const libraryUrlSplit = (_a2 = libraryApp.address) == null ? void 0 : _a2.split("?");
62910
+ if (!libraryUrlSplit || libraryUrlSplit.length < 2)
62911
+ return null;
62912
+ let libraryHost = libraryUrlSplit[0];
62913
+ libraryHost.endsWith("/") || (libraryHost = `${libraryHost}/`);
62914
+ const platformURLParam = libraryUrlSplit == null ? void 0 : libraryUrlSplit[1], searchParams = `application%5B0%5D=${appName}&page=1&sort_field=views&sort_order=desc`;
62915
+ return `${libraryHost}search/?${platformURLParam}&${searchParams}`;
62865
62916
  }, useLibraryUrl$1 = useLibraryUrl;
62866
62917
  function useOdeIcons() {
62867
62918
  const iconOfWidget = {
@@ -63871,12 +63922,12 @@ const ImagePicker = /* @__PURE__ */ reactExports.forwardRef(({
63871
63922
  onValueChange == null || onValueChange(value);
63872
63923
  }
63873
63924
  }, [localValue]);
63874
- const label = typeof localValue == "object" ? localValue.label : localValue;
63925
+ const label = typeof localValue == "object" ? localValue.label : localValue, iconChange = typeof localValue == "object" ? localValue.icon : void 0;
63875
63926
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(Dropdown$1, { overflow, block, children: [
63876
- /* @__PURE__ */ jsxRuntimeExports.jsx(SelectTrigger$1, { icon, label: t2(label || placeholderOption), variant, size: size2, disabled }),
63927
+ /* @__PURE__ */ jsxRuntimeExports.jsx(SelectTrigger$1, { icon: iconChange || icon, label: t2(label || placeholderOption), variant, size: size2, disabled }),
63877
63928
  /* @__PURE__ */ jsxRuntimeExports.jsx(Dropdown$1.Menu, { role: "listbox", children: options == null ? void 0 : options.map((option) => {
63878
- const value = typeof option == "object" ? option.value : option, label2 = typeof option == "object" ? option.label : option;
63879
- return /* @__PURE__ */ jsxRuntimeExports.jsx(Dropdown$1.Item, { type: "action", onClick: () => setLocalValue(option), children: label2 }, value);
63929
+ const value = typeof option == "object" ? option.value : option, label2 = typeof option == "object" ? option.label : option, icon2 = typeof option == "object" ? option.icon : void 0;
63930
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(Dropdown$1.Item, { type: "action", onClick: () => setLocalValue(option), icon: icon2, children: label2 }, value);
63880
63931
  }) })
63881
63932
  ] });
63882
63933
  }, Select$1 = Select;
@@ -64539,8 +64590,8 @@ function PublishModal$2({
64539
64590
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mb-24", children: [
64540
64591
  /* @__PURE__ */ jsxRuntimeExports.jsx("label", { htmlFor: "", className: "form-label", children: t2("bpr.form.publication.age") }),
64541
64592
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "d-flex gap-8", children: [
64542
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "col col-2", children: /* @__PURE__ */ jsxRuntimeExports.jsx(AgeSelect, { control, name: "ageMin", placeholderOption: defaultSelectAgeMinOption, validate: (value, formValues) => parseInt(value) <= parseInt(formValues.ageMax) }) }),
64543
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "col col-2", children: /* @__PURE__ */ jsxRuntimeExports.jsx(AgeSelect, { control, name: "ageMax", placeholderOption: defaultSelectAgeMaxOption, validate: (value, formValues) => parseInt(value) >= parseInt(formValues.ageMin) }) })
64593
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "col col-md-2 d-flex", children: /* @__PURE__ */ jsxRuntimeExports.jsx(AgeSelect, { control, name: "ageMin", placeholderOption: defaultSelectAgeMinOption, validate: (value, formValues) => parseInt(value) <= parseInt(formValues.ageMax) }) }),
64594
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "col col-md-2 d-flex", children: /* @__PURE__ */ jsxRuntimeExports.jsx(AgeSelect, { control, name: "ageMax", placeholderOption: defaultSelectAgeMaxOption, validate: (value, formValues) => parseInt(value) >= parseInt(formValues.ageMin) }) })
64544
64595
  ] })
64545
64596
  ] }),
64546
64597
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mb-24", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(FormControl$1, { id: "keywords", isOptional: true, children: [
@@ -66491,6 +66542,12 @@ const restoreAll = async ({
66491
66542
  };
66492
66543
  return await odeServices.resource(searchParams.application).restoreAll(trashParameters, useAssetIds);
66493
66544
  };
66545
+ const copyResource = async (searchParams, resourceId) => {
66546
+ return await odeServices.resource(searchParams.application).copy({
66547
+ application: searchParams.application,
66548
+ resourceId
66549
+ });
66550
+ };
66494
66551
  const moveToFolder = async ({
66495
66552
  searchParams,
66496
66553
  resourceIds,
@@ -67360,6 +67417,87 @@ const useDelete = () => {
67360
67417
  }
67361
67418
  });
67362
67419
  };
67420
+ const useCopyResource = () => {
67421
+ const toast = useToast();
67422
+ const searchParams = useSearchParams();
67423
+ const queryClient2 = useQueryClient();
67424
+ const { user } = useUser();
67425
+ const currentFolder = useCurrentFolder();
67426
+ const { filters: filters2, trashed } = searchParams;
67427
+ const TOAST_INFO_ID = "duplicate_start";
67428
+ const queryKey = [
67429
+ "context",
67430
+ {
67431
+ folderId: filters2.folder,
67432
+ filters: filters2,
67433
+ trashed
67434
+ }
67435
+ ];
67436
+ return useMutation({
67437
+ mutationFn: async (resource) => {
67438
+ toast.info(t$4("duplicate.start"), {
67439
+ id: TOAST_INFO_ID
67440
+ });
67441
+ return await copyResource(searchParams, resource.assetId);
67442
+ },
67443
+ onSuccess: async (data, variables) => {
67444
+ toast.remove(TOAST_INFO_ID);
67445
+ toast.success(t$4("duplicate.done"));
67446
+ await queryClient2.cancelQueries({ queryKey });
67447
+ const previousData = queryClient2.getQueryData(queryKey);
67448
+ const newResource = {
67449
+ ...variables,
67450
+ name: `${variables.name}${t$4("duplicate.suffix")}`,
67451
+ assetId: data.duplicateId,
67452
+ id: data.duplicateId,
67453
+ creatorId: user == null ? void 0 : user.userId,
67454
+ creatorName: user == null ? void 0 : user.username,
67455
+ createdAt: Date.now(),
67456
+ slug: variables.slug || "",
67457
+ modifiedAt: Date.now(),
67458
+ modifierId: (user == null ? void 0 : user.userId) || "",
67459
+ modifierName: (user == null ? void 0 : user.username) || "",
67460
+ updatedAt: Date.now(),
67461
+ trashed: false,
67462
+ rights: [`creator:${user == null ? void 0 : user.userId}`]
67463
+ };
67464
+ if (previousData) {
67465
+ queryClient2.setQueryData(
67466
+ queryKey,
67467
+ (prev) => {
67468
+ if (prev) {
67469
+ return {
67470
+ ...prev,
67471
+ pages: prev == null ? void 0 : prev.pages.map((page) => {
67472
+ return {
67473
+ ...page,
67474
+ resources: [newResource, ...page.resources]
67475
+ };
67476
+ })
67477
+ };
67478
+ }
67479
+ return void 0;
67480
+ }
67481
+ );
67482
+ }
67483
+ if (currentFolder.id && currentFolder.id !== "default") {
67484
+ moveToFolder({
67485
+ searchParams,
67486
+ resourceIds: [data.duplicateId],
67487
+ folderId: currentFolder.id,
67488
+ folderIds: [],
67489
+ useAssetIds: true
67490
+ });
67491
+ }
67492
+ },
67493
+ onError: (error) => {
67494
+ toast.remove(TOAST_INFO_ID);
67495
+ if (typeof error === "string") {
67496
+ toast.error(`${t$4("duplicate.error")}: ${error}`);
67497
+ }
67498
+ }
67499
+ });
67500
+ };
67363
67501
  const useMoveItem = () => {
67364
67502
  const toast = useToast();
67365
67503
  const queryClient2 = useQueryClient();
@@ -68209,20 +68347,21 @@ const queryClient = new QueryClient({
68209
68347
  });
68210
68348
  const getHTMLConfig = getExplorerConfig();
68211
68349
  createRoot(root).render(
68212
- // <StrictMode>
68213
- /* @__PURE__ */ jsxRuntimeExports.jsxs(QueryClientProvider, { client: queryClient, children: [
68214
- /* @__PURE__ */ jsxRuntimeExports.jsx(
68215
- OdeClientProvider,
68216
- {
68217
- params: {
68218
- app: getHTMLConfig.app
68219
- },
68220
- children: /* @__PURE__ */ jsxRuntimeExports.jsx(ThemeProvider, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(Root, {}) })
68221
- }
68222
- ),
68223
- /* @__PURE__ */ jsxRuntimeExports.jsx(ReactQueryDevtools2, { initialIsOpen: false })
68350
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(reactExports.StrictMode, { children: [
68351
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(QueryClientProvider, { client: queryClient, children: [
68352
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
68353
+ OdeClientProvider,
68354
+ {
68355
+ params: {
68356
+ app: getHTMLConfig.app
68357
+ },
68358
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx(ThemeProvider, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(Root, {}) })
68359
+ }
68360
+ ),
68361
+ /* @__PURE__ */ jsxRuntimeExports.jsx(ReactQueryDevtools2, { initialIsOpen: false })
68362
+ ] }),
68363
+ ","
68224
68364
  ] })
68225
- // </StrictMode>,
68226
68365
  );
68227
68366
  function EmptyScreenApp() {
68228
68367
  const { appCode } = useOdeClient();
@@ -68816,9 +68955,9 @@ const AppAction$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineP
68816
68955
  const Library = () => {
68817
68956
  const { t: t2 } = useTranslation();
68818
68957
  const { theme } = useOdeTheme();
68819
- const { libraryUrl } = useLibraryUrl$1();
68958
+ const libraryUrl = useLibraryUrl$1();
68820
68959
  const [imagePath] = usePaths();
68821
- return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "p-16", children: [
68960
+ return libraryUrl && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "p-16", children: [
68822
68961
  /* @__PURE__ */ jsxRuntimeExports.jsx(
68823
68962
  Image$2,
68824
68963
  {
@@ -68930,6 +69069,7 @@ function useActionBar() {
68930
69069
  const restoreItem = useRestore();
68931
69070
  const isTrashResource = useResourceIsTrash();
68932
69071
  const searchParams = useSearchParams();
69072
+ const copyResource2 = useCopyResource();
68933
69073
  const {
68934
69074
  openResource,
68935
69075
  printSelectedResource,
@@ -68963,6 +69103,8 @@ function useActionBar() {
68963
69103
  folderId: selectedFolders[0].id
68964
69104
  });
68965
69105
  }
69106
+ case ACTION.COPY:
69107
+ return onCopy();
68966
69108
  case ACTION.MOVE:
68967
69109
  return setOpenedModalName("move");
68968
69110
  case ACTION.PRINT:
@@ -68977,7 +69119,11 @@ function useActionBar() {
68977
69119
  case "edit":
68978
69120
  return onEdit();
68979
69121
  case "export":
68980
- return onExport();
69122
+ if (resourceIds.length > 0) {
69123
+ return onExport();
69124
+ } else {
69125
+ return null;
69126
+ }
68981
69127
  case ACTION.SHARE:
68982
69128
  return setOpenedModalName("share");
68983
69129
  default:
@@ -68994,12 +69140,16 @@ function useActionBar() {
68994
69140
  return onlyOneSelected;
68995
69141
  case ACTION.MANAGE:
68996
69142
  return onlyOneItemSelected;
69143
+ case ACTION.COPY:
69144
+ return onlyOneItemSelected && noFolderSelected;
68997
69145
  case ACTION.PUBLISH:
68998
69146
  return onlyOneItemSelected && noFolderSelected;
68999
69147
  case ACTION.UPD_PROPS:
69000
69148
  return onlyOneItemSelected && noFolderSelected;
69001
69149
  case ACTION.SHARE:
69002
69150
  return noFolderSelected && onlyOneItemSelected;
69151
+ case "export":
69152
+ return onlyOneItemSelected && noFolderSelected;
69003
69153
  case ACTION.PRINT:
69004
69154
  return onlyOneItemSelected && noFolderSelected;
69005
69155
  case "edit":
@@ -69047,6 +69197,14 @@ function useActionBar() {
69047
69197
  const onEditResourceCancel = onFinish("edit_resource");
69048
69198
  const onShareResourceSuccess = onFinish("share");
69049
69199
  const onShareResourceCancel = onFinish("share");
69200
+ async function onCopy() {
69201
+ if (selectedResources && selectedResources.length > 0) {
69202
+ const selectedResource = selectedResources[0];
69203
+ await copyResource2.mutate(selectedResource);
69204
+ clearSelectedItems();
69205
+ clearSelectedIds();
69206
+ }
69207
+ }
69050
69208
  function onEdit() {
69051
69209
  if (resourceIds && resourceIds.length > 0) {
69052
69210
  const selectedResource = selectedResources[0].assetId;
package/dist/version.txt CHANGED
@@ -1 +1 @@
1
- ode-explorer=1.0-b2school-SNAPSHOT 01/03/2024 16:07:07
1
+ ode-explorer=1.0-b2school-SNAPSHOT 12/03/2024 11:16:00