ode-explorer 1.4.0 → 1.4.1-develop-b2school.202403141630

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.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,
@@ -57121,6 +57163,22 @@ class ResizePlugin {
57121
57163
  }
57122
57164
  ResizePlugin.extension = ExtensionType.Application;
57123
57165
  extensions$1.add(ResizePlugin);
57166
+ DisplayObject.prototype.name = null;
57167
+ Container.prototype.getChildByName = function(name, deep) {
57168
+ for (let i2 = 0, j2 = this.children.length; i2 < j2; i2++)
57169
+ if (this.children[i2].name === name)
57170
+ return this.children[i2];
57171
+ if (deep)
57172
+ for (let i2 = 0, j2 = this.children.length; i2 < j2; i2++) {
57173
+ const child = this.children[i2];
57174
+ if (!child.getChildByName)
57175
+ continue;
57176
+ const target = child.getChildByName(name, true);
57177
+ if (target)
57178
+ return target;
57179
+ }
57180
+ return null;
57181
+ };
57124
57182
  const _tempMatrix = new Matrix();
57125
57183
  DisplayObject.prototype._cacheAsBitmap = false;
57126
57184
  DisplayObject.prototype._cacheData = null;
@@ -57251,22 +57309,6 @@ DisplayObject.prototype._destroyCachedDisplayObject = function() {
57251
57309
  DisplayObject.prototype._cacheAsBitmapDestroy = function(options) {
57252
57310
  this.cacheAsBitmap = false, this.destroy(options);
57253
57311
  };
57254
- DisplayObject.prototype.name = null;
57255
- Container.prototype.getChildByName = function(name, deep) {
57256
- for (let i2 = 0, j2 = this.children.length; i2 < j2; i2++)
57257
- if (this.children[i2].name === name)
57258
- return this.children[i2];
57259
- if (deep)
57260
- for (let i2 = 0, j2 = this.children.length; i2 < j2; i2++) {
57261
- const child = this.children[i2];
57262
- if (!child.getChildByName)
57263
- continue;
57264
- const target = child.getChildByName(name, true);
57265
- if (target)
57266
- return target;
57267
- }
57268
- return null;
57269
- };
57270
57312
  DisplayObject.prototype.getGlobalPosition = function(point = new Point(), skipUpdate = false) {
57271
57313
  return this.parent ? this.parent.toGlobal(this.position, point, skipUpdate) : (point.x = this.position.x, point.y = this.position.y), point;
57272
57314
  };
@@ -62142,7 +62184,7 @@ const ActionBar$1 = /* @__PURE__ */ reactExports.forwardRef(({
62142
62184
  } = props, getLoadingIcon = () => {
62143
62185
  let icon;
62144
62186
  return loadingIcon ? icon = loadingIcon : icon = /* @__PURE__ */ jsxRuntimeExports.jsx(SvgLoader$1, { ...restProps, "aria-label": "Loading" }), icon;
62145
- }, classes2 = clsx("loading", {
62187
+ }, classes2 = clsx("loading d-flex align-items-center gap-8", {
62146
62188
  "is-loading": isLoading
62147
62189
  }, className);
62148
62190
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: classes2, role: "status", ref: ref2, children: [
@@ -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 = {
@@ -63034,7 +63085,8 @@ const Image$1 = /* @__PURE__ */ reactExports.forwardRef(({
63034
63085
  app,
63035
63086
  size: size2 = "24",
63036
63087
  iconFit = "contain",
63037
- variant = "square"
63088
+ variant = "square",
63089
+ className = ""
63038
63090
  }, ref2) => {
63039
63091
  const {
63040
63092
  isIconUrl,
@@ -63052,14 +63104,19 @@ const Image$1 = /* @__PURE__ */ reactExports.forwardRef(({
63052
63104
  }, iconFits = {
63053
63105
  "icon-contain": isContain,
63054
63106
  "icon-ratio": isRatio
63055
- }, icon = typeof app == "string" ? app : (app == null ? void 0 : app.icon) !== void 0 ? app.icon : "placeholder", displayName = typeof app != "string" && (app == null ? void 0 : app.displayName) !== void 0 ? app.displayName : "", code = app ? getIconCode(app) : "", isIconURL = isIconUrl(icon), appCode = code || "placeholder", classes2 = clsx("app-icon", {
63107
+ }, icon = typeof app == "string" ? app : (app == null ? void 0 : app.icon) !== void 0 ? app.icon : "placeholder", displayName = typeof app != "string" && (app == null ? void 0 : app.displayName) !== void 0 ? app.displayName : "", code = app ? getIconCode(app) : "", isIconURL = isIconUrl(icon), appCode = code || "placeholder";
63108
+ if (isIconURL) {
63109
+ const classes22 = clsx("h-full", className);
63110
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(Image$2, { src: icon, alt: displayName, objectFit: "contain", width: size2, height: size2, className: classes22 });
63111
+ }
63112
+ const classes2 = clsx("app-icon", {
63056
63113
  ...iconSizes,
63057
63114
  ...iconVariant,
63058
63115
  ...iconFits,
63059
63116
  [`bg-light-${appCode}`]: appCode && !isContain,
63060
63117
  [`color-app-${appCode}`]: appCode
63061
- });
63062
- return isIconURL ? /* @__PURE__ */ jsxRuntimeExports.jsx(Image$2, { src: icon, alt: displayName, objectFit: "contain", width: size2, height: size2, className: "h-full" }) : /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: classes2, style: {
63118
+ }, className);
63119
+ return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: classes2, style: {
63063
63120
  width: size2 + "px",
63064
63121
  height: size2 + "px"
63065
63122
  }, children: /* @__PURE__ */ jsxRuntimeExports.jsx("svg", { ref: ref2, width: size2, height: size2, role: "img", fill: "currentColor", xmlns: "http://www.w3.org/2000/svg", "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntimeExports.jsx("use", { xlinkHref: `${iconPath}/apps.svg#${appCode}` }) }) });
@@ -63871,12 +63928,12 @@ const ImagePicker = /* @__PURE__ */ reactExports.forwardRef(({
63871
63928
  onValueChange == null || onValueChange(value);
63872
63929
  }
63873
63930
  }, [localValue]);
63874
- const label = typeof localValue == "object" ? localValue.label : localValue;
63931
+ const label = typeof localValue == "object" ? localValue.label : localValue, iconChange = typeof localValue == "object" ? localValue.icon : void 0;
63875
63932
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(Dropdown$1, { overflow, block, children: [
63876
- /* @__PURE__ */ jsxRuntimeExports.jsx(SelectTrigger$1, { icon, label: t2(label || placeholderOption), variant, size: size2, disabled }),
63933
+ /* @__PURE__ */ jsxRuntimeExports.jsx(SelectTrigger$1, { icon: iconChange || icon, label: t2(label || placeholderOption), variant, size: size2, disabled }),
63877
63934
  /* @__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);
63935
+ const value = typeof option == "object" ? option.value : option, label2 = typeof option == "object" ? option.label : option, icon2 = typeof option == "object" ? option.icon : void 0;
63936
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(Dropdown$1.Item, { type: "action", onClick: () => setLocalValue(option), icon: icon2, children: label2 }, value);
63880
63937
  }) })
63881
63938
  ] });
63882
63939
  }, Select$1 = Select;
@@ -64539,8 +64596,8 @@ function PublishModal$2({
64539
64596
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mb-24", children: [
64540
64597
  /* @__PURE__ */ jsxRuntimeExports.jsx("label", { htmlFor: "", className: "form-label", children: t2("bpr.form.publication.age") }),
64541
64598
  /* @__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) }) })
64599
+ /* @__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) }) }),
64600
+ /* @__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
64601
  ] })
64545
64602
  ] }),
64546
64603
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mb-24", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(FormControl$1, { id: "keywords", isOptional: true, children: [
@@ -65763,7 +65820,7 @@ function ShareResourceModal({
65763
65820
  /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip$1, { message: "Vos favoris de partage s’affichent en priorité dans votre liste lorsque vous recherchez un groupe ou une personne, vous pouvez les retrouver dans l’annuaire.", placement: "top", children: /* @__PURE__ */ jsxRuntimeExports.jsx(SvgInfoCircle$1, { className: "c-pointer", height: "18" }) })
65764
65821
  ] }),
65765
65822
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "row", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "col-10", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Combobox$1, { value: searchInputValue, placeholder: searchPlaceholder, isLoading: showSearchLoading(), noResult: showSearchNoResults(), options: searchResults, searchMinLength: getSearchMinLength(), onSearchInputChange: handleSearchInputChange, onSearchResultsChange: handleSearchResultsChange }) }) }),
65766
- children
65823
+ typeof children == "function" ? children(resource) : children
65767
65824
  ] }),
65768
65825
  /* @__PURE__ */ jsxRuntimeExports.jsxs(Modal$1.Footer, { children: [
65769
65826
  /* @__PURE__ */ jsxRuntimeExports.jsx(Button$1, { type: "button", color: "tertiary", variant: "ghost", onClick: onCancel, children: t2("explorer.cancel") }),
@@ -66491,6 +66548,12 @@ const restoreAll = async ({
66491
66548
  };
66492
66549
  return await odeServices.resource(searchParams.application).restoreAll(trashParameters, useAssetIds);
66493
66550
  };
66551
+ const copyResource = async (searchParams, resourceId) => {
66552
+ return await odeServices.resource(searchParams.application).copy({
66553
+ application: searchParams.application,
66554
+ resourceId
66555
+ });
66556
+ };
66494
66557
  const moveToFolder = async ({
66495
66558
  searchParams,
66496
66559
  resourceIds,
@@ -67360,6 +67423,87 @@ const useDelete = () => {
67360
67423
  }
67361
67424
  });
67362
67425
  };
67426
+ const useCopyResource = () => {
67427
+ const toast = useToast();
67428
+ const searchParams = useSearchParams();
67429
+ const queryClient2 = useQueryClient();
67430
+ const { user } = useUser();
67431
+ const currentFolder = useCurrentFolder();
67432
+ const { filters: filters2, trashed } = searchParams;
67433
+ const TOAST_INFO_ID = "duplicate_start";
67434
+ const queryKey = [
67435
+ "context",
67436
+ {
67437
+ folderId: filters2.folder,
67438
+ filters: filters2,
67439
+ trashed
67440
+ }
67441
+ ];
67442
+ return useMutation({
67443
+ mutationFn: async (resource) => {
67444
+ toast.info(t$4("duplicate.start"), {
67445
+ id: TOAST_INFO_ID
67446
+ });
67447
+ return await copyResource(searchParams, resource.assetId);
67448
+ },
67449
+ onSuccess: async (data, variables) => {
67450
+ toast.remove(TOAST_INFO_ID);
67451
+ toast.success(t$4("duplicate.done"));
67452
+ await queryClient2.cancelQueries({ queryKey });
67453
+ const previousData = queryClient2.getQueryData(queryKey);
67454
+ const newResource = {
67455
+ ...variables,
67456
+ name: `${variables.name}${t$4("duplicate.suffix")}`,
67457
+ assetId: data.duplicateId,
67458
+ id: data.duplicateId,
67459
+ creatorId: user == null ? void 0 : user.userId,
67460
+ creatorName: user == null ? void 0 : user.username,
67461
+ createdAt: Date.now(),
67462
+ slug: variables.slug || "",
67463
+ modifiedAt: Date.now(),
67464
+ modifierId: (user == null ? void 0 : user.userId) || "",
67465
+ modifierName: (user == null ? void 0 : user.username) || "",
67466
+ updatedAt: Date.now(),
67467
+ trashed: false,
67468
+ rights: [`creator:${user == null ? void 0 : user.userId}`]
67469
+ };
67470
+ if (previousData) {
67471
+ queryClient2.setQueryData(
67472
+ queryKey,
67473
+ (prev) => {
67474
+ if (prev) {
67475
+ return {
67476
+ ...prev,
67477
+ pages: prev == null ? void 0 : prev.pages.map((page) => {
67478
+ return {
67479
+ ...page,
67480
+ resources: [newResource, ...page.resources]
67481
+ };
67482
+ })
67483
+ };
67484
+ }
67485
+ return void 0;
67486
+ }
67487
+ );
67488
+ }
67489
+ if (currentFolder.id && currentFolder.id !== "default") {
67490
+ moveToFolder({
67491
+ searchParams,
67492
+ resourceIds: [data.duplicateId],
67493
+ folderId: currentFolder.id,
67494
+ folderIds: [],
67495
+ useAssetIds: true
67496
+ });
67497
+ }
67498
+ },
67499
+ onError: (error) => {
67500
+ toast.remove(TOAST_INFO_ID);
67501
+ if (typeof error === "string") {
67502
+ toast.error(`${t$4("duplicate.error")}: ${error}`);
67503
+ }
67504
+ }
67505
+ });
67506
+ };
67363
67507
  const useMoveItem = () => {
67364
67508
  const toast = useToast();
67365
67509
  const queryClient2 = useQueryClient();
@@ -68209,20 +68353,21 @@ const queryClient = new QueryClient({
68209
68353
  });
68210
68354
  const getHTMLConfig = getExplorerConfig();
68211
68355
  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 })
68356
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(reactExports.StrictMode, { children: [
68357
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(QueryClientProvider, { client: queryClient, children: [
68358
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
68359
+ OdeClientProvider,
68360
+ {
68361
+ params: {
68362
+ app: getHTMLConfig.app
68363
+ },
68364
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx(ThemeProvider, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(Root, {}) })
68365
+ }
68366
+ ),
68367
+ /* @__PURE__ */ jsxRuntimeExports.jsx(ReactQueryDevtools2, { initialIsOpen: false })
68368
+ ] }),
68369
+ ","
68224
68370
  ] })
68225
- // </StrictMode>,
68226
68371
  );
68227
68372
  function EmptyScreenApp() {
68228
68373
  const { appCode } = useOdeClient();
@@ -68816,9 +68961,9 @@ const AppAction$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineP
68816
68961
  const Library = () => {
68817
68962
  const { t: t2 } = useTranslation();
68818
68963
  const { theme } = useOdeTheme();
68819
- const { libraryUrl } = useLibraryUrl$1();
68964
+ const libraryUrl = useLibraryUrl$1();
68820
68965
  const [imagePath] = usePaths();
68821
- return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "p-16", children: [
68966
+ return libraryUrl && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "p-16", children: [
68822
68967
  /* @__PURE__ */ jsxRuntimeExports.jsx(
68823
68968
  Image$2,
68824
68969
  {
@@ -68930,6 +69075,7 @@ function useActionBar() {
68930
69075
  const restoreItem = useRestore();
68931
69076
  const isTrashResource = useResourceIsTrash();
68932
69077
  const searchParams = useSearchParams();
69078
+ const copyResource2 = useCopyResource();
68933
69079
  const {
68934
69080
  openResource,
68935
69081
  printSelectedResource,
@@ -68963,6 +69109,8 @@ function useActionBar() {
68963
69109
  folderId: selectedFolders[0].id
68964
69110
  });
68965
69111
  }
69112
+ case ACTION.COPY:
69113
+ return onCopy();
68966
69114
  case ACTION.MOVE:
68967
69115
  return setOpenedModalName("move");
68968
69116
  case ACTION.PRINT:
@@ -68977,7 +69125,11 @@ function useActionBar() {
68977
69125
  case "edit":
68978
69126
  return onEdit();
68979
69127
  case "export":
68980
- return onExport();
69128
+ if (resourceIds.length > 0) {
69129
+ return onExport();
69130
+ } else {
69131
+ return null;
69132
+ }
68981
69133
  case ACTION.SHARE:
68982
69134
  return setOpenedModalName("share");
68983
69135
  default:
@@ -68994,12 +69146,16 @@ function useActionBar() {
68994
69146
  return onlyOneSelected;
68995
69147
  case ACTION.MANAGE:
68996
69148
  return onlyOneItemSelected;
69149
+ case ACTION.COPY:
69150
+ return onlyOneItemSelected && noFolderSelected;
68997
69151
  case ACTION.PUBLISH:
68998
69152
  return onlyOneItemSelected && noFolderSelected;
68999
69153
  case ACTION.UPD_PROPS:
69000
69154
  return onlyOneItemSelected && noFolderSelected;
69001
69155
  case ACTION.SHARE:
69002
69156
  return noFolderSelected && onlyOneItemSelected;
69157
+ case "export":
69158
+ return onlyOneItemSelected && noFolderSelected;
69003
69159
  case ACTION.PRINT:
69004
69160
  return onlyOneItemSelected && noFolderSelected;
69005
69161
  case "edit":
@@ -69047,6 +69203,14 @@ function useActionBar() {
69047
69203
  const onEditResourceCancel = onFinish("edit_resource");
69048
69204
  const onShareResourceSuccess = onFinish("share");
69049
69205
  const onShareResourceCancel = onFinish("share");
69206
+ async function onCopy() {
69207
+ if (selectedResources && selectedResources.length > 0) {
69208
+ const selectedResource = selectedResources[0];
69209
+ await copyResource2.mutate(selectedResource);
69210
+ clearSelectedItems();
69211
+ clearSelectedIds();
69212
+ }
69213
+ }
69050
69214
  function onEdit() {
69051
69215
  if (resourceIds && resourceIds.length > 0) {
69052
69216
  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 14/03/2024 16:31:02