@beinformed/ui 1.57.3 → 1.57.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,13 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [commit-and-tag-version](https://github.com/absolute-version/commit-and-tag-version) for commit guidelines.
4
4
 
5
+ ## [1.57.4](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/compare/v1.57.3...v1.57.4) (2024-10-31)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * **modularui:** keep models with same url but different querystring ([2fb0be3](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/commit/2fb0be3e90c340445f22b32639bd1f12d63443f3))
11
+
5
12
  ## [1.57.3](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/compare/v1.57.2...v1.57.3) (2024-10-30)
6
13
 
7
14
 
@@ -6,7 +6,6 @@ import _findInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instanc
6
6
  import _filterInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/filter";
7
7
  import { getBasePathModularUI, HTTP_METHODS, CONTENT_PATH } from "../../constants";
8
8
  import Parameter from "../parameter/Parameter";
9
- import { IllegalArgumentException } from "../../exceptions";
10
9
  /**
11
10
  * Defines a Href with the parameters
12
11
  */
@@ -425,22 +424,23 @@ class Href {
425
424
 
426
425
  /**
427
426
  */
428
- equalsWithParameters(href) {
427
+ equalsWithParameters(other) {
428
+ var _context10;
429
+ if (other == null) {
430
+ return false;
431
+ }
432
+ const href = other instanceof Href ? other : new Href(other);
429
433
  if (!this.equals(href)) {
430
434
  return false;
431
435
  }
432
- if (href instanceof Href) {
433
- var _context10;
434
- if (this.parameters.length !== href.parameters.length) {
435
- return false;
436
- }
437
- if (this.parameters.length === 0 && href.parameters.length === 0) {
438
- return true;
439
- }
440
- const thisParams = _mapInstanceProperty(_context10 = this.parameters).call(_context10, param => param.toString());
441
- return href.parameters.every(param => _includesInstanceProperty(thisParams).call(thisParams, param.toString()));
436
+ if (this.parameters.length !== href.parameters.length) {
437
+ return false;
438
+ }
439
+ if (this.parameters.length === 0 && href.parameters.length === 0) {
440
+ return true;
442
441
  }
443
- throw new IllegalArgumentException(`${href} is not an instance of Href`);
442
+ const thisParams = _mapInstanceProperty(_context10 = this.parameters).call(_context10, param => param.toString());
443
+ return href.parameters.every(param => _includesInstanceProperty(thisParams).call(thisParams, param.toString()));
444
444
  }
445
445
 
446
446
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"Href.js","names":["getBasePathModularUI","HTTP_METHODS","CONTENT_PATH","Parameter","IllegalArgumentException","Href","constructor","href","resourcetype","modelOptions","_defineProperty","GET","setFromHref","setFromString","setFromLocationOrObject","origin","contextPath","path","parameters","hash","state","_origin","_contextPath","pathname","_path","search","addParametersFromString","Array","isArray","_parameters","_context","_mapInstanceProperty","call","param","addParameter","_name","_value","_prefix","getHashFromString","_hash","setStateFromLocationOrObject","_state","getPathFromString","isChangePassword","_context2","_includesInstanceProperty","isCamelRoute","_startsWithInstanceProperty","checkAbsoluteUrl","checkAbsolute","RegExp","test","isExternal","hrefNoHash","substring","indexOf","split","arguments","length","undefined","substr","forEach","paramFromString","fromString","setParameter","name","value","prefix","removeParameter","push","getParameter","_context3","_findInstanceProperty","hasParameter","method","_method","_context4","valueToRemove","newValue","filter","val","join","_context5","_filterInstanceProperty","getQuerystring","_context6","_context7","withPrefix","toQuerystring","getQuerystringForModularUI","_context8","_context9","isModUIParameter","querystring","setState","_resourcetype","absolutepath","absolutehref","absolutehrefPrefixedQuerystring","startsWith","thisPath","otherPath","equals","equalsWithParameters","_context10","thisParams","toString","every","isContent","_context11","getReferenceHash","_referenceHash","setReferenceHash","referenceHash","toLocation"],"sources":["../../../src/models/href/Href.js"],"sourcesContent":["// @flow\nimport {\n getBasePathModularUI,\n HTTP_METHODS,\n CONTENT_PATH,\n} from \"../../constants\";\n\nimport Parameter from \"../parameter/Parameter\";\nimport { IllegalArgumentException } from \"../../exceptions\";\n\nimport type { LocationShape } from \"react-router\";\nimport type { ModelOptions } from \"../types\";\n\ntype HrefObject = {\n _path: string,\n _hash: string,\n _parameters: Array<Parameter>,\n _resourcetype: string,\n _method: $Keys<typeof HTTP_METHODS>,\n _state: ?{ [key: string]: any },\n pathname: ?string,\n};\n\nexport type HrefInput = Href | HrefObject | LocationShape | string;\n\n/**\n * Defines a Href with the parameters\n */\nclass Href {\n _path: string = \"\";\n _hash: string = \"\";\n _parameters: Array<Parameter> = [];\n _resourcetype: string = \"\";\n _method: $Keys<typeof HTTP_METHODS> = HTTP_METHODS.GET;\n _state: any = null;\n _referenceHash: ?number;\n _origin: string = \"\";\n _contextPath: string = getBasePathModularUI();\n\n /**\n * Create a Href\n */\n constructor(\n href?: HrefInput,\n resourcetype?: string,\n modelOptions?: ?ModelOptions,\n ) {\n this.resourcetype = resourcetype ?? \"\";\n\n if (href instanceof Href) {\n this.setFromHref(href);\n } else if (typeof href === \"string\") {\n this.setFromString(href);\n } else if (typeof href === \"object\") {\n this.setFromLocationOrObject(href);\n }\n\n if (typeof modelOptions?.origin === \"string\") {\n this.origin = modelOptions.origin;\n }\n\n if (typeof modelOptions?.contextPath === \"string\") {\n this.contextPath = modelOptions.contextPath;\n }\n }\n\n /**\n * Set parameters from Href model input\n */\n setFromHref(href: Href) {\n this.origin = href.origin;\n this.contextPath = href.contextPath;\n this.path = href.path;\n this.parameters = href.parameters;\n this.hash = href.hash;\n this.state = href.state;\n }\n\n /**\n */\n setFromLocationOrObject(href: LocationShape | HrefObject) {\n // $FlowFixMe\n if (typeof href._origin === \"string\") {\n this.origin = href._origin;\n }\n // $FlowFixMe\n if (typeof href._contextPath === \"string\") {\n this.contextPath = href._contextPath;\n }\n\n if (typeof href[\"pathname\"] === \"string\") {\n this.path = href.pathname;\n } else if (typeof href._path === \"string\") {\n this.path = href._path;\n }\n\n if (href.search) {\n this.addParametersFromString(href.search);\n } else if (Array.isArray(href._parameters)) {\n // $FlowExpectedError[incompatible-call]\n href._parameters.map((param: Parameter) =>\n this.addParameter(param._name, param._value, param._prefix),\n );\n }\n\n if (href.hash) {\n this.hash = Href.getHashFromString(href.hash);\n } else if (typeof href._hash === \"string\") {\n this.hash = href._hash;\n }\n\n if (typeof href.state === \"object\") {\n this.setStateFromLocationOrObject(href.state);\n } else if (typeof href._state === \"object\") {\n this.setStateFromLocationOrObject(href._state);\n }\n }\n\n /**\n */\n setStateFromLocationOrObject(state?: any) {\n if (state != null) {\n this.state = state;\n if (typeof state.contextPath === \"string\") {\n this.contextPath = state.contextPath;\n }\n if (typeof state.origin === \"string\") {\n this.origin = state.origin;\n }\n }\n }\n\n /**\n * Set parameters from string input\n */\n setFromString(href: string) {\n this.path = Href.getPathFromString(href);\n this.addParametersFromString(href);\n this.hash = Href.getHashFromString(href);\n }\n\n /**\n */\n get isChangePassword(): boolean {\n return this._path.includes(\"/change-password\");\n }\n\n /**\n * check if the path is referencing a camel route\n */\n static isCamelRoute(path: string): boolean {\n return (\n path.startsWith(\"/restServices\") && !path.startsWith(\"/restServices/ui\")\n );\n }\n\n /**\n */\n static checkAbsoluteUrl(href: string): boolean {\n const checkAbsolute = new RegExp(\"^(?:[a-z]+:)?//\", \"i\");\n return checkAbsolute.test(href);\n }\n\n // Check if url is relative (not checking for absolute urls with same domain)\n /**\n */\n get isExternal(): boolean {\n return Href.checkAbsoluteUrl(this.path);\n }\n\n /**\n * Retrieve the relative path part of a href string, e.g. https://www.beinformed.com/BeInformed/tab/view?q=url => /tab/view\n */\n static getPathFromString(href: string): string {\n const hrefNoHash = href.includes(\"#\")\n ? href.substring(0, href.indexOf(\"#\"))\n : href;\n\n return hrefNoHash.includes(\"?\") ? hrefNoHash.split(\"?\")[0] : hrefNoHash;\n }\n\n /**\n * Retrieve hash of href string\n */\n static getHashFromString(href: string = \"\"): string {\n return href.includes(\"#\") ? href.substr(href.indexOf(\"#\") + 1) : \"\";\n }\n\n /**\n * Add a parameter for each parameter found in the querystring of an URL string, e.g. https://www.beinformed.com?q=url => q=url\n */\n addParametersFromString(href: string): Href {\n if (href.includes(\"?\")) {\n href\n .split(\"?\")[1]\n .split(\"&\")\n .forEach((param) => {\n const paramFromString = Parameter.fromString(param);\n if (paramFromString) {\n this.setParameter(\n paramFromString.name,\n paramFromString.value,\n paramFromString.prefix,\n );\n }\n });\n }\n\n return this;\n }\n\n /**\n * Add a querystring parameter to the parameter collection of this Href, skips parameters that have a value of null\n */\n addParameter(name: string, value: ?string, prefix: ?string): Href {\n if (value !== null) {\n this.removeParameter(name, prefix);\n this._parameters.push(new Parameter(prefix, name, value));\n }\n\n return this;\n }\n\n /**\n * Adds or overwrites a parameter when it exists and value is not null.\n * Removes the parameter when the value is null\n */\n setParameter(name: string, value: ?string, prefix: ?string): Href {\n if (value === null) {\n this.removeParameter(name, prefix);\n } else {\n this.addParameter(name, value, prefix);\n }\n\n return this;\n }\n\n /**\n * Retrieve a parameter by it's name and (optionally) prefix\n */\n getParameter(name: string, prefix: ?string): ?Parameter {\n return this._parameters.find(\n (param) => param.prefix === prefix && param.name === name,\n );\n }\n\n /**\n */\n hasParameter(name: string, prefix: ?string): boolean {\n return this.getParameter(name, prefix) !== undefined;\n }\n\n /**\n * Get request method\n */\n get method(): $Keys<typeof HTTP_METHODS> {\n return this._method;\n }\n\n /**\n * Set request method\n */\n set method(method: $Keys<typeof HTTP_METHODS>) {\n this._method = method || HTTP_METHODS.GET;\n }\n\n /**\n * Retrieve all paremters\n */\n get parameters(): Array<Parameter> {\n return this._parameters;\n }\n\n /**\n * Replace parameters of Href\n */\n set parameters(parameters: Array<Parameter>) {\n this._parameters = parameters;\n }\n\n /**\n * Remove a parameter from the parameter collection\n */\n removeParameter(name: string, prefix: ?string, value: ?string): Href {\n if (value !== undefined) {\n const valueToRemove = value;\n\n this._parameters = this._parameters.map((param) => {\n if (param.prefix === prefix && param.name === name) {\n const newValue = param.value\n ?.split(\",\")\n .filter((val) => val !== valueToRemove)\n .join(\",\");\n return new Parameter(param.prefix, param.name, newValue);\n }\n return param;\n });\n } else {\n this._parameters = this._parameters.filter(\n (param) => param.prefix !== prefix || param.name !== name,\n );\n }\n\n return this;\n }\n\n /**\n * Get the parameters as a querystring, e.g. param1=value1&param2=value2, optionally with prefix\n */\n getQuerystring(withPrefix: boolean = false): string {\n return this.parameters\n .filter((param) => param.value != null && param.value !== \"\")\n .map((param) => param.toQuerystring(withPrefix))\n .join(\"&\");\n }\n\n /**\n * Retrieve a querystring that only contains parameter that can be send to the modular ui, parameters are filtered by prefix\n */\n getQuerystringForModularUI(prefix: string = \"\"): string {\n return this.parameters\n .filter(\n (param) =>\n param.isModUIParameter &&\n (!prefix || !param.prefix || param.prefix === prefix) &&\n param.value != null,\n )\n .map((param) => param.toQuerystring(false))\n .join(\"&\");\n }\n\n /**\n * Retrieve all parameters from the parameter collection in a querystring style name1=value1&name2=value2, without the prefix\n */\n get querystring(): string {\n return this.getQuerystring(false);\n }\n\n /**\n * Set the path of the Href, the part before the querystring question mark\n */\n set path(path: string) {\n this._path = path;\n }\n\n /**\n * Retrieve the path\n */\n get path(): string {\n return this._path ?? \"\";\n }\n\n /**\n * Retrieve the origin (e.g. http://example.com:18080)<br>\n * Empty when the default must be used\n */\n get origin(): string {\n return this._origin ?? \"\";\n }\n\n /**\n * Set the origin (e.g. http://example.com:18080)\n */\n set origin(origin: string) {\n this._origin = origin;\n }\n\n /**\n * Get the context path\n */\n get contextPath(): string {\n return this._contextPath;\n }\n\n /**\n * Set the context path if different from default\n */\n set contextPath(contextPath: string) {\n this._contextPath = contextPath;\n }\n\n /**\n * Set hash\n */\n set hash(hash: string) {\n this._hash = hash;\n }\n\n /**\n * Retrieve hash\n */\n get hash(): string {\n return this._hash;\n }\n\n /**\n */\n set state(state: any) {\n this._state = state;\n }\n\n /**\n */\n get state(): any {\n return this._state;\n }\n\n /**\n */\n setState(state: any): Href {\n this.state = state;\n\n return this;\n }\n\n /**\n * Set resourctype\n */\n set resourcetype(resourcetype: string) {\n this._resourcetype = resourcetype;\n }\n\n /**\n * Retrieve resourceType\n */\n get resourcetype(): string {\n return this._resourcetype;\n }\n\n /**\n * Retrieve the path combined with the base path (context-path) of the application, e.g. /BeInformed\n */\n get absolutepath(): string {\n if (this.isExternal) {\n return this.path;\n }\n\n return this.origin + this.contextPath + this.path;\n }\n\n /**\n * Retrieves the combination of the path and the querystring\n */\n get href(): string {\n return this.querystring.length > 0\n ? [this.path, this.querystring].join(\"?\")\n : this.path;\n }\n\n /**\n * Getting the URL including the base path, querystring is prefixed\n */\n get absolutehref(): string {\n const querystring = this.getQuerystring(false);\n\n return querystring.length > 0\n ? [this.absolutepath, querystring].join(\"?\")\n : this.absolutepath;\n }\n\n /**\n * Getting the URL including the base path, the querystring is prefixed\n */\n get absolutehrefPrefixedQuerystring(): string {\n const querystring = this.getQuerystring(true);\n\n return querystring.length > 0\n ? [this.absolutepath, querystring].join(\"?\")\n : this.absolutepath;\n }\n\n /**\n * Checks if the URL starts within the given href\n */\n startsWith(href: Href | string): boolean {\n const thisPath = `${this.path}/`;\n const otherPath = href instanceof Href ? `${href.path}/` : href;\n\n return thisPath.startsWith(otherPath);\n }\n\n /**\n * Checks if the given Href equals this Href\n */\n equals(href: Href | string | null): boolean {\n if (href instanceof Href) {\n return this.path === href.path;\n }\n\n return this.path === href;\n }\n\n /**\n */\n equalsWithParameters(href: Href): boolean {\n if (!this.equals(href)) {\n return false;\n }\n\n if (href instanceof Href) {\n if (this.parameters.length !== href.parameters.length) {\n return false;\n }\n\n if (this.parameters.length === 0 && href.parameters.length === 0) {\n return true;\n }\n\n const thisParams = this.parameters.map((param) => param.toString());\n\n return href.parameters.every((param) =>\n thisParams.includes(param.toString()),\n );\n }\n\n throw new IllegalArgumentException(`${href} is not an instance of Href`);\n }\n\n /**\n * Indicates if the link is a content link\n */\n get isContent(): boolean {\n return this.absolutepath.startsWith(\n `${getBasePathModularUI()}${CONTENT_PATH}`,\n );\n }\n\n /**\n */\n getReferenceHash(): ?number {\n return this._referenceHash;\n }\n\n /**\n */\n setReferenceHash(referenceHash: number) {\n this._referenceHash = referenceHash;\n }\n\n /**\n * Returns a complete url from the Href\n */\n toString(): string {\n return this.href;\n }\n\n /**\n */\n toLocation(): LocationShape {\n return {\n pathname: this.path,\n search: this.querystring.length > 0 ? `?${this.querystring}` : \"\",\n hash: this.hash.length > 0 ? `#${this.hash}` : \"\",\n state: {\n origin: this.origin,\n contextPath: this.contextPath,\n ...this.state,\n },\n };\n }\n}\n\nexport default Href;\n"],"mappings":";;;;;;AACA,SACEA,oBAAoB,EACpBC,YAAY,EACZC,YAAY,QACP,iBAAiB;AAExB,OAAOC,SAAS,MAAM,wBAAwB;AAC9C,SAASC,wBAAwB,QAAQ,kBAAkB;AAiB3D;AACA;AACA;AACA,MAAMC,IAAI,CAAC;EAWT;AACF;AACA;EACEC,WAAWA,CACTC,IAAgB,EAChBC,YAAqB,EACrBC,YAA4B,EAC5B;IAAAC,eAAA,gBAjBc,EAAE;IAAAA,eAAA,gBACF,EAAE;IAAAA,eAAA,sBACc,EAAE;IAAAA,eAAA,wBACV,EAAE;IAAAA,eAAA,kBACYT,YAAY,CAACU,GAAG;IAAAD,eAAA,iBACxC,IAAI;IAAAA,eAAA;IAAAA,eAAA,kBAEA,EAAE;IAAAA,eAAA,uBACGV,oBAAoB,CAAC,CAAC;IAU3C,IAAI,CAACQ,YAAY,GAAGA,YAAY,IAAI,EAAE;IAEtC,IAAID,IAAI,YAAYF,IAAI,EAAE;MACxB,IAAI,CAACO,WAAW,CAACL,IAAI,CAAC;IACxB,CAAC,MAAM,IAAI,OAAOA,IAAI,KAAK,QAAQ,EAAE;MACnC,IAAI,CAACM,aAAa,CAACN,IAAI,CAAC;IAC1B,CAAC,MAAM,IAAI,OAAOA,IAAI,KAAK,QAAQ,EAAE;MACnC,IAAI,CAACO,uBAAuB,CAACP,IAAI,CAAC;IACpC;IAEA,IAAI,OAAOE,YAAY,EAAEM,MAAM,KAAK,QAAQ,EAAE;M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MAAM,EAAE,IAAI,CAACoE,WAAW,CAACnC,MAAM,GAAG,CAAC,GAAG,IAAI,IAAI,CAACmC,WAAW,EAAE,GAAG,EAAE;MACjE1E,IAAI,EAAE,IAAI,CAACA,IAAI,CAACuC,MAAM,GAAG,CAAC,GAAG,IAAI,IAAI,CAACvC,IAAI,EAAE,GAAG,EAAE;MACjDC,KAAK,EAAE;QACLL,MAAM,EAAE,IAAI,CAACA,MAAM;QACnBC,WAAW,EAAE,IAAI,CAACA,WAAW;QAC7B,GAAG,IAAI,CAACI;MACV;IACF,CAAC;EACH;AACF;AAEA,eAAef,IAAI","ignoreList":[]}
1
+ {"version":3,"file":"Href.js","names":["getBasePathModularUI","HTTP_METHODS","CONTENT_PATH","Parameter","Href","constructor","href","resourcetype","modelOptions","_defineProperty","GET","setFromHref","setFromString","setFromLocationOrObject","origin","contextPath","path","parameters","hash","state","_origin","_contextPath","pathname","_path","search","addParametersFromString","Array","isArray","_parameters","_context","_mapInstanceProperty","call","param","addParameter","_name","_value","_prefix","getHashFromString","_hash","setStateFromLocationOrObject","_state","getPathFromString","isChangePassword","_context2","_includesInstanceProperty","isCamelRoute","_startsWithInstanceProperty","checkAbsoluteUrl","checkAbsolute","RegExp","test","isExternal","hrefNoHash","substring","indexOf","split","arguments","length","undefined","substr","forEach","paramFromString","fromString","setParameter","name","value","prefix","removeParameter","push","getParameter","_context3","_findInstanceProperty","hasParameter","method","_method","_context4","valueToRemove","newValue","filter","val","join","_context5","_filterInstanceProperty","getQuerystring","_context6","_context7","withPrefix","toQuerystring","getQuerystringForModularUI","_context8","_context9","isModUIParameter","querystring","setState","_resourcetype","absolutepath","absolutehref","absolutehrefPrefixedQuerystring","startsWith","thisPath","otherPath","equals","equalsWithParameters","other","_context10","thisParams","toString","every","isContent","_context11","getReferenceHash","_referenceHash","setReferenceHash","referenceHash","toLocation"],"sources":["../../../src/models/href/Href.js"],"sourcesContent":["// @flow\nimport {\n getBasePathModularUI,\n HTTP_METHODS,\n CONTENT_PATH,\n} from \"../../constants\";\n\nimport Parameter from \"../parameter/Parameter\";\n\nimport type { LocationShape } from \"react-router\";\nimport type { ModelOptions } from \"../types\";\n\ntype HrefObject = {\n _path: string,\n _hash: string,\n _parameters: Array<Parameter>,\n _resourcetype: string,\n _method: $Keys<typeof HTTP_METHODS>,\n _state: ?{ [key: string]: any },\n pathname: ?string,\n};\n\nexport type HrefInput = Href | HrefObject | LocationShape | string;\n\n/**\n * Defines a Href with the parameters\n */\nclass Href {\n _path: string = \"\";\n _hash: string = \"\";\n _parameters: Array<Parameter> = [];\n _resourcetype: string = \"\";\n _method: $Keys<typeof HTTP_METHODS> = HTTP_METHODS.GET;\n _state: any = null;\n _referenceHash: ?number;\n _origin: string = \"\";\n _contextPath: string = getBasePathModularUI();\n\n /**\n * Create a Href\n */\n constructor(\n href?: HrefInput,\n resourcetype?: string,\n modelOptions?: ?ModelOptions,\n ) {\n this.resourcetype = resourcetype ?? \"\";\n\n if (href instanceof Href) {\n this.setFromHref(href);\n } else if (typeof href === \"string\") {\n this.setFromString(href);\n } else if (typeof href === \"object\") {\n this.setFromLocationOrObject(href);\n }\n\n if (typeof modelOptions?.origin === \"string\") {\n this.origin = modelOptions.origin;\n }\n\n if (typeof modelOptions?.contextPath === \"string\") {\n this.contextPath = modelOptions.contextPath;\n }\n }\n\n /**\n * Set parameters from Href model input\n */\n setFromHref(href: Href) {\n this.origin = href.origin;\n this.contextPath = href.contextPath;\n this.path = href.path;\n this.parameters = href.parameters;\n this.hash = href.hash;\n this.state = href.state;\n }\n\n /**\n */\n setFromLocationOrObject(href: LocationShape | HrefObject) {\n // $FlowFixMe\n if (typeof href._origin === \"string\") {\n this.origin = href._origin;\n }\n // $FlowFixMe\n if (typeof href._contextPath === \"string\") {\n this.contextPath = href._contextPath;\n }\n\n if (typeof href[\"pathname\"] === \"string\") {\n this.path = href.pathname;\n } else if (typeof href._path === \"string\") {\n this.path = href._path;\n }\n\n if (href.search) {\n this.addParametersFromString(href.search);\n } else if (Array.isArray(href._parameters)) {\n // $FlowExpectedError[incompatible-call]\n href._parameters.map((param: Parameter) =>\n this.addParameter(param._name, param._value, param._prefix),\n );\n }\n\n if (href.hash) {\n this.hash = Href.getHashFromString(href.hash);\n } else if (typeof href._hash === \"string\") {\n this.hash = href._hash;\n }\n\n if (typeof href.state === \"object\") {\n this.setStateFromLocationOrObject(href.state);\n } else if (typeof href._state === \"object\") {\n this.setStateFromLocationOrObject(href._state);\n }\n }\n\n /**\n */\n setStateFromLocationOrObject(state?: any) {\n if (state != null) {\n this.state = state;\n if (typeof state.contextPath === \"string\") {\n this.contextPath = state.contextPath;\n }\n if (typeof state.origin === \"string\") {\n this.origin = state.origin;\n }\n }\n }\n\n /**\n * Set parameters from string input\n */\n setFromString(href: string) {\n this.path = Href.getPathFromString(href);\n this.addParametersFromString(href);\n this.hash = Href.getHashFromString(href);\n }\n\n /**\n */\n get isChangePassword(): boolean {\n return this._path.includes(\"/change-password\");\n }\n\n /**\n * check if the path is referencing a camel route\n */\n static isCamelRoute(path: string): boolean {\n return (\n path.startsWith(\"/restServices\") && !path.startsWith(\"/restServices/ui\")\n );\n }\n\n /**\n */\n static checkAbsoluteUrl(href: string): boolean {\n const checkAbsolute = new RegExp(\"^(?:[a-z]+:)?//\", \"i\");\n return checkAbsolute.test(href);\n }\n\n // Check if url is relative (not checking for absolute urls with same domain)\n /**\n */\n get isExternal(): boolean {\n return Href.checkAbsoluteUrl(this.path);\n }\n\n /**\n * Retrieve the relative path part of a href string, e.g. https://www.beinformed.com/BeInformed/tab/view?q=url => /tab/view\n */\n static getPathFromString(href: string): string {\n const hrefNoHash = href.includes(\"#\")\n ? href.substring(0, href.indexOf(\"#\"))\n : href;\n\n return hrefNoHash.includes(\"?\") ? hrefNoHash.split(\"?\")[0] : hrefNoHash;\n }\n\n /**\n * Retrieve hash of href string\n */\n static getHashFromString(href: string = \"\"): string {\n return href.includes(\"#\") ? href.substr(href.indexOf(\"#\") + 1) : \"\";\n }\n\n /**\n * Add a parameter for each parameter found in the querystring of an URL string, e.g. https://www.beinformed.com?q=url => q=url\n */\n addParametersFromString(href: string): Href {\n if (href.includes(\"?\")) {\n href\n .split(\"?\")[1]\n .split(\"&\")\n .forEach((param) => {\n const paramFromString = Parameter.fromString(param);\n if (paramFromString) {\n this.setParameter(\n paramFromString.name,\n paramFromString.value,\n paramFromString.prefix,\n );\n }\n });\n }\n\n return this;\n }\n\n /**\n * Add a querystring parameter to the parameter collection of this Href, skips parameters that have a value of null\n */\n addParameter(name: string, value: ?string, prefix: ?string): Href {\n if (value !== null) {\n this.removeParameter(name, prefix);\n this._parameters.push(new Parameter(prefix, name, value));\n }\n\n return this;\n }\n\n /**\n * Adds or overwrites a parameter when it exists and value is not null.\n * Removes the parameter when the value is null\n */\n setParameter(name: string, value: ?string, prefix: ?string): Href {\n if (value === null) {\n this.removeParameter(name, prefix);\n } else {\n this.addParameter(name, value, prefix);\n }\n\n return this;\n }\n\n /**\n * Retrieve a parameter by it's name and (optionally) prefix\n */\n getParameter(name: string, prefix: ?string): ?Parameter {\n return this._parameters.find(\n (param) => param.prefix === prefix && param.name === name,\n );\n }\n\n /**\n */\n hasParameter(name: string, prefix: ?string): boolean {\n return this.getParameter(name, prefix) !== undefined;\n }\n\n /**\n * Get request method\n */\n get method(): $Keys<typeof HTTP_METHODS> {\n return this._method;\n }\n\n /**\n * Set request method\n */\n set method(method: $Keys<typeof HTTP_METHODS>) {\n this._method = method || HTTP_METHODS.GET;\n }\n\n /**\n * Retrieve all paremters\n */\n get parameters(): Array<Parameter> {\n return this._parameters;\n }\n\n /**\n * Replace parameters of Href\n */\n set parameters(parameters: Array<Parameter>) {\n this._parameters = parameters;\n }\n\n /**\n * Remove a parameter from the parameter collection\n */\n removeParameter(name: string, prefix: ?string, value: ?string): Href {\n if (value !== undefined) {\n const valueToRemove = value;\n\n this._parameters = this._parameters.map((param) => {\n if (param.prefix === prefix && param.name === name) {\n const newValue = param.value\n ?.split(\",\")\n .filter((val) => val !== valueToRemove)\n .join(\",\");\n return new Parameter(param.prefix, param.name, newValue);\n }\n return param;\n });\n } else {\n this._parameters = this._parameters.filter(\n (param) => param.prefix !== prefix || param.name !== name,\n );\n }\n\n return this;\n }\n\n /**\n * Get the parameters as a querystring, e.g. param1=value1&param2=value2, optionally with prefix\n */\n getQuerystring(withPrefix: boolean = false): string {\n return this.parameters\n .filter((param) => param.value != null && param.value !== \"\")\n .map((param) => param.toQuerystring(withPrefix))\n .join(\"&\");\n }\n\n /**\n * Retrieve a querystring that only contains parameter that can be send to the modular ui, parameters are filtered by prefix\n */\n getQuerystringForModularUI(prefix: string = \"\"): string {\n return this.parameters\n .filter(\n (param) =>\n param.isModUIParameter &&\n (!prefix || !param.prefix || param.prefix === prefix) &&\n param.value != null,\n )\n .map((param) => param.toQuerystring(false))\n .join(\"&\");\n }\n\n /**\n * Retrieve all parameters from the parameter collection in a querystring style name1=value1&name2=value2, without the prefix\n */\n get querystring(): string {\n return this.getQuerystring(false);\n }\n\n /**\n * Set the path of the Href, the part before the querystring question mark\n */\n set path(path: string) {\n this._path = path;\n }\n\n /**\n * Retrieve the path\n */\n get path(): string {\n return this._path ?? \"\";\n }\n\n /**\n * Retrieve the origin (e.g. http://example.com:18080)<br>\n * Empty when the default must be used\n */\n get origin(): string {\n return this._origin ?? \"\";\n }\n\n /**\n * Set the origin (e.g. http://example.com:18080)\n */\n set origin(origin: string) {\n this._origin = origin;\n }\n\n /**\n * Get the context path\n */\n get contextPath(): string {\n return this._contextPath;\n }\n\n /**\n * Set the context path if different from default\n */\n set contextPath(contextPath: string) {\n this._contextPath = contextPath;\n }\n\n /**\n * Set hash\n */\n set hash(hash: string) {\n this._hash = hash;\n }\n\n /**\n * Retrieve hash\n */\n get hash(): string {\n return this._hash;\n }\n\n /**\n */\n set state(state: any) {\n this._state = state;\n }\n\n /**\n */\n get state(): any {\n return this._state;\n }\n\n /**\n */\n setState(state: any): Href {\n this.state = state;\n\n return this;\n }\n\n /**\n * Set resourctype\n */\n set resourcetype(resourcetype: string) {\n this._resourcetype = resourcetype;\n }\n\n /**\n * Retrieve resourceType\n */\n get resourcetype(): string {\n return this._resourcetype;\n }\n\n /**\n * Retrieve the path combined with the base path (context-path) of the application, e.g. /BeInformed\n */\n get absolutepath(): string {\n if (this.isExternal) {\n return this.path;\n }\n\n return this.origin + this.contextPath + this.path;\n }\n\n /**\n * Retrieves the combination of the path and the querystring\n */\n get href(): string {\n return this.querystring.length > 0\n ? [this.path, this.querystring].join(\"?\")\n : this.path;\n }\n\n /**\n * Getting the URL including the base path, querystring is prefixed\n */\n get absolutehref(): string {\n const querystring = this.getQuerystring(false);\n\n return querystring.length > 0\n ? [this.absolutepath, querystring].join(\"?\")\n : this.absolutepath;\n }\n\n /**\n * Getting the URL including the base path, the querystring is prefixed\n */\n get absolutehrefPrefixedQuerystring(): string {\n const querystring = this.getQuerystring(true);\n\n return querystring.length > 0\n ? [this.absolutepath, querystring].join(\"?\")\n : this.absolutepath;\n }\n\n /**\n * Checks if the URL starts within the given href\n */\n startsWith(href: Href | string): boolean {\n const thisPath = `${this.path}/`;\n const otherPath = href instanceof Href ? `${href.path}/` : href;\n\n return thisPath.startsWith(otherPath);\n }\n\n /**\n * Checks if the given Href equals this Href\n */\n equals(href: Href | string | null): boolean {\n if (href instanceof Href) {\n return this.path === href.path;\n }\n\n return this.path === href;\n }\n\n /**\n */\n equalsWithParameters(other: Href | string | null): boolean {\n if (other == null) {\n return false;\n }\n\n const href = other instanceof Href ? other : new Href(other);\n\n if (!this.equals(href)) {\n return false;\n }\n\n if (this.parameters.length !== href.parameters.length) {\n return false;\n }\n\n if (this.parameters.length === 0 && href.parameters.length === 0) {\n return true;\n }\n\n const thisParams = this.parameters.map((param) => param.toString());\n\n return href.parameters.every((param) =>\n thisParams.includes(param.toString()),\n );\n }\n\n /**\n * Indicates if the link is a content link\n */\n get isContent(): boolean {\n return this.absolutepath.startsWith(\n `${getBasePathModularUI()}${CONTENT_PATH}`,\n );\n }\n\n /**\n */\n getReferenceHash(): ?number {\n return this._referenceHash;\n }\n\n /**\n */\n setReferenceHash(referenceHash: number) {\n this._referenceHash = referenceHash;\n }\n\n /**\n * Returns a complete url from the Href\n */\n toString(): string {\n return this.href;\n }\n\n /**\n */\n toLocation(): LocationShape {\n return {\n pathname: this.path,\n search: this.querystring.length > 0 ? `?${this.querystring}` : \"\",\n hash: this.hash.length > 0 ? `#${this.hash}` : \"\",\n state: {\n origin: this.origin,\n contextPath: this.contextPath,\n ...this.state,\n },\n };\n }\n}\n\nexport default Href;\n"],"mappings":";;;;;;AACA,SACEA,oBAAoB,EACpBC,YAAY,EACZC,YAAY,QACP,iBAAiB;AAExB,OAAOC,SAAS,MAAM,wBAAwB;AAiB9C;AACA;AACA;AACA,MAAMC,IAAI,CAAC;EAWT;AACF;AACA;EACEC,WAAWA,CACTC,IAAgB,EAChBC,YAAqB,EACrBC,YAA4B,EAC5B;IAAAC,eAAA,gBAjBc,EAAE;IAAAA,eAAA,gBACF,EAAE;IAAAA,eAAA,sBACc,EAAE;IAAAA,eAAA,wBACV,EAAE;IAAAA,eAAA,kBACYR,YAAY,CAACS,GAAG;IAAAD,eAAA,iBACxC,IAAI;IAAAA,eAAA;IAAAA,eAAA,kBAEA,EAAE;IAAAA,eAAA,uBACGT,oBAAoB,CAAC,CAAC;IAU3C,IAAI,CAACO,YAAY,GAAGA,YAAY,IAAI,EAAE;IAEtC,IAAID,IAAI,YAAYF,IAAI,EAAE;MACxB,IAAI,CAACO,WAAW,CAACL,IAAI,CAAC;IACxB,CAAC,MAAM,IAAI,OAAOA,IAAI,KAAK,QAAQ,EAAE;MACnC,IAAI,CAACM,aAAa,CAACN,IAAI,CAAC;IAC1B,CAAC,MAAM,IAAI,OAAOA,IAAI,KAAK,QAAQ,EAAE;MACnC,IAAI,CAACO,uBAAuB,CAACP,IAAI,CAAC;IACpC;IAEA,IAAI,OAAOE,YAAY,EAAEM,MAAM,KAAK,QAAQ,EAAE;MAC5C,IAAI,CAACA,MAAM,GA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,IAAI,CAACN,IAAI;MACnBQ,MAAM,EAAE,IAAI,CAACoE,WAAW,CAACnC,MAAM,GAAG,CAAC,GAAG,IAAI,IAAI,CAACmC,WAAW,EAAE,GAAG,EAAE;MACjE1E,IAAI,EAAE,IAAI,CAACA,IAAI,CAACuC,MAAM,GAAG,CAAC,GAAG,IAAI,IAAI,CAACvC,IAAI,EAAE,GAAG,EAAE;MACjDC,KAAK,EAAE;QACLL,MAAM,EAAE,IAAI,CAACA,MAAM;QACnBC,WAAW,EAAE,IAAI,CAACA,WAAW;QAC7B,GAAG,IAAI,CAACI;MACV;IACF,CAAC;EACH;AACF;AAEA,eAAef,IAAI","ignoreList":[]}
@@ -19,6 +19,9 @@ export const useUrl = (resource, props) => {
19
19
  const [previousUrl, setPreviousUrl] = useState(null);
20
20
  const [previousExact, setPreviousExact] = useState(false);
21
21
  const url = getUrl(resource, props);
22
+ if (url == null && previousUrl == null) {
23
+ return new Href("");
24
+ }
22
25
  const {
23
26
  match
24
27
  } = props;
@@ -28,8 +31,8 @@ export const useUrl = (resource, props) => {
28
31
  if (!match) {
29
32
  return url;
30
33
  }
31
- if (url.equals(previousUrl)) {
32
- return url;
34
+ if (url.equalsWithParameters(previousUrl)) {
35
+ return previousUrl || url;
33
36
  }
34
37
 
35
38
  // Always create an url when the match is exact
@@ -1 +1 @@
1
- {"version":3,"file":"ModularUIUtils.js","names":["useState","getDisplayName","MODULARUI_STATUS","Href","getUrl","resource","props","url","useUrl","previousUrl","setPreviousUrl","previousExact","setPreviousExact","match","equals","isExact","startsWith","getKey","WrappedComponent","name","split","useReload","modelEntry","reload","arguments","length","undefined","isFullyLoaded","status","FINISHED","lastModification"],"sources":["../../../src/redux/_modularui/ModularUIUtils.js"],"sourcesContent":["// @flow\nimport { useState } from \"react\";\n\nimport { getDisplayName } from \"../../react/utils\";\nimport { MODULARUI_STATUS } from \"../../constants/Constants\";\nimport Href from \"../../models/href/Href\";\n\nimport type { ComponentType } from \"react\";\n\n/**\n * Generate modular ui url\n */\nconst getUrl = (resource: string | Function | Href, props: Object): Href => {\n const url = typeof resource === \"function\" ? resource(props) : resource;\n\n if (url instanceof Href) {\n return url;\n }\n\n return new Href(url);\n};\n\n/**\n */\nexport const useUrl = (\n resource: string | Function | Href,\n props: Object,\n): Href => {\n const [previousUrl, setPreviousUrl] = useState(null);\n const [previousExact, setPreviousExact] = useState(false);\n\n const url = getUrl(resource, props);\n\n const { match } = props;\n\n // when match is not available through props,\n // this is a direct call to the modular ui hoc, not using a route\n if (!match) {\n return url;\n }\n\n if (url.equals(previousUrl)) {\n return url;\n }\n\n // Always create an url when the match is exact\n // Or when the match is not exact AND the original match also was not exact\n // Or when the new start uri is different from the previous url --> different resource for same panel\n if (\n match.isExact === true ||\n previousExact === match.isExact ||\n !previousUrl?.startsWith(match.url)\n ) {\n setPreviousUrl(url);\n setPreviousExact(match.isExact);\n\n return url;\n }\n\n return previousUrl || new Href(\"\");\n};\n\n/**\n * Create key for modularui request based on component name and requested url\n */\nexport const getKey = (\n WrappedComponent: ComponentType<any>,\n name: string,\n url: string,\n): string => {\n if (url) {\n return `${getDisplayName(WrappedComponent, name)}(${url.split(\"?\")[0]})`;\n }\n\n return getDisplayName(WrappedComponent, name);\n};\n\n/**\n * Check if the model corresponding to a modular ui service should be reloaded\n */\nexport const useReload = (modelEntry: Object, reload: number = 0): boolean => {\n if (reload > 0) {\n const isFullyLoaded = modelEntry?.status === MODULARUI_STATUS.FINISHED;\n const lastModification = modelEntry?.lastModification ?? 0;\n\n if (isFullyLoaded && lastModification < reload) {\n return true;\n }\n }\n\n return false;\n};\n"],"mappings":"AACA,SAASA,QAAQ,QAAQ,OAAO;AAEhC,SAASC,cAAc,QAAQ,mBAAmB;AAClD,SAASC,gBAAgB,QAAQ,2BAA2B;AAC5D,OAAOC,IAAI,MAAM,wBAAwB;AAIzC;AACA;AACA;AACA,MAAMC,MAAM,GAAGA,CAACC,QAAkC,EAAEC,KAAa,KAAW;EAC1E,MAAMC,GAAG,GAA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,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG;EAC1E;EAEA,OAAOnB,cAAc,CAACiB,gBAAgB,EAAEC,IAAI,CAAC;AAC/C,CAAC;;AAED;AACA;AACA;AACA,OAAO,MAAME,SAAS,GAAG,SAAAA,CAACC,UAAkB,EAAkC;EAAA,IAAhCC,MAAc,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC;EAC9D,IAAID,MAAM,GAAG,CAAC,EAAE;IACd,MAAMI,aAAa,GAAGL,UAAU,EAAEM,MAAM,KAAK1B,gBAAgB,CAAC2B,QAAQ;IACtE,MAAMC,gBAAgB,GAAGR,UAAU,EAAEQ,gBAAgB,IAAI,CAAC;IAE1D,IAAIH,aAAa,IAAIG,gBAAgB,GAAGP,MAAM,EAAE;MAC9C,OAAO,IAAI;IACb;EACF;EAEA,OAAO,KAAK;AACd,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"ModularUIUtils.js","names":["useState","getDisplayName","MODULARUI_STATUS","Href","getUrl","resource","props","url","useUrl","previousUrl","setPreviousUrl","previousExact","setPreviousExact","match","equalsWithParameters","isExact","startsWith","getKey","WrappedComponent","name","split","useReload","modelEntry","reload","arguments","length","undefined","isFullyLoaded","status","FINISHED","lastModification"],"sources":["../../../src/redux/_modularui/ModularUIUtils.js"],"sourcesContent":["// @flow\nimport { useState } from \"react\";\n\nimport { getDisplayName } from \"../../react/utils\";\nimport { MODULARUI_STATUS } from \"../../constants/Constants\";\nimport Href from \"../../models/href/Href\";\n\nimport type { ComponentType } from \"react\";\n\n/**\n * Generate modular ui url\n */\nconst getUrl = (resource: string | Function | Href, props: Object): Href => {\n const url = typeof resource === \"function\" ? resource(props) : resource;\n\n if (url instanceof Href) {\n return url;\n }\n\n return new Href(url);\n};\n\n/**\n */\nexport const useUrl = (\n resource: string | Function | Href,\n props: Object,\n): Href => {\n const [previousUrl, setPreviousUrl] = useState(null);\n const [previousExact, setPreviousExact] = useState(false);\n\n const url = getUrl(resource, props);\n\n if (url == null && previousUrl == null) {\n return new Href(\"\");\n }\n\n const { match } = props;\n\n // when match is not available through props,\n // this is a direct call to the modular ui hoc, not using a route\n if (!match) {\n return url;\n }\n\n if (url.equalsWithParameters(previousUrl)) {\n return previousUrl || url;\n }\n\n // Always create an url when the match is exact\n // Or when the match is not exact AND the original match also was not exact\n // Or when the new start uri is different from the previous url --> different resource for same panel\n if (\n match.isExact === true ||\n previousExact === match.isExact ||\n !previousUrl?.startsWith(match.url)\n ) {\n setPreviousUrl(url);\n setPreviousExact(match.isExact);\n\n return url;\n }\n\n return previousUrl || new Href(\"\");\n};\n\n/**\n * Create key for modularui request based on component name and requested url\n */\nexport const getKey = (\n WrappedComponent: ComponentType<any>,\n name: string,\n url: string,\n): string => {\n if (url) {\n return `${getDisplayName(WrappedComponent, name)}(${url.split(\"?\")[0]})`;\n }\n\n return getDisplayName(WrappedComponent, name);\n};\n\n/**\n * Check if the model corresponding to a modular ui service should be reloaded\n */\nexport const useReload = (modelEntry: Object, reload: number = 0): boolean => {\n if (reload > 0) {\n const isFullyLoaded = modelEntry?.status === MODULARUI_STATUS.FINISHED;\n const lastModification = modelEntry?.lastModification ?? 0;\n\n if (isFullyLoaded && lastModification < reload) {\n return true;\n }\n }\n\n return false;\n};\n"],"mappings":"AACA,SAASA,QAAQ,QAAQ,OAAO;AAEhC,SAASC,cAAc,QAAQ,mBAAmB;AAClD,SAASC,gBAAgB,QAAQ,2BAA2B;AAC5D,OAAOC,IAAI,MAAM,wBAAwB;AAIzC;AACA;AACA;AACA,MAAMC,MAAM,GAAGA,CAACC,QAAkC,EAAEC,KAAa,KAAW;EAC1E,MAAMC,GAAG,GAAG,OAAOF,QAAQ,KAAK,UAAU,GAAGA,QAAQ,CAACC,KAAK,CAAC,GAAGD,QAAQ;EAEvE,IAAIE,GAAG,YAAYJ,IAAI,EAAE;IACvB,OAAOI,GAAG;EACZ;EAEA,OAAO,IAAIJ,IAAI,CAACI,GA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,OAAOnB,cAAc,CAACiB,gBAAgB,EAAEC,IAAI,CAAC;AAC/C,CAAC;;AAED;AACA;AACA;AACA,OAAO,MAAME,SAAS,GAAG,SAAAA,CAACC,UAAkB,EAAkC;EAAA,IAAhCC,MAAc,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC;EAC9D,IAAID,MAAM,GAAG,CAAC,EAAE;IACd,MAAMI,aAAa,GAAGL,UAAU,EAAEM,MAAM,KAAK1B,gBAAgB,CAAC2B,QAAQ;IACtE,MAAMC,gBAAgB,GAAGR,UAAU,EAAEQ,gBAAgB,IAAI,CAAC;IAE1D,IAAIH,aAAa,IAAIG,gBAAgB,GAAGP,MAAM,EAAE;MAC9C,OAAO,IAAI;IACb;EACF;EAEA,OAAO,KAAK;AACd,CAAC","ignoreList":[]}
@@ -13,7 +13,6 @@ var _filter = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-sta
13
13
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/defineProperty"));
14
14
  var _constants = require("../../constants");
15
15
  var _Parameter = _interopRequireDefault(require("../parameter/Parameter"));
16
- var _exceptions = require("../../exceptions");
17
16
  /**
18
17
  * Defines a Href with the parameters
19
18
  */
@@ -432,22 +431,23 @@ class Href {
432
431
 
433
432
  /**
434
433
  */
435
- equalsWithParameters(href) {
434
+ equalsWithParameters(other) {
435
+ var _context10;
436
+ if (other == null) {
437
+ return false;
438
+ }
439
+ const href = other instanceof Href ? other : new Href(other);
436
440
  if (!this.equals(href)) {
437
441
  return false;
438
442
  }
439
- if (href instanceof Href) {
440
- var _context10;
441
- if (this.parameters.length !== href.parameters.length) {
442
- return false;
443
- }
444
- if (this.parameters.length === 0 && href.parameters.length === 0) {
445
- return true;
446
- }
447
- const thisParams = (0, _map.default)(_context10 = this.parameters).call(_context10, param => param.toString());
448
- return href.parameters.every(param => (0, _includes.default)(thisParams).call(thisParams, param.toString()));
443
+ if (this.parameters.length !== href.parameters.length) {
444
+ return false;
445
+ }
446
+ if (this.parameters.length === 0 && href.parameters.length === 0) {
447
+ return true;
449
448
  }
450
- throw new _exceptions.IllegalArgumentException(`${href} is not an instance of Href`);
449
+ const thisParams = (0, _map.default)(_context10 = this.parameters).call(_context10, param => param.toString());
450
+ return href.parameters.every(param => (0, _includes.default)(thisParams).call(thisParams, param.toString()));
451
451
  }
452
452
 
453
453
  /**
@@ -6,7 +6,6 @@ import {
6
6
  } from "../../constants";
7
7
 
8
8
  import Parameter from "../parameter/Parameter";
9
- import { IllegalArgumentException } from "../../exceptions";
10
9
 
11
10
  import type { LocationShape } from "react-router";
12
11
  import type { ModelOptions } from "../types";
@@ -492,28 +491,30 @@ class Href {
492
491
 
493
492
  /**
494
493
  */
495
- equalsWithParameters(href: Href): boolean {
496
- if (!this.equals(href)) {
494
+ equalsWithParameters(other: Href | string | null): boolean {
495
+ if (other == null) {
497
496
  return false;
498
497
  }
499
498
 
500
- if (href instanceof Href) {
501
- if (this.parameters.length !== href.parameters.length) {
502
- return false;
503
- }
499
+ const href = other instanceof Href ? other : new Href(other);
504
500
 
505
- if (this.parameters.length === 0 && href.parameters.length === 0) {
506
- return true;
507
- }
501
+ if (!this.equals(href)) {
502
+ return false;
503
+ }
508
504
 
509
- const thisParams = this.parameters.map((param) => param.toString());
505
+ if (this.parameters.length !== href.parameters.length) {
506
+ return false;
507
+ }
510
508
 
511
- return href.parameters.every((param) =>
512
- thisParams.includes(param.toString()),
513
- );
509
+ if (this.parameters.length === 0 && href.parameters.length === 0) {
510
+ return true;
514
511
  }
515
512
 
516
- throw new IllegalArgumentException(`${href} is not an instance of Href`);
513
+ const thisParams = this.parameters.map((param) => param.toString());
514
+
515
+ return href.parameters.every((param) =>
516
+ thisParams.includes(param.toString()),
517
+ );
517
518
  }
518
519
 
519
520
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"Href.js","names":["_constants","require","_Parameter","_interopRequireDefault","_exceptions","Href","constructor","href","resourcetype","modelOptions","_defineProperty2","default","HTTP_METHODS","GET","getBasePathModularUI","setFromHref","setFromString","setFromLocationOrObject","origin","contextPath","path","parameters","hash","state","_origin","_contextPath","pathname","_path","search","addParametersFromString","Array","isArray","_parameters","_context","_map","call","param","addParameter","_name","_value","_prefix","getHashFromString","_hash","setStateFromLocationOrObject","_state","getPathFromString","isChangePassword","_context2","_includes","isCamelRoute","_startsWith","checkAbsoluteUrl","checkAbsolute","RegExp","test","isExternal","hrefNoHash","substring","indexOf","split","arguments","length","undefined","substr","forEach","paramFromString","Parameter","fromString","setParameter","name","value","prefix","removeParameter","push","getParameter","_context3","_find","hasParameter","method","_method","_context4","valueToRemove","newValue","filter","val","join","_context5","_filter","getQuerystring","_context6","_context7","withPrefix","toQuerystring","getQuerystringForModularUI","_context8","_context9","isModUIParameter","querystring","setState","_resourcetype","absolutepath","absolutehref","absolutehrefPrefixedQuerystring","startsWith","thisPath","otherPath","equals","equalsWithParameters","_context10","thisParams","toString","every","IllegalArgumentException","isContent","_context11","CONTENT_PATH","getReferenceHash","_referenceHash","setReferenceHash","referenceHash","toLocation","_default","exports"],"sources":["../../../src/models/href/Href.js"],"sourcesContent":["// @flow\nimport {\n getBasePathModularUI,\n HTTP_METHODS,\n CONTENT_PATH,\n} from \"../../constants\";\n\nimport Parameter from \"../parameter/Parameter\";\nimport { IllegalArgumentException } from \"../../exceptions\";\n\nimport type { LocationShape } from \"react-router\";\nimport type { ModelOptions } from \"../types\";\n\ntype HrefObject = {\n _path: string,\n _hash: string,\n _parameters: Array<Parameter>,\n _resourcetype: string,\n _method: $Keys<typeof HTTP_METHODS>,\n _state: ?{ [key: string]: any },\n pathname: ?string,\n};\n\nexport type HrefInput = Href | HrefObject | LocationShape | string;\n\n/**\n * Defines a Href with the parameters\n */\nclass Href {\n _path: string = \"\";\n _hash: string = \"\";\n _parameters: Array<Parameter> = [];\n _resourcetype: string = \"\";\n _method: $Keys<typeof HTTP_METHODS> = HTTP_METHODS.GET;\n _state: any = null;\n _referenceHash: ?number;\n _origin: string = \"\";\n _contextPath: string = getBasePathModularUI();\n\n /**\n * Create a Href\n */\n constructor(\n href?: HrefInput,\n resourcetype?: string,\n modelOptions?: ?ModelOptions,\n ) {\n this.resourcetype = resourcetype ?? \"\";\n\n if (href instanceof Href) {\n this.setFromHref(href);\n } else if (typeof href === \"string\") {\n this.setFromString(href);\n } else if (typeof href === \"object\") {\n this.setFromLocationOrObject(href);\n }\n\n if (typeof modelOptions?.origin === \"string\") {\n this.origin = modelOptions.origin;\n }\n\n if (typeof modelOptions?.contextPath === \"string\") {\n this.contextPath = modelOptions.contextPath;\n }\n }\n\n /**\n * Set parameters from Href model input\n */\n setFromHref(href: Href) {\n this.origin = href.origin;\n this.contextPath = href.contextPath;\n this.path = href.path;\n this.parameters = href.parameters;\n this.hash = href.hash;\n this.state = href.state;\n }\n\n /**\n */\n setFromLocationOrObject(href: LocationShape | HrefObject) {\n // $FlowFixMe\n if (typeof href._origin === \"string\") {\n this.origin = href._origin;\n }\n // $FlowFixMe\n if (typeof href._contextPath === \"string\") {\n this.contextPath = href._contextPath;\n }\n\n if (typeof href[\"pathname\"] === \"string\") {\n this.path = href.pathname;\n } else if (typeof href._path === \"string\") {\n this.path = href._path;\n }\n\n if (href.search) {\n this.addParametersFromString(href.search);\n } else if (Array.isArray(href._parameters)) {\n // $FlowExpectedError[incompatible-call]\n href._parameters.map((param: Parameter) =>\n this.addParameter(param._name, param._value, param._prefix),\n );\n }\n\n if (href.hash) {\n this.hash = Href.getHashFromString(href.hash);\n } else if (typeof href._hash === \"string\") {\n this.hash = href._hash;\n }\n\n if (typeof href.state === \"object\") {\n this.setStateFromLocationOrObject(href.state);\n } else if (typeof href._state === \"object\") {\n this.setStateFromLocationOrObject(href._state);\n }\n }\n\n /**\n */\n setStateFromLocationOrObject(state?: any) {\n if (state != null) {\n this.state = state;\n if (typeof state.contextPath === \"string\") {\n this.contextPath = state.contextPath;\n }\n if (typeof state.origin === \"string\") {\n this.origin = state.origin;\n }\n }\n }\n\n /**\n * Set parameters from string input\n */\n setFromString(href: string) {\n this.path = Href.getPathFromString(href);\n this.addParametersFromString(href);\n this.hash = Href.getHashFromString(href);\n }\n\n /**\n */\n get isChangePassword(): boolean {\n return this._path.includes(\"/change-password\");\n }\n\n /**\n * check if the path is referencing a camel route\n */\n static isCamelRoute(path: string): boolean {\n return (\n path.startsWith(\"/restServices\") && !path.startsWith(\"/restServices/ui\")\n );\n }\n\n /**\n */\n static checkAbsoluteUrl(href: string): boolean {\n const checkAbsolute = new RegExp(\"^(?:[a-z]+:)?//\", \"i\");\n return checkAbsolute.test(href);\n }\n\n // Check if url is relative (not checking for absolute urls with same domain)\n /**\n */\n get isExternal(): boolean {\n return Href.checkAbsoluteUrl(this.path);\n }\n\n /**\n * Retrieve the relative path part of a href string, e.g. https://www.beinformed.com/BeInformed/tab/view?q=url => /tab/view\n */\n static getPathFromString(href: string): string {\n const hrefNoHash = href.includes(\"#\")\n ? href.substring(0, href.indexOf(\"#\"))\n : href;\n\n return hrefNoHash.includes(\"?\") ? hrefNoHash.split(\"?\")[0] : hrefNoHash;\n }\n\n /**\n * Retrieve hash of href string\n */\n static getHashFromString(href: string = \"\"): string {\n return href.includes(\"#\") ? href.substr(href.indexOf(\"#\") + 1) : \"\";\n }\n\n /**\n * Add a parameter for each parameter found in the querystring of an URL string, e.g. https://www.beinformed.com?q=url => q=url\n */\n addParametersFromString(href: string): Href {\n if (href.includes(\"?\")) {\n href\n .split(\"?\")[1]\n .split(\"&\")\n .forEach((param) => {\n const paramFromString = Parameter.fromString(param);\n if (paramFromString) {\n this.setParameter(\n paramFromString.name,\n paramFromString.value,\n paramFromString.prefix,\n );\n }\n });\n }\n\n return this;\n }\n\n /**\n * Add a querystring parameter to the parameter collection of this Href, skips parameters that have a value of null\n */\n addParameter(name: string, value: ?string, prefix: ?string): Href {\n if (value !== null) {\n this.removeParameter(name, prefix);\n this._parameters.push(new Parameter(prefix, name, value));\n }\n\n return this;\n }\n\n /**\n * Adds or overwrites a parameter when it exists and value is not null.\n * Removes the parameter when the value is null\n */\n setParameter(name: string, value: ?string, prefix: ?string): Href {\n if (value === null) {\n this.removeParameter(name, prefix);\n } else {\n this.addParameter(name, value, prefix);\n }\n\n return this;\n }\n\n /**\n * Retrieve a parameter by it's name and (optionally) prefix\n */\n getParameter(name: string, prefix: ?string): ?Parameter {\n return this._parameters.find(\n (param) => param.prefix === prefix && param.name === name,\n );\n }\n\n /**\n */\n hasParameter(name: string, prefix: ?string): boolean {\n return this.getParameter(name, prefix) !== undefined;\n }\n\n /**\n * Get request method\n */\n get method(): $Keys<typeof HTTP_METHODS> {\n return this._method;\n }\n\n /**\n * Set request method\n */\n set method(method: $Keys<typeof HTTP_METHODS>) {\n this._method = method || HTTP_METHODS.GET;\n }\n\n /**\n * Retrieve all paremters\n */\n get parameters(): Array<Parameter> {\n return this._parameters;\n }\n\n /**\n * Replace parameters of Href\n */\n set parameters(parameters: Array<Parameter>) {\n this._parameters = parameters;\n }\n\n /**\n * Remove a parameter from the parameter collection\n */\n removeParameter(name: string, prefix: ?string, value: ?string): Href {\n if (value !== undefined) {\n const valueToRemove = value;\n\n this._parameters = this._parameters.map((param) => {\n if (param.prefix === prefix && param.name === name) {\n const newValue = param.value\n ?.split(\",\")\n .filter((val) => val !== valueToRemove)\n .join(\",\");\n return new Parameter(param.prefix, param.name, newValue);\n }\n return param;\n });\n } else {\n this._parameters = this._parameters.filter(\n (param) => param.prefix !== prefix || param.name !== name,\n );\n }\n\n return this;\n }\n\n /**\n * Get the parameters as a querystring, e.g. param1=value1&param2=value2, optionally with prefix\n */\n getQuerystring(withPrefix: boolean = false): string {\n return this.parameters\n .filter((param) => param.value != null && param.value !== \"\")\n .map((param) => param.toQuerystring(withPrefix))\n .join(\"&\");\n }\n\n /**\n * Retrieve a querystring that only contains parameter that can be send to the modular ui, parameters are filtered by prefix\n */\n getQuerystringForModularUI(prefix: string = \"\"): string {\n return this.parameters\n .filter(\n (param) =>\n param.isModUIParameter &&\n (!prefix || !param.prefix || param.prefix === prefix) &&\n param.value != null,\n )\n .map((param) => param.toQuerystring(false))\n .join(\"&\");\n }\n\n /**\n * Retrieve all parameters from the parameter collection in a querystring style name1=value1&name2=value2, without the prefix\n */\n get querystring(): string {\n return this.getQuerystring(false);\n }\n\n /**\n * Set the path of the Href, the part before the querystring question mark\n */\n set path(path: string) {\n this._path = path;\n }\n\n /**\n * Retrieve the path\n */\n get path(): string {\n return this._path ?? \"\";\n }\n\n /**\n * Retrieve the origin (e.g. http://example.com:18080)<br>\n * Empty when the default must be used\n */\n get origin(): string {\n return this._origin ?? \"\";\n }\n\n /**\n * Set the origin (e.g. http://example.com:18080)\n */\n set origin(origin: string) {\n this._origin = origin;\n }\n\n /**\n * Get the context path\n */\n get contextPath(): string {\n return this._contextPath;\n }\n\n /**\n * Set the context path if different from default\n */\n set contextPath(contextPath: string) {\n this._contextPath = contextPath;\n }\n\n /**\n * Set hash\n */\n set hash(hash: string) {\n this._hash = hash;\n }\n\n /**\n * Retrieve hash\n */\n get hash(): string {\n return this._hash;\n }\n\n /**\n */\n set state(state: any) {\n this._state = state;\n }\n\n /**\n */\n get state(): any {\n return this._state;\n }\n\n /**\n */\n setState(state: any): Href {\n this.state = state;\n\n return this;\n }\n\n /**\n * Set resourctype\n */\n set resourcetype(resourcetype: string) {\n this._resourcetype = resourcetype;\n }\n\n /**\n * Retrieve resourceType\n */\n get resourcetype(): string {\n return this._resourcetype;\n }\n\n /**\n * Retrieve the path combined with the base path (context-path) of the application, e.g. /BeInformed\n */\n get absolutepath(): string {\n if (this.isExternal) {\n return this.path;\n }\n\n return this.origin + this.contextPath + this.path;\n }\n\n /**\n * Retrieves the combination of the path and the querystring\n */\n get href(): string {\n return this.querystring.length > 0\n ? [this.path, this.querystring].join(\"?\")\n : this.path;\n }\n\n /**\n * Getting the URL including the base path, querystring is prefixed\n */\n get absolutehref(): string {\n const querystring = this.getQuerystring(false);\n\n return querystring.length > 0\n ? [this.absolutepath, querystring].join(\"?\")\n : this.absolutepath;\n }\n\n /**\n * Getting the URL including the base path, the querystring is prefixed\n */\n get absolutehrefPrefixedQuerystring(): string {\n const querystring = this.getQuerystring(true);\n\n return querystring.length > 0\n ? [this.absolutepath, querystring].join(\"?\")\n : this.absolutepath;\n }\n\n /**\n * Checks if the URL starts within the given href\n */\n startsWith(href: Href | string): boolean {\n const thisPath = `${this.path}/`;\n const otherPath = href instanceof Href ? `${href.path}/` : href;\n\n return thisPath.startsWith(otherPath);\n }\n\n /**\n * Checks if the given Href equals this Href\n */\n equals(href: Href | string | null): boolean {\n if (href instanceof Href) {\n return this.path === href.path;\n }\n\n return this.path === href;\n }\n\n /**\n */\n equalsWithParameters(href: Href): boolean {\n if (!this.equals(href)) {\n return false;\n }\n\n if (href instanceof Href) {\n if (this.parameters.length !== href.parameters.length) {\n return false;\n }\n\n if (this.parameters.length === 0 && href.parameters.length === 0) {\n return true;\n }\n\n const thisParams = this.parameters.map((param) => param.toString());\n\n return href.parameters.every((param) =>\n thisParams.includes(param.toString()),\n );\n }\n\n throw new IllegalArgumentException(`${href} is not an instance of Href`);\n }\n\n /**\n * Indicates if the link is a content link\n */\n get isContent(): boolean {\n return this.absolutepath.startsWith(\n `${getBasePathModularUI()}${CONTENT_PATH}`,\n );\n }\n\n /**\n */\n getReferenceHash(): ?number {\n return this._referenceHash;\n }\n\n /**\n */\n setReferenceHash(referenceHash: number) {\n this._referenceHash = referenceHash;\n }\n\n /**\n * Returns a complete url from the Href\n */\n toString(): string {\n return this.href;\n }\n\n /**\n */\n toLocation(): LocationShape {\n return {\n pathname: this.path,\n search: this.querystring.length > 0 ? `?${this.querystring}` : \"\",\n hash: this.hash.length > 0 ? `#${this.hash}` : \"\",\n state: {\n origin: this.origin,\n contextPath: this.contextPath,\n ...this.state,\n },\n };\n }\n}\n\nexport default Href;\n"],"mappings":";;;;;;;;;;;;;AACA,IAAAA,UAAA,GAAAC,OAAA;AAMA,IAAAC,UAAA,GAAAC,sBAAA,CAAA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,IAAI,CAACvG,IAAI;EAClB;;EAEA;AACF;EACEiH,UAAUA,CAAA,EAAkB;IAC1B,OAAO;MACL9F,QAAQ,EAAE,IAAI,CAACN,IAAI;MACnBQ,MAAM,EAAE,IAAI,CAACqE,WAAW,CAACpC,MAAM,GAAG,CAAC,GAAG,IAAI,IAAI,CAACoC,WAAW,EAAE,GAAG,EAAE;MACjE3E,IAAI,EAAE,IAAI,CAACA,IAAI,CAACuC,MAAM,GAAG,CAAC,GAAG,IAAI,IAAI,CAACvC,IAAI,EAAE,GAAG,EAAE;MACjDC,KAAK,EAAE;QACLL,MAAM,EAAE,IAAI,CAACA,MAAM;QACnBC,WAAW,EAAE,IAAI,CAACA,WAAW;QAC7B,GAAG,IAAI,CAACI;MACV;IACF,CAAC;EACH;AACF;AAAC,IAAAkG,QAAA,GAAAC,OAAA,CAAA/G,OAAA,GAEcN,IAAI","ignoreList":[]}
1
+ {"version":3,"file":"Href.js","names":["_constants","require","_Parameter","_interopRequireDefault","Href","constructor","href","resourcetype","modelOptions","_defineProperty2","default","HTTP_METHODS","GET","getBasePathModularUI","setFromHref","setFromString","setFromLocationOrObject","origin","contextPath","path","parameters","hash","state","_origin","_contextPath","pathname","_path","search","addParametersFromString","Array","isArray","_parameters","_context","_map","call","param","addParameter","_name","_value","_prefix","getHashFromString","_hash","setStateFromLocationOrObject","_state","getPathFromString","isChangePassword","_context2","_includes","isCamelRoute","_startsWith","checkAbsoluteUrl","checkAbsolute","RegExp","test","isExternal","hrefNoHash","substring","indexOf","split","arguments","length","undefined","substr","forEach","paramFromString","Parameter","fromString","setParameter","name","value","prefix","removeParameter","push","getParameter","_context3","_find","hasParameter","method","_method","_context4","valueToRemove","newValue","filter","val","join","_context5","_filter","getQuerystring","_context6","_context7","withPrefix","toQuerystring","getQuerystringForModularUI","_context8","_context9","isModUIParameter","querystring","setState","_resourcetype","absolutepath","absolutehref","absolutehrefPrefixedQuerystring","startsWith","thisPath","otherPath","equals","equalsWithParameters","other","_context10","thisParams","toString","every","isContent","_context11","CONTENT_PATH","getReferenceHash","_referenceHash","setReferenceHash","referenceHash","toLocation","_default","exports"],"sources":["../../../src/models/href/Href.js"],"sourcesContent":["// @flow\nimport {\n getBasePathModularUI,\n HTTP_METHODS,\n CONTENT_PATH,\n} from \"../../constants\";\n\nimport Parameter from \"../parameter/Parameter\";\n\nimport type { LocationShape } from \"react-router\";\nimport type { ModelOptions } from \"../types\";\n\ntype HrefObject = {\n _path: string,\n _hash: string,\n _parameters: Array<Parameter>,\n _resourcetype: string,\n _method: $Keys<typeof HTTP_METHODS>,\n _state: ?{ [key: string]: any },\n pathname: ?string,\n};\n\nexport type HrefInput = Href | HrefObject | LocationShape | string;\n\n/**\n * Defines a Href with the parameters\n */\nclass Href {\n _path: string = \"\";\n _hash: string = \"\";\n _parameters: Array<Parameter> = [];\n _resourcetype: string = \"\";\n _method: $Keys<typeof HTTP_METHODS> = HTTP_METHODS.GET;\n _state: any = null;\n _referenceHash: ?number;\n _origin: string = \"\";\n _contextPath: string = getBasePathModularUI();\n\n /**\n * Create a Href\n */\n constructor(\n href?: HrefInput,\n resourcetype?: string,\n modelOptions?: ?ModelOptions,\n ) {\n this.resourcetype = resourcetype ?? \"\";\n\n if (href instanceof Href) {\n this.setFromHref(href);\n } else if (typeof href === \"string\") {\n this.setFromString(href);\n } else if (typeof href === \"object\") {\n this.setFromLocationOrObject(href);\n }\n\n if (typeof modelOptions?.origin === \"string\") {\n this.origin = modelOptions.origin;\n }\n\n if (typeof modelOptions?.contextPath === \"string\") {\n this.contextPath = modelOptions.contextPath;\n }\n }\n\n /**\n * Set parameters from Href model input\n */\n setFromHref(href: Href) {\n this.origin = href.origin;\n this.contextPath = href.contextPath;\n this.path = href.path;\n this.parameters = href.parameters;\n this.hash = href.hash;\n this.state = href.state;\n }\n\n /**\n */\n setFromLocationOrObject(href: LocationShape | HrefObject) {\n // $FlowFixMe\n if (typeof href._origin === \"string\") {\n this.origin = href._origin;\n }\n // $FlowFixMe\n if (typeof href._contextPath === \"string\") {\n this.contextPath = href._contextPath;\n }\n\n if (typeof href[\"pathname\"] === \"string\") {\n this.path = href.pathname;\n } else if (typeof href._path === \"string\") {\n this.path = href._path;\n }\n\n if (href.search) {\n this.addParametersFromString(href.search);\n } else if (Array.isArray(href._parameters)) {\n // $FlowExpectedError[incompatible-call]\n href._parameters.map((param: Parameter) =>\n this.addParameter(param._name, param._value, param._prefix),\n );\n }\n\n if (href.hash) {\n this.hash = Href.getHashFromString(href.hash);\n } else if (typeof href._hash === \"string\") {\n this.hash = href._hash;\n }\n\n if (typeof href.state === \"object\") {\n this.setStateFromLocationOrObject(href.state);\n } else if (typeof href._state === \"object\") {\n this.setStateFromLocationOrObject(href._state);\n }\n }\n\n /**\n */\n setStateFromLocationOrObject(state?: any) {\n if (state != null) {\n this.state = state;\n if (typeof state.contextPath === \"string\") {\n this.contextPath = state.contextPath;\n }\n if (typeof state.origin === \"string\") {\n this.origin = state.origin;\n }\n }\n }\n\n /**\n * Set parameters from string input\n */\n setFromString(href: string) {\n this.path = Href.getPathFromString(href);\n this.addParametersFromString(href);\n this.hash = Href.getHashFromString(href);\n }\n\n /**\n */\n get isChangePassword(): boolean {\n return this._path.includes(\"/change-password\");\n }\n\n /**\n * check if the path is referencing a camel route\n */\n static isCamelRoute(path: string): boolean {\n return (\n path.startsWith(\"/restServices\") && !path.startsWith(\"/restServices/ui\")\n );\n }\n\n /**\n */\n static checkAbsoluteUrl(href: string): boolean {\n const checkAbsolute = new RegExp(\"^(?:[a-z]+:)?//\", \"i\");\n return checkAbsolute.test(href);\n }\n\n // Check if url is relative (not checking for absolute urls with same domain)\n /**\n */\n get isExternal(): boolean {\n return Href.checkAbsoluteUrl(this.path);\n }\n\n /**\n * Retrieve the relative path part of a href string, e.g. https://www.beinformed.com/BeInformed/tab/view?q=url => /tab/view\n */\n static getPathFromString(href: string): string {\n const hrefNoHash = href.includes(\"#\")\n ? href.substring(0, href.indexOf(\"#\"))\n : href;\n\n return hrefNoHash.includes(\"?\") ? hrefNoHash.split(\"?\")[0] : hrefNoHash;\n }\n\n /**\n * Retrieve hash of href string\n */\n static getHashFromString(href: string = \"\"): string {\n return href.includes(\"#\") ? href.substr(href.indexOf(\"#\") + 1) : \"\";\n }\n\n /**\n * Add a parameter for each parameter found in the querystring of an URL string, e.g. https://www.beinformed.com?q=url => q=url\n */\n addParametersFromString(href: string): Href {\n if (href.includes(\"?\")) {\n href\n .split(\"?\")[1]\n .split(\"&\")\n .forEach((param) => {\n const paramFromString = Parameter.fromString(param);\n if (paramFromString) {\n this.setParameter(\n paramFromString.name,\n paramFromString.value,\n paramFromString.prefix,\n );\n }\n });\n }\n\n return this;\n }\n\n /**\n * Add a querystring parameter to the parameter collection of this Href, skips parameters that have a value of null\n */\n addParameter(name: string, value: ?string, prefix: ?string): Href {\n if (value !== null) {\n this.removeParameter(name, prefix);\n this._parameters.push(new Parameter(prefix, name, value));\n }\n\n return this;\n }\n\n /**\n * Adds or overwrites a parameter when it exists and value is not null.\n * Removes the parameter when the value is null\n */\n setParameter(name: string, value: ?string, prefix: ?string): Href {\n if (value === null) {\n this.removeParameter(name, prefix);\n } else {\n this.addParameter(name, value, prefix);\n }\n\n return this;\n }\n\n /**\n * Retrieve a parameter by it's name and (optionally) prefix\n */\n getParameter(name: string, prefix: ?string): ?Parameter {\n return this._parameters.find(\n (param) => param.prefix === prefix && param.name === name,\n );\n }\n\n /**\n */\n hasParameter(name: string, prefix: ?string): boolean {\n return this.getParameter(name, prefix) !== undefined;\n }\n\n /**\n * Get request method\n */\n get method(): $Keys<typeof HTTP_METHODS> {\n return this._method;\n }\n\n /**\n * Set request method\n */\n set method(method: $Keys<typeof HTTP_METHODS>) {\n this._method = method || HTTP_METHODS.GET;\n }\n\n /**\n * Retrieve all paremters\n */\n get parameters(): Array<Parameter> {\n return this._parameters;\n }\n\n /**\n * Replace parameters of Href\n */\n set parameters(parameters: Array<Parameter>) {\n this._parameters = parameters;\n }\n\n /**\n * Remove a parameter from the parameter collection\n */\n removeParameter(name: string, prefix: ?string, value: ?string): Href {\n if (value !== undefined) {\n const valueToRemove = value;\n\n this._parameters = this._parameters.map((param) => {\n if (param.prefix === prefix && param.name === name) {\n const newValue = param.value\n ?.split(\",\")\n .filter((val) => val !== valueToRemove)\n .join(\",\");\n return new Parameter(param.prefix, param.name, newValue);\n }\n return param;\n });\n } else {\n this._parameters = this._parameters.filter(\n (param) => param.prefix !== prefix || param.name !== name,\n );\n }\n\n return this;\n }\n\n /**\n * Get the parameters as a querystring, e.g. param1=value1&param2=value2, optionally with prefix\n */\n getQuerystring(withPrefix: boolean = false): string {\n return this.parameters\n .filter((param) => param.value != null && param.value !== \"\")\n .map((param) => param.toQuerystring(withPrefix))\n .join(\"&\");\n }\n\n /**\n * Retrieve a querystring that only contains parameter that can be send to the modular ui, parameters are filtered by prefix\n */\n getQuerystringForModularUI(prefix: string = \"\"): string {\n return this.parameters\n .filter(\n (param) =>\n param.isModUIParameter &&\n (!prefix || !param.prefix || param.prefix === prefix) &&\n param.value != null,\n )\n .map((param) => param.toQuerystring(false))\n .join(\"&\");\n }\n\n /**\n * Retrieve all parameters from the parameter collection in a querystring style name1=value1&name2=value2, without the prefix\n */\n get querystring(): string {\n return this.getQuerystring(false);\n }\n\n /**\n * Set the path of the Href, the part before the querystring question mark\n */\n set path(path: string) {\n this._path = path;\n }\n\n /**\n * Retrieve the path\n */\n get path(): string {\n return this._path ?? \"\";\n }\n\n /**\n * Retrieve the origin (e.g. http://example.com:18080)<br>\n * Empty when the default must be used\n */\n get origin(): string {\n return this._origin ?? \"\";\n }\n\n /**\n * Set the origin (e.g. http://example.com:18080)\n */\n set origin(origin: string) {\n this._origin = origin;\n }\n\n /**\n * Get the context path\n */\n get contextPath(): string {\n return this._contextPath;\n }\n\n /**\n * Set the context path if different from default\n */\n set contextPath(contextPath: string) {\n this._contextPath = contextPath;\n }\n\n /**\n * Set hash\n */\n set hash(hash: string) {\n this._hash = hash;\n }\n\n /**\n * Retrieve hash\n */\n get hash(): string {\n return this._hash;\n }\n\n /**\n */\n set state(state: any) {\n this._state = state;\n }\n\n /**\n */\n get state(): any {\n return this._state;\n }\n\n /**\n */\n setState(state: any): Href {\n this.state = state;\n\n return this;\n }\n\n /**\n * Set resourctype\n */\n set resourcetype(resourcetype: string) {\n this._resourcetype = resourcetype;\n }\n\n /**\n * Retrieve resourceType\n */\n get resourcetype(): string {\n return this._resourcetype;\n }\n\n /**\n * Retrieve the path combined with the base path (context-path) of the application, e.g. /BeInformed\n */\n get absolutepath(): string {\n if (this.isExternal) {\n return this.path;\n }\n\n return this.origin + this.contextPath + this.path;\n }\n\n /**\n * Retrieves the combination of the path and the querystring\n */\n get href(): string {\n return this.querystring.length > 0\n ? [this.path, this.querystring].join(\"?\")\n : this.path;\n }\n\n /**\n * Getting the URL including the base path, querystring is prefixed\n */\n get absolutehref(): string {\n const querystring = this.getQuerystring(false);\n\n return querystring.length > 0\n ? [this.absolutepath, querystring].join(\"?\")\n : this.absolutepath;\n }\n\n /**\n * Getting the URL including the base path, the querystring is prefixed\n */\n get absolutehrefPrefixedQuerystring(): string {\n const querystring = this.getQuerystring(true);\n\n return querystring.length > 0\n ? [this.absolutepath, querystring].join(\"?\")\n : this.absolutepath;\n }\n\n /**\n * Checks if the URL starts within the given href\n */\n startsWith(href: Href | string): boolean {\n const thisPath = `${this.path}/`;\n const otherPath = href instanceof Href ? `${href.path}/` : href;\n\n return thisPath.startsWith(otherPath);\n }\n\n /**\n * Checks if the given Href equals this Href\n */\n equals(href: Href | string | null): boolean {\n if (href instanceof Href) {\n return this.path === href.path;\n }\n\n return this.path === href;\n }\n\n /**\n */\n equalsWithParameters(other: Href | string | null): boolean {\n if (other == null) {\n return false;\n }\n\n const href = other instanceof Href ? other : new Href(other);\n\n if (!this.equals(href)) {\n return false;\n }\n\n if (this.parameters.length !== href.parameters.length) {\n return false;\n }\n\n if (this.parameters.length === 0 && href.parameters.length === 0) {\n return true;\n }\n\n const thisParams = this.parameters.map((param) => param.toString());\n\n return href.parameters.every((param) =>\n thisParams.includes(param.toString()),\n );\n }\n\n /**\n * Indicates if the link is a content link\n */\n get isContent(): boolean {\n return this.absolutepath.startsWith(\n `${getBasePathModularUI()}${CONTENT_PATH}`,\n );\n }\n\n /**\n */\n getReferenceHash(): ?number {\n return this._referenceHash;\n }\n\n /**\n */\n setReferenceHash(referenceHash: number) {\n this._referenceHash = referenceHash;\n }\n\n /**\n * Returns a complete url from the Href\n */\n toString(): string {\n return this.href;\n }\n\n /**\n */\n toLocation(): LocationShape {\n return {\n pathname: this.path,\n search: this.querystring.length > 0 ? `?${this.querystring}` : \"\",\n hash: this.hash.length > 0 ? `#${this.hash}` : \"\",\n state: {\n origin: this.origin,\n contextPath: this.contextPath,\n ...this.state,\n },\n };\n }\n}\n\nexport default Href;\n"],"mappings":";;;;;;;;;;;;;AACA,IAAAA,UAAA,GAAAC,OAAA;AAMA,IAAAC,UAAA,GAAAC,sBAAA,CAAAF,OAAA;AAiBA;AACA;AACA;AACA,MAAMG,IAAI,CAAC;EAWT;AACF;AACA;EACEC,WAAWA,CACTC,IAAgB,EAChBC,YAAqB,EACrBC,YAA4B,EAC5B;IAAA,IAAAC,gBAAA,CAAAC,OAAA,iBAjBc,EAAE;IAAA,IAAAD,gBAAA,CAAAC,OAAA,iBACF,EAAE;IAAA,IAAAD,gBAAA,CAAAC,OAAA,uBACc,EAAE;IAAA,IAAAD,gBAAA,CAAAC,OAAA,yBACV,EAAE;IAAA,IAAAD,gBAAA,CAAAC,OAAA,mBACYC,uBAAY,CAACC,GAAG;IAAA,IAAAH,gBAAA,CAAAC,OAAA,kBACxC,IAAI;IAAA,IAAAD,gBAAA,CAAAC,OAAA;IAAA,IAAAD,gBAAA,CAAAC,OAAA,mBAEA,EAAE;IAAA,IAAAD,gBAAA,CAAAC,OAAA,wBACG,IAAAG,+BAAoB,EAAC,CAAC;IAU3C,IAAI,CAACN,YAAY,GAAGA,YAAY,IAAI,EAAE;IAEtC,IAAID,IAAI,YAAY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AE5E,KAAK,IACjC,IAAAY,SAAA,CAAArC,OAAA,EAAAmG,UAAU,EAAA3E,IAAA,CAAV2E,UAAU,EAAU1E,KAAK,CAAC2E,QAAQ,CAAC,CAAC,CACtC,CAAC;EACH;;EAEA;AACF;AACA;EACE,IAAIE,SAASA,CAAA,EAAY;IAAA,IAAAC,UAAA;IACvB,OAAO,IAAAhE,WAAA,CAAAvC,OAAA,EAAAuG,UAAA,OAAI,CAACd,YAAY,EAAAjE,IAAA,CAAA+E,UAAA,EACtB,GAAG,IAAApG,+BAAoB,EAAC,CAAC,GAAGqG,uBAAY,EAC1C,CAAC;EACH;;EAEA;AACF;EACEC,gBAAgBA,CAAA,EAAY;IAC1B,OAAO,IAAI,CAACC,cAAc;EAC5B;;EAEA;AACF;EACEC,gBAAgBA,CAACC,aAAqB,EAAE;IACtC,IAAI,CAACF,cAAc,GAAGE,aAAa;EACrC;;EAEA;AACF;AACA;EACER,QAAQA,CAAA,EAAW;IACjB,OAAO,IAAI,CAACxG,IAAI;EAClB;;EAEA;AACF;EACEiH,UAAUA,CAAA,EAAkB;IAC1B,OAAO;MACL9F,QAAQ,EAAE,IAAI,CAACN,IAAI;MACnBQ,MAAM,EAAE,IAAI,CAACqE,WAAW,CAACpC,MAAM,GAAG,CAAC,GAAG,IAAI,IAAI,CAACoC,WAAW,EAAE,GAAG,EAAE;MACjE3E,IAAI,EAAE,IAAI,CAACA,IAAI,CAACuC,MAAM,GAAG,CAAC,GAAG,IAAI,IAAI,CAACvC,IAAI,EAAE,GAAG,EAAE;MACjDC,KAAK,EAAE;QACLL,MAAM,EAAE,IAAI,CAACA,MAAM;QACnBC,WAAW,EAAE,IAAI,CAACA,WAAW;QAC7B,GAAG,IAAI,CAACI;MACV;IACF,CAAC;EACH;AACF;AAAC,IAAAkG,QAAA,GAAAC,OAAA,CAAA/G,OAAA,GAEcN,IAAI","ignoreList":[]}
@@ -90,13 +90,18 @@ describe("href spec", () => {
90
90
  const samePathHref = new Href("/url?param1=value2");
91
91
  const otherHref = new Href("/path?param1=value1");
92
92
 
93
- expect(baseHref.equals(sameHref)).toBeTruthy();
94
- expect(baseHref.equals(samePathHref)).toBeTruthy();
95
- expect(baseHref.equals(otherHref)).toBeFalsy();
96
-
97
- expect(baseHref.equalsWithParameters(sameHref)).toBeTruthy();
98
- expect(baseHref.equalsWithParameters(samePathHref)).toBeFalsy();
99
- expect(baseHref.equalsWithParameters(otherHref)).toBeFalsy();
93
+ expect(baseHref.equals(sameHref)).toBe(true);
94
+ expect(baseHref.equals(samePathHref)).toBe(true);
95
+ expect(baseHref.equals(otherHref)).toBe(false);
96
+
97
+ expect(baseHref.equalsWithParameters(sameHref)).toBe(true);
98
+ expect(baseHref.equalsWithParameters(samePathHref)).toBe(false);
99
+ expect(baseHref.equalsWithParameters(otherHref)).toBe(false);
100
+
101
+ expect(baseHref.equalsWithParameters("/url?param1=value1")).toBe(true);
102
+ expect(baseHref.equalsWithParameters(null)).toBe(false);
103
+ expect(baseHref.equalsWithParameters("/url?param1=value2")).toBe(false);
104
+ expect(baseHref.equalsWithParameters("/path?param1=value1")).toBe(false);
100
105
  });
101
106
 
102
107
  it("can make distinction between relative and absolute urls", () => {
@@ -26,6 +26,9 @@ const useUrl = (resource, props) => {
26
26
  const [previousUrl, setPreviousUrl] = (0, _react.useState)(null);
27
27
  const [previousExact, setPreviousExact] = (0, _react.useState)(false);
28
28
  const url = getUrl(resource, props);
29
+ if (url == null && previousUrl == null) {
30
+ return new _Href.default("");
31
+ }
29
32
  const {
30
33
  match
31
34
  } = props;
@@ -35,8 +38,8 @@ const useUrl = (resource, props) => {
35
38
  if (!match) {
36
39
  return url;
37
40
  }
38
- if (url.equals(previousUrl)) {
39
- return url;
41
+ if (url.equalsWithParameters(previousUrl)) {
42
+ return previousUrl || url;
40
43
  }
41
44
 
42
45
  // Always create an url when the match is exact
@@ -31,6 +31,10 @@ export const useUrl = (
31
31
 
32
32
  const url = getUrl(resource, props);
33
33
 
34
+ if (url == null && previousUrl == null) {
35
+ return new Href("");
36
+ }
37
+
34
38
  const { match } = props;
35
39
 
36
40
  // when match is not available through props,
@@ -39,8 +43,8 @@ export const useUrl = (
39
43
  return url;
40
44
  }
41
45
 
42
- if (url.equals(previousUrl)) {
43
- return url;
46
+ if (url.equalsWithParameters(previousUrl)) {
47
+ return previousUrl || url;
44
48
  }
45
49
 
46
50
  // Always create an url when the match is exact
@@ -1 +1 @@
1
- {"version":3,"file":"ModularUIUtils.js","names":["_react","require","_utils","_Constants","_Href","_interopRequireDefault","getUrl","resource","props","url","Href","useUrl","previousUrl","setPreviousUrl","useState","previousExact","setPreviousExact","match","equals","isExact","startsWith","exports","getKey","WrappedComponent","name","getDisplayName","split","useReload","modelEntry","reload","arguments","length","undefined","isFullyLoaded","status","MODULARUI_STATUS","FINISHED","lastModification"],"sources":["../../../src/redux/_modularui/ModularUIUtils.js"],"sourcesContent":["// @flow\nimport { useState } from \"react\";\n\nimport { getDisplayName } from \"../../react/utils\";\nimport { MODULARUI_STATUS } from \"../../constants/Constants\";\nimport Href from \"../../models/href/Href\";\n\nimport type { ComponentType } from \"react\";\n\n/**\n * Generate modular ui url\n */\nconst getUrl = (resource: string | Function | Href, props: Object): Href => {\n const url = typeof resource === \"function\" ? resource(props) : resource;\n\n if (url instanceof Href) {\n return url;\n }\n\n return new Href(url);\n};\n\n/**\n */\nexport const useUrl = (\n resource: string | Function | Href,\n props: Object,\n): Href => {\n const [previousUrl, setPreviousUrl] = useState(null);\n const [previousExact, setPreviousExact] = useState(false);\n\n const url = getUrl(resource, props);\n\n const { match } = props;\n\n // when match is not available through props,\n // this is a direct call to the modular ui hoc, not using a route\n if (!match) {\n return url;\n }\n\n if (url.equals(previousUrl)) {\n return url;\n }\n\n // Always create an url when the match is exact\n // Or when the match is not exact AND the original match also was not exact\n // Or when the new start uri is different from the previous url --> different resource for same panel\n if (\n match.isExact === true ||\n previousExact === match.isExact ||\n !previousUrl?.startsWith(match.url)\n ) {\n setPreviousUrl(url);\n setPreviousExact(match.isExact);\n\n return url;\n }\n\n return previousUrl || new Href(\"\");\n};\n\n/**\n * Create key for modularui request based on component name and requested url\n */\nexport const getKey = (\n WrappedComponent: ComponentType<any>,\n name: string,\n url: string,\n): string => {\n if (url) {\n return `${getDisplayName(WrappedComponent, name)}(${url.split(\"?\")[0]})`;\n }\n\n return getDisplayName(WrappedComponent, name);\n};\n\n/**\n * Check if the model corresponding to a modular ui service should be reloaded\n */\nexport const useReload = (modelEntry: Object, reload: number = 0): boolean => {\n if (reload > 0) {\n const isFullyLoaded = modelEntry?.status === MODULARUI_STATUS.FINISHED;\n const lastModification = modelEntry?.lastModification ?? 0;\n\n if (isFullyLoaded && lastModification < reload) {\n return true;\n }\n }\n\n return false;\n};\n"],"mappings":";;;;;;;AACA,IAAAA,MAAA,GAAAC,OAAA;AAEA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,UAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAC,sBAAA,CAAAJ,OAAA;AAIA;AACA;AACA;AACA,MAAMK,MAAM,GAAGA,CAACC,QAAkC,EAAEC,KAAa,KAAW;EAC1E,MAAMC,GAAG,GAAG,OAAOF,QAAQ,KAAK,UAAU,GAAGA,QAAQ,CAACC,KAAK,CAAC,GAAGD,QAAQ;EAEvE,IAAIE,GAAG,YAAYC,aAAI,EAAE;IACvB,OAAOD,GAAG;EACZ;EAEA,OAAO,IAAIC,aAAI,CAACD,GAAG,CAAC;AACtB,CAAC;;AAED;AACA;AACO,MAAME,MAAM,GAAGA,CACpBJ,QAAkC,EAClCC,KAAa,KACJ;EACT,MAAM,CAACI,WAAW,EAAEC,cAAc,CAAC,GAAG,IAAAC,eAAQ,EAAC,IAAI,CAAC;EACpD,MAAM,CAACC,aAAa,EAAEC,gBAAgB,CAAC,GAAG,IAAAF,eAAQ,EAAC,KAAK,CAAC;EAEzD,MAAML,GAAG,GAAGH,MAAM,CAACC,QAAQ,EAAEC,KAAK,CAAC;EAEnC,MAAM;IAAES;EAAM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ES,gBAAgB,IAAI,CAAC;IAE1D,IAAIJ,aAAa,IAAII,gBAAgB,GAAGR,MAAM,EAAE;MAC9C,OAAO,IAAI;IACb;EACF;EAEA,OAAO,KAAK;AACd,CAAC;AAACR,OAAA,CAAAM,SAAA,GAAAA,SAAA","ignoreList":[]}
1
+ {"version":3,"file":"ModularUIUtils.js","names":["_react","require","_utils","_Constants","_Href","_interopRequireDefault","getUrl","resource","props","url","Href","useUrl","previousUrl","setPreviousUrl","useState","previousExact","setPreviousExact","match","equalsWithParameters","isExact","startsWith","exports","getKey","WrappedComponent","name","getDisplayName","split","useReload","modelEntry","reload","arguments","length","undefined","isFullyLoaded","status","MODULARUI_STATUS","FINISHED","lastModification"],"sources":["../../../src/redux/_modularui/ModularUIUtils.js"],"sourcesContent":["// @flow\nimport { useState } from \"react\";\n\nimport { getDisplayName } from \"../../react/utils\";\nimport { MODULARUI_STATUS } from \"../../constants/Constants\";\nimport Href from \"../../models/href/Href\";\n\nimport type { ComponentType } from \"react\";\n\n/**\n * Generate modular ui url\n */\nconst getUrl = (resource: string | Function | Href, props: Object): Href => {\n const url = typeof resource === \"function\" ? resource(props) : resource;\n\n if (url instanceof Href) {\n return url;\n }\n\n return new Href(url);\n};\n\n/**\n */\nexport const useUrl = (\n resource: string | Function | Href,\n props: Object,\n): Href => {\n const [previousUrl, setPreviousUrl] = useState(null);\n const [previousExact, setPreviousExact] = useState(false);\n\n const url = getUrl(resource, props);\n\n if (url == null && previousUrl == null) {\n return new Href(\"\");\n }\n\n const { match } = props;\n\n // when match is not available through props,\n // this is a direct call to the modular ui hoc, not using a route\n if (!match) {\n return url;\n }\n\n if (url.equalsWithParameters(previousUrl)) {\n return previousUrl || url;\n }\n\n // Always create an url when the match is exact\n // Or when the match is not exact AND the original match also was not exact\n // Or when the new start uri is different from the previous url --> different resource for same panel\n if (\n match.isExact === true ||\n previousExact === match.isExact ||\n !previousUrl?.startsWith(match.url)\n ) {\n setPreviousUrl(url);\n setPreviousExact(match.isExact);\n\n return url;\n }\n\n return previousUrl || new Href(\"\");\n};\n\n/**\n * Create key for modularui request based on component name and requested url\n */\nexport const getKey = (\n WrappedComponent: ComponentType<any>,\n name: string,\n url: string,\n): string => {\n if (url) {\n return `${getDisplayName(WrappedComponent, name)}(${url.split(\"?\")[0]})`;\n }\n\n return getDisplayName(WrappedComponent, name);\n};\n\n/**\n * Check if the model corresponding to a modular ui service should be reloaded\n */\nexport const useReload = (modelEntry: Object, reload: number = 0): boolean => {\n if (reload > 0) {\n const isFullyLoaded = modelEntry?.status === MODULARUI_STATUS.FINISHED;\n const lastModification = modelEntry?.lastModification ?? 0;\n\n if (isFullyLoaded && lastModification < reload) {\n return true;\n }\n }\n\n return false;\n};\n"],"mappings":";;;;;;;AACA,IAAAA,MAAA,GAAAC,OAAA;AAEA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,UAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAC,sBAAA,CAAAJ,OAAA;AAIA;AACA;AACA;AACA,MAAMK,MAAM,GAAGA,CAACC,QAAkC,EAAEC,KAAa,KAAW;EAC1E,MAAMC,GAAG,GAAG,OAAOF,QAAQ,KAAK,UAAU,GAAGA,QAAQ,CAACC,KAAK,CAAC,GAAGD,QAAQ;EAEvE,IAAIE,GAAG,YAAYC,aAAI,EAAE;IACvB,OAAOD,GAAG;EACZ;EAEA,OAAO,IAAIC,aAAI,CAACD,GAAG,CAAC;AACtB,CAAC;;AAED;AACA;AACO,MAAME,MAAM,GAAGA,CACpBJ,QAAkC,EAClCC,KAAa,KACJ;EACT,MAAM,CAACI,WAAW,EAAEC,cAAc,CAAC,GAAG,IAAAC,eAAQ,EAAC,IAAI,CAAC;EACpD,MAAM,CAACC,aAAa,EAAEC,gBAAgB,CAAC,GAAG,IAAAF,eAAQ,EAAC,KAAK,CAAC;EAEzD,MAAML,GAAG,GAAGH,MAAM,CAACC,QAAQ,EAAEC,KAAK,CAAC;EAEnC,IAAIC,GAAG,IAAI,IAAI,I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,EAAE;IACd,MAAMI,aAAa,GAAGL,UAAU,EAAEM,MAAM,KAAKC,2BAAgB,CAACC,QAAQ;IACtE,MAAMC,gBAAgB,GAAGT,UAAU,EAAES,gBAAgB,IAAI,CAAC;IAE1D,IAAIJ,aAAa,IAAII,gBAAgB,GAAGR,MAAM,EAAE;MAC9C,OAAO,IAAI;IACb;EACF;EAEA,OAAO,KAAK;AACd,CAAC;AAACR,OAAA,CAAAM,SAAA,GAAAA,SAAA","ignoreList":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@beinformed/ui",
3
- "version": "1.57.3",
3
+ "version": "1.57.4",
4
4
  "description": "Toolbox for be informed javascript layouts",
5
5
  "license": "SEE LICENSE IN LICENSE.md",
6
6
  "bugs": "http://support.beinformed.com",
@@ -6,7 +6,6 @@ import {
6
6
  } from "../../constants";
7
7
 
8
8
  import Parameter from "../parameter/Parameter";
9
- import { IllegalArgumentException } from "../../exceptions";
10
9
 
11
10
  import type { LocationShape } from "react-router";
12
11
  import type { ModelOptions } from "../types";
@@ -492,28 +491,30 @@ class Href {
492
491
 
493
492
  /**
494
493
  */
495
- equalsWithParameters(href: Href): boolean {
496
- if (!this.equals(href)) {
494
+ equalsWithParameters(other: Href | string | null): boolean {
495
+ if (other == null) {
497
496
  return false;
498
497
  }
499
498
 
500
- if (href instanceof Href) {
501
- if (this.parameters.length !== href.parameters.length) {
502
- return false;
503
- }
499
+ const href = other instanceof Href ? other : new Href(other);
504
500
 
505
- if (this.parameters.length === 0 && href.parameters.length === 0) {
506
- return true;
507
- }
501
+ if (!this.equals(href)) {
502
+ return false;
503
+ }
508
504
 
509
- const thisParams = this.parameters.map((param) => param.toString());
505
+ if (this.parameters.length !== href.parameters.length) {
506
+ return false;
507
+ }
510
508
 
511
- return href.parameters.every((param) =>
512
- thisParams.includes(param.toString()),
513
- );
509
+ if (this.parameters.length === 0 && href.parameters.length === 0) {
510
+ return true;
514
511
  }
515
512
 
516
- throw new IllegalArgumentException(`${href} is not an instance of Href`);
513
+ const thisParams = this.parameters.map((param) => param.toString());
514
+
515
+ return href.parameters.every((param) =>
516
+ thisParams.includes(param.toString()),
517
+ );
517
518
  }
518
519
 
519
520
  /**
@@ -90,13 +90,18 @@ describe("href spec", () => {
90
90
  const samePathHref = new Href("/url?param1=value2");
91
91
  const otherHref = new Href("/path?param1=value1");
92
92
 
93
- expect(baseHref.equals(sameHref)).toBeTruthy();
94
- expect(baseHref.equals(samePathHref)).toBeTruthy();
95
- expect(baseHref.equals(otherHref)).toBeFalsy();
96
-
97
- expect(baseHref.equalsWithParameters(sameHref)).toBeTruthy();
98
- expect(baseHref.equalsWithParameters(samePathHref)).toBeFalsy();
99
- expect(baseHref.equalsWithParameters(otherHref)).toBeFalsy();
93
+ expect(baseHref.equals(sameHref)).toBe(true);
94
+ expect(baseHref.equals(samePathHref)).toBe(true);
95
+ expect(baseHref.equals(otherHref)).toBe(false);
96
+
97
+ expect(baseHref.equalsWithParameters(sameHref)).toBe(true);
98
+ expect(baseHref.equalsWithParameters(samePathHref)).toBe(false);
99
+ expect(baseHref.equalsWithParameters(otherHref)).toBe(false);
100
+
101
+ expect(baseHref.equalsWithParameters("/url?param1=value1")).toBe(true);
102
+ expect(baseHref.equalsWithParameters(null)).toBe(false);
103
+ expect(baseHref.equalsWithParameters("/url?param1=value2")).toBe(false);
104
+ expect(baseHref.equalsWithParameters("/path?param1=value1")).toBe(false);
100
105
  });
101
106
 
102
107
  it("can make distinction between relative and absolute urls", () => {
@@ -31,6 +31,10 @@ export const useUrl = (
31
31
 
32
32
  const url = getUrl(resource, props);
33
33
 
34
+ if (url == null && previousUrl == null) {
35
+ return new Href("");
36
+ }
37
+
34
38
  const { match } = props;
35
39
 
36
40
  // when match is not available through props,
@@ -39,8 +43,8 @@ export const useUrl = (
39
43
  return url;
40
44
  }
41
45
 
42
- if (url.equals(previousUrl)) {
43
- return url;
46
+ if (url.equalsWithParameters(previousUrl)) {
47
+ return previousUrl || url;
44
48
  }
45
49
 
46
50
  // Always create an url when the match is exact