@beinformed/ui 1.63.14 → 1.65.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (82) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/esm/constants/Constants.js +4 -0
  3. package/esm/constants/Constants.js.flow +5 -0
  4. package/esm/constants/Constants.js.map +1 -1
  5. package/esm/hooks/__tests__/UseModularUIModel.spec.js.flow +7 -5
  6. package/esm/hooks/index.js +2 -0
  7. package/esm/hooks/index.js.flow +2 -0
  8. package/esm/hooks/index.js.map +1 -1
  9. package/esm/hooks/useList.js +69 -0
  10. package/esm/hooks/useList.js.flow +90 -0
  11. package/esm/hooks/useList.js.map +1 -0
  12. package/esm/hooks/useModularUIBasic.js +1 -1
  13. package/esm/hooks/useModularUIBasic.js.flow +6 -2
  14. package/esm/hooks/useModularUIBasic.js.map +1 -1
  15. package/esm/hooks/useModularUIModel.js +0 -34
  16. package/esm/hooks/useModularUIModel.js.flow +1 -55
  17. package/esm/hooks/useModularUIModel.js.map +1 -1
  18. package/esm/hooks/usePanel.js +49 -0
  19. package/esm/hooks/usePanel.js.flow +76 -0
  20. package/esm/hooks/usePanel.js.map +1 -0
  21. package/esm/models/filters/BaseFilterModel.js +27 -1
  22. package/esm/models/filters/BaseFilterModel.js.flow +30 -1
  23. package/esm/models/filters/BaseFilterModel.js.map +1 -1
  24. package/esm/models/filters/FilterCollection.js +18 -0
  25. package/esm/models/filters/FilterCollection.js.flow +18 -0
  26. package/esm/models/filters/FilterCollection.js.map +1 -1
  27. package/esm/models/filters/StringFilterModel.js +8 -0
  28. package/esm/models/filters/StringFilterModel.js.flow +8 -0
  29. package/esm/models/filters/StringFilterModel.js.map +1 -1
  30. package/esm/models/href/ListHref.js +3 -1
  31. package/esm/models/href/ListHref.js.flow +11 -8
  32. package/esm/models/href/ListHref.js.map +1 -1
  33. package/esm/models/list/ListModel.js +17 -7
  34. package/esm/models/list/ListModel.js.flow +20 -8
  35. package/esm/models/list/ListModel.js.map +1 -1
  36. package/esm/models/paging/PagesizeModel.js +6 -0
  37. package/esm/models/paging/PagesizeModel.js.flow +6 -0
  38. package/esm/models/paging/PagesizeModel.js.map +1 -1
  39. package/esm/models/paging/PagingModel.js +11 -0
  40. package/esm/models/paging/PagingModel.js.flow +11 -0
  41. package/esm/models/paging/PagingModel.js.map +1 -1
  42. package/lib/constants/Constants.js +5 -1
  43. package/lib/constants/Constants.js.map +1 -1
  44. package/lib/hooks/index.js +22 -0
  45. package/lib/hooks/index.js.map +1 -1
  46. package/lib/hooks/useList.js +80 -0
  47. package/lib/hooks/useList.js.map +1 -0
  48. package/lib/hooks/useModularUIBasic.js +2 -2
  49. package/lib/hooks/useModularUIBasic.js.map +1 -1
  50. package/lib/hooks/useModularUIModel.js +1 -39
  51. package/lib/hooks/useModularUIModel.js.map +1 -1
  52. package/lib/hooks/usePanel.js +57 -0
  53. package/lib/hooks/usePanel.js.map +1 -0
  54. package/lib/models/filters/BaseFilterModel.js +26 -0
  55. package/lib/models/filters/BaseFilterModel.js.map +1 -1
  56. package/lib/models/filters/FilterCollection.js +17 -0
  57. package/lib/models/filters/FilterCollection.js.map +1 -1
  58. package/lib/models/filters/StringFilterModel.js +8 -0
  59. package/lib/models/filters/StringFilterModel.js.map +1 -1
  60. package/lib/models/href/ListHref.js +3 -1
  61. package/lib/models/href/ListHref.js.map +1 -1
  62. package/lib/models/list/ListModel.js +17 -7
  63. package/lib/models/list/ListModel.js.map +1 -1
  64. package/lib/models/paging/PagesizeModel.js +6 -0
  65. package/lib/models/paging/PagesizeModel.js.map +1 -1
  66. package/lib/models/paging/PagingModel.js +11 -0
  67. package/lib/models/paging/PagingModel.js.map +1 -1
  68. package/package.json +8 -8
  69. package/src/constants/Constants.js +5 -0
  70. package/src/hooks/__tests__/UseModularUIModel.spec.js +7 -5
  71. package/src/hooks/index.js +2 -0
  72. package/src/hooks/useList.js +90 -0
  73. package/src/hooks/useModularUIBasic.js +6 -2
  74. package/src/hooks/useModularUIModel.js +1 -55
  75. package/src/hooks/usePanel.js +76 -0
  76. package/src/models/filters/BaseFilterModel.js +30 -1
  77. package/src/models/filters/FilterCollection.js +18 -0
  78. package/src/models/filters/StringFilterModel.js +8 -0
  79. package/src/models/href/ListHref.js +11 -8
  80. package/src/models/list/ListModel.js +20 -8
  81. package/src/models/paging/PagesizeModel.js +6 -0
  82. package/src/models/paging/PagingModel.js +11 -0
package/CHANGELOG.md CHANGED
@@ -2,6 +2,31 @@
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.65.0](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/compare/v1.63.14...v1.65.0) (2025-12-18)
6
+
7
+
8
+ ### Features
9
+
10
+ * **filter-post:** indicate if a filter is a POST or GET filter ([374c74d](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/commit/374c74dc97706eab0bedaa5400e6f0e978f7456e))
11
+ * **filter-post:** retrieve post data from lists ([32ae39a](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/commit/32ae39acc6fb43431caa7d1e191d8b24595ff287))
12
+ * **hooks:** refactor and reintroduce hooks for list and panel management ([dfca996](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/commit/dfca9967cbbd2a3840706f946d432fc656d7f7c2))
13
+ * **types:** update type definitions for filters, requests, and hooks ([80f2fd2](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/commit/80f2fd23df6356ed850f7cb2d8ef3109aab2df3b))
14
+
15
+
16
+ ### Bug Fixes
17
+
18
+ * **flowtype:** handle flowtype errors ([0f661bf](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/commit/0f661bf023926f1e0eda361e9ccd18479a15ca26))
19
+
20
+ ## [1.64.0](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/compare/v1.63.14...v1.64.0) (2025-12-18)
21
+
22
+
23
+ ### Features
24
+
25
+ * **filter-post:** indicate if a filter is a POST or GET filter ([374c74d](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/commit/374c74dc97706eab0bedaa5400e6f0e978f7456e))
26
+ * **filter-post:** retrieve post data from lists ([32ae39a](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/commit/32ae39acc6fb43431caa7d1e191d8b24595ff287))
27
+ * **hooks:** refactor and reintroduce hooks for list and panel management ([dfca996](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/commit/dfca9967cbbd2a3840706f946d432fc656d7f7c2))
28
+ * **types:** update type definitions for filters, requests, and hooks ([80f2fd2](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/commit/80f2fd23df6356ed850f7cb2d8ef3109aab2df3b))
29
+
5
30
  ## [1.63.14](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/compare/v1.63.13...v1.63.14) (2025-12-15)
6
31
 
7
32
 
@@ -123,6 +123,10 @@ export const HTTP_METHODS = {
123
123
  GET: "GET",
124
124
  POST: "POST"
125
125
  };
126
+ export const PARAMETER_TYPES = {
127
+ BODY: "bodyParameter",
128
+ QUERY: "queryParameter"
129
+ };
126
130
 
127
131
  /**
128
132
  * POSSIBLE MODULARUI STATUSSES
@@ -128,6 +128,11 @@ export const HTTP_METHODS = {
128
128
  POST: "POST",
129
129
  };
130
130
 
131
+ export const PARAMETER_TYPES = {
132
+ BODY: "bodyParameter",
133
+ QUERY: "queryParameter",
134
+ };
135
+
131
136
  /**
132
137
  * POSSIBLE MODULARUI STATUSSES
133
138
  * @type {{LOADING: string, ERROR: string, FINISHED: string}}
@@ -1 +1 @@
1
- {"version":3,"file":"Constants.js","names":["CONTENT_PATH","UPLOAD_PATH","CAPTCHA_PATH","CHANGEAVATAR_PATH","CHANGEPASSWORD_PATH","USERPROFILE_PATH","RESOURCE_PATH","PARAMETER_SEPARATOR","TIMEVERSION_FILTER_NAME","PARAMETER_OVERVIEW_VIEWTYPE","DEFAULT_UI_PARAMETERS","ISO_DATE_FORMAT","ISO_DATETIME_FORMAT","ISO_TIME_FORMAT","ISO_TIMESTAMP_FORMAT","DATETIME_OFFSET_FORMAT","DEFAULT_WEEK_STARTS_ON","DEFAULT_FIRST_WEEK_CONTAINS_DATE","KEYCODES","TAB","ENTER","ESCAPE","SPACE","PAGE_UP","PAGE_DOWN","ARROW_LEFT","ARROW_UP","ARROW_RIGHT","ARROW_DOWN","IS_SYNC","dataFetcher","IS_SERVER","IS_GRAALJS","Graal","NOTIFICATION_TYPES","SUCCESS","INFO","WARNING","ERROR","HTTP_METHODS","GET","POST","MODULARUI_STATUS","LOADING","FINISHED","AUTOSAVE_STATUS","START","INPUT_DEBOUNCE_TIMEOUT","VALIDATE_DEBOUNCE_TIMEOUT","ATTRIBUTE_WIDTH","EXTRA_SMALL","SMALL","MEDIUM","LARGE","EXTRA_LARGE","ALL_CONTENT_IN_DATA_SETTING","INCLUDE_TIME_OFFSET","INTERNAL_LOGIN_TYPE","JAAS","PAC4J_FORM","PAC4J_BASIC","PAC4J_INDIRECT","LOGIN_TYPE","LOGIN_PATH_SETTING","LOGIN_USERNAME_SETTING","LOGIN_PASSWORD_SETTING","LOGOUT_PATH_SETTING","DEFAULT_AUTHENTICATION_TYPE","name","authentication","isPrimary"],"sources":["../../src/constants/Constants.js"],"sourcesContent":["// @flow\n/**\n * path to content service\n */\nexport const CONTENT_PATH = `/content`;\n\n/**\n * Upload Path\n */\nexport const UPLOAD_PATH = `/uploadFile`;\n\n/**\n * Captcha Path\n */\nexport const CAPTCHA_PATH = `/captchaServices`;\n\n/**\n * Path to change avatar page / component\n */\nexport const CHANGEAVATAR_PATH = \"/change-avatar\";\n\n/**\n * Path to change password page / component\n */\nexport const CHANGEPASSWORD_PATH = \"/change-password\";\n\n/**\n * Path to user profile page / component\n */\nexport const USERPROFILE_PATH = \"/user\";\n\n/**\n * Path to resources in the Be Informed repository\n */\nexport const RESOURCE_PATH = \"/resource\";\n\n/**\n * Separator for parameters of a list, makes it possible to render multiple lists on a page in a non-js environment\n */\nexport const PARAMETER_SEPARATOR = \"~\";\n\n/**\n * Timeversion filter name\n */\nexport const TIMEVERSION_FILTER_NAME = \"entryDate\";\n\nconst PARAMETER_OVERVIEW_VIEWTYPE = \"viewType\";\n/**\n * Parameter name for the viewtype toggle\n */\nexport const DEFAULT_UI_PARAMETERS: Array<string> = [\n PARAMETER_OVERVIEW_VIEWTYPE,\n];\n\n/**\n */\nexport const ISO_DATE_FORMAT = \"yyyy-MM-dd\";\n/**\n */\nexport const ISO_DATETIME_FORMAT = \"yyyy-MM-dd'T'HH:mm:ss\";\n/**\n */\nexport const ISO_TIME_FORMAT = \"HH:mm:ss\";\n/**\n */\nexport const ISO_TIMESTAMP_FORMAT = \"yyyy-MM-dd'T'HH:mm:ss.SSS\";\n/**\n * Offset format is appended to iso datetime and timestamp when isIncludeTimeOffsetInDateTimes = true\n */\nexport const DATETIME_OFFSET_FORMAT = \"xxx\";\n/**\n * week starts on monday by default\n */\nexport const DEFAULT_WEEK_STARTS_ON = 1;\n\n/**\n * first week indicated by the 1st of january\n */\nexport const DEFAULT_FIRST_WEEK_CONTAINS_DATE = 1;\n\n/**\n * Key codes\n * @type {{SPACE: number, PAGE_DOWN: number, TAB: number, ARROW_RIGHT: number, ARROW_DOWN: number, ENTER: number, ARROW_UP: number, ARROW_LEFT: number, PAGE_UP: number, ESCAPE: number}}\n */\nexport const KEYCODES = {\n TAB: 9,\n ENTER: 13,\n ESCAPE: 27,\n SPACE: 32,\n PAGE_UP: 33,\n PAGE_DOWN: 34,\n ARROW_LEFT: 37,\n ARROW_UP: 38,\n ARROW_RIGHT: 39,\n ARROW_DOWN: 40,\n};\n\n/**\n * @type {boolean}\n */\nexport const IS_SYNC = typeof dataFetcher !== \"undefined\";\n/**\n * @type {boolean}\n */\nexport const IS_SERVER = IS_SYNC;\n/**\n * @type {boolean}\n */\n// $FlowExpectedError[cannot-resolve-name]\nexport const IS_GRAALJS = typeof Graal !== \"undefined\";\n\n/**\n * @type {{SUCCESS: string, ERROR: string, INFO: string, WARNING: string}}\n */\nexport const NOTIFICATION_TYPES = {\n SUCCESS: \"SUCCESS\",\n INFO: \"INFO\",\n WARNING: \"WARNING\",\n ERROR: \"ERROR\",\n};\n\n/**\n * SUPPORTED HTTP METHODS\n * @type {{POST: string, GET: string}}\n */\nexport const HTTP_METHODS = {\n GET: \"GET\",\n POST: \"POST\",\n};\n\n/**\n * POSSIBLE MODULARUI STATUSSES\n * @type {{LOADING: string, ERROR: string, FINISHED: string}}\n */\nexport const MODULARUI_STATUS = {\n LOADING: \"LOADING\",\n FINISHED: \"FINISHED\",\n ERROR: \"ERROR\",\n};\n\n/**\n * POSSIBLE AUTOSAVE STATUSSES\n * @type {{START: string, FINISHED: string}}\n */\nexport const AUTOSAVE_STATUS = {\n START: \"START\",\n FINISHED: \"FINISHED\",\n};\n\n/**\n * DEBOUNCE INPUT TIMEOUT\n */\nexport const INPUT_DEBOUNCE_TIMEOUT = 100;\n\n/**\n * DEBOUNCE VALIDATION TIMEOUT\n */\nexport const VALIDATE_DEBOUNCE_TIMEOUT = 500;\n\n/**\n * ATTRIBUTE WIDTH\n */\nexport const ATTRIBUTE_WIDTH = {\n EXTRA_SMALL: \"EXTRA_SMALL\",\n SMALL: \"SMALL\",\n MEDIUM: \"MEDIUM\",\n LARGE: \"LARGE\",\n EXTRA_LARGE: \"EXTRA_LARGE\",\n};\n\nexport const ALL_CONTENT_IN_DATA_SETTING = \"hasAllContentInData\";\n\nexport const INCLUDE_TIME_OFFSET = \"isIncludeTimeOffsetInDateTimes\";\n\nexport const INTERNAL_LOGIN_TYPE = {\n JAAS: \"JAAS\",\n PAC4J_FORM: \"PAC4J_FORM\",\n PAC4J_BASIC: \"PAC4J_BASIC\",\n PAC4J_INDIRECT: \"PAC4J_INDIRECT\",\n};\nexport const LOGIN_TYPE = \"security.clients\";\nexport const LOGIN_PATH_SETTING = \"FormClient.login_url\";\nexport const LOGIN_USERNAME_SETTING = \"FormClient.username_field_name\";\nexport const LOGIN_PASSWORD_SETTING = \"FormClient.password_field_name\";\nexport const LOGOUT_PATH_SETTING = \"FormClient.logout_url\";\n\nexport const DEFAULT_AUTHENTICATION_TYPE = {\n name: \"Form based authentication\",\n authentication: \"DefaultFormClient\",\n isPrimary: true,\n};\n"],"mappings":"AACA;AACA;AACA;AACA,OAAO,MAAMA,YAAY,GAAG,UAAU;;AAEtC;AACA;AACA;AACA,OAAO,MAAMC,WAAW,GAAG,aAAa;;AAExC;AACA;AACA;AACA,OAAO,MAAMC,YAAY,GAAG,kBAAkB;;AAE9C;AACA;AACA;AACA,OAAO,MAAMC,iBAAiB,GAAG,gBAAgB;;AAEjD;AACA;AACA;AACA,OAAO,MAAMC,mBAAmB,GAAG,kBAAkB;;AAErD;AACA;AACA;AACA,OAAO,MAAMC,gBAAgB,GAAG,OAAO;;AAEvC;AACA;AACA;AACA,OAAO,MAAMC,aAAa,GAAG,WAAW;;AAExC;AACA;AACA;AACA,OAAO,MAAMC,mBAAmB,GAAG,GAAG;;AAEtC;AACA;AACA;AACA,OAAO,MAAMC,uBAAuB,GAAG,WAAW;AAElD,MAAMC,2BAA2B,GAAG,UAAU;AAC9C;AACA;AACA;AACA,OAAO,MAAMC,qBAAoC,GAAG,CAClDD,2BAA2B,CAC5B;;AAED;AACA;AACA,OAAO,MAAME,eAAe,GAAG,YAAY;AAC3C;AACA;AACA,OAAO,MAAMC,mBAAmB,GAAG,uBAAuB;AAC1D;AACA;AACA,OAAO,MAAMC,eAAe,GAAG,UAAU;AACzC;AACA;AACA,OAAO,MAAMC,oBAAoB,GAAG,2BAA2B;AAC/D;AACA;AACA;AACA,OAAO,MAAMC,sBAAsB,GAAG,KAAK;AAC3C;AACA;AACA;AACA,OAAO,MAAMC,sBAAsB,GAAG,CAAC;;AAEvC;AACA;AACA;AACA,OAAO,MAAMC,gCAAgC,GAAG,CAAC;;AAEjD;AACA;AACA;AACA;AACA,OAAO,MAAMC,QAAQ,GAAG;E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AACf,CAAC;AAED,OAAO,MAAMC,2BAA2B,GAAG,qBAAqB;AAEhE,OAAO,MAAMC,mBAAmB,GAAG,gCAAgC;AAEnE,OAAO,MAAMC,mBAAmB,GAAG;EACjCC,IAAI,EAAE,MAAM;EACZC,UAAU,EAAE,YAAY;EACxBC,WAAW,EAAE,aAAa;EAC1BC,cAAc,EAAE;AAClB,CAAC;AACD,OAAO,MAAMC,UAAU,GAAG,kBAAkB;AAC5C,OAAO,MAAMC,kBAAkB,GAAG,sBAAsB;AACxD,OAAO,MAAMC,sBAAsB,GAAG,gCAAgC;AACtE,OAAO,MAAMC,sBAAsB,GAAG,gCAAgC;AACtE,OAAO,MAAMC,mBAAmB,GAAG,uBAAuB;AAE1D,OAAO,MAAMC,2BAA2B,GAAG;EACzCC,IAAI,EAAE,2BAA2B;EACjCC,cAAc,EAAE,mBAAmB;EACnCC,SAAS,EAAE;AACb,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"Constants.js","names":["CONTENT_PATH","UPLOAD_PATH","CAPTCHA_PATH","CHANGEAVATAR_PATH","CHANGEPASSWORD_PATH","USERPROFILE_PATH","RESOURCE_PATH","PARAMETER_SEPARATOR","TIMEVERSION_FILTER_NAME","PARAMETER_OVERVIEW_VIEWTYPE","DEFAULT_UI_PARAMETERS","ISO_DATE_FORMAT","ISO_DATETIME_FORMAT","ISO_TIME_FORMAT","ISO_TIMESTAMP_FORMAT","DATETIME_OFFSET_FORMAT","DEFAULT_WEEK_STARTS_ON","DEFAULT_FIRST_WEEK_CONTAINS_DATE","KEYCODES","TAB","ENTER","ESCAPE","SPACE","PAGE_UP","PAGE_DOWN","ARROW_LEFT","ARROW_UP","ARROW_RIGHT","ARROW_DOWN","IS_SYNC","dataFetcher","IS_SERVER","IS_GRAALJS","Graal","NOTIFICATION_TYPES","SUCCESS","INFO","WARNING","ERROR","HTTP_METHODS","GET","POST","PARAMETER_TYPES","BODY","QUERY","MODULARUI_STATUS","LOADING","FINISHED","AUTOSAVE_STATUS","START","INPUT_DEBOUNCE_TIMEOUT","VALIDATE_DEBOUNCE_TIMEOUT","ATTRIBUTE_WIDTH","EXTRA_SMALL","SMALL","MEDIUM","LARGE","EXTRA_LARGE","ALL_CONTENT_IN_DATA_SETTING","INCLUDE_TIME_OFFSET","INTERNAL_LOGIN_TYPE","JAAS","PAC4J_FORM","PAC4J_BASIC","PAC4J_INDIRECT","LOGIN_TYPE","LOGIN_PATH_SETTING","LOGIN_USERNAME_SETTING","LOGIN_PASSWORD_SETTING","LOGOUT_PATH_SETTING","DEFAULT_AUTHENTICATION_TYPE","name","authentication","isPrimary"],"sources":["../../src/constants/Constants.js"],"sourcesContent":["// @flow\n/**\n * path to content service\n */\nexport const CONTENT_PATH = `/content`;\n\n/**\n * Upload Path\n */\nexport const UPLOAD_PATH = `/uploadFile`;\n\n/**\n * Captcha Path\n */\nexport const CAPTCHA_PATH = `/captchaServices`;\n\n/**\n * Path to change avatar page / component\n */\nexport const CHANGEAVATAR_PATH = \"/change-avatar\";\n\n/**\n * Path to change password page / component\n */\nexport const CHANGEPASSWORD_PATH = \"/change-password\";\n\n/**\n * Path to user profile page / component\n */\nexport const USERPROFILE_PATH = \"/user\";\n\n/**\n * Path to resources in the Be Informed repository\n */\nexport const RESOURCE_PATH = \"/resource\";\n\n/**\n * Separator for parameters of a list, makes it possible to render multiple lists on a page in a non-js environment\n */\nexport const PARAMETER_SEPARATOR = \"~\";\n\n/**\n * Timeversion filter name\n */\nexport const TIMEVERSION_FILTER_NAME = \"entryDate\";\n\nconst PARAMETER_OVERVIEW_VIEWTYPE = \"viewType\";\n/**\n * Parameter name for the viewtype toggle\n */\nexport const DEFAULT_UI_PARAMETERS: Array<string> = [\n PARAMETER_OVERVIEW_VIEWTYPE,\n];\n\n/**\n */\nexport const ISO_DATE_FORMAT = \"yyyy-MM-dd\";\n/**\n */\nexport const ISO_DATETIME_FORMAT = \"yyyy-MM-dd'T'HH:mm:ss\";\n/**\n */\nexport const ISO_TIME_FORMAT = \"HH:mm:ss\";\n/**\n */\nexport const ISO_TIMESTAMP_FORMAT = \"yyyy-MM-dd'T'HH:mm:ss.SSS\";\n/**\n * Offset format is appended to iso datetime and timestamp when isIncludeTimeOffsetInDateTimes = true\n */\nexport const DATETIME_OFFSET_FORMAT = \"xxx\";\n/**\n * week starts on monday by default\n */\nexport const DEFAULT_WEEK_STARTS_ON = 1;\n\n/**\n * first week indicated by the 1st of january\n */\nexport const DEFAULT_FIRST_WEEK_CONTAINS_DATE = 1;\n\n/**\n * Key codes\n * @type {{SPACE: number, PAGE_DOWN: number, TAB: number, ARROW_RIGHT: number, ARROW_DOWN: number, ENTER: number, ARROW_UP: number, ARROW_LEFT: number, PAGE_UP: number, ESCAPE: number}}\n */\nexport const KEYCODES = {\n TAB: 9,\n ENTER: 13,\n ESCAPE: 27,\n SPACE: 32,\n PAGE_UP: 33,\n PAGE_DOWN: 34,\n ARROW_LEFT: 37,\n ARROW_UP: 38,\n ARROW_RIGHT: 39,\n ARROW_DOWN: 40,\n};\n\n/**\n * @type {boolean}\n */\nexport const IS_SYNC = typeof dataFetcher !== \"undefined\";\n/**\n * @type {boolean}\n */\nexport const IS_SERVER = IS_SYNC;\n/**\n * @type {boolean}\n */\n// $FlowExpectedError[cannot-resolve-name]\nexport const IS_GRAALJS = typeof Graal !== \"undefined\";\n\n/**\n * @type {{SUCCESS: string, ERROR: string, INFO: string, WARNING: string}}\n */\nexport const NOTIFICATION_TYPES = {\n SUCCESS: \"SUCCESS\",\n INFO: \"INFO\",\n WARNING: \"WARNING\",\n ERROR: \"ERROR\",\n};\n\n/**\n * SUPPORTED HTTP METHODS\n * @type {{POST: string, GET: string}}\n */\nexport const HTTP_METHODS = {\n GET: \"GET\",\n POST: \"POST\",\n};\n\nexport const PARAMETER_TYPES = {\n BODY: \"bodyParameter\",\n QUERY: \"queryParameter\",\n};\n\n/**\n * POSSIBLE MODULARUI STATUSSES\n * @type {{LOADING: string, ERROR: string, FINISHED: string}}\n */\nexport const MODULARUI_STATUS = {\n LOADING: \"LOADING\",\n FINISHED: \"FINISHED\",\n ERROR: \"ERROR\",\n};\n\n/**\n * POSSIBLE AUTOSAVE STATUSSES\n * @type {{START: string, FINISHED: string}}\n */\nexport const AUTOSAVE_STATUS = {\n START: \"START\",\n FINISHED: \"FINISHED\",\n};\n\n/**\n * DEBOUNCE INPUT TIMEOUT\n */\nexport const INPUT_DEBOUNCE_TIMEOUT = 100;\n\n/**\n * DEBOUNCE VALIDATION TIMEOUT\n */\nexport const VALIDATE_DEBOUNCE_TIMEOUT = 500;\n\n/**\n * ATTRIBUTE WIDTH\n */\nexport const ATTRIBUTE_WIDTH = {\n EXTRA_SMALL: \"EXTRA_SMALL\",\n SMALL: \"SMALL\",\n MEDIUM: \"MEDIUM\",\n LARGE: \"LARGE\",\n EXTRA_LARGE: \"EXTRA_LARGE\",\n};\n\nexport const ALL_CONTENT_IN_DATA_SETTING = \"hasAllContentInData\";\n\nexport const INCLUDE_TIME_OFFSET = \"isIncludeTimeOffsetInDateTimes\";\n\nexport const INTERNAL_LOGIN_TYPE = {\n JAAS: \"JAAS\",\n PAC4J_FORM: \"PAC4J_FORM\",\n PAC4J_BASIC: \"PAC4J_BASIC\",\n PAC4J_INDIRECT: \"PAC4J_INDIRECT\",\n};\nexport const LOGIN_TYPE = \"security.clients\";\nexport const LOGIN_PATH_SETTING = \"FormClient.login_url\";\nexport const LOGIN_USERNAME_SETTING = \"FormClient.username_field_name\";\nexport const LOGIN_PASSWORD_SETTING = \"FormClient.password_field_name\";\nexport const LOGOUT_PATH_SETTING = \"FormClient.logout_url\";\n\nexport const DEFAULT_AUTHENTICATION_TYPE = {\n name: \"Form based authentication\",\n authentication: \"DefaultFormClient\",\n isPrimary: true,\n};\n"],"mappings":"AACA;AACA;AACA;AACA,OAAO,MAAMA,YAAY,GAAG,UAAU;;AAEtC;AACA;AACA;AACA,OAAO,MAAMC,WAAW,GAAG,aAAa;;AAExC;AACA;AACA;AACA,OAAO,MAAMC,YAAY,GAAG,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AkB;AAC5C,OAAO,MAAMC,kBAAkB,GAAG,sBAAsB;AACxD,OAAO,MAAMC,sBAAsB,GAAG,gCAAgC;AACtE,OAAO,MAAMC,sBAAsB,GAAG,gCAAgC;AACtE,OAAO,MAAMC,mBAAmB,GAAG,uBAAuB;AAE1D,OAAO,MAAMC,2BAA2B,GAAG;EACzCC,IAAI,EAAE,2BAA2B;EACjCC,cAAc,EAAE,mBAAmB;EACnCC,SAAS,EAAE;AACb,CAAC","ignoreList":[]}
@@ -4,20 +4,19 @@ import { Provider } from "react-redux";
4
4
  import { renderHook } from "@testing-library/react";
5
5
  import xhrMock from "xhr-mock";
6
6
 
7
- import { useLocation } from "react-router";
7
+ import { useLocation, useRouteMatch } from "react-router";
8
8
 
9
9
  import {
10
10
  useApplication,
11
11
  useTab,
12
12
  useCaseView,
13
- usePanel,
14
- useList,
15
- useListDetail,
16
13
  useGroupingPanel,
17
14
  useDetailPanel,
18
15
  useQuicksearch,
19
16
  useUserProfile,
20
17
  } from "../useModularUIModel";
18
+ import { useList, useListDetail } from "../useList";
19
+ import { usePanel } from "../usePanel";
21
20
  import {
22
21
  ApplicationModel,
23
22
  CaseSearchModel,
@@ -37,6 +36,7 @@ const mockStore = configureMockStore(middlewares);
37
36
  jest.mock("react-router", () => ({
38
37
  ...jest.requireActual("react-router"), // Keep other methods from react-router as is
39
38
  useLocation: jest.fn(), // Mock useLocation
39
+ useRouteMatch: jest.fn(),
40
40
  }));
41
41
 
42
42
  const JSON_TYPE = "application/json";
@@ -84,12 +84,14 @@ describe("modularui hooks", () => {
84
84
  ]);
85
85
  };
86
86
 
87
- // replace the real XHR object with the mock XHR object before each test
88
87
  // eslint-disable-next-line jest/no-hooks
89
88
  beforeEach(() => {
90
89
  useLocation.mockReturnValue({
91
90
  state: null,
92
91
  });
92
+ useRouteMatch.mockReturnValue({
93
+ isExact: true,
94
+ });
93
95
  xhrMock.setup();
94
96
  });
95
97
 
@@ -2,6 +2,7 @@ export * from "./useAuthentication";
2
2
  export * from "./useContent";
3
3
  export * from "./useForm";
4
4
  export * from "./useI18n";
5
+ export * from "./useList";
5
6
  export * from "./useModal";
6
7
  export * from "./useModelCatalog";
7
8
  export * from "./useModels";
@@ -10,6 +11,7 @@ export * from "./useModularUIBasic";
10
11
  export * from "./useModularUIModel";
11
12
  export * from "./useModularUIRequest";
12
13
  export * from "./useNotification";
14
+ export * from "./usePanel";
13
15
  export * from "./usePreference";
14
16
  export * from "./useProgressIndicator";
15
17
  export * from "./useRouter";
@@ -3,6 +3,7 @@ export * from "./useAuthentication";
3
3
  export * from "./useContent";
4
4
  export * from "./useForm";
5
5
  export * from "./useI18n";
6
+ export * from "./useList";
6
7
  export * from "./useModal";
7
8
  export * from "./useModelCatalog";
8
9
  export * from "./useModels";
@@ -11,6 +12,7 @@ export * from "./useModularUIBasic";
11
12
  export * from "./useModularUIModel";
12
13
  export * from "./useModularUIRequest";
13
14
  export * from "./useNotification";
15
+ export * from "./usePanel";
14
16
  export * from "./usePreference";
15
17
  export * from "./useProgressIndicator";
16
18
  export * from "./useRouter";
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../src/hooks/index.js"],"sourcesContent":["// @flow\nexport * from \"./useAuthentication\";\nexport * from \"./useContent\";\nexport * from \"./useForm\";\nexport * from \"./useI18n\";\nexport * from \"./useModal\";\nexport * from \"./useModelCatalog\";\nexport * from \"./useModels\";\nexport * from \"./useModularUI\";\nexport * from \"./useModularUIBasic\";\nexport * from \"./useModularUIModel\";\nexport * from \"./useModularUIRequest\";\nexport * from \"./useNotification\";\nexport * from \"./usePreference\";\nexport * from \"./useProgressIndicator\";\nexport * from \"./useRouter\";\nexport * from \"./useAllFormsOnModel\";\n"],"mappings":"AACA,cAAc,qBAAqB;AACnC,cAAc,cAAc;AAC5B,cAAc,WAAW;AACzB,cAAc,WAAW;AACzB,cAAc,YAAY;AAC1B,cAAc,mBAAmB;AACjC,cAAc,aAAa;AAC3B,cAAc,gBAAgB;AAC9B,cAAc,qBAAqB;AACnC,cAAc,qBAAqB;AACnC,cAAc,uBAAuB;AACrC,cAAc,mBAAmB;AACjC,cAAc,iBAAiB;AAC/B,cAAc,wBAAwB;AACtC,cAAc,aAAa;AAC3B,cAAc,sBAAsB","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../src/hooks/index.js"],"sourcesContent":["// @flow\nexport * from \"./useAuthentication\";\nexport * from \"./useContent\";\nexport * from \"./useForm\";\nexport * from \"./useI18n\";\nexport * from \"./useList\";\nexport * from \"./useModal\";\nexport * from \"./useModelCatalog\";\nexport * from \"./useModels\";\nexport * from \"./useModularUI\";\nexport * from \"./useModularUIBasic\";\nexport * from \"./useModularUIModel\";\nexport * from \"./useModularUIRequest\";\nexport * from \"./useNotification\";\nexport * from \"./usePanel\";\nexport * from \"./usePreference\";\nexport * from \"./useProgressIndicator\";\nexport * from \"./useRouter\";\nexport * from \"./useAllFormsOnModel\";\n"],"mappings":"AACA,cAAc,qBAAqB;AACnC,cAAc,cAAc;AAC5B,cAAc,WAAW;AACzB,cAAc,WAAW;AACzB,cAAc,WAAW;AACzB,cAAc,YAAY;AAC1B,cAAc,mBAAmB;AACjC,cAAc,aAAa;AAC3B,cAAc,gBAAgB;AAC9B,cAAc,qBAAqB;AACnC,cAAc,qBAAqB;AACnC,cAAc,uBAAuB;AACrC,cAAc,mBAAmB;AACjC,cAAc,YAAY;AAC1B,cAAc,iBAAiB;AAC/B,cAAc,wBAAwB;AACtC,cAAc,aAAa;AAC3B,cAAc,sBAAsB","ignoreList":[]}
@@ -0,0 +1,69 @@
1
+ import { useModularUIBasic } from "./useModularUIBasic";
2
+ import { useDispatch } from "react-redux";
3
+ import { HTTP_METHODS } from "../constants/Constants";
4
+ import { loadModularUI } from "../redux";
5
+ import DetailModel from "../models/detail/DetailModel";
6
+ import ListModel from "../models/list/ListModel";
7
+ import ListDetailModel from "../models/list/ListDetailModel";
8
+ import Href from "../models/href/Href";
9
+ import { useHistory } from "react-router";
10
+ /**
11
+ */
12
+ export const useList = (href, options) => useModularUIBasic("list", href, {
13
+ expectedModels: ["List"],
14
+ targetModel: ListModel,
15
+ ...options
16
+ });
17
+
18
+ /**
19
+ */
20
+ export const useListOrDetail = (href, options) => useModularUIBasic("list", href, {
21
+ expectedModels: ["List", "Detail"],
22
+ targetModel: [ListModel, DetailModel],
23
+ ...options
24
+ });
25
+
26
+ /**
27
+ */
28
+ export const useListDetail = (href, options) => useModularUIBasic("listdetail", href, {
29
+ expectedModels: ["ListDetail"],
30
+ targetModel: ListDetailModel,
31
+ forceTargetModel: true,
32
+ ...options
33
+ });
34
+
35
+ /**
36
+ */
37
+ export const useListNavigation = () => {
38
+ const history = useHistory();
39
+ const dispatch = useDispatch();
40
+ const fetch = (list, resetPage = false) => {
41
+ const listHref = list.selfhref;
42
+ if (resetPage) {
43
+ listHref.page = null;
44
+ }
45
+ if (list.requestMethod === HTTP_METHODS.POST) {
46
+ history.push({
47
+ search: listHref.querystring,
48
+ state: list.formdata
49
+ });
50
+ return dispatch(loadModularUI(list.connectKey, listHref, {
51
+ method: HTTP_METHODS.POST,
52
+ data: list.formdata,
53
+ targetModel: ListModel
54
+ }));
55
+ } else {
56
+ history.push({
57
+ search: listHref.querystring
58
+ });
59
+ return dispatch(loadModularUI(list.connectKey, listHref, {
60
+ method: HTTP_METHODS.GET,
61
+ targetModel: ListModel
62
+ }));
63
+ }
64
+ };
65
+ return {
66
+ fetch
67
+ };
68
+ };
69
+ //# sourceMappingURL=useList.js.map
@@ -0,0 +1,90 @@
1
+ // @flow
2
+ import { useModularUIBasic } from "./useModularUIBasic";
3
+ import { useDispatch } from "react-redux";
4
+ import { HTTP_METHODS } from "../constants/Constants";
5
+ import { loadModularUI } from "../redux";
6
+ import DetailModel from "../models/detail/DetailModel";
7
+ import ListModel from "../models/list/ListModel";
8
+ import ListDetailModel from "../models/list/ListDetailModel";
9
+ import Href from "../models/href/Href";
10
+
11
+ import type { HookOptions } from "./useModularUIBasic";
12
+ import { useHistory } from "react-router";
13
+
14
+ type ListNavigationHook = {
15
+ fetch: (list: ListModel, resetPage?: boolean) => void,
16
+ };
17
+
18
+ /**
19
+ */
20
+ export const useList = (
21
+ href: string | Href,
22
+ options?: HookOptions,
23
+ ): ListModel | null =>
24
+ useModularUIBasic("list", href, {
25
+ expectedModels: ["List"],
26
+ targetModel: ListModel,
27
+ ...options,
28
+ });
29
+
30
+ /**
31
+ */
32
+ export const useListOrDetail = (
33
+ href: string | Href,
34
+ options?: HookOptions,
35
+ ): ListModel | DetailModel | null =>
36
+ useModularUIBasic("list", href, {
37
+ expectedModels: ["List", "Detail"],
38
+ targetModel: [ListModel, DetailModel],
39
+ ...options,
40
+ });
41
+
42
+ /**
43
+ */
44
+ export const useListDetail = (
45
+ href: string | Href,
46
+ options?: HookOptions,
47
+ ): ListDetailModel | null =>
48
+ useModularUIBasic("listdetail", href, {
49
+ expectedModels: ["ListDetail"],
50
+ targetModel: ListDetailModel,
51
+ forceTargetModel: true,
52
+ ...options,
53
+ });
54
+
55
+ /**
56
+ */
57
+ export const useListNavigation = (): ListNavigationHook => {
58
+ const history = useHistory();
59
+ const dispatch = useDispatch();
60
+
61
+ const fetch = (list: ListModel, resetPage: boolean = false) => {
62
+ const listHref = list.selfhref;
63
+ if (resetPage) {
64
+ listHref.page = null;
65
+ }
66
+
67
+ if (list.requestMethod === HTTP_METHODS.POST) {
68
+ history.push({ search: listHref.querystring, state: list.formdata });
69
+ return dispatch(
70
+ loadModularUI(list.connectKey, listHref, {
71
+ method: HTTP_METHODS.POST,
72
+ data: list.formdata,
73
+ targetModel: ListModel,
74
+ }),
75
+ );
76
+ } else {
77
+ history.push({ search: listHref.querystring });
78
+ return dispatch(
79
+ loadModularUI(list.connectKey, listHref, {
80
+ method: HTTP_METHODS.GET,
81
+ targetModel: ListModel,
82
+ }),
83
+ );
84
+ }
85
+ };
86
+
87
+ return {
88
+ fetch,
89
+ };
90
+ };
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useList.js","names":["useModularUIBasic","useDispatch","HTTP_METHODS","loadModularUI","DetailModel","ListModel","ListDetailModel","Href","useHistory","useList","href","options","expectedModels","targetModel","useListOrDetail","useListDetail","forceTargetModel","useListNavigation","history","dispatch","fetch","list","resetPage","listHref","selfhref","page","requestMethod","POST","push","search","querystring","state","formdata","connectKey","method","data","GET"],"sources":["../../src/hooks/useList.js"],"sourcesContent":["// @flow\nimport { useModularUIBasic } from \"./useModularUIBasic\";\nimport { useDispatch } from \"react-redux\";\nimport { HTTP_METHODS } from \"../constants/Constants\";\nimport { loadModularUI } from \"../redux\";\nimport DetailModel from \"../models/detail/DetailModel\";\nimport ListModel from \"../models/list/ListModel\";\nimport ListDetailModel from \"../models/list/ListDetailModel\";\nimport Href from \"../models/href/Href\";\n\nimport type { HookOptions } from \"./useModularUIBasic\";\nimport { useHistory } from \"react-router\";\n\ntype ListNavigationHook = {\n fetch: (list: ListModel, resetPage?: boolean) => void,\n};\n\n/**\n */\nexport const useList = (\n href: string | Href,\n options?: HookOptions,\n): ListModel | null =>\n useModularUIBasic(\"list\", href, {\n expectedModels: [\"List\"],\n targetModel: ListModel,\n ...options,\n });\n\n/**\n */\nexport const useListOrDetail = (\n href: string | Href,\n options?: HookOptions,\n): ListModel | DetailModel | null =>\n useModularUIBasic(\"list\", href, {\n expectedModels: [\"List\", \"Detail\"],\n targetModel: [ListModel, DetailModel],\n ...options,\n });\n\n/**\n */\nexport const useListDetail = (\n href: string | Href,\n options?: HookOptions,\n): ListDetailModel | null =>\n useModularUIBasic(\"listdetail\", href, {\n expectedModels: [\"ListDetail\"],\n targetModel: ListDetailModel,\n forceTargetModel: true,\n ...options,\n });\n\n/**\n */\nexport const useListNavigation = (): ListNavigationHook => {\n const history = useHistory();\n const dispatch = useDispatch();\n\n const fetch = (list: ListModel, resetPage: boolean = false) => {\n const listHref = list.selfhref;\n if (resetPage) {\n listHref.page = null;\n }\n\n if (list.requestMethod === HTTP_METHODS.POST) {\n history.push({ search: listHref.querystring, state: list.formdata });\n return dispatch(\n loadModularUI(list.connectKey, listHref, {\n method: HTTP_METHODS.POST,\n data: list.formdata,\n targetModel: ListModel,\n }),\n );\n } else {\n history.push({ search: listHref.querystring });\n return dispatch(\n loadModularUI(list.connectKey, listHref, {\n method: HTTP_METHODS.GET,\n targetModel: ListModel,\n }),\n );\n }\n };\n\n return {\n fetch,\n };\n};\n"],"mappings":"AACA,SAASA,iBAAiB,QAAQ,qBAAqB;AACvD,SAASC,WAAW,QAAQ,aAAa;AACzC,SAASC,YAAY,QAAQ,wBAAwB;AACrD,SAASC,aAAa,QAAQ,UAAU;AACxC,OAAOC,WAAW,MAAM,8BAA8B;AACtD,OAAOC,SAAS,MAAM,0BAA0B;AAChD,OAAOC,eAAe,MAAM,gCAAgC;AAC5D,OAAOC,IAAI,MAAM,qBAAqB;AAGtC,SAASC,UAAU,QAAQ,cAAc;AAMzC;AACA;AACA,OAAO,MAAMC,OAAO,GAAGA,CACrBC,IAAmB,EACnBC,OAAqB,KAErBX,iBAAiB,CAAC,MAAM,EAAEU,IAAI,EAAE;EAC9BE,cAAc,EAAE,CAAC,MAAM,CAAC;EACxBC,WAAW,EAAER,SAAS;EACtB,GAAGM;AACL,CAAC,CAAC;;AAEJ;AACA;AACA,OAAO,MAAMG,eAAe,GAAGA,CAC7BJ,IAAmB,EACnBC,OAAqB,KAErBX,iBAAiB,CAAC,MAAM,EAAEU,IAAI,EAAE;EAC9BE,cAAc,EAAE,CAAC,MAAM,EAAE,QAAQ,CAAC;EAClCC,WAAW,EAAE,CAACR,SAAS,EAAED,WAAW,CAAC;EACrC,GAAGO;AACL,CAAC,CAAC;;AAEJ;AACA;AACA,OAAO,MAAMI,aAAa,GAAGA,CAC3BL,IAAmB,EACnBC,OAAqB,KAErBX,iBAAiB,CAAC,YAAY,EAAEU,IAAI,EAAE;EACpCE,cAAc,EAAE,CAAC,YAAY,CAAC;EAC9BC,WAAW,EAAEP,eAAe;EAC5BU,gBAAgB,EAAE,IAAI;EACtB,GAAGL;AACL,CAAC,CAAC;;AAEJ;AACA;AACA,OAAO,MAAMM,iBAAiB,GAAGA,CAAA,KAA0B;EACzD,MAAMC,OAAO,GAAGV,UAAU,CAAC,CAAC;EAC5B,MAAMW,QAAQ,GAAGlB,WAAW,CAAC,CAAC;EAE9B,MAAMmB,KAAK,GAAGA,CAACC,IAAe,EAAEC,SAAkB,GAAG,KAAK,KAAK;IAC7D,MAAMC,QAAQ,GAAGF,IAAI,CAACG,QAAQ;IAC9B,IAAIF,SAAS,EAAE;MACbC,QAAQ,CAACE,IAAI,GAAG,IAAI;IACtB;IAEA,IAAIJ,IAAI,CAACK,aAAa,KAAKxB,YAAY,CAACyB,IAAI,EAAE;MAC5CT,OAAO,CAACU,IAAI,CAAC;QAAEC,MAAM,EAAEN,QAAQ,CAACO,WAAW;QAAEC,KAAK,EAAEV,IAAI,CAACW;MAAS,CAAC,CAAC;MACpE,OAAOb,QAAQ,CACbhB,aAAa,CAACkB,IAAI,CAACY,UAAU,EAAEV,QAAQ,EAAE;QACvCW,MAAM,EAAEhC,YAAY,CAACyB,IAAI;QACzBQ,IAAI,EAAEd,IAAI,CAACW,QAAQ;QACnBnB,WAAW,EAAER;MACf,CAAC,CACH,CAAC;IACH,CAAC,MAAM;MACLa,OAAO,CAACU,IAAI,CAAC;QAAEC,MAAM,EAAEN,QAAQ,CAACO;MAAY,CAAC,CAAC;MAC9C,OAAOX,QAAQ,CACbhB,aAAa,CAACkB,IAAI,CAACY,UAAU,EAAEV,QAAQ,EAAE;QACvCW,MAAM,EAAEhC,YAAY,CAACkC,GAAG;QACxBvB,WAAW,EAAER;MACf,CAAC,CACH,CAAC;IACH;EACF,CAAC;EAED,OAAO;IACLe;EACF,CAAC;AACH,CAAC","ignoreList":[]}
@@ -1,7 +1,7 @@
1
1
  import _startsWithInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/starts-with";
2
+ import { useLocation } from "react-router";
2
3
  import { useMemo } from "react";
3
4
  import { useModularUI } from "./useModularUI";
4
- import { useLocation } from "./useRouter";
5
5
  // Helper to create useModularUI options
6
6
  const createUseModularUIOptions = (options, href, location) => {
7
7
  var _context;
@@ -1,9 +1,13 @@
1
1
  // @flow
2
+ import type { ModularUIModel, Href } from "../models";
3
+ import { useLocation } from "react-router";
2
4
  import { useMemo } from "react";
3
5
  import { useModularUI } from "./useModularUI";
4
- import { useLocation } from "./useRouter";
5
6
 
6
- import type { ModularUIModel, Href } from "../models";
7
+ export type HookOptions = {
8
+ origin?: string,
9
+ contextPath?: string,
10
+ };
7
11
 
8
12
  export type UseModularUIBasicOptions<T: ModularUIModel> = {
9
13
  expectedModels?: Array<string>,
@@ -1 +1 @@
1
- {"version":3,"file":"useModularUIBasic.js","names":["useMemo","useModularUI","useLocation","createUseModularUIOptions","options","href","location","_context","baseOptions","targetModel","undefined","forceTargetModel","isReload","origin","contextPath","cache","state","reload","_startsWithInstanceProperty","pathname","call","validateModel","model","expectedModels","length","isCorrectModel","some","expectedModel","type","console","warn","useModularUIBasic","key","memoizedHref","toString","useModularUIOptions","modularUI"],"sources":["../../src/hooks/useModularUIBasic.js"],"sourcesContent":["// @flow\nimport { useMemo } from \"react\";\nimport { useModularUI } from \"./useModularUI\";\nimport { useLocation } from \"./useRouter\";\n\nimport type { ModularUIModel, Href } from \"../models\";\n\nexport type UseModularUIBasicOptions<T: ModularUIModel> = {\n expectedModels?: Array<string>,\n targetModel?: Class<T> | Array<Class<T>>,\n forceTargetModel?: boolean,\n origin?: string,\n contextPath?: string,\n cache?: boolean,\n};\n\n// Helper to create useModularUI options\nconst createUseModularUIOptions = <T: ModularUIModel>(\n options: UseModularUIBasicOptions<T>,\n href: string,\n location: any,\n): Object => {\n const baseOptions = {\n targetModel: undefined,\n forceTargetModel: undefined,\n isReload: false,\n origin: undefined,\n contextPath: undefined,\n cache: false,\n };\n\n // Handle targetModel and forceTargetModel\n if (options.targetModel) {\n baseOptions.targetModel = options.targetModel;\n baseOptions.forceTargetModel = options.forceTargetModel;\n }\n\n // Handle cache option\n if (options.cache) {\n baseOptions.cache = options.cache;\n }\n\n // Check for reload if location matches href\n if (location.state?.reload && location.pathname.startsWith(href)) {\n baseOptions.isReload = true;\n }\n\n // Handle origin and contextPath options\n baseOptions.origin = options.origin ?? baseOptions.origin;\n baseOptions.contextPath = options.contextPath ?? baseOptions.contextPath;\n\n return baseOptions;\n};\n\n// Helper to validate the model against expectedModels\nconst validateModel = (model: any, expectedModels: Array<string>) => {\n if (expectedModels.length > 0) {\n const isCorrectModel = expectedModels.some(\n (expectedModel) => model.type === expectedModel,\n );\n if (!isCorrectModel) {\n console.warn(model, \"is not of instance\", expectedModels);\n }\n }\n};\n\n/**\n * useModularUIBasic Hook\n */\nexport const useModularUIBasic = <T: ModularUIModel>(\n key: string,\n href: string | Href,\n options: UseModularUIBasicOptions<T> = {\n expectedModels: [],\n targetModel: undefined,\n forceTargetModel: false,\n origin: undefined,\n contextPath: undefined,\n },\n): T | null => {\n const location = useLocation();\n const memoizedHref = useMemo(() => href.toString(), [href]);\n const useModularUIOptions = useMemo(\n () => createUseModularUIOptions(options, memoizedHref, location),\n [options, memoizedHref, location],\n );\n\n const modularUI = useModularUI(key, href, useModularUIOptions);\n const expectedModels = useMemo(\n () => options.expectedModels ?? [],\n [options.expectedModels],\n );\n\n return useMemo((): T | null => {\n if (modularUI?.model) {\n validateModel(modularUI.model, expectedModels);\n return modularUI.model;\n }\n return null;\n }, [expectedModels, modularUI]);\n};\n"],"mappings":";AACA,SAASA,OAAO,QAAQ,OAAO;AAC/B,SAASC,YAAY,QAAQ,gBAAgB;AAC7C,SAASC,WAAW,QAAQ,aAAa;AAazC;AACA,MAAMC,yBAAyB,GAAGA,CAChCC,OAAoC,EACpCC,IAAY,EACZC,QAAa,KACF;EAAA,IAAAC,QAAA;EACX,MAAMC,WAAW,GAAG;IAClBC,WAAW,EAAEC,SAAS;IACtBC,gBAAgB,EAAED,SAAS;IAC3BE,QAAQ,EAAE,KAAK;IACfC,MAAM,EAAEH,SAAS;IACjB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M,EAAEH,SAAS;EACjBI,WAAW,EAAEJ;AACf,CAAC,KACY;EACb,MAAMJ,QAAQ,GAAGJ,WAAW,CAAC,CAAC;EAC9B,MAAM+B,YAAY,GAAGjC,OAAO,CAAC,MAAMK,IAAI,CAAC6B,QAAQ,CAAC,CAAC,EAAE,CAAC7B,IAAI,CAAC,CAAC;EAC3D,MAAM8B,mBAAmB,GAAGnC,OAAO,CACjC,MAAMG,yBAAyB,CAACC,OAAO,EAAE6B,YAAY,EAAE3B,QAAQ,CAAC,EAChE,CAACF,OAAO,EAAE6B,YAAY,EAAE3B,QAAQ,CAClC,CAAC;EAED,MAAM8B,SAAS,GAAGnC,YAAY,CAAC+B,GAAG,EAAE3B,IAAI,EAAE8B,mBAAmB,CAAC;EAC9D,MAAMZ,cAAc,GAAGvB,OAAO,CAC5B,MAAMI,OAAO,CAACmB,cAAc,IAAI,EAAE,EAClC,CAACnB,OAAO,CAACmB,cAAc,CACzB,CAAC;EAED,OAAOvB,OAAO,CAAC,MAAgB;IAC7B,IAAIoC,SAAS,EAAEd,KAAK,EAAE;MACpBD,aAAa,CAACe,SAAS,CAACd,KAAK,EAAEC,cAAc,CAAC;MAC9C,OAAOa,SAAS,CAACd,KAAK;IACxB;IACA,OAAO,IAAI;EACb,CAAC,EAAE,CAACC,cAAc,EAAEa,SAAS,CAAC,CAAC;AACjC,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"useModularUIBasic.js","names":["useLocation","useMemo","useModularUI","createUseModularUIOptions","options","href","location","_context","baseOptions","targetModel","undefined","forceTargetModel","isReload","origin","contextPath","cache","state","reload","_startsWithInstanceProperty","pathname","call","validateModel","model","expectedModels","length","isCorrectModel","some","expectedModel","type","console","warn","useModularUIBasic","key","memoizedHref","toString","useModularUIOptions","modularUI"],"sources":["../../src/hooks/useModularUIBasic.js"],"sourcesContent":["// @flow\nimport type { ModularUIModel, Href } from \"../models\";\nimport { useLocation } from \"react-router\";\nimport { useMemo } from \"react\";\nimport { useModularUI } from \"./useModularUI\";\n\nexport type HookOptions = {\n origin?: string,\n contextPath?: string,\n};\n\nexport type UseModularUIBasicOptions<T: ModularUIModel> = {\n expectedModels?: Array<string>,\n targetModel?: Class<T> | Array<Class<T>>,\n forceTargetModel?: boolean,\n origin?: string,\n contextPath?: string,\n cache?: boolean,\n};\n\n// Helper to create useModularUI options\nconst createUseModularUIOptions = <T: ModularUIModel>(\n options: UseModularUIBasicOptions<T>,\n href: string,\n location: any,\n): Object => {\n const baseOptions = {\n targetModel: undefined,\n forceTargetModel: undefined,\n isReload: false,\n origin: undefined,\n contextPath: undefined,\n cache: false,\n };\n\n // Handle targetModel and forceTargetModel\n if (options.targetModel) {\n baseOptions.targetModel = options.targetModel;\n baseOptions.forceTargetModel = options.forceTargetModel;\n }\n\n // Handle cache option\n if (options.cache) {\n baseOptions.cache = options.cache;\n }\n\n // Check for reload if location matches href\n if (location.state?.reload && location.pathname.startsWith(href)) {\n baseOptions.isReload = true;\n }\n\n // Handle origin and contextPath options\n baseOptions.origin = options.origin ?? baseOptions.origin;\n baseOptions.contextPath = options.contextPath ?? baseOptions.contextPath;\n\n return baseOptions;\n};\n\n// Helper to validate the model against expectedModels\nconst validateModel = (model: any, expectedModels: Array<string>) => {\n if (expectedModels.length > 0) {\n const isCorrectModel = expectedModels.some(\n (expectedModel) => model.type === expectedModel,\n );\n if (!isCorrectModel) {\n console.warn(model, \"is not of instance\", expectedModels);\n }\n }\n};\n\n/**\n * useModularUIBasic Hook\n */\nexport const useModularUIBasic = <T: ModularUIModel>(\n key: string,\n href: string | Href,\n options: UseModularUIBasicOptions<T> = {\n expectedModels: [],\n targetModel: undefined,\n forceTargetModel: false,\n origin: undefined,\n contextPath: undefined,\n },\n): T | null => {\n const location = useLocation();\n const memoizedHref = useMemo(() => href.toString(), [href]);\n const useModularUIOptions = useMemo(\n () => createUseModularUIOptions(options, memoizedHref, location),\n [options, memoizedHref, location],\n );\n\n const modularUI = useModularUI(key, href, useModularUIOptions);\n const expectedModels = useMemo(\n () => options.expectedModels ?? [],\n [options.expectedModels],\n );\n\n return useMemo((): T | null => {\n if (modularUI?.model) {\n validateModel(modularUI.model, expectedModels);\n return modularUI.model;\n }\n return null;\n }, [expectedModels, modularUI]);\n};\n"],"mappings":";AAEA,SAASA,WAAW,QAAQ,cAAc;AAC1C,SAASC,OAAO,QAAQ,OAAO;AAC/B,SAASC,YAAY,QAAQ,gBAAgB;AAgB7C;AACA,MAAMC,yBAAyB,GAAGA,CAChCC,OAAoC,EACpCC,IAAY,EACZC,QAAa,KACF;EAAA,IAAAC,QAAA;EACX,MAAMC,WAAW,GAAG;IAClBC,WAAW,EAAEC,SAAS;IACtBC,gBAAgB,EAAED,SAAS;IAC3BE,QAAQ,EAAE,KAAK;IACfC,MAAM,EAAEH,SAAS;IACjBI,WAAW,EAAEJ,SAAS;IACtBK,KAAK,EAAE;EACT,CAAC;;EAED;EACA,IAAIX,OAAO,CAACK,WAAW,EAAE;IACvBD,WAAW,CAACC,WAAW,GAAGL,OAAO,CAACK,WAAW;IAC7CD,WAAW,CAACG,gBAAgB,GAAGP,OAAO,CAACO,gBAAgB;EACzD;;EAEA;EACA,IAAIP,OAAO,CAACW,KAAK,EAAE;IACjBP,WAAW,CAACO,KAAK,GAAGX,OAAO,CAACW,KAAK;EACnC;;EAEA;EACA,IAAIT,QAAQ,CAACU,KAAK,EAAEC,MAAM,IAAIC,2BAAA,CAAAX,QAAA,GAAAD,QAAQ,CAACa,QAAQ,EAAAC,IAAA,CAAAb,QAAA,EAAYF,IAAI,CAAC,EAAE;IAChEG,WAAW,CAACI,QAAQ,GAAG,IAAI;EAC7B;;EAEA;EACAJ,WAAW,CAACK,MAAM,GAAGT,OAAO,CAACS,MAAM,IAAIL,WAAW,CAACK,MAAM;EACzDL,WAAW,CAACM,WAAW,GAAGV,OAAO,CAACU,WAAW,IAAIN,WAAW,CAACM,WAAW;EAExE,OAAON,WAAW;AACpB,CAAC;;AAED;AACA,MAAMa,aAAa,GAAGA,CAACC,KAA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CAACd,KAAK;IACxB;IACA,OAAO,IAAI;EACb,CAAC,EAAE,CAACC,cAAc,EAAEa,SAAS,CAAC,CAAC;AACjC,CAAC","ignoreList":[]}
@@ -1,11 +1,9 @@
1
1
  import ApplicationModel from "../models/application/ApplicationModel";
2
2
  import CaseViewModel from "../models/caseview/CaseViewModel";
3
3
  import TabModel from "../models/tab/TabModel";
4
- import ListModel from "../models/list/ListModel";
5
4
  import GroupingPanelModel from "../models/panels/GroupingPanelModel";
6
5
  import DetailModel from "../models/detail/DetailModel";
7
6
  import CaseSearchModel from "../models/search/CaseSearchModel";
8
- import ListDetailModel from "../models/list/ListDetailModel";
9
7
  import UserProfileModel from "../models/user/UserProfileModel";
10
8
  import { useModularUIBasic } from "./useModularUIBasic";
11
9
  /**
@@ -35,38 +33,6 @@ export const useCaseView = (href, options) => useModularUIBasic("caseview", href
35
33
  ...options
36
34
  });
37
35
 
38
- /**
39
- */
40
- export const usePanel = (href, options) => useModularUIBasic("panel", href, {
41
- expectedModels: ["List", "GroupingPanel", "Detail"],
42
- ...options
43
- });
44
-
45
- /**
46
- */
47
- export const useList = (href, options) => useModularUIBasic("list", href, {
48
- expectedModels: ["List"],
49
- targetModel: ListModel,
50
- ...options
51
- });
52
-
53
- /**
54
- */
55
- export const useListOrDetail = (href, options) => useModularUIBasic("list", href, {
56
- expectedModels: ["List", "Detail"],
57
- targetModel: [ListModel, DetailModel],
58
- ...options
59
- });
60
-
61
- /**
62
- */
63
- export const useListDetail = (href, options) => useModularUIBasic("listdetail", href, {
64
- expectedModels: ["ListDetail"],
65
- targetModel: ListDetailModel,
66
- forceTargetModel: true,
67
- ...options
68
- });
69
-
70
36
  /**
71
37
  */
72
38
  export const useGroupingPanel = (href, options) => useModularUIBasic("groupingpanel", href, {
@@ -2,21 +2,15 @@
2
2
  import ApplicationModel from "../models/application/ApplicationModel";
3
3
  import CaseViewModel from "../models/caseview/CaseViewModel";
4
4
  import TabModel from "../models/tab/TabModel";
5
- import ListModel from "../models/list/ListModel";
6
5
  import GroupingPanelModel from "../models/panels/GroupingPanelModel";
7
6
  import DetailModel from "../models/detail/DetailModel";
8
7
  import CaseSearchModel from "../models/search/CaseSearchModel";
9
- import ListDetailModel from "../models/list/ListDetailModel";
10
8
  import UserProfileModel from "../models/user/UserProfileModel";
11
9
 
12
10
  import { useModularUIBasic } from "./useModularUIBasic";
13
11
 
14
12
  import type Href from "../models/href/Href";
15
-
16
- type HookOptions = {
17
- origin?: string,
18
- contextPath?: string,
19
- };
13
+ import type { HookOptions } from "./useModularUIBasic";
20
14
 
21
15
  /**
22
16
  * Load application
@@ -56,54 +50,6 @@ export const useCaseView = (
56
50
  ...options,
57
51
  });
58
52
 
59
- /**
60
- */
61
- export const usePanel = (
62
- href: string | Href,
63
- options?: HookOptions,
64
- ): ListModel | GroupingPanelModel | DetailModel | null =>
65
- useModularUIBasic("panel", href, {
66
- expectedModels: ["List", "GroupingPanel", "Detail"],
67
- ...options,
68
- });
69
-
70
- /**
71
- */
72
- export const useList = (
73
- href: string | Href,
74
- options?: HookOptions,
75
- ): ListModel | null =>
76
- useModularUIBasic("list", href, {
77
- expectedModels: ["List"],
78
- targetModel: ListModel,
79
- ...options,
80
- });
81
-
82
- /**
83
- */
84
- export const useListOrDetail = (
85
- href: string | Href,
86
- options?: HookOptions,
87
- ): ListModel | DetailModel | null =>
88
- useModularUIBasic("list", href, {
89
- expectedModels: ["List", "Detail"],
90
- targetModel: [ListModel, DetailModel],
91
- ...options,
92
- });
93
-
94
- /**
95
- */
96
- export const useListDetail = (
97
- href: string | Href,
98
- options?: HookOptions,
99
- ): ListDetailModel | null =>
100
- useModularUIBasic("listdetail", href, {
101
- expectedModels: ["ListDetail"],
102
- targetModel: ListDetailModel,
103
- forceTargetModel: true,
104
- ...options,
105
- });
106
-
107
53
  /**
108
54
  */
109
55
  export const useGroupingPanel = (
@@ -1 +1 @@
1
- {"version":3,"file":"useModularUIModel.js","names":["ApplicationModel","CaseViewModel","TabModel","ListModel","GroupingPanelModel","DetailModel","CaseSearchModel","ListDetailModel","UserProfileModel","useModularUIBasic","useApplication","options","expectedModels","targetModel","useTab","href","useCaseView","usePanel","useList","useListOrDetail","useListDetail","forceTargetModel","useGroupingPanel","useDetailPanel","useQuicksearch","useSearch","useUserProfile"],"sources":["../../src/hooks/useModularUIModel.js"],"sourcesContent":["// @flow\nimport ApplicationModel from \"../models/application/ApplicationModel\";\nimport CaseViewModel from \"../models/caseview/CaseViewModel\";\nimport TabModel from \"../models/tab/TabModel\";\nimport ListModel from \"../models/list/ListModel\";\nimport GroupingPanelModel from \"../models/panels/GroupingPanelModel\";\nimport DetailModel from \"../models/detail/DetailModel\";\nimport CaseSearchModel from \"../models/search/CaseSearchModel\";\nimport ListDetailModel from \"../models/list/ListDetailModel\";\nimport UserProfileModel from \"../models/user/UserProfileModel\";\n\nimport { useModularUIBasic } from \"./useModularUIBasic\";\n\nimport type Href from \"../models/href/Href\";\n\ntype HookOptions = {\n origin?: string,\n contextPath?: string,\n};\n\n/**\n * Load application\n */\nexport const useApplication = (\n options?: HookOptions,\n): ApplicationModel | null =>\n useModularUIBasic(\"application\", \"/\", {\n expectedModels: [\"Application\"],\n targetModel: ApplicationModel,\n ...options,\n });\n\n/**\n * Load a tab by href\n */\nexport const useTab = (\n href: string | Href,\n options?: HookOptions,\n): TabModel | null =>\n useModularUIBasic(\"tab\", href, {\n expectedModels: [\"Tab\"],\n targetModel: TabModel,\n ...options,\n });\n\n/**\n * Load caseview by href\n */\nexport const useCaseView = (\n href: string | Href,\n options?: HookOptions,\n): CaseViewModel | null =>\n useModularUIBasic(\"caseview\", href, {\n expectedModels: [\"CaseView\"],\n targetModel: CaseViewModel,\n ...options,\n });\n\n/**\n */\nexport const usePanel = (\n href: string | Href,\n options?: HookOptions,\n): ListModel | GroupingPanelModel | DetailModel | null =>\n useModularUIBasic(\"panel\", href, {\n expectedModels: [\"List\", \"GroupingPanel\", \"Detail\"],\n ...options,\n });\n\n/**\n */\nexport const useList = (\n href: string | Href,\n options?: HookOptions,\n): ListModel | null =>\n useModularUIBasic(\"list\", href, {\n expectedModels: [\"List\"],\n targetModel: ListModel,\n ...options,\n });\n\n/**\n */\nexport const useListOrDetail = (\n href: string | Href,\n options?: HookOptions,\n): ListModel | DetailModel | null =>\n useModularUIBasic(\"list\", href, {\n expectedModels: [\"List\", \"Detail\"],\n targetModel: [ListModel, DetailModel],\n ...options,\n });\n\n/**\n */\nexport const useListDetail = (\n href: string | Href,\n options?: HookOptions,\n): ListDetailModel | null =>\n useModularUIBasic(\"listdetail\", href, {\n expectedModels: [\"ListDetail\"],\n targetModel: ListDetailModel,\n forceTargetModel: true,\n ...options,\n });\n\n/**\n */\nexport const useGroupingPanel = (\n href: string | Href,\n options?: HookOptions,\n): GroupingPanelModel | null =>\n useModularUIBasic(\"groupingpanel\", href, {\n expectedModels: [\"GroupingPanel\"],\n targetModel: GroupingPanelModel,\n ...options,\n });\n\n/**\n */\nexport const useDetailPanel = (\n href: string | Href,\n options?: HookOptions,\n): DetailModel | null =>\n useModularUIBasic(\"detailpanel\", href, {\n expectedModels: [\"Detail\"],\n targetModel: DetailModel,\n ...options,\n });\n\n/**\n */\nexport const useQuicksearch = (\n href: string | Href,\n options?: HookOptions,\n): CaseSearchModel | null =>\n useModularUIBasic(\"quicksearch\", href, {\n expectedModels: [\"CaseSearch\"],\n targetModel: CaseSearchModel,\n ...options,\n });\n\n/**\n */\nexport const useSearch = (\n href: string | Href,\n options?: HookOptions,\n): CaseSearchModel | null =>\n useModularUIBasic(\"search\", href, {\n expectedModels: [\"CaseSearch\"],\n targetModel: CaseSearchModel,\n ...options,\n });\n\n/**\n */\nexport const useUserProfile = (\n href: string | Href,\n options?: HookOptions,\n): UserProfileModel | null =>\n useModularUIBasic(\"userprofile\", href, {\n expectedModels: [\"UserProfile\"],\n targetModel: UserProfileModel,\n ...options,\n });\n"],"mappings":"AACA,OAAOA,gBAAgB,MAAM,wCAAwC;AACrE,OAAOC,aAAa,MAAM,kCAAkC;AAC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EAC9BC,WAAW,EAAEP,eAAe;EAC5B,GAAGK;AACL,CAAC,CAAC;;AAEJ;AACA;AACA,OAAO,MAAMc,SAAS,GAAGA,CACvBV,IAAmB,EACnBJ,OAAqB,KAErBF,iBAAiB,CAAC,QAAQ,EAAEM,IAAI,EAAE;EAChCH,cAAc,EAAE,CAAC,YAAY,CAAC;EAC9BC,WAAW,EAAEP,eAAe;EAC5B,GAAGK;AACL,CAAC,CAAC;;AAEJ;AACA;AACA,OAAO,MAAMe,cAAc,GAAGA,CAC5BX,IAAmB,EACnBJ,OAAqB,KAErBF,iBAAiB,CAAC,aAAa,EAAEM,IAAI,EAAE;EACrCH,cAAc,EAAE,CAAC,aAAa,CAAC;EAC/BC,WAAW,EAAEL,gBAAgB;EAC7B,GAAGG;AACL,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"useModularUIModel.js","names":["ApplicationModel","CaseViewModel","TabModel","GroupingPanelModel","DetailModel","CaseSearchModel","UserProfileModel","useModularUIBasic","useApplication","options","expectedModels","targetModel","useTab","href","useCaseView","useGroupingPanel","useDetailPanel","useQuicksearch","useSearch","useUserProfile"],"sources":["../../src/hooks/useModularUIModel.js"],"sourcesContent":["// @flow\nimport ApplicationModel from \"../models/application/ApplicationModel\";\nimport CaseViewModel from \"../models/caseview/CaseViewModel\";\nimport TabModel from \"../models/tab/TabModel\";\nimport GroupingPanelModel from \"../models/panels/GroupingPanelModel\";\nimport DetailModel from \"../models/detail/DetailModel\";\nimport CaseSearchModel from \"../models/search/CaseSearchModel\";\nimport UserProfileModel from \"../models/user/UserProfileModel\";\n\nimport { useModularUIBasic } from \"./useModularUIBasic\";\n\nimport type Href from \"../models/href/Href\";\nimport type { HookOptions } from \"./useModularUIBasic\";\n\n/**\n * Load application\n */\nexport const useApplication = (\n options?: HookOptions,\n): ApplicationModel | null =>\n useModularUIBasic(\"application\", \"/\", {\n expectedModels: [\"Application\"],\n targetModel: ApplicationModel,\n ...options,\n });\n\n/**\n * Load a tab by href\n */\nexport const useTab = (\n href: string | Href,\n options?: HookOptions,\n): TabModel | null =>\n useModularUIBasic(\"tab\", href, {\n expectedModels: [\"Tab\"],\n targetModel: TabModel,\n ...options,\n });\n\n/**\n * Load caseview by href\n */\nexport const useCaseView = (\n href: string | Href,\n options?: HookOptions,\n): CaseViewModel | null =>\n useModularUIBasic(\"caseview\", href, {\n expectedModels: [\"CaseView\"],\n targetModel: CaseViewModel,\n ...options,\n });\n\n/**\n */\nexport const useGroupingPanel = (\n href: string | Href,\n options?: HookOptions,\n): GroupingPanelModel | null =>\n useModularUIBasic(\"groupingpanel\", href, {\n expectedModels: [\"GroupingPanel\"],\n targetModel: GroupingPanelModel,\n ...options,\n });\n\n/**\n */\nexport const useDetailPanel = (\n href: string | Href,\n options?: HookOptions,\n): DetailModel | null =>\n useModularUIBasic(\"detailpanel\", href, {\n expectedModels: [\"Detail\"],\n targetModel: DetailModel,\n ...options,\n });\n\n/**\n */\nexport const useQuicksearch = (\n href: string | Href,\n options?: HookOptions,\n): CaseSearchModel | null =>\n useModularUIBasic(\"quicksearch\", href, {\n expectedModels: [\"CaseSearch\"],\n targetModel: CaseSearchModel,\n ...options,\n });\n\n/**\n */\nexport const useSearch = (\n href: string | Href,\n options?: HookOptions,\n): CaseSearchModel | null =>\n useModularUIBasic(\"search\", href, {\n expectedModels: [\"CaseSearch\"],\n targetModel: CaseSearchModel,\n ...options,\n });\n\n/**\n */\nexport const useUserProfile = (\n href: string | Href,\n options?: HookOptions,\n): UserProfileModel | null =>\n useModularUIBasic(\"userprofile\", href, {\n expectedModels: [\"UserProfile\"],\n targetModel: UserProfileModel,\n ...options,\n });\n"],"mappings":"AACA,OAAOA,gBAAgB,MAAM,wCAAwC;AACrE,OAAOC,aAAa,MAAM,kCAAkC;AAC5D,OAAOC,QAAQ,MAAM,wBAAwB;AAC7C,OAAOC,kBAAkB,MAAM,qCAAqC;AACpE,OAAOC,WAAW,MAAM,8BAA8B;AACtD,OAAOC,eAAe,MAAM,kCAA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,OAAqB,KAErBF,iBAAiB,CAAC,aAAa,EAAEM,IAAI,EAAE;EACrCH,cAAc,EAAE,CAAC,YAAY,CAAC;EAC9BC,WAAW,EAAEN,eAAe;EAC5B,GAAGI;AACL,CAAC,CAAC;;AAEJ;AACA;AACA,OAAO,MAAMS,SAAS,GAAGA,CACvBL,IAAmB,EACnBJ,OAAqB,KAErBF,iBAAiB,CAAC,QAAQ,EAAEM,IAAI,EAAE;EAChCH,cAAc,EAAE,CAAC,YAAY,CAAC;EAC9BC,WAAW,EAAEN,eAAe;EAC5B,GAAGI;AACL,CAAC,CAAC;;AAEJ;AACA;AACA,OAAO,MAAMU,cAAc,GAAGA,CAC5BN,IAAmB,EACnBJ,OAAqB,KAErBF,iBAAiB,CAAC,aAAa,EAAEM,IAAI,EAAE;EACrCH,cAAc,EAAE,CAAC,aAAa,CAAC;EAC/BC,WAAW,EAAEL,gBAAgB;EAC7B,GAAGG;AACL,CAAC,CAAC","ignoreList":[]}
@@ -0,0 +1,49 @@
1
+ import _startsWithInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/starts-with";
2
+ import { useState, useMemo } from "react";
3
+ import { useLocation, useRouteMatch } from "react-router";
4
+ import Href from "../models/href/Href";
5
+ import { useModularUIBasic } from "./useModularUIBasic";
6
+ const useUrl = (href, fromRoute = false) => {
7
+ const [previousUrl, setPreviousUrl] = useState(null);
8
+ const [previousExact, setPreviousExact] = useState(false);
9
+ const match = useRouteMatch();
10
+ const location = useLocation();
11
+ return useMemo(() => {
12
+ var _context;
13
+ if (href == null && previousUrl == null) {
14
+ return new Href("");
15
+ }
16
+ const url = href instanceof Href ? href : new Href(href);
17
+ if (!fromRoute) {
18
+ return url;
19
+ }
20
+ if (match.isExact) {
21
+ url.addParametersFromString(location.search);
22
+ }
23
+
24
+ // Check equality to prevent unnecessary state updates
25
+ if (url.equalsWithParameters(previousUrl)) {
26
+ return previousUrl || url;
27
+ }
28
+ const shouldUpdate = match.isExact === true || previousExact === match.isExact || !((_context = previousUrl) == null ? void 0 : Function.call.bind(_startsWithInstanceProperty(_context), _context))?.(match.url);
29
+ if (shouldUpdate) {
30
+ setPreviousUrl(url);
31
+ setPreviousExact(match.isExact);
32
+ return url;
33
+ }
34
+ return previousUrl || new Href("");
35
+ }, [href, previousUrl, fromRoute, match.isExact, match.url, previousExact, location.search]);
36
+ };
37
+
38
+ /**
39
+ */
40
+ export const usePanel = (href, options) => {
41
+ const url = useUrl(href, options?.fromRoute || false);
42
+ const basicOptions = {
43
+ expectedModels: ["List", "GroupingPanel", "Detail"],
44
+ origin: options?.origin,
45
+ contextPath: options?.contextPath
46
+ };
47
+ return useModularUIBasic("panel", url, basicOptions);
48
+ };
49
+ //# sourceMappingURL=usePanel.js.map