@beinformed/ui 1.65.7 → 1.65.9

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 (64) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/esm/hooks/__tests__/UseModularUIModel.spec.js.flow +1 -1
  3. package/esm/hooks/index.js +3 -1
  4. package/esm/hooks/index.js.flow +3 -1
  5. package/esm/hooks/index.js.map +1 -1
  6. package/esm/hooks/useForm.js +3 -3
  7. package/esm/hooks/useForm.js.flow +7 -4
  8. package/esm/hooks/useForm.js.map +1 -1
  9. package/esm/hooks/useList.js +37 -26
  10. package/esm/hooks/useList.js.flow +140 -83
  11. package/esm/hooks/useList.js.map +1 -1
  12. package/esm/hooks/useLookup.js +62 -0
  13. package/esm/hooks/useLookup.js.flow +82 -0
  14. package/esm/hooks/useLookup.js.map +1 -0
  15. package/esm/hooks/useModularUIModel.js +0 -17
  16. package/esm/hooks/useModularUIModel.js.flow +0 -25
  17. package/esm/hooks/useModularUIModel.js.map +1 -1
  18. package/esm/hooks/useProgressIndicator.js +21 -6
  19. package/esm/hooks/useProgressIndicator.js.flow +27 -10
  20. package/esm/hooks/useProgressIndicator.js.map +1 -1
  21. package/esm/hooks/useSearch.js +19 -0
  22. package/esm/hooks/useSearch.js.flow +31 -0
  23. package/esm/hooks/useSearch.js.map +1 -0
  24. package/esm/models/attributes/AttributeSetModel.js +1 -1
  25. package/esm/models/attributes/AttributeSetModel.js.flow +1 -1
  26. package/esm/models/attributes/AttributeSetModel.js.map +1 -1
  27. package/esm/models/attributes/ChoiceAttributeModel.js +19 -2
  28. package/esm/models/attributes/ChoiceAttributeModel.js.flow +23 -2
  29. package/esm/models/attributes/ChoiceAttributeModel.js.map +1 -1
  30. package/esm/models/links/LinkModel.js +17 -1
  31. package/esm/models/links/LinkModel.js.flow +18 -1
  32. package/esm/models/links/LinkModel.js.map +1 -1
  33. package/lib/hooks/index.js +26 -4
  34. package/lib/hooks/index.js.map +1 -1
  35. package/lib/hooks/useForm.js +5 -5
  36. package/lib/hooks/useForm.js.map +1 -1
  37. package/lib/hooks/useList.js +37 -26
  38. package/lib/hooks/useList.js.map +1 -1
  39. package/lib/hooks/useLookup.js +70 -0
  40. package/lib/hooks/useLookup.js.map +1 -0
  41. package/lib/hooks/useModularUIModel.js +1 -20
  42. package/lib/hooks/useModularUIModel.js.map +1 -1
  43. package/lib/hooks/useProgressIndicator.js +23 -7
  44. package/lib/hooks/useProgressIndicator.js.map +1 -1
  45. package/lib/hooks/useSearch.js +28 -0
  46. package/lib/hooks/useSearch.js.map +1 -0
  47. package/lib/models/attributes/AttributeSetModel.js +1 -1
  48. package/lib/models/attributes/AttributeSetModel.js.map +1 -1
  49. package/lib/models/attributes/ChoiceAttributeModel.js +18 -1
  50. package/lib/models/attributes/ChoiceAttributeModel.js.map +1 -1
  51. package/lib/models/links/LinkModel.js +17 -0
  52. package/lib/models/links/LinkModel.js.map +1 -1
  53. package/package.json +3 -3
  54. package/src/hooks/__tests__/UseModularUIModel.spec.js +1 -1
  55. package/src/hooks/index.js +3 -1
  56. package/src/hooks/useForm.js +7 -4
  57. package/src/hooks/useList.js +140 -83
  58. package/src/hooks/useLookup.js +82 -0
  59. package/src/hooks/useModularUIModel.js +0 -25
  60. package/src/hooks/useProgressIndicator.js +27 -10
  61. package/src/hooks/useSearch.js +31 -0
  62. package/src/models/attributes/AttributeSetModel.js +1 -1
  63. package/src/models/attributes/ChoiceAttributeModel.js +23 -2
  64. package/src/models/links/LinkModel.js +18 -1
@@ -0,0 +1,62 @@
1
+ import { useEffect, useState } from "react";
2
+ import { HTTP_METHODS } from "../constants";
3
+ import Href from "../models/href/Href";
4
+ import LinkModel from "../models/links/LinkModel";
5
+ import LookupOptionsModel from "../models/lookup/LookupOptionsModel";
6
+ import { useModularUIRequest } from "./useModularUIRequest";
7
+ import { useProgressIndicator } from "./useProgressIndicator";
8
+ /**
9
+ * Lookup options call
10
+ */
11
+ export const useLookup = (lookupLink, filterInput = "", minLength = 2, debounceMs = 300) => {
12
+ const {
13
+ start,
14
+ finish
15
+ } = useProgressIndicator();
16
+ const modularuiRequest = useModularUIRequest();
17
+ const [lookupOptions, setLookupOptions] = useState(null);
18
+ const [lookupLoading, setLookupLoading] = useState(false);
19
+ const {
20
+ href,
21
+ filterName,
22
+ method
23
+ } = lookupLink;
24
+ useEffect(() => {
25
+ if (filterInput.length < minLength) {
26
+ setLookupOptions(null);
27
+ return;
28
+ }
29
+ const timeoutId = setTimeout(async () => {
30
+ setLookupLoading(true);
31
+ start();
32
+ const lookupHref = new Href(href);
33
+ const requestOptions = {
34
+ method,
35
+ data: undefined
36
+ };
37
+ if (method === HTTP_METHODS.POST) {
38
+ requestOptions.data = {
39
+ [filterName]: filterInput
40
+ };
41
+ } else {
42
+ lookupHref.addParameter(filterName, filterInput);
43
+ }
44
+ modularuiRequest(lookupHref, requestOptions).fetch().then(lookupResponse => {
45
+ if (lookupResponse instanceof LookupOptionsModel) {
46
+ setLookupOptions(lookupResponse);
47
+ }
48
+ }).finally(() => {
49
+ finish();
50
+ setLookupLoading(false);
51
+ });
52
+ }, debounceMs);
53
+ return () => {
54
+ clearTimeout(timeoutId);
55
+ };
56
+ }, [debounceMs, filterInput, filterName, finish, href, method, minLength, modularuiRequest, start]);
57
+ return {
58
+ lookupOptions,
59
+ lookupLoading
60
+ };
61
+ };
62
+ //# sourceMappingURL=useLookup.js.map
@@ -0,0 +1,82 @@
1
+ // @flow
2
+ import { useEffect, useState } from "react";
3
+
4
+ import { HTTP_METHODS } from "../constants";
5
+
6
+ import Href from "../models/href/Href";
7
+ import LinkModel from "../models/links/LinkModel";
8
+ import LookupOptionsModel from "../models/lookup/LookupOptionsModel";
9
+
10
+ import { useModularUIRequest } from "./useModularUIRequest";
11
+ import { useProgressIndicator } from "./useProgressIndicator";
12
+
13
+ type UseLookupHook = {
14
+ lookupOptions: LookupOptionsModel | null,
15
+ lookupLoading: boolean,
16
+ };
17
+
18
+ /**
19
+ * Lookup options call
20
+ */
21
+ export const useLookup = (
22
+ lookupLink: LinkModel,
23
+ filterInput: string = "",
24
+ minLength: number = 2,
25
+ debounceMs: number = 300,
26
+ ): UseLookupHook => {
27
+ const { start, finish } = useProgressIndicator();
28
+ const modularuiRequest = useModularUIRequest();
29
+
30
+ const [lookupOptions, setLookupOptions] = useState(null);
31
+ const [lookupLoading, setLookupLoading] = useState(false);
32
+
33
+ const { href, filterName, method } = lookupLink;
34
+
35
+ useEffect(() => {
36
+ if (filterInput.length < minLength) {
37
+ setLookupOptions(null);
38
+ return;
39
+ }
40
+
41
+ const timeoutId = setTimeout(async () => {
42
+ setLookupLoading(true);
43
+ start();
44
+
45
+ const lookupHref = new Href(href);
46
+ const requestOptions = { method, data: undefined };
47
+ if (method === HTTP_METHODS.POST) {
48
+ requestOptions.data = { [filterName]: filterInput };
49
+ } else {
50
+ lookupHref.addParameter(filterName, filterInput);
51
+ }
52
+
53
+ modularuiRequest(lookupHref, requestOptions)
54
+ .fetch()
55
+ .then((lookupResponse) => {
56
+ if (lookupResponse instanceof LookupOptionsModel) {
57
+ setLookupOptions(lookupResponse);
58
+ }
59
+ })
60
+ .finally(() => {
61
+ finish();
62
+ setLookupLoading(false);
63
+ });
64
+ }, debounceMs);
65
+
66
+ return () => {
67
+ clearTimeout(timeoutId);
68
+ };
69
+ }, [
70
+ debounceMs,
71
+ filterInput,
72
+ filterName,
73
+ finish,
74
+ href,
75
+ method,
76
+ minLength,
77
+ modularuiRequest,
78
+ start,
79
+ ]);
80
+
81
+ return { lookupOptions, lookupLoading };
82
+ };
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useLookup.js","names":["useEffect","useState","HTTP_METHODS","Href","LinkModel","LookupOptionsModel","useModularUIRequest","useProgressIndicator","useLookup","lookupLink","filterInput","minLength","debounceMs","start","finish","modularuiRequest","lookupOptions","setLookupOptions","lookupLoading","setLookupLoading","href","filterName","method","length","timeoutId","setTimeout","lookupHref","requestOptions","data","undefined","POST","addParameter","fetch","then","lookupResponse","finally","clearTimeout"],"sources":["../../src/hooks/useLookup.js"],"sourcesContent":["// @flow\nimport { useEffect, useState } from \"react\";\n\nimport { HTTP_METHODS } from \"../constants\";\n\nimport Href from \"../models/href/Href\";\nimport LinkModel from \"../models/links/LinkModel\";\nimport LookupOptionsModel from \"../models/lookup/LookupOptionsModel\";\n\nimport { useModularUIRequest } from \"./useModularUIRequest\";\nimport { useProgressIndicator } from \"./useProgressIndicator\";\n\ntype UseLookupHook = {\n lookupOptions: LookupOptionsModel | null,\n lookupLoading: boolean,\n};\n\n/**\n * Lookup options call\n */\nexport const useLookup = (\n lookupLink: LinkModel,\n filterInput: string = \"\",\n minLength: number = 2,\n debounceMs: number = 300,\n): UseLookupHook => {\n const { start, finish } = useProgressIndicator();\n const modularuiRequest = useModularUIRequest();\n\n const [lookupOptions, setLookupOptions] = useState(null);\n const [lookupLoading, setLookupLoading] = useState(false);\n\n const { href, filterName, method } = lookupLink;\n\n useEffect(() => {\n if (filterInput.length < minLength) {\n setLookupOptions(null);\n return;\n }\n\n const timeoutId = setTimeout(async () => {\n setLookupLoading(true);\n start();\n\n const lookupHref = new Href(href);\n const requestOptions = { method, data: undefined };\n if (method === HTTP_METHODS.POST) {\n requestOptions.data = { [filterName]: filterInput };\n } else {\n lookupHref.addParameter(filterName, filterInput);\n }\n\n modularuiRequest(lookupHref, requestOptions)\n .fetch()\n .then((lookupResponse) => {\n if (lookupResponse instanceof LookupOptionsModel) {\n setLookupOptions(lookupResponse);\n }\n })\n .finally(() => {\n finish();\n setLookupLoading(false);\n });\n }, debounceMs);\n\n return () => {\n clearTimeout(timeoutId);\n };\n }, [\n debounceMs,\n filterInput,\n filterName,\n finish,\n href,\n method,\n minLength,\n modularuiRequest,\n start,\n ]);\n\n return { lookupOptions, lookupLoading };\n};\n"],"mappings":"AACA,SAASA,SAAS,EAAEC,QAAQ,QAAQ,OAAO;AAE3C,SAASC,YAAY,QAAQ,cAAc;AAE3C,OAAOC,IAAI,MAAM,qBAA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UAAU,EAAEC,cAAc,CAAC,CACzCK,KAAK,CAAC,CAAC,CACPC,IAAI,CAAEC,cAAc,IAAK;QACxB,IAAIA,cAAc,YAAY7B,kBAAkB,EAAE;UAChDY,gBAAgB,CAACiB,cAAc,CAAC;QAClC;MACF,CAAC,CAAC,CACDC,OAAO,CAAC,MAAM;QACbrB,MAAM,CAAC,CAAC;QACRK,gBAAgB,CAAC,KAAK,CAAC;MACzB,CAAC,CAAC;IACN,CAAC,EAAEP,UAAU,CAAC;IAEd,OAAO,MAAM;MACXwB,YAAY,CAACZ,SAAS,CAAC;IACzB,CAAC;EACH,CAAC,EAAE,CACDZ,UAAU,EACVF,WAAW,EACXW,UAAU,EACVP,MAAM,EACNM,IAAI,EACJE,MAAM,EACNX,SAAS,EACTI,gBAAgB,EAChBF,KAAK,CACN,CAAC;EAEF,OAAO;IAAEG,aAAa;IAAEE;EAAc,CAAC;AACzC,CAAC","ignoreList":[]}
@@ -3,7 +3,6 @@ import CaseViewModel from "../models/caseview/CaseViewModel";
3
3
  import TabModel from "../models/tab/TabModel";
4
4
  import GroupingPanelModel from "../models/panels/GroupingPanelModel";
5
5
  import DetailModel from "../models/detail/DetailModel";
6
- import CaseSearchModel from "../models/search/CaseSearchModel";
7
6
  import UserProfileModel from "../models/user/UserProfileModel";
8
7
  import { useModularUIBasic } from "./useModularUIBasic";
9
8
  /**
@@ -49,22 +48,6 @@ export const useDetailPanel = (href, options) => useModularUIBasic("detailpanel"
49
48
  ...options
50
49
  });
51
50
 
52
- /**
53
- */
54
- export const useQuicksearch = (href, options) => useModularUIBasic("quicksearch", href, {
55
- expectedModels: ["CaseSearch"],
56
- targetModel: CaseSearchModel,
57
- ...options
58
- });
59
-
60
- /**
61
- */
62
- export const useSearch = (href, options) => useModularUIBasic("search", href, {
63
- expectedModels: ["CaseSearch"],
64
- targetModel: CaseSearchModel,
65
- ...options
66
- });
67
-
68
51
  /**
69
52
  */
70
53
  export const useUserProfile = (href, options) => useModularUIBasic("userprofile", href, {
@@ -4,7 +4,6 @@ import CaseViewModel from "../models/caseview/CaseViewModel";
4
4
  import TabModel from "../models/tab/TabModel";
5
5
  import GroupingPanelModel from "../models/panels/GroupingPanelModel";
6
6
  import DetailModel from "../models/detail/DetailModel";
7
- import CaseSearchModel from "../models/search/CaseSearchModel";
8
7
  import UserProfileModel from "../models/user/UserProfileModel";
9
8
 
10
9
  import { useModularUIBasic } from "./useModularUIBasic";
@@ -74,30 +73,6 @@ export const useDetailPanel = (
74
73
  ...options,
75
74
  });
76
75
 
77
- /**
78
- */
79
- export const useQuicksearch = (
80
- href: string | Href,
81
- options?: HookOptions,
82
- ): CaseSearchModel | null =>
83
- useModularUIBasic("quicksearch", href, {
84
- expectedModels: ["CaseSearch"],
85
- targetModel: CaseSearchModel,
86
- ...options,
87
- });
88
-
89
- /**
90
- */
91
- export const useSearch = (
92
- href: string | Href,
93
- options?: HookOptions,
94
- ): CaseSearchModel | null =>
95
- useModularUIBasic("search", href, {
96
- expectedModels: ["CaseSearch"],
97
- targetModel: CaseSearchModel,
98
- ...options,
99
- });
100
-
101
76
  /**
102
77
  */
103
78
  export const useUserProfile = (
@@ -1 +1 @@
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"],"mapp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ErBF,iBAAiB,CAAC,aAAa,EAAEM,IAAI,EAAE;EACrCH,cAAc,EAAE,CAAC,QAAQ,CAAC;EAC1BC,WAAW,EAAEP,WAAW;EACxB,GAAGK;AACL,CAAC,CAAC;;AAEJ;AACA;AACA,OAAO,MAAMQ,cAAc,GAAGA,CAC5BJ,IAAmB,EACnBJ,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":[]}
1
+ {"version":3,"file":"useModularUIModel.js","names":["ApplicationModel","CaseViewModel","TabModel","GroupingPanelModel","DetailModel","UserProfileModel","useModularUIBasic","useApplication","options","expectedModels","targetModel","useTab","href","useCaseView","useGroupingPanel","useDetailPanel","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 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 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,gBAAgB,MAAM,iCAAiC;AAE9D,SAASC,iBAAiB,QAAQ,qBAAqB;AAKvD;AACA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AAC;EAC/BC,WAAW,EAAEL,gBAAgB;EAC7B,GAAGG;AACL,CAAC,CAAC","ignoreList":[]}
@@ -1,16 +1,31 @@
1
1
  import { useDispatch, useSelector } from "react-redux";
2
2
  import { startProgress, finishProgress, resetProgress, updateProgress } from "../redux/actions/ProgressIndicator";
3
+ import { useCallback } from "react";
3
4
  /**
4
5
  */
5
6
  export const useProgressIndicator = () => {
6
7
  const dispatch = useDispatch();
7
- const progress = useSelector(state => state.progressindicator);
8
+ const start = useCallback(() => {
9
+ dispatch(startProgress());
10
+ }, [dispatch]);
11
+ const finish = useCallback(() => {
12
+ dispatch(finishProgress());
13
+ }, [dispatch]);
14
+ const reset = useCallback(() => {
15
+ dispatch(resetProgress());
16
+ }, [dispatch]);
17
+ const update = useCallback(percentComplete => {
18
+ dispatch(updateProgress(percentComplete));
19
+ }, [dispatch]);
8
20
  return {
9
- ...progress,
10
- start: () => dispatch(startProgress()),
11
- finish: () => dispatch(finishProgress()),
12
- reset: () => dispatch(resetProgress()),
13
- update: percentComplete => dispatch(updateProgress(percentComplete))
21
+ start,
22
+ finish,
23
+ reset,
24
+ update
14
25
  };
15
26
  };
27
+
28
+ /**
29
+ */
30
+ export const useProgressIndicatorState = () => useSelector(state => state.progressindicator);
16
31
  //# sourceMappingURL=useProgressIndicator.js.map
@@ -7,27 +7,44 @@ import {
7
7
  updateProgress,
8
8
  } from "../redux/actions/ProgressIndicator";
9
9
  import type { ProgressIndicatorState } from "../redux/types";
10
+ import { useCallback } from "react";
10
11
 
11
12
  type ProgressIndicatorHook = {
12
- ...ProgressIndicatorState,
13
13
  start: () => void,
14
14
  finish: () => void,
15
15
  reset: () => void,
16
16
  update: (percentComplete: number) => void,
17
17
  };
18
18
 
19
+ type ProgressIndicatorStateHook = {
20
+ ...ProgressIndicatorState,
21
+ };
22
+
19
23
  /**
20
24
  */
21
25
  export const useProgressIndicator = (): ProgressIndicatorHook => {
22
26
  const dispatch = useDispatch();
23
- const progress = useSelector((state) => state.progressindicator);
24
27
 
25
- return {
26
- ...progress,
27
- start: () => dispatch(startProgress()),
28
- finish: () => dispatch(finishProgress()),
29
- reset: () => dispatch(resetProgress()),
30
- update: (percentComplete: number) =>
31
- dispatch(updateProgress(percentComplete)),
32
- };
28
+ const start = useCallback(() => {
29
+ dispatch(startProgress());
30
+ }, [dispatch]);
31
+ const finish = useCallback(() => {
32
+ dispatch(finishProgress());
33
+ }, [dispatch]);
34
+ const reset = useCallback(() => {
35
+ dispatch(resetProgress());
36
+ }, [dispatch]);
37
+ const update = useCallback(
38
+ (percentComplete: number) => {
39
+ dispatch(updateProgress(percentComplete));
40
+ },
41
+ [dispatch],
42
+ );
43
+
44
+ return { start, finish, reset, update };
33
45
  };
46
+
47
+ /**
48
+ */
49
+ export const useProgressIndicatorState = (): ProgressIndicatorStateHook =>
50
+ useSelector((state) => state.progressindicator);
@@ -1 +1 @@
1
- {"version":3,"file":"useProgressIndicator.js","names":["useDispatch","useSelector","startProgress","finishProgress","resetProgress","updateProgress","useProgressIndicator","dispatch","progress","state","progressindicator","start","finish","reset","update","percentComplete"],"sources":["../../src/hooks/useProgressIndicator.js"],"sourcesContent":["// @flow\nimport { useDispatch, useSelector } from \"react-redux\";\nimport {\n startProgress,\n finishProgress,\n resetProgress,\n updateProgress,\n} from \"../redux/actions/ProgressIndicator\";\nimport type { ProgressIndicatorState } from \"../redux/types\";\n\ntype ProgressIndicatorHook = {\n ...ProgressIndicatorState,\n start: () => void,\n finish: () => void,\n reset: () => void,\n update: (percentComplete: number) => void,\n};\n\n/**\n */\nexport const useProgressIndicator = (): ProgressIndicatorHook => {\n const dispatch = useDispatch();\n const progress = useSelector((state) => state.progressindicator);\n\n return {\n ...progress,\n start: () => dispatch(startProgress()),\n finish: () => dispatch(finishProgress()),\n reset: () => dispatch(resetProgress()),\n update: (percentComplete: number) =>\n dispatch(updateProgress(percentComplete)),\n };\n};\n"],"mappings":"AACA,SAASA,WAAW,EAAEC,WAAW,QAAQ,aAAa;AACtD,SACEC,aAAa,EACbC,cAAc,EACdC,aAAa,EACbC,cAAc,QACT,oCAAoC;AAW3C;AACA;AACA,OAAO,MAAMC,oBAAoB,GAAGA,CAAA,KAA6B;EAC/D,MAAMC,QAAQ,GAAGP,WAAW,CAAC,CAAC;EAC9B,MAAMQ,QAAQ,GAAGP,WAAW,CAAEQ,KAAK,IAAKA,KAAK,CAACC,iBAAiB,CAAC;EAEhE,OAAO;IACL,GAAGF,QAAQ;IACXG,KAAK,EAAEA,CAAA,KAAMJ,QAAQ,CAACL,aAAa,CAAC,CAAC,CAAC;IACtCU,MAAM,EAAEA,CAAA,KAAML,QAAQ,CAACJ,cAAc,CAAC,CAAC,CAAC;IACxCU,KAAK,EAAEA,CAAA,KAAMN,QAAQ,CAACH,aAAa,CAAC,CAAC,CAAC;IACtCU,MAAM,EAAGC,eAAuB,IAC9BR,QAAQ,CAACF,cAAc,CAACU,eAAe,CAAC;EAC5C,CAAC;AACH,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"useProgressIndicator.js","names":["useDispatch","useSelector","startProgress","finishProgress","resetProgress","updateProgress","useCallback","useProgressIndicator","dispatch","start","finish","reset","update","percentComplete","useProgressIndicatorState","state","progressindicator"],"sources":["../../src/hooks/useProgressIndicator.js"],"sourcesContent":["// @flow\nimport { useDispatch, useSelector } from \"react-redux\";\nimport {\n startProgress,\n finishProgress,\n resetProgress,\n updateProgress,\n} from \"../redux/actions/ProgressIndicator\";\nimport type { ProgressIndicatorState } from \"../redux/types\";\nimport { useCallback } from \"react\";\n\ntype ProgressIndicatorHook = {\n start: () => void,\n finish: () => void,\n reset: () => void,\n update: (percentComplete: number) => void,\n};\n\ntype ProgressIndicatorStateHook = {\n ...ProgressIndicatorState,\n};\n\n/**\n */\nexport const useProgressIndicator = (): ProgressIndicatorHook => {\n const dispatch = useDispatch();\n\n const start = useCallback(() => {\n dispatch(startProgress());\n }, [dispatch]);\n const finish = useCallback(() => {\n dispatch(finishProgress());\n }, [dispatch]);\n const reset = useCallback(() => {\n dispatch(resetProgress());\n }, [dispatch]);\n const update = useCallback(\n (percentComplete: number) => {\n dispatch(updateProgress(percentComplete));\n },\n [dispatch],\n );\n\n return { start, finish, reset, update };\n};\n\n/**\n */\nexport const useProgressIndicatorState = (): ProgressIndicatorStateHook =>\n useSelector((state) => state.progressindicator);\n"],"mappings":"AACA,SAASA,WAAW,EAAEC,WAAW,QAAQ,aAAa;AACtD,SACEC,aAAa,EACbC,cAAc,EACdC,aAAa,EACbC,cAAc,QACT,oCAAoC;AAE3C,SAASC,WAAW,QAAQ,OAAO;AAanC;AACA;AACA,OAAO,MAAMC,oBAAoB,GAAGA,CAAA,KAA6B;EAC/D,MAAMC,QAAQ,GAAGR,WAAW,CAAC,CAAC;EAE9B,MAAMS,KAAK,GAAGH,WAAW,CAAC,MAAM;IAC9BE,QAAQ,CAACN,aAAa,CAAC,CAAC,CAAC;EAC3B,CAAC,EAAE,CAACM,QAAQ,CAAC,CAAC;EACd,MAAME,MAAM,GAAGJ,WAAW,CAAC,MAAM;IAC/BE,QAAQ,CAACL,cAAc,CAAC,CAAC,CAAC;EAC5B,CAAC,EAAE,CAACK,QAAQ,CAAC,CAAC;EACd,MAAMG,KAAK,GAAGL,WAAW,CAAC,MAAM;IAC9BE,QAAQ,CAACJ,aAAa,CAAC,CAAC,CAAC;EAC3B,CAAC,EAAE,CAACI,QAAQ,CAAC,CAAC;EACd,MAAMI,MAAM,GAAGN,WAAW,CACvBO,eAAuB,IAAK;IAC3BL,QAAQ,CAACH,cAAc,CAACQ,eAAe,CAAC,CAAC;EAC3C,CAAC,EACD,CAACL,QAAQ,CACX,CAAC;EAED,OAAO;IAAEC,KAAK;IAAEC,MAAM;IAAEC,KAAK;IAAEC;EAAO,CAAC;AACzC,CAAC;;AAED;AACA;AACA,OAAO,MAAME,yBAAyB,GAAGA,CAAA,KACvCb,WAAW,CAAEc,KAAK,IAAKA,KAAK,CAACC,iBAAiB,CAAC","ignoreList":[]}
@@ -0,0 +1,19 @@
1
+ import Href from "../models/href/Href";
2
+ import CaseSearchModel from "../models/search/CaseSearchModel";
3
+ import { useModularUIBasic } from "./useModularUIBasic";
4
+ /**
5
+ */
6
+ export const useQuicksearch = (href, options) => useModularUIBasic("quicksearch", href, {
7
+ expectedModels: ["CaseSearch"],
8
+ targetModel: CaseSearchModel,
9
+ ...options
10
+ });
11
+
12
+ /**
13
+ */
14
+ export const useSearch = (href, options) => useModularUIBasic("search", href, {
15
+ expectedModels: ["CaseSearch"],
16
+ targetModel: CaseSearchModel,
17
+ ...options
18
+ });
19
+ //# sourceMappingURL=useSearch.js.map
@@ -0,0 +1,31 @@
1
+ // @flow
2
+ import Href from "../models/href/Href";
3
+ import CaseSearchModel from "../models/search/CaseSearchModel";
4
+
5
+ import { useModularUIBasic } from "./useModularUIBasic";
6
+
7
+ import type { HookOptions } from "./useModularUIBasic";
8
+
9
+ /**
10
+ */
11
+ export const useQuicksearch = (
12
+ href: string | Href,
13
+ options?: HookOptions,
14
+ ): CaseSearchModel | null =>
15
+ useModularUIBasic("quicksearch", href, {
16
+ expectedModels: ["CaseSearch"],
17
+ targetModel: CaseSearchModel,
18
+ ...options,
19
+ });
20
+
21
+ /**
22
+ */
23
+ export const useSearch = (
24
+ href: string | Href,
25
+ options?: HookOptions,
26
+ ): CaseSearchModel | null =>
27
+ useModularUIBasic("search", href, {
28
+ expectedModels: ["CaseSearch"],
29
+ targetModel: CaseSearchModel,
30
+ ...options,
31
+ });
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useSearch.js","names":["Href","CaseSearchModel","useModularUIBasic","useQuicksearch","href","options","expectedModels","targetModel","useSearch"],"sources":["../../src/hooks/useSearch.js"],"sourcesContent":["// @flow\nimport Href from \"../models/href/Href\";\nimport CaseSearchModel from \"../models/search/CaseSearchModel\";\n\nimport { useModularUIBasic } from \"./useModularUIBasic\";\n\nimport type { HookOptions } from \"./useModularUIBasic\";\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"],"mappings":"AACA,OAAOA,IAAI,MAAM,qBAAqB;AACtC,OAAOC,eAAe,MAAM,kCAAkC;AAE9D,SAASC,iBAAiB,QAAQ,qBAAqB;AAIvD;AACA;AACA,OAAO,MAAMC,cAAc,GAAGA,CAC5BC,IAAmB,EACnBC,OAAqB,KAErBH,iBAAiB,CAAC,aAAa,EAAEE,IAAI,EAAE;EACrCE,cAAc,EAAE,CAAC,YAAY,CAAC;EAC9BC,WAAW,EAAEN,eAAe;EAC5B,GAAGI;AACL,CAAC,CAAC;;AAEJ;AACA;AACA,OAAO,MAAMG,SAAS,GAAGA,CACvBJ,IAAmB,EACnBC,OAAqB,KAErBH,iBAAiB,CAAC,QAAQ,EAAEE,IAAI,EAAE;EAChCE,cAAc,EAAE,CAAC,YAAY,CAAC;EAC9BC,WAAW,EAAEN,eAAe;EAC5B,GAAGI;AACL,CAAC,CAAC","ignoreList":[]}
@@ -68,7 +68,7 @@ export default class AttributeSetModel extends BaseModel {
68
68
  }
69
69
 
70
70
  /**
71
- * Retrieve child {@code AttributeSetModel}s
71
+ * Retrieve child AttributeSetModels
72
72
  */
73
73
  getChildAttributeSets() {
74
74
  if (!this.contributions.objects) {
@@ -89,7 +89,7 @@ export default class AttributeSetModel extends BaseModel {
89
89
  }
90
90
 
91
91
  /**
92
- * Retrieve child {@code AttributeSetModel}s
92
+ * Retrieve child AttributeSetModels
93
93
  */
94
94
  getChildAttributeSets(): Array<AttributeSetModel> {
95
95
  if (!this.contributions.objects) {
@@ -1 +1 @@
1
- {"version":3,"file":"AttributeSetModel.js","names":["has","BaseModel","AttributeCollection","AttributeSetModel","constructor","key","data","contributions","modelOptions","_context","_defineProperty","attributeContributions","attributes","_filterInstanceProperty","call","contribution","contributionKey","_Object$keys","_attributeCollection","isReadonly","_key","label","attributeCollection","collection","createChildAttributeSetModel","dataObject","index","dynamicschema","objects","getChildAttributeSets","childAttributeSets","Array","isArray","i","_entriesInstanceProperty","_context2","push"],"sources":["../../../src/models/attributes/AttributeSetModel.js"],"sourcesContent":["// @flow\nimport { has } from \"../../utils/helpers/objects\";\n\nimport BaseModel from \"../base/BaseModel\";\nimport AttributeCollection from \"./AttributeCollection\";\n\nimport type { ModelOptions } from \"../types\";\n\n/**\n */\nexport default class AttributeSetModel extends BaseModel {\n _key: string;\n _attributeCollection: AttributeCollection;\n\n /**\n */\n constructor(\n key: string = \"\",\n data: Object = {},\n contributions: Object = {},\n modelOptions?: ModelOptions,\n ) {\n super(data, contributions, modelOptions);\n\n const attributeContributions = this.contributions.attributes\n ? this.contributions.attributes.filter((contribution) => {\n const [contributionKey] = Object.keys(contribution);\n return has(this.data, contributionKey);\n })\n : [];\n\n this._attributeCollection = new AttributeCollection(\n this.data,\n attributeContributions,\n { ...modelOptions, isReadonly: true },\n );\n\n this._key = key;\n }\n\n /**\n */\n get key(): string {\n return this._key;\n }\n\n /**\n */\n set key(key: string) {\n this._key = key;\n }\n\n /**\n */\n get label(): ?string {\n return this.contributions.label;\n }\n\n /**\n * Retrieve attribute collection\n */\n get attributeCollection(): AttributeCollection {\n return this._attributeCollection;\n }\n\n /**\n * Set the attributes with a new AttributeCollection\n */\n set attributeCollection(collection: AttributeCollection) {\n this._attributeCollection = collection;\n }\n\n /**\n */\n createChildAttributeSetModel(\n key: string,\n dataObject: Object,\n index?: number,\n ): AttributeSetModel {\n return new AttributeSetModel(\n index ? `${key}-${index + 1}` : key,\n {\n ...dataObject,\n dynamicschema: this.data.dynamicschema,\n },\n this.contributions.objects[key],\n this.modelOptions,\n );\n }\n\n /**\n * Retrieve child {@code AttributeSetModel}s\n */\n getChildAttributeSets(): Array<AttributeSetModel> {\n if (!this.contributions.objects) {\n return [];\n }\n\n const childAttributeSets = [];\n for (const key of Object.keys(this.contributions.objects)) {\n if (key in this.data) {\n if (Array.isArray(this.data[key])) {\n for (const [i, dataObject] of this.data[key].entries()) {\n childAttributeSets.push(\n this.createChildAttributeSetModel(key, dataObject, i),\n );\n }\n } else {\n childAttributeSets.push(\n this.createChildAttributeSetModel(key, this.data[key]),\n );\n }\n }\n }\n return childAttributeSets;\n }\n}\n"],"mappings":";;;;AACA,SAASA,GAAG,QAAQ,6BAA6B;AAEjD,OAAOC,SAAS,MAAM,mBAAmB;AACzC,OAAOC,mBAAmB,MAAM,uBAAuB;AAIvD;AACA;AACA,eAAe,MAAMC,iBAAiB,SAASF,SAAS,CAAC;EAIvD;AACF;EACEG,WAAWA,CACTC,GAAW,GAAG,EAAE,EAChBC,IAAY,GAAG,CAAC,CAAC,EACjBC,aAAqB,GAAG,CAAC,CAAC,EAC1BC,YAA2B,EAC3B;IAAA,IAAAC,QAAA;IACA,KAAK,CAACH,IAAI,EAAEC,aAAa,EAAEC,YAAY,CAAC;IAACE,eAAA;IAAAA,eAAA;IAEzC,MAAMC,sBAAsB,GAAG,IAAI,CAACJ,aAAa,CAACK,UAAU,GACxDC,uBAAA,CAAAJ,QAAA,OAAI,CAACF,aAAa,CAACK,UAAU,EAAAE,IAAA,CAAAL,QAAA,EAASM,YAAY,IAAK;MACrD,MAAM,CAACC,eAAe,CAAC,GAAGC,YAAA,CAAYF,YAAY,CAAC;MACnD,OAAOf,GAAG,CAAC,IAAI,CAACM,IAAI,EAAEU,eAAe,CAAC;IACxC,CAAC,CAAC,GACF,EAAE;IAEN,IAAI,CAACE,oBAAoB,GAAG,IAAIhB,mBAAmB,CACjD,IAAI,CAACI,IAAI,EACTK,sBAAsB,EACtB;MAAE,GAAGH,YAAY;MAAEW,UAAU,EAAE;IAAK,CACtC,CAAC;IAED,IAAI,CAACC,IAAI,GAAGf,GAAG;EACjB;;EAEA;AACF;EACE,IAA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AU,CAAC,IAAIS,wBAAA,CAAAC,SAAA,OAAI,CAAC7B,IAAI,CAACD,GAAG,CAAC,EAAAS,IAAA,CAAAqB,SAAS,CAAC,EAAE;YAAA,IAAAA,SAAA;YACtDL,kBAAkB,CAACM,IAAI,CACrB,IAAI,CAACZ,4BAA4B,CAACnB,GAAG,EAAEoB,UAAU,EAAEQ,CAAC,CACtD,CAAC;UACH;QACF,CAAC,MAAM;UACLH,kBAAkB,CAACM,IAAI,CACrB,IAAI,CAACZ,4BAA4B,CAACnB,GAAG,EAAE,IAAI,CAACC,IAAI,CAACD,GAAG,CAAC,CACvD,CAAC;QACH;MACF;IACF;IACA,OAAOyB,kBAAkB;EAC3B;AACF","ignoreList":[]}
1
+ {"version":3,"file":"AttributeSetModel.js","names":["has","BaseModel","AttributeCollection","AttributeSetModel","constructor","key","data","contributions","modelOptions","_context","_defineProperty","attributeContributions","attributes","_filterInstanceProperty","call","contribution","contributionKey","_Object$keys","_attributeCollection","isReadonly","_key","label","attributeCollection","collection","createChildAttributeSetModel","dataObject","index","dynamicschema","objects","getChildAttributeSets","childAttributeSets","Array","isArray","i","_entriesInstanceProperty","_context2","push"],"sources":["../../../src/models/attributes/AttributeSetModel.js"],"sourcesContent":["// @flow\nimport { has } from \"../../utils/helpers/objects\";\n\nimport BaseModel from \"../base/BaseModel\";\nimport AttributeCollection from \"./AttributeCollection\";\n\nimport type { ModelOptions } from \"../types\";\n\n/**\n */\nexport default class AttributeSetModel extends BaseModel {\n _key: string;\n _attributeCollection: AttributeCollection;\n\n /**\n */\n constructor(\n key: string = \"\",\n data: Object = {},\n contributions: Object = {},\n modelOptions?: ModelOptions,\n ) {\n super(data, contributions, modelOptions);\n\n const attributeContributions = this.contributions.attributes\n ? this.contributions.attributes.filter((contribution) => {\n const [contributionKey] = Object.keys(contribution);\n return has(this.data, contributionKey);\n })\n : [];\n\n this._attributeCollection = new AttributeCollection(\n this.data,\n attributeContributions,\n { ...modelOptions, isReadonly: true },\n );\n\n this._key = key;\n }\n\n /**\n */\n get key(): string {\n return this._key;\n }\n\n /**\n */\n set key(key: string) {\n this._key = key;\n }\n\n /**\n */\n get label(): ?string {\n return this.contributions.label;\n }\n\n /**\n * Retrieve attribute collection\n */\n get attributeCollection(): AttributeCollection {\n return this._attributeCollection;\n }\n\n /**\n * Set the attributes with a new AttributeCollection\n */\n set attributeCollection(collection: AttributeCollection) {\n this._attributeCollection = collection;\n }\n\n /**\n */\n createChildAttributeSetModel(\n key: string,\n dataObject: Object,\n index?: number,\n ): AttributeSetModel {\n return new AttributeSetModel(\n index ? `${key}-${index + 1}` : key,\n {\n ...dataObject,\n dynamicschema: this.data.dynamicschema,\n },\n this.contributions.objects[key],\n this.modelOptions,\n );\n }\n\n /**\n * Retrieve child AttributeSetModels\n */\n getChildAttributeSets(): Array<AttributeSetModel> {\n if (!this.contributions.objects) {\n return [];\n }\n\n const childAttributeSets = [];\n for (const key of Object.keys(this.contributions.objects)) {\n if (key in this.data) {\n if (Array.isArray(this.data[key])) {\n for (const [i, dataObject] of this.data[key].entries()) {\n childAttributeSets.push(\n this.createChildAttributeSetModel(key, dataObject, i),\n );\n }\n } else {\n childAttributeSets.push(\n this.createChildAttributeSetModel(key, this.data[key]),\n );\n }\n }\n }\n return childAttributeSets;\n }\n}\n"],"mappings":";;;;AACA,SAASA,GAAG,QAAQ,6BAA6B;AAEjD,OAAOC,SAAS,MAAM,mBAAmB;AACzC,OAAOC,mBAAmB,MAAM,uBAAuB;AAIvD;AACA;AACA,eAAe,MAAMC,iBAAiB,SAASF,SAAS,CAAC;EAIvD;AACF;EACEG,WAAWA,CACTC,GAAW,GAAG,EAAE,EAChBC,IAAY,GAAG,CAAC,CAAC,EACjBC,aAAqB,GAAG,CAAC,CAAC,EAC1BC,YAA2B,EAC3B;IAAA,IAAAC,QAAA;IACA,KAAK,CAACH,IAAI,EAAEC,aAAa,EAAEC,YAAY,CAAC;IAACE,eAAA;IAAAA,eAAA;IAEzC,MAAMC,sBAAsB,GAAG,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Aa,CAACqB,OAAO,CAACvB,GAAG,CAAC,EAC/B,IAAI,CAACG,YACP,CAAC;EACH;;EAEA;AACF;AACA;EACEqB,qBAAqBA,CAAA,EAA6B;IAChD,IAAI,CAAC,IAAI,CAACtB,aAAa,CAACqB,OAAO,EAAE;MAC/B,OAAO,EAAE;IACX;IAEA,MAAME,kBAAkB,GAAG,EAAE;IAC7B,KAAK,MAAMzB,GAAG,IAAIY,YAAA,CAAY,IAAI,CAACV,aAAa,CAACqB,OAAO,CAAC,EAAE;MACzD,IAAIvB,GAAG,IAAI,IAAI,CAACC,IAAI,EAAE;QACpB,IAAIyB,KAAK,CAACC,OAAO,CAAC,IAAI,CAAC1B,IAAI,CAACD,GAAG,CAAC,CAAC,EAAE;UACjC,KAAK,MAAM,CAAC4B,CAAC,EAAER,UAAU,CAAC,IAAIS,wBAAA,CAAAC,SAAA,OAAI,CAAC7B,IAAI,CAACD,GAAG,CAAC,EAAAS,IAAA,CAAAqB,SAAS,CAAC,EAAE;YAAA,IAAAA,SAAA;YACtDL,kBAAkB,CAACM,IAAI,CACrB,IAAI,CAACZ,4BAA4B,CAACnB,GAAG,EAAEoB,UAAU,EAAEQ,CAAC,CACtD,CAAC;UACH;QACF,CAAC,MAAM;UACLH,kBAAkB,CAACM,IAAI,CACrB,IAAI,CAACZ,4BAA4B,CAACnB,GAAG,EAAE,IAAI,CAACC,IAAI,CAACD,GAAG,CAAC,CACvD,CAAC;QACH;MACF;IACF;IACA,OAAOyB,kBAAkB;EAC3B;AACF","ignoreList":[]}
@@ -10,7 +10,7 @@ import ChoiceAttributeOptionModel from "./ChoiceAttributeOptionModel";
10
10
  import CompositeAttributeModel from "./CompositeAttributeModel";
11
11
  import ContentConfigurationElements from "../contentconfiguration/ContentConfigurationElements";
12
12
  import { RENDER_SECTION_LABEL, SORT_OPTIONS } from "../../constants/LayoutHints";
13
- import { ATTRIBUTE_WIDTH } from "../../constants";
13
+ import { ATTRIBUTE_WIDTH, PARAMETER_TYPES, HTTP_METHODS } from "../../constants";
14
14
  /**
15
15
  * Model for a choice attribute
16
16
  */
@@ -89,7 +89,24 @@ export default class ChoiceAttributeModel extends AttributeModel {
89
89
  * Retrieve lookup service link
90
90
  */
91
91
  get lookupLink() {
92
- return this.links.getLinkByKey("lookupOptions");
92
+ const link = this.links.getLinkByKey("lookupOptions");
93
+ if (link && this.lookupParameterType === PARAMETER_TYPES.BODY) {
94
+ link.method = HTTP_METHODS.POST;
95
+ }
96
+ return link;
97
+ }
98
+
99
+ /**
100
+ * Indicate if the lookup must be done with POST or GET
101
+ */
102
+ get lookupParameterType() {
103
+ const parameterType = this.getContribution("parameterType");
104
+ switch (parameterType) {
105
+ case "bodyParameter":
106
+ return PARAMETER_TYPES.BODY;
107
+ default:
108
+ return PARAMETER_TYPES.QUERY;
109
+ }
93
110
  }
94
111
 
95
112
  /**
@@ -13,7 +13,11 @@ import {
13
13
  RENDER_SECTION_LABEL,
14
14
  SORT_OPTIONS,
15
15
  } from "../../constants/LayoutHints";
16
- import { ATTRIBUTE_WIDTH } from "../../constants";
16
+ import {
17
+ ATTRIBUTE_WIDTH,
18
+ PARAMETER_TYPES,
19
+ HTTP_METHODS,
20
+ } from "../../constants";
17
21
 
18
22
  import type {
19
23
  ModularUIModel,
@@ -133,7 +137,24 @@ export default class ChoiceAttributeModel extends AttributeModel {
133
137
  * Retrieve lookup service link
134
138
  */
135
139
  get lookupLink(): LinkModel | null {
136
- return this.links.getLinkByKey("lookupOptions");
140
+ const link = this.links.getLinkByKey("lookupOptions");
141
+ if (link && this.lookupParameterType === PARAMETER_TYPES.BODY) {
142
+ link.method = HTTP_METHODS.POST;
143
+ }
144
+ return link;
145
+ }
146
+
147
+ /**
148
+ * Indicate if the lookup must be done with POST or GET
149
+ */
150
+ get lookupParameterType(): $Values<typeof PARAMETER_TYPES> {
151
+ const parameterType = this.getContribution("parameterType");
152
+ switch (parameterType) {
153
+ case "bodyParameter":
154
+ return PARAMETER_TYPES.BODY;
155
+ default:
156
+ return PARAMETER_TYPES.QUERY;
157
+ }
137
158
  }
138
159
 
139
160
  /**